fix report fpdf
This commit is contained in:
@@ -182,17 +182,47 @@ class Rpt_pr_direct extends MY_Controller
|
||||
$pdf->Line(15, $pdf->GetY(), 15 + $pageW, $pdf->GetY());
|
||||
$pdf->Ln(2);
|
||||
|
||||
// ── Info dokumen: 2 kolom (kiri & kanan) ─────────────────────────────
|
||||
$half = $pageW / 2;
|
||||
$lbl = 30;
|
||||
$val = $half - $lbl - 4;
|
||||
$startY = $pdf->GetY();
|
||||
$half = $pageW / 2;
|
||||
$lbl = 28;
|
||||
$val = $half - $lbl - 4;
|
||||
|
||||
// ── Kolom Kiri ────────────────────────────────────────────────────────
|
||||
$pdf->SetY($startY);
|
||||
|
||||
$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']),
|
||||
array('Nomor', $header['PurchaseRequestDirectNumber'], true),
|
||||
array('Tanggal', $this->_fmt_date($header['PurchaseRequestDirectDate']), false),
|
||||
array('Tanggal Pelaksanaan', $this->_fmt_date($header['PurchaseRequestDirectDateUse']), false),
|
||||
);
|
||||
|
||||
foreach ($left as $item) {
|
||||
$pdf->SetX(15);
|
||||
$pdf->SetFont('Arial_Narrow', '', 9);
|
||||
$pdf->Cell($lbl, 5, $item[0], 0, 0, 'L');
|
||||
$pdf->Cell(4, 5, ':', 0, 0, 'C');
|
||||
if (isset($item[2]) && $item[2]) {
|
||||
$pdf->SetFont('Arial_Narrow', 'B', 9);
|
||||
} else {
|
||||
$pdf->SetFont('Arial_Narrow', '', 9);
|
||||
}
|
||||
$pdf->Cell($val, 5, $item[1], 0, 1, 'L');
|
||||
}
|
||||
|
||||
// Keterangan langsung di bawah info kiri (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->MultiCell($val, 5, $header['PurchaseRequestDirectDescription'], 0, 'L');
|
||||
}
|
||||
$leftY = $pdf->GetY();
|
||||
|
||||
// ── Kolom Kanan ───────────────────────────────────────────────────────
|
||||
$pdf->SetY($startY);
|
||||
$rightX = 15 + $half;
|
||||
|
||||
$right = array(
|
||||
array('Cabang', $header['M_BranchName']),
|
||||
array('Regional', $header['S_RegionalName']),
|
||||
@@ -200,43 +230,22 @@ class Rpt_pr_direct extends MY_Controller
|
||||
array('Dibuat Oleh', $header['CreatedByName']),
|
||||
);
|
||||
|
||||
$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');
|
||||
} 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);
|
||||
}
|
||||
}
|
||||
|
||||
// Keterangan (catatan dihapus)
|
||||
if (!empty($header['PurchaseRequestDirectDescription'])) {
|
||||
foreach ($right as $item) {
|
||||
$pdf->SetX($rightX);
|
||||
$pdf->SetFont('Arial_Narrow', '', 9);
|
||||
$pdf->Cell($lbl, 5, 'Keterangan', 0, 0, 'L');
|
||||
$pdf->Cell($lbl, 5, $item[0], 0, 0, 'L');
|
||||
$pdf->Cell(4, 5, ':', 0, 0, 'C');
|
||||
$pdf->Cell($pageW - $lbl - 4, 5, $header['PurchaseRequestDirectDescription'], 0, 1, 'L');
|
||||
$pdf->SetFont('Arial_Narrow', '', 9);
|
||||
|
||||
if ($item[0] === 'Alamat') {
|
||||
$pdf->MultiCell($val, 5, $item[1], 0, 'L');
|
||||
} else {
|
||||
$pdf->Cell($val, 5, $item[1], 0, 1, 'L');
|
||||
}
|
||||
}
|
||||
$rightY = $pdf->GetY();
|
||||
|
||||
$pdf->Ln(4);
|
||||
$pdf->SetY(max($leftY, $rightY) + 4);
|
||||
}
|
||||
|
||||
// =========================================================================
|
||||
|
||||
Reference in New Issue
Block a user