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] 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
sforr...@bcgov.net<mailto:sforr...@bcgov.net>

www.beaufortcountylibrary.org<http://www.beaufortcountylibrary.org>

For Leisure, For Learning, For Life

From: Open-ils-dev [mailto: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<mailto: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
sforr...@bcgov.net<mailto:sforr...@bcgov.net>

www.beaufortcountylibrary.org<http://www.beaufortcountylibrary.org>

For Leisure, For Learning, For Life

Reply via email to