日期:2014-05-17  浏览次数:20443 次

关于周转率,求大婶
楼主新手一个,毕业六月,错入大坑(零售行业)。
工作之余,闲来无事,寻思写了一枚表表。
主要是查询【配送中心】商品周转率的,平均库存计算到每一天的叠加。
但是写完之后,发现周转率这个东西的分析过程十分艰难,还要加入库存数量,出货数量等参数一起才能判断商品经营是否正常,这样一来就只能够人为进行判断了。新人经验不足啊,写完报表思路就不清晰了,各位大神来帮忙分析分析哇。
二楼代码- -
------最佳解决方案--------------------
参考

1、周转率 = 周期内出库量/库存量(包括订购中未到货的)
2、周期性打折物品的计算,可以在金额周转率(可以理解为成本)上进行衡量。这个就看时间周期的设定了。


------其他解决方案--------------------
create table #rourou
(
f_spbm varchar(50) not null,
f_qcsl float,
)
create table #rourou2
(
f_spbm varchar(50) not null,
f_chl float,
)
create table #rourou3
(
f_spbm varchar(50) not null,
f_kcsl float,
f_pjkcsl float
)
create table #rourou4
(
f_spbm varchar(50) not null,
f_chl float,
f_pjchl float
)
declare @starttime datetime
declare @endtime datetime
declare @startny varchar(10)
declare @ts int
declare @zts int
declare @startday varchar(10)
declare @null varchar(10)
set @starttime='[开始日期]'
set @endtime='[结束日期]'
set @startny=(select left(convert(varchar(10),@starttime,112),6))
set @ts=(select datediff(day,@starttime,@endtime))+1
set @startday=(select convert(varchar(10),@starttime,112))
set @zts=@ts
insert into #rourou exec('select a.f_spbm,'+@zts+'*(isnull(c.f_qcsl,0)+isnull(d.f_rhj,0)) f_qmsl  from tbspda a
left join tb'+@startny+'_yhj c on a.f_spbm=c.f_spbm 
left join (select f_spbm,isnull(sum(f_jhsl+f_brsl+f_sysl+f_pssl-f_xssl-f_bcsl-f_shsl-f_phsl),0) f_rhj from tb'+@startny+'_rhj where f_rq<'+@startday+' group by f_spbm) d on a.f_spbm=d.f_spbm where datalength(a.f_cwbm)<>0')
while @ts>'0'
begin
declare @jsny varchar(10)
declare @jsday varchar(10)
set @jsny=(select left(convert(varchar(10),@starttime,112),6))
set @jsday=(select convert(varchar(10),@starttime,112))
insert into #rourou exec('select f_spbm,'+@ts+'*isnull(b.f_Jhsl+b.f_Brsl+b.f_Sysl+b.f_Pssl-b.f_Xssl-b.f_Bcsl-b.f_Shsl-b.f_Phsl,0) from tb'+@jsny+'_rhj b where b.f_rq='+@jsday)
set @starttime=@starttime+1
set @ts=@ts-1
insert into #rourou2 exec('select f_spbm,isnull(f_xssl+f_bcsl+f_shsl+f_phsl,0) f_chl from tb'+@jsny+'_rhj where f_rq='+@jsday)
end
insert into #rourou4 exec('select f_spbm,sum(f_chl),sum(f_chl)/'+@zts+' from #rourou2 group by f_spbm')
insert into #rourou3 exec('select f_spbm,sum(f_qcsl) f_kcsl,sum(f_qcsl)/'+@zts+' from #rourou group by f_spbm')
select a.f_spbm,c.f_sptm,b.f_spmc,a.f_pjkcsl f_pjkcsl,isnull(a.f_pjkcsl/e.f_dwbl,0) f_pjkcxs,case when (b.f_ti*b.f_hi)<>'0' then isnull(a.f_pjkcsl/e.f_dwbl/(b.f_ti*b.f_hi),0) else '0' end f_pjkctp,isnull(f.f_pjchl,0) f_pjchl,case when (b.f_ti*b.f_hi)<>'0' then isnull(f.f_pjchl/e.f_dwbl/(b.f_ti*b.f_hi),0) else '0' end f_pjchtp,isnull(f.f_chl,0) f_chl,case when (b.f_ti*b.f_hi)<>'0' then isnull(f.f_chl/e.f_dwbl/(b.f_ti*b.f_hi),0) else '0' end f_chtp,case when a.f_kcsl<>'0' then&nb