ֱݿ
1˫Ŀ¼TransDBConn.udlúݿӣȷݿдͼView_HuiHongGetPluμͼ˵
2ӳӵбͨԺ
3AutoTransfer.exeöʱʱȡԴ


Զ·ݿȡͼView_HuiHongGetPlu˵
ͼб뺬ҾҪ
select PluNo,ArticleItem,PluName,UnitPrice1,UnitPrice2,PluType,SellByDays,BestBeforeDays,SpecialPriceStartDateTime,SpecialPriceEndDateTime,SpecialPrice,UnitByCount,PriceUnitByWeight from View_HuiHongGetPlu order by PluNo 

     PluNo                    Ʒ    1~99999999
     ArticleItem                      <=13ֽ
     PluName                  һƷ    <=28ֽڣӢľ1֣
     UnitPrice1               һ    0~9999.99
     UnitPrice2               ڶ    0~9999.99 (һ0
     PluType                  Ʒ    0أ1
     SellByDays               ƫ    0~999
     BestBeforeDays           Ƽƫ    0~999
     SpecialPriceStartDateTimeؼۿʼ      yyyy-mm-dd hh:nn:ss
     SpecialPriceEndDateTime  ؼ۽      yyyy-mm-dd hh:nn:ss
     SpecialPrice             ؼ              0~9999.99
     UnitByCount              Ʒλ      <=4ֽڣӢľ1֣
     PriceUnitByWeight        ƷƼ۵λʶ    0: Ԫ/kg1: Ԫ/g2: Ԫ/100g;  3: Ԫ/500g

¼
99.5ȡű
select 
A.item_subno as PluNo,              --Ʒ
item_id as ArticleItem,             --
item_subname as PluName,            --Ʒ
isnull(isnull(D.new_saleprice,C.sale_price),A.sale_price) as UnitPrice1, --
0 as UnitPrice2,                    --ڶ,ʹ
B.sx_flag as PluType,               --'رʾ', 0أ1
left(B.valid_days,3) as SellByDays, -- '',
0 as BestBeforeDays,                --ȱƼڣĬΪ0
'2000-1-1 0:0:0' as SpecialPriceStartDateTime,--ȱؼۿʼʱ
'2000-1-1 0:0:0' as SpecialPriceEndDateTime,--ȱؼ۽ʱ
--A.sale_price as'',
--C.sale_price as'',
D.new_saleprice as SpecialPrice,    -- 'ؼ'
'PCS' as UnitByCount,               --ȱټƷλ
0 as PriceUnitByWeight              --ȱټƷλ0:kg,1:g,2:100g,3:500g
from bi_t_item_i A
left join bi_t_item_e B on A.item_id=B.item_id
left join bi_t_item_price C on A.item_id=C.item_id and A.item_subno=C.item_subno and C.branch_id='3' and update_date is not null
left join (select b.* from (select MAX(sn)as a,item_id from (select F.item_id,F.sn
from pos_t_spec_price_new F
left join bi_t_item_price E on E.item_id=F.item_id and E.branch_id='3' 
where F.branch_id='3'
and convert(varchar,outstart_date,12)<convert(varchar,getdate()+1,12) and 
convert(varchar,getdate()-1,12)<convert(varchar,outend_date,12) and 
convert(varchar(12),instart_date,108)<convert(varchar(12),getdate(),108) 
and convert(varchar(12),getdate(),108)<convert(varchar(12),inend_date,108) and voucher_no like 'SP%')c group by item_id)a 
inner join pos_t_spec_price_new b on a.item_id=b.item_id and b.sn=a.a where b.branch_id='3') D on D.item_id=A.item_id
where len(A.item_subno)=5 and (B.sx_flag='J' or B.sx_flag='Z')

ȡű
select 
convert(decimal(8,0),pluweight.weightcomid) as PluNo,
pluweight.weightcomid as ArticleItem,
plupos.comname as PluName,
plupos.saleprice as UnitPrice1,
0 as UnitPrice2,
case plupos.ispiece when 'Ƽ'then 1 else 0 as PluType,
plupos.quantity as SellByDays,
0 as BestBeforeDays,
'2000-1-1 0:0:0' as SpecialPriceStartDateTime,
'2000-1-1 0:0:0' as SpecialPriceEndDateTime,
0 as SpecialPrice,
case plupos.ispiece when 'Ƽ'then plupos.unit else '' as UnitByCount,
case plupos.unit when '500g' then 3,when '100g' then 2 when 'g'then 1 else 0 as PriceUnitByWeight
 from pluweight,plupos
 where pluweight.comid=plupos.comid

ҵȡű
SELECT   
plu.PluCode as PluNo,                --Ʒ
plu.PluCode as ArticleItem,          --
plu.PluName as PluName,              --Ʒ
CONVERT(numeric(8, 2),Price ) AS UnitPrice1, --
0 as UnitPrice2,                    --ڶ,ʹ
plu.IsWeight-1  as PluType,         --'ر־', 0أ1
0 as SellByDays,                    -- '',
0 as BestBeforeDays,                --ȱƼڣĬΪ0
cx.BgnDate as SpecialPriceStartDateTime,--ؼۿʼʱ
cx.EndDate as SpecialPriceEndDateTime,  --ؼ۽ʱ
CONVERT(numeric(8, 2),yhprice )  as SpecialPrice,    -- 'ؼ'
isnull(plu.unit,'PCS') AS UnitByCount,    --Ʒλ      <=4ֽڣӢľ1֣
0 as PriceUnitByWeight                    --ƷƼ۵λʶ    0: Ԫ/kg1: Ԫ/g2: Ԫ/100g;  3: Ԫ/500g
FROM      (SELECT   b.OrgCode, a.PluName, a.Spec, a.ProdArea, a.Unit, b.PluCode, a.BarCode, b.Price, a.IsWeight, 
                                 b.VipPrice
                 FROM      dbo.Goods AS a INNER JOIN
                                 dbo.GoodsOrg AS b ON a.PluCode = b.PluCode) AS plu LEFT OUTER JOIN
                    (SELECT   orgcode, grpcode, yhprice, bgndate, enddate
                     FROM      (SELECT   v.*, row_number() OVER (partition BY GrpCode
                                      ORDER BY jzdate DESC) AS order_num
                     FROM      (SELECT   b.RzDate + ' ' + b.RzTime AS jzdate, c.OrgCode, a.GrpCode, a.YhPrice, d .BgnDate, 
                                                      d .EndDate
                                      FROM      DscGroup a, DscProject b, DscShop c, DsTime D
                                      WHERE   a.dsccode = b.dsccode AND a.dsccode = c.dsccode AND a.dsccode = d .dsccode AND 
                                                      b.rzdate IS NOT NULL AND a.GrpType = 'P' AND (d .EndDate >= CONVERT(char(10), GETDATE(), 
                                                      120) AND d .BgnDate <= CONVERT(char(10), GETDATE(), 120))) v) s
WHERE   order_num = 1) AS cx ON plu.OrgCode = cx.OrgCode AND plu.PluCode = cx.GrpCode

