对公报销单-生成收款明细

This commit is contained in:
李靖 2024-06-28 16:46:23 +08:00
parent fbac3eb04e
commit 2bd6700386
1 changed files with 62 additions and 23 deletions

View File

@ -3,10 +3,21 @@ package shkd.fi.er.plugin.formplugin;
import kd.bos.bill.AbstractBillPlugIn;
import kd.bos.dataentity.entity.DynamicObject;
import kd.bos.dataentity.entity.DynamicObjectCollection;
import kd.bos.dataentity.metadata.IDataEntityType;
import kd.bos.dataentity.metadata.dynamicobject.DynamicObjectType;
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.orm.query.QFilter;
import kd.bos.servicehelper.BusinessDataServiceHelper;
import kd.bos.servicehelper.QueryServiceHelper;
import kd.sdk.plugin.Plugin;
import java.math.BigDecimal;
import java.util.EventObject;
import java.util.HashMap;
import java.util.Map;
/**
* 单据界面插件
@ -19,33 +30,61 @@ public class GenerateSKClickPlugln extends AbstractBillPlugIn implements Plugin
@Override
public void registerListener(EventObject e) {
super.registerListener(e);
this.addItemClickListeners(KEY_sku);
// this.addItemClickListeners("advcontoolbarap3");
// super.registerListener(e);
}
@Override
public void afterDoOperation(AfterDoOperationEventArgs afterDoOperationEventArgs) {
// super.afterDoOperation(afterDoOperationEventArgs);
if("shkd_shoukuan".equals(afterDoOperationEventArgs.getOperateKey())){
DynamicObject temp2 = BusinessDataServiceHelper.loadSingle("bd_supplier",
new QFilter("number", QFilter.equals, "2020071139634629").toArray());
String name = temp2.getString("name");
DynamicObject bankEntry = temp2.getDynamicObjectCollection("entry_bank").get(0);
String bankaccount = bankEntry.getString("bankaccount");
String accountname = bankEntry.getString("accountname");
DynamicObject bank = bankEntry.getDynamicObject("bank");
DynamicObjectCollection entryEntity1 = this.getModel().getEntryEntity("expenseentryentity");
DynamicObjectCollection entryEntity2 = this.getModel().getEntryEntity("accountentry");
entryEntity2.clear();
for (int i = 0; i < entryEntity1.size(); i++) {
DynamicObject fymx = entryEntity1.get(i);
DynamicObject obj1 = fymx.getDynamicObject("shkd_entrypaycompany"); //费用支付公司
DynamicObject obj2 = fymx.getDynamicObject("std_entrycostcenter"); //成本中心
DynamicObject obj3 = fymx.getDynamicObject("expenseitem"); //费用项目
BigDecimal expenseamount = fymx.getBigDecimal("expenseamount"); //报销金额
DynamicObject sk = entryEntity2.addNew();
sk.set("shkd_skpaycompany", obj1); //费用支付公司
sk.set("shkd_skcostcente", obj2); //成本中心
sk.set("shkd_skexpenseitem", obj3); //费用项目
sk.set("orireceiveamount", expenseamount); //收款金额
sk.set("payertype", "bd_supplier");//payertype 收款人类型 默认供应商 bd_supplier
sk.set("payername", name);//payername 收款人 员工虚拟发薪虚拟账户
sk.set("payeraccount", bankaccount);//payeraccount 银行账号
sk.set("payeraccountname", accountname);//payeraccountname 账户名称
sk.set("payerbank", bank);//payerbank 开户银行
}
this.getView().updateView("accountentry");
this.getView().showTipNotification("生成收款明细成功!");
}
}
@Override
public void beforeDoOperation(BeforeDoOperationEventArgs args) {
super.beforeDoOperation(args);
}
@Override
public void click(EventObject evt) {
super.click(evt);
}
@Override
public void itemClick(ItemClickEvent evt) {
super.itemClick(evt);
System.out.println();
DynamicObjectCollection expenseentryentity = this.getModel().getEntryEntity("expenseentryentity");
DynamicObjectCollection entryEntity = this.getModel().getEntryEntity("");
entryEntity.clear();
for(int i= 0;i<expenseentryentity.size();i++){
DynamicObject fymx = expenseentryentity.get(0);
DynamicObject shkd_entrypaycompany = fymx.getDynamicObject("shkd_entrypaycompany");
DynamicObject std_entrycostcenter = fymx.getDynamicObject("std_entrycostcenter");
DynamicObject dynamicObject = fymx.getDynamicObject("expenseitem");
DynamicObject sk = entryEntity.addNew();
sk.set("shkd_skpaycompany",shkd_entrypaycompany);
// sk.set("",);
// sk.set("",);
// sk.set("",);
// sk.set("",);
// sk.set("",);
// sk.set("",);
}
this.getView().updateView("");
}
}