<?php $PageSecurity = 4;
global  $db;
include('includes/session.inc');
include('includes/function_lib.php');
include('includes/stockcalculation.php');

$function_filter[]=$_REQUEST['site'];
$function_filter[]=$_REQUEST['store'];
$function_filter[]=FormatDateForSQL($_REQUEST['date']); 
$function_filter[]=FormatDateForSQL($_REQUEST['date']); 
?>

<link href="css/professional/default.css" rel="stylesheet" type="text/css" />
<form name="form1" action="" method="post">
<table width="100%" border="0" style="border:1px solid #333333;" align="right" cellspacing="0" cellpadding="3">
<tr>
	<td><strong>Main category </strong></td>
	<td><select style="width:150px;" id="srch_cateory" onchange="getSubCategory()">
		<option value="">Select</option>
		<?php
        $item_query="SELECT * FROM stockmaincategory where CompanyId='".$_SESSION['ACGCompanyId']."'";
		$res=DB_query($item_query ,$db);
		while($item_row1=DB_fetch_array($res)){
		$p='';
		if($item_row1['id'] == $_REQUEST['CategoryID'])	
		$p="selected";?>
		 <option value="<?php echo $item_row1['id'];?>"<?php echo $p;?>><?php echo $item_row1['stockmaincategoryname'];?></option>
       <?php }?>
      </select></td>
      <td><strong>Sub Category</strong></td>
      <td><select style="width:150px;" id="srch_subcateory" >
		<option value="">Select</option>
		<?php
        $item_subquery="SELECT * FROM stockcategory where CompanyId='".$_SESSION['ACGCompanyId']."'";
		$subres=DB_query($item_subquery ,$db);
		while($item_subrow=DB_fetch_array($subres)){
		$p='';
		if($item_subrow['id'] == $_REQUEST['CategoryID'])	
		$p="selected";?>
		 <option value="<?php echo $item_subrow['id'];?>"<?php echo $p;?>><?php echo $item_subrow['categorydescription'];?></option>
       <?php }?>
      </select></td>
     

   <td><strong>Code:</strong></td>
	<td ><input type="text" id="srch_code" style="width:150px;"  placeholder="Item Code"/></td>
  <td><strong>Name:</strong></td>
	<td ><input type="text" id="srch_name" style="width:150px;"  placeholder="Item Name"/></td>  
<td><input type="button" value="Search" onclick="getdata1()"></td>
</tr>
</table>
<br />
<br /><br />

<br /><br />
<div id="ItemListDiv">

<table width="100%" border="0" style="border:1px solid #333333;" align="right" cellspacing="0" cellpadding="3">
<tr style="height:30px;">
	<td width="7%" style="border-bottom:1px solid #FF0000;"><strong>Select</strong></td>
	<td width="13%" style="border-bottom:1px solid #FF0000;"><strong>Item Code</strong></td>
	<td width="21%" style="border-bottom:1px solid #FF0000;"><strong>Item Name</strong></td>
	<td width="9%" style="border-bottom:1px solid #FF0000;"><strong>UOM</strong></td>
</tr>
<?php // echo "Select * from machine_center where working='y' and sale_status='NS' and availability_status='0' and location='".$_REQUEST['site']."' ";
$sql=DB_query("Select id,StockID,item_name,item_desc,mst_unitid,mrp_rate,net_rate,item_mst_form_rate from item_master",$db); 
$i=0;
if(DB_num_rows($sql)>0)
{
	while($myrow=DB_fetch_array($sql))
	{ 	
	 	 $parameter=$myrow['id'];

		 $unit=$s->getField('unitsofmeasure','unitid',$myrow['mst_unitid'],'unitname');
?>
<tr bgcolor="#c1c1c1">
	<td><input type="checkbox" name="row_id[<?php echo $i;?>]" id="row_id_<?php echo $i;?>" value="<?php echo $parameter;?>" 
		onclick="getItemsList('<?php echo $parameter;?>','<?php echo $myrow['code'];?>','<?php echo  htmlspecialchars($myrow['name'], ENT_QUOTES);?>','Nos','<?php echo $i;?>')"></td>
	<td><strong><?php echo $myrow['StockID'];?></strong></td>
	<td><?php echo  $myrow['item_name'];?></td>
	<td><?php  echo $unit;?></td>
</tr>
	<?php $i++;} }?>
 </table>

</div>
</form>
