<?php $title='Ingredient Ledger (Print)'; ob_start(); ?>
<style>
body{font-size:11px;}
@media print{ .no-print{display:none;} }
table{width:100%; border-collapse:collapse;}
th,td{border:1px solid #999; padding:2px 3px;}
thead{background:#eee;}
</style>
<div class="no-print"><button onclick="window.print()">Print</button> <a href="/samanta_crm/stock/ingredients?mode=ledger">Back</a></div>
<h3>Ingredient Storage Ledger</h3>
<table>
<thead><tr><th>ID</th><th>Ing ID</th><th><?= __("common.name", "Name") ?></th><th>Loc</th><th>Qty</th><th>Unit</th><th>Reason</th><th>Ref Date</th><th>Note</th><th>Created</th><th>Updated</th></tr></thead>
<tbody>
<?php foreach($rows as $r): ?>
<tr>
<td><?=$r['id']?></td>
<td><?=$r['ingredient_id']?></td>
<td><?=htmlspecialchars($r['name'])?></td>
<td><?=htmlspecialchars($r['location'])?></td>
<td><?= (int)round($r['change_qty']) ?></td>
<td><?=htmlspecialchars($r['unit'])?></td>
<td><?=htmlspecialchars($r['reason'])?></td>
<td><?=htmlspecialchars($r['ref_date'])?></td>
<td><?=htmlspecialchars($r['note'])?></td>
<td><?=htmlspecialchars(substr($r['created_at']??'',0,19))?></td>
<td><?=htmlspecialchars(substr($r['updated_at']??'',0,19))?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php $content=ob_get_clean(); require __DIR__.'/../layout.php'; ?>