« Back to History
daily_summary.php
|
20260722_120325.php
Initial Domain Snapshot
Copy Code
<?php $st = $pdo->prepare(" SELECT psi.bill_date AS d, COUNT(*) AS total_bills, SUM(CASE WHEN pse.id IS NOT NULL THEN 1 ELSE 0 END) AS sent_bills FROM parcel_stock_in psi LEFT JOIN parcel_send_entry pse ON pse.company_id = psi.company_id AND psi.bill_no = pse.bill_no WHERE psi.company_id = ? AND psi.bill_date BETWEEN ? AND ? GROUP BY psi.bill_date ORDER BY psi.bill_date "); $st->execute([$company_id, $from, $to]); echo "<table class='table table-sm table-bordered table-striped'> <thead> <tr> <th>Date</th><th>Total</th><th>Sent</th><th>Pending</th> </tr> </thead><tbody>"; foreach ($st as $r) { $pending = $r['total_bills'] - $r['sent_bills']; echo "<tr> <td>".h($r['d'])."</td> <td class='text-center'>{$r['total_bills']}</td> <td class='text-center'>{$r['sent_bills']}</td> <td class='text-center fw-bold'>{$pending}</td> </tr>"; } echo "</tbody></table>";