Bug 23354: Format price on item add
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Josef Moravec <josef.moravec@gmail.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
parent
e71b615cf6
commit
b151f71ddc
1 changed files with 14 additions and 12 deletions
|
@ -183,18 +183,6 @@
|
||||||
[% INCLUDE 'datatables.inc' %]
|
[% INCLUDE 'datatables.inc' %]
|
||||||
[% Asset.js("lib/jquery/plugins/jquery.jeditable.mini.js") | $raw %]
|
[% Asset.js("lib/jquery/plugins/jquery.jeditable.mini.js") | $raw %]
|
||||||
<script>
|
<script>
|
||||||
function fnClickAddRow( table, invoiceCode, invoiceTitle, invoicePrice ) {
|
|
||||||
table.fnAddData( [
|
|
||||||
invoiceTitle,
|
|
||||||
invoicePrice,
|
|
||||||
1,
|
|
||||||
null,
|
|
||||||
'<button class="drop"><i class="fa fa-trash"></i> Remove</button>',
|
|
||||||
invoiceCode
|
|
||||||
]
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
function moneyFormat(textObj) {
|
function moneyFormat(textObj) {
|
||||||
var newValue = textObj.value;
|
var newValue = textObj.value;
|
||||||
var decAmount = "";
|
var decAmount = "";
|
||||||
|
@ -244,6 +232,20 @@
|
||||||
textObj.value = dolAmount + "." + decAmount;
|
textObj.value = dolAmount + "." + decAmount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function fnClickAddRow( table, invoiceCode, invoiceTitle, invoicePrice ) {
|
||||||
|
var defaultPrice = { value: invoicePrice };
|
||||||
|
moneyFormat(defaultPrice);
|
||||||
|
table.fnAddData( [
|
||||||
|
invoiceTitle,
|
||||||
|
defaultPrice.value,
|
||||||
|
1,
|
||||||
|
null,
|
||||||
|
'<button class="drop"><i class="fa fa-trash"></i> Remove</button>',
|
||||||
|
invoiceCode
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
function updateChangeValues() {
|
function updateChangeValues() {
|
||||||
var change = $('#change')[0];
|
var change = $('#change')[0];
|
||||||
change.innerHTML = Math.round(($('#collected')[0].value - $('#paid')[0].value) * 100) / 100;
|
change.innerHTML = Math.round(($('#collected')[0].value - $('#paid')[0].value) * 100) / 100;
|
||||||
|
|
Loading…
Reference in a new issue