]> git.evergreen-ils.org Git - Evergreen.git/blob - docs/admin/receipt_template_editor.adoc
a71d456bc317734eb700b9dfb8c0d5a416bde49c
[Evergreen.git] / docs / admin / receipt_template_editor.adoc
1 Receipt Template Editor
2 -----------------------
3 indexterm:[web client, receipt template editor]
4 indexterm:[receipt template editor]
5 indexterm:[receipt template editor, macros]
6 indexterm:[receipt template editor, checkout]
7
8 The print templates follow W3C HTML standards (see
9 http://w3schools.com/html/default.asp) and can make use of CSS and
10 https://angularjs.org[Angular JS] to a certain extent.
11
12 The Receipt Template Editor can be found at: *Administration -> Workstation ->
13 Print Templates*
14
15 The Editor can also be found on the default home page of the staff client.
16
17 Receipts come in various types: Bills, checkout, items, holds, transits and
18 Payments.
19
20 Receipt Templates
21 ~~~~~~~~~~~~~~~~~
22 This is a complete list of the receipts currently in use in Evergreen.
23
24 [horizontal]
25 .List of Receipts
26 *Bills, Current*:: Listing of current bills on an account.
27 *Bills, Historic*:: Listing of bills that have had payments made on them. This
28    used on the Bill History Transaction screen.
29 *Bills, Payment*:: Patron payment receipt
30 *Checkin*:: List of items that have been entered in to the check-in screen.
31 *Checkout*:: List of items currently checked out by a patron during the transaction.
32 *Hold Transit Slip*:: This is printed when a hold goes in-transit to another library.
33 *Hold Shelf Slip*:: This prints when a hold is fulfilled.
34 *Holds for Bib Record*:: Prints a list of holds on a Title record.
35 *Holds for Patron*:: Prints a list of holds on a patron record.
36 *Hold Pull List*:: Prints the Holds Pull List.
37 *Hold Shelf List*:: Prints a list of hold that are waiting to be picked up.
38 *In-House Use List*:: Prints a list of items imputed into In-house use.
39 *Item Status*:: Prints a list of items imputed into Item Status.
40 *Items Out*:: Prints the list of items a patron has checked out.
41 *Patron Address*:: Prints the current patrons address.
42 *Patron Note*:: Prints a note on a patron's record.
43 *Renew*:: List of items that have been renewed using the Renew Item Screen.
44 *Transit List*:: Prints the list of items in-transit from the Transit List.
45 *Transit Slip*:: This is printed when an items goes in-transit to another location.
46
47
48 Editing Receipts
49 ~~~~~~~~~~~~~~~~
50
51 To edit a Receipt:
52
53 . Select *Administration -> Workstation -> Print Templates*.
54
55 . Choose the Receipt in the drop down list.
56 . If you are using Hatch, you can choose different printers for different types
57   of receipts with the Force Content field. If not, leave that field blank.
58   Printer Settings can be set at *Administration -> Workstation -> Printer
59   Settings*.
60 +    
61 image::media/receipt1.png[select checkout]
62 +
63 . Make edits to the Receipt on the right hand side.
64 +    
65 image::media/receipt2.png[receipt screen]
66 +
67 . Click out of the section you are editing to see what your changes will look
68   right on the Left hand side. 
69 . Click *Save Locally* in the Upper right hand corner.
70
71
72 Formatting Receipts
73 ^^^^^^^^^^^^^^^^^^^
74
75 Print templates use variables for various pieces of information coming from the
76 Evergreen database.  These variables deal with everything from the library name
77 to the due date of an item. Information from the database is entered in the
78 templates with curly brackets `{{term}}`.
79
80 Example: `{{checkout.title}}`
81
82 Some print templates have sections that are repeated for each item in a list.
83 For example, the portion of the Checkout print template below repeats every item
84 that is checked out in HTML list format by means of the 'ng-repeat' in the li
85 tag. 
86
87 ------
88 <ol>
89 <li ng-repeat="checkout in circulations">
90 <b>{{checkout.title}}</b><br/>
91 Barcode: {{checkout.copy.barcode}}<br/>
92 Due: {{checkout.circ.due_date | date:"short"}}<br/>
93 </li>
94 </ol>
95 ------
96
97 Text Formatting
98 ^^^^^^^^^^^^^^^
99
100 General text formatting
101 |========================================================================================
102 | Goal         | Original     | Code                                            | Result 
103 | Bold (HTML)  | hello        | <b>hello</b>                                    | *hello*
104 | Bold (CSS)   | hello        | <span style="font-weight:bold;">hello</span>    | *hello*
105 | Capitalize   | circulation  | <span style="text-transform:capitalize;">circulation</span> | Circulation
106 | Currency     | 1            | {{1 \| currency}}                               | $1.00
107 |========================================================================================
108
109 Date Formatting
110 ^^^^^^^^^^^^^^^
111
112 If you do not format dates, they will appear in a system format which isn't
113 easily readable.
114
115 |===================================================
116 | Code                         | Result
117 |{{today}}                     | 2017-08-01T14:18:51.445Z
118 |{{today \| date:'short'}}     | 8/1/17 10:18 AM
119 |{{today \| date:'M/d/yyyy'}}  | 8/1/2017
120 |===================================================
121
122 Currency Formatting
123 ^^^^^^^^^^^^^^^^^^^
124
125 Add " | currency" after any dollar amount that you wish to display as currency.
126
127 Example:
128 `{{xact.summary.balance_owed | currency}}` prints as `$2.50`
129
130
131 Conditional Formatting
132 ^^^^^^^^^^^^^^^^^^^^^^
133
134 You can use Angular JS to only print a line if the data matches. For example:
135
136 `<div ng-if="hold.email_notify == 't'">Notify by email: {{patron.email}}</div>`
137
138 This will only print the "Notify by email:" line if email notification is
139 enabled for that hold.
140
141 Example for checkout print template that will only print the amount a patron
142 owes if there is a balance:
143
144 `<span ng-if="patron_money.balance_owed">You owe the library
145 ${{patron_money.balance_owed}}</span>`
146
147 See also: https://docs.angularjs.org/api/ng/directive/ngIf
148
149 Substrings
150 ^^^^^^^^^^
151
152 To print just a sub-string of a variable, you can use a *limitTo* function.
153 `{{variable | limitTo:limit:begin}}` where *limit* is the number of characters
154 you are wanting, and *begin* (optional) is where you want to start printing
155 those characters. To limit the variable to the first four characters, you can
156 use `{{variable | limitTo:4}}` to get "vari". To limit to the last five
157 characters you can use `{{variable | limitTo:-5}}` to get "iable". And
158 `{{variable | limitTo:3:3}}` will produce "ria".
159
160 |========================================================================================
161 | Original                               | Code                                   | Result
162 | The Sisterhood of the Traveling Pants  | {{checkout.title \| limitTo:10}}       | The Sisterhood of th
163 | 123456789                              | {{patron.card.barcode \| limitTo:-5}}  | 56789
164 | Roberts                                | {{patron.family_name \| limitTo:3:3}}  | ber
165 |========================================================================================
166
167
168 Images
169 ^^^^^^
170
171 You can use HTML and CSS to add an image to your print template if you have the
172 image uploaded onto a publicly available web server. (It will currently only
173 work with images on a secure (https) site.) For example:
174
175 `<img
176 src="https://evergreen-ils.org/wp-content/uploads/2013/09/copy-Evergreen_Logo_sm072.jpg"
177 style="width:150px;padding:5px;">`
178
179 Sort Order
180 ^^^^^^^^^^
181
182 You can sort the items in an ng-repeat block using orderBy. For example, the
183 following will sort a list of holds by the shelving location first, then by the
184 call number:
185
186 `<tr ng-repeat="hold_data in holds | orderBy :
187 ['copy.location.name','volume.label']">`
188
189 Subtotals
190 ^^^^^^^^^
191
192 You can use Angular JS to add information from each iteration of a loop together
193 to create a subtotal. This involves setting an initial variable before the
194 ng-repeat loop begins, adding an amount to that variable from within each loop,
195 and then displaying the final amount at the end. 
196
197 ------
198 <div>You checked out the following items:</div>
199 <br/>
200 <div ng-init="transactions.subtotal=0">                <!-- <1> -->
201 <ol>
202 <div ng-repeat="checkout in circulations">
203   <li ng-init="transactions.subtotal=transactions.subtotal -- checkout.copy.price"> <!-- <2> -->
204      <b>{{checkout.title}}</b><br/>
205      Barcode: {{checkout.copy.barcode}}<br/>
206      Due: {{checkout.circ.due_date | date:"M/d/yyyy"}}
207   </li>
208 </div>
209 </ol>
210 <div style="font-weight:bold;">Total Amount Owed: {{patron_money.balance_owed | currency}}</div>
211 <div style="font-weight:bold;border:1px dotted black; padding:5px;text-align:center;">
212 You Saved<br/>
213 {{transactions.subtotal | currency}}<br/>              <!-- <3> -->
214 by borrowing from the library!</div>
215 ------
216 <1> This line sets the variable.
217 <2> This adds the list item's price to the variable.
218 <3> This prints the total of the variable.
219
220 Exporting and importing Customized Receipts
221 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
222
223 Once you have your receipts set up on one machine you can export your receipts,
224 and then load them on to another machine.  Just remember to *Save Locally*
225 once you import the receipts on the new machine.
226
227 Exporting templates
228 ^^^^^^^^^^^^^^^^^^^
229 As you can only save a template on to the computer you are working on you will
230 need to export the template if you have more than one computer that prints out
231 receipts (i.e., more than one computer on the circulation desk, or another
232 computer in the workroom that you use to checkin items or capture holds with)
233
234 . Export.  
235 . Select the location to save the template to, name the template, and click
236 *Save*.
237 . Click OK. 
238
239 Importing Templates
240 ^^^^^^^^^^^^^^^^^^^
241
242 . Click Import.
243 . Navigate to and select the template that you want to import.  Click Open. 
244 . Click OK.
245 . Click *Save Locally*.
246 . Click OK.
247
248
249 WARNING: Clearing your browser's cache/temporary files will clear any print
250 template customizations that you make unless you are using Hatch to store your
251 customizations. Be sure to export a copy of your customizations as a backup so
252 that you can import it as needed.
253
254 TIP: If you are modifying your templates and you do not see the updates appear
255 on your printed receipt, you may need to go into *Administration -> Workstation
256 -> Stored Preferences* and delete the stored preferences related to the print
257 template that you modified (for example, eg.print.template_context.bills_current).