<?php ob_start();
$PageSecurity = 4;
$PageName = 'Add Items';
include('includes/DefinePOClass.php');
include('includes/session.inc');
include('includes/SQL_CommonFunctions.inc');
include('includes/DefineSuppTransClass.php');
include('includes/header.inc');
include('includes/function_lib.php');
$sql=DB_query("Select * from item_master where CategoryID!='FG'",$db);

if($_REQUEST['Select'] != '')
{
	$item_array=array();
	$item_array=$_REQUEST['row_id'];
	$itemlist=implode("#",$item_array);
	$_SESSION['itemlist']=$itemlist;
	//print_r($_SESSION['itemlist']);
?>
<script type="text/javascript">
//var requisition=document.getElementById("requisition").value;
//alert(requisition);
opener.window.location="MR_Edit_Header.php?RequisitionNo="+<?php echo $_GET['id'];?>+"&update=1";self.close();
</script>
<?php 
}
?>
<link rel="stylesheet" href="css/jquery.ui.all.css">
<script src="js/jquery-1.5.1.js"> </script>
<script src="ui/jquery.ui.core.js"> </script>
<script src="ui/jquery.ui.widget.js"></script>


<h2 align="center">ADD ITEMS</h2><br /><br />
<form name="form1" action="" method="post">
<input type="submit" name="Select" id="Select" value="Select">
<input type="hidden" name="requisition" value="<?php echo $_GET['id'];?>" id="requisition">
<div style="overflow:auto; width:900px; height:300px">
<table width="100%" border="0" cellspacing="3" cellpadding="2" align="center">
  <tr>
  	<th><strong>SELECT</strong></th>
    <th><strong>ITEM CODE</strong></th>
    <th><strong>ITEM NAME</strong></th>
	 <th><strong>ITEM DESCRIPTION </strong></th>
     <th><strong>ITEM NO.</strong></th>
	  <th><strong>FLEXO/OFFSET</strong></th>
      <th><strong>OD</strong></th>
      <th><strong>UNIT</strong></th>
      <th><strong>SERIAL NO. </strong></th>
      <th><strong>ORIGINAL/LOCAL</strong></th>
      <th><strong>TYPE </strong></th>
      <th><strong>SHADE</strong></th>
      <th><strong>RUNNING METER/ROLL</strong></th>
      <th><strong>VOLUME</strong></th>
      <th><strong>TEETH</strong></th>
      <th><strong>BCM</strong></th>
      <th><strong>UPS</strong></th>
      <th><strong>QUALITY</strong></th>
  </tr>
  <?php 
  $i=1;
  while($myrow=DB_fetch_array($sql))
  {
  	if($i%2==0)
	{$bg="#CCCCCC";}
	else
	$bg="#C8BECB";
	
	$specs_sql="Select * from item_specification where proc_id='".$myrow['StockID']."'";
	$specs_result=DB_query($specs_sql,$db);
	while($specs_row=DB_fetch_array($specs_result))
	{
  $parameter=$myrow['StockID'].",".$specs_row['manufacture'].",".$specs_row['grade'].",".$specs_row['color'];
  ?>
  <tr bgcolor="<?php echo $bg;?>">
    <td><input type="checkbox" name="row_id[<?php echo $i;?>]" id="row_id_<?php echo $i;?>" value="<?php echo $parameter;?>"<?php echo $c;?>></td>
	<td><strong><?php 
	echo $myrow['StockID'];?></strong></td>
    <td><?php echo $myrow['item_name'];?></td>
    <td><?php echo $myrow['item_desc'];?></td>
    <td><?php echo $myrow['item_no'];?></td>
    <td><?php echo $myrow['flexo_offset'];?></td>
    <td><?php echo $myrow['od'];?></td>
	<td><?php 
	$unit=$s->getField('unitsofmeasure','unitid',$myrow['unit'],'unitname'); echo $unit;?></td>
    <td><?php echo $myrow['serial_no'];?></td>
    <td><?php echo $myrow['orig_local'];?></td>
    <td><?php echo $myrow['type_name'];?></td>
    <td><?php echo $myrow['shade'];?></td>
    <td><?php echo $myrow['running_roll'];?></td>
    <td><?php echo $myrow['volume'];?></td>
    <td><?php echo $myrow['teeth'];?></td>
    <td><?php echo $myrow['bcm'];?></td>
    <td><?php echo $myrow['ups'];?></td>
    <td><?php echo $myrow['quantity'];?></td>


  </tr>
<?php $i++;} }?>
<input type="hidden" name="row_count" id="row_count" value="<?php echo $i;?>">
</table>
</div>
</form>
<?php
include('includes/footer.inc');
?>