5 [% USE AuthorisedValues %]
8 [% INCLUDE 'doc-head-open.inc' %]
9 <title>Koha › Patrons › Collect fine payment for [% patron.firstname | html %] [% patron.surname | html %]</title>
10 [% INCLUDE 'doc-head-close.inc' %]
13 <body id="pat_paycollect" class="pat">
14 [% INCLUDE 'header.inc' %]
15 [% INCLUDE 'patron-search.inc' %]
16 <div id="breadcrumbs">
17 <a href="/cgi-bin/koha/mainpage.pl">Home</a> ›
18 <a href="/cgi-bin/koha/members/members-home.pl">Patrons</a> ›
19 <a href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% patron.borrowernumber | uri %]">Pay fines for [% patron.firstname | html %] [% patron.surname | html %]</a> ›
20 [% IF ( pay_individual ) %]Pay an individual fine
21 [% ELSIF ( writeoff_individual ) %]Write off an individual fine
23 [% IF ( selected_accts ) %]
24 [% IF type == 'writeoff' %]Write off an amount toward selected fines
25 [% ELSE %]Pay an amount toward selected fines
27 [% ELSE %]Pay an amount toward all fines
32 <div class="main container-fluid">
34 <div class="col-sm-10 col-sm-push-2">
37 [% INCLUDE 'members-toolbar.inc' borrowernumber=patron.borrowernumber %]
40 <!-- The manual invoice and credit buttons -->
41 <div class="statictabs">
44 <a href="/cgi-bin/koha/members/boraccount.pl?borrowernumber=[% patron.borrowernumber | uri %]">Transactions</a>
47 <a href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% patron.borrowernumber | uri %]" >Make a payment</a>
50 <a href="/cgi-bin/koha/members/maninvoice.pl?borrowernumber=[% patron.borrowernumber | uri %]" >Create manual invoice</a>
53 <a href="/cgi-bin/koha/members/mancredit.pl?borrowernumber=[% patron.borrowernumber | uri %]" >Create manual credit</a>
56 <div class="tabs-container">
57 [% IF ( error_over ) %]
58 <div id="error_message" class="dialog alert">
59 You must pay a value less than or equal to [% total_due | format('%.2f') %].
63 [% IF ( pay_individual ) %]
64 <form name="payindivfine" id="payindivfine" method="post" action="/cgi-bin/koha/members/paycollect.pl">
65 <input type="hidden" name="csrf_token" value="[% csrf_token | html %]" />
66 <input type="hidden" name="borrowernumber" id="borrowernumber" value="[% patron.borrowernumber | html %]" />
67 <input type="hidden" name="pay_individual" id="pay_individual" value="[% pay_individual | html %]" />
68 <input type="hidden" name="itemnumber" id="itemnumber" value="[% itemnumber | html %]" />
69 <input type="hidden" name="description" id="description" value="[% description | html %]" />
70 <input type="hidden" name="accounttype" id="accounttype" value="[% accounttype | html %]" />
71 <input type="hidden" name="amount" id="amount" value="[% amount | html %]" />
72 <input type="hidden" name="amountoutstanding" id="amountoutstanding" value="[% amountoutstanding | html %]" />
73 <input type="hidden" name="accountlines_id" id="accountlines_id" value="[% accountlines_id | html %]" />
74 <input type="hidden" name="title" id="title" value="[% title | html %]" />
76 <fieldset class="rows">
77 <legend>Pay an individual fine</legend>
78 <input type="hidden" name="payment_note" id="payment_note" value="[% payment_note | html %]" />
84 <th>Amount outstanding</th>
87 <tr><td colspan="3">Total amount payable:</td><td>[% amountoutstanding | format('%.2f') %]</td></tr>
91 [% individual_description | html %]
93 <td>[% accounttype | html %]</td>
94 <td class="debit">[% amount | format('%.2f') %]</td>
95 <td class="debit">[% amountoutstanding | format('%.2f') %]</td>
102 <label for="paid">Amount paid: </label>
103 <input name="paid" id="paid" value="[% amountoutstanding | $Price %]"/>
106 <label for="collected">Collect from patron: </label>
107 <input id="collected" value="[% amountoutstanding | $Price %]"/>
110 <label>Change to give: </label>
111 <span id="change">0.00</span>
113 [% SET payment_types = AuthorisedValues.GetAuthValueDropbox('PAYMENT_TYPE') %]
114 [% IF payment_types %]
116 <label for="payment_type">Payment type: </label>
117 <select name="payment_type" id="payment_type">
118 <option value=""></option>
119 [% FOREACH pt IN payment_types %]
120 <option value="[% pt.authorised_value | html %]">[% pt.lib | html %]</option>
128 <div class="action"><input type="submit" name="submitbutton" value="Confirm" />
129 <a class="cancel" href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% patron.borrowernumber | html %]">Cancel</a></div>
131 [% ELSIF ( writeoff_individual ) %]
132 <form name="woindivfine" id="woindivfine" action="/cgi-bin/koha/members/pay.pl" method="post" >
133 <input type="hidden" name="csrf_token" value="[% csrf_token | html %]" />
134 <fieldset class="rows">
135 <legend>Write off an individual fine</legend>
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="[% description | html %]" />
140 <input type="hidden" name="accounttype" id="accounttype" value="[% accounttype | html %]" />
141 <input type="hidden" name="amount" id="amount" value="[% amount | html %]" />
142 <input type="hidden" name="accountlines_id" id="accountlines_id" value="[% accountlines_id | html %]" />
143 <input type="hidden" name="title" id="title" value="[% title | html %]" />
144 <input type="hidden" name="payment_note" id="payment_note" value="[% payment_note | html %]" />
145 <input type="hidden" name="amountoutstanding" id="amountoutstanding" value="[% amountoutstanding | html %]" />
146 <input type="hidden" name="confirm_writeoff" id="confirm_writeoff" value="1" />
150 <th>Account type</th>
152 <th>Amount outstanding</th>
154 <tfoot><tr><td colspan="3">Total amount outstanding:</td><td>[% amountoutstanding | format('%.2f') %]</td></tr></tfoot>
156 <td>[% description | html %] [% title | html %]</td>
157 <td>[% accounttype | html %]</td>
158 <td class="debit">[% amount | format('%.2f') %]</td>
159 <td class="debit">[% amountoutstanding | format('%.2f') %]</td>
165 <label for="paid">Writeoff amount: </label>
166 <!-- default to writing off all -->
167 <input name="amountwrittenoff" id="amountwrittenoff" value="[% amountoutstanding | $Price on_editing => 1 %]" type="text" />
172 <input type="submit" value="Write off this charge" />
173 <a class="cancel" href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% patron.borrowernumber | html %]">Cancel</a>
178 <form name="payfine" id="payfine" method="post" action="/cgi-bin/koha/members/paycollect.pl">
179 <input type="hidden" name="csrf_token" value="[% csrf_token | html %]" />
180 <input type="hidden" name="borrowernumber" id="borrowernumber" value="[% patron.borrowernumber | html %]" />
181 <input type="hidden" name="selected_accts" id="selected_accts" value="[% selected_accts | html %]" />
182 <input type="hidden" name="total" id="total" value="[% total | html %]" />
183 <input type="hidden" name="type" value="[% type | html %]" />
185 <fieldset class="rows">
186 [% IF ( selected_accts ) %]
187 [% IF type == 'writeoff' %]
188 <legend>Write off an amount toward selected fines</legend>
190 <legend>Pay an amount toward selected fines</legend>
193 <legend>Pay an amount toward all fines</legend>
198 <span class="label">Total amount outstanding: </span>
199 <span class="debit">[% total | format('%.2f') %]</span>
202 <label for="paid">Amount paid :</label>
203 <input name="paid" id="paid" value="[% total | $Price %]"/>
206 [% IF type == 'writeoff' %]
207 <label for="collected">Writeoff amount: </label>
209 <label for="collected">Collect from patron: </label>
211 <input id="collected" value="[% total | $Price %]"/>
214 <label>Change to give: </label>
215 <span id="change">0.00</span>
217 [% SET payment_types = AuthorisedValues.GetAuthValueDropbox('PAYMENT_TYPE') %]
218 [% IF payment_types %]
220 <label for="payment_type">Payment type: </label>
221 <select name="payment_type" id="payment_type">
222 <option value=""></option>
223 [% FOREACH pt IN payment_types %]
224 <option value="[% pt.authorised_value | html %]">[% pt.lib | html %]</option>
230 <label for="selected_accts_notes">Note: </label>
231 <textarea name="selected_accts_notes" id="selected_accts_notes">[% selected_accts_notes | html %]</textarea>
236 <input type="submit" name="submitbutton" value="Confirm" />
237 <a class="cancel" href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% patron.borrowernumber | html %]">Cancel</a>
244 </div> <!-- /.col-sm-10.col-sm-push-2 -->
246 <div class="col-sm-2 col-sm-pull-10">
248 [% INCLUDE 'circ-menu.inc' %]
250 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
251 </div> <!-- /.row -->
254 <a class="hidden" href="#confirm_change_form" data-toggle="modal"></a>
255 <div id="confirm_change_form" class="modal" tabindex="-1" role="dialog" aria-hidden="true">
256 <div class="modal-dialog">
257 <div class="modal-content">
258 <div class="modal-header">
259 <h3>Amount collected higher than paid</h3>
261 <div class="modal-body">
262 <p>The amount collected from the patron is higher than the amount paid.</p>
263 <p>The change to give is <b><span id="modal_change">0.00</span></b>.</p>
264 <p>Do you still confirm the payment?</p>
266 <div class="modal-footer">
267 <button class="btn btn-default approve" id="modal_submit" type="button"><i class="fa fa-check"></i> Yes</button>
268 <button class="btn btn-default deny cancel" href="#" data-dismiss="modal" aria-hidden="true"><i class="fa fa-times"></i> No</button>
274 [% MACRO jsinclude BLOCK %]
275 [% INCLUDE 'str/members-menu.inc' %]
276 [% Asset.js("js/members-menu.js") | $raw %]
278 $(document).ready(function() {
279 var forms = $('#payindivfine, #payfine');
280 var change = $('#change')[0];
282 $('#payindivfine, #payfine').preventDoubleFormSubmit();
283 $("#paid, #collected").on("change",function() {
285 if (change != undefined) {
286 updateChangeValues();
290 if (change != undefined) {
291 forms.bind('submit', function(e) {
292 if (change.innerHTML > 0.00) {
294 $('a[href="#confirm_change_form"]').click();
299 $('#modal_submit').click(function() {
305 $('#woindivfine').on('submit', function(e){
306 if ( prevent_default ) {
309 let amount_outstanding = parseFloat( $('#amountoutstanding').attr('value') );
310 let amount_writeoff = parseFloat( $('#amountwrittenoff').attr('value') );
311 if ( amount_writeoff > amount_outstanding ) {
312 alert(_("You are attemping to writeoff more than the value of the fee."));
313 $('#woindivfine').beenSubmitted = false;
316 $('#woindivfine').preventDoubleFormSubmit();
317 $('#woindivfine').submit();
322 function moneyFormat(textObj) {
323 var newValue = textObj.value;
329 for(i=0; i < newValue.length; i++) {
330 aChar = newValue.substring(i, i+1);
331 if (aChar >= "0" && aChar <= "9") {
333 decAmount = "" + decAmount + aChar;
336 dolAmount = "" + dolAmount + aChar;
348 if (dolAmount == "") {
352 if (dolAmount.length > 1) {
353 while(dolAmount.length > 1 && dolAmount.substring(0,1) == "0") {
354 dolAmount = dolAmount.substring(1,dolAmount.length);
357 if (decAmount.length > 2) {
358 decAmount = decAmount.substring(0,2);
361 if (decAmount.length == 1) {
362 decAmount = decAmount + "0";
364 if (decAmount.length == 0) {
365 decAmount = decAmount + "00";
368 textObj.value = dolAmount + "." + decAmount;
371 function updateChangeValues() {
372 var change = $('#change')[0];
373 change.innerHTML = Math.round(($('#collected')[0].value - $('#paid')[0].value) * 100) / 100;
374 if (change.innerHTML <= 0) {
375 change.innerHTML = "0.00";
377 change.value = change.innerHTML;
379 change.innerHTML = change.value;
382 $('#modal_change').html(change.innerHTML);
387 [% INCLUDE 'intranet-bottom.inc' %]