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>
214 [% IF available_additional_fields %]
215 [% INCLUDE 'additional-fields-entry.inc' available=available_additional_fields values=additional_field_values %]
219 <input type="submit" name="submitbutton" value="Confirm" />
220 <a class="cancel" href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% patron.borrowernumber | html %]">Cancel</a>
224 [% ELSIF ( writeoff_individual ) %]
225 <ul class="nav nav-pills">
226 <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>
227 <li role="presentation" class="active"><a>Write off</a></li>
230 <form name="woindivfine" id="woindivfine" action="/cgi-bin/koha/members/pay.pl" method="post" >
231 <input type="hidden" name="csrf_token" value="[% csrf_token | html %]" />
232 <fieldset class="rows">
233 <legend>Write off an individual fine</legend>
234 <input type="hidden" name="borrowernumber" id="borrowernumber" value="[% patron.borrowernumber | html %]" />
235 <input type="hidden" name="pay_individual" id="pay_individual" value="[% pay_individual | html %]" />
236 <input type="hidden" name="itemnumber" id="itemnumber" value="[% itemnumber | html %]" />
237 <input type="hidden" name="description" id="description" value="[% individual_description | html %]" />
238 <input type="hidden" name="debit_type_code" id="debit_type_code" value="[% debit_type_code | html %]" />
239 <input type="hidden" name="amount" id="amount" value="[% amount | html %]" />
240 <input type="hidden" name="accountlines_id" id="accountlines_id" value="[% accountlines_id | html %]" />
241 <input type="hidden" name="payment_note" id="payment_note" value="[% payment_note | html %]" />
242 <input type="hidden" name="amountoutstanding" id="amountoutstanding" value="[% amountoutstanding | html %]" />
243 <input type="hidden" name="confirm_writeoff" id="confirm_writeoff" value="1" />
244 <input type="hidden" name="change_given" id="change_given" />
248 <th>Account type</th>
250 <th>Amount outstanding</th>
252 <tfoot><tr><td colspan="3">Total amount outstanding:</td><td>[% amountoutstanding | $Price %]</td></tr></tfoot>
254 <td>[% individual_description | html %]</td>
255 [% line.debit_type_code = debit_type_code %]
256 <td>[% PROCESS account_type_description account=line %]</td>
257 <td class="debit">[% amount | $Price %]</td>
258 <td class="debit">[% amountoutstanding | $Price %]</td>
264 <label for="amountwrittenoff">Writeoff amount: </label>
265 <!-- default to writing off all -->
266 <input name="amountwrittenoff" id="amountwrittenoff" value="[% amountoutstanding | $Price on_editing => 1 %]" type="text" />
271 [% IF available_additional_fields %]
272 [% INCLUDE 'additional-fields-entry.inc' available=available_additional_fields values=additional_field_values %]
276 <input type="submit" value="Write off this charge" />
277 <a class="cancel" href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% patron.borrowernumber | html %]">Cancel</a>
281 [% IF Koha.Preference('UseCashRegisters') && ( registers.size == 0 ) && ( type != 'WRITEOFF' ) %]
282 [% PROCESS 'cash_register_required' %]
285 [% IF selected_accts %]
286 <ul class="nav nav-pills">
287 [% IF type == 'WRITEOFF' %]
288 <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>
289 <li role="presentation" class="active"><a>Write off</a></li>
291 <li role="presentation" class="active"><a>Pay</a></li>
292 <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>
297 <form name="payfine" id="payfine" method="post" action="/cgi-bin/koha/members/paycollect.pl">
298 <input type="hidden" name="csrf_token" value="[% csrf_token | html %]" />
299 <input type="hidden" name="borrowernumber" id="borrowernumber" value="[% patron.borrowernumber | html %]" />
300 <input type="hidden" name="selected_accts" id="selected_accts" value="[% selected_accts | html %]" />
301 <input type="hidden" name="total" id="total" value="[% total | html %]" />
302 <input type="hidden" name="type" value="[% type | html %]" />
303 <input type="hidden" name="change_given" id="change_given" />
305 <fieldset class="rows">
306 [% IF ( selected_accts ) %]
307 [% IF type == 'WRITEOFF' %]
308 <legend>Write off an amount toward selected fines</legend>
310 <legend>Pay an amount toward selected fines</legend>
313 <legend>Pay an amount toward all fines</legend>
318 <span class="label">Total amount outstanding: </span>
319 <span class="debit">[% total | $Price %]</span>
322 [% IF type == 'WRITEOFF' %]
323 <label for="paid">Writeoff amount: </label>
325 <label for="paid">Amount being paid: </label>
327 <input name="paid" id="paid" type="text" step="0.01" min="0" value="[% total | $Price on_editing => 1 %]"/>
329 [% IF type != 'WRITEOFF' %]
331 <label for="collected">Amount tendered: </label>
332 <input name="collected" id="collected" type="text" step="0.01" min="0" value="[% total | $Price on_editing => 1 %]"/>
335 <label>Change to give: </label>
336 <span id="change">0.00</span>
339 [% INCLUDE 'transaction_types.inc' type="payment" %]
341 [% IF Koha.Preference('UseCashRegisters') %]
343 <label for="cash_register">Cash register: </label>
344 <select name="cash_register" id="cash_register">
345 <option id="noregister" disabled selected="selected" value="">-- Select an option--</option>
346 [% PROCESS options_for_registers %]
353 <label for="selected_accts_notes">Note: </label>
354 <textarea name="selected_accts_notes" id="selected_accts_notes">[% selected_accts_notes | html %]</textarea>
359 [% IF available_additional_fields %]
360 [% INCLUDE 'additional-fields-entry.inc' available=available_additional_fields values=additional_field_values %]
364 <input type="submit" name="submitbutton" value="Confirm" />
365 <a class="cancel" href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% patron.borrowernumber | html %]">Cancel</a>
373 </div> <!-- /.col-sm-10.col-sm-push-2 -->
375 <div class="col-sm-2 col-sm-pull-10">
377 [% INCLUDE 'circ-menu.inc' %]
379 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
380 </div> <!-- /.row -->
383 <div id="confirm_change_form" class="modal" tabindex="-1" role="dialog" aria-hidden="true">
384 <div class="modal-dialog">
385 <div class="modal-content">
386 <div class="modal-header">
387 <h3>The amount collected is more than the outstanding charge</h3>
389 <div class="modal-body">
390 <p>The amount collected from the patron is higher than the amount to be paid.</p>
391 <p>The change to give is <strong><span id="modal_change">0.00</span></strong>.</p>
392 <p>Confirm this payment?</p>
394 <div class="modal-footer">
395 <button class="btn btn-default approve" id="modal_submit" type="button"><i class="fa fa-check"></i> Yes</button>
396 <button class="btn btn-default deny cancel" href="#" data-dismiss="modal" aria-hidden="true"><i class="fa fa-times"></i> No</button>
402 [% MACRO jsinclude BLOCK %]
403 [% INCLUDE 'str/members-menu.inc' %]
404 [% Asset.js("js/members-menu.js") | $raw %]
406 $(document).ready(function() {
407 [% IF payment_id && Koha.Preference('FinePaymentAutoPopup') %]
408 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');
411 var forms = $('#payindivfine, #payfine');
412 var change = $('#change')[0];
414 $('#payindivfine, #payfine').preventDoubleFormSubmit();
415 $("#paid, #collected").on("change",function() {
417 if (change != undefined) {
418 updateChangeValues();
422 if (change != undefined) {
423 forms.on("submit", function(e) {
424 if (change.innerHTML > 0.00) {
426 $("#confirm_change_form").modal("show");
433 $("#confirm_change_form").on("hidden.bs.modal", function(){
434 // remove class added by preventDoubleFormSubmit if necessary
435 $("body, form input[type='submit'], form button[type='submit'], form a").removeClass('waiting');
438 $('#modal_submit').click(function() {
442 $( "#payindivfine, #payfine" ).validate({
444 paid: { required: true },
448 [% IF Koha.Preference('UseCashRegisters') %]
450 [% IF Koha.Preference('RequireCashRegister') %]
453 required: function() {
454 return $('#payment_type').val() == 'CASH'
460 invalidHandler: function(event, validator) {
461 // reset beenSubmitted for prevenDoubleFormSubmit
462 event.target.beenSubmitted = false;
463 // remove class added by preventDoubleFormSubmit
464 $("body, form input[type='submit'], form button[type='submit'], form a").removeClass('waiting');
470 $('#woindivfine').on('submit', function(e){
471 if ( prevent_default ) {
474 let amount_outstanding = parseFloat( $('#amountoutstanding').attr('value') );
475 let amount_writeoff = parseFloat( $('#amountwrittenoff').attr('value') );
476 if ( amount_writeoff > amount_outstanding ) {
477 alert(_("You are attemping to writeoff more than the value of the fee."));
478 $('#woindivfine').beenSubmitted = false;
481 $('#woindivfine').preventDoubleFormSubmit();
482 $('#woindivfine').submit();
487 function moneyFormat(textObj) {
488 var newValue = textObj.value;
494 for(var i = newValue.length; 0 < i; i--) {
495 aChar = newValue.substring(i-1, i);
496 if ("0" <= aChar && aChar <= "9") {
498 dolAmount = "" + aChar + dolAmount;
501 decAmount = "" + aChar + decAmount;
504 if (aChar == "." || aChar == ",") {
510 dolAmount = decAmount;
514 if (dolAmount == "") {
518 if (dolAmount.length > 1) {
519 while(dolAmount.length > 1 && dolAmount.substring(0,1) == "0") {
520 dolAmount = dolAmount.substring(1,dolAmount.length);
523 if (decAmount.length > 2) {
524 decAmount = decAmount.substring(0,2);
527 if (decAmount.length == 1) {
528 decAmount = decAmount + "0";
530 if (decAmount.length == 0) {
531 decAmount = decAmount + "00";
534 textObj.value = dolAmount + "." + decAmount;
537 function updateChangeValues() {
538 var change = $('#change')[0];
539 change.innerHTML = Math.round(($('#collected')[0].value - $('#paid')[0].value) * 100) / 100;
540 if (change.innerHTML <= 0) {
541 var paid = $('#paid')[0];
543 $('#collected').rules( "add", { min: Number(paid.value) });
544 $( "#payindivfine, #payfine" ).valid();
545 change.innerHTML = "0.00";
546 $('input[name="change_given"]').val('0.00');
548 change.value = change.innerHTML;
550 change.innerHTML = change.value;
551 $('input[name="change_given"]').val(change.value);
554 $('#modal_change').html(change.innerHTML);
559 [% INCLUDE 'intranet-bottom.inc' %]