Open luemic opened 1 year ago
Yes please !! new year must archive last year invoices and start again from 0
Yes, please add this feature
Having the same problem. The sequence_number for invoices and payments loads the highest number instead of the 'next' from the last entry. So even overriding the the first invoice in 2023 with 23001 wont work because 23003 gets used in the next Invoice until we reach 23003.
Fast hotfix would be to clear by hand in the DB the sequence_number of old invoices from the invoice table. But didnt test it so maybe it could break something.
EDIT: If somebody is comfortable to change the code to use the Invoice number of the last Invoice + 1. Change the following code.
Open File:
/crater/app/Services/SerialFormatNumber.php
Change the function setNextSequenceNumber()
from
$last = $this->model::orderBy('sequence_number', 'desc')
to
$last = $this->model::latest()
You still have to manually set the number for the first invoice of the new year. After that it works.
Is your feature request related to a problem? Please describe. My problem is that I have invoice numbers like 22001, 22002 and so on, where 22 is the year prefix. Now in year 23, I do not want to start wih invoice 23003 instead I want to start with 23001.
Describe the solution you'd like I would prefer a separate replacable class for generating the invoice number and use this in the model.
Describe alternatives you've considered Cpoying the invoices table to ivoices_2022 and clear the invoices table.