example34_invoice_example.php 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293
  1. <?php
  2. $html = '
  3. <html>
  4. <head>
  5. <style>
  6. body {font-family: sans-serif;
  7. font-size: 10pt;
  8. }
  9. p { margin: 0pt; }
  10. table.items {
  11. border: 0.1mm solid #000000;
  12. }
  13. td { vertical-align: top; }
  14. .items td {
  15. border-left: 0.1mm solid #000000;
  16. border-right: 0.1mm solid #000000;
  17. }
  18. table thead td { background-color: #EEEEEE;
  19. text-align: center;
  20. border: 0.1mm solid #000000;
  21. font-variant: small-caps;
  22. }
  23. .items td.blanktotal {
  24. background-color: #EEEEEE;
  25. border: 0.1mm solid #000000;
  26. background-color: #FFFFFF;
  27. border: 0mm none #000000;
  28. border-top: 0.1mm solid #000000;
  29. border-right: 0.1mm solid #000000;
  30. }
  31. .items td.totals {
  32. text-align: right;
  33. border: 0.1mm solid #000000;
  34. }
  35. .items td.cost {
  36. text-align: "." center;
  37. }
  38. </style>
  39. </head>
  40. <body>
  41. <!--mpdf
  42. <htmlpageheader name="myheader">
  43. <table width="100%"><tr>
  44. <td width="50%" style="color:#0000BB; "><span style="font-weight: bold; font-size: 14pt;">Acme Trading Co.</span><br />123 Anystreet<br />Your City<br />GD12 4LP<br /><span style="font-family:dejavusanscondensed;">&#9742;</span> 01777 123 567</td>
  45. <td width="50%" style="text-align: right;">Invoice No.<br /><span style="font-weight: bold; font-size: 12pt;">0012345</span></td>
  46. </tr></table>
  47. </htmlpageheader>
  48. <htmlpagefooter name="myfooter">
  49. <div style="border-top: 1px solid #000000; font-size: 9pt; text-align: center; padding-top: 3mm; ">
  50. Page {PAGENO} of {nb}
  51. </div>
  52. </htmlpagefooter>
  53. <sethtmlpageheader name="myheader" value="on" show-this-page="1" />
  54. <sethtmlpagefooter name="myfooter" value="on" />
  55. mpdf-->
  56. <div style="text-align: right">Date: 13th November 2008</div>
  57. <table width="100%" style="font-family: serif;" cellpadding="10"><tr>
  58. <td width="45%" style="border: 0.1mm solid #888888; "><span style="font-size: 7pt; color: #555555; font-family: sans;">SOLD TO:</span><br /><br />345 Anotherstreet<br />Little Village<br />Their City<br />CB22 6SO</td>
  59. <td width="10%">&nbsp;</td>
  60. <td width="45%" style="border: 0.1mm solid #888888;"><span style="font-size: 7pt; color: #555555; font-family: sans;">SHIP TO:</span><br /><br />345 Anotherstreet<br />Little Village<br />Their City<br />CB22 6SO</td>
  61. </tr></table>
  62. <br />
  63. <table class="items" width="100%" style="font-size: 9pt; border-collapse: collapse; " cellpadding="8">
  64. <thead>
  65. <tr>
  66. <td width="15%">Ref. No.</td>
  67. <td width="10%">Quantity</td>
  68. <td width="45%">Description</td>
  69. <td width="15%">Unit Price</td>
  70. <td width="15%">Amount</td>
  71. </tr>
  72. </thead>
  73. <tbody>
  74. <!-- ITEMS HERE -->
  75. <tr>
  76. <td align="center">MF1234567</td>
  77. <td align="center">10</td>
  78. <td>Large pack Hoover bags</td>
  79. <td class="cost">&pound;2.56</td>
  80. <td class="cost">&pound;25.60</td>
  81. </tr>
  82. <tr>
  83. <td align="center">MX37801982</td>
  84. <td align="center">1</td>
  85. <td>Womans waterproof jacket<br />Options - Red and charcoal.</td>
  86. <td class="cost">&pound;102.11</td>
  87. <td class="cost">&pound;102.11</td>
  88. </tr>
  89. <tr>
  90. <td align="center">MR7009298</td>
  91. <td align="center">25</td>
  92. <td>Steel nails; oval head; 30mm x 3mm. Packs of 1000.</td>
  93. <td class="cost">&pound;12.26</td>
  94. <td class="cost">&pound;325.60</td>
  95. </tr>
  96. <tr>
  97. <td align="center">MF1234567</td>
  98. <td align="center">10</td>
  99. <td>Large pack Hoover bags</td>
  100. <td class="cost">&pound;2.56</td>
  101. <td class="cost">&pound;25.60</td>
  102. </tr>
  103. <tr>
  104. <td align="center">MX37801982</td>
  105. <td align="center">1</td>
  106. <td>Womans waterproof jacket<br />Options - Red and charcoal.</td>
  107. <td class="cost">&pound;102.11</td>
  108. <td class="cost">&pound;102.11</td>
  109. </tr>
  110. <tr>
  111. <td align="center">MR7009298</td>
  112. <td align="center">25</td>
  113. <td>Steel nails; oval head; 30mm x 3mm. Packs of 1000.</td>
  114. <td class="cost">&pound;12.26</td>
  115. <td class="cost">&pound;325.60</td>
  116. </tr>
  117. <tr>
  118. <td align="center">MF1234567</td>
  119. <td align="center">10</td>
  120. <td>Large pack Hoover bags</td>
  121. <td class="cost">&pound;2.56</td>
  122. <td class="cost">&pound;25.60</td>
  123. </tr>
  124. <tr>
  125. <td align="center">MX37801982</td>
  126. <td align="center">1</td>
  127. <td>Womans waterproof jacket<br />Options - Red and charcoal.</td>
  128. <td class="cost">&pound;102.11</td>
  129. <td class="cost">&pound;102.11</td>
  130. </tr>
  131. <tr>
  132. <td align="center">MR7009298</td>
  133. <td align="center">25</td>
  134. <td>Steel nails; oval head; 30mm x 3mm. Packs of 1000.</td>
  135. <td class="cost">&pound;12.26</td>
  136. <td class="cost">&pound;325.60</td>
  137. </tr>
  138. <tr>
  139. <td align="center">MF1234567</td>
  140. <td align="center">10</td>
  141. <td>Large pack Hoover bags</td>
  142. <td class="cost">&pound;2.56</td>
  143. <td class="cost">&pound;25.60</td>
  144. </tr>
  145. <tr>
  146. <td align="center">MX37801982</td>
  147. <td align="center">1</td>
  148. <td>Womans waterproof jacket<br />Options - Red and charcoal.</td>
  149. <td class="cost">&pound;102.11</td>
  150. <td class="cost">&pound;102.11</td>
  151. </tr>
  152. <tr>
  153. <td align="center">MR7009298</td>
  154. <td align="center">25</td>
  155. <td>Steel nails; oval head; 30mm x 3mm. Packs of 1000.</td>
  156. <td class="cost">&pound;12.26</td>
  157. <td class="cost">&pound;325.60</td>
  158. </tr>
  159. <tr>
  160. <td align="center">MF1234567</td>
  161. <td align="center">10</td>
  162. <td>Large pack Hoover bags</td>
  163. <td class="cost">&pound;2.56</td>
  164. <td class="cost">&pound;25.60</td>
  165. </tr>
  166. <tr>
  167. <td align="center">MX37801982</td>
  168. <td align="center">1</td>
  169. <td>Womans waterproof jacket<br />Options - Red and charcoal.</td>
  170. <td class="cost">&pound;102.11</td>
  171. <td class="cost">&pound;102.11</td>
  172. </tr>
  173. <tr>
  174. <td align="center">MF1234567</td>
  175. <td align="center">10</td>
  176. <td>Large pack Hoover bags</td>
  177. <td class="cost">&pound;2.56</td>
  178. <td class="cost">&pound;25.60</td>
  179. </tr>
  180. <tr>
  181. <td align="center">MX37801982</td>
  182. <td align="center">1</td>
  183. <td>Womans waterproof jacket<br />Options - Red and charcoal.</td>
  184. <td class="cost">&pound;102.11</td>
  185. <td class="cost">&pound;102.11</td>
  186. </tr>
  187. <tr>
  188. <td align="center">MR7009298</td>
  189. <td align="center">25</td>
  190. <td>Steel nails; oval head; 30mm x 3mm. Packs of 1000.</td>
  191. <td class="cost">&pound;12.26</td>
  192. <td class="cost">&pound;325.60</td>
  193. </tr>
  194. <tr>
  195. <td align="center">MR7009298</td>
  196. <td align="center">25</td>
  197. <td>Steel nails; oval head; 30mm x 3mm. Packs of 1000.</td>
  198. <td class="cost">&pound;12.26</td>
  199. <td class="cost">&pound;325.60</td>
  200. </tr>
  201. <tr>
  202. <td align="center">MF1234567</td>
  203. <td align="center">10</td>
  204. <td>Large pack Hoover bags</td>
  205. <td class="cost">&pound;2.56</td>
  206. <td class="cost">&pound;25.60</td>
  207. </tr>
  208. <tr>
  209. <td align="center">MX37801982</td>
  210. <td align="center">1</td>
  211. <td>Womans waterproof jacket<br />Options - Red and charcoal.</td>
  212. <td class="cost">&pound;102.11</td>
  213. <td class="cost">&pound;102.11</td>
  214. </tr>
  215. <tr>
  216. <td align="center">MR7009298</td>
  217. <td align="center">25</td>
  218. <td>Steel nails; oval head; 30mm x 3mm. Packs of 1000.</td>
  219. <td class="cost">&pound;12.26</td>
  220. <td class="cost">&pound;325.60</td>
  221. </tr>
  222. <!-- END ITEMS HERE -->
  223. <tr>
  224. <td class="blanktotal" colspan="3" rowspan="6"></td>
  225. <td class="totals">Subtotal:</td>
  226. <td class="totals cost">&pound;1825.60</td>
  227. </tr>
  228. <tr>
  229. <td class="totals">Tax:</td>
  230. <td class="totals cost">&pound;18.25</td>
  231. </tr>
  232. <tr>
  233. <td class="totals">Shipping:</td>
  234. <td class="totals cost">&pound;42.56</td>
  235. </tr>
  236. <tr>
  237. <td class="totals"><b>TOTAL:</b></td>
  238. <td class="totals cost"><b>&pound;1882.56</b></td>
  239. </tr>
  240. <tr>
  241. <td class="totals">Deposit:</td>
  242. <td class="totals cost">&pound;100.00</td>
  243. </tr>
  244. <tr>
  245. <td class="totals"><b>Balance due:</b></td>
  246. <td class="totals cost"><b>&pound;1782.56</b></td>
  247. </tr>
  248. </tbody>
  249. </table>
  250. <div style="text-align: center; font-style: italic;">Payment terms: payment due in 30 days</div>
  251. </body>
  252. </html>
  253. ';
  254. //==============================================================
  255. //==============================================================
  256. //==============================================================
  257. //==============================================================
  258. //==============================================================
  259. //==============================================================
  260. define('_MPDF_PATH','../');
  261. require_once __DIR__ . '/../vendor/autoload.php';
  262. $mpdf = new mPDF('c','A4','','',20,15,48,25,10,10);
  263. $mpdf->SetProtection(array('print'));
  264. $mpdf->SetTitle("Acme Trading Co. - Invoice");
  265. $mpdf->SetAuthor("Acme Trading Co.");
  266. $mpdf->SetWatermarkText("Paid");
  267. $mpdf->showWatermarkText = true;
  268. $mpdf->watermark_font = 'DejaVuSansCondensed';
  269. $mpdf->watermarkTextAlpha = 0.1;
  270. $mpdf->SetDisplayMode('fullpage');
  271. $mpdf->WriteHTML($html);
  272. $mpdf->Output(); exit;
  273. exit;