|
@@ -210,18 +210,18 @@
|
|
|
where #{month} BETWEEN DATE_FORMAT(orc.start_date_,'%Y-%m') AND DATE_FORMAT(orc.end_date_,'%Y-%m') AND orc.cloud_price_ > 0 AND orc.start_date_ IS NOT NULL;
|
|
|
</select>
|
|
|
<select id="sumRefundAmount" resultType="java.util.Map">
|
|
|
- select organ_id_ 'key',SUM(amount_) 'value' from financial_expenditure where process_id_ IN (19,22,23,28,51) AND fee_project_ = 19
|
|
|
+ select organ_id_ 'key',SUM(current_amount_) 'value' from financial_expenditure where process_id_ IN (19,22,23,28,51) AND fee_project_ = 19
|
|
|
AND effective_time_ = #{month} AND amount_ > 0 and del_flag_ = 0 group by organ_id_;
|
|
|
</select>
|
|
|
<select id="sumVariableCosts" resultType="java.util.Map">
|
|
|
- select fe.organ_id_ 'key',SUM(amount_) 'value' from financial_expenditure fe
|
|
|
+ select fe.organ_id_ 'key',SUM(current_amount_) 'value' from financial_expenditure fe
|
|
|
where effective_time_ = #{month} AND amount_ > 0 and del_flag_ = 0
|
|
|
- AND fee_project_ BETWEEN 6 AND 21 AND process_id_ IN (19,22,23,28,51) group by fe.organ_id_;
|
|
|
+ AND fee_project_ IN (6,7,8,9,10,11,12,15,16,17,20,21) AND process_id_ IN (19,22,23,28,51) group by fe.organ_id_;
|
|
|
</select>
|
|
|
<select id="sumFixedCosts" resultType="java.util.Map">
|
|
|
- select fe.organ_id_ 'key',SUM(amount_) 'value' from financial_expenditure fe
|
|
|
+ select fe.organ_id_ 'key',SUM(current_amount_) 'value' from financial_expenditure fe
|
|
|
where effective_time_ = #{month} AND amount_ > 0 and del_flag_ = 0
|
|
|
- AND fee_project_ IN (1,2,3,4,5) AND process_id_ IN (19,22,23,28,51) group by fe.organ_id_;
|
|
|
+ AND fee_project_ IN (3,4,5) AND process_id_ IN (19,22,23,28,51) group by fe.organ_id_;
|
|
|
</select>
|
|
|
<select id="sumCloudPreAmount" resultType="java.util.Map">
|
|
|
select cto.organ_id_ 'key',TRUNCATE(SUM(operating_amount_ / (TIMESTAMPDIFF(DAY,cto.start_time_,cto.end_time_) + 1) *
|
|
@@ -372,16 +372,21 @@
|
|
|
SUM(CASE WHEN fee_project_ = 17 THEN fe.current_amount_ ELSE 0 END) AS hospitality,
|
|
|
SUM(CASE WHEN fee_project_ = 19 THEN fe.current_amount_ ELSE 0 END) AS refund,
|
|
|
SUM(CASE WHEN fee_project_ = 26 THEN fe.current_amount_ ELSE 0 END) AS other,
|
|
|
- SUM(CASE WHEN hc.human_cost_type_ = 'FIXED' THEN hc.amount_ ELSE 0 END) AS fixedHumanCost,
|
|
|
- SUM(CASE WHEN hc.human_cost_type_ = 'VARIABLE' THEN hc.amount_ ELSE 0 END) AS variableHumanCost,
|
|
|
- SUM(CASE WHEN hc.human_cost_type_ = 'NETWORK_CLASSROOM' THEN hc.amount_ ELSE 0 END) AS network,
|
|
|
- SUM(CASE WHEN hc.human_cost_type_ = 'CLOUD_COACHING_COST' THEN hc.amount_ ELSE 0 END) AS cloudCoachingCost,
|
|
|
- SUM(CASE WHEN hc.human_cost_type_ = 'INTERNAL_SETTLEMENT' THEN hc.amount_ ELSE 0 END) AS internalSettlement,
|
|
|
- SUM(CASE WHEN hc.human_cost_type_ = 'STUDENT_MANAGEMENT_FEE_ADJUSTMENT' THEN hc.amount_ ELSE 0 END) AS studentManagementFeeAdjustment
|
|
|
+ hc.fixedHumanCost,hc.fixedHumanCost, hc.variableHumanCost, hc.network, hc.cloudCoachingCost, hc.internalSettlement, hc.studentManagementFeeAdjustment
|
|
|
FROM
|
|
|
organization o
|
|
|
left join financial_expenditure fe ON o.id_ = fe.organ_id_ AND fe.process_id_ IN (19,22,23,28,51) AND fe.fee_project_ NOT IN (1,2,13,14) AND effective_time_= #{month} AND fe.del_flag_ = 0
|
|
|
- left join human_cost hc ON hc.organ_id_ = o.id_ AND hc.month_ = #{month}
|
|
|
+ left join (select organ_id_,
|
|
|
+ SUM(CASE WHEN hc.human_cost_type_ = 'FIXED' THEN hc.amount_ ELSE 0 END) AS fixedHumanCost,
|
|
|
+ SUM(CASE WHEN hc.human_cost_type_ = 'VARIABLE' THEN hc.amount_ ELSE 0 END) AS variableHumanCost,
|
|
|
+ SUM(CASE WHEN hc.human_cost_type_ = 'NETWORK_CLASSROOM' THEN hc.amount_ ELSE 0 END) AS network,
|
|
|
+ SUM(CASE WHEN hc.human_cost_type_ = 'CLOUD_COACHING_COST' THEN hc.amount_ ELSE 0 END) AS cloudCoachingCost,
|
|
|
+ SUM(CASE WHEN hc.human_cost_type_ = 'INTERNAL_SETTLEMENT' THEN hc.amount_ ELSE 0 END) AS internalSettlement,
|
|
|
+ SUM(CASE WHEN hc.human_cost_type_ = 'STUDENT_MANAGEMENT_FEE_ADJUSTMENT' THEN hc.amount_ ELSE 0 END) AS studentManagementFeeAdjustment,
|
|
|
+ SUM(CASE WHEN hc.human_cost_type_ = 'TAX' THEN hc.amount_ ELSE 0 END) AS tax,
|
|
|
+ SUM(CASE WHEN hc.human_cost_type_ = 'COMMISSION' THEN hc.amount_ ELSE 0 END) AS commission
|
|
|
+ from human_cost hc where month_ = #{month}
|
|
|
+ group by organ_id_) hc ON hc.organ_id_ = o.id_
|
|
|
WHERE
|
|
|
o.tenant_id_ = 1 AND o.del_flag_ = 0
|
|
|
GROUP BY
|
|
@@ -417,7 +422,9 @@
|
|
|
SUM(CASE WHEN human_cost_type_ = 'NETWORK_CLASSROOM' THEN amount_ ELSE 0 END) AS networkClassroomCost,
|
|
|
SUM(CASE WHEN human_cost_type_ = 'CLOUD_COACHING_COST' THEN amount_ ELSE 0 END) AS cloudCoachingCost,
|
|
|
SUM(CASE WHEN human_cost_type_ = 'INTERNAL_SETTLEMENT' THEN amount_ ELSE 0 END) AS internalSettlement,
|
|
|
- SUM(CASE WHEN human_cost_type_ = 'STUDENT_MANAGEMENT_FEE_ADJUSTMENT' THEN amount_ ELSE 0 END) AS studentManagementFeeAdjustment
|
|
|
+ SUM(CASE WHEN human_cost_type_ = 'STUDENT_MANAGEMENT_FEE_ADJUSTMENT' THEN amount_ ELSE 0 END) AS studentManagementFeeAdjustment,
|
|
|
+ SUM(CASE WHEN human_cost_type_ = 'COMMISSION' THEN amount_ ELSE 0 END) AS commission,
|
|
|
+ SUM(CASE WHEN human_cost_type_ = 'TAX' THEN amount_ ELSE 0 END) AS tax
|
|
|
from human_cost
|
|
|
where month_ = #{month} group by organ_id_
|
|
|
</select>
|