<?php ob_start();
$PageSecurity = 2;
include('includes/session.inc');
include('includes/SQL_CommonFunctions.inc');

$data1='';
$data2='';
if($_REQUEST['branch']!='')
{
		 // vendor Data
		  $sql_vendor ="Select id,vendor_code,vendor_name from suppliers where site='".$_REQUEST['branch']."'";
		 $result_vendor = DB_query($sql_vendor,$db);
       $data1.='<option value="0">Select</option>';
		while ($vendorData=DB_fetch_array($result_vendor))
		{
		if($_REQUEST['vendor']==$vendorData['id']) { $p='selected';} else { $p=''; }
        $data1.='<option value="'.$vendorData['id'].'" '.$p.'>'.$vendorData['vendor_name'].'</option>';
		}
		
		// Job Work Data
		  $sql_Job ="select id,jobNumber from job_work where site = '".$_REQUEST['branch']."' and CompanyId='".$_SESSION['ACGCompanyId']."' and vendor='".$_REQUEST['vendor']."' and status='0'";
		 $result_Job = DB_query($sql_Job,$db);
       $data2.='<option value="0">Select</option>';
		while ($JobData=DB_fetch_array($result_Job))
		{
		if($_REQUEST['jobNumber']==$JobData['id']) { $t='selected';} else { $t=''; }
        $data2.='<option value="'.$JobData['id'].'" '.$t.'>'.$JobData['jobNumber'].'</option>';
		}
      
      $store_sql = "SELECT id, StoreName,StoreCode FROM storetype where Store_Site = '".$_GET['branch']."'";
	
	$data3='';
		$data3.="<select name='store'  style='width:100%' id='store'    >";
								
 			$store_result = DB_query($store_sql,$db);
			while($store_row = DB_fetch_array($store_result))
			{
				
				$p='';
				if($store_row['id'] == $_POST['store'])
				$p="selected";
			
			
		$data3.="<option value=".$store_row['id']." ".$p.">".$store_row['StoreName']."</option>";
			 }
			
			$data3.="</select>";
}
echo $data=$data1.'__'.$data2.'__'.$data3;
?>