d3m0n Posted November 13, 2017 Share Posted November 13, 2017 Hello, i have a question related to Sequential Invoice Number Format , that i have not been able to solve. I need to adjust WHMCS in accordance with the current system. i have a pattern id - client id , number - invoice number , year - year invoice is issued . the only tags that are currently available are :{YEAR} {MONTH} {DAY} {NUMBER} is there a way how to add a client id into the pattern ? so that whmcs could generate the invoices like: {clientid}-{NUMBER}-{YEAR} is it possible? any help is highly appreciated , thx in advance. thank Link to comment Share on other sites More sharing options...
WHMCS ChrisD Posted November 14, 2017 Share Posted November 14, 2017 Hey @d3m0n, There isnt a way out of the box to do this, but, there may be a custom module in the marketplace or a 3rd developer might be able to whip some magic up for you, would you like me to move this thread to the Developer Boards? Link to comment Share on other sites More sharing options...
brian! Posted November 14, 2017 Share Posted November 14, 2017 it's going to be a variation on the hook I posted in the thread below... <?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']; $id = Capsule::table('tblinvoices')->where('id', $invoiceid)->value('userid'); $year = date('Y'); $customnumber = $id."-".$invoiceid."-".$year; 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"); ?> Link to comment Share on other sites More sharing options...
Recommended Posts