5 [% USE AuthorisedValues %]
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>
126 [% SET payment_types = AuthorisedValues.GetAuthValueDropbox('PAYMENT_TYPE') %]
127 [% SET excluded = ['SIP00', 'SIP01', 'SIP02'] %]
128 [% IF payment_types.size > 3 %]
130 <label for="payment_type">Payment type: </label>
131 <select name="payment_type" id="payment_type">
132 <option value=""></option>
133 [% FOREACH pt IN payment_types %]
134 [% UNLESS excluded.grep("^$pt.authorised_value\$").size %]
135 <option value="[% pt.authorised_value | html %]">[% pt.lib | html %]</option>
141 [% IF Koha.Preference('UseCashRegisters') %]
143 <label for="cash_register">Cash register: </label>
144 <select name="cash_register" id="cash_register">
145 [% FOREACH register IN registers %]
146 [% IF register.id == registerid %]
147 <option value="[% register.id | html %]" selected="selected">[% register.name | html %]</option>
149 <option value="[% register.id | html %]">[% register.name | html %]</option>
159 <input type="submit" name="submitbutton" value="Confirm" />
160 <a class="cancel" href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% patron.borrowernumber | html %]">Cancel</a>
164 [% ELSIF ( writeoff_individual ) %]
165 <form name="woindivfine" id="woindivfine" action="/cgi-bin/koha/members/pay.pl" method="post" >
166 <input type="hidden" name="csrf_token" value="[% csrf_token | html %]" />
167 <fieldset class="rows">
168 <legend>Write off an individual fine</legend>
169 <input type="hidden" name="borrowernumber" id="borrowernumber" value="[% patron.borrowernumber | html %]" />
170 <input type="hidden" name="pay_individual" id="pay_individual" value="[% pay_individual | html %]" />
171 <input type="hidden" name="itemnumber" id="itemnumber" value="[% itemnumber | html %]" />
172 <input type="hidden" name="description" id="description" value="[% description | html %]" />
173 <input type="hidden" name="debit_type_code" id="debit_type_code" value="[% debit_type_code | html %]" />
174 <input type="hidden" name="amount" id="amount" value="[% amount | html %]" />
175 <input type="hidden" name="accountlines_id" id="accountlines_id" value="[% accountlines_id | html %]" />
176 <input type="hidden" name="title" id="title" value="[% title | html %]" />
177 <input type="hidden" name="payment_note" id="payment_note" value="[% payment_note | html %]" />
178 <input type="hidden" name="amountoutstanding" id="amountoutstanding" value="[% amountoutstanding | html %]" />
179 <input type="hidden" name="confirm_writeoff" id="confirm_writeoff" value="1" />
180 <input type="hidden" name="change_given" id="change_given" />
184 <th>Account type</th>
186 <th>Amount outstanding</th>
188 <tfoot><tr><td colspan="3">Total amount outstanding:</td><td>[% amountoutstanding | format('%.2f') %]</td></tr></tfoot>
190 <td>[% individual_description | html %]</td>
191 <td>[% debit_type_code | html %]</td>
192 <td class="debit">[% amount | format('%.2f') %]</td>
193 <td class="debit">[% amountoutstanding | format('%.2f') %]</td>
199 <label for="paid">Writeoff amount: </label>
200 <!-- default to writing off all -->
201 <input name="amountwrittenoff" id="amountwrittenoff" value="[% amountoutstanding | $Price on_editing => 1 %]" type="text" />
206 <input type="submit" value="Write off this charge" />
207 <a class="cancel" href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% patron.borrowernumber | html %]">Cancel</a>
211 [% IF ( error_registers && type != 'writeoff' ) %]
212 <div id="error_message" class="dialog alert">
213 You must have at least one cash register associated with this branch before you can record payments.
217 <form name="payfine" id="payfine" method="post" action="/cgi-bin/koha/members/paycollect.pl">
218 <input type="hidden" name="csrf_token" value="[% csrf_token | html %]" />
219 <input type="hidden" name="borrowernumber" id="borrowernumber" value="[% patron.borrowernumber | html %]" />
220 <input type="hidden" name="selected_accts" id="selected_accts" value="[% selected_accts | html %]" />
221 <input type="hidden" name="total" id="total" value="[% total | html %]" />
222 <input type="hidden" name="type" value="[% type | html %]" />
223 <input type="hidden" name="change_given" id="change_given" />
225 <fieldset class="rows">
226 [% IF ( selected_accts ) %]
227 [% IF type == 'WRITEOFF' %]
228 <legend>Write off an amount toward selected fines</legend>
230 <legend>Pay an amount toward selected fines</legend>
233 <legend>Pay an amount toward all fines</legend>
238 <span class="label">Total amount outstanding: </span>
239 <span class="debit">[% total | format('%.2f') %]</span>
242 [% IF type == 'WRITEOFF' %]
243 <label for="paid">Writeoff amount:</label>
245 <label for="paid">Amount paid: </label>
247 <input name="paid" id="paid" value="[% total | $Price on_editing => 1 %]"/>
250 [% IF type != 'WRITEOFF' %]
252 <label for="collected">Collected from patron: </label>
253 <input id="collected" value="[% total | $Price on_editing => 1 %]"/>
256 <label>Change to give: </label>
257 <span id="change">0.00</span>
259 [% SET payment_types = AuthorisedValues.GetAuthValueDropbox('PAYMENT_TYPE') %]
260 [% SET excluded = ['SIP00', 'SIP01', 'SIP02'] %]
261 [% IF payment_types.size > 3 %]
263 <label for="payment_type">Payment type: </label>
264 <select name="payment_type" id="payment_type">
265 <option value=""></option>
266 [% FOREACH pt IN payment_types %]
267 [% UNLESS excluded.grep("^$pt.authorised_value\$").size %]
268 <option value="[% pt.authorised_value | html %]">[% pt.lib | html %]</option>
275 [% IF Koha.Preference('UseCashRegisters') %]
277 <label for="cash_register">Cash register: </label>
278 <select name="cash_register" id="cash_register">
279 [% FOREACH register IN registers %]
280 [% IF register.id == registerid %]
281 <option value="[% register.id | html %]" selected="selected">[% register.name | html %]</option>
283 <option value="[% register.id | html %]">[% register.name | html %]</option>
292 <label for="selected_accts_notes">Note: </label>
293 <textarea name="selected_accts_notes" id="selected_accts_notes">[% selected_accts_notes | html %]</textarea>
298 <input type="submit" name="submitbutton" value="Confirm" />
299 <a class="cancel" href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% patron.borrowernumber | html %]">Cancel</a>
307 </div> <!-- /.col-sm-10.col-sm-push-2 -->
309 <div class="col-sm-2 col-sm-pull-10">
311 [% INCLUDE 'circ-menu.inc' %]
313 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
314 </div> <!-- /.row -->
317 <div id="confirm_change_form" class="modal" tabindex="-1" role="dialog" aria-hidden="true">
318 <div class="modal-dialog">
319 <div class="modal-content">
320 <div class="modal-header">
321 <h3>The amount collected is more than the outstanding charge</h3>
323 <div class="modal-body">
324 <p>The amount collected from the patron is higher than the amount to be paid.</p>
325 <p>The change to give is <b><span id="modal_change">0.00</span></b>.</p>
326 <p>Confirm this payment?</p>
328 <div class="modal-footer">
329 <button class="btn btn-default approve" id="modal_submit" type="button"><i class="fa fa-check"></i> Yes</button>
330 <button class="btn btn-default deny cancel" href="#" data-dismiss="modal" aria-hidden="true"><i class="fa fa-times"></i> No</button>
336 [% MACRO jsinclude BLOCK %]
337 [% INCLUDE 'str/members-menu.inc' %]
338 [% Asset.js("js/members-menu.js") | $raw %]
340 $(document).ready(function() {
341 [% IF payment_id && Koha.Preference('FinePaymentAutoPopup') %]
342 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');
345 var forms = $('#payindivfine, #payfine');
346 var change = $('#change')[0];
348 $('#payindivfine, #payfine').preventDoubleFormSubmit();
349 $("#paid, #collected").on("change",function() {
351 if (change != undefined) {
352 updateChangeValues();
356 if (change != undefined) {
357 forms.on("submit", function(e) {
358 if (change.innerHTML > 0.00) {
360 $("#confirm_change_form").modal("show");
367 $("#confirm_change_form").on("hidden.bs.modal", function(){
368 // remove class added by preventDoubleFormSubmit if necessary
369 $("body, form input[type='submit'], form button[type='submit'], form a").removeClass('waiting');
372 $('#modal_submit').click(function() {
378 $('#woindivfine').on('submit', function(e){
379 if ( prevent_default ) {
382 let amount_outstanding = parseFloat( $('#amountoutstanding').attr('value') );
383 let amount_writeoff = parseFloat( $('#amountwrittenoff').attr('value') );
384 if ( amount_writeoff > amount_outstanding ) {
385 alert(_("You are attemping to writeoff more than the value of the fee."));
386 $('#woindivfine').beenSubmitted = false;
389 $('#woindivfine').preventDoubleFormSubmit();
390 $('#woindivfine').submit();
395 function moneyFormat(textObj) {
396 var newValue = textObj.value;
402 for(i=0; i < newValue.length; i++) {
403 aChar = newValue.substring(i, i+1);
404 if (aChar >= "0" && aChar <= "9") {
406 decAmount = "" + decAmount + aChar;
409 dolAmount = "" + dolAmount + aChar;
421 if (dolAmount == "") {
425 if (dolAmount.length > 1) {
426 while(dolAmount.length > 1 && dolAmount.substring(0,1) == "0") {
427 dolAmount = dolAmount.substring(1,dolAmount.length);
430 if (decAmount.length > 2) {
431 decAmount = decAmount.substring(0,2);
434 if (decAmount.length == 1) {
435 decAmount = decAmount + "0";
437 if (decAmount.length == 0) {
438 decAmount = decAmount + "00";
441 textObj.value = dolAmount + "." + decAmount;
444 function updateChangeValues() {
445 var change = $('#change')[0];
446 change.innerHTML = Math.round(($('#collected')[0].value - $('#paid')[0].value) * 100) / 100;
447 if (change.innerHTML <= 0) {
448 change.innerHTML = "0.00";
449 $('input[name="change_given"]').val('0.00');
451 change.value = change.innerHTML;
453 change.innerHTML = change.value;
454 $('input[name="change_given"]').val(change.value);
457 $('#modal_change').html(change.innerHTML);
462 [% INCLUDE 'intranet-bottom.inc' %]