关于资产卡片查询财务页签上【累计折旧】字段来自的视图V_FA_LASTBALANCE
有些字段在数据库中其实是没有一个具体的字段名称,以固定资产(财务页签上)的累计折旧字段为例:
通过查询BOS可以看出,位于财务页签上的累计折旧字段是没有实体字段的,那么在系统中是如何计算出来的呢?
累计折旧字段取自视图V_FA_LASTBALANCE视图中这段计算出来的:
*THEN (((C.FACCUMDEPRP + C.FACCUMDEPRINC) - C.FACCUMDEPRDEC) + C.FDEPR) ELSE B.FACCUMDEPR
在sql server中 V_FA_LASTBALANCE视图的创建语句可通过语句sp_helptext V_FA_LASTBALANCE得到
ps:该视图取的都是所有卡片最新的一个数据情况(截止到当期的数据),固定资产财务页签上有一些字段都是多字段计算出来的。
V_FA_LASTBALANCE 创建语句具体如下:
CREATE VIEW V_FA_LASTBALANCE
AS
SELECT A.FALTERID
,A.FASSETID
,B.FFINANCEID
,B.FACCTPOLICYID
,C.FYEAR
,C.FPERIOD
,C.FID fbalanceid
,D.FCURRENCYID
,C.FORGVALP
,C.FORGVALINC
,C.FORGVALDEC
,CASE
WHEN (C.FID > 0)
THEN ((C.FORGVALP + C.FORGVALINC) - C.FORGVAL DEC)
ELSE B.FORGVAL
END forgval
,C.FACCUMDEPRP
,C.FACCUMDEPRINC
,C.FACCUMDEPRDEC
,CASE
WHEN (C.FID > 0)
THEN (((C.FACCUMDEPRP + C.FACCUMDEPRINC) - C.FACCUMDEPRDEC) + C.FDEPR)
ELSE B.FACCUMDEPR
END faccumdepr
,CASE
WHEN (C.FID > 0)
THEN (((C.FORGVALP + C.FORGVALINC) - C.FORGVALDEC) - (((C.FACCUMDEPRP + C.FACCUMDEPRINC) - C.FACCUMDEPRDEC) + C.FDEPR))
ELSE (B.FORGVAL - B.FACCUMDEPR)
END fnetvalue
,C.FDECPREP
,C.FDECPREINC
,C.FDECPREDEC
,CASE
WHEN (C.FID > 0)
THEN ((C.FDECPREP + C.FDECPREINC) - C.FDECPREDE C)
ELSE B.FACCUMDEVALUE
END fdecpre
,CASE
WHEN (C.FID > 0)
THEN ((((C.FORGVALP + C.FORGVALINC) - C.FORGVALDEC) - ((C.FDECPREP + C.FDECPREINC) - C.FDECPREDEC)) - (((C.FACCUMDEPRP + C.FACCUMDEPRINC) - C.FACCUMDEPRDEC) + C.FDEPR))
ELSE ((B.FORGVAL - B.FACCU MDEPR) - B.FACCUMDEVALUE)
END fvalue
,C.FSHOULDDEPR
,C.FDEPR
,C.FDEPRRATE
,CASE
WHEN (C.FID > 0)
THEN C.FDEPRPERIODS
ELSE B.FDEPRPERIODS
END fdeprperiods
,CASE
WHEN (C.FID > 0)
THEN C.FDEPRWORKLOAD
ELSE B.FINITIALDEPRWORKLOAD
END fdeprworkload
,CASE WH EN(C.FID > 0) THEN(((((C.FORGVALP + C.FORGVALINC) - C.FORGVALDEC) - ((C.FDECPREP + C.FDECPREINC) - C.FDECPREDEC)) - (((C.FACCUMDEPRP + C.FACCUMDEPRINC) - C.FACCUMDEPRDEC) + C.FDEPR)) - FRESIDUALVALUE) ELSE C.FDEPRREMAIN END fdeprremain
,C.FYTDDECPREINC
,C.FYTDDECPREDEC
,C.FYTDDEPRINC
,C.FYTDDEPRDEC
,CASE
WHEN (C.FID > 0)
THEN C.FCURYEARDEPR
ELSE B.FCURYEARDEPR
END fcuryeardepr
,C.FYTDORGVALINC
,C.FYTDORGVALDEC FROM T_FA_CARD A INNER JOIN T_FA_FINANCE B ON A.FALTERID = B.FALTERID INNER JOIN T_FA_ACCTPOL ICY D ON B.FACCTPOLICYID = D.FACCTPOLICYID LEFT OUTER JOIN T_FA_BALANCE C ON (
(
A.FASSETID = C.FASSETID
AND B.FACCTPOLICYID = C.FACCTPOLICYID
)
AND C.FISNEWREC = '2'
) WHERE A.FISNEWREC = '2'
关于资产卡片查询财务页签上【累计折旧】字段来自的视图V_FA_LASTBALANCE
本文2024-09-16 18:56:15发表“云星空知识”栏目。
本文链接:https://wenku.my7c.com/article/kingdee-k3cloud-25352.html