应收票据台账报表插件2
This commit is contained in:
parent
1722c6ed48
commit
8e5a618295
|
@ -2,10 +2,13 @@ package shkd.sys.sys.plugin.report;
|
|||
|
||||
import kd.bos.algo.DataSet;
|
||||
import kd.bos.algo.JoinDataSet;
|
||||
import kd.bos.algo.JoinType;
|
||||
import kd.bos.db.DB;
|
||||
import kd.bos.db.DBRoute;
|
||||
import kd.bos.entity.report.AbstractReportListDataPlugin;
|
||||
import kd.bos.entity.report.ReportQueryParam;
|
||||
import kd.bos.orm.query.QCP;
|
||||
import kd.bos.orm.query.QFilter;
|
||||
import kd.bos.servicehelper.QueryServiceHelper;
|
||||
|
||||
/**
|
||||
|
@ -16,17 +19,23 @@ public class BillReceivableReportFormPlugin extends AbstractReportListDataPlugin
|
|||
public DataSet query(ReportQueryParam reportQueryParam, Object o) throws Throwable {
|
||||
String selectFields = "id as shkd_id,company.name as shkd_skdw,bizdate as shkd_spyf,bizdate as shkd_sprq,draftbillno as shkd_pjhm" +
|
||||
"amount as shkd_hpje,availableamount as shkd_kyje,drawername as shkd_cprqc,delivername as shkd_jprqcqs," +
|
||||
"acceptername as shkd_cdrqc";
|
||||
"acceptername as shkd_cdrqc,issuedate as shkd_cprq, draftbillexpiredate as shkd_pjdqr";
|
||||
DataSet draftBillData = QueryServiceHelper.queryDataSet(this.getClass().getSimpleName(),"cdm_receivablebill",
|
||||
selectFields, null, null);
|
||||
selectFields, new QFilter[]{new QFilter("source", QCP.not_equals,"cdm")}, null);
|
||||
|
||||
DataSet disCountData = getDisCountData();
|
||||
JoinDataSet select = draftBillData.join(disCountData).select("");
|
||||
|
||||
DataSet pledgeData = getPledgeData();
|
||||
DataSet endorseData = getEndorseData();
|
||||
DataSet collectData = getCollectData();
|
||||
return null;
|
||||
|
||||
return draftBillData.join(disCountData, JoinType.LEFT).select("shkd_txrq,shkd_txjg,shkd_txje")
|
||||
.on("shkd_id","pjid3").finish()
|
||||
.join(collectData, JoinType.LEFT).select("shkd_tsrq,shkd_tsje")
|
||||
.on("shkd_id","pjid1").finish()
|
||||
.join(endorseData, JoinType.LEFT).select("shkd_bsrq,shkd_bsr,shkd_bsje")
|
||||
.on("shkd_id","pjid2").finish()
|
||||
.join(pledgeData, JoinType.LEFT).select("shkd_zyrq,shkd_zyr,shkd_zyje")
|
||||
.on("shkd_id","pjid4").finish();
|
||||
}
|
||||
|
||||
//贴现
|
||||
|
@ -70,47 +79,47 @@ public class BillReceivableReportFormPlugin extends AbstractReportListDataPlugin
|
|||
//背书
|
||||
private DataSet getEndorseData() {
|
||||
return DB.queryDataSet(this.getClass().getSimpleName(), DBRoute.of("fi"),
|
||||
"/*dialect*/SELECT \n" +
|
||||
" pjid2,\n" +
|
||||
" MAX(discountid) AS discountid,\n" +
|
||||
" MAX(discounttradetype) AS discounttradetype,\n" +
|
||||
" LISTAGG(\n" +
|
||||
" TO_CHAR(bizdate, 'YYYY-MM-DD'), '\\n' \n" +
|
||||
" ) WITHIN GROUP (ORDER BY bizdate) AS shkd_bsrq, \n" +
|
||||
" LISTAGG(\n" +
|
||||
" endorsename || ';' || TO_CHAR(endorseamt, '999,999,999,999.99'),'\\n'\n" +
|
||||
" ) WITHIN GROUP (ORDER BY bizdate) AS shkd_bsr,\n" +
|
||||
" SUM(endorseamt) AS shkd_bsje\n" +
|
||||
"FROM (\n" +
|
||||
" SELECT \n" +
|
||||
" t1.fid AS pjid2,\n" +
|
||||
" t2.fid AS discountid,\n" +
|
||||
" t2.ftradetype AS discounttradetype,\n" +
|
||||
" t2.fbeendorsortext AS endorsename,\n" +
|
||||
" t2.FBIZDATE AS bizdate,\n" +
|
||||
" t2.famount AS endorseamt\n" +
|
||||
" FROM CTSK0414_FI.t_cdm_draftbill t1\n" +
|
||||
" LEFT JOIN CTSK0414_FI.t_cdm_drafttrdbill_entry t3 ON t1.fid = t3.fdraftbillid\n" +
|
||||
" LEFT JOIN CTSK0414_FI.t_cdm_drafttradebill t2 ON t2.fid = t3.fid\n" +
|
||||
" WHERE t1.fsource <> 'cdm' AND t2.ftradetype = 'endorse'\n" +
|
||||
") src\n" +
|
||||
"/*dialect*/SELECT " +
|
||||
" pjid2," +
|
||||
" MAX(discountid) AS discountid," +
|
||||
" MAX(discounttradetype) AS discounttradetype," +
|
||||
" LISTAGG(" +
|
||||
" TO_CHAR(bizdate, 'YYYY-MM-DD'), '\' " +
|
||||
" ) WITHIN GROUP (ORDER BY bizdate) AS shkd_bsrq, " +
|
||||
" LISTAGG(" +
|
||||
" endorsename || ';' || TO_CHAR(endorseamt, '999,999,999,999.99'),'\'" +
|
||||
" ) WITHIN GROUP (ORDER BY bizdate) AS shkd_bsr," +
|
||||
" SUM(endorseamt) AS shkd_bsje" +
|
||||
"FROM (" +
|
||||
" SELECT " +
|
||||
" t1.fid AS pjid2," +
|
||||
" t2.fid AS discountid," +
|
||||
" t2.ftradetype AS discounttradetype," +
|
||||
" t2.fbeendorsortext AS endorsename," +
|
||||
" t2.FBIZDATE AS bizdate," +
|
||||
" t2.famount AS endorseamt" +
|
||||
" FROM CTSK0414_FI.t_cdm_draftbill t1" +
|
||||
" LEFT JOIN CTSK0414_FI.t_cdm_drafttrdbill_entry t3 ON t1.fid = t3.fdraftbillid" +
|
||||
" LEFT JOIN CTSK0414_FI.t_cdm_drafttradebill t2 ON t2.fid = t3.fid" +
|
||||
" WHERE t1.fsource <> 'cdm' AND t2.ftradetype = 'endorse'" +
|
||||
") src" +
|
||||
"GROUP BY pjid2;");
|
||||
}
|
||||
|
||||
//托收
|
||||
private DataSet getCollectData(){
|
||||
return DB.queryDataSet(this.getClass().getSimpleName(), DBRoute.of("fi"),
|
||||
"/*dialect*/SELECT \n" +
|
||||
" t1.fid AS pjid1,\n" +
|
||||
" t2.fid AS discountid,\n" +
|
||||
" t2.ftradetype AS discounttradetype,\n" +
|
||||
" t4.freceivername AS shkd_tsjg,\n" +
|
||||
" t2.FBIZDATE AS shkd_tsrq,\n" +
|
||||
" t2.fcollection AS shkd_tsje\n" +
|
||||
"FROM CTSK0414_FI.t_cdm_draftbill t1\n" +
|
||||
" LEFT JOIN CTSK0414_FI.t_cdm_draftbill_e t4 ON t4.fid = t1.fid\n" +
|
||||
" LEFT JOIN CTSK0414_FI.t_cdm_drafttrdbill_entry t3 ON t1.fid = t3.fdraftbillid\n" +
|
||||
" LEFT JOIN CTSK0414_FI.t_cdm_drafttradebill t2 ON t2.fid = t3.fid\n" +
|
||||
"/*dialect*/SELECT " +
|
||||
" t1.fid AS pjid1," +
|
||||
" t2.fid AS discountid," +
|
||||
" t2.ftradetype AS discounttradetype," +
|
||||
" t4.freceivername AS shkd_tsjg," +
|
||||
" t2.FBIZDATE AS shkd_tsrq," +
|
||||
" t2.fcollection AS shkd_tsje" +
|
||||
"FROM CTSK0414_FI.t_cdm_draftbill t1" +
|
||||
" LEFT JOIN CTSK0414_FI.t_cdm_draftbill_e t4 ON t4.fid = t1.fid" +
|
||||
" LEFT JOIN CTSK0414_FI.t_cdm_drafttrdbill_entry t3 ON t1.fid = t3.fdraftbillid" +
|
||||
" LEFT JOIN CTSK0414_FI.t_cdm_drafttradebill t2 ON t2.fid = t3.fid" +
|
||||
" WHERE t1.fsource <> 'cdm' AND t2.ftradetype = 'collect'");
|
||||
|
||||
}
|
||||
|
@ -118,30 +127,30 @@ public class BillReceivableReportFormPlugin extends AbstractReportListDataPlugin
|
|||
//托收
|
||||
private DataSet getPledgeData(){
|
||||
return DB.queryDataSet(this.getClass().getSimpleName(), DBRoute.of("fi"),
|
||||
"/*dialect*/SELECT \n" +
|
||||
" pjid4,\n" +
|
||||
" MAX(t2id4) AS t2id4,\n" +
|
||||
" MAX(tradetype4) AS tradetype4,\n" +
|
||||
" LISTAGG(\n" +
|
||||
" TO_CHAR(bizdate, 'YYYY-MM-DD'),';' \n" +
|
||||
" ) WITHIN GROUP (ORDER BY bizdate) AS shkd_zyrq,\n" +
|
||||
" LISTAGG(\n" +
|
||||
" pledgename || ';' || TO_CHAR(pledgeamt, '999,999,999,999.99'),';'\n" +
|
||||
" ) WITHIN GROUP (ORDER BY bizdate) AS shkd_zyr,\n" +
|
||||
" SUM(pledgeamt) AS shkd_zyje\n" +
|
||||
"FROM (\n" +
|
||||
" SELECT \n" +
|
||||
" t1.fid AS pjid4,\n" +
|
||||
" t2.fid AS t2id4,\n" +
|
||||
" t2.ftradetype AS tradetype4,\n" +
|
||||
" t2.fpledgeetext AS pledgename,\n" +
|
||||
" t2.FBIZDATE AS bizdate,\n" +
|
||||
" t2.famount AS pledgeamt\n" +
|
||||
" FROM CTSK0414_FI.t_cdm_draftbill t1\n" +
|
||||
" LEFT JOIN CTSK0414_FI.t_cdm_drafttrdbill_entry t3 ON t1.fid = t3.fdraftbillid\n" +
|
||||
" LEFT JOIN CTSK0414_FI.t_cdm_drafttradebill t2 ON t2.fid = t3.fid\n" +
|
||||
" WHERE t1.fsource <> 'cdm' AND t2.ftradetype = 'pledge'\n" +
|
||||
") src\n" +
|
||||
"/*dialect*/SELECT " +
|
||||
" pjid4," +
|
||||
" MAX(t2id4) AS t2id4," +
|
||||
" MAX(tradetype4) AS tradetype4," +
|
||||
" LISTAGG(" +
|
||||
" TO_CHAR(bizdate, 'YYYY-MM-DD'),';' " +
|
||||
" ) WITHIN GROUP (ORDER BY bizdate) AS shkd_zyrq," +
|
||||
" LISTAGG(" +
|
||||
" pledgename || ';' || TO_CHAR(pledgeamt, '999,999,999,999.99'),';'" +
|
||||
" ) WITHIN GROUP (ORDER BY bizdate) AS shkd_zyr," +
|
||||
" SUM(pledgeamt) AS shkd_zyje" +
|
||||
"FROM (" +
|
||||
" SELECT " +
|
||||
" t1.fid AS pjid4," +
|
||||
" t2.fid AS t2id4," +
|
||||
" t2.ftradetype AS tradetype4," +
|
||||
" t2.fpledgeetext AS pledgename," +
|
||||
" t2.FBIZDATE AS bizdate," +
|
||||
" t2.famount AS pledgeamt" +
|
||||
" FROM CTSK0414_FI.t_cdm_draftbill t1" +
|
||||
" LEFT JOIN CTSK0414_FI.t_cdm_drafttrdbill_entry t3 ON t1.fid = t3.fdraftbillid" +
|
||||
" LEFT JOIN CTSK0414_FI.t_cdm_drafttradebill t2 ON t2.fid = t3.fid" +
|
||||
" WHERE t1.fsource <> 'cdm' AND t2.ftradetype = 'pledge'" +
|
||||
") src" +
|
||||
"GROUP BY pjid4");
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue