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 [% patron.firstname | html %] [% patron.surname | html %]
28 Collect fine payment for [% patron.firstname | html %] [% patron.surname | html %]
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 [% patron.firstname | html %] [% patron.surname | html %]</a>
50 <a href="#" aria-current="page">
51 [% IF ( pay_individual ) %]
52 Pay an individual fine
53 [% ELSIF ( writeoff_individual ) %]
54 Write off an individual fine
56 [% IF ( selected_accts ) %]
57 [% IF type == 'WRITEOFF' %]
58 Write off an amount toward selected fines
60 Pay an amount toward selected fines
63 Pay an amount toward all fines
71 <div class="main container-fluid">
73 <div class="col-sm-10 col-sm-push-2">
77 [% IF ( pay_individual ) %]
78 Pay an individual fine
79 [% ELSIF ( writeoff_individual ) %]
80 Write off an individual fine
82 [% IF ( selected_accts ) %]
83 [% IF type == 'WRITEOFF' %]
84 Write off an amount toward selected fines
86 Pay an amount toward selected fines
89 Pay an amount toward all fines
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 | format('%.2f') %].
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 | format('%.2f') %].
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="title" id="title" value="[% patron.title | html %]" />
145 <input type="hidden" name="change_given" id="change_given" />
147 <fieldset class="rows">
148 <legend>Pay an individual fine</legend>
149 <input type="hidden" name="payment_note" id="payment_note" value="[% payment_note | html %]" />
153 <th>Account type</th>
155 <th>Amount outstanding</th>
158 <tr><td colspan="3">Total amount payable:</td><td>[% amountoutstanding | format('%.2f') %]</td></tr>
162 [% individual_description | html %]
164 [% line.debit_type_code = debit_type_code %]
165 <td>[% PROCESS account_type_description account=line %]</td>
166 <td class="debit">[% amount | format('%.2f') %]</td>
167 <td class="debit">[% amountoutstanding | format('%.2f') %]</td>
174 <label for="paid">Amount being paid: </label>
175 <input name="paid" id="paid" type="text" step="0.01" min="0" value="[% amountoutstanding | $Price on_editing => 1 %]"/>
178 <label for="collected">Amount tendered: </label>
179 <input name="collected" id="collected" type="text" step="0.01" min="0" value="[% amountoutstanding | $Price on_editing => 1 %]"/>
182 <label>Change to give: </label>
183 <span id="change">0.00</span>
186 [% INCLUDE 'transaction_types.inc' type="payment" %]
188 [% IF Koha.Preference('UseCashRegisters') %]
190 <label for="cash_register">Cash register: </label>
191 <select name="cash_register" id="cash_register">
192 <option id="noregister" disabled selected="selected" value="">-- Select an option--</option>
193 [% PROCESS options_for_registers %]
201 <input type="submit" name="submitbutton" value="Confirm" />
202 <a class="cancel" href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% patron.borrowernumber | html %]">Cancel</a>
206 [% ELSIF ( writeoff_individual ) %]
207 <ul class="nav nav-pills">
208 <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>
209 <li role="presentation" class="active"><a>Write off</a></li>
212 <form name="woindivfine" id="woindivfine" action="/cgi-bin/koha/members/pay.pl" method="post" >
213 <input type="hidden" name="csrf_token" value="[% csrf_token | html %]" />
214 <fieldset class="rows">
215 <legend>Write off an individual fine</legend>
216 <input type="hidden" name="borrowernumber" id="borrowernumber" value="[% patron.borrowernumber | html %]" />
217 <input type="hidden" name="pay_individual" id="pay_individual" value="[% pay_individual | html %]" />
218 <input type="hidden" name="itemnumber" id="itemnumber" value="[% itemnumber | html %]" />
219 <input type="hidden" name="description" id="description" value="[% individual_description | html %]" />
220 <input type="hidden" name="debit_type_code" id="debit_type_code" value="[% debit_type_code | html %]" />
221 <input type="hidden" name="amount" id="amount" value="[% amount | html %]" />
222 <input type="hidden" name="accountlines_id" id="accountlines_id" value="[% accountlines_id | html %]" />
223 <input type="hidden" name="title" id="title" value="[% patron.title | html %]" />
224 <input type="hidden" name="payment_note" id="payment_note" value="[% payment_note | html %]" />
225 <input type="hidden" name="amountoutstanding" id="amountoutstanding" value="[% amountoutstanding | html %]" />
226 <input type="hidden" name="confirm_writeoff" id="confirm_writeoff" value="1" />
227 <input type="hidden" name="change_given" id="change_given" />
231 <th>Account type</th>
233 <th>Amount outstanding</th>
235 <tfoot><tr><td colspan="3">Total amount outstanding:</td><td>[% amountoutstanding | format('%.2f') %]</td></tr></tfoot>
237 <td>[% individual_description | html %]</td>
238 [% line.debit_type_code = debit_type_code %]
239 <td>[% PROCESS account_type_description account=line %]</td>
240 <td class="debit">[% amount | format('%.2f') %]</td>
241 <td class="debit">[% amountoutstanding | format('%.2f') %]</td>
247 <label for="amountwrittenoff">Writeoff amount: </label>
248 <!-- default to writing off all -->
249 <input name="amountwrittenoff" id="amountwrittenoff" value="[% amountoutstanding | $Price on_editing => 1 %]" type="text" />
254 <input type="submit" value="Write off this charge" />
255 <a class="cancel" href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% patron.borrowernumber | html %]">Cancel</a>
259 [% IF Koha.Preference('UseCashRegisters') && ( registers.size == 0 ) && ( type != 'WRITEOFF' ) %]
260 [% PROCESS 'cash_register_required' %]
263 [% IF selected_accts %]
264 <ul class="nav nav-pills">
265 [% IF type == 'WRITEOFF' %]
266 <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>
267 <li role="presentation" class="active"><a>Write off</a></li>
269 <li role="presentation" class="active"><a>Pay</a></li>
270 <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>
275 <form name="payfine" id="payfine" method="post" action="/cgi-bin/koha/members/paycollect.pl">
276 <input type="hidden" name="csrf_token" value="[% csrf_token | html %]" />
277 <input type="hidden" name="borrowernumber" id="borrowernumber" value="[% patron.borrowernumber | html %]" />
278 <input type="hidden" name="selected_accts" id="selected_accts" value="[% selected_accts | html %]" />
279 <input type="hidden" name="total" id="total" value="[% total | html %]" />
280 <input type="hidden" name="type" value="[% type | html %]" />
281 <input type="hidden" name="change_given" id="change_given" />
283 <fieldset class="rows">
284 [% IF ( selected_accts ) %]
285 [% IF type == 'WRITEOFF' %]
286 <legend>Write off an amount toward selected fines</legend>
288 <legend>Pay an amount toward selected fines</legend>
291 <legend>Pay an amount toward all fines</legend>
296 <span class="label">Total amount outstanding: </span>
297 <span class="debit">[% total | format('%.2f') %]</span>
300 [% IF type == 'WRITEOFF' %]
301 <label for="paid">Writeoff amount: </label>
303 <label for="paid">Amount being paid: </label>
305 <input name="paid" id="paid" type="text" step="0.01" min="0" value="[% total | $Price on_editing => 1 %]"/>
307 [% IF type != 'WRITEOFF' %]
309 <label for="collected">Amount tendered: </label>
310 <input name="collected" id="collected" type="text" step="0.01" min="0" value="[% total | $Price on_editing => 1 %]"/>
313 <label>Change to give: </label>
314 <span id="change">0.00</span>
317 [% INCLUDE 'transaction_types.inc' type="payment" %]
319 [% IF Koha.Preference('UseCashRegisters') %]
321 <label for="cash_register">Cash register: </label>
322 <select name="cash_register" id="cash_register">
323 <option id="noregister" disabled selected="selected" value="">-- Select an option--</option>
324 [% PROCESS options_for_registers %]
331 <label for="selected_accts_notes">Note: </label>
332 <textarea name="selected_accts_notes" id="selected_accts_notes">[% selected_accts_notes | html %]</textarea>
337 <input type="submit" name="submitbutton" value="Confirm" />
338 <a class="cancel" href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% patron.borrowernumber | html %]">Cancel</a>
346 </div> <!-- /.col-sm-10.col-sm-push-2 -->
348 <div class="col-sm-2 col-sm-pull-10">
350 [% INCLUDE 'circ-menu.inc' %]
352 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
353 </div> <!-- /.row -->
356 <div id="confirm_change_form" class="modal" tabindex="-1" role="dialog" aria-hidden="true">
357 <div class="modal-dialog">
358 <div class="modal-content">
359 <div class="modal-header">
360 <h3>The amount collected is more than the outstanding charge</h3>
362 <div class="modal-body">
363 <p>The amount collected from the patron is higher than the amount to be paid.</p>
364 <p>The change to give is <strong><span id="modal_change">0.00</span></strong>.</p>
365 <p>Confirm this payment?</p>
367 <div class="modal-footer">
368 <button class="btn btn-default approve" id="modal_submit" type="button"><i class="fa fa-check"></i> Yes</button>
369 <button class="btn btn-default deny cancel" href="#" data-dismiss="modal" aria-hidden="true"><i class="fa fa-times"></i> No</button>
375 [% MACRO jsinclude BLOCK %]
376 [% INCLUDE 'str/members-menu.inc' %]
377 [% Asset.js("js/members-menu.js") | $raw %]
379 $(document).ready(function() {
380 [% IF payment_id && Koha.Preference('FinePaymentAutoPopup') %]
381 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');
384 var forms = $('#payindivfine, #payfine');
385 var change = $('#change')[0];
387 $('#payindivfine, #payfine').preventDoubleFormSubmit();
388 $("#paid, #collected").on("change",function() {
390 if (change != undefined) {
391 updateChangeValues();
395 if (change != undefined) {
396 forms.on("submit", function(e) {
397 if (change.innerHTML > 0.00) {
399 $("#confirm_change_form").modal("show");
406 $("#confirm_change_form").on("hidden.bs.modal", function(){
407 // remove class added by preventDoubleFormSubmit if necessary
408 $("body, form input[type='submit'], form button[type='submit'], form a").removeClass('waiting');
411 $('#modal_submit').click(function() {
415 $( "#payindivfine, #payfine" ).validate({
417 paid: { required: true },
421 [% IF Koha.Preference('UseCashRegisters') %]
423 required: function() {
424 return $('#payment_type').val() == 'CASH'
429 invalidHandler: function(event, validator) {
430 // reset beenSubmitted for prevenDoubleFormSubmit
431 event.target.beenSubmitted = false;
432 // remove class added by preventDoubleFormSubmit
433 $("body, form input[type='submit'], form button[type='submit'], form a").removeClass('waiting');
439 $('#woindivfine').on('submit', function(e){
440 if ( prevent_default ) {
443 let amount_outstanding = parseFloat( $('#amountoutstanding').attr('value') );
444 let amount_writeoff = parseFloat( $('#amountwrittenoff').attr('value') );
445 if ( amount_writeoff > amount_outstanding ) {
446 alert(_("You are attemping to writeoff more than the value of the fee."));
447 $('#woindivfine').beenSubmitted = false;
450 $('#woindivfine').preventDoubleFormSubmit();
451 $('#woindivfine').submit();
456 function moneyFormat(textObj) {
457 var newValue = textObj.value;
463 for(i=0; i < newValue.length; i++) {
464 aChar = newValue.substring(i, i+1);
465 if (aChar >= "0" && aChar <= "9") {
467 decAmount = "" + decAmount + aChar;
470 dolAmount = "" + dolAmount + aChar;
482 if (dolAmount == "") {
486 if (dolAmount.length > 1) {
487 while(dolAmount.length > 1 && dolAmount.substring(0,1) == "0") {
488 dolAmount = dolAmount.substring(1,dolAmount.length);
491 if (decAmount.length > 2) {
492 decAmount = decAmount.substring(0,2);
495 if (decAmount.length == 1) {
496 decAmount = decAmount + "0";
498 if (decAmount.length == 0) {
499 decAmount = decAmount + "00";
502 textObj.value = dolAmount + "." + decAmount;
505 function updateChangeValues() {
506 var change = $('#change')[0];
507 change.innerHTML = Math.round(($('#collected')[0].value - $('#paid')[0].value) * 100) / 100;
508 if (change.innerHTML <= 0) {
509 var paid = $('#paid')[0];
511 $('#collected').rules( "add", { min: Number(paid.value) });
512 $( "#payindivfine, #payfine" ).valid();
513 change.innerHTML = "0.00";
514 $('input[name="change_given"]').val('0.00');
516 change.value = change.innerHTML;
518 change.innerHTML = change.value;
519 $('input[name="change_given"]').val(change.value);
522 $('#modal_change').html(change.innerHTML);
527 [% INCLUDE 'intranet-bottom.inc' %]