45 lines
1.4 KiB
PHP
45 lines
1.4 KiB
PHP
<?php
|
|
|
|
require('fpdf/fpdf.php');
|
|
|
|
class PDF extends FPDF {
|
|
|
|
function __construct($lebar = 45, $tinggi = 100, $margin = 2) {
|
|
parent::__construct('P', 'mm', array($lebar, $tinggi));
|
|
$this->SetMargins($margin, $margin, $margin);
|
|
$this->AddPage();
|
|
}
|
|
|
|
function dataItems($items, $tanggal, $bulan) {
|
|
$this->SetFont('Helvetica', '', 8);
|
|
$this->Cell(0, 5, 'STRUK PEMBAYARAN', 0, 1, 'C');
|
|
$this->Ln(2);
|
|
$this->Cell(0, 4, 'Tanggal : ' . $tanggal, 0, 1, 'L');
|
|
$this->Cell(0, 4, 'Bulan : ' . $bulan, 0, 1, 'L');
|
|
$this->Ln(2);
|
|
$this->Cell(0, 0, str_repeat('-', 42), 0, 1, 'L');
|
|
$this->Ln(2);
|
|
|
|
foreach ($items as $item) {
|
|
$ket = $item[0];
|
|
$spc = $item[1];
|
|
$itm = $item[2];
|
|
|
|
if ($ket == 'Keterangan') {
|
|
$this->Cell(13, 3, $ket, 0, 0, 'L');
|
|
$this->Cell(2, 3, $spc, 0, 1, 'L');
|
|
$this->MultiCell(0, 3, $itm, 0, 'R');
|
|
} else {
|
|
$this->Cell(13, 3, $ket, 0, 0, 'L');
|
|
$this->Cell(2, 3, $spc, 0, 1, 'L');
|
|
$this->Cell(0, 3, $itm, 0, 1, 'R');
|
|
}
|
|
}
|
|
|
|
$this->Ln(2);
|
|
$this->Cell(0, 1, str_repeat('-', 42), 0, 1, 'L');
|
|
$this->Cell(0, 1, str_repeat('-', 42), 0, 1, 'L');
|
|
}
|
|
}
|
|
?>
|