7 [% PROCESS 'i18n.inc' %]
9 [% PROCESS 'accounts.inc' %]
10 [% INCLUDE 'doc-head-open.inc' %]
11 [% BLOCK cash_register_required %]
12 <div id="error_message" class="dialog message">
14 You must have at least one cash register associated with the library before you can record payments.
16 [% IF ( CAN_user_parameters_manage_cash_registers ) %]
17 <form action="/cgi-bin/koha/admin/cash_registers.pl" method="get">
18 <input type="hidden" name="op" value="add_form" />
19 <button class="new" type="submit"><i class="fa fa-plus"></i> Create a new cash register</button>
24 [% SET registers = Registers.all( filters => { current_branch => 1 } ) %]
25 <title>[% FILTER collapse %]
26 [% IF type == 'WRITEOFF' %]
27 [% tx("Write off an amount for {patron}", patron = "") | html %] [% INCLUDE 'patron-title.inc' no_html = 1 %]
29 [% tx("Collect payment for {patron}", patron = "") | html %] [% INCLUDE 'patron-title.inc' no_html = 1 %]
31 [% t("Patrons") | html %] ›
32 [% t("Koha") | html %]
34 [% INCLUDE 'doc-head-close.inc' %]
37 <body id="pat_paycollect" class="pat">
38 [% WRAPPER 'header.inc' %]
39 [% INCLUDE 'patron-search-header.inc' %]
42 [% WRAPPER 'sub-header.inc' %]
43 [% WRAPPER breadcrumbs %]
44 [% WRAPPER breadcrumb_item %]
45 <a href="/cgi-bin/koha/members/members-home.pl">Patrons</a>
47 [% WRAPPER breadcrumb_item %]
48 <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% patron.borrowernumber | uri %]">[% INCLUDE 'patron-title.inc' %]</a>
50 [% WRAPPER breadcrumb_item %]
51 <a href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% patron.borrowernumber | uri %]">Make a payment</a>
53 [% WRAPPER breadcrumb_item bc_active= 1 %]
54 [% IF ( pay_individual ) %]
55 <span>Pay an individual charge</span>
56 [% ELSIF ( writeoff_individual ) %]
57 <span>Write off an individual charge</span>
59 [% IF ( selected_accts ) %]
60 [% IF type == 'WRITEOFF' %]
61 <span>Write off an amount toward selected charges</span>
63 <span>Pay an amount toward selected charges</span>
66 <span>Pay an amount toward all charges</span>
70 [% END #/ WRAPPER breadcrumbs %]
71 [% END #/ WRAPPER sub-header.inc %]
73 <div class="main container-fluid">
75 <div class="col-sm-10 col-sm-push-2">
77 [% INCLUDE 'messages.inc' %]
80 [% IF ( pay_individual ) %]
81 <span>Pay an individual charge</span>
82 [% ELSIF ( writeoff_individual ) %]
83 <span>Write off an individual charge</span>
85 [% IF ( selected_accts ) %]
86 [% IF type == 'WRITEOFF' %]
87 <span>Write off an amount toward selected charges</span>
89 <span>Pay an amount toward selected charges</span>
92 <span>Pay an amount toward all charges</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 [% IF CAN_user_updatecharges_manual_invoice %]
109 <li role="presentation" class="manualinvoice">
110 <a href="/cgi-bin/koha/members/maninvoice.pl?borrowernumber=[% patron.borrowernumber | uri %]" role="tab">Create manual invoice</a>
113 [% IF CAN_user_updatecharges_manual_credit %]
114 <li role="presentation" class="manualcredit">
115 <a href="/cgi-bin/koha/members/mancredit.pl?borrowernumber=[% patron.borrowernumber | uri %]" role="tab">Create manual credit</a>
118 </ul> <!-- /.nav.nav-tabs -->
119 <div class="tab-content">
120 <div role="tabpanel" class="tab-pane active">
121 [% IF ( error_over ) %]
122 <div id="error_message" class="dialog alert">
123 You must pay a value less than or equal to [% total_due | $Price %].
126 [% IF ( error_under ) %]
127 <div id="error_message" class="dialog alert">
128 You must collect a value greater than or equal to [% total_paid | $Price %].
132 [% IF ( pay_individual ) %]
133 [% IF Koha.Preference('UseCashRegisters') && ( registers.size == 0 ) %]
134 [% PROCESS 'cash_register_required' %]
137 <ul class="nav nav-pills">
138 <li role="presentation" class="active"><a href="#">Pay</a></li>
139 <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>
142 <form name="payindivfine" id="payindivfine" method="post" action="/cgi-bin/koha/members/paycollect.pl">
143 <input type="hidden" name="csrf_token" value="[% csrf_token | html %]" />
144 <input type="hidden" name="borrowernumber" id="borrowernumber" value="[% patron.borrowernumber | html %]" />
145 <input type="hidden" name="pay_individual" id="pay_individual" value="[% pay_individual | html %]" />
146 <input type="hidden" name="itemnumber" id="itemnumber" value="[% itemnumber | html %]" />
147 <input type="hidden" name="description" id="description" value="[% individual_description | html %]" />
148 <input type="hidden" name="debit_type_code" id="debit_type_code" value="[% debit_type_code | html %]" />
149 <input type="hidden" name="amount" id="amount" value="[% amount | html %]" />
150 <input type="hidden" name="amountoutstanding" id="amountoutstanding" value="[% amountoutstanding | html %]" />
151 <input type="hidden" name="accountlines_id" id="accountlines_id" value="[% accountlines_id | html %]" />
152 <input type="hidden" name="change_given" id="change_given" />
154 <fieldset class="rows">
155 <legend>Pay an individual charge</legend>
156 <input type="hidden" name="payment_note" id="payment_note" value="[% payment_note | html %]" />
160 <th>Account type</th>
162 <th>Amount outstanding</th>
165 <tr><td colspan="3">Total amount payable:</td><td>[% amountoutstanding | $Price %]</td></tr>
169 [% individual_description | html %]
171 [% line.debit_type_code = debit_type_code %]
172 <td>[% PROCESS account_type_description account=line %]</td>
173 <td class="debit">[% amount | $Price %]</td>
174 <td class="debit">[% amountoutstanding | $Price %]</td>
181 <label for="paid">Amount being paid: </label>
182 <input name="paid" id="paid" type="text" step="0.01" min="0" value="[% amountoutstanding | $Price on_editing => 1 %]"/>
185 <label for="collected">Amount tendered: </label>
186 <input name="collected" id="collected" type="text" step="0.01" min="0" value="[% amountoutstanding | $Price on_editing => 1 %]"/>
189 <label>Change to give: </label>
190 <span id="change">0.00</span>
193 [% INCLUDE 'transaction_types.inc' type="payment" %]
195 [% IF Koha.Preference('UseCashRegisters') %]
197 [% IF Koha.Preference('RequireCashRegister') %]
198 <label for="cash_register" class="required">
200 <label for="cash_register">
205 [% IF Koha.Preference('RequireCashRegister') %]
206 <select name="cash_register" id="cash_register" required>
208 <select name="cash_register" id="cash_register">
210 <option id="noregister" disabled selected="selected" value="">-- Select an option--</option>
211 [% PROCESS options_for_registers %]
214 [% IF Koha.Preference('RequireCashRegister') %]
215 <span class="required">Required</span>
222 [% IF available_additional_fields %]
223 [% INCLUDE 'additional-fields-entry.inc' available=available_additional_fields values=additional_field_values %]
227 <input type="submit" name="submitbutton" class="btn btn-primary" value="Confirm" />
228 <a class="cancel" href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% patron.borrowernumber | html %]">Cancel</a>
232 [% ELSIF ( writeoff_individual ) %]
233 <ul class="nav nav-pills">
234 <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>
235 <li role="presentation" class="active"><a href="#">Write off</a></li>
238 <form name="woindivfine" id="woindivfine" action="/cgi-bin/koha/members/pay.pl" method="post" >
239 <input type="hidden" name="csrf_token" value="[% csrf_token | html %]" />
240 <fieldset class="rows">
241 <legend>Write off an individual charge</legend>
242 <input type="hidden" name="borrowernumber" id="borrowernumber" value="[% patron.borrowernumber | html %]" />
243 <input type="hidden" name="pay_individual" id="pay_individual" value="[% pay_individual | html %]" />
244 <input type="hidden" name="itemnumber" id="itemnumber" value="[% itemnumber | html %]" />
245 <input type="hidden" name="description" id="description" value="[% individual_description | html %]" />
246 <input type="hidden" name="debit_type_code" id="debit_type_code" value="[% debit_type_code | html %]" />
247 <input type="hidden" name="amount" id="amount" value="[% amount | html %]" />
248 <input type="hidden" name="accountlines_id" id="accountlines_id" value="[% accountlines_id | html %]" />
249 <input type="hidden" name="payment_note" id="payment_note" value="[% payment_note | html %]" />
250 <input type="hidden" name="amountoutstanding" id="amountoutstanding" value="[% amountoutstanding | html %]" />
251 <input type="hidden" name="confirm_writeoff" id="confirm_writeoff" value="1" />
252 <input type="hidden" name="change_given" id="change_given" />
256 <th>Account type</th>
258 <th>Amount outstanding</th>
260 <tfoot><tr><td colspan="3">Total amount outstanding:</td><td>[% amountoutstanding | $Price %]</td></tr></tfoot>
262 <td>[% individual_description | html %]</td>
263 [% line.debit_type_code = debit_type_code %]
264 <td>[% PROCESS account_type_description account=line %]</td>
265 <td class="debit">[% amount | $Price %]</td>
266 <td class="debit">[% amountoutstanding | $Price %]</td>
272 <label for="amountwrittenoff">Writeoff amount: </label>
273 <!-- default to writing off all -->
274 <input name="amountwrittenoff" id="amountwrittenoff" value="[% amountoutstanding | $Price on_editing => 1 %]" type="text" />
279 [% IF available_additional_fields %]
280 [% INCLUDE 'additional-fields-entry.inc' available=available_additional_fields values=additional_field_values %]
284 <input type="submit" class="btn btn-primary" value="Write off this charge" />
285 <a class="cancel" href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% patron.borrowernumber | html %]">Cancel</a>
289 [% IF Koha.Preference('UseCashRegisters') && ( registers.size == 0 ) && ( type != 'WRITEOFF' ) %]
290 [% PROCESS 'cash_register_required' %]
293 [% IF selected_accts %]
294 <ul class="nav nav-pills">
295 [% IF type == 'WRITEOFF' %]
296 <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>
297 <li role="presentation" class="active"><a>Write off</a></li>
299 <li role="presentation" class="active"><a>Pay</a></li>
300 <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>
305 <form name="payfine" id="payfine" method="post" action="/cgi-bin/koha/members/paycollect.pl">
306 <input type="hidden" name="csrf_token" value="[% csrf_token | html %]" />
307 <input type="hidden" name="borrowernumber" id="borrowernumber" value="[% patron.borrowernumber | html %]" />
308 <input type="hidden" name="selected_accts" id="selected_accts" value="[% selected_accts | html %]" />
309 <input type="hidden" name="total" id="total" value="[% total | html %]" />
310 <input type="hidden" name="type" value="[% type | html %]" />
311 <input type="hidden" name="change_given" id="change_given" />
313 <fieldset class="rows">
314 [% IF ( selected_accts ) %]
315 [% IF type == 'WRITEOFF' %]
316 <legend>Write off an amount toward selected charges</legend>
318 <legend>Pay an amount toward selected charges</legend>
321 <legend>Pay an amount toward all charges</legend>
326 <span class="label">Total amount outstanding: </span>
327 <span class="debit">[% total | $Price %]</span>
330 [% IF type == 'WRITEOFF' %]
331 <label for="paid">Writeoff amount: </label>
333 <label for="paid">Amount being paid: </label>
335 <input name="paid" id="paid" type="text" step="0.01" min="0" value="[% total | $Price on_editing => 1 %]"/>
337 [% IF type != 'WRITEOFF' %]
339 <label for="collected">Amount tendered: </label>
340 <input name="collected" id="collected" type="text" step="0.01" min="0" value="[% total | $Price on_editing => 1 %]"/>
343 <label>Change to give: </label>
344 <span id="change">0.00</span>
347 [% INCLUDE 'transaction_types.inc' type="payment" %]
349 [% IF Koha.Preference('UseCashRegisters') %]
351 <label for="cash_register">Cash register: </label>
352 <select name="cash_register" id="cash_register">
353 <option id="noregister" disabled selected="selected" value="">-- Select an option--</option>
354 [% PROCESS options_for_registers %]
361 <label for="selected_accts_notes">Note: </label>
362 <textarea name="selected_accts_notes" id="selected_accts_notes">[% selected_accts_notes | html %]</textarea>
367 [% IF available_additional_fields %]
368 [% INCLUDE 'additional-fields-entry.inc' available=available_additional_fields values=additional_field_values %]
372 <input type="submit" name="submitbutton" class="btn btn-primary" value="Confirm" />
373 <a class="cancel" href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% patron.borrowernumber | html %]">Cancel</a>
378 </div> <!-- /.tab-pane -->
379 </div> <!-- /.tab-content -->
380 </div> <!-- /.toptabs -->
383 </div> <!-- /.col-sm-10.col-sm-push-2 -->
385 <div class="col-sm-2 col-sm-pull-10">
387 [% INCLUDE 'circ-menu.inc' %]
389 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
390 </div> <!-- /.row -->
393 <div id="confirm_change_form" class="modal" tabindex="-1" role="dialog" aria-hidden="true">
394 <div class="modal-dialog">
395 <div class="modal-content">
396 <div class="modal-header">
397 <h3>The amount collected is more than the outstanding charge</h3>
399 <div class="modal-body">
400 <p>The amount collected from the patron is higher than the amount to be paid.</p>
401 <p>The change to give is <strong><span id="modal_change">0.00</span></strong>.</p>
402 <p>Confirm this payment?</p>
404 <div class="modal-footer">
405 <button class="btn btn-default approve" id="modal_submit" type="button"><i class="fa fa-check"></i> Yes</button>
406 <button class="btn btn-default deny cancel" href="#" data-dismiss="modal" aria-hidden="true"><i class="fa fa-times"></i> No</button>
412 [% MACRO jsinclude BLOCK %]
413 [% INCLUDE 'str/members-menu.inc' %]
414 [% Asset.js("js/members-menu.js") | $raw %]
416 $(document).ready(function() {
417 [% IF payment_id && Koha.Preference('FinePaymentAutoPopup') %]
418 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');
421 var forms = $('#payindivfine, #payfine');
422 var change = $('#change')[0];
424 $('#payindivfine, #payfine').preventDoubleFormSubmit();
425 $("#paid, #collected").on("change",function() {
427 if (change != undefined) {
428 updateChangeValues();
432 if (change != undefined) {
433 forms.on("submit", function(e) {
434 if (change.innerHTML > 0.00) {
436 $("#confirm_change_form").modal("show");
443 $("#confirm_change_form").on("hidden.bs.modal", function(){
444 // remove class added by preventDoubleFormSubmit if necessary
445 $("body, form input[type='submit'], form button[type='submit'], form a").removeClass('waiting');
448 $('#modal_submit').click(function() {
452 $( "#payindivfine, #payfine" ).validate({
454 paid: { required: true },
458 [% IF Koha.Preference('UseCashRegisters') %]
460 [% IF Koha.Preference('RequireCashRegister') %]
463 required: function() {
464 return $('#payment_type').val() == 'CASH'
470 invalidHandler: function(event, validator) {
471 // reset beenSubmitted for prevenDoubleFormSubmit
472 event.target.beenSubmitted = false;
473 // remove class added by preventDoubleFormSubmit
474 $("body, form input[type='submit'], form button[type='submit'], form a").removeClass('waiting');
480 $('#woindivfine').on('submit', function(e){
481 if ( prevent_default ) {
484 let amount_outstanding = parseFloat( $('#amountoutstanding').attr('value') );
485 let amount_writeoff = parseFloat( $('#amountwrittenoff').attr('value') );
486 if ( amount_writeoff > amount_outstanding ) {
487 alert(_("You are attemping to writeoff more than the value of the fee."));
488 $('#woindivfine').beenSubmitted = false;
491 $('#woindivfine').preventDoubleFormSubmit();
492 $('#woindivfine').submit();
497 function moneyFormat(textObj) {
498 var newValue = textObj.value;
504 for(var i = newValue.length; 0 < i; i--) {
505 aChar = newValue.substring(i-1, i);
506 if ("0" <= aChar && aChar <= "9") {
508 dolAmount = "" + aChar + dolAmount;
511 decAmount = "" + aChar + decAmount;
514 if (aChar == "." || aChar == ",") {
520 dolAmount = decAmount;
524 if (dolAmount == "") {
528 if (dolAmount.length > 1) {
529 while(dolAmount.length > 1 && dolAmount.substring(0,1) == "0") {
530 dolAmount = dolAmount.substring(1,dolAmount.length);
533 if (decAmount.length > 2) {
534 decAmount = decAmount.substring(0,2);
537 if (decAmount.length == 1) {
538 decAmount = decAmount + "0";
540 if (decAmount.length == 0) {
541 decAmount = decAmount + "00";
544 textObj.value = dolAmount + "." + decAmount;
547 function updateChangeValues() {
548 var change = $('#change')[0];
549 change.innerHTML = Math.round(($('#collected')[0].value - $('#paid')[0].value) * 100) / 100;
550 if (change.innerHTML <= 0) {
551 var paid = $('#paid')[0];
553 $('#collected').rules( "add", { min: Number(paid.value) });
554 $( "#payindivfine, #payfine" ).valid();
555 change.innerHTML = "0.00";
556 $('input[name="change_given"]').val('0.00');
558 change.value = change.innerHTML;
560 change.innerHTML = change.value;
561 $('input[name="change_given"]').val(change.value);
564 $('#modal_change').html(change.innerHTML);
569 [% INCLUDE 'intranet-bottom.inc' %]