关于从用友软件账套数据库导出凭证数据的语句
1.最近有客户电脑的主板出现问题,导致原用友T3软件用不了,更换主板后,T3软件是能登录了,但可能是原来的操作系统存在环境问题,原来的加密卡有时能识别,有时不能识别。为了预防后续的问题,同时对于用友查询跨年数据需要不停的更换账套的操作客户感觉很麻烦,客户就咨询更换软件。
2.因为登录T3比较麻烦,而且原来的加密卡有时能识别,有时不能识别。因此就考虑从用友软件的数据库层面把不同年度的数据一起导出。
3.约定:用友2022年账套对应的后台数据库实体是ufdata_001_2022,2023年账套对应的后台数据库实体是ufdata_001_2023,其他依次类推。
对应的后台用友凭证序时账的语句如下:
SELECT *
FROM (
SELECT 2022 AS "F会计年度",
v.iperiod AS "F会计期间",
v.dbill_date AS "F凭证日期",
v.csign AS "F凭证字",
v.ino_id AS "F凭证号",
v.inid AS "F分录号",
v.ccode AS "F科目代码",
c.ccode_name AS "F科目名称",
v.cdigest AS "F摘要",
v.md AS "F借方发生额",
v.mc AS "F贷方发生额",
v.cbill AS "F制单人",
v.ccheck AS "F审核人",
v.cbook AS "F过账人"
FROM ufdata_001_2022.dbo.GL_accvouch v
LEFT JOIN code c
ON v.ccode = c.ccode
UNION ALL
SELECT 2023 AS "F会计年度",
v.iperiod AS "F会计期间",
v.dbill_date AS "F凭证日期",
v.csign AS "F凭证字",
v.ino_id AS "F凭证号",
v.inid AS "F分录号",
v.ccode AS "F科目代码",
c.ccode_name AS "F科目名称",
v.cdigest AS "F摘要",
v.md AS "F借方发生额",
v.mc AS "F贷方发生额",
v.cbill AS "F制单人",
v.ccheck AS "F审核人",
v.cbook AS "F过账人"
FROM ufdata_001_2023.dbo.GL_accvouch v
LEFT JOIN code c
ON v.ccode = c.ccode) u
WHERE u.F借方发生额+F贷方发生额<>0
ORDER BY u.F会计年度,
u.F会计期间,
u.F凭证字,
u.F凭证号,
u.F分录号
4.把查询结果导出为EXCEL文件,然后再整理成金蝶专业版的标准凭证格式,再导入到专业版中即可。
5.在金蝶专业版把凭证序时簿和科目余额表导出,然后核对导入的凭证和各年的科目余额表。