679
社区成员
![](https://csdnimg.cn/release/cmsfe/public/img/topic.427195d5.png)
![](https://csdnimg.cn/release/cmsfe/public/img/me.40a70ab0.png)
![](https://csdnimg.cn/release/cmsfe/public/img/task.87b52881.png)
![](https://csdnimg.cn/release/cmsfe/public/img/share-circle.3e0b7822.png)
select substr(ima01,1,1),case when substr(ima01,1,1)='D' then '塑钢'
when substr(ima01,1,1)='M' then '金属'
when substr(ima01,1,1)='N' then '尼龙'
when substr(ima01,1,1)='T' then '拉片'
when substr(ima01,1,1)='J' then '模具' end type,round(sum(ccc23a*oeb12)/sum(oeb12),4) 材料成本 ,round(sum(ccc23b*oeb12)/sum(oeb12),4) 人工成本,
round(sum(ccc23c*oeb12)/sum(oeb12),4) 制费成本,round(sum(ccc23d*oeb12)/sum(oeb12),4) 加工成本,round(sum(ccc23e*oeb12)/sum(oeb12),4) 其它成本,
round(sum(ccc23*oeb12)/sum(oeb12),4) 合计成本,round(sum(oeb13)/sum(oeb12),4) 销售单价,round(sum(oeb13)/sum(oeb12) - sum(ccc23*oeb12)/sum(oeb12),4) 毛利
from (
select ima01,ccc23,ccc23a,ccc23b,ccc23c,ccc23d,ccc23e,sum(oeb12*oeb13*oea24) oeb13,sum(oeb12) oeb12
from oay_file,ima_file,ccc_file,oeb_file,oea_file
where oea01 = oeb01
and ima01 = oeb04
and oeb04 = ccc01
and oeb12 > 0
and oeb13 > 0
and year(oea02) = ccc02
and month(oea02) = ccc03
and ima06 = '0601'
and oay24 = 'N'
and substr(oea01, 1, 3) = oayslip
and oea02 between to_date('110201', 'yymmdd') and to_date('110228', 'yymmdd')
group by ima01,ccc23,ccc23a,ccc23b,ccc23c,ccc23d,ccc23e
)
group by substr(ima01,1,1)