Bug 36076: paycollect.tt add permission checks for manual credit and invoice
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / members / paycollect.tt
1 [% USE raw %]
2 [% USE Asset %]
3 [% USE Koha %]
4 [% USE Branches %]
5 [% USE Registers %]
6 [% USE Price %]
7 [% PROCESS 'i18n.inc' %]
8 [% SET footerjs = 1 %]
9 [% PROCESS 'accounts.inc' %]
10 [% INCLUDE 'doc-head-open.inc' %]
11 [% BLOCK cash_register_required %]
12     <div id="error_message" class="dialog message">
13         <p>
14             You must have at least one cash register associated with the library before you can record payments.
15         </p>
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>
20             </form>
21         [% END %]
22     </div>
23 [% END %]
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 %]
28     [% ELSE %]
29         [% tx("Collect payment for {patron}", patron = "") | html %] [% INCLUDE 'patron-title.inc' no_html = 1 %]
30     [% END %] &rsaquo;
31     [% t("Patrons") | html %] &rsaquo;
32     [% t("Koha") | html %]
33 [% END %]</title>
34 [% INCLUDE 'doc-head-close.inc' %]
35 </head>
36
37 <body id="pat_paycollect" class="pat">
38 [% WRAPPER 'header.inc' %]
39     [% INCLUDE 'patron-search-header.inc' %]
40 [% END %]
41
42 [% WRAPPER 'sub-header.inc' %]
43     [% WRAPPER breadcrumbs %]
44         [% WRAPPER breadcrumb_item %]
45             <a href="/cgi-bin/koha/members/members-home.pl">Patrons</a>
46         [% END %]
47         [% WRAPPER breadcrumb_item %]
48             <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% patron.borrowernumber | uri %]">[% INCLUDE 'patron-title.inc' %]</a>
49         [% END %]
50         [% WRAPPER breadcrumb_item %]
51             <a href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% patron.borrowernumber | uri %]">Make a payment</a>
52         [% END %]
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>
58             [% ELSE %]
59                 [% IF ( selected_accts ) %]
60                     [% IF type == 'WRITEOFF' %]
61                         <span>Write off an amount toward selected charges</span>
62                     [% ELSE %]
63                         <span>Pay an amount toward selected charges</span>
64                     [% END %]
65                 [% ELSE %]
66                     <span>Pay an amount toward all charges</span>
67                 [% END %]
68             [% END %]
69         [% END %]
70     [% END #/ WRAPPER breadcrumbs %]
71 [% END #/ WRAPPER sub-header.inc %]
72
73 <div class="main container-fluid">
74     <div class="row">
75         <div class="col-sm-10 col-sm-push-2">
76             <main>
77                 [% INCLUDE 'messages.inc' %]
78
79             <h1>
80                 [% IF ( pay_individual ) %]
81                     <span>Pay an individual charge</span>
82                 [% ELSIF ( writeoff_individual ) %]
83                     <span>Write off an individual charge</span>
84                 [% ELSE %]
85                     [% IF ( selected_accts ) %]
86                         [% IF type == 'WRITEOFF' %]
87                             <span>Write off an amount toward selected charges</span>
88                         [% ELSE %]
89                             <span>Pay an amount toward selected charges</span>
90                         [% END %]
91                     [% ELSE %]
92                         <span>Pay an amount toward all charges</span>
93                     [% END %]
94                 [% END %]
95             </h1>
96
97 [% INCLUDE 'members-toolbar.inc' borrowernumber=patron.borrowernumber %]
98
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>
104         </li>
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>
107         </li>
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>
111             </li>
112         [% END %]
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>
116             </li>
117         [% END %]
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 %].
124     </div>
125 [% END %]
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 %].
129     </div>
130 [% END %]
131
132 [% IF ( pay_individual ) %]
133     [% IF Koha.Preference('UseCashRegisters') && ( registers.size == 0 ) %]
134         [% PROCESS 'cash_register_required' %]
135     [% ELSE %]
136
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>
140     </ul>
141
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" />
153
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 %]" />
157     <table>
158     <thead><tr>
159             <th>Description</th>
160             <th>Account type</th>
161             <th>Amount</th>
162             <th>Amount outstanding</th>
163         </tr></thead>
164     <tfoot>
165         <tr><td colspan="3">Total amount payable:</td><td>[% amountoutstanding | $Price %]</td></tr>
166     </tfoot>
167     <tbody><tr>
168             <td>
169                 [% individual_description | html %]
170             </td>
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>
175         </tr></tbody>
176 </table>
177
178 <ol>
179
180     <li>
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 %]"/>
183     </li>
184     <li>
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 %]"/>
187     </li>
188     <li>
189         <label>Change to give: </label>
190         <span id="change">0.00</span>
191     </li>
192
193     [% INCLUDE 'transaction_types.inc' type="payment" %]
194
195     [% IF Koha.Preference('UseCashRegisters') %]
196     <li>
197         [% IF Koha.Preference('RequireCashRegister') %]
198             <label for="cash_register" class="required">
199         [% ELSE %]
200             <label for="cash_register">
201         [% END %]
202             Cash register:
203         </label>
204
205         [% IF Koha.Preference('RequireCashRegister') %]
206             <select name="cash_register" id="cash_register" required>
207         [% ELSE %]
208             <select name="cash_register" id="cash_register">
209         [% END %]
210             <option id="noregister" disabled selected="selected" value="">-- Select an option--</option>
211             [% PROCESS options_for_registers %]
212         </select>
213
214         [% IF Koha.Preference('RequireCashRegister') %]
215             <span class="required">Required</span>
216         [% END %]
217     </li>
218     [% END %]
219 </ol>
220 </fieldset>
221
222 [% IF available_additional_fields %]
223     [% INCLUDE 'additional-fields-entry.inc' available=available_additional_fields values=additional_field_values %]
224 [% END %]
225
226         <div class="action">
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>
229         </div>
230     </form>
231     [% END %]
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>
236     </ul>
237
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" />
253     <table>
254     <thead><tr>
255             <th>Description</th>
256             <th>Account type</th>
257             <th>Amount</th>
258             <th>Amount outstanding</th>
259         </tr></thead>
260     <tfoot><tr><td colspan="3">Total amount outstanding:</td><td>[% amountoutstanding | $Price %]</td></tr></tfoot>
261     <tbody><tr>
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>
267         </tr></tbody>
268     </table>
269
270             <ol>
271                 <li>
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" />
275                 </li>
276             </ol>
277         </fieldset>
278
279         [% IF available_additional_fields %]
280             [% INCLUDE 'additional-fields-entry.inc' available=available_additional_fields values=additional_field_values %]
281         [% END %]
282
283         <div class="action">
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>
286         </div>
287     </form>
288 [% ELSE %]
289     [% IF Koha.Preference('UseCashRegisters') && ( registers.size == 0 ) && ( type != 'WRITEOFF' ) %]
290         [% PROCESS 'cash_register_required' %]
291     [% ELSE %]
292
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 %]&notes=[% selected_accts_notes | uri %]">Pay</a></li>
297                 <li role="presentation" class="active"><a>Write off</a></li>
298             [% ELSE %]
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 %]&notes=[% selected_accts_notes | uri %]">Write off</a></li>
301             [% END %]
302         </ul>
303     [% END %]
304
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" />
312
313     <fieldset class="rows">
314     [% IF ( selected_accts ) %]
315         [% IF type == 'WRITEOFF' %]
316             <legend>Write off an amount toward selected charges</legend>
317         [% ELSE %]
318             <legend>Pay an amount toward selected charges</legend>
319         [% END %]
320     [% ELSE %]
321         <legend>Pay an amount toward all charges</legend>
322     [% END %]
323
324     <ol>
325         <li>
326             <span class="label">Total amount outstanding: </span>
327             <span class="debit">[% total | $Price %]</span>
328         </li>
329     <li>
330         [% IF type == 'WRITEOFF' %]
331             <label for="paid">Writeoff amount: </label>
332         [% ELSE %]
333             <label for="paid">Amount being paid: </label>
334         [% END %]
335         <input name="paid" id="paid" type="text" step="0.01" min="0" value="[% total | $Price on_editing => 1 %]"/>
336     </li>
337     [% IF type != 'WRITEOFF' %]
338         <li>
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 %]"/>
341         </li>
342         <li>
343             <label>Change to give: </label>
344             <span id="change">0.00</span>
345         </li>
346
347     [% INCLUDE 'transaction_types.inc' type="payment" %]
348
349     [% IF Koha.Preference('UseCashRegisters') %]
350     <li>
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 %]
355         </select>
356     </li>
357     [% END %]
358     [% END %]
359
360     <li>
361         <label for="selected_accts_notes">Note: </label>
362         <textarea name="selected_accts_notes" id="selected_accts_notes">[% selected_accts_notes | html %]</textarea>
363     </li>
364     </ol>
365     </fieldset>
366
367     [% IF available_additional_fields %]
368         [% INCLUDE 'additional-fields-entry.inc' available=available_additional_fields values=additional_field_values %]
369     [% END %]
370
371     <div class="action">
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>
374     </div>
375     </form>
376     [% END %]
377 [% END %]
378         </div> <!-- /.tab-pane -->
379     </div> <!-- /.tab-content -->
380 </div> <!-- /.toptabs -->
381
382             </main>
383         </div> <!-- /.col-sm-10.col-sm-push-2 -->
384
385         <div class="col-sm-2 col-sm-pull-10">
386             <aside>
387                 [% INCLUDE 'circ-menu.inc' %]
388             </aside>
389         </div> <!-- /.col-sm-2.col-sm-pull-10 -->
390      </div> <!-- /.row -->
391
392 <!-- Modal -->
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>
398             </div>
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>
403             </div>
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>
407             </div>
408         </div>
409     </div>
410 </div>
411
412 [% MACRO jsinclude BLOCK %]
413     [% INCLUDE 'str/members-menu.inc' %]
414     [% Asset.js("js/members-menu.js") | $raw %]
415     <script>
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');
419             [% END %]
420
421             var forms = $('#payindivfine, #payfine');
422             var change = $('#change')[0];
423
424             $('#payindivfine, #payfine').preventDoubleFormSubmit();
425             $("#paid, #collected").on("change",function() {
426                 moneyFormat( this );
427                 if (change != undefined) {
428                     updateChangeValues();
429                 }
430             });
431
432             if (change != undefined) {
433                 forms.on("submit", function(e) {
434                     if (change.innerHTML > 0.00) {
435                         e.preventDefault();
436                         $("#confirm_change_form").modal("show");
437                     } else {
438                         return true;
439                     }
440                 });
441             }
442
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');
446             });
447
448             $('#modal_submit').click(function() {
449                 forms[0].submit();
450             });
451
452             $( "#payindivfine, #payfine" ).validate({
453                 rules: {
454                     paid: { required: true },
455                     collected: {
456                         required: true
457                     },
458                     [% IF Koha.Preference('UseCashRegisters') %]
459                     cash_register: {
460                         [% IF Koha.Preference('RequireCashRegister') %]
461                             required: true
462                         [% ELSE %]
463                             required: function() {
464                                 return $('#payment_type').val() == 'CASH'
465                             }
466                         [% END %]
467                     }
468                     [% END %]
469                 },
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');
475                 }
476             });
477         });
478
479         prevent_default = 1;
480         $('#woindivfine').on('submit', function(e){
481             if ( prevent_default ) {
482                 e.preventDefault();
483
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;
489                 } else {
490                     prevent_default = 0;
491                     $('#woindivfine').preventDoubleFormSubmit();
492                     $('#woindivfine').submit();
493                 }
494             }
495         });
496
497         function moneyFormat(textObj) {
498             var newValue = textObj.value;
499             var decAmount = "";
500             var dolAmount = "";
501             var dolFlag   = false;
502             var aChar     = "";
503
504             for(var i = newValue.length; 0 < i; i--) {
505                 aChar = newValue.substring(i-1, i);
506                 if ("0" <= aChar && aChar <= "9") {
507                     if(dolFlag) {
508                         dolAmount = "" + aChar + dolAmount;
509                     }
510                     else {
511                         decAmount = "" + aChar + decAmount;
512                     }
513                 }
514                 if (aChar == "." || aChar == ",") {
515                     dolFlag = true;
516                 }
517             }
518
519             if (!dolFlag) {
520                 dolAmount = decAmount;
521                 decAmount = "";
522             }
523
524             if (dolAmount == "") {
525                 dolAmount = "0";
526             }
527         // Strip leading 0s
528             if (dolAmount.length > 1) {
529                 while(dolAmount.length > 1 && dolAmount.substring(0,1) == "0") {
530                     dolAmount = dolAmount.substring(1,dolAmount.length);
531                 }
532             }
533             if (decAmount.length > 2) {
534                 decAmount = decAmount.substring(0,2);
535             }
536         // Pad right side
537             if (decAmount.length == 1) {
538                decAmount = decAmount + "0";
539             }
540             if (decAmount.length == 0) {
541                decAmount = decAmount + "00";
542             }
543
544             textObj.value = dolAmount + "." + decAmount;
545         }
546
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];
552                 moneyFormat(paid);
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');
557             } else {
558                 change.value = change.innerHTML;
559                 moneyFormat(change);
560                 change.innerHTML = change.value;
561                 $('input[name="change_given"]').val(change.value);
562             }
563
564             $('#modal_change').html(change.innerHTML);
565         }
566     </script>
567 [% END %]
568
569 [% INCLUDE 'intranet-bottom.inc' %]