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 [% WRAPPER 'header.inc' %]
36 [% INCLUDE 'patron-search-header.inc' %]
39 [% WRAPPER 'sub-header.inc' %]
40 <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
43 <a href="/cgi-bin/koha/mainpage.pl">Home</a>
46 <a href="/cgi-bin/koha/members/members-home.pl">Patrons</a>
49 <a href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% patron.borrowernumber | uri %]">Pay charges for [% INCLUDE 'patron-title.inc' %]</a>
52 <a href="#" aria-current="page">
53 [% IF ( pay_individual ) %]
54 <span>Pay an individual fine</span>
55 [% ELSIF ( writeoff_individual ) %]
56 <span>Write off an individual fine</span>
58 [% IF ( selected_accts ) %]
59 [% IF type == 'WRITEOFF' %]
60 <span>Write off an amount toward selected fines</span>
62 <span>Pay an amount toward selected fines</span>
65 <span>Pay an amount toward all fines</span>
74 <div class="main container-fluid">
76 <div class="col-sm-10 col-sm-push-2">
80 [% IF ( pay_individual ) %]
81 <span>Pay an individual fine</span>
82 [% ELSIF ( writeoff_individual ) %]
83 <span>Write off an individual fine</span>
85 [% IF ( selected_accts ) %]
86 [% IF type == 'WRITEOFF' %]
87 <span>Write off an amount toward selected fines</span>
89 <span>Pay an amount toward selected fines</span>
92 <span>Pay an amount toward all fines</span>
97 [% INCLUDE 'members-toolbar.inc' borrowernumber=patron.borrowernumber %]
99 <!-- The manual invoice and credit buttons -->
100 <div class="toptabs">
101 <ul class="nav nav-tabs" role="tablist">
102 <li role="presentation" class="transactions">
103 <a href="/cgi-bin/koha/members/boraccount.pl?borrowernumber=[% patron.borrowernumber | uri %]" role="tab">Transactions</a>
105 <li role="presentation" class="makepayment active">
106 <a href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% patron.borrowernumber | uri %]" role="tab">Make a payment</a>
108 <li role="presentation">
109 <a href="/cgi-bin/koha/members/maninvoice.pl?borrowernumber=[% patron.borrowernumber | uri %]" role="tab">Create manual invoice</a>
111 <li role="presentation">
112 <a href="/cgi-bin/koha/members/mancredit.pl?borrowernumber=[% patron.borrowernumber | uri %]" role="tab">Create manual credit</a>
114 </ul> <!-- /.nav.nav-tabs -->
115 <div class="tab-content">
116 <div role="tabpanel" class="tab-pane active">
117 [% IF ( error_over ) %]
118 <div id="error_message" class="dialog alert">
119 You must pay a value less than or equal to [% total_due | $Price %].
122 [% IF ( error_under ) %]
123 <div id="error_message" class="dialog alert">
124 You must collect a value greater than or equal to [% total_paid | $Price %].
128 [% IF ( pay_individual ) %]
129 [% IF Koha.Preference('UseCashRegisters') && ( registers.size == 0 ) %]
130 [% PROCESS 'cash_register_required' %]
133 <ul class="nav nav-pills">
134 <li role="presentation" class="active"><a href="#">Pay</a></li>
135 <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>
138 <form name="payindivfine" id="payindivfine" method="post" action="/cgi-bin/koha/members/paycollect.pl">
139 <input type="hidden" name="csrf_token" value="[% csrf_token | html %]" />
140 <input type="hidden" name="borrowernumber" id="borrowernumber" value="[% patron.borrowernumber | html %]" />
141 <input type="hidden" name="pay_individual" id="pay_individual" value="[% pay_individual | html %]" />
142 <input type="hidden" name="itemnumber" id="itemnumber" value="[% itemnumber | html %]" />
143 <input type="hidden" name="description" id="description" value="[% individual_description | html %]" />
144 <input type="hidden" name="debit_type_code" id="debit_type_code" value="[% debit_type_code | html %]" />
145 <input type="hidden" name="amount" id="amount" value="[% amount | html %]" />
146 <input type="hidden" name="amountoutstanding" id="amountoutstanding" value="[% amountoutstanding | html %]" />
147 <input type="hidden" name="accountlines_id" id="accountlines_id" value="[% accountlines_id | html %]" />
148 <input type="hidden" name="change_given" id="change_given" />
150 <fieldset class="rows">
151 <legend>Pay an individual fine</legend>
152 <input type="hidden" name="payment_note" id="payment_note" value="[% payment_note | html %]" />
156 <th>Account type</th>
158 <th>Amount outstanding</th>
161 <tr><td colspan="3">Total amount payable:</td><td>[% amountoutstanding | $Price %]</td></tr>
165 [% individual_description | html %]
167 [% line.debit_type_code = debit_type_code %]
168 <td>[% PROCESS account_type_description account=line %]</td>
169 <td class="debit">[% amount | $Price %]</td>
170 <td class="debit">[% amountoutstanding | $Price %]</td>
177 <label for="paid">Amount being paid: </label>
178 <input name="paid" id="paid" type="text" step="0.01" min="0" value="[% amountoutstanding | $Price on_editing => 1 %]"/>
181 <label for="collected">Amount tendered: </label>
182 <input name="collected" id="collected" type="text" step="0.01" min="0" value="[% amountoutstanding | $Price on_editing => 1 %]"/>
185 <label>Change to give: </label>
186 <span id="change">0.00</span>
189 [% INCLUDE 'transaction_types.inc' type="payment" %]
191 [% IF Koha.Preference('UseCashRegisters') %]
193 [% IF Koha.Preference('RequireCashRegister') %]
194 <label for="cash_register" class="required">
196 <label for="cash_register">
201 [% IF Koha.Preference('RequireCashRegister') %]
202 <select name="cash_register" id="cash_register" required>
204 <select name="cash_register" id="cash_register">
206 <option id="noregister" disabled selected="selected" value="">-- Select an option--</option>
207 [% PROCESS options_for_registers %]
210 [% IF Koha.Preference('RequireCashRegister') %]
211 <span class="required">Required</span>
218 [% IF available_additional_fields %]
219 [% INCLUDE 'additional-fields-entry.inc' available=available_additional_fields values=additional_field_values %]
223 <input type="submit" name="submitbutton" class="btn btn-primary" value="Confirm" />
224 <a class="cancel" href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% patron.borrowernumber | html %]">Cancel</a>
228 [% ELSIF ( writeoff_individual ) %]
229 <ul class="nav nav-pills">
230 <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>
231 <li role="presentation" class="active"><a href="#">Write off</a></li>
234 <form name="woindivfine" id="woindivfine" action="/cgi-bin/koha/members/pay.pl" method="post" >
235 <input type="hidden" name="csrf_token" value="[% csrf_token | html %]" />
236 <fieldset class="rows">
237 <legend>Write off an individual fine</legend>
238 <input type="hidden" name="borrowernumber" id="borrowernumber" value="[% patron.borrowernumber | html %]" />
239 <input type="hidden" name="pay_individual" id="pay_individual" value="[% pay_individual | html %]" />
240 <input type="hidden" name="itemnumber" id="itemnumber" value="[% itemnumber | html %]" />
241 <input type="hidden" name="description" id="description" value="[% individual_description | html %]" />
242 <input type="hidden" name="debit_type_code" id="debit_type_code" value="[% debit_type_code | html %]" />
243 <input type="hidden" name="amount" id="amount" value="[% amount | html %]" />
244 <input type="hidden" name="accountlines_id" id="accountlines_id" value="[% accountlines_id | html %]" />
245 <input type="hidden" name="payment_note" id="payment_note" value="[% payment_note | html %]" />
246 <input type="hidden" name="amountoutstanding" id="amountoutstanding" value="[% amountoutstanding | html %]" />
247 <input type="hidden" name="confirm_writeoff" id="confirm_writeoff" value="1" />
248 <input type="hidden" name="change_given" id="change_given" />
252 <th>Account type</th>
254 <th>Amount outstanding</th>
256 <tfoot><tr><td colspan="3">Total amount outstanding:</td><td>[% amountoutstanding | $Price %]</td></tr></tfoot>
258 <td>[% individual_description | html %]</td>
259 [% line.debit_type_code = debit_type_code %]
260 <td>[% PROCESS account_type_description account=line %]</td>
261 <td class="debit">[% amount | $Price %]</td>
262 <td class="debit">[% amountoutstanding | $Price %]</td>
268 <label for="amountwrittenoff">Writeoff amount: </label>
269 <!-- default to writing off all -->
270 <input name="amountwrittenoff" id="amountwrittenoff" value="[% amountoutstanding | $Price on_editing => 1 %]" type="text" />
275 [% IF available_additional_fields %]
276 [% INCLUDE 'additional-fields-entry.inc' available=available_additional_fields values=additional_field_values %]
280 <input type="submit" class="btn btn-primary" value="Write off this charge" />
281 <a class="cancel" href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% patron.borrowernumber | html %]">Cancel</a>
285 [% IF Koha.Preference('UseCashRegisters') && ( registers.size == 0 ) && ( type != 'WRITEOFF' ) %]
286 [% PROCESS 'cash_register_required' %]
289 [% IF selected_accts %]
290 <ul class="nav nav-pills">
291 [% IF type == 'WRITEOFF' %]
292 <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>
293 <li role="presentation" class="active"><a>Write off</a></li>
295 <li role="presentation" class="active"><a>Pay</a></li>
296 <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>
301 <form name="payfine" id="payfine" method="post" action="/cgi-bin/koha/members/paycollect.pl">
302 <input type="hidden" name="csrf_token" value="[% csrf_token | html %]" />
303 <input type="hidden" name="borrowernumber" id="borrowernumber" value="[% patron.borrowernumber | html %]" />
304 <input type="hidden" name="selected_accts" id="selected_accts" value="[% selected_accts | html %]" />
305 <input type="hidden" name="total" id="total" value="[% total | html %]" />
306 <input type="hidden" name="type" value="[% type | html %]" />
307 <input type="hidden" name="change_given" id="change_given" />
309 <fieldset class="rows">
310 [% IF ( selected_accts ) %]
311 [% IF type == 'WRITEOFF' %]
312 <legend>Write off an amount toward selected fines</legend>
314 <legend>Pay an amount toward selected fines</legend>
317 <legend>Pay an amount toward all fines</legend>
322 <span class="label">Total amount outstanding: </span>
323 <span class="debit">[% total | $Price %]</span>
326 [% IF type == 'WRITEOFF' %]
327 <label for="paid">Writeoff amount: </label>
329 <label for="paid">Amount being paid: </label>
331 <input name="paid" id="paid" type="text" step="0.01" min="0" value="[% total | $Price on_editing => 1 %]"/>
333 [% IF type != 'WRITEOFF' %]
335 <label for="collected">Amount tendered: </label>
336 <input name="collected" id="collected" type="text" step="0.01" min="0" value="[% total | $Price on_editing => 1 %]"/>
339 <label>Change to give: </label>
340 <span id="change">0.00</span>
343 [% INCLUDE 'transaction_types.inc' type="payment" %]
345 [% IF Koha.Preference('UseCashRegisters') %]
347 <label for="cash_register">Cash register: </label>
348 <select name="cash_register" id="cash_register">
349 <option id="noregister" disabled selected="selected" value="">-- Select an option--</option>
350 [% PROCESS options_for_registers %]
357 <label for="selected_accts_notes">Note: </label>
358 <textarea name="selected_accts_notes" id="selected_accts_notes">[% selected_accts_notes | html %]</textarea>
363 [% IF available_additional_fields %]
364 [% INCLUDE 'additional-fields-entry.inc' available=available_additional_fields values=additional_field_values %]
368 <input type="submit" name="submitbutton" class="btn btn-primary" value="Confirm" />
369 <a class="cancel" href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% patron.borrowernumber | html %]">Cancel</a>
374 </div> <!-- /.tab-pane -->
375 </div> <!-- /.tab-content -->
376 </div> <!-- /.toptabs -->
379 </div> <!-- /.col-sm-10.col-sm-push-2 -->
381 <div class="col-sm-2 col-sm-pull-10">
383 [% INCLUDE 'circ-menu.inc' %]
385 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
386 </div> <!-- /.row -->
389 <div id="confirm_change_form" class="modal" tabindex="-1" role="dialog" aria-hidden="true">
390 <div class="modal-dialog">
391 <div class="modal-content">
392 <div class="modal-header">
393 <h3>The amount collected is more than the outstanding charge</h3>
395 <div class="modal-body">
396 <p>The amount collected from the patron is higher than the amount to be paid.</p>
397 <p>The change to give is <strong><span id="modal_change">0.00</span></strong>.</p>
398 <p>Confirm this payment?</p>
400 <div class="modal-footer">
401 <button class="btn btn-default approve" id="modal_submit" type="button"><i class="fa fa-check"></i> Yes</button>
402 <button class="btn btn-default deny cancel" href="#" data-dismiss="modal" aria-hidden="true"><i class="fa fa-times"></i> No</button>
408 [% MACRO jsinclude BLOCK %]
409 [% INCLUDE 'str/members-menu.inc' %]
410 [% Asset.js("js/members-menu.js") | $raw %]
412 $(document).ready(function() {
413 [% IF payment_id && Koha.Preference('FinePaymentAutoPopup') %]
414 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');
417 var forms = $('#payindivfine, #payfine');
418 var change = $('#change')[0];
420 $('#payindivfine, #payfine').preventDoubleFormSubmit();
421 $("#paid, #collected").on("change",function() {
423 if (change != undefined) {
424 updateChangeValues();
428 if (change != undefined) {
429 forms.on("submit", function(e) {
430 if (change.innerHTML > 0.00) {
432 $("#confirm_change_form").modal("show");
439 $("#confirm_change_form").on("hidden.bs.modal", function(){
440 // remove class added by preventDoubleFormSubmit if necessary
441 $("body, form input[type='submit'], form button[type='submit'], form a").removeClass('waiting');
444 $('#modal_submit').click(function() {
448 $( "#payindivfine, #payfine" ).validate({
450 paid: { required: true },
454 [% IF Koha.Preference('UseCashRegisters') %]
456 [% IF Koha.Preference('RequireCashRegister') %]
459 required: function() {
460 return $('#payment_type').val() == 'CASH'
466 invalidHandler: function(event, validator) {
467 // reset beenSubmitted for prevenDoubleFormSubmit
468 event.target.beenSubmitted = false;
469 // remove class added by preventDoubleFormSubmit
470 $("body, form input[type='submit'], form button[type='submit'], form a").removeClass('waiting');
476 $('#woindivfine').on('submit', function(e){
477 if ( prevent_default ) {
480 let amount_outstanding = parseFloat( $('#amountoutstanding').attr('value') );
481 let amount_writeoff = parseFloat( $('#amountwrittenoff').attr('value') );
482 if ( amount_writeoff > amount_outstanding ) {
483 alert(_("You are attemping to writeoff more than the value of the fee."));
484 $('#woindivfine').beenSubmitted = false;
487 $('#woindivfine').preventDoubleFormSubmit();
488 $('#woindivfine').submit();
493 function moneyFormat(textObj) {
494 var newValue = textObj.value;
500 for(var i = newValue.length; 0 < i; i--) {
501 aChar = newValue.substring(i-1, i);
502 if ("0" <= aChar && aChar <= "9") {
504 dolAmount = "" + aChar + dolAmount;
507 decAmount = "" + aChar + decAmount;
510 if (aChar == "." || aChar == ",") {
516 dolAmount = decAmount;
520 if (dolAmount == "") {
524 if (dolAmount.length > 1) {
525 while(dolAmount.length > 1 && dolAmount.substring(0,1) == "0") {
526 dolAmount = dolAmount.substring(1,dolAmount.length);
529 if (decAmount.length > 2) {
530 decAmount = decAmount.substring(0,2);
533 if (decAmount.length == 1) {
534 decAmount = decAmount + "0";
536 if (decAmount.length == 0) {
537 decAmount = decAmount + "00";
540 textObj.value = dolAmount + "." + decAmount;
543 function updateChangeValues() {
544 var change = $('#change')[0];
545 change.innerHTML = Math.round(($('#collected')[0].value - $('#paid')[0].value) * 100) / 100;
546 if (change.innerHTML <= 0) {
547 var paid = $('#paid')[0];
549 $('#collected').rules( "add", { min: Number(paid.value) });
550 $( "#payindivfine, #payfine" ).valid();
551 change.innerHTML = "0.00";
552 $('input[name="change_given"]').val('0.00');
554 change.value = change.innerHTML;
556 change.innerHTML = change.value;
557 $('input[name="change_given"]').val(change.value);
560 $('#modal_change').html(change.innerHTML);
565 [% INCLUDE 'intranet-bottom.inc' %]