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="debit_type_code" id="debit_type_code" value="[% debit_type_code | 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 %]" />
81 <input type="hidden" name="change_given" id="change_given" />
83 <fieldset class="rows">
84 <legend>Pay an individual fine</legend>
85 <input type="hidden" name="payment_note" id="payment_note" value="[% payment_note | html %]" />
91 <th>Amount outstanding</th>
94 <tr><td colspan="3">Total amount payable:</td><td>[% amountoutstanding | format('%.2f') %]</td></tr>
98 [% individual_description | html %]
100 <td>[% debit_type_code | html %]</td>
101 <td class="debit">[% amount | format('%.2f') %]</td>
102 <td class="debit">[% amountoutstanding | format('%.2f') %]</td>
109 <label for="paid">Amount being paid: </label>
110 <input name="paid" id="paid" value="[% amountoutstanding | $Price on_editing => 1 %]"/>
113 <label for="collected">Collected from patron: </label>
114 <input id="collected" value="[% amountoutstanding | $Price on_editing => 1 %]"/>
117 <label>Change to give: </label>
118 <span id="change">0.00</span>
120 [% SET payment_types = AuthorisedValues.GetAuthValueDropbox('PAYMENT_TYPE') %]
121 [% IF payment_types %]
123 <label for="payment_type">Payment type: </label>
124 <select name="payment_type" id="payment_type">
125 <option value=""></option>
126 [% FOREACH pt IN payment_types %]
127 <option value="[% pt.authorised_value | html %]">[% pt.lib | html %]</option>
132 [% IF Koha.Preference('UseCashRegisters') %]
134 <label for="cash_register">Cash register: </label>
135 <select name="cash_register" id="cash_register">
136 [% FOREACH register IN registers %]
137 [% IF register.id == registerid %]
138 <option value="[% register.id | html %]" selected="selected">[% register.name | html %]</option>
140 <option value="[% register.id | html %]">[% register.name | html %]</option>
150 <input type="submit" name="submitbutton" value="Confirm" />
151 <a class="cancel" href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% patron.borrowernumber | html %]">Cancel</a>
155 [% ELSIF ( writeoff_individual ) %]
156 <form name="woindivfine" id="woindivfine" action="/cgi-bin/koha/members/pay.pl" method="post" >
157 <input type="hidden" name="csrf_token" value="[% csrf_token | html %]" />
158 <fieldset class="rows">
159 <legend>Write off an individual fine</legend>
160 <input type="hidden" name="borrowernumber" id="borrowernumber" value="[% patron.borrowernumber | html %]" />
161 <input type="hidden" name="pay_individual" id="pay_individual" value="[% pay_individual | html %]" />
162 <input type="hidden" name="itemnumber" id="itemnumber" value="[% itemnumber | html %]" />
163 <input type="hidden" name="description" id="description" value="[% description | html %]" />
164 <input type="hidden" name="debit_type_code" id="debit_type_code" value="[% debit_type_code | html %]" />
165 <input type="hidden" name="amount" id="amount" value="[% amount | html %]" />
166 <input type="hidden" name="accountlines_id" id="accountlines_id" value="[% accountlines_id | html %]" />
167 <input type="hidden" name="title" id="title" value="[% title | html %]" />
168 <input type="hidden" name="payment_note" id="payment_note" value="[% payment_note | html %]" />
169 <input type="hidden" name="amountoutstanding" id="amountoutstanding" value="[% amountoutstanding | html %]" />
170 <input type="hidden" name="confirm_writeoff" id="confirm_writeoff" value="1" />
171 <input type="hidden" name="change_given" id="change_given" />
175 <th>Account type</th>
177 <th>Amount outstanding</th>
179 <tfoot><tr><td colspan="3">Total amount outstanding:</td><td>[% amountoutstanding | format('%.2f') %]</td></tr></tfoot>
181 <td>[% description | html %] [% title | html %]</td>
182 <td>[% debit_type_code | html %]</td>
183 <td class="debit">[% amount | format('%.2f') %]</td>
184 <td class="debit">[% amountoutstanding | format('%.2f') %]</td>
190 <label for="paid">Writeoff amount: </label>
191 <!-- default to writing off all -->
192 <input name="amountwrittenoff" id="amountwrittenoff" value="[% amountoutstanding | $Price on_editing => 1 %]" type="text" />
197 <input type="submit" value="Write off this charge" />
198 <a class="cancel" href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% patron.borrowernumber | html %]">Cancel</a>
202 [% IF ( error_registers && type != 'writeoff' ) %]
203 <div id="error_message" class="dialog alert">
204 You must have at least one cash register associated with this branch before you can record payments.
208 <form name="payfine" id="payfine" method="post" action="/cgi-bin/koha/members/paycollect.pl">
209 <input type="hidden" name="csrf_token" value="[% csrf_token | html %]" />
210 <input type="hidden" name="borrowernumber" id="borrowernumber" value="[% patron.borrowernumber | html %]" />
211 <input type="hidden" name="selected_accts" id="selected_accts" value="[% selected_accts | html %]" />
212 <input type="hidden" name="total" id="total" value="[% total | html %]" />
213 <input type="hidden" name="type" value="[% type | html %]" />
214 <input type="hidden" name="change_given" id="change_given" />
216 <fieldset class="rows">
217 [% IF ( selected_accts ) %]
218 [% IF type == 'writeoff' %]
219 <legend>Write off an amount toward selected fines</legend>
221 <legend>Pay an amount toward selected fines</legend>
224 <legend>Pay an amount toward all fines</legend>
229 <span class="label">Total amount outstanding: </span>
230 <span class="debit">[% total | format('%.2f') %]</span>
233 <label for="paid">Amount paid :</label>
234 <input name="paid" id="paid" value="[% total | $Price on_editing => 1 %]"/>
237 [% IF type == 'writeoff' %]
238 <label for="collected">Writeoff amount: </label>
240 <label for="collected">Collect from patron: </label>
242 <input id="collected" value="[% total | $Price on_editing => 1 %]"/>
245 <label>Change to give: </label>
246 <span id="change">0.00</span>
249 [% IF type != 'writeoff' %]
250 [% SET payment_types = AuthorisedValues.GetAuthValueDropbox('PAYMENT_TYPE') %]
251 [% IF payment_types %]
253 <label for="payment_type">Payment type: </label>
254 <select name="payment_type" id="payment_type">
255 <option value=""></option>
256 [% FOREACH pt IN payment_types %]
257 <option value="[% pt.authorised_value | html %]">[% pt.lib | html %]</option>
263 [% IF Koha.Preference('UseCashRegisters') %]
265 <label for="cash_register">Cash register: </label>
266 <select name="cash_register" id="cash_register">
267 [% FOREACH register IN registers %]
268 [% IF register.id == registerid %]
269 <option value="[% register.id | html %]" selected="selected">[% register.name | html %]</option>
271 <option value="[% register.id | html %]">[% register.name | html %]</option>
280 <label for="selected_accts_notes">Note: </label>
281 <textarea name="selected_accts_notes" id="selected_accts_notes">[% selected_accts_notes | html %]</textarea>
286 <input type="submit" name="submitbutton" value="Confirm" />
287 <a class="cancel" href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% patron.borrowernumber | html %]">Cancel</a>
295 </div> <!-- /.col-sm-10.col-sm-push-2 -->
297 <div class="col-sm-2 col-sm-pull-10">
299 [% INCLUDE 'circ-menu.inc' %]
301 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
302 </div> <!-- /.row -->
305 <div id="confirm_change_form" class="modal" tabindex="-1" role="dialog" aria-hidden="true">
306 <div class="modal-dialog">
307 <div class="modal-content">
308 <div class="modal-header">
309 <h3>The amount collected is more than the outstanding charge</h3>
311 <div class="modal-body">
312 <p>The amount collected from the patron is higher than the amount to be paid.</p>
313 <p>The change to give is <b><span id="modal_change">0.00</span></b>.</p>
314 <p>Confirm this payment?</p>
316 <div class="modal-footer">
317 <button class="btn btn-default approve" id="modal_submit" type="button"><i class="fa fa-check"></i> Yes</button>
318 <button class="btn btn-default deny cancel" href="#" data-dismiss="modal" aria-hidden="true"><i class="fa fa-times"></i> No</button>
324 [% MACRO jsinclude BLOCK %]
325 [% INCLUDE 'str/members-menu.inc' %]
326 [% Asset.js("js/members-menu.js") | $raw %]
328 $(document).ready(function() {
329 [% IF payment_id && Koha.Preference('FinePaymentAutoPopup') %]
330 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');
333 var forms = $('#payindivfine, #payfine');
334 var change = $('#change')[0];
336 $('#payindivfine, #payfine').preventDoubleFormSubmit();
337 $("#paid, #collected").on("change",function() {
339 if (change != undefined) {
340 updateChangeValues();
344 if (change != undefined) {
345 forms.on("submit", function(e) {
346 if (change.innerHTML > 0.00) {
348 $("#confirm_change_form").modal("show");
355 $("#confirm_change_form").on("hidden.bs.modal", function(){
356 // remove class added by preventDoubleFormSubmit if necessary
357 $("body, form input[type='submit'], form button[type='submit'], form a").removeClass('waiting');
360 $('#modal_submit').click(function() {
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 change.innerHTML = "0.00";
437 $('input[name="change_given"]').val('0.00');
439 change.value = change.innerHTML;
441 change.innerHTML = change.value;
442 $('input[name="change_given"]').val(change.value);
445 $('#modal_change').html(change.innerHTML);
450 [% INCLUDE 'intranet-bottom.inc' %]