5 [% USE AuthorisedValues %]
8 [% INCLUDE 'doc-head-open.inc' %]
9 <title>Koha › Patrons › Collect fine payment for [% patron.firstname | html %] [% patron.surname | html %]</title>
10 [% INCLUDE 'doc-head-close.inc' %]
13 <body id="pat_paycollect" class="pat">
14 [% INCLUDE 'header.inc' %]
15 [% INCLUDE 'patron-search.inc' %]
16 <div id="breadcrumbs">
17 <a href="/cgi-bin/koha/mainpage.pl">Home</a> ›
18 <a href="/cgi-bin/koha/members/members-home.pl">Patrons</a> ›
19 <a href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% patron.borrowernumber | uri %]">Pay fines for [% patron.firstname | html %] [% patron.surname | html %]</a> ›
20 [% IF ( pay_individual ) %]Pay an individual fine
21 [% ELSIF ( writeoff_individual ) %]Write off an individual fine
23 [% IF ( selected_accts ) %]
24 [% IF type == 'writeoff' %]Write off an amount toward selected fines
25 [% ELSE %]Pay an amount toward selected fines
27 [% ELSE %]Pay an amount toward all fines
32 <div class="main container-fluid">
34 <div class="col-sm-10 col-sm-push-2">
37 [% INCLUDE 'members-toolbar.inc' borrowernumber=patron.borrowernumber %]
40 <!-- The manual invoice and credit buttons -->
41 <div class="statictabs">
44 <a href="/cgi-bin/koha/members/boraccount.pl?borrowernumber=[% patron.borrowernumber | uri %]">Transactions</a>
47 <a href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% patron.borrowernumber | uri %]" >Make a payment</a>
50 <a href="/cgi-bin/koha/members/maninvoice.pl?borrowernumber=[% patron.borrowernumber | uri %]" >Create manual invoice</a>
53 <a href="/cgi-bin/koha/members/mancredit.pl?borrowernumber=[% patron.borrowernumber | uri %]" >Create manual credit</a>
56 <div class="tabs-container">
57 [% IF ( error_over ) %]
58 <div id="error_message" class="dialog alert">
59 You must pay a value less than or equal to [% total_due | format('%.2f') %].
63 [% IF ( pay_individual ) %]
64 [% IF ( error_registers ) %]
65 <div id="error_message" class="dialog alert">
66 You must have at least one cash register associated with this branch before you can record payments.
70 <form name="payindivfine" id="payindivfine" method="post" action="/cgi-bin/koha/members/paycollect.pl">
71 <input type="hidden" name="csrf_token" value="[% csrf_token | html %]" />
72 <input type="hidden" name="borrowernumber" id="borrowernumber" value="[% patron.borrowernumber | html %]" />
73 <input type="hidden" name="pay_individual" id="pay_individual" value="[% pay_individual | html %]" />
74 <input type="hidden" name="itemnumber" id="itemnumber" value="[% itemnumber | html %]" />
75 <input type="hidden" name="description" id="description" value="[% description | html %]" />
76 <input type="hidden" name="accounttype" id="accounttype" value="[% accounttype | html %]" />
77 <input type="hidden" name="amount" id="amount" value="[% amount | html %]" />
78 <input type="hidden" name="amountoutstanding" id="amountoutstanding" value="[% amountoutstanding | html %]" />
79 <input type="hidden" name="accountlines_id" id="accountlines_id" value="[% accountlines_id | html %]" />
80 <input type="hidden" name="title" id="title" value="[% title | html %]" />
82 <fieldset class="rows">
83 <legend>Pay an individual fine</legend>
84 <input type="hidden" name="payment_note" id="payment_note" value="[% payment_note | html %]" />
90 <th>Amount outstanding</th>
93 <tr><td colspan="3">Total amount payable:</td><td>[% amountoutstanding | format('%.2f') %]</td></tr>
97 [% individual_description | html %]
99 <td>[% accounttype | html %]</td>
100 <td class="debit">[% amount | format('%.2f') %]</td>
101 <td class="debit">[% amountoutstanding | format('%.2f') %]</td>
108 <label for="paid">Amount being paid: </label>
109 <input name="paid" id="paid" value="[% amountoutstanding | $Price on_editing => 1 %]"/>
112 <label for="collected">Collected from patron: </label>
113 <input id="collected" value="[% amountoutstanding | $Price on_editing => 1 %]"/>
116 <label>Change to give: </label>
117 <span id="change">0.00</span>
119 [% SET payment_types = AuthorisedValues.GetAuthValueDropbox('PAYMENT_TYPE') %]
120 [% IF payment_types %]
122 <label for="payment_type">Payment type: </label>
123 <select name="payment_type" id="payment_type">
124 <option value=""></option>
125 [% FOREACH pt IN payment_types %]
126 <option value="[% pt.authorised_value | html %]">[% pt.lib | html %]</option>
131 [% IF Koha.Preference('UseCashRegisters') %]
133 <label for="cash_register">Cash register: </label>
134 <select name="cash_register" id="cash_register">
135 [% FOREACH register IN registers %]
136 [% IF register.id == registerid %]
137 <option value="[% register.id %]" selected="selected">[% register.name | html %]</option>
139 <option value="[% register.id %]">[% register.name | html %]</option>
149 <input type="submit" name="submitbutton" value="Confirm" />
150 <a class="cancel" href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% patron.borrowernumber | html %]">Cancel</a>
154 [% ELSIF ( writeoff_individual ) %]
155 <form name="woindivfine" id="woindivfine" action="/cgi-bin/koha/members/pay.pl" method="post" >
156 <input type="hidden" name="csrf_token" value="[% csrf_token | html %]" />
157 <fieldset class="rows">
158 <legend>Write off an individual fine</legend>
159 <input type="hidden" name="borrowernumber" id="borrowernumber" value="[% patron.borrowernumber | html %]" />
160 <input type="hidden" name="pay_individual" id="pay_individual" value="[% pay_individual | html %]" />
161 <input type="hidden" name="itemnumber" id="itemnumber" value="[% itemnumber | html %]" />
162 <input type="hidden" name="description" id="description" value="[% description | html %]" />
163 <input type="hidden" name="accounttype" id="accounttype" value="[% accounttype | html %]" />
164 <input type="hidden" name="amount" id="amount" value="[% amount | html %]" />
165 <input type="hidden" name="accountlines_id" id="accountlines_id" value="[% accountlines_id | html %]" />
166 <input type="hidden" name="title" id="title" value="[% title | html %]" />
167 <input type="hidden" name="payment_note" id="payment_note" value="[% payment_note | html %]" />
168 <input type="hidden" name="amountoutstanding" id="amountoutstanding" value="[% amountoutstanding | html %]" />
169 <input type="hidden" name="confirm_writeoff" id="confirm_writeoff" value="1" />
173 <th>Account type</th>
175 <th>Amount outstanding</th>
177 <tfoot><tr><td colspan="3">Total amount outstanding:</td><td>[% amountoutstanding | format('%.2f') %]</td></tr></tfoot>
179 <td>[% description | html %] [% title | html %]</td>
180 <td>[% accounttype | html %]</td>
181 <td class="debit">[% amount | format('%.2f') %]</td>
182 <td class="debit">[% amountoutstanding | format('%.2f') %]</td>
188 <label for="paid">Writeoff amount: </label>
189 <!-- default to writing off all -->
190 <input name="amountwrittenoff" id="amountwrittenoff" value="[% amountoutstanding | $Price on_editing => 1 %]" type="text" />
195 <input type="submit" value="Write off this charge" />
196 <a class="cancel" href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% patron.borrowernumber | html %]">Cancel</a>
200 [% IF ( error_registers && type != 'writeoff' ) %]
201 <div id="error_message" class="dialog alert">
202 You must have at least one cash register associated with this branch before you can record payments.
206 <form name="payfine" id="payfine" method="post" action="/cgi-bin/koha/members/paycollect.pl">
207 <input type="hidden" name="csrf_token" value="[% csrf_token | html %]" />
208 <input type="hidden" name="borrowernumber" id="borrowernumber" value="[% patron.borrowernumber | html %]" />
209 <input type="hidden" name="selected_accts" id="selected_accts" value="[% selected_accts | html %]" />
210 <input type="hidden" name="total" id="total" value="[% total | html %]" />
211 <input type="hidden" name="type" value="[% type | html %]" />
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 <label for="paid">Amount paid :</label>
231 <input name="paid" id="paid" value="[% total | $Price on_editing => 1 %]"/>
234 [% IF type == 'writeoff' %]
235 <label for="collected">Writeoff amount: </label>
237 <label for="collected">Collect from patron: </label>
239 <input id="collected" value="[% total | $Price on_editing => 1 %]"/>
242 <label>Change to give: </label>
243 <span id="change">0.00</span>
246 [% IF type != 'writeoff' %]
247 [% SET payment_types = AuthorisedValues.GetAuthValueDropbox('PAYMENT_TYPE') %]
248 [% IF payment_types %]
250 <label for="payment_type">Payment type: </label>
251 <select name="payment_type" id="payment_type">
252 <option value=""></option>
253 [% FOREACH pt IN payment_types %]
254 <option value="[% pt.authorised_value | html %]">[% pt.lib | html %]</option>
260 [% IF Koha.Preference('UseCashRegisters') %]
262 <label for="cash_register">Cash register: </label>
263 <select name="cash_register" id="cash_register">
264 [% FOREACH register IN registers %]
265 [% IF register.id == registerid %]
266 <option value="[% register.id %]" selected="selected">[% register.name | html %]</option>
268 <option value="[% register.id %]">[% register.name | html %]</option>
277 <label for="selected_accts_notes">Note: </label>
278 <textarea name="selected_accts_notes" id="selected_accts_notes">[% selected_accts_notes | html %]</textarea>
283 <input type="submit" name="submitbutton" value="Confirm" />
284 <a class="cancel" href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% patron.borrowernumber | html %]">Cancel</a>
292 </div> <!-- /.col-sm-10.col-sm-push-2 -->
294 <div class="col-sm-2 col-sm-pull-10">
296 [% INCLUDE 'circ-menu.inc' %]
298 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
299 </div> <!-- /.row -->
302 <div id="confirm_change_form" class="modal" tabindex="-1" role="dialog" aria-hidden="true">
303 <div class="modal-dialog">
304 <div class="modal-content">
305 <div class="modal-header">
306 <h3>The amount collected is more than the outstanding charge</h3>
308 <div class="modal-body">
309 <p>The amount collected from the patron is higher than the amount to be paid.</p>
310 <p>The change to give is <b><span id="modal_change">0.00</span></b>.</p>
311 <p>Confirm this payment?</p>
313 <div class="modal-footer">
314 <button class="btn btn-default approve" id="modal_submit" type="button"><i class="fa fa-check"></i> Yes</button>
315 <button class="btn btn-default deny cancel" href="#" data-dismiss="modal" aria-hidden="true"><i class="fa fa-times"></i> No</button>
321 [% MACRO jsinclude BLOCK %]
322 [% INCLUDE 'str/members-menu.inc' %]
323 [% Asset.js("js/members-menu.js") | $raw %]
325 $(document).ready(function() {
326 [% IF payment_id && Koha.Preference('FinePaymentAutoPopup') %]
327 window.open('/cgi-bin/koha/members/printfeercpt.pl?action=print&accountlines_id=[% payment_id | html %]&borrowernumber=[% patron.borrowernumber | html %]', '_blank');
330 var forms = $('#payindivfine, #payfine');
331 var change = $('#change')[0];
333 $('#payindivfine, #payfine').preventDoubleFormSubmit();
334 $("#paid, #collected").on("change",function() {
336 if (change != undefined) {
337 updateChangeValues();
341 if (change != undefined) {
342 forms.on("submit", function(e) {
343 if (change.innerHTML > 0.00) {
345 $("#confirm_change_form").modal("show");
352 $("#confirm_change_form").on("hidden.bs.modal", function(){
353 // remove class added by preventDoubleFormSubmit if necessary
354 $("body, form input[type='submit'], form button[type='submit'], form a").removeClass('waiting');
357 $('#modal_submit').click(function() {
363 $('#woindivfine').on('submit', function(e){
364 if ( prevent_default ) {
367 let amount_outstanding = parseFloat( $('#amountoutstanding').attr('value') );
368 let amount_writeoff = parseFloat( $('#amountwrittenoff').attr('value') );
369 if ( amount_writeoff > amount_outstanding ) {
370 alert(_("You are attemping to writeoff more than the value of the fee."));
371 $('#woindivfine').beenSubmitted = false;
374 $('#woindivfine').preventDoubleFormSubmit();
375 $('#woindivfine').submit();
380 function moneyFormat(textObj) {
381 var newValue = textObj.value;
387 for(i=0; i < newValue.length; i++) {
388 aChar = newValue.substring(i, i+1);
389 if (aChar >= "0" && aChar <= "9") {
391 decAmount = "" + decAmount + aChar;
394 dolAmount = "" + dolAmount + aChar;
406 if (dolAmount == "") {
410 if (dolAmount.length > 1) {
411 while(dolAmount.length > 1 && dolAmount.substring(0,1) == "0") {
412 dolAmount = dolAmount.substring(1,dolAmount.length);
415 if (decAmount.length > 2) {
416 decAmount = decAmount.substring(0,2);
419 if (decAmount.length == 1) {
420 decAmount = decAmount + "0";
422 if (decAmount.length == 0) {
423 decAmount = decAmount + "00";
426 textObj.value = dolAmount + "." + decAmount;
429 function updateChangeValues() {
430 var change = $('#change')[0];
431 change.innerHTML = Math.round(($('#collected')[0].value - $('#paid')[0].value) * 100) / 100;
432 if (change.innerHTML <= 0) {
433 change.innerHTML = "0.00";
435 change.value = change.innerHTML;
437 change.innerHTML = change.value;
440 $('#modal_change').html(change.innerHTML);
445 [% INCLUDE 'intranet-bottom.inc' %]