Register

Grocery Accounting program

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

The Grannie's(1) instructions:
  • Install the program onto the calculator. You may need a little help with this, though if you've got here, you've clearly got the Internet down pat, and there are YouTube videos that show you how.
  • Run GRCBTN from the Programs screen first. This Is Mandatory. You shouldn't need to ever run this again. The calculator manual (assuming you got one) shows you how to start a program.
  • Run GRCAMAIN from the Programs screen. This is the main grocery program you run each time.
  • Help for the grocery program is available from F6 on the first screen of the program. Look for the ? on the bottom right of the screen.
  • Profit!

First, the warnings. This program uses multiple variables of different types, I note them here.
  • This program saves the non-volatile text as a graphic to PICT6, so you should make sure that PICT6 is free. 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 also be free if you ever want to snapshot the screen for FA-124. Trust me, you'll know if you haven't done this.
  • If you ever nuke/empty/change PICT6, rerun GRCBTN before you run GRCMAIN/GRCAMAIN, otherwise things are going to look really weird when you run the GRCAMAIN program.
  • Please make sure that List 4, 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 those Lists is because the G+ only has 6 Lists in each file, so I just used the last three numbered lists I could. On a fx-9750GII/9860GII/9860GII SD, you could presumably use List 24/25/26 as noted below.
  • GRCSAVE/LOAD saves or restores grocery vars to List 5 in File6. You can alter them to use List 25 (File 6) on a GII/GII-SD if you wish, as the later models have more lists available.
  • On program startup, GRCPUT/GET saves all variables A-Z, r and theta to File6[List6], and restores them at exit of the program, switching back to File1. You can alter this routine to use List 26 (File 6) on later models (GII/GII-SD).
  • GRCLIST retrieves entries from List4. Again, you can edit this if you need.
  • 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 two releases of GROCERY; GROCERY.cat should be used for the earlier G/GA/GB/G+ models, because they have far less support for lowercase characters in printed strings. GROCERY.G1M is for later models (fx-9750GII, fx-9860GII-SD, etc) and contains strings with lower case characters. However, the two versions are almost the same aside from lower case support and the two functions Int/ and Rmdr (only found on the GII family). This single difference only affects GRCLIST, which lists the individual elements entered. I can't yet create a version of GRCLIST that doesn't need these, I have to learn a little more BASIC for that.

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 and graphics to PICT6 and recalling it each time I draw the main screen, but the screen redraw rate is still fairly slow on a fx-9750G+. 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). 0.75 includes a browser to list individual entries and now includes inbuilt help for the very first time. 0.76 (not yet released, as I'm working on it) will eventually include a decimal currency toggle for currencies such as yen, yuan or rimmimbi so people don't have to worry about cents or pence being displayed. Watch this space.

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 fx-9750G+ in 2008, and it's worked (mostly) very well since then, though it's had several updates since 2008.

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

Image

When you start up GRCAMAIN you'll be shown the main starting screen, listing empty category totals and temp variables:

Image

The bottom line contains softkeys on the F1F6 keys. These are the category menu keys; Vege, Meat, etc and Help (?). Each category prompts for a count and a cost, except for Vege and Meat, which first prompts you for a count or weight, and then asks for a count and a cost (either per KG or item). The rest (Dairy, Clean (cleaning), etc), should be easy enough to understand. The Misc category catches everything else not already covered.

Once you've entered in something, a total will appear for that category, along with a counter that increments for the number of things you bought. i.e. if you've bought 3 bottles of milk, 5 bags of potato chips, 3 packets of coffee and 4 loaves of bread, your Dairy category will have 7 in the category count and your Misc category count should have 8. This can be useful to make sure that the number of things in your trolley is the same as the number in the calculator. If you provide a weight for an item (not a count) then each entered item is then counted as 1; 3.2kg of potatoes counts as 1 item. An example screen is shown with some other values added in.

Image

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

Temporary values and Taxes

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 or Meat 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 weight, 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 in KG) for Item weight, 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 $17.95 (yes, we have very expensive potatoes), so I put 17.95 into R. Later on, I put 3 into Item Count, and R for Item Cost. These slots can all be cleared from the Erase function accessed from MENU after you've used them.

Another example screen is shown here with some temporary variables set and values added to the grocery totals:

Image

As you can see, the total bill will have $21.95 worth of tax, calculated at 15%. This is pretty useful for all those times you need to declare your tax for business purposes, and can be set as described below in the Functions menu.

Functions menu

Hitting the MENU key sends you to a function screen. Back in the menu returns to the main screen. Tax sets the rate to what you wish. Erase clears the grocery variables and/or the temporary P-T 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 and Theta. Exit (on the keyboard) does the obvious and asks you if you wish to save grocery vars, and restores your previously used variables.

I've also added a snapshot feature (use the 7 key while you're in the main menu), this snapshot (PICT5) can then be uploaded to the PC later.

To retrieve the snapshot picture, start up FA-124 on your PC, 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 calculator screen, and hit [Shift][7] (CAPTURE), while the FA-124 program is in screen capture 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 fx-9750G+. 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) Added snapshot screen feature.

0.74: Added an entry browser, showing individual entries. Significant tidy-up of code.

0.75 (current): Added a Help screen, finally. A remake of the pictures in this guide is in progress.

0.76: (not yet released)Rework for decimal currency toggle, for yen-users.

Notes:
(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 Sat Jul 14, 2018 2:11 am, edited 13 times in total.
Regards, BrickViking

Member
Posts: 24
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

Member
Posts: 24
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 » Fri Jun 15, 2018 10:08 am

I've finally—after a very long time—updated this entry, having added a screenshot function (easy) and complete help screen (complicated). The application's had a bit of tightening up in comparison to the previous release, so I hope it was worth it. Also, I squashed a couple of weird timing bugs while I was writing the Help screens.

If you want to snapshot the screen for later, simply hit the 7 key while in the main screen (it has the word Capture above it on the GII models), and continue as normal. When you want to upload the screenshot to a computer from a USB model (GII etc), plug in your USB cable, fire up FA-124, put it into ScreenCapture mode, then recall the screen to the Runmode screen OPTN->F6->F6->PICT->RclPict 5, and hit SHIFT-7 (Capture).

For G+ models (fx-9750G+/CFX-9850GB+/CFX-9850GC+/CFX-9950GB+) with the FA-123 unit , please check section 21-6 (page 408) in the manual for the relevant instructions. For G models (9750G) with the FA-122 unit, check Chapter 20-6 (page 372) in the supplied manual.

(Post 21)
Regards, BrickViking

Return to Released Projects

Who is online

Users browsing this forum: No registered users and 1 guest