Custom Invoice/Estimate Numbers

Custom Invoice/Estimate Numbers

Hello there,

I have a specific invoice / estimate number system which was so far based on a number of parameters:

For estimates, my numbering takes on the following format:

EST-YYAA-MMDD/NN.RR

Where, 

YY is the year in which the estimate was created (e.g. 17 for 2017)
AA is a alphanumeric project code (taken from a custom dropdown field called "Project Type" I created under Estimate Preferences, it's 2 or 3 characters long)
MM is the month in which the estimate was created (e.g. 12 for December)
DD is the day of the month in which the estimate was created (e.g. 24)
NN needs to be an auto generated sequence number for that particular day (01, 02, 03). So, if another estimate is created in the same day, the number would sequentially increase. 
RR is a revision number in a "00" format (e.g. 01, 02, 03, etc.) which is taken from a custom field called "Revision" I created.

Invoice number is pretty similar. It's format is as follows:

INV-YYAA-MMDD/NN.RR-KK

Here, the middle portion (YYAA-MMDD/NN.RR) is taken from the estimate the invoice relates to, and
KK is auto generated sequential number for the particular estimate (so if the same estimate has 3 invoices attached to it, then the KK would generate 01, 02, 03 as the invoices are created. 

Is there a way for me to achieve this using custom functions, or in any other way?

Any help would be greatly appreciated! 

Cheerio!

Atif