Update Invoice template to include new field

I understand that I can introduce a new variable to an invoice template by adding a custom field.
However, I need to add a new field to be filled by a specific query.
( I’m trying to add Total_Balance).
How can I do so? Where is the model to introduce a new field to the invoice template?

By convention, models in Codeigniter are stored in the ‘models’ directory. ie
/applications/models/

However, since Invoiceplane uses modules, you can also find then in
/application/modules/[modulename]/models/

For invoices, the file will be
/application/modules/invoices/models/Mdl_invoices.php

You would probably want to look at the following functions to get and save the new field.

  • default_select()
  • create()
  • db_array()