⑴生成新凭证中间表。查询语句如下:
SELECT GL_accvouch.dbill_date AS 编制日期, GL_accvouch.ino_id AS 凭证编号, GL_accvouch.ccode AS 科目编码, GL_accvouch.md AS 借方金额, GL_accvouch.mc AS 贷方金额, GL_accvouch.cdigest AS 摘要, GL_accvouch.cperson_id AS 个人编码, Person.cPersonName, GL_accvouch.ccus_id AS 单位往来编码, Customer.cCusName, GL_accvouch.csup_id AS 应付款编码, Vendor.cVenName INTO 新凭证中间表
FROM Vendor RIGHT JOIN (Person RIGHT JOIN (Customer RIGHT JOIN GL_accvouch ON Customer.cCusCode = GL_accvouch.ccus_id) ON Person.cPersonCode = GL_accvouch.cperson_id) ON Vendor.cVenCode = GL_accvouch.csup_id
WHERE (((GL_accvouch.dbill_date) Like '2008*’) AND ((GL_accvouch.ino_id) Is Not Null))
ORDER BY GL_accvouch.dbill_date, GL_accvouch.ino_id;
⑵生成新凭证表。查询语句如下:
SELECT 新凭证中间表。编制日期, 新凭证中间表。凭证编号,
IIf([单位往来编码] Is Not Null,IIf(Len([单位往来编码])=3,[科目编码]+'0'+Right([单位往来编码],1),[科目编码]+Right([单位往来编码],2)),
IIf([应付款编码] Is Not Null,IIf(Len([应付款编码])=4,[科目编码]+'0'+Right([应付款编码],1),[科目编码]+Right([应付款编码],2)),
IIf([个人编码] Is Not Null,IIf(Len([个人编码])=3,[科目编码]+'0'+Right([个人编码],1),[科目编码]+Right([个人编码],2)),[科目编码])
)) AS 新科目编码,
新凭证中间表。借方金额, 新凭证中间表。贷方金额, 新凭证中间表。摘要 INTO 新凭证表
FROM 新凭证中间表;
3.生成新科目表
⑴生成科目表。查询语句如下:
SELECT code.ccode AS 科目编码, code.ccode_name AS 科目名称 INTO 科目表 FROM code;
⑵生成新科目表。查询语句如下:
SELECT * INTO 新科目表
FROM (SELECT DISTINCT
iif([单位往来编码] Is Not Null,IIf(Len([单位往来编码])=3,科目表。科目编码+'0'+Right([单位往来编码],1),科目表。科目编码+Right([单位往来编码],2)),
IIf([应付款编码] Is Not Null,IIf(Len([应付款编码])=4,科目表。科目编码+'0'+Right([应付款编码],1),科目表。科目编码+Right([应付款编码],2)),