对公报销单冲销后金额计算

This commit is contained in:
zengweihai 2024-08-07 12:03:45 +08:00
parent fa1eb6623b
commit bef247de72
1 changed files with 37 additions and 0 deletions

View File

@ -9,6 +9,7 @@ import kd.bos.form.control.EntryGrid;
import kd.bos.form.control.events.ItemClickEvent;
import kd.bos.form.events.AfterDoOperationEventArgs;
import kd.bos.form.events.BeforeDoOperationEventArgs;
import kd.bos.form.operate.FormOperate;
import kd.bos.orm.query.QFilter;
import kd.bos.servicehelper.BusinessDataServiceHelper;
import kd.bos.servicehelper.QueryServiceHelper;
@ -91,6 +92,42 @@ public class GenerateSKClickPlugln extends AbstractBillPlugIn implements Plugin
@Override
public void beforeDoOperation(BeforeDoOperationEventArgs args) {
super.beforeDoOperation(args);
FormOperate formOperate = (FormOperate)args.getSource();
String operateKey = formOperate.getOperateKey();
if ("save".equals(operateKey) || "submit".equals(operateKey)){
DynamicObject shkd_billtypefield = this.getModel().getDataEntity().getDynamicObject("shkd_billtypefield");
if (!"er_publicreimbursebill_BT_03".equals(shkd_billtypefield.getString("number"))){
DynamicObjectCollection writeoffmoney = this.getModel().getEntryEntity("writeoffmoney");
if (writeoffmoney.size() > 0){
DynamicObject dynamicObject = writeoffmoney.get(0);
BigDecimal accloanamount = dynamicObject.getBigDecimal("accloanamount");//获取冲销金额
if (accloanamount != null){
DynamicObjectCollection expenseentryentity = this.getModel().getEntryEntity("expenseentryentity");
if (expenseentryentity.size() > 0){
DynamicObject dynamicObject1 = expenseentryentity.get(0);
BigDecimal expenseamount = dynamicObject1.getBigDecimal("expenseamount");//获取报销金额
if (expenseamount != null){
dynamicObject1.set("shkd_verification",expenseamount.subtract(accloanamount));
this.getView().updateView("expenseentryentity");
}
}
}
}else {
DynamicObjectCollection expenseentryentity = this.getModel().getEntryEntity("expenseentryentity");
if (expenseentryentity.size() > 0){
DynamicObject dynamicObject1 = expenseentryentity.get(0);
BigDecimal expenseamount = dynamicObject1.getBigDecimal("expenseamount");//获取报销金额
if (expenseamount != null){
dynamicObject1.set("shkd_verification",expenseamount);
this.getView().updateView("expenseentryentity");
}
}
}
}
}
}
@Override