<!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>Purchase Debit Note</title>
<link rel="stylesheet" href="<?php echo base_url()?>css/stylesheets.css" type="text/css" />
<style media="print" type="text/css">
	/*body{FONT-SIZE: 14px;FONT-FAMILY: Arial;COLOR: #000000}*/
	.printButton { display: none; }
</style>
<script language="javascript" type="text/javascript">	
function do_print(){
	window.print();
}
/*function do_printexcel(){
	var url = "<?php //echo base_url()?>aptransaction/printDebitNote_excel/<?php //echo $dateFrom?>/<?php //echo $dateTo?>";
	window.location.href = url;
}*/
</script>
</head>
<div class="printButton" align="center">
<table width="100%" border="0" align="center" cellpadding="1" cellspacing="0">
    <tr>
        <td align="center" colspan="2">
        	<?php 
			$js = 'onClick="do_print()" class="btn btn-primary Print" title="Print"';
			echo form_button('Print','<span class="i-printer">',$js);?>&nbsp;&nbsp; <?php
			$js = 'onClick="do_printexcel()" class="btn btn-primary EXCEL" title="Download"';
			echo form_button('EXCEL','<span class="i-download">',$js);?>&nbsp;&nbsp; <?php
			$js = 'onClick="javascript:window.close();" class="btn btn-warning Close" title="Close"';
			echo form_button('Close','<span class="i-switch">',$js);?>
        </td>
    </tr>
</table>
</div>
<div>
	<table border="0" cellpadding="1" cellspacing="0" width="100%">
		<thead>
		<tr>
			<th width="20%"></th>
			<th width="20%"></th>
			<th width="20%"><?php
                     echo $companyInfo->companyName;?></th>
			<th width="20%"></th>
			<th width="30%">&nbsp;</th>               
		</tr>
        <tr>
			<th></th>
			<th></th>
			<th><?php echo $companyInfo->companyNo;?></th>
			<th></th>
			<th></th>               
		</tr>
        <tr>
			<th></th>
			<th></th>
			<td class="tac"><?php echo $companyInfo->line1;?><br><?php echo $companyInfo->line2;?></td>
			<th></th>
			<th></th>               
		</tr>
		</thead>
		<tbody>
        <tr><td width="20%"></td>
        	<td width="20%"></td>
            <td width="20%" class="tac"><?php echo $companyInfo->line3;?><br/><?php echo $companyInfo->companyPostCode;?><?php echo $companyInfo->city;?></td>
            <td>&nbsp;</td>
            <td width="20%"></td>
        </tr>
        <tr>
        	<td></td>
        	<td></td>
            <td class="tac"><?php echo $companyInfo->phoneNo;?></td>
            <td></td>
            <td>&nbsp;</td>
        </tr>
        <tr>
        	<td></td>
        	<td></td>
            <td class="tac"><?php echo $companyInfo->faxNo;?></td>
            <td></td>
            <td>&nbsp;</td>
        </tr>
        <tr>
        	<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $supplierDetails->supplierName;?></td>
        	<td></td>
            <td></td>
            <td></td>
            <th>STATEMENT OF ACCOUNT</th>
        </tr>
        <tr>
       	  <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $supplierDetails->line1;?><br></td>
        	<td></td>
            <td></td>
            <td></td>
            <td>&nbsp;</td>
        </tr>
        <tr>
        	<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $supplierDetails->line2;?><br/></td>
        	<td></td>
            <td></td>
            <td></td>
          <td>&nbsp;</td>
        </tr>
        <tr>
        	<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $supplierDetails->line3;?></td>
        	<td></td>
            <td></td>
            <td></td>
            <td>&nbsp;</td>
        </tr>
        <tr>
        	<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $supplierDetails->supplierPostCode;?><?php echo $supplierDetails->city;?></td>
        	<td></td>
            <td></td>
            <td></td>
            <td>&nbsp;</td>
        </tr>
        <tr>
        	<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $supplierDetails->phoneNumber1;?></td>
        	<td></td>
            <td></td>
            <td></td>
          <td>&nbsp;</td>
        </tr>
        <tr>
        	<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $supplierDetails->fax;?></td>
        	<td></td>
            <td></td>
            <td></td>
            <td>&nbsp;</td>
        </tr>
        <tr>
        	<td></td>
            <td></td>
            <td></td>
        </tr>
        </tbody>
        </table>
        <table border="0" cellpadding="1" cellspacing="0" width="100%">
		<thead>
        <tr style="border-top:0pt solid black; border-bottom:0pt solid black;" bgcolor="#FFCC00">
              			<th style="display:none"></th>
            			<th><?php echo form_label($this->lang->line('ID'),'ID');?></th>
            			<th><?php echo form_label($this->lang->line('transDate'),'transDate');?></th>
                        <th><?php echo form_label($this->lang->line('refNo'),'refNo');?></th>
                        <td><?php echo form_label($this->lang->line('formNo'),'formNo');?></td>   
                        <th><?php echo form_label($this->lang->line('description'),'description');?></th>
                		<th class="tar"><?php echo form_label($this->lang->line('debit'),'debit');?></th>    
                        <th class="tar"><?php echo form_label($this->lang->line('credit'),'credit');?></th>   
                        <th class="tar"><?php echo form_label($this->lang->line('balance'),'balance');?></th>   
            		</tr>
        </thead>
        <tbody>
	<?php $bil = 0;
			//echo var_dump($datatbls); 
				foreach($supplierStatement as $row):
				$bil++?>
            	<tr>
                	<td style="display:none" ><?php echo $row->ID; ?></td>	
                	<td class="tac"><?php echo $bil; ?></td>
                	
                	<td class="tac"><?php echo date('d-m-Y', strtotime($row->transDate)); ?></td>
                    <td><?php echo $row->refNo ?></td>
                    <td><?php echo $row->formNo ?></td>
                	<td class="tac"><?php echo "description lah"; ?></td>
                    <?php
					$balance = 0;                    
					$balance += $row->dr;
					$balance -= $row->cr;
                     echo '<td class="tar">'.number_format($row->dr,2,'.',',').'</td>'; //dr
					 echo '<td class="tar">'.number_format($row->cr,2,'.',',').'</td>'; //cr
					 echo '<td class="tar">'.number_format($balance,2,'.',',').'</td>'; //balance?>
                </tr>
            <?php endforeach; ?>
            <tr style="border-top:1pt solid black;">
            <td colspan="8" class="tar"><h8><?php echo $this->lang->line('total').' '.
			number_format ($balance,2,'.',','); ?></h8></td>
            </tr>
            <tr>
        		<td></td>
            	<td></td>
            	<td></td>
            	<td></td>
                <td></td>
                <td></td>
                <td></td>
                <td></td>
                <td></td>
                <td></td>
        	</tr>
            <tr>
        		<td height="40"></td>
            	<td></td>
            	<td></td>
            	<td></td>
                <td></td>
                <td></td>
                <td></td>
                <td></td>
                <td></td>
                <td></td>
        	</tr>
            <tr>
        		<td colspan="10"><table border="1" width="100%">
                <tr>
                  <th width="17%"><?php echo $this->lang->line('current'); ?></th>
                  <th width="17%"><?php echo $this->lang->line('1M'); ?></th>
                  <th width="17%"><?php echo $this->lang->line('2M'); ?></th>
                  <th width="17%"><?php echo $this->lang->line('3M'); ?></th>
                  <th width="18%"><?php echo $this->lang->line('4M'); ?></th>
                  <th width="14%"><?php echo $this->lang->line('5M'); ?></th>
                </tr>
                <tr>  
                  <?php
				 // echo var_dump($supplierAging);
				    if($supplierAging)		
					foreach($supplierAging as $row1){
					   echo '<tr><td class="tar">'.$row1->current.'</td>';
					   echo '<td class="tar">'.$row1->month1.'</td>';
					   echo '<td class="tar">'.$row1->month2.'</td>';
					   echo '<td class="tar">'.$row1->month3.'</td>';
					   echo '<td class="tar">'.$row1->month4.'</td>';
					   echo '<td class="tar">'.$row1->month5.'</td>';
		               echo '</tr>';
              			echo '</table><br/>'; 
   			 			echo '<table border="1" width="100%">';
                		echo '<tr>';
                  		echo '<th width="17%" class="tar">'. $this->lang->line('current').'</th>';
                  		echo '<th width="17%" class="tar">'. $this->lang->line('6M').'</th>';
                  		echo '<th width="17%" class="tar">'. $this->lang->line('7M').'</th>';
                  		echo '<th width="17%" class="tar">'. $this->lang->line('8M').'</th>';
                  		echo '<th width="18%" class="tar">'. $this->lang->line('9M').'</th>';
						echo '<th width="18%" class="tar">'. $this->lang->line('10M').'</th>';
						echo '<th width="18%" class="tar">'. $this->lang->line('11M').'</th>';
                		echo '</tr><tr>';
					   echo '<td>'.$row1->month6.'</td>';
					   echo '<td>'.$row1->month7.'</td>';
					   echo '<td>'.$row1->month8.'</td>';
					   echo '<td>'.$row1->month9.'</td>';
					   echo '<td>'.$row1->month10.'</td>';
					   echo '<td>'.$row1->month11.'</td>';
		               echo '</tr>';
             			echo '</table><br/>'; 
			}?></td>
        	</tr>
            <tr>
        		<td></td>
            	<td></td>
            	<td></td>
            	<td></td>
                <td></td>
                <td></td>
                <td></td>
                <td></td>
                <td></td>
                <td></td>
        	</tr>
            <tr>
        		<td colspan="10"><div align="right">SYSTEM GENERATED NO SIGNATURE REQUIRED</div></td>
        	</tr>
            <tr>
        		<td colspan="10">
                <table border="1" width="100%">
           <tr>
             <td>THANK YOU FOR DOING BUSINESS WITH US</strong><p>Prepared by Salihin<br/>Copyright Controlled/Private and Confidential</p></td>
             </tr>
             <tr>
                <td>
                <div align="justify">WE SHALL BE GRATEFUL IF YOU LET US HAVE PAYMENT AS SOON AS POSSIBLE. ANY DISCREPANCY IN THIS STATEMENT PLEASE INFORM US IN WRITING WITHIN 10 DAYS.</div></td>
        	</tr></table>
            <tr>
        		<td></td>
            	<td></td>
            	<td></td>
            	<td></td>
                <td></td>
                <td></td>
                <td></td>
                <td></td>
                <td></td>
                <td></td>
        	</tr>
		</tbody>
	</table>                                         
</div>
<div style="page-break-after:always"></div>
</html>
