1<?php
2
3# Logo
4if (file_exists(ROOTDIR.'/assets/img/logo.png')) $pdf->Image(ROOTDIR.'/assets/img/logo.png', 20, 25, 75);
5elseif (file_exists(ROOTDIR.'/assets/img/logo.jpg')) $pdf->Image(ROOTDIR.'/assets/img/logo.jpg', 20, 25, 75);
6else $pdf->Image(ROOTDIR.'/assets/img/placeholder.png', 20, 25, 75);
7
8# Company Details
9$pdf->SetFont($pdfFont,'',13);
10$pdf->Cell(0,6,trim($companyaddress[0]),0,1,'R');
11$pdf->SetFont($pdfFont,'',9);
12for ( $i = 1; $i <= ((count($companyaddress)>6) ? count($companyaddress) : 6); $i += 1) {
13 $pdf->Cell(0, 4, trim($companyaddress[$i] ?? ''), 0, 1, 'R');
14}
15$pdf->Ln(5);
16
17$pdf->SetFont($pdfFont,'B',10);
18
19$tblhtml = "
20<table width=\"100%\" bgcolor=\"#ccc\" cellspacing=\"1\" cellpadding=\"2\" border=\"0\">
21 <tr height=\"30\" bgcolor=\"#efefef\" style=\"font-weight:bold;text-align:center;\">
22 <td>{$_LANG['quotenumber']}</td>
23 <td>{$_LANG['quotesubject']}</td>
24 <td>{$_LANG['quotedatecreated']}</td>
25 <td>{$_LANG['quotevaliduntil']}</td>
26 </tr>
27 <tr bgcolor=\"#fff\">
28 <td align=\"center\">{$quotenumber}</td>
29 <td align=\"left\">{$subject}</td>
30 <td align=\"center\">{$datecreated}</td>
31 <td align=\"center\">{$validuntil}</td>
32 </tr>
33</table>";
34$pdf->writeHTML($tblhtml, true, false, false, false, '');
35
36$pdf->Ln(10);
37
38$pdf->SetFont($pdfFont,'B',10);
39$pdf->Cell(0,4,$_LANG['quoterecipient'],0,1);
40$pdf->SetFont($pdfFont,'',9);
41if ($clientsdetails["companyname"]) {
42 $pdf->Cell(0,4,$clientsdetails["companyname"],0,1,'L');
43 $pdf->Cell(0,4,$_LANG["invoicesattn"].": ".$clientsdetails["firstname"]." ".$clientsdetails["lastname"],0,1,'L');
44} else {
45 $pdf->Cell(0,4,$clientsdetails["firstname"]." ".$clientsdetails["lastname"],0,1,'L');
46}
47$pdf->Cell(0,4,$clientsdetails["address1"],0,1,'L');
48if ($clientsdetails["address2"]) {
49 $pdf->Cell(0,4,$clientsdetails["address2"],0,1,'L');
50}
51$pdf->Cell(0,4,$clientsdetails["city"].', '.$clientsdetails["state"].', '.$clientsdetails["postcode"],0,1,'L');
52$pdf->Cell(0,4,$clientsdetails["country"],0,1,'L');
53
54$pdf->Ln(10);
55
56if ($proposal) {
57 $pdf->SetFont($pdfFont,'',9);
58 $pdf->MultiCell(170,5,$proposal);
59 $pdf->Ln(10);
60}
61
62$pdf->SetDrawColor(200);
63$pdf->SetFillColor(239);
64
65$pdf->SetFont($pdfFont,'',8);
66
67$tblhtml = '<table width="100%" bgcolor="#ccc" cellspacing="1" cellpadding="2" border="0">
68 <tr height="30" bgcolor="#efefef" style="font-weight:bold;text-align:center;">
69 <td width="5%">'.$_LANG['quoteqty'].'</td>
70 <td width="45%">'.$_LANG['quotedesc'].'</td>
71 <td width="15%">'.$_LANG['quoteunitprice'].'</td>
72 <td width="15%">'.$_LANG['quotediscount'].'</td>
73 <td width="20%">'.$_LANG['quotelinetotal'].'</td>
74 </tr>';
75foreach ($lineitems AS $item) {
76 $tblhtml .= '
77 <tr bgcolor="#fff">
78 <td align="center">'.$item['qty'].'</td>
79 <td align="left">'.nl2br($item['description']).'<br /></td>
80 <td align="center">'.$item['unitprice'].'</td>
81 <td align="center">'.$item['discount'].'</td>
82 <td align="center">'.$item['total'].'</td>
83 </tr>';
84}
85$tblhtml .= '
86 <tr height="30" bgcolor="#efefef" style="font-weight:bold;">
87 <td align="right" colspan="4">'.$_LANG['invoicessubtotal'].'</td>
88 <td align="center">'.$subtotal.'</td>
89 </tr>';
90if ($taxlevel1['rate']>0) $tblhtml .= '
91 <tr height="30" bgcolor="#efefef" style="font-weight:bold;">
92 <td align="right" colspan="4">'.$taxlevel1['name'].' @ '.$taxlevel1['rate'].'%</td>
93 <td align="center">'.$tax1.'</td>
94 </tr>';
95if ($taxlevel2['rate']>0) $tblhtml .= '
96 <tr height="30" bgcolor="#efefef" style="font-weight:bold;">
97 <td align="right" colspan="4">'.$taxlevel2['name'].' @ '.$taxlevel2['rate'].'%</td>
98 <td align="center">'.$tax2.'</td>
99 </tr>';
100$tblhtml .= '
101 <tr height="30" bgcolor="#efefef" style="font-weight:bold;">
102 <td align="right" colspan="4">'.$_LANG['invoicestotal'].'</td>
103 <td align="center">'.$total.'</td>
104 </tr>
105</table>';
106
107$pdf->writeHTML($tblhtml, true, false, false, false, '');
108
109if ($notes) {
110 $pdf->Ln(6);
111 $pdf->SetFont($pdfFont,'',8);
112 $pdf->MultiCell(170,5,$_LANG['invoicesnotes'].": $notes");
113}
114