From c6013debf5c8b60b0447da3d9d031f82457d04b9 Mon Sep 17 00:00:00 2001 From: xiaoshi <2272816786@qq.com> Date: Thu, 12 Dec 2024 18:04:46 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81=20=20?= =?UTF-8?q?=E6=94=AF=E5=87=BA=E5=90=88=E5=90=8C=E8=AE=A1=E9=87=8F=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E8=AE=A1=E7=AE=97=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../form/ContractEeasurementBillPlugin.java | 59 +++++++++++++++++++ .../InContractMeasurementBillEditPlugin.java | 1 - 2 files changed, 59 insertions(+), 1 deletion(-) 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 84e926d..0f206da 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 @@ -3,6 +3,7 @@ package zcgj.zcdev.zcdev.pr.plugin.form; import kd.bos.dataentity.entity.DynamicObject; import kd.bos.dataentity.utils.StringUtils; import kd.bos.entity.datamodel.events.ChangeData; +import kd.bos.entity.datamodel.events.PropertyChangedArgs; import kd.bos.form.CloseCallBack; import kd.bos.form.ShowFormHelper; import kd.bos.list.ListShowParameter; @@ -10,6 +11,7 @@ import kd.bos.orm.query.QFilter; import kd.ec.contract.formplugin.ContractMeasureBillEditPlugin; import java.math.BigDecimal; +import java.math.RoundingMode; import java.util.ArrayList; import java.util.List; @@ -74,4 +76,61 @@ public class ContractEeasurementBillPlugin extends ContractMeasureBillEditPlugin this.getView().showForm(param); } } + + @Override + public void propertyChanged(PropertyChangedArgs e) { + super.propertyChanged(e); + String name = e.getProperty().getName(); + ChangeData changeData = e.getChangeSet()[0]; + int rowIndex = changeData.getRowIndex(); + int parentRowIndex = changeData.getParentRowIndex(); + BigDecimal curtaxprice = BigDecimal.ZERO;//当前含税单价 + BigDecimal currentprice = BigDecimal.ZERO;//当前单价 + BigDecimal qty = BigDecimal.ZERO;//数量 + BigDecimal taxrate = BigDecimal.ZERO;//税率 + if(name.equals("curtaxprice")||name.equals("currentprice")) { + if (parentRowIndex>=0&&rowIndex>=0){ + Object curtaxpriceobj = this.getModel().getValue("curtaxprice", rowIndex, parentRowIndex); + if (curtaxpriceobj != null) { + curtaxprice = (BigDecimal) curtaxpriceobj; + } + Object currentpriceobj = this.getModel().getValue("currentprice", rowIndex, parentRowIndex); + if (currentpriceobj != null) { + currentprice = (BigDecimal) currentpriceobj; + ; + } + Object totalqtyibj = this.getModel().getValue("totalqty", rowIndex, parentRowIndex); + if (totalqtyibj != null) { + qty = (BigDecimal) totalqtyibj; + } + Object entrytaxrateobj = this.getModel().getValue("entrytaxrate", rowIndex, parentRowIndex); + if (entrytaxrateobj != null) { + BigDecimal entrytaxrate = (BigDecimal) entrytaxrateobj; + taxrate = entrytaxrate.divide(new BigDecimal(100)).add(new BigDecimal(1)); + } + if (name.equals("curtaxprice") && curtaxprice.compareTo(new BigDecimal(0))>0) { + BigDecimal divide = curtaxprice.divide(taxrate,6, RoundingMode.HALF_UP);//当前单价 + BigDecimal multiply = divide.multiply(qty);//当前金额 + BigDecimal multiply1 = curtaxprice.multiply(qty);//当前价税合计 + BigDecimal subtract = multiply1.subtract(multiply);//当前税额 +// this.getModel().getDataEntity().set("currentprice",divide, rowIndex, parentRowIndex); + this.getModel().setValue("currentprice",divide, rowIndex, parentRowIndex);//当前单价 + this.getModel().setValue("currentamt", multiply,rowIndex, parentRowIndex);//当前金额 + this.getModel().setValue("currenttaxamt", subtract,rowIndex, parentRowIndex);//当前税额 + this.getModel().setValue("currentoftax", multiply1,rowIndex, parentRowIndex);//当前价税合计 + } else if (name.equals("currentprice")&¤tprice.compareTo(new BigDecimal(0))>0) { + BigDecimal divide = currentprice.multiply(taxrate);//当前含税单价 + BigDecimal multiply = currentprice.multiply(qty);//当前金额 + BigDecimal multiply1 = divide.multiply(qty);//当前价税合计 + BigDecimal subtract = multiply1.subtract(multiply);//当前税额 + this.getModel().setValue("curtaxprice",divide, rowIndex, parentRowIndex);//当前含税单价 + this.getModel().setValue("currentamt", multiply,rowIndex, parentRowIndex);//当前金额 + this.getModel().setValue("currenttaxamt",multiply1, rowIndex, parentRowIndex);//当前税额 + this.getModel().setValue("currentoftax",subtract, rowIndex, parentRowIndex);//当前价税合计 + } + this.getView().updateView(); + } + + } + } } diff --git a/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/form/InContractMeasurementBillEditPlugin.java b/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/form/InContractMeasurementBillEditPlugin.java index a01138a..9a22320 100644 --- a/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/form/InContractMeasurementBillEditPlugin.java +++ b/code/zcdev/zcgj-zcdev-zcdev-pr/src/main/java/zcgj/zcdev/zcdev/pr/plugin/form/InContractMeasurementBillEditPlugin.java @@ -10,7 +10,6 @@ import kd.bos.list.ListShowParameter; import kd.bos.orm.query.QFilter; import kd.bos.servicehelper.BusinessDataServiceHelper; import kd.ec.contract.formplugin.InContractMeasureBillEditPlugin; - import java.math.BigDecimal; import java.math.RoundingMode; import java.util.ArrayList;