优化支出合同计量

This commit is contained in:
xuhaihui 2025-10-16 17:20:11 +08:00
parent 58825bcf40
commit 91427df69b
1 changed files with 23 additions and 16 deletions

View File

@ -154,20 +154,27 @@ public class ContractEeasurementBillPlugin extends ContractMeasureBillEditPlugin
BigDecimal newValue = (BigDecimal)changeData.getNewValue(); BigDecimal newValue = (BigDecimal)changeData.getNewValue();
PriceChangedWarn(initialValue,newValue,rowIndex,parentRowIndex); PriceChangedWarn(initialValue,newValue,rowIndex,parentRowIndex);
} else if (checkbox && (StringUtils.equals(propName, "thisqty") || StringUtils.equals(propName, "thisoftaxmount"))) { } else if (checkbox && (StringUtils.equals(propName, "thisqty") || StringUtils.equals(propName, "thisoftaxmount"))) {
BigDecimal oldValue = (BigDecimal)changeData.getOldValue(); //清单分录-本期计量数量清单分录-本期计量含税金额
if(oldValue.compareTo(new BigDecimal(0)) == 0){ if (StringUtils.equals(propName, "thisoftaxmount")) {
BigDecimal initialValue = (BigDecimal) changeData.getNewValue(); //清单分录-本期计量含税金额
this.getView().getPageCache().put("currentprice", initialValue.toString()); BigDecimal newValue = (BigDecimal) changeData.getNewValue();
return; if (newValue.compareTo(new BigDecimal(0)) == 0) {
DynamicObjectCollection listmodelentry = this.getModel().getDataEntity().getDynamicObjectCollection("listmodelentry");//模板分录
DynamicObject listentry = listmodelentry.get(parentRowIndex).getDynamicObjectCollection("listentry").get(rowIndex);//清单分录模板分录子分录
listentry.set("curtaxprice",newValue);//清单分录-当前含税单价
listentry.set("currentprice",newValue);//清单分录-当前单价
this.getView().updateView("listentry");
return;
}
} }
BigDecimal initialValue = (BigDecimal)this.getModel().getValue("zcgj_cachepricefield", rowIndex, parentRowIndex); BigDecimal initialValue = (BigDecimal)this.getModel().getValue("zcgj_cachepricefield", rowIndex, parentRowIndex);
// //
// String initialValue = this.getView().getPageCache().get("currentprice"); // String initialValue = this.getView().getPageCache().get("currentprice");
// BigDecimal initialvalue = new BigDecimal(initialValue); // BigDecimal initialvalue = new BigDecimal(initialValue);
BigDecimal thisqty = (BigDecimal)this.getModel().getValue("thisqty", rowIndex, parentRowIndex); BigDecimal thisqty = (BigDecimal)this.getModel().getValue("thisqty", rowIndex, parentRowIndex);//清单分录-本期计量数量
BigDecimal thisoftaxmount =(BigDecimal) this.getModel().getValue("thisoftaxmount", rowIndex, parentRowIndex); BigDecimal thisoftaxmount =(BigDecimal) this.getModel().getValue("thisoftaxmount", rowIndex, parentRowIndex);//清单分录-本期计量含税金额
BigDecimal totalqty =(BigDecimal) this.getModel().getValue("totalqty", rowIndex, parentRowIndex); BigDecimal totalqty =(BigDecimal) this.getModel().getValue("totalqty", rowIndex, parentRowIndex);//清单分录-数量
BigDecimal entrytaxrate =(BigDecimal) this.getModel().getValue("entrytaxrate", rowIndex, parentRowIndex); BigDecimal entrytaxrate =(BigDecimal) this.getModel().getValue("entrytaxrate", rowIndex, parentRowIndex);//清单分录-税率%
BigDecimal tax = entrytaxrate.divide(new BigDecimal(100)).add(new BigDecimal(1)); BigDecimal tax = entrytaxrate.divide(new BigDecimal(100)).add(new BigDecimal(1));
BigDecimal zero = new BigDecimal(0); BigDecimal zero = new BigDecimal(0);
@ -176,13 +183,13 @@ public class ContractEeasurementBillPlugin extends ContractMeasureBillEditPlugin
if (thisqty.compareTo(zero)>0 && thisoftaxmount.compareTo(zero)>0) { if (thisqty.compareTo(zero)>0 && thisoftaxmount.compareTo(zero)>0) {
BigDecimal curtaxprice = thisoftaxmount.divide(thisqty,6,BigDecimal.ROUND_HALF_UP); BigDecimal curtaxprice = thisoftaxmount.divide(thisqty,6,BigDecimal.ROUND_HALF_UP);
currentprice = curtaxprice.divide(tax, 6, BigDecimal.ROUND_HALF_UP); currentprice = curtaxprice.divide(tax, 6, BigDecimal.ROUND_HALF_UP);
DynamicObjectCollection listmodelentry = this.getModel().getDataEntity().getDynamicObjectCollection("listmodelentry"); DynamicObjectCollection listmodelentry = this.getModel().getDataEntity().getDynamicObjectCollection("listmodelentry");//模板分录
DynamicObject listentry = listmodelentry.get(parentRowIndex).getDynamicObjectCollection("listentry").get(rowIndex); DynamicObject listentry = listmodelentry.get(parentRowIndex).getDynamicObjectCollection("listentry").get(rowIndex);//清单分录模板分录子分录
listentry.set("curtaxprice",curtaxprice); listentry.set("curtaxprice",curtaxprice);//清单分录-当前含税单价
listentry.set("currentprice",currentprice); listentry.set("currentprice",currentprice);//清单分录-当前单价
listentry.set("currentamt",currentprice.multiply(totalqty)); listentry.set("currentamt",currentprice.multiply(totalqty));//清单分录-当前金额
listentry.set("currenttaxamt",curtaxprice.multiply(totalqty).subtract(currentprice.multiply(totalqty))); listentry.set("currenttaxamt",curtaxprice.multiply(totalqty).subtract(currentprice.multiply(totalqty)));//清单分录-当前税额
listentry.set("currentoftax",curtaxprice.multiply(totalqty)); listentry.set("currentoftax",curtaxprice.multiply(totalqty));//清单分录-当前价税合计
this.getView().updateView("listentry"); this.getView().updateView("listentry");
PriceChangedWarn(initialValue,currentprice,rowIndex, parentRowIndex); PriceChangedWarn(initialValue,currentprice,rowIndex, parentRowIndex);
} }