You are on page 1of 1

CREATE OR REPLACE VIEW GPGL.

GP_ACCOUNT_DET_FOR_MGT_DB_V
(PERIOD_NAME, ACCOUNT_TYPE, ACCOUNT_CATEGORY, ACCOUNT_SUB_CATEGORY, TOTAL_DR, TO
TAL_CR, PERIOD_BALANCE)
AS
SELECT gp.period_name
,atm.gp_account_type ACCOUNT_TYPE
,atm.gp_acc_category ACCOUNT_CATEGORY
,atm.gp_acc_sub_category ACCOUNT_SUB_CATEGORY
,sum(accounted_dr) TOTAL_DR
,sum(accounted_cr) TOTAL_CR
,nvl(sum(accounted_dr),0) - nvl(sum(accounted_cr),0) PERIOD_BALANCE
FROM
gpgl.GP_ACCOUNT_TYPE_MAPPING atm
,apps.gl_code_combinations_kfv GLCC
,apps.gl_je_headers GJH
,apps.gl_je_lines GJL
,apps.gl_periods GP
WHERE
atm.gp_account = glcc.segment2
AND glcc.enabled_flag = 'Y'
AND gjh.je_header_id=gjl.je_header_id
AND GJH.set_of_books_id=1001
AND GJH.set_of_books_id=GJL.set_of_books_id
AND gjl.code_combination_id=glcc.code_combination_id
AND gjh.PERIOD_NAME in (to_char(sysdate, 'MON-YY'), to_char(ADD_MONTHS(s
ysdate,-1), 'MON-YY'), to_char(ADD_MONTHS(sysdate,-2), 'MON-YY'), to_char(ADD_MO
NTHS(sysdate,-3), 'MON-YY'))
AND gjh.ACTUAL_FLAG = 'A'
AND gp.PERIOD_SET_NAME = 'GP_CALENDAR'
AND gp.PERIOD_NAME = gjh.PERIOD_NAME
AND atm.category_context = 'GP_ACCOUNT_TYPES'
GROUP BY gp.period_name
,atm.gp_account_type
,atm.gp_acc_category
,atm.gp_acc_sub_category;

You might also like