<?php
$PageSecurity=2;
include('includes/session.inc');
include('includes/function_lib.php');
include('includes/SQL_CommonFunctions.inc');
include('includes/AccountGroupMaster_Class.php');
global $db;

if($_REQUEST['section']!=''){
switch($_REQUEST['section'])
{
case 'Drledgername':
$tst_st = $_REQUEST['site'];
//$tst_st = $_REQUEST['site'];
?><option value="0">ALL</option>		
<?php
$AccountMaster-> AccountLegerNew($ledger_dr,'ledger_dr[]','ledgerdr',urldecode($_REQUEST['group']),$tst_st); ?>
<?php
break;

case 'Drledgername_transaction':
$tst_st = $_REQUEST['site'];
//$tst_st = $_REQUEST['site'];
?><option value="0">Please Select Ledger</option>		
<?php
$AccountMaster-> AccountLegerNew($ledger_dr,'ledger_dr[]','ledgerdr',urldecode($_REQUEST['group']),$tst_st); ?>
<?php
break;


case 'Drledgernameledger':
$tst_st = $_REQUEST['site'];
//$tst_st = $_REQUEST['site'];
?><option value="0">Select ledger</option>		
<?php
$AccountMaster-> AccountLegerNewledgerday($ledger_dr,'ledger_dr[]','ledgerdr',urldecode($_REQUEST['group']),$tst_st); ?>
<?php
break;


case 'Vendornamepurch':
$tst_st = $_REQUEST['site'];
//$tst_st = $_REQUEST['site'];
?>
<select name="vendor" id="vendor" class="select_purch"  style="width:150px;">
	<option value="0">Select Vendor</option>
	<?php 
	$sqlvendor=DB_query("select id,vendor_name from suppliers where find_in_set('".$tst_st."',site)",$db);
	while($resultVendor=DB_fetch_array($sqlvendor))
	{
	?>
	<option value="<?php echo $resultVendor['id']; ?>"><?php echo $resultVendor['vendor_name']; ?></option>
	<?php } ?>
	</select>

<?php 
break; 

case 'VendornameFormA':
$tst_st = $_REQUEST['site'];
//$tst_st = $_REQUEST['site'];
?>
<select name="vendor" id="vendor" class="select_purch"  style="width:150px;">
	<option value="0">Select Vendor</option>
	<?php 
	$sqlvendor=DB_query("select id,vendor_name from suppliers where find_in_set('".$tst_st."',site)",$db);
	while($resultVendor=DB_fetch_array($sqlvendor))
	{
	?>
	<option value="<?php echo $resultVendor['id']; ?>"><?php echo $resultVendor['vendor_name']; ?></option>
	<?php } ?>
	</select>

<?php 
break; 

case 'VendornameFormC':
$tst_st = $_REQUEST['site'];
//$tst_st = $_REQUEST['site'];
?>
<select name="vendor" id="vendor" class="select_purch"  style="width:150px;">
	<option value="0">Select Vendor</option>
	<?php 
	$sqlvendor=DB_query("select id,vendor_name from suppliers where find_in_set('".$tst_st."',site)",$db);
	while($resultVendor=DB_fetch_array($sqlvendor))
	{
	?>
	<option value="<?php echo $resultVendor['id']; ?>"><?php echo $resultVendor['vendor_name']; ?></option>
	<?php } ?>
	</select>

<?php 
break; 

case 'VendornameCDP':
$tst_st = $_REQUEST['site'];
//$tst_st = $_REQUEST['site'];
?>
<select name="vendor_id" id="vendor_id" style="width:150px;" onchange="VendorAddressContactpeson(this.value)" >
	<option value="0">Select Vendor</option>
	<?php 
	$sqlvendor=DB_query("select id,vendor_name from suppliers where find_in_set('".$tst_st."',site)",$db);
	while($resultVendor=DB_fetch_array($sqlvendor))
	{
	?>
	<option value="<?php echo $resultVendor['id']; ?>"><?php echo $resultVendor['vendor_name']; ?></option>
	<?php } ?>
	</select>

<?php 
break; 

case 'VendornameCPI':
$tst_st = $_REQUEST['site'];
//$tst_st = $_REQUEST['site'];
?>
<select name="vendor_id" id="vendor_id" style="width:150px;" onchange="VendorAddressContactpeson(this.value)" >
	<option value="0">Select Vendor</option>
	<?php 
	$sqlvendor=DB_query("select id,vendor_name from suppliers where find_in_set('".$tst_st."',site)",$db);
	while($resultVendor=DB_fetch_array($sqlvendor))
	{
	?>
	<option value="<?php echo $resultVendor['id']; ?>"><?php echo $resultVendor['vendor_name']; ?></option>
	<?php } ?>
	</select>

<?php 
break; 


case 'IndentUser':
$tst_st = $_REQUEST['site'];
//$tst_st = $_REQUEST['site'];
?>
<select name="requition_by" id="requition_by" style="width:100%;">
	<option value="0">Select</option>
	<?php 
	$SQLEmp=DB_query("SELECT id,emp_name FROM empmaster WHERE CompanyId='".$_SESSION['ACGCompanyId']."' AND emp_site='".$tst_st."' ORDER BY emp_name",$db);
        while($EmpId=DB_fetch_array($SQLEmp)){
	?>
	<option value="<?php echo $EmpId['id']; ?>"><?php echo $EmpId['emp_name'];?></option>
	<?php } ?>
	</select>

<?php 
break;

case 'IndentUserDepHApp':
$tst_st = $_REQUEST['site'];
?>
        <select style="width:150px;" name="user" id="user">
	<option value="0">All</option>
	<?php 
	$SQLEmp=DB_query("SELECT id,emp_name FROM empmaster WHERE CompanyId='".$_SESSION['ACGCompanyId']."' AND emp_site='".$tst_st."' ORDER BY emp_name",$db);
        while($EmpId=DB_fetch_array($SQLEmp)){
	?>
	<option value="<?php echo $EmpId['id']; ?>"><?php echo $EmpId['emp_name'];?></option>
	<?php } ?>
	</select>

<?php 
break;

case 'IndentUserStoreHApp':
$tst_st = $_REQUEST['site'];
?>
        <select style="width:150px;" name="user" id="user">
	<option value="0">All</option>
	<?php 
	$SQLEmp=DB_query("SELECT id,emp_name FROM empmaster WHERE CompanyId='".$_SESSION['ACGCompanyId']."' AND emp_site='".$tst_st."' ORDER BY emp_name",$db);
        while($EmpId=DB_fetch_array($SQLEmp)){
	?>
	<option value="<?php echo $EmpId['id']; ?>"><?php echo $EmpId['emp_name'];?></option>
	<?php } ?>
	</select>

<?php 
break;

case 'IndentUserPurchHApp':
$tst_st = $_REQUEST['site'];
?>
        <select style="width:150px;" name="user" id="user">
	<option value="0">All</option>
	<?php 
	$SQLEmp=DB_query("SELECT id,emp_name FROM empmaster WHERE CompanyId='".$_SESSION['ACGCompanyId']."' AND emp_site='".$tst_st."' ORDER BY emp_name",$db);
        while($EmpId=DB_fetch_array($SQLEmp)){
	?>
	<option value="<?php echo $EmpId['id']; ?>"><?php echo $EmpId['emp_name'];?></option>
	<?php } ?>
	</select>

<?php 
break;

case 'IndentUserPurchReqAdd':
$tst_st = $_REQUEST['site'];
//$tst_st = $_REQUEST['site'];
?>
<select name="requition_by" id="requition_by" style="width:150px;">
	<option value="0">--Select--</option>
	<?php 
	$SQLEmp=DB_query("SELECT id,emp_name FROM empmaster WHERE CompanyId='".$_SESSION['ACGCompanyId']."' AND emp_site='".$tst_st."' ORDER BY emp_name",$db);
        while($EmpId=DB_fetch_array($SQLEmp)){
	?>
	<option value="<?php echo $EmpId['id']; ?>"><?php echo $EmpId['emp_name'];?></option>
	<?php } ?>
	</select>

<?php 
break; 

case 'VendornameQuotReg':
$tst_st = $_REQUEST['site'];
//$tst_st = $_REQUEST['site'];
?>
<select name="vendor" id="vendor" class="select_purch"  style="width:150px;">
	<option value="0">Select Vendor</option>
	<?php 
	$sqlvendor=DB_query("SELECT id,vendor_name FROM suppliers WHERE CompanyId='".$_SESSION['ACGCompanyId']."' 
		AND find_in_set('".$tst_st."',site) ",$db);
	while($resultVendor=DB_fetch_array($sqlvendor))
	{
	?>
	<option value="<?php echo $resultVendor['id']; ?>"><?php echo $resultVendor['vendor_name']; ?></option>
	<?php } ?>
	</select>

<?php 
break; 

case 'VendornameQuotReg':
$tst_st = $_REQUEST['site'];
//$tst_st = $_REQUEST['site'];
?>
<select name="vendor" id="vendor" class="select_purch"  style="width:150px;">
	<option value="0">Select Vendor</option>
	<?php 
	$sqlvendor=DB_query("SELECT id,vendor_name FROM suppliers WHERE CompanyId='".$_SESSION['ACGCompanyId']."'
	 AND find_in_set('".$tst_st."',site)",$db);
	while($resultVendor=DB_fetch_array($sqlvendor))
	{
	?>
	<option value="<?php echo $resultVendor['id']; ?>"><?php echo $resultVendor['vendor_name']; ?></option>
	<?php } ?>
	</select>

<?php 
break; 


case 'showVendor':
$tst_st = $_REQUEST['site'];
//$tst_st = $_REQUEST['site'];
?>
<select name="vendor" id="vendor">
	<option value="0">Select Vendor</option>
	<?php 
	$sqlvendor=DB_query("SELECT id,vendor_name FROM suppliers WHERE CompanyId='".$_SESSION['ACGCompanyId']."'
	 AND find_in_set('".$tst_st."',site)",$db);
	while($resultVendor=DB_fetch_array($sqlvendor))
	{
	?>
	<option value="<?php echo $resultVendor['id']; ?>"><?php echo $resultVendor['vendor_name']; ?></option>
	<?php } ?>
</select>

<?php 
break; 

case 'showVendorMRN':
$tst_st = $_REQUEST['site'];
//$tst_st = $_REQUEST['site'];
$data1='';$data2='';
$sql_store =DB_query("select id, StoreName from storetype where Store_Site='".$tst_st."' and CompanyId='".$_SESSION['ACGCompanyId']."' order by StoreCode ASC",$db);
$data1.="<option value=''>Select</option>";
while($Storedetail=DB_fetch_array($sql_store)){
$data1.="<option value='".$Storedetail['id']."'>".$Storedetail['StoreName']."</option>";
}
$data2.="<option value='0'>Select</option>";
	$sqlvendor=DB_query("SELECT id,vendor_name FROM suppliers WHERE CompanyId='".$_SESSION['ACGCompanyId']."' 
		AND find_in_set('".$tst_st."',site)",$db);
	while($resultVendor=DB_fetch_array($sqlvendor))
	{
	$data2.="<option value='".$resultVendor['id']."'>".$resultVendor['vendor_name']."</option>";
        }
echo $data1.'__'.$data2;
break; 

case 'showStoreEmpIssue':
$tst_st = $_REQUEST['site'];
//$tst_st = $_REQUEST['site'];
$data1='';$data2='';
$sql_store =DB_query("select id,StoreName from storetype where Store_Site='".$tst_st."' and CompanyId='".$_SESSION['ACGCompanyId']."' order by StoreCode ASC",$db);
//$data1.="<option value='0'>Select</option>";
while($Storedetail=DB_fetch_array($sql_store)){
$data1.="<option value='".$Storedetail['id']."'>".$Storedetail['StoreName']."</option>";
}
$data2.="<option value='0'>---Select---</option>";
	$sqlemp=DB_query("SELECT id,emp_name FROM empmaster WHERE CompanyId='".$_SESSION['ACGCompanyId']."' AND emp_site='".$tst_st."' ORDER BY emp_name",$db);
	while($resultEmp=DB_fetch_array($sqlemp))
	{
	$data2.="<option value='".$resultEmp['id']."'>".$resultEmp['emp_name']."</option>";
        }
echo $data1.'__'.$data2;
break; 

case 'showVendorCode':
$tst_st = $_REQUEST['site'];
//$tst_st = $_REQUEST['site'];
?>
<select name="vendor" id="vendor">
	<option value="0">Select Vendor</option>
	<?php 
	$sqlvendor=DB_query("SELECT vendor_code,vendor_name FROM suppliers WHERE CompanyId='".$_SESSION['ACGCompanyId']."'
	 AND find_in_set('".$tst_st."',site)",$db);
	while($resultVendor=DB_fetch_array($sqlvendor))
	{
	?>
	<option value="<?php echo $resultVendor['vendor_code']; ?>"><?php echo $resultVendor['vendor_name']; ?></option>
	<?php } ?>
</select>
<?php 
break; 

case 'Membername': 
$tst_st = $_REQUEST['site'];
$tst_type = $_REQUEST['type'];
//$tst_st = $_REQUEST['site'];
?>
<?php if($tst_type=='sales'){?>
<select name="client" id="client" style="width:100%">
	<option value="0">Select Client</option>
	<?php 
	$party=DB_query("Select id,client_code,c_name from clientmaster where find_in_set('".$tst_st."',Site)",$db);
	while($party_row=DB_fetch_array($party))
	{
	?>
	<option value="<?php echo $party_row['id'];?>"><?php echo $party_row['c_name'];?></option>
	<?php } ?>
	</select>
<?php }else{?>
<select name="vendor" id="vendor" style="width:100%">
	<option value="0">Select Vendor</option>
	<?php 
	$sqlvendor=DB_query("SELECT id,vendor_name FROM suppliers WHERE CompanyId='".$_SESSION['ACGCompanyId']."'
	 AND find_in_set('".$tst_st."',site)",$db);
	while($resultVendor=DB_fetch_array($sqlvendor))
	{
	?>
	<option value="<?php echo $resultVendor['id']; ?>"><?php echo $resultVendor['vendor_name']; ?></option>
	<?php } ?>
	</select>
<?php } 
break;

case 'showItemBySub': 
$tst_sub = $_REQUEST['subcat'];
$tst_cat = $_REQUEST['cat'];
$data1='';
if($tst_sub!='0' && $tst_cat=='0'){
$item_subquery =DB_query("SELECT id,item_name,StockID FROM item_master WHERE SubCategoryID='".$tst_sub."'",$db);
}
if($tst_cat!='0' && $tst_sub=='0'){ "SELECT id,item_name,StockID FROM item_master WHERE CategoryID='".$tst_cat."'";
$item_subquery =DB_query("SELECT id,item_name,StockID FROM item_master WHERE CategoryID='".$tst_cat."'",$db);
}
if($tst_sub!='0' && $tst_cat!='0'){
$item_subquery =DB_query("SELECT id,item_name,StockID FROM item_master WHERE CategoryID='".$tst_cat."' AND SubCategoryID='".$tst_sub."'",$db);
}
?>
<option value="">Select</option>
<?php 
 while($item_subrow=DB_fetch_array($item_subquery)){
?>

<option value="<?php echo $item_subrow['id']; ?>"><?php echo $item_subrow['item_name']." - ".$item_subrow['StockID']; ?></option>
<?php }
break; 

case 'showItemByCat':
$tst_sub = $_REQUEST['subcat'];
$tst_cat = $_REQUEST['cat'];
$data1='';$data2='';
$item_sub =DB_query("SELECT id,categorydescription FROM stockcategory WHERE CompanyId='".$_SESSION['ACGCompanyId']."' AND stockmaincategory='".$_REQUEST['cat']."'",$db);
$data1="<option value=''>Select</option>";

 while($item_row=DB_fetch_array($item_sub)){
?>
<?php $data1.="<option value='".$item_row['id']."'>".$item_row['categorydescription']."</option>";
 }

if($tst_sub!='0' && $tst_cat=='0'){
$item_subquery =DB_query("SELECT id,item_name,StockID FROM item_master WHERE SubCategoryID='".$tst_sub."'",$db);
}
if($tst_cat!='0' && $tst_sub=='0'){ "SELECT id,item_name,StockID FROM item_master WHERE CategoryID='".$tst_cat."'";
$item_subquery =DB_query("SELECT id,item_name,StockID FROM item_master WHERE CategoryID='".$tst_cat."'",$db);
}
if($tst_sub!='0' && $tst_cat!='0'){
$item_subquery =DB_query("SELECT id,item_name,StockID FROM item_master WHERE CategoryID='".$tst_cat."' AND SubCategoryID='".$tst_sub."'",$db);
}
$data2="<option value=''>Select</option>";
 while($item_subrow=DB_fetch_array($item_subquery)){
$data2.="<option value='".$item_subrow['id']."'>".$item_subrow['item_name']." - ".$item_subrow['StockID']."</option>";
 }
echo $data1.'__'.$data2;
break; ?>

 <?php }
}
?>
