FHM08062601IBL - fix table border: pakai Rect() untuk outer border, row separator via 'B' only
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user