Jump to content

10 digit invoice numbering


Inversed98

Recommended Posts

Hey guys, due to recent changes in laws in my country now we are obligated to use 10 digits as invoice numbering for example first invoice starts with 0000000001 and I have no idea how to go about this. 
Also I need to delete all invoices and transactions and each new invoice should use the numbering system. Has anybody done this before ? 
I'm not a programmer so I have no idea how to go about this. I've contacted WHMCS and they suggested using InvoiceCreation hook point to execute custom code to add a new custom invoice number (with leading zeros) via the UpdateInvoice API command here:
 

Link to comment
Share on other sites

The suggestions isn't the full details that can lead you to success, as the invoiceid is only limited to integers, which means not support leading zeros.

I guess the rules didn't mention you must start the invoice with leading zeros?  Then I have a workaround suggestion.

If so, just a simple method: Why not add the date as part of the leading numbers?

Steps:

  1. Enter to System Settings
  2. Find the Invoice tab.
  3. Locate the option: Sequential Invoice Number Format    
  4. place this and save: {YEAR}{MONTH}{DAY}{NUMBER}

Hope it helps.

Link to comment
Share on other sites

1 hour ago, Nelson Neoh said:

The suggestions isn't the full details that can lead you to success, as the invoiceid is only limited to integers, which means not support leading zeros.

I guess the rules didn't mention you must start the invoice with leading zeros?  Then I have a workaround suggestion.

If so, just a simple method: Why not add the date as part of the leading numbers?

Steps:

  1. Enter to System Settings
  2. Find the Invoice tab.
  3. Locate the option: Sequential Invoice Number Format    
  4. place this and save: {YEAR}{MONTH}{DAY}{NUMBER}

Hope it helps.

Hello, thanks for taking your type to post here. Well the issue is this won't work due to the strict local laws. The invoices have to be numbered exactly as I explained otherwise they will not be valid.
I was thinking about something else, can a hook be made to change the invoice number after every order ? 
It would work like this in my head: 
1. Order 1 comes in with invoice number 1
2. Hook detects the order and changes the invoice number to 0000000001 in the database and then it increases for every following one.

Link to comment
Share on other sites

As the natual of what going to store in database, it won't able to store leading zeros.  In other means, there will have no way to store the exact figure with leading zeros in DB.

Hook can come to help only on the views.  Since the exact figure with leading zeros is not able to store in DB, you will need to code for every view that will show the invoice number.  Not an easy work.

Link to comment
Share on other sites

16 hours ago, Nelson Neoh said:

As the natual of what going to store in database, it won't able to store leading zeros.  In other means, there will have no way to store the exact figure with leading zeros in DB.

Hook can come to help only on the views.  Since the exact figure with leading zeros is not able to store in DB, you will need to code for every view that will show the invoice number.  Not an easy work.

I understand, it looks like I won't be able to achieve this easily.

Link to comment
Share on other sites

DO NOT MODIFY EXISTING INVOICE NUMBERS!!!!
If you do it you'll have years of bad times, realizing it has been a very bad idea.

FIX:

  •  modify just the .tpl files, adding the leading zeroes to the invoice number
  • if, after this modification, you really need to renumber existing invoices, don't modify the current invoice number, but create a new field in MySQL table ("myinvoicenumber") and modify the .tpl files in order to display this number instead of invoice number (you can still print also the original invoice number as "internal document number" or something like this)

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • 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