tambah kolom server di pdf barang bawaan

This commit is contained in:
2026-07-29 08:01:24 +07:00
parent 7d90548717
commit 4c2fefe9c3
2 changed files with 13 additions and 8 deletions
+9 -6
View File
@@ -8,7 +8,7 @@ class PDF_BarangBawaan extends FPDF
private $tanggal;
private $teknisi;
private $colWidths = [8, 18, 27, 44, 26, 10, 57];
private $colWidths = [8, 18, 27, 42, 24, 10, 46, 15];
public function __construct($orientation = 'L', $unit = 'mm', $size = 'A5')
{
@@ -57,7 +57,7 @@ class PDF_BarangBawaan extends FPDF
$this->SetTextColor(255, 255, 255);
$this->SetFont('Arial', 'B', 7);
$headers = ['No', 'Tanggal', 'Barcode', 'Nama Barang', 'Serial Number', 'Jumlah', 'Keterangan'];
$headers = ['No', 'Tanggal', 'Barcode', 'Nama Barang', 'Serial Number', 'Jumlah', 'Keterangan', 'Server'];
foreach ($headers as $i => $h) {
$this->Cell($this->colWidths[$i], 7, $h, 1, 0, 'C', true);
}
@@ -73,8 +73,8 @@ class PDF_BarangBawaan extends FPDF
$minRowH = 8;
$no = 1;
$colsMultiCell = [false, false, true, true, true, false, true];
$cellAligns = ['C', 'C', 'L', 'L', 'L', 'C', 'L'];
$colsMultiCell = [false, false, true, true, true, false, true, false];
$cellAligns = ['C', 'C', 'L', 'L', 'L', 'C', 'L', 'L'];
foreach ($items as $item) {
$keterangan = isset($item->keterangan) ? $item->keterangan : '';
@@ -82,6 +82,7 @@ class PDF_BarangBawaan extends FPDF
$serial = $item->serial_number ?? '-';
$barcode = $item->barcode ?? '-';
$jumlah = isset($item->qty_sisa) ? (int)$item->qty_sisa : 1;
$server = '';
$cellValues = [
(string)$no,
@@ -90,7 +91,8 @@ class PDF_BarangBawaan extends FPDF
$namaBarang,
$serial,
(string)$jumlah,
$keterangan
$keterangan,
$server
];
$maxLines = 1;
@@ -122,7 +124,8 @@ class PDF_BarangBawaan extends FPDF
foreach ($cellValues as $i => $val) {
$this->SetXY($currentX, $startY);
if ($colsMultiCell[$i]) {
$contentH = $maxLines * $lineH;
$colLines = $this->NbLines($this->colWidths[$i], $val);
$contentH = $colLines * $lineH;
$offsetY = ($rowH - $contentH) / 2;
$this->SetXY($currentX, $startY + $offsetY);
$this->MultiCell($this->colWidths[$i], $lineH, $val, 0, $cellAligns[$i]);