|
|
@@ -2454,8 +2454,8 @@
|
|
|
<if test="vo.isNotCar !=null and vo.isNotCar !=''">
|
|
|
and a.is_not_car =#{vo.isNotCar}
|
|
|
</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 test="vo.year !=null and vo.year !=''">
|
|
|
+ and DATE_FORMAT( a.signdate, '%Y' ) =#{vo.year}
|
|
|
</if>
|
|
|
</where>
|
|
|
</select>
|
|
|
@@ -2477,8 +2477,12 @@
|
|
|
FROM
|
|
|
ins_ply_income a
|
|
|
LEFT JOIN ptl_agreement pa ON pa.id = a.agreement_id
|
|
|
- WHERE
|
|
|
+ <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
|
|
|
@@ -2490,6 +2494,11 @@
|
|
|
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
|
|
|
@@ -2497,8 +2506,13 @@
|
|
|
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'
|
|
|
+ <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
|
|
|
</select>
|
|
|
@@ -2847,23 +2861,23 @@
|
|
|
</select>
|
|
|
<select id="getProfitAnalysisQueryList" resultType="com.ydtech.modules.admin.model.report.profitAnalysis.ProfitAnalysisDto">
|
|
|
SELECT
|
|
|
- a.signingTime as "signingTime",
|
|
|
- a.sumpremium as "sumpremium",
|
|
|
- b.allAmount as "sumcount",
|
|
|
- d.settlement as "meet",
|
|
|
- c.ActualPayment as "paid",
|
|
|
- ifnull(d.settlement,0) - IFNULL(c.ActualPayment,0) as "unpaid",
|
|
|
- IFNULL( b.allAmount,0)- IFNULL (d.settlement,0) as "grossProfit",
|
|
|
- e.applyAmount as "laborCost",
|
|
|
- f.applyAmount as "fixedCost",
|
|
|
- j.applyAmount as "variableCost",
|
|
|
+ a.signingTime as "yearAndMonth",
|
|
|
+ IFNULL(a.sumpremium,0) as "sumpremium",
|
|
|
+ IFNULL(b.allAmount,0) as "sumcount",
|
|
|
+ IFNULL(d.settlement,0) as "meet",
|
|
|
+ IFNULL(c.actualPayment,0) as "paid",
|
|
|
+ ifnull(d.settlement,0) - IFNULL(c.actualPayment,0) as "unpaid",
|
|
|
+ IFNULL(b.allAmount,0)- IFNULL (d.settlement,0) as "grossProfit",
|
|
|
+ IFNULL(e.applyAmount,0) as "laborCost",
|
|
|
+ IFNULL(f.applyAmount,0) as "fixedCost",
|
|
|
+ IFNULL(j.applyAmount,0) as "variableCost",
|
|
|
(IFNULL (b.allAmount,0) - IFNULL(d.settlement,0) ) -( IFNULL(e.applyAmount,0) + IFNULL(f.applyAmount,0) + IFNULL(j.applyAmount,0) ) as "operatingProfit",
|
|
|
- g.applyAmount as "税费",
|
|
|
+ IFNULL(g.applyAmount,0) as "taxation",
|
|
|
(IFNULL(b.allAmount,0)- IFNULL(d.settlement,0) ) -( IFNULL(e.applyAmount,0) + IFNULL(f.applyAmount,0) + IFNULL(j.applyAmount,0) ) - IFNULL(g.applyAmount,0) as "netProfit"
|
|
|
FROM
|
|
|
(
|
|
|
SELECT
|
|
|
- sum( iac.sumpremium ) as "sumpremium",
|
|
|
+ IFNULL(sum( iac.jqpremium ),0) +IFNULL(sum( iac.sypremium ),0) + IFNULL(sum(iac.jypremium),0) as "sumpremium",
|
|
|
DATE_FORMAT( iac.signing_time, '%Y-%m' ) AS "signingTime"
|
|
|
FROM
|
|
|
`ins_fee_audit` ifa
|
|
|
@@ -2876,7 +2890,7 @@
|
|
|
) a
|
|
|
LEFT JOIN (
|
|
|
SELECT
|
|
|
- sum( ipi.commission_feevalue +ipi.other_feevalue ) as "allAmount",
|
|
|
+ sum( ipi.commission_feevalue) + sum(ipi.other_feevalue ) as "allAmount",
|
|
|
DATE_FORMAT( ipi.signdate, '%Y-%m' ) AS "signingTime"
|
|
|
FROM
|
|
|
ins_ply_income ipi
|
|
|
@@ -2885,7 +2899,7 @@
|
|
|
) b ON a.signingTime = b.signingTime
|
|
|
left join (
|
|
|
select
|
|
|
- sum(a.amount) as "ActualPayment",DATE_FORMAT( a.auditing_time, '%Y-%m' ) as "auditingTime"
|
|
|
+ sum(a.amount) as "actualPayment",DATE_FORMAT( a.auditing_time, '%Y-%m' ) as "auditingTime"
|
|
|
from sys_amount_auditing a
|
|
|
left join sys_user_account_history b on a.id = b.auditiing_id
|
|
|
left join sys_user su on su.id =a.user_id
|
|
|
@@ -2910,7 +2924,7 @@
|
|
|
) d on d.signingTime =a.signingTime
|
|
|
left join (
|
|
|
SELECT
|
|
|
- sum(apply_amount) as "applyAmount",
|
|
|
+ sum( CAST(a.apply_amount AS DECIMAL(10, 2))) as "applyAmount",
|
|
|
DATE_FORMAT( a.create_time, '%Y-%m' ) as "createTime",
|
|
|
b.expenditureDetails
|
|
|
FROM
|
|
|
@@ -2938,7 +2952,7 @@
|
|
|
) e on e.createTime =a.signingTime
|
|
|
left join (
|
|
|
SELECT
|
|
|
- sum(apply_amount) as "applyAmount",
|
|
|
+ sum( CAST(a.apply_amount AS DECIMAL(10, 2))) as "applyAmount",
|
|
|
DATE_FORMAT( a.create_time, '%Y-%m' ) as "createTime",
|
|
|
b.expenditureDetails
|
|
|
FROM
|
|
|
@@ -2966,7 +2980,7 @@
|
|
|
) f on f.createTime =a.signingTime
|
|
|
left join (
|
|
|
SELECT
|
|
|
- sum(apply_amount) as "applyAmount",
|
|
|
+ sum( CAST(a.apply_amount AS DECIMAL(10, 2))) as "applyAmount",
|
|
|
DATE_FORMAT( a.create_time, '%Y-%m' ) as "createTime",
|
|
|
b.expenditureDetails
|
|
|
FROM
|
|
|
@@ -2994,7 +3008,7 @@
|
|
|
) j on j.createTime =a.signingTime
|
|
|
left join (
|
|
|
SELECT
|
|
|
- sum(apply_amount) as "applyAmount",
|
|
|
+ sum( CAST(a.apply_amount AS DECIMAL(10, 2))) as "applyAmount",
|
|
|
DATE_FORMAT( a.create_time, '%Y-%m' ) as "createTime",
|
|
|
b.expenditureDetails
|
|
|
FROM
|
|
|
@@ -3064,21 +3078,37 @@
|
|
|
DATE_FORMAT(a.signdate, '%Y-%m') as "signingTime"
|
|
|
FROM ins_ply_income a
|
|
|
LEFT JOIN ptl_agreement pa ON pa.id = a.agreement_id
|
|
|
- WHERE pa.agreement_type = '1'
|
|
|
+ <where>
|
|
|
+ pa.agreement_type = '1'
|
|
|
+ <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 sum(a.commission_feevalue) + sum(a.other_feevalue) AS "notInvoicAmount",
|
|
|
DATE_FORMAT(a.signdate, '%Y-%m') as "signingTime"
|
|
|
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'
|
|
|
+ <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>
|
|
|
GROUP BY DATE_FORMAT(a.signdate, '%Y-%m')) b on a.signingTime = b.signingTime
|
|
|
left join (SELECT sum(a.commission_feevalue) + sum(a.other_feevalue) AS "settAmount",
|
|
|
DATE_FORMAT(a.signdate, '%Y-%m') as "signingTime"
|
|
|
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 = '1'
|
|
|
+ <where>
|
|
|
+ pa.agreement_type = '1'
|
|
|
+ and a.handling_fees_status = '1'
|
|
|
+ <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')) c on c.signingTime = a.signingTime
|
|
|
</select>
|
|
|
<select id="getPatherId" resultType="com.ydtech.modules.admin.model.report.financialReceivables.FinancialReceivablesMonthVo">
|