Commit 0d4354bb by yukang

部分BUG处理:租赁合同、结算单

parent 670e2dcf
...@@ -16,36 +16,12 @@ $(function() { ...@@ -16,36 +16,12 @@ $(function() {
], ],
loadComplete: function (grid) { loadComplete: function (grid) {
grid.dataSource.bind("change", function(e) { grid.dataSource.bind("change", function(e) {
if (e.field == "dayNumber") { if (e.field == "dayNumber" || e.field == "unitPrice" || e.field == "dayNumber") {
var tr,index; var tr,index;
// 获取此model元素信息 // 获取此model元素信息
var item = e.items[0]; var item = e.items[0];
// 计算总金额 // 计算总金额
var taxPoints = $("#result-0-taxPoints").val() ? $("#result-0-taxPoints").val() / 100 : 0; calculateAmount(item);
var deviceNumber = parseFloat(item.deviceNumber) || 0;
var unitPrice = parseFloat(item.unitPrice) || 0;
var dayNumber = parseFloat(item.dayNumber) || 0;
var totalPrice = deviceNumber * unitPrice * dayNumber;
detail1Grid.setCellValue(item, 'totalPrice', parseFloat(totalPrice));
console.log(grid.dataSource._data);
console.log(detail1Grid.getDataItems());
var allRows = detail1Grid.getDataItems();
var totalPriceExcluding = 0;
var totalPriceIncluding = 0;
var valueAddedTax = 0;
totalPrice = 0;
deviceNumber = 0
allRows.forEach(function (row, index) {
totalPrice += parseFloat(row.totalPrice);
deviceNumber += parseFloat(row.deviceNumber);
});
totalPriceExcluding = totalPrice;
totalPriceIncluding = totalPriceExcluding * (1 + parseFloat(taxPoints));
valueAddedTax = parseFloat(totalPriceIncluding) - parseFloat(totalPriceExcluding);
$("#result-0-totalContractPriceExcluding").val(parseFloat(totalPriceExcluding).toFixed(3))
$("#result-0-totalContractPriceIncluding").val(parseFloat(totalPriceIncluding).toFixed(3))
$("#result-0-valueAddedTax").val(parseFloat(valueAddedTax).toFixed(3))
$("#result-0-totalQuantity").val(parseFloat(deviceNumber).toFixed(3))
} }
}); });
...@@ -98,7 +74,25 @@ $(function() { ...@@ -98,7 +74,25 @@ $(function() {
$("#result-0-projName").val(textField); $("#result-0-projName").val(textField);
} }
} }
} },
"result-0-taxPoints": {
// 点击下拉选项时触发
select: function (e) { //获取勾选值
var dataItem = e.dataItem;
var valueField = dataItem['valueField'];
if (valueField) {
var taxPoints = valueField / 100;
var totalContractPriceExcluding = $("#result-0-totalContractPriceExcluding").val();
var totalContractPriceIncluding = totalContractPriceExcluding * (1 + taxPoints);
$("#result-0-totalContractPriceIncluding").val(totalContractPriceIncluding.toFixed(3))
$("#result-0-valueAddedTax").val((totalContractPriceIncluding - totalContractPriceExcluding).toFixed(3))
} else {
var totalContractPriceExcluding = parseFloat($("#result-0-totalContractPriceExcluding").val());
$("#result-0-totalContractPriceIncluding").val(totalContractPriceExcluding.toFixed(3))
$("#result-0-valueAddedTax").val(0)
}
}
},
} }
IPLATUI.EFPopupInput = { IPLATUI.EFPopupInput = {
...@@ -245,10 +239,60 @@ let refreshRowNo = function () { ...@@ -245,10 +239,60 @@ let refreshRowNo = function () {
} }
} }
function fieldValidation() { function fieldValidation() {
var projCode = $("#result-0-projCode").val();
if (isBlank(projCode)) {
message("请选择项目!");
return;
}
var contractName = $("#result-0-contractName").val();
if (isBlank(contractName)) {
message("请填写合同名称!");
return;
}
var partyA = $("#result-0-partyA").val();
if (isBlank(partyA)) {
message("请选择甲方!");
return;
}
var planStartDate = $("#result-0-leaseStartDate").val();
if (isBlank(planStartDate)) {
message("请选择租赁开始日期!");
return;
}
var planEndDate = $("#result-0-leaseEndDate").val();
if (isBlank(planEndDate)) {
message("请选择租赁结束日期!");
return;
}
} }
$(window).load(function () { $(window).load(function () {
refreshRowNo(); refreshRowNo();
}); });
function calculateAmount(item) {
var taxPoints = $("#result-0-taxPoints").val() ? $("#result-0-taxPoints").val() / 100 : 0;
var deviceNumber = parseFloat(item.deviceNumber) || 0;
var unitPrice = parseFloat(item.unitPrice) || 0;
var dayNumber = parseFloat(item.dayNumber) || 0;
var totalPrice = deviceNumber * unitPrice * dayNumber;
detail1Grid.setCellValue(item, 'totalPrice', parseFloat(totalPrice));
var allRows = detail1Grid.getDataItems();
var totalPriceExcluding = 0;
var totalPriceIncluding = 0;
var valueAddedTax = 0;
totalPrice = 0;
deviceNumber = 0
allRows.forEach(function (row, index) {
totalPrice += parseFloat(row.totalPrice);
deviceNumber += parseFloat(row.deviceNumber);
});
totalPriceExcluding = totalPrice;
totalPriceIncluding = totalPriceExcluding * (1 + parseFloat(taxPoints));
valueAddedTax = parseFloat(totalPriceIncluding) - parseFloat(totalPriceExcluding);
$("#result-0-totalContractPriceExcluding").val(parseFloat(totalPriceExcluding).toFixed(3))
$("#result-0-totalContractPriceIncluding").val(parseFloat(totalPriceIncluding).toFixed(3))
$("#result-0-valueAddedTax").val(parseFloat(valueAddedTax).toFixed(3))
$("#result-0-totalQuantity").val(parseFloat(deviceNumber).toFixed(3))
}
...@@ -29,10 +29,11 @@ $(function() { ...@@ -29,10 +29,11 @@ $(function() {
var unitPrice = parseFloat(item.unitPrice) || 0; // 单价 var unitPrice = parseFloat(item.unitPrice) || 0; // 单价
var totalPrice = thisEngineeringQuantity * unitPrice; // 总价 var totalPrice = thisEngineeringQuantity * unitPrice; // 总价
detail1Grid.setCellValue(item, 'totalPrice', parseFloat(totalPrice)); detail1Grid.setCellValue(item, 'totalPrice', parseFloat(totalPrice));
var cumulativeEngineeringQuantity = queryCumulativeEngineeringQuantity(inventoryId); queryCumulativeEngineeringQuantity(inventoryId,item);
detail1Grid.setCellValue(item, 'cumulativeEngineeringQuantity', thisEngineeringQuantity + cumulativeEngineeringQuantity); // 计算总金额
// 计算总金额 setTimeout(function () {
calculateAmount(detail1Grid.getDataItems()); calculateAmount(detail1Grid.getDataItems());
}, 200);
} }
}); });
grid.dataSource.bind("change", function(e) { grid.dataSource.bind("change", function(e) {
...@@ -100,6 +101,14 @@ $(function() { ...@@ -100,6 +101,14 @@ $(function() {
$("#result-0-projName").val(textField); $("#result-0-projName").val(textField);
} }
} }
},
"result-0-taxPoints": {
select: function (e) { //获取勾选值
var dataItem = e.dataItem;
var valueField = dataItem['valueField'];
var taxPoints = valueField ? valueField / 100 : 0;
calculateAmount2(taxPoints);
}
} }
} }
...@@ -276,27 +285,27 @@ let refreshRowNo = function () { ...@@ -276,27 +285,27 @@ let refreshRowNo = function () {
detail1Grid.refresh(); detail1Grid.refresh();
} }
} }
function queryCumulativeEngineeringQuantity(inventoryId) { function queryCumulativeEngineeringQuantity(inventoryId,item) {
if (inventoryId) { if (inventoryId) {
var thisEngineeringQuantity = parseFloat(item.thisEngineeringQuantity) || 0; // 工程量
var info = new EiInfo(); var info = new EiInfo();
info.set("inventoryId", inventoryId); info.set("inventoryId", inventoryId);
EiCommunicator.send("HGCW009", "queryEngineeringQuantity", info, { EiCommunicator.send("HGCW009", "queryEngineeringQuantity", info, {
onSuccess: function (ei) { onSuccess: function (ei) {
if (ei.getStatus() >= 0) { if (ei.getStatus() >= 0) {
return ei.result var cumulativeEngineeringQuantity = ei.extAttr.result || 0;
detail1Grid.setCellValue(item, 'cumulativeEngineeringQuantity', thisEngineeringQuantity + cumulativeEngineeringQuantity);
} else { } else {
NotificationUtil(ei, "error"); NotificationUtil(ei, "error");
return 0; detail1Grid.setCellValue(item, 'cumulativeEngineeringQuantity', thisEngineeringQuantity);
} }
}, },
onFail: function (ei) { onFail: function (ei) {
// 发生异常 // 发生异常
NotificationUtil("操作失败,原因[" + ei + "]", "error"); NotificationUtil("操作失败,原因[" + ei + "]", "error");
return 0;
} }
}); });
} }
return 0;
} }
/** /**
...@@ -348,9 +357,48 @@ function calculateAmount(rows) { ...@@ -348,9 +357,48 @@ function calculateAmount(rows) {
$("#result-0-thisPriceTax").val(parseFloat(thisPriceTax).toFixed(3)) $("#result-0-thisPriceTax").val(parseFloat(thisPriceTax).toFixed(3))
$("#result-0-cumulativePriceTax").val(parseFloat(cumulativePriceTax).toFixed(3)) $("#result-0-cumulativePriceTax").val(parseFloat(cumulativePriceTax).toFixed(3))
} }
function fieldValidation() { function calculateAmount2(taxPoints) {
var rows = detail1Grid.getDataItems();
var contractType = $("#contractType").val();
var totalPrice = 0;
var deductionPrice= 0;
rows.forEach(function (row, index) {
if (row.settlementBasis == "合同内") {
totalPrice += parseFloat(row.totalPrice);
} else {
deductionPrice += parseFloat(row.totalPrice);
}
});
//本次结算金额
var thisSettlementAmount = $("#result-0-thisSettlementAmount").val() || 0;
//本次结算税金
var thisSettlementTax = 0;
if (contractType == "1") {
thisSettlementTax = thisSettlementAmount * taxPoints;
} else {
thisSettlementTax = totalPrice * taxPoints;
}
//本次价税合计=本次结算金额+本次结算税金
var thisPriceTax = parseFloat(thisSettlementAmount) + parseFloat(thisSettlementTax);
$("#result-0-thisSettlementTax").val(parseFloat(thisSettlementTax).toFixed(3))
$("#result-0-thisPriceTax").val(parseFloat(thisPriceTax).toFixed(3))
//累计结算金额
var cumulativeSettlementAmount = parseFloat(sumCumulativeSettlementAmount) + parseFloat(thisSettlementAmount);
//累计结算税金
var cumulativeSettlementTax = parseFloat(sumCumulativeSettlementTax) + parseFloat(thisSettlementTax);
//累计价税合计=累计结算金额+累计结算税金
var cumulativePriceTax = parseFloat(cumulativeSettlementAmount) + parseFloat(cumulativeSettlementTax);
$("#result-0-cumulativeSettlementTax").val(parseFloat(cumulativeSettlementTax).toFixed(3))
$("#result-0-cumulativePriceTax").val(parseFloat(cumulativePriceTax).toFixed(3))
} }
function fieldValidation() {
var projCode = $("#result-0-projCode").val();
if (isBlank(projCode)) {
message("请选择项目!");
return;
}
}
$(window).load(function () { $(window).load(function () {
refreshRowNo(); refreshRowNo();
}); });
......
...@@ -29,10 +29,11 @@ $(function() { ...@@ -29,10 +29,11 @@ $(function() {
var unitPrice = parseFloat(item.unitPrice) || 0; // 单价 var unitPrice = parseFloat(item.unitPrice) || 0; // 单价
var totalPrice = thisEngineeringQuantity * unitPrice; // 总价 var totalPrice = thisEngineeringQuantity * unitPrice; // 总价
detail1Grid.setCellValue(item, 'totalPrice', parseFloat(totalPrice)); detail1Grid.setCellValue(item, 'totalPrice', parseFloat(totalPrice));
var cumulativeEngineeringQuantity = queryCumulativeEngineeringQuantity(inventoryId); queryCumulativeEngineeringQuantity(inventoryId,item);
detail1Grid.setCellValue(item, 'cumulativeEngineeringQuantity', thisEngineeringQuantity + cumulativeEngineeringQuantity);
// 计算总金额 // 计算总金额
calculateAmount(detail1Grid.getDataItems()); setTimeout(function () {
calculateAmount(detail1Grid.getDataItems());
}, 200);
} }
}); });
grid.dataSource.bind("change", function(e) { grid.dataSource.bind("change", function(e) {
...@@ -109,6 +110,14 @@ $(function() { ...@@ -109,6 +110,14 @@ $(function() {
$("#result-0-projName").val(textField); $("#result-0-projName").val(textField);
} }
} }
},
"result-0-taxPoints": {
select: function (e) { //获取勾选值
var dataItem = e.dataItem;
var valueField = dataItem['valueField'];
var taxPoints = valueField ? valueField / 100 : 0;
calculateAmount2(taxPoints);
}
} }
} }
...@@ -266,27 +275,27 @@ function btnSaveFunc() { ...@@ -266,27 +275,27 @@ function btnSaveFunc() {
}); });
} }
function queryCumulativeEngineeringQuantity(inventoryId) { function queryCumulativeEngineeringQuantity(inventoryId,item) {
if (inventoryId) { if (inventoryId) {
var thisEngineeringQuantity = parseFloat(item.thisEngineeringQuantity) || 0; // 工程量
var info = new EiInfo(); var info = new EiInfo();
info.set("inventoryId", inventoryId); info.set("inventoryId", inventoryId);
EiCommunicator.send("HGCW009", "queryEngineeringQuantity", info, { EiCommunicator.send("HGCW009", "queryEngineeringQuantity", info, {
onSuccess: function (ei) { onSuccess: function (ei) {
if (ei.getStatus() >= 0) { if (ei.getStatus() >= 0) {
return ei.result var cumulativeEngineeringQuantity = ei.extAttr.result || 0;
detail1Grid.setCellValue(item, 'cumulativeEngineeringQuantity', thisEngineeringQuantity + cumulativeEngineeringQuantity);
} else { } else {
NotificationUtil(ei, "error"); NotificationUtil(ei, "error");
return 0; detail1Grid.setCellValue(item, 'cumulativeEngineeringQuantity', thisEngineeringQuantity);
} }
}, },
onFail: function (ei) { onFail: function (ei) {
// 发生异常 // 发生异常
NotificationUtil("操作失败,原因[" + ei + "]", "error"); NotificationUtil("操作失败,原因[" + ei + "]", "error");
return 0;
} }
}); });
} }
return 0;
} }
/** /**
...@@ -338,6 +347,41 @@ function calculateAmount(rows) { ...@@ -338,6 +347,41 @@ function calculateAmount(rows) {
$("#result-0-thisPriceTax").val(parseFloat(thisPriceTax).toFixed(3)) $("#result-0-thisPriceTax").val(parseFloat(thisPriceTax).toFixed(3))
$("#result-0-cumulativePriceTax").val(parseFloat(cumulativePriceTax).toFixed(3)) $("#result-0-cumulativePriceTax").val(parseFloat(cumulativePriceTax).toFixed(3))
} }
function calculateAmount2(taxPoints) {
var rows = detail1Grid.getDataItems();
var contractType = $("#contractType").val();
var totalPrice = 0;
var deductionPrice= 0;
rows.forEach(function (row, index) {
if (row.settlementBasis == "合同内") {
totalPrice += parseFloat(row.totalPrice);
} else {
deductionPrice += parseFloat(row.totalPrice);
}
});
//本次结算金额
var thisSettlementAmount = $("#result-0-thisSettlementAmount").val() || 0;
//本次结算税金
var thisSettlementTax = 0;
if (contractType == "1") {
thisSettlementTax = thisSettlementAmount * taxPoints;
} else {
thisSettlementTax = totalPrice * taxPoints;
}
//本次价税合计=本次结算金额+本次结算税金
var thisPriceTax = parseFloat(thisSettlementAmount) + parseFloat(thisSettlementTax);
$("#result-0-thisSettlementTax").val(parseFloat(thisSettlementTax).toFixed(3))
$("#result-0-thisPriceTax").val(parseFloat(thisPriceTax).toFixed(3))
//累计结算金额
var cumulativeSettlementAmount = parseFloat(sumCumulativeSettlementAmount) + parseFloat(thisSettlementAmount);
//累计结算税金
var cumulativeSettlementTax = parseFloat(sumCumulativeSettlementTax) + parseFloat(thisSettlementTax);
//累计价税合计=累计结算金额+累计结算税金
var cumulativePriceTax = parseFloat(cumulativeSettlementAmount) + parseFloat(cumulativeSettlementTax);
$("#result-0-cumulativeSettlementTax").val(parseFloat(cumulativeSettlementTax).toFixed(3))
$("#result-0-cumulativePriceTax").val(parseFloat(cumulativePriceTax).toFixed(3))
}
function initDate() { function initDate() {
var projCode = $("#result-0-projCode").val(); var projCode = $("#result-0-projCode").val();
var contractNumber = $("#result-0-contractNumber").val(); var contractNumber = $("#result-0-contractNumber").val();
...@@ -444,7 +488,11 @@ function deleteResult1Func() { ...@@ -444,7 +488,11 @@ function deleteResult1Func() {
}); });
} }
function fieldValidation() { function fieldValidation() {
var projCode = $("#result-0-projCode").val();
if (isBlank(projCode)) {
message("请选择项目!");
return;
}
} }
......
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