會(huì)計(jì)數(shù)據(jù)審計(jì)分析九大算法實(shí)例_第1頁
會(huì)計(jì)數(shù)據(jù)審計(jì)分析九大算法實(shí)例_第2頁
會(huì)計(jì)數(shù)據(jù)審計(jì)分析九大算法實(shí)例_第3頁
會(huì)計(jì)數(shù)據(jù)審計(jì)分析九大算法實(shí)例_第4頁
會(huì)計(jì)數(shù)據(jù)審計(jì)分析九大算法實(shí)例_第5頁
已閱讀5頁,還剩3頁未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡(jiǎn)介

1、 .wd. .wd. .wd./*第七章 7.2九大算法實(shí)例*/*第一算法 查記賬憑證的算法知識(shí)點(diǎn):查的是記賬憑證而不是明細(xì)賬。一張憑證是多條記錄的集合,而記錄只是一條解題規(guī)那么:一個(gè)條件二張表,二個(gè)條件三張表,三個(gè)條件四張表。*/-分析:從題意看只有一個(gè)決定條件,即科目為主營業(yè)務(wù)收入,所以要用二張表相連,a表是查詢結(jié)果憑證,用b表設(shè)條件。 -例:檢索出所有現(xiàn)金支出為整千元的記賬記錄。Select * from gl_accvouch where ccode=101 and abs(mc%1000)=0 and mc0 -例:檢索出所有現(xiàn)金收支大于1000元的記賬憑證。Select b.* f

2、rom gl_accvouch a join gl_accvouch b on a.iperiod=b.iperiod and a.csign=b.csign and a.ino_id=b.ino_id where a.ccode=101 and (a.md1000 or a.mc1000) -例:檢索出所有憑證的現(xiàn)金科目的對(duì)應(yīng)科目的科目代碼、科目名稱、借方發(fā)生額、貸方發(fā)生額。(?)select a.iperiod,a.csign ,a.ino_id,a.ccode,b.ccode_name,a.md,a.mcfrom GL_accvouch a join code b on a.ccode=

3、b.ccode where a.ccode_equal like %,101% or a.ccode_equal like 101% order by a.iperiod,a.csign ,a.ino_id,a.ccodeselect a.ccode 科目代碼,ccode_name 科目名稱,SUM(md) 借方發(fā)生額,SUM(mc) 貸方發(fā)生額from GL_accvouch a join code b on a.ccode=b.ccodewhere ccode_equal like %,101% or ccode_equal like 101% group by a.ccode,ccode

4、_name/*第二算法 賒銷算法,借方一個(gè)科目,貸方一個(gè)科目。如借 應(yīng)收賬款/票據(jù) 貸:主營業(yè)務(wù)收入/產(chǎn)品銷售收入 查憑證比查記錄多張表。*/-分析:從題意看有二個(gè)條件,即憑證中要有應(yīng)收科目和主營業(yè)務(wù)收入科目,所以要三張表,a 表是查詢結(jié)果憑證,-b表設(shè)應(yīng)收條件,c表設(shè)主營業(yè)務(wù)收入條件。 -例:檢索出所有賒銷收入明細(xì)賬記錄。賒銷:已銷售,沒收到人民幣。 -第一種方式 可以利用產(chǎn)品銷售收入的對(duì)應(yīng)科目code_equal來完成select * from GL_accvouch where ccode=501 and ccode_equal like %113% and mc0 order by i

5、period,csign,ino_id -第二種方式 內(nèi)連接方式,求兩個(gè)集合的交集運(yùn)算,檢查兩個(gè)表中的共有內(nèi)容。顯示的是記錄而不是憑證。Select a.* from gl_accvouch a join gl_accvouch b on a.iperiod=b.iperiod and a.csign=b.csign and a.ino_id=b.ino_id where a.ccode=501 and b.ccode=113 and a.mc0 order by a.iperiod,a.csign,a.ino_id -例:檢索出所有賒銷收入明細(xì)賬憑證?;虿檎腋髟沦d銷憑證 -第一種方式 兩表連

6、接select a.* from GL_accvouch a join GL_accvouch b on a.iperiod=b.iperiod and a.csign=b.csign and a.ino_id=b.ino_id where b.ccode=501 and b.ccode_equal like %113% and b.mc0order by a.iperiod,a.csign,a.ino_id -第二種方式 三表連接select a.* from GL_accvouch a join GL_accvouch b on a.iperiod=b.iperiod and a.csig

7、n=b.csign and a.ino_id=b.ino_id join GL_accvouch c on c.iperiod=b.iperiod and c.csign=b.csign and c.ino_id=b.ino_id where b.ccode like 501% and c.ccode like 113% and C.md0 and b.mc0order by a.iperiod,a.csign,a.ino_id -例:查找各月賒銷收入總額select a.iperiod 期間,SUM(a.mc) 收入總額 from GL_accvouch a join GL_accvouch

8、 b on a.iperiod=b.iperiod and a.csign=b.csign and a.ino_id=b.ino_id where a.ccode like 501% and b.ccode like 113% and b.md0 and a.mc0group by a.iperiodselect iperiod ,SUM(mc) 收入總額 from GL_accvouch where ccode =501 and ccode_equal like %113%group by iperiod -例:查找各月現(xiàn)銷記錄select a.* from GL_accvouch a jo

9、in GL_accvouch b on a.iperiod=b.iperiod and a.csign=b.csign and a.ino_id=b.ino_id where a.ccode like 101% and b.ccode like 501% and a.md0select * from GL_accvouch awhere a.ccode =101 and a.ccode_equal like %501% and md0 -例:查找各月現(xiàn)銷憑證select a.* from GL_accvouch a join GL_accvouch b on a.iperiod=b.iperi

10、od and a.csign=b.csign and a.ino_id=b.ino_id join GL_accvouch c on c.iperiod=b.iperiod and c.csign=b.csign and c.ino_id=b.ino_id where b.ccode like 501% and (c.ccode like 101% or c.ccode like 102%) and C.md0 and b.mc0 -例:查找各月現(xiàn)銷收入,分析:統(tǒng)計(jì)各月通過現(xiàn)結(jié)方式的現(xiàn)金收入。select a.iperiod 期間,SUM(a.md) 收入from GL_accvouch a

11、join GL_accvouch b on a.iperiod=b.iperiod and a.csign=b.csign and a.ino_id=b.ino_id where (a.ccode like 101% or a.ccode like 102%) and b.ccode like 501% and a.md0 and b.mc0group by a.iperiod -例:計(jì)算各月收回的銷售欠款應(yīng)收賬款累計(jì)發(fā)生額。分析:應(yīng)收賬款是113,何謂收回,即113在貸方,借方應(yīng)為101、102select a.iperiod 期間,a.ccode,sum(a.mc) mc,SUM(a.md

12、) mdfrom GL_accvouch ajoin GL_accvouch b on a.iperiod=b.iperiod and a.csign=b.csign and a.ino_id=b.ino_id where (a.ccode like 101% or a.ccode like 102%) and b.ccode like 113% and a.md0 group by a.iperiod,a.ccode -例:計(jì)算各月收回的銷售欠款應(yīng)收賬款憑證。分解條件:此憑證借方應(yīng)為現(xiàn)金或銀行存款,貸方為113,要查找憑證select a.* from GL_accvouch a join

13、gl_accvouch bon a.iperiod=b.iperiod and a.csign=b.csign and a.ino_id=b.ino_id join GL_accvouch c on c.iperiod=b.iperiod and c.csign=b.csign and c.ino_id=b.ino_id where (b.ccode like 101% or b.ccode like 102%) and b.md0 and c.ccode like 113% and c.mc0order by a.iperiod,a.csign,a.ino_idselect a.* from

14、 GL_accvouch a join GL_accvouch b on a.iperiod=b.iperiod and a.csign=b.csign and a.ino_id=b.ino_id where (b.ccode like 101% or b.ccode like 102%) and b.md0 and (b.ccode_equal like 113% or b.ccode_equal like %,113%)/*第三算法 登記一個(gè)科目,末登記一個(gè)科目的算法。使用外連接left(right) join。 實(shí)現(xiàn)兩個(gè)集合的差集運(yùn)算。找出一個(gè)集合中存在而另一個(gè)集合不存在的內(nèi)容*/ -例

15、:檢查所有確認(rèn)收入時(shí),未同時(shí)提取應(yīng)交稅金的銷售收入明細(xì)賬記錄。 -分析:先查詢憑證中有主營業(yè)務(wù)收入,再左連接所有提取了應(yīng)交稅金的記錄,而右表中為空的即為未提取應(yīng)交稅金的記錄。select a.*from (select * from GL_accvouch where ccode like 501% and mc0) aleft join (select * from GL_accvouch where ccode like 221% and mc0) b on a.iperiod=b.iperiod and a.csign=b.csign and a.ino_id=b.ino_idwhere

16、 b.iperiod is nullselect a.* from GL_accvouch a left join GL_accvouch b on a.iperiod=b.iperiod and a.csign=b.csign and a.ino_id=b.ino_id and b.ccode like 221% and b.mc0where a.ccode like 501% and b.iperiod is null and a.mc0-第一個(gè)視圖,獲取所有有501主營業(yè)務(wù)收入的記錄create view a_1 asselect * from GL_accvouch where cco

17、de like 501% and mc0-第二個(gè)視力,獲取所有有221%提取稅金的記錄create view a_2as select * from GL_accvouch where ccode like 221% and mc0-最后,一視圖左連接二視圖,檢查右邊記錄為空的所有記錄,即為確認(rèn)收入時(shí)未同時(shí)提取應(yīng)交稅金。create view a_3asselect a.* from a_1 aleft join a_2 b on a.iperiod =b.iperiod and a.csign=b.csign and a.ino_id=b.ino_idwhere b.iperiod is n

18、ull order by a.iperiod,a.csign,a.ino_iddrop view a_1,a_2 -例:檢查漏繳稅款的憑證 -分析用有主營業(yè)務(wù)收入的a表子查詢作查詢結(jié)果憑證,再與有提取稅金的B表子查詢進(jìn)展左連接,右為空的即為所求。select a.* from GL_accvouch ajoin (select a.*from (select * from GL_accvouch where ccode like 501% and mc0) aleft join (select * from GL_accvouch where ccode like 221% and mc0)

19、b on a.iperiod=b.iperiod and a.csign=b.csign and a.ino_id=b.ino_idwhere b.iperiod is null) bon a.iperiod=b.iperiod and a.csign=b.csign and a.ino_id=b.ino_idselect a.* from GL_accvouch ajoin (select a.* from GL_accvouch a left join GL_accvouch bon a.iperiod=b.iperiod and a.csign=b.csign and a.ino_id=

20、b.ino_id and b.ccode like 221% and b.mc0where a.ccode like 501% and a.mc0 and b.iperiod is null) bon a.iperiod=b.iperiod and a.csign=b.csign and a.ino_id=b.ino_id-在上題的根基上,將憑證表與視圖a_3用join連接,而視圖a_3中的記錄的所在憑證即為漏繳稅款的憑證select a.*from GL_accvouch ajoin a_3 b on a.iperiod=b.iperiod and a.csign=b.csign and a

21、.ino_id=b.ino_idorder by a.iperiod,a.csign,a.ino_iddrop view a_3 /*第四算法 數(shù)據(jù)分層算法*/-利用分組和求和、計(jì)數(shù)函數(shù)實(shí)現(xiàn)分層。三種情況:0到最大值分層;正的最小值到最大值分層;按金額范圍分層。-一從0到最大值分層。分層:(1)統(tǒng)計(jì)業(yè)務(wù)發(fā)生額的最大值、最小值,分別匯總金額和數(shù)量。分層的關(guān)鍵是找出層寬 -(2)使用ceiling取整函數(shù)進(jìn)展分層分組匯總,正數(shù)“進(jìn)一法取整,負(fù)數(shù)“去尾法取整。 -實(shí)際上ceiling函數(shù)是返回大于或等于所給數(shù)值的最小整數(shù)。且注:5/2=2,5/2.0=2.5 -例 將主營業(yè)務(wù)收入明細(xì)賬501科目記錄

22、從0開場(chǎng)到最大值分10層,統(tǒng)計(jì)每層業(yè)務(wù)筆數(shù)、金額,以及占總業(yè)務(wù)筆數(shù)、金額的比率。select MAX(mc) 最大值,MAX(mc)/10 層寬,COUNT(*) 數(shù)量合計(jì),SUM(mc) 金額合計(jì)from GL_accvouch where ccode like 501% and mc0select cast(CEILING(mc/40800.00) as int) 層級(jí),COUNT(*) 業(yè)務(wù)筆數(shù),cast(COUNT(*)/27.00 as numeric(4,2) 數(shù)量比率,sum(mc) 業(yè)務(wù)金額合計(jì),cast(sum(mc)/4733700.00 as numeric(4,4) 金

23、額比率from GL_accvouch where ccode like 501% and mc0 group by CEILING(mc/40800.00)-二從正的最小值到最大值分層 -例 將主營業(yè)務(wù)收入明細(xì)賬501科目記錄從正的最小值開場(chǎng)到最大值分10層,層數(shù)=ceiling(發(fā)生額-最小值)/層寬 -統(tǒng)計(jì)每層業(yè)務(wù)筆數(shù)、金額,以及占總業(yè)務(wù)筆數(shù)、金額的比率。必須要做最小值的判斷,使層數(shù)的開場(chǎng)為1。 select MAX(mc) 最大值,Min(mc) 最小值,(MAX(mc)-MIN(mc)/10 層寬,COUNT(*) 數(shù)量合計(jì),SUM(mc) 金額合計(jì)from GL_accvouch

24、where ccode like 501% and mc0select CEILING(case when mc=6000 then 1 else (mc-6000)/40200.00 end) 層級(jí),COUNT(*) 業(yè)務(wù)筆數(shù),count(*)/27.00 數(shù)量占比,SUM(mc) 業(yè)務(wù)金額合計(jì),SUM(mc)/4733700.00 金額占比from GL_accvouch where ccode like 501% and mc0group by CEILING(case when mc=6000 then 1 else (mc-6000)/40200.00 end)-三按金額范圍分層。

25、-例 將主營業(yè)務(wù)收入明細(xì)賬501科目記錄分為4層,包括2萬元以下,2萬-3萬元,3萬-4萬元,4萬元以上。 -統(tǒng)計(jì)每層業(yè)務(wù)筆數(shù)、金額,以及占總業(yè)務(wù)筆數(shù)、金額的比率。 -分析:首先統(tǒng)計(jì)每筆業(yè)務(wù)所屬的區(qū)間,按區(qū)間確定層級(jí)增加“層級(jí)列。然后再按要求進(jìn)展統(tǒng)計(jì)。select COUNT(*) zsl,SUM(mc) zje from GL_accvouch where ccode like 501% and mc0select 層級(jí),COUNT(*) 業(yè)務(wù)筆數(shù),count(*)/27.00 數(shù)量占比,SUM(mc) 業(yè)務(wù)金額合計(jì),SUM(mc)/4733700.00 金額占比from (select 層

26、級(jí)=case when mc40000 then 4 end,*from GL_accvouch where ccode like 501% and mc0) agroup by 層級(jí) /*第五算法 整理科目的算法*/ -例:從憑證表查詢獲得以下內(nèi)容期間、憑證類型、憑證號(hào)、摘要、科目代碼、借貸方向、金額,利用CASE語句。select iperiod 期間,csign 憑證類型,ino_id 憑證號(hào),a.cdigest 摘要,a.ccode 科目代碼,b.ccode_name 科目名稱,case when md0 then 借 when mc0 then 貸 end 借貸方向,case whe

27、n md0 then md when mc0 then mc end 金額from GL_accvouch a join code b on a.ccode=b.ccode -例:某單位科目代碼級(jí)次為322。以下程序可以生成了個(gè)新的科目代碼表。表中包含兩個(gè)字段科目代碼、科目全稱-分析:利用case語句進(jìn)展判斷。第一個(gè)表用來展示,第2表為二級(jí)科目表,第3表為三級(jí)科目表,第4表為四級(jí)科目表. -按級(jí)次來確定需要連接幾個(gè)表,如題,3個(gè)級(jí)次那么要連接4張表。分別自連接,利用left構(gòu)造各級(jí)次的代碼表select a.ccode 科目代碼,科目全稱=b.ccode_name+case when LEN(

28、a.ccode)3 then +c.ccode_name else EnD +case when LEN(a.ccode)5 then +d.ccode_name else end from code ajoin code b on left(a.ccode,3)=b.ccodejoin code c on left(a.ccode,5)=c.ccodejoin code d on left(a.ccode,7)=d.ccode/*第六算法 真實(shí)性、完整性、一致性檢查的算法分析:真實(shí)性、完整性算法類型比較多,首先看什么是真實(shí)性;什么是完整性,從教師已經(jīng)講過的內(nèi)容來看,注意,查真實(shí)性完整性,在憑

29、證表中都指的是收入憑證,也就是在憑證表中要設(shè)條件ccode like 501%查找真實(shí)性就是從:關(guān)注業(yè)務(wù)的真實(shí)性,進(jìn)展逆查.憑證表發(fā)票表發(fā)貨單即為 gl_accvouch - salebillvouch- dispatchlist查找完整性就是從:發(fā)貨單發(fā)票表憑證表即為 dispatchlist-salebillvouch - gl_accvouch -例:審計(jì)人員檢查銷售發(fā)票所列商品的品名、數(shù)量、金額與發(fā)貨單中所列商品的品名、數(shù)量、金額是否一致。 分析:全連接full join。在不確定兩個(gè)集合的關(guān)系時(shí),可以使用全連接。包含了兩個(gè)集合的所有元素。 通常會(huì)將同一張發(fā)票、發(fā)貨單的主子表連接起來。

30、按品名等分組。在左連接、右連接、全連接時(shí),如 where 條件需要作比較判斷時(shí),需用isnull函數(shù)確定數(shù)據(jù)的準(zhǔn)確性、完整性。*/select * from (select a.cSBVCode,cInvCode,SUM(b.iQuantity) sl,SUM (iNatSum ) jefrom SaleBillVouch a join SaleBillVouchs b on a.SBVID=b.SBVID group by a.cSBVCode,cInvCode) a full join (select a.cSBVCode,a.cdlcode,cInvCode,SUM(b.iQuantit

31、y) sl,SUM(iNatSum) jefrom DispatchList a join DispatchLists b on a.DLID=b.DLID group by a.cSBVCode,a.cdlcode,cInvCode) bon a.cSBVCode=b.cSBVCode and a.cInvCode=b.cInvCode -連接條件where isnull(a.je,0) isnull(b.je,0) or isnull(a.sl,0) isnull(b.sl,0)-一致性比較 or a.cInvCode is null or b.cInvCode is null-發(fā)票主、子

32、表連接create view a_fp asselect a.SBVID,b.cInvCode,SUM(b.iQuantity) sl,SUM(iNatSum) jefrom SaleBillVouch a join SaleBillVouchs b on a.SBVID=b.SBVIDgroup by a.SBVID,b.cInvCodeselect * from a_fpdrop view a_fp-發(fā)貨單主、子表連接create view a_fhd as select a.SBVID,a.cDLCode,b.cInvCode,SUM(b.iQuantity) sl,SUM(iNatSu

33、m) jefrom DispatchList a join DispatchLists b on a.DLID=b.DLIDgroup by a.SBVID,a.cDLCode,b.cInvCodeselect * from a_fhddrop view a_fhd-一致性比較select * from a_fp afull join a_fhd b on a.sbvid=b.sbvid and a.cinvcode=b.cinvcodewhere ISNULL(a.sl,0)ISNULL(b.sl,0) or ISNULL(a.je,0)ISNULL(b.je,0) or a.cinvcod

34、e is null or b.cinvcode is null-檢索出銷售收入明細(xì)賬與發(fā)票不一致的地方./*分析:收入為501, 主要是比照銷售收入的貸方金額sum(mc)與發(fā)票的金額不含稅sum(iNatMoney)是否一致 根據(jù)憑證表中的外部單據(jù)號(hào)coutid、外部單據(jù)類型coutbillsign 與發(fā)票表的發(fā)票號(hào)csbvcode、發(fā)票類型cvouchtype相等作為條件來進(jìn)展判斷。*/select a.coutid,a.coutbillsign,sum(mc) sumje from GL_accvouch a where ccode like 501% and mc0group by a

35、.coutid,a.coutbillsignselect a.cSBVCode ,a.cVouchType,sum(b.iNatMoney) sumjefrom SaleBillVouch a join SaleBillVouchs b on a.SBVID=b.SBVID group by a.cSBVCode ,a.cVouchTypeselect * from (select a.coutid,a.coutbillsign,sum(mc) sumje from GL_accvouch a where ccode like 501% and mc0group by a.coutid,a.c

36、outbillsign) afull join (select a.cSBVCode ,a.cVouchType,sum(b.iNatMoney) sumjefrom SaleBillVouch a join SaleBillVouchs b on a.SBVID=b.SBVID group by a.cSBVCode ,a.cVouchType) bon a.coutid=b.cSBVCode and a.coutbillsign=b.cVouchTypewhere isnull(a.sumje,0)isnull(b.sumje,0)or a.coutbillsign is null or

37、b.cVouchType is null/*(一)真實(shí)性檢查之符合性測(cè)試 (一)真實(shí)性檢查之符合性測(cè)試:業(yè)務(wù)流程逆查,憑證表-?發(fā)票表-?發(fā)貨單-?訂單*/-例題六:檢查銷售發(fā)票副聯(lián)是否附有發(fā)運(yùn)憑證(或提貨單)及顧客訂貨單 -檢查發(fā)票是否附有發(fā)貨單select a.* from SaleBillVouch a left join DispatchList b on a.SBVID=b.SBVID where b.SBVID is null -檢查發(fā)票是否附有訂單select a.* from SaleBillVouch a left join SO_SOMain b on a.cSOCode=

38、b.cSOCode where b.cSOCode is null -例題七:查真實(shí)性,檢查是否每張發(fā)票都有對(duì)應(yīng)的發(fā)貨單。select a.* from SaleBillVouch a left join DispatchList b on a.SBVID=b.SBVID where b.DLID is null -例題八:查真實(shí)性,檢查是否每一張發(fā)票都有對(duì)應(yīng)的訂單select a.* from SaleBillVouch a left join SO_SOMain b on a.cSOCode=b.cSOCode where b.cSOCode is null/*(一)真實(shí)性檢查之實(shí)質(zhì)性測(cè)試

39、*/-1、追查主營業(yè)務(wù)收入的明細(xì)賬中的分錄至銷售單、銷售發(fā)票副聯(lián)及發(fā)運(yùn)憑證。 -檢查主檢察員業(yè)務(wù)收入501的明細(xì)賬分錄是否都銷售開票select * from GL_accvouch a left join SaleBillVouch b on a.coutid=b.cSBVCode and a.coutbillsign=b.cVouchType where b.SBVID is null and a.ccode like 501% and mc0/*(二)完整性檢查:業(yè)務(wù)流程順查,訂單-?發(fā)貨-?發(fā)票-?記賬*/-例題九:查完整性,檢查是否每一張發(fā)票都有對(duì)應(yīng)的收入明細(xì)select *from

40、 SaleBillVouch a left join GL_accvouch b on a.cSBVCode=b.coutid and a.cVouchType=b.coutbillsign where b.coutid is null-例題十:查完整性,檢查是否每一張發(fā)貨單都有對(duì)應(yīng)的發(fā)票select * from DispatchList a left join SaleBillVouch b on a.SBVID=b.SBVID where b.SBVID is null-例題十一:將發(fā)票與收入明細(xì)賬進(jìn)展核對(duì),確定所有的發(fā)票均記賬.select a.* from SaleBillVouch

41、 a left join GL_accvouch b on a.cSBVCode=b.coutid and a.cVouchType=b.coutbillsign and b.ccode like 501% and b.mc0where b.iperiod is null /*第七算法 金額比照檢查的算法,即估價(jià)準(zhǔn)確性算法分析:發(fā)票和記賬憑證相比較,看金額是否對(duì)算法(注意,此題發(fā)票中的金額指的是本幣也即是發(fā)票子表中的inatmoney)金額在發(fā)票子表中,一張發(fā)票主表對(duì)應(yīng)多條發(fā)票子表記錄,所以要對(duì)子表的sbvid分組求每組的合計(jì)值,算出每張發(fā)票總金額*/-例題十一:發(fā)票和收入明細(xì)賬相比較,找出發(fā)

42、票金額和收入金額不相等的記錄。-1、子表按sbvid分組求出每張發(fā)票總金額create view v_103 as select sbvid ,sum(inatmoney) sum_inatmoney from salebillvouchs group by sbvid-2、視圖和發(fā)票主表關(guān)聯(lián)alter view v_104 asselect a.sbvid,a.cvouchtype, a.csbvcode, b.sum_inatmoney from salebillvouch a inner join v_103 bon a.sbvid = b.sbvid-3、發(fā)票金額視圖和收入明細(xì)表關(guān)聯(lián),

43、找出金額不相等的記錄(v_102是前面已生成的收入明細(xì)視圖)select a.iperiod, a.csign, a.ino_id, a.mc , b.sbvid, b.sum_inatmoney from v_102 a inner join v_104 bon a.coutbillsign = b.cvouchtype and a.coutid = b.csbvcodewhere a.mc b.sum_inatmoney -例題十二: 追查主營業(yè)務(wù)收入明細(xì)賬中的分錄至銷售,檢查主營業(yè)務(wù)收入明細(xì)賬中登記金額與銷售發(fā)票中填寫金額是否一致.select iperiod,csign,ino_id,ccode,mc 憑證金額,inatmoney 發(fā)票金額 from GL_accvouch ajoin (select a.cSBVCode,a.cVouchType,SUM(iNatMoney) inatmoney from SaleBillVouch a join S

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

評(píng)論

0/150

提交評(píng)論