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') %].
68 [% IF ( error_under ) %]
69 <div id="error_message" class="dialog alert">
70 You must collect a value greater than or equal to [% total_paid | format('%.2f') %].
74 [% IF ( pay_individual ) %]
75 [% IF ( error_registers ) %]
76 <div id="error_message" class="dialog alert">
77 You must have at least one cash register associated with this branch before you can record payments.
81 <form name="payindivfine" id="payindivfine" method="post" action="/cgi-bin/koha/members/paycollect.pl">
82 <input type="hidden" name="csrf_token" value="[% csrf_token | html %]" />
83 <input type="hidden" name="borrowernumber" id="borrowernumber" value="[% patron.borrowernumber | html %]" />
84 <input type="hidden" name="pay_individual" id="pay_individual" value="[% pay_individual | html %]" />
85 <input type="hidden" name="itemnumber" id="itemnumber" value="[% itemnumber | html %]" />
86 <input type="hidden" name="description" id="description" value="[% description | html %]" />
87 <input type="hidden" name="debit_type_code" id="debit_type_code" value="[% debit_type_code | html %]" />
88 <input type="hidden" name="amount" id="amount" value="[% amount | html %]" />
89 <input type="hidden" name="amountoutstanding" id="amountoutstanding" value="[% amountoutstanding | html %]" />
90 <input type="hidden" name="accountlines_id" id="accountlines_id" value="[% accountlines_id | html %]" />
91 <input type="hidden" name="title" id="title" value="[% title | html %]" />
92 <input type="hidden" name="change_given" id="change_given" />
94 <fieldset class="rows">
95 <legend>Pay an individual fine</legend>
96 <input type="hidden" name="payment_note" id="payment_note" value="[% payment_note | html %]" />
100 <th>Account type</th>
102 <th>Amount outstanding</th>
105 <tr><td colspan="3">Total amount payable:</td><td>[% amountoutstanding | format('%.2f') %]</td></tr>
109 [% individual_description | html %]
111 <td>[% debit_type_code | html %]</td>
112 <td class="debit">[% amount | format('%.2f') %]</td>
113 <td class="debit">[% amountoutstanding | format('%.2f') %]</td>
120 <label for="paid">Amount being paid: </label>
121 <input name="paid" id="paid" type="text" step="0.01" value="[% amountoutstanding | $Price on_editing => 1 %]"/>
124 <label for="collected">Collected from patron: </label>
125 <input name="collected" id="collected" type="text" step="0.01" value="[% amountoutstanding | $Price on_editing => 1 %]"/>
128 <label>Change to give: </label>
129 <span id="change">0.00</span>
132 [% PROCESS account_payment_types %]
134 [% IF Koha.Preference('UseCashRegisters') %]
136 <label for="cash_register">Cash register: </label>
137 <select name="cash_register" id="cash_register">
138 [% FOREACH register IN registers %]
139 [% IF register.id == registerid %]
140 <option value="[% register.id | html %]" selected="selected">[% register.name | html %]</option>
142 <option value="[% register.id | html %]">[% register.name | html %]</option>
152 <input type="submit" name="submitbutton" value="Confirm" />
153 <a class="cancel" href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% patron.borrowernumber | html %]">Cancel</a>
157 [% ELSIF ( writeoff_individual ) %]
158 <form name="woindivfine" id="woindivfine" action="/cgi-bin/koha/members/pay.pl" method="post" >
159 <input type="hidden" name="csrf_token" value="[% csrf_token | html %]" />
160 <fieldset class="rows">
161 <legend>Write off an individual fine</legend>
162 <input type="hidden" name="borrowernumber" id="borrowernumber" value="[% patron.borrowernumber | html %]" />
163 <input type="hidden" name="pay_individual" id="pay_individual" value="[% pay_individual | html %]" />
164 <input type="hidden" name="itemnumber" id="itemnumber" value="[% itemnumber | html %]" />
165 <input type="hidden" name="description" id="description" value="[% description | html %]" />
166 <input type="hidden" name="debit_type_code" id="debit_type_code" value="[% debit_type_code | html %]" />
167 <input type="hidden" name="amount" id="amount" value="[% amount | html %]" />
168 <input type="hidden" name="accountlines_id" id="accountlines_id" value="[% accountlines_id | html %]" />
169 <input type="hidden" name="title" id="title" value="[% title | html %]" />
170 <input type="hidden" name="payment_note" id="payment_note" value="[% payment_note | html %]" />
171 <input type="hidden" name="amountoutstanding" id="amountoutstanding" value="[% amountoutstanding | html %]" />
172 <input type="hidden" name="confirm_writeoff" id="confirm_writeoff" value="1" />
173 <input type="hidden" name="change_given" id="change_given" />
177 <th>Account type</th>
179 <th>Amount outstanding</th>
181 <tfoot><tr><td colspan="3">Total amount outstanding:</td><td>[% amountoutstanding | format('%.2f') %]</td></tr></tfoot>
183 <td>[% individual_description | html %]</td>
184 <td>[% debit_type_code | html %]</td>
185 <td class="debit">[% amount | format('%.2f') %]</td>
186 <td class="debit">[% amountoutstanding | format('%.2f') %]</td>
192 <label for="paid">Writeoff amount: </label>
193 <!-- default to writing off all -->
194 <input name="amountwrittenoff" id="amountwrittenoff" value="[% amountoutstanding | $Price on_editing => 1 %]" type="text" />
199 <input type="submit" value="Write off this charge" />
200 <a class="cancel" href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% patron.borrowernumber | html %]">Cancel</a>
204 [% IF ( error_registers && type != 'writeoff' ) %]
205 <div id="error_message" class="dialog alert">
206 You must have at least one cash register associated with this branch before you can record payments.
210 <form name="payfine" id="payfine" method="post" action="/cgi-bin/koha/members/paycollect.pl">
211 <input type="hidden" name="csrf_token" value="[% csrf_token | html %]" />
212 <input type="hidden" name="borrowernumber" id="borrowernumber" value="[% patron.borrowernumber | html %]" />
213 <input type="hidden" name="selected_accts" id="selected_accts" value="[% selected_accts | html %]" />
214 <input type="hidden" name="total" id="total" value="[% total | html %]" />
215 <input type="hidden" name="type" value="[% type | html %]" />
216 <input type="hidden" name="change_given" id="change_given" />
218 <fieldset class="rows">
219 [% IF ( selected_accts ) %]
220 [% IF type == 'WRITEOFF' %]
221 <legend>Write off an amount toward selected fines</legend>
223 <legend>Pay an amount toward selected fines</legend>
226 <legend>Pay an amount toward all fines</legend>
231 <span class="label">Total amount outstanding: </span>
232 <span class="debit">[% total | format('%.2f') %]</span>
235 [% IF type == 'WRITEOFF' %]
236 <label for="paid">Writeoff amount: </label>
238 <label for="paid">Amount being paid: </label>
240 <input name="paid" id="paid" type="text" step="0.01" value="[% total | $Price on_editing => 1 %]"/>
242 [% IF type != 'WRITEOFF' %]
244 <label for="collected">Collected from patron: </label>
245 <input name="collected" id="collected" type="text" step="0.01" value="[% total | $Price on_editing => 1 %]"/>
248 <label>Change to give: </label>
249 <span id="change">0.00</span>
252 [% PROCESS account_payment_types %]
254 [% IF Koha.Preference('UseCashRegisters') %]
256 <label for="cash_register">Cash register: </label>
257 <select name="cash_register" id="cash_register">
258 [% FOREACH register IN registers %]
259 [% IF register.id == registerid %]
260 <option value="[% register.id | html %]" selected="selected">[% register.name | html %]</option>
262 <option value="[% register.id | html %]">[% register.name | html %]</option>
271 <label for="selected_accts_notes">Note: </label>
272 <textarea name="selected_accts_notes" id="selected_accts_notes">[% selected_accts_notes | html %]</textarea>
277 <input type="submit" name="submitbutton" value="Confirm" />
278 <a class="cancel" href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% patron.borrowernumber | html %]">Cancel</a>
286 </div> <!-- /.col-sm-10.col-sm-push-2 -->
288 <div class="col-sm-2 col-sm-pull-10">
290 [% INCLUDE 'circ-menu.inc' %]
292 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
293 </div> <!-- /.row -->
296 <div id="confirm_change_form" class="modal" tabindex="-1" role="dialog" aria-hidden="true">
297 <div class="modal-dialog">
298 <div class="modal-content">
299 <div class="modal-header">
300 <h3>The amount collected is more than the outstanding charge</h3>
302 <div class="modal-body">
303 <p>The amount collected from the patron is higher than the amount to be paid.</p>
304 <p>The change to give is <b><span id="modal_change">0.00</span></b>.</p>
305 <p>Confirm this payment?</p>
307 <div class="modal-footer">
308 <button class="btn btn-default approve" id="modal_submit" type="button"><i class="fa fa-check"></i> Yes</button>
309 <button class="btn btn-default deny cancel" href="#" data-dismiss="modal" aria-hidden="true"><i class="fa fa-times"></i> No</button>
315 [% MACRO jsinclude BLOCK %]
316 [% INCLUDE 'str/members-menu.inc' %]
317 [% Asset.js("js/members-menu.js") | $raw %]
319 $(document).ready(function() {
320 [% IF payment_id && Koha.Preference('FinePaymentAutoPopup') %]
321 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');
324 var forms = $('#payindivfine, #payfine');
325 var change = $('#change')[0];
327 $('#payindivfine, #payfine').preventDoubleFormSubmit();
328 $("#paid, #collected").on("change",function() {
330 if (change != undefined) {
331 updateChangeValues();
335 if (change != undefined) {
336 forms.on("submit", function(e) {
337 if (change.innerHTML > 0.00) {
339 $("#confirm_change_form").modal("show");
346 $("#confirm_change_form").on("hidden.bs.modal", function(){
347 // remove class added by preventDoubleFormSubmit if necessary
348 $("body, form input[type='submit'], form button[type='submit'], form a").removeClass('waiting');
351 $('#modal_submit').click(function() {
355 $( "#payindivfine, #payfine" ).validate({
357 paid: { required: true },
366 $('#woindivfine').on('submit', function(e){
367 if ( prevent_default ) {
370 let amount_outstanding = parseFloat( $('#amountoutstanding').attr('value') );
371 let amount_writeoff = parseFloat( $('#amountwrittenoff').attr('value') );
372 if ( amount_writeoff > amount_outstanding ) {
373 alert(_("You are attemping to writeoff more than the value of the fee."));
374 $('#woindivfine').beenSubmitted = false;
377 $('#woindivfine').preventDoubleFormSubmit();
378 $('#woindivfine').submit();
383 function moneyFormat(textObj) {
384 var newValue = textObj.value;
390 for(i=0; i < newValue.length; i++) {
391 aChar = newValue.substring(i, i+1);
392 if (aChar >= "0" && aChar <= "9") {
394 decAmount = "" + decAmount + aChar;
397 dolAmount = "" + dolAmount + aChar;
409 if (dolAmount == "") {
413 if (dolAmount.length > 1) {
414 while(dolAmount.length > 1 && dolAmount.substring(0,1) == "0") {
415 dolAmount = dolAmount.substring(1,dolAmount.length);
418 if (decAmount.length > 2) {
419 decAmount = decAmount.substring(0,2);
422 if (decAmount.length == 1) {
423 decAmount = decAmount + "0";
425 if (decAmount.length == 0) {
426 decAmount = decAmount + "00";
429 textObj.value = dolAmount + "." + decAmount;
432 function updateChangeValues() {
433 var change = $('#change')[0];
434 change.innerHTML = Math.round(($('#collected')[0].value - $('#paid')[0].value) * 100) / 100;
435 if (change.innerHTML <= 0) {
436 var paid = $('#paid')[0];
438 $('#collected').rules( "add", { min: Number(paid.value) });
439 $( "#payindivfine, #payfine" ).valid();
440 change.innerHTML = "0.00";
441 $('input[name="change_given"]').val('0.00');
443 change.value = change.innerHTML;
445 change.innerHTML = change.value;
446 $('input[name="change_given"]').val(change.value);
449 $('#modal_change').html(change.innerHTML);
454 [% INCLUDE 'intranet-bottom.inc' %]