8 [% PROCESS 'accounts.inc' %]
9 [% INCLUDE 'doc-head-open.inc' %]
10 [% BLOCK cash_register_required %]
11 <div id="error_message" class="dialog message">
13 You must have at least one cash register associated with the library before you can record payments.
15 [% IF ( CAN_user_parameters_manage_cash_registers ) %]
16 <form action="/cgi-bin/koha/admin/cash_registers.pl" method="get">
17 <input type="hidden" name="op" value="add_form" />
18 <button class="new" type="submit"><i class="fa fa-plus"></i> Create a new cash register</button>
23 [% SET registers = Registers.all( filters => { current_branch => 1 } ) %]
25 [% IF type == 'WRITEOFF' %]
26 Write off an amount for [% patron.firstname | html %] [% patron.surname | html %]
28 Collect fine payment for [% patron.firstname | html %] [% patron.surname | html %]
29 [% END %] › Patrons › Koha
31 [% INCLUDE 'doc-head-close.inc' %]
34 <body id="pat_paycollect" class="pat">
35 [% INCLUDE 'header.inc' %]
36 [% INCLUDE 'patron-search-header.inc' %]
38 <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
41 <a href="/cgi-bin/koha/mainpage.pl">Home</a>
44 <a href="/cgi-bin/koha/members/members-home.pl">Patrons</a>
47 <a href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% patron.borrowernumber | uri %]">Pay charges for [% patron.firstname | html %] [% patron.surname | html %]</a>
50 <a href="#" aria-current="page">
51 [% IF ( pay_individual ) %]
52 Pay an individual fine
53 [% ELSIF ( writeoff_individual ) %]
54 Write off an individual fine
56 [% IF ( selected_accts ) %]
57 [% IF type == 'WRITEOFF' %]
58 Write off an amount toward selected fines
60 Pay an amount toward selected fines
63 Pay an amount toward all fines
71 <div class="main container-fluid">
73 <div class="col-sm-10 col-sm-push-2">
77 [% IF ( pay_individual ) %]
78 Pay an individual fine
79 [% ELSIF ( writeoff_individual ) %]
80 Write off an individual fine
82 [% IF ( selected_accts ) %]
83 [% IF type == 'WRITEOFF' %]
84 Write off an amount toward selected fines
86 Pay an amount toward selected fines
89 Pay an amount toward all fines
94 [% INCLUDE 'members-toolbar.inc' borrowernumber=patron.borrowernumber %]
96 <!-- The manual invoice and credit buttons -->
97 <div class="statictabs">
100 <a href="/cgi-bin/koha/members/boraccount.pl?borrowernumber=[% patron.borrowernumber | uri %]">Transactions</a>
103 <a href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% patron.borrowernumber | uri %]" >Make a payment</a>
106 <a href="/cgi-bin/koha/members/maninvoice.pl?borrowernumber=[% patron.borrowernumber | uri %]" >Create manual invoice</a>
109 <a href="/cgi-bin/koha/members/mancredit.pl?borrowernumber=[% patron.borrowernumber | uri %]" >Create manual credit</a>
112 <div class="tabs-container">
113 [% IF ( error_over ) %]
114 <div id="error_message" class="dialog alert">
115 You must pay a value less than or equal to [% total_due | format('%.2f') %].
118 [% IF ( error_under ) %]
119 <div id="error_message" class="dialog alert">
120 You must collect a value greater than or equal to [% total_paid | format('%.2f') %].
124 [% IF ( pay_individual ) %]
125 [% IF Koha.Preference('UseCashRegisters') && ( registers.size == 0 ) %]
126 [% PROCESS 'cash_register_required' %]
129 <ul class="nav nav-pills">
130 <li role="presentation" class="active"><a>Pay</a></li>
131 <li role="presentation"><a href="/cgi-bin/koha/members/paycollect.pl?writeoff_individual=1&borrowernumber=[% patron.borrowernumber | uri %]&debit_type_code=[% debit_type_code | uri %]&amount=[% amount | uri %]&amountoutstanding=[% amountoutstanding | uri %]&description=[% individual_description | uri %]&itemnumber=[% itemnumber | uri %]&accountlines_id=[% accountlines_id | uri %]&payment_note=[% payment_note | uri %]">Write off</a></li>
134 <form name="payindivfine" id="payindivfine" method="post" action="/cgi-bin/koha/members/paycollect.pl">
135 <input type="hidden" name="csrf_token" value="[% csrf_token | html %]" />
136 <input type="hidden" name="borrowernumber" id="borrowernumber" value="[% patron.borrowernumber | html %]" />
137 <input type="hidden" name="pay_individual" id="pay_individual" value="[% pay_individual | html %]" />
138 <input type="hidden" name="itemnumber" id="itemnumber" value="[% itemnumber | html %]" />
139 <input type="hidden" name="description" id="description" value="[% individual_description | html %]" />
140 <input type="hidden" name="debit_type_code" id="debit_type_code" value="[% debit_type_code | html %]" />
141 <input type="hidden" name="amount" id="amount" value="[% amount | html %]" />
142 <input type="hidden" name="amountoutstanding" id="amountoutstanding" value="[% amountoutstanding | html %]" />
143 <input type="hidden" name="accountlines_id" id="accountlines_id" value="[% accountlines_id | html %]" />
144 <input type="hidden" name="title" id="title" value="[% patron.title | html %]" />
145 <input type="hidden" name="change_given" id="change_given" />
147 <fieldset class="rows">
148 <legend>Pay an individual fine</legend>
149 <input type="hidden" name="payment_note" id="payment_note" value="[% payment_note | html %]" />
153 <th>Account type</th>
155 <th>Amount outstanding</th>
158 <tr><td colspan="3">Total amount payable:</td><td>[% amountoutstanding | format('%.2f') %]</td></tr>
162 [% individual_description | html %]
164 [% line.debit_type_code = debit_type_code %]
165 <td>[% PROCESS account_type_description account=line %]</td>
166 <td class="debit">[% amount | format('%.2f') %]</td>
167 <td class="debit">[% amountoutstanding | format('%.2f') %]</td>
174 <label for="paid">Amount being paid: </label>
175 <input name="paid" id="paid" type="text" step="0.01" min="0" value="[% amountoutstanding | $Price on_editing => 1 %]"/>
178 <label for="collected">Amount tendered: </label>
179 <input name="collected" id="collected" type="text" step="0.01" min="0" value="[% amountoutstanding | $Price on_editing => 1 %]"/>
182 <label>Change to give: </label>
183 <span id="change">0.00</span>
186 [% INCLUDE 'transaction_types.inc' type="payment" %]
188 [% IF Koha.Preference('UseCashRegisters') %]
190 [% IF Koha.Preference('RequireCashRegister') %]
191 <label for="cash_register" class="required">
193 <label for="cash_register">
198 [% IF Koha.Preference('RequireCashRegister') %]
199 <select name="cash_register" id="cash_register" required>
201 <select name="cash_register" id="cash_register">
203 <option id="noregister" disabled selected="selected" value="">-- Select an option--</option>
204 [% PROCESS options_for_registers %]
207 [% IF Koha.Preference('RequireCashRegister') %]
208 <span class="required">Required</span>
216 <input type="submit" name="submitbutton" value="Confirm" />
217 <a class="cancel" href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% patron.borrowernumber | html %]">Cancel</a>
221 [% ELSIF ( writeoff_individual ) %]
222 <ul class="nav nav-pills">
223 <li role="presentation"><a href="/cgi-bin/koha/members/paycollect.pl?pay_individual=1&borrowernumber=[% patron.borrowernumber | uri %]&debit_type_code=[% debit_type_code | uri %]&amount=[% amount | uri %]&amountoutstanding=[% amountoutstanding | uri %]&description=[% individual_description | uri %]&itemnumber=[% itemnumber | uri %]&accountlines_id=[% accountlines_id | uri %]&payment_note=[% payment_note | uri %]">Pay</a></li>
224 <li role="presentation" class="active"><a>Write off</a></li>
227 <form name="woindivfine" id="woindivfine" action="/cgi-bin/koha/members/pay.pl" method="post" >
228 <input type="hidden" name="csrf_token" value="[% csrf_token | html %]" />
229 <fieldset class="rows">
230 <legend>Write off an individual fine</legend>
231 <input type="hidden" name="borrowernumber" id="borrowernumber" value="[% patron.borrowernumber | html %]" />
232 <input type="hidden" name="pay_individual" id="pay_individual" value="[% pay_individual | html %]" />
233 <input type="hidden" name="itemnumber" id="itemnumber" value="[% itemnumber | html %]" />
234 <input type="hidden" name="description" id="description" value="[% individual_description | html %]" />
235 <input type="hidden" name="debit_type_code" id="debit_type_code" value="[% debit_type_code | html %]" />
236 <input type="hidden" name="amount" id="amount" value="[% amount | html %]" />
237 <input type="hidden" name="accountlines_id" id="accountlines_id" value="[% accountlines_id | html %]" />
238 <input type="hidden" name="title" id="title" value="[% patron.title | html %]" />
239 <input type="hidden" name="payment_note" id="payment_note" value="[% payment_note | html %]" />
240 <input type="hidden" name="amountoutstanding" id="amountoutstanding" value="[% amountoutstanding | html %]" />
241 <input type="hidden" name="confirm_writeoff" id="confirm_writeoff" value="1" />
242 <input type="hidden" name="change_given" id="change_given" />
246 <th>Account type</th>
248 <th>Amount outstanding</th>
250 <tfoot><tr><td colspan="3">Total amount outstanding:</td><td>[% amountoutstanding | format('%.2f') %]</td></tr></tfoot>
252 <td>[% individual_description | html %]</td>
253 [% line.debit_type_code = debit_type_code %]
254 <td>[% PROCESS account_type_description account=line %]</td>
255 <td class="debit">[% amount | format('%.2f') %]</td>
256 <td class="debit">[% amountoutstanding | format('%.2f') %]</td>
262 <label for="amountwrittenoff">Writeoff amount: </label>
263 <!-- default to writing off all -->
264 <input name="amountwrittenoff" id="amountwrittenoff" value="[% amountoutstanding | $Price on_editing => 1 %]" type="text" />
269 <input type="submit" value="Write off this charge" />
270 <a class="cancel" href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% patron.borrowernumber | html %]">Cancel</a>
274 [% IF Koha.Preference('UseCashRegisters') && ( registers.size == 0 ) && ( type != 'WRITEOFF' ) %]
275 [% PROCESS 'cash_register_required' %]
278 [% IF selected_accts %]
279 <ul class="nav nav-pills">
280 [% IF type == 'WRITEOFF' %]
281 <li role="presentation"><a href="/cgi-bin/koha/members/paycollect.pl?borrowernumber=[% patron.borrowernumber | uri %]&type=PAYMENT&amt=[% amt | uri %]&selected=[% selected_accts | uri %]¬es=[% selected_accts_notes | uri %]">Pay</a></li>
282 <li role="presentation" class="active"><a>Write off</a></li>
284 <li role="presentation" class="active"><a>Pay</a></li>
285 <li role="presentation"><a href="/cgi-bin/koha/members/paycollect.pl?borrowernumber=[% patron.borrowernumber | uri %]&type=WRITEOFF&amt=[% amt | uri %]&selected=[% selected_accts | uri %]¬es=[% selected_accts_notes | uri %]">Write off</a></li>
290 <form name="payfine" id="payfine" method="post" action="/cgi-bin/koha/members/paycollect.pl">
291 <input type="hidden" name="csrf_token" value="[% csrf_token | html %]" />
292 <input type="hidden" name="borrowernumber" id="borrowernumber" value="[% patron.borrowernumber | html %]" />
293 <input type="hidden" name="selected_accts" id="selected_accts" value="[% selected_accts | html %]" />
294 <input type="hidden" name="total" id="total" value="[% total | html %]" />
295 <input type="hidden" name="type" value="[% type | html %]" />
296 <input type="hidden" name="change_given" id="change_given" />
298 <fieldset class="rows">
299 [% IF ( selected_accts ) %]
300 [% IF type == 'WRITEOFF' %]
301 <legend>Write off an amount toward selected fines</legend>
303 <legend>Pay an amount toward selected fines</legend>
306 <legend>Pay an amount toward all fines</legend>
311 <span class="label">Total amount outstanding: </span>
312 <span class="debit">[% total | format('%.2f') %]</span>
315 [% IF type == 'WRITEOFF' %]
316 <label for="paid">Writeoff amount: </label>
318 <label for="paid">Amount being paid: </label>
320 <input name="paid" id="paid" type="text" step="0.01" min="0" value="[% total | $Price on_editing => 1 %]"/>
322 [% IF type != 'WRITEOFF' %]
324 <label for="collected">Amount tendered: </label>
325 <input name="collected" id="collected" type="text" step="0.01" min="0" value="[% total | $Price on_editing => 1 %]"/>
328 <label>Change to give: </label>
329 <span id="change">0.00</span>
332 [% INCLUDE 'transaction_types.inc' type="payment" %]
334 [% IF Koha.Preference('UseCashRegisters') %]
336 <label for="cash_register">Cash register: </label>
337 <select name="cash_register" id="cash_register">
338 <option id="noregister" disabled selected="selected" value="">-- Select an option--</option>
339 [% PROCESS options_for_registers %]
346 <label for="selected_accts_notes">Note: </label>
347 <textarea name="selected_accts_notes" id="selected_accts_notes">[% selected_accts_notes | html %]</textarea>
352 <input type="submit" name="submitbutton" value="Confirm" />
353 <a class="cancel" href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% patron.borrowernumber | html %]">Cancel</a>
361 </div> <!-- /.col-sm-10.col-sm-push-2 -->
363 <div class="col-sm-2 col-sm-pull-10">
365 [% INCLUDE 'circ-menu.inc' %]
367 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
368 </div> <!-- /.row -->
371 <div id="confirm_change_form" class="modal" tabindex="-1" role="dialog" aria-hidden="true">
372 <div class="modal-dialog">
373 <div class="modal-content">
374 <div class="modal-header">
375 <h3>The amount collected is more than the outstanding charge</h3>
377 <div class="modal-body">
378 <p>The amount collected from the patron is higher than the amount to be paid.</p>
379 <p>The change to give is <strong><span id="modal_change">0.00</span></strong>.</p>
380 <p>Confirm this payment?</p>
382 <div class="modal-footer">
383 <button class="btn btn-default approve" id="modal_submit" type="button"><i class="fa fa-check"></i> Yes</button>
384 <button class="btn btn-default deny cancel" href="#" data-dismiss="modal" aria-hidden="true"><i class="fa fa-times"></i> No</button>
390 [% MACRO jsinclude BLOCK %]
391 [% INCLUDE 'str/members-menu.inc' %]
392 [% Asset.js("js/members-menu.js") | $raw %]
394 $(document).ready(function() {
395 [% IF payment_id && Koha.Preference('FinePaymentAutoPopup') %]
396 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');
399 var forms = $('#payindivfine, #payfine');
400 var change = $('#change')[0];
402 $('#payindivfine, #payfine').preventDoubleFormSubmit();
403 $("#paid, #collected").on("change",function() {
405 if (change != undefined) {
406 updateChangeValues();
410 if (change != undefined) {
411 forms.on("submit", function(e) {
412 if (change.innerHTML > 0.00) {
414 $("#confirm_change_form").modal("show");
421 $("#confirm_change_form").on("hidden.bs.modal", function(){
422 // remove class added by preventDoubleFormSubmit if necessary
423 $("body, form input[type='submit'], form button[type='submit'], form a").removeClass('waiting');
426 $('#modal_submit').click(function() {
430 $( "#payindivfine, #payfine" ).validate({
432 paid: { required: true },
436 [% IF Koha.Preference('UseCashRegisters') %]
438 [% IF Koha.Preference('RequireCashRegister') %]
441 required: function() {
442 return $('#payment_type').val() == 'CASH'
448 invalidHandler: function(event, validator) {
449 // reset beenSubmitted for prevenDoubleFormSubmit
450 event.target.beenSubmitted = false;
451 // remove class added by preventDoubleFormSubmit
452 $("body, form input[type='submit'], form button[type='submit'], form a").removeClass('waiting');
458 $('#woindivfine').on('submit', function(e){
459 if ( prevent_default ) {
462 let amount_outstanding = parseFloat( $('#amountoutstanding').attr('value') );
463 let amount_writeoff = parseFloat( $('#amountwrittenoff').attr('value') );
464 if ( amount_writeoff > amount_outstanding ) {
465 alert(_("You are attemping to writeoff more than the value of the fee."));
466 $('#woindivfine').beenSubmitted = false;
469 $('#woindivfine').preventDoubleFormSubmit();
470 $('#woindivfine').submit();
475 function moneyFormat(textObj) {
476 var newValue = textObj.value;
482 for(var i = newValue.length; 0 < i; i--) {
483 aChar = newValue.substring(i-1, i);
484 if ("0" <= aChar && aChar <= "9") {
486 dolAmount = "" + aChar + dolAmount;
489 decAmount = "" + aChar + decAmount;
492 if (aChar == "." || aChar == ",") {
498 dolAmount = decAmount;
502 if (dolAmount == "") {
506 if (dolAmount.length > 1) {
507 while(dolAmount.length > 1 && dolAmount.substring(0,1) == "0") {
508 dolAmount = dolAmount.substring(1,dolAmount.length);
511 if (decAmount.length > 2) {
512 decAmount = decAmount.substring(0,2);
515 if (decAmount.length == 1) {
516 decAmount = decAmount + "0";
518 if (decAmount.length == 0) {
519 decAmount = decAmount + "00";
522 textObj.value = dolAmount + "." + decAmount;
525 function updateChangeValues() {
526 var change = $('#change')[0];
527 change.innerHTML = Math.round(($('#collected')[0].value - $('#paid')[0].value) * 100) / 100;
528 if (change.innerHTML <= 0) {
529 var paid = $('#paid')[0];
531 $('#collected').rules( "add", { min: Number(paid.value) });
532 $( "#payindivfine, #payfine" ).valid();
533 change.innerHTML = "0.00";
534 $('input[name="change_given"]').val('0.00');
536 change.value = change.innerHTML;
538 change.innerHTML = change.value;
539 $('input[name="change_given"]').val(change.value);
542 $('#modal_change').html(change.innerHTML);
547 [% INCLUDE 'intranet-bottom.inc' %]