[期限统计]
进货情况统计表=Y

[进货情况统计表]
DATASET_COUNT=2
DS_ALIAS1=M
DS_ALIAS2=D
SQL1=Select #D_B# As beginData, #D_E# As endData
SQL2=Select * from V_Yw_InMain  Where  In_Date between #D_B# and #D_E# QT_TJ order by In_Date

[进货情况明细表]
DATASET_COUNT=2
DS_ALIAS1=M
DS_ALIAS2=D
SQL1=Select #D_B# As beginData, #D_E# As endData
SQL2=select * from V_Yw_InData_Detail where In_Date between #D_B# and #D_E# QT_TJ order by In_Date

;SQL2=select d.*, m.*, g.*, d.InNum*d.InPrice AS TPrice, c.ClientName  from Yw_InDetail d, V_Yw_InMain m, Jb_Goods g, Jb_Client c where c.Client_Id = m.ClientId_In and m.InMain_ID=d.InMainId_Detail and d.GoodsId_In=g.Goods_Id and m.In_Date between #D_B# and #D_E# QT_TJ order by m.In_Date

[进货情况汇总表(供应商)]
DATASET_COUNT=2
DS_ALIAS1=M
DS_ALIAS2=D
SQL1=Select #D_B# As beginData, #D_E# As endData
SQL2=Select c.ClientName, Sum(TNum) As InNum, Sum(TPrice) As TPrice from V_Yw_InMain m, Jb_Client c where c.Client_Id = m.ClientId_In and m.In_Date between #D_B# and #D_E# QT_TJ Group by m.ClientId_In, c.ClientName

[进货情况汇总表(商品)]
DATASET_COUNT=2
DS_ALIAS1=M
DS_ALIAS2=D
SQL1=Select #D_B# As beginData, #D_E# As endData
SQL2=select g.Goods_Id, g.GoodsName, Sum(d.InNum) As InNum, Sum(d.InNum*d.InPrice) AS TPrice  from Yw_InDetail d, V_Yw_InMain m, Jb_Goods g where m.InMain_ID=d.InMainId_Detail and d.GoodsId_In=g.Goods_Id and m.In_Date between #D_B# and #D_E# QT_TJ Group by g.Goods_Id, g.GoodsName


[销售情况统计表]
DATASET_COUNT=2
DS_ALIAS1=M
DS_ALIAS2=D
SQL1=Select #D_B# As beginData, #D_E# As endData
SQL2=select * from V_Yw_SaMain Where Sa_Date between #D_B# and #D_E# QT_TJ order by Sa_Date

[销售情况明细表]
DATASET_COUNT=2
DS_ALIAS1=M
DS_ALIAS2=D
SQL1=Select #D_B# As beginData, #D_E# As endData
SQL2=select *  from V_Yw_SaData_Detail where  Sa_Date between #D_B# and #D_E# QT_TJ order by Sa_Date

[销售情况汇总表(客户)]
DATASET_COUNT=2
DS_ALIAS1=M
DS_ALIAS2=D
SQL1=Select #D_B# As beginData, #D_E# As endData
SQL2=select c.ClientName, sum(m.TPrice) as TPrice, sum(m.TPrice_In) as TPrice_In, sum(m.TPrice_Ml) as TPrice_Ml  from V_Yw_SaMain m, Jb_Client c Where c.Client_Id = m.ClientId_Sa and m.Sa_Date between #D_B# and #D_E# QT_TJ group by m.ClientId_Sa, c.ClientName

[销售情况汇总表(商品)]
DATASET_COUNT=2
DS_ALIAS1=M
DS_ALIAS2=D
SQL1=Select #D_B# As beginData, #D_E# As endData
SQL2=select g.Goods_Id, g.GoodsName, Sum(d.SaNum) As SaNum, Sum(d.SaNum*d.SaPrice) AS TPrice  from Yw_SaDetail d, V_Yw_SaMain m, Jb_Goods g where m.SaMain_ID=d.SaMainId_Detail and d.GoodsId_Sa=g.Goods_Id and m.Sa_Date between #D_B# and #D_E# QT_TJ Group by g.Goods_Id, g.GoodsName



[零售情况明细表]
DATASET_COUNT=2
DS_ALIAS1=M
DS_ALIAS2=D
SQL1=Select #D_B# As beginData, #D_E# As endData
SQL2=select *  from V_Yw_PosData where  Sa_Date120 between #D_B# and #D_E# QT_TJ order by Sa_Date120

[零售情况汇总表(商品)]
DATASET_COUNT=2
DS_ALIAS1=M
DS_ALIAS2=D
SQL1=Select #D_B# As beginData, #D_E# As endData
SQL2=select Goods_Id,GoodsName, Sum(SaNum) As SaNum, Sum(TSaPrice) AS TPrice  from V_Yw_PosData where Sa_Date120 between #D_B# and #D_E# QT_TJ Group by Goods_Id,GoodsName

[零售情况汇总表(销售员)]
DATASET_COUNT=2
DS_ALIAS1=M
DS_ALIAS2=D
SQL1=Select #D_B# As beginData, #D_E# As endData
SQL2=select SaUser, Sum(SaNum) As SaNum, Sum(TSaPrice) AS TPrice  from V_Yw_PosData where Sa_Date120 between #D_B# and #D_E# QT_TJ Group by SaUser

[零售情况汇总表(支付方式)]
DATASET_COUNT=2
DS_ALIAS1=M
DS_ALIAS2=D
SQL1=Select #D_B# As beginData, #D_E# As endData
SQL2=select PayType,sum(PayPrice) as TPayPrice from (select a.Sa_Date120,b.* from V_Yw_PosMain a,Yw_PayLog b where a.PosMain_Id=b.ObjId and b.ObjType=3) a where Sa_Date120 between #D_B# and #D_E# QT_TJ group by PayType

[会员消费情况汇总表]
DATASET_COUNT=2
DS_ALIAS1=M
DS_ALIAS2=D
SQL1=Select #D_B# As beginData, #D_E# As endData
SQL2=select a.*,b.* from (select VipId_Sa, Sum(SaNum) As SaNum, Sum(TSaPrice) AS TPrice  from V_Yw_PosData where Sa_Date120 between #D_B# and #D_E# and VipId_Sa>0 QT_TJ Group by VipId_Sa) a,V_Jb_Vip b where a.VipId_Sa=b.Vip_Id

[库存日报表]
DATASET_COUNT=2
DS_ALIAS1=M
DS_ALIAS2=D
SQL1=Select #D_B# As beginData, #D_E# As endData
SQL2=Select t.PosiId_Kc, t.GoodsId_Kc, t.PosiNo, t.PosiName, t.GoodsNo, t.GoodsName, t.Unit, t.Depart, t.TypeName, t.OtherNo, t.KcNum + iif(t.TotleBSaNum is null, 0, t.TotleBSaNum) - iif(t.TotleBInNum is null, 0, t.TotleBInNum) As BNum, iif(t.InNum is null, 0, t.InNum) As InNum, iif(t.SaNum is null, 0, t.SaNum) As SaNum, t.KcNum + iif(t.TotleESaNum is null, 0, t.TotleESaNum)  - iif(t.TotleEInNum is null, 0, t.TotleEInNum) As ENum from (Select k.PosiId_Kc, k.GoodsId_Kc, p.PosiNo, p.PosiName, g.GoodsNo, g.GoodsName, g.Unit, g.Depart, Sum(k.KcNum) As KcNum, (Select Sum(i.InNum) from V_Yw_InData_Detail i Where i.InState = 1 and i.PosiId_In = k.PosiId_Kc and i.GoodsId_in = k.GoodsId_Kc  and i.In_Date >= #D_B#) As TotleBInNum, (Select Sum(s.AllSaNum) from v_YW_AllSaDetail s Where s.PosiId_Sa = k.PosiId_Kc and s.GoodsId_Sa = k.GoodsId_Kc  and s.Sa_Date >= #D_B#) As TotleBSaNum, (Select Sum(i.InNum) from V_Yw_InData_Detail i Where i.InState = 1 and i.PosiId_In = k.PosiId_Kc and i.GoodsId_in = k.GoodsId_Kc  and i.In_Date between #D_B# and  #D_E#) as InNum, (Select Sum(s.AllSaNum) from v_YW_AllSaDetail s Where s.PosiId_Sa = k.PosiId_Kc and s.GoodsId_Sa = k.GoodsId_Kc  and s.Sa_Date between #D_B# and  #D_E#) As SaNum, (Select Sum(i.InNum) from V_Yw_InData_Detail i Where i.InState = 1 and i.PosiId_In = k.PosiId_Kc and i.GoodsId_in = k.GoodsId_Kc  and i.In_Date > #D_E#) As TotleEInNum, (Select Sum(s.AllSaNum) from v_YW_AllSaDetail s Where s.PosiId_Sa = k.PosiId_Kc and s.GoodsId_Sa = k.GoodsId_Kc  and s.Sa_Date > #D_E#) As TotleESaNum, (Select TypeName from Jb_ObjTreeType m Where m.MeId = g.[TypeId_Goods]) As TypeName, g.OtherNo From Yw_KcData k, Jb_Posi p, Jb_Goods g Where k.PosiId_Kc = p.Posi_Id And k.GoodsId_Kc = g.Goods_Id Group by k.PosiId_Kc, k.GoodsId_Kc, p.PosiNo, p.PosiName, g.GoodsNo, g.GoodsName, g.Unit, g.Depart, g.TypeId_Goods, OtherNo) t Order by t.PosiId_Kc, t.GoodsId_Kc 



[库存月报表]
DATASET_COUNT=2
DS_ALIAS1=M
DS_ALIAS2=D
SQL1=Select #D_B# As beginData, #D_E# As endData
SQL2=Select t.PosiId_Kc, t.GoodsId_Kc, t.PosiNo, t.PosiName, t.GoodsNo, t.GoodsName, t.Unit, t.Depart, t.TypeName, t.OtherNo, t.KcNum + iif(t.TotleBSaNum is null, 0, t.TotleBSaNum) - iif(t.TotleBInNum is null, 0, t.TotleBInNum) As BNum, iif(t.InNum is null, 0, t.InNum) As InNum, iif(t.SaNum is null, 0, t.SaNum) As SaNum, t.KcNum + iif(t.TotleESaNum is null, 0, t.TotleESaNum)  - iif(t.TotleEInNum is null, 0, t.TotleEInNum) As ENum from (Select k.PosiId_Kc, k.GoodsId_Kc, p.PosiNo, p.PosiName, g.GoodsNo, g.GoodsName, g.Unit, g.Depart, Sum(k.KcNum) As KcNum, (Select Sum(i.InNum) from V_Yw_InData_Detail i Where i.InState = 1 and i.PosiId_In = k.PosiId_Kc and i.GoodsId_in = k.GoodsId_Kc  and i.In_Date >= #D_B#) As TotleBInNum, (Select Sum(s.AllSaNum) from v_YW_AllSaDetail s Where s.PosiId_Sa = k.PosiId_Kc and s.GoodsId_Sa = k.GoodsId_Kc  and s.Sa_Date >= #D_B#) As TotleBSaNum, (Select Sum(i.InNum) from V_Yw_InData_Detail i Where i.InState = 1 and i.PosiId_In = k.PosiId_Kc and i.GoodsId_in = k.GoodsId_Kc  and i.In_Date between #D_B# and  #D_E#) as InNum, (Select Sum(s.AllSaNum) from v_YW_AllSaDetail s Where s.PosiId_Sa = k.PosiId_Kc and s.GoodsId_Sa = k.GoodsId_Kc  and s.Sa_Date between #D_B# and  #D_E#) As SaNum, (Select Sum(i.InNum) from V_Yw_InData_Detail i Where i.InState = 1 and i.PosiId_In = k.PosiId_Kc and i.GoodsId_in = k.GoodsId_Kc  and i.In_Date > #D_E#) As TotleEInNum, (Select Sum(s.AllSaNum) from v_YW_AllSaDetail s Where s.PosiId_Sa = k.PosiId_Kc and s.GoodsId_Sa = k.GoodsId_Kc  and s.Sa_Date > #D_E#) As TotleESaNum, (Select TypeName from Jb_ObjTreeType m Where m.MeId = g.[TypeId_Goods]) As TypeName, g.OtherNo From Yw_KcData k, Jb_Posi p, Jb_Goods g Where k.PosiId_Kc = p.Posi_Id And k.GoodsId_Kc = g.Goods_Id Group by k.PosiId_Kc, k.GoodsId_Kc, p.PosiNo, p.PosiName, g.GoodsNo, g.GoodsName, g.Unit, g.Depart, g.TypeId_Goods, OtherNo) t Order by t.PosiId_Kc, t.GoodsId_Kc 


[GbTree_Width]
Width=227
[ERRORSQL]
SQL=select PayType,sum(PayPrice) as TPayPrice from (select a.Sa_Date120,b.* from V_Yw_PosMain a,Yw_Pay b where a.PosMain_Id=b.ObjId and b.ObjType=1) a where Sa_Date120 between #2010-10-17# and #2010-11-17#  group by PayType
