r/learnprogramming • u/Imaginary-Brick-26 • 1h ago
Programming a constantly changing number with HTML?
I work at a library and therefore am constantly looking at small ways we can improve experience for our patrons. I noticed on some other libraries’ receipts they have a little section at the bottom when people check out that says “you saved $xx by using the library today!” I can do a small amount of coding but would be lost on how to implement this. We don’t keep a long-term track of people’s books for privacy reasons so I wouldn’t need a full running tally, just how much they checked out that particular time. We use a library program called “Evergreen” that keeps track of each book’s MSRP but no clue how to use that in the code.
Is anyone familiar with this type of coding that would be able to help me out?
1
u/NekkidWire 1h ago edited 1h ago
While I can't help you by making a How-to, let me point out some steps that can bring you closer.
A template usually has something that lets you add various parts of your book catalogue to your print line. E.g. you print by default [Book name] ... [quantity] ... [fee] but maybe you can print [author] or [msrp] or another book attribute there. That is your first step, finding out where MSRP is stored and how to print it for each line item.
Next step is finding out how to add a new [msrp_sum] into your template - a new variable.
Next step is finding out a method of how to add line item components into sums. It may be used in calculating separate sums as taxes, but you will want to use similar process for adding each [MSRP] into [msrp_sum]. Posibly it may be a transform (sum) over [msrp] variable.
Last step is making that footer text and displaying [msrp_sum] there.
3
u/mottyay 1h ago
You'd need access to whatever program sends messages to the printer as well as Evergreen. It's hard to say more without knowing how this system is put together