« Back to History
beam_load_print.php
|
20260721_154032.php
Initial Bulk Import
Copy Code
<?php error_reporting(E_ALL); ini_set('display_errors', 1); /* ================= AUTH ================= */ require_once __DIR__ . '/modules/auth/page_acl.php'; $ctx = page_require_access('beam_load_manage'); $pdo = $ctx['pdo']; $company_id = (int)$ctx['company_id']; function h($s){ return htmlspecialchars((string)$s, ENT_QUOTES, 'UTF-8'); } /* ================= INPUTS ================= */ $machine_no = $_GET['machine_no'] ?? ''; $beam_no = $_GET['beam_no'] ?? ''; $from_date = $_GET['from_date'] ?? ''; $to_date = $_GET['to_date'] ?? ''; /* ================= WHERE ================= */ $where = "WHERE company_id = :cid"; $params = [':cid' => $company_id]; if ($machine_no !== '') { $where .= " AND machine_no = :machine_no"; $params[':machine_no'] = $machine_no; } if ($beam_no !== '') { $where .= " AND beam_no LIKE :beam_no"; $params[':beam_no'] = "%$beam_no%"; } if ($from_date && $to_date) { $where .= " AND load_date BETWEEN :from AND :to"; $params[':from'] = $from_date; $params[':to'] = $to_date; } /* ================= DATA ================= */ $sql = " SELECT * FROM beam_load_data $where ORDER BY load_date DESC, id DESC "; $stmt = $pdo->prepare($sql); $stmt->execute($params); $rows = $stmt->fetchAll(PDO::FETCH_ASSOC); $page_title = 'Beam Load Print'; require_once __DIR__ . '/partials/header.php'; ?> <div class="container-fluid py-4"> <div class="card"> <div class="card-body"> <h4 class="fw-bold mb-3">Beam Load Report</h4> <table class="table table-bordered table-sm"> <thead class="table-light"> <tr> <th>ID</th> <th>Beam No</th> <th>Machine</th> <th>Slot</th> <th>Quality</th> <th>Load Type</th> <th>Load Date</th> </tr> </thead> <tbody> <?php if(!$rows): ?> <tr> <td colspan="7" class="text-center text-muted py-4"> No Data Found </td> </tr> <?php endif; ?> <?php foreach($rows as $r): ?> <tr> <td><?=h($r['id'])?></td> <td><?=h($r['beam_no'])?></td> <td><?=h($r['machine_no'])?></td> <td><?=h($r['beam_slot'])?></td> <td><?=h($r['quality_id'])?></td> <td><?=h($r['load_type'])?></td> <td><?=h($r['load_date'])?></td> </tr> <?php endforeach; ?> </tbody> </table> </div> </div> </div> <script> window.onload = function(){ window.print(); }; </script> <?php require_once __DIR__ . '/partials/footer.php'; ?>