|
@@ -2462,54 +2462,47 @@
|
|
|
|
|
|
|
|
<select id="queryDateByType"
|
|
<select id="queryDateByType"
|
|
|
resultType="com.ydtech.modules.admin.model.report.financialReceivables.FinancialReceivablesVo">
|
|
resultType="com.ydtech.modules.admin.model.report.financialReceivables.FinancialReceivablesVo">
|
|
|
- select
|
|
|
|
|
- a.years as yearAndMonth,
|
|
|
|
|
- a.commissionFeevalue as commissionFeevalue,
|
|
|
|
|
- a.noInvoicCommissionFeevalue as noInvoicCommissionFeevalue,
|
|
|
|
|
- a.readyCommissionFeevalue as readyCommissionFeevalue,
|
|
|
|
|
- ifnull(b.settlementAmount,0) as settlementAmount,
|
|
|
|
|
- ifnull(b.noSettlementAmount,0) as noSettlementAmount
|
|
|
|
|
- from (
|
|
|
|
|
SELECT
|
|
SELECT
|
|
|
- DATE_FORMAT( a.create_time, '%Y-%m' ) as years,
|
|
|
|
|
- SUM(IFNULL(a.commission_feevalue ,0 ) + IFNULL(a.other_feevalue ,0 )) AS commissionFeevalue,
|
|
|
|
|
- SUM(CASE WHEN a.handling_fees_status = '0' THEN IFNULL(a.commission_feevalue ,0 ) + IFNULL(a.other_feevalue ,0 ) ELSE 0 END ) AS noInvoicCommissionFeevalue,
|
|
|
|
|
- SUM(CASE WHEN a.handling_fees_status = '1' THEN IFNULL(a.commission_feevalue ,0 ) + IFNULL(a.other_feevalue ,0 ) ELSE 0 END) AS readyCommissionFeevalue
|
|
|
|
|
|
|
+ a.subSigning as "yearAndMonth",
|
|
|
|
|
+ a.allAmount as "commissionFeevalue",
|
|
|
|
|
+ b.commSettLement +c.otherSettlementAmount as "noInvoicCommissionFeevalue",
|
|
|
|
|
+ a.allAmount-( b.commSettLement +c.otherSettlementAmount) as "readyCommissionFeevalue",
|
|
|
|
|
+ (c.invoicAmount - c.otherSettlementAmount) + (b.remainingAmount) as "settlementAmount"
|
|
|
FROM
|
|
FROM
|
|
|
- ins_ply_income a
|
|
|
|
|
- LEFT JOIN
|
|
|
|
|
- ptl_agreement pa ON pa.id = a.agreement_id
|
|
|
|
|
- <where>
|
|
|
|
|
- 1=1
|
|
|
|
|
- <if test="vo.type !=null and vo.type !=''">
|
|
|
|
|
- and pa.agreement_type =#{vo.type}
|
|
|
|
|
- </if>
|
|
|
|
|
- <if test="vo.beginDate != null and vo.beginDate!='' and vo.endDate != null and vo.endDate!=''">
|
|
|
|
|
- AND a.create_time BETWEEN #{vo.beginDate} AND #{vo.endDate}
|
|
|
|
|
- </if>
|
|
|
|
|
- </where>
|
|
|
|
|
- GROUP BY
|
|
|
|
|
- DATE_FORMAT( a.create_time, '%Y-%m' )
|
|
|
|
|
|
|
+ (
|
|
|
|
|
+ SELECT
|
|
|
|
|
+ sum( a.all_fee_value ) AS "allAmount",
|
|
|
|
|
+ DATE_FORMAT( a.signdate, '%Y-%m' ) AS "subSigning"
|
|
|
|
|
+ FROM
|
|
|
|
|
+ ins_ply_income a
|
|
|
|
|
+ LEFT JOIN ptl_agreement pa ON pa.id = a.agreement_id
|
|
|
|
|
+ WHERE
|
|
|
|
|
+ pa.agreement_type = '2'
|
|
|
|
|
+ GROUP BY
|
|
|
|
|
+ DATE_FORMAT( a.signdate, '%Y-%m' )
|
|
|
|
|
+ ) a left join (
|
|
|
|
|
+ SELECT
|
|
|
|
|
+ sum( a.settlement_amount ) as "commSettLement",
|
|
|
|
|
+ sum( a.remaining_amount ) as "remainingAmount",
|
|
|
|
|
+ DATE_FORMAT( a.signing_time, '%Y-%m' ) as "subSigning"
|
|
|
|
|
+ FROM
|
|
|
|
|
+ sys_insurance_handling_settlement_month a
|
|
|
|
|
+ GROUP BY
|
|
|
|
|
+ DATE_FORMAT( a.signing_time, '%Y-%m' )
|
|
|
|
|
+ ) b on b.subSigning=a.subSigning
|
|
|
|
|
+ left join (
|
|
|
|
|
+ SELECT
|
|
|
|
|
+ SUM( CASE WHEN a.settlement_status = '2' THEN IFNULL( a.settlement_amount, 0 ) ELSE 0 END ) AS "otherSettlementAmount",
|
|
|
|
|
+ SUM( CASE WHEN a.settlement_status = '1' THEN IFNULL( a.settlement_amount, 0 ) ELSE 0 END ) AS "invoicAmount",
|
|
|
|
|
+ DATE_FORMAT( a.signing_time, '%Y-%m' ) AS "subSigning"
|
|
|
|
|
+ FROM
|
|
|
|
|
+ settlement_documentary_fees a
|
|
|
|
|
+ WHERE
|
|
|
|
|
+ a.handling_fees_status = '1'
|
|
|
|
|
+ GROUP BY
|
|
|
|
|
+ DATE_FORMAT( a.signing_time, '%Y-%m' )
|
|
|
|
|
+ ) c on c.subSigning=a.subSigning
|
|
|
|
|
|
|
|
- ) a left join
|
|
|
|
|
- (
|
|
|
|
|
- SELECT
|
|
|
|
|
- DATE_FORMAT( a.create_time, '%Y-%m' ) as years,
|
|
|
|
|
- SUM(IFNULL(a.settlement_amount ,0 )) as settlementAmount,
|
|
|
|
|
- SUM(IFNULL(a.total_amount ,0 ) -IFNULL(a.settlement_amount ,0 ) ) AS noSettlementAmount
|
|
|
|
|
- FROM
|
|
|
|
|
- settlement_documentary_fees a
|
|
|
|
|
- <where>
|
|
|
|
|
- a.settlement_status=2
|
|
|
|
|
- <if test="vo.type !=null and vo.type !=''">
|
|
|
|
|
- and a.agreement_type =#{vo.type}
|
|
|
|
|
- </if>
|
|
|
|
|
- <if test="vo.beginDate != null and vo.beginDate!='' and vo.endDate != null and vo.endDate!=''">
|
|
|
|
|
- AND a.create_time BETWEEN #{vo.beginDate} AND #{vo.endDate}
|
|
|
|
|
- </if>
|
|
|
|
|
- </where>
|
|
|
|
|
- GROUP BY DATE_FORMAT( a.create_time, '%Y-%m' )
|
|
|
|
|
- ) b on a.years =b.years
|
|
|
|
|
</select>
|
|
</select>
|
|
|
|
|
|
|
|
<select id="queryDateByTypeMonthSumAmount" resultType="java.math.BigDecimal">
|
|
<select id="queryDateByTypeMonthSumAmount" resultType="java.math.BigDecimal">
|