|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
本帖最后由 flyge 于 2011-10-18 12:49 编辑
针对用友7.2X
为了实现多年的凭证查询,我们将用友多年帐套连在一起,
前提是 找到帐套所在目录 我们这里 是 U:\
我们就在U:\ 下
=================================================
新建一个access文件,
=================================================
=================================================
链接帐务数据库
=================================================
改个名字如“2001.mdb”,这里2001是年份,你可以变成相应年份
链接帐务中的数据到这个 新建的access文件“2001.mdb”
链接完毕
=================================================
建立一个查询
=================================================
接下来我们
建立一个查询,
不选择任何表,选择SQL视图,见图
接下来,将“实例代码”中的代码复制到 查询的SQL视图中
把年份修改到与帐务对应的,这里有两处,这里的年份是增加的一列,为了与其他年份帐务合并的时候作区分用的,
因为7.2x的用友的这个凭证库里原本没有分哪个年份,一年一个数据库,所以我们把所有年度的凭证放在一起是加个年份。
接下来,保存为“凭证”
这个查询把所有的需要的凭证,汇总在一起,包含“已记账凭证”和“未记账凭证”还有期初数(用友里用月份为0表示的)
将“实例代码”中的代码复制到 查询的SQL视图中即可,注意把年份修改到与帐务对应的, 保存为“凭证”即可
保存access文件,退出
===========================================================
接下来就是体力活了,将每个年份建立一个access文件,重复以上步骤,接下来就 要准备合并了
===========================================================
=======
实例代码如下:
========
(SELECT
g_pvouch.isid,
g_pvouch.iperiod,
g_pvouch.ino_id,
g_pvouchs.snid,
g_pvouchs.ccode,
g_code.ccode_name,
g_pvouchs.cd_c,
g_pvouchs.mmoney,
g_pvouchs.cdigest,
g_pvouchs.ienter_id,
g_enter.center_name,
g_itemss00.FIELD1,
g_itemss00.FIELD2,
g_itemss00.FIELD3,
g_enter.center_id,
g_itemss00.FIELD4,
g_pvouchs.iperson_id,
"2004" as year
FROM
g_pvouch
INNER JOIN
(g_itemss00
RIGHT JOIN
( (g_pvouchs
INNER JOIN
g_code
ON g_pvouchs.ccode = g_code.ccode
)
LEFT JOIN
g_enter
ON g_pvouchs.ienter_id = g_enter.ienter_id
)
ON g_itemss00.FIELD0 = g_pvouchs.iitem_id
) ON g_pvouch.isid = g_pvouchs.isid
ORDER BY g_pvouch.isid)
union
(SELECT
g_vouch.isid,
g_vouch.iperiod,
g_vouch.ino_id,
g_vouchs.snid,
g_vouchs.ccode,
g_code.ccode_name,
g_vouchs.cd_c,
g_vouchs.mmoney,
g_vouchs.cdigest,
g_vouchs.ienter_id,
g_enter.center_name,
g_itemss00.FIELD1,
g_itemss00.FIELD2,
g_itemss00.FIELD3,
g_enter.center_id,
g_itemss00.FIELD4,
g_vouchs.iperson_id,
"2004" as year
FROM
g_vouch
INNER JOIN
(g_itemss00
RIGHT JOIN
( (g_vouchs
INNER JOIN
g_code
ON g_vouchs.ccode = g_code.ccode
)
LEFT JOIN
g_enter
ON g_vouchs.ienter_id = g_enter.ienter_id
)
ON g_itemss00.FIELD0 = g_vouchs.iitem_id
) ON g_vouch.isid = g_vouchs.isid
ORDER BY g_vouch.isid)
;
========
实例代码结束,注意最后的分号别忘了
========
|
|