Subject Re: [firebird-support] Re: Generator question
Author Martijn Tonies
Hello Myles,

> The problem isn't that users are creating actual, audited invoices and
> then want to cancel them. Its more to do with the data entry process
> for this. Its a web hosted application, so data entry is done on a
> browser. I don't have a persistent connection with the data entry form
> (well I have limited connection through AJAX but I digress).
>
> The user will select the party that they wish to invoice, then click
> 'Create Invoice'. At this time it will bring up an invoice entry form.
> But it will show an invoice number.

Why? Why not show the invoice number after the user has "saved"
the invoice?

> The invoice record has been
> created in order to get a unique invoice number for the user doing the
> data entry at this time. However its not until they elect to save their
> entry that the invoice is considered 'processed' and therefore actually
> exists.
>
> Since a generator is being used to get the next invoice number for the
> data entry, and I need to show this to the user at the time of data
> entry, the problem is that if they cancel then go back to enter a new
> one, it is incrementing the invoice numbers so there are holes in the
> sequence. I just want to be able to recycle the invoice numbers that
> have not yet been actually created so that when a user returns to do the
> invoice again, they don't get a number that shows that the out of
> sequence problem.
>
> I'm thinking that using a separate document ID table and just
> incrementing that when the document is actually saved might be the best
> (and probably only) option for this. At least I can guarantee that two
> users won't get the same document ID number allocated, and I can reset
> the number back if the user cancels the data entry.

With regards,

Martijn Tonies
Upscene Productions
http://www.upscene.com

Download Database Workbench for Oracle, MS SQL Server, Sybase SQL
Anywhere, MySQL, InterBase, NexusDB and Firebird!

Database questions? Check the forum:
http://www.databasedevelopmentforum.com