Commit d5219066 by yukang

部分BUG处理

parent bea43b91
......@@ -20,26 +20,15 @@ $(function() {
var tr,index;
// 获取此model元素信息
var item = e.items[0];
// 计算总金额
var taxPoints = $("#result-0-taxPoints").val() ? $("#result-0-taxPoints").val() / 100 : 0;
var totalPriceExcluding = item.provisionalQuantity * item.unitPriceExcludingTax;
var totalPriceIncluding = totalPriceExcluding * (1 + parseFloat(taxPoints));
detail1Grid.setCellValue(item, 'totalPriceExcluding', totalPriceExcluding);
detail1Grid.setCellValue(item, 'totalPriceIncluding', totalPriceIncluding);
console.log(grid.dataSource._data);
console.log(detail1Grid.getDataItems());
var allRows = detail1Grid.getDataItems();
var totalPriceExcluding = 0;
var totalPriceIncluding = 0;
var valueAddedTax = 0;
allRows.forEach(function (row, index) {
totalPriceExcluding += parseFloat(row.totalPriceExcluding);
totalPriceIncluding += parseFloat(row.totalPriceIncluding);
});
valueAddedTax = parseFloat(totalPriceIncluding) - parseFloat(totalPriceExcluding);
$("#result-0-totalContractPriceExcluding").val(totalPriceExcluding.toFixed(3))
$("#result-0-totalContractPriceIncluding").val(totalPriceIncluding.toFixed(3))
$("#result-0-valueAddedTax").val(valueAddedTax.toFixed(3))
calculateAmount(item);
}
});
grid.dataSource.bind("change", function(e) {
if (e.field == "provisionalQuantity") {
var tr,index;
// 获取此model元素信息
var item = e.items[0];
calculateAmount(item);
}
});
},
......@@ -371,6 +360,30 @@ function fieldValidation() {
}
}
}
function calculateAmount(item) {
// 计算总金额
var taxPoints = $("#result-0-taxPoints").val() ? $("#result-0-taxPoints").val() / 100 : 0;
var provisionalQuantity = item.provisionalQuantity || 0;
var unitPriceExcludingTax = item.unitPriceExcludingTax || 0;
var totalPriceExcluding = provisionalQuantity * unitPriceExcludingTax;
var totalPriceIncluding = totalPriceExcluding * (1 + parseFloat(taxPoints));
detail1Grid.setCellValue(item, 'totalPriceExcluding', totalPriceExcluding);
detail1Grid.setCellValue(item, 'totalPriceIncluding', totalPriceIncluding);
var allRows = detail1Grid.getDataItems();
var totalPriceExcluding = 0;
var totalPriceIncluding = 0;
var valueAddedTax = 0;
allRows.forEach(function (row, index) {
totalPriceExcluding += parseFloat(row.totalPriceExcluding);
totalPriceIncluding += parseFloat(row.totalPriceIncluding);
});
valueAddedTax = parseFloat(totalPriceIncluding) - parseFloat(totalPriceExcluding);
$("#result-0-totalContractPriceExcluding").val(totalPriceExcluding.toFixed(3))
$("#result-0-totalContractPriceIncluding").val(totalPriceIncluding.toFixed(3))
$("#result-0-valueAddedTax").val(valueAddedTax.toFixed(3))
}
$(window).load(function () {
refreshRowNo();
});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment