+[% USE raw %]
+[% USE Asset %]
+[% USE Koha %]
+[% USE Branches %]
+[% USE AuthorisedValues %]
+[% USE Price %]
+[% SET footerjs = 1 %]
[% INCLUDE 'doc-head-open.inc' %]
-<title>Koha › Patrons › Collect fine payment for [% borrower.firstname %] [% borrower.surname %]</title>
+<title>Koha › Patrons › Collect fine payment for [% patron.firstname | html %] [% patron.surname | html %]</title>
[% INCLUDE 'doc-head-close.inc' %]
-<script type= "text/javascript">
-//<![CDATA[
-$(document).ready(function() {
- $('#payindivfine, #woindivfine, #payfine').preventDoubleFormSubmit();
-});
-//]]>
-</script>
-<script type= "text/javascript">
-//<![CDATA[
-function moneyFormat(textObj) {
- var newValue = textObj.value;
- var decAmount = "";
- var dolAmount = "";
- var decFlag = false;
- var aChar = "";
-
- for(i=0; i < newValue.length; i++) {
- aChar = newValue.substring(i, i+1);
- if (aChar >= "0" && aChar <= "9") {
- if(decFlag) {
- decAmount = "" + decAmount + aChar;
- }
- else {
- dolAmount = "" + dolAmount + aChar;
- }
- }
- if (aChar == ".") {
- if (decFlag) {
- dolAmount = "";
- break;
- }
- decFlag = true;
- }
- }
-
- if (dolAmount == "") {
- dolAmount = "0";
- }
-// Strip leading 0s
- if (dolAmount.length > 1) {
- while(dolAmount.length > 1 && dolAmount.substring(0,1) == "0") {
- dolAmount = dolAmount.substring(1,dolAmount.length);
- }
- }
- if (decAmount.length > 2) {
- decAmount = decAmount.substring(0,2);
- }
-// Pad right side
- if (decAmount.length == 1) {
- decAmount = decAmount + "0";
- }
- if (decAmount.length == 0) {
- decAmount = decAmount + "00";
- }
-
- textObj.value = dolAmount + "." + decAmount;
-}
-//]]>
-</script>
</head>
+
<body id="pat_paycollect" class="pat">
[% INCLUDE 'header.inc' %]
[% INCLUDE 'patron-search.inc' %]
-<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/members/members-home.pl">Patrons</a> › <a href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% borrower.borrowernumber %]">Pay fines for [% borrower.firstname %] [% borrower.surname %]</a> › [% IF ( pay_individual ) %]Pay an individual fine[% ELSIF ( writeoff_individual ) %]Write off an individual fine[% ELSE %][% IF ( selected_accts ) %]Pay an amount toward selected fines[% ELSE %]Pay an amount toward all fines[% END %][% END %]</div>
+<div id="breadcrumbs">
+ <a href="/cgi-bin/koha/mainpage.pl">Home</a> ›
+ <a href="/cgi-bin/koha/members/members-home.pl">Patrons</a> ›
+ <a href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% patron.borrowernumber | uri %]">Pay fines for [% patron.firstname | html %] [% patron.surname | html %]</a> ›
+ [% IF ( pay_individual ) %]Pay an individual fine
+ [% ELSIF ( writeoff_individual ) %]Write off an individual fine
+ [% ELSE %]
+ [% IF ( selected_accts ) %]
+ [% IF type == 'writeoff' %]Write off an amount toward selected fines
+ [% ELSE %]Pay an amount toward selected fines
+ [% END %]
+ [% ELSE %]Pay an amount toward all fines
+ [% END %]
+ [% END %]
+</div>
-<div id="doc3" class="yui-t2">
+<div class="main container-fluid">
+ <div class="row">
+ <div class="col-sm-10 col-sm-push-2">
+ <main>
-<div id="bd">
-<div id="yui-main">
-<div class="yui-b">
-[% INCLUDE 'members-toolbar.inc' borrowernumber=borrower.borrowernumber %]
+[% INCLUDE 'members-toolbar.inc' borrowernumber=patron.borrowernumber %]
<!-- The manual invoice and credit buttons -->
<div class="statictabs">
<ul>
<li>
- <a href="/cgi-bin/koha/members/boraccount.pl?borrowernumber=[% borrower.borrowernumber %]">Account</a>
+ <a href="/cgi-bin/koha/members/boraccount.pl?borrowernumber=[% patron.borrowernumber | uri %]">Transactions</a>
</li>
<li class="active">
- <a href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% borrower.borrowernumber %]" >Pay fines</a>
+ <a href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% patron.borrowernumber | uri %]" >Make a payment</a>
</li>
<li>
- <a href="/cgi-bin/koha/members/maninvoice.pl?borrowernumber=[% borrower.borrowernumber %]" >Create manual invoice</a>
+ <a href="/cgi-bin/koha/members/maninvoice.pl?borrowernumber=[% patron.borrowernumber | uri %]" >Create manual invoice</a>
</li>
<li>
- <a href="/cgi-bin/koha/members/mancredit.pl?borrowernumber=[% borrower.borrowernumber %]" >Create manual credit</a>
+ <a href="/cgi-bin/koha/members/mancredit.pl?borrowernumber=[% patron.borrowernumber | uri %]" >Create manual credit</a>
</li>
</ul>
<div class="tabs-container">
[% END %]
[% IF ( pay_individual ) %]
- <form name="payindivfine" id="payindivfine" onsubmit="return validatePayment(this);" method="post" action="/cgi-bin/koha/members/paycollect.pl">
- <input type="hidden" name="borrowernumber" id="borrowernumber" value="[% borrower.borrowernumber %]" />
- <input type="hidden" name="pay_individual" id="pay_individual" value="[% pay_individual %]" />
- <input type="hidden" name="itemnumber" id="itemnumber" value="[% itemnumber %]" />
- <input type="hidden" name="description" id="description" value="[% description %]" />
- <input type="hidden" name="accounttype" id="accounttype" value="[% accounttype %]" />
- <input type="hidden" name="notify_id" id="notify_id" value="[% notify_id %]" />
- <input type="hidden" name="notify_level" id="notify_level" value="[% notify_level %]" />
- <input type="hidden" name="amount" id="amount" value="[% amount %]" />
- <input type="hidden" name="amountoutstanding" id="amountoutstanding" value="[% amountoutstanding %]" />
- <input type="hidden" name="accountno" id="accountno" value="[% accountno %]" />
- <input type="hidden" name="accountlines_id" id="accountlines_id" value="[% accountlines_id %]" />
- <input type="hidden" name="title" id="title" value="[% title %]" />
+ [% IF ( error_registers ) %]
+ <div id="error_message" class="dialog alert">
+ You must have at least one cash register associated with this branch before you can record payments.
+ </div>
+ [% ELSE %]
+
+ <form name="payindivfine" id="payindivfine" method="post" action="/cgi-bin/koha/members/paycollect.pl">
+ <input type="hidden" name="csrf_token" value="[% csrf_token | html %]" />
+ <input type="hidden" name="borrowernumber" id="borrowernumber" value="[% patron.borrowernumber | html %]" />
+ <input type="hidden" name="pay_individual" id="pay_individual" value="[% pay_individual | html %]" />
+ <input type="hidden" name="itemnumber" id="itemnumber" value="[% itemnumber | html %]" />
+ <input type="hidden" name="description" id="description" value="[% description | html %]" />
+ <input type="hidden" name="debit_type_code" id="debit_type_code" value="[% debit_type_code | html %]" />
+ <input type="hidden" name="amount" id="amount" value="[% amount | html %]" />
+ <input type="hidden" name="amountoutstanding" id="amountoutstanding" value="[% amountoutstanding | html %]" />
+ <input type="hidden" name="accountlines_id" id="accountlines_id" value="[% accountlines_id | html %]" />
+ <input type="hidden" name="title" id="title" value="[% title | html %]" />
+ <input type="hidden" name="change_given" id="change_given" />
<fieldset class="rows">
<legend>Pay an individual fine</legend>
- <input type="hidden" name="payment_note" id="payment_note" value="[% payment_note %]" />
+ <input type="hidden" name="payment_note" id="payment_note" value="[% payment_note | html %]" />
<table>
<thead><tr>
<th>Description</th>
<th>Account type</th>
- <th>Notify id</th>
- <th>Level</th>
<th>Amount</th>
<th>Amount outstanding</th>
</tr></thead>
<tfoot>
- <td colspan="5">Total amount payable:</td><td>[% amountoutstanding | format('%.2f') %]</td>
+ <tr><td colspan="3">Total amount payable:</td><td>[% amountoutstanding | format('%.2f') %]</td></tr>
</tfoot>
<tbody><tr>
<td>
- [% description %] [% title %]
+ [% individual_description | html %]
</td>
- <td>[% accounttype %]</td>
- <td>[% notify_id %]</td>
- <td>[% notify_level %]</td>
+ <td>[% debit_type_code | html %]</td>
<td class="debit">[% amount | format('%.2f') %]</td>
<td class="debit">[% amountoutstanding | format('%.2f') %]</td>
</tr></tbody>
<ol>
<li>
- <label for="paid">Collect from patron: </label>
- <!-- default to paying all -->
- <input name="paid" id="paid" value="[% amountoutstanding | format('%.2f') %]" onchange="moneyFormat(document.payindivfine.paid)"/>
+ <label for="paid">Amount being paid: </label>
+ <input name="paid" id="paid" value="[% amountoutstanding | $Price on_editing => 1 %]"/>
</li>
+ <li>
+ <label for="collected">Collected from patron: </label>
+ <input id="collected" value="[% amountoutstanding | $Price on_editing => 1 %]"/>
+ </li>
+ <li>
+ <label>Change to give: </label>
+ <span id="change">0.00</span>
+ </li>
+ [% SET payment_types = AuthorisedValues.GetAuthValueDropbox('PAYMENT_TYPE') %]
+ [% IF payment_types %]
+ <li>
+ <label for="payment_type">Payment type: </label>
+ <select name="payment_type" id="payment_type">
+ <option value=""></option>
+ [% FOREACH pt IN payment_types %]
+ <option value="[% pt.authorised_value | html %]">[% pt.lib | html %]</option>
+ [% END %]
+ </select>
+ </li>
+ [% END %]
+ [% IF Koha.Preference('UseCashRegisters') %]
+ <li>
+ <label for="cash_register">Cash register: </label>
+ <select name="cash_register" id="cash_register">
+ [% FOREACH register IN registers %]
+ [% IF register.id == registerid %]
+ <option value="[% register.id | html %]" selected="selected">[% register.name | html %]</option>
+ [% ELSE %]
+ <option value="[% register.id | html %]">[% register.name | html %]</option>
+ [% END %]
+ [% END %]
+ </select>
+ </li>
+ [% END %]
</ol>
</fieldset>
- <div class="action"><input type="submit" name="submitbutton" value="Confirm" />
- <a class="cancel" href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% borrower.borrowernumber %]">Cancel</a></div>
+ <div class="action">
+ <input type="submit" name="submitbutton" value="Confirm" />
+ <a class="cancel" href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% patron.borrowernumber | html %]">Cancel</a>
+ </div>
</form>
+ [% END %]
[% ELSIF ( writeoff_individual ) %]
<form name="woindivfine" id="woindivfine" action="/cgi-bin/koha/members/pay.pl" method="post" >
+ <input type="hidden" name="csrf_token" value="[% csrf_token | html %]" />
<fieldset class="rows">
<legend>Write off an individual fine</legend>
- <input type="hidden" name="borrowernumber" id="borrowernumber" value="[% borrower.borrowernumber %]" />
- <input type="hidden" name="pay_individual" id="pay_individual" value="[% pay_individual %]" />
- <input type="hidden" name="itemnumber" id="itemnumber" value="[% itemnumber %]" />
- <input type="hidden" name="description" id="description" value="[% description %]" />
- <input type="hidden" name="accounttype" id="accounttype" value="[% accounttype %]" />
- <input type="hidden" name="notify_id" id="notify_id" value="[% notify_id %]" />
- <input type="hidden" name="notify_level" id="notify_level" value="[% notify_level %]" />
- <input type="hidden" name="amount" id="amount" value="[% amount %]" />
- <input type="hidden" name="amountoutstanding" id="amountoutstanding" value="[% amountoutstanding %]" />
- <input type="hidden" name="accountno" id="accountno" value="[% accountno %]" />
- <input type="hidden" name="accountlines_id" id="accountlines_id" value="[% accountlines_id %]" />
- <input type="hidden" name="title" id="title" value="[% title %]" />
- <input type="hidden" name="payment_note" id="payment_note" value="[% payment_note %]" />
+ <input type="hidden" name="borrowernumber" id="borrowernumber" value="[% patron.borrowernumber | html %]" />
+ <input type="hidden" name="pay_individual" id="pay_individual" value="[% pay_individual | html %]" />
+ <input type="hidden" name="itemnumber" id="itemnumber" value="[% itemnumber | html %]" />
+ <input type="hidden" name="description" id="description" value="[% description | html %]" />
+ <input type="hidden" name="debit_type_code" id="debit_type_code" value="[% debit_type_code | html %]" />
+ <input type="hidden" name="amount" id="amount" value="[% amount | html %]" />
+ <input type="hidden" name="accountlines_id" id="accountlines_id" value="[% accountlines_id | html %]" />
+ <input type="hidden" name="title" id="title" value="[% title | html %]" />
+ <input type="hidden" name="payment_note" id="payment_note" value="[% payment_note | html %]" />
+ <input type="hidden" name="amountoutstanding" id="amountoutstanding" value="[% amountoutstanding | html %]" />
+ <input type="hidden" name="confirm_writeoff" id="confirm_writeoff" value="1" />
+ <input type="hidden" name="change_given" id="change_given" />
<table>
<thead><tr>
<th>Description</th>
<th>Account type</th>
- <th>Notify id</th>
- <th>Level</th>
<th>Amount</th>
<th>Amount outstanding</th>
</tr></thead>
- <tfoot><td colspan="5">Total amount to be written off:</td><td>[% amountoutstanding | format('%.2f') %]</td></tfoot>
+ <tfoot><tr><td colspan="3">Total amount outstanding:</td><td>[% amountoutstanding | format('%.2f') %]</td></tr></tfoot>
<tbody><tr>
- <td>[% description %] [% title %]</td>
- <td>[% accounttype %]</td>
- <td>[% notify_id %]</td>
- <td>[% notify_level %]</td>
+ <td>[% description | html %] [% title | html %]</td>
+ <td>[% debit_type_code | html %]</td>
<td class="debit">[% amount | format('%.2f') %]</td>
<td class="debit">[% amountoutstanding | format('%.2f') %]</td>
</tr></tbody>
</table>
- </fieldset>
- <div class="action"><input type="submit" name="confirm_writeoff" id="confirm_writeoff" value="Write off this charge" />
- <a class="cancel" href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% borrower.borrowernumber %]">Cancel</a></div>
+
+ <ol>
+ <li>
+ <label for="paid">Writeoff amount: </label>
+ <!-- default to writing off all -->
+ <input name="amountwrittenoff" id="amountwrittenoff" value="[% amountoutstanding | $Price on_editing => 1 %]" type="text" />
+ </li>
+ </ol>
+ </fieldset>
+ <div class="action">
+ <input type="submit" value="Write off this charge" />
+ <a class="cancel" href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% patron.borrowernumber | html %]">Cancel</a>
+ </div>
</form>
[% ELSE %]
+ [% IF ( error_registers && type != 'writeoff' ) %]
+ <div id="error_message" class="dialog alert">
+ You must have at least one cash register associated with this branch before you can record payments.
+ </div>
+ [% ELSE %]
- <form name="payfine" id="payfine" onsubmit="return validatePayment(this);" method="post" action="/cgi-bin/koha/members/paycollect.pl">
- <input type="hidden" name="borrowernumber" id="borrowernumber" value="[% borrower.borrowernumber %]" />
- <input type="hidden" name="selected_accts" id="selected_accts" value="[% selected_accts %]" />
- <input type="hidden" name="total" id="total" value="[% total %]" />
+ <form name="payfine" id="payfine" method="post" action="/cgi-bin/koha/members/paycollect.pl">
+ <input type="hidden" name="csrf_token" value="[% csrf_token | html %]" />
+ <input type="hidden" name="borrowernumber" id="borrowernumber" value="[% patron.borrowernumber | html %]" />
+ <input type="hidden" name="selected_accts" id="selected_accts" value="[% selected_accts | html %]" />
+ <input type="hidden" name="total" id="total" value="[% total | html %]" />
+ <input type="hidden" name="type" value="[% type | html %]" />
+ <input type="hidden" name="change_given" id="change_given" />
<fieldset class="rows">
- [% IF ( selected_accts ) %]<legend>Pay an amount toward selected fines</legend>[% ELSE %]<legend>Pay an amount toward all fines</legend>[% END %]
+ [% IF ( selected_accts ) %]
+ [% IF type == 'writeoff' %]
+ <legend>Write off an amount toward selected fines</legend>
+ [% ELSE %]
+ <legend>Pay an amount toward selected fines</legend>
+ [% END %]
+ [% ELSE %]
+ <legend>Pay an amount toward all fines</legend>
+ [% END %]
+
<ol>
<li>
<span class="label">Total amount outstanding: </span>
<span class="debit">[% total | format('%.2f') %]</span>
</li>
<li>
- <label for="paid">Collect from patron: </label>
- <!-- default to paying all -->
- <input name="paid" id="paid" value="[% total | format('%.2f') %]" onchange="moneyFormat(document.payfine.paid)"/>
+ <label for="paid">Amount paid :</label>
+ <input name="paid" id="paid" value="[% total | $Price on_editing => 1 %]"/>
+ </li>
+ <li>
+ [% IF type == 'writeoff' %]
+ <label for="collected">Writeoff amount: </label>
+ [% ELSE %]
+ <label for="collected">Collect from patron: </label>
+ [% END %]
+ <input id="collected" value="[% total | $Price on_editing => 1 %]"/>
</li>
<li>
+ <label>Change to give: </label>
+ <span id="change">0.00</span>
+ </li>
+
+ [% IF type != 'writeoff' %]
+ [% SET payment_types = AuthorisedValues.GetAuthValueDropbox('PAYMENT_TYPE') %]
+ [% IF payment_types %]
+ <li>
+ <label for="payment_type">Payment type: </label>
+ <select name="payment_type" id="payment_type">
+ <option value=""></option>
+ [% FOREACH pt IN payment_types %]
+ <option value="[% pt.authorised_value | html %]">[% pt.lib | html %]</option>
+ [% END %]
+ </select>
+ </li>
+ [% END %]
+
+ [% IF Koha.Preference('UseCashRegisters') %]
+ <li>
+ <label for="cash_register">Cash register: </label>
+ <select name="cash_register" id="cash_register">
+ [% FOREACH register IN registers %]
+ [% IF register.id == registerid %]
+ <option value="[% register.id | html %]" selected="selected">[% register.name | html %]</option>
+ [% ELSE %]
+ <option value="[% register.id | html %]">[% register.name | html %]</option>
+ [% END %]
+ [% END %]
+ </select>
+ </li>
+ [% END %]
+ [% END %]
+
+ <li>
<label for="selected_accts_notes">Note: </label>
- <textarea name="selected_accts_notes" id="selected_accts_notes">[% selected_accts_notes %]</textarea>
+ <textarea name="selected_accts_notes" id="selected_accts_notes">[% selected_accts_notes | html %]</textarea>
</li>
</ol>
</fieldset>
- <div class="action"><input type="submit" name="submitbutton" value="Confirm" />
- <a class="cancel" href="/cgi-bin/koha/members/boraccount.pl?borrowernumber=[% borrower.borrowernumber %]">Cancel</a></div>
+ <div class="action">
+ <input type="submit" name="submitbutton" value="Confirm" />
+ <a class="cancel" href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% patron.borrowernumber | html %]">Cancel</a>
+ </div>
</form>
+ [% END %]
[% END %]
</div></div>
-</div>
-</div>
-<div class="yui-b">
-[% INCLUDE 'circ-menu.tt' %]
-</div>
+ </main>
+ </div> <!-- /.col-sm-10.col-sm-push-2 -->
+
+ <div class="col-sm-2 col-sm-pull-10">
+ <aside>
+ [% INCLUDE 'circ-menu.inc' %]
+ </aside>
+ </div> <!-- /.col-sm-2.col-sm-pull-10 -->
+ </div> <!-- /.row -->
+
+<!-- Modal -->
+<div id="confirm_change_form" class="modal" tabindex="-1" role="dialog" aria-hidden="true">
+ <div class="modal-dialog">
+ <div class="modal-content">
+ <div class="modal-header">
+ <h3>The amount collected is more than the outstanding charge</h3>
+ </div>
+ <div class="modal-body">
+ <p>The amount collected from the patron is higher than the amount to be paid.</p>
+ <p>The change to give is <b><span id="modal_change">0.00</span></b>.</p>
+ <p>Confirm this payment?</p>
+ </div>
+ <div class="modal-footer">
+ <button class="btn btn-default approve" id="modal_submit" type="button"><i class="fa fa-check"></i> Yes</button>
+ <button class="btn btn-default deny cancel" href="#" data-dismiss="modal" aria-hidden="true"><i class="fa fa-times"></i> No</button>
+ </div>
+ </div>
+ </div>
</div>
-[% INCLUDE 'intranet-bottom.inc' %]
+[% MACRO jsinclude BLOCK %]
+ [% INCLUDE 'str/members-menu.inc' %]
+ [% Asset.js("js/members-menu.js") | $raw %]
+ <script>
+ $(document).ready(function() {
+ [% IF payment_id && Koha.Preference('FinePaymentAutoPopup') %]
+ 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');
+ [% END %]
+
+ var forms = $('#payindivfine, #payfine');
+ var change = $('#change')[0];
+
+ $('#payindivfine, #payfine').preventDoubleFormSubmit();
+ $("#paid, #collected").on("change",function() {
+ moneyFormat( this );
+ if (change != undefined) {
+ updateChangeValues();
+ }
+ });
+
+ if (change != undefined) {
+ forms.on("submit", function(e) {
+ if (change.innerHTML > 0.00) {
+ e.preventDefault();
+ $("#confirm_change_form").modal("show");
+ } else {
+ return true;
+ }
+ });
+ }
+
+ $("#confirm_change_form").on("hidden.bs.modal", function(){
+ // remove class added by preventDoubleFormSubmit if necessary
+ $("body, form input[type='submit'], form button[type='submit'], form a").removeClass('waiting');
+ });
+
+ $('#modal_submit').click(function() {
+ forms[0].submit();
+ });
+ });
+
+ prevent_default = 1;
+ $('#woindivfine').on('submit', function(e){
+ if ( prevent_default ) {
+ e.preventDefault();
+
+ let amount_outstanding = parseFloat( $('#amountoutstanding').attr('value') );
+ let amount_writeoff = parseFloat( $('#amountwrittenoff').attr('value') );
+ if ( amount_writeoff > amount_outstanding ) {
+ alert(_("You are attemping to writeoff more than the value of the fee."));
+ $('#woindivfine').beenSubmitted = false;
+ } else {
+ prevent_default = 0;
+ $('#woindivfine').preventDoubleFormSubmit();
+ $('#woindivfine').submit();
+ }
+ }
+ });
+
+ function moneyFormat(textObj) {
+ var newValue = textObj.value;
+ var decAmount = "";
+ var dolAmount = "";
+ var decFlag = false;
+ var aChar = "";
+
+ for(i=0; i < newValue.length; i++) {
+ aChar = newValue.substring(i, i+1);
+ if (aChar >= "0" && aChar <= "9") {
+ if(decFlag) {
+ decAmount = "" + decAmount + aChar;
+ }
+ else {
+ dolAmount = "" + dolAmount + aChar;
+ }
+ }
+ if (aChar == ".") {
+ if (decFlag) {
+ dolAmount = "";
+ break;
+ }
+ decFlag = true;
+ }
+ }
+
+ if (dolAmount == "") {
+ dolAmount = "0";
+ }
+ // Strip leading 0s
+ if (dolAmount.length > 1) {
+ while(dolAmount.length > 1 && dolAmount.substring(0,1) == "0") {
+ dolAmount = dolAmount.substring(1,dolAmount.length);
+ }
+ }
+ if (decAmount.length > 2) {
+ decAmount = decAmount.substring(0,2);
+ }
+ // Pad right side
+ if (decAmount.length == 1) {
+ decAmount = decAmount + "0";
+ }
+ if (decAmount.length == 0) {
+ decAmount = decAmount + "00";
+ }
+
+ textObj.value = dolAmount + "." + decAmount;
+ }
+
+ function updateChangeValues() {
+ var change = $('#change')[0];
+ change.innerHTML = Math.round(($('#collected')[0].value - $('#paid')[0].value) * 100) / 100;
+ if (change.innerHTML <= 0) {
+ change.innerHTML = "0.00";
+ $('input[name="change_given"]').val('0.00');
+ } else {
+ change.value = change.innerHTML;
+ moneyFormat(change);
+ change.innerHTML = change.value;
+ $('input[name="change_given"]').val(change.value);
+ }
+
+ $('#modal_change').html(change.innerHTML);
+ }
+ </script>
+[% END %]
+
+[% INCLUDE 'intranet-bottom.inc' %]