Invoice number with {mm/YYYY}

If you have an invoice number in the form RE- {mm} {yyyy} {00000}
then you get at the beginning of each month a number that starts again at 00001.
As an example: In June, the last bill: RE-06 2019 01391 From 01.July RE-07 2019 00001
So far so good. But if an invoice is to be backdated in June with an invoice date in June, e.g. 6/28/2019,
Then Dolibarr tries to give the invoice number: RE-06 2019 00001, which does not work because this number is already taken.
If you change the invoice number to RE- {mm} {yyyy} {00000 + 1}, the invoice numbers will continue to run at the beginning of June. RE-06 20019 00001 until the end of June RE-06 2019 01391 and beginning of July then RE-07 2019 01392. If you then have a Rechnungz.B. dated on the 3rd of July, and the current invoice number is RE-07 2019 01457, the backdated invoice number is: RE-06 2019 01458.
This does not work because the number must be continuous. So a bill in June can not have a higher invoice number than one from July.
Is there a solution for this?

You mean you want to reset number every month? like for June last inv is say 06/0345 and you want July first inv to be 07/0001 ?
If you want this then it is possible.

1 Like

it does not work for me.
If I have to write a bill with retroactive data. (In July a bill with date in June) then Dolibarr starts again in 00001 in June. But since the June is over and already bills were written in June, the number 00001 is already taken.

This is the Error Message:

OS: Linux uSERVER 4.19.38-sunxi #5.85 SMP Wed May 8 14:20:48 CEST 2019 armv7l
UserAgent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:68.0) Gecko/20100101 Firefox/68.0

Angefragte URL: /compta/facture/card.php?facid=80&action=confirm_valid&confirm=yes&token=f4e1ebc6e072cb6db1039c9e8b8d6230
Referer: https://xxxxxx.xxx/compta/facture/card.php?facid=80&action=valid&page_y=384
Menüverwaltung: eldy_menu.php

Modul/Applikation: user, customfields, externalsite, commande, documentgeneration, ecm, facture, fournisseur, printing, societe, service, ticket, agenda, ficheinter, export, workflow, fckeditor, banque, product, expedition, supplier_proposal
Datenbank Type Manager: mysqli
Letzter Fehlerhafter Datenbankzugriff: SELECT MAX(SUBSTRING(facnumber, 12, 5)) as val FROM llx_facture WHERE facnumber LIKE ‘RE-_____________’ AND facnumber NOT LIKE ‘(PROV%)’ AND entity IN (1) AND (SUBSTRING(facnumber, 9, 4) = ‘2019’)
Rückgabewert des letzten fehlerhaften Datenbankzugriff: DB_ERROR_NOSUCHFIELD
Information zum letzten fehlerhaften Datenbankzugriff: Unknown column ‘facnumber’ in ‘field list’

Das System hat einen technischen Fehler festgestellt.
Diese Informationen können bei der Fehlersuche hilfreich sein (Hinweise können entfernt werden indem $dolibarr_main_prod auf ‘1’ gesetzt wird):