quotepdf.tpl 4.2 KB

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