SELECT
XMAP.CHART_OF_ACCOUNTS_NAME A$Chart_Of_Accounts_Name,
GLHDR.DOC_SEQUENCE_VALUE A$Doc_Sequence_Value,
GLBTC.NAME A$Je_Batch_Name,
GLHDR.NAME A$Je_Name,
XMAP.LEDGER_NAME A$Ledger_Name,
OFF.PERIOD_NAME A$Period_Name,
OFF.PERIOD_NUMBER A$Period_Number,
OFF.PERIOD_OFFSET A$Period_Offset,
$ZZ__________________________,
NVL(GLHDR.ACCRUAL_REV_FLAG, 'N') Accrual_Reversed_Flag,
GL#1.CV$Accounting_KFF Acct$CV$Accounting_KFF,
GL#1.CODE_COMBINATION_ID Acct$Code_Combination_Id,
GL#1.QV$Balancing Acct$QV$Balancing,
GL#1.QV$Cost_Center Acct$QV$Cost_Center,
GL#1.QV$Natural_Account Acct$QV$Natural_Account,
GL#1.Segment_Name_List Acct$Segment_Name_List,
GL#1.Structure_Name Acct$Structure_Name,
TO_CHAR(NULL) Accural_Revered_Flag,
DECODE(GLHDR.CURRENCY_CODE,
'STAT',0,NVL(GLLIN.ACCOUNTED_DR,0) NVL(GLLIN.ACCOUNTED_CR,0)) Amount,
DECODE(GLHDR.CURRENCY_CODE,'STAT',0,NVL(GLLIN.ACCOUNTED_CR,0))
Amount_Cr,
DECODE(
GLHDR.CURRENCY_CODE,'STAT',0,NVL(GLLIN.ENTERED_CR,0)) Amount_Cr_Entered,
DECODE(GLHDR.CURRENCY_CODE,'STAT',0,NVL(GLLIN.ACCOUNTED_DR,0))
Amount_Dr,
DECODE(
GLHDR.CURRENCY_CODE,'STAT',0,NVL(GLLIN.ENTERED_DR,0)) Amount_Dr_Entered,
DECODE(GLHDR.CURRENCY_CODE,
'STAT',0,NVL(GLLIN.ENTERED_DR,0) NVL(GLLIN.ENTERED_CR,0)) Amount_Entered,
OFF.PERIOD_SET_NAME Calendar_Name,
XMAP.CHART_OF_ACCOUNTS_NAME Chart_Of_Accounts_Name,
GLLIN.CREATION_DATE Creation_Date,
GLHDR.CURRENCY_CODE Currency_Code,
GLHDR.CURRENCY_CONVERSION_DATE Currency_Conversion_Date,
GLHDR.CURRENCY_CONVERSION_RATE Currency_Conversion_Rate,
GLHDR.CURRENCY_CONVERSION_TYPE Currency_Conversion_Type,
GLHDR.DOC_SEQUENCE_VALUE Doc_Sequence_Value,
GLLIN.EFFECTIVE_DATE Effective_Date,
Functional_Currency_Code.CURRENCY_CODE Functional_Currency_Code,
GLHDR.BALANCED_JE_FLAG Je_Balanced_Je_Flag,
GLBTC.DESCRIPTION Je_Batch_Description,
GLBTC.NAME Je_Batch_Name,
GLHDR.JE_CATEGORY Je_Category,
GLHDR.DESCRIPTION Je_Description,
GLHDR.EXTERNAL_REFERENCE Je_External_Reference,
GLHDR.NAME Je_Name,
GLJES.USER_JE_SOURCE_NAME Je_Source,
Je_Status.MEANING Je_Status,
GLHDR.UNIQUE_DATE Je_Timestamp,
XMAP.LEDGER_NAME Ledger_Name,
GLLIN.DESCRIPTION Line_Description,
GLLIN.JE_LINE_NUM Line_Number,
OFF.PERIOD_NAME Period_Name,
OFF.PERIOD_NUMBER Period_Number,
OFF.PERIOD_OFFSET Period_Offset,
OFF.PERIOD_YEAR Period_Year,
GLBTC.POSTED_DATE Posted_Date,
OFF.QUARTER_NUMBER Quarter_Number,
OFF.QUARTER_OFFSET Quarter_Offset,
TO_CHAR(NULL) Reference_1,
TO_CHAR(NULL) Reference_10,
TO_CHAR(NULL) Reference_2,
TO_CHAR(NULL) Reference_3,
TO_CHAR(NULL) Reference_4,
TO_CHAR(NULL) Reference_5,
TO_CHAR(NULL) Reference_6,
TO_CHAR(NULL) Reference_7,
TO_CHAR(NULL) Reference_8,
TO_CHAR(NULL) Reference_9,
TO_CHAR(NULL) Set_Of_Books_Name,
DECODE(GLHDR.CURRENCY_CODE,'STAT',NVL(GLLIN.ACCOUNTED_DR,
0)NVL(GLLIN.ACCOUNTED_CR,0),NVL(GLLIN.STAT_AMOUNT,0)) Stat_Amount,
GLCAT.USER_JE_CATEGORY_NAME User_Je_Category,
GLLIN.INVOICE_AMOUNT Vat_Invoice_Amount,
GLLIN.INVOICE_DATE Vat_Invoice_Date,
GLLIN.INVOICE_IDENTIFIER Vat_Invoice_IDentifier,
GLLIN.NO1 Vat_No1,
DECODE(GLHDR.CURRENCY_CODE,'STAT',NVL(GLLIN.ACCOUNTED_DR,
0)NVL(GLLIN.ACCOUNTED_CR,0),NVL(GLLIN.STAT_AMOUNT,0)) Vat_Stat_Amount,
GLLIN.TAX_CODE Vat_Tax_Code,
'Z$$_________________________' Z$$_________________________,
GL#1.Z$XXK_GL_Acct Z$Acct$XXK_GL_Acct,
Acct.rowid Z$GL_Chart_Of_Accounts,
GLHDR.rowid Z$GL_Journal_Entries,
GLBTC.rowid Z$GL_Journal_Entry_Batches,
GLLIN.rowid Z$GL_Journal_Entry_Lines
FROM
XX_NOETIX_SYS.XXK_GL_Acct GL#1,
GL.GL_CODE_COMBINATIONS# Acct,
GL.GL_LEDGERS# Functional_Currency_Code,
XX_NOETIX_SYS.N_GL_LOOKUPS_VL Je_Status,
GL.GL_JE_SOURCES_TL# GLJES,
GL.GL_JE_CATEGORIES_TL# GLCAT,
GL.GL_JE_LINES# GLLIN,
GL.GL_JE_HEADERS# GLHDR,
GL.GL_JE_BATCHES# GLBTC,
XX_NOETIX_SYS.GL_SOB_ACL_Map_Base XMAP,
XX_NOETIX_SYS.NOETIX_PERIOD_OFFSETS OFF
WHERE 'Copyright Noetix Corporation 19922014' is not null
AND GLHDR.JE_BATCH_ID = GLBTC.JE_BATCH_ID
AND GLHDR.LEDGER_ID = XMAP.SET_OF_BOOKS_ID
AND GLLIN.JE_HEADER_ID = GLHDR.JE_HEADER_ID
AND GLLIN.LEDGER_ID = GLHDR.LEDGER_ID
AND GLHDR.ACTUAL_FLAG = 'A'
AND GLBTC.ACTUAL_FLAG = 'A'
AND GLCAT.JE_CATEGORY_NAME = GLHDR.JE_CATEGORY
AND GLCAT.LANGUAGE LIKE NOETIX_ENV_PKG.GET_LANGUAGE
AND OFF.PERIOD_NAME=GLLIN.PERIOD_NAME
AND OFF.SET_OF_BOOKS_ID= XMAP.SET_OF_BOOKS_ID
AND GLHDR.CURRENCY_CODE IN (XMAP.CURRENCY_CODE, 'STAT')
AND GLHDR.JE_SOURCE = GLJES.JE_SOURCE_NAME
AND GLJES.LANGUAGE LIKE NOETIX_ENV_PKG.GET_LANGUAGE
AND XX_NOETIX_SYS.noetix_gl_security_pkg.check_security(
Acct.chart_of_accounts_id, XMAP.SET_OF_BOOKS_ID, 'KFFRG' , 'GL' ,
Acct.SEGMENT1, Acct.SEGMENT2, Acct.SEGMENT3, Acct.SEGMENT4, Acct.SEGMENT5,
Acct.SEGMENT6, Acct.SEGMENT7, Acct.SEGMENT8, Acct.SEGMENT9, Acct.SEGMENT10,
Acct.SEGMENT11, Acct.SEGMENT12, Acct.SEGMENT13, Acct.SEGMENT14,
Acct.SEGMENT15, Acct.SEGMENT16, Acct.SEGMENT17, Acct.SEGMENT18,
Acct.SEGMENT19, Acct.SEGMENT20, Acct.SEGMENT21, Acct.SEGMENT22,
Acct.SEGMENT23, Acct.SEGMENT24, Acct.SEGMENT25, Acct.SEGMENT26,
Acct.SEGMENT27, Acct.SEGMENT28, Acct.SEGMENT29, Acct.SEGMENT30 ) = 1
AND GLLIN.STATUS = Je_Status.LOOKUP_CODE(+)
AND Je_Status.LOOKUP_TYPE(+) = 'BATCH_STATUS'
AND Je_Status.LANGUAGE (+) = NOETIX_ENV_PKG.GET_LANGUAGE
AND GLHDR.LEDGER_ID = Functional_Currency_Code.LEDGER_ID(+)
AND GLLIN.CODE_COMBINATION_ID = Acct.CODE_COMBINATION_ID(+)
AND Acct.CODE_COMBINATION_ID = GL#1.CODE_COMBINATION_ID (+)
SELECT COUNT(NVL(rates.conversion_rate,1)) Conversion_Rate_USD
FROM GL.GL_DAILY_RATES rates,
(SELECT count(GLHDR.JE_HEADER_ID) HEADER_ID,
GLHDR.JE_HEADER_ID,
GLLIN.effective_date,
GLHDR.CURRENCY_CODE
FROM GL.GL_JE_HEADERS GLHDR,
GL.GL_JE_LINES GLLIN
GL.GL_DAILY_RATES rates
WHERE GLLIN.JE_HEADER_ID = GLHDR.JE_HEADER_ID
AND GLLIN.LEDGER_ID = GLHDR.LEDGER_ID
AND GLHDR.ACTUAL_FLAG = 'A') GR
WHERE RATES.CONVERSION_DATE(+)=GR.EFFECTIVE_DATE
AND RATES.TO_CURRENCY(+)='USD'
AND RATES.FROM_CURRENCY(+)=GR.CURRENCY_CODE
AND RATES.CONVERSION_TYPE(+)='Corporate'
XMAP.CHART_OF_ACCOUNTS_NAME A$Chart_Of_Accounts_Name,
GLHDR.DOC_SEQUENCE_VALUE A$Doc_Sequence_Value,
GLBTC.NAME A$Je_Batch_Name,
GLHDR.NAME A$Je_Name,
XMAP.LEDGER_NAME A$Ledger_Name,
OFF.PERIOD_NAME A$Period_Name,
OFF.PERIOD_NUMBER A$Period_Number,
OFF.PERIOD_OFFSET A$Period_Offset,
$ZZ__________________________,
NVL(GLHDR.ACCRUAL_REV_FLAG, 'N') Accrual_Reversed_Flag,
GL#1.CV$Accounting_KFF Acct$CV$Accounting_KFF,
GL#1.CODE_COMBINATION_ID Acct$Code_Combination_Id,
GL#1.QV$Balancing Acct$QV$Balancing,
GL#1.QV$Cost_Center Acct$QV$Cost_Center,
GL#1.QV$Natural_Account Acct$QV$Natural_Account,
GL#1.Segment_Name_List Acct$Segment_Name_List,
GL#1.Structure_Name Acct$Structure_Name,
TO_CHAR(NULL) Accural_Revered_Flag,
DECODE(GLHDR.CURRENCY_CODE,
'STAT',0,NVL(GLLIN.ACCOUNTED_DR,0) NVL(GLLIN.ACCOUNTED_CR,0)) Amount,
DECODE(GLHDR.CURRENCY_CODE,'STAT',0,NVL(GLLIN.ACCOUNTED_CR,0))
Amount_Cr,
DECODE(
GLHDR.CURRENCY_CODE,'STAT',0,NVL(GLLIN.ENTERED_CR,0)) Amount_Cr_Entered,
DECODE(GLHDR.CURRENCY_CODE,'STAT',0,NVL(GLLIN.ACCOUNTED_DR,0))
Amount_Dr,
DECODE(
GLHDR.CURRENCY_CODE,'STAT',0,NVL(GLLIN.ENTERED_DR,0)) Amount_Dr_Entered,
DECODE(GLHDR.CURRENCY_CODE,
'STAT',0,NVL(GLLIN.ENTERED_DR,0) NVL(GLLIN.ENTERED_CR,0)) Amount_Entered,
OFF.PERIOD_SET_NAME Calendar_Name,
XMAP.CHART_OF_ACCOUNTS_NAME Chart_Of_Accounts_Name,
GLLIN.CREATION_DATE Creation_Date,
GLHDR.CURRENCY_CODE Currency_Code,
GLHDR.CURRENCY_CONVERSION_DATE Currency_Conversion_Date,
GLHDR.CURRENCY_CONVERSION_RATE Currency_Conversion_Rate,
GLHDR.CURRENCY_CONVERSION_TYPE Currency_Conversion_Type,
GLHDR.DOC_SEQUENCE_VALUE Doc_Sequence_Value,
GLLIN.EFFECTIVE_DATE Effective_Date,
Functional_Currency_Code.CURRENCY_CODE Functional_Currency_Code,
GLHDR.BALANCED_JE_FLAG Je_Balanced_Je_Flag,
GLBTC.DESCRIPTION Je_Batch_Description,
GLBTC.NAME Je_Batch_Name,
GLHDR.JE_CATEGORY Je_Category,
GLHDR.DESCRIPTION Je_Description,
GLHDR.EXTERNAL_REFERENCE Je_External_Reference,
GLHDR.NAME Je_Name,
GLJES.USER_JE_SOURCE_NAME Je_Source,
Je_Status.MEANING Je_Status,
GLHDR.UNIQUE_DATE Je_Timestamp,
XMAP.LEDGER_NAME Ledger_Name,
GLLIN.DESCRIPTION Line_Description,
GLLIN.JE_LINE_NUM Line_Number,
OFF.PERIOD_NAME Period_Name,
OFF.PERIOD_NUMBER Period_Number,
OFF.PERIOD_OFFSET Period_Offset,
OFF.PERIOD_YEAR Period_Year,
GLBTC.POSTED_DATE Posted_Date,
OFF.QUARTER_NUMBER Quarter_Number,
OFF.QUARTER_OFFSET Quarter_Offset,
TO_CHAR(NULL) Reference_1,
TO_CHAR(NULL) Reference_10,
TO_CHAR(NULL) Reference_2,
TO_CHAR(NULL) Reference_3,
TO_CHAR(NULL) Reference_4,
TO_CHAR(NULL) Reference_5,
TO_CHAR(NULL) Reference_6,
TO_CHAR(NULL) Reference_7,
TO_CHAR(NULL) Reference_8,
TO_CHAR(NULL) Reference_9,
TO_CHAR(NULL) Set_Of_Books_Name,
DECODE(GLHDR.CURRENCY_CODE,'STAT',NVL(GLLIN.ACCOUNTED_DR,
0)NVL(GLLIN.ACCOUNTED_CR,0),NVL(GLLIN.STAT_AMOUNT,0)) Stat_Amount,
GLCAT.USER_JE_CATEGORY_NAME User_Je_Category,
GLLIN.INVOICE_AMOUNT Vat_Invoice_Amount,
GLLIN.INVOICE_DATE Vat_Invoice_Date,
GLLIN.INVOICE_IDENTIFIER Vat_Invoice_IDentifier,
GLLIN.NO1 Vat_No1,
DECODE(GLHDR.CURRENCY_CODE,'STAT',NVL(GLLIN.ACCOUNTED_DR,
0)NVL(GLLIN.ACCOUNTED_CR,0),NVL(GLLIN.STAT_AMOUNT,0)) Vat_Stat_Amount,
GLLIN.TAX_CODE Vat_Tax_Code,
'Z$$_________________________' Z$$_________________________,
GL#1.Z$XXK_GL_Acct Z$Acct$XXK_GL_Acct,
Acct.rowid Z$GL_Chart_Of_Accounts,
GLHDR.rowid Z$GL_Journal_Entries,
GLBTC.rowid Z$GL_Journal_Entry_Batches,
GLLIN.rowid Z$GL_Journal_Entry_Lines
FROM
XX_NOETIX_SYS.XXK_GL_Acct GL#1,
GL.GL_CODE_COMBINATIONS# Acct,
GL.GL_LEDGERS# Functional_Currency_Code,
XX_NOETIX_SYS.N_GL_LOOKUPS_VL Je_Status,
GL.GL_JE_SOURCES_TL# GLJES,
GL.GL_JE_CATEGORIES_TL# GLCAT,
GL.GL_JE_LINES# GLLIN,
GL.GL_JE_HEADERS# GLHDR,
GL.GL_JE_BATCHES# GLBTC,
XX_NOETIX_SYS.GL_SOB_ACL_Map_Base XMAP,
XX_NOETIX_SYS.NOETIX_PERIOD_OFFSETS OFF
WHERE 'Copyright Noetix Corporation 19922014' is not null
AND GLHDR.JE_BATCH_ID = GLBTC.JE_BATCH_ID
AND GLHDR.LEDGER_ID = XMAP.SET_OF_BOOKS_ID
AND GLLIN.JE_HEADER_ID = GLHDR.JE_HEADER_ID
AND GLLIN.LEDGER_ID = GLHDR.LEDGER_ID
AND GLHDR.ACTUAL_FLAG = 'A'
AND GLBTC.ACTUAL_FLAG = 'A'
AND GLCAT.JE_CATEGORY_NAME = GLHDR.JE_CATEGORY
AND GLCAT.LANGUAGE LIKE NOETIX_ENV_PKG.GET_LANGUAGE
AND OFF.PERIOD_NAME=GLLIN.PERIOD_NAME
AND OFF.SET_OF_BOOKS_ID= XMAP.SET_OF_BOOKS_ID
AND GLHDR.CURRENCY_CODE IN (XMAP.CURRENCY_CODE, 'STAT')
AND GLHDR.JE_SOURCE = GLJES.JE_SOURCE_NAME
AND GLJES.LANGUAGE LIKE NOETIX_ENV_PKG.GET_LANGUAGE
AND XX_NOETIX_SYS.noetix_gl_security_pkg.check_security(
Acct.chart_of_accounts_id, XMAP.SET_OF_BOOKS_ID, 'KFFRG' , 'GL' ,
Acct.SEGMENT1, Acct.SEGMENT2, Acct.SEGMENT3, Acct.SEGMENT4, Acct.SEGMENT5,
Acct.SEGMENT6, Acct.SEGMENT7, Acct.SEGMENT8, Acct.SEGMENT9, Acct.SEGMENT10,
Acct.SEGMENT11, Acct.SEGMENT12, Acct.SEGMENT13, Acct.SEGMENT14,
Acct.SEGMENT15, Acct.SEGMENT16, Acct.SEGMENT17, Acct.SEGMENT18,
Acct.SEGMENT19, Acct.SEGMENT20, Acct.SEGMENT21, Acct.SEGMENT22,
Acct.SEGMENT23, Acct.SEGMENT24, Acct.SEGMENT25, Acct.SEGMENT26,
Acct.SEGMENT27, Acct.SEGMENT28, Acct.SEGMENT29, Acct.SEGMENT30 ) = 1
AND GLLIN.STATUS = Je_Status.LOOKUP_CODE(+)
AND Je_Status.LOOKUP_TYPE(+) = 'BATCH_STATUS'
AND Je_Status.LANGUAGE (+) = NOETIX_ENV_PKG.GET_LANGUAGE
AND GLHDR.LEDGER_ID = Functional_Currency_Code.LEDGER_ID(+)
AND GLLIN.CODE_COMBINATION_ID = Acct.CODE_COMBINATION_ID(+)
AND Acct.CODE_COMBINATION_ID = GL#1.CODE_COMBINATION_ID (+)
SELECT COUNT(NVL(rates.conversion_rate,1)) Conversion_Rate_USD
FROM GL.GL_DAILY_RATES rates,
(SELECT count(GLHDR.JE_HEADER_ID) HEADER_ID,
GLHDR.JE_HEADER_ID,
GLLIN.effective_date,
GLHDR.CURRENCY_CODE
FROM GL.GL_JE_HEADERS GLHDR,
GL.GL_JE_LINES GLLIN
GL.GL_DAILY_RATES rates
WHERE GLLIN.JE_HEADER_ID = GLHDR.JE_HEADER_ID
AND GLLIN.LEDGER_ID = GLHDR.LEDGER_ID
AND GLHDR.ACTUAL_FLAG = 'A') GR
WHERE RATES.CONVERSION_DATE(+)=GR.EFFECTIVE_DATE
AND RATES.TO_CURRENCY(+)='USD'
AND RATES.FROM_CURRENCY(+)=GR.CURRENCY_CODE
AND RATES.CONVERSION_TYPE(+)='Corporate'
No comments:
Post a Comment