Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
c2a9b82dc5
|
@ -66,7 +66,7 @@ public class ReimbursementAccountTypePlugin extends AbstractBillPlugIn implement
|
||||||
if (name.equals("zcgj_accounttype")) { //科目分类根据科目分类基础资料过滤
|
if (name.equals("zcgj_accounttype")) { //科目分类根据科目分类基础资料过滤
|
||||||
int row = beforeF7SelectEvent.getRow();
|
int row = beforeF7SelectEvent.getRow();
|
||||||
DynamicObjectCollection dynamicObjectCollection = this.getModel().getDataEntity(true).getDynamicObjectCollection("expenseentryentity");
|
DynamicObjectCollection dynamicObjectCollection = this.getModel().getDataEntity(true).getDynamicObjectCollection("expenseentryentity");
|
||||||
if (dynamicObjectCollection != null) {
|
if (dynamicObjectCollection.size() > 0) {
|
||||||
DynamicObject expenseItem = dynamicObjectCollection.get(row).getDynamicObject("expenseitem");//费用项目
|
DynamicObject expenseItem = dynamicObjectCollection.get(row).getDynamicObject("expenseitem");//费用项目
|
||||||
if (expenseItem != null) {
|
if (expenseItem != null) {
|
||||||
QFilter filter = new QFilter("zcgj_entryentity.zcgj_fee", QCP.equals, expenseItem.getLong("id"));
|
QFilter filter = new QFilter("zcgj_entryentity.zcgj_fee", QCP.equals, expenseItem.getLong("id"));
|
||||||
|
@ -139,6 +139,9 @@ public class ReimbursementAccountTypePlugin extends AbstractBillPlugIn implement
|
||||||
//费用项目
|
//费用项目
|
||||||
String billFormId = ((BillView) this.getView()).getFormId();//单据标识
|
String billFormId = ((BillView) this.getView()).getFormId();//单据标识
|
||||||
DynamicObject costCompany = (DynamicObject) this.getModel().getValue("costcompany");//费用承担公司
|
DynamicObject costCompany = (DynamicObject) this.getModel().getValue("costcompany");//费用承担公司
|
||||||
|
if (costCompany == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
long costCompanyId = costCompany.getLong("id");//费用承担公司id
|
long costCompanyId = costCompany.getLong("id");//费用承担公司id
|
||||||
if (!OrgCheckUtils.isKS(costCompanyId)) {
|
if (!OrgCheckUtils.isKS(costCompanyId)) {
|
||||||
//不是矿山不进入下面逻辑
|
//不是矿山不进入下面逻辑
|
||||||
|
@ -148,7 +151,7 @@ public class ReimbursementAccountTypePlugin extends AbstractBillPlugIn implement
|
||||||
ChangeData changeData = e.getChangeSet()[0];
|
ChangeData changeData = e.getChangeSet()[0];
|
||||||
int rowIndex = changeData.getRowIndex();//所选行
|
int rowIndex = changeData.getRowIndex();//所选行
|
||||||
DynamicObjectCollection entryEntityCollection = this.getModel().getDataEntity(true).getDynamicObjectCollection("expenseentryentity");//分录
|
DynamicObjectCollection entryEntityCollection = this.getModel().getDataEntity(true).getDynamicObjectCollection("expenseentryentity");//分录
|
||||||
if (entryEntityCollection != null) {
|
if (entryEntityCollection.size() > 0) {
|
||||||
DynamicObject expenseItem = entryEntityCollection.get(rowIndex).getDynamicObject("expenseitem");//费用项目
|
DynamicObject expenseItem = entryEntityCollection.get(rowIndex).getDynamicObject("expenseitem");//费用项目
|
||||||
if (expenseItem == null) {
|
if (expenseItem == null) {
|
||||||
this.getModel().setValue("zcgj_accounttype", null, rowIndex);//科目属性
|
this.getModel().setValue("zcgj_accounttype", null, rowIndex);//科目属性
|
||||||
|
@ -212,8 +215,6 @@ public class ReimbursementAccountTypePlugin extends AbstractBillPlugIn implement
|
||||||
if (orgTypeDefaultCollection != null && orgTypeDefaultCollection.size() == 1) {
|
if (orgTypeDefaultCollection != null && orgTypeDefaultCollection.size() == 1) {
|
||||||
//默认科目分类中存在单条的费用项目
|
//默认科目分类中存在单条的费用项目
|
||||||
DynamicObject companyRule = BusinessDataServiceHelper.loadSingle("zcgj_companyrule",
|
DynamicObject companyRule = BusinessDataServiceHelper.loadSingle("zcgj_companyrule",
|
||||||
"zcgj_entryrule,zcgj_entryrule.zcgj_expenseitem,zcgj_entryrule.zcgj_ruletype," +
|
|
||||||
"zcgj_entryrule.zcgj_companytype,zcgj_entryrule.zcgj_positiontype,zcgj_entryrule.zcgj_persontype",
|
|
||||||
new QFilter("zcgj_costcompany.id", QCP.equals, costCompanyId).toArray());//公司科目分类规则单
|
new QFilter("zcgj_costcompany.id", QCP.equals, costCompanyId).toArray());//公司科目分类规则单
|
||||||
if (companyRule != null) {
|
if (companyRule != null) {
|
||||||
//公司科目分类规则中存在对应公司的信息
|
//公司科目分类规则中存在对应公司的信息
|
||||||
|
|
|
@ -0,0 +1,271 @@
|
||||||
|
package zcgj.zcdev.zcdev.fs.plugin.form;
|
||||||
|
|
||||||
|
import kd.bos.bill.AbstractBillPlugIn;
|
||||||
|
import kd.bos.dataentity.entity.DynamicObject;
|
||||||
|
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
||||||
|
import kd.bos.dataentity.utils.StringUtils;
|
||||||
|
import kd.bos.entity.datamodel.IDataModel;
|
||||||
|
import kd.bos.entity.datamodel.events.PropertyChangedArgs;
|
||||||
|
import kd.bos.form.field.BasedataEdit;
|
||||||
|
import kd.bos.form.field.events.BeforeF7SelectEvent;
|
||||||
|
import kd.bos.form.field.events.BeforeF7SelectListener;
|
||||||
|
import kd.bos.list.ListShowParameter;
|
||||||
|
import kd.bos.orm.query.QCP;
|
||||||
|
import kd.bos.orm.query.QFilter;
|
||||||
|
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||||
|
import kd.bos.servicehelper.QueryServiceHelper;
|
||||||
|
import kd.bos.servicehelper.user.UserServiceHelper;
|
||||||
|
import kd.sdk.plugin.Plugin;
|
||||||
|
import zcgj.zcdev.zcdev.fs.utils.OrgCheckUtils;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.EventObject;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 差旅报销单:行程信息分录编辑页插件;费用项目过滤和科目属性过滤与赋值
|
||||||
|
*/
|
||||||
|
public class TripEntryEditAccountTypePlugin extends AbstractBillPlugIn implements Plugin, BeforeF7SelectListener {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void registerListener(EventObject e) {
|
||||||
|
super.registerListener(e);
|
||||||
|
DynamicObject dataEntity = this.getView().getParentView().getModel().getDataEntity(true);//获取父页面数据实体
|
||||||
|
Object company = dataEntity.get("costcompany");//核算组织(费用承担公司)
|
||||||
|
if (company != null) {
|
||||||
|
DynamicObject companyObj = (DynamicObject) company;
|
||||||
|
Long companyId = companyObj.getLong("id");
|
||||||
|
if (OrgCheckUtils.isKS(companyId)) {
|
||||||
|
//仅针对矿山下组织下的逻辑
|
||||||
|
BasedataEdit accountType = this.getControl("zcgj_accounttype"); //科目属性
|
||||||
|
if (accountType != null) {
|
||||||
|
accountType.addBeforeF7SelectListener(this);
|
||||||
|
}
|
||||||
|
BasedataEdit tripeExpenseItem = this.getControl("tripexpenseitem"); //费用项目
|
||||||
|
if (tripeExpenseItem != null) {
|
||||||
|
tripeExpenseItem.addBeforeF7SelectListener(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void beforeF7Select(BeforeF7SelectEvent beforeF7SelectEvent) {
|
||||||
|
DynamicObject dataEntity = this.getView().getParentView().getModel().getDataEntity(true);//获取父页面数据实体
|
||||||
|
DynamicObject companyObj = (DynamicObject) dataEntity.get("costcompany");//核算组织(费用承担公司)
|
||||||
|
if (companyObj != null) {
|
||||||
|
Long companyId = companyObj.getLong("id");
|
||||||
|
if (OrgCheckUtils.isKS(companyId)) {
|
||||||
|
//仅针对矿山下组织下的逻辑
|
||||||
|
String name = beforeF7SelectEvent.getProperty().getName();
|
||||||
|
if (name.equals("zcgj_accounttype")) {
|
||||||
|
//科目属性
|
||||||
|
DynamicObject tripeExpenseItem = (DynamicObject) this.getModel().getValue("tripexpenseitem");//费用项目
|
||||||
|
if (tripeExpenseItem != null) {
|
||||||
|
QFilter filter = new QFilter("zcgj_entryentity.zcgj_fee", QCP.equals, tripeExpenseItem.getLong("id"));
|
||||||
|
QFilter biztypefilter = new QFilter("zcgj_biztype", QCP.equals, "20");
|
||||||
|
DynamicObjectCollection accountfeeEntries = QueryServiceHelper.query("zcgj_accountfee",
|
||||||
|
"zcgj_entryentity.zcgj_accounttype.number", new QFilter[]{filter, biztypefilter});//费用与科目分类单
|
||||||
|
List<String> numbers = new ArrayList<>();
|
||||||
|
if (accountfeeEntries != null) {
|
||||||
|
for (DynamicObject dynamicObject : accountfeeEntries) {
|
||||||
|
String zcgjAccounttypeNumber = dynamicObject.getString("zcgj_entryentity.zcgj_accounttype.number");
|
||||||
|
if (zcgjAccounttypeNumber != null) {
|
||||||
|
numbers.add(zcgjAccounttypeNumber);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
QFilter qFilter = new QFilter("number", QCP.in, numbers);
|
||||||
|
ListShowParameter formShowParameter = (ListShowParameter) beforeF7SelectEvent.getFormShowParameter();
|
||||||
|
formShowParameter.getListFilterParameter().getQFilters().add(qFilter);
|
||||||
|
} else {
|
||||||
|
this.getView().showErrorNotification("请选择费用项目!");
|
||||||
|
beforeF7SelectEvent.setCancel(true);
|
||||||
|
}
|
||||||
|
} else if ("tripexpenseitem".equals(name)) {
|
||||||
|
//费用项目增加过滤
|
||||||
|
QFilter bizTypeFilter = new QFilter("zcgj_biztype", QCP.equals, "20"); //过滤业务单据为支出财务确认单
|
||||||
|
DynamicObject zcgj_accountFee = BusinessDataServiceHelper.loadSingle("zcgj_accountfee",
|
||||||
|
"zcgj_entryentity,zcgj_entryentity.zcgj_fee", bizTypeFilter.toArray());//费用与科目分类表
|
||||||
|
List<String> feeNumbers = new ArrayList<>();
|
||||||
|
if (zcgj_accountFee != null) {
|
||||||
|
DynamicObjectCollection entryEntityCollection = zcgj_accountFee.getDynamicObjectCollection("zcgj_entryentity");//分录
|
||||||
|
for (DynamicObject entryEntity : entryEntityCollection) {
|
||||||
|
DynamicObject fee = entryEntity.getDynamicObject("zcgj_fee");//费用项目
|
||||||
|
String feeNumber = fee.getString("number");
|
||||||
|
feeNumbers.add(feeNumber);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
QFilter qFilter = new QFilter("number", QCP.in, feeNumbers);
|
||||||
|
ListShowParameter formShowParameter = (ListShowParameter) beforeF7SelectEvent.getFormShowParameter();
|
||||||
|
formShowParameter.getListFilterParameter().getQFilters().add(qFilter);
|
||||||
|
formShowParameter.getTreeFilterParameter().getQFilters().add(qFilter);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void propertyChanged(PropertyChangedArgs e) {
|
||||||
|
super.propertyChanged(e);
|
||||||
|
String name = e.getProperty().getName();
|
||||||
|
if (StringUtils.equals(name, "tripexpenseitem")) {
|
||||||
|
//费用项目
|
||||||
|
DynamicObject dataEntity = this.getView().getParentView().getModel().getDataEntity(true);//获取父页面数据实体
|
||||||
|
DynamicObject companyObj = (DynamicObject) dataEntity.get("costcompany");//核算组织(费用承担公司)
|
||||||
|
if (companyObj != null) {
|
||||||
|
Long costCompanyId = companyObj.getLong("id");//核算组织(费用承担公司)id
|
||||||
|
if (OrgCheckUtils.isKS(costCompanyId)) {
|
||||||
|
//仅针对矿山下组织下的逻辑
|
||||||
|
DynamicObject tripeExpenseItem = (DynamicObject) this.getModel().getValue("tripexpenseitem");//费用项目
|
||||||
|
if (tripeExpenseItem == null) {
|
||||||
|
this.getModel().setValue("zcgj_accounttype", null);//科目属性
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
long tripeExpenseItemId = tripeExpenseItem.getLong("id");//费用项目id
|
||||||
|
QFilter filter = new QFilter("zcgj_entryentity.zcgj_fee", QCP.equals, tripeExpenseItemId).and("zcgj_biztype", QCP.equals, "20");
|
||||||
|
DynamicObjectCollection AccountFeeCollection = QueryServiceHelper.query("zcgj_accountfee",
|
||||||
|
"zcgj_entryentity.zcgj_accounttype", new QFilter[]{filter});//费用与科目分类单
|
||||||
|
|
||||||
|
if (AccountFeeCollection != null && AccountFeeCollection.size() == 1) {
|
||||||
|
//费用与科目分类中费用项目与科目分类为一对一的关系,直接获取科目分类赋值
|
||||||
|
long id = AccountFeeCollection.get(0).getLong("zcgj_entryentity.zcgj_accounttype");
|
||||||
|
this.getModel().setValue("zcgj_accounttype", id);//科目属性
|
||||||
|
} else if (AccountFeeCollection != null && AccountFeeCollection.size() > 1) {
|
||||||
|
QFilter filter1 = new QFilter("zcgj_entryexpense.zcgj_expenseitem", QCP.equals, tripeExpenseItemId);
|
||||||
|
DynamicObjectCollection orgTypeDefaultCollection = QueryServiceHelper.query("zcgj_orgtypedefault",
|
||||||
|
"zcgj_entryexpense.zcgj_yanzhou,zcgj_entryexpense.zcgj_xian,zcgj_entryexpense.zcgj_nanjing,zcgj_entryexpense.zcgj_tianjin",
|
||||||
|
new QFilter[]{filter1});//默认科目分类单
|
||||||
|
if (orgTypeDefaultCollection != null && orgTypeDefaultCollection.size() == 1) {
|
||||||
|
//默认科目分类中存在单条的费用项目
|
||||||
|
DynamicObject companyRule = BusinessDataServiceHelper.loadSingle("zcgj_companyrule",
|
||||||
|
new QFilter("zcgj_costcompany.id", QCP.equals, costCompanyId).toArray());//公司科目分类规则单
|
||||||
|
if (companyRule != null) {
|
||||||
|
//公司科目分类规则中存在对应公司的信息
|
||||||
|
DynamicObjectCollection entryRuleCollection = companyRule.getDynamicObjectCollection("zcgj_entryrule");//公司费用分类规则分录
|
||||||
|
for (DynamicObject entryRule : entryRuleCollection) {
|
||||||
|
DynamicObject entryRuleExpenseItem = entryRule.getDynamicObject("zcgj_expenseitem");//费用项目
|
||||||
|
String entryRuleRuleType = entryRule.getString("zcgj_ruletype");//分类规则
|
||||||
|
if (entryRuleExpenseItem != null && entryRuleExpenseItem.getLong("id") == tripeExpenseItemId) {
|
||||||
|
DynamicObject applier = dataEntity.getDynamicObject("applier");//申请人
|
||||||
|
long applierId = applier.getLong("id");//申请人id
|
||||||
|
switch (entryRuleRuleType) {
|
||||||
|
case "公司":
|
||||||
|
DynamicObject entryRuleCompanyType = entryRule.getDynamicObject("zcgj_companytype");//公司默认分类(科目分类)
|
||||||
|
if (entryRuleCompanyType != null) {
|
||||||
|
this.getModel().setValue("zcgj_accounttype", entryRuleCompanyType);//科目属性
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
case "部门属性":
|
||||||
|
DynamicObject costDept = dataEntity.getDynamicObject("costdept");//费用承担部门
|
||||||
|
DynamicObject dutyRelation = BusinessDataServiceHelper.loadSingle("bos_org_dutyrelation", "orgduty",
|
||||||
|
new QFilter("org.id", QCP.equals, costDept.getLong("id")).toArray());//部门属性管理单
|
||||||
|
if (dutyRelation != null) {
|
||||||
|
DynamicObject orgDuty = dutyRelation.getDynamicObject("orgduty");//业务属性
|
||||||
|
long id = orgDuty.getLong("id");
|
||||||
|
DynamicObject accountType = BusinessDataServiceHelper.loadSingle("zcgj_accounttype", "id",
|
||||||
|
new QFilter("zcgj_orgtype.fbasedataid", QCP.in, id).toArray());//科目分类单
|
||||||
|
if (accountType != null) {
|
||||||
|
this.getModel().setValue("zcgj_accounttype", accountType);//科目属性
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
case "职位":
|
||||||
|
String userMainJob = UserServiceHelper.getUserMainJob(applierId);//申请人默认主职位
|
||||||
|
QFilter filter4 = new QFilter("zcgj_entryposition.zcgj_cusposition.name", QCP.equals, userMainJob);//职位
|
||||||
|
QFilter filter5 = new QFilter("zcgj_entryposition.zcgj_expenseitem", QCP.equals, tripeExpenseItemId);//费用项目
|
||||||
|
DynamicObjectCollection zcgj_positionrule = QueryServiceHelper.query("zcgj_positionrule",
|
||||||
|
"zcgj_entryposition.zcgj_accounttype", new QFilter[]{filter4, filter5});//职位科目分类单
|
||||||
|
if (zcgj_positionrule != null && zcgj_positionrule.size() == 1) {
|
||||||
|
long zcgj_accounttype = zcgj_positionrule.get(0).getLong("zcgj_entryposition.zcgj_accounttype");
|
||||||
|
if (zcgj_accounttype != 0) {
|
||||||
|
this.getModel().setValue("zcgj_accounttype", zcgj_accounttype);//科目属性
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
DynamicObject zcgj_positiontype = entryRule.getDynamicObject("zcgj_positiontype");//职位默认分类
|
||||||
|
if (zcgj_positiontype != null) {
|
||||||
|
this.getModel().setValue("zcgj_accounttype", zcgj_positiontype);//科目属性
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "人员":
|
||||||
|
QFilter filter6 = new QFilter("zcgj_entryperson.zcgj_person.id", QCP.equals, applierId);//申请人
|
||||||
|
QFilter filter7 = new QFilter("zcgj_entryperson.zcgj_expenseitem", QCP.equals, tripeExpenseItemId);//费用项目
|
||||||
|
DynamicObjectCollection zcgj_personrule = QueryServiceHelper.query("zcgj_personrule",
|
||||||
|
"zcgj_entryperson.zcgj_accounttype", new QFilter[]{filter6, filter7});//人员科目分类单
|
||||||
|
if (zcgj_personrule != null && zcgj_personrule.size() == 1) {
|
||||||
|
long zcgj_accounttype = zcgj_personrule.get(0).getLong("zcgj_entryperson.zcgj_accounttype");
|
||||||
|
if (zcgj_accounttype != 0) {
|
||||||
|
this.getModel().setValue("zcgj_accounttype", zcgj_accounttype);//科目属性
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
DynamicObject zcgj_persontype = entryRule.getDynamicObject("zcgj_persontype");//人员默认分类
|
||||||
|
if (zcgj_persontype != null) {
|
||||||
|
this.getModel().setValue("zcgj_accounttype", zcgj_persontype);//科目属性
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
QFilter filter3 = new QFilter("entryentity.orgid", QCP.equals, costCompanyId);
|
||||||
|
DynamicObjectCollection wf_orgTypCollection = QueryServiceHelper.query("wf_orgtype",
|
||||||
|
"number", new QFilter[]{filter3});//组织分类单
|
||||||
|
|
||||||
|
if (wf_orgTypCollection != null && wf_orgTypCollection.size() > 0) {
|
||||||
|
List<String> numbers = new ArrayList<>();
|
||||||
|
for (DynamicObject wf_orgTyp : wf_orgTypCollection) {
|
||||||
|
String number = wf_orgTyp.getString("number");
|
||||||
|
numbers.add(number);
|
||||||
|
}
|
||||||
|
DynamicObject orgCateGoryConfig = BusinessDataServiceHelper.loadSingle("zcgj_orgcategoryconfig",
|
||||||
|
"zcgj_defaultsubjectcode",
|
||||||
|
new QFilter("number", QCP.in, numbers).toArray());//组织分类配置表单
|
||||||
|
|
||||||
|
String accountType = null;//默认科目分类中的科目分类
|
||||||
|
if (orgCateGoryConfig != null) {
|
||||||
|
String defaultSubjectCode = orgCateGoryConfig.getString("zcgj_defaultsubjectcode");//默认科目分类编码
|
||||||
|
switch (defaultSubjectCode) {
|
||||||
|
case "ZCKS_NJXMBM":
|
||||||
|
//南京项目
|
||||||
|
accountType = "zcgj_nanjing";
|
||||||
|
break;
|
||||||
|
case "ZCKS_TJXMBM":
|
||||||
|
//天津项目
|
||||||
|
accountType = "zcgj_tianjin";
|
||||||
|
break;
|
||||||
|
case "ZCKS_XAXMBM":
|
||||||
|
//西安项目
|
||||||
|
accountType = "zcgj_xian";
|
||||||
|
break;
|
||||||
|
case "ZCKS_YZ_XMBM":
|
||||||
|
//兖州项目
|
||||||
|
accountType = "zcgj_yanzhou";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (accountType != null) {
|
||||||
|
long id = orgTypeDefaultCollection.get(0).getLong("zcgj_entryexpense." + accountType);
|
||||||
|
this.getModel().setValue("zcgj_accounttype", id);//科目属性
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
//组织分类配置表中未查询到对应数据,说明组织分类中编码有所改变,需维护对应的组织分类配置表
|
||||||
|
this.getModel().setValue("zcgj_accounttype", null);//科目属性
|
||||||
|
this.getView().showErrorNotification("组织分类中编码有所改变,请维护对应的组织分类配置表!");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.getModel().setValue("zcgj_accounttype", null);//科目属性
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.getModel().setValue("zcgj_accounttype", null);//科目属性
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.getModel().setValue("zcgj_accounttype", null);//科目属性
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -131,13 +131,14 @@ public class PayApplyOpExt extends AbstractReverseWritingContractOp {
|
||||||
|
|
||||||
BigDecimal totalInvoiceAmount = BigDecimal.ZERO;
|
BigDecimal totalInvoiceAmount = BigDecimal.ZERO;
|
||||||
QFilter[] contractFilter = new QFilter[]{new QFilter("zcgj_contract.id", QCP.equals, contractId).and("billstatus", QCP.equals, "C")}; // 合同筛选条件
|
QFilter[] contractFilter = new QFilter[]{new QFilter("zcgj_contract.id", QCP.equals, contractId).and("billstatus", QCP.equals, "C")}; // 合同筛选条件
|
||||||
DynamicObject[] financeConfirmObjs = BusinessDataServiceHelper.load("zcgj_ec_out_finaceconfirm", "id,billstatus,zcgj_entryentity,zcgj_entryentity.zcgj_invoiceamount", contractFilter); // 支出财务确认
|
DynamicObject[] financeConfirmObjs = BusinessDataServiceHelper.load("zcgj_ec_out_finaceconfirm",
|
||||||
|
"id,billstatus,zcgj_entryentity,zcgj_entryentity.zcgj_oftaxinvoiceamount", contractFilter); // 支出财务确认
|
||||||
for (int i = 0; i < financeConfirmObjs.length; i++) {
|
for (int i = 0; i < financeConfirmObjs.length; i++) {
|
||||||
DynamicObject financeConfirmObj = financeConfirmObjs[i];
|
DynamicObject financeConfirmObj = financeConfirmObjs[i];
|
||||||
DynamicObjectCollection invoiceEntryList = financeConfirmObj.getDynamicObjectCollection("zcgj_entryentity"); // 支出财务确认-合同进项发票信息
|
DynamicObjectCollection invoiceEntryList = financeConfirmObj.getDynamicObjectCollection("zcgj_entryentity"); // 支出财务确认-合同进项发票信息
|
||||||
for (int j = 0; j < invoiceEntryList.size(); j++) {
|
for (int j = 0; j < invoiceEntryList.size(); j++) {
|
||||||
DynamicObject invoiceEntry = invoiceEntryList.get(j);
|
DynamicObject invoiceEntry = invoiceEntryList.get(j);
|
||||||
BigDecimal invoiceAmount = invoiceEntry.getBigDecimal("zcgj_invoiceamount"); // 发票金额
|
BigDecimal invoiceAmount = invoiceEntry.getBigDecimal("zcgj_oftaxinvoiceamount"); // 价税合计
|
||||||
totalInvoiceAmount = totalInvoiceAmount.add(invoiceAmount);
|
totalInvoiceAmount = totalInvoiceAmount.add(invoiceAmount);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -184,12 +185,14 @@ public class PayApplyOpExt extends AbstractReverseWritingContractOp {
|
||||||
contract.set("totalapplyoftaxamount", totalApplyOfTaxAmount.add(thisApplyOfTaxAmount));//支出合同-累计应付含税金额
|
contract.set("totalapplyoftaxamount", totalApplyOfTaxAmount.add(thisApplyOfTaxAmount));//支出合同-累计应付含税金额
|
||||||
contract.set("totalapplyamount", totalApplyAmount.add(thisApplyAmount));//支出合同-累计应付金额
|
contract.set("totalapplyamount", totalApplyAmount.add(thisApplyAmount));//支出合同-累计应付金额
|
||||||
contract.set("totalinvoiceamount", totalinvoiceAmount.add(invoiceAmount));//支出合同-累计开票金额
|
contract.set("totalinvoiceamount", totalinvoiceAmount.add(invoiceAmount));//支出合同-累计开票金额
|
||||||
contract.set("totalinvoiceoftaxamount", totalInvoiceOftaxAmount.add(invoiceOfTaxAmont).add(totalInvoiceAmount));//支出合同-累计开票价税合计
|
// contract.set("totalinvoiceoftaxamount", totalInvoiceOftaxAmount.add(invoiceOfTaxAmont).add(totalInvoiceAmount));//支出合同-累计开票价税合计
|
||||||
|
contract.set("totalinvoiceoftaxamount", totalInvoiceOftaxAmount.add(invoiceOfTaxAmont));//支出合同-累计开票价税合计
|
||||||
} else if (StringUtils.equals(operationKey, "unaudit")) {
|
} else if (StringUtils.equals(operationKey, "unaudit")) {
|
||||||
contract.set("totalapplyoftaxamount", totalApplyOfTaxAmount.subtract(thisApplyOfTaxAmount));//支出合同-累计应付含税金额
|
contract.set("totalapplyoftaxamount", totalApplyOfTaxAmount.subtract(thisApplyOfTaxAmount));//支出合同-累计应付含税金额
|
||||||
contract.set("totalapplyamount", totalApplyAmount.subtract(thisApplyAmount));//支出合同-累计应付金额
|
contract.set("totalapplyamount", totalApplyAmount.subtract(thisApplyAmount));//支出合同-累计应付金额
|
||||||
contract.set("totalinvoiceamount", totalinvoiceAmount.subtract(invoiceAmount));//支出合同-累计开票金额
|
contract.set("totalinvoiceamount", totalinvoiceAmount.subtract(invoiceAmount));//支出合同-累计开票金额
|
||||||
contract.set("totalinvoiceoftaxamount", totalInvoiceOftaxAmount.subtract(invoiceOfTaxAmont).subtract(totalInvoiceAmount));//支出合同-累计开票价税合计
|
// contract.set("totalinvoiceoftaxamount", totalInvoiceOftaxAmount.subtract(invoiceOfTaxAmont).subtract(totalInvoiceAmount));//支出合同-累计开票价税合计
|
||||||
|
contract.set("totalinvoiceoftaxamount", totalInvoiceOftaxAmount.subtract(invoiceOfTaxAmont));//支出合同-累计开票价税合计
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,60 @@
|
||||||
|
package zcgj.zcdev.zcdev.pr.plugin.operate;
|
||||||
|
|
||||||
|
import kd.bos.dataentity.entity.DynamicObject;
|
||||||
|
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
||||||
|
import kd.bos.entity.plugin.AbstractOperationServicePlugIn;
|
||||||
|
import kd.bos.entity.plugin.args.AfterOperationArgs;
|
||||||
|
import kd.bos.orm.query.QCP;
|
||||||
|
import kd.bos.orm.query.QFilter;
|
||||||
|
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||||
|
import kd.bos.servicehelper.operation.SaveServiceHelper;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 支出财务确认单:审核反审核操作插件;将合同进项发票信息分录中的价税合加减赋给→支出合同的累计开票价税合计中
|
||||||
|
*/
|
||||||
|
public class FinanceConfirmAuditOp extends AbstractOperationServicePlugIn {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void afterExecuteOperationTransaction(AfterOperationArgs e) {
|
||||||
|
super.afterExecuteOperationTransaction(e);
|
||||||
|
|
||||||
|
String operationKey = e.getOperationKey();//操作标识
|
||||||
|
DynamicObject[] dataEntities = e.getDataEntities();
|
||||||
|
List<DynamicObject> modifiedEntities = new ArrayList<>();
|
||||||
|
|
||||||
|
for (DynamicObject model : dataEntities) {
|
||||||
|
long id = model.getLong("id");
|
||||||
|
QFilter f1 = new QFilter("id", "=", id);
|
||||||
|
DynamicObject FinanceConfirm = BusinessDataServiceHelper.loadSingle("zcgj_ec_out_finaceconfirm",
|
||||||
|
"zcgj_contract,zcgj_entryentity,zcgj_entryentity.zcgj_oftaxinvoiceamount", new QFilter[]{f1});//支出财务确认单
|
||||||
|
DynamicObjectCollection entryEntityCollection = FinanceConfirm.getDynamicObjectCollection("zcgj_entryentity");//合同进项发票信息分录
|
||||||
|
BigDecimal totalTaxInvoiceAmount = BigDecimal.ZERO;
|
||||||
|
for (DynamicObject entryEntity : entryEntityCollection) {
|
||||||
|
BigDecimal ofTaxInvoiceAmount = entryEntity.getBigDecimal("zcgj_oftaxinvoiceamount");//价税合计
|
||||||
|
totalTaxInvoiceAmount = totalTaxInvoiceAmount.add(ofTaxInvoiceAmount);
|
||||||
|
}
|
||||||
|
DynamicObject contract = FinanceConfirm.getDynamicObject("zcgj_contract");//合同名称
|
||||||
|
QFilter filter = new QFilter("billno", QCP.equals, contract.getString("number"));
|
||||||
|
DynamicObject ec_out_contract = BusinessDataServiceHelper.loadSingle("ec_out_contract", new QFilter[]{filter});//支出合同
|
||||||
|
BigDecimal totalInvoiceofTaxAmount = ec_out_contract.getBigDecimal("totalinvoiceoftaxamount");//累计开票价税合计
|
||||||
|
if (operationKey.equals("audit")) {
|
||||||
|
ec_out_contract.set("totalinvoiceoftaxamount", totalInvoiceofTaxAmount.add(totalTaxInvoiceAmount));//支出合同-累计开票价税合计
|
||||||
|
} else if (operationKey.equals("unaudit")) {
|
||||||
|
ec_out_contract.set("totalinvoiceoftaxamount", totalInvoiceofTaxAmount.subtract(totalTaxInvoiceAmount));//支出合同-累计开票价税合计
|
||||||
|
}
|
||||||
|
modifiedEntities.add(ec_out_contract);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!modifiedEntities.isEmpty()) {
|
||||||
|
try {
|
||||||
|
SaveServiceHelper.save(modifiedEntities.toArray(new DynamicObject[0]));
|
||||||
|
} catch (Exception ex) {
|
||||||
|
throw new RuntimeException(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue