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 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 [% WRAPPER breadcrumbs %]
41 [% WRAPPER breadcrumb_item %]
42 <a href="/cgi-bin/koha/members/members-home.pl">Patrons</a>
44 [% WRAPPER breadcrumb_item %]
45 <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% patron.borrowernumber | uri %]">[% INCLUDE 'patron-title.inc' %]</a>
47 [% WRAPPER breadcrumb_item %]
48 <a href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% patron.borrowernumber | uri %]">Make a payment</a>
50 [% WRAPPER breadcrumb_item bc_active= 1 %]
51 [% IF ( pay_individual ) %]
52 <span>Pay an individual charge</span>
53 [% ELSIF ( writeoff_individual ) %]
54 <span>Write off an individual charge</span>
56 [% IF ( selected_accts ) %]
57 [% IF type == 'WRITEOFF' %]
58 <span>Write off an amount toward selected charges</span>
60 <span>Pay an amount toward selected charges</span>
63 <span>Pay an amount toward all charges</span>
67 [% END #/ WRAPPER breadcrumbs %]
68 [% END #/ WRAPPER sub-header.inc %]
70 <div class="main container-fluid">
72 <div class="col-sm-10 col-sm-push-2">
76 [% IF ( pay_individual ) %]
77 <span>Pay an individual charge</span>
78 [% ELSIF ( writeoff_individual ) %]
79 <span>Write off an individual charge</span>
81 [% IF ( selected_accts ) %]
82 [% IF type == 'WRITEOFF' %]
83 <span>Write off an amount toward selected charges</span>
85 <span>Pay an amount toward selected charges</span>
88 <span>Pay an amount toward all charges</span>
93 [% INCLUDE 'members-toolbar.inc' borrowernumber=patron.borrowernumber %]
95 <!-- The manual invoice and credit buttons -->
97 <ul class="nav nav-tabs" role="tablist">
98 <li role="presentation" class="transactions">
99 <a href="/cgi-bin/koha/members/boraccount.pl?borrowernumber=[% patron.borrowernumber | uri %]" role="tab">Transactions</a>
101 <li role="presentation" class="makepayment active">
102 <a href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% patron.borrowernumber | uri %]" role="tab">Make a payment</a>
104 <li role="presentation">
105 <a href="/cgi-bin/koha/members/maninvoice.pl?borrowernumber=[% patron.borrowernumber | uri %]" role="tab">Create manual invoice</a>
107 <li role="presentation">
108 <a href="/cgi-bin/koha/members/mancredit.pl?borrowernumber=[% patron.borrowernumber | uri %]" role="tab">Create manual credit</a>
110 </ul> <!-- /.nav.nav-tabs -->
111 <div class="tab-content">
112 <div role="tabpanel" class="tab-pane active">
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 href="#">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 charge</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" class="btn btn-primary" 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 href="#">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 charge</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" class="btn btn-primary" 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 charges</legend>
310 <legend>Pay an amount toward selected charges</legend>
313 <legend>Pay an amount toward all charges</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" class="btn btn-primary" value="Confirm" />
365 <a class="cancel" href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% patron.borrowernumber | html %]">Cancel</a>
370 </div> <!-- /.tab-pane -->
371 </div> <!-- /.tab-content -->
372 </div> <!-- /.toptabs -->
375 </div> <!-- /.col-sm-10.col-sm-push-2 -->
377 <div class="col-sm-2 col-sm-pull-10">
379 [% INCLUDE 'circ-menu.inc' %]
381 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
382 </div> <!-- /.row -->
385 <div id="confirm_change_form" class="modal" tabindex="-1" role="dialog" aria-hidden="true">
386 <div class="modal-dialog">
387 <div class="modal-content">
388 <div class="modal-header">
389 <h3>The amount collected is more than the outstanding charge</h3>
391 <div class="modal-body">
392 <p>The amount collected from the patron is higher than the amount to be paid.</p>
393 <p>The change to give is <strong><span id="modal_change">0.00</span></strong>.</p>
394 <p>Confirm this payment?</p>
396 <div class="modal-footer">
397 <button class="btn btn-default approve" id="modal_submit" type="button"><i class="fa fa-check"></i> Yes</button>
398 <button class="btn btn-default deny cancel" href="#" data-dismiss="modal" aria-hidden="true"><i class="fa fa-times"></i> No</button>
404 [% MACRO jsinclude BLOCK %]
405 [% INCLUDE 'str/members-menu.inc' %]
406 [% Asset.js("js/members-menu.js") | $raw %]
408 $(document).ready(function() {
409 [% IF payment_id && Koha.Preference('FinePaymentAutoPopup') %]
410 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');
413 var forms = $('#payindivfine, #payfine');
414 var change = $('#change')[0];
416 $('#payindivfine, #payfine').preventDoubleFormSubmit();
417 $("#paid, #collected").on("change",function() {
419 if (change != undefined) {
420 updateChangeValues();
424 if (change != undefined) {
425 forms.on("submit", function(e) {
426 if (change.innerHTML > 0.00) {
428 $("#confirm_change_form").modal("show");
435 $("#confirm_change_form").on("hidden.bs.modal", function(){
436 // remove class added by preventDoubleFormSubmit if necessary
437 $("body, form input[type='submit'], form button[type='submit'], form a").removeClass('waiting');
440 $('#modal_submit').click(function() {
444 $( "#payindivfine, #payfine" ).validate({
446 paid: { required: true },
450 [% IF Koha.Preference('UseCashRegisters') %]
452 [% IF Koha.Preference('RequireCashRegister') %]
455 required: function() {
456 return $('#payment_type').val() == 'CASH'
462 invalidHandler: function(event, validator) {
463 // reset beenSubmitted for prevenDoubleFormSubmit
464 event.target.beenSubmitted = false;
465 // remove class added by preventDoubleFormSubmit
466 $("body, form input[type='submit'], form button[type='submit'], form a").removeClass('waiting');
472 $('#woindivfine').on('submit', function(e){
473 if ( prevent_default ) {
476 let amount_outstanding = parseFloat( $('#amountoutstanding').attr('value') );
477 let amount_writeoff = parseFloat( $('#amountwrittenoff').attr('value') );
478 if ( amount_writeoff > amount_outstanding ) {
479 alert(_("You are attemping to writeoff more than the value of the fee."));
480 $('#woindivfine').beenSubmitted = false;
483 $('#woindivfine').preventDoubleFormSubmit();
484 $('#woindivfine').submit();
489 function moneyFormat(textObj) {
490 var newValue = textObj.value;
496 for(var i = newValue.length; 0 < i; i--) {
497 aChar = newValue.substring(i-1, i);
498 if ("0" <= aChar && aChar <= "9") {
500 dolAmount = "" + aChar + dolAmount;
503 decAmount = "" + aChar + decAmount;
506 if (aChar == "." || aChar == ",") {
512 dolAmount = decAmount;
516 if (dolAmount == "") {
520 if (dolAmount.length > 1) {
521 while(dolAmount.length > 1 && dolAmount.substring(0,1) == "0") {
522 dolAmount = dolAmount.substring(1,dolAmount.length);
525 if (decAmount.length > 2) {
526 decAmount = decAmount.substring(0,2);
529 if (decAmount.length == 1) {
530 decAmount = decAmount + "0";
532 if (decAmount.length == 0) {
533 decAmount = decAmount + "00";
536 textObj.value = dolAmount + "." + decAmount;
539 function updateChangeValues() {
540 var change = $('#change')[0];
541 change.innerHTML = Math.round(($('#collected')[0].value - $('#paid')[0].value) * 100) / 100;
542 if (change.innerHTML <= 0) {
543 var paid = $('#paid')[0];
545 $('#collected').rules( "add", { min: Number(paid.value) });
546 $( "#payindivfine, #payfine" ).valid();
547 change.innerHTML = "0.00";
548 $('input[name="change_given"]').val('0.00');
550 change.value = change.innerHTML;
552 change.innerHTML = change.value;
553 $('input[name="change_given"]').val(change.value);
556 $('#modal_change').html(change.innerHTML);
561 [% INCLUDE 'intranet-bottom.inc' %]