fix report fpdf

This commit is contained in:
Hanan Askarim
2026-07-17 15:39:07 +07:00
committed by sasadib
parent 2c349c4f6e
commit b5028c06dd
13 changed files with 1401 additions and 152 deletions

View File

@@ -221,7 +221,6 @@ class Rpt_receive_item_po extends MY_Controller
$leftItems = array(
array('Nomor', $header['ReceiveOrderPoNumber'], true),
array('Tanggal', $this->_fmt_date($header['ReceiveOrderPoIDate']), false),
array('No. Referensi', $header['ReceiveOrderPoRefNumber'] ?: '-', false),
array('No. Surat Jalan', $header['ReceiveOrderPoDONumber'] ?: '-', false),
array('Gudang Penerima', $header['ReceivedWarehouseName'] ?: '-', false),
);
@@ -290,15 +289,14 @@ class Rpt_receive_item_po extends MY_Controller
// ── Definisi kolom: [label, lebar, align] ─────────────────────────────
// Total lebar = 180mm (A4 portrait: 210 - margin 15 kiri - 15 kanan)
// 8 + 45 + 38 + 20 + 15 + 24 + 30 = 180
// 8 + 75 + 23 + 15 + 27 + 32 = 180
$cols = array(
array('No', 8, 'C'),
array('Nama', 45, 'L'),
array('No. PO', 38, 'L'),
array('Unit', 20, 'C'),
array('Nama', 75, 'L'),
array('Unit', 23, 'C'),
array('Qty', 15, 'C'),
array('Harga', 24, 'R'),
array('Total', 30, 'R'),
array('Harga', 27, 'R'),
array('Total', 32, 'R'),
);
// Header kolom
@@ -321,11 +319,10 @@ class Rpt_receive_item_po extends MY_Controller
foreach ($details as $d) {
$pdf->Cell($cols[0][1], 6, $no, 1, 0, 'C');
$pdf->Cell($cols[1][1], 6, $d['M_ItemDesc'] ?: ($d['M_ItemCode'] ?: '-'), 1, 0, 'L');
$pdf->Cell($cols[2][1], 6, $d['PurchaseOrderNumber'] ?: '-', 1, 0, 'L');
$pdf->Cell($cols[3][1], 6, $d['ItemUnitName'] ?: ($d['ItemUnitCode'] ?: '-'), 1, 0, 'C');
$pdf->Cell($cols[4][1], 6, $this->_fmt_qty($d['ReceiveOrderPoDetailQty']), 1, 0, 'C');
$pdf->Cell($cols[5][1], 6, $this->_fmt_rp($d['ReceiveOrderPoDetailPrice']), 1, 0, 'R');
$pdf->Cell($cols[6][1], 6, $this->_fmt_rp($d['ReceiveOrderPoDetailTotal']), 1, 0, 'R');
$pdf->Cell($cols[2][1], 6, $d['ItemUnitName'] ?: ($d['ItemUnitCode'] ?: '-'), 1, 0, 'C');
$pdf->Cell($cols[3][1], 6, $this->_fmt_qty($d['ReceiveOrderPoDetailQty']), 1, 0, 'C');
$pdf->Cell($cols[4][1], 6, $this->_fmt_rp($d['ReceiveOrderPoDetailPrice']), 1, 0, 'R');
$pdf->Cell($cols[5][1], 6, $this->_fmt_rp($d['ReceiveOrderPoDetailTotal']), 1, 0, 'R');
$pdf->Ln();
$grand_tot += floatval($d['ReceiveOrderPoDetailTotal']);
@@ -333,12 +330,12 @@ class Rpt_receive_item_po extends MY_Controller
}
// Baris TOTAL
$span = array_sum(array_column(array_slice($cols, 0, 6), 1));
$span = array_sum(array_column(array_slice($cols, 0, 5), 1));
$pdf->SetLineWidth(0.3);
$pdf->SetFont('Arial_Narrow', 'B', 9); // bold + size 9 agar menonjol
$pdf->SetFillColor(220, 220, 220);
$pdf->Cell($span, 7, 'TOTAL', 1, 0, 'R', true);
$pdf->Cell($cols[6][1], 7, $this->_fmt_rp($grand_tot), 1, 0, 'R', true);
$pdf->Cell($cols[5][1], 7, $this->_fmt_rp($grand_tot), 1, 0, 'R', true);
$pdf->Ln(6);
// Ringkasan Biaya jika ada Biaya Ekspedisi (mendukung fallback dari PO)
@@ -360,9 +357,9 @@ class Rpt_receive_item_po extends MY_Controller
array('Grand Total', $this->_fmt_rp($grandTotal)),
);
$cW1 = 39;
$cW2 = 30;
$offsetX = 15 + array_sum(array_column(array_slice($cols, 0, 4), 1));
$cW1 = 27;
$cW2 = 32;
$offsetX = 15 + array_sum(array_column(array_slice($cols, 0, 4), 1));
foreach ($summary as $s) {
$pdf->SetX($offsetX);