create or replace view fee_name_view as
select f.id,f.pay_or_receive, f.status,f.order_code,f.description,f.type,f.orderid,
       decode(ft.name, '入库费', f.fee_menoy, 0) rkf,
       decode(ft.name, '出库费', f.fee_menoy, 0) ckf,
       decode(ft.name, '单证费', f.fee_menoy, 0) dzf,
       decode(ft.name, '分拣费', f.fee_menoy, 0) fjf,
       decode(ft.name, '换箱费', f.fee_menoy, 0) hxf,
       decode(ft.name, '托盘费', f.fee_menoy, 0) tpf,
       decode(ft.name, '恒温库位仓储费', f.fee_menoy, 0) hwccf,
       decode(ft.name, '常温库位仓储费', f.fee_menoy, 0) cwccf,
      (select nvl(sum(bf.fee_menoy),0) from Fee bf left join fee_type bft on bft.id=bf.feename_id where bf.id=f.id and bft.name not in ('入库费','仓储费','出库费', '单证费','分拣费','换箱费','托盘费')) qtf
  from fee f
  left join fee_type ft on ft.id = f.feename_id 
  
  create or replace view fee_name_view as
select f.id,f.pay_or_receive, f.status,f.order_code,f.description,f.type,f.orderid,
       decode(ft.code, 'RKF', f.fee_menoy, 0) rkf,
       decode(ft.code, 'CKF', f.fee_menoy, 0) ckf,
       decode(ft.code, 'DZF', f.fee_menoy, 0) dzf,
       decode(ft.code, 'FJF', f.fee_menoy, 0) fjf,
       decode(ft.code, 'HXF', f.fee_menoy, 0) hxf,
       decode(ft.code, 'TPF', f.fee_menoy, 0) tpf,
       decode(ft.code, 'HWCCF', f.fee_menoy, 0) hwccf,
       decode(ft.code, 'CWCCF', f.fee_menoy, 0) cwccf,
      (select nvl(sum(bf.fee_menoy),0) from Fee bf left join fee_type bft on bft.id=bf.feename_id where bf.id=f.id and bft.code not in ('RKF','CKF','DZF', 'FJF','HXF','TPF','HWCCF','CWCCF')) qtf
  from fee f
  left join fee_type ft on ft.id = f.feename_id;
  