Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
9f15f95342
|
@ -9,6 +9,7 @@ import kd.bos.entity.report.FilterItemInfo;
|
|||
import kd.bos.entity.report.ReportQueryParam;
|
||||
import kd.bos.logging.Log;
|
||||
import kd.bos.logging.LogFactory;
|
||||
import kd.bos.orm.ORM;
|
||||
import kd.bos.orm.query.QCP;
|
||||
import kd.bos.orm.query.QFilter;
|
||||
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||
|
@ -33,274 +34,58 @@ public class CapitalDayListDataPlugin extends AbstractReportListDataPlugin imple
|
|||
@Override
|
||||
public DataSet query(ReportQueryParam reportQueryParam, Object o) throws Throwable {
|
||||
|
||||
//获取过滤条件集合
|
||||
Map<String, Object> paramMap = this.transQueryParam(reportQueryParam);
|
||||
DynamicObjectCollection companys = (DynamicObjectCollection)paramMap.get("shkd_filter_company");//使用组织集合
|
||||
DynamicObjectCollection groups = (DynamicObjectCollection)paramMap.get("shkd_filter_group");//使用组织集合
|
||||
String shkd_queryorgtype = paramMap.get("shkd_queryorgtype").toString();//使用组织集合
|
||||
ArrayList<Long> longs = new ArrayList<>();
|
||||
String groupName = null;
|
||||
//如果查询是查的集团,然后想要查询需查询下级及下级所有公司的id
|
||||
if("group".equals(shkd_queryorgtype)){
|
||||
ArrayList<Long> grouplongs = new ArrayList<>();
|
||||
for (DynamicObject group : groups) {
|
||||
groupName = group.getString("name");
|
||||
grouplongs.add(group.getLong("id"));
|
||||
}
|
||||
List<Long> allSubordinateOrgs = OrgUnitServiceHelper.getAllSubordinateOrgs(8L, grouplongs, true);
|
||||
longs.addAll(allSubordinateOrgs);
|
||||
}else{
|
||||
for (DynamicObject company : companys) {
|
||||
longs.add(company.getLong("id"));
|
||||
}
|
||||
}
|
||||
|
||||
Date firstDate = (Date)paramMap.get("shkd_firstdate");//开始时间
|
||||
Date endDate = (Date)paramMap.get("shkd_enddate");//结束时间
|
||||
DynamicObject orgcurrency = (DynamicObject) paramMap.get("shkd_orgcurrency");
|
||||
DynamicObject exratetable = (DynamicObject) paramMap.get("shkd_exratetable");
|
||||
Long orgcurrencyId = null;
|
||||
Long exratetableId = null;
|
||||
if (orgcurrency != null){
|
||||
orgcurrencyId = orgcurrency.getLong("id");
|
||||
}
|
||||
if (exratetable != null){
|
||||
exratetableId = exratetable.getLong("id");
|
||||
}
|
||||
// Long currency = ((DynamicObject)paramMap.get("orgcurrency")).getLong("id");//币别
|
||||
// Long exchangeRateTableId = ((DynamicObject)paramMap.get("exratetable")).getLong("id");//汇率表
|
||||
|
||||
String[] fileNames = {"shkd_ordinal","shkd_company","shkd_init_original","shkd_income_original","shkd_expend_original",
|
||||
"shkd_period_original","shkd_currencyfield"};//字段标识数组
|
||||
DataType[] dataTypes = {DataType.StringType,DataType.StringType,DataType.BigDecimalType,DataType.BigDecimalType,DataType.BigDecimalType,
|
||||
DataType.BigDecimalType,DataType.LongType};//字段类型数组
|
||||
//查询已出纳初始化的公司
|
||||
QFilter accQF = new QFilter("isfinishinit", QCP.equals, "1");//过滤为启用的公司账户
|
||||
accQF.and("org.id",QCP.in,longs);
|
||||
// accQF.and("org.name",QCP.equals,"上海挚新私募基金管理有限公司");
|
||||
DynamicObject[] cas_cashmgtinits = BusinessDataServiceHelper.load("cas_cashmgtinit", "id,org,isfinishinit,startperiod,standardcurrency,exratetable," +
|
||||
"entrybank.bank_accountbank,entrybank.bank_journalbalance,entrybank.bank_journalsumbalanceadj", accQF.toArray());
|
||||
Collection<Object[]> firmParams = null;
|
||||
if (cas_cashmgtinits != null){
|
||||
firmParams = new ArrayList<Object[]>(cas_cashmgtinits.length);//多公司数据集合
|
||||
BigDecimal payTotal = BigDecimal.ZERO; //总计 期间支出合计
|
||||
BigDecimal recTotal = BigDecimal.ZERO; //总计 期间收入合计
|
||||
BigDecimal payLB = BigDecimal.ZERO; //内部往来,支出合计
|
||||
BigDecimal recLB = BigDecimal.ZERO; //内部往来 期间收入合计
|
||||
for (int i = 0; i < cas_cashmgtinits.length; i++) {
|
||||
//若是集团,需要在第一行拼接第一行的数据
|
||||
if("group".equals(shkd_queryorgtype)&&i == 0){
|
||||
Object[] firmParam = new Object[7];//存放公司数据
|
||||
firmParam[0] = i;//存放序号
|
||||
firmParam[1] = groupName;//存放集团名称,先优先考虑单集团的凭借
|
||||
firmParams.add(firmParam);
|
||||
}
|
||||
DynamicObject startperiod = cas_cashmgtinits[i].getDynamicObject("startperiod");
|
||||
if (startperiod != null){
|
||||
Object pkValue = startperiod.getPkValue();
|
||||
DynamicObject bd_period = BusinessDataServiceHelper.loadSingle(pkValue, "bd_period");
|
||||
Date begindate = bd_period.getDate("begindate");//获取期初时间
|
||||
DynamicObject org = cas_cashmgtinits[i].getDynamicObject("org");
|
||||
if (org != null){//当前组织不为空时,查询对应付款单和收款单,计算收入
|
||||
Object[] firmParam = new Object[7];//存放公司数据
|
||||
String name = org.getString("name");
|
||||
Object orgPkValue = org.getPkValue();
|
||||
firmParam[0] = i+1;//存放序号
|
||||
firmParam[1] = name;//存放公司名称
|
||||
//获取初始金额之和及日记账余额之和
|
||||
DynamicObjectCollection entrybank = cas_cashmgtinits[i].getDynamicObjectCollection("entrybank");
|
||||
BigDecimal journalbalance_total = BigDecimal.ZERO;//日记账初始余额之和
|
||||
for (DynamicObject dynamicObject : entrybank) {//计算各银行账号金额之和
|
||||
BigDecimal bank_journalbalance = dynamicObject.getBigDecimal("bank_journalbalance");
|
||||
journalbalance_total = journalbalance_total.add(bank_journalbalance);//日记账初始余额之和
|
||||
}
|
||||
BigDecimal payAmountTotal = BigDecimal.ZERO;
|
||||
BigDecimal recAmountTotal = BigDecimal.ZERO;
|
||||
//逻辑1:查询该公司到查询时间的所有付款单
|
||||
QFilter bef_payQF = new QFilter("billstatus", QCP.equals, "D");
|
||||
bef_payQF.and("org.id",QCP.equals,orgPkValue);
|
||||
bef_payQF.and("paydate",QCP.large_equals,begindate);
|
||||
if (firstDate == null){//没有设置时间,则查询今日记账,即查询期间开始到今日之前的所有付款单据
|
||||
firstDate = new Date();
|
||||
}
|
||||
if (exratetable != null){
|
||||
bef_payQF.and("exratetable.id",QCP.equals,exratetableId);
|
||||
}
|
||||
if (orgcurrency != null){
|
||||
bef_payQF.and("currency.id",QCP.equals,orgcurrencyId);
|
||||
}
|
||||
Date startDate = this.getStartDate(firstDate);//过滤条件-开始日期
|
||||
bef_payQF.and("paydate","<",startDate);
|
||||
DynamicObject[] bef_cas_paybills = BusinessDataServiceHelper.load("cas_paybill", "id,org,org.id,org.number,payeenumber,actpayamt,currency", bef_payQF.toArray());
|
||||
for (DynamicObject bef_cas_paybill : bef_cas_paybills) {
|
||||
String payNumber = bef_cas_paybill.getDynamicObject("org").getString("number");
|
||||
String recNumber = bef_cas_paybill.getString("payeenumber");
|
||||
logger.info("付款方编码为:"+payNumber+",收款方编码为:"+recNumber);
|
||||
BigDecimal actpayamt = bef_cas_paybill.getBigDecimal("actpayamt");
|
||||
if (!payNumber.equals(recNumber)){//付款编码同收款编码的忽略(相互抵消)
|
||||
payAmountTotal = payAmountTotal.add(actpayamt);
|
||||
}
|
||||
}
|
||||
|
||||
//逻辑2:查询该公司到查询时间的所有收款单
|
||||
QFilter bef_recQF = new QFilter("billstatus", QCP.equals, "D");
|
||||
if (exratetable != null){
|
||||
bef_recQF.and("exratetable.id",QCP.equals,exratetableId);
|
||||
}
|
||||
if (orgcurrency != null){
|
||||
bef_recQF.and("currency.id",QCP.equals,orgcurrencyId);
|
||||
}
|
||||
bef_recQF.and("org.id",QCP.equals,orgPkValue);
|
||||
bef_recQF.and("payeedate",QCP.large_equals,begindate);
|
||||
bef_recQF.and("payeedate","<",startDate);
|
||||
DynamicObject[] cas_recbills = BusinessDataServiceHelper.load("cas_recbill", "id,org,org.id,org.number,actrecamt,currency", bef_recQF.toArray());
|
||||
for (DynamicObject cas_recbill : cas_recbills) {
|
||||
BigDecimal actrecamt = cas_recbill.getBigDecimal("actrecamt");
|
||||
recAmountTotal = recAmountTotal.add(actrecamt);
|
||||
}
|
||||
//获取过滤条件集合
|
||||
Map<String, Object> paramMap = this.transQueryParam(reportQueryParam);
|
||||
DynamicObjectCollection companys = (DynamicObjectCollection)paramMap.get("shkd_filter_company");//使用=组织集合
|
||||
// DynamicObjectCollection groups = (DynamicObjectCollection)paramMap.get("shkd_filter_group");//使用组织集合
|
||||
String shkd_queryorgtype = paramMap.get("shkd_queryorgtype").toString();//使用组织集合
|
||||
Collection<Object[]> firmParams = null ;
|
||||
Date firstDate = (Date)paramMap.get("shkd_firstdate");//开始时间
|
||||
Date endDate = (Date)paramMap.get("shkd_enddate");//结束时间
|
||||
DynamicObject orgcurrency = (DynamicObject) paramMap.get("shkd_orgcurrency");
|
||||
DynamicObject exratetable = (DynamicObject) paramMap.get("shkd_exratetable");
|
||||
String groupName = null;
|
||||
|
||||
//期初余额 = 初始余额 + 期初前收入 - 期初前支出
|
||||
BigDecimal startAmount = journalbalance_total.add(recAmountTotal).subtract(payAmountTotal);
|
||||
firmParam[2] = startAmount;
|
||||
|
||||
if (endDate == null){
|
||||
endDate = new Date();//赋值结束时间
|
||||
HashMap<Long, ArrayList<Long>> groupMap = new HashMap<>();//集团id集合
|
||||
for (DynamicObject company : companys) {
|
||||
long companyId = company.getLong("id");
|
||||
List<Long> supGroupIds = OrgUnitServiceHelper.getSuperiorOrgs("08", companyId);
|
||||
Long aLong = supGroupIds.get(0);
|
||||
ArrayList<Long> companyList = null;
|
||||
if (groupMap.containsKey(aLong)){
|
||||
companyList = groupMap.get(aLong);
|
||||
}else {
|
||||
companyList = new ArrayList<>();
|
||||
}
|
||||
Date overDate = this.getEndDate(endDate);//取到当天结束日期
|
||||
BigDecimal perPayAmountTotal = BigDecimal.ZERO;//期间总支出
|
||||
BigDecimal perRecAmountTotal = BigDecimal.ZERO;//期间总收入
|
||||
//逻辑3:查询该公司期间总收入
|
||||
QFilter per_recQF = new QFilter("billstatus", QCP.equals, "D");
|
||||
per_recQF.and("org.id",QCP.equals,orgPkValue);
|
||||
if (exratetable != null){
|
||||
per_recQF.and("exratetable.id",QCP.equals,exratetableId);
|
||||
companyList.add(companyId);
|
||||
groupMap.put(aLong,companyList);
|
||||
}
|
||||
if (orgcurrency != null){
|
||||
per_recQF.and("currency.id",QCP.equals,orgcurrencyId);
|
||||
}
|
||||
per_recQF.and("payeedate",QCP.large_equals,startDate);
|
||||
per_recQF.and("payeedate",QCP.less_equals,overDate);
|
||||
DynamicObject[] per_cas_recbills = BusinessDataServiceHelper.load("cas_recbill", "id,org,org.id,org.number,actrecamt,currency,payertype,customerf7,customerf7", per_recQF.toArray());
|
||||
BigDecimal transactions = this.getTransactions(per_cas_recbills);
|
||||
recLB =recLB.add(transactions); //内部往来收入合计
|
||||
|
||||
|
||||
for (DynamicObject per_cas_recbill : per_cas_recbills) {
|
||||
BigDecimal actrecamt = per_cas_recbill.getBigDecimal("actrecamt");
|
||||
perRecAmountTotal = perRecAmountTotal.add(actrecamt);//添加收入金额
|
||||
}
|
||||
firmParam[3] = perRecAmountTotal;
|
||||
//逻辑4:查询该公司期间总支出
|
||||
QFilter per_payQF = new QFilter("billstatus", QCP.equals, "D");
|
||||
if (exratetable != null){
|
||||
per_payQF.and("exratetable.id",QCP.equals,exratetableId);
|
||||
}
|
||||
if (orgcurrency != null){
|
||||
per_payQF.and("currency.id",QCP.equals,orgcurrencyId);
|
||||
}
|
||||
per_payQF.and("org.id",QCP.equals,orgPkValue);
|
||||
per_payQF.and("paydate",QCP.large_equals,startDate);
|
||||
per_payQF.and("paydate",QCP.less_equals,overDate);
|
||||
DynamicObject[] per_cas_paybills = BusinessDataServiceHelper.load("cas_paybill", "id,org,org.id,org.number,payeenumber,actpayamt,currency,payeetype,payee", per_payQF.toArray());
|
||||
BigDecimal transactionsByfk = this.getTransactionsByfk(per_cas_paybills);
|
||||
payLB =payLB.add(transactionsByfk); //内部往来收入合计
|
||||
|
||||
for (DynamicObject per_cas_paybill : per_cas_paybills) {
|
||||
String payNumber = per_cas_paybill.getDynamicObject("org").getString("number");
|
||||
String recNumber = per_cas_paybill.getString("payeenumber");
|
||||
BigDecimal actpayamt = per_cas_paybill.getBigDecimal("actpayamt");
|
||||
perPayAmountTotal = perPayAmountTotal.add(actpayamt);
|
||||
if (payNumber.equals(recNumber)){//当付款编码同收款编码时
|
||||
perRecAmountTotal = perRecAmountTotal.add(actpayamt);//补充收款数据
|
||||
//如果查询是查的集团,然后想要查询需查询下级及下级所有公司的id
|
||||
if("group".equals(shkd_queryorgtype)){
|
||||
for (Long key : groupMap.keySet()){
|
||||
DynamicObject bos_org_group = BusinessDataServiceHelper.loadSingle(key, "bos_org");
|
||||
groupName = bos_org_group.getString("name");
|
||||
ArrayList<Long> longs = groupMap.get(key);
|
||||
firmParams = this.addFirmParams(shkd_queryorgtype,firmParams,groupName,longs,firstDate,endDate,orgcurrency,exratetable);
|
||||
}
|
||||
}
|
||||
firmParam[4] = perPayAmountTotal;
|
||||
|
||||
//期间余额 = 期初余额 +期间收入 -期间支出
|
||||
BigDecimal endAmount = startAmount.add(perRecAmountTotal).subtract(perPayAmountTotal);
|
||||
firmParam[5] = endAmount;
|
||||
firmParams.add(firmParam);
|
||||
payTotal = payTotal.add(perPayAmountTotal);
|
||||
recTotal = recTotal.add(perRecAmountTotal);
|
||||
int i = 0;
|
||||
if(firmParams != null && firmParams.size() > 0){
|
||||
for (Object[] firmParam : firmParams) {
|
||||
firmParam[0] = i+1;
|
||||
i++;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
//总计行的组装
|
||||
Object[] firmParam = new Object[7];//存放公司数据
|
||||
firmParam[1] = "总计";
|
||||
firmParam[3] = recTotal; //今日收入合计
|
||||
firmParam[4] = payTotal; //今日收入合计
|
||||
firmParams.add(firmParam);
|
||||
|
||||
Object[] firmParam2 = new Object[7];//存放公司数据
|
||||
firmParam2[1] = "内部往来";
|
||||
firmParam2[3] = recLB; //今日收入合计
|
||||
firmParam2[4] = payLB; //今日收入合计
|
||||
firmParams.add(firmParam2);
|
||||
//内部收支净额的组装
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Map<String, List<Map<String,Object>>> firm_accMap = new HashMap<String, List<Map<String, Object>>>(cas_cashmgtinits.length);//总体公司银行账户集合数据
|
||||
// for (DynamicObject cas_cashmgtinit : cas_cashmgtinits) {
|
||||
// DynamicObject org = cas_cashmgtinit.getDynamicObject("org");
|
||||
// String name = org.getString("name");
|
||||
// List<Map<String,Object>> firm_banks = new ArrayList<Map<String, Object>>();//银行账户集合
|
||||
// DynamicObjectCollection entrybank = cas_cashmgtinit.getDynamicObjectCollection("entrybank");
|
||||
// for (DynamicObject dynamicObject : entrybank) {
|
||||
// Map<String,Object> bankInfo = new HashMap<String,Object>();//单个银行数据信息
|
||||
// bankInfo.put("bank_accountbank_id",dynamicObject.getDynamicObject("bank_accountbank").getLong("id"));
|
||||
// bankInfo.put("bank_journalbalance",dynamicObject.getBigDecimal("bank_journalbalance"));
|
||||
// bankInfo.put("bank_journalsumbalanceadj",dynamicObject.getBigDecimal("bank_journalsumbalanceadj"));
|
||||
// firm_banks.add(bankInfo);
|
||||
// }
|
||||
// firm_accMap.put(name,firm_banks);
|
||||
// }
|
||||
|
||||
|
||||
//2、查询所有收款处理单据数据cas_recbill org收款人(公司) accountbank银行账号 actrecamt收款金额
|
||||
|
||||
|
||||
//3、查询所有付款处理单据数据 org付款人(公司) payeracctbank银行账号 payeename收款人名称 payeebanknum收款账号 actpayamt付款金额
|
||||
// QFilter payQF = new QFilter();
|
||||
// BusinessDataServiceHelper.load("cas_paybill",)
|
||||
|
||||
|
||||
// Collection<Object[]> coll= new ArrayList<Object[]>();
|
||||
// for (int i = 0;i < 3 ;i++ ){
|
||||
// Object[] values = new Object[fileNames.length];
|
||||
// values[0] = i+1;
|
||||
// values[1] = "公司"+i;
|
||||
// values[2] = 10+(int)Math.floor(Math.random()*100);
|
||||
// values[3] = 10+(int)Math.floor(Math.random()*100);
|
||||
// values[4] = 10+(int)Math.floor(Math.random()*100);
|
||||
// values[5] = 10+(int)Math.floor(Math.random()*100);
|
||||
// coll.add(values);
|
||||
// }
|
||||
// BigDecimal sum1 = BigDecimal.ZERO;
|
||||
// BigDecimal sum2 = BigDecimal.ZERO;
|
||||
// for (Object[] objects : coll) {
|
||||
// sum1 = sum1.add(new BigDecimal(objects[3].toString()));
|
||||
// sum2 = sum2.add(new BigDecimal(objects[4].toString()));
|
||||
// }
|
||||
// Object[] obj = new Object[fileNames.length];
|
||||
// obj[1] = "期间汇总";
|
||||
// obj[3] = sum1;
|
||||
// obj[4] = sum2;
|
||||
// coll.add(obj);
|
||||
if (firmParams != null){
|
||||
RowMeta row = RowMetaFactory.createRowMeta(fileNames, dataTypes);
|
||||
CollectionInput inputs = new CollectionInput(row, firmParams);
|
||||
DataSet resultDataSet = Algo.create(this.getClass().getName()).createDataSet(inputs);
|
||||
return resultDataSet;
|
||||
}
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
protected Map<String, Object> transQueryParam(ReportQueryParam param) {
|
||||
Map<String, Object> paramMap = new HashMap(param.getFilter().getFilterItems().size());
|
||||
|
@ -333,29 +118,45 @@ public class CapitalDayListDataPlugin extends AbstractReportListDataPlugin imple
|
|||
for (DynamicObject per_cas_recbill : per_cas_recbills) {
|
||||
//查询收款单,为内部往来的公司
|
||||
String payertype = per_cas_recbill.getString("payertype");//付款人类型
|
||||
Long payerid = per_cas_recbill.getLong("payer");//收款人id
|
||||
//判断是否内部,不是则跳过该循环
|
||||
if("bd_customer".equals(payertype)||"bd_supplier".equals(payertype)||"bos_org".equals(payertype)){
|
||||
if("bd_supplier".equals(payertype)){
|
||||
DynamicObject f7_payer = per_cas_recbill.getDynamicObject("f7_payer");//供应商
|
||||
long id = f7_payer.getLong("id");
|
||||
QFilter per_recQF = new QFilter("billstatus", QCP.equals, "D");
|
||||
per_recQF.and("org.id",QCP.equals,id);
|
||||
QFilter per_recQF = new QFilter("id", QCP.equals, payerid);
|
||||
DynamicObject bd_supplier = BusinessDataServiceHelper.loadSingle("bd_supplier", "id,number,internal_company", per_recQF.toArray());
|
||||
if(bd_supplier != null){
|
||||
DynamicObject internal_company = bd_supplier.getDynamicObject("internal_company");
|
||||
if(internal_company==null){
|
||||
if (internal_company != null){
|
||||
if (isYuYe(internal_company.getLong("id"))){
|
||||
continue;
|
||||
}
|
||||
}else {
|
||||
continue;
|
||||
}
|
||||
}else {
|
||||
continue;
|
||||
}
|
||||
|
||||
} else if ("bd_customer".equals(payertype)) {
|
||||
DynamicObject customerf7 = per_cas_recbill.getDynamicObject("customerf7");//供应商
|
||||
long id = customerf7.getLong("id");
|
||||
QFilter per_recQF = new QFilter("billstatus", QCP.equals, "D");
|
||||
per_recQF.and("org.id",QCP.equals,id);
|
||||
DynamicObject bd_supplier = BusinessDataServiceHelper.loadSingle("bd_supplier", "id,number,internal_company", per_recQF.toArray());
|
||||
DynamicObject internal_company = bd_supplier.getDynamicObject("internal_company");
|
||||
if(internal_company==null){
|
||||
QFilter per_recQF = new QFilter("id", QCP.equals, payerid);
|
||||
DynamicObject bd_customer = BusinessDataServiceHelper.loadSingle("bd_customer", "id,number,internal_company", per_recQF.toArray());
|
||||
if (bd_customer != null){
|
||||
DynamicObject internal_company = bd_customer.getDynamicObject("internal_company");
|
||||
if (internal_company != null){
|
||||
if (isYuYe(internal_company.getLong("id"))){
|
||||
continue;
|
||||
}
|
||||
}else {
|
||||
continue;
|
||||
}
|
||||
}else {
|
||||
continue;
|
||||
}
|
||||
}else {
|
||||
if (isYuYe(payerid)){
|
||||
continue;
|
||||
}
|
||||
}
|
||||
//是内部往来,累计金额
|
||||
BigDecimal actrecamt = per_cas_recbill.getBigDecimal("actrecamt");
|
||||
recAmountTotal = recAmountTotal.add(actrecamt);//添加收入金额
|
||||
|
||||
|
@ -365,41 +166,273 @@ public class CapitalDayListDataPlugin extends AbstractReportListDataPlugin imple
|
|||
}
|
||||
|
||||
//内部往来付款合计
|
||||
public BigDecimal getTransactionsByfk(DynamicObject[] per_cas_paybills){
|
||||
public HashMap<String, BigDecimal> getTransactionsByfk(DynamicObject[] per_cas_paybills){
|
||||
HashMap<String, BigDecimal> stringBigDecimalHashMap = new HashMap<>();
|
||||
BigDecimal perPayAmountTotal = BigDecimal.ZERO;
|
||||
BigDecimal addRecAmountTotal = BigDecimal.ZERO;
|
||||
for (DynamicObject per_cas_paybill : per_cas_paybills) {
|
||||
//查询收款单,为内部往来的公司
|
||||
String payertype = per_cas_paybill.getString("payeetype");//收款人款人类型
|
||||
Long payerid = per_cas_paybill.getLong("payee");//供应商
|
||||
|
||||
Long payerid = per_cas_paybill.getLong("payee");//收款人id
|
||||
//判断是否内部,不是则跳过该循环
|
||||
if("bd_customer".equals(payertype)||"bd_supplier".equals(payertype)||"bos_org".equals(payertype)){
|
||||
if("bd_supplier".equals(payertype)){
|
||||
QFilter per_recQF = new QFilter("id",QCP.equals,payerid);
|
||||
DynamicObject bd_supplier = BusinessDataServiceHelper.loadSingle("bd_supplier", "id,number,internal_company", per_recQF.toArray());
|
||||
if (bd_supplier != null){
|
||||
DynamicObject internal_company = bd_supplier.getDynamicObject("internal_company");
|
||||
if(internal_company==null){
|
||||
if (internal_company != null){
|
||||
if (isYuYe(internal_company.getLong("id"))){
|
||||
continue;
|
||||
}
|
||||
}else {
|
||||
continue;
|
||||
}
|
||||
}else {
|
||||
continue;
|
||||
}
|
||||
|
||||
} else if ("bd_customer".equals(payertype)) {
|
||||
QFilter per_recQF = new QFilter("org.id",QCP.equals,payerid);
|
||||
DynamicObject bd_supplier = BusinessDataServiceHelper.loadSingle("bd_supplier", "id,number,internal_company", per_recQF.toArray());
|
||||
DynamicObject internal_company = bd_supplier.getDynamicObject("internal_company");
|
||||
if(internal_company==null){
|
||||
QFilter per_recQF = new QFilter("id",QCP.equals,payerid);
|
||||
DynamicObject bd_customer = BusinessDataServiceHelper.loadSingle("bd_customer", "id,number,internal_company", per_recQF.toArray());
|
||||
if (bd_customer != null){
|
||||
DynamicObject internal_company = bd_customer.getDynamicObject("internal_company");
|
||||
if (internal_company != null){
|
||||
if (isYuYe(internal_company.getLong("id"))){
|
||||
continue;
|
||||
}
|
||||
}else {
|
||||
continue;
|
||||
}
|
||||
}else {
|
||||
continue;
|
||||
}
|
||||
}else{
|
||||
if (isYuYe(payerid)){
|
||||
continue;
|
||||
}
|
||||
}
|
||||
//是内部往来,累计金额
|
||||
String payNumber = per_cas_paybill.getDynamicObject("org").getString("number");
|
||||
String recNumber = per_cas_paybill.getString("payeenumber");
|
||||
BigDecimal actpayamt = per_cas_paybill.getBigDecimal("actpayamt");
|
||||
perPayAmountTotal = perPayAmountTotal.add(actpayamt);
|
||||
if (payNumber.equals(recNumber)){//当付款编码同收款编码时
|
||||
perPayAmountTotal = perPayAmountTotal.add(actpayamt);//补充收款数据
|
||||
addRecAmountTotal = addRecAmountTotal.add(actpayamt);//补充收款数据
|
||||
}
|
||||
}
|
||||
}
|
||||
stringBigDecimalHashMap.put("pay",perPayAmountTotal);
|
||||
stringBigDecimalHashMap.put("rec",addRecAmountTotal);
|
||||
return stringBigDecimalHashMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断是否为榆叶系公司
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
public boolean isYuYe(Long id){
|
||||
DynamicObject bos_org = BusinessDataServiceHelper.loadSingle(id, "bos_org");
|
||||
if (bos_org != null){
|
||||
String shkd_affiliation = bos_org.getString("shkd_affiliation");
|
||||
if ("0".equals(shkd_affiliation)){
|
||||
return true;
|
||||
}else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public Collection<Object[]> addFirmParams(String shkd_queryorgtype, Collection<Object[]> firmParams, String groupName, List<Long> longs, Date firstDate,Date endDate,DynamicObject orgcurrency, DynamicObject exratetable){
|
||||
Long orgcurrencyId = null;
|
||||
Long exratetableId = null;
|
||||
if (orgcurrency != null){
|
||||
orgcurrencyId = orgcurrency.getLong("id");
|
||||
}
|
||||
if (exratetable != null){
|
||||
exratetableId = exratetable.getLong("id");
|
||||
}
|
||||
// Long currency = ((DynamicObject)paramMap.get("orgcurrency")).getLong("id");//币别
|
||||
// Long exchangeRateTableId = ((DynamicObject)paramMap.get("exratetable")).getLong("id");//汇率表
|
||||
//查询已出纳初始化的公司
|
||||
QFilter accQF = new QFilter("isfinishinit", QCP.equals, "1");//过滤为启用的公司账户
|
||||
accQF.and("org.id",QCP.in,longs);
|
||||
// accQF.and("org.name",QCP.equals,"上海挚新私募基金管理有限公司");
|
||||
DynamicObject[] cas_cashmgtinits = BusinessDataServiceHelper.load("cas_cashmgtinit", "id,org,isfinishinit,startperiod,standardcurrency,exratetable," +
|
||||
"entrybank.bank_accountbank,entrybank.bank_journalbalance,entrybank.bank_journalsumbalanceadj", accQF.toArray());
|
||||
if (cas_cashmgtinits != null){
|
||||
firmParams = new ArrayList<Object[]>(cas_cashmgtinits.length);//多公司数据集合
|
||||
BigDecimal payTotal = BigDecimal.ZERO; //总计 期间支出合计
|
||||
BigDecimal recTotal = BigDecimal.ZERO; //总计 期间收入合计
|
||||
BigDecimal payLB = BigDecimal.ZERO; //内部往来,支出合计
|
||||
BigDecimal recLB = BigDecimal.ZERO; //内部往来 期间收入合计
|
||||
BigDecimal payNet = BigDecimal.ZERO;//支出净额
|
||||
BigDecimal recNet = BigDecimal.ZERO;//收入净额
|
||||
//若是集团,需要在第一行拼接第一行的数据
|
||||
if("group".equals(shkd_queryorgtype)&& cas_cashmgtinits.length > 0){
|
||||
Object[] firmParam = new Object[7];//存放公司数据
|
||||
firmParam[1] = groupName;//存放集团名称,先优先考虑单集团的凭借
|
||||
firmParams.add(firmParam);
|
||||
}
|
||||
|
||||
for (int i = 0; i < cas_cashmgtinits.length; i++) {
|
||||
DynamicObject startperiod = cas_cashmgtinits[i].getDynamicObject("startperiod");
|
||||
if (startperiod != null){
|
||||
Object pkValue = startperiod.getPkValue();
|
||||
DynamicObject bd_period = BusinessDataServiceHelper.loadSingle(pkValue, "bd_period");
|
||||
Date begindate = bd_period.getDate("begindate");//获取期初时间
|
||||
DynamicObject org = cas_cashmgtinits[i].getDynamicObject("org");
|
||||
if (org != null){//当前组织不为空时,查询对应付款单和收款单,计算收入
|
||||
Object[] firmParam = new Object[7];//存放公司数据
|
||||
String name = org.getString("name");
|
||||
Object orgPkValue = org.getPkValue();
|
||||
firmParam[1] = name;//存放公司名称
|
||||
//获取初始金额之和及日记账余额之和
|
||||
DynamicObjectCollection entrybank = cas_cashmgtinits[i].getDynamicObjectCollection("entrybank");
|
||||
BigDecimal journalbalance_total = BigDecimal.ZERO;//日记账初始余额之和
|
||||
for (DynamicObject dynamicObject : entrybank) {//计算各银行账号金额之和
|
||||
BigDecimal bank_journalbalance = dynamicObject.getBigDecimal("bank_journalbalance");
|
||||
journalbalance_total = journalbalance_total.add(bank_journalbalance);//日记账初始余额之和
|
||||
}
|
||||
BigDecimal payAmountTotal = BigDecimal.ZERO;
|
||||
BigDecimal recAmountTotal = BigDecimal.ZERO;
|
||||
//逻辑1:查询该公司到查询时间的所有付款单
|
||||
QFilter bef_payQF = new QFilter("billstatus", QCP.equals, "D");
|
||||
bef_payQF.and("org.id",QCP.equals,orgPkValue);
|
||||
bef_payQF.and("paydate",QCP.large_equals,begindate);//付款日期paydate 业务日期bizdate
|
||||
if (firstDate == null){//没有设置时间,则查询今日记账,即查询期间开始到今日之前的所有付款单据
|
||||
firstDate = new Date();
|
||||
}
|
||||
if (exratetable != null){
|
||||
bef_payQF.and("exratetable.id",QCP.equals,exratetableId);
|
||||
}
|
||||
if (orgcurrency != null){
|
||||
bef_payQF.and("currency.id",QCP.equals,orgcurrencyId);
|
||||
}
|
||||
Date startDate = this.getStartDate(firstDate);//过滤条件-开始日期
|
||||
bef_payQF.and("paydate","<",startDate);
|
||||
DynamicObject[] bef_cas_paybills = BusinessDataServiceHelper.load("cas_paybill", "id,org,org.id,org.number,payeenumber,actpayamt,currency", bef_payQF.toArray());
|
||||
for (DynamicObject bef_cas_paybill : bef_cas_paybills) {
|
||||
String payNumber = bef_cas_paybill.getDynamicObject("org").getString("number");
|
||||
String recNumber = bef_cas_paybill.getString("payeenumber");
|
||||
logger.info("付款方编码为:"+payNumber+",收款方编码为:"+recNumber);
|
||||
BigDecimal actpayamt = bef_cas_paybill.getBigDecimal("actpayamt");
|
||||
if (!payNumber.equals(recNumber)){//付款编码同收款编码的忽略(相互抵消)
|
||||
payAmountTotal = payAmountTotal.add(actpayamt);
|
||||
}
|
||||
}
|
||||
|
||||
//逻辑2:查询该公司到查询时间的所有收款单
|
||||
QFilter bef_recQF = new QFilter("billstatus", QCP.equals, "D");
|
||||
if (exratetable != null){
|
||||
bef_recQF.and("exratetable.id",QCP.equals,exratetableId);
|
||||
}
|
||||
if (orgcurrency != null){
|
||||
bef_recQF.and("currency.id",QCP.equals,orgcurrencyId);
|
||||
}
|
||||
bef_recQF.and("org.id",QCP.equals,orgPkValue);
|
||||
bef_recQF.and("payeedate",QCP.large_equals,begindate);//收款日期payeedate 业务日期bizdate
|
||||
bef_recQF.and("payeedate","<",startDate);
|
||||
DynamicObject[] cas_recbills = BusinessDataServiceHelper.load("cas_recbill", "id,org,org.id,org.number,actrecamt,currency", bef_recQF.toArray());
|
||||
for (DynamicObject cas_recbill : cas_recbills) {
|
||||
BigDecimal actrecamt = cas_recbill.getBigDecimal("actrecamt");
|
||||
recAmountTotal = recAmountTotal.add(actrecamt);
|
||||
}
|
||||
|
||||
//期初余额 = 初始余额 + 期初前收入 - 期初前支出
|
||||
BigDecimal startAmount = journalbalance_total.add(recAmountTotal).subtract(payAmountTotal);
|
||||
firmParam[2] = startAmount;
|
||||
|
||||
if (endDate == null){
|
||||
endDate = new Date();//赋值结束时间
|
||||
}
|
||||
Date overDate = this.getEndDate(endDate);//取到当天结束日期
|
||||
BigDecimal perPayAmountTotal = BigDecimal.ZERO;//期间总支出
|
||||
BigDecimal perRecAmountTotal = BigDecimal.ZERO;//期间总收入
|
||||
//逻辑3:查询该公司期间总收入
|
||||
QFilter per_recQF = new QFilter("billstatus", QCP.equals, "D");
|
||||
per_recQF.and("org.id",QCP.equals,orgPkValue);
|
||||
if (exratetable != null){
|
||||
per_recQF.and("exratetable.id",QCP.equals,exratetableId);
|
||||
}
|
||||
if (orgcurrency != null){
|
||||
per_recQF.and("currency.id",QCP.equals,orgcurrencyId);
|
||||
}
|
||||
per_recQF.and("payeedate",QCP.large_equals,startDate);//收款日期payeedate 业务日期bizdate
|
||||
per_recQF.and("payeedate",QCP.less_equals,overDate);
|
||||
DynamicObject[] per_cas_recbills = BusinessDataServiceHelper.load("cas_recbill", "id,org,org.id,org.number,actrecamt,currency,payertype,customerf7,customerf7,payer", per_recQF.toArray());
|
||||
BigDecimal transactions = this.getTransactions(per_cas_recbills);
|
||||
recLB =recLB.add(transactions); //内部往来收入合计
|
||||
|
||||
|
||||
for (DynamicObject per_cas_recbill : per_cas_recbills) {
|
||||
BigDecimal actrecamt = per_cas_recbill.getBigDecimal("actrecamt");
|
||||
perRecAmountTotal = perRecAmountTotal.add(actrecamt);//添加收入金额
|
||||
}
|
||||
firmParam[3] = perRecAmountTotal;
|
||||
//逻辑4:查询该公司期间总支出
|
||||
QFilter per_payQF = new QFilter("billstatus", QCP.equals, "D");
|
||||
if (exratetable != null){
|
||||
per_payQF.and("exratetable.id",QCP.equals,exratetableId);
|
||||
}
|
||||
if (orgcurrency != null){
|
||||
per_payQF.and("currency.id",QCP.equals,orgcurrencyId);
|
||||
}
|
||||
per_payQF.and("org.id",QCP.equals,orgPkValue);
|
||||
per_payQF.and("paydate",QCP.large_equals,startDate);//付款日期paydate 业务日期bizdate
|
||||
per_payQF.and("paydate",QCP.less_equals,overDate);
|
||||
DynamicObject[] per_cas_paybills = BusinessDataServiceHelper.load("cas_paybill", "id,org,org.id,org.number,payeenumber,actpayamt,currency,payeetype,payee", per_payQF.toArray());
|
||||
HashMap<String, BigDecimal> stringBigDecimalHashMap = this.getTransactionsByfk(per_cas_paybills);
|
||||
payLB =payLB.add(stringBigDecimalHashMap.get("pay")); //内部往来支出合计
|
||||
recLB = recLB.add(stringBigDecimalHashMap.get("rec"));//内部往来收入合计(同公司收入补充)
|
||||
for (DynamicObject per_cas_paybill : per_cas_paybills) {
|
||||
String payNumber = per_cas_paybill.getDynamicObject("org").getString("number");
|
||||
String recNumber = per_cas_paybill.getString("payeenumber");
|
||||
BigDecimal actpayamt = per_cas_paybill.getBigDecimal("actpayamt");
|
||||
perPayAmountTotal = perPayAmountTotal.add(actpayamt);
|
||||
if (payNumber.equals(recNumber)){//当付款编码同收款编码时
|
||||
perRecAmountTotal = perRecAmountTotal.add(actpayamt);//补充收款数据
|
||||
}
|
||||
}
|
||||
firmParam[4] = perPayAmountTotal;
|
||||
|
||||
//期间余额 = 期初余额 +期间收入 -期间支出
|
||||
BigDecimal endAmount = startAmount.add(perRecAmountTotal).subtract(perPayAmountTotal);
|
||||
firmParam[5] = endAmount;
|
||||
firmParams.add(firmParam);
|
||||
payTotal = payTotal.add(perPayAmountTotal);
|
||||
recTotal = recTotal.add(perRecAmountTotal);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
return perPayAmountTotal;
|
||||
if ("group".equals(shkd_queryorgtype)&& cas_cashmgtinits.length > 0){
|
||||
//总计行的组装
|
||||
Object[] firmParam = new Object[7];//存放公司数据
|
||||
firmParam[1] = "总计";
|
||||
firmParam[3] = recTotal; //今日收入合计
|
||||
firmParam[4] = payTotal; //今日收入合计
|
||||
firmParams.add(firmParam);
|
||||
|
||||
Object[] firmParam2 = new Object[7];//存放内部往来数据
|
||||
firmParam2[1] = "内部往来";
|
||||
firmParam2[3] = recLB; //收入(内部往来)合计
|
||||
firmParam2[4] = payLB; //支出(内部往来)合计
|
||||
firmParams.add(firmParam2);
|
||||
//内部收支净额的组装
|
||||
Object[] firmParam3 = new Object[7];//存放内部往来数据
|
||||
firmParam3[1] = "收支净额";
|
||||
recNet = recTotal.subtract(recLB);//收入净额
|
||||
payNet = payTotal.subtract(payLB);//支出净额
|
||||
firmParam3[3] = recNet; //收入(内部往来)合计
|
||||
firmParam3[4] = payNet; //支出(内部往来)合计
|
||||
firmParams.add(firmParam3);
|
||||
}
|
||||
return firmParams;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,11 @@
|
|||
package shkd.fi.cas.report.form;
|
||||
|
||||
import kd.bos.dataentity.entity.DynamicObject;
|
||||
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
||||
import kd.bos.dataentity.resource.ResManager;
|
||||
import kd.bos.entity.datamodel.events.ChangeData;
|
||||
import kd.bos.entity.datamodel.events.PropertyChangedArgs;
|
||||
import kd.bos.entity.report.FilterInfo;
|
||||
import kd.bos.entity.report.ReportQueryParam;
|
||||
import kd.bos.filter.FilterColumn;
|
||||
import kd.bos.form.control.events.FilterContainerInitEvent;
|
||||
|
@ -16,12 +19,15 @@ import kd.bos.orm.query.QCP;
|
|||
import kd.bos.orm.query.QFilter;
|
||||
import kd.bos.report.plugin.AbstractReportFormPlugin;
|
||||
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||
import kd.bos.servicehelper.org.OrgUnitServiceHelper;
|
||||
import kd.sdk.plugin.Plugin;
|
||||
|
||||
import java.sql.Array;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.EventObject;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 报表界面插件
|
||||
|
@ -48,13 +54,14 @@ public class CapitalDayFormListPlugin extends AbstractReportFormPlugin implement
|
|||
//设置日期范围初始值
|
||||
this.getModel().setValue("shkd_firstdate",new Date());
|
||||
this.getModel().setValue("shkd_enddate",new Date());
|
||||
//始化公司集团字段显影控制
|
||||
String shkd_queryorgtype = (String) this.getModel().getValue("shkd_queryorgtype");
|
||||
if ("company".equals(shkd_queryorgtype)){
|
||||
this.getView().setVisible(false,"shkd_filter_group");
|
||||
}else if ("group".equals(shkd_queryorgtype)){
|
||||
this.getView().setVisible(false,"shkd_filter_company");
|
||||
}
|
||||
//始化公司集团字段显影控制,逻辑变更代码取消
|
||||
// String shkd_queryorgtype = (String) this.getModel().getValue("shkd_queryorgtype");
|
||||
// if ("company".equals(shkd_queryorgtype)){
|
||||
// this.getView().setVisible(false,"shkd_filter_group");
|
||||
// this.getView().setVisible(false,"shkd_iscontainyy");
|
||||
// }else if ("group".equals(shkd_queryorgtype)){
|
||||
// this.getView().setVisible(false,"shkd_filter_company");
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
|
@ -62,7 +69,16 @@ public class CapitalDayFormListPlugin extends AbstractReportFormPlugin implement
|
|||
public void beforeF7Select(BeforeF7SelectEvent beforeF7SelectEvent) {
|
||||
String name = beforeF7SelectEvent.getProperty().getName();
|
||||
if ("shkd_filter_company".equals(name)){
|
||||
QFilter orgQF = new QFilter("orgpattern.number",QCP.equals,"Orgform02");
|
||||
DynamicObject[] loads = BusinessDataServiceHelper.load("bos_org", "id", orgQF.toArray());
|
||||
List<Long> longs = new ArrayList<>();
|
||||
for (DynamicObject load : loads) {
|
||||
long id = load.getLong("id");
|
||||
longs.add(id);
|
||||
}
|
||||
if (longs.size() > 0){
|
||||
QFilter accQF = new QFilter("isfinishinit", QCP.equals, "1");//过滤为启用的公司账户
|
||||
accQF.and("org.id",QCP.in,longs);
|
||||
DynamicObject[] cas_cashmgtinits = BusinessDataServiceHelper.load("cas_cashmgtinit", "id,org,isfinishinit,startperiod,standardcurrency,exratetable," +
|
||||
"entrybank.bank_accountbank,entrybank.bank_journalbalance,entrybank.bank_journalsumbalanceadj", accQF.toArray());
|
||||
ArrayList<Long> orgIds = new ArrayList<>();
|
||||
|
@ -72,29 +88,69 @@ public class CapitalDayFormListPlugin extends AbstractReportFormPlugin implement
|
|||
ListShowParameter formShowParameter = (ListShowParameter) beforeF7SelectEvent.getFormShowParameter();
|
||||
QFilter payment_qf= new QFilter("id",QCP.in,orgIds);
|
||||
formShowParameter.getListFilterParameter().setFilter(payment_qf);
|
||||
}else if ("shkd_filter_group".equals(name)){
|
||||
QFilter orgpattern_qf= new QFilter("orgpattern.number",QCP.equals, "Orgform01");
|
||||
ListShowParameter formShowParameter = (ListShowParameter) beforeF7SelectEvent.getFormShowParameter();
|
||||
formShowParameter.getListFilterParameter().setFilter(orgpattern_qf);
|
||||
}
|
||||
|
||||
}
|
||||
// else if ("shkd_filter_group".equals(name)){
|
||||
// QFilter orgpattern_qf= new QFilter("orgpattern.number",QCP.equals, "Orgform01");
|
||||
// ListShowParameter formShowParameter = (ListShowParameter) beforeF7SelectEvent.getFormShowParameter();
|
||||
// formShowParameter.getListFilterParameter().setFilter(orgpattern_qf);
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
public void propertyChanged(PropertyChangedArgs e) {
|
||||
super.propertyChanged(e);
|
||||
String name = e.getProperty().getName();
|
||||
if ("shkd_queryorgtype".equals(name)){
|
||||
ChangeData[] changeSet = e.getChangeSet();
|
||||
Object newValue = changeSet[0].getNewValue();
|
||||
if ("company".equals(newValue)){
|
||||
this.getModel().setValue("shkd_filter_group",null);
|
||||
this.getView().setVisible(false,"shkd_filter_group");
|
||||
this.getView().setVisible(true,"shkd_filter_company");
|
||||
}else if ("group".equals(newValue)){
|
||||
this.getModel().setValue("shkd_filter_company",null);
|
||||
this.getView().setVisible(false,"shkd_filter_company");
|
||||
this.getView().setVisible(true,"shkd_filter_group");
|
||||
// String name = e.getProperty().getName();
|
||||
// if ("shkd_queryorgtype".equals(name)){
|
||||
// ChangeData[] changeSet = e.getChangeSet();
|
||||
// Object newValue = changeSet[0].getNewValue();
|
||||
// if ("company".equals(newValue)){
|
||||
// this.getModel().setValue("shkd_filter_group",null);
|
||||
// this.getView().setVisible(false,"shkd_filter_group");
|
||||
// this.getView().setVisible(false,"shkd_iscontainyy");
|
||||
// this.getView().setVisible(true,"shkd_filter_company");
|
||||
// }else if ("group".equals(newValue)){
|
||||
// this.getModel().setValue("shkd_filter_company",null);
|
||||
// this.getView().setVisible(false,"shkd_filter_company");
|
||||
// this.getView().setVisible(true,"shkd_filter_group");
|
||||
// this.getView().setVisible(true,"shkd_iscontainyy");
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验过滤条件
|
||||
* @param queryParam
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public boolean verifyQuery(ReportQueryParam queryParam) {
|
||||
FilterInfo filterInfo = queryParam.getFilter();
|
||||
String shkd_queryorgtype = (String)this.getModel().getValue("shkd_queryorgtype");
|
||||
if (filterInfo != null) {
|
||||
// 判断集团或公司是否为空
|
||||
// if("company".equals(shkd_queryorgtype)){//当类型为公司时,校验使用公司不为空
|
||||
// DynamicObjectCollection company = (DynamicObjectCollection)filterInfo.getValue("shkd_filter_company");
|
||||
// if (company == null || company.isEmpty()){
|
||||
// this.getView().showTipNotification("使用公司条件不能为空!");
|
||||
// return false;
|
||||
// }
|
||||
// }else
|
||||
if ("group".equals(shkd_queryorgtype)){//当类型为集团时,校验使用集团不为空
|
||||
DynamicObjectCollection group = (DynamicObjectCollection)filterInfo.getValue("shkd_filter_company");
|
||||
if (group == null || group.isEmpty()){
|
||||
this.getView().showTipNotification("使用公司条件不能为空!");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
//判断币别不为空
|
||||
// DynamicObject shkd_orgcurrency = (DynamicObject)filterInfo.getValue("shkd_orgcurrency");
|
||||
// if (shkd_orgcurrency == null) {
|
||||
// this.getView().showTipNotification("币别不能为空!");
|
||||
// return false;
|
||||
// }
|
||||
}
|
||||
return super.verifyQuery(queryParam);
|
||||
}
|
||||
}
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue