收入合同履约记录表单插件添加价税合计、金额和税额的逻辑

This commit is contained in:
xuhaihui 2026-01-04 15:11:20 +08:00
parent 836a8a3201
commit 1f6131e5bc
1 changed files with 52 additions and 0 deletions

View File

@ -0,0 +1,52 @@
package zcgj.zcdev.zcdev.pr.plugin.form;
import kd.bos.bill.AbstractBillPlugIn;
import kd.bos.dataentity.entity.DynamicObjectCollection;
import kd.bos.entity.datamodel.events.PropertyChangedArgs;
import kd.bos.form.control.EntryGrid;
import kd.bos.form.control.events.ItemClickEvent;
import java.math.BigDecimal;
import java.util.EventObject;
/**
* 收入合同履约记录表单插件
*/
public class PerFormRecordsBillPlugin extends AbstractBillPlugIn {
@Override
public void registerListener(EventObject e) {
super.registerListener(e);
this.addItemClickListeners("advcontoolbarap");
}
@Override
public void itemClick(ItemClickEvent evt) {
super.itemClick(evt);
String itemKey = evt.getItemKey();
if (itemKey.equals("deleteline")) {
//事务记录明细删行
EntryGrid entryGrid = (EntryGrid) this.getControl("entryentity");
BigDecimal amount = entryGrid.getSum("amount").abs();//价税合计
this.getModel().setValue("zcgj_taxperformeamou", amount);//含税履约金额
BigDecimal notaxamount = entryGrid.getSum("notaxamount").abs();//金额
this.getModel().setValue("zcgj_performamount", notaxamount);//履约金额不含税
BigDecimal tax = entryGrid.getSum("tax").abs();//税额
this.getModel().setValue("zcgj_taxamount", tax);//履约税额
}
}
@Override
public void propertyChanged(PropertyChangedArgs e) {
String propName = e.getProperty().getName();
if ("amount".equals(propName) || "notaxamount".equals(propName) || "tax".equals(propName)) {
//价税合计,金额,税额
EntryGrid entryGrid = (EntryGrid) this.getControl("entryentity");
BigDecimal amount = entryGrid.getSum("amount").abs();//价税合计
this.getModel().setValue("zcgj_taxperformeamou", amount);//含税履约金额
BigDecimal notaxamount = entryGrid.getSum("notaxamount").abs();//金额
this.getModel().setValue("zcgj_performamount", notaxamount);//履约金额不含税
BigDecimal tax = entryGrid.getSum("tax").abs();//税额
this.getModel().setValue("zcgj_taxamount", tax);//履约税额
}
}
}