BEGIN
mo_global.set_policy_context('S',84);
END;
SELECT project_number, project_name, :p_gl_period MONTH, ou.NAME org_name,
(SELECT revenue_amount
FROM pa_events_v pae
WHERE pae.event_id = pee.event_id
AND UPPER (event_type) = UPPER ('Revenue')) rev_amt,
NULL inter_crev_amt,
NVL ((SELECT revenue_amount
FROM pa_events_v pae
WHERE UPPER (event_type) = UPPER ('TMIND CoGS')
AND pae.event_id = pee.event_id),
0
)
+ NVL ((SELECT revenue_amount
FROM pa_events pae
WHERE UPPER (event_type) = UPPER ('TMIND PC Labor CoGS')
AND pae.event_id = pee.event_id),
0
) cogs_total,
(SELECT revenue_amount
FROM pa_events_v pae
WHERE UPPER (event_type) =
UPPER ('TMIND Warranty CoGS')
AND pae.event_id = pee.event_id) cogs_warranty
FROM pa_events_v pee, hr_all_organization_units_tl ou
WHERE TO_CHAR (pee.event_date, 'MON-YYYY') = :p_gl_period
AND ou.organization_id = pee.organization_id;
mo_global.set_policy_context('S',84);
END;
SELECT project_number, project_name, :p_gl_period MONTH, ou.NAME org_name,
(SELECT revenue_amount
FROM pa_events_v pae
WHERE pae.event_id = pee.event_id
AND UPPER (event_type) = UPPER ('Revenue')) rev_amt,
NULL inter_crev_amt,
NVL ((SELECT revenue_amount
FROM pa_events_v pae
WHERE UPPER (event_type) = UPPER ('TMIND CoGS')
AND pae.event_id = pee.event_id),
0
)
+ NVL ((SELECT revenue_amount
FROM pa_events pae
WHERE UPPER (event_type) = UPPER ('TMIND PC Labor CoGS')
AND pae.event_id = pee.event_id),
0
) cogs_total,
(SELECT revenue_amount
FROM pa_events_v pae
WHERE UPPER (event_type) =
UPPER ('TMIND Warranty CoGS')
AND pae.event_id = pee.event_id) cogs_warranty
FROM pa_events_v pee, hr_all_organization_units_tl ou
WHERE TO_CHAR (pee.event_date, 'MON-YYYY') = :p_gl_period
AND ou.organization_id = pee.organization_id;
No comments:
Post a Comment