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 = [] %]
127 [% FOR pt IN AuthorisedValues.GetAuthValueDropbox('PAYMENT_TYPE') %]
128 [% NEXT IF pt.authorised_value.grep("^SIP[[:digit:]]{2}$").size() %]
129 [% payment_types.push(pt) %]
131 [% IF payment_types.size > 0 %]
133 <label for="payment_type">Payment type: </label>
134 <select name="payment_type" id="payment_type">
135 <option value=""></option>
136 [% FOREACH pt IN payment_types %]
137 <option value="[% pt.authorised_value | html %]">[% pt.lib | html %]</option>
142 [% IF Koha.Preference('UseCashRegisters') %]
144 <label for="cash_register">Cash register: </label>
145 <select name="cash_register" id="cash_register">
146 [% FOREACH register IN registers %]
147 [% IF register.id == registerid %]
148 <option value="[% register.id | html %]" selected="selected">[% register.name | html %]</option>
150 <option value="[% register.id | html %]">[% register.name | html %]</option>
160 <input type="submit" name="submitbutton" value="Confirm" />
161 <a class="cancel" href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% patron.borrowernumber | html %]">Cancel</a>
165 [% ELSIF ( writeoff_individual ) %]
166 <form name="woindivfine" id="woindivfine" action="/cgi-bin/koha/members/pay.pl" method="post" >
167 <input type="hidden" name="csrf_token" value="[% csrf_token | html %]" />
168 <fieldset class="rows">
169 <legend>Write off an individual fine</legend>
170 <input type="hidden" name="borrowernumber" id="borrowernumber" value="[% patron.borrowernumber | html %]" />
171 <input type="hidden" name="pay_individual" id="pay_individual" value="[% pay_individual | html %]" />
172 <input type="hidden" name="itemnumber" id="itemnumber" value="[% itemnumber | html %]" />
173 <input type="hidden" name="description" id="description" value="[% description | html %]" />
174 <input type="hidden" name="debit_type_code" id="debit_type_code" value="[% debit_type_code | html %]" />
175 <input type="hidden" name="amount" id="amount" value="[% amount | html %]" />
176 <input type="hidden" name="accountlines_id" id="accountlines_id" value="[% accountlines_id | html %]" />
177 <input type="hidden" name="title" id="title" value="[% title | html %]" />
178 <input type="hidden" name="payment_note" id="payment_note" value="[% payment_note | html %]" />
179 <input type="hidden" name="amountoutstanding" id="amountoutstanding" value="[% amountoutstanding | html %]" />
180 <input type="hidden" name="confirm_writeoff" id="confirm_writeoff" value="1" />
181 <input type="hidden" name="change_given" id="change_given" />
185 <th>Account type</th>
187 <th>Amount outstanding</th>
189 <tfoot><tr><td colspan="3">Total amount outstanding:</td><td>[% amountoutstanding | format('%.2f') %]</td></tr></tfoot>
191 <td>[% individual_description | html %]</td>
192 <td>[% debit_type_code | html %]</td>
193 <td class="debit">[% amount | format('%.2f') %]</td>
194 <td class="debit">[% amountoutstanding | format('%.2f') %]</td>
200 <label for="paid">Writeoff amount: </label>
201 <!-- default to writing off all -->
202 <input name="amountwrittenoff" id="amountwrittenoff" value="[% amountoutstanding | $Price on_editing => 1 %]" type="text" />
207 <input type="submit" value="Write off this charge" />
208 <a class="cancel" href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% patron.borrowernumber | html %]">Cancel</a>
212 [% IF ( error_registers && type != 'writeoff' ) %]
213 <div id="error_message" class="dialog alert">
214 You must have at least one cash register associated with this branch before you can record payments.
218 <form name="payfine" id="payfine" method="post" action="/cgi-bin/koha/members/paycollect.pl">
219 <input type="hidden" name="csrf_token" value="[% csrf_token | html %]" />
220 <input type="hidden" name="borrowernumber" id="borrowernumber" value="[% patron.borrowernumber | html %]" />
221 <input type="hidden" name="selected_accts" id="selected_accts" value="[% selected_accts | html %]" />
222 <input type="hidden" name="total" id="total" value="[% total | html %]" />
223 <input type="hidden" name="type" value="[% type | html %]" />
224 <input type="hidden" name="change_given" id="change_given" />
226 <fieldset class="rows">
227 [% IF ( selected_accts ) %]
228 [% IF type == 'WRITEOFF' %]
229 <legend>Write off an amount toward selected fines</legend>
231 <legend>Pay an amount toward selected fines</legend>
234 <legend>Pay an amount toward all fines</legend>
239 <span class="label">Total amount outstanding: </span>
240 <span class="debit">[% total | format('%.2f') %]</span>
243 [% IF type == 'WRITEOFF' %]
244 <label for="paid">Writeoff amount:</label>
246 <label for="paid">Amount paid: </label>
248 <input name="paid" id="paid" value="[% total | $Price on_editing => 1 %]"/>
251 [% IF type != 'WRITEOFF' %]
253 <label for="collected">Collected from patron: </label>
254 <input id="collected" value="[% total | $Price on_editing => 1 %]"/>
257 <label>Change to give: </label>
258 <span id="change">0.00</span>
260 [% SET payment_types = [] %]
261 [% FOR pt IN AuthorisedValues.GetAuthValueDropbox('PAYMENT_TYPE') %]
262 [% NEXT IF pt.authorised_value.grep("^SIP[[:digit:]]{2}$").size() %]
263 [% payment_types.push(pt) %]
265 [% IF payment_types.size > 0 %]
267 <label for="payment_type">Payment type: </label>
268 <select name="payment_type" id="payment_type">
269 <option value=""></option>
270 [% FOREACH pt IN payment_types %]
271 <option value="[% pt.authorised_value | html %]">[% pt.lib | html %]</option>
277 [% IF Koha.Preference('UseCashRegisters') %]
279 <label for="cash_register">Cash register: </label>
280 <select name="cash_register" id="cash_register">
281 [% FOREACH register IN registers %]
282 [% IF register.id == registerid %]
283 <option value="[% register.id | html %]" selected="selected">[% register.name | html %]</option>
285 <option value="[% register.id | html %]">[% register.name | html %]</option>
294 <label for="selected_accts_notes">Note: </label>
295 <textarea name="selected_accts_notes" id="selected_accts_notes">[% selected_accts_notes | html %]</textarea>
300 <input type="submit" name="submitbutton" value="Confirm" />
301 <a class="cancel" href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% patron.borrowernumber | html %]">Cancel</a>
309 </div> <!-- /.col-sm-10.col-sm-push-2 -->
311 <div class="col-sm-2 col-sm-pull-10">
313 [% INCLUDE 'circ-menu.inc' %]
315 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
316 </div> <!-- /.row -->
319 <div id="confirm_change_form" class="modal" tabindex="-1" role="dialog" aria-hidden="true">
320 <div class="modal-dialog">
321 <div class="modal-content">
322 <div class="modal-header">
323 <h3>The amount collected is more than the outstanding charge</h3>
325 <div class="modal-body">
326 <p>The amount collected from the patron is higher than the amount to be paid.</p>
327 <p>The change to give is <b><span id="modal_change">0.00</span></b>.</p>
328 <p>Confirm this payment?</p>
330 <div class="modal-footer">
331 <button class="btn btn-default approve" id="modal_submit" type="button"><i class="fa fa-check"></i> Yes</button>
332 <button class="btn btn-default deny cancel" href="#" data-dismiss="modal" aria-hidden="true"><i class="fa fa-times"></i> No</button>
338 [% MACRO jsinclude BLOCK %]
339 [% INCLUDE 'str/members-menu.inc' %]
340 [% Asset.js("js/members-menu.js") | $raw %]
342 $(document).ready(function() {
343 [% IF payment_id && Koha.Preference('FinePaymentAutoPopup') %]
344 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');
347 var forms = $('#payindivfine, #payfine');
348 var change = $('#change')[0];
350 $('#payindivfine, #payfine').preventDoubleFormSubmit();
351 $("#paid, #collected").on("change",function() {
353 if (change != undefined) {
354 updateChangeValues();
358 if (change != undefined) {
359 forms.on("submit", function(e) {
360 if (change.innerHTML > 0.00) {
362 $("#confirm_change_form").modal("show");
369 $("#confirm_change_form").on("hidden.bs.modal", function(){
370 // remove class added by preventDoubleFormSubmit if necessary
371 $("body, form input[type='submit'], form button[type='submit'], form a").removeClass('waiting');
374 $('#modal_submit').click(function() {
380 $('#woindivfine').on('submit', function(e){
381 if ( prevent_default ) {
384 let amount_outstanding = parseFloat( $('#amountoutstanding').attr('value') );
385 let amount_writeoff = parseFloat( $('#amountwrittenoff').attr('value') );
386 if ( amount_writeoff > amount_outstanding ) {
387 alert(_("You are attemping to writeoff more than the value of the fee."));
388 $('#woindivfine').beenSubmitted = false;
391 $('#woindivfine').preventDoubleFormSubmit();
392 $('#woindivfine').submit();
397 function moneyFormat(textObj) {
398 var newValue = textObj.value;
404 for(i=0; i < newValue.length; i++) {
405 aChar = newValue.substring(i, i+1);
406 if (aChar >= "0" && aChar <= "9") {
408 decAmount = "" + decAmount + aChar;
411 dolAmount = "" + dolAmount + aChar;
423 if (dolAmount == "") {
427 if (dolAmount.length > 1) {
428 while(dolAmount.length > 1 && dolAmount.substring(0,1) == "0") {
429 dolAmount = dolAmount.substring(1,dolAmount.length);
432 if (decAmount.length > 2) {
433 decAmount = decAmount.substring(0,2);
436 if (decAmount.length == 1) {
437 decAmount = decAmount + "0";
439 if (decAmount.length == 0) {
440 decAmount = decAmount + "00";
443 textObj.value = dolAmount + "." + decAmount;
446 function updateChangeValues() {
447 var change = $('#change')[0];
448 change.innerHTML = Math.round(($('#collected')[0].value - $('#paid')[0].value) * 100) / 100;
449 if (change.innerHTML <= 0) {
450 change.innerHTML = "0.00";
451 $('input[name="change_given"]').val('0.00');
453 change.value = change.innerHTML;
455 change.innerHTML = change.value;
456 $('input[name="change_given"]').val(change.value);
459 $('#modal_change').html(change.innerHTML);
464 [% INCLUDE 'intranet-bottom.inc' %]