Guest User

Untitled

a guest
Nov 14th, 2020
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 5.46 KB | None | 0 0
  1. <?php
  2.  
  3. # Logo
  4. $logoFilename = 'logo.png';
  5. if (file_exists(ROOTDIR . '/assets/img/logo.png')) {
  6.     $logoFilename = 'logo.png';
  7. } elseif (file_exists(ROOTDIR . '/assets/img/logo.jpg')) {
  8.     $logoFilename = 'logo.jpg';
  9. }
  10. $pdf->Image(ROOTDIR . '/assets/img/' . $logoFilename, 15, 25, 35, '', 'PNG', '', 'T', false, 300, 'R', false, false, 0, false, false, false);
  11.  
  12.  
  13. $pdf->SetFont($pdfFont, 'B', 18);
  14. $pdf->writeHTML("DÍJBEKÉRŐ", true, 'L', '1');
  15.  
  16. $pdf->SetFont($pdfFont, 'B', 18);
  17. $pdf->SetTextColor(102,102,102);
  18.  
  19. $pdf->writeHTML($pagetitle, true, 'L', '1');
  20.  
  21. $horizontal_alignments = array('L', 'C', 'R');
  22. $vertical_alignments = array('T', 'M', 'B');
  23. $pdf->Ln(10);
  24. $pdf->writeHTML("<hr>", true, false, false, false, '');
  25.  
  26.  
  27. # Header Bar
  28.  
  29. /**
  30.  * Invoice header
  31.  *
  32.  * You can optionally define a header/footer in a way that is repeated across page breaks.
  33.  * For more information, see https://docs.whmcs.com/PDF_Invoice#Header.2FFooter
  34.  */
  35.  
  36. /**
  37. * $pdf->SetFont($pdfFont, 'B', 15);
  38. * $pdf->SetFillColor(255);
  39. * $pdf->Cell(0, 8, $pagetitle, 0, 1, 'L', '1');
  40. * $pdf->SetFont($pdfFont, '', 10);
  41. * $pdf->Cell(0, 6, Lang::trans('invoicesdatecreated') . ': ' . $datecreated, 0, 1, 'L', '1');
  42. * $pdf->Cell(0, 6, Lang::trans('invoicesdatedue') . ': ' . $duedate, 0, 1, 'L', '1');
  43. * $pdf->Ln(10);
  44. */
  45.  
  46. $startpage = $pdf->GetPage();
  47.  
  48. # Clients Details
  49. $pdf->SetFont($pdfFont, '', 8);
  50. $pdf->Cell(180, 4, 'VEVŐ', 0, 1, 'R');
  51. $pdf->SetFont($pdfFont, '', 9);
  52. $pdf->SetTextColor(0);
  53. if ($clientsdetails["companyname"]) {
  54.     $pdf->Cell(180, 4, $clientsdetails["companyname"], 0, 1, 'R');
  55.     $pdf->Cell(180, 4, Lang::trans('invoicesattn') . ': ' . $clientsdetails["firstname"] . ' ' . $clientsdetails["lastname"], 0, 1, 'R');
  56. } else {
  57.     $pdf->Cell(180, 4, $clientsdetails["firstname"] . " " . $clientsdetails["lastname"], 0, 1, 'R');
  58. }
  59. $pdf->Cell(180, 4, $clientsdetails["address1"], 0, 1, 'R');
  60. if ($clientsdetails["address2"]) {
  61.     $pdf->Cell(180, 4, $clientsdetails["address2"], 0, 1, 'R');
  62. }
  63. $pdf->Cell(180, 4, $clientsdetails["city"] . ", " . $clientsdetails["state"] . ", " . $clientsdetails["postcode"], 0, 1, 'R');
  64. $pdf->Cell(180, 4, $clientsdetails["country"], 0, 1, 'R');
  65. if (array_key_exists('tax_id', $clientsdetails) && $clientsdetails['tax_id']) {
  66.     $pdf->Cell(180, 4, $taxIdLabel . ': ' . $clientsdetails['tax_id'], 0, 1, 'R');
  67. }
  68. if ($customfields) {
  69.     $pdf->Ln();
  70.     foreach ($customfields as $customfield) {
  71.         $pdf->Cell(180, 4, $customfield['fieldname'] . ': ' . $customfield['value'], 0, 1, 'R');
  72.     }
  73. }
  74.  
  75. $pdf->SetTextColor(0);
  76. # Company Details
  77. $pdf->SetFont($pdfFont, '', 8);
  78. $pdf->SetTextColor(102,102,102);
  79.  
  80. $pdf->writeHTML("ELADÓ", true, 'L', '1');
  81. $pdf->SetTextColor(0);
  82. $pdf->SetFont($pdfFont, '', 13);
  83.  
  84. foreach ($companyaddress as $addressLine) {
  85.     $pdf->Cell(180, 4, trim($addressLine), 0, 1, 'L');
  86.     $pdf->SetFont($pdfFont, '', 9);
  87. }
  88.  
  89.  
  90. $pdf->Ln(2);
  91.  
  92. $pdf->writeHTML('<br /><span style="color:rgb(102,102,102);font-size:7px;">ADÓSZÁM: XXXXXXXXXX<br />
  93. NYILVÁNTARTÁSI SZÁM: XXXXXXXXXXXX<br />
  94. KÖZÖSSÉGI ADÓSZÁM: XXXXXXXXXXX<br />
  95. BANKSZÁMLASZÁM: XXXXXXXXXXXX<br />
  96. IBAN: XXXXXXXXX<br />
  97. BANK NEVE: XXXXXXXXX</span>
  98. ', true, 'L', '1');
  99.  
  100. $pdf->Ln(2);
  101.  
  102. $pdf->writeHTML("<br /><hr>", true, false, false, false, '');
  103.  
  104. $due = '
  105. <table width="100%" cellspacing="1" cellpadding="2" border="0">
  106.    <tr height="30" style="color:rgb(102,102,102);font-size:7px;">
  107.        <td width="25%">SZÁMLA KELTE:</td>
  108.        <td width="25%">TELJESÍTÉS KELTE:</td>
  109.        <td width="25%">FIZETÉSI HATÁRIDŐ:</td>
  110.        <td width="25%">FIZETÉSI MÓD:</td>
  111.    </tr>';
  112.    
  113. $due .= '
  114.    <tr height="30">
  115.        <td width="25%">' . $datecreated . '</td>
  116.        <td width="25%">' . $datecreated . '</td>
  117.        <td width="25%">' . $datedue . '</td>
  118.        <td width="25%">' . $paymentmethod . '</td>
  119.    </tr></table>';    
  120.    
  121. $pdf->writeHTML($due, true, false, false, false, '');
  122.  
  123. # Invoice Items
  124. $tblhtml = '<hr><br /><table width="100%" cellspacing="1" cellpadding="2" border="0">
  125.    <tr height="30" style="color:rgb(102,102,102);font-size:7px;">
  126.        <td width="40%">MEGNEVEZÉS</td>
  127.        <td>NETTÓ EGYSÉGÁR</td>
  128.        <td>NETTÓ ÁR</td>
  129.        <td width="8%">ÁFA</td>
  130.        <td>BRUTTÓ ÁR</td>
  131.    </tr><hr><br />';
  132.  
  133. foreach ($invoiceitems as $item) {
  134. if ($taxname) {
  135. if (strpos($item['description'], '2X') !== true)
  136.     $tblhtml .= '<br /> <tr>
  137.        <td width="40%">' . nl2br($item['description']) . '</td>
  138.        <td>' . $item['amount'] . '</td>
  139.        <td>' . $item['amount'] . '</td>
  140.        <td width="8%">' . $taxname . '</td>
  141.        <td>' . $total . '</td>
  142.    </tr><br /><hr></table>';
  143.     }
  144. }
  145.  
  146. $tblhtml .= '<table width="100%" style="margin-top: 25px;" cellspacing="1" cellpadding="2" border="0">
  147.    <tr height="30" style="color:rgb(0,0,0);text-align:right;font-size:12px;">
  148.        <td width="20%"></td>
  149.        <td width="60%">NETTÓ ÖSSZEG:</td>
  150.        <td width="20%">' . $total . '</td>
  151.    </tr></table>';
  152.  
  153. $tblhtml .= '<table width="100%" style="margin-top: 25px;" cellspacing="1" cellpadding="2" border="0">
  154.    <tr height="30" style="color:rgb(0,0,0);text-align:right;font-size:12px;">
  155.        <td width="20%"></td>
  156.        <td width="60%">FIZETENDŐ BRUTTÓ VÉGÖSSZEG:</td>
  157.        <td width="20%">' . $subtotal . '</td>
  158. </tr></table>';
  159.    
  160. $pdf->writeHTML($tblhtml, true, false, false, false, '');
  161.  
  162. $pdf->Ln(5);
  163.  
  164.  
  165. /**
  166.  * Invoice footer
  167.  */
Advertisement
Add Comment
Please, Sign In to add comment