Skip to content

Commit

Permalink
Fixed sumFormatterQuantity if using 1.234,56 fomat
Browse files Browse the repository at this point in the history
Previously sumFormatterQuantity used the parseFloat to convert the
string purchase_cost to a floating point number. parseFloat does not
return the correct value when using the comma format. To fix this
sumFormatterQuantity now used the cleanFloat function to convert
purchase_cost to a float.

Signed-off-by: Matthew Nickson <mnickson@sidingsmedia.com>
  • Loading branch information
Computroniks committed Oct 30, 2021
1 parent 8996c24 commit 90ca668
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion resources/views/partials/bootstrap-table.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -639,7 +639,7 @@ function sumFormatterQuantity(data){
return 'no quantity';
}
var total_sum = data.reduce(function(sum, row) {
return (sum) + (parseFloat(row["purchase_cost"])*row[multiplier] || 0);
return (sum) + (cleanFloat(row["purchase_cost"])*row[multiplier] || 0);
}, 0);
return numberWithCommas(total_sum.toFixed(2));
}
Expand Down

0 comments on commit 90ca668

Please sign in to comment.