Line 0
Link Here
|
|
|
1 |
[% SET accounts_view = 1 %] |
2 |
[% USE KohaDates %] |
3 |
[% USE Currency %] |
4 |
[% INCLUDE 'doc-head-open.inc' %] |
5 |
<title>Koha › Patrons › Account for [% INCLUDE 'patron-title.inc' %]</title> |
6 |
[% INCLUDE 'doc-head-close.inc' %] |
7 |
|
8 |
<link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/en/css/datatables.css" /> |
9 |
[% INCLUDE 'datatables.inc' %] |
10 |
[% INCLUDE 'browser-strings.inc' %] |
11 |
|
12 |
<script type="text/javascript"> |
13 |
//<![CDATA[ |
14 |
$(document).ready(function() { |
15 |
void_compare = "[% 0 FILTER $Currency highlight => highlight %]"; |
16 |
|
17 |
[% IF credit_id %] |
18 |
accountPrint( 'credit', [% credit_id %] ); |
19 |
[% ELSIF debit_id %] |
20 |
accountPrint( 'debit', [% debit_id %] ); |
21 |
[% END %] |
22 |
|
23 |
$('#account-credits').hide(); |
24 |
$('#account-debits-switcher').click(function() { |
25 |
$('#account-debits').slideUp(); |
26 |
$('#account-credits').slideDown(); |
27 |
}); |
28 |
$('#account-credits-switcher').click(function() { |
29 |
$('#account-credits').slideUp(); |
30 |
$('#account-debits').slideDown(); |
31 |
}); |
32 |
|
33 |
var anOpen = []; |
34 |
var sImageUrl = "[% interface %]/[% theme %]/img/"; |
35 |
|
36 |
var debitsTable = $('#debits-table').dataTable( { |
37 |
"sDom": "<'row-fluid'<'span6'T><'span6'>r>t<'row-fluid'><'top pager'ilpf>t<'bottom pager'ip>", |
38 |
"oTableTools": { |
39 |
"sSwfPath": "[% interface %]/lib/jquery/plugins/TableTools/media/swf/copy_csv_xls_pdf.swf", |
40 |
"aButtons": [ |
41 |
{ |
42 |
"sExtends": "print", |
43 |
"sButtonText": "<i class='icon-print'></i> " + _("Print") |
44 |
}, |
45 |
{ |
46 |
"sExtends": "collection", |
47 |
"sButtonText": "<i class='icon-download'></i> " + _("Download") + " <span class='caret' />", |
48 |
"aButtons": [ |
49 |
{ |
50 |
"sExtends": "csv", |
51 |
"sButtonText": "<i class='icon-file'></i> " + _("CSV") |
52 |
} |
53 |
] |
54 |
} |
55 |
] |
56 |
}, |
57 |
"bProcessing": true, |
58 |
"aoColumns": [ |
59 |
{ |
60 |
"mDataProp": null, |
61 |
"sClass": "control center", |
62 |
"sDefaultContent": '<img src="'+sImageUrl+'details_open.png'+'">' |
63 |
}, |
64 |
{ "mDataProp": "debit_id" }, |
65 |
{ "mDataProp": "description" }, |
66 |
{ |
67 |
"mDataProp": "type", |
68 |
"fnRender": function ( o, val ) { |
69 |
return STRINGS['DebitTypes'][val] || val; |
70 |
}, |
71 |
}, |
72 |
{ "mDataProp": "amount_original" }, |
73 |
{ "mDataProp": "amount_outstanding" }, |
74 |
{ "mDataProp": "created_on" }, |
75 |
{ "mDataProp": "updated_on" } |
76 |
], |
77 |
"aaData": [ |
78 |
[% FOREACH d IN debits %] |
79 |
{ |
80 |
[% PROCESS format_data data=d highlight='debit' %] |
81 |
|
82 |
// Data for related item if there is one linked |
83 |
"title": "[% d.item.biblio.title || d.deleted_item.biblio.title || d.deleted_item.deleted_biblio.title | replace('"', '\"') %]", |
84 |
"biblionumber": "[% d.item.biblio.biblionumber || d.deleted_item.biblio.biblionumber %]", |
85 |
"barcode": "[% d.item.barcode || d.deleted_item.barcode %]", |
86 |
"itemnumber": "[% d.item.itemnumber %]", //This way itemnumber will be undef if deleted |
87 |
|
88 |
|
89 |
// Data for related issue if there is one linked |
90 |
[% IF d.issue %] |
91 |
[% SET table = 'issue' %] |
92 |
[% ELSIF d.old_issue %] |
93 |
[% SET table = 'old_issue' %] |
94 |
[% END %] |
95 |
|
96 |
[% IF table %] |
97 |
"issue": { |
98 |
[% PROCESS format_data data=d.$table %] |
99 |
}, |
100 |
[% END %] |
101 |
|
102 |
|
103 |
"account_offsets": [ |
104 |
[% FOREACH ao IN d.account_offsets %] |
105 |
[% IF ao.credit %] |
106 |
{ |
107 |
[% PROCESS format_data data=ao highlight='offset'%] |
108 |
|
109 |
"credit": { |
110 |
[% PROCESS format_data data=ao.credit highlight='credit' %] |
111 |
} |
112 |
}, |
113 |
[% END %] |
114 |
[% END %] |
115 |
] |
116 |
|
117 |
}, |
118 |
[% END %] |
119 |
] |
120 |
} ); |
121 |
|
122 |
$('#debits-table td.control').live( 'click', function () { |
123 |
var nTr = this.parentNode; |
124 |
var i = $.inArray( nTr, anOpen ); |
125 |
|
126 |
if ( i === -1 ) { |
127 |
$('img', this).attr( 'src', sImageUrl+"details_close.png" ); |
128 |
var nDetailsRow = debitsTable.fnOpen( nTr, fnFormatDebitDetails(debitsTable, nTr), 'details' ); |
129 |
$('div.innerDetails', nDetailsRow).slideDown(); |
130 |
anOpen.push( nTr ); |
131 |
} |
132 |
else { |
133 |
$('img', this).attr( 'src', sImageUrl+"details_open.png" ); |
134 |
$('div.innerDetails', $(nTr).next()[0]).slideUp( function () { |
135 |
debitsTable.fnClose( nTr ); |
136 |
anOpen.splice( i, 1 ); |
137 |
} ); |
138 |
} |
139 |
} ); |
140 |
|
141 |
var creditsTable = $('#credits-table').dataTable( { |
142 |
"sDom": "<'row-fluid'<'span6'T><'span6'>r>t<'row-fluid'><'top pager'ilpf>t<'bottom pager'ip>", |
143 |
"oTableTools": { |
144 |
"sSwfPath": "[% interface %]/lib/jquery/plugins/TableTools/media/swf/copy_csv_xls_pdf.swf", |
145 |
"aButtons": [ |
146 |
{ |
147 |
"sExtends": "print", |
148 |
"sButtonText": "<i class='icon-print'></i> " + _("Print") |
149 |
}, |
150 |
{ |
151 |
"sExtends": "collection", |
152 |
"sButtonText": "<i class='icon-download'></i> " + _("Download") + " <span class='caret' />", |
153 |
"aButtons": [ |
154 |
{ |
155 |
"sExtends": "csv", |
156 |
"sButtonText": "<i class='icon-file'></i> " + _("CSV") |
157 |
} |
158 |
] |
159 |
} |
160 |
] |
161 |
}, |
162 |
"bProcessing": true, |
163 |
"aoColumns": [ |
164 |
{ |
165 |
"mDataProp": null, |
166 |
"sClass": "control center", |
167 |
"sDefaultContent": '<img src="'+sImageUrl+'details_open.png'+'">' |
168 |
}, |
169 |
{ "mDataProp": "credit_id" }, |
170 |
{ "mDataProp": "notes" }, |
171 |
{ |
172 |
"mDataProp": "type", |
173 |
"fnRender": function ( o, val ) { |
174 |
return STRINGS['CreditTypes'][val] || val; |
175 |
}, |
176 |
}, |
177 |
{ |
178 |
"mDataProp": "amount_paid", |
179 |
"mRender": function ( data, type, full ) { |
180 |
if ( full.amount_voided != void_compare ) { |
181 |
return "<strike>" + full.amount_voided + "</strike>"; |
182 |
} else { |
183 |
return full.amount_paid; |
184 |
} |
185 |
} |
186 |
}, |
187 |
{ "mDataProp": "amount_remaining" }, |
188 |
{ "mDataProp": "created_on" }, |
189 |
{ "mDataProp": "updated_on" } |
190 |
], |
191 |
"aaData": [ |
192 |
[% FOREACH c IN credits %] |
193 |
{ |
194 |
[% PROCESS format_data data=c highlight='credit' %] |
195 |
|
196 |
"account_offsets": [ |
197 |
[% FOREACH ao IN c.account_offsets %] |
198 |
{ |
199 |
[% PROCESS format_data data=ao highlight='offset' %] |
200 |
|
201 |
"debit": { |
202 |
[% PROCESS format_data data=ao.debit highlight='debit' %] |
203 |
} |
204 |
}, |
205 |
[% END %] |
206 |
] |
207 |
|
208 |
}, |
209 |
[% END %] |
210 |
] |
211 |
} ); |
212 |
|
213 |
$('#credits-table td.control').live( 'click', function () { |
214 |
var nTr = this.parentNode; |
215 |
var i = $.inArray( nTr, anOpen ); |
216 |
|
217 |
if ( i === -1 ) { |
218 |
$('img', this).attr( 'src', sImageUrl+"details_close.png" ); |
219 |
var nDetailsRow = creditsTable.fnOpen( nTr, fnFormatCreditDetails(creditsTable, nTr), 'details' ); |
220 |
$('div.innerDetails', nDetailsRow).slideDown(); |
221 |
anOpen.push( nTr ); |
222 |
} |
223 |
else { |
224 |
$('img', this).attr( 'src', sImageUrl+"details_open.png" ); |
225 |
$('div.innerDetails', $(nTr).next()[0]).slideUp( function () { |
226 |
creditsTable.fnClose( nTr ); |
227 |
anOpen.splice( i, 1 ); |
228 |
} ); |
229 |
} |
230 |
} ); |
231 |
|
232 |
} ); |
233 |
|
234 |
function fnFormatDebitDetails( debitsTable, nTr ) { |
235 |
var oData = debitsTable.fnGetData( nTr ); |
236 |
|
237 |
var sOut = "<div class='innerDetails' style='display:none;'>"; |
238 |
|
239 |
var account_offsets = oData.account_offsets; |
240 |
|
241 |
sOut += "<a class='debit_print btn btn-small noprint' style='margin:5px;' onclick='accountPrint(\"debit\"," + oData.debit_id + ")'>" + |
242 |
"<i class='icon-print'></i> " + _("Print receipt") + |
243 |
"</a>"; |
244 |
|
245 |
sOut += "<ul>"; |
246 |
if ( oData.title ) { |
247 |
sOut += "<li>" + _("Title: "); |
248 |
if ( oData.biblionumber ) { |
249 |
sOut += "<a href='/cgi-bin/koha/catalogue/detail.pl?biblionumber=" + oData.biblionumber + "'>"; |
250 |
} |
251 |
|
252 |
sOut += oData.title; |
253 |
|
254 |
if ( oData.biblionumber ) { |
255 |
sOut += "</a>"; |
256 |
} |
257 |
|
258 |
sOut += "</li>"; |
259 |
} |
260 |
|
261 |
if ( oData.barcode ) { |
262 |
sOut += "<li>" + _("Barcode: "); |
263 |
if ( oData.itemnumber ) { |
264 |
sOut += "<a href='/cgi-bin/koha/catalogue/moredetail.pl?itemnumber=11&biblionumber=" + oData.biblionumber + "&bi=" + oData.biblionumber + "#item" + oData.itemnumber + "" + oData.biblionumber + "'>"; |
265 |
} |
266 |
|
267 |
sOut += oData.barcode; |
268 |
|
269 |
if ( oData.itemnumber ) { |
270 |
sOut += "</a>"; |
271 |
} |
272 |
|
273 |
sOut += "</li>"; |
274 |
} |
275 |
|
276 |
if ( oData.notes ) { |
277 |
sOut += "<li>" + _("Notes: ") + oData.notes + "</li>"; |
278 |
} |
279 |
|
280 |
sOut += "</ul>"; |
281 |
|
282 |
if ( account_offsets.length ) { |
283 |
sOut += |
284 |
"<div class='innerDetails'>" + |
285 |
"<table cellpadding='5' cellspacing='0' border='0' style='margin:10px;'>" + |
286 |
"<thead>" + |
287 |
"<tr><th colspan='99'>" + _("Payments applied") + "</th></tr>" + |
288 |
"<tr>" + |
289 |
"<th>" + _("ID") + "</th>" + |
290 |
"<th>" + _("Created on") + "</th>" + |
291 |
"<th>" + _("Payment amount") + "</th>" + |
292 |
"<th>" + _("Applied amount") + "</th>" + |
293 |
"<th>" + _("Type") + "</th>" + |
294 |
"<th>" + _("Notes") + "</th>" + |
295 |
"</tr>" + |
296 |
"</thead>" + |
297 |
"<tbody>"; |
298 |
|
299 |
for ( var i = 0; i < account_offsets.length; i++ ) { |
300 |
ao = account_offsets[i]; |
301 |
credit_type = STRINGS["CreditTypes"][ao.credit.type] || ao.credit.type; |
302 |
offset_type = STRINGS["OffsetTypes"][ao.type] || ao.type; |
303 |
if ( offset_type ) offset_type = " (" + offset_type + ") "; |
304 |
|
305 |
var payment_or_void; |
306 |
if ( ao.credit.amount_voided != void_compare ) { |
307 |
payment_or_void = "<strike>" + ao.credit.amount_voided + "</strike>"; |
308 |
} else { |
309 |
payment_or_void = ao.credit.amount_paid; |
310 |
} |
311 |
|
312 |
sOut += |
313 |
"<tr>" + |
314 |
"<td>" + ao.credit_id + "</td>" + |
315 |
"<td>" + ao.created_on + "</td>" + |
316 |
"<td>" + payment_or_void + "</td>" + |
317 |
"<td>" + ao.amount + "</td>" + |
318 |
"<td>" + credit_type + offset_type + "</td>" + |
319 |
"<td>" + ao.credit.notes + "</td>" + |
320 |
"</tr>"; |
321 |
} |
322 |
|
323 |
sOut += |
324 |
"</tbody>"+ |
325 |
"</table>"; |
326 |
} |
327 |
|
328 |
sOut += |
329 |
"</div>"; |
330 |
|
331 |
return sOut; |
332 |
} |
333 |
|
334 |
function fnFormatCreditDetails( creditsTable, nTr ) { |
335 |
var oData = creditsTable.fnGetData( nTr ); |
336 |
|
337 |
var sOut = "<div class='innerDetails' style='display:none;'>"; |
338 |
|
339 |
sOut += "<button class='credit_print btn btn-small noprint' style='margin:5px;' onclick='accountPrint(\"credit\"," + oData.credit_id + ")'>" + |
340 |
"<i class='icon-print'></i> " + _("Print receipt") + |
341 |
"</button>"; |
342 |
|
343 |
if ( ! oData.amount_voided_original ) { |
344 |
sOut += "<a class='credit_void btn btn-small noprint' style='margin:5px;' onclick='accountVoid(\"credit\"," + oData.credit_id + ")'>" + |
345 |
"<i class='icon-remove-sign'></i> " + _("Void payment") + |
346 |
"</a>"; |
347 |
} |
348 |
|
349 |
var account_offsets = oData.account_offsets; |
350 |
|
351 |
if ( account_offsets.length ) { |
352 |
sOut += |
353 |
"<table cellpadding='5' cellspacing='0' border='0' style='margin:10px;'>" + |
354 |
"<thead>" + |
355 |
"<tr><th colspan='99'>" + _("Fees paid") + "</th></tr>" + |
356 |
"<tr>" + |
357 |
"<th>" + _("ID") + "</th>" + |
358 |
"<th>" + _("Description") + "</th>" + |
359 |
"<th>" + _("Type") + "</th>" + |
360 |
"<th>" + _("Amount") + "</th>" + |
361 |
"<th>" + _("Amount applied") + "</th>" + |
362 |
"<th>" + _("Remaining") + "</th>" + |
363 |
"<th>" + _("Created on") + "</th>" + |
364 |
"<th>" + _("Updated on") + "</th>" + |
365 |
"<th>" + _("Notes") + "</th>" + |
366 |
"</tr>" + |
367 |
"</thead>" + |
368 |
"<tbody>"; |
369 |
|
370 |
for ( var i = 0; i < account_offsets.length; i++ ) { |
371 |
ao = account_offsets[i]; |
372 |
debit_type = STRINGS["DebitTypes"][ao.debit.type] || ao.debit.type; |
373 |
offset_type = STRINGS["OffsetTypes"][ao.type] || ao.type; |
374 |
if ( offset_type ) offset_type = " (" + offset_type + ") "; |
375 |
|
376 |
sOut += |
377 |
"<tr>" + |
378 |
"<td>" + ao.debit.debit_id + "</td>" + |
379 |
"<td>" + ao.debit.description + "</td>" + |
380 |
"<td>" + debit_type + offset_type + "</td>" + |
381 |
"<td>" + ao.debit.amount_original + "</td>" + |
382 |
"<td>" + ao.amount + "</td>" + |
383 |
"<td>" + ao.debit.amount_outstanding + "</td>" + |
384 |
"<td>" + ao.debit.created_on + "</td>" + |
385 |
"<td>" + ao.debit.updated_on + "</td>" + |
386 |
"<td>" + ao.debit.notes + "</td>" + |
387 |
"</tr>"; |
388 |
} |
389 |
|
390 |
sOut += |
391 |
"</tbody>"+ |
392 |
"</table>"; |
393 |
} |
394 |
|
395 |
sOut += |
396 |
"</div>"; |
397 |
|
398 |
return sOut; |
399 |
} |
400 |
|
401 |
function accountPrint( type, id ) { |
402 |
window.open( "/cgi-bin/koha/members/account_print.pl?type=" + type + "&id=" + id ); |
403 |
} |
404 |
|
405 |
function accountVoid( type, id ) { |
406 |
if ( confirm(_("Are you sure you want to void this transaction?")) ) { |
407 |
window.location.href = "/cgi-bin/koha/members/account_void.pl?borrowernumber=" + [% borrowernumber %] + "&id=" + id; |
408 |
} |
409 |
} |
410 |
//]]> |
411 |
</script> |
412 |
</head> |
413 |
<body> |
414 |
[% INCLUDE 'header.inc' %] |
415 |
[% INCLUDE 'patron-search.inc' %] |
416 |
|
417 |
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/members/members-home.pl">Patrons</a> › Account for [% INCLUDE 'patron-title.inc' %]</div> |
418 |
|
419 |
<div id="doc3" class="yui-t2"> |
420 |
<div id="bd"> |
421 |
<div id="yui-main"> |
422 |
<div class="yui-b"> |
423 |
[% INCLUDE 'members-toolbar.inc' %] |
424 |
|
425 |
<div class="statictabs"> |
426 |
<ul> |
427 |
<li class="active"> |
428 |
<a href="/cgi-bin/koha/members/account.pl?borrowernumber=[% borrowernumber %]">Account</a> |
429 |
</li> |
430 |
|
431 |
<li> |
432 |
<a href="/cgi-bin/koha/members/account_payment.pl?borrowernumber=[% borrowernumber %]" >Pay fines</a> |
433 |
</li> |
434 |
|
435 |
<li> |
436 |
<a href="/cgi-bin/koha/members/account_debit.pl?borrowernumber=[% borrowernumber %]" >Create manual invoice</a> |
437 |
</li> |
438 |
|
439 |
<li> |
440 |
<a href="/cgi-bin/koha/members/account_credit.pl?borrowernumber=[% borrowernumber %]" >Create manual credit</a> |
441 |
</li> |
442 |
</ul> |
443 |
</div> |
444 |
|
445 |
<div class="tabs-container"> |
446 |
|
447 |
<p> |
448 |
<h3>Account balance: [% borrower.account_balance | $Currency %]</h3> |
449 |
</p> |
450 |
|
451 |
<div> |
452 |
<div id="account-debits"> |
453 |
<p><a id="account-debits-switcher" href="#" onclick="return false">View payments</a></p> |
454 |
<table cellpadding="0" cellspacing="0" border="0" class="display" id="debits-table"> |
455 |
<thead> |
456 |
<tr> |
457 |
<th colspan="99">Fees</th> |
458 |
</tr> |
459 |
<tr> |
460 |
<th></th> |
461 |
<th>ID</th> |
462 |
<th>Description</th> |
463 |
<th>Type</th> |
464 |
<th>Amount</th> |
465 |
<th>Outstanding</th> |
466 |
<th>Created on</th> |
467 |
<th>Updated on</th> |
468 |
</tr> |
469 |
</thead> |
470 |
<tbody></tbody> |
471 |
</table> |
472 |
</div> |
473 |
|
474 |
<div id="account-credits"> |
475 |
<p><a id="account-credits-switcher" href="#" onclick="return false">View fees</a></p> |
476 |
<table cellpadding="0" cellspacing="0" border="0" class="display" id="credits-table"> |
477 |
<thead> |
478 |
<tr> |
479 |
<th colspan="99">Payments</th> |
480 |
</tr> |
481 |
<tr> |
482 |
<th></th> |
483 |
<th>ID</th> |
484 |
<th>Notes</th> |
485 |
<th>Type</th> |
486 |
<th>Amount</th> |
487 |
<th>Remaining</th> |
488 |
<th>Created on</th> |
489 |
<th>Updated on</th> |
490 |
</tr> |
491 |
</thead> |
492 |
<tbody></tbody> |
493 |
</table> |
494 |
</div> |
495 |
</div> |
496 |
</div> |
497 |
</div> |
498 |
</div> |
499 |
|
500 |
<div class="yui-b"> |
501 |
[% INCLUDE 'circ-menu.inc' %] |
502 |
</div> |
503 |
</div> |
504 |
[% INCLUDE 'intranet-bottom.inc' %] |
505 |
|
506 |
[% BLOCK format_data %] |
507 |
[% FOREACH key IN data.result_source.columns %] |
508 |
[% IF key.match('^amount') %] |
509 |
"[% key %]_original": "[% data.$key %]", |
510 |
"[% key %]": "[% data.$key FILTER $Currency highlight => highlight %]", |
511 |
[% ELSIF key.match('_on$') %] |
512 |
"[% key %]_original": "[% data.$key %]", |
513 |
"[% key %]": "[% data.$key | $KohaDates %]", |
514 |
[% ELSE %] |
515 |
"[% key %]": "[% data.$key | replace('"', '\"') %]", |
516 |
[% END %] |
517 |
[% END %] |
518 |
[% END %] |