Click here to Skip to main content
15,886,362 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi.

How can i find in invoice series after missig sequence first serie.

Like this:

A402020000000001
A402020000000002
A402020000000006


İ Have codes for finding missing sequence series for example
(A402020000000003-A402020000000004-A402020000000005)
my question answer is must be ;

for A402020000000003 serie i must find A402020000000006 (next first seri)
for A402020000000004 serie i must find A402020000000006 (next first seri)
for A402020000000005 serie i must find A402020000000006 (next first seri)

What I have tried:

NEXTFIRST = "SELECT MAX(SERIE) FROM TABLE WHERE SERIE =LPAD(A.SERIE,7)||LPAD((TO_NUMBER(SUBSTR(A.SERIE,8,9))+1),9,0) "


in this code i find next seri only for
A402020000000005
result is
A402020000000006


others A402020000000003 and A402020000000004 is null
Posted
Updated 26-Sep-20 7:00am

1 solution

Once you issue an "invoice number" it should never go "missing". You have "outstanding" invoices as indicated by their balances in the accounts receivable or payables ledger.

If invoices are "missing", then your accounting system is corrupt.

Then you generate a list of "should have" invoice numbers and compare that with the ones that are "not missing"; e.g. select xxx not in yyy.
 
Share this answer
 
Comments
Member 14588284 26-Sep-20 14:42pm    
If invoices are "missing", then your accounting system is corrupt.

Already Thats the my problem. So i want find missing sequence and first serie after the missing sequence serie

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900