<?php declare(strict_types=1);ini_set('display_errors','0');header('Cache-Control: private, no-store, max-age=0');require_once __DIR__.'/../../includes/console_shell.php';require_login();require_acl('can_view','reports/attendance/daily-misspunch-log.php');require_once __DIR__.'/daily-misspunch-log-common.php';try{$o=dml_options($con);$f=dml_filters($_GET);$e=dml_validate($f,$o);$rows=$e?[]:dml_report($con,$f);$setting=dal_table_exists($con,'jos_app_usersetting')?(dal_rows($con,'SELECT store_name FROM jos_app_usersetting LIMIT 1')[0]??[]):[];$company=$setting['store_name']??APP_NAME;}catch(Throwable $x){$e=['Unable to generate print report.'];$rows=[];$company=APP_NAME;}?><!doctype html><html><head><meta charset="utf-8"><title>Daily Misspunch Log</title><style>@page{size:landscape;margin:8mm}body{font:11px Arial;color:#172033}table{width:100%;border-collapse:collapse}th,td{border:1px solid #222;padding:5px;text-align:center}th{background:#eee}.flex{display:block}.flex span{display:inline-block;margin:2px}button{margin-bottom:8px}@media print{button{display:none}}</style></head><body><button onclick="window.print()">Print</button><div style="text-align:center"><b><?=h((string)$company)?></b><h1>Daily Misspunch Log</h1><p><?=h(date('d-m-Y',strtotime($f['from'])))?> to <?=h(date('d-m-Y',strtotime($f['to'])))?></p></div><?php if($e):?><p><?=h(implode(' ',$e))?></p><?php else:dml_render($rows);?><script>addEventListener('load',()=>window.print())</script><?php endif;?></body></html>
