[易飞]库存分类情况表/*
*用途:库存分类情况表
*作者:龚德辉 2011-02-13
*/

CREATE proc UP_InvItemPriceChart
as
begin

Select a.MC001 品号,b.MB002 品名,b.MB003 规格,b.MB004 单位,c.MC002 仓库,a.MC007 库存数量,a.MC008 库存金额,
case when left(b.MB003,2)='AZ' then '继电器'
when left(b.MB003,2)='ZE' then '贸易品'
when left(a.MC001,1)='1' then '成品'
when left(b.MB001,1)<>'1' THEN '原材料'

END AS 种类,
case when left(b.MB003,2)='AZ' then '继电器'
when left(b.MB003,2)='ZE' then '贸易品'
when left(a.MC001,1)='1' then '成品'
when left(b.MB001,1)<>'1' and left(a.MC001,3)='301' then 'LCD'
when left(b.MB001,1)<>'1' and left(a.MC001,3)='302' then 'PCB'
when left(b.MB001,1)<>'1' and left(a.MC001,3)='303' then '背光'
when left(b.MB001,1)<>'1' and left(a.MC001,3)='304' then '导电胶条'
when left(b.MB001,1)<>'1' and left(a.MC001,3)='305' then '铁框'
when left(b.MB001,1)<>'1' and left(a.MC001,3)='306' then 'IC'
when left(b.MB001,1)<>'1' and left(a.MC001,3)='307' then '连接件'
else '辅料' END as 小类
into #tmp
from INVMC a inner join CMSMC c on a.MC002=c.MC001 inner join INVMB b on a.MC001=b.MB001
where a.MC007>0


select 种类,sum(库存金额) 库存金额 from #tmp
group by 种类

select 小类,sum (库存金额) 库存金额 from #tmp
where 种类='原材料'
group by 小类

drop table #tmp


end
GO

相关文章:

  • 2021-08-03
  • 2021-10-04
  • 2021-09-01
  • 2021-06-15
  • 2021-11-02
  • 2021-08-04
  • 2021-11-15
  • 2021-10-16
猜你喜欢
  • 2021-08-14
  • 2021-12-29
  • 2021-11-27
  • 2021-08-13
  • 2021-11-05
  • 2021-08-27
  • 2021-10-16
  • 2021-05-07
相关资源
相似解决方案