<?php
	$PageSecurity = 11;
 	include('includes/SQL_CommonFunctions.inc');
 	include('includes/session.inc');
   	include('includes/function_lib.php');
	include('includes/Class_Client.php');
?>
<link href="css/professional/default.css" rel="stylesheet" type="text/css" />
<h2 align="center">Search Product</h2>
<br />
<form name="form1" action="" method="post">
  <input type="hidden"  name="acgteephonicitems"  id="acgteephonicitems" value=""/>
	   <table width="100%" border="1" cellpadding="3" cellspacing="0" style="border-collapse:collapse; border:#666666 solid 1px;">
    <tr>
      <th width="12%"><strong>SELECT</strong></th>
	  <th width="23%"><strong>Invoice Date</strong></th>
      <th width="20%"><strong>Product Name</strong></th>
      <th width="22%"><strong>Quantity</strong></th>
	  <th width="23%"><strong>Warrantee Expiry Date</strong></th>
    </tr>

   <?php
  	$sql=DB_query("SELECT ItemCode,ExpireDate,Quantity FROM invoice_details WHERE invoiceid='".$_REQUEST['invoiceId']."'",$db); 
	?>
   
      <?php	
	
	$i=0;
	if(DB_num_rows($sql)>0)
	{
		while($myrow=DB_fetch_array($sql))
	  	{ 	
		 $itemname = $s->GetFieldValue('item_master','id="'.$myrow['ItemCode'].'"','item_name');
		 $itemsDetails = DB_query("SELECT invoiceDate FROM invoice WHERE invoice_id='".$_REQUEST['invoiceId']."'",$db);
         $items = DB_fetch_array($itemsDetails);
  ?>
      <tr bgcolor="#CCCCCC">
        <td width="12%"><input type="checkbox" name="row_id[<?php echo $i;?>]" id="row_id_<?php echo $i;?>" value="<?php echo $parameter;?>"	<?php echo $c;?> 
		onclick="getItemsList('<?php echo $myrow['id'];?>','<?php echo  $items['invoiceDate'];?>','<?php echo $itemname;?>','<?php echo $myrow['ExpireDate'];?>','<?php echo $myrow['ItemCode'];?>','<?php echo $i;?>')"/>
        </td>
		<td width="23%"><?php echo $items['invoiceDate']?></td>
		<td width="20%"><?php echo $itemname; ?></td>
        <td width="22%"><?php echo $myrow['Quantity'];?></td>
        <td width="23%"><?php echo $myrow['ExpireDate'];?></td>
        
      </tr>
      <?php $i++;} }?>
    </table>

</form>
</table>
<script language="javascript" type="text/javascript">
function getItemsList(id,invocedate,itmname,expdate,itmcode,ctr)
{
			window.opener.document.getElementById('productIddiv').style.display='none';
			window.opener.document.getElementById('productId1').style.display='block';
			
				window.opener.document.getElementById('invoiceDate').value = invocedate;
				window.opener.document.getElementById('productId1').value = itmname;
				window.opener.document.getElementById('productId2').value = itmcode;
				window.opener.document.getElementById('expireDate').value = expdate;
				window.opener.document.getElementById('invoiceNo2').value = window.opener.document.getElementById('invoiceNo').value;
				
				
		self.close();		
				
			
}
</script>












		
	 	




		
	 	