<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
    <head>
        <title>Journal <?php echo $menu_label ?></title>
    </head>
	<style type="text/css">
	  @media print {
		.noPrint { display: none; }
	  }
	</style>
    <body style="width:auto; margin:auto;">
        <div style="padding:2px">
            <a href="#" class="easyui-linkbutton noPrint" data-options="plain:true,iconCls:'icon-print'" onClick="window.print()">Print</a>
        </div><br />
		<div style="overflow:auto; height:550px;">
        <table width="90%" border="0" cellspacing="0" cellpadding="0" align="center">
            <tr>
		<td colspan="6" class="s0"><?php echo $detail->CompanyName ?></td>
            </tr>
    
            <tr>
		<td colspan="6" class="s0"><?php echo $detail->BranchName; ?></td>
            </tr>
            
            <tr>
		<td colspan="6" class="s1">Journal <?php echo $menu_label ?></td>
            </tr>
	
            <tr>
		<td colspan="6" class="s1">&nbsp;</td>
            </tr>
    
            <tr>
		<td width="20" class="s4">Account No</td>
		<td width="43" class="s4">Account Name</td>

		<td width="60" class="s4" align="right">Debit (Base)</td>
		<td width="50" class="s4" align="right">Credit (Base)</td>
		<td width="80" class="s4" align="right">Debit (Prime)</td>
		<td width="70" class="s4" align="right">Credit (Prime)</td>
            </tr>  

            <tr>
                <td class="s3" colspan="4"> <?php echo 'Receipt Number : ';?> <?php echo $detail->SRecNumber; ?> <?php echo 'Description : ';?> <?php echo $detail->SRecDesc; ?> </td>
            </tr>

            <tr height="7px">
                <td colspan="4"></td>                    
            </tr>

            <?php $invoice_number_loop = "";  ?>
           
            <?php 
			foreach($list as $row){ 
			$invoice_number_loop;
				$invoice_number = $row->SInvNumber;
				
                if($row->SRecSaldoCredit > 0) {                    
                    $debit_prime    = 0;
                    $credit_prime   = abs($row->AmountCurrency);
                } 
                else { 
                    $debit_prime    = abs($row->AmountCurrency);
                    $credit_prime   = 0;
                }
				
				if($invoice_number_loop != $invoice_number){
			  ?>
              			<tr height="5px">
                            <td class="s3" colspan="8">
                            <br>
                            <?php echo $invoice_number ;?>
                            	<hr>
                            </td>                    
                        </tr>
			  <?php	
				}
				else if($invoice_number == NULL){
				?>
                	<tr height="5px">
                            <td colspan="8">
                            <hr>
                            </td>                    
                        </tr>
                <?php
				}
				$invoice_number_loop = $invoice_number;
			?>    
            
                <tr height="15px">
                    <td class="s3"><?php echo $row->AccountNumber; ?></td>
                    <td class="s5"><?php echo $row->AccountName; ?></td>
                    <td class="s5" align="right"><?php echo number_format($row->SRecSaldoDebet,"2",",","."); ?></td>
                    <td class="s5" align="right"><?php echo number_format($row->SRecSaldoCredit,"2",",","."); ?></td>
                    
                    <td class="s5" align="right"><?php echo number_format($debit_prime,"2",",","."); ?></td>
                    <td class="s5" align="right"><?php echo number_format($credit_prime,"2",",","."); ?></td>
                </tr> 
            <?php } ?>

            <td class="s5" align="right" colspan="4">&nbsp;</td>
        </table>
        </div>
    </body>
</html>

