Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

generating receipt numbers by lots of 25

Status
Not open for further replies.

kstart

Programmer
Dec 25, 2004
21
US
I can make numbers all day but does anyone know a way to generate a bank of numbers? My sales office makes sales recipts in batches of 25. they keep track of these and will issue them to us if I can just make them show up in a foxpro application. I have tried resetting the autoinc but I still cant limit it to 25. There has to be an easier way, if anyone can tell me how I would appreciate it greatly.
 
A little more information, such as what you're working with for table structures would really help. Also, when you say batches of 25, what are they batched by... date, amount, customer, sales person or what? Any additional information you feel is relevent should be included.

boyd.gif

SweetPotato Software Website
My Blog
 
Thanks Craig I guess I should have said each ticket has a serial number, all numeric no alpha. The corporate office issues the numbers out to us so we can get our receipts printed. They have them in lots of 25. It is from the old days I was told.... Being a new days kinda guy I cant see why we have them printed, fill them in and then enter them into a computer. The table structure is just customer information and what they bought. The corporate office keeps track of the tickets for some reason by the serial numbers they assign. They did not bite on my idea of generating my own numbers. I could get the next 25 or anyone else could get the next 25 it is not based on employee or customer
 
Try something along these lines.

Have a table to track the batches. When you receive a batch of numbers, create a new record registering the low and high values. Include a field that indicates the last value used from that batch (0 if none have been used).

When you need an id, find the first record in the table where last value used is less than high value, lock that record, increment the last value used, and grab it to use. Unlock.

Tamar
 
Tamar's way will work quite well for you.

What I do is quite similar. I just create a new record in my SysInfo.DBF to track the number (Every program has a SysInfo.DBF to track miscellaneous info). Then fill that record with the next available number.

Each record of SysInfo has two fields, one for the name of the variable I am tracking, and the second for the value of that variable. In this case I might use something like 'rcptnum' for the variable name, and next available receipt number for the variable value.

When someone needs a block of 25, I would issue a block of 25 starting with that number, then update the SysInfo record to reflect where the next block would start. The nice thing about doing it this way is that if Corporate decides to change the size of the blocks in the future, the only thing you would have to change is the variable defining the size of the block.

mmerlinn?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top