<!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>Customer Statement</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()?>customerStatement/getCustomerStatementList_excel/<?php echo $dateFrom?>/<?php echo $dateTo?>/53";
	window.location.href = url;
}
</script>
</head>

<table width="100%" border="0" align="center" cellpadding="1" cellspacing="0">
    
    <tr>
        <td align="center" colspan="2">
            <div class="printButton" align="center">
        	<?php 
			$js = 'onClick="do_print()" class="btn-icon btn-success-form Print" title="Print"';
			echo form_button('Print','<span class="i-printer">',$js);?>&nbsp;&nbsp; <?php
			$js = 'onClick="do_printexcel()" class="btn-icon btn-warning-form EXCEL" title="Download"';
			echo form_button('EXCEL','<span class="i-download">',$js);?>&nbsp;&nbsp; <?php
			$js = 'onClick="javascript:window.close();" class="btn-icon btn-danger-form Close" title="Close"';
			echo form_button('Close','<span class="i-switch">',$js);?>
            </div>
        </td>
    </tr>
    <tr>
                            <td colspan="2" >
                                <p style="text-align: right; margin:0; padding-right: 10px; font-weight: 500; line-height: 2; padding-bottom: 0px; padding-top: 0px; color: black; font-size: 25px;">
                                    <?php if(isset($rptTitle)) echo $rptTitle; ?>
                                </p>
                                        <p style="text-align:center; font-size:16px;"> 
                                            <span style=" font-weight:800;"><?php echo $companyInfo->companyName; ?></span> <span style="font-size:10px;"><?php echo "(".$companyInfo->companyNo.")";?></span><br />
                                            <span style="font-size:10px;"><?php echo "GST Registration No : ".$companyInfo->gstRegisteredNo; ?></span><br />
                                        </p>
                                        <p style="text-align:center; font-size:10px; line-height:1.4; padding:0 0 5px; margin:0; border-bottom:1px solid #eeeeee;">

                                            <?php if(!empty($companyInfo->line1)): ?><span><?php echo $companyInfo->line1; ?></span><br /><?php endif; ?>
                                            <?php if(!empty($companyInfo->line2) || !empty($companyInfo->line3)): ?><span><?php echo $companyInfo->line2.", ".$companyInfo->line3; ?></span><br /><?php endif; ?>
                                            <?php if(!empty($companyInfo->companyPostCode) || !empty($companyInfo->city)): ?><span><?php echo $companyInfo->companyPostCode . '  ' . $companyInfo->city; ?> </span><br /><?php endif; ?>
                                            <?php if(!empty($companyInfo->fldname) || !empty($companyInfo->fldcountry)): ?><span><?php echo $companyInfo->fldname . '  ' . $companyInfo->fldcountry; ?> </span><br /><?php endif; ?>
                                            <?php if(!empty($companyInfo->phoneNo) || !empty($companyInfo->faxNo)): ?><span><?php echo 'Phone : ' . $companyInfo->phoneNo . '  Fax : ' . $companyInfo->faxNo; ?> </span><?php endif; ?>
                                        </p>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <?php
                                if (isset($leftContentHeader)){
                                    echo "<p style='padding-left:10px; margin:0; font-size:11px; '>"
                                    . "<strong>".$leftContentHeader."</strong></p>";
                                }
                                 
                                 if (isset($leftContent)){
                                   echo '<p style="padding-left:10px; margin:0; line-height:1.4;">';
                                    foreach ($leftContent as $value) {
                                         echo $value != ''?"<span>".$value."</span><br />":'';
                                     }
                                  echo '</p>';
                                 }
                                
                                ?>
                            </td>
                                
                                <td style="float:right;" valign="top">
                                    <p style="line-height:1.4; text-align:left;">
                                        <?php
	                                        if (isset($rightContentHeader)){
	                                        	echo "<p style='padding-right:10px; margin:0; font-size:11px; '>"
	                                        			. "<strong>".$rightContentHeader."</strong></p>";
	                                        } 
                                            if (isset($rightContent)){
                                                 foreach ($rightContent as $value) {
                                                    echo $value != ''?"<span>".$value."</span><br />":'';
                                                }
                                            }
                                        ?>
                                    </p>
                                  </td>
                            </tr>
</table>
<div>
	<table border="0" cellpadding="1" cellspacing="0" width="100%">
		<thead>
		
        <tr>
        	<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b><?php echo $customerDetails->customerName." (".$customerDetails->customerCompanyNo.")";?></b></td>
        	<td></td>
            <td></td>
            <td></td>
            <td class="tar"><b><?php echo "As at :"." ".date('d-m-Y'); ?></b></td>
        </tr>
        <?php if(!empty($customerDetails->gstRegNo)): ?>
        <tr>
       	  <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php echo 'GST Registration No : '.$customerDetails->gstRegNo;?><br></td>
        	<td></td>
            <td></td>
            <td></td>
            <td>&nbsp;</td>
        </tr>
        <?php endif; ?>
        <tr>
          <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $customerDetails->line1;?><br></td>
            <td></td>
            <td></td>
            <td></td>
            <td>&nbsp;</td>
        </tr>
        <tr>
        	<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $customerDetails->line2;?><br/></td>
        	<td></td>
            <td></td>
            <td></td>
          <td>&nbsp;</td>
        </tr>
        <tr>
        	<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $customerDetails->line3;?></td>
        	<td></td>
            <td></td>
            <td></td>
            <td>&nbsp;</td>
        </tr>
        <tr>
        	<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $customerDetails->customerPostCode;?><?php echo $customerDetails->city;?></td>
        	<td></td>
            <td></td>
            <td></td>
            <td>&nbsp;</td>
        </tr>
        <tr>
        	<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $customerDetails->phoneNumber1;?></td>
        	<td></td>
            <td></td>
            <td></td>
          <td>&nbsp;</td>
        </tr>
        <tr>
        	<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $customerDetails->fax;?></td>
        	<td></td>
            <td></td>
            <td></td>
            <td>&nbsp;</td>
        </tr>
        <tr>
        	<td></td>
            <td></td>
            <td></td>
        </tr>
        </tbody>
        </table>
        <script type="text/javascript" src="<?php echo base_url(); ?>js/jquery/jquery-2.0.0.min.js"></script>
        <script type="text/javascript">
			$(window).load(function(){      
				$(window).resize();
			});
        	$(window).resize(function(){ 
				if($('.image').length){
					$('.image').width($('.image').parents('thead').width());
					$('.image').height($('.image').parents('thead').find('tr:nth-child(2)').height());
				}
			});
        </script>
        <table border="0" cellpadding="0" cellspacing="0" width="100%" style="position:relative;">
		<thead>
        	<tr>
            	<td colspan="9">
                <img class="image" style="position:absolute;left:0;top:0;z-index: -1000;width:100%" alt="" src="<?php echo base_url() ?>img/rptPaymentAdvice.png" />
                </td>
            </tr>
        	<tr>
              	<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>
                <th><?php echo form_label($this->lang->line('formNo'),'formNo');?></th>   
                <th><?php echo form_label($this->lang->line('description'),'description');?></th>
                <th class="tar"><?php echo form_label($this->lang->line('dr'),'dr');?></th>    
                <th class="tar"><?php echo form_label($this->lang->line('cr'),'cr');?></th>   
                <th class="tar"><?php echo form_label($this->lang->line('balance'),'balance');?></th>   
            </tr>
        </thead>
        <tbody>
	<?php $bil = 0;
			//echo var_dump($datatbls);
			if ($customerStatement) { 
                $balance = 0;
				foreach($customerStatement 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 $row->transType; ?></td>
                    <?php                    
					$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 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($customerAging)		
					foreach($customerAging as $row1){
					   echo '<tr><td class="tar">'.number_format($row1->current, 2).'</td>';
					   echo '<td class="tar">'.number_format($row1->month1, 2).'</td>';
					   echo '<td class="tar">'.number_format($row1->month2, 2).'</td>';
					   echo '<td class="tar">'.number_format($row1->month3, 2).'</td>';
					   echo '<td class="tar">'.number_format($row1->month4, 2).'</td>';
					   echo '<td class="tar">'.number_format($row1->month5, 2).'</td>';
		               echo '</tr>';
              		   echo '</table><br/>'; 
   			 		   echo '<table border="1" width="100%">';
                	   echo '<tr>';
                  	   //echo '<th width="17%">'. $this->lang->line('current').'</th>';
                  	   echo '<th width="17%">'. $this->lang->line('6M').'</th>';
                  	   echo '<th width="17%">'. $this->lang->line('7M').'</th>';
                  	   echo '<th width="17%">'. $this->lang->line('8M').'</th>';
                  	   echo '<th width="18%">'. $this->lang->line('9M').'</th>';
					   echo '<th width="18%">'. $this->lang->line('10M').'</th>';
					   echo '<th width="18%">'. $this->lang->line('11M').'</th>';
                	   echo '</tr><tr>';
					   echo '<td class="tar">'.number_format($row1->month6, 2).'</td>';
					   echo '<td class="tar">'.number_format($row1->month7, 2).'</td>';
					   echo '<td class="tar">'.number_format($row1->month8, 2).'</td>';
					   echo '<td class="tar">'.number_format($row1->month9, 2).'</td>';
					   echo '<td class="tar">'.number_format($row1->month10, 2).'</td>';
					   echo '<td class="tar">'.number_format($row1->month11, 2).'</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"><?php echo $this->lang->line('buttom1')?></div></td>
        	</tr>
            <tr>
        		<td colspan="10">
                <table border="1" width="100%">
           <tr>
             <td>
                <?php echo $this->session->userdata('footerLine1'); ?><br />
                <?php echo $this->session->userdata('footerLine2'); ?><br />
                <?php echo $this->session->userdata('footerLine3'); ?></td>
             </tr>
             <tr>
                <td>
                <div align="justify"><?php echo $this->lang->line('buttom5')?></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>
