6 [% USE TablesSettings %]
7 [% USE AuthorisedValues %]
11 [% SET footerjs = 1 %]
12 [% SET registers = Registers.all( filters => { current_branch => 1 } ) %]
14 [% PROCESS 'accounts.inc' %]
16 [% INCLUDE 'doc-head-open.inc' %]
17 <title>Account for [% INCLUDE 'patron-title.inc' no_html = 1 %] › Patrons › Koha</title>
18 [% INCLUDE 'doc-head-close.inc' %]
21 <body id="pat_borraccount" class="pat">
22 [% WRAPPER 'header.inc' %]
23 [% INCLUDE 'patron-search-header.inc' %]
26 [% WRAPPER 'sub-header.inc' %]
27 [% WRAPPER breadcrumbs %]
28 [% WRAPPER breadcrumb_item %]
29 <a href="/cgi-bin/koha/members/members-home.pl">Patrons</a>
31 [% WRAPPER breadcrumb_item %]
32 <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% patron.borrowernumber | uri %]">[% INCLUDE 'patron-title.inc' %]</a>
34 [% WRAPPER breadcrumb_item bc_active= 1 %]
37 [% END #/ WRAPPER breadcrumbs %]
38 [% END #/ WRAPPER sub-header.inc %]
40 <div class="main container-fluid">
42 <div class="col-sm-10 col-sm-push-2">
45 [% IF receipt_sent == '1' %]
46 <div id="receipt_sent_dialog" class="dialog message">
50 [% IF receipt_sent == '-1' %]
51 <div id="receipt_sent_dialog" class="dialog warning">
52 Receipt not sent, failed to find template.
56 [% INCLUDE 'members-toolbar.inc' %]
57 <h1>Account for [% INCLUDE 'patron-title.inc' %]</h1>
58 <form action="/cgi-bin/koha/members/boraccount.pl" method="get">[% INCLUDE 'csrf-token.inc' %]<input type="hidden" name="borrowernumber" id="borrowernumber" value="[% patron.borrowernumber | html %]" /></form>
60 <!-- The manual invoice and credit buttons -->
62 <ul class="nav nav-tabs" role="tablist">
63 <li role="presentation" class="transactions active">
64 <a href="/cgi-bin/koha/members/boraccount.pl?borrowernumber=[% patron.borrowernumber | uri %]" role="tab">Transactions</a>
66 <li role="presentation" class="makepayment">
67 <a href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% patron.borrowernumber | uri %]" role="tab">Make a payment</a>
69 [% IF CAN_user_updatecharges_manual_invoice %]
70 <li role="presentation" class="manualinvoice">
71 <a href="/cgi-bin/koha/members/maninvoice.pl?borrowernumber=[% patron.borrowernumber | uri %]" role="tab">Create manual invoice</a>
74 [% IF CAN_user_updatecharges_manual_credit %]
75 <li role="presentation" class="manualcredit">
76 <a href="/cgi-bin/koha/members/mancredit.pl?borrowernumber=[% patron.borrowernumber | uri %]" role="tab">Create manual credit</a>
79 </ul> <!-- /.nav.nav-tabs -->
80 <div class="tab-content">
81 <div role="tabpanel" class="tab-pane active">
82 [% INCLUDE 'renew_results.inc' renew_results=renew_results %]
83 <!-- The table with the account items -->
84 <table id="table_account_fines">
89 <th>Credit number</th>
91 <th>Description of charges</th>
96 <th>Checkout date</th>
97 <th class="checked_out_from">Checked out from</th>
102 <th class="NoSort noExport">Actions</th>
106 <!-- FIXME: Shouldn't hardcode dollar signs, since Euro or Pound might be needed -->
107 [% FOREACH account IN accounts %]
110 <td data-order="[% account.date | html %]">[% account.date | $KohaDates %]</td>
111 <td data-order="[% account.timestamp | html %]">[% account.timestamp | $KohaDates with_hours = 1 %]</td>
112 <td>[% account.credit_number | html %]</td>
113 <td>[% PROCESS account_type_description account=account %]</td>
115 [%- IF account.payment_type %][% AuthorisedValues.GetByCode('PAYMENT_TYPE', account.payment_type) | html %][% END %]
116 [%- IF account.description %][% account.description | html %][% END %]
117 [% 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>
118 <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>
119 <td>[% IF ( account.itemnumber ) %][% account.item.itemcallnumber | html %][% END %]</td>
120 <td>[% IF ( account.issue_id ) %][% account.checkout.date_due | $KohaDates as_due_date => 1 %][% END %]</td>
121 <td>[% IF ( account.issue_id ) %][% account.checkout.returndate | $KohaDates with_hours => 1 %][% END %]</td>
122 <td>[% IF ( account.issue_id ) %][% account.checkout.issuedate | $KohaDates %][% END %]</td>
123 <td class="checked_out_from">
124 [% IF account.issue_id && account.checkout.library %]
125 [% account.checkout.library.branchname | html %]
128 <td>[% IF account.itemnumber %][% Branches.GetName( account.item.homebranch ) | html %][% END %]</td>
129 <td>[% account.note | html_line_break %]</td>
130 [% IF account.amount <= 0 %]<td class="credit" style="text-align: right;">[% ELSE %]<td class="debit" style="text-align: right;">[% END %][% account.amount | $Price %]</td>
131 [% IF account.amountoutstanding <= 0 %]<td class="credit" style="text-align: right;">[% ELSE %]<td class="debit" style="text-align: right;">[% END %][% account.amountoutstanding | $Price %]</td>
133 [% IF ( account.is_credit ) %]
134 [% IF Koha.Preference('UseEmailReceipts') %]
135 <div class="btn-group">
136 <button class="btn btn-xs btn-default dropdown-toggle" data-toggle="dropdown"><i class="fa fa-receipt"></i> Receipt <span class="caret"></span></button>
137 <ul class="dropdown-menu dropdown-menu-right">
138 <li><a target="_blank" href="printfeercpt.pl?accountlines_id=[% account.accountlines_id | uri %]" class="receipt-print-action"><i class="fa fa-print"></i> Print</a></li>
139 <li><a href="boraccount.pl?action=send_receipt&accountlines_id=[% account.accountlines_id | uri %]&borrowernumber=[% account.borrowernumber | uri %]" class="receipt-email-action"><i class="fa fa-envelope"></i> Email</a></li>
143 <a target="_blank" href="printfeercpt.pl?action=print&accountlines_id=[% account.accountlines_id | uri %]" class="btn btn-default btn-xs receipt-print-action"><i class="fa fa-print"></i> Print</a>
146 <a target="_blank" href="printinvoice.pl?action=print&accountlines_id=[% account.accountlines_id | uri %]" class="btn btn-default btn-xs invoice-print-action"><i class="fa fa-print"></i> Print</a>
148 <a href="accountline-details.pl?accountlines_id=[% account.accountlines_id | uri %]" class="btn btn-default btn-xs details-action"><i class="fa fa-list"></i> Details</a>
149 [% IF account.is_debit && account.amountoutstanding > 0 %]
150 <a class="btn btn-default btn-xs pay-action" href="/cgi-bin/koha/members/paycollect.pl?borrowernumber=[% account.borrowernumber | html %]&pay_individual=1&debit_type_code=[% account.debit_type_code | html %]&amount=[% account.amount | html %]&amountoutstanding=[% account.amountoutstanding | html %]&description=[% account.description | html %]&itemnumber=[% account.itemnumber | html %]&accountlines_id=[% account.accountlines_id | html %]&csrf_token=[% csrf_token | html %]"><i class="fa-solid fa-money-bill-1"></i> Pay</a>
152 [% IF account.is_credit && account.status != 'VOID' %]
153 <a href="boraccount.pl?action=void&accountlines_id=[% account.accountlines_id | uri %]&borrowernumber=[% account.borrowernumber | uri %]&csrf_token=[% csrf_token | uri %]" class="btn btn-default btn-xs void-action"><i class="fa fa-ban"></i> Void payment</a>
155 [% IF account.is_debit && account.amount == account.amountoutstanding && account.status != 'CANCELLED' && !(account.debit_type_code == 'PAYOUT') %]
156 <form method="post" action="/cgi-bin/koha/members/cancel-charge.pl">
157 [% INCLUDE 'csrf-token.inc' %]
158 <input type="hidden" name="borrowernumber" value="[% patron.borrowernumber | html %]">
159 <input type="hidden" name="accountlines_id" value="[% account.accountlines_id | html %]">
160 <button type="submit" class="btn btn-default btn-xs cancel-action">
161 <i class="fa fa-ban"></i>
166 [% IF CAN_user_updatecharges_payout && account.is_credit && ( account.amountoutstanding < 0 ) %]
167 <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 on_editing => 1 %]" class="btn btn-default btn-xs payout-action"><i class="fa-solid fa-money-bill-1"></i> Issue payout</button>
169 [% IF CAN_user_updatecharges_refund && account.is_debit && ( account.amountoutstanding != account.amount ) && !(account.status == 'REFUNDED') && !(account.debit_type_code == 'PAYOUT') %]
170 <button type="button" class="btn btn-default btn-xs refund-action" 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 on_editing => 1 %]" data-amountoutstanding="[% account.amountoutstanding | $Price on_editing => 1 %]" data-member="[% account.borrowernumber | html %]"><i class="fa-solid fa-money-bill-1"></i> Issue refund</button>
172 [% IF CAN_user_updatecharges_discount && account.is_debit && ( account.amountoutstanding == account.amount ) && !(account.debit_type_code == 'PAYOUT') && !(account.debit_type_code == 'VOID') %]
173 <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 on_editing => 1 %]" data-amountoutstanding="[% account.amountoutstanding | $Price on_editing => 1 %]" class="btn btn-default btn-xs discount-action">Apply discount</button>
181 <td colspan="14">Total due</td>
182 [% IF ( totalcredit ) %]
183 <td class="credit" style="text-align: right;">[% total | $Price %]</td>
185 [% IF CAN_user_updatecharges_payout %]
186 <button type="button" data-toggle="modal" data-target="#issuePayoutModal" data-amount="[% total | $Price on_editing => 1 %]" class="btn btn-default btn-xs payout-amount-action"><i class="fa-solid fa-money-bill-1"></i> Payout amount</button>
190 <td class="debit"style="text-align: right;">[% total | $Price %]</td>
196 </div> <!-- /.tab-pane -->
197 </div> <!-- /.tab-content -->
198 </div> <!-- /.toptabs -->
201 </div> <!-- /.col-sm-10.col-sm-push-2 -->
203 <div class="col-sm-2 col-sm-pull-10">
205 [% INCLUDE 'circ-menu.inc' %]
207 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
208 </div> <!-- /.row -->
210 <!-- Issue payout modal -->
211 <div class="modal" id="issuePayoutModal" tabindex="-1" role="dialog" aria-labelledby="issuePayoutLabel">
212 <form id="payout_form" action="/cgi-bin/koha/members/boraccount.pl" method="get" enctype="multipart/form-data" class="validated">
213 [% INCLUDE 'csrf-token.inc' %]
214 <input type="hidden" name="accountlines_id" value="" id="payoutline">
215 <input type="hidden" name="action" value="payout">
216 <input type="hidden" name="borrowernumber" value="[% account.borrowernumber | html %]">
217 <div class="modal-dialog" role="document">
218 <div class="modal-content">
219 <div class="modal-header">
220 <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
221 <h4 class="modal-title" id="issuePayoutLabel">Issue payout</h4>
223 <div class="modal-body">
224 [% IF Koha.Preference('UseCashRegisters') && ( registers.size == 0 ) %]
225 <div id="payout_error" class="dialog alert">
226 You must have at least one cash register associated with this branch before you can record cash payouts.
229 <fieldset class="rows">
232 <span id="paid" class="label">Outstanding credit: </span><span>[% payout.amount | $Price %]</span>
235 <label class="required" for="amount">Returned to patron: </label>
236 <input type="text" inputmode="numeric" pattern="[0-9]*" id="amount" name="amount" required="required">
237 <span class="required">Required</span>
240 [% INCLUDE 'transaction_types.inc' type="payout" %]
242 [% IF Koha.Preference('UseCashRegisters') %]
244 <label for="registerid">Cash register: </label>
245 <select name="registerid" id="payout_registerid">
246 <option id="noregister" disabled selected="selected" value="">-- Select an option--</option>
247 [% PROCESS options_for_registers %]
253 </fieldset> <!-- /.rows -->
254 </div> <!-- /.modal-body -->
255 <div class="modal-footer">
256 <input type="hidden" name="op" value="payout">
257 <button type="submit" class="btn btn-default" id="borr_payout_confirm">Confirm</button>
258 <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
259 </div> <!-- /.modal-footer -->
260 </div> <!-- /.modal-content -->
261 </div> <!-- /.modal-dialog -->
262 </form> <!-- /#payout_form -->
263 </div> <!-- /#issuePayoutModal -->
265 <!-- Issue refund modal -->
266 <div class="modal" id="issueRefundModal" tabindex="-1" role="dialog" aria-labelledby="issueRefundLabel">
267 <form id="refund_form" action="/cgi-bin/koha/members/boraccount.pl" method="get" enctype="multipart/form-data" class="validated">
268 [% INCLUDE 'csrf-token.inc' %]
269 <input type="hidden" name="accountlines_id" value="" id="refundline">
270 <input type="hidden" name="action" value="refund">
271 <input type="hidden" name="borrowernumber" value="[% account.borrowernumber | html %]">
272 <div class="modal-dialog" role="document">
273 <div class="modal-content">
274 <div class="modal-header">
275 <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
276 <h4 class="modal-title" id="issueRefundLabel">Issue refund</h4>
278 <div class="modal-body">
279 [% IF Koha.Preference('UseCashRegisters') && ( registers.size == 0 ) %]
280 <div id="refund_error" class="dialog alert">
281 You must have at least one cash register associated with this branch before you can record cash refunds.
284 <fieldset class="rows">
287 <span id="item" class="label">Account: </span><span></span>
290 <span id="paid" class="label">Amount paid: </span><span></span>
293 <label class="required" for="amount">Returned to patron: </label>
294 <input type="text" inputmode="numeric" pattern="[0-9]*" id="returned" name="amount" required="required">
295 <span class="required">Required</span>
298 [% INCLUDE 'transaction_types.inc' type="refund" %]
300 [% IF Koha.Preference('UseCashRegisters') %]
302 <label for="registerid">Cash register: </label>
303 <select name="registerid" id="refund_registerid">
304 <option id="noregister" disabled selected="selected" value="">-- Select an option--</option>
305 [% PROCESS options_for_registers %]
311 </fieldset> <!-- /.rows -->
312 </div> <!-- /.modal-body -->
313 <div class="modal-footer">
314 <input type="hidden" name="op" value="refund">
315 <button type="submit" class="btn btn-default" id="borr_refund_confirm">Confirm</button>
316 <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
317 </div> <!-- /.modal-footer -->
318 </div> <!-- /.modal-content -->
319 </div> <!-- /.modal-dialog -->
320 </form> <!-- /#refund_form -->
321 </div> <!-- /#issueRefundModal -->
323 <!-- Apply discount modal -->
324 <div class="modal" id="applyDiscountModal" tabindex="-1" role="dialog" aria-labelledby="applyDiscountLabel">
325 <form id="discount_form" action="/cgi-bin/koha/members/boraccount.pl" method="get" enctype="multipart/form-data" class="validated">
326 [% INCLUDE 'csrf-token.inc' %]
327 <input type="hidden" name="accountlines_id" value="" id="discountline">
328 <input type="hidden" name="action" value="discount">
329 <input type="hidden" name="borrowernumber" value="[% account.borrowernumber | html %]">
330 <div class="modal-dialog" role="document">
331 <div class="modal-content">
332 <div class="modal-header">
333 <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
334 <h4 class="modal-title" id="applyDiscountLabel">Apply discount</h4>
336 <div class="modal-body">
337 <fieldset class="rows">
340 <span id="item" class="label">Account type: </span><span></span>
343 <span id="charged" class="label">Amount charged: </span><span></span>
346 <label class="required" for="amount">Discount to apply: </label>
347 <input type="text" inputmode="numeric" pattern="[0-9]*" id="discount" name="amount" required="required">
348 <span class="required">Required</span>
351 </fieldset> <!-- /.rows -->
352 </div> <!-- /.modal-body -->
353 <div class="modal-footer">
354 <input type="hidden" name="op" value="discount">
355 <button type="submit" class="btn btn-default">Confirm</button>
356 <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
357 </div> <!-- /.modal-footer -->
358 </div> <!-- /.modal-content -->
359 </div> <!-- /.modal-dialog -->
360 </form> <!-- /#discount_form -->
361 </div> <!-- /#applyDiscountModal -->
363 [% MACRO jsinclude BLOCK %]
364 [% INCLUDE 'datatables.inc' %]
365 [% INCLUDE 'format_price.inc' %]
366 [% INCLUDE 'columns_settings.inc' %]
367 [% INCLUDE 'str/members-menu.inc' %]
368 [% Asset.js("js/members-menu.js") | $raw %]
370 $(document).ready(function() {
371 [% IF payment_id && Koha.Preference('FinePaymentAutoPopup') %]
372 window.open('/cgi-bin/koha/members/printfeercpt.pl?action=print&change_given=[% change_given | html %]&accountlines_id=[% payment_id | html %]', '_blank');
375 var txtActivefilter = _("Filter paid transactions");
376 var txtInactivefilter = _("Show all transactions");
377 var table_settings = [% TablesSettings.GetTableSettings('members', 'fines', 'account-fines', 'json') | $raw %];
378 var table_account_fines = KohaTable("table_account_fines", {
379 "sPaginationType": "full",
380 'aaSorting': [[0, 'desc']],
381 "sDom": 'C<"top pager"ilpfB><"#filter_c">tr<"bottom pager"ip>',
383 $("#filter_c").html('<p><a href="#" id="filter_transacs"><i class="fa fa-filter"></i> '+txtActivefilter+'</a>');
384 $('#filter_transacs').click(function(e) {
386 if ($(this).hasClass('filtered')) {
387 var filteredValue = '';
388 $(this).html('<i class="fa fa-filter"></i> '+txtActivefilter);
389 } else { //Not filtered. Let's do it!
390 var filteredValue = '^((?!0.00).*)$'; //Filter not matching 0.00 http://stackoverflow.com/a/406408
391 $(this).html('<i class="fa fa-filter"></i> '+txtInactivefilter);
393 table_account_fines.DataTable().columns( 13 ).search( filteredValue, true, false ).draw();
394 $(this).toggleClass('filtered');
397 $(".void-action").on("click",function(e){
398 if( confirm( _("Are you sure you want to void this credit?") ) ) {
405 $("#issuePayoutModal").on("shown.bs.modal", function(e){
406 var button = $(e.relatedTarget);
407 var accountline = button.data('accountline');
408 $('#payoutline').val(accountline);
409 var amount = button.data('amount') * -1;
410 $("#paid + span").replaceWith(amount.format_price());
411 $("#amount").attr({ "value": amount, "max": amount, "min": 0 });
412 $("#amount, #payout_transaction_type").focus();
415 $("#issueRefundModal").on("shown.bs.modal", function(e){
416 var button = $(e.relatedTarget);
417 var item = button.data('item');
418 $("#item + span").replaceWith(item);
419 var accountline = button.data('accountline');
420 $('#refundline').val(accountline);
421 var amount = button.data('amount');
422 var amountoutstanding = button.data('amountoutstanding') || 0;
423 var paid = amount - amountoutstanding;
424 $("#paid + span").replaceWith(paid.format_price());
425 $("#returned").attr({ "value": paid, "max": paid, "min": 0 });
426 var member = button.data('member');
427 if ( member === '' ) {
428 $("#refund_type option[value='AC']").remove();
429 } else if ( $("#refund_type option[value='AC']").length == 0 ) {
430 $("#refund_type").prepend('<option value="AC" selected="selected">Account credit</option>');
432 $("#returned, #refund_type").focus();
435 $("#applyDiscountModal").on("shown.bs.modal", function(e){
436 var button = $(e.relatedTarget);
437 var item = button.data('item');
438 $("#item + span").replaceWith(item);
439 var accountline = button.data('accountline');
440 $('#discountline').val(accountline);
441 var amount = button.data('amount');
442 $("#charged + span").replaceWith(amount.format_price());
443 $("#discount").attr({ "max": amount, "min": 0 });
444 $("#discount").focus();
450 [% INCLUDE 'intranet-bottom.inc' %]