资金日表取数逻辑更新

This commit is contained in:
zengweihai 2024-08-08 10:57:00 +08:00
parent bef247de72
commit 61dbe850d2
1 changed files with 18 additions and 62 deletions

View File

@ -87,6 +87,8 @@ public class CapitalDayListDataPlugin extends AbstractReportListDataPlugin imple
BigDecimal recTotal = BigDecimal.ZERO; //总计 期间收入合计
BigDecimal payLB = BigDecimal.ZERO; //内部往来,支出合计
BigDecimal recLB = BigDecimal.ZERO; //内部往来 期间收入合计
BigDecimal payNet = BigDecimal.ZERO;//支出净额
BigDecimal recNet = BigDecimal.ZERO;//收入净额
for (int i = 0; i < cas_cashmgtinits.length; i++) {
//若是集团需要在第一行拼接第一行的数据
if("group".equals(shkd_queryorgtype)&&i == 0){
@ -119,7 +121,7 @@ public class CapitalDayListDataPlugin extends AbstractReportListDataPlugin imple
//逻辑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);
bef_payQF.and("bizdate",QCP.large_equals,begindate);//付款日期paydate
if (firstDate == null){//没有设置时间则查询今日记账,即查询期间开始到今日之前的所有付款单据
firstDate = new Date();
}
@ -130,7 +132,7 @@ public class CapitalDayListDataPlugin extends AbstractReportListDataPlugin imple
bef_payQF.and("currency.id",QCP.equals,orgcurrencyId);
}
Date startDate = this.getStartDate(firstDate);//过滤条件-开始日期
bef_payQF.and("paydate","<",startDate);
bef_payQF.and("bizdate","<",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");
@ -151,8 +153,8 @@ public class CapitalDayListDataPlugin extends AbstractReportListDataPlugin imple
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);
bef_recQF.and("bizdate",QCP.large_equals,begindate);//收款日期payeedate
bef_recQF.and("bizdate","<",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");
@ -178,8 +180,8 @@ public class CapitalDayListDataPlugin extends AbstractReportListDataPlugin imple
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);
per_recQF.and("bizdate",QCP.large_equals,startDate);//收款日期payeedate
per_recQF.and("bizdate",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); //内部往来收入合计
@ -199,8 +201,8 @@ public class CapitalDayListDataPlugin extends AbstractReportListDataPlugin imple
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);
per_payQF.and("bizdate",QCP.large_equals,startDate);//付款日期paydate
per_payQF.and("bizdate",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); //内部往来收入合计
@ -234,64 +236,18 @@ public class CapitalDayListDataPlugin extends AbstractReportListDataPlugin imple
firmParam[4] = payTotal; //今日收入合计
firmParams.add(firmParam);
Object[] firmParam2 = new Object[7];//存放公司数据
Object[] firmParam2 = new Object[7];//存放内部往来数据
firmParam2[1] = "内部往来";
firmParam2[3] = recLB; //今日收入合计
firmParam2[4] = payLB; //今日收入合计
firmParam2[3] = recLB; //收入内部往来合计
firmParam2[4] = payLB; //支出内部往来合计
firmParams.add(firmParam2);
//内部收支净额的组装
Object[] firmParam3 = new Object[7];//存放内部往来数据
firmParam3[1] = "收支净额";
firmParam3[3] = recTotal.subtract(recLB); //收入内部往来合计
firmParam3[4] = payTotal.subtract(payLB); //支出内部往来合计
firmParams.add(firmParam3);
}
// 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);