[FLAG]
ShowDesign=Y

[生产计划管理]
生产计划原料单=Y

[生产入库管理]
Delivery Note=Y

[销售管理]
INVOICE=Y
INVOICE_欧元=
INVOICE_BIBBY=
;INVOICE_挂账14=
DeliveryNote=
CreditNote=



[Delivery Note]
DS_NUM=3
MKEY_NUM=1
DS_ALIAS1=M
DS_ALIAS2=D
DS_ALIAS3=T
MKEY1=InHead_Id
SQL1=select * from V_Yw_InHead_Sc where InHead_Id=@1
SQL2=select a.*,(InNum*In_Price) as TPrice,b.Depart,b.GoodsNo,b.GoodsName,b.GoodsName_E from Yw_InDetail a,Jb_Goods b where InMain_Id=@1 and a.GoodsId_In=b.Goods_Id
SQL3=select sum(InNum) as TNum,sum(InNum*In_Price) as TPrice from Yw_InDetail where InMain_Id=@1 group by InMain_Id


[DeliveryNote]
DS_NUM=3
MKEY_NUM=1
DS_ALIAS1=M
DS_ALIAS2=D
DS_ALIAS3=T
MKEY1=SaHead_Id
SQL1=select * from V_Yw_SaHead where SaHead_Id=@1
SQL2=select c.Depart,c.GoodsNo,c.GoodsName,c.GoodsName_E,d.SaMain_Id,d.SaNum,e.Currency_Code,e.Exchange_Rate from Jb_Goods c,Yw_SaDetail d,Yw_SaHead e  where d.SaMain_Id=@1 and c.Goods_Id=d.GoodsId_Sa and d.SaMain_Id=e.SaHead_Id order by GoodsNo
SQL3=select sum(UseNum) as TNum from (select a.*,b.Pc,c.GoodsNo,c.GoodsName,c.GoodsName_E,d.SaMain_Id,d.SaNum from Yw_KcData_Change a,Yw_KcData b,Jb_Goods c,Yw_SaDetail d where d.SaMain_Id=@1 and a.UseNum<>0 and a.KcId_Change=b.KcData_Id and b.GoodsId_Kc=c.Goods_Id and a.ObjId=d.SaDetail_Id) a

[DeliveryNote_分批次]
DS_NUM=3
MKEY_NUM=1
DS_ALIAS1=M
DS_ALIAS2=D
DS_ALIAS3=T
MKEY1=SaHead_Id
SQL1=select * from V_Yw_SaHead where SaHead_Id=@1
SQL2=select a.*,b.Pc,c.Depart,c.GoodsNo,c.GoodsName,c.GoodsName_E,d.SaMain_Id,d.SaNum from Yw_KcData_Change a,Yw_KcData b,Jb_Goods c,Yw_SaDetail d where d.SaMain_Id=@1 and a.UseNum<>0 and a.KcId_Change=b.KcData_Id and b.GoodsId_Kc=c.Goods_Id and a.ObjId=d.SaDetail_Id order by GoodsNo
SQL3=select sum(UseNum) as TNum from (select a.*,b.Pc,c.GoodsNo,c.GoodsName,c.GoodsName_E,d.SaMain_Id,d.SaNum from Yw_KcData_Change a,Yw_KcData b,Jb_Goods c,Yw_SaDetail d where d.SaMain_Id=@1 and a.UseNum<>0 and a.KcId_Change=b.KcData_Id and b.GoodsId_Kc=c.Goods_Id and a.ObjId=d.SaDetail_Id) a


[INVOICE]
DS_NUM=3
MKEY_NUM=1
DS_ALIAS1=M
DS_ALIAS2=D
DS_ALIAS3=T
MKEY1=SaHead_Id
SQL1=select *,Send_Date+PayDate_Num as Sk_Date from V_Yw_SaHead where SaHead_Id=@1
SQL2=select a.*,(SaNum*Sa_Price) as TPrice,b.Depart,b.GoodsNo,b.GoodsName,b.GoodsName_E,e.Currency_Code,e.Exchange_Rate from Yw_SaDetail a,Jb_Goods b,Yw_SaHead e where SaMain_Id=@1 and a.GoodsId_Sa=b.Goods_Id and a.SaMain_Id=e.SaHead_Id order by GoodsNo

SQL3=select sum(SaNum) as TNum,sum(SaNum*Sa_Price) as TPrice from Yw_SaDetail where SaMain_Id=@1 group by SaMain_Id

[INVOICE_欧元]
DS_NUM=3
MKEY_NUM=1
DS_ALIAS1=M
DS_ALIAS2=D
DS_ALIAS3=T
MKEY1=SaHead_Id
SQL1=select *,Send_Date+PayDate_Num as Sk_Date from V_Yw_SaHead where SaHead_Id=@1
SQL2=select a.*,(SaNum*Sa_Price) as TPrice,b.Depart,b.GoodsNo,b.GoodsName,b.GoodsName_E,e.Currency_Code,e.Exchange_Rate from Yw_SaDetail a,Jb_Goods b,Yw_SaHead e where SaMain_Id=@1 and a.GoodsId_Sa=b.Goods_Id and a.SaMain_Id=e.SaHead_Id order by GoodsNo

SQL3=select sum(SaNum) as TNum,sum(SaNum*Sa_Price) as TPrice from Yw_SaDetail where SaMain_Id=@1 group by SaMain_Id

[INVOICE_BIBBY]
DS_NUM=3
MKEY_NUM=1
DS_ALIAS1=M
DS_ALIAS2=D
DS_ALIAS3=T
MKEY1=SaHead_Id
SQL1=select *,Send_Date+PayDate_Num as Sk_Date from V_Yw_SaHead where SaHead_Id=@1
SQL2=select a.*,(SaNum*Sa_Price) as TPrice,b.Depart,b.GoodsNo,b.GoodsName,b.GoodsName_E,e.Currency_Code,e.Exchange_Rate from Yw_SaDetail a,Jb_Goods b,Yw_SaHead e where SaMain_Id=@1 and a.GoodsId_Sa=b.Goods_Id and a.SaMain_Id=e.SaHead_Id order by GoodsNo

SQL3=select sum(SaNum) as TNum,sum(SaNum*Sa_Price) as TPrice from Yw_SaDetail where SaMain_Id=@1 group by SaMain_Id
;SQL1=select *,iif(PayType='28 Days Credit',Send_Date+28,iif(PayType='14 Days Credit',Send_Date+14,Send_Date)) as Sk_Date from V_Yw_SaHead where SaHead_Id=@1

[INVOICE_挂账14]
DS_NUM=3
MKEY_NUM=1
DS_ALIAS1=M
DS_ALIAS2=D
DS_ALIAS3=T
MKEY1=SaHead_Id
SQL1=select *,Send_Date+14 as Sk_Date from V_Yw_SaHead where SaHead_Id=@1
SQL2=select a.*,(SaNum*Sa_Price) as TPrice,b.Depart,b.GoodsNo,b.GoodsName,b.GoodsName_E,e.Currency_Code,e.Exchange_Rate from Yw_SaDetail a,Jb_Goods b,Yw_SaHead e where SaMain_Id=@1 and a.GoodsId_Sa=b.Goods_Id and a.SaMain_Id=e.SaHead_Id

SQL3=select sum(SaNum) as TNum,sum(SaNum*Sa_Price) as TPrice from Yw_SaDetail where SaMain_Id=@1 group by SaMain_Id

[CreditNote]
DS_NUM=3
MKEY_NUM=1
DS_ALIAS1=M
DS_ALIAS2=D
DS_ALIAS3=T
MKEY1=SaHead_Id
SQL1=select *,0-TNum as TNum2,0-TPrice as TPrice2 from V_Yw_SaHead where SaHead_Id=@1
SQL2=select a.*,0-SaNum as SaNum2,0-(SaNum*Sa_Price) as TPrice,b.Depart,b.GoodsNo,b.GoodsName,b.GoodsName_E,e.Currency_Code,e.Exchange_Rate from Yw_SaDetail a,Jb_Goods b,Yw_SaHead e where SaMain_Id=@1 and a.GoodsId_Sa=b.Goods_Id and a.SaMain_Id=e.SaHead_Id order by GoodsNo

SQL3=select 0-sum(SaNum) as TNum,0-sum(SaNum*Sa_Price) as TPrice from Yw_SaDetail where SaMain_Id=@1 group by SaMain_Id

[生产计划原料单]
DS_NUM=3
MKEY_NUM=1
DS_ALIAS1=M
DS_ALIAS2=D
DS_ALIAS3=T
MKEY1=ScHead_Id
SQL1=select * from V_Yw_ScPlanHead where ScHead_Id=@1
SQL2=select a.*,b.GoodsNo,b.Depart,b.GoodsName,b.GoodsName_E from Yw_ScPlanDetail a,Jb_Goods b where ScMain_Id=@1 and a.GoodsId_Sc=b.Goods_Id
SQL3=select a.*,b.GoodsName,b.GoodsName_E from (select GoodsId_Yl_Bom,sum(ScNum*UseNum) as TUseNum from (select a.GoodsId_Sc,a.ScNum,b.GoodsId_Yl_Bom,b.UseNum from Yw_ScPlanDetail  a,Jb_GoodsBom b where a.ScMain_Id=@1 and a.GoodsId_Sc=b.GoodsId_Cp_Bom) a group by GoodsId_Yl_Bom) a,Jb_Goods b where a.GoodsId_Yl_Bom=b.Goods_Id

