Grocery Accounting program

Topics on released projects. Only the author of a program should start a topic on it.
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


The Grannie's(1) instructions:
  • Run GRCBTN first. This Is Mandatory. You won't need to ever run this again.
  • Profit!

First, the warnings. This program uses multiple variables of different types, I note them here.
  • This program uses PICT5 and PICT6, 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 GRCMAIN/GRCAMAIN for the first run. You can re-comment it once the picture has been initialised. PICT6 should be free for use. PICT5 should be free if you ever want to snapshot the screen for FA-124.
  • If you ever nuke PICT6, rerun GRCBTN before you run GRCMAIN/GRCAMAIN, otherwise things are going to look really weird.
  • 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. The only reason I used Lists 5 and 6 is because the G+ only has 6 Lists in each file, so I just used the last two lists I could.
  • GRCSAVE/LOAD saves or restores grocery vars to List 5 in File6. You can alter them to use List 25/26 (File 6) on a GII/GII-SD if you wish, as the later models have more lists available.
  • GRCPUT/GET saves all variables on entry to File6[List6], and restores them at exit of the program, switching back to File1.
  • Be aware this program is metric, not imperial, so cost for ounces should be multiplied by 16 if you have 4lb 3oz to convert to oz. I have not written any code for imperial calculations in the program.

In addition, there are differences between GRCMAIN and GRCAMAIN. GRCMAIN should be used for the earlier G/GA/GB/G+ models, because they have 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:


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

The bottom line contains softkeys (F1 - F6) for grocery categories; Vege, Meat, etc and a Function menu. 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 -> (just above the AC key), 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
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. Also sped up the non-volatile text by putting it into PICT6, then using BG-Pict 6 at suitable times.
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.

(1)Grandma is presumably someone who got handed this calculator, and has somehow managed to figure out how to copy stuff onto the calculator. Neat! Welcome along. For the rest of us, this should all be pretty obvious.

(Post 9)
Last edited by brickviking on Sun Nov 05, 2017 5:47 am, edited 10 times in total.
Regards, BrickViking

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+).

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: No registered users and 1 guest