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