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 |
<script type="text/javascript" src="[% interface %]/[% theme %]/en/js/strings.js"></script> |
10 |
[% INCLUDE 'datatables.inc' %] |
11 |
[% INCLUDE 'browser-strings.inc' %] |
12 |
|
13 |
<script type="text/javascript"> |
14 |
//<![CDATA[ |
15 |
$(document).ready(function() { |
16 |
$('#account-credits').hide(); |
17 |
$('#account-debits-switcher').click(function() { |
18 |
$('#account-debits').slideUp(); |
19 |
$('#account-credits').slideDown(); |
20 |
}); |
21 |
$('#account-credits-switcher').click(function() { |
22 |
$('#account-credits').slideUp(); |
23 |
$('#account-debits').slideDown(); |
24 |
}); |
25 |
|
26 |
var anOpen = []; |
27 |
var sImageUrl = "[% interface %]/[% theme %]/img/"; |
28 |
|
29 |
var debitsTable = $('#debits-table').dataTable( { |
30 |
"bProcessing": true, |
31 |
"aoColumns": [ |
32 |
{ |
33 |
"mDataProp": null, |
34 |
"sClass": "control center", |
35 |
"sDefaultContent": '<img src="'+sImageUrl+'details_open.png'+'">' |
36 |
}, |
37 |
{ "mDataProp": "debit_id" }, |
38 |
{ "mDataProp": "description" }, |
39 |
{ |
40 |
"mDataProp": "type", |
41 |
"fnRender": function ( o, val ) { |
42 |
return STRINGS['DebitTypes'][val]; |
43 |
}, |
44 |
}, |
45 |
{ "mDataProp": "amount_original" }, |
46 |
{ "mDataProp": "amount_outstanding" }, |
47 |
{ "mDataProp": "created_on" }, |
48 |
{ "mDataProp": "updated_on" } |
49 |
], |
50 |
"aaData": [ |
51 |
[% FOREACH d IN debits %] |
52 |
{ |
53 |
[% PROCESS format_data data=d highlight='debit' %] |
54 |
|
55 |
// Data for related item if there is one linked |
56 |
"title": "[% d.item.biblio.title || d.deleted_item.biblio.title || d.deleted_item.deleted_biblio.title %]", |
57 |
"biblionumber": "[% d.item.biblio.biblionumber || d.deleted_item.biblio.biblionumber %]", |
58 |
"barcode": "[% d.item.barcode || d.deleted_item.barcode %]", |
59 |
"itemnumber": "[% d.item.itemnumber %]", //This way itemnumber will be undef if deleted |
60 |
|
61 |
|
62 |
// Data for related issue if there is one linked |
63 |
[% IF d.issue %] |
64 |
[% SET table = 'issue' %] |
65 |
[% ELSIF d.old_issue %] |
66 |
[% SET table = 'old_issue' %] |
67 |
[% END %] |
68 |
|
69 |
[% IF table %] |
70 |
"issue": { |
71 |
[% PROCESS format_data data=d.$table %] |
72 |
}, |
73 |
[% END %] |
74 |
|
75 |
|
76 |
"account_offsets": [ |
77 |
[% FOREACH ao IN d.account_offsets %] |
78 |
{ |
79 |
[% PROCESS format_data data=ao highlight='offset'%] |
80 |
|
81 |
"credit": { |
82 |
[% PROCESS format_data data=ao.credit highlight='credit' %] |
83 |
} |
84 |
}, |
85 |
[% END %] |
86 |
] |
87 |
|
88 |
}, |
89 |
[% END %] |
90 |
] |
91 |
} ); |
92 |
|
93 |
$('#debits-table td.control').live( 'click', function () { |
94 |
var nTr = this.parentNode; |
95 |
var i = $.inArray( nTr, anOpen ); |
96 |
|
97 |
if ( i === -1 ) { |
98 |
$('img', this).attr( 'src', sImageUrl+"details_close.png" ); |
99 |
var nDetailsRow = debitsTable.fnOpen( nTr, fnFormatDebitDetails(debitsTable, nTr), 'details' ); |
100 |
$('div.innerDetails', nDetailsRow).slideDown(); |
101 |
anOpen.push( nTr ); |
102 |
} |
103 |
else { |
104 |
$('img', this).attr( 'src', sImageUrl+"details_open.png" ); |
105 |
$('div.innerDetails', $(nTr).next()[0]).slideUp( function () { |
106 |
debitsTable.fnClose( nTr ); |
107 |
anOpen.splice( i, 1 ); |
108 |
} ); |
109 |
} |
110 |
} ); |
111 |
|
112 |
var creditsTable = $('#credits-table').dataTable( { |
113 |
"bProcessing": true, |
114 |
"aoColumns": [ |
115 |
{ |
116 |
"mDataProp": null, |
117 |
"sClass": "control center", |
118 |
"sDefaultContent": '<img src="'+sImageUrl+'details_open.png'+'">' |
119 |
}, |
120 |
{ "mDataProp": "credit_id" }, |
121 |
{ "mDataProp": "notes" }, |
122 |
{ |
123 |
"mDataProp": "type", |
124 |
"fnRender": function ( o, val ) { |
125 |
return STRINGS['CreditTypes'][val]; |
126 |
}, |
127 |
}, |
128 |
{ "mDataProp": "amount_paid" }, |
129 |
{ "mDataProp": "amount_remaining" }, |
130 |
{ "mDataProp": "created_on" }, |
131 |
{ "mDataProp": "updated_on" } |
132 |
], |
133 |
"aaData": [ |
134 |
[% FOREACH c IN credits %] |
135 |
{ |
136 |
[% PROCESS format_data data=c highlight='credit' %] |
137 |
|
138 |
"account_offsets": [ |
139 |
[% FOREACH ao IN c.account_offsets %] |
140 |
{ |
141 |
[% PROCESS format_data data=ao highlight='offset' %] |
142 |
|
143 |
"debit": { |
144 |
[% PROCESS format_data data=ao.debit highlight='debit' %] |
145 |
} |
146 |
}, |
147 |
[% END %] |
148 |
] |
149 |
|
150 |
}, |
151 |
[% END %] |
152 |
] |
153 |
} ); |
154 |
|
155 |
$('#credits-table td.control').live( 'click', function () { |
156 |
var nTr = this.parentNode; |
157 |
var i = $.inArray( nTr, anOpen ); |
158 |
|
159 |
if ( i === -1 ) { |
160 |
$('img', this).attr( 'src', sImageUrl+"details_close.png" ); |
161 |
var nDetailsRow = creditsTable.fnOpen( nTr, fnFormatCreditDetails(creditsTable, nTr), 'details' ); |
162 |
$('div.innerDetails', nDetailsRow).slideDown(); |
163 |
anOpen.push( nTr ); |
164 |
} |
165 |
else { |
166 |
$('img', this).attr( 'src', sImageUrl+"details_open.png" ); |
167 |
$('div.innerDetails', $(nTr).next()[0]).slideUp( function () { |
168 |
creditsTable.fnClose( nTr ); |
169 |
anOpen.splice( i, 1 ); |
170 |
} ); |
171 |
} |
172 |
} ); |
173 |
|
174 |
} ); |
175 |
|
176 |
function fnFormatDebitDetails( debitsTable, nTr ) { |
177 |
var oData = debitsTable.fnGetData( nTr ); |
178 |
|
179 |
var sOut = "<div class='innerDetails' style='display:none;'>"; |
180 |
|
181 |
var account_offsets = oData.account_offsets; |
182 |
|
183 |
sOut += "<a class='debit_print btn btn-small' style='margin:5px;' onclick='accountPrint(\"debit\"," + oData.debit_id + ")'>" + |
184 |
"<i class='icon-print'></i> " + _("Print receipt") + |
185 |
"</a>"; |
186 |
|
187 |
sOut += "<ul>"; |
188 |
if ( oData.title ) { |
189 |
sOut += "<li>" + _("Title: "); |
190 |
if ( oData.biblionumber ) { |
191 |
sOut += "<a href='/cgi-bin/koha/catalogue/detail.pl?biblionumber=" + oData.biblionumber + "'>"; |
192 |
} |
193 |
|
194 |
sOut += oData.title; |
195 |
|
196 |
if ( oData.biblionumber ) { |
197 |
sOut += "</a>"; |
198 |
} |
199 |
|
200 |
sOut += "</li>"; |
201 |
} |
202 |
|
203 |
if ( oData.barcode ) { |
204 |
sOut += "<li>" + _("Barcode: "); |
205 |
if ( oData.itemnumber ) { |
206 |
sOut += "<a href='/cgi-bin/koha/catalogue/moredetail.pl?itemnumber=11&biblionumber=" + oData.biblionumber + "&bi=" + oData.biblionumber + "#item" + oData.itemnumber + "" + oData.biblionumber + "'>"; |
207 |
} |
208 |
|
209 |
sOut += oData.barcode; |
210 |
|
211 |
if ( oData.itemnumber ) { |
212 |
sOut += "</a>"; |
213 |
} |
214 |
|
215 |
sOut += "</li>"; |
216 |
} |
217 |
|
218 |
if ( oData.notes ) { |
219 |
sOut += "<li>" + _("Notes: ") + oData.notes + "</li>"; |
220 |
} |
221 |
|
222 |
sOut += "</ul>"; |
223 |
|
224 |
if ( account_offsets.length ) { |
225 |
sOut += |
226 |
"<div class='innerDetails'>" + |
227 |
"<table cellpadding='5' cellspacing='0' border='0' style='margin:10px;'>" + |
228 |
"<thead>" + |
229 |
"<tr><th colspan='99'>" + _("Payments applied") + "</th></tr>" + |
230 |
"<tr>" + |
231 |
"<th>" + _("ID") + "</th>" + |
232 |
"<th>" + _("Created on") + "</th>" + |
233 |
"<th>" + _("Payment amount") + "</th>" + |
234 |
"<th>" + _("Applied amount") + "</th>" + |
235 |
"<th>" + _("Type") + "</th>" + |
236 |
"<th>" + _("Notes") + "</th>" + |
237 |
"</tr>" + |
238 |
"</thead>" + |
239 |
"<tbody>"; |
240 |
|
241 |
for ( var i = 0; i < account_offsets.length; i++ ) { |
242 |
ao = account_offsets[i]; |
243 |
sOut += |
244 |
"<tr>" + |
245 |
"<td>" + ao.credit_id + "</td>" + |
246 |
"<td>" + ao.created_on + "</td>" + |
247 |
"<td>" + ao.credit.amount_paid + "</td>" + |
248 |
"<td>" + ao.amount + "</td>" + |
249 |
"<td>" + STRINGS["CreditTypes"][ao.credit.type] + "</td>" + |
250 |
"<td>" + ao.credit.notes + "</td>" + |
251 |
"</tr>"; |
252 |
} |
253 |
|
254 |
sOut += |
255 |
"</tbody>"+ |
256 |
"</table>"; |
257 |
} |
258 |
|
259 |
sOut += |
260 |
"</div>"; |
261 |
|
262 |
return sOut; |
263 |
} |
264 |
|
265 |
function fnFormatCreditDetails( creditsTable, nTr ) { |
266 |
var oData = creditsTable.fnGetData( nTr ); |
267 |
|
268 |
var sOut = "<div class='innerDetails' style='display:none;'>"; |
269 |
|
270 |
sOut += "<button class='credit_print btn btn-small' style='margin:5px;' onclick='accountPrint(\"credit\"," + oData.credit_id + ")'>" + |
271 |
"<i class='icon-print'></i> " + _("Print receipt") + |
272 |
"</button>"; |
273 |
|
274 |
var account_offsets = oData.account_offsets; |
275 |
|
276 |
if ( account_offsets.length ) { |
277 |
sOut += |
278 |
"<table cellpadding='5' cellspacing='0' border='0' style='margin:10px;'>" + |
279 |
"<thead>" + |
280 |
"<tr><th colspan='99'>" + _("Fees paid") + "</th></tr>" + |
281 |
"<tr>" + |
282 |
"<th>" + _("ID") + "</th>" + |
283 |
"<th>" + _("Description") + "</th>" + |
284 |
"<th>" + _("Type") + "</th>" + |
285 |
"<th>" + _("Amount") + "</th>" + |
286 |
"<th>" + _("Remaining") + "</th>" + |
287 |
"<th>" + _("Created on") + "</th>" + |
288 |
"<th>" + _("Updated on") + "</th>" + |
289 |
"<th>" + _("Notes") + "</th>" + |
290 |
"</tr>" + |
291 |
"</thead>" + |
292 |
"<tbody>"; |
293 |
|
294 |
for ( var i = 0; i < account_offsets.length; i++ ) { |
295 |
ao = account_offsets[i]; |
296 |
sOut += |
297 |
"<tr>" + |
298 |
"<td>" + ao.debit.debit_id + "</td>" + |
299 |
"<td>" + ao.debit.description + "</td>" + |
300 |
"<td>" + STRINGS["DebitTypes"][ao.debit.type] + "</td>" + |
301 |
"<td>" + ao.debit.amount_original + "</td>" + |
302 |
"<td>" + ao.debit.amount_outstanding + "</td>" + |
303 |
"<td>" + ao.debit.created_on + "</td>" + |
304 |
"<td>" + ao.debit.updated_on + "</td>" + |
305 |
"<td>" + ao.debit.notes + "</td>" + |
306 |
"</tr>"; |
307 |
} |
308 |
|
309 |
sOut += |
310 |
"</tbody>"+ |
311 |
"</table>"; |
312 |
} |
313 |
|
314 |
sOut += |
315 |
"</div>"; |
316 |
|
317 |
return sOut; |
318 |
} |
319 |
|
320 |
function accountPrint( type, id ) { |
321 |
window.open( "/cgi-bin/koha/members/account_print.pl?type=" + type + "&id=" + id ); |
322 |
} |
323 |
//]]> |
324 |
</script> |
325 |
</head> |
326 |
<body> |
327 |
[% INCLUDE 'header.inc' %] |
328 |
[% INCLUDE 'patron-search.inc' %] |
329 |
|
330 |
<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> |
331 |
|
332 |
<div id="doc3" class="yui-t2"> |
333 |
<div id="bd"> |
334 |
<div id="yui-main"> |
335 |
<div class="yui-b"> |
336 |
[% INCLUDE 'members-toolbar.inc' %] |
337 |
|
338 |
<div class="statictabs"> |
339 |
<ul> |
340 |
<li class="active"> |
341 |
<a href="/cgi-bin/koha/members/account.pl?borrowernumber=[% borrowernumber %]">Account</a> |
342 |
</li> |
343 |
|
344 |
<li> |
345 |
<a href="/cgi-bin/koha/members/account_payment.pl?borrowernumber=[% borrowernumber %]" >Pay fines</a> |
346 |
</li> |
347 |
|
348 |
<li> |
349 |
<a href="/cgi-bin/koha/members/account_debit.pl?borrowernumber=[% borrowernumber %]" >Create manual invoice</a> |
350 |
</li> |
351 |
|
352 |
<li> |
353 |
<a href="/cgi-bin/koha/members/account_credit.pl?borrowernumber=[% borrowernumber %]" >Create manual credit</a> |
354 |
</li> |
355 |
</ul> |
356 |
</div> |
357 |
|
358 |
<div class="tabs-container"> |
359 |
|
360 |
<p> |
361 |
<h3>Account balance: [% borrower.account_balance | $Currency %]</h3> |
362 |
</p> |
363 |
|
364 |
<div> |
365 |
<div id="account-debits"> |
366 |
<a id="account-debits-switcher" href="#" onclick="return false">View payments</a> |
367 |
<table cellpadding="0" cellspacing="0" border="0" class="display" id="debits-table"> |
368 |
<thead> |
369 |
<tr> |
370 |
<th colspan="99">Fees</th> |
371 |
</tr> |
372 |
<tr> |
373 |
<th></th> |
374 |
<th>ID</th> |
375 |
<th>Description</th> |
376 |
<th>Type</th> |
377 |
<th>Amount</th> |
378 |
<th>Outsanding</th> |
379 |
<th>Created on</th> |
380 |
<th>Updated on</th> |
381 |
</tr> |
382 |
</thead> |
383 |
<tbody></tbody> |
384 |
</table> |
385 |
</div> |
386 |
|
387 |
<div id="account-credits"> |
388 |
<a id="account-credits-switcher" href="#" onclick="return false">View fees</a> |
389 |
<table cellpadding="0" cellspacing="0" border="0" class="display" id="credits-table"> |
390 |
<thead> |
391 |
<tr> |
392 |
<th colspan="99">Payments</th> |
393 |
</tr> |
394 |
<tr> |
395 |
<th></th> |
396 |
<th>ID</th> |
397 |
<th>Notes</th> |
398 |
<th>Type</th> |
399 |
<th>Amount</th> |
400 |
<th>Remaining</th> |
401 |
<th>Created on</th> |
402 |
<th>Updated on</th> |
403 |
</tr> |
404 |
</thead> |
405 |
<tbody></tbody> |
406 |
</table> |
407 |
</div> |
408 |
</div> |
409 |
</div> |
410 |
</div> |
411 |
</div> |
412 |
|
413 |
<div class="yui-b"> |
414 |
[% INCLUDE 'circ-menu.inc' %] |
415 |
</div> |
416 |
</div> |
417 |
[% INCLUDE 'intranet-bottom.inc' %] |
418 |
|
419 |
[% BLOCK format_data %] |
420 |
[% FOREACH key IN data.result_source.columns %] |
421 |
[% IF key.match('^amount') %] |
422 |
"[% key %]": "[% data.$key FILTER $Currency highlight => highlight %]", |
423 |
[% ELSIF key.match('_on$') %] |
424 |
"[% key %]": "[% data.$key | $KohaDates %]", |
425 |
[% ELSE %] |
426 |
"[% key %]": "[% data.$key %]", |
427 |
[% END %] |
428 |
[% END %] |
429 |
[% END %] |