实施财务模块时为会计科目添加合计
2010-12-01 15:34
381 查看
最近实施的一个项目客户的会计科目表行非常多,并且没有使用中国本地化开发的树状科目,因此需要把非末级科目的科目类型设置为“合计”,并指定合计的下级科目,一个个设置有些太浪费时间和人力了,这种工作又不方便让技术顾问搞开发,还是自己用SQL解决吧。下面的方法不是最优化的,因为用了很多临时表,只是方便一些。
1. 将 LedgerTable 和 LedgerTableInterval 表转出为Excel (LedgerTable 表一定要将RecId 列也引出)。
2. 把 LedgerTable 表中的三列(AccountNum,AccountName,RecId)引入SQL Server(其中AccountName 列只是供人参考用,不引也可以)。
3. 更新 LedgerTable 表,把非末级科目的“科目类型”设置为“合计”
1. 将 LedgerTable 和 LedgerTableInterval 表转出为Excel (LedgerTable 表一定要将RecId 列也引出)。
2. 把 LedgerTable 表中的三列(AccountNum,AccountName,RecId)引入SQL Server(其中AccountName 列只是供人参考用,不引也可以)。
3. 更新 LedgerTable 表,把非末级科目的“科目类型”设置为“合计”
//填写AccountNumCN 列,这步做的傻了点,倒是容易理解,懒得优化了,其实一条语句就行了。
alter table coa add level1 varchar(255) //一级科目
alter table coa add level2 varchar(255) //二级科目
alter table coa add level3 varchar(255) //三级科目
alter table coa add AccountNumCN varchar(255) //临时科目,和按中国习惯显示的科目一样
update coa set level1=LEFT(accountnum,4)
update coa set level2=substring(accountnum,5,2)
update coa set level3=substring(accountnum,7,2)
update coa set AccountNumCN=level1 where level2='00'
update coa set AccountNumCN=level1+level2 where level3='00' and level2<>'00'
update coa set AccountNumCN=level1+level2+level3 where level3<>'00'
//按照AccountNumCN 判断哪些是末级科目,如果是则填1,不是则填0
alter table coa add EndMark tinyint //标识是否末级科目
update coa set EndMark=0
go
update coa set EndMark=1 from coa as t where not exists (select * from coa where AccountNumCN like t.AccountNumCN + '%' and AccountNumCN<>t.AccountNumCN)
go
//基本数据可以了,然后就转到EXCEL里处理再引入AX。
4. 填写 LedgerTableInterval 表alter table coa add level1 varchar(255) //一级科目
alter table coa add level2 varchar(255) //二级科目
alter table coa add level3 varchar(255) //三级科目
alter table coa add AccountNumCN varchar(255) //临时科目,和按中国习惯显示的科目一样
update coa set level1=LEFT(accountnum,4)
update coa set level2=substring(accountnum,5,2)
update coa set level3=substring(accountnum,7,2)
update coa set AccountNumCN=level1 where level2='00'
update coa set AccountNumCN=level1+level2 where level3='00' and level2<>'00'
update coa set AccountNumCN=level1+level2+level3 where level3<>'00'
//按照AccountNumCN 判断哪些是末级科目,如果是则填1,不是则填0
alter table coa add EndMark tinyint //标识是否末级科目
update coa set EndMark=0
go
update coa set EndMark=1 from coa as t where not exists (select * from coa where AccountNumCN like t.AccountNumCN + '%' and AccountNumCN<>t.AccountNumCN)
go
//基本数据可以了,然后就转到EXCEL里处理再引入AX。
alter table coa add FromNum varchar(255) //合计起科目
alter table coa add ToNum varchar(255) //合计终科目 update coa set FromNum=AccountNumCN+'01' where EndMark=0
update coa set ToNum=AccountNumCN+'99' where EndMark=0
update coa set FromNum=left(FromNum+'0000',8) where EndMark=0
update coa set ToNum=left(ToNum+'0000',8) where EndMark=0
select RecId,FromNum,ToNum from coa where endmark=0
//基本数据可以了,然后就转到EXCEL里处理再引入AX。
处理后的数据截图alter table coa add ToNum varchar(255) //合计终科目 update coa set FromNum=AccountNumCN+'01' where EndMark=0
update coa set ToNum=AccountNumCN+'99' where EndMark=0
update coa set FromNum=left(FromNum+'0000',8) where EndMark=0
update coa set ToNum=left(ToNum+'0000',8) where EndMark=0
select RecId,FromNum,ToNum from coa where endmark=0
//基本数据可以了,然后就转到EXCEL里处理再引入AX。
相关文章推荐
- 实施财务模块时为会计科目添加合计
- 金蝶EAS7 财务会计【总帐】模块实施摘要!
- 如何认识会计科目,看懂财务报表?
- OpenERP实施记录(5):导入会计科目表
- 【转帖】如何认识会计科目,看懂财务报表?
- ORACLE EBS财务科目FLEX FIELD的添加
- Compiere实施之会计科目(ZT)
- 5.以表格型主细表为模板定制模块:会计科目管理
- SAP财务模块中,科目余额表中的数据存在数据库的哪张表中?
- ORACLE EBS财务科目FLEX FIELD的添加
- 如何认识会计科目,看懂财务报表?
- 如何认识会计科目,看懂财务报表?
- OpenERP实施记录(6):设置会计科目
- 如何实施集团企业的ERP财务模块
- weberp财务会计科目
- SAP财务模块中,科目余额表中的数据存在数据库的哪张表中?
- 财务软件、进销存软件、ERP中会计凭证录入模块DIY全攻略
- Windows下Apache添加SSL模块
- 向Android系统中添加模块及产品流程
- 为Drupal添加CKEditor模块