Bug 29987: Improve validation
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / members / moremember-print.tt
1 [% USE Koha %]
2 [% USE Branches %]
3 [% USE KohaDates %]
4 [% USE Price %]
5 [% USE ItemTypes %]
6 [% USE TablesSettings %]
7 [% PROCESS 'member-display-address-style.inc' %]
8 [% SET footerjs = 1 %]
9
10 [% PROCESS 'accounts.inc' %]
11
12 [% INCLUDE 'doc-head-open.inc' %]
13     <title>Summary for [% patron.firstname | html %] [% patron.surname | html %] ([% patron.cardnumber | html %])</title>
14     [% INCLUDE 'doc-head-close.inc' %]
15 </head>
16
17 <body id="pat_moremember-print" class="pat">
18     <div id="main">
19         <h3><a href="/cgi-bin/koha/circ/circulation.pl?findborrower=[% patron.cardnumber | uri %]">Account summary: [% patron.firstname | html %] [% patron.surname | html %] ([% patron.cardnumber | html %])</a></h3>
20
21         <ul>
22             [% PROCESS 'display-address-style' %]
23             <li>[% IF ( patron.phone ) %][% patron.phone | html %][% ELSE %](no phone number on file)[% END %]</li>
24             <li>[% IF ( patron.email ) %][% patron.email | html %][% ELSE %](no primary email on file)[% END %]</li>
25             [% IF ( patron.emailpro ) %]
26                 <li>[% patron.emailpro | html %]</li>
27             [% END %]
28             <li>Registration date: [% patron.dateenrolled | $KohaDates %]</li>
29             <li>Expiration date: [% patron.dateexpiry | $KohaDates %]</li>
30             <li>Library: [% Branches.GetName( patron.branchcode ) | html %]</li>
31             <li>Category: [% patron.category.description | html %]</li>
32         </ul>
33
34         [% IF ( issues ) %]
35             <table id="print-summary-checkouts">
36                 <caption>Items checked out</caption>
37                 <thead>
38                     <tr>
39                         <th>Title</th>
40                         <th>Author</th>
41                         <th>Call number</th>
42                         <th>Item type</th>
43                         <th>Date due</th>
44                         <th>Barcode</th>
45                         <th>Inventory number</th>
46                         <th>Charge</th>
47                         <th>Price</th>
48                         <th>Status</th>
49                     </tr>
50                 </thead>
51                 <tbody>
52                     [% FOREACH issue IN issues %]
53                         <tr>
54                             <td>
55                                 [% INCLUDE 'biblio-title.inc' biblio=issue link = 0 %]
56                             </td>
57                             <td>[% issue.author | html %]</td>
58                             <td>[% issue.itemcallnumber | html %]</td>
59                             <td>[% ItemTypes.GetDescription( issue.itype ) | html %]</td>
60                             <td>[% issue.date_due | $KohaDates  as_due_date => 1 %]</td>
61                             <td>[% issue.barcode | html %]</td>
62                             <td>[% issue.stocknumber | html %]</td>
63                             [% IF ( issue.charge <= 0 ) %]
64                                 <td class="credit">
65                             [% ELSE %]
66                                 <td class="debit">
67                             [% END %]
68                                 [% issue.charge | $Price %]
69                             </td>
70                             [% IF ( issue.replacementprice <= 0 ) %]
71                                 <td class="credit">
72                             [% ELSE %]
73                                 <td class="debit">
74                             [% END %]
75                                 [% issue.replacementprice | $Price %]
76                             </td>
77                             <td>[% IF ( issue.overdue ) %]Overdue![% ELSE %]&nbsp;[% END %]</td>
78                         </tr>
79                     [% END %]
80                 </tbody>
81                  <tfoot>
82                     <tr>
83                         <td></td>
84                         <td></td>
85                         <td></td>
86                         <td></td>
87                         <td></td>
88                         <td></td>
89                         <td style="text-align: right; font-weight:bold;">Totals:</td>
90                         [% IF ( totaldue <= 0 ) %]
91                             <td class="credit">
92                         [% ELSE %]
93                             <td class="debit">
94                         [% END %]
95                             [% totaldue | $Price %]
96                         </td>
97                         [% IF ( totalprice <= 0 ) %]
98                             <td class="credit">
99                         [% ELSE %]
100                             <td class="debit">
101                         [% END %]
102                             [% totalprice | $Price %]
103                         </td>
104                         <td></td>
105                     </tr>
106                 </tfoot>
107             </table>
108         [% END %]
109
110     [% IF ( reserves ) %]
111         <table id="print-summary-holds">
112             <caption>Pending holds</caption>
113             <thead>
114                 <tr>
115                     <th>Title</th>
116                     <th>Author</th>
117                     <th>Placed on</th>
118                     <th>Expires on</th>
119                     <th>Pick up location</th>
120                 </tr>
121             </thead>
122             <tbody>
123                 [% FOREACH reserve IN reserves %]
124                     <tr>
125                         <td>[% reserve.title | html %]</td>
126                         <td>[% reserve.author | html %]</td>
127                         <td>[% reserve.reservedate | $KohaDates %]</td>
128                         <td>[% reserve.expirationdate | $KohaDates %]</td>
129                         <td>[% reserve.waiting_at | html %]</td>
130                     </tr>
131                 [% END %]
132             </tbody>
133         </table>
134     [% END %]
135     [% IF accounts && totaldue != 0 %]
136         <table id="print-summary-fines">
137             <caption>Account fines and payments</caption>
138             <thead>
139               <tr>
140                   <th>Date</th>
141                   <th>Description of charges</th>
142                   <th>Note</th>
143                   <th>Amount</th>
144                   <th>Outstanding</th>
145                 </tr>
146             </thead>
147             <tbody>
148                 [% FOREACH account IN accounts %]
149                     <tr>
150                         <td>[% account.date | $KohaDates %]</td>
151                         <td>
152                             [% PROCESS account_type_description account=account %]
153                             [%- IF account.payment_type %]
154                                 , [% AuthorisedValues.GetByCode('PAYMENT_TYPE', account.payment_type) | html %]
155                             [% END %]
156                             [%- IF account.description %]
157                                 , [% account.description | html %]
158                             [% END %]
159                             &nbsp;
160                             [% IF ( account.itemnumber AND account.debit_type_code != 'OVERDUE' ) %]
161                                 <a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=[% account.item.biblionumber | uri %]&amp;itemnumber=[% account.itemnumber | uri %]">[% account.item.biblio.title | html %]</a>
162                             [% END %]
163                         </td>
164                         <td>
165                             [% account.note | html_line_break %]
166                         </td>
167                         [% IF ( account.amount <= 0 ) %]
168                             <td class="credit">
169                         [% ELSE %]
170                             <td class="debit">
171                         [% END %]
172                             [% account.amount | $Price %]
173                         </td>
174                         [% IF ( account.amountoutstanding <= 0 ) %]
175                             <td class="credit">
176                         [% ELSE %]
177                             <td class="debit">
178                         [% END %]
179                             [% account.amountoutstanding | $Price %]
180                         </td>
181                     </tr>
182                 [% END %]
183             </tbody>
184             <tfoot>
185                 <tr>
186                     <td></td>
187                     <td></td>
188                     <td ></td>
189                     [% IF ( totaldue < 0 ) %]
190                         <td class="credit">
191                     [% ELSE %]
192                         <td class="debit">
193                     [% END %]
194                         Total due:
195                     </td>
196                     [% IF ( totaldue < 0 ) %]
197                         <td class="credit">
198                     [% ELSE %]
199                         <td class="debit">
200                     [% END %]
201                         [% totaldue | $Price %]
202                     </td>
203                 </tr>
204             </tfoot>
205         </table>
206     [% END %]
207
208 [% MACRO jsinclude BLOCK %]
209     [% INCLUDE 'slip-print.inc' #printThenClose %]
210     [% INCLUDE 'datatables.inc' %]
211     [% INCLUDE 'columns_settings.inc' %]
212     <script>
213         var checkouts_columns = [% TablesSettings.GetTableSettings( 'circ', 'print_summary', 'print-summary-checkouts', 'json' ) | $raw %];
214         var holds_columns = [% TablesSettings.GetTableSettings( 'circ', 'print_summary', 'print-summary-holds', 'json' ) | $raw %];
215         var fines_columns = [% TablesSettings.GetTableSettings( 'circ', 'print_summary', 'print-summary-fines', 'json' ) | $raw %];
216
217         function moveColumnsButton( tableId ){
218             /* Hide the export button */
219             $("#" + tableId + "_wrapper").find("button.export_controls").remove();
220             /* We don't show the table controls toolbar here, so the columns settings button looks better as part of the caption */
221             $("#" + tableId).find("caption").append( $("#" + tableId + "_wrapper").find("button.columns_controls") );
222         }
223
224         $(document).ready(function() {
225
226             KohaTable("print-summary-checkouts", {
227                 "dom": "Bt",
228                 "paging": false,
229                 "bAutoWidth": false,
230                 initComplete: function( settings) {
231                     moveColumnsButton( settings.nTable.id );
232                 }
233             }, checkouts_columns);
234
235             KohaTable("print-summary-holds", {
236                 "dom": "Bt",
237                 "paging": false,
238                 "bAutoWidth": false,
239                 initComplete: function( settings) {
240                     moveColumnsButton( settings.nTable.id );
241                 }
242             }, holds_columns);
243
244             KohaTable("print-summary-fines", {
245                 "dom": "Bt",
246                 "paging": false,
247                 "bAutoWidth": false,
248                 initComplete: function( settings) {
249                     moveColumnsButton( settings.nTable.id );
250                 }
251             }, fines_columns);
252
253         });
254     </script>
255 [% END %]
256
257 [% INCLUDE 'intranet-bottom.inc' %]