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(); ?>
<?=htmlspecialchars(COMPANY_NAME)?>

INVOICE


Tel:

Bill To:
name)?>
invoice_contact_name)?>

phone) { ?> Tel: phone)?>
email) { ?> Email: email)?>
Ref:
Name: name)?>

Date:
Due Date:
Balance Due: £

Item Quantity Rate Amount
getName())?> getDisplayQuantity())?> getDisplayPrice())?> getDisplayTotal())?>
Total £
VAT @ 20% £
Total (inc. VAT) £

Pay To:


Account Number:
Sort Code:

Payment is due within 30 days.

If you have any questions concerning this invoice, contact:

THANK YOU FOR YOUR BUSINESS!

VAT Number:

WriteHTML($html); // Output to browser $mpdf->Output($download_filename, "D");