6 [% USE ColumnsSettings %]
7 [% USE AuthorisedValues %]
10 [% SET footerjs = 1 %]
12 [% PROCESS 'accounts.inc' %]
14 [% INCLUDE 'doc-head-open.inc' %]
15 <title>Koha › Patrons › Account for [% INCLUDE 'patron-title.inc' no_html = 1 %]</title>
16 [% INCLUDE 'doc-head-close.inc' %]
19 <body id="pat_borraccount" class="pat">
20 [% INCLUDE 'header.inc' %]
21 [% INCLUDE 'patron-search.inc' %]
23 <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>
25 <div class="main container-fluid">
27 <div class="col-sm-10 col-sm-push-2">
30 [% INCLUDE 'members-toolbar.inc' %]
31 <form action="/cgi-bin/koha/members/boraccount.pl" method="get"><input type="hidden" name="borrowernumber" id="borrowernumber" value="[% patron.borrowernumber | html %]" /></form>
33 <!-- The manual invoice and credit buttons -->
34 <div class="statictabs">
36 <li class="active"><a href="/cgi-bin/koha/members/boraccount.pl?borrowernumber=[% patron.borrowernumber | uri %]">Transactions</a></li>
37 <li><a href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% patron.borrowernumber | uri %]" >Make a payment</a></li>
38 <li><a href="/cgi-bin/koha/members/maninvoice.pl?borrowernumber=[% patron.borrowernumber | uri %]" >Create manual invoice</a></li>
39 <li><a href="/cgi-bin/koha/members/mancredit.pl?borrowernumber=[% patron.borrowernumber | uri %]" >Create manual credit</a></li>
41 <div class="tabs-container">
42 [% INCLUDE 'renew_results.inc' renew_results=renew_results %]
43 <!-- The table with the account items -->
44 <table id="table_account_fines">
47 <th class="title-string">Date</th>
49 <th>Description of charges</th>
61 <!-- FIXME: Shouldn't hardcode dollar signs, since Euro or Pound might be needed -->
62 [% FOREACH account IN accounts %]
65 <td><span title="[% account.date | html %]">[% account.date |$KohaDates %]</span></td>
66 <td>[% PROCESS account_type_description account=account %]</td>
68 [%- IF account.payment_type %][% AuthorisedValues.GetByCode('PAYMENT_TYPE', account.payment_type) | html %][% END %]
69 [%- IF account.description %][% account.description | html %][% END %]
70 [% IF ( account.itemnumber ) %]<a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=[% account.item.biblionumber | uri %]&itemnumber=[% account.itemnumber | uri %]">[% account.item.biblio.title | html %]</a>[% END %]</td>
71 <td>[% IF ( account.itemnumber ) %]<a href="/cgi-bin/koha/catalogue/moredetail.pl?itemnumber=[% account.itemnumber | uri %]&biblionumber=[% account.item.biblionumber | uri %]#item[% account.itemnumber | uri %]">[% account.item.barcode | html %]</a>[% END %]</td>
72 <td>[% IF ( account.issue_id ) %][% account.checkout.date_due | $KohaDates as_due_date => 1 %][% END %]</td>
73 <td>[% IF ( account.issue_id ) %][% account.checkout.returndate | $KohaDates with_hours => 1 %][% END %]</td>
74 <td>[% IF account.itemnumber %][% Branches.GetName( account.item.homebranch ) | html %][% END %]</td>
75 <td>[% account.note | html_line_break %]</td>
76 [% IF account.amount <= 0 %]<td class="credit" style="text-align: right;">[% ELSE %]<td class="debit" style="text-align: right;">[% END %][% account.amount | $Price %]</td>
77 [% IF account.amountoutstanding <= 0 %]<td class="credit" style="text-align: right;">[% ELSE %]<td class="debit" style="text-align: right;">[% END %][% account.amountoutstanding | $Price %]</td>
79 [% IF ( account.is_credit ) %]
80 <a target="_blank" href="printfeercpt.pl?action=print&accountlines_id=[% account.accountlines_id | uri %]&borrowernumber=[% account.borrowernumber | uri %]" class="btn btn-default btn-xs"><i class="fa fa-print"></i> Print</a>
82 <a target="_blank" href="printinvoice.pl?action=print&accountlines_id=[% account.accountlines_id | uri %]&borrowernumber=[% account.borrowernumber | uri %]" class="btn btn-default btn-xs"><i class="fa fa-print"></i> Print</a>
84 <a href="accountline-details.pl?accountlines_id=[% account.accountlines_id | uri %]" class="btn btn-default btn-xs"><i class="fa fa-list"></i> Details</a>
85 [% IF account.is_credit %]
86 <a href="boraccount.pl?action=void&accountlines_id=[% account.accountlines_id | uri %]&borrowernumber=[% account.borrowernumber | uri %]" class="btn btn-default btn-xs void"><i class="fa fa-ban"></i> Void</a>
88 [% IF CAN_user_updatecharges_payout && account.is_credit && ( account.amountoutstanding < 0 ) %]
89 <button type="button" data-toggle="modal" data-target="#issuePayoutModal" data-account="[%- PROCESS account_type_description account=account -%]" data-accountline="[% account.accountlines_id | html %]" data-amount="[% account.amountoutstanding | $Price %]" class="btn btn-default btn-xs"><i class="fa fa-money"></i> Issue payout</button>
91 [% IF CAN_user_updatecharges_refund && account.is_debit && ( account.amountoutstanding != account.amount ) && !(account.status == 'REFUNDED') && !(account.debit_type_code == 'PAYOUT') %]
92 <button type="button" data-toggle="modal" data-target="#issueRefundModal" data-item="[%- PROCESS account_type_description account=account -%]" data-accountline="[% account.accountlines_id | html %]" data-amount="[% account.amount | $Price %]" data-amountoutstanding="[% account.amountoutstanding | $Price %]" class="btn btn-default btn-xs"><i class="fa fa-money"></i> Issue refund</button>
94 [% IF CAN_user_updatecharges_discount && account.is_debit && ( account.amountoutstanding == account.amount ) && !(account.debit_type_code == 'PAYOUT') %]
95 <button type="button" data-toggle="modal" data-target="#applyDiscountModal" data-item="[%- PROCESS account_type_description account=account -%]" data-accountline="[% account.accountlines_id | html %]" data-amount="[% account.amount | $Price %]" data-amountoutstanding="[% account.amountoutstanding | $Price %]" class="btn btn-default btn-xs"><i class="fa fa-percent"></i> Apply discount</button>
103 <td colspan="9">Total due</td>
104 [% IF ( totalcredit ) %]
105 <td class="credit" style="text-align: right;">[% total | $Price %]</td>
107 <td class="debit"style="text-align: right;">[% total | $Price %]</td>
117 </div> <!-- /.col-sm-10.col-sm-push-2 -->
119 <div class="col-sm-2 col-sm-pull-10">
121 [% INCLUDE 'circ-menu.inc' %]
123 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
124 </div> <!-- /.row -->
126 <!-- Issue payout modal -->
127 <div class="modal" id="issuePayoutModal" tabindex="-1" role="dialog" aria-labelledby="issuePayoutLabel">
128 <form id="payout_form" action="/cgi-bin/koha/members/boraccount.pl" method="get" enctype="multipart/form-data" class="validated">
129 <input type="hidden" name="accountlines_id" value="" id="payoutline">
130 <input type="hidden" name="action" value="payout">
131 <input type="hidden" name="borrowernumber" value="[% account.borrowernumber | html %]">
132 <div class="modal-dialog" role="document">
133 <div class="modal-content">
134 <div class="modal-header">
135 <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
136 <h4 class="modal-title" id="issuePayoutLabel">Issue payout</h4>
138 <div class="modal-body">
139 <fieldset class="rows">
142 <span id="paid" class="label">Outstanding credit: </span><span>[% payout.amount | $Price %]</span>
145 <label class="required" for="amount">Returned to patron: </label>
146 <input type="number" step="0.01" id="amount" name="amount" min="0.00" required="required">
147 <span class="required">Required</span>
149 [% SET payment_types = AuthorisedValues.GetAuthValueDropbox('PAYMENT_TYPE') %]
150 [% SET excluded = ['SIP00', 'SIP01', 'SIP02'] %]
151 [% IF payment_types > 3 %]
153 <label for="transaction_type">Transaction type: </label>
154 <select name="transaction_type" id="payout_transaction_type">
155 [% FOREACH pt IN payment_types %]
156 [% UNLESS excluded.grep("^$pt.authorised_value\$").size %]
157 <option value="[% pt.authorised_value | html %]">[% pt.lib | html %]</option>
164 [% IF Koha.Preference('UseCashRegisters') %]
166 <label for="registerid">Cash register: </label>
167 <select name="registerid" id="payout_registerid">
168 [% FOREACH register IN registers %]
169 [% IF register.id == registerid %]
170 <option value="[% register.id | html %]" selected="selected">[% register.name | html %]</option>
172 <option value="[% register.id | html %]">[% register.name | html %]</option>
180 </fieldset> <!-- /.rows -->
181 </div> <!-- /.modal-body -->
182 <div class="modal-footer">
183 <input type="hidden" name="op" value="payout">
184 <button type="submit" class="btn btn-default">Confirm</button>
185 <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
186 </div> <!-- /.modal-footer -->
187 </div> <!-- /.modal-content -->
188 </div> <!-- /.modal-dialog -->
189 </form> <!-- /#payout_form -->
190 </div> <!-- /#issuePayoutModal -->
192 <!-- Issue refund modal -->
193 <div class="modal" id="issueRefundModal" tabindex="-1" role="dialog" aria-labelledby="issueRefundLabel">
194 <form id="refund_form" action="/cgi-bin/koha/members/boraccount.pl" method="get" enctype="multipart/form-data" class="validated">
195 <input type="hidden" name="accountlines_id" value="" id="refundline">
196 <input type="hidden" name="action" value="refund">
197 <input type="hidden" name="borrowernumber" value="[% account.borrowernumber | html %]">
198 <div class="modal-dialog" role="document">
199 <div class="modal-content">
200 <div class="modal-header">
201 <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
202 <h4 class="modal-title" id="issueRefundLabel">Issue refund</h4>
204 <div class="modal-body">
205 <fieldset class="rows">
208 <span id="item" class="label">Account: </span><span></span>
211 <span id="paid" class="label">Amount paid: </span><span></span>
214 <label class="required" for="amount">Returned to patron: </label>
215 <input type="number" step="0.01" id="returned" name="amount" min="0.00" required="required">
216 <span class="required">Required</span>
218 [% SET payment_types = AuthorisedValues.GetAuthValueDropbox('PAYMENT_TYPE') %]
220 <label for="transaction_type">Transaction type: </label>
221 <select name="transaction_type" id="refund_transaction_type">
222 <option value="AC">Account credit</option>
223 [% IF payment_types %]
224 [% FOREACH pt IN payment_types %]
225 <option value="[% pt.authorised_value | html %]">[% pt.lib | html %]</option>
231 [% IF Koha.Preference('UseCashRegisters') %]
233 <label for="registerid">Cash register: </label>
234 <select name="registerid" id="refund_registerid">
235 [% FOREACH register IN registers %]
236 [% IF register.id == registerid %]
237 <option value="[% register.id | html %]" selected="selected">[% register.name | html %]</option>
239 <option value="[% register.id | html %]">[% register.name | html %]</option>
247 </fieldset> <!-- /.rows -->
248 </div> <!-- /.modal-body -->
249 <div class="modal-footer">
250 <input type="hidden" name="op" value="refund">
251 <button type="submit" class="btn btn-default">Confirm</button>
252 <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
253 </div> <!-- /.modal-footer -->
254 </div> <!-- /.modal-content -->
255 </div> <!-- /.modal-dialog -->
256 </form> <!-- /#refund_form -->
257 </div> <!-- /#issueRefundModal -->
259 <!-- Apply discount modal -->
260 <div class="modal" id="applyDiscountModal" tabindex="-1" role="dialog" aria-labelledby="applyDiscountLabel">
261 <form id="discount_form" action="/cgi-bin/koha/members/boraccount.pl" method="get" enctype="multipart/form-data" class="validated">
262 <input type="hidden" name="accountlines_id" value="" id="discountline">
263 <input type="hidden" name="action" value="discount">
264 <input type="hidden" name="borrowernumber" value="[% account.borrowernumber | html %]">
265 <div class="modal-dialog" role="document">
266 <div class="modal-content">
267 <div class="modal-header">
268 <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
269 <h4 class="modal-title" id="applyDiscountLabel">Apply discount</h4>
271 <div class="modal-body">
272 <fieldset class="rows">
275 <span id="item" class="label">Account type: </span><span></span>
278 <span id="charged" class="label">Amount charged: </span><span></span>
281 <label class="required" for="amount">Discount to apply: </label>
282 <input type="number" step="0.01" id="discount" name="amount" min="0.00" required="required">
283 <span class="required">Required</span>
286 </fieldset> <!-- /.rows -->
287 </div> <!-- /.modal-body -->
288 <div class="modal-footer">
289 <input type="hidden" name="op" value="discount">
290 <button type="submit" class="btn btn-default">Confirm</button>
291 <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
292 </div> <!-- /.modal-footer -->
293 </div> <!-- /.modal-content -->
294 </div> <!-- /.modal-dialog -->
295 </form> <!-- /#discount_form -->
296 </div> <!-- /#applyDiscountModal -->
298 [% MACRO jsinclude BLOCK %]
299 [% INCLUDE 'datatables.inc' %]
300 [% INCLUDE 'columns_settings.inc' %]
301 [% INCLUDE 'str/members-menu.inc' %]
302 [% Asset.js("js/members-menu.js") | $raw %]
304 $(document).ready(function() {
305 [% IF payment_id && Koha.Preference('FinePaymentAutoPopup') %]
306 window.open('/cgi-bin/koha/members/printfeercpt.pl?action=print&change_given=[% change_given | html %]&accountlines_id=[% payment_id | html %]&borrowernumber=[% patron.borrowernumber | html %]', '_blank');
309 var txtActivefilter = _("Filter paid transactions");
310 var txtInactivefilter = _("Show all transactions");
311 var columns_settings = [% ColumnsSettings.GetColumns('members', 'fines', 'account-fines', 'json') | $raw %];
312 var table_account_fines = KohaTable("table_account_fines", {
313 "sPaginationType": "full",
314 'aaSorting': [[0, 'desc']],
315 "sDom": 'C<"top pager"ilpfB><"#filter_c">tr<"bottom pager"ip>',
317 { "sType": "title-string", "aTargets" : [ "title-string" ] },
318 { "bSortable": false, "bSearchable": false, "aTargets": [-1] }
320 }, columns_settings);
321 $("#filter_c").html('<p><a href="#" id="filter_transacs"><i class="fa fa-filter"></i> '+txtActivefilter+'</a>');
322 $('#filter_transacs').click(function(e) {
324 if ($(this).hasClass('filtered')) {
325 var filteredValue = '';
326 $(this).html('<i class="fa fa-filter"></i> '+txtActivefilter);
327 } else { //Not filtered. Let's do it!
328 var filteredValue = '^((?!0.00).*)$'; //Filter not matching 0.00 http://stackoverflow.com/a/406408
329 $(this).html('<i class="fa fa-filter"></i> '+txtInactivefilter);
331 table_account_fines.fnFilter(filteredValue, 9, true, false);
332 $(this).toggleClass('filtered');
335 $(".void").on("click",function(e){
336 if( confirm( _("Are you sure you want to void this credit?") ) ) {
343 $("#issuePayoutModal").on("shown.bs.modal", function(e){
344 var button = $(e.relatedTarget);
345 var accountline = button.data('accountline');
346 $('#payoutline').val(accountline);
347 var amount = button.data('amount') * -1;
348 $("#paid + span").replaceWith(amount);
349 $("#amount").attr({ "value": amount, "max": amount });
350 $("#amount, #payout_transaction_type").focus();
353 $("#issueRefundModal").on("shown.bs.modal", function(e){
354 var button = $(e.relatedTarget);
355 var item = button.data('item');
356 $("#item + span").replaceWith(item);
357 var accountline = button.data('accountline');
358 $('#refundline').val(accountline);
359 var amount = button.data('amount');
360 var amountoutstanding = button.data('amountoutstanding');
361 var paid = amount - amountoutstanding;
362 $("#paid + span").replaceWith(paid);
363 $("#returned").attr({ "value": paid, "max": paid });
364 $("#returned, #refund_transaction_type").focus();
367 $("#applyDiscountModal").on("shown.bs.modal", function(e){
368 var button = $(e.relatedTarget);
369 var item = button.data('item');
370 $("#item + span").replaceWith(item);
371 var accountline = button.data('accountline');
372 $('#discountline').val(accountline);
373 var amount = button.data('amount');
374 $("#charged + span").replaceWith(amount);
375 $("#discount").attr({ "max": amount });
376 $("#discount").focus();
382 [% INCLUDE 'intranet-bottom.inc' %]