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