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">
79 [% IF ( pay_individual ) %]
80 <span>Pay an individual charge</span>
81 [% ELSIF ( writeoff_individual ) %]
82 <span>Write off an individual charge</span>
84 [% IF ( selected_accts ) %]
85 [% IF type == 'WRITEOFF' %]
86 <span>Write off an amount toward selected charges</span>
88 <span>Pay an amount toward selected charges</span>
91 <span>Pay an amount toward all charges</span>
96 [% INCLUDE 'members-toolbar.inc' borrowernumber=patron.borrowernumber %]
98 <!-- The manual invoice and credit buttons -->
100 <ul class="nav nav-tabs" role="tablist">
101 <li role="presentation" class="transactions">
102 <a href="/cgi-bin/koha/members/boraccount.pl?borrowernumber=[% patron.borrowernumber | uri %]" role="tab">Transactions</a>
104 <li role="presentation" class="makepayment active">
105 <a href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% patron.borrowernumber | uri %]" role="tab">Make a payment</a>
107 <li role="presentation">
108 <a href="/cgi-bin/koha/members/maninvoice.pl?borrowernumber=[% patron.borrowernumber | uri %]" role="tab">Create manual invoice</a>
110 <li role="presentation">
111 <a href="/cgi-bin/koha/members/mancredit.pl?borrowernumber=[% patron.borrowernumber | uri %]" role="tab">Create manual credit</a>
113 </ul> <!-- /.nav.nav-tabs -->
114 <div class="tab-content">
115 <div role="tabpanel" class="tab-pane active">
116 [% IF ( error_over ) %]
117 <div id="error_message" class="dialog alert">
118 You must pay a value less than or equal to [% total_due | $Price %].
121 [% IF ( error_under ) %]
122 <div id="error_message" class="dialog alert">
123 You must collect a value greater than or equal to [% total_paid | $Price %].
127 [% IF ( pay_individual ) %]
128 [% IF Koha.Preference('UseCashRegisters') && ( registers.size == 0 ) %]
129 [% PROCESS 'cash_register_required' %]
132 <ul class="nav nav-pills">
133 <li role="presentation" class="active"><a href="#">Pay</a></li>
134 <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>
137 <form name="payindivfine" id="payindivfine" method="post" action="/cgi-bin/koha/members/paycollect.pl">
138 <input type="hidden" name="csrf_token" value="[% csrf_token | html %]" />
139 <input type="hidden" name="borrowernumber" id="borrowernumber" value="[% patron.borrowernumber | html %]" />
140 <input type="hidden" name="pay_individual" id="pay_individual" value="[% pay_individual | html %]" />
141 <input type="hidden" name="itemnumber" id="itemnumber" value="[% itemnumber | html %]" />
142 <input type="hidden" name="description" id="description" value="[% individual_description | html %]" />
143 <input type="hidden" name="debit_type_code" id="debit_type_code" value="[% debit_type_code | html %]" />
144 <input type="hidden" name="amount" id="amount" value="[% amount | html %]" />
145 <input type="hidden" name="amountoutstanding" id="amountoutstanding" value="[% amountoutstanding | html %]" />
146 <input type="hidden" name="accountlines_id" id="accountlines_id" value="[% accountlines_id | html %]" />
147 <input type="hidden" name="change_given" id="change_given" />
149 <fieldset class="rows">
150 <legend>Pay an individual charge</legend>
151 <input type="hidden" name="payment_note" id="payment_note" value="[% payment_note | html %]" />
155 <th>Account type</th>
157 <th>Amount outstanding</th>
160 <tr><td colspan="3">Total amount payable:</td><td>[% amountoutstanding | $Price %]</td></tr>
164 [% individual_description | html %]
166 [% line.debit_type_code = debit_type_code %]
167 <td>[% PROCESS account_type_description account=line %]</td>
168 <td class="debit">[% amount | $Price %]</td>
169 <td class="debit">[% amountoutstanding | $Price %]</td>
176 <label for="paid">Amount being paid: </label>
177 <input name="paid" id="paid" type="text" step="0.01" min="0" value="[% amountoutstanding | $Price on_editing => 1 %]"/>
180 <label for="collected">Amount tendered: </label>
181 <input name="collected" id="collected" type="text" step="0.01" min="0" value="[% amountoutstanding | $Price on_editing => 1 %]"/>
184 <label>Change to give: </label>
185 <span id="change">0.00</span>
188 [% INCLUDE 'transaction_types.inc' type="payment" %]
190 [% IF Koha.Preference('UseCashRegisters') %]
192 [% IF Koha.Preference('RequireCashRegister') %]
193 <label for="cash_register" class="required">
195 <label for="cash_register">
200 [% IF Koha.Preference('RequireCashRegister') %]
201 <select name="cash_register" id="cash_register" required>
203 <select name="cash_register" id="cash_register">
205 <option id="noregister" disabled selected="selected" value="">-- Select an option--</option>
206 [% PROCESS options_for_registers %]
209 [% IF Koha.Preference('RequireCashRegister') %]
210 <span class="required">Required</span>
217 [% IF available_additional_fields %]
218 [% INCLUDE 'additional-fields-entry.inc' available=available_additional_fields values=additional_field_values %]
222 <input type="submit" name="submitbutton" class="btn btn-primary" value="Confirm" />
223 <a class="cancel" href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% patron.borrowernumber | html %]">Cancel</a>
227 [% ELSIF ( writeoff_individual ) %]
228 <ul class="nav nav-pills">
229 <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>
230 <li role="presentation" class="active"><a href="#">Write off</a></li>
233 <form name="woindivfine" id="woindivfine" action="/cgi-bin/koha/members/pay.pl" method="post" >
234 <input type="hidden" name="csrf_token" value="[% csrf_token | html %]" />
235 <fieldset class="rows">
236 <legend>Write off an individual charge</legend>
237 <input type="hidden" name="borrowernumber" id="borrowernumber" value="[% patron.borrowernumber | html %]" />
238 <input type="hidden" name="pay_individual" id="pay_individual" value="[% pay_individual | html %]" />
239 <input type="hidden" name="itemnumber" id="itemnumber" value="[% itemnumber | html %]" />
240 <input type="hidden" name="description" id="description" value="[% individual_description | html %]" />
241 <input type="hidden" name="debit_type_code" id="debit_type_code" value="[% debit_type_code | html %]" />
242 <input type="hidden" name="amount" id="amount" value="[% amount | html %]" />
243 <input type="hidden" name="accountlines_id" id="accountlines_id" value="[% accountlines_id | html %]" />
244 <input type="hidden" name="payment_note" id="payment_note" value="[% payment_note | html %]" />
245 <input type="hidden" name="amountoutstanding" id="amountoutstanding" value="[% amountoutstanding | html %]" />
246 <input type="hidden" name="confirm_writeoff" id="confirm_writeoff" value="1" />
247 <input type="hidden" name="change_given" id="change_given" />
251 <th>Account type</th>
253 <th>Amount outstanding</th>
255 <tfoot><tr><td colspan="3">Total amount outstanding:</td><td>[% amountoutstanding | $Price %]</td></tr></tfoot>
257 <td>[% individual_description | html %]</td>
258 [% line.debit_type_code = debit_type_code %]
259 <td>[% PROCESS account_type_description account=line %]</td>
260 <td class="debit">[% amount | $Price %]</td>
261 <td class="debit">[% amountoutstanding | $Price %]</td>
267 <label for="amountwrittenoff">Writeoff amount: </label>
268 <!-- default to writing off all -->
269 <input name="amountwrittenoff" id="amountwrittenoff" value="[% amountoutstanding | $Price on_editing => 1 %]" type="text" />
274 [% IF available_additional_fields %]
275 [% INCLUDE 'additional-fields-entry.inc' available=available_additional_fields values=additional_field_values %]
279 <input type="submit" class="btn btn-primary" value="Write off this charge" />
280 <a class="cancel" href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% patron.borrowernumber | html %]">Cancel</a>
284 [% IF Koha.Preference('UseCashRegisters') && ( registers.size == 0 ) && ( type != 'WRITEOFF' ) %]
285 [% PROCESS 'cash_register_required' %]
288 [% IF selected_accts %]
289 <ul class="nav nav-pills">
290 [% IF type == 'WRITEOFF' %]
291 <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>
292 <li role="presentation" class="active"><a>Write off</a></li>
294 <li role="presentation" class="active"><a>Pay</a></li>
295 <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>
300 <form name="payfine" id="payfine" method="post" action="/cgi-bin/koha/members/paycollect.pl">
301 <input type="hidden" name="csrf_token" value="[% csrf_token | html %]" />
302 <input type="hidden" name="borrowernumber" id="borrowernumber" value="[% patron.borrowernumber | html %]" />
303 <input type="hidden" name="selected_accts" id="selected_accts" value="[% selected_accts | html %]" />
304 <input type="hidden" name="total" id="total" value="[% total | html %]" />
305 <input type="hidden" name="type" value="[% type | html %]" />
306 <input type="hidden" name="change_given" id="change_given" />
308 <fieldset class="rows">
309 [% IF ( selected_accts ) %]
310 [% IF type == 'WRITEOFF' %]
311 <legend>Write off an amount toward selected charges</legend>
313 <legend>Pay an amount toward selected charges</legend>
316 <legend>Pay an amount toward all charges</legend>
321 <span class="label">Total amount outstanding: </span>
322 <span class="debit">[% total | $Price %]</span>
325 [% IF type == 'WRITEOFF' %]
326 <label for="paid">Writeoff amount: </label>
328 <label for="paid">Amount being paid: </label>
330 <input name="paid" id="paid" type="text" step="0.01" min="0" value="[% total | $Price on_editing => 1 %]"/>
332 [% IF type != 'WRITEOFF' %]
334 <label for="collected">Amount tendered: </label>
335 <input name="collected" id="collected" type="text" step="0.01" min="0" value="[% total | $Price on_editing => 1 %]"/>
338 <label>Change to give: </label>
339 <span id="change">0.00</span>
342 [% INCLUDE 'transaction_types.inc' type="payment" %]
344 [% IF Koha.Preference('UseCashRegisters') %]
346 <label for="cash_register">Cash register: </label>
347 <select name="cash_register" id="cash_register">
348 <option id="noregister" disabled selected="selected" value="">-- Select an option--</option>
349 [% PROCESS options_for_registers %]
356 <label for="selected_accts_notes">Note: </label>
357 <textarea name="selected_accts_notes" id="selected_accts_notes">[% selected_accts_notes | html %]</textarea>
362 [% IF available_additional_fields %]
363 [% INCLUDE 'additional-fields-entry.inc' available=available_additional_fields values=additional_field_values %]
367 <input type="submit" name="submitbutton" class="btn btn-primary" value="Confirm" />
368 <a class="cancel" href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% patron.borrowernumber | html %]">Cancel</a>
373 </div> <!-- /.tab-pane -->
374 </div> <!-- /.tab-content -->
375 </div> <!-- /.toptabs -->
378 </div> <!-- /.col-sm-10.col-sm-push-2 -->
380 <div class="col-sm-2 col-sm-pull-10">
382 [% INCLUDE 'circ-menu.inc' %]
384 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
385 </div> <!-- /.row -->
388 <div id="confirm_change_form" class="modal" tabindex="-1" role="dialog" aria-hidden="true">
389 <div class="modal-dialog">
390 <div class="modal-content">
391 <div class="modal-header">
392 <h3>The amount collected is more than the outstanding charge</h3>
394 <div class="modal-body">
395 <p>The amount collected from the patron is higher than the amount to be paid.</p>
396 <p>The change to give is <strong><span id="modal_change">0.00</span></strong>.</p>
397 <p>Confirm this payment?</p>
399 <div class="modal-footer">
400 <button class="btn btn-default approve" id="modal_submit" type="button"><i class="fa fa-check"></i> Yes</button>
401 <button class="btn btn-default deny cancel" href="#" data-dismiss="modal" aria-hidden="true"><i class="fa fa-times"></i> No</button>
407 [% MACRO jsinclude BLOCK %]
408 [% INCLUDE 'str/members-menu.inc' %]
409 [% Asset.js("js/members-menu.js") | $raw %]
411 $(document).ready(function() {
412 [% IF payment_id && Koha.Preference('FinePaymentAutoPopup') %]
413 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');
416 var forms = $('#payindivfine, #payfine');
417 var change = $('#change')[0];
419 $('#payindivfine, #payfine').preventDoubleFormSubmit();
420 $("#paid, #collected").on("change",function() {
422 if (change != undefined) {
423 updateChangeValues();
427 if (change != undefined) {
428 forms.on("submit", function(e) {
429 if (change.innerHTML > 0.00) {
431 $("#confirm_change_form").modal("show");
438 $("#confirm_change_form").on("hidden.bs.modal", function(){
439 // remove class added by preventDoubleFormSubmit if necessary
440 $("body, form input[type='submit'], form button[type='submit'], form a").removeClass('waiting');
443 $('#modal_submit').click(function() {
447 $( "#payindivfine, #payfine" ).validate({
449 paid: { required: true },
453 [% IF Koha.Preference('UseCashRegisters') %]
455 [% IF Koha.Preference('RequireCashRegister') %]
458 required: function() {
459 return $('#payment_type').val() == 'CASH'
465 invalidHandler: function(event, validator) {
466 // reset beenSubmitted for prevenDoubleFormSubmit
467 event.target.beenSubmitted = false;
468 // remove class added by preventDoubleFormSubmit
469 $("body, form input[type='submit'], form button[type='submit'], form a").removeClass('waiting');
475 $('#woindivfine').on('submit', function(e){
476 if ( prevent_default ) {
479 let amount_outstanding = parseFloat( $('#amountoutstanding').attr('value') );
480 let amount_writeoff = parseFloat( $('#amountwrittenoff').attr('value') );
481 if ( amount_writeoff > amount_outstanding ) {
482 alert(_("You are attemping to writeoff more than the value of the fee."));
483 $('#woindivfine').beenSubmitted = false;
486 $('#woindivfine').preventDoubleFormSubmit();
487 $('#woindivfine').submit();
492 function moneyFormat(textObj) {
493 var newValue = textObj.value;
499 for(var i = newValue.length; 0 < i; i--) {
500 aChar = newValue.substring(i-1, i);
501 if ("0" <= aChar && aChar <= "9") {
503 dolAmount = "" + aChar + dolAmount;
506 decAmount = "" + aChar + decAmount;
509 if (aChar == "." || aChar == ",") {
515 dolAmount = decAmount;
519 if (dolAmount == "") {
523 if (dolAmount.length > 1) {
524 while(dolAmount.length > 1 && dolAmount.substring(0,1) == "0") {
525 dolAmount = dolAmount.substring(1,dolAmount.length);
528 if (decAmount.length > 2) {
529 decAmount = decAmount.substring(0,2);
532 if (decAmount.length == 1) {
533 decAmount = decAmount + "0";
535 if (decAmount.length == 0) {
536 decAmount = decAmount + "00";
539 textObj.value = dolAmount + "." + decAmount;
542 function updateChangeValues() {
543 var change = $('#change')[0];
544 change.innerHTML = Math.round(($('#collected')[0].value - $('#paid')[0].value) * 100) / 100;
545 if (change.innerHTML <= 0) {
546 var paid = $('#paid')[0];
548 $('#collected').rules( "add", { min: Number(paid.value) });
549 $( "#payindivfine, #payfine" ).valid();
550 change.innerHTML = "0.00";
551 $('input[name="change_given"]').val('0.00');
553 change.value = change.innerHTML;
555 change.innerHTML = change.value;
556 $('input[name="change_given"]').val(change.value);
559 $('#modal_change').html(change.innerHTML);
564 [% INCLUDE 'intranet-bottom.inc' %]