<?php 
$PageSecurity = 11;

include('includes/session.inc');
//include('includes/SQL_CommonFunctions.inc');
//include('includes/DefineSuppTransClass.php');
//include('includes/function_lib.php');

$site = isset($_REQUEST['site']) ? $_REQUEST['site'] : 0;
$group = isset($_REQUEST['group']) ? $_REQUEST['group'] : 0;
$type = isset($_REQUEST['type']) ? $_REQUEST['type'] : 0;
$filter = array();

if($site !='0'){
	$filter[] = "location='".$site."'";
}

if($group !='0'){
	$filter[] = "under_group='".$group."'";
}

if($type !='0'){
	$filter[] = "asset_type='".$type."'";
}

if($filter!='')
	{			
		$filter1 = implode(" and ",$filter);	
	}
	if($filter1=='')
	{
		$filter1 ="1=1";
	}
	
$sql_search = "select id,name from machine_center where CompanyId='".$_SESSION['ACGCompanyId']."' and $filter1";
		
$search_result = DB_query($sql_search, $db);
$data ='<option value="">--Select--</option>';		
if(DB_num_rows($search_result)>0)
{
	while($myrow = DB_fetch_array($search_result)){
	$data .= '<option value="'.$myrow['id'].'">'.$myrow['name'].'</option>'; 
}
}
echo $data;	
  ?>

