From 686db5ed4354e3dd2632638e4c1e9fc067a5562e Mon Sep 17 00:00:00 2001 From: "sas.fajri" Date: Tue, 9 Jun 2026 09:19:25 +0700 Subject: [PATCH] FHM08062601IBL - fix table border: pakai Rect() untuk outer border, row separator via 'B' only Co-Authored-By: Claude Sonnet 4.6 --- .../controllers/tools/Rpt_lab_result.php | 30 +++++++++++-------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/application/controllers/tools/Rpt_lab_result.php b/application/controllers/tools/Rpt_lab_result.php index ff1ce7b1..5261a91d 100644 --- a/application/controllers/tools/Rpt_lab_result.php +++ b/application/controllers/tools/Rpt_lab_result.php @@ -308,6 +308,8 @@ class Rpt_lab_result extends MY_Controller $col_w_arr = array_values($col); $row_h = 6; + $y_table_start = $pdf->GetY(); + $pdf->SetFont($fnt, 'B', $fs); $pdf->SetFillColor(240, 240, 240); $pdf->SetX($ml); @@ -317,6 +319,11 @@ class Rpt_lab_result extends MY_Controller $pdf->Ln(); // ── Table rows ──────────────────────────────────────────────────────── + // Strategy: + // - Group/SubSubGroup rows : full-width cell, border 'B' (bottom only) + // - Test rows : each cell border 'B' (no internal vertical lines) + // - Outer L/R/T/B : drawn via Rect() after all rows + $prev_subgroup = null; $prev_subsubgroup = null; $qr_url = ''; @@ -336,25 +343,23 @@ class Rpt_lab_result extends MY_Controller $qr_url = $d['qrreport']; } - // Level 1: SubGroup (bold, full width) + // Level 1: SubGroup — bold, full-width, bottom separator only if ($subgroup !== '' && $subgroup !== $prev_subgroup) { $pdf->SetX($ml); $pdf->SetFont($fnt, 'B', $fs); - $pdf->Cell($cw, $row_h, $subgroup, 'LR', 1, 'L'); - $pdf->SetX($ml); $pdf->Cell($cw, 0, '', 'T', 1); + $pdf->Cell($cw, $row_h, $subgroup, 'B', 1, 'L'); $prev_subgroup = $subgroup; $prev_subsubgroup = null; } - // Level 2: SubSubGroup (italic, full width) + // Level 2: SubSubGroup — italic, full-width, bottom separator only if ($subsubgroup !== '' && $subsubgroup !== $prev_subsubgroup) { $pdf->SetX($ml); $pdf->SetFont($fnt, 'I', $fs); - $pdf->Cell($cw, $row_h, ' ' . $this->_s($subsubgroup), 'LR', 1, 'L'); - $pdf->SetX($ml); $pdf->Cell($cw, 0, '', 'T', 1); + $pdf->Cell($cw, $row_h, ' ' . $this->_s($subsubgroup), 'B', 1, 'L'); $prev_subsubgroup = $subsubgroup; } - // Level 3: Test row — indent via spaces (always draw from $ml full width) + // Level 3: Test row — indent via spaces, bottom separator per cell $sp = 0; $prefix = ''; if ($sascode_len >= 10 && $sascode_len < 12) { $sp = 2; } elseif ($sascode_len >= 12 && $sascode_len < 14) { $sp = 4; $prefix = chr(183) . ' '; } @@ -375,22 +380,21 @@ class Rpt_lab_result extends MY_Controller } } - // Render cells — selalu dari $ml, full width per kolom + // Render cells — bottom border only, outer L/R via Rect() $x_cur = $ml; foreach ($texts as $i => $txt) { $w = $col_w_arr[$i]; $align = ($i === 0) ? 'L' : 'C'; $pdf->SetXY($x_cur, $y_start); - $pdf->Cell($w, $row_height, $txt, 'LR', 0, $align); + $pdf->Cell($w, $row_height, $txt, 'B', 0, $align); $x_cur += $w; } $pdf->SetXY($ml, $y_start + $row_height); - $pdf->SetX($ml); $pdf->Cell($cw, 0, '', 'T', 1); } - // Tutup tabel (outer bottom border) - $pdf->SetX($ml); - $pdf->Cell($cw, 0, '', 'B', 1); + // Outer rectangle — clean single-weight border for entire table + $y_table_end = $pdf->GetY(); + $pdf->Rect($ml, $y_table_start, $cw, $y_table_end - $y_table_start); // ── Catatan ─────────────────────────────────────────────────────────── $pdf->Ln(3);