@ -403,18 +403,18 @@ public class InterestBearingRptListPlugin extends AbstractReportListDataPlugin {
" AND t1.FBILLNO = s1.FBILLNO \ n " +
" GROUP BY to_char(s6.fbizdate,'yyyy') having to_char(s6.fbizdate,'yyyy') = ' " + year + " ') " ;
/ / 年末未还金额
String selYearNmAmt = " (SELECT sum(sum(isnull(s1.fnotrepayamount,0))) \ n " +
String selYearNmAmt = " (SELECT sum(sum(isnull(s1.fnotrepayamount,0))) yearwhamt \ n " +
" FROM t_cfm_loanbill s1 \ n " +
" INNER JOIN t_cfm_loanbill_e s2 ON s1.fid = s2.FID \ n " +
" WHERE (s2.floantype = 'loan' OR s2.floantype = 'sl' OR s2.floantype = 'bond') \ n " +
" AND (s1.fdrawtype = 'drawed' OR s1.fdrawtype = 'partpayment') \ n " +
" AND t1.FBILLNO = s1.FBILLNO \ n " +
" GROUP BY to_char(s2.fstartintdate,'yyyy') having to_char(s2.fstartintdate,'yyyy') > '" + year + " ') " ;
" GROUP BY to_char(s2.fstartintdate,'yyyy') having to_char(s2.fstartintdate,'yyyy') = '" + year + " ') " ;
DataSet selData = null ;
/ / 业务单元数据集
DataSet orgDataSet = QueryServiceHelper . queryDataSet ( this . getClass ( ) . getSimpleName ( ) , " bos_org " , " id,number as orgnumber,name as orgname " , null , null ) ;
/ / 查询提款处理和债券发行 。 这两PC布局属于一个单据
String sql = " /*dialect*/ SELECT t1. FBILLNO shkd_billno,t1.fk_shkd_ejgs shkd_ejgs,t2.forgid orgid,\ n " +
String sql = " /*dialect*/ SELECT t1. fid shkd_billid,t1. FBILLNO shkd_billno,t1.fk_shkd_ejgs shkd_ejgs,t2.forgid orgid,\ n " +
" CASE \ n " +
" \ tWHEN (t1.fk_shkd_zqrzh IS NULL OR t1.fk_shkd_rzqd == '') THEN ' ' \ n " +
" END shkd_zqrzh, \ n " +
@ -599,6 +599,9 @@ public class InterestBearingRptListPlugin extends AbstractReportListDataPlugin {
sql + = " " + selLxAmt ( " >= '2035' " ) + " /100000000 sellx2035, \ n " ; / / 2035年之后债务利息
sql + = " isnull(t1.fdrawamount,0)/100000000 drawamount, \ n " ;
}
sql + = " 0.01 yghlx, \ n " ; / / 已归还利息
sql + = " 0.01 sumbj, \ n " ; / / 前面年份本金合计
sql + = " 0.01 sumlx, \ n " ; / / 前面年份利息合计
sql + = " 0.01 sumamt, \ n " ;
sql + = " 0.01 sumzhrzcb, \ n " ;
sql + = " 0.01 sumzhrzqx, \ n " ;
@ -708,20 +711,50 @@ public class InterestBearingRptListPlugin extends AbstractReportListDataPlugin {
/ / 数据表查询
DataSet dataRes = DB . queryDataSet ( this . getClass ( ) . getSimpleName ( ) , DBRoute . of ( " fi " ) , selSql ) ; / / 财务云
JoinDataSet join1 = dataRes . join ( orgDataSet , JoinType . LEFT ) ; / / 连接二级组织
DataSet dataRes1 = join1 . on ( " shkd_ejgs " , " id " ) . select ( new String [ ] { " shkd_bill no" , " orgname shkd_ejgs " , " orgid " , " shkd_zqrzh " , " textcreditor " , " shkd_rzpz1 " , " shkd_rzpzmx " ,
" shkd_rzqd " , " shkd_blxm " , " shkd_dybbkmmc " , " term " , " xcday " , " xcdate " , " startintdate " , " expiredate " , " selyearncamt+selyearaddamt-selyearyhkamt selyearncamt" ,
DataSet dataRes1 = join1 . on ( " shkd_ejgs " , " id " ) . select ( new String [ ] { " shkd_bill id" , " shkd_bill no" , " orgname shkd_ejgs " , " orgid " , " shkd_zqrzh " , " textcreditor " , " shkd_rzpz1 " , " shkd_rzpzmx " ,
" shkd_rzqd " , " shkd_blxm " , " shkd_dybbkmmc " , " term " , " xcday " , " xcdate " , " startintdate " , " expiredate " , " NullToZero( selyearncamt) +NullToZero( selyearaddamt) -NullToZero( selyearyhkamt) selyearncamt" ,
" selyearaddamt " , " selyearyhkamt " , " selyearnmamt " , " drawamount " , " sumamt " , " sumzhrzcb " , " sumzhrzqx " , " zhrzcb " , " zhrzqx " , " SubStr(guaranteeway, 1, LEN(guaranteeway)-2) guaranteeway " ,
" dbwkm " , " dbwname " , " lilv " , " remark " ,
" selbj2025 " , " sellx2025 " , " selbj2026 " , " sellx2026 " , " selbj2027 " , " sellx2027 " , " selbj2028 " , " sellx2028 " , " selbj2029 " , " sellx2029 " , " selbj2030 " , " sellx2030 " ,
" selbj2031 " , " sellx2031 " , " selbj2032 " , " sellx2032 " , " selbj2033 " , " sellx2033 " , " selbj2034 " , " sellx2034 " , " selbj2035 " , " sellx2035 " } ) . finish ( ) ;
" selbj2031 " , " sellx2031 " , " selbj2032 " , " sellx2032 " , " selbj2033 " , " sellx2033 " , " selbj2034 " , " sellx2034 " , " selbj2035 " , " sellx2035 " ,
" NullToZero(selbj2025)+NullToZero(selbj2026)+NullToZero(selbj2027)+NullToZero(selbj2028)+NullToZero(selbj2029)+NullToZero(selbj2030)+ " +
" NullToZero(selbj2031)+NullToZero(selbj2032)+NullToZero(selbj2033)+NullToZero(selbj2034)+NullToZero(selbj2035) sumbj " ,
" NullToZero(sellx2025)+NullToZero(sellx2026)+NullToZero(sellx2027)+NullToZero(sellx2028)+NullToZero(sellx2029)+NullToZero(sellx2030)+ " +
" NullToZero(sellx2031)+NullToZero(sellx2032)+NullToZero(sellx2033)+NullToZero(sellx2034)+NullToZero(sellx2035) sumlx " , " yghlx " } ) . finish ( ) ;
JoinDataSet join2 = dataRes1 . join ( orgDataSet , JoinType . LEFT ) ; / / 连接融资主体
DataSet dataRes2 = join2 . on ( " orgid " , " id " ) . select ( new String [ ] { " shkd_billno " , " shkd_ejgs " , " orgname orgid " , " shkd_zqrzh " , " textcreditor " , " shkd_rzpz1 " , " shkd_rzpzmx " , " shkd_rzqd " ,
DataSet dataRes2 = join2 . on ( " orgid " , " id " ) . select ( new String [ ] { " shkd_bill id" , " shkd_bill no" , " shkd_ejgs " , " orgname orgid " , " shkd_zqrzh " , " textcreditor " , " shkd_rzpz1 " , " shkd_rzpzmx " , " shkd_rzqd " ,
" shkd_blxm " , " shkd_dybbkmmc " , " term " , " xcday " , " xcdate " , " startintdate " , " expiredate " , " drawamount " , " selyearncamt " ,
" selyearaddamt " , " selyearyhkamt " , " selyearnmamt " , " sumamt " , " sumzhrzcb " , " sumzhrzqx " , " zhrzcb " , " zhrzqx " , " guaranteeway " , " dbwkm " , " dbwname " , " lilv " , " remark " ,
" selbj2025 " , " sellx2025 " , " selbj2026 " , " sellx2026 " , " selbj2027 " , " sellx2027 " , " selbj2028 " , " sellx2028 " , " selbj2029 " , " sellx2029 " , " selbj2030 " , " sellx2030 " ,
" selbj2031 " , " sellx2031 " , " selbj2032 " , " sellx2032 " , " selbj2033 " , " sellx2033 " , " selbj2034 " , " sellx2034 " , " selbj2035 " , " sellx2035 " } ) . finish ( ) ;
" selbj2031 " , " sellx2031 " , " selbj2032 " , " sellx2032 " , " selbj2033 " , " sellx2033 " , " selbj2034 " , " sellx2034 " , " selbj2035 " , " sellx2035 " , " sumbj " , " sumlx " , " yghlx " } ) . finish ( ) ;
String selhxSql = " /*dialect*/ select " ;
/ / 计算元
if ( amtUnit = = null | | amtUnit . equals ( " yuan " ) ) {
/ / 元
selhxSql + = " sum(isnull(factualinstamt,0)) selyghlx, \ n " ; / / 本年已归还利息year
} else if ( amtUnit . equals ( " qyuan " ) ) {
/ / 千元
selhxSql + = " sum(isnull(factualinstamt,0))/1000 selyghlx, \ n " ; / / 本年已归还利息year
} else if ( amtUnit . equals ( " wyuan " ) ) {
/ / 万元
selhxSql + = " sum(isnull(factualinstamt,0))/10000 selyghlx, \ n " ; / / 本年已归还利息year
} else if ( amtUnit . equals ( " bwyuan " ) ) {
/ / 百万元
selhxSql + = " sum(isnull(factualinstamt,0))/1000000 selyghlx, \ n " ; / / 本年已归还利息year
} else if ( amtUnit . equals ( " yyuan " ) ) {
/ / 亿元
selhxSql + = " sum(isnull(factualinstamt,0))/100000000 selyghlx, \ n " ; / / 本年已归还利息year
}
selhxSql + = " s1.fsourcebillid souid from t_cfm_interestbill s1 where s1.finstbillctg = 'payinterst' and to_char(s1.fbizdate,'yyyy') = ' " + year + " ' group by s1.fsourcebillid " ;
DataSet selhxDate = DB . queryDataSet ( this . getClass ( ) . getSimpleName ( ) , DBRoute . of ( " fi " ) , selhxSql ) ; / / 财务云
JoinDataSet join3 = dataRes2 . join ( selhxDate , JoinType . LEFT ) ; / / 连接归还利息
DataSet dataRes3 = join3 . on ( " shkd_billid " , " souid " ) . select ( new String [ ] { " shkd_billid " , " shkd_billno " , " shkd_ejgs " , " orgid " , " shkd_zqrzh " , " textcreditor " , " shkd_rzpz1 " , " shkd_rzpzmx " , " shkd_rzqd " ,
" shkd_blxm " , " shkd_dybbkmmc " , " term " , " xcday " , " xcdate " , " startintdate " , " expiredate " , " drawamount " , " selyearncamt " ,
" selyearaddamt " , " selyearyhkamt " , " selyearnmamt " , " sumamt " , " sumzhrzcb " , " sumzhrzqx " , " zhrzcb " , " zhrzqx " , " guaranteeway " , " dbwkm " , " dbwname " , " lilv " , " remark " ,
" selbj2025 " , " sellx2025 " , " selbj2026 " , " sellx2026 " , " selbj2027 " , " sellx2027 " , " selbj2028 " , " sellx2028 " , " selbj2029 " , " sellx2029 " , " selbj2030 " , " sellx2030 " ,
" selbj2031 " , " sellx2031 " , " selbj2032 " , " sellx2032 " , " selbj2033 " , " sellx2033 " , " selbj2034 " , " sellx2034 " , " selbj2035 " , " sellx2035 " , " sumbj " , " sumlx " , " selyghlx yghlx " } ) . finish ( ) ;
/ / 根据结果集重新计算两个日期相差的格式
DynamicObjectCollection srcCollection = ORM . create ( ) . toPlainDynamicObjectCollection ( dataRes2 . copy ( ) ) ;
DynamicObjectCollection srcCollection = ORM . create ( ) . toPlainDynamicObjectCollection ( dataRes 3 . copy ( ) ) ;
BigDecimal sumCb = BigDecimal . ZERO ; / / 综合融资成本
BigDecimal sumQx = BigDecimal . ZERO ; / / 综合融资期限
for ( int i = 0 ; i < srcCollection . size ( ) ; i + + ) {
@ -923,7 +956,8 @@ public class InterestBearingRptListPlugin extends AbstractReportListDataPlugin {
/ / dataTypes . add ( anyType ) ;
/ / } else
if ( field . equals ( " drawamount " ) | | field . equals ( " zhrzcb " ) | | field . equals ( " zhrzqx " )
| | field . contains ( " selyear " ) | | field . contains ( " sellx " ) | | field . contains ( " selbj " ) ) {
| | field . contains ( " selyear " ) | | field . contains ( " sellx " ) | | field . contains ( " selbj " )
| | field . equals ( " sumbj " ) | | field . equals ( " sumlx " ) | | field . equals ( " yghlx " ) ) {
dataTypes . add ( bigDecimalType ) ;
} else {
dataTypes . add ( stringType ) ;
@ -1022,6 +1056,8 @@ public class InterestBearingRptListPlugin extends AbstractReportListDataPlugin {
DecimalReportColumn lx2034 = new DecimalReportColumn ( ) ;
DecimalReportColumn bj2035 = new DecimalReportColumn ( ) ;
DecimalReportColumn lx2035 = new DecimalReportColumn ( ) ;
DecimalReportColumn sumbj = new DecimalReportColumn ( ) ;
DecimalReportColumn sumlx = new DecimalReportColumn ( ) ;
/ / 年条件金额相关字段
ReportColumnGroup yearAmtEfg = new ReportColumnGroup ( ) ;
yearAmtEfg . setCaption ( new LocaleString ( " 债务余额(对外债务、不含权益工具) " ) ) ;
@ -1032,6 +1068,7 @@ public class InterestBearingRptListPlugin extends AbstractReportListDataPlugin {
DecimalReportColumn nmAmt = new DecimalReportColumn ( ) ;
/ / 金额
DecimalReportColumn amt = new DecimalReportColumn ( ) ;
DecimalReportColumn yghlx = new DecimalReportColumn ( ) ;
if ( amtUnit = = null | | amtUnit . equals ( " yuan " ) ) {
/ / 元
ncAmt = createDecReportColumn ( " selyearncamt " , " amount " , " 年初余额(元) " ) ;
@ -1060,6 +1097,9 @@ public class InterestBearingRptListPlugin extends AbstractReportListDataPlugin {
lx2034 = createDecReportColumn ( " sellx2034 " , " amount " , " 2034债务利息( 元) " ) ;
bj2035 = createDecReportColumn ( " selbj2035 " , " amount " , " 2035债务本金( 元) " ) ;
lx2035 = createDecReportColumn ( " sellx2035 " , " amount " , " 2035债务利息( 元) " ) ;
sumbj = createDecReportColumn ( " sumbj " , " amount " , " 合计本金(元) " ) ;
sumlx = createDecReportColumn ( " sumlx " , " amount " , " 合计利息(元) " ) ;
yghlx = createDecReportColumn ( " yghlx " , " amount " , " 本年已归还利息(元) " ) ;
amt = createDecReportColumn ( " drawamount " , " amount " , " 金额(元) " ) ;
} else if ( amtUnit . equals ( " qyuan " ) ) {
/ / 千元
@ -1089,6 +1129,9 @@ public class InterestBearingRptListPlugin extends AbstractReportListDataPlugin {
lx2034 = createDecReportColumn ( " sellx2034 " , " amount " , " 2034债务利息( 千元) " ) ;
bj2035 = createDecReportColumn ( " selbj2035 " , " amount " , " 2035债务本金( 千元) " ) ;
lx2035 = createDecReportColumn ( " sellx2035 " , " amount " , " 2035债务利息( 千元) " ) ;
sumbj = createDecReportColumn ( " sumbj " , " amount " , " 合计本金(千元) " ) ;
sumlx = createDecReportColumn ( " sumlx " , " amount " , " 合计利息(千元) " ) ;
yghlx = createDecReportColumn ( " yghlx " , " amount " , " 本年已归还利息(千元) " ) ;
amt = createDecReportColumn ( " drawamount " , " amount " , " 金额(千元) " ) ;
} else if ( amtUnit . equals ( " wyuan " ) ) {
/ / 万元
@ -1118,6 +1161,9 @@ public class InterestBearingRptListPlugin extends AbstractReportListDataPlugin {
lx2034 = createDecReportColumn ( " sellx2034 " , " amount " , " 2034债务利息( 万元) " ) ;
bj2035 = createDecReportColumn ( " selbj2035 " , " amount " , " 2035债务本金( 万元) " ) ;
lx2035 = createDecReportColumn ( " sellx2035 " , " amount " , " 2035债务利息( 万元) " ) ;
sumbj = createDecReportColumn ( " sumbj " , " amount " , " 合计本金(万元) " ) ;
sumlx = createDecReportColumn ( " sumlx " , " amount " , " 合计利息(万元) " ) ;
yghlx = createDecReportColumn ( " yghlx " , " amount " , " 本年已归还利息(万元) " ) ;
amt = createDecReportColumn ( " drawamount " , " amount " , " 金额(万元) " ) ;
} else if ( amtUnit . equals ( " bwyuan " ) ) {
/ / 百万元
@ -1147,6 +1193,9 @@ public class InterestBearingRptListPlugin extends AbstractReportListDataPlugin {
lx2034 = createDecReportColumn ( " sellx2034 " , " amount " , " 2034债务利息( 百万元) " ) ;
bj2035 = createDecReportColumn ( " selbj2035 " , " amount " , " 2035债务本金( 百万元) " ) ;
lx2035 = createDecReportColumn ( " sellx2035 " , " amount " , " 2035债务利息( 百万元) " ) ;
sumbj = createDecReportColumn ( " sumbj " , " amount " , " 合计本金(百万元) " ) ;
sumlx = createDecReportColumn ( " sumlx " , " amount " , " 合计利息(百万元) " ) ;
yghlx = createDecReportColumn ( " yghlx " , " amount " , " 本年已归还利息(百万元) " ) ;
amt = createDecReportColumn ( " drawamount " , " amount " , " 金额(百万元) " ) ;
} else if ( amtUnit . equals ( " yyuan " ) ) {
/ / 亿元
@ -1176,6 +1225,9 @@ public class InterestBearingRptListPlugin extends AbstractReportListDataPlugin {
lx2034 = createDecReportColumn ( " sellx2034 " , " amount " , " 2034债务利息( 亿元) " ) ;
bj2035 = createDecReportColumn ( " selbj2035 " , " amount " , " 2035债务本金( 亿元) " ) ;
lx2035 = createDecReportColumn ( " sellx2035 " , " amount " , " 2035债务利息( 亿元) " ) ;
sumbj = createDecReportColumn ( " sumbj " , " amount " , " 合计本金(亿元) " ) ;
sumlx = createDecReportColumn ( " sumlx " , " amount " , " 合计利息(亿元) " ) ;
yghlx = createDecReportColumn ( " yghlx " , " amount " , " 本年已归还利息(亿元) " ) ;
amt = createDecReportColumn ( " drawamount " , " amount " , " 金额(亿元) " ) ;
}
/ / 添加年相关四个金额且合计
@ -1211,6 +1263,8 @@ public class InterestBearingRptListPlugin extends AbstractReportListDataPlugin {
lx2034 . setSummary ( 1 ) ;
bj2035 . setSummary ( 1 ) ;
lx2035 . setSummary ( 1 ) ;
sumbj . setSummary ( 1 ) ;
sumlx . setSummary ( 1 ) ;
bjlxEfg . getChildren ( ) . add ( bj2025 ) ; / / 添加下级分组
bjlxEfg . getChildren ( ) . add ( lx2025 ) ; / / 添加下级分组
bjlxEfg . getChildren ( ) . add ( bj2026 ) ; / / 添加下级分组
@ -1233,7 +1287,12 @@ public class InterestBearingRptListPlugin extends AbstractReportListDataPlugin {
bjlxEfg . getChildren ( ) . add ( lx2034 ) ; / / 添加下级分组
bjlxEfg . getChildren ( ) . add ( bj2035 ) ; / / 添加下级分组
bjlxEfg . getChildren ( ) . add ( lx2035 ) ; / / 添加下级分组
bjlxEfg . getChildren ( ) . add ( sumbj ) ; / / 添加下级分组
bjlxEfg . getChildren ( ) . add ( sumlx ) ; / / 添加下级分组
columns . add ( bjlxEfg ) ;
/ / 添加本年已归还利息行且合计
yghlx . setSummary ( 1 ) ;
columns . add ( yghlx ) ;
/ / 添加金额行且合计
amt . setSummary ( 1 ) ;
columns . add ( amt ) ;