固定资产之折旧期间与会计期间那点事

by zhaoff 2013.8.28 10:28

注:脚本执行有风险,对于客户正式环境请在研发指导下执行。

对于调整或删除会计期间导致资产严重出错的问题,已经很多次了,致使我觉得不得不写点什么,来揭开会计期间与折旧期间之间暧昧又诡异的关系。

会计期间属于Base,有点上级的感觉。折旧期间属于资产,有点下级的感觉。不过这个下级有点不好管理,能决定上级会计期间的长度,所以如果你哪天看见会计期间一下到了2071年,请不要惊慌,这或许不是问题,如果一下到了4000年,这就是问题了。。。因为资产有限制,最多可建70年。

以下只关心与期间有关的字段,其他字段不考虑。

先看看期间相关Base有什么?

账簿(会计准则, 会计日历)

会计期间(会计日历)

账簿会计期间(账簿,会计期间)

再看看资产有什么?

折旧账簿(折旧账簿编码同账簿编码,会计准则,会计日历,生效日期等等一致,完全是账簿的副本,自己特有的东西是货主组织与启用期间)

折旧账簿期间(后台维护实体,前台不可见,由账簿启用期间确定是和账簿会计期间完全一致,还是只是取了账簿期间的一部分)

 

1.建一个账簿,所对应的会计日历的会计期间为2013.1~~2013.12.

账簿保存后账簿会计期间自动生成,也是2013.1~~2013.12.

此时创建折旧账簿,

如果启用期间为2013.3,则生成的折旧账簿期间如下

 

如果启用期间是2013.1则生成的折旧账簿期间如下:

 

 

这时会发现和账簿期间是一致的。这里就展示了折旧账簿期间与账簿会计期间的区别。

与折旧账簿启用期间有关。

查询SQl为:

select c.Name '折旧账簿',b.AccountingPeriod '会计期间ID',b.DPYear '',b.PeriodNo '期间号',b.FromDate '开始日期',b.ToDate '结束日期',* from FA_DepreciationBook a inner join FA_DepreciationBookPeriod b on a.ID=b.DPBook inner join FA_DepreciationBook_Trl c on a.ID=c.ID

where c.SysMLFlag='zh-CN'

2.新增卡片

如果新增的卡片使用年限是一年,则会计期间不会发生变化。

如果新增的卡片的使用年限是>1年,则会对会计期间进行追加。对于折旧方法是预置的这种资产,在卡片审核的时候一次性生成所有期间的折旧计划,并计算出折旧金额。例:卡片KP-13080003使用年限一年,2013.3.1开始启用,折旧计划如下。

 

 

查询SQl

select d.Name '折旧账簿',c.DocNo '卡片号',a.DepreciateAccountingPeriod '会计期间ID',a.DepreciateAccountingYear '',

a.DepreciateAccountingPeriodNO '期间号',a.FADepreciateValue '折旧金额',

* from FA_AssetDepreciateSchedule a inner join Base_AccountingPeriod b on a.DepreciateAccountingPeriod=b.ID

inner join FA_AssetCard c on a.AssetCard=c.ID

inner join FA_DepreciationBook_trl d on d.ID=a.DPBook

where c.DocNo='KP-13080003' and d.SysMLFlag='zh-CN'

总结:

通过以上不难看出,会计期间被折旧计划和折旧账簿期间引用。卡片使用年限是70年,折旧计划就有可能是70年的,所以会计期间不能轻易删除。

要想删除会计期间必须先做检查,看下资产最大的折旧期间是什么,然后只能删除比最大期间之后的会计期间,之前的都不能删除,一旦删除回导致卡片折旧和资产结账严重错误。

查询Sql为:

Select  max(DepreciateAccountingYear) from FA_AssetDepreciateSchedule

之前开发提供过财务清空会计日历冗余问题处理的脚本,这个脚本发往现场直接执行,导致资产无法折旧,无法结账,其实最初这个脚本是为了解决某个客户删除会计期间的问题,不是所有客户都适用,脚本如下

DELETE FROM dbo.Base_SOBAccountingPeriod_Trl WHERE id IN (SELECT ID FROM dbo.Base_SOBAccountingPeriod WHERE Year>2050)

DELETE FROM dbo.Base_SOBAccountingPeriod WHERE Year>2050

DELETE FROM dbo.Base_AccountingPeriod WHERE Year>2050

UPDATE dbo.Base_AccountCalendar SET ToDate='2049-12-31 00:00:00' WHERE code='会计日历编码'

DELETE FROM dbo.AP_APPeriodClose WHERE year>2050

DELETE FROM AR_ARPeriodClose WHERE year>2050

DELETE FROM CM_DailyClosed WHERE SOBPeriod NOT IN

(SELECT id FROM dbo.Base_SOBAccountingPeriod)

DELETE FROM FA_DepreciationBookPeriod WHERE AccountingPeriod NOT IN

(SELECT id FROM dbo.Base_AccountingPeriod)

delete FROM CBO_TBCalendarPeriod  WHERE year>2050

 

这里的2050其实指的就是max(DepreciateAccountingYear),另外红色部分脚本完全不能使用,正确的应该是

DELETE FROM FA_DepreciationBookPeriod WHERE AccountingPeriod NOT IN

(SELECT id FROM dbo.Base_SOBAccountingPeriod)

 

如果会计期间通过脚本调整了开始和结束日期,也需要同步调整折旧账簿期间的开始和结束日期,

 update b set b.FromDate=d.FromDate,b.ToDate=d.ToDate
 from  FA_DepreciationBookPeriod b inner join FA_DepreciationBook a
on a.ID=b.DPBook
inner join Base_SetofBooks c on c.ID=a.SOB
left join  Base_AccountingPeriod d on d.AccountingCalendar=c.AccountCalendar
 where a.ID=
折旧账簿ID  and b.DPYear=d.Year and b.PeriodNo=d.Month*10

 

 

 

 

 

 

 

 

Tags:

评论 (1) -

weight Loss shakes 美国 wrote at 2016/6/11 0:04:22 #

I have been surfing online more than three hours today, yet I never found any interesting article like yours. It is pretty worth enough for me. Personally, if all website owners and bloggers made good content as you did, the internet will be a lot more useful than ever before.| I could not resist commenting. Well written!| I'll immediately snatch your rss as I can not to find your e-mail subscription hyperlink or newsletter service. Do you have any? Please permit me know so that I could subscribe. Thanks.| It's the best time to make some plans for the future and it is time to be happy. I've read this post and if I could I want to suggest you few interesting things or suggestions. Perhaps you could write next articles referring to this article. I desire to read even more things about it!| It is perfect time to make a few plans for the longer term and it's time to be happy. I have read this post and if I may just I wish to counsel you some fascinating issues or suggestions. Maybe you can write subsequent articles relating to this article. I desire to learn even more issues about it!| I have been surfing on-line greater than 3 hours as of late, but I by no means discovered any interesting article like yours. It is pretty value sufficient for me. Personally, if all webmasters and bloggers made excellent content as you did, the web might be a lot more useful than ever before.| Ahaa, its good conversation concerning this article here at this weblog, I have read all that, so at this time me also commenting here.| I am sure this article has touched all the internet viewers, its really really pleasant piece of writing on building up new blog.| Wow, this article is fastidious, my younger sister is analyzing these things, so I am going to inform her.| Saved as a favorite, I really like your website!| Way cool! Some very valid points! I appreciate you penning this write-up and the rest of the website is very good.| Hi, I do believe this is an excellent web site. I stumbledupon it ;) I will revisit once again since I bookmarked it. Money and freedom is the best way to change, may you be rich and continue to guide others.| Woah! I'm really digging the template/theme of this blog. It's simple, yet effective. A lot of times it's very difficult to get that "perfect balance" between usability and visual appeal. I must say that you've done a excellent job with this. Additionally, the blog loads super fast for me on Safari. Outstanding Blog!| These are really wonderful ideas in about blogging. You have touched some pleasant factors here. Any way keep up wrinting.| I like what you guys are usually up too. Such clever work and reporting! Keep up the excellent works guys I've incorporated you guys to  blogroll.| Hi there! Someone in my Myspace group shared this website with us so I came to look it over. I'm definitely enjoying the information. I'm bookmarking and will be tweeting this to my followers! Excellent blog and superb style and design.| Everyone loves what you guys tend to be up too. Such clever work and exposure! Keep up the fantastic works guys I've added you guys to  blogroll.| Hey there would you mind stating which blog platform you're using? I'm planning to start my own blog soon but I'm having a difficult time deciding between BlogEngine/Wordpress/B2evolution and Drupal. The reason I ask is because your design and style seems different then most blogs and I'm looking for something unique.                  P.S Apologies for getting off-topic but I had to ask!| Hey would you mind letting me know which webhost you're using? I've loaded your blog in 3 completely different web browsers and I must say this blog loads a lot quicker then most. Can you recommend a good internet hosting provider at a honest price? Thanks a lot, I appreciate it!| Everyone loves it when people come together and share ideas. Great website, keep it up!| Thank you for the auspicious writeup. It in fact was a amusement account it. Look advanced to more added agreeable from you! By the way, how can we communicate?| Howdy just wanted to give you a quick heads up. The words in your content seem to be running off the screen in Ie. I'm not sure if this is a format issue or something to do with internet browser compatibility but I thought I'd post to let you know. The design look great though! Hope you get the issue resolved soon. Kudos| This is a topic that's close to my heart... Take care! Exactly where are your contact details though?| It's very trouble-free to find out any matter on net as compared to books, as I found this piece of writing at this web page.| Does your website have a contact page? I'm having problems locating it but, I'd like to shoot you an email. I've got some recommendations for your blog you might be interested in hearing. Either way, great site and I look forward to seeing it grow over time.| Hey there! I've been reading your web site for some time now and finally got the courage to go ahead and give you a shout out from  Houston Texas! Just wanted to mention keep up the fantastic job!| Greetings from California! I'm bored at work so I decided to check out your site on my iphone during lunch break. I love the knowledge you provide here and can't wait to take a look when I get home. I'm shocked at how quick your blog loaded on my mobile .. I'm not even using WIFI, just 3G .. Anyways, fantastic blog!| Its like you learn my thoughts! You seem to grasp so much approximately this, such as you wrote the ebook in it or something. I think that you simply could do with some percent to drive the message home a little bit, but other than that, that is fantastic blog. A fantastic read. I'll certainly be back.| I visited many web pages except the audio feature for audio songs existing at this website is actually excellent.| Hi there, i read your blog from time to time and i own a similar one and i was just curious if you get a lot of spam remarks? If so how do you stop it, any plugin or anything you can recommend? I get so much lately it's driving me crazy so any assistance is very much appreciated.| Greetings! Very helpful advice in this particular post! It's the little changes that make the biggest changes. Thanks a lot for sharing!| I really love your blog.. Excellent colors & theme. Did you create this web site yourself? Please reply back as I'm wanting to create my own personal blog and would love to know where you got this from or just what the theme is called. Kudos!| Hi there! This article could not be written any better! Looking at this post reminds me of my previous roommate! He continually kept preaching about this. I will send this post to him. Pretty sure he's going to have a great read. I appreciate you for sharing!| Wow! This blog looks just like my old one! It's on a totally different subject but it has pretty much the same page layout and design. Outstanding choice of colors!| There's definately a lot to know about this topic. I like all the points you have made.| You've made some decent points there. I checked on the web to find out more about the issue and found most people will go along with your views on this web site.| Hello, I check your new stuff like every week. Your writing style is witty, keep up the good work!| I just could not go away your web site prior to suggesting that I extremely loved the standard information an individual supply in your guests? Is going to be again steadily in order to inspect new posts| I wanted to thank you for this good read!! I certainly loved every little bit of it. I have got you bookmarked to look at new things you post…\

添加评论



biuquote
微笑得意调皮害羞酷大笑惊讶发呆喜欢可怜尴尬闭嘴噘嘴皱眉伤心抓狂呕吐坏笑漫骂发怒
Loading


RecentComments

评论 RSS

Statistics

989 篇文章
0 个单页
776066 条评论
11 次评分
1443825 次访问
访问统计开始于 2019年12月15日
平均日访问 6810 次
当前 103 人在线