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 | replace('"', '\"') %]", |
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 |
[% IF ao.credit %] |
79 |
{ |
80 |
[% PROCESS format_data data=ao highlight='offset'%] |
81 |
|
82 |
"credit": { |
83 |
[% PROCESS format_data data=ao.credit highlight='credit' %] |
84 |
} |
85 |
}, |
86 |
[% END %] |
87 |
[% END %] |
88 |
] |
89 |
|
90 |
}, |
91 |
[% END %] |
92 |
] |
93 |
} ); |
94 |
|
95 |
$('#debits-table td.control').live( 'click', function () { |
96 |
var nTr = this.parentNode; |
97 |
var i = $.inArray( nTr, anOpen ); |
98 |
|
99 |
if ( i === -1 ) { |
100 |
$('img', this).attr( 'src', sImageUrl+"details_close.png" ); |
101 |
var nDetailsRow = debitsTable.fnOpen( nTr, fnFormatDebitDetails(debitsTable, nTr), 'details' ); |
102 |
$('div.innerDetails', nDetailsRow).slideDown(); |
103 |
anOpen.push( nTr ); |
104 |
} |
105 |
else { |
106 |
$('img', this).attr( 'src', sImageUrl+"details_open.png" ); |
107 |
$('div.innerDetails', $(nTr).next()[0]).slideUp( function () { |
108 |
debitsTable.fnClose( nTr ); |
109 |
anOpen.splice( i, 1 ); |
110 |
} ); |
111 |
} |
112 |
} ); |
113 |
|
114 |
var creditsTable = $('#credits-table').dataTable( { |
115 |
"bProcessing": true, |
116 |
"aoColumns": [ |
117 |
{ |
118 |
"mDataProp": null, |
119 |
"sClass": "control center", |
120 |
"sDefaultContent": '<img src="'+sImageUrl+'details_open.png'+'">' |
121 |
}, |
122 |
{ "mDataProp": "credit_id" }, |
123 |
{ "mDataProp": "notes" }, |
124 |
{ |
125 |
"mDataProp": "type", |
126 |
"fnRender": function ( o, val ) { |
127 |
return STRINGS['CreditTypes'][val]; |
128 |
}, |
129 |
}, |
130 |
{ "mDataProp": "amount_paid" }, |
131 |
{ "mDataProp": "amount_remaining" }, |
132 |
{ "mDataProp": "created_on" }, |
133 |
{ "mDataProp": "updated_on" } |
134 |
], |
135 |
"aaData": [ |
136 |
[% FOREACH c IN credits %] |
137 |
{ |
138 |
[% PROCESS format_data data=c highlight='credit' %] |
139 |
|
140 |
"account_offsets": [ |
141 |
[% FOREACH ao IN c.account_offsets %] |
142 |
{ |
143 |
[% PROCESS format_data data=ao highlight='offset' %] |
144 |
|
145 |
"debit": { |
146 |
[% PROCESS format_data data=ao.debit highlight='debit' %] |
147 |
} |
148 |
}, |
149 |
[% END %] |
150 |
] |
151 |
|
152 |
}, |
153 |
[% END %] |
154 |
] |
155 |
} ); |
156 |
|
157 |
$('#credits-table td.control').live( 'click', function () { |
158 |
var nTr = this.parentNode; |
159 |
var i = $.inArray( nTr, anOpen ); |
160 |
|
161 |
if ( i === -1 ) { |
162 |
$('img', this).attr( 'src', sImageUrl+"details_close.png" ); |
163 |
var nDetailsRow = creditsTable.fnOpen( nTr, fnFormatCreditDetails(creditsTable, nTr), 'details' ); |
164 |
$('div.innerDetails', nDetailsRow).slideDown(); |
165 |
anOpen.push( nTr ); |
166 |
} |
167 |
else { |
168 |
$('img', this).attr( 'src', sImageUrl+"details_open.png" ); |
169 |
$('div.innerDetails', $(nTr).next()[0]).slideUp( function () { |
170 |
creditsTable.fnClose( nTr ); |
171 |
anOpen.splice( i, 1 ); |
172 |
} ); |
173 |
} |
174 |
} ); |
175 |
|
176 |
} ); |
177 |
|
178 |
function fnFormatDebitDetails( debitsTable, nTr ) { |
179 |
var oData = debitsTable.fnGetData( nTr ); |
180 |
|
181 |
var sOut = "<div class='innerDetails' style='display:none;'>"; |
182 |
|
183 |
var account_offsets = oData.account_offsets; |
184 |
|
185 |
sOut += "<a class='debit_print btn btn-small' style='margin:5px;' onclick='accountPrint(\"debit\"," + oData.debit_id + ")'>" + |
186 |
"<i class='icon-print'></i> " + _("Print receipt") + |
187 |
"</a>"; |
188 |
|
189 |
sOut += "<ul>"; |
190 |
if ( oData.title ) { |
191 |
sOut += "<li>" + _("Title: "); |
192 |
if ( oData.biblionumber ) { |
193 |
sOut += "<a href='/cgi-bin/koha/catalogue/detail.pl?biblionumber=" + oData.biblionumber + "'>"; |
194 |
} |
195 |
|
196 |
sOut += oData.title; |
197 |
|
198 |
if ( oData.biblionumber ) { |
199 |
sOut += "</a>"; |
200 |
} |
201 |
|
202 |
sOut += "</li>"; |
203 |
} |
204 |
|
205 |
if ( oData.barcode ) { |
206 |
sOut += "<li>" + _("Barcode: "); |
207 |
if ( oData.itemnumber ) { |
208 |
sOut += "<a href='/cgi-bin/koha/catalogue/moredetail.pl?itemnumber=11&biblionumber=" + oData.biblionumber + "&bi=" + oData.biblionumber + "#item" + oData.itemnumber + "" + oData.biblionumber + "'>"; |
209 |
} |
210 |
|
211 |
sOut += oData.barcode; |
212 |
|
213 |
if ( oData.itemnumber ) { |
214 |
sOut += "</a>"; |
215 |
} |
216 |
|
217 |
sOut += "</li>"; |
218 |
} |
219 |
|
220 |
if ( oData.notes ) { |
221 |
sOut += "<li>" + _("Notes: ") + oData.notes + "</li>"; |
222 |
} |
223 |
|
224 |
sOut += "</ul>"; |
225 |
|
226 |
if ( account_offsets.length ) { |
227 |
sOut += |
228 |
"<div class='innerDetails'>" + |
229 |
"<table cellpadding='5' cellspacing='0' border='0' style='margin:10px;'>" + |
230 |
"<thead>" + |
231 |
"<tr><th colspan='99'>" + _("Payments applied") + "</th></tr>" + |
232 |
"<tr>" + |
233 |
"<th>" + _("ID") + "</th>" + |
234 |
"<th>" + _("Created on") + "</th>" + |
235 |
"<th>" + _("Payment amount") + "</th>" + |
236 |
"<th>" + _("Applied amount") + "</th>" + |
237 |
"<th>" + _("Type") + "</th>" + |
238 |
"<th>" + _("Notes") + "</th>" + |
239 |
"</tr>" + |
240 |
"</thead>" + |
241 |
"<tbody>"; |
242 |
|
243 |
for ( var i = 0; i < account_offsets.length; i++ ) { |
244 |
ao = account_offsets[i]; |
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>" + STRINGS["CreditTypes"][ao.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 |
sOut += |
299 |
"<tr>" + |
300 |
"<td>" + ao.debit.debit_id + "</td>" + |
301 |
"<td>" + ao.debit.description + "</td>" + |
302 |
"<td>" + STRINGS["DebitTypes"][ao.debit.type] + "</td>" + |
303 |
"<td>" + ao.debit.amount_original + "</td>" + |
304 |
"<td>" + ao.debit.amount_outstanding + "</td>" + |
305 |
"<td>" + ao.debit.created_on + "</td>" + |
306 |
"<td>" + ao.debit.updated_on + "</td>" + |
307 |
"<td>" + ao.debit.notes + "</td>" + |
308 |
"</tr>"; |
309 |
} |
310 |
|
311 |
sOut += |
312 |
"</tbody>"+ |
313 |
"</table>"; |
314 |
} |
315 |
|
316 |
sOut += |
317 |
"</div>"; |
318 |
|
319 |
return sOut; |
320 |
} |
321 |
|
322 |
function accountPrint( type, id ) { |
323 |
window.open( "/cgi-bin/koha/members/account_print.pl?type=" + type + "&id=" + id ); |
324 |
} |
325 |
//]]> |
326 |
</script> |
327 |
</head> |
328 |
<body> |
329 |
[% INCLUDE 'header.inc' %] |
330 |
[% INCLUDE 'patron-search.inc' %] |
331 |
|
332 |
<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> |
333 |
|
334 |
<div id="doc3" class="yui-t2"> |
335 |
<div id="bd"> |
336 |
<div id="yui-main"> |
337 |
<div class="yui-b"> |
338 |
[% INCLUDE 'members-toolbar.inc' %] |
339 |
|
340 |
<div class="statictabs"> |
341 |
<ul> |
342 |
<li class="active"> |
343 |
<a href="/cgi-bin/koha/members/account.pl?borrowernumber=[% borrowernumber %]">Account</a> |
344 |
</li> |
345 |
|
346 |
<li> |
347 |
<a href="/cgi-bin/koha/members/account_payment.pl?borrowernumber=[% borrowernumber %]" >Pay fines</a> |
348 |
</li> |
349 |
|
350 |
<li> |
351 |
<a href="/cgi-bin/koha/members/account_debit.pl?borrowernumber=[% borrowernumber %]" >Create manual invoice</a> |
352 |
</li> |
353 |
|
354 |
<li> |
355 |
<a href="/cgi-bin/koha/members/account_credit.pl?borrowernumber=[% borrowernumber %]" >Create manual credit</a> |
356 |
</li> |
357 |
</ul> |
358 |
</div> |
359 |
|
360 |
<div class="tabs-container"> |
361 |
|
362 |
<p> |
363 |
<h3>Account balance: [% borrower.account_balance | $Currency %]</h3> |
364 |
</p> |
365 |
|
366 |
<div> |
367 |
<div id="account-debits"> |
368 |
<a id="account-debits-switcher" href="#" onclick="return false">View payments</a> |
369 |
<table cellpadding="0" cellspacing="0" border="0" class="display" id="debits-table"> |
370 |
<thead> |
371 |
<tr> |
372 |
<th colspan="99">Fees</th> |
373 |
</tr> |
374 |
<tr> |
375 |
<th></th> |
376 |
<th>ID</th> |
377 |
<th>Description</th> |
378 |
<th>Type</th> |
379 |
<th>Amount</th> |
380 |
<th>Outsanding</th> |
381 |
<th>Created on</th> |
382 |
<th>Updated on</th> |
383 |
</tr> |
384 |
</thead> |
385 |
<tbody></tbody> |
386 |
</table> |
387 |
</div> |
388 |
|
389 |
<div id="account-credits"> |
390 |
<a id="account-credits-switcher" href="#" onclick="return false">View fees</a> |
391 |
<table cellpadding="0" cellspacing="0" border="0" class="display" id="credits-table"> |
392 |
<thead> |
393 |
<tr> |
394 |
<th colspan="99">Payments</th> |
395 |
</tr> |
396 |
<tr> |
397 |
<th></th> |
398 |
<th>ID</th> |
399 |
<th>Notes</th> |
400 |
<th>Type</th> |
401 |
<th>Amount</th> |
402 |
<th>Remaining</th> |
403 |
<th>Created on</th> |
404 |
<th>Updated on</th> |
405 |
</tr> |
406 |
</thead> |
407 |
<tbody></tbody> |
408 |
</table> |
409 |
</div> |
410 |
</div> |
411 |
</div> |
412 |
</div> |
413 |
</div> |
414 |
|
415 |
<div class="yui-b"> |
416 |
[% INCLUDE 'circ-menu.inc' %] |
417 |
</div> |
418 |
</div> |
419 |
[% INCLUDE 'intranet-bottom.inc' %] |
420 |
|
421 |
[% BLOCK format_data %] |
422 |
[% FOREACH key IN data.result_source.columns %] |
423 |
[% IF key.match('^amount') %] |
424 |
"[% key %]": "[% data.$key FILTER $Currency highlight => highlight %]", |
425 |
[% ELSIF key.match('_on$') %] |
426 |
"[% key %]": "[% data.$key | $KohaDates %]", |
427 |
[% ELSE %] |
428 |
"[% key %]": "[% data.$key | replace('"', '\"') %]", |
429 |
[% END %] |
430 |
[% END %] |
431 |
[% END %] |