Customising invoices

I’m wondering if there is a solution to my problem. I’m looking to do some custom invoicing. The invoices are quite unique as the Discount part should be included in the invoice sub total. An example of what the invoice would look like is below:

Item      Cost           total
Product A £100.00        £100.00
Product B £30.00         £30.00
          Subtotal       £180.00
          Discount       £50.00
          Paid To Date   £130.00
          Balance Due    £0.00

As you can see there are two line items which total £130 and a discount of £50 applied. Hence, I’m looking for the sub total to be £180. I’m guessing that the sub total can’t be manually overridden so i’ve been looking into other solutions.

Now all our invoices have 2 line items. So I thought of adding another line item for the discount (Discount £30.00 £30.00). This works and the invoice totals are what I want. However, I don’t want to see the newly added line item in the pdf so thought about customising the invoice pdf.

Problem is I’m not sure how to manually change how the body of the invoiceLineItemsTable. I thought it would be as simple as setting the body: [$invoiceLineItems.0 $invoiceLineItems.1] but that doesn’t appear to be valid syntax and I’m not clear on how to access the individual items in $invoiceLineItems. It might not be even possible.

Any thoughts on how to go about this or ways to manually override Subtotal\Paid To Date?

Have you tried setting the invoice discount field?