create api rpt pr direct approval
This commit is contained in:
@@ -101,6 +101,7 @@ class Rpt_pr_direct extends MY_Controller
|
||||
$this->_pdf_header();
|
||||
$this->_pdf_data($details);
|
||||
$this->_pdf_terms();
|
||||
$this->_pdf_signatures();
|
||||
|
||||
// ── Output ────────────────────────────────────────────────────────
|
||||
$filename = 'PRD_' . str_replace('/', '-', $header['PurchaseRequestDirectNumber']) . '.pdf';
|
||||
@@ -227,19 +228,13 @@ class Rpt_pr_direct extends MY_Controller
|
||||
}
|
||||
}
|
||||
|
||||
// Keterangan & Catatan (full width)
|
||||
// Keterangan (catatan dihapus)
|
||||
if (!empty($header['PurchaseRequestDirectDescription'])) {
|
||||
$pdf->SetFont('Arial_Narrow', '', 9);
|
||||
$pdf->Cell($lbl, 5, 'Keterangan', 0, 0, 'L');
|
||||
$pdf->Cell(4, 5, ':', 0, 0, 'C');
|
||||
$pdf->Cell($pageW - $lbl - 4, 5, $header['PurchaseRequestDirectDescription'], 0, 1, 'L');
|
||||
}
|
||||
if (!empty($header['PurchaseRequestDirectNote'])) {
|
||||
$pdf->SetFont('Arial_Narrow', '', 9);
|
||||
$pdf->Cell($lbl, 5, 'Catatan', 0, 0, 'L');
|
||||
$pdf->Cell(4, 5, ':', 0, 0, 'C');
|
||||
$pdf->Cell($pageW - $lbl - 4, 5, $header['PurchaseRequestDirectNote'], 0, 1, 'L');
|
||||
}
|
||||
|
||||
$pdf->Ln(4);
|
||||
}
|
||||
@@ -255,14 +250,13 @@ class Rpt_pr_direct extends MY_Controller
|
||||
|
||||
// ── Definisi kolom: [label, lebar, align] ─────────────────────────────
|
||||
// Total lebar = 180mm (A4 portrait: 210 - margin 15 kiri - 15 kanan)
|
||||
// 8 + 42 + 25 + 15 + 17 + 18 + 28 + 27 = 180
|
||||
// 8 + 50 + 30 + 15 + 22 + 28 + 27 = 180 (Qty Disetujui dihapus)
|
||||
$cols = array(
|
||||
array('No', 8, 'C'),
|
||||
array('Nama', 42, 'L'),
|
||||
array('Kategori', 25, 'L'),
|
||||
array('Nama', 50, 'L'),
|
||||
array('Kategori', 30, 'L'),
|
||||
array('Unit', 15, 'C'),
|
||||
array('Qty Request', 17, 'R'),
|
||||
array('Qty Disetujui', 18, 'R'),
|
||||
array('Qty Request', 22, 'R'),
|
||||
array('Harga', 28, 'R'),
|
||||
array('Total', 27, 'R'),
|
||||
);
|
||||
@@ -290,9 +284,8 @@ class Rpt_pr_direct extends MY_Controller
|
||||
$pdf->Cell($cols[2][1], 6, $d['PurchaseDirectCategoryName'] ?: '-', 1, 0, 'L');
|
||||
$pdf->Cell($cols[3][1], 6, $d['ItemUnitName'], 1, 0, 'C');
|
||||
$pdf->Cell($cols[4][1], 6, $this->_fmt_qty($d['PurchaseRequestDirectDetailAmountRequest']), 1, 0, 'R');
|
||||
$pdf->Cell($cols[5][1], 6, $this->_fmt_qty($d['PurchaseRequestDirectDetailAmount']), 1, 0, 'R');
|
||||
$pdf->Cell($cols[6][1], 6, $this->_fmt_rp($d['PurchaseRequestDirectDetailEstimationPrice']), 1, 0, 'R');
|
||||
$pdf->Cell($cols[7][1], 6, $this->_fmt_rp($d['PurchaseRequestDirectDetailTotalEstimationPrice']), 1, 0, 'R');
|
||||
$pdf->Cell($cols[5][1], 6, $this->_fmt_rp($d['PurchaseRequestDirectDetailEstimationPrice']), 1, 0, 'R');
|
||||
$pdf->Cell($cols[6][1], 6, $this->_fmt_rp($d['PurchaseRequestDirectDetailTotalEstimationPrice']), 1, 0, 'R');
|
||||
$pdf->Ln();
|
||||
|
||||
$total_est += floatval($d['PurchaseRequestDirectDetailTotalEstimationPrice']);
|
||||
@@ -300,12 +293,12 @@ class Rpt_pr_direct extends MY_Controller
|
||||
}
|
||||
|
||||
// Baris TOTAL
|
||||
$span = array_sum(array_column(array_slice($cols, 0, 7), 1));
|
||||
$span = array_sum(array_column(array_slice($cols, 0, 6), 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[7][1], 7, $this->_fmt_rp($total_est), 1, 0, 'R', true);
|
||||
$pdf->Cell($cols[6][1], 7, $this->_fmt_rp($total_est), 1, 0, 'R', true);
|
||||
$pdf->Ln();
|
||||
|
||||
// ── Ringkasan nilai (rata kanan) ──────────────────────────────────────
|
||||
@@ -357,6 +350,28 @@ class Rpt_pr_direct extends MY_Controller
|
||||
}
|
||||
}
|
||||
|
||||
// =========================================================================
|
||||
// PDF SECTION: Tanda Tangan
|
||||
// =========================================================================
|
||||
private function _pdf_signatures()
|
||||
{
|
||||
$pdf = $this->_pdf;
|
||||
$pageW = $this->_pageW;
|
||||
$header = $this->_header_data;
|
||||
|
||||
$colTtd = $pageW / 2;
|
||||
|
||||
$pdf->Ln(8);
|
||||
$pdf->SetFont('Arial_Narrow', '', 9);
|
||||
$pdf->Cell($colTtd, 5, 'Dibuat oleh,', 0, 0, 'C');
|
||||
$pdf->Cell($colTtd, 5, 'Diketahui oleh,', 0, 1, 'C');
|
||||
|
||||
$pdf->Ln(15); // Ruang tanda tangan
|
||||
$pdf->SetFont('Arial_Narrow', 'B', 9);
|
||||
$pdf->Cell($colTtd, 5, '( ' . ($header['CreatedByName'] ?: ' ') . ' )', 0, 0, 'C');
|
||||
$pdf->Cell($colTtd, 5, '( )', 0, 1, 'C');
|
||||
}
|
||||
|
||||
// =========================================================================
|
||||
// HELPER: Format tampilan
|
||||
// =========================================================================
|
||||
|
||||
Reference in New Issue
Block a user