dts_finished) throw new Exception(__("An invoice cannot be generated for this project as it has not been marked as finished.")); if(!Core::$user->canAdmin()) throw new Exception(__("You do not have permission to access this resource.")); $invoice = $project->getCustomerInvoice(); $line_items = $invoice->getLineItems(); $customer = $project->getCustomer(); $total_ex_vat = $invoice->getTotal(); $vat = $invoice->getTax(); $total_inc_vat = $invoice->getTotalIncTax(); // Filename $reference = $invoice->getReference(); $download_filename = str_replace("/", "_", $reference) . " - " . $project->name . " - Invoice.pdf"; // Initialise for PDF generation $bill_to_address_parts = array_filter([ $customer->address_1, $customer->address_2, $customer->city, implode(", ", array_filter([$customer->county, $customer->postal_code])), ]); $bill_from_address_parts = explode("\n", ADDRESS); // A4 size: 210x297mm $mpdf = new Mpdf(); $mpdf->SetSubject("Project Invoice"); $mpdf->SetCreator(APP_NAME); $mpdf->SetAuthor(APP_NAME); $mpdf->SetTitle("Invoice ({$reference})"); $mpdf->useSubstitutions = true; ob_start(); ?>

| Date: | =date("d/m/Y")?> |
| Due Date: | =date("d/m/Y", time() + (30 * 86400))?> |
| Balance Due: | £=number_format($total_inc_vat, 2)?> |
| Item | Quantity | Rate | Amount |
| =htmlspecialchars($item->getName())?> | =htmlspecialchars($item->getDisplayQuantity())?> | =htmlspecialchars($item->getDisplayPrice())?> | =htmlspecialchars($item->getDisplayTotal())?> |
| Total | £=number_format($total_ex_vat, 2)?> | ||
| VAT @ 20% | £=number_format($vat, 2)?> | ||
| Total (inc. VAT) | £=number_format($total_inc_vat, 2)?> | ||
Payment is due within 30 days.
If you have any questions concerning this invoice, contact: =htmlspecialchars(INVOICE_CONTACT_EMAIL)?>
THANK YOU FOR YOUR BUSINESS!
VAT Number: =htmlspecialchars(INVOICE_VAT_NUMBER)?>