Jump to content

Invoice number prefix


Basheer

Recommended Posts

seq-invoice.PNG

 

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

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.

 

WPTwb79.png

 

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

  • 4 months later...

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

<?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

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. :idea:

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated