« Back to History
send_report.php
|
20260721_154033.php
Initial Bulk Import
Copy Code
<?php function splitParcelSendRemark($remark) { $remark = trim((string)$remark); $sendFrom = ''; if ($remark !== '' && preg_match('/^Send From:\s*(.+?)(?:\s*\|\s*(.*))?$/i', $remark, $matches)) { $sendFrom = trim($matches[1]); $remark = trim($matches[2] ?? ''); } return [$sendFrom, $remark]; } $st = $pdo->prepare(" SELECT pse.bill_no,pse.vehicle_no,pse.send_date,pse.remark, psi.transport,psi.station FROM parcel_send_entry pse LEFT JOIN parcel_stock_in psi ON psi.company_id = pse.company_id AND psi.bill_no = pse.bill_no WHERE pse.company_id = ? AND pse.send_date BETWEEN ? AND ? ORDER BY pse.send_date "); $st->execute([$company_id,$from,$to]); echo "<table class='table table-sm table-bordered table-striped'>"; echo "<thead><tr> <th>Bill</th><th>Transport</th><th>Station</th> <th>Vehicle</th><th>Date</th><th>Send From</th><th>Remark</th> </tr></thead><tbody>"; foreach($st as $r){ [$sendFrom, $remark] = splitParcelSendRemark($r['remark'] ?? ''); echo "<tr> <td>".h($r['bill_no'])."</td> <td>".h($r['transport'])."</td> <td>".h($r['station'])."</td> <td>".h($r['vehicle_no'])."</td> <td>".h($r['send_date'])."</td> <td>".h($sendFrom ?: '-')."</td> <td>".h($remark ?: '-')."</td> </tr>"; } echo "</tbody></table>";