|
|
@@ -2833,62 +2833,71 @@
|
|
|
</select>
|
|
|
|
|
|
<select id="queryPrivateCar" resultType="com.ydtech.modules.admin.model.report.financialReceivables.FinancialReceivablesVo">
|
|
|
- SELECT
|
|
|
+ SELECT
|
|
|
a.subSigndate as "yearAndMonth",
|
|
|
a.allAmount as "commissionFeevalue",
|
|
|
IFNULL(c.settAmountOther,0) +IFNULL(b.settCommAmount ,0) as "noInvoicCommissionFeevalue",
|
|
|
- IFNULL(b.remainingAmount,0) +IFNULL(c.invoicNotOther,0) as "settlementAmount",
|
|
|
- (a.allAmount-(IFNULL(b.invoicComm,0) + IFNULL(c.otherInvoic,0))) as "noSettlementAmount",
|
|
|
- a.allAmount-(IFNULL(c.settAmountOther,0) +IFNULL(b.settCommAmount ,0)) as "readyCommissionFeevalue"
|
|
|
- FROM
|
|
|
+ IFNULL(a.allInvoicCommissionFeevalue,0) - IFNULL( b.settCommAmount,0) + ifnull(c.invoicNotOther,0) as "settlementAmount",
|
|
|
+ a.allAmount -(
|
|
|
+ IFNULL( c.settAmountOther, 0 ) + IFNULL( b.settCommAmount, 0 )) - (IFNULL( a.allInvoicCommissionFeevalue, 0 ) - IFNULL( b.settCommAmount, 0 )) AS "readyCommissionFeevalue",
|
|
|
+ a.allAmount-(IFNULL(c.settAmountOther,0) +IFNULL(b.settCommAmount ,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.isNotCar !=null and vo.isNotCar !=''">
|
|
|
- and a.is_not_car =#{vo.isNotCar}
|
|
|
- </if>
|
|
|
- <if test="vo.year !=null and vo.year !=''">
|
|
|
- and YEAR(a.signdate) =#{vo.year}
|
|
|
- </if>
|
|
|
- </where>
|
|
|
- GROUP BY
|
|
|
- DATE_FORMAT( a.signdate, '%Y-%m' )
|
|
|
+ SELECT
|
|
|
+ DATE_FORMAT( a.signdate, '%Y-%m' ) AS subSigndate,
|
|
|
+ SUM( CASE WHEN a.handling_fees_status != '0' AND a.task_id IS NOT NULL THEN IFNULL( a.commission_feevalue, 0 ) ELSE 0 END ) AS "allInvoicCommissionFeevalue",
|
|
|
+ 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>
|
|
|
+ <if test="vo.isNotCar !=null and vo.isNotCar !=''">
|
|
|
+ and a.is_not_car =#{vo.isNotCar}
|
|
|
+ </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>
|
|
|
- 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' )
|
|
|
+ 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>
|
|
|
+ <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'
|
|
|
+ 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>
|
|
|
<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' )
|
|
|
+ </where>
|
|
|
+ GROUP BY DATE_FORMAT( a.signing_time, '%Y-%m' )
|
|
|
) c on c.subSigndate=a.subSigndate
|
|
|
- order by a.subSigndate
|
|
|
+ ORDER BY a.subSigndate
|
|
|
</select>
|
|
|
|
|
|
<select id="getProfitAnalysisQueryList" resultType="com.ydtech.modules.admin.model.report.profitAnalysis.ProfitAnalysisDto">
|
|
|
@@ -3011,6 +3020,7 @@
|
|
|
FROM
|
|
|
inv_account_operate a
|
|
|
left join (
|
|
|
+
|
|
|
select a.category as "aCategory",b. category as "bCategory",a.expenditure_details as "expenditureDetails"
|
|
|
from inv_account_expenses a
|
|
|
left join inv_account_expenses b on a.parent_id =b.expenses_id
|