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 [% INCLUDE 'header.inc' %]
23 [% INCLUDE 'patron-search-header.inc' %]
25 <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
28 <a href="/cgi-bin/koha/mainpage.pl">Home</a>
31 <a href="/cgi-bin/koha/members/members-home.pl">Patrons</a>
34 <a href="#" aria-current="page">
35 Account for [% INCLUDE 'patron-title.inc' %]
41 <div class="main container-fluid">
43 <div class="col-sm-10 col-sm-push-2">
46 [% INCLUDE 'members-toolbar.inc' %]
47 <h1>Account for [% INCLUDE 'patron-title.inc' %]</h1>
48 <form action="/cgi-bin/koha/members/boraccount.pl" method="get"><input type="hidden" name="borrowernumber" id="borrowernumber" value="[% patron.borrowernumber | html %]" /></form>
50 <!-- The manual invoice and credit buttons -->
51 <div class="statictabs">
53 <li class="active"><a href="/cgi-bin/koha/members/boraccount.pl?borrowernumber=[% patron.borrowernumber | uri %]">Transactions</a></li>
54 <li><a href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% patron.borrowernumber | uri %]" >Make a payment</a></li>
55 <li><a href="/cgi-bin/koha/members/maninvoice.pl?borrowernumber=[% patron.borrowernumber | uri %]" >Create manual invoice</a></li>
56 <li><a href="/cgi-bin/koha/members/mancredit.pl?borrowernumber=[% patron.borrowernumber | uri %]" >Create manual credit</a></li>
58 <div class="tabs-container">
59 [% INCLUDE 'renew_results.inc' renew_results=renew_results %]
60 <!-- The table with the account items -->
61 <table id="table_account_fines">
66 <th>Credit number</th>
68 <th>Description of charges</th>
72 <th>Checkout date</th>
73 <th class="checked_out_from">Checked out from</th>
78 <th class="NoSort noExport">Actions</th>
82 <!-- FIXME: Shouldn't hardcode dollar signs, since Euro or Pound might be needed -->
83 [% FOREACH account IN accounts %]
86 <td data-order="[% account.date | html %]">[% account.date | $KohaDates %]</td>
87 <td data-order="[% account.timestamp | html %]">[% account.timestamp | $KohaDates with_hours = 1 %]</td>
88 <td>[% account.credit_number | html %]</td>
89 <td>[% PROCESS account_type_description account=account %]</td>
91 [%- IF account.payment_type %][% AuthorisedValues.GetByCode('PAYMENT_TYPE', account.payment_type) | html %][% END %]
92 [%- IF account.description %][% account.description | html %][% END %]
93 [% 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>
94 <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>
95 <td>[% IF ( account.issue_id ) %][% account.checkout.date_due | $KohaDates as_due_date => 1 %][% END %]</td>
96 <td>[% IF ( account.issue_id ) %][% account.checkout.returndate | $KohaDates with_hours => 1 %][% END %]</td>
97 <td>[% IF ( account.issue_id ) %][% account.checkout.issuedate | $KohaDates %][% END %]</td>
98 <td class="checked_out_from">
99 [% IF account.issue_id && account.checkout.library %]
100 [% account.checkout.library.branchname | html %]
103 <td>[% IF account.itemnumber %][% Branches.GetName( account.item.homebranch ) | html %][% END %]</td>
104 <td>[% account.note | html_line_break %]</td>
105 [% IF account.amount <= 0 %]<td class="credit" style="text-align: right;">[% ELSE %]<td class="debit" style="text-align: right;">[% END %][% account.amount | $Price %]</td>
106 [% IF account.amountoutstanding <= 0 %]<td class="credit" style="text-align: right;">[% ELSE %]<td class="debit" style="text-align: right;">[% END %][% account.amountoutstanding | $Price %]</td>
108 [% IF ( account.is_credit ) %]
109 <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>
111 <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>
113 <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>
114 [% IF account.is_debit && account.amountoutstanding > 0 %]
115 <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>
117 [% IF account.is_credit && account.status != 'VOID' %]
118 <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>
120 [% IF account.is_debit && account.amount == account.amountoutstanding && account.status != 'CANCELLED' && !(account.debit_type_code == 'PAYOUT') %]
121 <form method="post" action="/cgi-bin/koha/members/cancel-charge.pl">
122 <input type="hidden" name="csrf_token" value="[% csrf_token | html %]">
123 <input type="hidden" name="borrowernumber" value="[% patron.borrowernumber | html %]">
124 <input type="hidden" name="accountlines_id" value="[% account.accountlines_id | html %]">
125 <button type="submit" class="btn btn-default btn-xs cancel-action">
126 <i class="fa fa-ban"></i>
131 [% IF CAN_user_updatecharges_payout && account.is_credit && ( account.amountoutstanding < 0 ) %]
132 <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 payout-action"><i class="fa fa-money"></i> Issue payout</button>
134 [% IF CAN_user_updatecharges_refund && account.is_debit && ( account.amountoutstanding != account.amount ) && !(account.status == 'REFUNDED') && !(account.debit_type_code == 'PAYOUT') %]
135 <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 %]" data-amountoutstanding="[% account.amountoutstanding | $Price %]" data-member="[% account.borrowernumber | html %]"><i class="fa fa-money"></i> Issue refund</button>
137 [% IF CAN_user_updatecharges_discount && account.is_debit && ( account.amountoutstanding == account.amount ) && !(account.debit_type_code == 'PAYOUT') && !(account.debit_type_code == 'VOID') %]
138 <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 discount-action">Apply discount</button>
146 <td colspan="13">Total due</td>
147 [% IF ( totalcredit ) %]
148 <td class="credit" style="text-align: right;">[% total | $Price %]</td>
150 [% IF CAN_user_updatecharges_payout %]
151 <button type="button" data-toggle="modal" data-target="#issuePayoutModal" data-amount="[% total | $Price %]" class="btn btn-default btn-xs payout-amount-action"><i class="fa fa-money"></i> Payout amount</button>
155 <td class="debit"style="text-align: right;">[% total | $Price %]</td>
165 </div> <!-- /.col-sm-10.col-sm-push-2 -->
167 <div class="col-sm-2 col-sm-pull-10">
169 [% INCLUDE 'circ-menu.inc' %]
171 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
172 </div> <!-- /.row -->
174 <!-- Issue payout modal -->
175 <div class="modal" id="issuePayoutModal" tabindex="-1" role="dialog" aria-labelledby="issuePayoutLabel">
176 <form id="payout_form" action="/cgi-bin/koha/members/boraccount.pl" method="get" enctype="multipart/form-data" class="validated">
177 <input type="hidden" name="accountlines_id" value="" id="payoutline">
178 <input type="hidden" name="action" value="payout">
179 <input type="hidden" name="borrowernumber" value="[% account.borrowernumber | html %]">
180 <div class="modal-dialog" role="document">
181 <div class="modal-content">
182 <div class="modal-header">
183 <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
184 <h4 class="modal-title" id="issuePayoutLabel">Issue payout</h4>
186 <div class="modal-body">
187 [% IF Koha.Preference('UseCashRegisters') && ( registers.size == 0 ) %]
188 <div id="payout_error" class="dialog alert">
189 You must have at least one cash register associated with this branch before you can record cash payouts.
192 <fieldset class="rows">
195 <span id="paid" class="label">Outstanding credit: </span><span>[% payout.amount | $Price %]</span>
198 <label class="required" for="amount">Returned to patron: </label>
199 <input type="text" inputmode="numeric" pattern="[0-9]*" id="amount" name="amount" required="required">
200 <span class="required">Required</span>
203 [% INCLUDE 'transaction_types.inc' type="payout" %]
205 [% IF Koha.Preference('UseCashRegisters') %]
207 <label for="registerid">Cash register: </label>
208 <select name="registerid" id="payout_registerid">
209 <option id="noregister" disabled selected="selected" value="">-- Select an option--</option>
210 [% PROCESS options_for_registers %]
216 </fieldset> <!-- /.rows -->
217 </div> <!-- /.modal-body -->
218 <div class="modal-footer">
219 <input type="hidden" name="op" value="payout">
220 <button type="submit" class="btn btn-default" id="borr_payout_confirm">Confirm</button>
221 <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
222 </div> <!-- /.modal-footer -->
223 </div> <!-- /.modal-content -->
224 </div> <!-- /.modal-dialog -->
225 </form> <!-- /#payout_form -->
226 </div> <!-- /#issuePayoutModal -->
228 <!-- Issue refund modal -->
229 <div class="modal" id="issueRefundModal" tabindex="-1" role="dialog" aria-labelledby="issueRefundLabel">
230 <form id="refund_form" action="/cgi-bin/koha/members/boraccount.pl" method="get" enctype="multipart/form-data" class="validated">
231 <input type="hidden" name="accountlines_id" value="" id="refundline">
232 <input type="hidden" name="action" value="refund">
233 <input type="hidden" name="borrowernumber" value="[% account.borrowernumber | html %]">
234 <div class="modal-dialog" role="document">
235 <div class="modal-content">
236 <div class="modal-header">
237 <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
238 <h4 class="modal-title" id="issueRefundLabel">Issue refund</h4>
240 <div class="modal-body">
241 [% IF Koha.Preference('UseCashRegisters') && ( registers.size == 0 ) %]
242 <div id="refund_error" class="dialog alert">
243 You must have at least one cash register associated with this branch before you can record cash refunds.
246 <fieldset class="rows">
249 <span id="item" class="label">Account: </span><span></span>
252 <span id="paid" class="label">Amount paid: </span><span></span>
255 <label class="required" for="amount">Returned to patron: </label>
256 <input type="text" inputmode="numeric" pattern="[0-9]*" id="returned" name="amount" required="required">
257 <span class="required">Required</span>
260 [% INCLUDE 'transaction_types.inc' type="refund" %]
262 [% IF Koha.Preference('UseCashRegisters') %]
264 <label for="registerid">Cash register: </label>
265 <select name="registerid" id="refund_registerid">
266 <option id="noregister" disabled selected="selected" value="">-- Select an option--</option>
267 [% PROCESS options_for_registers %]
273 </fieldset> <!-- /.rows -->
274 </div> <!-- /.modal-body -->
275 <div class="modal-footer">
276 <input type="hidden" name="op" value="refund">
277 <button type="submit" class="btn btn-default" id="borr_refund_confirm">Confirm</button>
278 <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
279 </div> <!-- /.modal-footer -->
280 </div> <!-- /.modal-content -->
281 </div> <!-- /.modal-dialog -->
282 </form> <!-- /#refund_form -->
283 </div> <!-- /#issueRefundModal -->
285 <!-- Apply discount modal -->
286 <div class="modal" id="applyDiscountModal" tabindex="-1" role="dialog" aria-labelledby="applyDiscountLabel">
287 <form id="discount_form" action="/cgi-bin/koha/members/boraccount.pl" method="get" enctype="multipart/form-data" class="validated">
288 <input type="hidden" name="accountlines_id" value="" id="discountline">
289 <input type="hidden" name="action" value="discount">
290 <input type="hidden" name="borrowernumber" value="[% account.borrowernumber | html %]">
291 <div class="modal-dialog" role="document">
292 <div class="modal-content">
293 <div class="modal-header">
294 <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
295 <h4 class="modal-title" id="applyDiscountLabel">Apply discount</h4>
297 <div class="modal-body">
298 <fieldset class="rows">
301 <span id="item" class="label">Account type: </span><span></span>
304 <span id="charged" class="label">Amount charged: </span><span></span>
307 <label class="required" for="amount">Discount to apply: </label>
308 <input type="text" inputmode="numeric" pattern="[0-9]*" id="discount" name="amount" required="required">
309 <span class="required">Required</span>
312 </fieldset> <!-- /.rows -->
313 </div> <!-- /.modal-body -->
314 <div class="modal-footer">
315 <input type="hidden" name="op" value="discount">
316 <button type="submit" class="btn btn-default">Confirm</button>
317 <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
318 </div> <!-- /.modal-footer -->
319 </div> <!-- /.modal-content -->
320 </div> <!-- /.modal-dialog -->
321 </form> <!-- /#discount_form -->
322 </div> <!-- /#applyDiscountModal -->
324 [% MACRO jsinclude BLOCK %]
325 [% INCLUDE 'datatables.inc' %]
326 [% INCLUDE 'columns_settings.inc' %]
327 [% INCLUDE 'str/members-menu.inc' %]
328 [% Asset.js("js/members-menu.js") | $raw %]
330 $(document).ready(function() {
331 [% IF payment_id && Koha.Preference('FinePaymentAutoPopup') %]
332 window.open('/cgi-bin/koha/members/printfeercpt.pl?action=print&change_given=[% change_given | html %]&accountlines_id=[% payment_id | html %]', '_blank');
335 var txtActivefilter = _("Filter paid transactions");
336 var txtInactivefilter = _("Show all transactions");
337 var table_settings = [% TablesSettings.GetTableSettings('members', 'fines', 'account-fines', 'json') | $raw %];
338 var table_account_fines = KohaTable("table_account_fines", {
339 "sPaginationType": "full",
340 'aaSorting': [[0, 'desc']],
341 "sDom": 'C<"top pager"ilpfB><"#filter_c">tr<"bottom pager"ip>',
343 $("#filter_c").html('<p><a href="#" id="filter_transacs"><i class="fa fa-filter"></i> '+txtActivefilter+'</a>');
344 $('#filter_transacs').click(function(e) {
346 if ($(this).hasClass('filtered')) {
347 var filteredValue = '';
348 $(this).html('<i class="fa fa-filter"></i> '+txtActivefilter);
349 } else { //Not filtered. Let's do it!
350 var filteredValue = '^((?!0.00).*)$'; //Filter not matching 0.00 http://stackoverflow.com/a/406408
351 $(this).html('<i class="fa fa-filter"></i> '+txtInactivefilter);
353 table_account_fines.DataTable().columns( 13 ).search( filteredValue, true, false ).draw();
354 $(this).toggleClass('filtered');
357 $(".void-action").on("click",function(e){
358 if( confirm( _("Are you sure you want to void this credit?") ) ) {
365 $("#issuePayoutModal").on("shown.bs.modal", function(e){
366 var button = $(e.relatedTarget);
367 var accountline = button.data('accountline');
368 $('#payoutline').val(accountline);
369 var amount = button.data('amount') * -1;
370 $("#paid + span").replaceWith(amount);
371 $("#amount").attr({ "value": amount, "max": amount, "min": 0 });
372 $("#amount, #payout_transaction_type").focus();
375 $("#issueRefundModal").on("shown.bs.modal", function(e){
376 var button = $(e.relatedTarget);
377 var item = button.data('item');
378 $("#item + span").replaceWith(item);
379 var accountline = button.data('accountline');
380 $('#refundline').val(accountline);
381 var amount = button.data('amount');
382 var amountoutstanding = button.data('amountoutstanding') || 0;
383 var paid = amount - amountoutstanding;
384 $("#paid + span").replaceWith(paid);
385 $("#returned").attr({ "value": paid, "max": paid, "min": 0 });
386 var member = button.data('member');
387 if ( member === '' ) {
388 $("#refund_type option[value='AC']").remove();
389 } else if ( $("#refund_type option[value='AC']").length == 0 ) {
390 $("#refund_type").prepend('<option value="AC" selected="selected">Account credit</option>');
392 $("#returned, #refund_type").focus();
395 $("#applyDiscountModal").on("shown.bs.modal", function(e){
396 var button = $(e.relatedTarget);
397 var item = button.data('item');
398 $("#item + span").replaceWith(item);
399 var accountline = button.data('accountline');
400 $('#discountline').val(accountline);
401 var amount = button.data('amount');
402 $("#charged + span").replaceWith(amount);
403 $("#discount").attr({ "max": amount, "min": 0 });
404 $("#discount").focus();
410 [% INCLUDE 'intranet-bottom.inc' %]