以文本方式查看主题 - 安易免费财务软件交流论坛 (http://anyicw.com/bbs/index.asp) -- 用友财务软件交流 (http://anyicw.com/bbs/list.asp?boardid=7) ---- 财务通标准版821存货核算财务通现存量不对怎么办? (http://anyicw.com/bbs/dispbbs.asp?boardid=7&id=23780) |
-- 作者:iabc3000 -- 发布时间:2009/8/16 18:02:28 -- 财务通标准版821存货核算财务通现存量不对怎么办? 财务通标准版821存货核算财务通现存量不对怎么办? |
-- 作者:iabc3000 -- 发布时间:2009/8/16 18:02:59 -- 执行以下脚本能解决问题 select * from sysobjects where name=\'tempcurrentstock\' drop table TempCurrentStock SELECT cWhCode,cInvCode,(CASE WHEN cFree1=\'\'THEN NULL ELSE cFree1 END) AS cFree1 ,(CASE WHEN cFree2=\'\'THEN NULL ELSE cFree2 END) AS cFree2 ,iainquantity AS iQuantity, CAST(0 AS FLOAT) AS fOutQuantity,CAST(0 AS FLOAT) AS fInQuantity INTO TempCurrentStock From ia_subsidiary Where cvoutype=\'34\' group by ia_subsidiary.cWhCode,ia_subsidiary.cInvCode,ia_subsidiary.cFree1, ia_subsidiary.cFree2,ia_subsidiary.iainquantity INSERT INTO TempCurrentStock(cWhCode,cInvCode,cFree1,cFree2,iQuantity) SELECT cWhCode, cInvCode,(CASE WHEN cFree1=\'\'THEN NULL ELSE cFree1 END) AS cFree1 ,( CASE WHEN cFree2=\'\'THEN NULL ELSE cFree2 END) AS cFree2 , (CASE WHEN bRdFlag<>0 THEN iQuantity ELSE -iQuantity END) AS iQuantity FROM RdRecord INNER JOIN RdRecords ON RdRecord.ID = RdRecords.ID WHERE cVouchType<>\'33\'AND cVouchType<>\'34\' AND RdRecord.dDate>=\'2007-1-01\' INSERT INTO TempCurrentStock(cWhCode,cInvCode,cFree1,cFree2,fOutQuantity) SELECT EnDispatchs.cWhCode, EnDispatchs.cInvCode,(CASE WHEN EnDispatchs.cFree1= \'\' THEN NULL ELSE EnDispatchs.cFree1 END) AS cFree1 ,(CASE WHEN EnDispatchs. cFree2=\'\' THEN NULL ELSE EnDispatchs.cFree2 END) AS cFree2 , (ISNULL(iQuantity, 0)-ISNULL(fOutQuantity,0)) AS fOutQuantity FROM EnDispatch INNER JOIN EnDispatchs ON EnDispatch.EDID = EnDispatchs.EDID WHERE ISNULL(EnDispatchs.cWhCode,\'\')<>\'\' AND ISNULL(EnDispatch.cSTCode,\'\')<>\'\' AND EnDispatchs.iQuantity>0 AND bReturnFlag=0 INSERT INTO TempCurrentStock(cWhCode,cInvCode,cFree1,cFree2,fOutQuantity) SELECT DispatchLists.cWhCode as cWhCode, DispatchLists.cInvCode as cInvCode,( CASE WHEN DispatchLists.cFree1=\'\' THEN NULL ELSE DispatchLists.cFree1 END) AS cFree1 , (CASE WHEN DispatchLists.cFree2=\'\' THEN NULL ELSE DispatchLists.cFree2 END) AS cFree2 , (ISNULL(iQuantity,0)-ISNULL(fOutQuantity,0)) AS fOutQuantity FROM DispatchLists INNER JOIN DispatchList ON DispatchLists.DLID = DispatchList.DLID WHERE DispatchList.cVouchType=\'05\' AND ISNULL(DispatchLists.cWhCode,\'\')<>\'\' AND ISNULL(DispatchList.cSTCode,\'\')<>\'\' AND (DispatchList.iSale=0 or DispatchList.iSale IS NULL) AND DispatchLists.iQuantity>0 INSERT INTO TempCurrentStock(cWhCode,cInvCode,cFree1,cFree2,fOutQuantity) SELECT cWhCode, cInvCode,(CASE WHEN cFree1=\'\'THEN NULL ELSE cFree1 END) AS cFree1 , (CASE WHEN cFree2=\'\'THEN NULL ELSE cFree2 END) AS cFree2 , (ISNULL( iQuantity,0)-ISNULL(fOutQuantity,0)) AS fOutQuantity FROM SaleBillVouchs INNER JOIN SaleBillVouch ON SaleBillVouch.SBVID= SaleBillVouchs.SBVID WHERE ISNULL(SaleBillVouchs.cWhCode,\'\')<>\'\' AND (SaleBillVouch.iDisp=0 OR SaleBillVouch.iDisp IS NULL) AND ISNULL(cBusType,\'\')<>\'委托\' AND ISNULL( cSTCode,\'\')<>\'\' AND ISNULL(cInvalider,\'\')=\'\' AND SaleBillVouchs.iQuantity> 0INSERT INTO CurrentStock(cWhCode,cInvCode,cFree1,cFree2,iQuantity,fOutQuantity, fInQuantity) SELECT cWhCode, cInvCode,cFree1,cFree2 , sum(iQuantity) AS iQuantity,sum( ISNULL(fOutQuantity,0)) AS fOutQuantity, sum(ISNULL(fInQuantity,0)) AS fInQuantity FROM TempCurrentStock GROUP BY cWhCode,cInvCode,cFree1,cFree2 Delete From CurrentStock where iquantity is null and foutquantity=0 and finquantity=0 |
-- 作者:清风生 -- 发布时间:2010/4/26 22:08:36 -- 哦 这样啊 |
-- 作者:caritas -- 发布时间:2011/3/2 17:59:32 -- 看不懂哦 |
-- 作者:sunjiacun -- 发布时间:2011/10/7 15:28:36 -- 看不明白 |
-- 作者:hlp34567 -- 发布时间:2011/10/8 8:25:41 -- 好麻烦看不懂 |
-- 作者:dmacc906 -- 发布时间:2011/11/5 21:35:23 -- 应该不会啊~~ |