Register

Grocery Accounting program

Topics on released projects. Only the author of a program should start a topic on it.
Member
Posts: 20
Joined: Fri Aug 28, 2015 5:10 am
Calculators: Casio fx-9750G PLUS, Casio fx-9750 G II (SH4)

Grocery Accounting program

Postby brickviking » Thu Sep 17, 2015 11:41 am

Warning
First, the warning. Please make sure that List 5 and List 6 in File6 are free to be used, otherwise edit the GRCGET, GRCPUT, GRCSAVE and GRCLOAD routines to use Lists that are free. GRCSAVE/LOAD saves or restores grocery vars to File6[List5], GRCPUT/GET saves all variables on entry to File6[List6], and restores them at exit of the program, switching back to File1. The only reason I used Lists 5 and 6 is because the G+ doesn't have any more lists than this, so I just used the last two lists I could. You can alter this to use List 25/26 (File 6) on a GII. In addition, at least one of the routines is only used once, so could be inlined. I leave that as an exercise for you, the reader. This program also uses PICT5 and PICT6.

In addition, there are differences between GRCMAIN and GRCAMAIN. GRCMAIN should be used for the earlier G+ models, because it has far less support for lowercase characters in printed strings. GRCAMAIN is for later models (GII, GII-SD, etc) and contains strings with lower case characters. However, the two versions are the same aside from lower case support.

Of course this program has had some improvements. As of version 0.67, the program run speed has been significantly improved by caching non-volatile text to PICT6 and recalling it each time I draw the main screen, but the screen redraw rate is still fairly slow on a G+. The grocery program works fairly quickly on a fx-9750GII/9860GII. 0.73 adds support for a screen snapshot, which isn't provided in this download (0.72).

Now the warnings are out of the way, I can describe the rest of the program. I've had this grocery program in operation since I first got my fx9750G+ in 2008, and it's worked (mostly) very well since then.

Description and keys used
This image describes the various parts of the screen:

Image

When you start up the program (GRCMAIN/GRCAMAIN) you'll be shown the main screen, listing category totals and temp variables:
Image

The bottom line contains softkeys (F1 - F6) for grocery categories; Vege, Meat, etc. Each key prompts for a cost, except for Vege, which first prompts you for a weight or count (Vege Item #), then a cost per kg/pound or cost per item. The rest (Meat, Clean (cleaning), etc), should be easy enough to understand. The Misc category catches everything else not already covered. You can also put in an expression when you are prompted for a price: 3*3.95 for example. This will then put the result of $11.85 into your total.

Exit (on the keyboard) does the obvious, but asks if you wish to save the current grocery values for loading next time. The -> key (above the AC key) requests a value to put into the next empty variable. The DEL key undoes the last transaction you entered, revising your grand total and category total.

Temporary values

There are five temporary variables you can use, which can be cleared after use. Variables P-T can be used to save prices-per-KG (or pound) and recall them for later use with Vege input. Here's how to use them: if Oranges are $4.99 per kg, I hit ->, the program asks me for the first empty temporary var (P) figure. I enter in 4.99. When I get to the scales to weigh my oranges, let's say they're 1.3 kg. I put in 1.3 for the item count, and P for an Item Cost. Grapes (another example) are $5.99 per kg (which I then put into Q), and I got 550g of them. I put in 0.55 (weight) for Item #, and Q for the Item Cost (in this case, it's a cost per unit of weight). Another example: I've bought 3 bags of potatoes, each bag is $7.95 (yes, we have very expensive potatoes), so I put 7.95 into R. Later on, I put 3 into Item #, and R for Item Cost.

Functions menu

=> (F6) contains a function screen. Back in the menu returns to the main screen. Tax sets the rate to what you wish. Clear clears the grocery variables, Store/Load: save or restore the grocery variables to List 5 in File 6. List 6/File 6 contains the previously saved variables A~Z,r,Theta. Exit (on the keyboard) does the obvious and asks you if you wish to save grocery vars.

I've also added a snapshot feature to be added to the next live version of this code, this snapshot (PICT5) can then be uploaded to the PC.

Start up FA-124, and set up communications preferences on the calculator so that Capture is set to S.Capt. Plug in the USB cable, recall PICT5 to the screen, and hit [Shift][7] (CAPTURE), while the FA-124 program is in screencapture mode. If you've crossed your eyes right, a screenshot of the recalled PICT will then turn up in a window, you can then save that picture (as BMP) for further processing. I used this to capture the screens for this description.

I hope this is useful to someone else. Do let me know what you think, or what refinements I could make. No bashing though.

Link to download
Changelog
0.60 (not available for download): I added some functionality to automatically back up all vars A-Z, r and Theta to a List so the variables can be "clobbered" by my grocery program. After the program finishes, I then restore those same variables. I also have the option of saving the existing grocery variables to another List, so that if you want to load them back in another time, you can.

0.61: Some slight refinements in the code for GRCAMAIN, as I realised I didn't need a couple of variable increments and all the comment/blank lines, that's reduced the bytecount a little.

0.65: Significantly sped up the program by saving the non-volatile text as a graphic to PICT6. This functionality is in GRCBTN, so run this first, or uncomment Prog "GRCBTN" near the top of GRCAMAIN for the first run. You can re-comment it once the picture has been initialised. PICT6 should be free for use.

0.66: Removed some code as it wasn't needed. I may have even sped the program up microscopically.

0.67: Apparently there's a SSe command embedded in a text string, which threw me out as it's not in a fx9750G+. A word was replaced, and RclPict was replaced with BG-Pict.

0.68: Added Tax support, initially set to 15%. Tweaked main screen.
0.69: Tweaked main screen further
0.70: Reworked Tax input screen
0.71: program now asks if you wish to save the current grocery values on exit.
0.72: program now asks if you wish to load previous grocery values on startup. I use this if I've been to another supermarket on the same day and want a grand total.
0.73: (not released yet) Added snapshot screen feature.


(Post 9)
Last edited by brickviking on Wed Aug 30, 2017 5:37 am, edited 9 times in total.
Regards, BrickViking

Member
Posts: 20
Joined: Fri Aug 28, 2015 5:10 am
Calculators: Casio fx-9750G PLUS, Casio fx-9750 G II (SH4)

Re: Grocery Accounting program

Postby brickviking » Wed Sep 23, 2015 11:16 am

I've found one small bug, with no real way to work around it. If File6->List 5 happens to be empty (no values), and I try retrieving any information about that list (Dim List 5), I get Dimension Error on the fx-9860GII (or simply Dim Error on the fx-9750G+).

Unfortunately, this is rather a show stopper for the program. The only way around it I can think of is to store 13 zero elements into List 5 in GRCBTN, but this won't help if there are already 13 elements there. I don't want to force a creation of list values if they're already there, but I can't test for a non-present list without running into the aforementioned Dimension Error.

(Post 11)
Regards, BrickViking

Return to Released Projects

Who is online

Users browsing this forum: Baidu [Spider] and 1 guest