How can I show patrons how much they saved on a library receipt?
Asked by
MellowPine47
I work at a library and want to add a small message to checkout receipts showing something like, "You saved $XX by using the library today!" The amount only needs to cover the items checked out during that transaction; we do not retain long-term checkout histories for privacy reasons. Our library uses Evergreen, which stores each book's MSRP, and its receipt templates can be edited locally. The receipts print through a Star receipt printer, but there is no separate printer-specific program involved. I know a little coding but am unsure how to access the MSRP values in Evergreen, add them together for the current checkout, and display the total in the receipt footer. What would the general approach be?
Answers
The first thing to determine is how Evergreenโs receipt template exposes item data. If the template can already print fields such as title, author, price, or fees, look for the field that contains each itemโs MSRP and test printing it for individual checkout lines. After that, check whether the template system supports calculated or aggregate fields, such as summing a value across all items in the current transaction. You would then place that total in a footer with the savings message. The exact syntax depends on Evergreenโs template system, so its template documentation or existing examples involving totals and fees will be important.
Reply to this answer
Because the receipt template is stored and edited within Evergreen, the printer itself probably is not where the calculation needs to happen. Youโll need to confirm that the checkout data passed into the template includes MSRP for every item, then find out whether Evergreen templates can perform a sum over those values. If they cannot, the calculation would likely require changing Evergreenโs checkout or receipt-generation code rather than just editing the printed layout. Start with a test template that displays one itemโs MSRP, then investigate how existing totals are calculated before attempting the final footer.
Reply to this answer
Add your answer
Answers are reviewed before publication.
SilverNook31: Since the Star printer only receives the finished receipt content, it should not need to know anything about the prices or the calculation. The important part is the Evergreen data and template engine that generate that content.