8 [% PROCESS 'payments.inc' %]
9 [% PROCESS 'accounts.inc' %]
10 [% INCLUDE 'doc-head-open.inc' %]
11 [% BLOCK cash_register_required %]
12 <div id="error_message" class="dialog message">
14 You must have at least one cash register associated with the library before you can record payments.
16 [% IF ( CAN_user_parameters_manage_cash_registers ) %]
17 <form action="/cgi-bin/koha/admin/cash_registers.pl" method="get">
18 <input type="hidden" name="op" value="add_form" />
19 <button class="new" type="submit"><i class="fa fa-plus"></i> Create a new cash register</button>
24 [% SET registers = Registers.all( filters => { current_branch => 1 } ) %]
25 <title>Koha › Patrons ›
26 [% IF type == 'WRITEOFF' %]
27 Write off an amount for [% patron.firstname | html %] [% patron.surname | html %]
29 Collect fine payment for [% patron.firstname | html %] [% patron.surname | html %]
32 [% INCLUDE 'doc-head-close.inc' %]
35 <body id="pat_paycollect" class="pat">
36 [% INCLUDE 'header.inc' %]
37 [% INCLUDE 'patron-search.inc' %]
38 <div id="breadcrumbs">
39 <a href="/cgi-bin/koha/mainpage.pl">Home</a> ›
40 <a href="/cgi-bin/koha/members/members-home.pl">Patrons</a> ›
41 <a href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% patron.borrowernumber | uri %]">Pay fines for [% patron.firstname | html %] [% patron.surname | html %]</a> ›
42 [% IF ( pay_individual ) %]Pay an individual fine
43 [% ELSIF ( writeoff_individual ) %]Write off an individual fine
45 [% IF ( selected_accts ) %]
46 [% IF type == 'WRITEOFF' %]Write off an amount toward selected fines
47 [% ELSE %]Pay an amount toward selected fines
49 [% ELSE %]Pay an amount toward all fines
54 <div class="main container-fluid">
56 <div class="col-sm-10 col-sm-push-2">
59 [% INCLUDE 'members-toolbar.inc' borrowernumber=patron.borrowernumber %]
62 <!-- The manual invoice and credit buttons -->
63 <div class="statictabs">
66 <a href="/cgi-bin/koha/members/boraccount.pl?borrowernumber=[% patron.borrowernumber | uri %]">Transactions</a>
69 <a href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% patron.borrowernumber | uri %]" >Make a payment</a>
72 <a href="/cgi-bin/koha/members/maninvoice.pl?borrowernumber=[% patron.borrowernumber | uri %]" >Create manual invoice</a>
75 <a href="/cgi-bin/koha/members/mancredit.pl?borrowernumber=[% patron.borrowernumber | uri %]" >Create manual credit</a>
78 <div class="tabs-container">
79 [% IF ( error_over ) %]
80 <div id="error_message" class="dialog alert">
81 You must pay a value less than or equal to [% total_due | format('%.2f') %].
84 [% IF ( error_under ) %]
85 <div id="error_message" class="dialog alert">
86 You must collect a value greater than or equal to [% total_paid | format('%.2f') %].
90 [% IF ( pay_individual ) %]
91 [% IF Koha.Preference('UseCashRegisters') && ( registers.size == 0 ) %]
92 [% PROCESS 'cash_register_required' %]
95 <ul class="nav nav-pills">
96 <li role="presentation" class="active"><a>Pay</a></li>
97 <li role="presentation"><a href="/cgi-bin/koha/members/paycollect.pl?writeoff_individual=1&borrowernumber=[% patron.borrowernumber | uri %]&debit_type_code=[% debit_type_code | uri %]&amount=[% amount | uri %]&amountoutstanding=[% amountoutstanding | uri %]&description=[% individual_description | uri %]&itemnumber=[% itemnumber | uri %]&accountlines_id=[% accountlines_id | uri %]&payment_note=[% payment_note | uri %]">Write off</a></li>
100 <form name="payindivfine" id="payindivfine" method="post" action="/cgi-bin/koha/members/paycollect.pl">
101 <input type="hidden" name="csrf_token" value="[% csrf_token | html %]" />
102 <input type="hidden" name="borrowernumber" id="borrowernumber" value="[% patron.borrowernumber | html %]" />
103 <input type="hidden" name="pay_individual" id="pay_individual" value="[% pay_individual | html %]" />
104 <input type="hidden" name="itemnumber" id="itemnumber" value="[% itemnumber | html %]" />
105 <input type="hidden" name="description" id="description" value="[% individual_description | html %]" />
106 <input type="hidden" name="debit_type_code" id="debit_type_code" value="[% debit_type_code | html %]" />
107 <input type="hidden" name="amount" id="amount" value="[% amount | html %]" />
108 <input type="hidden" name="amountoutstanding" id="amountoutstanding" value="[% amountoutstanding | html %]" />
109 <input type="hidden" name="accountlines_id" id="accountlines_id" value="[% accountlines_id | html %]" />
110 <input type="hidden" name="title" id="title" value="[% title | html %]" />
111 <input type="hidden" name="change_given" id="change_given" />
113 <fieldset class="rows">
114 <legend>Pay an individual fine</legend>
115 <input type="hidden" name="payment_note" id="payment_note" value="[% payment_note | html %]" />
119 <th>Account type</th>
121 <th>Amount outstanding</th>
124 <tr><td colspan="3">Total amount payable:</td><td>[% amountoutstanding | format('%.2f') %]</td></tr>
128 [% individual_description | html %]
130 [% line.debit_type_code = debit_type_code %]
131 <td>[% PROCESS account_type_description account=line %]</td>
132 <td class="debit">[% amount | format('%.2f') %]</td>
133 <td class="debit">[% amountoutstanding | format('%.2f') %]</td>
140 <label for="paid">Amount being paid: </label>
141 <input name="paid" id="paid" type="text" step="0.01" value="[% amountoutstanding | $Price on_editing => 1 %]"/>
144 <label for="collected">Amount tendered: </label>
145 <input name="collected" id="collected" type="text" step="0.01" value="[% amountoutstanding | $Price on_editing => 1 %]"/>
148 <label>Change to give: </label>
149 <span id="change">0.00</span>
152 [% PROCESS account_payment_types %]
154 [% IF Koha.Preference('UseCashRegisters') %]
156 <label for="cash_register">Cash register: </label>
157 <select name="cash_register" id="cash_register">
158 [% PROCESS options_for_registers register_required => 1 %]
166 <input type="submit" name="submitbutton" value="Confirm" />
167 <a class="cancel" href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% patron.borrowernumber | html %]">Cancel</a>
171 [% ELSIF ( writeoff_individual ) %]
172 <ul class="nav nav-pills">
173 <li role="presentation"><a href="/cgi-bin/koha/members/paycollect.pl?pay_individual=1&borrowernumber=[% patron.borrowernumber | uri %]&debit_type_code=[% debit_type_code | uri %]&amount=[% amount | uri %]&amountoutstanding=[% amountoutstanding | uri %]&description=[% individual_description | uri %]&itemnumber=[% itemnumber | uri %]&accountlines_id=[% accountlines_id | uri %]&payment_note=[% payment_note | uri %]">Pay</a></li>
174 <li role="presentation" class="active"><a>Write off</a></li>
177 <form name="woindivfine" id="woindivfine" action="/cgi-bin/koha/members/pay.pl" method="post" >
178 <input type="hidden" name="csrf_token" value="[% csrf_token | html %]" />
179 <fieldset class="rows">
180 <legend>Write off an individual fine</legend>
181 <input type="hidden" name="borrowernumber" id="borrowernumber" value="[% patron.borrowernumber | html %]" />
182 <input type="hidden" name="pay_individual" id="pay_individual" value="[% pay_individual | html %]" />
183 <input type="hidden" name="itemnumber" id="itemnumber" value="[% itemnumber | html %]" />
184 <input type="hidden" name="description" id="description" value="[% individual_description | html %]" />
185 <input type="hidden" name="debit_type_code" id="debit_type_code" value="[% debit_type_code | html %]" />
186 <input type="hidden" name="amount" id="amount" value="[% amount | html %]" />
187 <input type="hidden" name="accountlines_id" id="accountlines_id" value="[% accountlines_id | html %]" />
188 <input type="hidden" name="title" id="title" value="[% title | html %]" />
189 <input type="hidden" name="payment_note" id="payment_note" value="[% payment_note | html %]" />
190 <input type="hidden" name="amountoutstanding" id="amountoutstanding" value="[% amountoutstanding | html %]" />
191 <input type="hidden" name="confirm_writeoff" id="confirm_writeoff" value="1" />
192 <input type="hidden" name="change_given" id="change_given" />
196 <th>Account type</th>
198 <th>Amount outstanding</th>
200 <tfoot><tr><td colspan="3">Total amount outstanding:</td><td>[% amountoutstanding | format('%.2f') %]</td></tr></tfoot>
202 <td>[% individual_description | html %]</td>
203 [% line.debit_type_code = debit_type_code %]
204 <td>[% PROCESS account_type_description account=line %]</td>
205 <td class="debit">[% amount | format('%.2f') %]</td>
206 <td class="debit">[% amountoutstanding | format('%.2f') %]</td>
212 <label for="paid">Writeoff amount: </label>
213 <!-- default to writing off all -->
214 <input name="amountwrittenoff" id="amountwrittenoff" value="[% amountoutstanding | $Price on_editing => 1 %]" type="text" />
219 <input type="submit" value="Write off this charge" />
220 <a class="cancel" href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% patron.borrowernumber | html %]">Cancel</a>
224 [% IF Koha.Preference('UseCashRegisters') && ( registers.size == 0 ) && ( type != 'WRITEOFF' ) %]
225 [% PROCESS 'cash_register_required' %]
228 [% IF selected_accts %]
229 <ul class="nav nav-pills">
230 [% IF type == 'WRITEOFF' %]
231 <li role="presentation"><a href="/cgi-bin/koha/members/paycollect.pl?borrowernumber=[% patron.borrowernumber | uri %]&type=PAYMENT&amt=[% amt | uri %]&selected=[% selected_accts | uri %]¬es=[% selected_accts_notes | uri %]">Pay</a></li>
232 <li role="presentation" class="active"><a>Write off</a></li>
234 <li role="presentation" class="active"><a>Pay</a></li>
235 <li role="presentation"><a href="/cgi-bin/koha/members/paycollect.pl?borrowernumber=[% patron.borrowernumber | uri %]&type=WRITEOFF&amt=[% amt | uri %]&selected=[% selected_accts | uri %]¬es=[% selected_accts_notes | uri %]">Write off</a></li>
240 <form name="payfine" id="payfine" method="post" action="/cgi-bin/koha/members/paycollect.pl">
241 <input type="hidden" name="csrf_token" value="[% csrf_token | html %]" />
242 <input type="hidden" name="borrowernumber" id="borrowernumber" value="[% patron.borrowernumber | html %]" />
243 <input type="hidden" name="selected_accts" id="selected_accts" value="[% selected_accts | html %]" />
244 <input type="hidden" name="total" id="total" value="[% total | html %]" />
245 <input type="hidden" name="type" value="[% type | html %]" />
246 <input type="hidden" name="change_given" id="change_given" />
248 <fieldset class="rows">
249 [% IF ( selected_accts ) %]
250 [% IF type == 'WRITEOFF' %]
251 <legend>Write off an amount toward selected fines</legend>
253 <legend>Pay an amount toward selected fines</legend>
256 <legend>Pay an amount toward all fines</legend>
261 <span class="label">Total amount outstanding: </span>
262 <span class="debit">[% total | format('%.2f') %]</span>
265 [% IF type == 'WRITEOFF' %]
266 <label for="paid">Writeoff amount: </label>
268 <label for="paid">Amount being paid: </label>
270 <input name="paid" id="paid" type="text" step="0.01" value="[% total | $Price on_editing => 1 %]"/>
272 [% IF type != 'WRITEOFF' %]
274 <label for="collected">Amount tendered: </label>
275 <input name="collected" id="collected" type="text" step="0.01" value="[% total | $Price on_editing => 1 %]"/>
278 <label>Change to give: </label>
279 <span id="change">0.00</span>
282 [% PROCESS account_payment_types %]
284 [% IF Koha.Preference('UseCashRegisters') %]
286 <label for="cash_register">Cash register: </label>
287 <select name="cash_register" id="cash_register">
288 [% PROCESS options_for_registers register_required => 1 %]
295 <label for="selected_accts_notes">Note: </label>
296 <textarea name="selected_accts_notes" id="selected_accts_notes">[% selected_accts_notes | html %]</textarea>
301 <input type="submit" name="submitbutton" value="Confirm" />
302 <a class="cancel" href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% patron.borrowernumber | html %]">Cancel</a>
310 </div> <!-- /.col-sm-10.col-sm-push-2 -->
312 <div class="col-sm-2 col-sm-pull-10">
314 [% INCLUDE 'circ-menu.inc' %]
316 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
317 </div> <!-- /.row -->
320 <div id="confirm_change_form" class="modal" tabindex="-1" role="dialog" aria-hidden="true">
321 <div class="modal-dialog">
322 <div class="modal-content">
323 <div class="modal-header">
324 <h3>The amount collected is more than the outstanding charge</h3>
326 <div class="modal-body">
327 <p>The amount collected from the patron is higher than the amount to be paid.</p>
328 <p>The change to give is <strong><span id="modal_change">0.00</span></strong>.</p>
329 <p>Confirm this payment?</p>
331 <div class="modal-footer">
332 <button class="btn btn-default approve" id="modal_submit" type="button"><i class="fa fa-check"></i> Yes</button>
333 <button class="btn btn-default deny cancel" href="#" data-dismiss="modal" aria-hidden="true"><i class="fa fa-times"></i> No</button>
339 [% MACRO jsinclude BLOCK %]
340 [% INCLUDE 'str/members-menu.inc' %]
341 [% Asset.js("js/members-menu.js") | $raw %]
343 $(document).ready(function() {
344 [% IF payment_id && Koha.Preference('FinePaymentAutoPopup') %]
345 window.open('/cgi-bin/koha/members/printfeercpt.pl?action=print&accountlines_id=[% payment_id | html %]&change_given=[% change_given | html %]&borrowernumber=[% patron.borrowernumber | html %]', '_blank');
348 var forms = $('#payindivfine, #payfine');
349 var change = $('#change')[0];
351 $('#payindivfine, #payfine').preventDoubleFormSubmit();
352 $("#paid, #collected").on("change",function() {
354 if (change != undefined) {
355 updateChangeValues();
359 if (change != undefined) {
360 forms.on("submit", function(e) {
361 if (change.innerHTML > 0.00) {
363 $("#confirm_change_form").modal("show");
370 $("#confirm_change_form").on("hidden.bs.modal", function(){
371 // remove class added by preventDoubleFormSubmit if necessary
372 $("body, form input[type='submit'], form button[type='submit'], form a").removeClass('waiting');
375 $('#modal_submit').click(function() {
379 $( "#payindivfine, #payfine" ).validate({
381 paid: { required: true },
385 [% IF Koha.Preference('UseCashRegisters') %]
387 required: function() {
388 return $('#payment_type').val() == 'CASH'
393 invalidHandler: function(event, validator) {
394 // reset beenSubmitted for prevenDoubleFormSubmit
395 event.target.beenSubmitted = false;
396 // remove class added by preventDoubleFormSubmit
397 $("body, form input[type='submit'], form button[type='submit'], form a").removeClass('waiting');
403 $('#woindivfine').on('submit', function(e){
404 if ( prevent_default ) {
407 let amount_outstanding = parseFloat( $('#amountoutstanding').attr('value') );
408 let amount_writeoff = parseFloat( $('#amountwrittenoff').attr('value') );
409 if ( amount_writeoff > amount_outstanding ) {
410 alert(_("You are attemping to writeoff more than the value of the fee."));
411 $('#woindivfine').beenSubmitted = false;
414 $('#woindivfine').preventDoubleFormSubmit();
415 $('#woindivfine').submit();
420 function moneyFormat(textObj) {
421 var newValue = textObj.value;
427 for(i=0; i < newValue.length; i++) {
428 aChar = newValue.substring(i, i+1);
429 if (aChar >= "0" && aChar <= "9") {
431 decAmount = "" + decAmount + aChar;
434 dolAmount = "" + dolAmount + aChar;
446 if (dolAmount == "") {
450 if (dolAmount.length > 1) {
451 while(dolAmount.length > 1 && dolAmount.substring(0,1) == "0") {
452 dolAmount = dolAmount.substring(1,dolAmount.length);
455 if (decAmount.length > 2) {
456 decAmount = decAmount.substring(0,2);
459 if (decAmount.length == 1) {
460 decAmount = decAmount + "0";
462 if (decAmount.length == 0) {
463 decAmount = decAmount + "00";
466 textObj.value = dolAmount + "." + decAmount;
469 function updateChangeValues() {
470 var change = $('#change')[0];
471 change.innerHTML = Math.round(($('#collected')[0].value - $('#paid')[0].value) * 100) / 100;
472 if (change.innerHTML <= 0) {
473 var paid = $('#paid')[0];
475 $('#collected').rules( "add", { min: Number(paid.value) });
476 $( "#payindivfine, #payfine" ).valid();
477 change.innerHTML = "0.00";
478 $('input[name="change_given"]').val('0.00');
480 change.value = change.innerHTML;
482 change.innerHTML = change.value;
483 $('input[name="change_given"]').val(change.value);
486 $('#modal_change').html(change.innerHTML);
491 [% INCLUDE 'intranet-bottom.inc' %]