收缴下钻数据集更新
This commit is contained in:
parent
3efd8454e1
commit
3283b3a131
@ -27,6 +27,20 @@ where ParentCostCode in ('0001','0007','0008')
|
|||||||
order by ParentCostCode asc
|
order by ParentCostCode asc
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
-- report_多经收缴情况
|
||||||
|
SELECT
|
||||||
|
${if(len(p_area) == 0,"organ_code code, organ_name name,","comm_id code, comm_name name,")}
|
||||||
|
`year_month`, index_type, index_receivable, index_receipts, index_not_receipts, collection_rate, update_user, update_time
|
||||||
|
FROM ods_caiwu_profit
|
||||||
|
where 1=1
|
||||||
|
-- ${if(len(p_area) == 0,"","and organ_code = '" + p_area+ "'")}
|
||||||
|
${IF(LEN(p_area)>0," AND organ_code IN ('"+JOINARRAY(p_area,"','")+"')", "")}
|
||||||
|
${if(len(p_startdate) == 0,"","and `year_month` = '" + replace(p_startdate,"-","") + "'")}
|
||||||
|
${if(left(fine_role,2)=="项目","and comm_name = '"+GETUSERDEPARTMENTS(3)+"'","")}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-- report_收缴率
|
-- report_收缴率
|
||||||
|
|
||||||
|
|
||||||
@ -58,13 +72,12 @@ select * from (
|
|||||||
|
|
||||||
-- report_收缴率目标
|
-- report_收缴率目标
|
||||||
|
|
||||||
|
|
||||||
select
|
select
|
||||||
organ_code code
|
organ_code code
|
||||||
, organ_name name
|
, organ_name name
|
||||||
, ym
|
, ym
|
||||||
, index_dq_target
|
, ${IF(p_feestype = '0001',"index_dq_target",IF(p_feestype = "0007","''","''"))} AS index_dq_target
|
||||||
, index_wq_target
|
, ${IF(p_feestype = '0001',"index_wq_target",IF(p_feestype = "0007","''","''"))} AS index_wq_target
|
||||||
, index_sd_target
|
, index_sd_target
|
||||||
, index_dj_target
|
, index_dj_target
|
||||||
, index_ac_target_dq
|
, index_ac_target_dq
|
||||||
@ -78,8 +91,8 @@ select
|
|||||||
comm_id code
|
comm_id code
|
||||||
, comm_name name
|
, comm_name name
|
||||||
, ym
|
, ym
|
||||||
, index_dq_target
|
, ${IF(p_feestype = '0001',"index_dq_target",IF(p_feestype = "0007","''","''"))} AS index_dq_target
|
||||||
, index_wq_target
|
, ${IF(p_feestype = '0001',"index_wq_target",IF(p_feestype = "0007","''","''"))} AS index_wq_target
|
||||||
, index_sd_target
|
, index_sd_target
|
||||||
, index_dj_target
|
, index_dj_target
|
||||||
, index_ac_target_dq
|
, index_ac_target_dq
|
||||||
@ -88,21 +101,56 @@ select
|
|||||||
from ods_finance_collection_target_project
|
from ods_finance_collection_target_project
|
||||||
where 1=1
|
where 1=1
|
||||||
${if(len(p_startdate) == 0,"","and ym = '" + p_startdate + "'")}
|
${if(len(p_startdate) == 0,"","and ym = '" + p_startdate + "'")}
|
||||||
|
${if(left(fine_role,2)=="项目","and comm_name = '"+GETUSERDEPARTMENTS(3)+"'","")}
|
||||||
|
|
||||||
|
-- report_物业费收缴总目标
|
||||||
|
|
||||||
|
select organ_code, ym, index_dq_target, index_wq_target from ods_finance_collection_target_area where organ_code = '5501'
|
||||||
|
${if(left(fine_role,2)=="项目","and comm_name = '"+GETUSERDEPARTMENTS(3)+"'","")}
|
||||||
|
|
||||||
|
|
||||||
-- report_中科目收缴率
|
-- report_中科目收缴率
|
||||||
|
|
||||||
select
|
select
|
||||||
b.organ_code, b.organ_name, b.comm_id, b.comm_name, ym
|
CostName
|
||||||
${if(len(p_feestype) == 0,", ParentCostCode CostCode, ParentCostName CostName",", MiddleCostCode CostCode, MiddleCostName CostName")}
|
, sum((ifnull(cu_receivable_amt,0) - ifnull(cu_paid_amt,0)) + (ifnull(pr_receivable_amt,0) - ifnull(pr_paid_amt,0))) owed_amt
|
||||||
, (pr_paid_cu_amt + cu_paid_cu_amt + pr_exempt_cu_amt + cu_exempt_cu_amt)/10000 cu_paid_amt
|
from (
|
||||||
, (cu_receivable_amt + pr_exempt_cu_amt + cu_exempt_cu_amt)/10000 cu_receivable_amt
|
select
|
||||||
, (- cu_paid_pr_amt + cu_offset_pr_amt)/10000 pr_paid_amt
|
b.organ_code, b.organ_name, b.comm_id, b.comm_name, ym
|
||||||
, (pr_total_receivable_amt + pr_total_received_amt + cu_early_exempt_pr_amt + cu_exempt_pr_amt)/10000 pr_receivable_amt
|
${if(len(p_feestype) == 0,", ParentCostCode CostCode, ParentCostName CostName",", MiddleCostCode CostCode, MiddleCostName CostName")}
|
||||||
from dwd_finance_fees_serial_d a
|
, (ifnull(pr_paid_cu_amt,0) + ifnull(cu_paid_cu_amt,0) - ifnull(pr_offset_cu_amt,0) - ifnull(cu_offset_cu_amt,0))/10000 cu_paid_amt
|
||||||
inner join (select distinct organ_code, organ_name, comm_id, comm_name from dim_organ_mapping where comm_id is not null) b
|
, (ifnull(cu_receivable_amt,0) + ifnull(pr_exempt_cu_amt,0) + ifnull(cu_exempt_cu_amt,0))/10000 cu_receivable_amt
|
||||||
on a.commid = b.comm_id
|
, (- ifnull(cu_paid_pr_amt,0) - ifnull(cu_offset_pr_amt,0))/10000 pr_paid_amt
|
||||||
|
, (ifnull(pr_total_receivable_amt,0) + ifnull(pr_total_received_amt,0) + ifnull(cu_early_exempt_pr_amt,0) + ifnull(cu_exempt_pr_amt,0))/10000 pr_receivable_amt
|
||||||
|
from dwd_finance_fees_serial_d a
|
||||||
|
left join(
|
||||||
|
select a.CommID comm_id, a.CommName comm_name, b.OrganCode organ_code, b.OrganName organ_name from ods_erp_tb_hspr_community_d a
|
||||||
|
left join (
|
||||||
|
select * from ods_erp_tb_sys_organ_d
|
||||||
|
where length(OrganCode) = 4
|
||||||
|
) b
|
||||||
|
on left(a.OrganCode,4) = b.OrganCode
|
||||||
|
) b
|
||||||
|
on a.commid = b.comm_id
|
||||||
|
where 1=1
|
||||||
|
and ((a.ParentCostCode = '0008' and a.MiddleCostCode in ('00080001','00080002','00080003','00080004','00080005','00080006','00080007','00080008','00080017','00080018','00080019','00080022','00080023','00080024','00080027','00080028','00080032','00080035')) or a.ParentCostCode = '0001')
|
||||||
|
and a.organ_name not in ('东湖商管','领悦总部','演示机构') and a.comm_name not like '%天富%'
|
||||||
|
${if(len(p_startdate) == 0,"","and ym = '" + p_startdate + "'")}
|
||||||
|
${if(len(p_feestype) == 0,"","and ParentCostCode = '" + p_feestype+ "'")}
|
||||||
|
-- ${if(len(p_area) == 0,"","and b.organ_code = '" + p_area+ "'")}
|
||||||
|
${IF(LEN(p_area)>0," AND b.organ_code IN ('"+JOINARRAY(p_area,"','")+"')", "")}
|
||||||
|
${if(left(fine_role,2)=="项目","and a.comm_name = '"+GETUSERDEPARTMENTS(3)+"'","")}
|
||||||
|
) a
|
||||||
|
where not (cu_paid_amt=0 and cu_receivable_amt=0 and pr_paid_amt=0 and pr_receivable_amt = 0)
|
||||||
|
group by CostName
|
||||||
|
union all
|
||||||
|
SELECT
|
||||||
|
index_type, sum(index_not_receipts)
|
||||||
|
FROM ods_caiwu_profit
|
||||||
where 1=1
|
where 1=1
|
||||||
${if(len(p_startdate) == 0,"","and ym = '" + p_startdate + "'")}
|
-- ${if(len(p_area) == 0,"","and organ_code = '" + p_area+ "'")}
|
||||||
${if(len(p_feestype) == 0,"","and ParentCostCode = '" + p_feestype+ "'")}
|
${IF(LEN(p_area)>0," AND organ_code IN ('"+JOINARRAY(p_area,"','")+"')", "")}
|
||||||
${if(len(p_area) == 0,"","and b.organ_code = '" + p_area+ "'")}
|
${if(len(p_startdate) == 0,"","and `year_month` = '" + replace(p_startdate,"-","") + "'")}
|
||||||
|
${if(left(fine_role,2)=="项目","and comm_name = '"+GETUSERDEPARTMENTS(3)+"'","")}
|
||||||
|
group by index_type
|
||||||
|
order by owed_amt desc
|
Loading…
Reference in New Issue
Block a user