以文本方式查看主题

-  昂捷论坛  (http://www.enjoyit.com.cn/bbs/index.asp)
--  □-系统配置管理类  (http://www.enjoyit.com.cn/bbs/list.asp?boardid=34)
----  店代码不小心改变后要修改的数据  (http://www.enjoyit.com.cn/bbs/dispbbs.asp?boardid=34&id=4075)

--  作者:czg1981
--  发布时间:2008/7/17 18:55:04
--  店代码不小心改变后要修改的数据

对应连锁企业来说,我们系统在总部来统一修改参数,然后由系统自动下发到每一个门店,这样提高了我们的工作效率,但是有时候不小心把一些相对独立的参数也一起下发了,比如店代码.
店代码修改后影响的数据:用户进入系统的权限,值单机构等;流水方面需要修改非自营商品的扣率,销售成本,店代码等
流水方面涉及的表有:tb_o_sg, tb_o_sm,tb_o_sg_today,tb_cursale
参考语句:

select * into #tb_o_sg
from tb_o_sg
where c_store_id=\'1\'
and datediff(day,c_datetime,getdate())=0

update #tb_o_sg
set c_deduct_rate=case when b.c_prom_deduct_rate<>0 then b.c_prom_deduct_rate else b.c_deduct_rate end,
 c_pt_cost=round(#tb_o_sg.c_price_disc*(1-0.01*case when b.c_prom_deduct_rate<>0 then b.c_prom_deduct_rate else b.c_deduct_rate end),2)
from tb_gdsprovider b
where #tb_o_sg.c_gds_type like \'自营%\'
and #tb_o_sg.c_gcode=b.c_gcode
and b.c_status=\'主供应商\'

update tb_o_sg
set c_deduct_rate=b.c_deduct_rate,c_pt_cost=b.c_pt_cost,c_store_id=dbo.uf_store_id()
from #tb_o_sg b
where tb_o_sg.c_guid=b.c_guid

update tb_o_sg_today
set c_deduct_rate=b.c_deduct_rate,c_pt_cost=b.c_pt_cost,c_store_id=dbo.uf_store_id()
from #tb_o_sg b
where tb_o_sg.c_guid=b.c_guid

update tb_o_sm
set c_store_id=dbo.uf_store_id()
where c_store_id=\'1\'
and datediff(day,c_datetime,getdate())=0

delete tb_cursale
where datediff(day,c_datetime,getdate())=0


--  作者:czg1981
--  发布时间:2008/7/17 18:58:41
--  
对应连锁企业还有手工的调整上级的实时销售监测
如果做了其它单据,就只能一一的修改了