From 6c7aaf0dd0b415aced07a60a28ea2452f1fdf1ee Mon Sep 17 00:00:00 2001 From: "sas.fajri" Date: Tue, 9 Jun 2026 09:13:11 +0700 Subject: [PATCH] FHM08062601IBL - fix font Helvetica 10pt (match BIRT Calibri), 3cm kop gap, form_rev pojok kanan atas, fix cell indent Co-Authored-By: Claude Sonnet 4.6 --- .../controllers/tools/Rpt_lab_result.php | 114 +++++++++--------- 1 file changed, 58 insertions(+), 56 deletions(-) diff --git a/application/controllers/tools/Rpt_lab_result.php b/application/controllers/tools/Rpt_lab_result.php index c51b140e..ff1ce7b1 100644 --- a/application/controllers/tools/Rpt_lab_result.php +++ b/application/controllers/tools/Rpt_lab_result.php @@ -166,7 +166,7 @@ class Rpt_lab_result extends MY_Controller } public function Footer() { $ml = 10; $cw = $this->GetPageWidth() - 20; - $this->SetFont('Arial', '', 8); + $this->SetFont('Helvetica', '', 10); // Validasi Oleh (kanan) $this->SetY(-38); @@ -204,15 +204,27 @@ class Rpt_lab_result extends MY_Controller $mr = 10; $cw = $pw - $ml - $mr; // 190 - // ── Page header ────────────────────────────────────────────────────── + // Form revision number + $form_row = $this->db_onedev->query( + "SELECT IFNULL(M_No_FormRev,'') AS M_No_FormRev FROM m_no_form WHERE M_No_FormName='LAB' AND M_No_FormIsActive='Y' LIMIT 1" + ); + $form_rev = $form_row ? $this->_s($form_row->row_array()['M_No_FormRev'] ?? '') : ''; + + // ── Pojok kanan atas: lab number + form rev ─────────────────────────── + $pdf->SetFont('Helvetica', '', 8); + $pdf->SetXY($ml, 5); + $top_right = trim($lab_number . ($form_rev ? ' ' . $form_rev : '')); + $pdf->Cell($cw, 5, $top_right, 0, 1, 'R'); + + // ── 3cm gap untuk kop (y=30) ───────────────────────────────────────── $company_addr = $this->_s($co['S_SystemsCompanyAddress'] ?? 'Jl. LL. RE. Martadinata No. 135'); $company_city = $this->_s($co['S_SystemsCompanyCity'] ?? 'Bandung'); $company_phone = $this->_s($co['S_SystemsCompanyPhone'] ?? '(022)7271946'); $addr_line = $company_addr . ' ' . $company_city . ' Telp. ' . $company_phone; $pj_name = $this->_s($h['M_DoctorName'] ?? ''); - $pdf->SetFont('Arial', '', 8); - $pdf->SetXY($ml, 8); + $pdf->SetFont('Helvetica', '', 10); + $pdf->SetXY($ml, 30); $pdf->Cell($cw / 2, 5, $addr_line, 0, 0, 'L'); $pdf->SetX($ml + $cw / 2); $pdf->Cell($cw / 2, 5, 'Penanggung Jawab : ' . $pj_name, 0, 1, 'R'); @@ -245,14 +257,17 @@ class Rpt_lab_result extends MY_Controller ['NO. TLP. / HP', $this->_s($h['M_PatientHp'] ?? '-')], ]; - $pdf->SetFont('Arial', '', 8); + $fnt = 'Helvetica'; // match Calibri (BIRT) + $fs = 10; // 10pt = font size BIRT + + $pdf->SetFont($fnt, '', $fs); $y_info_start = $pdf->GetY(); // Barcode (teks) di atas kolom kanan $pdf->SetXY($ml + $lw, $y_info_start); - $pdf->SetFont('Arial', 'B', 9); - $pdf->Cell($rw, 6, '||| ' . $pid . ' |||', 0, 1, 'C'); - $pdf->SetFont('Arial', '', 8); + $pdf->SetFont($fnt, 'B', 11); + $pdf->Cell($rw, 7, '||| ' . $pid . ' |||', 0, 1, 'C'); + $pdf->SetFont($fnt, '', $fs); $y_right_start = $pdf->GetY(); $y_left_cur = $y_info_start; @@ -262,11 +277,11 @@ class Rpt_lab_result extends MY_Controller foreach ($left_rows as $r) { $y = $pdf->GetY(); $pdf->SetXY($ml, $y); - $pdf->SetFont('Arial', '', 8); - $pdf->Cell($lbl_w, 5, $r[0], 0, 0); - $pdf->Cell($col_w, 5, ':', 0, 0, 'C'); + $pdf->SetFont($fnt, '', $fs); + $pdf->Cell($lbl_w, 6, $r[0], 0, 0); + $pdf->Cell($col_w, 6, ':', 0, 0, 'C'); $pdf->SetXY($ml + $lbl_w + $col_w, $y); - $pdf->MultiCell($val_w, 5, $r[1], 0, 'L'); + $pdf->MultiCell($val_w, 6, $r[1], 0, 'L'); } $y_left_cur = $pdf->GetY(); @@ -275,25 +290,25 @@ class Rpt_lab_result extends MY_Controller foreach ($right_rows as $r) { $y = $pdf->GetY(); $pdf->SetXY($ml + $lw, $y); - $pdf->SetFont('Arial', '', 8); - $pdf->Cell($lbl_rw, 5, $r[0], 0, 0); - $pdf->Cell($col_w, 5, ':', 0, 0, 'C'); + $pdf->SetFont($fnt, '', $fs); + $pdf->Cell($lbl_rw, 6, $r[0], 0, 0); + $pdf->Cell($col_w, 6, ':', 0, 0, 'C'); $pdf->SetXY($ml + $lw + $lbl_rw + $col_w, $y); - $pdf->MultiCell($val_rw, 5, $r[1], 0, 'L'); + $pdf->MultiCell($val_rw, 6, $r[1], 0, 'L'); } $y_right_cur = $pdf->GetY(); $pdf->SetY(max($y_left_cur, $y_right_cur) + 2); $pdf->SetX($ml); $pdf->Cell($cw, 0.3, '', 'T', 1); - $pdf->Ln(1); + $pdf->Ln(2); // ── Table header ───────────────────────────────────────────────────── - $col = ['JENIS PEMERIKSAAN' => 67, 'HASIL' => 25, 'NILAI RUJUKAN' => 51, 'SATUAN' => 20, 'METODE' => 27]; + $col = ['JENIS PEMERIKSAAN' => 67, 'HASIL' => 25, 'NILAI RUJUKAN' => 51, 'SATUAN' => 20, 'METODE' => 27]; $col_w_arr = array_values($col); - $row_h = 5; + $row_h = 6; - $pdf->SetFont('Arial', 'B', 8); + $pdf->SetFont($fnt, 'B', $fs); $pdf->SetFillColor(240, 240, 240); $pdf->SetX($ml); foreach ($col as $label => $w) { @@ -302,11 +317,6 @@ class Rpt_lab_result extends MY_Controller $pdf->Ln(); // ── Table rows ──────────────────────────────────────────────────────── - // sp_rpt_hasil_lab columns: - // Nat_SubGroupName, Nat_SubSubGroupName, T_TestSasCode, T_TestName - // T_OrderDetailResult, T_OrderDetailNormalValueNote, T_OrderDetailNat_UnitName - // T_OrderdetailNat_MethodeName, T_OrderDetailResultFlag, qrreport - $prev_subgroup = null; $prev_subsubgroup = null; $qr_url = ''; @@ -329,61 +339,53 @@ class Rpt_lab_result extends MY_Controller // Level 1: SubGroup (bold, full width) if ($subgroup !== '' && $subgroup !== $prev_subgroup) { $pdf->SetX($ml); - $pdf->SetFont('Arial', 'B', 8); + $pdf->SetFont($fnt, 'B', $fs); $pdf->Cell($cw, $row_h, $subgroup, 'LR', 1, 'L'); - $pdf->SetX($ml); - $pdf->Cell($cw, 0, '', 'T', 1); - $prev_subgroup = $subgroup; - $prev_subsubgroup = null; + $pdf->SetX($ml); $pdf->Cell($cw, 0, '', 'T', 1); + $prev_subgroup = $subgroup; $prev_subsubgroup = null; } // Level 2: SubSubGroup (italic, full width) if ($subsubgroup !== '' && $subsubgroup !== $prev_subsubgroup) { $pdf->SetX($ml); - $pdf->SetFont('Arial', 'I', 8); + $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->SetX($ml); $pdf->Cell($cw, 0, '', 'T', 1); $prev_subsubgroup = $subsubgroup; } - // Level 3: Test row — indented by SasCode length - $indent = 0; - $prefix = ''; - if ($sascode_len >= 10 && $sascode_len < 12) { $indent = 3; } - elseif ($sascode_len >= 12 && $sascode_len < 14) { $indent = 6; $prefix = chr(183) . ' '; } - elseif ($sascode_len >= 14) { $indent = 9; $prefix = chr(183) . ' '; } + // Level 3: Test row — indent via spaces (always draw from $ml full width) + $sp = 0; $prefix = ''; + if ($sascode_len >= 10 && $sascode_len < 12) { $sp = 2; } + elseif ($sascode_len >= 12 && $sascode_len < 14) { $sp = 4; $prefix = chr(183) . ' '; } + elseif ($sascode_len >= 14) { $sp = 6; $prefix = chr(183) . ' '; } + $display_name = str_repeat(' ', $sp) . $prefix . $test_name; - $display_name = $prefix . $test_name; - - $pdf->SetFont('Arial', $is_abnormal ? 'B' : '', 8); - $x_start = $ml; + $pdf->SetFont($fnt, $is_abnormal ? 'B' : '', $fs); $y_start = $pdf->GetY(); // Hitung row height $row_height = $row_h; - $texts = [$display_name, $result, $normal, $unit, $method]; + $texts = [$display_name, $result, $normal, $unit, $method]; foreach ($texts as $i => $txt) { - $avail = $col_w_arr[$i] - 2 - ($i === 0 ? $indent : 0); + $avail = $col_w_arr[$i] - 2; if ($avail > 0 && $pdf->GetStringWidth($txt) > $avail) { $lines = (int) ceil($pdf->GetStringWidth($txt) / $avail); $row_height = max($row_height, $lines * $row_h); } } - // Render cells - $x_cur = $x_start; + // Render cells — selalu dari $ml, full width per kolom + $x_cur = $ml; foreach ($texts as $i => $txt) { - $w = $col_w_arr[$i]; - $pad_l = ($i === 0) ? $indent : 0; - $align = ($i === 0) ? 'L' : 'C'; - $pdf->SetXY($x_cur + $pad_l, $y_start); - $pdf->Cell($w - $pad_l, $row_height, $txt, 'LR', 0, $align); + $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); $x_cur += $w; } $pdf->SetXY($ml, $y_start + $row_height); - $pdf->SetX($ml); - $pdf->Cell($cw, 0, '', 'T', 1); + $pdf->SetX($ml); $pdf->Cell($cw, 0, '', 'T', 1); } // Tutup tabel (outer bottom border) @@ -392,14 +394,14 @@ class Rpt_lab_result extends MY_Controller // ── Catatan ─────────────────────────────────────────────────────────── $pdf->Ln(3); - $pdf->SetFont('Arial', '', 8); + $pdf->SetFont($fnt, '', $fs); $pdf->SetX($ml); $pdf->Cell($cw, $row_h, 'Catatan :', 0, 1, 'L'); $pdf->Ln(2); // ── Waktu Pengambilan Spesimen ──────────────────────────────────────── if (!empty($sampling)) { - $pdf->SetFont('Arial', '', 8); + $pdf->SetFont($fnt, '', $fs); $pdf->SetX($ml); $pdf->Cell($cw, $row_h, 'Waktu Pengambilan Spesimen', 0, 1, 'L'); foreach ($sampling as $s) {