<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Preview Journal Transaction</title>
<link rel="stylesheet" type="text/css" href="<?php echo base_url()?>assets/custom/css/print_new.css">
<style type="text/css">
@media print {
.noPrint { display: none; }
}
.ahover:hover{
	cursor: pointer;
	color:blue;
}
</style>
</head>
<body style="width:auto; margin:auto">
	<div id="form-header" data-options="region:'north',border:false">
		<div id="form-header-wrapper">
          <table cellpadding="0" cellspacing="0" width="100%">
              <tr>
                  <td  valign="middle">
                      <a href="#" class="easyui-linkbutton noPrint" data-options="plain:true,iconCls:'icon-print'" onClick="print_detail()">Print</a>
                   </td>
              </tr>
          </table>  
        </div>     
		<div id="print-container-balancesheet">
			<table width="90%" border="0" cellspacing="0" cellpadding="0" align="center">
				<tr>
					<td colspan="6" class="s0 " align="center"><span class="normal_bold"><?php echo $branch->CompanyName;?></span></td>
				</tr>
			    <tr>
					<td colspan="6" class="s0" align="center"><span class="normal_bold"><?php echo $branch->BranchName;?></span></td>
				</tr>
				<tr>
					<td colspan="6" class="s1" align="center"><span class="normal_bold">List Journal Balance Sheet</span></td>
				</tr>

				<tr>
					<td colspan="6" class="s2" align="center">Period : <?= $month_period[0] ?> <?= $year[0] ?> &amp; <?= $month_period[1] ?> <?= $year[1] ?></td>
				</tr>
				<tr>
					<td colspan="6" class="s2" align="center" height="20"></td>
				</tr>
				<tr>
					<td width="150" class="s4 text-left" align="left"><span class="normal_bold">Journal Date</span></td>
					<td width="150" class="s4 text-left" align="left"><span class="normal_bold">Journal Number</span></td>
					<td width="150" class="s4 text-left" align="left"><span class="normal_bold">Journal Desc</span></td>
					<!-- <td width="150" class="s4 text-right" align="right"><span class="normal_bold">Currency Rate</span></td> -->
					<td width="160" class="s4 text-right" align="right"><span class="normal_bold">Debet</span></td>
					<td width="160" class="s4 text-right" align="right"><span class="normal_bold">Credit</span></td>
					<td width="160" class="s4 text-right" align="right"><span class="normal_bold">Type</span></td>
				</tr>
				
				<tr>
					 <td height="23" class="s3" colspan="6"> <?php echo 'Account Number : ';?> <?php echo $Account_Number; ?> <?php echo 'Account Name : ';?> <?php echo $Account_Name; ?></td>
				</tr> 
				<?php for($x=0;$x<count($month);$x++):?> 
					<tr>
						<td class="s3 text-left" align="left"><span class="normal_bold"><?php echo change_month_indonesia($month[$x]); ?> <?= $year[$x]?></span></td>
						<td class="s5 text-left" align="left"><span class="normal_bold" >Saldo Opening Balance</span></td> 
						<td class="s5 text-right" align="right" colspan="1"><span class="normal_bold"></span></td>
						<?php if($debet_credit['plus'] == 'Debet'):?>
							<td class="s5 text-right" align="right"><span class="normal_bold"><?= ($saldo_opening_balance[$x] > 0 ) ? number_format($saldo_opening_balance[$x],"2",",",".") : number_format(0,"2",",",".") ?></span></td>
							<td class="s5 text-right" align="right"><span class="normal_bold" style="<?= ($saldo_opening_balance[$x] < 0)? 'color:#FF6666' : '' ?>"><?= ($saldo_opening_balance[$x] < 0 ) ? formatRp_acc($saldo_opening_balance[$x]) : number_format(0,"2",",",".") ?></span></td>
						<?php else:?>
							<td class="s5 text-right" align="right"><span class="normal_bold"><?= ($saldo_opening_balance[$x] < 0 ) ? number_format($saldo_opening_balance[$x],"2",",",".") : number_format(0,"2",",",".") ?></span></td>
							<td class="s5 text-right" align="right"><span class="normal_bold" style="<?= ($saldo_opening_balance[$x] < 0)? 'color:#FF6666' : '' ?>"><?= ($saldo_opening_balance[$x] > 0 ) ? formatRp_acc($saldo_opening_balance[$x]) : number_format(0,"2",",",".") ?></span></td>
						<?php endif;?>
						<td class="s5 text-right" align="right"><span class="normal_bold">Opening Balance</span></td>
					</tr>	
					<?php foreach($all_journal as $row):?>
						<?php if(($month[$x] == date('m',strtotime($row->Journal_Date))) and ($year[$x] == date('Y',strtotime($row->Journal_Date)))):?>
							<tr>
								<td class="s3 text-left" align="left"><span class="normal_bold"><?php echo convert_to_dmy($row->Journal_Date); ?></span></td>
								<td class="s5 text-left" align="left"><span class="normal_bold ahover" onclick="open_transaction('<?php echo $row->Journal_Number;?>','<?php echo $row->Trans_Type;?>')"><?php echo $row->Journal_Number; ?></span></td> 
								<td class="s5 text-left" align="left"><span class="normal_bold"><?php echo $row->Journal_Desc; ?></span></td>
								<!-- <td class="s5 text-right" align="right"><span class="normal_bold"><?php //echo number_format($row->CurrencyRate,"2",",","."); ?></span></td> -->
								<td class="s5 text-right" align="right"><span class="normal_bold"><?php echo number_format($row->Saldo_Debet,"2",",","."); ?></span></td>
								<td class="s5 text-right" align="right"><span class="normal_bold"><?php echo number_format($row->Saldo_Credit,"2",",","."); ?></span></td>
								<td class="s5 text-right" align="right"><span class="normal_bold"><?php echo $row->Trans_Type; ?></span></td>
							</tr>
						<?php endif;?> 
					<?php endforeach;?>
					<tr>
					 	<td height="30" class="s3" colspan="6"> </td>
					</tr> 
				<?php endfor;?>
			</table>
		</div>
	</div>
</body>
</html>
<script type="text/javascript">
function print_detail(){
  //var opt_print   = $("input[type='radio'][name='opt_print']:checked").val();
  var data_print  = $("#print-container-balancesheet").html();
  Popup(data_print);
  
}

function Popup(data) 
{
    var mywindow = window.open('', 'print-container', 'height=528,width=700');
    var css = css_print_lama();
    mywindow.document.write('<html><head><title>Print Detail</title>');
    mywindow.document.write(css);
    mywindow.document.write('</head><body >');
    mywindow.document.write(data);
    mywindow.document.write('</body></html>');

    mywindow.document.close(); // necessary for IE >= 10
    mywindow.focus(); // necessary for IE >= 10

    mywindow.print();
    mywindow.close();

    return true;
}
</script>