select t.OUTORDERID,
decode(t.itemtypecode, 'E', '工程类', 'C', '业务类') as 物资类型,
t.REQUESTFLAG,
decode(t.REQUESTFLAG,
'Y',
'物资申领单',
'N',
decode(t.ordertype,
'AI',
'账户发放',
'PI',
'项目发放',
'MO',
'杂项出库','qita')) as 单据类型,
to_char(createtime, 'yyyy-mm-dd'),
t.CREATORNAME,
m.orgname as 发料组织,
'[' || p.projectcode || ']' || p.name as 发料项目
from project p, misouprofile m, outorder t
where m.ORGID = t.FROMORGID
and p.PROJECTID = t.FROMPROJECTID
and t.createtime >= to_date('2014-1-1', 'yyyy-mm-dd')
and t.createtime <= to_date('2014-12-31 23:59:59', 'yyyy-mm-dd hh24:mi:ss')
and t.TOORGID = 82