<?php session_start();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Print Purchase Order</title>
<style type="text/css">
<!--
.companyname {
	color: #000000;
	font-weight: bold;
	font-size: 24px;
}

.com_address {
	color: #000000;
	font-weight: bold;
	font-size: 18px;
}

.heading {
	color: #000000;
	font-weight: bold;
	font-size: 20px;
}
-->
</style>
</head>

<body style="font-family: Arial, Helvetica, sans-serif;"><center>
<?php 
require_once("connectioni.php");
	
	
		
		$sql_head="select * from invpara where flag='".$_SESSION['company']."'";  
		$result_head =mysqli_query($GLOBALS['dbinv'],$sql_head);
		$row_head = mysqli_fetch_array($result_head);
		
		 
	?>
  
<table width="922" height="228" border="0">
    
    <tr>
        <th class='center' style='font-size:25px;' colspan='4' scope='col' class='heading' > <?php echo $row_head["COMPANY"] ?></th>
    </tr>
    <tr>
        <th class='center' style='font-size:15px;' colspan='4' scope='col' class='heading' > <?php echo $row_head["ADD1"] ?></th>
    </tr> 
  <?php
		//echo $_GET["invno"];
    			 
		$sql="Select * from s_ordmas where REFNO='".$_GET["invno"]."'";
    	$result =mysqli_query($GLOBALS['dbinv'],$sql) ; 	
		$row = mysqli_fetch_array($result);		
		
			$sql3="Select * from s_stomas where CODE='".$row["DEP_CODE"]."'";
    	$result3 =mysqli_query($GLOBALS['dbinv'],$sql3) ; 	
		$row3= mysqli_fetch_array($result3);	
        
		$sql1="Select * from vendor where CODE='".$row["SUP_CODE"]."'";
    	$result1 =mysqli_query($GLOBALS['dbinv'],$sql1) ; 	
		$row1 = mysqli_fetch_array($result1);	
		
		$sql2="Select * from s_ordtrn where REFNO='".$_GET["invno"]."'";
    	$result2 =mysqli_query($GLOBALS['dbinv'],$sql2) ; 	
		
	?>
  
   <tr>
        <?php  
            if($row['cancel']=="1"){
                echo "<th class='center' style='color:red;font-size:23px;' colspan='4' scope='col' class='heading' >CANCELED PURCHASE ORDER </th>";
            }else{
                echo "<th class='center' style=' font-size:23px;'  colspan='4' scope='col' class='heading' ><u><a id='pdfid'  >PURCHASE ORDER </a></u></th>";
            }
            ?>
            
     
  </tr>
   </tr>
    
  <tr>
  <th colspan="4" scope="col">
  <table cellpadding="0" cellspacing="0" border="1"><tr><td>
  <table border="0">
       <tr> 
    <td align="left">PO Date -</td>
    <td align="left"><?php echo $row["SDATE"]; ?></td>
    <td align="left">CI No -</td> 
    <td align="right"><?php echo $row["invno"]; ?></td>
  </tr>
  <tr>
    <td width="150" align="left">PO No -</td>
    <td width="600" align="left"><?php echo $row["REFNO"]; ?></td>
    <td width="170" align="left">LC/TT No -</td> 
    <td width="266" align="right"><?php echo $row["LC_No"]; ?></td>
  </tr>
  <tr>
     <td align="left">Supplier -</td>
    <td align="left"><?php echo $row1["NAME"]; ?></td>
    <td align="left">BL No -</td> 
    <td align="right"><?php echo $row["blno"]; ?></td>
  </tr>
  <tr>
     <td align="left">Brand -</td>
    <td align="left"><?php echo $row["Brand"]; ?></td>
    <td align="left">PI No -</td> 
    <td align="right"><?php echo $row["pi_no"]; ?></td>
  </tr>
  <tr>
     <td align="left">Country -</td>
    <td align="left"><?php echo $row["COUNTRY"]; ?></td> 
    <td align="left">Department -</td>
    <td align="right"><?php echo $row3["DESCRIPTION"]; ?></td> 
  </tr>
 
  </table>
  </td></tr></table>
  </th>
  </tr>
  
  <tr>
    <td colspan="4"><table width="1000" border="1" cellpadding="2" cellspacing="0">
      <tr>
        <th width="100" height="22" scope="col">Item Code</th>
        <th width="420" scope="col">Item Description</th>
        <th width="150" scope="col">Pattern</th>
        <th width="102" scope="col">Quantity</th>
        <th width="102" scope="col">Unit Price</th>
      </tr>
      <?php 
	  	$ORD_QTY=0;
		
	  	while($row2 = mysqli_fetch_array($result2)){	
      
	  echo "<tr>
        <td align=center>".$row2["STK_NO"]."</td>
        <td>".$row2["DESCRIPT"]."</td>
        <td align=center>".$row2["partno"]."</td>
        <td align=center>".$row2["ORD_QTY"]."</td>
        <td align=center>".$row2["RATE"]."</td>
      </tr>";
	  $ORD_QTY=$ORD_QTY+$row2["ORD_QTY"];
	  }
	  ?>
      
      <tr>
        <th  scope="col" colspan="3" align="center">Total Quantity</th>
        <th  scope="col" align="center"><?php echo $ORD_QTY; ?></th>
        <th  scope="col" align="center"></th>
     
      </tr>
    </table>
   
    </td>
  </tr>
 
  
  </table>
  <table width="922"  border="0">
       <tr>
    <td colspan='1'><b>&nbsp;</b></td>
    <td colspan='11'>&nbsp; </td>
      
  </tr>
  <tr>
    <td colspan='1'><b>Remark:</b></td>
    <td colspan='11'><b><?php echo $row["REMARK"]; ?></b></td>
      
  </tr>
 
  </table>
  <table width="922"  border="0">
   
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
     <td width="500">&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
   <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
     <td width="500">&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
    
  <tr>
    <td align="center">_____________________</td>
    <td>&nbsp;</td>
    <td width="500">&nbsp;</td>
    <td align="center">_____________________</td>
  </tr>
  <tr>
    <td align="center"><b>ENTERED BY</b></td>
    <td>&nbsp;</td>
     <td width="500">&nbsp;</td>
    <td align="center"><b>AUTHORIZED BY</b></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
     <td width="500">&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
     
 
</table>
</body>
</html>
