入库单添加运费和运费税额变化后改变对应字段逻辑

This commit is contained in:
xuhaihui 2025-10-13 13:55:16 +08:00
parent e333e87276
commit b2f0702195
1 changed files with 50 additions and 0 deletions

View File

@ -8,6 +8,7 @@ import kd.bos.dataentity.resource.ResManager;
import kd.bos.entity.datamodel.events.ChangeData; import kd.bos.entity.datamodel.events.ChangeData;
import kd.bos.entity.datamodel.events.PropertyChangedArgs; import kd.bos.entity.datamodel.events.PropertyChangedArgs;
import kd.bos.form.*; import kd.bos.form.*;
import kd.bos.form.control.EntryGrid;
import kd.bos.form.control.events.ItemClickEvent; import kd.bos.form.control.events.ItemClickEvent;
import kd.bos.form.events.BeforeDoOperationEventArgs; import kd.bos.form.events.BeforeDoOperationEventArgs;
import kd.bos.form.events.ClosedCallBackEvent; import kd.bos.form.events.ClosedCallBackEvent;
@ -36,6 +37,7 @@ import java.util.*;
* 5申请人部门赋值逻辑 * 5申请人部门赋值逻辑
* 6合同编码字段赋值 * 6合同编码字段赋值
* 7费用汇总分录新增赋值逻辑 * 7费用汇总分录新增赋值逻辑
* 8运费和运费税额变化后改变对应字段逻辑
*/ */
public class MaterialInbPurchaseApplyPlugin extends AbstractBillPlugIn implements Plugin, BeforeF7SelectListener { public class MaterialInbPurchaseApplyPlugin extends AbstractBillPlugIn implements Plugin, BeforeF7SelectListener {
@Override @Override
@ -142,6 +144,54 @@ public class MaterialInbPurchaseApplyPlugin extends AbstractBillPlugIn implement
} }
} }
setNewExpenseSummary(); setNewExpenseSummary();
} else if ("zcgj_transtaxamount".equals(key)) {
// 入库单明细-运费税额
EntryGrid entryGrid = (EntryGrid) this.getControl("entryentity");
BigDecimal totalFreightAmount = entryGrid.getSum("ftransamount"); // 入库单明细-运费总金额
BigDecimal totalFreightTaxAmount = entryGrid.getSum("zcgj_transtaxamount"); // 入库单明细-运费税额总和
BigDecimal totalNoTaxAmount = entryGrid.getSum("notaxamount"); // 入库单明细-不含税金额总和
BigDecimal totalTaxAmount = entryGrid.getSum("taxamount"); // 入库单明细-税额总和
BigDecimal calculatedTotalTax = totalTaxAmount.add(totalFreightTaxAmount); // 总税额 = 原税额 + 运费税额
BigDecimal calculatedTaxIncludedFreight = totalFreightTaxAmount.add(totalFreightAmount); // 含税运费 = 运费税额 + 运费
BigDecimal calculatedTotalTaxIncluded = totalFreightAmount.add(totalFreightTaxAmount).add(totalNoTaxAmount).add(totalTaxAmount); // 入库含税总金额
this.getModel().beginInit();
this.getModel().setValue("totaltaxamount", calculatedTotalTax); // 总税额
this.getModel().setValue("transtaxamount", totalFreightTaxAmount); // 运费总税额
this.getModel().setValue("transoftaxamount", calculatedTaxIncludedFreight); // 含税总运费
this.getModel().setValue("totaloftaxamount", calculatedTotalTaxIncluded); // 入库含税总金额
this.getView().updateView("totaltaxamount");
this.getView().updateView("transtaxamount");
this.getView().updateView("transoftaxamount");
this.getView().updateView("totaloftaxamount");
this.getModel().endInit();
} else if ("ftransamount".equals(key)) {
// 入库单明细-运费
EntryGrid entryGrid = (EntryGrid) this.getControl("entryentity");
BigDecimal totalFreightAmount = entryGrid.getSum("ftransamount"); // 入库单明细-运费总金额
BigDecimal totalFreightTaxAmount = entryGrid.getSum("zcgj_transtaxamount"); // 入库单明细-运费税额总和
BigDecimal totalNoTaxAmount = entryGrid.getSum("notaxamount"); // 入库单明细-不含税金额总和
BigDecimal totalTaxAmount = entryGrid.getSum("taxamount"); // 入库单明细-税额总和
BigDecimal calculatedTotalAmount = totalNoTaxAmount.add(totalFreightAmount); // 入库总金额 = 不含税金额 + 运费
BigDecimal calculatedTaxIncludedFreight = totalFreightTaxAmount.add(totalFreightAmount); // 含税运费 = 运费税额 + 运费
BigDecimal calculatedTotalTaxIncluded = totalFreightAmount.add(totalFreightTaxAmount).add(totalNoTaxAmount).add(totalTaxAmount); // 入库含税总金额
this.getModel().beginInit();
this.getModel().setValue("transamount", totalFreightAmount); // 总运费
this.getModel().setValue("totalamount", calculatedTotalAmount); // 入库总金额
this.getModel().setValue("transoftaxamount", calculatedTaxIncludedFreight); // 含税总运费
this.getModel().setValue("totaloftaxamount", calculatedTotalTaxIncluded); // 入库含税总金额
this.getView().updateView("transamount");
this.getView().updateView("totalamount");
this.getView().updateView("transoftaxamount");
this.getView().updateView("totaloftaxamount");
this.getModel().endInit();
} }
} }