Main processing
After startup, Sales Host periodically checks to see if it has local sales to process (records in ww_sales with a fwd_status of 0). If it doesn't find any, it goes to the server and grabs the next one available (if any). At this point, the server ww_sales record is marked with a fwd_status of 1 and the Salespoint field is filled in. Locally, Sales Host writes the ww_sales record with a fwd_status of 0 and fills in the salespoint name.
The ww_sales records are then processed, one by one, in order to make them into “real” sales in the system. If the sale is completed, a sale_no is filled into the ww_sales record. If the printing routine finishes and all expected PDFs are generated, appropriate ww_email records are generated. If the sale is completed successfully, the sale is marked with a fwd_status of 1. If some sort of error is encountered, the fwd_status is marked with a 4 and the Result field is populated with the error.
Thus, there are three cases for a sale:
1. Complete success; sale is marked with a 1.
2. Partial success; a sale_no was generated, but there was an error in generation of PDF files, marked with a 4.
3. Failure; no sale_no generated, marked with a 4.
Statuses 1 and 4 are rarely seen in the local tables because they are rapidly converted to 2 and 5, respectively, when Sales Host forwards the information to the server.