DennisHermannsen Posted October 17, 2017 Share Posted October 17, 2017 Is there really no way to prefix invoices but to change the templates? We have three companies under the same holding company, all using WHMCS. Seen from a legal point, we're not allowed to have 2 invoices that share the same invoice number. We'd like to prefix (or suffix) all invoices from company A to be A-1234, from company B to be B-1234 and company C to C-1234. Link to comment Share on other sites More sharing options...
brian! Posted October 17, 2017 Share Posted October 17, 2017 are all three companies using the same WHMCS installation or are there 3 different installations of WHMCS ? Link to comment Share on other sites More sharing options...
DennisHermannsen Posted October 17, 2017 Author Share Posted October 17, 2017 One is using the newest version while the two other are using 5.3.14. Link to comment Share on other sites More sharing options...
brian! Posted October 17, 2017 Share Posted October 17, 2017 8 minutes ago, DennisMidjord said: One is using the newest version while the two other are using 5.3.14. then if there are 3 installations, i'd be tempted to use a hook to create a custom invoice number - similar to the one I posted in the thread below... in terms of v7+, the hook below would prefix invoices with a custom invoice number... <?php /** * Generate Custom Invoice Number Format * @author brian! */ use Illuminate\Database\Capsule\Manager as Capsule; function generate_custom_invoice_number_hook($vars) { $invoiceid = $vars['invoiceid']; $customnumber = "A-".$invoiceid; if (isset($customnumber)) { try { $updatedInvoiceNumber = Capsule::table('tblinvoices') ->where('id', $invoiceid) ->update(['invoicenum' => $customnumber,]); } catch (\Exception $e) { // Deal with error } } } add_hook("InvoiceCreationPreEmail",1,"generate_custom_invoice_number_hook"); ?> then for v5, you could rewrite the above and replace the capsule code with similar mysql code.... or just edit the templates! Link to comment Share on other sites More sharing options...
Recommended Posts