6 [% USE TablesSettings %]
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>
48 <th>Credit number</th>
50 <th>Description of charges</th>
54 <th>Checkout date</th>
59 <th class="NoSort">Actions</th>
63 <!-- FIXME: Shouldn't hardcode dollar signs, since Euro or Pound might be needed -->
64 [% FOREACH account IN accounts %]
67 <td><span title="[% account.date | html %]">[% account.date |$KohaDates %]</span></td>
68 <td>[% account.credit_number | html %]</td>
69 <td>[% PROCESS account_type_description account=account %]</td>
71 [%- IF account.payment_type %][% AuthorisedValues.GetByCode('PAYMENT_TYPE', account.payment_type) | html %][% END %]
72 [%- IF account.description %][% account.description | html %][% END %]
73 [% 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>
74 <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>
75 <td>[% IF ( account.issue_id ) %][% account.checkout.date_due | $KohaDates as_due_date => 1 %][% END %]</td>
76 <td>[% IF ( account.issue_id ) %][% account.checkout.returndate | $KohaDates with_hours => 1 %][% END %]</td>
77 <td>[% IF ( account.issue_id ) %][% account.checkout.issuedate | $KohaDates %][% END %]</td>
78 <td>[% IF account.itemnumber %][% Branches.GetName( account.item.homebranch ) | html %][% END %]</td>
79 <td>[% account.note | html_line_break %]</td>
80 [% IF account.amount <= 0 %]<td class="credit" style="text-align: right;">[% ELSE %]<td class="debit" style="text-align: right;">[% END %][% account.amount | $Price %]</td>
81 [% IF account.amountoutstanding <= 0 %]<td class="credit" style="text-align: right;">[% ELSE %]<td class="debit" style="text-align: right;">[% END %][% account.amountoutstanding | $Price %]</td>
83 [% IF ( account.is_credit ) %]
84 <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>
86 <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>
88 <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>
89 [% IF account.is_debit && account.amountoutstanding > 0 %]
90 <a class="btn btn-default btn-xs" 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 %]">Pay</a>
92 [% IF account.is_credit %]
93 <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>
95 [% IF CAN_user_updatecharges_payout && account.is_credit && ( account.amountoutstanding < 0 ) %]
96 <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>
98 [% IF CAN_user_updatecharges_refund && account.is_debit && ( account.amountoutstanding != account.amount ) && !(account.status == 'REFUNDED') && !(account.debit_type_code == 'PAYOUT') %]
99 <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>
101 [% IF CAN_user_updatecharges_discount && account.is_debit && ( account.amountoutstanding == account.amount ) && !(account.debit_type_code == 'PAYOUT') %]
102 <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>
110 <td colspan="11">Total due</td>
111 [% IF ( totalcredit ) %]
112 <td class="credit" style="text-align: right;">[% total | $Price %]</td>
114 <td class="debit"style="text-align: right;">[% total | $Price %]</td>
124 </div> <!-- /.col-sm-10.col-sm-push-2 -->
126 <div class="col-sm-2 col-sm-pull-10">
128 [% INCLUDE 'circ-menu.inc' %]
130 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
131 </div> <!-- /.row -->
133 <!-- Issue payout modal -->
134 <div class="modal" id="issuePayoutModal" tabindex="-1" role="dialog" aria-labelledby="issuePayoutLabel">
135 <form id="payout_form" action="/cgi-bin/koha/members/boraccount.pl" method="get" enctype="multipart/form-data" class="validated">
136 <input type="hidden" name="accountlines_id" value="" id="payoutline">
137 <input type="hidden" name="action" value="payout">
138 <input type="hidden" name="borrowernumber" value="[% account.borrowernumber | html %]">
139 <div class="modal-dialog" role="document">
140 <div class="modal-content">
141 <div class="modal-header">
142 <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
143 <h4 class="modal-title" id="issuePayoutLabel">Issue payout</h4>
145 <div class="modal-body">
146 <fieldset class="rows">
149 <span id="paid" class="label">Outstanding credit: </span><span>[% payout.amount | $Price %]</span>
152 <label class="required" for="amount">Returned to patron: </label>
153 <input type="number" step="0.01" id="amount" name="amount" min="0.00" required="required">
154 <span class="required">Required</span>
156 [% SET payment_types = AuthorisedValues.GetAuthValueDropbox('PAYMENT_TYPE') %]
157 [% SET excluded = ['SIP00', 'SIP01', 'SIP02'] %]
158 [% IF payment_types > 3 %]
160 <label for="transaction_type">Transaction type: </label>
161 <select name="transaction_type" id="payout_transaction_type">
162 [% FOREACH pt IN payment_types %]
163 [% UNLESS excluded.grep("^$pt.authorised_value\$").size %]
164 <option value="[% pt.authorised_value | html %]">[% pt.lib | html %]</option>
171 [% IF Koha.Preference('UseCashRegisters') %]
173 <label for="registerid">Cash register: </label>
174 <select name="registerid" id="payout_registerid">
175 [% FOREACH register IN registers %]
176 [% IF register.id == registerid %]
177 <option value="[% register.id | html %]" selected="selected">[% register.name | html %]</option>
179 <option value="[% register.id | html %]">[% register.name | html %]</option>
187 </fieldset> <!-- /.rows -->
188 </div> <!-- /.modal-body -->
189 <div class="modal-footer">
190 <input type="hidden" name="op" value="payout">
191 <button type="submit" class="btn btn-default" id="borr_payout_confirm">Confirm</button>
192 <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
193 </div> <!-- /.modal-footer -->
194 </div> <!-- /.modal-content -->
195 </div> <!-- /.modal-dialog -->
196 </form> <!-- /#payout_form -->
197 </div> <!-- /#issuePayoutModal -->
199 <!-- Issue refund modal -->
200 <div class="modal" id="issueRefundModal" tabindex="-1" role="dialog" aria-labelledby="issueRefundLabel">
201 <form id="refund_form" action="/cgi-bin/koha/members/boraccount.pl" method="get" enctype="multipart/form-data" class="validated">
202 <input type="hidden" name="accountlines_id" value="" id="refundline">
203 <input type="hidden" name="action" value="refund">
204 <input type="hidden" name="borrowernumber" value="[% account.borrowernumber | html %]">
205 <div class="modal-dialog" role="document">
206 <div class="modal-content">
207 <div class="modal-header">
208 <button type="button" class="closebtn" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
209 <h4 class="modal-title" id="issueRefundLabel">Issue refund</h4>
211 <div class="modal-body">
212 <fieldset class="rows">
215 <span id="item" class="label">Account: </span><span></span>
218 <span id="paid" class="label">Amount paid: </span><span></span>
221 <label class="required" for="amount">Returned to patron: </label>
222 <input type="number" step="0.01" id="returned" name="amount" min="0.00" required="required">
223 <span class="required">Required</span>
225 [% SET payment_types = AuthorisedValues.GetAuthValueDropbox('PAYMENT_TYPE') %]
227 <label for="transaction_type">Transaction type: </label>
228 <select name="transaction_type" id="refund_transaction_type">
229 <option value="AC">Account credit</option>
230 [% IF payment_types %]
231 [% FOREACH pt IN payment_types %]
232 <option value="[% pt.authorised_value | html %]">[% pt.lib | html %]</option>
238 [% IF Koha.Preference('UseCashRegisters') %]
240 <label for="registerid">Cash register: </label>
241 <select name="registerid" id="refund_registerid">
242 [% FOREACH register IN registers %]
243 [% IF register.id == registerid %]
244 <option value="[% register.id | html %]" selected="selected">[% register.name | html %]</option>
246 <option value="[% register.id | html %]">[% register.name | html %]</option>
254 </fieldset> <!-- /.rows -->
255 </div> <!-- /.modal-body -->
256 <div class="modal-footer">
257 <input type="hidden" name="op" value="refund">
258 <button type="submit" class="btn btn-default" id="borr_refund_confirm">Confirm</button>
259 <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
260 </div> <!-- /.modal-footer -->
261 </div> <!-- /.modal-content -->
262 </div> <!-- /.modal-dialog -->
263 </form> <!-- /#refund_form -->
264 </div> <!-- /#issueRefundModal -->
266 <!-- Apply discount modal -->
267 <div class="modal" id="applyDiscountModal" tabindex="-1" role="dialog" aria-labelledby="applyDiscountLabel">
268 <form id="discount_form" action="/cgi-bin/koha/members/boraccount.pl" method="get" enctype="multipart/form-data" class="validated">
269 <input type="hidden" name="accountlines_id" value="" id="discountline">
270 <input type="hidden" name="action" value="discount">
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="applyDiscountLabel">Apply discount</h4>
278 <div class="modal-body">
279 <fieldset class="rows">
282 <span id="item" class="label">Account type: </span><span></span>
285 <span id="charged" class="label">Amount charged: </span><span></span>
288 <label class="required" for="amount">Discount to apply: </label>
289 <input type="number" step="0.01" id="discount" name="amount" min="0.00" required="required">
290 <span class="required">Required</span>
293 </fieldset> <!-- /.rows -->
294 </div> <!-- /.modal-body -->
295 <div class="modal-footer">
296 <input type="hidden" name="op" value="discount">
297 <button type="submit" class="btn btn-default">Confirm</button>
298 <button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
299 </div> <!-- /.modal-footer -->
300 </div> <!-- /.modal-content -->
301 </div> <!-- /.modal-dialog -->
302 </form> <!-- /#discount_form -->
303 </div> <!-- /#applyDiscountModal -->
305 [% MACRO jsinclude BLOCK %]
306 [% INCLUDE 'datatables.inc' %]
307 [% INCLUDE 'columns_settings.inc' %]
308 [% INCLUDE 'str/members-menu.inc' %]
309 [% Asset.js("js/members-menu.js") | $raw %]
311 $(document).ready(function() {
312 [% IF payment_id && Koha.Preference('FinePaymentAutoPopup') %]
313 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');
316 var txtActivefilter = _("Filter paid transactions");
317 var txtInactivefilter = _("Show all transactions");
318 var columns_settings = [% TablesSettings.GetColumns('members', 'fines', 'account-fines', 'json') | $raw %];
319 var table_account_fines = KohaTable("table_account_fines", {
320 "sPaginationType": "full",
321 'aaSorting': [[0, 'desc']],
322 "sDom": 'C<"top pager"ilpfB><"#filter_c">tr<"bottom pager"ip>',
323 }, columns_settings);
324 $("#filter_c").html('<p><a href="#" id="filter_transacs"><i class="fa fa-filter"></i> '+txtActivefilter+'</a>');
325 $('#filter_transacs').click(function(e) {
327 if ($(this).hasClass('filtered')) {
328 var filteredValue = '';
329 $(this).html('<i class="fa fa-filter"></i> '+txtActivefilter);
330 } else { //Not filtered. Let's do it!
331 var filteredValue = '^((?!0.00).*)$'; //Filter not matching 0.00 http://stackoverflow.com/a/406408
332 $(this).html('<i class="fa fa-filter"></i> '+txtInactivefilter);
334 table_account_fines.fnFilter(filteredValue, 10, true, false);
335 $(this).toggleClass('filtered');
338 $(".void").on("click",function(e){
339 if( confirm( _("Are you sure you want to void this credit?") ) ) {
346 $("#issuePayoutModal").on("shown.bs.modal", function(e){
347 var button = $(e.relatedTarget);
348 var accountline = button.data('accountline');
349 $('#payoutline').val(accountline);
350 var amount = button.data('amount') * -1;
351 $("#paid + span").replaceWith(amount);
352 $("#amount").attr({ "value": amount, "max": amount });
353 $("#amount, #payout_transaction_type").focus();
356 $("#issueRefundModal").on("shown.bs.modal", function(e){
357 var button = $(e.relatedTarget);
358 var item = button.data('item');
359 $("#item + span").replaceWith(item);
360 var accountline = button.data('accountline');
361 $('#refundline').val(accountline);
362 var amount = button.data('amount');
363 var amountoutstanding = button.data('amountoutstanding');
364 var paid = amount - amountoutstanding;
365 $("#paid + span").replaceWith(paid);
366 $("#returned").attr({ "value": paid, "max": paid });
367 $("#returned, #refund_transaction_type").focus();
370 $("#applyDiscountModal").on("shown.bs.modal", function(e){
371 var button = $(e.relatedTarget);
372 var item = button.data('item');
373 $("#item + span").replaceWith(item);
374 var accountline = button.data('accountline');
375 $('#discountline').val(accountline);
376 var amount = button.data('amount');
377 $("#charged + span").replaceWith(amount);
378 $("#discount").attr({ "max": amount });
379 $("#discount").focus();
385 [% INCLUDE 'intranet-bottom.inc' %]