- 打卡等级:无名新人
- 打卡总天数:1
- 打卡月天数:0
- 打卡总奖励:3
- 最近打卡:2024-10-15 13:48:57
|
楼主 |
发表于 2010-9-11 17:20:47
|
显示全部楼层
回复 2# zhanghucupite
跟踪结果,高手帮看看!
SET NO_BROWSETABLE ON
go
SELECT MAX(iPeriod) AS CurMonth FROM GL_mEnd WHERE bFlag_IA=1
go
SET NO_BROWSETABLE ON
go
declare @P1 int
set @P1=1
exec sp_prepare @P1 output, NULL, N'SELECT * FROM GL_mEnd', 1
select @P1
go
exec sp_reset_connection
go
Select dBegin,dEnd from UA_Period where cAcc_ID='006' and iYear=2010 and iID=8
go
SET NO_BROWSETABLE ON
go
SELECT MAX(iPeriod) AS CurMonth FROM GL_mEnd WHERE bFlag_IA=1
go
SET NO_BROWSETABLE ON
go
declare @P1 int
set @P1=1
exec sp_prepare @P1 output, NULL, N'SELECT * FROM GL_mEnd', 1
select @P1
go
SELECT IA_EstiSettle.PSVID, IA_EstiSettle.ID, IA_EstiSettle.iRdID,IA_EstiSettle.iRdsid, ' ' AS 表达式1,IA_EstiSettle.cSVCode, IA_EstiSettle.cWhCode, IA_EstiSettle.cWhName,IA_EstiSettle.cPIVCode, IA_EstiSettle.DDATE, IA_EstiSettle.cInvCode,IA_EstiSettle.cInvName, IA_EstiSettle.cInvM_Unit, LTRIM(STR(IA_EstiSettle.iSVQuantity,20,2)),LTRIM(STR((Case When IsNull(IA_EstiSettle.iRdsid,0)<>0 then(case when isnull(ia_subsidiary.iainquantity,0)=0 then 0 else (isnull(ia_subsidiary.iainprice,0)+-1*isnull(ia_subsidiary.iCreditDifCost,0))/ia_subsidiary.iainquantity end)else ia_estisettle.isvacost end),20,6)), LTRIM(STR((Case When Isnull(IA_EstiSettle.iRdsid,0)<>0 then IsNull(IA_EstiSettle.iSVQuantity,0)*(case when isnull(ia_subsidiary.iainquantity,0)=0 then 0 else (isnull(ia_subsidiary.iainprice,0)+-1*isnull(ia_subsidiary.iCreditDifCost,0))/ia_subsidiary.iainquantity end) Else ISNULL(IA_EstiSettle.iSVAPrice,0) End),20,2)), LTRIM(STR((case when ( isnull(IA_EstiSettle.iSVCost,0)=0 and isnull(IA_EstiSettle.iSVPrice,0)<>0) then 0 else (isnull(IA_EstiSettle.iSVQuantity,0)) end),20,2)),LTRIM(STR((case when isnull(IA_EstiSettle.iSVQuantity,0)=0 then 0 else (isnull(IA_EstiSettle.iSVPrice,0)/isnull(IA_EstiSettle.iSVQuantity,0)) end),20,6)),LTRIM(STR(IA_EstiSettle.iSVPrice,20,2)),IA_EstiSettle.ibsid,IA_EstiSettle.cRdCode, IA_EstiSettle.cRdName,IA_EstiSettle.cFree1,IA_EstiSettle.cFree2,IA_EstiSettle.cFree3, IA_EstiSettle.cFree4,IA_EstiSettle.cFree5, IA_EstiSettle.cFree6,IA_EstiSettle.cFree7, IA_EstiSettle.cFree8,IA_EstiSettle.cFree9, IA_EstiSettle.cFree10 FROM (((((IA_EstiSettle INNER JOIN Inventory ON IA_EstiSettle.cInvCode = Inventory.cInvCode) left Join PurBillVouchs On IA_EstiSettle.iBSid=PurBillVouchs.Id) Left JOIN RdRecords ON IA_EstiSettle.iRdsID = RdRecords.AutoID)left join ia_subsidiary on rdrecords.autoid=ia_subsidiary.id)left join rdrecord on rdrecords.id=rdrecord.id) WHERE (((Purbillvouchs.bExBill=1 and isnull(IA_EstiSettle.iRdsid,0)=0) or (Purbillvouchs.bExBill=1 and isnull(IA_EstiSettle.iRdsid,0)<>0 and (ia_subsidiary.cvoutype='01' or ia_subsidiary.cvoutype='33'))) or (isnull(IA_EstiSettle.iRdsid,0)<>0 and (ia_subsidiary.cvoutype='01' or ia_subsidiary.cvoutype='33'))) and IA_EstiSettle.dSVDate<='2010-08-31' AND (IA_EstiSettle.bAccount=0) and (isnull(IA_EstiSettle.iSVQuantity,0)<>0 or isnull(IA_EstiSettle.iSVPrice,0)<>0) AND ((Purbillvouchs.bExBill=1) or (rdrecord.cbustype='受托代销' or (rdrecord.cbustype<>'受托代销' and rdrecords.dsdate<='2010-08-31'))) AND ((RIGHT(IA_EstiSettle.cMonth,2)<'08') OR (IA_EstiSettle.cMonth is null)) and ia_subsidiary.bflag<>2 AND IA_EstiSettle.cWhCode IN ('001') order by IA_EstiSettle.PSVID,IA_EstiSettle.ID,ia_subsidiary.bflag desc,IA_EstiSettle.cWhCode,IA_EstiSettle.cCode
go |
|