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