<?php
require_once __DIR__ . '/../lib/FPDF/fpdf.php';
require_once __DIR__ . '/../config/db_remote.php';

$pdf=new FPDF();
$pdf->AddPage();
$pdf->SetFont('Arial','B',14);
$pdf->Cell(0,10,'Production Summary Report',0,1,'C');

$pdf->SetFont('Arial','',10);
$q=$mysqli->query("SELECT * FROM barcode_readings ORDER BY read_time DESC LIMIT 200");

while($r=$q->fetch_assoc()){
    $line = ($r['code']??'')." | ".($r['SKU']??'')." | ".($r['read_time']??'');
    $pdf->Cell(0,6,$line,0,1);
}

$pdf->Output('D','production_report.pdf');
