This is going to be blog-like for a while. I am going to be posting a log of what I am doing toward getting the customer accounts feature to function. This way it will help me organize what I am doing and you folks can see what goes into adding a major feature to DHPOS. This is also an opportunity for you to tell me if I am headed in the wrong direction and if you have a better idea of where I should be going.
Things I have done before today...
I came up with the idea of using the part of the program that writes the record of past transactions (the .REC file) to also write the invoices. This would save code space by using the same code to do two different things.
Since it is possible that an invoice could be in the file long after an item has been discontinued from the stock table it would be neccessary to save the descriptions in the invoices and thereby the .REC file. An added feature from that would be that changes made in the descriptions would be there when a past sale was recalled by the void feature. I also thought that between the time the stuff was purchased and the time the bill was paid that the tax rates may have changed. So save the tax rates for each line also.
To work on the .REC file I need a description of the file format. I had an old description but there have been changes. So I look at the code and this is what a new REC file record will look like
http://www.dhpos.com/recfile.pdf The lines at the bottom are the FIELDS for the record.
It took a week but I finally got the CONVERT program to sucessfully update the version 4 .REC file into the version 8 .REC file. It took this long mostly from screwing up. I also found some room in the file that can be used to store data for when the sale is saved as an invoice. This is good because the minimum increase in the .REC file is 280 bytes. This is because when the .REC file is accessed for as a text file for opening, closing, or no sale transactions it is opened as 40 byte records. However for all other transaction types it is opend as 28 byte records. The lowest common denominater for 28 and 40 is 280 so that is the minumum amount I can increase the file size.
Cwathen point out that "voids" does not find the information on who bought the stuff for a sale. I fix that.
Today I realized that information would have to go in and out of the existing customer file ( the .CST file) so I need a file format for that. Each record in the file gets a customer system number which is how the program matches a transaction with a customer. In the past I have received a couple of emails telling me that the program would match a transaction with the wrong customer. For invoices this would be a real problem. I look into the file and see that the next system number to be used is kept in the .POS file not the .CST file. This means that if you move one of the files and then later move the other one they will no longer be in sync. This is what is causing the problem. So I have to move the "next number" to the .CST file. I also find the file version number is kept in each record but when the CONVERT program updates the file it only changes the version number in the first record. So version 4 would be changed to version 8. However if you then delete the first record the version number in the new first record would revert to version 4. ( The program only check the version number in the first record.) Not a good thing. The solution will be to move all the existing records 1 back in the file and use the new 1st record as an information record that will hold the version number and the "next available" customer system number. Then to GET or PUT a record you would add 1 to the command. For example GET 3, CSAVE would have to be changed to GET 3, CSAVE + 1
I make these changes to the POS.EXE, and CF2.EXE program files and write conversion routine for the CONVERT program. Tonight I have been debugging these changes.
Tonight I also realize if between the time a purchase is made and the time the invoice is paid if the tax rate changes that the amount due must be with the new tax rates. This is because you did not actually sell it until it is paid for and that is when the taxes are collected. How will I impliment this?
Tomorrow I will work on understanding the .CST file format.
Dale
Comments?