收入财务确认上拉合同履约与审核反审核反写金额等相关逻辑
This commit is contained in:
parent
2fa35aca26
commit
7563a3106b
|
|
@ -14,6 +14,8 @@ import kd.bos.form.FormShowParameter;
|
||||||
import kd.bos.form.IPageCache;
|
import kd.bos.form.IPageCache;
|
||||||
import kd.bos.form.ShowType;
|
import kd.bos.form.ShowType;
|
||||||
import kd.bos.form.control.EntryGrid;
|
import kd.bos.form.control.EntryGrid;
|
||||||
|
import kd.bos.form.control.events.BeforeItemClickEvent;
|
||||||
|
import kd.bos.form.control.events.ItemClickEvent;
|
||||||
import kd.bos.form.events.HyperLinkClickEvent;
|
import kd.bos.form.events.HyperLinkClickEvent;
|
||||||
import kd.bos.form.events.HyperLinkClickListener;
|
import kd.bos.form.events.HyperLinkClickListener;
|
||||||
import kd.bos.form.field.RefBillEdit;
|
import kd.bos.form.field.RefBillEdit;
|
||||||
|
|
@ -151,8 +153,48 @@ public class InContractFinaceConfirmePlugin extends AbstractBillPlugIn implement
|
||||||
}else if(StringUtils.equals(name, "zcgj_ec_in_contract_sett")){
|
}else if(StringUtils.equals(name, "zcgj_ec_in_contract_sett")){
|
||||||
DynamicObject newValue = (DynamicObject)changeData.getNewValue();
|
DynamicObject newValue = (DynamicObject)changeData.getNewValue();
|
||||||
initData(newValue.getLong("id"));
|
initData(newValue.getLong("id"));
|
||||||
|
} else if (StringUtils.equals(name, "zcgj_bolttype")) {
|
||||||
|
//冲销类型
|
||||||
|
Object newValue = changeData.getNewValue();//新值
|
||||||
|
DynamicObjectCollection zcgj_expensereversal = this.getModel().getDataEntity(true).getDynamicObjectCollection("zcgj_expensereversal");//冲销支出结算分录
|
||||||
|
DynamicObjectCollection zcgj_performrec = this.getModel().getDataEntity(true).getDynamicObjectCollection("zcgj_performrec");//冲销履约记录分录
|
||||||
|
if (newValue == null || newValue.equals("30")) {
|
||||||
|
zcgj_expensereversal.clear();
|
||||||
|
zcgj_performrec.clear();
|
||||||
|
} else if (newValue.equals("10")) {
|
||||||
|
zcgj_expensereversal.clear();
|
||||||
|
} else if (newValue.equals("20")) {
|
||||||
|
zcgj_performrec.clear();
|
||||||
|
}
|
||||||
|
this.getView().updateView("zcgj_expensereversal");
|
||||||
|
this.getView().updateView("zcgj_performrec");
|
||||||
|
} else if (StringUtils.equals(name, "zcgj_contract")) {
|
||||||
|
//合同名称
|
||||||
|
DynamicObjectCollection zcgj_expensereversal = this.getModel().getDataEntity(true).getDynamicObjectCollection("zcgj_expensereversal");//冲销支出结算分录
|
||||||
|
DynamicObjectCollection zcgj_performrec = this.getModel().getDataEntity(true).getDynamicObjectCollection("zcgj_performrec");//冲销履约记录分录
|
||||||
|
zcgj_expensereversal.clear();
|
||||||
|
zcgj_performrec.clear();
|
||||||
|
this.getView().updateView("zcgj_expensereversal");
|
||||||
|
this.getView().updateView("zcgj_performrec");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void itemClick(ItemClickEvent evt) {
|
||||||
|
super.itemClick(evt);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void beforeItemClick(BeforeItemClickEvent evt) {
|
||||||
|
super.beforeItemClick(evt);
|
||||||
|
if (StringUtils.equals("zcgj_drawzcht", evt.getItemKey()) || StringUtils.equals("zcgj_drawlyjl", evt.getItemKey())) {
|
||||||
|
//冲销支出结算和冲销履约记录分录的增行按钮
|
||||||
|
Object zcgj_contract = this.getModel().getValue("zcgj_contract");//合同名称
|
||||||
|
if (zcgj_contract == null) {
|
||||||
|
this.getView().showErrorNotification("请先选择合同名称");
|
||||||
|
evt.setCancel(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void ofTaxAmountChanged(ChangeData changeData) {
|
protected void ofTaxAmountChanged(ChangeData changeData) {
|
||||||
|
|
@ -195,6 +237,8 @@ public class InContractFinaceConfirmePlugin extends AbstractBillPlugIn implement
|
||||||
if(outContractSett != null) {
|
if(outContractSett != null) {
|
||||||
outContractSett.addBeforeF7SelectListener(this);
|
outContractSett.addBeforeF7SelectListener(this);
|
||||||
}
|
}
|
||||||
|
this.addItemClickListeners("zcgj_entrytoolbar111");
|
||||||
|
this.addItemClickListeners("zcgj_entrytoolbar1111");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,69 @@
|
||||||
|
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.PreparePropertysEventArgs;
|
||||||
|
import kd.bos.entity.plugin.args.EndOperationTransactionArgs;
|
||||||
|
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 FinaceConfirmRevWriteAmtOp extends AbstractOperationServicePlugIn {
|
||||||
|
|
||||||
|
public void onPreparePropertys(PreparePropertysEventArgs e) {
|
||||||
|
e.getFieldKeys().add("zcgj_performrec");
|
||||||
|
e.getFieldKeys().add("zcgj_performrec.zcgj_thisreversalamount");
|
||||||
|
e.getFieldKeys().add("zcgj_performrec.zcgj_performrecid");
|
||||||
|
e.getFieldKeys().add("zcgj_bolttype");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void endOperationTransaction(EndOperationTransactionArgs e) {
|
||||||
|
String operationKey = e.getOperationKey();
|
||||||
|
DynamicObject[] dataEntities = e.getDataEntities();
|
||||||
|
switch (operationKey) {
|
||||||
|
case "audit"://审核
|
||||||
|
updateInApplyReversaAmt(dataEntities, true);
|
||||||
|
break;
|
||||||
|
case "unaudit"://反审核
|
||||||
|
updateInApplyReversaAmt(dataEntities, false);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void updateInApplyReversaAmt(DynamicObject[] dataEntities, boolean isAudit) {
|
||||||
|
for (DynamicObject dataEntity : dataEntities) {
|
||||||
|
String zcgj_bolttype = dataEntity.getString("zcgj_bolttype");//冲销类型
|
||||||
|
if ("10".equals(zcgj_bolttype)) {
|
||||||
|
//冲销合同履约记录
|
||||||
|
DynamicObjectCollection PerFormRecCollection = dataEntity.getDynamicObjectCollection("zcgj_performrec");//冲销履约记录分录
|
||||||
|
for (DynamicObject perFormRec : PerFormRecCollection) {
|
||||||
|
BigDecimal zcgj_thisreversalamount = perFormRec.getBigDecimal("zcgj_thisreversalamount");//本次冲销金额
|
||||||
|
long zcgj_performrecid = perFormRec.getLong("zcgj_performrecid");//来源单据id-收入合同履约记录id
|
||||||
|
QFilter[] qFilters = new QFilter[]{new QFilter("id", QCP.equals, zcgj_performrecid)};
|
||||||
|
DynamicObject ec_in_perFormRecords = BusinessDataServiceHelper.loadSingle("ec_in_performrecords", "id,zcgj_taxperformflot", qFilters);//收入合同履约记录
|
||||||
|
BigDecimal zcgj_taxperformflot = ec_in_perFormRecords.getBigDecimal("zcgj_taxperformflot");//含税履约金额(已冲销)
|
||||||
|
if (isAudit) {
|
||||||
|
zcgj_taxperformflot = zcgj_taxperformflot.add(zcgj_thisreversalamount);
|
||||||
|
} else {
|
||||||
|
zcgj_taxperformflot = zcgj_taxperformflot.subtract(zcgj_thisreversalamount);
|
||||||
|
}
|
||||||
|
ec_in_perFormRecords.set("zcgj_taxperformflot", zcgj_taxperformflot);//含税履约金额(已冲销)
|
||||||
|
SaveServiceHelper.save(new DynamicObject[]{ec_in_perFormRecords});
|
||||||
|
}
|
||||||
|
} else if ("20".equals(zcgj_bolttype)) {
|
||||||
|
//冲销业主支出结算
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,34 @@
|
||||||
|
package zcgj.zcdev.zcdev.pr.plugin.other;
|
||||||
|
|
||||||
|
import kd.bos.dataentity.entity.DynamicObject;
|
||||||
|
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
||||||
|
import kd.bos.entity.botp.plugin.AbstractConvertPlugIn;
|
||||||
|
import kd.bos.entity.botp.plugin.args.AfterBuildDrawFilterEventArgs;
|
||||||
|
import kd.bos.orm.query.QCP;
|
||||||
|
import kd.bos.orm.query.QFilter;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 收入财务确认上拉收入合同履约记录botp插件
|
||||||
|
*/
|
||||||
|
public class FinanceConfirmPerfRecordsPlugin extends AbstractConvertPlugIn {
|
||||||
|
@Override
|
||||||
|
public void afterBuildDrawFilter(AfterBuildDrawFilterEventArgs e) {
|
||||||
|
//选单过滤
|
||||||
|
super.afterBuildDrawFilter(e);
|
||||||
|
DynamicObject targetDataEntity = e.getTargetDataEntity();//当前数据包
|
||||||
|
DynamicObjectCollection perFormRecCollection = targetDataEntity.getDynamicObjectCollection("zcgj_performrec");//冲销履约记录分录
|
||||||
|
List<Long> ids = new ArrayList<>();
|
||||||
|
for (DynamicObject perFormRec : perFormRecCollection) {
|
||||||
|
long zcgj_performrecid = perFormRec.getLong("zcgj_performrecid");
|
||||||
|
ids.add(zcgj_performrecid);
|
||||||
|
}
|
||||||
|
QFilter filter = new QFilter("id", QCP.not_in, ids);
|
||||||
|
DynamicObject zcgj_contract = targetDataEntity.getDynamicObject("zcgj_contract");//合同名称
|
||||||
|
long contractId = zcgj_contract.getLong("id");
|
||||||
|
filter = filter.and(new QFilter("contract", QCP.equals, contractId));
|
||||||
|
e.setPlugFilter(filter);
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue