chronous

Potrait

Sep 24th, 2025
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 4.70 KB | None | 0 0
  1. <?php
  2.  
  3. use App\Libraries\easyTables;
  4. use App\Libraries\exFPDF;
  5. use App\Traits\HeaderLaporanDynamic;
  6.  
  7. class PDF extends exFPDF
  8. {
  9.     use HeaderLaporanDynamic;
  10.  
  11.     public function __construct($orientation = 'P', $unit = 'mm', $size = 'A4')
  12.     {
  13.         parent::__construct($orientation, $unit, $size);
  14.         $this->initSystemPdamData($orientation);
  15.     }
  16. }
  17.  
  18. ob_start();
  19. $pdf = new PDF('P', 'cm', 'A4');
  20. $pdf->SetMargins(0.5, 0.5, 1);
  21. $pdf->AliasNbPages();
  22. $pdf->AddPage();
  23. $pdf->headerVisible = "true";
  24. $sekarang_tgl = date("Y-m-d");
  25. $sekarang_jam = date("H:i:s");
  26.  
  27. $pdf->SetTitle('V : '. $Mjournal['mjo_code'] );
  28.  
  29. $pdf->SetFont('helvetica', 'UB', 16);
  30. $pdf->SetTextColor(0, 0, 0);
  31. $pdf->Cell(5, 0.5, "", 0, 0, 'C');
  32. $pdf->Cell(9, 1, "V O U C H E R", 0, 0, 'C');
  33. $pdf->SetFont('helvetica', '', 12);
  34. $pdf->Cell(6, 0.5, "Nomor    : " . ($Mjournal['mjo_code'] ?? '-'), 0, 0, 'L');
  35. $pdf->Ln(0.8);
  36. $pdf->Cell(14, 0.5, "", 0, 0, 'C');
  37. $dates = date("Y-m-d");
  38. $pdf->Cell(6, 0, "Tanggal  : " . format_date_ind($Mjournal['mjo_date'] ?? '-'), 0, 0, 'L');
  39. $pdf->Ln(0.85);
  40.  
  41. $pdf->SetFont('helvetica', '', 10);
  42. $pdf->SetFillColor(255, 255, 255);
  43. $pdf->SetDrawColor(0, 0, 0);
  44. $pdf->Cell(9, 0.6, 'Kas/Bank : -', "TL", 'L', 'L', 1);
  45. $pdf->Cell(6, 0.6, 'No Cek : '. ($Mjournal['mjo_ceque'] ?? '-'), "T", 'L', 'L', 1);
  46. // $pdf->Cell(5 , 0.6, 'Tgl Voucher : '.$this->parse->format_date_ind($tgl_voucher), "TR", 'L', 'L',1);
  47. $pdf->Cell(5, 0.6, 'Tgl Bayar : '. ($Mjournal['mjo_paymentdate'] ?? '-'), "TR", 'L', 'L', 1);
  48. $pdf->Ln();
  49. $pdf->Cell(20, 0.6, 'Beban Bagian/Seksi : '. ($Mjournal['mjo_ajuan_dari'] ?? '-'), 1, 'L', 'L', 1);
  50. $pdf->Ln();
  51. $pdf->Cell(20, 0.6, 'Dibayarkan Kepada : '. ($Mjournal['mjo_ajuan_untuk'] ?? '-'), 1, 'L', 'L', 1);
  52. $pdf->Ln();
  53.  
  54. $pdf->SetFont('helvetica', 'B', 10);
  55. $pdf->SetFillColor(255, 255, 255);
  56. $pdf->SetDrawColor(0, 0, 0);
  57.  
  58. $pdf->Cell(9, 1.2, 'NAMA PERKIRAAN', 1, 0, 'C', 1);
  59. $pdf->Cell(3, 1.2, 'KODE PERK.', 1, 0, 'C', 1);
  60. $pdf->Cell(8, 0.6, 'JUMLAH (Rupiah)', 1, 1, 'C', 1);
  61.  
  62. $pdf->Cell(12, 0.6, '', 0, 0, 'L');
  63. $pdf->Cell(4, 0.6, 'Debet', 1, 0, 'C', 1);
  64. $pdf->Cell(4, 0.6, 'Kredit', 1, 1, 'C', 1);
  65.  
  66. $pdf->SetFont('helvetica', '', 9);
  67.  
  68. $total_debet  = 0;
  69. $total_kredit = 0;
  70.  
  71. foreach ($Djournal as $datas) {
  72.     $isdebet  = (float) $datas['djo_debit'];
  73.     $iskredit = (float) $datas['djo_credit'];
  74.  
  75.     $pdf->Cell(9, 0.6, $datas['acc_name'], 'LR', 0, 'L');
  76.     $pdf->Cell(3, 0.6, $datas['acc_code'], 'R', 0, 'C');
  77.     $pdf->Cell(4, 0.6, number_format($isdebet, 2, ',', '.'), '', 0, 'R');
  78.     $pdf->Cell(4, 0.6, number_format($iskredit, 2, ',', '.'), 'LR', 1, 'R');
  79.  
  80.     $total_debet  += $isdebet;
  81.     $total_kredit += $iskredit;
  82. }
  83.  
  84. $minRows = 15;
  85. if (count($Djournal) < $minRows) {
  86.     for ($i = 1; $i <= ($minRows - count($Djournal)); $i++) {
  87.         $pdf->Cell(9, 0.6, '', 'LR', 0, 'L');
  88.         $pdf->Cell(3, 0.6, '', 'R', 0, 'C');
  89.         $pdf->Cell(4, 0.6, '', '', 0, 'R');
  90.         $pdf->Cell(4, 0.6, '', 'LR', 1, 'R');
  91.     }
  92. }
  93.  
  94.  
  95. $pdf->SetFont('helvetica', 'B', 9);
  96. $pdf->Cell(12, 0.6, 'JUMLAH', 1, 0, 'C');
  97. $pdf->Cell(4, 0.6, number_format($total_debet, 2, ',', '.'), 1, 0, 'R');
  98. $pdf->Cell(4, 0.6, number_format($total_kredit, 2, ',', '.'), 1, 1, 'R');
  99.  
  100. $pdf->SetFont('helvetica', '', 9);
  101. if (!empty($total_debet) && $total_debet > 0) {
  102.     $terbilang = ucwords(terbilang($total_debet)) . ' RUPIAH';
  103. } else {
  104.     $terbilang = '-';
  105. }
  106. $pdf->MultiCell(20, 0.6, 'TERBILANG : ' . $terbilang, 1, 'L');
  107. $pdf->MultiCell(20, 0.6, 'KETERANGAN : '. ($Mjournal['mjo_ket'] ?? '-'), 1, 'L', 'L');
  108. $pdf->Ln();
  109.  
  110. $tgl = date("Y-m-d");
  111. $pdf->Ln();
  112. $pdf->SetFont('helvetica', '', 8);
  113. $pdf->SetTextColor(0, 0, 0);
  114. $pdf->Cell(5, 0.5, 'DISETUJUI', 0, 0, 'C');
  115. $pdf->Cell(5, 0.5, 'DIKETAHUI', 0, 0, 'C');
  116. $pdf->Cell(5, 0.5, 'DIBUAT OLEH', 0, 0, 'C');
  117. $pdf->Cell(5, 0.5, "Diterima Oleh :", 0, 0, 'C');
  118. $pdf->Ln();
  119. $pdf->Cell(5, 0.5, 'DIREKTUR UTAMA', 0, 0, 'C');
  120. $pdf->Cell(5, 0.5, 'DIREKTUR UMUM', 0, 0, 'C');
  121. $pdf->Cell(5, 0.5, 'MANAJER KEUANGAN', 0, 0, 'C');
  122. $pdf->Cell(5, 0.5, '', 0, 0, 'C');
  123. $pdf->Ln(2.5);
  124. $pdf->SetFont('helvetica', 'U', 10);
  125. $pdf->SetTextColor(0, 0, 0);
  126. $pdf->Cell(5, 0.5, '______________________', 0, 0, 'C');
  127. $pdf->Cell(5, 0.5, '______________________', 0, 0, 'C');
  128. $pdf->Cell(5, 0.5, '______________________', 0, 0, 'C');
  129. $pdf->Cell(5, 0.5, '______________________', 0, 0, 'C');
  130.  
  131. $pdf->Ln();
  132. $pdf->SetFont('helvetica', 'U', 10);
  133. $pdf->SetTextColor(0, 0, 0);
  134. $pdf->Cell(5, 0.5, '', 0, 0, 'C');
  135. $pdf->Cell(5, 0.5, '', 0, 0, 'C');
  136. $pdf->Cell(5, 0.5, '', 0, 0, 'C');
  137. $pdf->Cell(5, 0.5, '', 0, 0, 'C');
  138. $pdf->Ln();
  139. $pdf->SetFont('helvetica', '', 10);
  140. $pdf->SetTextColor(0, 0, 0);
  141. $pdf->Cell(5, 0.5, '', 0, 0, 'C');
  142. $pdf->Cell(5, 0.5, '', 0, 0, 'C');
  143. $pdf->Cell(5, 0.5, '', 0, 0, 'C');
  144. $pdf->Cell(5, 0.5, '', 0, 0, 'C');
  145.  
  146. ob_clean();
  147. $pdf->Output("Voucher - " .$Mjournal['mjo_code']. ".pdf", "I");
Advertisement
Add Comment
Please, Sign In to add comment