7 [% PROCESS 'payments.inc' %]
8 [% INCLUDE 'doc-head-open.inc' %]
9 <title>Koha › Patrons ›
10 [% IF type == 'WRITEOFF' %]
11 Write off an amount for [% patron.firstname | html %] [% patron.surname | html %]
13 Collect fine payment for [% patron.firstname | html %] [% patron.surname | html %]
16 [% INCLUDE 'doc-head-close.inc' %]
19 <body id="pat_paycollect" class="pat">
20 [% INCLUDE 'header.inc' %]
21 [% INCLUDE 'patron-search.inc' %]
22 <div id="breadcrumbs">
23 <a href="/cgi-bin/koha/mainpage.pl">Home</a> ›
24 <a href="/cgi-bin/koha/members/members-home.pl">Patrons</a> ›
25 <a href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% patron.borrowernumber | uri %]">Pay fines for [% patron.firstname | html %] [% patron.surname | html %]</a> ›
26 [% IF ( pay_individual ) %]Pay an individual fine
27 [% ELSIF ( writeoff_individual ) %]Write off an individual fine
29 [% IF ( selected_accts ) %]
30 [% IF type == 'writeoff' %]Write off an amount toward selected fines
31 [% ELSE %]Pay an amount toward selected fines
33 [% ELSE %]Pay an amount toward all fines
38 <div class="main container-fluid">
40 <div class="col-sm-10 col-sm-push-2">
43 [% INCLUDE 'members-toolbar.inc' borrowernumber=patron.borrowernumber %]
46 <!-- The manual invoice and credit buttons -->
47 <div class="statictabs">
50 <a href="/cgi-bin/koha/members/boraccount.pl?borrowernumber=[% patron.borrowernumber | uri %]">Transactions</a>
53 <a href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% patron.borrowernumber | uri %]" >Make a payment</a>
56 <a href="/cgi-bin/koha/members/maninvoice.pl?borrowernumber=[% patron.borrowernumber | uri %]" >Create manual invoice</a>
59 <a href="/cgi-bin/koha/members/mancredit.pl?borrowernumber=[% patron.borrowernumber | uri %]" >Create manual credit</a>
62 <div class="tabs-container">
63 [% IF ( error_over ) %]
64 <div id="error_message" class="dialog alert">
65 You must pay a value less than or equal to [% total_due | format('%.2f') %].
69 [% IF ( pay_individual ) %]
70 [% IF ( error_registers ) %]
71 <div id="error_message" class="dialog alert">
72 You must have at least one cash register associated with this branch before you can record payments.
76 <form name="payindivfine" id="payindivfine" method="post" action="/cgi-bin/koha/members/paycollect.pl">
77 <input type="hidden" name="csrf_token" value="[% csrf_token | html %]" />
78 <input type="hidden" name="borrowernumber" id="borrowernumber" value="[% patron.borrowernumber | html %]" />
79 <input type="hidden" name="pay_individual" id="pay_individual" value="[% pay_individual | html %]" />
80 <input type="hidden" name="itemnumber" id="itemnumber" value="[% itemnumber | html %]" />
81 <input type="hidden" name="description" id="description" value="[% description | html %]" />
82 <input type="hidden" name="debit_type_code" id="debit_type_code" value="[% debit_type_code | html %]" />
83 <input type="hidden" name="amount" id="amount" value="[% amount | html %]" />
84 <input type="hidden" name="amountoutstanding" id="amountoutstanding" value="[% amountoutstanding | html %]" />
85 <input type="hidden" name="accountlines_id" id="accountlines_id" value="[% accountlines_id | html %]" />
86 <input type="hidden" name="title" id="title" value="[% title | html %]" />
87 <input type="hidden" name="change_given" id="change_given" />
89 <fieldset class="rows">
90 <legend>Pay an individual fine</legend>
91 <input type="hidden" name="payment_note" id="payment_note" value="[% payment_note | html %]" />
97 <th>Amount outstanding</th>
100 <tr><td colspan="3">Total amount payable:</td><td>[% amountoutstanding | format('%.2f') %]</td></tr>
104 [% individual_description | html %]
106 <td>[% debit_type_code | html %]</td>
107 <td class="debit">[% amount | format('%.2f') %]</td>
108 <td class="debit">[% amountoutstanding | format('%.2f') %]</td>
115 <label for="paid">Amount being paid: </label>
116 <input name="paid" id="paid" value="[% amountoutstanding | $Price on_editing => 1 %]"/>
119 <label for="collected">Collected from patron: </label>
120 <input id="collected" value="[% amountoutstanding | $Price on_editing => 1 %]"/>
123 <label>Change to give: </label>
124 <span id="change">0.00</span>
127 [% PROCESS account_payment_types %]
129 [% IF Koha.Preference('UseCashRegisters') %]
131 <label for="cash_register">Cash register: </label>
132 <select name="cash_register" id="cash_register">
133 [% FOREACH register IN registers %]
134 [% IF register.id == registerid %]
135 <option value="[% register.id | html %]" selected="selected">[% register.name | html %]</option>
137 <option value="[% register.id | html %]">[% register.name | html %]</option>
147 <input type="submit" name="submitbutton" value="Confirm" />
148 <a class="cancel" href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% patron.borrowernumber | html %]">Cancel</a>
152 [% ELSIF ( writeoff_individual ) %]
153 <form name="woindivfine" id="woindivfine" action="/cgi-bin/koha/members/pay.pl" method="post" >
154 <input type="hidden" name="csrf_token" value="[% csrf_token | html %]" />
155 <fieldset class="rows">
156 <legend>Write off an individual fine</legend>
157 <input type="hidden" name="borrowernumber" id="borrowernumber" value="[% patron.borrowernumber | html %]" />
158 <input type="hidden" name="pay_individual" id="pay_individual" value="[% pay_individual | html %]" />
159 <input type="hidden" name="itemnumber" id="itemnumber" value="[% itemnumber | html %]" />
160 <input type="hidden" name="description" id="description" value="[% description | html %]" />
161 <input type="hidden" name="debit_type_code" id="debit_type_code" value="[% debit_type_code | html %]" />
162 <input type="hidden" name="amount" id="amount" value="[% amount | html %]" />
163 <input type="hidden" name="accountlines_id" id="accountlines_id" value="[% accountlines_id | html %]" />
164 <input type="hidden" name="title" id="title" value="[% title | html %]" />
165 <input type="hidden" name="payment_note" id="payment_note" value="[% payment_note | html %]" />
166 <input type="hidden" name="amountoutstanding" id="amountoutstanding" value="[% amountoutstanding | html %]" />
167 <input type="hidden" name="confirm_writeoff" id="confirm_writeoff" value="1" />
168 <input type="hidden" name="change_given" id="change_given" />
172 <th>Account type</th>
174 <th>Amount outstanding</th>
176 <tfoot><tr><td colspan="3">Total amount outstanding:</td><td>[% amountoutstanding | format('%.2f') %]</td></tr></tfoot>
178 <td>[% individual_description | html %]</td>
179 <td>[% debit_type_code | html %]</td>
180 <td class="debit">[% amount | format('%.2f') %]</td>
181 <td class="debit">[% amountoutstanding | format('%.2f') %]</td>
187 <label for="paid">Writeoff amount: </label>
188 <!-- default to writing off all -->
189 <input name="amountwrittenoff" id="amountwrittenoff" value="[% amountoutstanding | $Price on_editing => 1 %]" type="text" />
194 <input type="submit" value="Write off this charge" />
195 <a class="cancel" href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% patron.borrowernumber | html %]">Cancel</a>
199 [% IF ( error_registers && type != 'writeoff' ) %]
200 <div id="error_message" class="dialog alert">
201 You must have at least one cash register associated with this branch before you can record payments.
205 <form name="payfine" id="payfine" method="post" action="/cgi-bin/koha/members/paycollect.pl">
206 <input type="hidden" name="csrf_token" value="[% csrf_token | html %]" />
207 <input type="hidden" name="borrowernumber" id="borrowernumber" value="[% patron.borrowernumber | html %]" />
208 <input type="hidden" name="selected_accts" id="selected_accts" value="[% selected_accts | html %]" />
209 <input type="hidden" name="total" id="total" value="[% total | html %]" />
210 <input type="hidden" name="type" value="[% type | html %]" />
211 <input type="hidden" name="change_given" id="change_given" />
213 <fieldset class="rows">
214 [% IF ( selected_accts ) %]
215 [% IF type == 'WRITEOFF' %]
216 <legend>Write off an amount toward selected fines</legend>
218 <legend>Pay an amount toward selected fines</legend>
221 <legend>Pay an amount toward all fines</legend>
226 <span class="label">Total amount outstanding: </span>
227 <span class="debit">[% total | format('%.2f') %]</span>
230 [% IF type == 'WRITEOFF' %]
231 <label for="paid">Writeoff amount:</label>
233 <label for="paid">Amount paid: </label>
235 <input name="paid" id="paid" value="[% total | $Price on_editing => 1 %]"/>
238 [% IF type != 'WRITEOFF' %]
240 <label for="collected">Collected from patron: </label>
241 <input id="collected" value="[% total | $Price on_editing => 1 %]"/>
244 <label>Change to give: </label>
245 <span id="change">0.00</span>
248 [% PROCESS account_payment_types %]
250 [% IF Koha.Preference('UseCashRegisters') %]
252 <label for="cash_register">Cash register: </label>
253 <select name="cash_register" id="cash_register">
254 [% FOREACH register IN registers %]
255 [% IF register.id == registerid %]
256 <option value="[% register.id | html %]" selected="selected">[% register.name | html %]</option>
258 <option value="[% register.id | html %]">[% register.name | html %]</option>
267 <label for="selected_accts_notes">Note: </label>
268 <textarea name="selected_accts_notes" id="selected_accts_notes">[% selected_accts_notes | html %]</textarea>
273 <input type="submit" name="submitbutton" value="Confirm" />
274 <a class="cancel" href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% patron.borrowernumber | html %]">Cancel</a>
282 </div> <!-- /.col-sm-10.col-sm-push-2 -->
284 <div class="col-sm-2 col-sm-pull-10">
286 [% INCLUDE 'circ-menu.inc' %]
288 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
289 </div> <!-- /.row -->
292 <div id="confirm_change_form" class="modal" tabindex="-1" role="dialog" aria-hidden="true">
293 <div class="modal-dialog">
294 <div class="modal-content">
295 <div class="modal-header">
296 <h3>The amount collected is more than the outstanding charge</h3>
298 <div class="modal-body">
299 <p>The amount collected from the patron is higher than the amount to be paid.</p>
300 <p>The change to give is <b><span id="modal_change">0.00</span></b>.</p>
301 <p>Confirm this payment?</p>
303 <div class="modal-footer">
304 <button class="btn btn-default approve" id="modal_submit" type="button"><i class="fa fa-check"></i> Yes</button>
305 <button class="btn btn-default deny cancel" href="#" data-dismiss="modal" aria-hidden="true"><i class="fa fa-times"></i> No</button>
311 [% MACRO jsinclude BLOCK %]
312 [% INCLUDE 'str/members-menu.inc' %]
313 [% Asset.js("js/members-menu.js") | $raw %]
315 $(document).ready(function() {
316 [% IF payment_id && Koha.Preference('FinePaymentAutoPopup') %]
317 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');
320 var forms = $('#payindivfine, #payfine');
321 var change = $('#change')[0];
323 $('#payindivfine, #payfine').preventDoubleFormSubmit();
324 $("#paid, #collected").on("change",function() {
326 if (change != undefined) {
327 updateChangeValues();
331 if (change != undefined) {
332 forms.on("submit", function(e) {
333 if (change.innerHTML > 0.00) {
335 $("#confirm_change_form").modal("show");
342 $("#confirm_change_form").on("hidden.bs.modal", function(){
343 // remove class added by preventDoubleFormSubmit if necessary
344 $("body, form input[type='submit'], form button[type='submit'], form a").removeClass('waiting');
347 $('#modal_submit').click(function() {
353 $('#woindivfine').on('submit', function(e){
354 if ( prevent_default ) {
357 let amount_outstanding = parseFloat( $('#amountoutstanding').attr('value') );
358 let amount_writeoff = parseFloat( $('#amountwrittenoff').attr('value') );
359 if ( amount_writeoff > amount_outstanding ) {
360 alert(_("You are attemping to writeoff more than the value of the fee."));
361 $('#woindivfine').beenSubmitted = false;
364 $('#woindivfine').preventDoubleFormSubmit();
365 $('#woindivfine').submit();
370 function moneyFormat(textObj) {
371 var newValue = textObj.value;
377 for(i=0; i < newValue.length; i++) {
378 aChar = newValue.substring(i, i+1);
379 if (aChar >= "0" && aChar <= "9") {
381 decAmount = "" + decAmount + aChar;
384 dolAmount = "" + dolAmount + aChar;
396 if (dolAmount == "") {
400 if (dolAmount.length > 1) {
401 while(dolAmount.length > 1 && dolAmount.substring(0,1) == "0") {
402 dolAmount = dolAmount.substring(1,dolAmount.length);
405 if (decAmount.length > 2) {
406 decAmount = decAmount.substring(0,2);
409 if (decAmount.length == 1) {
410 decAmount = decAmount + "0";
412 if (decAmount.length == 0) {
413 decAmount = decAmount + "00";
416 textObj.value = dolAmount + "." + decAmount;
419 function updateChangeValues() {
420 var change = $('#change')[0];
421 change.innerHTML = Math.round(($('#collected')[0].value - $('#paid')[0].value) * 100) / 100;
422 if (change.innerHTML <= 0) {
423 change.innerHTML = "0.00";
424 $('input[name="change_given"]').val('0.00');
426 change.value = change.innerHTML;
428 change.innerHTML = change.value;
429 $('input[name="change_given"]').val(change.value);
432 $('#modal_change').html(change.innerHTML);
437 [% INCLUDE 'intranet-bottom.inc' %]