Lines 1-76
Link Here
|
|
|
1 |
[% SET accountview = 1 %] |
2 |
|
1 |
[% USE Koha %] |
3 |
[% USE Koha %] |
2 |
[% USE KohaDates %] |
4 |
[% USE KohaDates %] |
|
|
5 |
[% USE Currency %] |
3 |
|
6 |
|
4 |
[% INCLUDE 'doc-head-open.inc' %][% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha online[% END %] catalog › Your fines and charges |
7 |
[% INCLUDE 'doc-head-open.inc' %][% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha online[% END %] catalog › Your fines and charges |
5 |
[% INCLUDE 'doc-head-close.inc' %] |
8 |
[% INCLUDE 'doc-head-close.inc' %] |
6 |
</head> |
9 |
</head> |
7 |
<body id="opac-account"> |
10 |
<body id="opac-account"> |
8 |
<div id="doc3" class="yui-t1"> |
11 |
<div id="doc3" class="yui-t1"> |
9 |
<div id="bd"> |
12 |
<div id="bd"> |
10 |
[% INCLUDE 'masthead.inc' %] |
13 |
[% INCLUDE 'masthead.inc' %] |
11 |
|
|
|
12 |
<div id="yui-main"> |
14 |
<div id="yui-main"> |
13 |
<div class="yui-b"><div class="yui-g"> |
15 |
<div class="yui-b"> |
14 |
<div id="useraccount" class="container"> |
16 |
<div class="yui-g"> |
15 |
<!--CONTENT--> |
17 |
<div id="useraccount" class="container"> |
16 |
[% FOREACH BORROWER_INF IN BORROWER_INFO %] |
18 |
<h3><a href="/cgi-bin/koha/opac-user.pl">[% borrower.firstname %] [% borrower.surname %]'s account</a> ⇢ Fines and charges</h3> |
17 |
<h3><a href="/cgi-bin/koha/opac-user.pl">[% BORROWER_INF.firstname %] [% BORROWER_INF.surname %]'s account</a> ⇢ Fines and charges</h3> |
|
|
18 |
[% END %] |
19 |
|
19 |
|
20 |
[% IF ( ACCOUNT_LINES ) %] |
20 |
[% IF credits || debits %] |
21 |
<table> |
21 |
|
22 |
<thead> |
22 |
<p> |
23 |
<tr> |
23 |
<h3>Account balance: [% borrower.account_balance | $Currency %]</h3> |
24 |
<th>Date</th> |
24 |
</p> |
25 |
<th>Description</th> |
25 |
|
26 |
<th>Fine amount</th> |
26 |
<div> |
27 |
<th>Amount outstanding</th> |
27 |
<div id="account-debits"> |
28 |
</tr> |
28 |
<a id="account-debits-switcher" href="#" onclick="return false">View payments</a> |
29 |
</thead> |
29 |
<table cellpadding="0" cellspacing="0" border="0" class="display" id="debits-table"> |
30 |
|
30 |
<thead> |
31 |
<tfoot> |
31 |
<tr> |
32 |
<tr> |
32 |
<th colspan="99">Fees</th> |
33 |
<th class="sum" colspan="3">Total due</th> |
33 |
</tr> |
34 |
<td class="sum">[% total %]</td> |
34 |
<tr> |
35 |
</tr> |
35 |
<th></th> |
36 |
</tfoot> |
36 |
<th>ID</th> |
37 |
|
37 |
<th>Description</th> |
38 |
<tbody> |
38 |
<th>Type</th> |
39 |
[% FOREACH ACCOUNT_LINE IN ACCOUNT_LINES %] |
39 |
<th>Amount</th> |
40 |
[% IF ( ACCOUNT_LINE.odd ) %]<tr class="highlight">[% ELSE %]<tr>[% END %] |
40 |
<th>Outsanding</th> |
41 |
<td>[% ACCOUNT_LINE.date | $KohaDates %]</td> |
41 |
<th>Created on</th> |
42 |
<td> |
42 |
<th>Updated on</th> |
43 |
[% SWITCH ACCOUNT_LINE.accounttype %] |
43 |
</tr> |
44 |
[% CASE 'Pay' %]Payment,thanks |
44 |
</thead> |
45 |
[% CASE 'N' %]New Card |
45 |
<tbody></tbody> |
46 |
[% CASE 'F' %]Fine |
46 |
</table> |
47 |
[% CASE 'A' %]Account management fee |
47 |
</div> |
48 |
[% CASE 'M' %]Sundry |
48 |
|
49 |
[% CASE 'L' %]Lost Item |
49 |
<div id="account-credits"> |
50 |
[% CASE 'W' %]Writeoff |
50 |
<a id="account-credits-switcher" href="#" onclick="return false">View fees</a> |
51 |
[% CASE %][% ACCOUNT_LINE.accounttype %] |
51 |
<table cellpadding="0" cellspacing="0" border="0" class="display" id="credits-table"> |
52 |
[%- END -%] |
52 |
<thead> |
53 |
[%- IF ACCOUNT_LINE.description %], [% ACCOUNT_LINE.description %][% END %] |
53 |
<tr> |
54 |
[% IF line.title %]([% line.title |html_entity %])[% END %] |
54 |
<th colspan="99">Payments</th> |
55 |
</td> |
55 |
</tr> |
56 |
[% IF ( ACCOUNT_LINE.amountcredit ) %]<td class="credit">[% ELSE %]<td class="debit">[% END %][% ACCOUNT_LINE.amount %]</td> |
56 |
<tr> |
57 |
[% IF ( ACCOUNT_LINE.amountoutstandingcredit ) %]<td class="credit">[% ELSE %]<td class="debit">[% END %][% ACCOUNT_LINE.amountoutstanding %]</td> |
57 |
<th></th> |
58 |
</tr> |
58 |
<th>ID</th> |
59 |
[% END %] |
59 |
<th>Notes</th> |
60 |
</tbody> |
60 |
<th>Type</th> |
61 |
|
61 |
<th>Amount</th> |
62 |
</table> |
62 |
<th>Remaining</th> |
63 |
[% ELSE %] |
63 |
<th>Created on</th> |
64 |
<h4>You have no fines or charges</h4> |
64 |
<th>Updated on</th> |
65 |
[% END %] |
65 |
</tr> |
66 |
</div> |
66 |
</thead> |
67 |
</div> |
67 |
<tbody></tbody> |
68 |
</div> |
68 |
</table> |
69 |
</div> |
69 |
</div> |
70 |
<div class="yui-b"> |
70 |
</div> |
71 |
<div id="leftmenus" class="container"> |
71 |
[% ELSE %] |
72 |
[% INCLUDE 'navigation.inc' IsPatronPage=1 %] |
72 |
<h4>You have no fines or charges</h4> |
73 |
</div> |
73 |
[% END %] |
74 |
</div> |
74 |
</div> |
|
|
75 |
</div> |
76 |
</div> |
77 |
</div> |
78 |
|
79 |
<div class="yui-b"> |
80 |
<div id="leftmenus" class="container"> |
81 |
[% INCLUDE 'navigation.inc' IsPatronPage=1 %] |
82 |
</div> |
83 |
</div> |
75 |
</div> |
84 |
</div> |
76 |
[% INCLUDE 'opac-bottom.inc' %] |
85 |
[% INCLUDE 'opac-bottom.inc' %] |
|
|
86 |
|
87 |
[% INCLUDE 'datatables.inc' %] |
88 |
[% INCLUDE 'browser-strings.inc' %] |
89 |
|
90 |
<script type="text/javascript"> |
91 |
//<![CDATA[ |
92 |
$(document).ready(function() { |
93 |
$('#account-credits').hide(); |
94 |
$('#account-debits-switcher').click(function() { |
95 |
$('#account-debits').slideUp(); |
96 |
$('#account-credits').slideDown(); |
97 |
}); |
98 |
$('#account-credits-switcher').click(function() { |
99 |
$('#account-credits').slideUp(); |
100 |
$('#account-debits').slideDown(); |
101 |
}); |
102 |
|
103 |
var anOpen = []; |
104 |
var sImageUrl = "[% interface %]/[% theme %]/images/"; |
105 |
|
106 |
var debitsTable = $('#debits-table').dataTable( { |
107 |
"bProcessing": true, |
108 |
"aoColumns": [ |
109 |
{ |
110 |
"mDataProp": null, |
111 |
"sClass": "control center", |
112 |
"sDefaultContent": '<img src="'+sImageUrl+'details_open.png'+'">' |
113 |
}, |
114 |
{ "mDataProp": "debit_id" }, |
115 |
{ "mDataProp": "description" }, |
116 |
{ |
117 |
"mDataProp": "type", |
118 |
"fnRender": function ( o, val ) { |
119 |
return STRINGS['DebitTypes'][val]; |
120 |
}, |
121 |
}, |
122 |
{ "mDataProp": "amount_original" }, |
123 |
{ "mDataProp": "amount_outstanding" }, |
124 |
{ "mDataProp": "created_on" }, |
125 |
{ "mDataProp": "updated_on" } |
126 |
], |
127 |
"aaData": [ |
128 |
[% FOREACH d IN debits %] |
129 |
{ |
130 |
[% PROCESS format_data data=d highlight='debit' %] |
131 |
|
132 |
// Data for related item if there is one linked |
133 |
"title": "[% d.item.biblio.title || d.deleted_item.biblio.title || d.deleted_item.deleted_biblio.title %]", |
134 |
"biblionumber": "[% d.item.biblio.biblionumber || d.deleted_item.biblio.biblionumber %]", |
135 |
"barcode": "[% d.item.barcode || d.deleted_item.barcode %]", |
136 |
"itemnumber": "[% d.item.itemnumber %]", //This way itemnumber will be undef if deleted |
137 |
|
138 |
|
139 |
// Data for related issue if there is one linked |
140 |
[% IF d.issue %] |
141 |
[% SET table = 'issue' %] |
142 |
[% ELSIF d.old_issue %] |
143 |
[% SET table = 'old_issue' %] |
144 |
[% END %] |
145 |
|
146 |
[% IF table %] |
147 |
"issue": { |
148 |
[% PROCESS format_data data=d.$table %] |
149 |
}, |
150 |
[% END %] |
151 |
|
152 |
|
153 |
"account_offsets": [ |
154 |
[% FOREACH ao IN d.account_offsets %] |
155 |
{ |
156 |
[% PROCESS format_data data=ao highlight='offset'%] |
157 |
|
158 |
"credit": { |
159 |
[% PROCESS format_data data=ao.credit highlight='credit' %] |
160 |
} |
161 |
}, |
162 |
[% END %] |
163 |
] |
164 |
|
165 |
}, |
166 |
[% END %] |
167 |
] |
168 |
} ); |
169 |
|
170 |
$('#debits-table td.control').live( 'click', function () { |
171 |
var nTr = this.parentNode; |
172 |
var i = $.inArray( nTr, anOpen ); |
173 |
|
174 |
if ( i === -1 ) { |
175 |
$('img', this).attr( 'src', sImageUrl+"details_close.png" ); |
176 |
var nDetailsRow = debitsTable.fnOpen( nTr, fnFormatDebitDetails(debitsTable, nTr), 'details' ); |
177 |
$('div.innerDetails', nDetailsRow).slideDown(); |
178 |
anOpen.push( nTr ); |
179 |
} |
180 |
else { |
181 |
$('img', this).attr( 'src', sImageUrl+"details_open.png" ); |
182 |
$('div.innerDetails', $(nTr).next()[0]).slideUp( function () { |
183 |
debitsTable.fnClose( nTr ); |
184 |
anOpen.splice( i, 1 ); |
185 |
} ); |
186 |
} |
187 |
} ); |
188 |
|
189 |
var creditsTable = $('#credits-table').dataTable( { |
190 |
"bProcessing": true, |
191 |
"aoColumns": [ |
192 |
{ |
193 |
"mDataProp": null, |
194 |
"sClass": "control center", |
195 |
"sDefaultContent": '<img src="'+sImageUrl+'details_open.png'+'">' |
196 |
}, |
197 |
{ "mDataProp": "credit_id" }, |
198 |
{ "mDataProp": "notes" }, |
199 |
{ |
200 |
"mDataProp": "type", |
201 |
"fnRender": function ( o, val ) { |
202 |
return STRINGS['CreditTypes'][val]; |
203 |
}, |
204 |
}, |
205 |
{ "mDataProp": "amount_paid" }, |
206 |
{ "mDataProp": "amount_remaining" }, |
207 |
{ "mDataProp": "created_on" }, |
208 |
{ "mDataProp": "updated_on" } |
209 |
], |
210 |
"aaData": [ |
211 |
[% FOREACH c IN credits %] |
212 |
{ |
213 |
[% PROCESS format_data data=c highlight='credit' %] |
214 |
|
215 |
"account_offsets": [ |
216 |
[% FOREACH ao IN c.account_offsets %] |
217 |
{ |
218 |
[% PROCESS format_data data=ao highlight='offset' %] |
219 |
|
220 |
"debit": { |
221 |
[% PROCESS format_data data=ao.debit highlight='debit' %] |
222 |
} |
223 |
}, |
224 |
[% END %] |
225 |
] |
226 |
|
227 |
}, |
228 |
[% END %] |
229 |
] |
230 |
} ); |
231 |
|
232 |
$('#credits-table td.control').live( 'click', function () { |
233 |
var nTr = this.parentNode; |
234 |
var i = $.inArray( nTr, anOpen ); |
235 |
|
236 |
if ( i === -1 ) { |
237 |
$('img', this).attr( 'src', sImageUrl+"details_close.png" ); |
238 |
var nDetailsRow = creditsTable.fnOpen( nTr, fnFormatCreditDetails(creditsTable, nTr), 'details' ); |
239 |
$('div.innerDetails', nDetailsRow).slideDown(); |
240 |
anOpen.push( nTr ); |
241 |
} |
242 |
else { |
243 |
$('img', this).attr( 'src', sImageUrl+"details_open.png" ); |
244 |
$('div.innerDetails', $(nTr).next()[0]).slideUp( function () { |
245 |
creditsTable.fnClose( nTr ); |
246 |
anOpen.splice( i, 1 ); |
247 |
} ); |
248 |
} |
249 |
} ); |
250 |
|
251 |
} ); |
252 |
|
253 |
function fnFormatDebitDetails( debitsTable, nTr ) { |
254 |
var oData = debitsTable.fnGetData( nTr ); |
255 |
|
256 |
var sOut = "<div class='innerDetails' style='display:none;'>"; |
257 |
|
258 |
var account_offsets = oData.account_offsets; |
259 |
|
260 |
sOut += "<ul>"; |
261 |
if ( oData.title ) { |
262 |
sOut += "<li>" + _("Title: "); |
263 |
if ( oData.biblionumber ) { |
264 |
sOut += "<a href='/cgi-bin/koha/opac-detail.pl?biblionumber=" + oData.biblionumber + "'>"; |
265 |
} |
266 |
|
267 |
sOut += oData.title; |
268 |
|
269 |
if ( oData.biblionumber ) { |
270 |
sOut += "</a>"; |
271 |
} |
272 |
|
273 |
sOut += "</li>"; |
274 |
} |
275 |
|
276 |
if ( oData.barcode ) { |
277 |
sOut += "<li>" + _("Barcode: ") + oData.barcode + "</li>"; |
278 |
} |
279 |
|
280 |
if ( oData.notes ) { |
281 |
sOut += "<li>" + _("Notes: ") + oData.notes + "</li>"; |
282 |
} |
283 |
|
284 |
sOut += "</ul>"; |
285 |
|
286 |
if ( account_offsets.length ) { |
287 |
sOut += |
288 |
"<div class='innerDetails'>" + |
289 |
"<table cellpadding='5' cellspacing='0' border='0' style='margin:10px;'>" + |
290 |
"<thead>" + |
291 |
"<tr><th colspan='99'>" + _("Payments applied") + "</th></tr>" + |
292 |
"<tr>" + |
293 |
"<th>" + _("ID") + "</th>" + |
294 |
"<th>" + _("Created on") + "</th>" + |
295 |
"<th>" + _("Payment amount") + "</th>" + |
296 |
"<th>" + _("Applied amount") + "</th>" + |
297 |
"<th>" + _("Type") + "</th>" + |
298 |
"<th>" + _("Notes") + "</th>" + |
299 |
"</tr>" + |
300 |
"</thead>" + |
301 |
"<tbody>"; |
302 |
|
303 |
for ( var i = 0; i < account_offsets.length; i++ ) { |
304 |
ao = account_offsets[i]; |
305 |
sOut += |
306 |
"<tr>" + |
307 |
"<td>" + ao.credit_id + "</td>" + |
308 |
"<td>" + ao.created_on + "</td>" + |
309 |
"<td>" + ao.credit.amount_paid + "</td>" + |
310 |
"<td>" + ao.amount + "</td>" + |
311 |
"<td>" + ao.credit.type + "</td>" + |
312 |
"<td>" + ao.credit.notes + "</td>" + |
313 |
"</tr>"; |
314 |
} |
315 |
|
316 |
sOut += |
317 |
"</tbody>"+ |
318 |
"</table>"; |
319 |
} |
320 |
|
321 |
sOut += |
322 |
"</div>"; |
323 |
|
324 |
return sOut; |
325 |
} |
326 |
|
327 |
function fnFormatCreditDetails( creditsTable, nTr ) { |
328 |
var oData = creditsTable.fnGetData( nTr ); |
329 |
|
330 |
var sOut = '<div class="innerDetails" style="display:none;">'; |
331 |
|
332 |
var account_offsets = oData.account_offsets; |
333 |
|
334 |
if ( account_offsets.length ) { |
335 |
sOut += |
336 |
"<table cellpadding='5' cellspacing='0' border='0' style='margin:10px;'>" + |
337 |
"<thead>" + |
338 |
"<tr><th colspan='99'>" + _("Fees paid") + "</th></tr>" + |
339 |
"<tr>" + |
340 |
"<th>" + _("ID") + "</th>" + |
341 |
"<th>" + _("Description") + "</th>" + |
342 |
"<th>" + _("Type") + "</th>" + |
343 |
"<th>" + _("Amount") + "</th>" + |
344 |
"<th>" + _("Remaining") + "</th>" + |
345 |
"<th>" + _("Created on") + "</th>" + |
346 |
"<th>" + _("Updated on") + "</th>" + |
347 |
"<th>" + _("Notes") + "</th>" + |
348 |
"</tr>" + |
349 |
"</thead>" + |
350 |
"<tbody>"; |
351 |
|
352 |
for ( var i = 0; i < account_offsets.length; i++ ) { |
353 |
ao = account_offsets[i]; |
354 |
sOut += |
355 |
"<tr>" + |
356 |
"<td>" + ao.debit.debit_id + "</td>" + |
357 |
"<td>" + ao.debit.description + "</td>" + |
358 |
"<td>" + ao.debit.type + "</td>" + |
359 |
"<td>" + ao.debit.amount_original + "</td>" + |
360 |
"<td>" + ao.debit.amount_outstanding + "</td>" + |
361 |
"<td>" + ao.debit.created_on + "</td>" + |
362 |
"<td>" + ao.debit.updated_on + "</td>" + |
363 |
"<td>" + ao.debit.notes + "</td>" + |
364 |
"</tr>"; |
365 |
} |
366 |
|
367 |
sOut += |
368 |
"</tbody>"+ |
369 |
"</table>"; |
370 |
} |
371 |
|
372 |
sOut += |
373 |
"</div>"; |
374 |
|
375 |
return sOut; |
376 |
} |
377 |
|
378 |
//]]> |
379 |
</script> |
380 |
|
381 |
[% BLOCK jsinclude %][% END %] |
382 |
|
383 |
[% BLOCK format_data %] |
384 |
[% FOREACH key IN data.result_source.columns %] |
385 |
[% IF key.match('^amount') %] |
386 |
"[% key %]": "[% data.$key FILTER $Currency %]", |
387 |
[% ELSIF key.match('_on$') %] |
388 |
"[% key %]": "[% data.$key | $KohaDates %]", |
389 |
[% ELSE %] |
390 |
"[% key %]": "[% data.$key %]", |
391 |
[% END %] |
392 |
[% END %] |
393 |
[% END %] |