Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Ellick Yeung
  Where is Ellick Yeung?
 
 Hong Kong
 Ellick Yeung
 To: Pete Sass
  Where is Pete Sass?
 Marathon, Ontario
 Canada
 Pete Sass
 Tags
Subject: Thanks! Got it.
Thread ID: 22134 Message ID: 22272 # Views: 13 # Ratings: 0
Version: Visual FoxPro 6 Category: General VFP Topics
Date: Monday, April 14, 2003 9:53:02 AM         
   


> > Thanks Pete for the detailed explanation. This is a great way to assure an unique KEY is always maintained, except there is one concern for me and you may point me to the right direction. Here is the situtation:
> >
> > User "A" adds a new invoice, the program read from the control table to obtain a new invoice number, it displays on screen as "INV006". This new invoice number writes to the control table and now it is holding the invoice number as INV006. User "A" starts entering the data for the invoice and the phone rings.....
> >
> > At this moment, User "B" add a new invoice and by the same process, the program gets INV007 display on screen and writes to the control table. User "B" enters all the details for the invoice, saves and exit the invoice form. The control table now holding the invoice number as INV007.
> >
> > After a long talk on the phone, user "A" decides to CANCEL the data input and do it later in the afternoon. (Here comes my concern) In the afternoon, user "A" adds the invoice again and of course the new invoice number will be anything greater than INV007. So, will the invoice table skips the invoice number of INV006? How could I handle this? or I misunderstood the point.
> >
> > Thanks!
> >
> > Ellick
>
>
>
> Hi,
>
> Yes you got it !
>
> The invoice number of INV006 will be lost forever.
>
> So your invoices will range like so:
> INV001
> INV002
> INV003
> INV004
> INV005
> INV007
>
> With INV006 missing from the range.
>
> If you need due to audit reasons need the invoices to never miss a number, you have only one
> choice in code. If a user starts an invoice and cancels it, you have to write the invoice header
> into the invoice table with a status field "Cancelled" or "Issued in Error" This way you have
> in view an invoice for every number, nothing skipped, but do require a status field in the
> invoice header table. I have a POS system like this and I have a field in the invoice header called
> status. This field hold the following:
> Status: "Active"
> Status: "Cancelled"
> Status: "Created in Error"
> Status: "Deleted"
>
> As well there is a comment field to explain why the invoice was removed with a date and time stamp on it.
> The status and comment fields are validated to ensure the user enters the reason and comments for the
> exclusion.
>
> Pete from the Great White North. (Only in Canada, ay.) Over and Out ...

Hi Pete,

Thanks very much, that make it clear. The method that we are discussing above is due to the display of the new invoice number when the user presses ADD button. I'm doing the samething but it happens when user presses the SAVE button, a popup window informs the user about the new invoice number right after the invoice records were wrote to disk. Yes, as you said, it all depends on when our users is asking for, we'll then decide which will be the best way to handle it.

Ellick


COMPLETE THREAD

Unique reference number under multi-user working Posted by Benny Thomas @ 4/10/2003 9:05:26 AM
RE: Unique reference number under multi-user wo... Posted by Caij Gomez @ 4/10/2003 9:17:00 AM
RE: Unique reference number under multi-user wo... Posted by Sazabi Ho @ 4/10/2003 10:30:49 AM
RE: Unique reference number under multi-user wo... Posted by Karben Selim Mejia @ 4/10/2003 3:52:00 PM
RE: Unique reference number under multi-user wo... Posted by Pete Sass @ 4/11/2003 2:25:52 AM
Great! but how to handle "Cancel" Posted by Ellick Yeung @ 4/12/2003 5:59:29 AM
RE: Great! but how to handle "Cancel" Posted by Pete Sass @ 4/13/2003 5:48:11 AM
Thanks! Got it. Posted by Ellick Yeung @ 4/14/2003 9:53:02 AM