Skip to content

Commit

Permalink
close #731 Fixed: Precision on currency error
Browse files Browse the repository at this point in the history
  • Loading branch information
cuneytsenturk committed Jan 25, 2019
1 parent 812ffee commit 39d3c85
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions public/js/jquery/jquery.maskMoney.js
Original file line number Diff line number Diff line change
Expand Up @@ -616,16 +616,26 @@
function maskValueStandard(value, settings) {
var negative = (value.indexOf("-") > -1 && settings.allowNegative) ? "-" : "",
onlyNumbers = value.replace(/[^0-9]/g, ""),
valueWithoutSymbol = value.replace(settings.prefix, "").replace(settings.suffix, ""),
input_precision = value.length - value.lastIndexOf(settings.decimal) - 1,
integerPart = onlyNumbers.slice(0, onlyNumbers.length - input_precision),
valueWithoutSymbol = value.replace(settings.prefix, "").replace(settings.suffix, "");

var input_precision = value.length - value.lastIndexOf(settings.decimal) - 1;

if (settings.precision == 0) {
input_precision = 0;
}

var integerPart = onlyNumbers.slice(0, onlyNumbers.length - input_precision),
newValue,
decimalPart,
leadingZeros;

if (settings.suffix != '' && value.length != valueWithoutSymbol.length) {
input_precision = valueWithoutSymbol.length - valueWithoutSymbol.lastIndexOf(settings.decimal) - 1;

if (settings.precision == 0) {
input_precision = 0;
}

integerPart = onlyNumbers.slice(0, onlyNumbers.length - input_precision);
}

Expand Down

1 comment on commit 39d3c85

@mrkoi89
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it not change :( problem is. when create invoice. can not insert price. price auto clear. Can not save invoice.
Pls check on my video
https://www.youtube.com/watch?v=5b5L9SZ59kI

Please sign in to comment.