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 <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
30 <a href="/cgi-bin/koha/mainpage.pl"><i class="fa fa-home"></i></a>
33 <a href="/cgi-bin/koha/members/members-home.pl">Patrons</a>
36 <a href="#" aria-current="page">
37 Account for [% INCLUDE 'patron-title.inc' %]
44 <div class="main container-fluid">
46 <div class="col-sm-10 col-sm-push-2">
49 [% INCLUDE 'members-toolbar.inc' %]
50 <h1>Account for [% INCLUDE 'patron-title.inc' %]</h1>
51 <form action="/cgi-bin/koha/members/boraccount.pl" method="get"><input type="hidden" name="borrowernumber" id="borrowernumber" value="[% patron.borrowernumber | html %]" /></form>
53 <!-- The manual invoice and credit buttons -->
54 <div class="statictabs">
56 <li class="active transactions"><a href="/cgi-bin/koha/members/boraccount.pl?borrowernumber=[% patron.borrowernumber | uri %]">Transactions</a></li>
57 <li class="makepayment"><a href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% patron.borrowernumber | uri %]" >Make a payment</a></li>
58 [% IF CAN_user_updatecharges_manual_invoice %]
59 <li class="manualinvoice"><a href="/cgi-bin/koha/members/maninvoice.pl?borrowernumber=[% patron.borrowernumber | uri %]" >Create manual invoice</a></li>
61 [% IF CAN_user_updatecharges_manual_credit %]
62 <li class="manualcredit"><a href="/cgi-bin/koha/members/mancredit.pl?borrowernumber=[% patron.borrowernumber | uri %]" >Create manual credit</a></li>
65 <div class="tabs-container">
66 [% INCLUDE 'renew_results.inc' renew_results=renew_results %]
67 <!-- The table with the account items -->
68 <table id="table_account_fines">
73 <th>Credit number</th>
75 <th>Description of charges</th>
79 <th>Checkout date</th>
80 <th class="checked_out_from">Checked out from</th>
85 <th class="NoSort noExport">Actions</th>
89 <!-- FIXME: Shouldn't hardcode dollar signs, since Euro or Pound might be needed -->
90 [% FOREACH account IN accounts %]
93 <td data-order="[% account.date | html %]">[% account.date | $KohaDates %]</td>
94 <td data-order="[% account.timestamp | html %]">[% account.timestamp | $KohaDates with_hours = 1 %]</td>
95 <td>[% account.credit_number | html %]</td>
96 <td>[% PROCESS account_type_description account=account %]</td>
98 [%- IF account.payment_type %][% AuthorisedValues.GetByCode('PAYMENT_TYPE', account.payment_type) | html %][% END %]
99 [%- IF account.description %][% account.description | html %][% END %]
100 [% 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>
101 <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>
102 <td>[% IF ( account.issue_id ) %][% account.checkout.date_due | $KohaDates as_due_date => 1 %][% END %]</td>
103 <td>[% IF ( account.issue_id ) %][% account.checkout.returndate | $KohaDates with_hours => 1 %][% END %]</td>
104 <td>[% IF ( account.issue_id ) %][% account.checkout.issuedate | $KohaDates %][% END %]</td>
105 <td class="checked_out_from">
106 [% IF account.issue_id && account.checkout.library %]
107 [% account.checkout.library.branchname | html %]
110 <td>[% IF account.itemnumber %][% Branches.GetName( account.item.homebranch ) | html %][% END %]</td>
111 <td>[% account.note | html_line_break %]</td>
112 [% IF account.amount <= 0 %]<td class="credit" style="text-align: right;">[% ELSE %]<td class="debit" style="text-align: right;">[% END %][% account.amount | $Price %]</td>
113 [% IF account.amountoutstanding <= 0 %]<td class="credit" style="text-align: right;">[% ELSE %]<td class="debit" style="text-align: right;">[% END %][% account.amountoutstanding | $Price %]</td>
115 [% IF ( account.is_credit ) %]
116 <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>
118 <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>
120 <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>
121 [% IF account.is_debit && account.amountoutstanding > 0 %]
122 <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 %]"><i class="fa fa-money"></i> Pay</a>
124 [% IF account.is_credit && account.status != 'VOID' %]
125 <a href="boraccount.pl?action=void&accountlines_id=[% account.accountlines_id | uri %]&borrowernumber=[% account.borrowernumber | uri %]" class="btn btn-default btn-xs void-action"><i class="fa fa-ban"></i> Void payment</a>
127 [% IF account.is_debit && account.amount == account.amountoutstanding && account.status != 'CANCELLED' && !(account.debit_type_code == 'PAYOUT') %]
128 <form method="post" action="/cgi-bin/koha/members/cancel-charge.pl">
129 <input type="hidden" name="csrf_token" value="[% csrf_token | html %]">
130 <input type="hidden" name="borrowernumber" value="[% patron.borrowernumber | html %]">
131 <input type="hidden" name="accountlines_id" value="[% account.accountlines_id | html %]">
132 <button type="submit" class="btn btn-default btn-xs cancel-action">
133 <i class="fa fa-ban"></i>
138 [% IF CAN_user_updatecharges_payout && account.is_credit && ( account.amountoutstanding < 0 ) %]
139 <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>
141 [% IF CAN_user_updatecharges_refund && account.is_debit && ( account.amountoutstanding != account.amount ) && !(account.status == 'REFUNDED') && !(account.debit_type_code == 'PAYOUT') %]
142 <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>
144 [% IF CAN_user_updatecharges_discount && account.is_debit && ( account.amountoutstanding == account.amount ) && !(account.debit_type_code == 'PAYOUT') && !(account.debit_type_code == 'VOID') %]
145 <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>
153 <td colspan="13">Total due</td>
154 [% IF ( totalcredit ) %]
155 <td class="credit" style="text-align: right;">[% total | $Price %]</td>
157 [% IF CAN_user_updatecharges_payout %]
158 <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>
162 <td class="debit"style="text-align: right;">[% total | $Price %]</td>
172 </div> <!-- /.col-sm-10.col-sm-push-2 -->
174 <div class="col-sm-2 col-sm-pull-10">
176 [% INCLUDE 'circ-menu.inc' %]
178 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
179 </div> <!-- /.row -->
181 <!-- Issue payout modal -->
182 <div class="modal" id="issuePayoutModal" tabindex="-1" role="dialog" aria-labelledby="issuePayoutLabel">
183 <form id="payout_form" action="/cgi-bin/koha/members/boraccount.pl" method="get" enctype="multipart/form-data" class="validated">
184 <input type="hidden" name="accountlines_id" value="" id="payoutline">
185 <input type="hidden" name="action" value="payout">
186 <input type="hidden" name="borrowernumber" value="[% account.borrowernumber | html %]">
187 <div class="modal-dialog" role="document">
188 <div class="modal-content">
189 <div class="modal-header">
190 <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
191 <h4 class="modal-title" id="issuePayoutLabel">Issue payout</h4>
193 <div class="modal-body">
194 [% IF Koha.Preference('UseCashRegisters') && ( registers.size == 0 ) %]
195 <div id="payout_error" class="dialog alert">
196 You must have at least one cash register associated with this branch before you can record cash payouts.
199 <fieldset class="rows">
202 <span id="paid" class="label">Outstanding credit: </span><span>[% payout.amount | $Price %]</span>
205 <label class="required" for="amount">Returned to patron: </label>
206 <input type="text" inputmode="numeric" pattern="[0-9]*" id="amount" name="amount" required="required">
207 <span class="required">Required</span>
210 [% INCLUDE 'transaction_types.inc' type="payout" %]
212 [% IF Koha.Preference('UseCashRegisters') %]
214 <label for="registerid">Cash register: </label>
215 <select name="registerid" id="payout_registerid">
216 <option id="noregister" disabled selected="selected" value="">-- Select an option--</option>
217 [% PROCESS options_for_registers %]
223 </fieldset> <!-- /.rows -->
224 </div> <!-- /.modal-body -->
225 <div class="modal-footer">
226 <input type="hidden" name="op" value="payout">
227 <button type="submit" class="btn btn-default" id="borr_payout_confirm">Confirm</button>
228 <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
229 </div> <!-- /.modal-footer -->
230 </div> <!-- /.modal-content -->
231 </div> <!-- /.modal-dialog -->
232 </form> <!-- /#payout_form -->
233 </div> <!-- /#issuePayoutModal -->
235 <!-- Issue refund modal -->
236 <div class="modal" id="issueRefundModal" tabindex="-1" role="dialog" aria-labelledby="issueRefundLabel">
237 <form id="refund_form" action="/cgi-bin/koha/members/boraccount.pl" method="get" enctype="multipart/form-data" class="validated">
238 <input type="hidden" name="accountlines_id" value="" id="refundline">
239 <input type="hidden" name="action" value="refund">
240 <input type="hidden" name="borrowernumber" value="[% account.borrowernumber | html %]">
241 <div class="modal-dialog" role="document">
242 <div class="modal-content">
243 <div class="modal-header">
244 <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
245 <h4 class="modal-title" id="issueRefundLabel">Issue refund</h4>
247 <div class="modal-body">
248 [% IF Koha.Preference('UseCashRegisters') && ( registers.size == 0 ) %]
249 <div id="refund_error" class="dialog alert">
250 You must have at least one cash register associated with this branch before you can record cash refunds.
253 <fieldset class="rows">
256 <span id="item" class="label">Account: </span><span></span>
259 <span id="paid" class="label">Amount paid: </span><span></span>
262 <label class="required" for="amount">Returned to patron: </label>
263 <input type="text" inputmode="numeric" pattern="[0-9]*" id="returned" name="amount" required="required">
264 <span class="required">Required</span>
267 [% INCLUDE 'transaction_types.inc' type="refund" %]
269 [% IF Koha.Preference('UseCashRegisters') %]
271 <label for="registerid">Cash register: </label>
272 <select name="registerid" id="refund_registerid">
273 <option id="noregister" disabled selected="selected" value="">-- Select an option--</option>
274 [% PROCESS options_for_registers %]
280 </fieldset> <!-- /.rows -->
281 </div> <!-- /.modal-body -->
282 <div class="modal-footer">
283 <input type="hidden" name="op" value="refund">
284 <button type="submit" class="btn btn-default" id="borr_refund_confirm">Confirm</button>
285 <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
286 </div> <!-- /.modal-footer -->
287 </div> <!-- /.modal-content -->
288 </div> <!-- /.modal-dialog -->
289 </form> <!-- /#refund_form -->
290 </div> <!-- /#issueRefundModal -->
292 <!-- Apply discount modal -->
293 <div class="modal" id="applyDiscountModal" tabindex="-1" role="dialog" aria-labelledby="applyDiscountLabel">
294 <form id="discount_form" action="/cgi-bin/koha/members/boraccount.pl" method="get" enctype="multipart/form-data" class="validated">
295 <input type="hidden" name="accountlines_id" value="" id="discountline">
296 <input type="hidden" name="action" value="discount">
297 <input type="hidden" name="borrowernumber" value="[% account.borrowernumber | html %]">
298 <div class="modal-dialog" role="document">
299 <div class="modal-content">
300 <div class="modal-header">
301 <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
302 <h4 class="modal-title" id="applyDiscountLabel">Apply discount</h4>
304 <div class="modal-body">
305 <fieldset class="rows">
308 <span id="item" class="label">Account type: </span><span></span>
311 <span id="charged" class="label">Amount charged: </span><span></span>
314 <label class="required" for="amount">Discount to apply: </label>
315 <input type="text" inputmode="numeric" pattern="[0-9]*" id="discount" name="amount" required="required">
316 <span class="required">Required</span>
319 </fieldset> <!-- /.rows -->
320 </div> <!-- /.modal-body -->
321 <div class="modal-footer">
322 <input type="hidden" name="op" value="discount">
323 <button type="submit" class="btn btn-default">Confirm</button>
324 <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
325 </div> <!-- /.modal-footer -->
326 </div> <!-- /.modal-content -->
327 </div> <!-- /.modal-dialog -->
328 </form> <!-- /#discount_form -->
329 </div> <!-- /#applyDiscountModal -->
331 [% MACRO jsinclude BLOCK %]
332 [% INCLUDE 'datatables.inc' %]
333 [% INCLUDE 'format_price.inc' %]
334 [% INCLUDE 'columns_settings.inc' %]
335 [% INCLUDE 'str/members-menu.inc' %]
336 [% Asset.js("js/members-menu.js") | $raw %]
338 $(document).ready(function() {
339 [% IF payment_id && Koha.Preference('FinePaymentAutoPopup') %]
340 window.open('/cgi-bin/koha/members/printfeercpt.pl?action=print&change_given=[% change_given | html %]&accountlines_id=[% payment_id | html %]', '_blank');
343 var txtActivefilter = _("Filter paid transactions");
344 var txtInactivefilter = _("Show all transactions");
345 var table_settings = [% TablesSettings.GetTableSettings('members', 'fines', 'account-fines', 'json') | $raw %];
346 var table_account_fines = KohaTable("table_account_fines", {
347 "sPaginationType": "full",
348 'aaSorting': [[0, 'desc']],
349 "sDom": 'C<"top pager"ilpfB><"#filter_c">tr<"bottom pager"ip>',
351 $("#filter_c").html('<p><a href="#" id="filter_transacs"><i class="fa fa-filter"></i> '+txtActivefilter+'</a>');
352 $('#filter_transacs').click(function(e) {
354 if ($(this).hasClass('filtered')) {
355 var filteredValue = '';
356 $(this).html('<i class="fa fa-filter"></i> '+txtActivefilter);
357 } else { //Not filtered. Let's do it!
358 var filteredValue = '^((?!0.00).*)$'; //Filter not matching 0.00 http://stackoverflow.com/a/406408
359 $(this).html('<i class="fa fa-filter"></i> '+txtInactivefilter);
361 table_account_fines.DataTable().columns( 13 ).search( filteredValue, true, false ).draw();
362 $(this).toggleClass('filtered');
365 $(".void-action").on("click",function(e){
366 if( confirm( _("Are you sure you want to void this credit?") ) ) {
373 $("#issuePayoutModal").on("shown.bs.modal", function(e){
374 var button = $(e.relatedTarget);
375 var accountline = button.data('accountline');
376 $('#payoutline').val(accountline);
377 var amount = button.data('amount') * -1;
378 $("#paid + span").replaceWith(amount.format_price());
379 $("#amount").attr({ "value": amount, "max": amount, "min": 0 });
380 $("#amount, #payout_transaction_type").focus();
383 $("#issueRefundModal").on("shown.bs.modal", function(e){
384 var button = $(e.relatedTarget);
385 var item = button.data('item');
386 $("#item + span").replaceWith(item);
387 var accountline = button.data('accountline');
388 $('#refundline').val(accountline);
389 var amount = button.data('amount');
390 var amountoutstanding = button.data('amountoutstanding') || 0;
391 var paid = amount - amountoutstanding;
392 $("#paid + span").replaceWith(paid.format_price());
393 $("#returned").attr({ "value": paid, "max": paid, "min": 0 });
394 var member = button.data('member');
395 if ( member === '' ) {
396 $("#refund_type option[value='AC']").remove();
397 } else if ( $("#refund_type option[value='AC']").length == 0 ) {
398 $("#refund_type").prepend('<option value="AC" selected="selected">Account credit</option>');
400 $("#returned, #refund_type").focus();
403 $("#applyDiscountModal").on("shown.bs.modal", function(e){
404 var button = $(e.relatedTarget);
405 var item = button.data('item');
406 $("#item + span").replaceWith(item);
407 var accountline = button.data('accountline');
408 $('#discountline').val(accountline);
409 var amount = button.data('amount');
410 $("#charged + span").replaceWith(amount.format_price());
411 $("#discount").attr({ "max": amount, "min": 0 });
412 $("#discount").focus();
418 [% INCLUDE 'intranet-bottom.inc' %]