-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added Journal Entries and Sub Ledger Entries
- Loading branch information
1 parent
c3cba18
commit 067c213
Showing
13 changed files
with
602 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
transform/oracle_analytics/models/intermediate/finance/general_ledger/f_journal_entry.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
{{ | ||
config( | ||
materialized='incremental', | ||
unique_key='Journal_Entry_Id', | ||
incremental_strategy='merge' | ||
) | ||
}} | ||
WITH je_batch AS ( | ||
SELECT * FROM {{ ref('je_batch') }} | ||
), | ||
je_header AS ( | ||
SELECT * FROM {{ ref('je_header') }} | ||
), | ||
je_line AS ( | ||
SELECT * FROM {{ ref('je_line') }} | ||
), | ||
ledger AS ( | ||
SELECT * FROM {{ ref('gl_ledger') }} | ||
) | ||
SELECT | ||
-- Surrogate Key | ||
{{ dbt_utils.generate_surrogate_key(['jb.je_batch_id', 'jh.je_header_id', 'jl.je_line_num']) }} AS Journal_Entry_Id, | ||
|
||
jh.je_header_id, | ||
jb.je_batch_id, | ||
jl.je_line_num, | ||
jb.name AS batch_name, | ||
jh.name AS journal_name, | ||
jh.status AS je_status, | ||
jh.actual_flag, | ||
jh.je_category, | ||
jh.je_source, | ||
jh.period_name, | ||
jl.code_combination_id, | ||
jh.description AS journal_description, | ||
jl.description AS line_description, | ||
jl.entered_dr AS entered_debit, | ||
jl.entered_cr AS entered_credit, | ||
jl.accounted_dr AS accounted_debit, | ||
jl.accounted_cr AS accounted_credit, | ||
jh.currency_code AS journal_currency, | ||
jl.currency_code AS line_currency, | ||
l.name AS ledger_name, | ||
l.short_name AS edger_short_name, | ||
l.currency_code AS ledger_currency, | ||
jb.status AS batch_status, | ||
jb.description AS batch_description, | ||
jh.creation_date AS journal_creation_date, | ||
jl.creation_date AS line_creation_date, | ||
jl.last_update_date AS last_update_date, | ||
|
||
NOW() AS _etl_ingestion_time | ||
FROM | ||
je_line jl | ||
LEFT JOIN je_header jh ON jl.je_header_id = jh.je_header_id | ||
LEFT JOIN je_batch jb ON jh.je_batch_id = jb.je_batch_id | ||
LEFT JOIN ledger l ON jh.ledger_id = l.ledger_id | ||
|
||
{% if is_incremental() %} | ||
WHERE jl.last_update_date > (SELECT COALESCE(MAX(last_update_date), '1970-01-01') FROM {{ this }}) | ||
{% endif %} |
142 changes: 142 additions & 0 deletions
142
transform/oracle_analytics/models/intermediate/finance/sub_ledger/f_subledger_entry.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,142 @@ | ||
{{ | ||
config( | ||
materialized='incremental', | ||
unique_key='Journal_Entry_Id', | ||
incremental_strategy='merge' | ||
) | ||
}} | ||
WITH ae_header AS ( | ||
SELECT | ||
ae_header_id, | ||
application_id, | ||
application_name, | ||
gl_transfer_status_code, | ||
transfer_date, | ||
ledger_id, | ||
accounting_date, | ||
accounted_cr AS total_accounted_credit, | ||
accounted_dr AS total_accounted_debit, | ||
created_by, | ||
creation_date, | ||
last_updated_by, | ||
last_update_date | ||
FROM | ||
{{ ref('xla_ae_header') }} | ||
), | ||
ae_line AS ( | ||
SELECT | ||
ae_line_id, | ||
ae_header_id, | ||
code_combination_id, | ||
segment1 || '-' || segment2 || '-' || segment3 || '-' || segment4 || '-' || segment5 AS account_code, | ||
segment1 AS company, | ||
segment2 AS cost_center, | ||
segment3 AS natural_account, | ||
segment4 AS intercompany, | ||
segment5 AS future_segment, | ||
accounting_class_code, | ||
accounted_dr AS line_accounted_debit, | ||
accounted_cr AS line_accounted_credit, | ||
created_by, | ||
creation_date, | ||
last_updated_by, | ||
last_update_date | ||
FROM | ||
{{ ref('xla_ae_line') }} | ||
), | ||
transaction_entity AS ( | ||
SELECT | ||
application_id, | ||
entity_id, | ||
entity_code, | ||
event_type_code, | ||
created_by, | ||
creation_date, | ||
last_updated_by, | ||
last_update_date | ||
FROM | ||
{{ ref('xla_transaction_entity') }} | ||
), | ||
gl_import_reference AS ( | ||
SELECT | ||
gl_sl_link_id, | ||
gl_sl_link_table, | ||
je_header_id, | ||
je_line_num, | ||
entity_id, | ||
created_by, | ||
creation_date, | ||
last_updated_by, | ||
last_update_date | ||
FROM | ||
{{ ref('gl_import_reference') }} | ||
), | ||
xla_event AS ( | ||
SELECT | ||
event_id, | ||
application_id, | ||
entity_id, | ||
event_type_code, | ||
event_date, | ||
event_status_code, | ||
process_status_code, | ||
created_by, | ||
creation_date, | ||
last_updated_by, | ||
last_update_date | ||
FROM | ||
{{ ref('xla_event') }} | ||
) | ||
SELECT | ||
aeh.ae_header_id, | ||
aeh.application_id, | ||
aeh.application_name, | ||
aeh.gl_transfer_status_code, | ||
aeh.transfer_date, | ||
aeh.ledger_id, | ||
aeh.accounting_date, | ||
aeh.total_accounted_credit, | ||
aeh.total_accounted_debit, | ||
aeh.creation_date AS header_creation_date, | ||
aeh.last_update_date AS header_last_update_date, | ||
ael.ae_line_id, | ||
ael.account_code, | ||
ael.company, | ||
ael.cost_center, | ||
ael.natural_account, | ||
ael.intercompany, | ||
ael.future_segment, | ||
ael.accounting_class_code, | ||
ael.line_accounted_debit, | ||
ael.line_accounted_credit, | ||
ael.creation_date AS line_creation_date, | ||
ael.last_update_date AS line_last_update_date, | ||
xte.entity_id, | ||
xte.entity_code, | ||
xte.event_type_code, | ||
xte.creation_date AS entity_creation_date, | ||
xte.last_update_date AS entity_last_update_date, | ||
gir.je_header_id, | ||
gir.je_line_num, | ||
xev.event_id, | ||
xev.event_date, | ||
xev.event_status_code, | ||
xev.process_status_code, | ||
xev.creation_date AS event_creation_date, | ||
xev.last_update_date AS event_last_update_date | ||
|
||
FROM | ||
ae_header aeh | ||
LEFT JOIN ae_line ael | ||
ON aeh.ae_header_id = ael.ae_header_id | ||
LEFT JOIN transaction_entity xte | ||
ON aeh.application_id = xte.application_id | ||
AND ael.ae_header_id = xte.entity_id | ||
LEFT JOIN gl_import_reference gir | ||
ON ael.ae_line_id = gir.gl_sl_link_id | ||
LEFT JOIN xla_event xev | ||
ON xte.event_id = xev.event_id | ||
|
||
{% if is_incremental() %} | ||
WHERE aeh.last_update_date > (SELECT COALESCE(MAX(header_last_update_date), '1970-01-01') FROM {{ this }}) | ||
{% endif %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
SELECT | ||
JournalCategoryJeCategoryKey AS JE_CATEGORY_KEY, | ||
JournalCategoryObjectVerNum AS OBJECT_VERSION_NUMBER, | ||
JrnlCatTransLangLastUpdatedBy AS LAST_UPDATED_BY, | ||
JournalCategoryAttribute3 AS ATTRIBUTE3, | ||
JrnlCatTransLangLastUpdateLogn AS LAST_UPDATE_LOGIN, | ||
JournalCategoryCreatedBy AS CREATED_BY, | ||
JrnlCatTransLangLanguage AS LANGUAGE, | ||
JournalCategoryLastUpdateDate AS LAST_UPDATE_DATE, | ||
JournalCategoryLastUpdatedBy AS LAST_UPDATED_BY, | ||
JrnlCatTransLangJeCategoryName AS JE_CATEGORY_NAME, | ||
JrnlCatTransLangLastUpdateDate AS LAST_UPDATE_DATE, | ||
JrnlCatTransLangSourceLang AS SOURCE_LANG, | ||
JournalCategoryLastUpdateLogin AS LAST_UPDATE_LOGIN, | ||
JrnlCatTransLangUserJeCatName AS USER_JE_CATEGORY_NAME, | ||
JournalCategoryAttribute5 AS ATTRIBUTE5, | ||
JournalCategoryAttrCategory AS ATTRIBUTE_CATEGORY, | ||
JournalCategoryAttribute2 AS ATTRIBUTE2, | ||
JournalCategoryCreationDate AS CREATION_DATE, | ||
JournalCategoryAttribute4 AS ATTRIBUTE4, | ||
JrnlCatTransLangDescription AS DESCRIPTION, | ||
JrnlCatTransLangCreationDate AS CREATION_DATE, | ||
JrnlCatTransLangCreatedBy AS CREATED_BY, | ||
JournalCategoryAttribute1 AS ATTRIBUTE1, | ||
JournalCategoryJeCategoryName AS JE_CATEGORY_NAME | ||
FROM {{ source('Fusion', 'Journal_Category_PVO') }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
SELECT | ||
JournalSourceAttribute4 AS ATTRIBUTE4, | ||
JournalSourceCreationDate AS CREATION_DATE, | ||
JournalSourceAttribute1 AS ATTRIBUTE1, | ||
JrnlSrcTransLangLastUpdatedBy AS LAST_UPDATED_BY, | ||
JournalSourceLastUpdateDate AS LAST_UPDATE_DATE, | ||
JournalSourceImpUsingKeyFlag AS IMPORT_USING_KEY_FLAG, | ||
JrnlSrcTransLangLastUpdateDate AS LAST_UPDATE_DATE, | ||
JournalSourceJournalRefFlag AS JOURNAL_REFERENCE_FLAG, | ||
JrnlSrcTransLangLastUpdateLog AS LAST_UPDATE_LOGIN, | ||
JournalSourceAttribute5 AS ATTRIBUTE5, | ||
JournalSourceLastUpdateLogin AS LAST_UPDATE_LOGIN, | ||
JournalSourceAttribute2 AS ATTRIBUTE2, | ||
JournalSourceAttributeCategory AS ATTRIBUTE_CATEGORY, | ||
JournalSourceObjectVersionNum AS OBJECT_VERSION_NUMBER, | ||
JournalSourceEffDateRuleCode AS EFFECTIVE_DATE_RULE_CODE, | ||
JournalSourceLastUpdatedBy AS LAST_UPDATED_BY, | ||
JournalSourceAttribute3 AS ATTRIBUTE3, | ||
JrnlSrcTransLangDescription AS DESCRIPTION, | ||
JrnlSrcTransLangLanguage AS LANGUAGE, | ||
JournalSourceJeSourceKey AS JE_SOURCE_KEY, | ||
JournalSourceCreatedBy AS CREATED_BY, | ||
JournalSourceJeSourceName AS JE_SOURCE_NAME, | ||
JrnlSrcTransLangJeSourceName AS JE_SOURCE_NAME, | ||
JrnlSrcTransLangSourceLang AS SOURCE_LANG, | ||
JournalSourceJournalApprvlFlag AS JOURNAL_APPROVAL_FLAG, | ||
JournalSourceOverrideEditsFlag AS OVERRIDE_EDITS_FLAG, | ||
JrnlSrcTransLangCreationDate AS CREATION_DATE, | ||
JrnlSrcTransLangCreatedBy AS CREATED_BY, | ||
JrnlSrcTransLangUserJeSrcName AS USER_JE_SOURCE_NAME, | ||
JournalSourceXlaApprovalFlag AS XLA_APPROVAL_FLAG | ||
FROM {{ source('Fusion', 'Journal_Source_PVO') }} |
26 changes: 26 additions & 0 deletions
26
transform/oracle_analytics/models/staging/finance/sub_ledger/gl_import_reference.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
SELECT | ||
GlImportReferencesJeHeaderId AS JE_HEADER_ID, | ||
GlImportReferencesReference8 AS REFERENCE_8, | ||
GlImportReferencesReference1 AS REFERENCE_1, | ||
GlImportReferencesReference10 AS REFERENCE_10, | ||
GlImportReferencesLastUpdateLogin AS LAST_UPDATE_LOGIN, | ||
GlImportReferencesCreatedBy AS CREATED_BY, | ||
GlImportReferencesGlSlLinkTable AS GL_SL_LINK_TABLE, | ||
GlImportReferencesReference2 AS REFERENCE_2, | ||
GlImportReferencesReference3 AS REFERENCE_3, | ||
GlImportReferencesReference6 AS REFERENCE_6, | ||
GlImportReferencesJeBatchId AS JE_BATCH_ID, | ||
GlImportReferencesReference4 AS REFERENCE_4, | ||
GlImportReferencesReference7 AS REFERENCE_7, | ||
GlImportReferencesSubledgerDocSequenceId AS SUBLEDGER_DOC_SEQUENCE_ID, | ||
GlImportReferencesGlSlLinkId AS GL_SL_LINK_ID, | ||
GlImportReferencesObjectVersionNumber AS OBJECT_VERSION_NUMBER, | ||
GlImportReferencesLastUpdatedBy AS LAST_UPDATED_BY, | ||
GlImportReferencesCreationDate AS CREATION_DATE, | ||
GlImportReferencesJeLineNum AS JE_LINE_NUM, | ||
GlImportReferencesSubledgerDocSequenceValue AS SUBLEDGER_DOC_SEQUENCE_VALUE, | ||
GlImportReferencesReference9 AS REFERENCE_9, | ||
GlImportReferencesReference5 AS REFERENCE_5, | ||
GlImportReferencesLastUpdateDate AS LAST_UPDATE_DATE | ||
FROM | ||
{{ source('Fusion', 'GL_Import_Reference_PVO') }} |
Oops, something went wrong.