I have some increment of invoice numbers, where there is Prefix and Counter,
Say Prefix is INV-
and Counter is started with 001
.
Below is code used in Laravel to get the next Invoice number automatically,
$lastInv = explode('-', $record->invoice_number); //Gets record and split number
$nextInv = $settings->invoice_number_prefix.'-'. ($lastInv[1] + 1);
In this case, there are two records in DB with INV-001, INV-002, But with the above code, I am getting $nextInv
as INV-3
How can I generate next invoice as INV-003
thank you,