<?php 
	$total_change = $data['total_pay'] - $data['grand_total_final'];
	if ($data['payment_status'] == 'PANJAR') {
		$total_change = $data['total_pay'] - $data['total_panjar'];
	}
?>
<!DOCTYPE html>
<html>
<head>
	<title>Bill</title>
	<style type="text/css">
		body {
			width: 100mm;
			/*border: 1px solid black;*/
			font-family: 'helvetica';
			font-size: 14px;
		}
		.tr-note td.lbl{
			font-size: 12px;
		}
		.box-production {
			border: 1px solid black;
			padding: 5px;
			display: inline-block;
			width: 45mm;
		}
	</style>
	<script type="text/javascript" src="<?php echo base_url(); ?>assets/plugins/jquery/jquery.min.js"></script>
    <script type="text/javascript" src="<?php echo base_url(); ?>assets/plugins/barcode/barcode.js"></script>
</head>
<body onload="window.print();">
	<div style="vertical-align: middle;">
		<div style="display: inline-block;vertical-align: middle;">
		</div>
		<div style="display: inline-block;vertical-align: middle;">
			<div style="margin-top:25px;">
		       <div align="center">
			   <div style="font-size:25px">
				<?php echo $data['code'];?>
			</div>
		</div>
		<div>Diprint pada tanggal: <?php echo Date('d-m-Y').' Jam: '.Date('H:i');?></div>
	</div>
	<hr>
	<div align="center">
		<div style="font-size: 16px">
			<?php echo $outlet['outlet_name'];?>
		</div>
		<?php 
			echo $outlet['address']."<br>";
			echo $outlet['phone']."<br>";
		?>
	</div>
	<div style="margin-top: 10px;">
		<table>
			<tr>
				<td valign="top">Nama</td>
				<td valign="top" width="10px" align="center">:</td>
				<td valign="top"><?php echo $data['customer_name'];?></td>
			</tr>
			<tr>
				<td valign="top">Tgl Transaksi</td>
				<td valign="top" width="10px" align="center">:</td>
				<td valign="top"><?php echo Date('d-m-Y H:i', strtotime($data['date']));?></td>
			</tr>
			<tr>
				<td valign="top">Tgl Selesai</td>
				<td valign="top" width="10px" align="center">:</td>
				<td valign="top"><?php echo Date('d-m-Y H:i', strtotime($data['duedate']));?></td>
			</tr>
		</table>
	</div>
	<div style="margin-top:20px;">
		<?php 
			$tot = count($trx);
			foreach ($trx as $key => $value) {
		?>
		<div>
			<?php echo ($key + 1).'/'.$tot.' '.$value['product_name'].'. '.$value['colour'].'. '.$value['hue'].'. '.$value['spot'];?>
		    <?php 
				if (strlen($value['trx_note']) > 0) {
			?>
			<div>
				Ket: <?php echo $value['trx_note'];?>
			</div>
			<?php
				}
			?>
			<?php
				$txt_cost = '';
				foreach ($value['arr_cost'] as $c_key => $c_value) {
					$comma = ', +';
					if ($c_key == 0) {
						$comma = '+';
					}
					$txt_cost .= $comma.$c_value['name'];
				}
			?>
			<div><?php echo $txt_cost;?></div>
		</div>
		<?php
			}
		?>
	</div>
</body>
</html>

<script type="text/javascript">
    $("#barcode").barcode("<?php echo $data['code'];?>", "code128", {barWidth:1, barHeight:30, output:"bmp", bgColor:"white", showHRI:false}); 
        
    $("#barcode object").css("width", "100%");
    $("#barcode object").css("height", "30px");
</script>