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