• <sup id="azsug"></sup>

    <menu id="azsug"></menu><dfn id="azsug"><li id="azsug"></li></dfn>
      <td id="azsug"></td>
      <sup id="azsug"></sup>
    1. 丰满无码人妻热妇无码区,亚洲国产欧美一区二区好看电影,大地资源中文第二页日本,亚洲色大成网站WWW永久麻豆,中文字幕乱码一区二区免费,欧美人妻在线一区二区,草裙社区精品视频播放,精品日韩人妻中文字幕
      24周年

      財稅實務 高薪就業 學歷教育
      APP下載
      APP下載新用戶掃碼下載
      立享專屬優惠

      安卓版本:8.8.30 蘋果版本:8.8.30

      開發者:北京正保會計科技有限公司

      應用涉及權限:查看權限>

      APP隱私政策:查看政策>

      HD版本上線:點擊下載>

      利用SQL游標核對銀行對賬單與銀行日記賬

      來源: 張金芳 編輯: 2010/01/25 13:19:04  字體:

      選課中心

      實務會員買一送一

      選課中心

      資料專區

      需要的都在這里

      資料專區

      課程試聽

      搶先體驗

      課程試聽

      高薪就業

      從零基礎到經理

      高薪就業

        核對銀行對賬單與單位銀行日記賬(以下簡稱單位日記賬)是對銀行存款審計中一項重要的步驟。通過核對銀行對賬單與單位日記賬,可以查找出未達賬項,從而為發現出租、出借帳戶、挪用公款,非法出借資金等違紀問題提供線索。以往查找未達賬項采用的是手工逐行勾挑的方法。這種方法耗時長,準確性不高。尤其是對一些存取款業務頻繁的單位,手工核對更是顯得力不從心。而利用SQL游標則可以快速查找未達賬項,從而取得事半功倍的效果。

        一、采集銀行對賬單和單位日記賬數據,并進行必要的整理轉換,使其對應字段的長度、數據類型相同。如:通常銀行日記賬的支票號為銀行對賬單的憑證號的后四位,因此應對銀行對賬單的憑證號作截斷處理。Update 銀行對賬單 set 憑證號=right(憑證號,4)

        二、對應整理后的銀行對賬單和單位日記賬創建四個空表用于接收未達賬項記錄:單位已付銀行未付、單位已收銀行未收、銀行已付單位未付、銀行已收單位未收。如:

        create table 單位已付銀行未付 (憑證日期 varchar(14),摘要 nvarchar(50),支票號 nvarchar(10),借方金額 money,貸方金額 money)

        create table 單位已收銀行未收 (憑證日期 varchar(14),摘要 nvarchar(50),支票號 nvarchar(10),借方金額 money,貸方金額 money)

        create table 銀行已付單位未付 (憑證日期 varchar(14),摘要 nvarchar(50),憑證號 nvarchar(10),借方金額 money,貸方金額 money)

        create table 銀行已收單位未收 (憑證日期 varchar(14),摘要 nvarchar(50),憑證號 nvarchar(10),借方金額 money,貸方金額 money)

        三、創建游標,將所有金額以是否有重復金額為條件分為相同金額和不同金額記錄,再做對應比較,分步篩選未達賬項:

        1、篩選單位日記賬不同金額借方有銀行對賬單貸方無的記錄

        declare cur1 cursor for select 借方金額 from 單位日記賬 where 借方金額 in (select 借方金額 from 單位日記賬 group by 借方金額 having count(借方金額)=1)

        open cur1

        declare @借方金額 money

        fetch next from cur1 into @借方金額

        while @@fetch_status=0

        begin

        if @借方金額 in (select 貸方金額 from 銀行對賬單 group by 貸方金額 having count(貸方金額)=1)

        fetch next from cur1 into @借方金額

        else

        begin

        insert into 單位已收銀行未收 select * from 單位日記賬 where 借方金額=@借方金額

        fetch next from cur1 into @借方金額

        end

        end

        close cur1

        deallocate cur1

        2、篩選單位日記賬不同金額貸方有銀行對賬單借方無的記錄

        declare cur1 cursor for select 貸方金額 from 單位日記賬 group by 貸方金額 having count(貸方金額)=1

        open cur1

        declare @貸方金額 money

        fetch next from cur1 into @貸方金額

        while @@fetch_status=0

        begin

        if @貸方金額 in (select 借方金額 from 銀行對賬單

        group by 借方金額 having count(借方金額)=1)

        fetch next from cur1 into @貸方金額

        else

        begin

        insert into 單位已付銀行未付 select * from 單位日記賬 where 貸方金額=@貸方金額

        fetch next from cur1 into @貸方金額

        end

        end

        close cur1

        deallocate cur1

        3、篩選單位日記賬相同金額借方有銀行對賬單貸方無的記錄

        declare cur1 cursor for select 借方金額,count(*) 個數 from 單位日記賬 where 借方金額0 group by 借方金額 having count(借方金額)>1

        open cur1

        declare @借方金額 money,@個數 int

        fetch next from cur1 into @借方金額,@個數

        while @@fetch_status=0

        begin

        if @個數 =(select count(*) from 銀行對賬單 where 貸方金額=@借方金額)

        fetch next from cur1 into @借方金額,@個數

        else

        begin

        insert into 單位已收銀行未收 select * from 單位日記賬 where 借方金額=@借方金額

        fetch next from cur1 into @借方金額,@個數

        end

        end

        close cur1

        deallocate cur1

        4、篩選單位日記賬相同金額貸方有銀行對賬單借方無的記錄

        declare cur1 cursor for select 貸方金額,count(*) 個數 from 單位日記賬 where 貸方金額0 group by 貸方金額 having count(借方金額)>1

        open cur1

        declare @貸方金額 money,@個數 int

        fetch next from cur1 into @貸方金額,@個數

        while @@fetch_status=0

        begin

        if @個數 =(select count(*) from 銀行對賬單 where 借方金額=@貸方金額)

        fetch next from cur1 into @貸方金額,@個數

        else

        begin

        insert into 單位已付銀行未付 select * from 單位日記賬 where 支票號 is null and 貸方金額=@貸方金額

        declare cur2 cursor for select 支票號 from 單位日記賬 where 貸方金額=@貸方金額 and 支票號 is not null

        open cur2

        declare @支票號 varchar(10)

        fetch next from cur2 into @支票號

        while @@fetch_status=0

        begin

        if @支票號 in (select 憑證號 from 銀行對賬單 where 借方金額=@貸方金額)

        fetch next from cur2 into @支票號

        else

        begin

        insert into 單位已付銀行未付 select * from 單位日記賬 where 支票號=@支票號

        fetch next from cur2 into @支票號

        end

        end

        close cur2

        deallocate cur2

        fetch next from cur1 into @貸方金額,@個數

        end

        end

        close cur1

        deallocate cur1

        5、篩選銀行對賬單不同金額借方有單位日記賬貸方無的記錄

        declare cur1 cursor for select 借方金額 from 銀行對賬單 group by 借方金額 having count(借方金額)=1

        open cur1

        declare @借方金額 money

        fetch next from cur1 into @借方金額

        while @@fetch_status=0

        begin

        if @借方金額 in (select 貸方金額 from 單位日記賬 group by 貸方金額 having count(貸方金額)=1)

        fetch next from cur1 into @借方金額

        else

        begin

        insert into 銀行已付單位未付 select * from 銀行對賬單 where 借方金額=@借方金額

        fetch next from cur1 into @借方金額

        end

        end

        close cur1

        deallocate cur1

        6、篩選銀行對賬單不同金額貸方有單位日記賬借方無的記錄

        declare cur1 cursor for select 貸方金額 from 銀行對賬單 group by 貸方金額 having count(貸方金額)=1

        open cur1

        declare @貸方金額 money

        fetch next from cur1 into @貸方金額

        while @@fetch_status=0

        begin

        if @貸方金額 in (select 借方金額 from 單位日記賬

        group by 借方金額 having count(借方金額)=1)

        fetch next from cur1 into @貸方金額

        else

        begin

        insert into 銀行已收單位未收 select * from 銀行對賬單 where 貸方金額=@貸方金額

        fetch next from cur1 into @貸方金額

        end

        end

        close cur1

        deallocate cur1

        7、篩選銀行對賬單相同金額借方有單位日記賬貸方無的記錄

        declare cur1 cursor for select 借方金額,count(*) 個數 from 銀行對賬單 where 借方金額0 group by 借方金額 having count(借方金額)>1

        open cur1

        declare @借方金額 money,@個數 int

        fetch next from cur1 into @借方金額,@個數

        while @@fetch_status=0

        begin

        if @個數 =(select count(*) from 單位日記賬 where 貸方金額=@借方金額)

        fetch next from cur1 into @借方金額,@個數

        else

        begin

        insert into 銀行已付單位未付 select * from 銀行對賬單 where 憑證號 is null and 借方金額=@借方金額

        declare cur2 cursor for select 憑證號 from 銀行對賬單 where 借方金額=@借方金額 and 憑證號 is not null

        open cur2

        declare @憑證號 varchar(10)

        fetch next from cur2 into @憑證號

        while @@fetch_status=0

        begin

        if @憑證號 in (select 支票號 from 單位日記賬 where 貸方金額=@借方金額)

        fetch next from cur2 into @憑證號

        else

        begin

        insert into 銀行已付單位未付 select * from 銀行對賬單 where 憑證號=@憑證號

        fetch next from cur2 into @憑證號

        end

        end

        close cur2

        deallocate cur2

        fetch next from cur1 into @借方金額,@個數

        end

        end

        close cur1

        deallocate cur1

        8、篩選銀行對賬單相同金額貸方有單位日記賬借方無的記錄

        declare cur1 cursor for select 貸方金額,count(*) 個數 from 銀行對賬單 where 貸方金額0 group by 貸方金額 having count(借方金額)>1

        open cur1

        declare @貸方金額 money,@個數 int

        fetch next from cur1 into @貸方金額,@個數

        while @@fetch_status=0

        begin

        if @個數 =(select count(*) from 單位日記賬 where 借方金額=@貸方金額)

        fetch next from cur1 into @貸方金額,@個數

        else

        begin

        insert into 銀行已收單位未收 select * from 銀行對賬單 where 貸方金額=@貸方金額

        fetch next from cur1 into @貸方金額,@個數

        end

        end

        close cur1

        deallocate cur1

      責任編輯:zoe
      學員討論(0

      實務學習指南

      回到頂部
      折疊
      網站地圖

      Copyright © 2000 - www.sgjweuf.cn All Rights Reserved. 北京正保會計科技有限公司 版權所有

      京B2-20200959 京ICP備20012371號-7 出版物經營許可證 京公網安備 11010802044457號

      恭喜你!獲得專屬大額券!

      套餐D大額券

      去使用
      主站蜘蛛池模板: 久久综合色之久久综合色| 国产美女69视频免费观看| 久久香蕉国产线看观看猫咪av| 粉嫩小泬无遮挡久久久久久| www国产精品内射熟女| 国产欧美精品一区二区三区四区| 福利网午夜视频一区二区| 国产一区二区一卡二卡| 亚洲中文精品一区二区| 国产精品午夜无码AV天美传媒| 精品一区二区三区在线视频观看| 国产精品第一二三区久久 | 成年午夜无码av片在线观看| 乱码午夜-极品国产内射| 国产精品区一二三四久久| 无码人妻丰满熟妇区bbbbxxxx| 亚洲国产中文字幕在线视频综合| 影音先锋男人站| 亚洲av天堂综合网久久| 日韩精品国产二区三区| 久久96热在精品国产高清| 久久亚洲精品国产精品| 国产欧美另类精品久久久 | 精品人妻一区二区| 91中文字幕在线一区| 一个人免费观看WWW在线视频| 国产精品免费无遮挡无码永久视频| 视频一区视频二区卡通动漫| 国产一级av在线播放| 欧美熟妇乱子伦XX视频| 好硬好湿好爽再深一点动态图视频| 亚洲韩国精品无码一区二区三区 | 亚洲天堂av在线免费看| 国产成人欧美一区二区三区在线| 永久无码天堂网小说区| 久久不见久久见免费影院www日本 亚洲综合精品一区二区三区 | 亚洲国产在一区二区三区| 成午夜福利人试看120秒| 亚洲av精彩一区二区| 亚洲午夜精品国产电影在线观看| 成人性无码专区免费视频|