Hi,
I somehow hacked this into invoicePlane, it’s a little of work, but it does the job. I amware that this isn’t the right ‘mvc’ way to do it, but I don’t really got hold of CodeIgniter and this app in particular…
First make sure every invoice number will start with a unique identifier per group.
In this example I used B2B and B2C invoices, which started with B or C respectively. (e.g. B02012016-1, or C02012016-1).
So you create invoice groups: B2B and B2C (or any other).
Now you create 2 templates, one for B2B and one for B2C.
Now create a third template file, name it invoice_switcher.php (or something like that)
Add the following code to this file:
<?php
if(substr( $invoice->invoice_number, 0, 1 ) === "B")
include ("B2B_template.php");
elseif(substr( $invoice->invoice_number, 0, 1 ) === "C")
include ("B2C_template.php");
else
include ("InvoicePlane.php");
?>
You could also check for $invoice->invoice_group_id, but I thought this was more clear and easier in this case.
Now in your systemsettings, under invoices change default pdf template to invoice_switcher.
This is it, now your B2B invoices take the B2B_template and B2C takes the B2C_template, all other normal invoices will take the default IP template.
Cheers,
Kreekhoorn