Basheer Posted July 10, 2017 Share Posted July 10, 2017 Hi, I want to generate a sequential invoice number with prefix, these is the my setting. But it doesnt work as i expected. Invoice number still in number format, no prefix any way. - - - Updated - - - and i don't want separate Sequential Paid Invoice Numbering Link to comment Share on other sites More sharing options...
brian! Posted July 10, 2017 Share Posted July 10, 2017 I want to generate a sequential invoice number with prefix, these is the my setting. But it doesn't work as i expected. Invoice number still in number format, no prefix any way.and i don't want separate Sequential Paid Invoice Numbering from that page, I don't think the invoice number format will change unless you enable SPIN. are you just looking to use a custom invoice number format? if so, the EU VAT Addon might be an option... I don't think you need to enable any of the VAT options within it for these invoice features to work. failing that, you could always edit the templates and slap a "SEC_" wherever the invoice number is output. Link to comment Share on other sites More sharing options...
Basheer Posted July 11, 2017 Author Share Posted July 11, 2017 failing that, you could always edit the templates and slap a "SEC_" wherever the invoice number is output. LOL . I will check the other option Link to comment Share on other sites More sharing options...
shadowtek Posted November 16, 2017 Share Posted November 16, 2017 HI Basheer, How did you go with this? Find a workable solution? Thanks Link to comment Share on other sites More sharing options...
brian! Posted November 16, 2017 Share Posted November 16, 2017 11 hours ago, shadowtek said: How did you go with this? Find a workable solution? 1 Link to comment Share on other sites More sharing options...
shadowtek Posted November 16, 2017 Share Posted November 16, 2017 Brian! thanks for your prompt reply. Are you able to help me simply add the prefix stek- the invoices as a prefix for example Invoice #stek-123 i can see from your original post I could use and alter pp- and bt- etc on payment methods but seems a overkill. I just need this prefix on all invoice. Many thanks Link to comment Share on other sites More sharing options...
brian! Posted November 16, 2017 Share Posted November 16, 2017 <?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 = "STEK-".$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"); ?> Link to comment Share on other sites More sharing options...
shadowtek Posted November 16, 2017 Share Posted November 16, 2017 Brian you are awesome thank you so much. Can i ask which file or template of i add this code to? Link to comment Share on other sites More sharing options...
brian! Posted November 16, 2017 Share Posted November 16, 2017 19 minutes ago, shadowtek said: Can i ask which file or template of i add this code to? create a new .php file in /includes/hooks, give it a filename (e.g invoicenumber.php) and paste the code into it.. then the next time an invoice is created, the hook will add your custom format to the invoice number before it is sent to the client. Link to comment Share on other sites More sharing options...
shadowtek Posted November 17, 2017 Share Posted November 17, 2017 Once again Brian Thank you... Its people like you in these communities that make all the difference Link to comment Share on other sites More sharing options...
Recommended Posts