Stuart, I just checked the example that Terran shared (see link below), and it seems one trick for converting strings to numbers is to use a double-minus operator.
https://pines.georgialibraries.org/dokuwiki/doku.php?id=circ:workstations:receipts#subtotals So I think you need to change the subtotal line to something like this: <div ng-init="subtotal = subtotal -- checkout.copy.price"> Remington On Mon, Feb 12, 2018 at 12:54 PM Forrest, Stuart <sforr...@bcgov.net> wrote: > Hi > > > > I found the checkout.copy.price does contain data and it prints on the > receipt but does not get added to the subtotal. Latest version I am using > is below with sum corrections by Remington. > > > > Stuart > > <div>Welcome to {{current_location.name}}</div> > > <div>You have the following items checked out:</div> > > <hr/> > > <div ng-init="subtotal=0"> > > <ol> > > <li ng-repeat="checkout in circulations"> > > <div>{{checkout.title}}</div> > > <div>Barcode: {{checkout.copy.barcode}} > </div> > > <div>Due: {{checkout.circ.due_date | > egDueDate:$root.egDateAndTimeFormat:checkout.circ.circ_lib:checkout.circ.duration}}</div> > > <div> > > Price: {{checkout.copy.price | currency}} > > <div ng-init="subtotal+=checkout.copy.price"> > > </li> > > </ol> > > <hr/> > > <div>{{current_location.shortname}} {{today | > date:$root.egDateAndTimeFormat}}</div> > > <div>You were helped by {{staff.first_given_name}}</div> > > <BLOCKQUOTE> > > <div > style="width:150px;height:70px;padding:10px;border:2px solid black;" > align="center"> > > <font size="4"> > > <b>You saved: {{subtotal | currency}}</b> > > <br/> by using your > > <br/> public library > > </div> > > </BLOCKQUOTE> > > > > > > *************************************************** > > Stuart Forrest PhD > > IT Analyst > > Beaufort County Library System > > 843 255 6450 <(843)%20255-6450> > > sforr...@bcgov.net > > > > www.beaufortcountylibrary.org > > > > For Leisure, For Learning, For Life > > > > *From:* Open-ils-dev [mailto: > open-ils-dev-boun...@list.georgialibraries.org] *On Behalf Of *Geoff Sams > *Sent:* Monday, February 12, 2018 12:16 PM > > > *To:* Evergreen Development Discussion List > *Subject:* Re: [OPEN-ILS-DEV] Evergreen 3.0 Receipt templates > > > > I tried the process out myself as well (thanks for this conversation, it’s > been very helpful!) and I am also noticing that checkout.copy.price doesn’t > seem to work at all. It doesn’t appear to return anything for me. > > > > I setup a checkout receipt with both an item count and a price savings > bit, and using subtotal doesn’t work for me. I ended up having to use > item.subtotal = item.subtotal + 1 for the section because item.subtotal+=1 > doesn’t work either. > > > > I’m not sure what causes any of that, but I thought I would share what > I’ve seen. We are currently running 3.0.3. > > > > Thanks, > > Geoff Sams > > Library Manager > > Roanoke Public Library > > 817-491-2691 <(817)%20491-2691> > > > > *From:* Open-ils-dev [ > mailto:open-ils-dev-boun...@list.georgialibraries.org > <open-ils-dev-boun...@list.georgialibraries.org>] *On Behalf Of *Forrest, > Stuart > *Sent:* Monday, February 12, 2018 8:30 AM > *To:* Evergreen Development Discussion List < > open-ils-dev@list.georgialibraries.org> > *Subject:* Re: [OPEN-ILS-DEV] Evergreen 3.0 Receipt templates > > > > Hi Remington > > > > Thank for putting me right on those errors, much appreciated. > > > > It still does not work as it should though, it seems the subtotal within > the repeat is not getting updated. > > > > Thanks > > Stuart > > > > *************************************************** > > Stuart Forrest PhD > > IT Analyst > > Beaufort County Library System > > 843 255 6450 <(843)%20255-6450> > > sforr...@bcgov.net > > > > www.beaufortcountylibrary.org > > > > For Leisure, For Learning, For Life > > > > *From:* Open-ils-dev [ > mailto:open-ils-dev-boun...@list.georgialibraries.org > <open-ils-dev-boun...@list.georgialibraries.org>] *On Behalf Of *Remington > Steed > *Sent:* Friday, February 09, 2018 3:50 PM > *To:* Evergreen Development Discussion List > *Subject:* Re: [OPEN-ILS-DEV] Evergreen 3.0 Receipt templates > > > > Hi Stuart, > > > > I’m not an expert in angularjs, but here are my observations. It looks > like you have a stray curly brace at the end of this line: > > > > <div ng-init="checkout.subtotal=123"}> > > > > Also, since “checkout” is reset to each circulation during the loop, I > suggest using a different variable name, like just “subtotal”. And it > sounds like you want to start by setting subtotal to zero, and then change > the following line to add the price of each item to the subtotal: > > > > BEFORE: <div ng-init="checkout.subtotal=checkout.subtotal + 1"> > > > > AFTER: <div ng-init="subtotal+=checkout.copy.price"> > > > > Remember to also change the variable name where you print the subtotal > (and I don’t think you need the “sumout” span anymore): > > > > <b>You saved: {{subtotal | currency}}</b> > > > > Here’s a gist of how your template would look with these changes: > > https://gist.github.com/remocrevo/efd38d5b34c6303376225f485375adbc > > > > Remington > > > > -- > Remington Steed > Electronic Resources Specialist > Hekman Library, Calvin College > http://library.calvin.edu/ > > > > *From:* Open-ils-dev [ > mailto:open-ils-dev-boun...@list.georgialibraries.org > <open-ils-dev-boun...@list.georgialibraries.org>] *On Behalf Of *Forrest, > Stuart > *Sent:* Friday, February 09, 2018 2:30 PM > *To:* Evergreen Development Discussion List < > open-ils-dev@list.georgialibraries.org> > *Subject:* Re: [OPEN-ILS-DEV] Evergreen 3.0 Receipt templates > > > > Hi > > > > This is my current attempt at the problem below, but does not give the > calculation expected. > > > > <div>Welcome to {{current_location.name}}</div> > > <div>You have the following items checked out:</div> > > <hr/> > > <div ng-init="checkout.subtotal=123"}> > > <ol> > > <li ng-repeat="checkout in circulations"> > > <div>{{checkout.title}}</div> > > <div>Barcode: {{checkout.copy.barcode}} > </div> > > <div>Due: {{checkout.circ.due_date | > egDueDate:$root.egDateAndTimeFormat:checkout.circ.circ_lib:checkout.circ.duration}}</div> > > <div> > > Price: {{checkout.copy.price | currency}} > > <div > ng-init="checkout.subtotal=checkout.subtotal + 1"> > > </li> > > </ol> > > <hr/> > > <div>{{current_location.shortname}} {{today | > date:$root.egDateAndTimeFormat}}</div> > > <div>You were helped by {{staff.first_given_name}}</div> > > <BLOCKQUOTE> > > <div > style="width:150px;height:70px;padding:10px;border:2px solid black;" > align="center"> > > <font size="4"> > > <b>You saved: {{checkout.subtotal | > currency}}<span sumout="sum1" fixed="2"></b> </span> > > <br/> by using your > > <br/> public library > > </div> > > </BLOCKQUOTE> > > > > *************************************************** > > Stuart Forrest PhD > > IT Analyst > > Beaufort County Library System > > 843 255 6450 <(843)%20255-6450> > > sforr...@bcgov.net > > > > www.beaufortcountylibrary.org > > > > For Leisure, For Learning, For Life > > > > *From:* Open-ils-dev [ > mailto:open-ils-dev-boun...@list.georgialibraries.org > <open-ils-dev-boun...@list.georgialibraries.org>] *On Behalf Of *Forrest, > Stuart > *Sent:* Friday, February 09, 2018 2:07 PM > *To:* Evergreen Development Discussion List ( > open-ils-dev@list.georgialibraries.org) > *Subject:* [OPEN-ILS-DEV] Evergreen 3.0 Receipt templates > > > > > This sender failed our fraud detection checks and may not be who they appear > to be. Learn about > spoofing <http://aka.ms/LearnAboutSpoofing> > > Feedback <http://aka.ms/SafetyTipsFeedback> > > Hi > > > > I really don’t know much about AngularJS but I am trying to convert the > following 2.11 template to evergreen 3.0 especially the part that sums the > prices of the itema and prints out the result at the end. Can anyone offer > any advice please? > > > > Thanks > > Stuart > > > > ************************************************** > > The following items have been examined: > > <hr/> > > <ol> > > <li> > > %title% > > <br/>Barcode: %barcode% > > <br/>Due: <b>%due_date%</b> > > <span style="display: none;" > sum="sum1">%price%</span> > > </li> > > </ol> > > <hr /> > > %SHORTNAME% %TODAY_TRIM%<br/> > > <BLOCKQUOTE> > > <div > style="width:150px;height:70px;padding:10px;border:2px solid black;" > align="center"> > > <font size="4"> > > <b>You saved: $<span sumout="sum1" > fixed="2"></b> </span> > > <br/> by using your > > <br/> public library > > </div> > > </BLOCKQUOTE> > > *************************************************** > > Stuart Forrest PhD > > IT Analyst > > Beaufort County Library System > > 843 255 6450 <(843)%20255-6450> > > sforr...@bcgov.net > > > > www.beaufortcountylibrary.org > > > > For Leisure, For Learning, For Life > > >