From d11ef009724a3a08570ca7197fa193524318db5b Mon Sep 17 00:00:00 2001 From: Hanan Askarim Date: Wed, 15 Jul 2026 13:34:37 +0700 Subject: [PATCH] hapus bagian tanda tangan --- .../controllers/report/Rpt_pr_direct.php | 27 +--- .../report/Rpt_pr_direct_approval.php | 143 ++++++++---------- 2 files changed, 64 insertions(+), 106 deletions(-) diff --git a/application/controllers/report/Rpt_pr_direct.php b/application/controllers/report/Rpt_pr_direct.php index f51d52f..26a8420 100644 --- a/application/controllers/report/Rpt_pr_direct.php +++ b/application/controllers/report/Rpt_pr_direct.php @@ -101,7 +101,6 @@ 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'; @@ -195,9 +194,10 @@ class Rpt_pr_direct extends MY_Controller array('Status', $header['PurchaseRequestDirectStatus']), ); $right = array( - array('Cabang', $header['M_BranchName']), - array('Regional', $header['S_RegionalName']), - array('Alamat', $header['M_BranchAddress']), + array('Cabang', $header['M_BranchName']), + array('Regional', $header['S_RegionalName']), + array('Alamat', $header['M_BranchAddress']), + array('Dibuat Oleh', $header['CreatedByName']), ); $maxRow = max(count($left), count($right)); @@ -351,26 +351,7 @@ 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 diff --git a/application/controllers/report/Rpt_pr_direct_approval.php b/application/controllers/report/Rpt_pr_direct_approval.php index 864a6dc..310331c 100644 --- a/application/controllers/report/Rpt_pr_direct_approval.php +++ b/application/controllers/report/Rpt_pr_direct_approval.php @@ -108,7 +108,6 @@ class Rpt_pr_direct_approval extends MY_Controller $this->_pdf_header(); $this->_pdf_data($details); $this->_pdf_terms(); - $this->_pdf_signatures(); // ── Output ──────────────────────────────────────────────────────── $filename = 'PRD_APPROVAL_' . str_replace('/', '-', $header['PurchaseRequestDirectNumber']) . '.pdf'; @@ -191,65 +190,81 @@ class Rpt_pr_direct_approval extends MY_Controller $pdf->Ln(2); // ── Info dokumen: 2 kolom (kiri & kanan) ───────────────────────────── - $half = $pageW / 2; - $lbl = 30; - $val = $half - $lbl - 4; + $startY = $pdf->GetY(); + $halfW = $pageW / 2; + $lblW = 28; + $valW = $halfW - $lblW - 4; - $left = array( - array('Nomor', $header['PurchaseRequestDirectNumber']), - array('Tanggal', $this->_fmt_date($header['PurchaseRequestDirectDate'])), - array('Tanggal Pelaksanaan', $this->_fmt_date($header['PurchaseRequestDirectDateUse'])), - array('Status', $header['PurchaseRequestDirectStatus']), - ); - $right = array( - array('Cabang', $header['M_BranchName']), - array('Regional', $header['S_RegionalName']), - array('Alamat', $header['M_BranchAddress']), + // ── Kolom Kiri ──────────────────────────────────────────────────────── + $pdf->SetY($startY); + + $leftItems = array( + array('Nomor', $header['PurchaseRequestDirectNumber'], true), + array('Tanggal', $this->_fmt_date($header['PurchaseRequestDirectDate']), false), + array('Tanggal Pelaksanaan', $this->_fmt_date($header['PurchaseRequestDirectDateUse']), false), + array('Status', $header['PurchaseRequestDirectStatus'], false), ); - $maxRow = max(count($left), count($right)); - for ($i = 0; $i < $maxRow; $i++) { - // kolom kiri - if (isset($left[$i])) { - $pdf->SetFont('Arial_Narrow', '', 9); - $pdf->Cell($lbl, 5, $left[$i][0], 0, 0, 'L'); - $pdf->Cell(4, 5, ':', 0, 0, 'C'); - if ($left[$i][0] === 'Nomor') { - $pdf->SetFont('Arial_Narrow', 'B', 9); - } else { - $pdf->SetFont('Arial_Narrow', '', 9); - } - $pdf->Cell($val, 5, $left[$i][1], 0, 0, 'L'); + foreach ($leftItems as $item) { + $pdf->SetX(15); + $pdf->SetFont('Arial_Narrow', '', 9); + $pdf->Cell($lblW, 5, $item[0], 0, 0, 'L'); + $pdf->Cell(4, 5, ':', 0, 0, 'C'); + if ($item[2]) { + $pdf->SetFont('Arial_Narrow', 'B', 9); } else { - $pdf->Cell($half, 5, '', 0, 0); - } - // kolom kanan - if (isset($right[$i])) { $pdf->SetFont('Arial_Narrow', '', 9); - $pdf->Cell($lbl, 5, $right[$i][0], 0, 0, 'L'); - $pdf->Cell(4, 5, ':', 0, 0, 'C'); - $pdf->SetFont('Arial_Narrow', '', 9); - $pdf->Cell($val, 5, $right[$i][1], 0, 1, 'L'); - } else { - $pdf->Cell($half, 5, '', 0, 1); } + $pdf->Cell($valW, 5, $item[1], 0, 1, 'L'); } - // Keterangan & Catatan (full width) + // Keterangan & Catatan langsung di bawah Status (tanpa spasi vertikal) if (!empty($header['PurchaseRequestDirectDescription'])) { + $pdf->SetX(15); $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'); + $pdf->Cell($lblW, 5, 'Keterangan', 0, 0, 'L'); + $pdf->Cell(4, 5, ':', 0, 0, 'C'); + $pdf->MultiCell($valW, 5, $header['PurchaseRequestDirectDescription'], 0, 'L'); } if (!empty($header['PurchaseRequestDirectNote'])) { + $pdf->SetX(15); $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->Cell($lblW, 5, 'Catatan', 0, 0, 'L'); + $pdf->Cell(4, 5, ':', 0, 0, 'C'); + $pdf->MultiCell($valW, 5, $header['PurchaseRequestDirectNote'], 0, 'L'); } + $leftY = $pdf->GetY(); - $pdf->Ln(4); + // ── Kolom Kanan ─────────────────────────────────────────────────────── + $pdf->SetY($startY); + $rightX = 15 + $halfW; + + $rightItems = array( + array('Cabang', $header['M_BranchName']), + array('Regional', $header['S_RegionalName']), + array('Alamat', $header['M_BranchAddress']), + array('Dibuat Oleh', $header['CreatedByName']), + array('Disetujui Oleh', $header['ApprovedByName']), + array('Tanggal Approved', $this->_fmt_datetime($header['PurchaseRequestDirectApprovedDate'])), + ); + + foreach ($rightItems as $item) { + $pdf->SetX($rightX); + $pdf->SetFont('Arial_Narrow', '', 9); + $pdf->Cell($lblW, 5, $item[0], 0, 0, 'L'); + $pdf->Cell(4, 5, ':', 0, 0, 'C'); + $pdf->SetFont('Arial_Narrow', '', 9); + + if ($item[0] === 'Alamat') { + $pdf->MultiCell($valW, 5, $item[1], 0, 'L'); + } else { + $pdf->Cell($valW, 5, $item[1], 0, 1, 'L'); + } + } + $rightY = $pdf->GetY(); + + // Posisikan Y ke yang paling bawah + margin + $pdf->SetY(max($leftY, $rightY) + 4); } // ========================================================================= @@ -365,44 +380,6 @@ class Rpt_pr_direct_approval extends MY_Controller } } - // ========================================================================= - // PDF SECTION: Tanda Tangan (Requestor, Reviewer, Approver) - // ========================================================================= - private function _pdf_signatures() - { - $pdf = $this->_pdf; - $pageW = $this->_pageW; - $header = $this->_header_data; - - // 3 kolom ttd - $colTtd = $pageW / 3; - - $pdf->Ln(8); - $pdf->SetFont('Arial_Narrow', '', 9); - $pdf->Cell($colTtd, 5, 'Dibuat oleh,', 0, 0, 'C'); - $pdf->Cell($colTtd, 5, 'Diketahui oleh,', 0, 0, 'C'); - $pdf->Cell($colTtd, 5, 'Disetujui oleh,', 0, 1, 'C'); - - $pdf->Ln(15); // Ruang tanda tangan - $pdf->SetFont('Arial_Narrow', 'B', 9); - - // Nama pembuat - $pdf->Cell($colTtd, 5, '( ' . ($header['CreatedByName'] ?: ' ') . ' )', 0, 0, 'C'); - - // Diketahui - $pdf->Cell($colTtd, 5, '( )', 0, 0, 'C'); - - // Penyetuju + info tanggal disetujui di bawah namanya - $pdf->Cell($colTtd, 5, '( ' . ($header['ApprovedByName'] ?: ' ') . ' )', 0, 1, 'C'); - - // Info Tanggal Approval di bawah ttd approver - if (!empty($header['ApprovedByName']) && $header['PurchaseRequestDirectApprovedDate'] !== '0000-00-00 00:00:00') { - $pdf->SetFont('Arial_Narrow', '', 7); - $pdf->Cell($colTtd * 2, 4, '', 0, 0); - $pdf->Cell($colTtd, 4, 'Approved: ' . date('d-m-Y H:i', strtotime($header['PurchaseRequestDirectApprovedDate'])), 0, 1, 'C'); - } - } - // ========================================================================= // HELPER: Format tampilan // =========================================================================