main
Last change
on this file since 5d6f37a was 5d6f37a, checked in by Naum Shapkarovski <naumshapkarovski@…>, 7 weeks ago |
add customer
|
-
Property mode
set to
100644
|
File size:
450 bytes
|
Rev | Line | |
---|
[5d6f37a] | 1 | export function incrementInvoiceNumber(lastInvoiceNumber?: string): string {
|
---|
| 2 | if (!lastInvoiceNumber) return '';
|
---|
| 3 |
|
---|
| 4 | // Extract the year and number parts
|
---|
| 5 | const number = parseInt(lastInvoiceNumber, 10);
|
---|
| 6 |
|
---|
| 7 | // Increment the number
|
---|
| 8 | const incrementedNumber = number + 1;
|
---|
| 9 |
|
---|
| 10 | // Format it back into the original format with leading zeros (assuming a max of 3 digits)
|
---|
| 11 | const formattedNumber = incrementedNumber.toString();
|
---|
| 12 |
|
---|
| 13 | return formattedNumber;
|
---|
| 14 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.