<?php ob_start();
$PageSecurity = 1;
include('config.php');
include('includes/ConnectDB.inc');
include('includes/function_lib.php');
include('includes/LanguageSetup.php');
include('includes/DateFunctions.inc');
$sql="Select * from invoice";
$result=DB_query($sql,$db);
$myrow=DB_fetch_array($result);
$vendorSql=DB_query("Select * from invoice_details where invoiceid='".$myrow['invoice_id']."'",$db);
$vendorRow=DB_fetch_array($vendorSql);

function convertDate($Dt)
{
	$dateBRK=explode('-',$Dt);
	$newFormat=$dateBRK[2]."/".$dateBRK[1]."/".$dateBRK[0];
	return $newFormat;
}

?>
<style>
body{font-family:Arial, Helvetica, sans-serif; font-size:10px!important;}
	.caps
	{
		text-transform: uppercase;
	}
</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>
<body>
	    <h2 align="center"><strong>BANK OF INDIA</strong></h2>
        <h3 align="center"><font color="#FF0000">STATEMENT OF BOOK-DEBITS HYPOTHECATED</font></h3>
        <div align="center">
        <table align="center" border="0" width="100%" cellpadding="0" cellspacing="0" style="">
	    <tr><th align="left"><strong>The Chief Manager/Manager</strong></th><th></th>
             <th align="right"><strong>Place:New Delhi</strong></th>
        </tr>
        <tr><th align="left"><strong>Bank of India</strong></th><th></th>
            <th align="right"><strong>Date:</strong></th></tr>
       <tr><th align="left"><strong>Okhla,Branch,New Delhi</strong></th><th></th><th></th></tr>
       <tr><th></th><th></th>
       <th align="right"><strong>Re:Our Loan/Cash Credit Account </strong></th>
       </tr>
       <tr><th></th><th></th><th align="right"><strong>Hypothecation of Book Debts</strong></th>
       </tr>
       <tr><th></th><th></th><th align="right"><strong>Re:Statement of Book=Debts as on</strong></th></tr>
 </table>

</div>
<div>&nbsp;</div>
<div>&nbsp;</div>
<form action="" method="post">
<div style="border:0px solid #000;">
<table width="100%"    align="center" cellpadding="1px" cellspacing="0">
<tr>
			<th style="border:1px dashed;">Bill No</th>
			<th style="border:1px dashed;">Bill Date</th>
			<th style="border:1px dashed;">Name & Address of the Party</th>
			<th style="border:1px dashed;">Item Supplied</th>
			<th style="border:1px dashed;">Value</th>
			</tr>
			<?php  $total_amt=array();
		    $invoicesql="SELECT * FROM invoice A,invoice_details B WHERE A.invoice_id=B.invoiceid and branch_name='".$_REQUEST['prefix']."' and invoiceDate between '". ($_REQUEST['frmdate'])."' and '".($_REQUEST['todate'])."' GROUP BY B.invoiceid ";
		   
		     $invoiceres=DB_query($invoicesql,$db);
		     $i=0;
			 while($invoicerow=DB_fetch_array($invoiceres))
			
				{
				
			?>
			<tr>
			<td style="border:1px dashed;"><?php echo $invoicerow['invoiceNo'];?></td>
			<td style="border:1px dashed;"><?php echo $invoicerow['invoiceDate'];?></td>
			<td style="border:1px dashed;"><font size="1px"><?php
				echo $s->GetFieldValue('clientmaster',"id='".$invoicerow['client_id']."'"  ,'c_name');
				echo $s->GetFieldValue('clientmaster',"id='".$invoicerow['client_id']."'"  ,'pre_address1');
			     ?></font></td>
				 <td style="border:1px dashed;"><font size="1px">
				 <?php
				 echo $s->GetFieldValue('item_master',"StockID='".$invoicerow['ItemCode']."'"  ,'item_name');
				 $itemid=$s->GetFieldValue('item_master',"StockID='".$invoicerow['ItemCode']."'",'StockID');
				 ?></font>
				 </td>
				 <td style="border:1px dashed;">
				 <?php echo $invoicerow['grandTotal'];
				 $total_amt[]=$invoicerow['grandTotal'];
				 //echo $s->GetFieldValue('invoice_details',"ItemCode='". $itemid."'"  ,'Amount');?>
				 	</td>
			
				<?php $i++; }?>
				</tr>
				<tr><td style="border:1px dashed;">&nbsp;</td><td style="border:1px dashed;">&nbsp;</td><td style="border:1px dashed;">&nbsp;</td><td style="border:1px dashed;" align="center" >Grand Total</td><td style="border:1px dashed;"style="border:1px dashed;"><?php echo array_sum($total_amt); ?></td></tr>

</table>
<div align="center"><strong>For WEBTECH PACKAGING(I) PVT. LTD.</strong></div>
<div id="foo"><p align="center">
  <a href="#" onClick="javascript:toggle_visibility('foo');" >Print</a></p>
</div> 
</form>
</div>