|
|
@@ -2454,23 +2454,58 @@
|
|
|
</select>
|
|
|
|
|
|
<select id="queryDateByTypeSumAmount" resultType="java.math.BigDecimal">
|
|
|
+ select
|
|
|
+ IFNULL( sum(a.readyCommissionFeevalue),0) as "noSettlementAmount"
|
|
|
+ from (
|
|
|
SELECT
|
|
|
- SUM(IFNULL(a.commission_feevalue ,0 ) + IFNULL(a.other_feevalue ,0 ))
|
|
|
+ a.allAmount-(IFNULL(c.settAmountOther,0) +IFNULL(b.settCommAmount ,0)) as "readyCommissionFeevalue"
|
|
|
+ FROM
|
|
|
+ (
|
|
|
+ SELECT
|
|
|
+ DATE_FORMAT( a.signdate, '%Y-%m' ) AS subSigndate,
|
|
|
+ IFNULL( sum( a.commission_feevalue ), 0 ) + IFNULL( sum( a.other_feevalue ), 0 ) AS "allAmount"
|
|
|
FROM
|
|
|
ins_ply_income a
|
|
|
- LEFT JOIN
|
|
|
- ptl_agreement pa ON pa.id = a.agreement_id
|
|
|
+ LEFT JOIN ptl_agreement pa ON pa.id = a.agreement_id
|
|
|
<where>
|
|
|
- <if test="vo.type !=null and vo.type !=''">
|
|
|
- and pa.agreement_type =#{vo.type}
|
|
|
- </if>
|
|
|
+ pa.agreement_type = '2'
|
|
|
<if test="vo.isNotCar !=null and vo.isNotCar !=''">
|
|
|
and a.is_not_car =#{vo.isNotCar}
|
|
|
</if>
|
|
|
- <if test="vo.year !=null and vo.year !=''">
|
|
|
- and DATE_FORMAT( a.signdate, '%Y' ) =#{vo.year}
|
|
|
+ </where>
|
|
|
+ GROUP BY
|
|
|
+ DATE_FORMAT( a.signdate, '%Y-%m' )
|
|
|
+ ) a
|
|
|
+ LEFT JOIN (
|
|
|
+ SELECT
|
|
|
+ DATE_FORMAT( a.signing_time, '%Y-%m' ) AS "subSigndate",
|
|
|
+ sum( a.settlement_amount ) AS "settCommAmount",
|
|
|
+ sum(a.remaining_amount) as "remainingAmount",
|
|
|
+ sum(a.total_amount) as "invoicComm"
|
|
|
+ FROM
|
|
|
+ sys_insurance_handling_settlement_month a
|
|
|
+ <where>
|
|
|
+ 1=1
|
|
|
+ <if test="vo.isNotCar !=null and vo.isNotCar !=''">
|
|
|
+ and a.is_not_car =#{vo.isNotCar}
|
|
|
</if>
|
|
|
</where>
|
|
|
+ GROUP BY
|
|
|
+ DATE_FORMAT( a.signing_time, '%Y-%m' )
|
|
|
+ ) b ON a.subSigndate = b.subSigndate
|
|
|
+ left join (
|
|
|
+ select DATE_FORMAT( a.signing_time, '%Y-%m' ) as "subSigndate" , sum(settlement_amount) as "otherInvoic", sum(invoiced_settled_amount) as "settAmountOther", sum(Invoiced_not_settled_amount) as "invoicNotOther"
|
|
|
+ from
|
|
|
+ settlement_documentary_fees a
|
|
|
+ where a.settlement_status='1'
|
|
|
+ and handling_fees_status ='1'
|
|
|
+ <if test="vo.isNotCar !=null and vo.isNotCar !=''">
|
|
|
+ and a.is_not_car =#{vo.isNotCar}
|
|
|
+ </if>
|
|
|
+ GROUP BY DATE_FORMAT( a.signing_time, '%Y-%m' )
|
|
|
+ ) c on c.subSigndate=a.subSigndate
|
|
|
+ order by a.subSigndate
|
|
|
+ ) a
|
|
|
</select>
|
|
|
|
|
|
<select id="queryDateByType"
|
|
|
@@ -3459,4 +3494,80 @@
|
|
|
pa.docking_person
|
|
|
order by sum( a.all_fee_value ) - sum(case when a.handling_fees_status =1 then a.all_fee_value else 0 end) desc
|
|
|
</select>
|
|
|
+
|
|
|
+
|
|
|
+ <select id="queryDateByNotTypeSumAmount" resultType="java.math.BigDecimal">
|
|
|
+ select IFNULL(sum(a.noSettlementAmount),0) as "sySumAmount"
|
|
|
+ from (
|
|
|
+ SELECT
|
|
|
+ (a.allAmount-(IFNULL(b.invoicComm,0) + IFNULL(c.otherInvoic,0))) as "noSettlementAmount"
|
|
|
+ FROM
|
|
|
+ (
|
|
|
+ SELECT
|
|
|
+ DATE_FORMAT( a.signdate, '%Y-%m' ) AS subSigndate,
|
|
|
+ IFNULL( sum( a.commission_feevalue ), 0 ) + IFNULL( sum( a.other_feevalue ), 0 ) AS "allAmount"
|
|
|
+ FROM
|
|
|
+ ins_ply_income a
|
|
|
+ LEFT JOIN ptl_agreement pa ON pa.id = a.agreement_id
|
|
|
+ <where>
|
|
|
+ pa.agreement_type = '2'
|
|
|
+ <if test="vo.year !=null and vo.year !=''">
|
|
|
+ and DATE_FORMAT( a.signdate, '%Y' ) =#{vo.year}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ GROUP BY
|
|
|
+ DATE_FORMAT( a.signdate, '%Y-%m' )
|
|
|
+ ) a
|
|
|
+ LEFT JOIN (
|
|
|
+ SELECT
|
|
|
+ DATE_FORMAT( a.signing_time, '%Y-%m' ) AS "subSigndate",
|
|
|
+ sum( a.settlement_amount ) AS "settCommAmount",
|
|
|
+ sum(a.remaining_amount) as "remainingAmount",
|
|
|
+ sum(a.total_amount) as "invoicComm"
|
|
|
+ FROM
|
|
|
+ sys_insurance_handling_settlement_month a
|
|
|
+ <where>
|
|
|
+ <if test="vo.year !=null and vo.year !=''">
|
|
|
+ DATE_FORMAT( a.signing_time, '%Y' ) =#{vo.year}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ GROUP BY
|
|
|
+ DATE_FORMAT( a.signing_time, '%Y-%m' )
|
|
|
+ ) b ON a.subSigndate = b.subSigndate
|
|
|
+ left join (
|
|
|
+ select DATE_FORMAT( a.signing_time, '%Y-%m' ) as "subSigndate" , sum(settlement_amount) as "otherInvoic", sum(invoiced_settled_amount) as "settAmountOther", sum(Invoiced_not_settled_amount) as "invoicNotOther"
|
|
|
+ from
|
|
|
+ settlement_documentary_fees a
|
|
|
+ <where>
|
|
|
+ a.settlement_status='1'
|
|
|
+ and handling_fees_status ='1'
|
|
|
+ <if test="vo.year !=null and vo.year !=''">
|
|
|
+ and DATE_FORMAT( a.signing_time, '%Y' ) =#{vo.year}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ GROUP BY DATE_FORMAT( a.signing_time, '%Y-%m' )
|
|
|
+ ) c on c.subSigndate=a.subSigndate
|
|
|
+ ORDER BY a.subSigndate
|
|
|
+ ) a
|
|
|
+ </select>
|
|
|
+
|
|
|
+
|
|
|
+ <select id="queryDateByTypeNotSumAmount" resultType="java.math.BigDecimal">
|
|
|
+ SELECT
|
|
|
+ IFNULL(a.notInvoicAmount, 0) as "noSettlementAmount"
|
|
|
+ FROM (
|
|
|
+ SELECT sum(a.commission_feevalue) + sum(a.other_feevalue) AS "notInvoicAmount"
|
|
|
+ FROM ins_ply_income a
|
|
|
+ LEFT JOIN ptl_agreement pa ON pa.id = a.agreement_id
|
|
|
+ <where>
|
|
|
+ pa.agreement_type = '1'
|
|
|
+ and a.handling_fees_status = '0'
|
|
|
+ <if test="vo.year !=null and vo.year !=''">
|
|
|
+ and DATE_FORMAT( a.signdate, '%Y' ) =#{vo.year}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ ) a
|
|
|
+
|
|
|
+
|
|
|
+ </select>
|
|
|
</mapper>
|