January 18, 200323 yr I have a simple script which opens a cash drawer through a receipt printer. Now I would like to keep track of the last 50 (or whatever) times the cash drawer was opened, and who opened it. The current user's name is stored in a global field--so no problem there. I would like the cash drawer log to be in a single field in a single-record database file (my configuration file)--again, no problem. So all I really need to know is, after I add a new line to this field... set field, cashLog, cashLog & "
January 18, 200323 yr Author Thanks Steve! That works very well. You just forgot one bracket near the end which I figured out without too much difficulty. Also, you'd actually use "50" not "49" since you use the greater than or equal to symbol (ie: if there are 50 carriage returns, there must be 51 entries). I also modified it so that new entries appear at the top and old ones come off the bottom. Here's my final implementation for anyone who's interested: Set field, logCashDrawer, TextToDate(Status(CurrentDate)) & " @ " & TextToDate(Status(CurrentTime)) & " - " & globalCurrentUser & "
January 19, 200323 yr This might be a case where a global repeating field might do the trick! I recently made an "undo" feature using a global repeating field and two scripts that rippled the data down (save last change) and rippled data up (restore last change). It worked well. The only challenge here would be that the contents of the global field will be mighty slippery in a multi-user environment. Better would be a related file with either a single record (like a prefs file) and a normal repeating field, or a related file with multiple records one for each state.
January 19, 200323 yr Author Yep, in this case I'm using a database file with only one record, which also happens to be my configuration file, where I store all of the user preferences. It's really slick now that I have it working. The only way a user could open the cash drawer without getting logged is either A) with the key, or : if they manually changed the printer in the print center (to the receipt printer), check the "open drawer" option in the print dialog, then printed something... most people probably won't figure that out.
Create an account or sign in to comment