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