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 [% INCLUDE 'members-toolbar.inc' %]
46 <h1>Account for [% INCLUDE 'patron-title.inc' %]</h1>
47 <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>
49 <!-- The manual invoice and credit buttons -->
51 <ul class="nav nav-tabs" role="tablist">
52 <li role="presentation" class="transactions active">
53 <a href="/cgi-bin/koha/members/boraccount.pl?borrowernumber=[% patron.borrowernumber | uri %]" role="tab">Transactions</a>
55 <li role="presentation" class="makepayment">
56 <a href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% patron.borrowernumber | uri %]" role="tab">Make a payment</a>
58 [% IF CAN_user_updatecharges_manual_invoice %]
59 <li role="presentation" class="manualinvoice">
60 <a href="/cgi-bin/koha/members/maninvoice.pl?borrowernumber=[% patron.borrowernumber | uri %]" role="tab">Create manual invoice</a>
63 [% IF CAN_user_updatecharges_manual_credit %]
64 <li role="presentation" class="manualcredit">
65 <a href="/cgi-bin/koha/members/mancredit.pl?borrowernumber=[% patron.borrowernumber | uri %]" role="tab">Create manual credit</a>
68 </ul> <!-- /.nav.nav-tabs -->
69 <div class="tab-content">
70 <div role="tabpanel" class="tab-pane active">
71 [% INCLUDE 'renew_results.inc' renew_results=renew_results %]
72 <!-- The table with the account items -->
73 <table id="table_account_fines">
78 <th>Credit number</th>
80 <th>Description of charges</th>
84 <th>Checkout date</th>
85 <th class="checked_out_from">Checked out from</th>
90 <th class="NoSort noExport">Actions</th>
94 <!-- FIXME: Shouldn't hardcode dollar signs, since Euro or Pound might be needed -->
95 [% FOREACH account IN accounts %]
98 <td data-order="[% account.date | html %]">[% account.date | $KohaDates %]</td>
99 <td data-order="[% account.timestamp | html %]">[% account.timestamp | $KohaDates with_hours = 1 %]</td>
100 <td>[% account.credit_number | html %]</td>
101 <td>[% PROCESS account_type_description account=account %]</td>
103 [%- IF account.payment_type %][% AuthorisedValues.GetByCode('PAYMENT_TYPE', account.payment_type) | html %][% END %]
104 [%- IF account.description %][% account.description | html %][% END %]
105 [% 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>
106 <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>
107 <td>[% IF ( account.issue_id ) %][% account.checkout.date_due | $KohaDates as_due_date => 1 %][% END %]</td>
108 <td>[% IF ( account.issue_id ) %][% account.checkout.returndate | $KohaDates with_hours => 1 %][% END %]</td>
109 <td>[% IF ( account.issue_id ) %][% account.checkout.issuedate | $KohaDates %][% END %]</td>
110 <td class="checked_out_from">
111 [% IF account.issue_id && account.checkout.library %]
112 [% account.checkout.library.branchname | html %]
115 <td>[% IF account.itemnumber %][% Branches.GetName( account.item.homebranch ) | html %][% END %]</td>
116 <td>[% account.note | html_line_break %]</td>
117 [% IF account.amount <= 0 %]<td class="credit" style="text-align: right;">[% ELSE %]<td class="debit" style="text-align: right;">[% END %][% account.amount | $Price %]</td>
118 [% IF account.amountoutstanding <= 0 %]<td class="credit" style="text-align: right;">[% ELSE %]<td class="debit" style="text-align: right;">[% END %][% account.amountoutstanding | $Price %]</td>
120 [% IF ( account.is_credit ) %]
121 <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>
123 <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>
125 <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>
126 [% IF account.is_debit && account.amountoutstanding > 0 %]
127 <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 fa-money"></i> Pay</a>
129 [% IF account.is_credit && account.status != 'VOID' %]
130 <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>
132 [% IF account.is_debit && account.amount == account.amountoutstanding && account.status != 'CANCELLED' && !(account.debit_type_code == 'PAYOUT') %]
133 <form method="post" action="/cgi-bin/koha/members/cancel-charge.pl">
134 [% INCLUDE 'csrf-token.inc' %]
135 <input type="hidden" name="borrowernumber" value="[% patron.borrowernumber | html %]">
136 <input type="hidden" name="accountlines_id" value="[% account.accountlines_id | html %]">
137 <button type="submit" class="btn btn-default btn-xs cancel-action">
138 <i class="fa fa-ban"></i>
143 [% IF CAN_user_updatecharges_payout && account.is_credit && ( account.amountoutstanding < 0 ) %]
144 <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 fa-money"></i> Issue payout</button>
146 [% IF CAN_user_updatecharges_refund && account.is_debit && ( account.amountoutstanding != account.amount ) && !(account.status == 'REFUNDED') && !(account.debit_type_code == 'PAYOUT') %]
147 <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 fa-money"></i> Issue refund</button>
149 [% IF CAN_user_updatecharges_discount && account.is_debit && ( account.amountoutstanding == account.amount ) && !(account.debit_type_code == 'PAYOUT') && !(account.debit_type_code == 'VOID') %]
150 <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>
158 <td colspan="13">Total due</td>
159 [% IF ( totalcredit ) %]
160 <td class="credit" style="text-align: right;">[% total | $Price %]</td>
162 [% IF CAN_user_updatecharges_payout %]
163 <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 fa-money"></i> Payout amount</button>
167 <td class="debit"style="text-align: right;">[% total | $Price %]</td>
173 </div> <!-- /.tab-pane -->
174 </div> <!-- /.tab-content -->
175 </div> <!-- /.toptabs -->
178 </div> <!-- /.col-sm-10.col-sm-push-2 -->
180 <div class="col-sm-2 col-sm-pull-10">
182 [% INCLUDE 'circ-menu.inc' %]
184 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
185 </div> <!-- /.row -->
187 <!-- Issue payout modal -->
188 <div class="modal" id="issuePayoutModal" tabindex="-1" role="dialog" aria-labelledby="issuePayoutLabel">
189 <form id="payout_form" action="/cgi-bin/koha/members/boraccount.pl" method="get" enctype="multipart/form-data" class="validated">
190 [% INCLUDE 'csrf-token.inc' %]
191 <input type="hidden" name="accountlines_id" value="" id="payoutline">
192 <input type="hidden" name="action" value="payout">
193 <input type="hidden" name="borrowernumber" value="[% account.borrowernumber | html %]">
194 <div class="modal-dialog" role="document">
195 <div class="modal-content">
196 <div class="modal-header">
197 <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
198 <h4 class="modal-title" id="issuePayoutLabel">Issue payout</h4>
200 <div class="modal-body">
201 [% IF Koha.Preference('UseCashRegisters') && ( registers.size == 0 ) %]
202 <div id="payout_error" class="dialog alert">
203 You must have at least one cash register associated with this branch before you can record cash payouts.
206 <fieldset class="rows">
209 <span id="paid" class="label">Outstanding credit: </span><span>[% payout.amount | $Price %]</span>
212 <label class="required" for="amount">Returned to patron: </label>
213 <input type="text" inputmode="numeric" pattern="[0-9]*" id="amount" name="amount" required="required">
214 <span class="required">Required</span>
217 [% INCLUDE 'transaction_types.inc' type="payout" %]
219 [% IF Koha.Preference('UseCashRegisters') %]
221 <label for="registerid">Cash register: </label>
222 <select name="registerid" id="payout_registerid">
223 <option id="noregister" disabled selected="selected" value="">-- Select an option--</option>
224 [% PROCESS options_for_registers %]
230 </fieldset> <!-- /.rows -->
231 </div> <!-- /.modal-body -->
232 <div class="modal-footer">
233 <input type="hidden" name="op" value="payout">
234 <button type="submit" class="btn btn-default" id="borr_payout_confirm">Confirm</button>
235 <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
236 </div> <!-- /.modal-footer -->
237 </div> <!-- /.modal-content -->
238 </div> <!-- /.modal-dialog -->
239 </form> <!-- /#payout_form -->
240 </div> <!-- /#issuePayoutModal -->
242 <!-- Issue refund modal -->
243 <div class="modal" id="issueRefundModal" tabindex="-1" role="dialog" aria-labelledby="issueRefundLabel">
244 <form id="refund_form" action="/cgi-bin/koha/members/boraccount.pl" method="get" enctype="multipart/form-data" class="validated">
245 [% INCLUDE 'csrf-token.inc' %]
246 <input type="hidden" name="accountlines_id" value="" id="refundline">
247 <input type="hidden" name="action" value="refund">
248 <input type="hidden" name="borrowernumber" value="[% account.borrowernumber | html %]">
249 <div class="modal-dialog" role="document">
250 <div class="modal-content">
251 <div class="modal-header">
252 <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
253 <h4 class="modal-title" id="issueRefundLabel">Issue refund</h4>
255 <div class="modal-body">
256 [% IF Koha.Preference('UseCashRegisters') && ( registers.size == 0 ) %]
257 <div id="refund_error" class="dialog alert">
258 You must have at least one cash register associated with this branch before you can record cash refunds.
261 <fieldset class="rows">
264 <span id="item" class="label">Account: </span><span></span>
267 <span id="paid" class="label">Amount paid: </span><span></span>
270 <label class="required" for="amount">Returned to patron: </label>
271 <input type="text" inputmode="numeric" pattern="[0-9]*" id="returned" name="amount" required="required">
272 <span class="required">Required</span>
275 [% INCLUDE 'transaction_types.inc' type="refund" %]
277 [% IF Koha.Preference('UseCashRegisters') %]
279 <label for="registerid">Cash register: </label>
280 <select name="registerid" id="refund_registerid">
281 <option id="noregister" disabled selected="selected" value="">-- Select an option--</option>
282 [% PROCESS options_for_registers %]
288 </fieldset> <!-- /.rows -->
289 </div> <!-- /.modal-body -->
290 <div class="modal-footer">
291 <input type="hidden" name="op" value="refund">
292 <button type="submit" class="btn btn-default" id="borr_refund_confirm">Confirm</button>
293 <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
294 </div> <!-- /.modal-footer -->
295 </div> <!-- /.modal-content -->
296 </div> <!-- /.modal-dialog -->
297 </form> <!-- /#refund_form -->
298 </div> <!-- /#issueRefundModal -->
300 <!-- Apply discount modal -->
301 <div class="modal" id="applyDiscountModal" tabindex="-1" role="dialog" aria-labelledby="applyDiscountLabel">
302 <form id="discount_form" action="/cgi-bin/koha/members/boraccount.pl" method="get" enctype="multipart/form-data" class="validated">
303 [% INCLUDE 'csrf-token.inc' %]
304 <input type="hidden" name="accountlines_id" value="" id="discountline">
305 <input type="hidden" name="action" value="discount">
306 <input type="hidden" name="borrowernumber" value="[% account.borrowernumber | html %]">
307 <div class="modal-dialog" role="document">
308 <div class="modal-content">
309 <div class="modal-header">
310 <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
311 <h4 class="modal-title" id="applyDiscountLabel">Apply discount</h4>
313 <div class="modal-body">
314 <fieldset class="rows">
317 <span id="item" class="label">Account type: </span><span></span>
320 <span id="charged" class="label">Amount charged: </span><span></span>
323 <label class="required" for="amount">Discount to apply: </label>
324 <input type="text" inputmode="numeric" pattern="[0-9]*" id="discount" name="amount" required="required">
325 <span class="required">Required</span>
328 </fieldset> <!-- /.rows -->
329 </div> <!-- /.modal-body -->
330 <div class="modal-footer">
331 <input type="hidden" name="op" value="discount">
332 <button type="submit" class="btn btn-default">Confirm</button>
333 <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
334 </div> <!-- /.modal-footer -->
335 </div> <!-- /.modal-content -->
336 </div> <!-- /.modal-dialog -->
337 </form> <!-- /#discount_form -->
338 </div> <!-- /#applyDiscountModal -->
340 [% MACRO jsinclude BLOCK %]
341 [% INCLUDE 'datatables.inc' %]
342 [% INCLUDE 'format_price.inc' %]
343 [% INCLUDE 'columns_settings.inc' %]
344 [% INCLUDE 'str/members-menu.inc' %]
345 [% Asset.js("js/members-menu.js") | $raw %]
347 $(document).ready(function() {
348 [% IF payment_id && Koha.Preference('FinePaymentAutoPopup') %]
349 window.open('/cgi-bin/koha/members/printfeercpt.pl?action=print&change_given=[% change_given | html %]&accountlines_id=[% payment_id | html %]', '_blank');
352 var txtActivefilter = _("Filter paid transactions");
353 var txtInactivefilter = _("Show all transactions");
354 var table_settings = [% TablesSettings.GetTableSettings('members', 'fines', 'account-fines', 'json') | $raw %];
355 var table_account_fines = KohaTable("table_account_fines", {
356 "sPaginationType": "full",
357 'aaSorting': [[0, 'desc']],
358 "sDom": 'C<"top pager"ilpfB><"#filter_c">tr<"bottom pager"ip>',
360 $("#filter_c").html('<p><a href="#" id="filter_transacs"><i class="fa fa-filter"></i> '+txtActivefilter+'</a>');
361 $('#filter_transacs').click(function(e) {
363 if ($(this).hasClass('filtered')) {
364 var filteredValue = '';
365 $(this).html('<i class="fa fa-filter"></i> '+txtActivefilter);
366 } else { //Not filtered. Let's do it!
367 var filteredValue = '^((?!0.00).*)$'; //Filter not matching 0.00 http://stackoverflow.com/a/406408
368 $(this).html('<i class="fa fa-filter"></i> '+txtInactivefilter);
370 table_account_fines.DataTable().columns( 14 ).search( filteredValue, true, false ).draw();
371 $(this).toggleClass('filtered');
374 $(".void-action").on("click",function(e){
375 if( confirm( _("Are you sure you want to void this credit?") ) ) {
382 $("#issuePayoutModal").on("shown.bs.modal", function(e){
383 var button = $(e.relatedTarget);
384 var accountline = button.data('accountline');
385 $('#payoutline').val(accountline);
386 var amount = button.data('amount') * -1;
387 $("#paid + span").replaceWith(amount.format_price());
388 $("#amount").attr({ "value": amount, "max": amount, "min": 0 });
389 $("#amount, #payout_transaction_type").focus();
392 $("#issueRefundModal").on("shown.bs.modal", function(e){
393 var button = $(e.relatedTarget);
394 var item = button.data('item');
395 $("#item + span").replaceWith(item);
396 var accountline = button.data('accountline');
397 $('#refundline').val(accountline);
398 var amount = button.data('amount');
399 var amountoutstanding = button.data('amountoutstanding') || 0;
400 var paid = amount - amountoutstanding;
401 $("#paid + span").replaceWith(paid.format_price());
402 $("#returned").attr({ "value": paid, "max": paid, "min": 0 });
403 var member = button.data('member');
404 if ( member === '' ) {
405 $("#refund_type option[value='AC']").remove();
406 } else if ( $("#refund_type option[value='AC']").length == 0 ) {
407 $("#refund_type").prepend('<option value="AC" selected="selected">Account credit</option>');
409 $("#returned, #refund_type").focus();
412 $("#applyDiscountModal").on("shown.bs.modal", function(e){
413 var button = $(e.relatedTarget);
414 var item = button.data('item');
415 $("#item + span").replaceWith(item);
416 var accountline = button.data('accountline');
417 $('#discountline').val(accountline);
418 var amount = button.data('amount');
419 $("#charged + span").replaceWith(amount.format_price());
420 $("#discount").attr({ "max": amount, "min": 0 });
421 $("#discount").focus();
427 [% INCLUDE 'intranet-bottom.inc' %]