Perubahan barcode dan inventory
This commit is contained in:
@@ -41,49 +41,55 @@ class PDF extends FPDF
|
||||
|
||||
function Header()
|
||||
{
|
||||
// Logo (opsional)
|
||||
if (!empty($this->logo) && file_exists($this->logo)) {
|
||||
$this->Image($this->logo, 10, 6, 18);
|
||||
$this->SetXY(31, 10);
|
||||
// Header lengkap hanya di halaman pertama
|
||||
if ($this->PageNo() === 1) {
|
||||
// Logo (opsional)
|
||||
if (!empty($this->logo) && file_exists($this->logo)) {
|
||||
$this->Image($this->logo, 10, 6, 18);
|
||||
$this->SetXY(31, 10);
|
||||
} else {
|
||||
$this->SetXY(10, 10);
|
||||
}
|
||||
|
||||
// Nama perusahaan
|
||||
$this->SetFont('Arial', 'B', 12);
|
||||
$this->Cell(0, 6, $this->nama, 0, 1, 'L');
|
||||
|
||||
// Alamat
|
||||
$this->SetFont('Arial', '', 9);
|
||||
$x = !empty($this->logo) && file_exists($this->logo) ? 31 : 10;
|
||||
$this->SetX($x);
|
||||
$this->Cell(0, 5, $this->alamat, 0, 1, 'L');
|
||||
|
||||
// Garis pemisah (A4 Portrait: x=10 s/d x=200)
|
||||
$this->Ln(2);
|
||||
$this->SetLineWidth(0.6);
|
||||
$this->Line(10, $this->GetY(), 200, $this->GetY());
|
||||
$this->SetLineWidth(0.2);
|
||||
$this->Line(10, $this->GetY() + 1, 200, $this->GetY() + 1);
|
||||
$this->Ln(5);
|
||||
|
||||
// Judul
|
||||
$this->SetFont('Arial', 'B', 13);
|
||||
$this->SetTextColor(245, 140, 0);
|
||||
$this->Cell(0, 7, 'LAPORAN NERACA SALDO', 0, 1, 'C');
|
||||
$this->SetTextColor(0, 0, 0);
|
||||
|
||||
// Periode
|
||||
$this->SetFont('Arial', '', 10);
|
||||
$this->Cell(0, 5, $this->periodeStr, 0, 1, 'C');
|
||||
|
||||
// Tanggal cetak
|
||||
$this->SetFont('Arial', '', 9);
|
||||
$this->Cell(0, 5, 'Di Cetak Pada : ' . date('d-m-Y') . ' - ' . date('H:i:s'), 0, 1, 'C');
|
||||
|
||||
$this->Ln(4);
|
||||
} else {
|
||||
$this->SetXY(10, 10);
|
||||
// Halaman berikutnya tanpa header laporan
|
||||
$this->SetY(10);
|
||||
}
|
||||
|
||||
// Nama perusahaan
|
||||
$this->SetFont('Arial', 'B', 12);
|
||||
$this->Cell(0, 6, $this->nama, 0, 1, 'L');
|
||||
|
||||
// Alamat
|
||||
$this->SetFont('Arial', '', 9);
|
||||
$x = !empty($this->logo) && file_exists($this->logo) ? 31 : 10;
|
||||
$this->SetX($x);
|
||||
$this->Cell(0, 5, $this->alamat, 0, 1, 'L');
|
||||
|
||||
// Garis pemisah (A4 Portrait: x=10 s/d x=200)
|
||||
$this->Ln(2);
|
||||
$this->SetLineWidth(0.6);
|
||||
$this->Line(10, $this->GetY(), 200, $this->GetY());
|
||||
$this->SetLineWidth(0.2);
|
||||
$this->Line(10, $this->GetY() + 1, 200, $this->GetY() + 1);
|
||||
$this->Ln(5);
|
||||
|
||||
// Judul
|
||||
$this->SetFont('Arial', 'B', 13);
|
||||
$this->SetTextColor(245, 140, 0);
|
||||
$this->Cell(0, 7, 'LAPORAN NERACA SALDO', 0, 1, 'C');
|
||||
$this->SetTextColor(0, 0, 0);
|
||||
|
||||
// Periode
|
||||
$this->SetFont('Arial', '', 10);
|
||||
$this->Cell(0, 5, $this->periodeStr, 0, 1, 'C');
|
||||
|
||||
// Tanggal cetak
|
||||
$this->SetFont('Arial', '', 9);
|
||||
$this->Cell(0, 5, 'Di Cetak Pada : ' . date('d-m-Y') . ' - ' . date('H:i:s'), 0, 1, 'C');
|
||||
|
||||
$this->Ln(4);
|
||||
|
||||
// Header kolom tabel
|
||||
// Header kolom tabel tetap tampil di setiap halaman
|
||||
$this->_drawTableHeader();
|
||||
}
|
||||
|
||||
@@ -146,8 +152,12 @@ class PDF extends FPDF
|
||||
$this->Cell(array_sum($this->colWidths), 8, 'Tidak ada data', 1, 1, 'C');
|
||||
} else {
|
||||
foreach ($rows as $row) {
|
||||
$namaAkun = isset($row->nama_akun) ? $row->nama_akun : (isset($row['nama_akun']) ? $row['nama_akun'] : '');
|
||||
$kodeAkun = isset($row->kode_akun) ? $row->kode_akun : (isset($row['kode_akun']) ? $row['kode_akun'] : '');
|
||||
$debit = isset($row->debit) ? (float)$row->debit : (isset($row['debit']) ? (float)$row['debit'] : 0);
|
||||
$kredit = isset($row->kredit) ? (float)$row->kredit : (isset($row['kredit']) ? (float)$row['kredit'] : 0);
|
||||
|
||||
$nbLines = $this->NbLines($this->colWidths[1], $row['nama']);
|
||||
$nbLines = $this->NbLines($this->colWidths[1], $namaAkun);
|
||||
$rowH = max(1, $nbLines) * $lineH;
|
||||
|
||||
if ($this->GetY() + $rowH > 270) {
|
||||
@@ -158,14 +168,14 @@ class PDF extends FPDF
|
||||
|
||||
$this->SetFont('Arial', '', 9);
|
||||
$this->SetXY($startX, $y);
|
||||
$this->Cell($this->colWidths[0], $rowH, $row['kode'], 1, 0, 'C');
|
||||
$this->Cell($this->colWidths[0], $rowH, $kodeAkun, 1, 0, 'C');
|
||||
|
||||
$xNama = $this->GetX();
|
||||
$this->MultiCell($this->colWidths[1], $lineH, $row['nama'], 1, 'L');
|
||||
$this->MultiCell($this->colWidths[1], $lineH, $namaAkun, 1, 'L');
|
||||
|
||||
$this->SetXY($xNama + $this->colWidths[1], $y);
|
||||
$this->Cell($this->colWidths[2], $rowH, $row['saldo_debit'] > 0 ? number_format($row['saldo_debit'], 0, ',', '.') : '-', 1, 0, 'R');
|
||||
$this->Cell($this->colWidths[3], $rowH, $row['saldo_kredit'] > 0 ? number_format($row['saldo_kredit'], 0, ',', '.') : '-', 1, 0, 'R');
|
||||
$this->Cell($this->colWidths[2], $rowH, $debit > 0 ? number_format($debit, 0, ',', '.') : '-', 1, 0, 'R');
|
||||
$this->Cell($this->colWidths[3], $rowH, $kredit > 0 ? number_format($kredit, 0, ',', '.') : '-', 1, 0, 'R');
|
||||
|
||||
$this->SetXY($startX, $y + $rowH);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user