<?php $PageSecurity = 2;
error_reporting(0);
include('includes/DefineSuppTransClass.php');
include('includes/DefinePOClass.php');
include('includes/SQL_CommonFunctions.inc');
include('includes/session.inc');
include('includes/function_lib.php');
include('includes/fun-HRClass.php');
/* Get opening balance */
?> 

	<div align="center">
  <div style="overflow:auto; width:600px; height:250px">
  <p align="right" style="padding-left:0px; padding-bottom:0px; margin:0px;"><a href="#" onclick="hidedata();" style="font-size:18px; font-weight:bold;border:#000000 solid 2px; padding:2px; text-decoration:none; background-color:#FFFFFF; color:#000000;" title="Close">X</a></p>
  <table width="100%" border="1" cellspacing="0" cellpadding="3" style="border-collapse:collapse;">
 <tr>
        <th><strong>Select</strong></th>
        <th><strong>Item Code</strong></th>
        <th><strong>Item Name </strong></th>
		<th><strong>UOM </strong></th>		
		<th><strong>Main Group </strong></th>	
	   <th><strong>Sub Group </strong></th>	
		</tr> 
		<?php   
	    $i=0;	 
			$catid=array();
			
			
			$maincat=DB_query("select id from  stockmaincategory 
			where stockmaincategoryid LIKE 'FG%' OR stockmaincategoryid LIKE 'SF%' OR stockmaincategoryid LIKE 'FM%' and CompanyId='".$_SESSION['ACGCompanyId']."' ",$db);
			 while($row1=DB_fetch_array($maincat))
			 {
			 $catid[]=$row1['id'];
			 }	
			   $catid1=implode("','",$catid);
			 
	       $store_sql = "SELECT id,StockID,item_name,mst_unitid,SubCategoryID,CategoryID
		 FROM item_master  where CategoryID  in('".$catid1."')  and item_name like '%".$_REQUEST['site']."%' and CompanyId='".$_SESSION['ACGCompanyId']."' ";
        $Result=DB_query($store_sql,$db);
	    while($myrow =DB_fetch_array($Result))
	    {  	 		
		 $item_name= $s->GetFieldValue('item_master'," id='".$myrow['id']."'" ,'item_name');
		 $parameter=$myrow['id'];
		 $unitname= $s->GetFieldValue('unitsofmeasure',"unitid='".$myrow['mst_unitid']."'",'unitname');
          $subcatname=$s->GetFieldValue('stockcategory',"id='".$myrow['SubCategoryID']."'",'categorydescription');  
		   $maincat=$s->GetFieldValue('stockmaincategory',"id='".$myrow['CategoryID']."'",'stockmaincategoryname');
		   $bomid=$s->getField('ppl_product_wise_capacity','mst_itemid',$myrow['id'],'id');		  
		
 	  ?> 	  
	   <tr bgcolor="#FFFFFF">
        <td ><?php if($bomid!='') { echo "Generated" ; } else { ?>
		
       <a href="javascript:getItemsList1('<?php echo $myrow['id'];?>','<?php echo $myrow['StockID'];?>','<?php echo htmlspecialchars($myrow['item_name'], ENT_QUOTES);?>','<?php echo $unitname;?>','<?php echo  htmlspecialchars($subcatname, ENT_QUOTES); ?>','<?php echo $myrow['SubCategoryID']; ?>',1)"><?php echo $myrow['id'];?></a> <?php } ?>	
		 </td>
        <td > <?php echo $myrow['StockID'];?> </td>
        <td ><?php echo $item_name;?></td>		
		<td ><?php  echo $unitname;		?></td>
		<td ><?php  echo $maincat;?></td>
		<td ><?php  echo $subcatname;?></td>
	 
	  <?php $i++; } ?>	
		
	</table>
	</div></div>
	
