优化资金余额相关取数+优化收入支出条形图排序
This commit is contained in:
parent
d98b9b5821
commit
c1f3a64b35
@ -2264,6 +2264,7 @@ FROM tmp2 T
|
|||||||
WHERE 1=1
|
WHERE 1=1
|
||||||
${if(sIncome_ly=0,"","and A.stat_type = '收入'")}
|
${if(sIncome_ly=0,"","and A.stat_type = '收入'")}
|
||||||
${if(isnull(sIncome_detail),"","and A.plan_item_class = '"+sIncome_detail+"'")}
|
${if(isnull(sIncome_detail),"","and A.plan_item_class = '"+sIncome_detail+"'")}
|
||||||
|
ORDER BY A.stat_type,A.收入执行
|
||||||
|
|
||||||
;
|
;
|
||||||
|
|
||||||
@ -2533,7 +2534,7 @@ FROM
|
|||||||
WHERE 1=1
|
WHERE 1=1
|
||||||
${if(sIncome_ly1=0,"","and A.stat_type = '支出'")}
|
${if(sIncome_ly1=0,"","and A.stat_type = '支出'")}
|
||||||
${if(isnull(sIncome_detail1),"","and A.plan_item_class = '"+sIncome_detail1+"'")}
|
${if(isnull(sIncome_detail1),"","and A.plan_item_class = '"+sIncome_detail1+"'")}
|
||||||
|
ORDER BY A.支出执行 desc
|
||||||
|
|
||||||
|
|
||||||
;
|
;
|
||||||
@ -2779,7 +2780,7 @@ SELECT
|
|||||||
,SUM(CASE WHEN A.subject_type in('受限资金') THEN A.yb_balance ELSE 0 END) AS limt_amt -- 受限资金
|
,SUM(CASE WHEN A.subject_type in('受限资金') THEN A.yb_balance ELSE 0 END) AS limt_amt -- 受限资金
|
||||||
FROM base_calc A
|
FROM base_calc A
|
||||||
|
|
||||||
-- 同比
|
-- 同期
|
||||||
with dba as (
|
with dba as (
|
||||||
select decode(length(accountnumber), '17',
|
select decode(length(accountnumber), '17',
|
||||||
substring(accountnumber, 3),
|
substring(accountnumber, 3),
|
||||||
@ -3033,6 +3034,71 @@ SELECT
|
|||||||
FROM base_calc A
|
FROM base_calc A
|
||||||
;
|
;
|
||||||
|
|
||||||
|
-- 本年累计期初余额
|
||||||
|
with dba as (
|
||||||
|
select decode(length(accountnumber), '17',
|
||||||
|
substring(accountnumber, 3),
|
||||||
|
accountnumber) as accountnumber,
|
||||||
|
max(category_name) as category_name
|
||||||
|
|
||||||
|
from dwr.dim_bank_account
|
||||||
|
where account_owner_class='langjiu'
|
||||||
|
group by decode(length(accountnumber), '17',
|
||||||
|
substring(accountnumber, 3),
|
||||||
|
accountnumber)
|
||||||
|
),
|
||||||
|
base_calc AS(
|
||||||
|
SELECT CASE
|
||||||
|
WHEN decode(a.is_usable,1,0,1)= 0 AND a.amt_type = '现金' AND a.corp_code <> '0223'
|
||||||
|
THEN '其中:可用存款'
|
||||||
|
WHEN a.amt_type = '票据'
|
||||||
|
THEN '银行承兑汇票'
|
||||||
|
WHEN a.amt_type = '现金' AND a.corp_code = '0223'
|
||||||
|
THEN '香港公司账户资金'
|
||||||
|
WHEN decode(a.is_usable,1,0,1) = 1 AND a.amt_type = '现金' AND a.corp_code <> '0223'
|
||||||
|
THEN '受限资金'
|
||||||
|
END AS subject_type
|
||||||
|
,sum(a.amt)/10000 as yb_balance
|
||||||
|
|
||||||
|
-- decode(a.is_usable,1,0,1) as is_limit--受限资金金额
|
||||||
|
from dm.dm_fim_fud_balance a
|
||||||
|
inner join dwr.dim_corp c on a.corp_code=c.corp_code and c.corp_group='股份'
|
||||||
|
/*left join dba on decode(length(a.owner_bank_account), 17,
|
||||||
|
substring(a.owner_bank_account, 3),
|
||||||
|
a.owner_bank_account)=dba.accountnumber*/
|
||||||
|
where a.stat_date=date'${CONCATENATE(year(sStart_date)-1,"-12-01")}'
|
||||||
|
and a.amt!=0
|
||||||
|
${IF(LEN(sCorp)!=0," AND a.corp_code IN ('"+ sCorp +"')", "")}
|
||||||
|
${if(year(sStart_date)>=2025,"and a.owner_bank_account!='其他货币资金微信'","")}
|
||||||
|
and exists (
|
||||||
|
select
|
||||||
|
1
|
||||||
|
from
|
||||||
|
dm.dm_bi_user_permisson
|
||||||
|
where
|
||||||
|
bi_user = '${fine_username}'
|
||||||
|
and per_model IN ('all','fim')
|
||||||
|
and (
|
||||||
|
is_all = 1
|
||||||
|
)
|
||||||
|
)
|
||||||
|
group by CASE
|
||||||
|
WHEN decode(a.is_usable,1,0,1)= 0 AND a.amt_type = '现金' AND a.corp_code <> '0223'
|
||||||
|
THEN '其中:可用存款'
|
||||||
|
WHEN a.amt_type = '票据'
|
||||||
|
THEN '银行承兑汇票'
|
||||||
|
WHEN a.amt_type = '现金' AND a.corp_code = '0223'
|
||||||
|
THEN '香港公司账户资金'
|
||||||
|
WHEN decode(a.is_usable,1,0,1) = 1 AND a.amt_type = '现金' AND a.corp_code <> '0223'
|
||||||
|
THEN '受限资金'
|
||||||
|
END
|
||||||
|
)
|
||||||
|
SELECT
|
||||||
|
SUM(CASE WHEN A.subject_type in('其中:可用存款','香港公司账户资金') THEN A.yb_balance ELSE 0 END) AS bank_amt -- 银行存款
|
||||||
|
,SUM(CASE WHEN A.subject_type in('银行承兑汇票') THEN A.yb_balance ELSE 0 END) AS bill_amt -- 票据
|
||||||
|
,SUM(CASE WHEN A.subject_type in('受限资金') THEN A.yb_balance ELSE 0 END) AS limt_amt -- 受限资金
|
||||||
|
FROM base_calc A
|
||||||
|
;
|
||||||
|
|
||||||
-- 资金分析-银行明细
|
-- 资金分析-银行明细
|
||||||
|
|
||||||
@ -3584,4 +3650,9 @@ FROM
|
|||||||
where
|
where
|
||||||
dk.this_amt is not null
|
dk.this_amt is not null
|
||||||
GROUP BY occupy_credit_quota_type
|
GROUP BY occupy_credit_quota_type
|
||||||
|
ORDER BY CASE WHEN dk.occupy_credit_quota_type = '1年期贷款' THEN 2
|
||||||
|
WHEN dk.occupy_credit_quota_type = '1-3年期贷款' THEN 3
|
||||||
|
WHEN dk.occupy_credit_quota_type = '3-5年期贷款' THEN 4
|
||||||
|
WHEN dk.occupy_credit_quota_type = '技改项目贷款(2030年到期)' THEN 1
|
||||||
|
ELSE 99 END
|
||||||
;
|
;
|
Loading…
Reference in New Issue
Block a user