|
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。如果您注册时有任何问题请联系客服QQ: 83569622 。
您需要 登录 才可以下载或查看,没有帐号?注册
x
select ml.meaning, -- "分类类型"
wdj.class_code, --"分类"
msi.concatenated_segments, --"装配件",
oap.schedule_close_date,
wdj.scheduled_start_date,
m2.MEANING status, --工单状态
m3.MEANING status1, --分类
gcc.segment1 || '.' || gcc.segment2 || '.' || gcc.segment3 || '.' ||
gcc.segment4 || '.' || gcc.segment5 || '.' || gcc.segment6 || '.' ||
gcc.segment7 segment, --帐户
(round( /* _EXCHANGE_RATE--转换率,这里设为1可更具要求修改*/1 *
decode(m3.lookup_code,
4 ,(nvl(wpb.tl_outside_processing_in,0)+ nvl(wpb.pl_outside_processing_in,0)),
6 ,nvl(wpb.pl_material_in,0),
12 ,nvl(wpb.tl_scrap_in, 0),
0 ) ,
2 /*:C_PRECISION--精度,这里设为2可更具要求修改)*/)) Costs_Incurred, --发生成本
(round( /*:P_EXCHANGE_RATE--转换率,这里设为1可更具要求修改*/1 *
decode(m3.lookup_code,
4 ,(nvl(wpb.tl_outside_processing_out,0)+ nvl(wpb.pl_outside_processing_out,0)),
6 ,nvl(wpb.pl_material_out,0),
12 ,nvl(wpb.tl_scrap_out, 0),
0 ) ,
2 /*:C_PRECISION--精度,这里设为2可更具要求修改)*/)) Costs_Relieved, --冲减成本
(round( /*:P_EXCHANGE_RATE--转换率,这里设为1可更具要求修改*/1 *
decode(m3.lookup_code,
4 ,(nvl(wpb.PL_OUTSIDE_PROCESSING_VAR,0)+nvl(wpb.tl_outside_processing_var,0)),
6 ,nvl(wpb.pl_material_var,0),
12 ,nvl(wpb.tl_scrap_var, 0),
0 ) ,
2 /*:C_PRECISION--精度,这里设为2可更具要求修改)*/)) Variances_Relieved, --冲减差异
nvl(wdj.primary_item_id, -1) Item
,m3.MEANING
,we.wip_entity_name
from wip_entities we,
mfg_lookups ml,
mfg_lookups m2,
mfg_lookups m3,
mtl_system_items_kfv msi,
wip_period_balances wpb,
wip_discrete_jobs wdj,
org_acct_periods oap,
gl_code_combinations gcc
where wdj.organization_id = 84 --84--& _Organization_Id
and wpb.wip_entity_id = wdj.wip_entity_id
and wpb.organization_id = 84 --&P_Organization_Id
and ml.lookup_type = 'WIP_CLASS_TYPE'
and ml.lookup_code = wpb.class_type
and oap.organization_id = 84 --&P_Organization_Id
and oap.acct_period_id = wpb.acct_period_id
and oap.period_name ='AUG-06'-- 'AUG-06' --会计期间'08-2006'
and we.wip_entity_id = wdj.wip_entity_id
and we.organization_id = 84 --&P_Organization_Id
and msi.inventory_item_id(+) = wdj.primary_item_id
and msi.organization_id = 84 --&P_Organization_Id
and m2.LOOKUP_TYPE = 'WIP_JOB_STATUS'
and m2.LOOKUP_CODE(+) = wdj.status_type
and m2.LOOKUP_CODE = 12 --为工单已取消,
and m3.lookup_type = 'WIP_ELEMENT_VAR_TYPE'
and (m3.lookup_code in( 4, 6, 13)) --外协加工,物料差异,估计废料差异,
and gcc.chart_of_accounts_id =
(SELECT CHART_OF_ACCOUNTS_ID
FROM ORG_ORGANIZATION_DEFINITIONS
WHERE ORGANIZATION_ID = 84) --取科目
and gcc.code_combination_id = decode(m3.lookup_code,
1,
wdj.material_account,
2,
wdj.material_overhead_account,
3,
wdj.resource_account,
4,
wdj.outside_processing_account,
5,
wdj.overhead_account,
6,
wdj.material_variance_account,
7,
wdj.resource_variance_account,
8,
wdj.outside_proc_variance_account,
9,
wdj.overhead_variance_account,
12,
wdj.est_scrap_account,
13,
wdj.est_scrap_var_account,
0) |
|