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 [% INCLUDE 'patron-title.inc' no_html = 1 %]
28 Collect fine payment for [% INCLUDE 'patron-title.inc' no_html = 1 %]
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 [% INCLUDE 'patron-title.inc' %]</a>
50 <a href="#" aria-current="page">
51 [% IF ( pay_individual ) %]
52 <span>Pay an individual fine</span>
53 [% ELSIF ( writeoff_individual ) %]
54 <span>Write off an individual fine</span>
56 [% IF ( selected_accts ) %]
57 [% IF type == 'WRITEOFF' %]
58 <span>Write off an amount toward selected fines</span>
60 <span>Pay an amount toward selected fines</span>
63 <span>Pay an amount toward all fines</span>
71 <div class="main container-fluid">
73 <div class="col-sm-10 col-sm-push-2">
77 [% IF ( pay_individual ) %]
78 <span>Pay an individual fine</span>
79 [% ELSIF ( writeoff_individual ) %]
80 <span>Write off an individual fine</span>
82 [% IF ( selected_accts ) %]
83 [% IF type == 'WRITEOFF' %]
84 <span>Write off an amount toward selected fines</span>
86 <span>Pay an amount toward selected fines</span>
89 <span>Pay an amount toward all fines</span>
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 | $Price %].
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 | $Price %].
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="change_given" id="change_given" />
146 <fieldset class="rows">
147 <legend>Pay an individual fine</legend>
148 <input type="hidden" name="payment_note" id="payment_note" value="[% payment_note | html %]" />
152 <th>Account type</th>
154 <th>Amount outstanding</th>
157 <tr><td colspan="3">Total amount payable:</td><td>[% amountoutstanding | $Price %]</td></tr>
161 [% individual_description | html %]
163 [% line.debit_type_code = debit_type_code %]
164 <td>[% PROCESS account_type_description account=line %]</td>
165 <td class="debit">[% amount | $Price %]</td>
166 <td class="debit">[% amountoutstanding | $Price %]</td>
173 <label for="paid">Amount being paid: </label>
174 <input name="paid" id="paid" type="text" step="0.01" min="0" value="[% amountoutstanding | $Price on_editing => 1 %]"/>
177 <label for="collected">Amount tendered: </label>
178 <input name="collected" id="collected" type="text" step="0.01" min="0" value="[% amountoutstanding | $Price on_editing => 1 %]"/>
181 <label>Change to give: </label>
182 <span id="change">0.00</span>
185 [% INCLUDE 'transaction_types.inc' type="payment" %]
187 [% IF Koha.Preference('UseCashRegisters') %]
189 [% IF Koha.Preference('RequireCashRegister') %]
190 <label for="cash_register" class="required">
192 <label for="cash_register">
197 [% IF Koha.Preference('RequireCashRegister') %]
198 <select name="cash_register" id="cash_register" required>
200 <select name="cash_register" id="cash_register">
202 <option id="noregister" disabled selected="selected" value="">-- Select an option--</option>
203 [% PROCESS options_for_registers %]
206 [% IF Koha.Preference('RequireCashRegister') %]
207 <span class="required">Required</span>
215 <input type="submit" name="submitbutton" value="Confirm" />
216 <a class="cancel" href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% patron.borrowernumber | html %]">Cancel</a>
220 [% ELSIF ( writeoff_individual ) %]
221 <ul class="nav nav-pills">
222 <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>
223 <li role="presentation" class="active"><a>Write off</a></li>
226 <form name="woindivfine" id="woindivfine" action="/cgi-bin/koha/members/pay.pl" method="post" >
227 <input type="hidden" name="csrf_token" value="[% csrf_token | html %]" />
228 <fieldset class="rows">
229 <legend>Write off an individual fine</legend>
230 <input type="hidden" name="borrowernumber" id="borrowernumber" value="[% patron.borrowernumber | html %]" />
231 <input type="hidden" name="pay_individual" id="pay_individual" value="[% pay_individual | html %]" />
232 <input type="hidden" name="itemnumber" id="itemnumber" value="[% itemnumber | html %]" />
233 <input type="hidden" name="description" id="description" value="[% individual_description | html %]" />
234 <input type="hidden" name="debit_type_code" id="debit_type_code" value="[% debit_type_code | html %]" />
235 <input type="hidden" name="amount" id="amount" value="[% amount | html %]" />
236 <input type="hidden" name="accountlines_id" id="accountlines_id" value="[% accountlines_id | html %]" />
237 <input type="hidden" name="payment_note" id="payment_note" value="[% payment_note | html %]" />
238 <input type="hidden" name="amountoutstanding" id="amountoutstanding" value="[% amountoutstanding | html %]" />
239 <input type="hidden" name="confirm_writeoff" id="confirm_writeoff" value="1" />
240 <input type="hidden" name="change_given" id="change_given" />
244 <th>Account type</th>
246 <th>Amount outstanding</th>
248 <tfoot><tr><td colspan="3">Total amount outstanding:</td><td>[% amountoutstanding | $Price %]</td></tr></tfoot>
250 <td>[% individual_description | html %]</td>
251 [% line.debit_type_code = debit_type_code %]
252 <td>[% PROCESS account_type_description account=line %]</td>
253 <td class="debit">[% amount | $Price %]</td>
254 <td class="debit">[% amountoutstanding | $Price %]</td>
260 <label for="amountwrittenoff">Writeoff amount: </label>
261 <!-- default to writing off all -->
262 <input name="amountwrittenoff" id="amountwrittenoff" value="[% amountoutstanding | $Price on_editing => 1 %]" type="text" />
267 <input type="submit" value="Write off this charge" />
268 <a class="cancel" href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% patron.borrowernumber | html %]">Cancel</a>
272 [% IF Koha.Preference('UseCashRegisters') && ( registers.size == 0 ) && ( type != 'WRITEOFF' ) %]
273 [% PROCESS 'cash_register_required' %]
276 [% IF selected_accts %]
277 <ul class="nav nav-pills">
278 [% IF type == 'WRITEOFF' %]
279 <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>
280 <li role="presentation" class="active"><a>Write off</a></li>
282 <li role="presentation" class="active"><a>Pay</a></li>
283 <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>
288 <form name="payfine" id="payfine" method="post" action="/cgi-bin/koha/members/paycollect.pl">
289 <input type="hidden" name="csrf_token" value="[% csrf_token | html %]" />
290 <input type="hidden" name="borrowernumber" id="borrowernumber" value="[% patron.borrowernumber | html %]" />
291 <input type="hidden" name="selected_accts" id="selected_accts" value="[% selected_accts | html %]" />
292 <input type="hidden" name="total" id="total" value="[% total | html %]" />
293 <input type="hidden" name="type" value="[% type | html %]" />
294 <input type="hidden" name="change_given" id="change_given" />
296 <fieldset class="rows">
297 [% IF ( selected_accts ) %]
298 [% IF type == 'WRITEOFF' %]
299 <legend>Write off an amount toward selected fines</legend>
301 <legend>Pay an amount toward selected fines</legend>
304 <legend>Pay an amount toward all fines</legend>
309 <span class="label">Total amount outstanding: </span>
310 <span class="debit">[% total | $Price %]</span>
313 [% IF type == 'WRITEOFF' %]
314 <label for="paid">Writeoff amount: </label>
316 <label for="paid">Amount being paid: </label>
318 <input name="paid" id="paid" type="text" step="0.01" min="0" value="[% total | $Price on_editing => 1 %]"/>
320 [% IF type != 'WRITEOFF' %]
322 <label for="collected">Amount tendered: </label>
323 <input name="collected" id="collected" type="text" step="0.01" min="0" value="[% total | $Price on_editing => 1 %]"/>
326 <label>Change to give: </label>
327 <span id="change">0.00</span>
330 [% INCLUDE 'transaction_types.inc' type="payment" %]
332 [% IF Koha.Preference('UseCashRegisters') %]
334 <label for="cash_register">Cash register: </label>
335 <select name="cash_register" id="cash_register">
336 <option id="noregister" disabled selected="selected" value="">-- Select an option--</option>
337 [% PROCESS options_for_registers %]
344 <label for="selected_accts_notes">Note: </label>
345 <textarea name="selected_accts_notes" id="selected_accts_notes">[% selected_accts_notes | html %]</textarea>
350 <input type="submit" name="submitbutton" value="Confirm" />
351 <a class="cancel" href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% patron.borrowernumber | html %]">Cancel</a>
359 </div> <!-- /.col-sm-10.col-sm-push-2 -->
361 <div class="col-sm-2 col-sm-pull-10">
363 [% INCLUDE 'circ-menu.inc' %]
365 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
366 </div> <!-- /.row -->
369 <div id="confirm_change_form" class="modal" tabindex="-1" role="dialog" aria-hidden="true">
370 <div class="modal-dialog">
371 <div class="modal-content">
372 <div class="modal-header">
373 <h3>The amount collected is more than the outstanding charge</h3>
375 <div class="modal-body">
376 <p>The amount collected from the patron is higher than the amount to be paid.</p>
377 <p>The change to give is <strong><span id="modal_change">0.00</span></strong>.</p>
378 <p>Confirm this payment?</p>
380 <div class="modal-footer">
381 <button class="btn btn-default approve" id="modal_submit" type="button"><i class="fa fa-check"></i> Yes</button>
382 <button class="btn btn-default deny cancel" href="#" data-dismiss="modal" aria-hidden="true"><i class="fa fa-times"></i> No</button>
388 [% MACRO jsinclude BLOCK %]
389 [% INCLUDE 'str/members-menu.inc' %]
390 [% Asset.js("js/members-menu.js") | $raw %]
392 $(document).ready(function() {
393 [% IF payment_id && Koha.Preference('FinePaymentAutoPopup') %]
394 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');
397 var forms = $('#payindivfine, #payfine');
398 var change = $('#change')[0];
400 $('#payindivfine, #payfine').preventDoubleFormSubmit();
401 $("#paid, #collected").on("change",function() {
403 if (change != undefined) {
404 updateChangeValues();
408 if (change != undefined) {
409 forms.on("submit", function(e) {
410 if (change.innerHTML > 0.00) {
412 $("#confirm_change_form").modal("show");
419 $("#confirm_change_form").on("hidden.bs.modal", function(){
420 // remove class added by preventDoubleFormSubmit if necessary
421 $("body, form input[type='submit'], form button[type='submit'], form a").removeClass('waiting');
424 $('#modal_submit').click(function() {
428 $( "#payindivfine, #payfine" ).validate({
430 paid: { required: true },
434 [% IF Koha.Preference('UseCashRegisters') %]
436 [% IF Koha.Preference('RequireCashRegister') %]
439 required: function() {
440 return $('#payment_type').val() == 'CASH'
446 invalidHandler: function(event, validator) {
447 // reset beenSubmitted for prevenDoubleFormSubmit
448 event.target.beenSubmitted = false;
449 // remove class added by preventDoubleFormSubmit
450 $("body, form input[type='submit'], form button[type='submit'], form a").removeClass('waiting');
456 $('#woindivfine').on('submit', function(e){
457 if ( prevent_default ) {
460 let amount_outstanding = parseFloat( $('#amountoutstanding').attr('value') );
461 let amount_writeoff = parseFloat( $('#amountwrittenoff').attr('value') );
462 if ( amount_writeoff > amount_outstanding ) {
463 alert(_("You are attemping to writeoff more than the value of the fee."));
464 $('#woindivfine').beenSubmitted = false;
467 $('#woindivfine').preventDoubleFormSubmit();
468 $('#woindivfine').submit();
473 function moneyFormat(textObj) {
474 var newValue = textObj.value;
480 for(var i = newValue.length; 0 < i; i--) {
481 aChar = newValue.substring(i-1, i);
482 if ("0" <= aChar && aChar <= "9") {
484 dolAmount = "" + aChar + dolAmount;
487 decAmount = "" + aChar + decAmount;
490 if (aChar == "." || aChar == ",") {
496 dolAmount = decAmount;
500 if (dolAmount == "") {
504 if (dolAmount.length > 1) {
505 while(dolAmount.length > 1 && dolAmount.substring(0,1) == "0") {
506 dolAmount = dolAmount.substring(1,dolAmount.length);
509 if (decAmount.length > 2) {
510 decAmount = decAmount.substring(0,2);
513 if (decAmount.length == 1) {
514 decAmount = decAmount + "0";
516 if (decAmount.length == 0) {
517 decAmount = decAmount + "00";
520 textObj.value = dolAmount + "." + decAmount;
523 function updateChangeValues() {
524 var change = $('#change')[0];
525 change.innerHTML = Math.round(($('#collected')[0].value - $('#paid')[0].value) * 100) / 100;
526 if (change.innerHTML <= 0) {
527 var paid = $('#paid')[0];
529 $('#collected').rules( "add", { min: Number(paid.value) });
530 $( "#payindivfine, #payfine" ).valid();
531 change.innerHTML = "0.00";
532 $('input[name="change_given"]').val('0.00');
534 change.value = change.innerHTML;
536 change.innerHTML = change.value;
537 $('input[name="change_given"]').val(change.value);
540 $('#modal_change').html(change.innerHTML);
545 [% INCLUDE 'intranet-bottom.inc' %]