<?php error_reporting(0);
unset($_SESSION['potype']);
unset($_SESSION['venderdata']);
 ?>
<link href="css/purchses1.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" href="css/new_mxerp.css">
<style type="text/css">
.border1{border:#666666 1px solid; border-left:none; border-top:none; font-family:Arial; font-size:12px; color:#000000;}
.border_bottom{border-bottom:#666666 1px solid; font-family:Arial; font-size:12px; color:#000000;}
.f12{font-family:Arial; font-size:12px; color:#000000; font-weight:bold;}
.f11{font-family:Arial; font-size:11px; color:#000000;}


</style>

<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>
<p id="foo" style="margin-left:auto;"  style="margin:0px; margin-bottom:5px;"> <a href="#" id="fis" onClick="javascript:toggle_visibility('foo');" >Print</a> </p>
<?php
session_name('CAKEPHP'); session_start();
 $ppptype=$_SESSION['potype']; 

//echo '<pre>'; print_r($_SESSION['purchRegisterPrint']); 
 //echo $_REQUEST['id']; 
  
$vnames=$_SESSION['venderdata'];
error_reporting(FALSE);
$PageSecurity = 3;	
include ('includes/session.inc');
include ('includes/function_lib.php');
include('includes/fun-php.php');
include('includes/fun-HRClass.php');
global $db;

?>

<div style="text-align:center; margin:0px; width:1080px;">        
	<?php 	
	$sql=$_SESSION['purchaseorderRegisterPrint'];
    $search_result=DB_query($sql,$db); 
    while($searched1=DB_fetch_assoc($search_result))
	{$searched[]=$searched1;
	}
	?>
	<center><h3 style="text-align:center; font-size:18px;"><u>
<?php 
$company_name=DB_fetch_assoc(DB_query("select CompanyName from companies where CompanyId='".$_SESSION[ACGCompanyId]."'",$db)); 
echo strtoupper($company_name[CompanyName]);?></u><br /><br />
Purchase Bill Verification Report</h3></center>	
</div>
<table width="100%" border="1" align="left" cellpadding="2" cellspacing="0">
<?php if($ppptype=='1'){ ?>
<tr>
  <th class="f12">Voucher No</th>
	<th  class="f12">V.Date</th>
   <th class="f12">Vendor Name</th>    
   <th class="f12">Bill NO.</th>
   <th class="f12">Bill Date</th>    
	<th class="f12">Basics Amount</th>
    <th class="f12">Pkg Charges</th>
    <th class="f12">Custom Duty</th>
    <th class="f12">CVD</th>    
    <th class="f12">Custom E.Cess</th>
	<th class="f12">Custom SE.Cess</th>
    <th class="f12">Additional Duty </th>
    <th class="f12">Freight</th>
    <th class="f12">Insurance</th>
	<th class="f12">Clearing & Forwarding</th>
	<th class="f12">Misc. Charges</th>
    <th class="f12">Handling Charges</th>   
    <th class="f12">Round Off</th>
	<th class="f12" colspan="2">Grand Total</th>	 	
  </tr>	
  
  <?php 
  //$vendorData=$s->getField('suppliers','id',$res1['vendor'],'vendor_name'); 
  foreach($searched as $res1)
  {     // echo  $roundoff=$res1['round_off'];
        $vnum=$res1['voucher_no'];
		$vsite=$res1['site'];
		$pcode=$s->getField('prefix_tbl','prefix_code','PV','prefix_code');
	    $vouchercode=$vsite."/".$pcode."/"."00".$vnum; 		 
  //echo '<pre>'; print_r($searched);	
  ?>  
  <tr bgcolor="#FFFFFF">
    <td class="f11" ><?php echo $vouchercode;?></td>
    <td class="f11"><?php echo ConvertSQLDate($res1['voucher_date']);?></td>
    <td class="f11"><?php echo $vnames; ?></td>
	<td class="f11"> <?php echo $res1['bill_no']; ?></td>
	<td class="f11"> <?php echo $res1['bill_date']; ?></td>
	<td class="f11"> <?php echo $res1['total_item_amount']; ?></td>
	<td class="f11"> <?php echo $res1['pkg_charges']; ?></td>
	<td class="f11"> <?php echo $res1['custom_duty']; ?></td>
	<td class="f11"> <?php echo $res1['cvd_total']; ?></td>
	<td class="f11"> <?php echo $res1['custom_ecess1']; ?></td>	
	<td class="f11"> <?php echo $res1['custom_sec_ecesss']; ?></td>
	<td class="f11"> <?php echo $res1['add_chargess']; ?></td>	
	<td class="f11"> <?php echo $res1['tot_freights']; ?></td>
	<td class="f11"> <?php echo $res1['insurance']; ?></td>
	<td class="f11"> <?php echo $res1['clearing']; ?></td>
	<td class="f11"> <?php echo $res1['misCharge']; ?></td>	
	<td class="f11"> <?php echo $res1['loadings']; ?></td>
	<td class="f11"> <?php echo $res1['round_off']; ?><?php echo $res1['roundVal']; ?></td>
	<td class="f11" colspan="2"> <?php echo $res1['grandtotals']; ?></td>   
  </tr>
  <?php } } else { ?>

  <tr>
    <th class="f12" width="89">Voucher No</th>
	<th class="f12" width="53">V.Date</th>
    <th class="f12" width="89">Vendor Name</th>  
    <th  class="f12" width="75" style="width:75px;">Bill NO.</th>
    <th  class="f12" width="50" style="width:50px;">Bill Date</th>
	<th class="f12" width="75" style="width:75px;">Basic Amount</th>	
	<th  class="f12" width="75" style="width:75px;">Pkg Charges</th>
    <th  class="f12" width="50" style="width:50px;">Total Excise Amt</th>
	<th  class="f12" width="75" style="width:75px;">Total E.Cess Amt</th>
    <th  class="f12" width="50" style="width:50px;">Total SE.Cess Amt</th>
	<th  class="f12" width="75" style="width:75px;">Additional Charges</th>
    <th  class="f12" width="50" style="width:50px;">Total Excise Duty Amt</th>
	<th  class="f12" width="100" style="width:100px;">Total Taxable Amt </th>
	<th  class="f12" width="75" style="width:75px;">Input Tax </th>
    <th  class="f12" width="50" style="width:50px;">Tax Value</th>
	<th  class="f12" width="60">Surcharge Amount</th>
	<th  class="f12" width="65">Freight</th>
	<th  class="f12" width="100" style="width:100px;">Loading/Unloading</th>
	 <th  class="f12" width="75" style="width:75px;">Round Off</th>  
    <th  class="f12" width="75" style="width:75px;">Grand Total</th>
	    			
  </tr>
  
  <?php  foreach($searched as $res2)
  {
        
        $vnum=$res2['voucher_no'];
		$vsite=$res2['site'];
		$pcode=$s->getField('prefix_tbl','prefix_code','PV','prefix_code');
	    $vouchercode=$vsite."/".$pcode."/"."00".$vnum; 
  ?>
  <tr bgcolor="#FFFFFF">
    <td class="f11" ><?php echo $vouchercode;?></td>
    <td class="f11"><?php echo ConvertSQLDate($res2['voucher_date']);?></td>
    <td class="f11"><?php echo $vnames; ?></td>
	<td class="f11"> <?php echo $res1['bill_no']; ?></td>
	<td class="f11"> <?php echo ConvertSQLDate($res2['bill_date']); ?></td>
	<td class="f11"> <?php echo $res2['total_item_amount']; ?></td>
	<td class="f11"> <?php echo $res2['pkg_charges']; ?></td>
	<td class="f11"> <?php echo $res2['tot_excise_amt']; ?></td>
	<td class="f11"> <?php echo $res2['tot_ecess_amt']; ?></td>
	<td class="f11"> <?php echo $res2['tot_ecess_amt']; ?></td>
	
	<td class="f11"> <?php echo $res2['tot_sahecess_amt']; ?></td>
	<td class="f11"> <?php echo $res2['tot_excise_duty_amt']; ?></td>	
	<td class="f11"> <?php echo $res2['tot_taxable_amt']; ?></td>
	<td class="f11"> <?php echo $res2['vat_cst']; ?></td>
	<td class="f11"> <?php echo $res2['taxvalue']; ?></td>
	<td class="f11"> <?php echo $res2['sur_oct_amt']; ?></td>
	
	<td class="f11"> <?php echo $res2['tot_freights']; ?></td>
	<td class="f11"> <?php echo $res2['loadings']; ?></td>
	<td class="f11"> <?php echo $res2['round_off']; ?><?php echo $res2['roundVal']; ?></td>
	<td class="f11"> <?php echo $res2['grandtotals']; ?></td>
  </tr>
 <?php } }?>
 
</table>

   
