<?php
include("../../classes/manager.class.php");
$m = new Manager();
$id = $_REQUEST['id'];

$ids = explode(",", $id);

if(!empty($ids) && (isset($ids[1]) || $ids[0] != "All")){
    //print_r($ids);
    if(in_array("All", $ids)){
        //echo 'asdasdsa';
        $idKey = array_search('All', $ids);
        unset($ids[$idKey]);
    }
    $idString = implode("','", $ids);
}
if ($ids) {
    $customersfilter = " WHERE status = 'active' AND is_mart = 1 AND middle_man IN ('$idString') ORDER BY name";
    $qry = CustomerSetup::GetCustomerSetupList($customersfilter);
    if($qry)
    {
        echo '<option>All</option>';
        foreach($qry AS $row){
            if($row->status != 'Draft'){
                echo '<option value="'.$row->id.'">'.$row->name.'</option>';
            }
        }
    }else{
        echo '<option>All</option>';
    }
}
?>