Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- use App\Libraries\easyTables;
- use App\Libraries\exFPDF;
- use App\Traits\HeaderLaporanDynamic;
- class PDF extends exFPDF
- {
- use HeaderLaporanDynamic;
- public function __construct($orientation = 'P', $unit = 'mm', $size = 'A4')
- {
- parent::__construct($orientation, $unit, $size);
- $this->initSystemPdamData($orientation);
- }
- }
- ob_start();
- $pdf = new PDF('P', 'cm', 'A4');
- $pdf->SetMargins(0.5, 0.5, 1);
- $pdf->AliasNbPages();
- $pdf->AddPage();
- $pdf->headerVisible = "true";
- $sekarang_tgl = date("Y-m-d");
- $sekarang_jam = date("H:i:s");
- $pdf->SetTitle('V : '. $Mjournal['mjo_code'] );
- $pdf->SetFont('helvetica', 'UB', 16);
- $pdf->SetTextColor(0, 0, 0);
- $pdf->Cell(5, 0.5, "", 0, 0, 'C');
- $pdf->Cell(9, 1, "V O U C H E R", 0, 0, 'C');
- $pdf->SetFont('helvetica', '', 12);
- $pdf->Cell(6, 0.5, "Nomor : " . ($Mjournal['mjo_code'] ?? '-'), 0, 0, 'L');
- $pdf->Ln(0.8);
- $pdf->Cell(14, 0.5, "", 0, 0, 'C');
- $dates = date("Y-m-d");
- $pdf->Cell(6, 0, "Tanggal : " . format_date_ind($Mjournal['mjo_date'] ?? '-'), 0, 0, 'L');
- $pdf->Ln(0.85);
- $pdf->SetFont('helvetica', '', 10);
- $pdf->SetFillColor(255, 255, 255);
- $pdf->SetDrawColor(0, 0, 0);
- $pdf->Cell(9, 0.6, 'Kas/Bank : -', "TL", 'L', 'L', 1);
- $pdf->Cell(6, 0.6, 'No Cek : '. ($Mjournal['mjo_ceque'] ?? '-'), "T", 'L', 'L', 1);
- // $pdf->Cell(5 , 0.6, 'Tgl Voucher : '.$this->parse->format_date_ind($tgl_voucher), "TR", 'L', 'L',1);
- $pdf->Cell(5, 0.6, 'Tgl Bayar : '. ($Mjournal['mjo_paymentdate'] ?? '-'), "TR", 'L', 'L', 1);
- $pdf->Ln();
- $pdf->Cell(20, 0.6, 'Beban Bagian/Seksi : '. ($Mjournal['mjo_ajuan_dari'] ?? '-'), 1, 'L', 'L', 1);
- $pdf->Ln();
- $pdf->Cell(20, 0.6, 'Dibayarkan Kepada : '. ($Mjournal['mjo_ajuan_untuk'] ?? '-'), 1, 'L', 'L', 1);
- $pdf->Ln();
- $pdf->SetFont('helvetica', 'B', 10);
- $pdf->SetFillColor(255, 255, 255);
- $pdf->SetDrawColor(0, 0, 0);
- $pdf->Cell(9, 1.2, 'NAMA PERKIRAAN', 1, 0, 'C', 1);
- $pdf->Cell(3, 1.2, 'KODE PERK.', 1, 0, 'C', 1);
- $pdf->Cell(8, 0.6, 'JUMLAH (Rupiah)', 1, 1, 'C', 1);
- $pdf->Cell(12, 0.6, '', 0, 0, 'L');
- $pdf->Cell(4, 0.6, 'Debet', 1, 0, 'C', 1);
- $pdf->Cell(4, 0.6, 'Kredit', 1, 1, 'C', 1);
- $pdf->SetFont('helvetica', '', 9);
- $total_debet = 0;
- $total_kredit = 0;
- foreach ($Djournal as $datas) {
- $isdebet = (float) $datas['djo_debit'];
- $iskredit = (float) $datas['djo_credit'];
- $pdf->Cell(9, 0.6, $datas['acc_name'], 'LR', 0, 'L');
- $pdf->Cell(3, 0.6, $datas['acc_code'], 'R', 0, 'C');
- $pdf->Cell(4, 0.6, number_format($isdebet, 2, ',', '.'), '', 0, 'R');
- $pdf->Cell(4, 0.6, number_format($iskredit, 2, ',', '.'), 'LR', 1, 'R');
- $total_debet += $isdebet;
- $total_kredit += $iskredit;
- }
- $minRows = 15;
- if (count($Djournal) < $minRows) {
- for ($i = 1; $i <= ($minRows - count($Djournal)); $i++) {
- $pdf->Cell(9, 0.6, '', 'LR', 0, 'L');
- $pdf->Cell(3, 0.6, '', 'R', 0, 'C');
- $pdf->Cell(4, 0.6, '', '', 0, 'R');
- $pdf->Cell(4, 0.6, '', 'LR', 1, 'R');
- }
- }
- $pdf->SetFont('helvetica', 'B', 9);
- $pdf->Cell(12, 0.6, 'JUMLAH', 1, 0, 'C');
- $pdf->Cell(4, 0.6, number_format($total_debet, 2, ',', '.'), 1, 0, 'R');
- $pdf->Cell(4, 0.6, number_format($total_kredit, 2, ',', '.'), 1, 1, 'R');
- $pdf->SetFont('helvetica', '', 9);
- if (!empty($total_debet) && $total_debet > 0) {
- $terbilang = ucwords(terbilang($total_debet)) . ' RUPIAH';
- } else {
- $terbilang = '-';
- }
- $pdf->MultiCell(20, 0.6, 'TERBILANG : ' . $terbilang, 1, 'L');
- $pdf->MultiCell(20, 0.6, 'KETERANGAN : '. ($Mjournal['mjo_ket'] ?? '-'), 1, 'L', 'L');
- $pdf->Ln();
- $tgl = date("Y-m-d");
- $pdf->Ln();
- $pdf->SetFont('helvetica', '', 8);
- $pdf->SetTextColor(0, 0, 0);
- $pdf->Cell(5, 0.5, 'DISETUJUI', 0, 0, 'C');
- $pdf->Cell(5, 0.5, 'DIKETAHUI', 0, 0, 'C');
- $pdf->Cell(5, 0.5, 'DIBUAT OLEH', 0, 0, 'C');
- $pdf->Cell(5, 0.5, "Diterima Oleh :", 0, 0, 'C');
- $pdf->Ln();
- $pdf->Cell(5, 0.5, 'DIREKTUR UTAMA', 0, 0, 'C');
- $pdf->Cell(5, 0.5, 'DIREKTUR UMUM', 0, 0, 'C');
- $pdf->Cell(5, 0.5, 'MANAJER KEUANGAN', 0, 0, 'C');
- $pdf->Cell(5, 0.5, '', 0, 0, 'C');
- $pdf->Ln(2.5);
- $pdf->SetFont('helvetica', 'U', 10);
- $pdf->SetTextColor(0, 0, 0);
- $pdf->Cell(5, 0.5, '______________________', 0, 0, 'C');
- $pdf->Cell(5, 0.5, '______________________', 0, 0, 'C');
- $pdf->Cell(5, 0.5, '______________________', 0, 0, 'C');
- $pdf->Cell(5, 0.5, '______________________', 0, 0, 'C');
- $pdf->Ln();
- $pdf->SetFont('helvetica', 'U', 10);
- $pdf->SetTextColor(0, 0, 0);
- $pdf->Cell(5, 0.5, '', 0, 0, 'C');
- $pdf->Cell(5, 0.5, '', 0, 0, 'C');
- $pdf->Cell(5, 0.5, '', 0, 0, 'C');
- $pdf->Cell(5, 0.5, '', 0, 0, 'C');
- $pdf->Ln();
- $pdf->SetFont('helvetica', '', 10);
- $pdf->SetTextColor(0, 0, 0);
- $pdf->Cell(5, 0.5, '', 0, 0, 'C');
- $pdf->Cell(5, 0.5, '', 0, 0, 'C');
- $pdf->Cell(5, 0.5, '', 0, 0, 'C');
- $pdf->Cell(5, 0.5, '', 0, 0, 'C');
- ob_clean();
- $pdf->Output("Voucher - " .$Mjournal['mjo_code']. ".pdf", "I");
Advertisement
Add Comment
Please, Sign In to add comment