<?php
$PageSecurity = 3;
include('includes/Class_Client.php');
include ('includes/session.inc');
include ('includes/function_lib.php');
 include('includes/fun-php.php');
include('includes/fun-HRClass.php');
//include("Class_Party.php");

  global $db;
  echo '<link href="'.$rootpath. '/css/'. $_SESSION['Theme'] .'/default.css" rel="stylesheet" type="text/css" />';
?>
<script type="text/javascript" language="javascript">
  function toggle_visibility(id) {
	
	 
       var e = document.getElementById(id);
	       e.style.display = 'none';
		       //alert(e.style.display);
			   window.print();
    }

</script>


<h2>
  <div align="center"><?php echo 	 $_SESSION['ACGCompanyName'];	?> - Production Schedule</div>
</h2>

<?php 

				
				
	$condition1="CompanyId='".$_SESSION['ACGCompanyId']."'";
	$result1=$s->GetRecordById('salesorder',  $condition1);
				
				
				
			




if(DB_num_rows($result1)>0)	
{
while($rowRecord=DB_fetch_array($result1))
{
   $s=new db_query();
 //  ($table_name,  $condition) and A.id=B.masterId
   	$condition="masterId='".$rowRecord['id']."' and ApprovalStatus='Approved'";
	$result=$s->GetRecordById('salesorder_details',$condition);
	if(DB_num_rows($result)>0)	
	{

?>
<table width="100%" border="0"  cellpadding="4" cellspacing="2">
  <tr>
    <td>SOP No:<?php echo $rowRecord['orderNo'];?></td>
    <td>Client:<?php echo  $s->GetFieldValue('clientmaster',"id='".$rowRecord['client']."'",'c_name');?></td>
    <td>Delivery Date:<?php echo ConvertSQLDate($rowRecord['DeliveryDate']);?></td>
  </tr>
</table>
<table width="100%" border="0" cellpadding="2" cellspacing="2">
  <tr bgcolor="#CCCCCC">
    <th>SNo.</th>
    <th>Item Name </th>
    <th>Code</th>
    <th>Qty</th>
    <!--<th>D.A.No</th>-->
    <th>Remark</th>
  </tr>
  <?php $i=1;
	while($row=DB_fetch_array($result))
	{
   ?>
  <tr>
    <td><?php echo  $i++;?></td>
    <td><?php  echo  $s->GetFieldValue('item_master',"id='".$row['ItemCode']."'",'item_name');	//echo $row['ItemCode'];?></td>
    <td><?php echo  $s->GetFieldValue('item_master',"id='".$row['ItemCode']."'",'StockID'); // echo $row['ItemCode'];?></td>
    <td><?php  echo $row['Quantity'];?></td>
    <!--<td><?php  echo $row['pendingForDispatch'];?></td>-->
    <td><?php  echo $row['SalesCategory'];?></td>
  </tr>
  <?php }    ?>
</table>
<?php }
}
}
?>
   <div id="foo"><p align="center">
<a href="#" onclick="javascript:toggle_visibility('foo');" >Print</a>    
</p>
