mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
added footer total for price
This commit is contained in:
parent
2fc185bd71
commit
dac112d908
@ -191,14 +191,20 @@ $("#po-table").inventreeTable({
|
|||||||
title: '{% trans "Total price" %}',
|
title: '{% trans "Total price" %}',
|
||||||
formatter: function(value, row) {
|
formatter: function(value, row) {
|
||||||
var total = row.purchase_price * row.quantity;
|
var total = row.purchase_price * row.quantity;
|
||||||
|
var formatter = new Intl.NumberFormat('en-US', {style: 'currency', currency: row.purchase_price_currency});
|
||||||
// Create our number formatter.
|
|
||||||
var formatter = new Intl.NumberFormat('en-US', {
|
|
||||||
style: 'currency',
|
|
||||||
currency: row.purchase_price_currency,
|
|
||||||
});
|
|
||||||
return formatter.format(total)
|
return formatter.format(total)
|
||||||
},
|
},
|
||||||
|
footerFormatter: function(data) {
|
||||||
|
var total = data.map(function (row) {
|
||||||
|
return +row['purchase_price']*row['quantity']
|
||||||
|
}).reduce(function (sum, i) {
|
||||||
|
return sum + i
|
||||||
|
}, 0)
|
||||||
|
var currency = (data.slice(-1)[0] && data.slice(-1)[0].purchase_price_currency) || 'USD';
|
||||||
|
var formatter = new Intl.NumberFormat('en-US', {style: 'currency', currency: currency});
|
||||||
|
return formatter.format(total)
|
||||||
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
sortable: true,
|
sortable: true,
|
||||||
|
Loading…
Reference in New Issue
Block a user