<!DOCTYPE html>
<html>
<head>
	<title>Marker</title>
	<style type="text/css">
		body {
            margin: 0;
            padding: 0;
            width: 4.6cm;
			height: 3.2cm;
			overflow: hidden;
			/*border: 1px solid black;*/
			font-family: 'helvetica';
			font-size: 8px
			box-sizing: border-box;
		}
	    table {
            width: 110%;
            height: 100%; /* Sesuaikan dengan tinggi body */
        
            border-collapse: collapse;
        }

        tr, td {
            height: auto; /* Tinggi otomatis */
            overflow: hidden;
            box-sizing: border-box;
        }
	    .tr-note td.lbl{
			font-size: 6px;
		}

		.ico-arrow {
			position: absolute;
			top: 7px;
			right: 0px;
			height: 23px;
		}

	</style>
	<script type="text/javascript" src="<?php echo base_url(); ?>assets/plugins/jquery/jquery.min.js"></script>
</head>
<body onload="window.print();">
	<table style="border-collapse: collapse;" border="1" cellpadding="1" width="100%">
		<?php 
			$tot = count($trx);
			$txt = '';
			
			foreach ($trx as $key => $value) {
				$is_row = false;
				$lspan = 3;
				if (strlen($value['trx_note']) > 0) {
					$is_row = true;
					$lspan = 4;
				}
				$is_row_cost = false;
				if (count($value['arr_cost']) > 0) {
					$is_row_cost = true;
					$lspan++;
				}
		?>
			<tr>
			    <!--<td rowspan="<?php echo $lspan;?>" width="70px">
			        <br>-->
				    <!--<div align="center"style="font-size: 10px;font-weight:bold;"><?php echo ''. $value['item_code'];?></div>-->
				   <!-- <div align="center"style="font-size: 12px;font-weight:bold;text-align:center;"><?php echo ' Stopwash ';?></div>
				  <img style="display:inline-block" src="https://quickchart.io/qr?size=70&text=<?php echo $value['item_code'];?>">
			        <div align="center"style="font-size: 10px;font-weight:bold;text-align:center;"><?php echo ($key + 1).'/'.$tot;?></div>
			       <div align="center"style="font-size: 10px;font-weight:bold;text-align:center;"><?php echo $outlet['outlet_name'];?></div>
			       <!--div align="center"style="font-size: 10px;text-align:center;"><?php echo''.Date('d M H:i', strtotime ($data['duedate']));?>
			    </td>-->
				<td colspan="2"
				<br>
				<br>
					<div style="font-size:12px;font-weight:bold;text-align:center;"><?php echo $data['customer_name'];?><br>
				    <?php echo substr((string) $data['code'], -5).' - ' .$outlet['outlet_name'];?>
				</div>
				</td>
				<td rowspan="<?php echo $lspan;?>" width="70px">
			        <br>
				    <div align="center"style="font-size: 12px;font-weight:bold;text-align:center;">
				        <?php echo ' Stopwash ';?></div>
				  <img style="display:inline-block" src="https://quickchart.io/qr?size=70&text=<?php echo $value['item_code'];?>">
			        <div align="center"style="font-size: 10px;font-weight:bold;text-align:center;"><?php echo ($key + 1).'/'.$tot;?></div>
			       <div align="center"style="font-size: 10px;font-weight:bold;text-align:center;"><?php echo $outlet['outlet_name'];?></div>
			      
			    </td>
			</tr>
			<tr>
				<td style="width: 20px!important; font-size: 16px; text-align: center; font-weight: bold;">
					<?php echo ($key + 1).'/'.$tot;?>
				</td>
				<td style="font-size: 10px;text-align:center;font-weight:bold;"><?php echo $value['product_name'];?><br>
				    <?php echo''.Date('d M H:i', strtotime ($data['duedate']));?>
				</td>
		   </tr>
			<tr>
				<td colspan="2"style="font-size: 10px;text-align:center;font-weight:bold;"><?php echo $value['colour'].', '.$value['hue'].', '.$value['spot'];?></td>
			</tr>
			<?php
				if ($is_row) {
			?>
			<tr>
				<td colspan="2"style="font-size: 10px;font-weight:bold;"><?php echo $value['trx_note'];?></td>
			</tr>
			<?php
				}
			?>
			<?php
				if (($is_row_cost)) {
					$txt_cost = '';
					foreach ($value['arr_cost'] as $c_key => $c_value) {
						$comma = ', +';
						if ($c_key == 0) {
							$comma = '+';
						}
						$txt_cost .= $comma.$c_value['name'];
					}
			?>
			
				<td colspan="2"><?php echo $txt_cost;?></td>
		    </tr>
		    <?php
				}
			?>
			</tr>
			<tr>
			    <!--<td align="center"style="font-size: 8px;font-weight:bold;"><?php echo''.Date('d M H:i', strtotime ($data['duedate']));?></td>
			    <td align="center"><?php echo $outlet['outlet_name'];?></td>
				<td colspan="1">
					<div style="font-size:12px;">-->
					
					<!--<?php echo $value['item_code'].',<br>klr: '.Date('d M (H:i)', strtotime($data['duedate']));?>-->
					</div>
				</td>
			</tr>
			<?php
			}
		?>
	</table>
</body>
</html>