47: X_ERR_CLASS_1 := NULL;
48: X_ERR_MESG_2 := NULL;
49: X_ERR_CLASS_2 := NULL;
50:
51: if(x_entity_type = WIP_CONSTANTS.EAM) then
52: begin
53: select default_eam_class
54: into V_EAM_CLASS
55: from wip_eam_parameters
65: into V_COST_METHOD
66: from mtl_parameters
67: where
68: organization_id = X_ORG_ID;
69: if( V_COST_METHOD = WIP_CONSTANTS.COST_STD ) then
70: -- Standard Costing Organization
71: begin
72: select wdcac.std_discrete_class, wdcac.repetitive_assy_class
73: into V_DISC_CLASS, V_REP_CLASS
132: exception
133: when NO_DATA_FOUND then
134: NULL;
135: end;
136: elsif( V_COST_METHOD in ( WIP_CONSTANTS.COST_AVG,
137: WIP_CONSTANTS.COST_FIFO,
138: WIP_CONSTANTS.COST_LIFO ) ) then
139: -- Average Costing Organization
140: if X_PROJECT_ID IS NOT NULL then
133: when NO_DATA_FOUND then
134: NULL;
135: end;
136: elsif( V_COST_METHOD in ( WIP_CONSTANTS.COST_AVG,
137: WIP_CONSTANTS.COST_FIFO,
138: WIP_CONSTANTS.COST_LIFO ) ) then
139: -- Average Costing Organization
140: if X_PROJECT_ID IS NOT NULL then
141: select NVL(costing_group_id,1), wip_acct_class_code
134: NULL;
135: end;
136: elsif( V_COST_METHOD in ( WIP_CONSTANTS.COST_AVG,
137: WIP_CONSTANTS.COST_FIFO,
138: WIP_CONSTANTS.COST_LIFO ) ) then
139: -- Average Costing Organization
140: if X_PROJECT_ID IS NOT NULL then
141: select NVL(costing_group_id,1), wip_acct_class_code
142: into V_COST_GROUP_ID, V_PRJ_DEF_CLASS
249: select nvl(wac.disable_date, SYSDATE + 1) into V_DISABLE_DATE
250: from wip_accounting_classes wac
251: where
252: wac.organization_id = X_ORG_ID and
253: wac.class_type = DECODE(X_ENTITY_TYPE, 1, WIP_CONSTANTS.DISC_CLASS,
254: 2, WIP_CONSTANTS.REP_CLASS,
255: 4, WIP_CONSTANTS.DISC_CLASS,
256: 6, WIP_CONSTANTS.DISC_CLASS) and
257: wac.class_code = X_CLASS;
250: from wip_accounting_classes wac
251: where
252: wac.organization_id = X_ORG_ID and
253: wac.class_type = DECODE(X_ENTITY_TYPE, 1, WIP_CONSTANTS.DISC_CLASS,
254: 2, WIP_CONSTANTS.REP_CLASS,
255: 4, WIP_CONSTANTS.DISC_CLASS,
256: 6, WIP_CONSTANTS.DISC_CLASS) and
257: wac.class_code = X_CLASS;
258: if V_DISABLE_DATE <= SYSDATE then
251: where
252: wac.organization_id = X_ORG_ID and
253: wac.class_type = DECODE(X_ENTITY_TYPE, 1, WIP_CONSTANTS.DISC_CLASS,
254: 2, WIP_CONSTANTS.REP_CLASS,
255: 4, WIP_CONSTANTS.DISC_CLASS,
256: 6, WIP_CONSTANTS.DISC_CLASS) and
257: wac.class_code = X_CLASS;
258: if V_DISABLE_DATE <= SYSDATE then
259: return(0);
252: wac.organization_id = X_ORG_ID and
253: wac.class_type = DECODE(X_ENTITY_TYPE, 1, WIP_CONSTANTS.DISC_CLASS,
254: 2, WIP_CONSTANTS.REP_CLASS,
255: 4, WIP_CONSTANTS.DISC_CLASS,
256: 6, WIP_CONSTANTS.DISC_CLASS) and
257: wac.class_code = X_CLASS;
258: if V_DISABLE_DATE <= SYSDATE then
259: return(0);
260: else
311: from mtl_parameters mp
312: where
313: mp.organization_id = X_ORG_ID;
314:
315: if v_primary_cost_method in ( WIP_CONSTANTS.COST_AVG,
316: WIP_CONSTANTS.COST_FIFO,
317: WIP_CONSTANTS.COST_LIFO ) and
318: v_project_reference_enabled = 1 then
319: begin
312: where
313: mp.organization_id = X_ORG_ID;
314:
315: if v_primary_cost_method in ( WIP_CONSTANTS.COST_AVG,
316: WIP_CONSTANTS.COST_FIFO,
317: WIP_CONSTANTS.COST_LIFO ) and
318: v_project_reference_enabled = 1 then
319: begin
320: select distinct class_code
313: mp.organization_id = X_ORG_ID;
314:
315: if v_primary_cost_method in ( WIP_CONSTANTS.COST_AVG,
316: WIP_CONSTANTS.COST_FIFO,
317: WIP_CONSTANTS.COST_LIFO ) and
318: v_project_reference_enabled = 1 then
319: begin
320: select distinct class_code
321: into dummy
495: wop.organization_id = p_organization_id
496: AND wop.wip_entity_id = p_wip_entity_id
497: AND
498: Decode(Decode(Nvl(p_repetitive_schedule_id,-1),
499: -1, wip_constants.discrete,
500: wip_constants.repetitive),
501: wip_constants.discrete,0,
502: wip_constants.repetitive,wop.repetitive_schedule_id)
503: = Decode(Decode(Nvl(p_repetitive_schedule_id,-1),
496: AND wop.wip_entity_id = p_wip_entity_id
497: AND
498: Decode(Decode(Nvl(p_repetitive_schedule_id,-1),
499: -1, wip_constants.discrete,
500: wip_constants.repetitive),
501: wip_constants.discrete,0,
502: wip_constants.repetitive,wop.repetitive_schedule_id)
503: = Decode(Decode(Nvl(p_repetitive_schedule_id,-1),
504: -1, wip_constants.discrete,
497: AND
498: Decode(Decode(Nvl(p_repetitive_schedule_id,-1),
499: -1, wip_constants.discrete,
500: wip_constants.repetitive),
501: wip_constants.discrete,0,
502: wip_constants.repetitive,wop.repetitive_schedule_id)
503: = Decode(Decode(Nvl(p_repetitive_schedule_id,-1),
504: -1, wip_constants.discrete,
505: wip_constants.repetitive),
498: Decode(Decode(Nvl(p_repetitive_schedule_id,-1),
499: -1, wip_constants.discrete,
500: wip_constants.repetitive),
501: wip_constants.discrete,0,
502: wip_constants.repetitive,wop.repetitive_schedule_id)
503: = Decode(Decode(Nvl(p_repetitive_schedule_id,-1),
504: -1, wip_constants.discrete,
505: wip_constants.repetitive),
506: wip_constants.discrete,0,
500: wip_constants.repetitive),
501: wip_constants.discrete,0,
502: wip_constants.repetitive,wop.repetitive_schedule_id)
503: = Decode(Decode(Nvl(p_repetitive_schedule_id,-1),
504: -1, wip_constants.discrete,
505: wip_constants.repetitive),
506: wip_constants.discrete,0,
507: wip_constants.repetitive,p_repetitive_schedule_id);
508:
501: wip_constants.discrete,0,
502: wip_constants.repetitive,wop.repetitive_schedule_id)
503: = Decode(Decode(Nvl(p_repetitive_schedule_id,-1),
504: -1, wip_constants.discrete,
505: wip_constants.repetitive),
506: wip_constants.discrete,0,
507: wip_constants.repetitive,p_repetitive_schedule_id);
508:
509: IF(p_repetitive_schedule_id IS NULL) THEN /* Discrete Job */
502: wip_constants.repetitive,wop.repetitive_schedule_id)
503: = Decode(Decode(Nvl(p_repetitive_schedule_id,-1),
504: -1, wip_constants.discrete,
505: wip_constants.repetitive),
506: wip_constants.discrete,0,
507: wip_constants.repetitive,p_repetitive_schedule_id);
508:
509: IF(p_repetitive_schedule_id IS NULL) THEN /* Discrete Job */
510:
503: = Decode(Decode(Nvl(p_repetitive_schedule_id,-1),
504: -1, wip_constants.discrete,
505: wip_constants.repetitive),
506: wip_constants.discrete,0,
507: wip_constants.repetitive,p_repetitive_schedule_id);
508:
509: IF(p_repetitive_schedule_id IS NULL) THEN /* Discrete Job */
510:
511: SELECT NVL(p_total_quantity,0) + Nvl(wdj.quantity_completed,0)