会计数据审计分析九大算法实例

上传人:大米 文档编号:498236748 上传时间:2023-06-27 格式:DOCX 页数:9 大小:35.04KB
返回 下载 相关 举报
会计数据审计分析九大算法实例_第1页
第1页 / 共9页
会计数据审计分析九大算法实例_第2页
第2页 / 共9页
会计数据审计分析九大算法实例_第3页
第3页 / 共9页
会计数据审计分析九大算法实例_第4页
第4页 / 共9页
会计数据审计分析九大算法实例_第5页
第5页 / 共9页
点击查看更多>>
资源描述

《会计数据审计分析九大算法实例》由会员分享,可在线阅读,更多相关《会计数据审计分析九大算法实例(9页珍藏版)》请在金锄头文库上搜索。

1、/*第七章7.2九大算法实例*/*第一算法查记账凭证的算法知识点:查的是记账凭证而不是明细账。一张凭证是多条记录的集合,而记录只是一条解题规则:一个条件二张表,二个条件三张表,三个条件四张表。*/,a表是查询结果凭证,用 b-分析:从题意看只有一个决定条件,即科目为主营业务收入,所以要用二张表相连表设条件。-例:检索出所有现金支出为整千元的记账记录。Select*fromgl_accvouchwhereccode=101andabs(mc%1000)=0andmc0-例:检索出所有现金收支大于1000元的记账凭证。Selectb.*fromgl_accvouchajoingl_accvouch

2、bona.iperiod=b.iperiodanda.csign=b.csignanda.ino_id=b.ino_idwherea.ccode=101and(a.md1000ora.mc1000)-例:检索出所有凭证的现金科目的对应科目的科目代码、科目名称、借方发生额、贷方发生额。(?)selecta.iperiod,a.csign,a.ino_id,a.ccode,b.ccode_name,a.md,a.mcfromGL_accvouchajoincodebona.ccode=b.ccodewherea.ccode_equallike%,101%ora.ccode_equallike101

3、%orderbya.iperiod,a.csign,a.ino_id,a.ccodeselecta.ccode科目代码,ccode_name科目名称,SUM(md)借方发生额,SUM(mc)贷方发生额fromGL_accvouchajoincodebona.ccode=b.ccodewhereccode_equallike%,101%orccode_equallike101%groupbya.ccode,ccode_name/*第二算法赊销算法,借方一个科目,贷方一个科目。如借应收账款/票据贷:主营业务收入/产品销售收入查凭证比查记录多张表。*/-分析:从题意看有二个条件,即凭证中要有应收科目

4、和主营业务收入科目,所以要三张表,a表是查询结果凭证,b表设应收条件,c表设主营业务收入条件。-例:检索出所有赊销收入明细账记录。赊销:已销售,没收到钱。-第一种方式可以利用产品销售收入的对应科目code_equal来完成select*fromGL_accvouchwhereccode=501andccode_equallike%113%andmc0orderbyiperiod,csign,ino_id-第二种方式内连接方式,求两个集合的交集运算,检查两个表中的共有内容。显示的是记录而不是凭证。Selecta.*fromgl_accvouchajoingl_accvouchbona.iperi

5、od=b.iperiodanda.csign=b.csignanda.ino_id=b.ino_idwherea.ccode=501andb.ccode=113anda.mc0orderbya.iperiod,a.csign,a.ino_id-例:检索出所有赊销收入明细账凭证。或查找各月赊销凭证-第一种方式两表连接selecta.*fromGL_accvouchajoinGL_accvouchbona.iperiod=b.iperiodanda.csign=b.csignanda.ino_id=b.ino_idwhereb.ccode=501andb.ccode_equallike%113%a

6、ndb.mc0orderbya.iperiod,a.csign,a.ino_id-第二种方式三表连接selecta.*fromGL_accvouchajoinGL_accvouchbona.iperiod=b.iperiodanda.csign=b.csignanda.ino_id=b.ino_idjoinGL_accvouchconc.iperiod=b.iperiodandc.csign=b.csignandc.ino_id=b.ino_idwhereb.ccodelike501%andc.ccodelike113%andC.md0andb.mc0orderbya.iperiod,a.cs

7、ign,a.ino_id-例:查找各月赊销收入总额selecta.iperiod期间,SUM(a.mc)收入总额fromGL_accvouchajoinGL_accvouchbona.iperiod=b.iperiodanda.csign=b.csignanda.ino_id=b.ino_idwherea.ccodelike501%andb.ccodelike113%andb.md0anda.mc0groupbya.iperiodselectiperiod,SUM(mc)收入总额fromGL_accvouchwhereccode=501andccode_equallike%113%groupb

8、yiperiod-例:查找各月现销记录selecta.*fromGL_accvouchajoinGL_accvouchbona.iperiod=b.iperiodanda.csign=b.csignanda.ino_id=b.ino_idwherea.ccodelike101%andb.ccodelike501%anda.md0select*fromGL_accvouchawherea.ccode=101anda.ccode_equallike%501%andmd0-例:查找各月现销凭证selecta.*fromGL_accvouchajoinGL_accvouchbona.iperiod=b

9、.iperiodanda.csign=b.csignanda.ino_id=b.ino_idjoinGL_accvouchconc.iperiod=b.iperiodandc.csign=b.csignandc.ino_id=b.ino_idwhereb.ccodelike501%and(c.ccodelike101%orc.ccodelike102%)andC.md0andb.mc0-例:查找各月现销收入,分析:统计各月通过现结方式的现金收入。selecta.iperiod期间,SUM(a.md)收入fromGL_accvouchajoinGL_accvouchbona.iperiod=b.

10、iperiodanda.csign=b.csignanda.ino_id=b.ino_idwhere(a.ccodelike101%ora.ccodelike102%)andb.ccodelike501%anda.md0andb.mc0groupbya.iperiod-例:计算各月收回的销售欠款(应收账款)累计发生额。分析:应收账款是113,何谓收回,即113在贷方,借方应为101、102selecta.iperiod期间,a.ccode,sum(a.mc)mc,SUM(a.md)mdfromGL_accvouchajoinGL_accvouchbona.iperiod=b.iperiodan

11、da.csign=b.csignanda.ino_id=b.ino_idwhere(a.ccodelike101%ora.ccodelike102%)andb.ccodelike113%anda.md0groupbya.iperiod,a.ccode-例:计算各月收回的销售欠款(应收账款)凭证。分解条件:此凭证借方应为现金或银行存款,贷方为113,要查找凭证selecta.*fromGL_accvouchajoingl_accvouchbona.iperiod=b.iperiodanda.csign=b.csignanda.ino_id=b.ino_idjoinGL_accvouchconc.

12、iperiod=b.iperiodandc.csign=b.csignandc.ino_id=b.ino_idwhere(b.ccodelike101%orb.ccodelike102%)andb.md0andc.ccodelike113%andc.mc0orderbya.iperiod,a.csign,a.ino_idselecta.*fromGL_accvouchajoinGL_accvouchbona.iperiod=b.iperiodanda.csign=b.csignanda.ino_id=b.ino_idwhere(b.ccodelike101%orb.ccodelike102%)

13、andb.md0and(b.ccode_equallike113%orb.ccode_equallike%,113%)/*第三算法登记一个科目,末登记一个科目的算法。使用外连接left(right)join。实现两个集合的差集运算。找出一个集合中存在而另一个集合不存在的内容*/-例:检查所有确认收入时,未同时提取应交税金的销售收入明细账记录。-分析:先查询凭证中有主营业务收入,再左连接所有提取了应交税金的记录,而右表中为空的即为未提取应交税金的记录。selecta.*from(select*fromGL_accvouchwhereccodelike501%andmc0)aleftjoin(se

14、lect*fromGL_accvouchwhereccodelike221%andmc0)bona.iperiod=b.iperiodanda.csign=b.csignanda.ino_id=b.ino_idwhereb.iperiodisnullselecta.*fromGL_accvouchaleftjoinGL_accvouchbona.iperiod=b.iperiodanda.csign=b.csignanda.ino_id=b.ino_idandb.ccodelike221%andb.mc0wherea.ccodelike501%andb.iperiodisnullanda.mc

15、0- -第一个视图,获取所有有501主营业务收入的记录createviewa_1asselect*fromGL_accvouchwhereccodelike501%andmc0- -第二个视力,获取所有有221%提取税金的记录createviewa_2asselect*fromGL_accvouchwhereccodelike221%andmc0- -最后,一视图左连接二视图,检查右边记录为空的所有记录,即为确认收入时未同时提取应交税金。createviewa_3asselecta.*froma_1aleftjoina_2bona.iperiod=b.iperiodanda.csign=b.csignanda.ino_id=b.ino_idwhereb.iperiodisnullorderbya.iperiod,a.csign,a.ino_iddropviewa_1,a_2-例:检查漏缴税款的凭证-分析用有主营业务收入的a表(子查询)作查

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 商业/管理/HR > 营销创新

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号