From 611d3461275baf0c2073eb1c9267ceec3de98155 Mon Sep 17 00:00:00 2001 From: yangkunan Date: Sat, 14 Dec 2024 17:18:06 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=BA=E5=8A=9B=E6=88=90=E6=9C=AC=E5=8F=96?= =?UTF-8?q?=E5=80=BC=E4=BC=98=E5=8C=96+=E5=95=86=E5=86=99=E7=89=87?= =?UTF-8?q?=E5=8C=BA=E5=BD=92=E7=B1=BB=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- finereport/kanban/mobile/人力_mobile.sql | 21 ++++------ finereport/kanban/pc/人力.sql | 22 ++++------ .../5_manpower/4_人力行政成本费率明细.sql | 42 ++++++++++++------- 3 files changed, 41 insertions(+), 44 deletions(-) diff --git a/finereport/kanban/mobile/人力_mobile.sql b/finereport/kanban/mobile/人力_mobile.sql index 50ab8ca..a490c1c 100644 --- a/finereport/kanban/mobile/人力_mobile.sql +++ b/finereport/kanban/mobile/人力_mobile.sql @@ -247,8 +247,7 @@ FROM SELECT * FROM dw.ods_cost_collection_lc_ac - WHERE left(ym,4) = left('${p_ym}',4) - AND ym <= '${p_ym}' + WHERE ym = '${p_ym}' )A LEFT JOIN ( @@ -808,8 +807,7 @@ coalesce(SUM(CASE WHEN cost_type = '人力成本' THEN actual_amount ELSE 0 END) ,0 AS lc_fee_rate_target -- 人力成本费率 ,0 AS ac_fee_rate_target -- 行政成本费率 from dw.ods_cost_collection_lc_ac -WHERE left(ym,4) = left('${p_ym}',4) - AND ym <= '${p_ym}' +WHERE ym = '${p_ym}' UNION ALL SELECT 0 AS lc_fee_rate @@ -847,8 +845,7 @@ SELECT ,coalesce(SUM(CASE WHEN cost_type = '人力成本' THEN actual_amount ELSE 0 END),0) AS lc_total_fee -- 人力成本费用 ,coalesce(SUM(CASE WHEN cost_type = '行政成本' THEN actual_amount ELSE 0 END),0) AS ac_total_fee -- 行政成本费用 from dw.ods_cost_collection_lc_ac - WHERE left(ym,4) = left('${p_ym}',4) - AND ym <= '${p_ym}' + WHERE ym = '${p_ym}' GROUP BY organ_code )A LEFT JOIN @@ -2036,8 +2033,7 @@ SELECT ,coalesce(SUM(CASE WHEN cost_type = '人力成本' THEN actual_amount ELSE 0 END),0) AS lc_total_fee -- 人力成本费用 ,coalesce(SUM(CASE WHEN cost_type = '行政成本' THEN actual_amount ELSE 0 END),0) AS ac_total_fee -- 行政成本费用 from dw.ods_cost_collection_lc_ac - WHERE left(ym,4) = left('${p_ym}',4) - AND ym <= '${p_ym}' + WHERE ym = '${p_ym}' ${IF(LEN(p_area)>0," AND A.organ_code IN ('"+JOINARRAY(p_area,"','")+"')", "")} GROUP BY organ_code,organ_name )A @@ -2085,8 +2081,7 @@ SELECT ,coalesce(SUM(CASE WHEN cost_type = '人力成本' THEN actual_amount ELSE 0 END),0) AS lc_total_fee -- 人力成本费用 ,coalesce(SUM(CASE WHEN cost_type = '行政成本' THEN actual_amount ELSE 0 END),0) AS ac_total_fee -- 行政成本费用 from dw.ods_cost_collection_lc_ac - WHERE left(ym,4) = left('${p_ym}',4) - AND ym <= '${p_ym}' + WHERE ym = '${p_ym}' ${IF(LEN(p_area)>0," AND A.organ_code IN ('"+JOINARRAY(p_area,"','")+"')", "")} GROUP BY organ_code,organ_name )A @@ -2153,8 +2148,7 @@ FROM , COALESCE(SUM(CASE WHEN cost_type = '行政成本' THEN actual_amount ELSE 0 END), 0) AS ac_total_fee -- 行政成本费用 FROM dw.ods_cost_collection_lc_ac - WHERE LEFT(ym, 4) = LEFT('${p_ym}', 4) - AND ym <= '${p_ym}' + WHERE ym = '${p_ym}' GROUP BY organ_code, comm_id, comm_name )A1 LEFT JOIN @@ -2266,8 +2260,7 @@ FROM , COALESCE(SUM(CASE WHEN cost_type = '行政成本' THEN actual_amount ELSE 0 END), 0) AS ac_total_fee -- 行政成本费用 FROM dw.ods_cost_collection_lc_ac - WHERE LEFT(ym, 4) = LEFT('${p_ym}', 4) - AND ym <= '${p_ym}' + WHERE ym = '${p_ym}' GROUP BY organ_code, comm_id, comm_name )A1 LEFT JOIN diff --git a/finereport/kanban/pc/人力.sql b/finereport/kanban/pc/人力.sql index fcb1060..baeae7f 100644 --- a/finereport/kanban/pc/人力.sql +++ b/finereport/kanban/pc/人力.sql @@ -338,8 +338,8 @@ FROM SELECT * FROM dw.ods_cost_collection_lc_ac - WHERE left(ym,4) = left('${p_ym}',4) - AND ym <= '${p_ym}' + WHERE ym = '${p_ym}' + )A LEFT JOIN ( @@ -1184,8 +1184,7 @@ SELECT ,coalesce(SUM(CASE WHEN cost_type = '人力成本' THEN actual_amount ELSE 0 END),0) AS lc_total_fee -- 人力成本费用 ,coalesce(SUM(CASE WHEN cost_type = '行政成本' THEN actual_amount ELSE 0 END),0) AS ac_total_fee -- 行政成本费用 from dw.ods_cost_collection_lc_ac - WHERE left(ym,4) = left('${p_ym}',4) - AND ym <= '${p_ym}' + WHERE ym = '${p_ym}' ${IF(LEN(p_area)>0," AND A.organ_code IN ('"+JOINARRAY(p_area,"','")+"')", "")} GROUP BY organ_code,organ_name )A @@ -1241,8 +1240,7 @@ SELECT ,coalesce(SUM(CASE WHEN cost_type = '人力成本' THEN actual_amount ELSE 0 END),0) AS lc_total_fee -- 人力成本费用 ,coalesce(SUM(CASE WHEN cost_type = '行政成本' THEN actual_amount ELSE 0 END),0) AS ac_total_fee -- 行政成本费用 from dw.ods_cost_collection_lc_ac - WHERE left(ym,4) = left('${p_ym}',4) - AND ym <= '${p_ym}' + WHERE ym = '${p_ym}' ${IF(LEN(p_area)>0," AND A.organ_code IN ('"+JOINARRAY(p_area,"','")+"')", "")} GROUP BY organ_code,organ_name )A @@ -1318,8 +1316,7 @@ FROM , COALESCE(SUM(CASE WHEN cost_type = '行政成本' THEN actual_amount ELSE 0 END), 0) AS ac_total_fee -- 行政成本费用 FROM dw.ods_cost_collection_lc_ac - WHERE LEFT(ym, 4) = LEFT('${p_ym}', 4) - AND ym <= '${p_ym}' + WHERE ym = '${p_ym}' GROUP BY organ_code, comm_id, comm_name )A1 LEFT JOIN @@ -1441,8 +1438,7 @@ FROM , COALESCE(SUM(CASE WHEN cost_type = '行政成本' THEN actual_amount ELSE 0 END), 0) AS ac_total_fee -- 行政成本费用 FROM dw.ods_cost_collection_lc_ac - WHERE LEFT(ym, 4) = LEFT('${p_ym}', 4) - AND ym <= '${p_ym}' + WHERE ym = '${p_ym}' GROUP BY organ_code, comm_id, comm_name )A1 LEFT JOIN @@ -1992,8 +1988,7 @@ coalesce(SUM(CASE WHEN cost_type = '人力成本' THEN actual_amount ELSE 0 END) ,0 AS lc_fee_rate_target -- 人力成本费率 ,0 AS ac_fee_rate_target -- 行政成本费率 from dw.ods_cost_collection_lc_ac -WHERE left(ym,4) = left('${p_ym}',4) - AND ym <= '${p_ym}' + WHERE ym = '${p_ym}' UNION ALL SELECT 0 AS lc_fee_rate @@ -2031,8 +2026,7 @@ SELECT ,coalesce(SUM(CASE WHEN cost_type = '人力成本' THEN actual_amount ELSE 0 END),0) AS lc_total_fee -- 人力成本费用 ,coalesce(SUM(CASE WHEN cost_type = '行政成本' THEN actual_amount ELSE 0 END),0) AS ac_total_fee -- 行政成本费用 from dw.ods_cost_collection_lc_ac - WHERE left(ym,4) = left('${p_ym}',4) - AND ym <= '${p_ym}' + WHERE ym = '${p_ym}' GROUP BY organ_code )A LEFT JOIN diff --git a/finereport/xiazuan/5_manpower/4_人力行政成本费率明细.sql b/finereport/xiazuan/5_manpower/4_人力行政成本费率明细.sql index 9b8a1ae..73b9c07 100644 --- a/finereport/xiazuan/5_manpower/4_人力行政成本费率明细.sql +++ b/finereport/xiazuan/5_manpower/4_人力行政成本费率明细.sql @@ -205,16 +205,18 @@ SELECT FROM ( SELECT - organ_code + CASE WHEN organ_code = '5501' THEN '0000' ELSE organ_code end AS organ_code ,SUM(index_market_target) AS index_market_target -- 收入目标值 ,SUM(index_income_fact) AS index_income_fact -- 实际收入 FROM ods_caiwu_feecollection WHERE category = '物业' - AND organ_code not in('5503','5501') + AND organ_name <> '佳美物业' + AND organ_code not in('5503') AND yr_month >= '${p_ym}' AND yr_month <= '${p_startym}' GROUP BY - organ_code + CASE WHEN organ_code = '5501' THEN '0000' ELSE organ_code end + UNION ALL SELECT '0108' AS organ_code @@ -222,9 +224,10 @@ SELECT ,SUM(index_income_fact) AS index_income_fact -- 实际收入 FROM ods_caiwu_feecollection WHERE category = '物业' + AND organ_name <> '佳美物业' AND yr_month >= '${p_ym}' AND yr_month <= '${p_startym}' - AND organ_code in('5503','5501') -- 集团办公区、集团总部片区归到商写片区 + AND organ_code in('5503') -- 集团办公区、集团总部片区归到商写片区 )t group by organ_code )B @@ -302,6 +305,7 @@ SELECT ,'' AS organ_name -- erp片区名称 ,'153' AS hr_organ_id -- hr片区编码 ,'领悦集团总部' AS hr_organ_name -- hr片区名称 + UNION ALL )A1 ON A.organ_code = A1.organ_code LEFT JOIN @@ -313,16 +317,17 @@ SELECT FROM ( SELECT - organ_code + CASE WHEN organ_code = '5501' THEN '0000' ELSE organ_code end AS organ_code ,SUM(index_market_target) AS index_market_target -- 收入目标值 ,SUM(index_income_fact) AS index_income_fact -- 实际收入 FROM ods_caiwu_feecollection WHERE category = '物业' - AND organ_code not in('5503','5501') + AND organ_name <> '佳美物业' + AND organ_code not in('5503') AND yr_month >= '${p_ym}' AND yr_month <= '${p_startym}' GROUP BY - organ_code + CASE WHEN organ_code = '5501' THEN '0000' ELSE organ_code end UNION ALL SELECT '0108' AS organ_code @@ -330,9 +335,10 @@ SELECT ,SUM(index_income_fact) AS index_income_fact -- 实际收入 FROM ods_caiwu_feecollection WHERE category = '物业' + AND organ_name <> '佳美物业' AND yr_month >= '${p_ym}' AND yr_month <= '${p_startym}' - AND organ_code in('5503','5501') -- 集团办公区、集团总部片区归到商写片区 + AND organ_code in('5503') -- 集团办公区归到商写片区 )t group by organ_code )B @@ -444,17 +450,18 @@ SELECT FROM ( SELECT - organ_code + CASE WHEN organ_code = '5501' THEN '0000' ELSE organ_code end AS organ_code ,comm_id ,SUM(index_market_target) AS index_market_target -- 收入目标值 ,SUM(index_income_fact) AS index_income_fact -- 实际收入 FROM ods_caiwu_feecollection WHERE category = '物业' - AND organ_code not in('5503','5501') + AND organ_name <> '佳美物业' + AND organ_code not in('5503') AND yr_month >= '${p_ym}' AND yr_month <= '${p_startym}' GROUP BY - organ_code,comm_id + CASE WHEN organ_code = '5501' THEN '0000' ELSE organ_code end,comm_id UNION ALL SELECT '0108' AS organ_code -- 商写片区 @@ -463,9 +470,10 @@ SELECT ,SUM(index_income_fact) AS index_income_fact -- 实际收入 FROM ods_caiwu_feecollection WHERE category = '物业' + AND organ_name <> '佳美物业' AND yr_month >= '${p_ym}' AND yr_month <= '${p_startym}' - AND organ_code in('5503','5501') -- 集团办公区、集团总部片区归到商写片区 + AND organ_code in('5503') -- 集团办公区、集团总部片区归到商写片区 )t group by organ_code ,comm_id )B @@ -589,17 +597,18 @@ SELECT FROM ( SELECT - organ_code + CASE WHEN organ_code = '5501' THEN '0000' ELSE organ_code end AS organ_code ,comm_id ,SUM(index_market_target) AS index_market_target -- 收入目标值 ,SUM(index_income_fact) AS index_income_fact -- 实际收入 FROM ods_caiwu_feecollection WHERE category = '物业' + AND organ_name <> '佳美物业' AND yr_month >= '${p_ym}' AND yr_month <= '${p_startym}' - AND organ_code not in('5503','5501') + AND organ_code not in('5503') GROUP BY - organ_code,comm_id + CASE WHEN organ_code = '5501' THEN '0000' ELSE organ_code end,comm_id UNION ALL SELECT '0108' AS organ_code -- 商写片区 @@ -608,9 +617,10 @@ SELECT ,SUM(index_income_fact) AS index_income_fact -- 实际收入 FROM ods_caiwu_feecollection WHERE category = '物业' + AND organ_name <> '佳美物业' AND yr_month >= '${p_ym}' AND yr_month <= '${p_startym}' - AND organ_code in('5503','5501') -- 集团办公区、集团总部片区归到商写片区 + AND organ_code in('5503') -- 集团办公区、集团总部片区归到商写片区 )t group by organ_code ,comm_id )B