Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- # Logo
- $logoFilename = 'logo.png';
- if (file_exists(ROOTDIR . '/assets/img/logo.png')) {
- $logoFilename = 'logo.png';
- } elseif (file_exists(ROOTDIR . '/assets/img/logo.jpg')) {
- $logoFilename = 'logo.jpg';
- }
- $pdf->Image(ROOTDIR . '/assets/img/' . $logoFilename, 15, 25, 35, '', 'PNG', '', 'T', false, 300, 'R', false, false, 0, false, false, false);
- $pdf->SetFont($pdfFont, 'B', 18);
- $pdf->writeHTML("DÍJBEKÉRŐ", true, 'L', '1');
- $pdf->SetFont($pdfFont, 'B', 18);
- $pdf->SetTextColor(102,102,102);
- $pdf->writeHTML($pagetitle, true, 'L', '1');
- $horizontal_alignments = array('L', 'C', 'R');
- $vertical_alignments = array('T', 'M', 'B');
- $pdf->Ln(10);
- $pdf->writeHTML("<hr>", true, false, false, false, '');
- # Header Bar
- /**
- * Invoice header
- *
- * You can optionally define a header/footer in a way that is repeated across page breaks.
- * For more information, see https://docs.whmcs.com/PDF_Invoice#Header.2FFooter
- */
- /**
- * $pdf->SetFont($pdfFont, 'B', 15);
- * $pdf->SetFillColor(255);
- * $pdf->Cell(0, 8, $pagetitle, 0, 1, 'L', '1');
- * $pdf->SetFont($pdfFont, '', 10);
- * $pdf->Cell(0, 6, Lang::trans('invoicesdatecreated') . ': ' . $datecreated, 0, 1, 'L', '1');
- * $pdf->Cell(0, 6, Lang::trans('invoicesdatedue') . ': ' . $duedate, 0, 1, 'L', '1');
- * $pdf->Ln(10);
- */
- $startpage = $pdf->GetPage();
- # Clients Details
- $pdf->SetFont($pdfFont, '', 8);
- $pdf->Cell(180, 4, 'VEVŐ', 0, 1, 'R');
- $pdf->SetFont($pdfFont, '', 9);
- $pdf->SetTextColor(0);
- if ($clientsdetails["companyname"]) {
- $pdf->Cell(180, 4, $clientsdetails["companyname"], 0, 1, 'R');
- $pdf->Cell(180, 4, Lang::trans('invoicesattn') . ': ' . $clientsdetails["firstname"] . ' ' . $clientsdetails["lastname"], 0, 1, 'R');
- } else {
- $pdf->Cell(180, 4, $clientsdetails["firstname"] . " " . $clientsdetails["lastname"], 0, 1, 'R');
- }
- $pdf->Cell(180, 4, $clientsdetails["address1"], 0, 1, 'R');
- if ($clientsdetails["address2"]) {
- $pdf->Cell(180, 4, $clientsdetails["address2"], 0, 1, 'R');
- }
- $pdf->Cell(180, 4, $clientsdetails["city"] . ", " . $clientsdetails["state"] . ", " . $clientsdetails["postcode"], 0, 1, 'R');
- $pdf->Cell(180, 4, $clientsdetails["country"], 0, 1, 'R');
- if (array_key_exists('tax_id', $clientsdetails) && $clientsdetails['tax_id']) {
- $pdf->Cell(180, 4, $taxIdLabel . ': ' . $clientsdetails['tax_id'], 0, 1, 'R');
- }
- if ($customfields) {
- $pdf->Ln();
- foreach ($customfields as $customfield) {
- $pdf->Cell(180, 4, $customfield['fieldname'] . ': ' . $customfield['value'], 0, 1, 'R');
- }
- }
- $pdf->SetTextColor(0);
- # Company Details
- $pdf->SetFont($pdfFont, '', 8);
- $pdf->SetTextColor(102,102,102);
- $pdf->writeHTML("ELADÓ", true, 'L', '1');
- $pdf->SetTextColor(0);
- $pdf->SetFont($pdfFont, '', 13);
- foreach ($companyaddress as $addressLine) {
- $pdf->Cell(180, 4, trim($addressLine), 0, 1, 'L');
- $pdf->SetFont($pdfFont, '', 9);
- }
- $pdf->Ln(2);
- $pdf->writeHTML('<br /><span style="color:rgb(102,102,102);font-size:7px;">ADÓSZÁM: XXXXXXXXXX<br />
- NYILVÁNTARTÁSI SZÁM: XXXXXXXXXXXX<br />
- KÖZÖSSÉGI ADÓSZÁM: XXXXXXXXXXX<br />
- BANKSZÁMLASZÁM: XXXXXXXXXXXX<br />
- IBAN: XXXXXXXXX<br />
- BANK NEVE: XXXXXXXXX</span>
- ', true, 'L', '1');
- $pdf->Ln(2);
- $pdf->writeHTML("<br /><hr>", true, false, false, false, '');
- $due = '
- <table width="100%" cellspacing="1" cellpadding="2" border="0">
- <tr height="30" style="color:rgb(102,102,102);font-size:7px;">
- <td width="25%">SZÁMLA KELTE:</td>
- <td width="25%">TELJESÍTÉS KELTE:</td>
- <td width="25%">FIZETÉSI HATÁRIDŐ:</td>
- <td width="25%">FIZETÉSI MÓD:</td>
- </tr>';
- $due .= '
- <tr height="30">
- <td width="25%">' . $datecreated . '</td>
- <td width="25%">' . $datecreated . '</td>
- <td width="25%">' . $datedue . '</td>
- <td width="25%">' . $paymentmethod . '</td>
- </tr></table>';
- $pdf->writeHTML($due, true, false, false, false, '');
- # Invoice Items
- $tblhtml = '<hr><br /><table width="100%" cellspacing="1" cellpadding="2" border="0">
- <tr height="30" style="color:rgb(102,102,102);font-size:7px;">
- <td width="40%">MEGNEVEZÉS</td>
- <td>NETTÓ EGYSÉGÁR</td>
- <td>NETTÓ ÁR</td>
- <td width="8%">ÁFA</td>
- <td>BRUTTÓ ÁR</td>
- </tr><hr><br />';
- foreach ($invoiceitems as $item) {
- if ($taxname) {
- if (strpos($item['description'], '2X') !== true)
- $tblhtml .= '<br /> <tr>
- <td width="40%">' . nl2br($item['description']) . '</td>
- <td>' . $item['amount'] . '</td>
- <td>' . $item['amount'] . '</td>
- <td width="8%">' . $taxname . '</td>
- <td>' . $total . '</td>
- </tr><br /><hr></table>';
- }
- }
- $tblhtml .= '<table width="100%" style="margin-top: 25px;" cellspacing="1" cellpadding="2" border="0">
- <tr height="30" style="color:rgb(0,0,0);text-align:right;font-size:12px;">
- <td width="20%"></td>
- <td width="60%">NETTÓ ÖSSZEG:</td>
- <td width="20%">' . $total . '</td>
- </tr></table>';
- $tblhtml .= '<table width="100%" style="margin-top: 25px;" cellspacing="1" cellpadding="2" border="0">
- <tr height="30" style="color:rgb(0,0,0);text-align:right;font-size:12px;">
- <td width="20%"></td>
- <td width="60%">FIZETENDŐ BRUTTÓ VÉGÖSSZEG:</td>
- <td width="20%">' . $subtotal . '</td>
- </tr></table>';
- $pdf->writeHTML($tblhtml, true, false, false, false, '');
- $pdf->Ln(5);
- /**
- * Invoice footer
- */
Advertisement
Add Comment
Please, Sign In to add comment