Advertisement
Guest User

query

a guest
Jul 18th, 2019
1,750
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQL 49.14 KB | None | 0 0
  1. WITH
  2.  
  3.  
  4. --1.6
  5. company AS
  6.  (
  7.         SELECT DISTINCT
  8.                         glh.pk1_value  AS child_value ,
  9.                         fv.description AS description
  10.                 FROM
  11.                         fnd_vs_typed_values_vl fv ,
  12.                         gl_seg_val_hier_rf     glh,
  13.                         fnd_tree_version       ftv
  14.                 WHERE
  15.                         1                 =1
  16.                 AND     fv.value_set_code = 'Company UOB Ledger'
  17.                 AND     glh.tree_code     = 'Company UOB Ledger'
  18.                 AND     ftv.tree_code     = 'Company UOB Ledger'
  19.                 AND     SYSDATE BETWEEN ftv.effective_start_date AND     ftv.effective_end_date
  20.                 AND     ftv.tree_structure_code = 'GL_ACCT_FLEX'
  21.                 AND     ftv.TREE_VERSION_ID     = glh.TREE_VERSION_ID
  22.                 AND     glh.pk1_value           = fv.VALUE
  23.                 AND     glh.tree_structure_code = 'GL_ACCT_FLEX' -- 2.8
  24.                 AND     ftv.STATUS              = 'ACTIVE' -- 3.0
  25.                 AND     (
  26.                                 glh.ancestor_pk1_value IN (:P_COMPANY)
  27.                         OR      least(:P_COMPANY) IS NULL)
  28.  )
  29.      ,   analysis AS
  30.         (
  31.                 SELECT DISTINCT
  32.                         glh.pk1_value  AS child_value ,
  33.                         fv.description AS description
  34.                 FROM
  35.                         fnd_vs_typed_values_vl fv ,
  36.                         gl_seg_val_hier_rf     glh,
  37.                         fnd_tree_version       ftv
  38.                 WHERE
  39.                         1                 =1
  40.                 AND     fv.value_set_code = 'Analysis UOB Ledger'
  41.                 AND     glh.tree_code     = 'Analysis UOB Ledger'
  42.                 AND     ftv.tree_code     = 'Analysis UOB Ledger'
  43.                 AND     SYSDATE BETWEEN ftv.effective_start_date AND     ftv.effective_end_date
  44.                 AND     ftv.tree_structure_code = 'GL_ACCT_FLEX'
  45.                 AND     ftv.TREE_VERSION_ID     = glh.TREE_VERSION_ID
  46.                 AND     glh.pk1_value           = fv.VALUE
  47.                 AND     glh.tree_structure_code = 'GL_ACCT_FLEX' -- 2.8
  48.                 AND     ftv.STATUS              = 'ACTIVE' -- 3.0
  49.                 AND     (
  50.                                 glh.ancestor_pk1_value IN (:P_ANALYSIS)
  51.                         OR      least(:P_ANALYSIS) IS NULL)
  52.         )
  53.         ,
  54.         cost_centre AS
  55.         (
  56.                 SELECT DISTINCT
  57.                         glh.pk1_value  AS child_value ,
  58.                         fv.description AS description
  59.                 FROM
  60.                         fnd_vs_typed_values_vl fv ,
  61.                         gl_seg_val_hier_rf     glh,
  62.                         fnd_tree_version       ftv
  63.                 WHERE
  64.                         1                 =1
  65.                 AND     fv.value_set_code = 'Cost Centre UOB Ledger'
  66.                 AND     glh.tree_code     = 'Cost Centre UOB Ledger'
  67.                 AND     ftv.tree_code     = 'Cost Centre UOB Ledger'
  68.                 AND     SYSDATE BETWEEN ftv.effective_start_date AND     ftv.effective_end_date
  69.                 AND     ftv.tree_structure_code = 'GL_ACCT_FLEX'
  70.                 AND     ftv.TREE_VERSION_ID     = glh.TREE_VERSION_ID
  71.                 AND     glh.pk1_value           = fv.VALUE
  72.                 AND     glh.tree_structure_code = 'GL_ACCT_FLEX' -- 2.8
  73.                 AND     ftv.STATUS              = 'ACTIVE' -- 3.0
  74.                 AND     (
  75.                                 glh.ancestor_pk1_value IN (:P_COST_CENTRE)
  76.                         OR      least(:P_COST_CENTRE) IS NULL)
  77.         )
  78.         ,
  79.         activity AS
  80.         (
  81.                 SELECT DISTINCT
  82.                         glh.pk1_value  AS child_value ,
  83.                         fv.description AS description
  84.                 FROM
  85.                         fnd_vs_typed_values_vl fv ,
  86.                         gl_seg_val_hier_rf     glh,
  87.                         fnd_tree_version       ftv
  88.                 WHERE
  89.                         1                 =1
  90.                 AND     fv.value_set_code = 'Activity UOB Ledger'
  91.                 AND     glh.tree_code     = 'Activity UOB Ledger'
  92.                 AND     ftv.tree_code     = 'Activity UOB Ledger'
  93.                 AND     SYSDATE BETWEEN ftv.effective_start_date AND     ftv.effective_end_date
  94.                 AND     ftv.tree_structure_code = 'GL_ACCT_FLEX'
  95.                 AND     ftv.TREE_VERSION_ID     = glh.TREE_VERSION_ID
  96.                 AND     glh.pk1_value           = fv.VALUE
  97.                 AND     glh.tree_structure_code = 'GL_ACCT_FLEX' -- 2.8
  98.                 AND     ftv.STATUS              = 'ACTIVE' -- 3.0
  99.                 AND     (
  100.                                 glh.ancestor_pk1_value IN (:P_ACTIVITY)
  101.                         OR      least(:P_ACTIVITY) IS NULL)
  102.         )
  103.         ,
  104.         sof AS
  105.         (
  106.                 SELECT DISTINCT
  107.                         glh.pk1_value  AS child_value ,
  108.                         fv.description AS description
  109.                 FROM
  110.                         fnd_vs_typed_values_vl fv ,
  111.                         gl_seg_val_hier_rf     glh,
  112.                         fnd_tree_version       ftv
  113.                 WHERE
  114.                         1                 =1
  115.                 AND     fv.value_set_code = 'Source of Funds UOB Ledger'
  116.                 AND     glh.tree_code     = 'Source of Funds UOB Ledger'
  117.                 AND     ftv.tree_code     = 'Source of Funds UOB Ledger'
  118.                 AND     SYSDATE BETWEEN ftv.effective_start_date AND     ftv.effective_end_date
  119.                 AND     ftv.tree_structure_code = 'GL_ACCT_FLEX'
  120.                 AND     ftv.TREE_VERSION_ID     = glh.TREE_VERSION_ID
  121.                 AND     glh.pk1_value           = fv.VALUE
  122.                 AND     glh.tree_structure_code = 'GL_ACCT_FLEX' -- 2.8
  123.                 AND     ftv.STATUS              = 'ACTIVE' -- 3.0
  124.                 AND     (
  125.                                 glh.ancestor_pk1_value IN (:P_SOF)
  126.                         OR      least(:P_SOF) IS NULL)
  127.         )
  128.         ,
  129.         code_combinations AS
  130.         (
  131.                 SELECT
  132.                         cc.code_combination_id,
  133.                         cc.segment1           ,
  134.                         cc.segment2           ,
  135.                         cc.segment3           ,
  136.                         cc.segment4           ,
  137.                         cc.segment5
  138.                 FROM
  139.                         gl_code_combinations cc,
  140.                         company,
  141.                         analysis,
  142.                         cost_centre,
  143.                         activity,
  144.                         sof
  145.                 WHERE 1          = 1
  146.                 AND cc.segment1  = company.child_value
  147.                 AND cc.segment2  = analysis.child_value
  148.                 AND cc.segment3  = cost_centre.child_value
  149.                 AND cc.segment4  = activity.child_value
  150.                 AND cc.segment5  = sof.child_value
  151.                       --  ENABLED_FLAG = 'Y'
  152.         ),
  153.        
  154.         gl_data AS
  155.          (
  156.             SELECT
  157.                 glh.je_source                                       AS je_source,
  158.                 glh.ledger_id                                       AS ledger_id,
  159.                 glh.name                                            AS journal_header_name,
  160.                 glh.description                                     AS je_description,
  161.                 TO_CHAR(glh.posted_date, 'DD-MON-YYYY')             AS gl_posted_date,
  162.                 gll.description                                     AS gl_lines_description,
  163.                 gll.je_header_id                                    AS je_header_id,
  164.                 gll.je_line_num                                     AS je_line_num,
  165.                 NVL(gll.entered_dr,0)   - NVL(gll.entered_cr,0)     AS entered_currency_net,
  166.                 NVL(gll.accounted_dr,0) - NVL(gll.accounted_cr,0)   AS net_amount,
  167.                 gll.code_combination_id                             AS code_combination_id,
  168.                 glb.name                                            AS gl_batch_name,
  169.                 (SELECT user_je_source_name
  170.                  FROM gl_je_sources gjs
  171.                 WHERE gjs.je_source_name = glh.je_source
  172.                  AND ROWNUM = 1)                                    AS je_user_source_name,
  173.                 (SELECT user_je_category_name
  174.                  FROM gl_je_categories gjc
  175.                  WHERE gjc.je_category_name = glh.je_category
  176.                  AND ROWNUM = 1)                                    AS je_user_category_name,
  177.                  gll.currency_code                                  AS currency_code, -- 3.4
  178.                  glh.REVERSED_JE_HEADER_ID -- 3.5
  179.              FROM  
  180.                 gl_je_headers     glh ,
  181.                 gl_je_lines       gll ,
  182.                 gl_je_batches     glb,
  183.                 code_combinations cc
  184.              WHERE 1                      = 1
  185.               AND glh.je_header_id        = gll.je_header_id
  186.               AND gll.ledger_id           = glh.ledger_id
  187.               AND glh.ledger_id           = :P_LEDGER_ID
  188.               AND glh.je_batch_id         = glb.je_batch_id
  189.               AND glh.period_name         = :P_PERIOD_NAME
  190.               AND gll.period_name         = glh.period_name
  191.               AND gll.code_combination_id = cc.code_combination_id
  192.               AND glb.STATUS              = 'P' -- report only posted batches 3.2
  193.               AND gll.currency_code       <> 'STAT' -- 3.3 exclude STAT journals / 3.4
  194.              
  195.          
  196.          )
  197.          ,
  198.          xla AS
  199.           (
  200.             SELECT
  201.                 xal.gl_sl_link_id
  202.                ,xal.code_combination_id
  203.                ,xal.gl_sl_link_table
  204.                ,xal.ae_header_id           
  205.                ,xal.ae_line_num
  206.                ,NVL(xal.entered_dr,0)   - NVL(xal.entered_cr,0)   AS entered_currency_net
  207.                ,NVL(xal.accounted_dr,0) - NVL(xal.accounted_cr,0) AS net_amount
  208.                ,xah.ledger_id
  209.                ,xal.accounting_class_code
  210.                ,nvl(xte.source_id_int_1,-99) AS source_id_int_1 -- 2.9
  211.                ,xet.name
  212.                ,xte.entity_code
  213.                ,xte.application_id
  214.                ,xah.event_id
  215.                ,xte.legal_entity_id
  216.                ,xal.description AS line_description
  217.              FROM
  218.               xla_ae_headers           xah ,
  219.               xla_ae_lines             xal ,
  220.               xla_transaction_entities xte ,
  221.               xla_events               xev ,
  222.               xla_event_types_vl       xet
  223.           WHERE 1                   = 1
  224.            AND xah.ae_header_id     = xal.ae_header_id
  225.            AND xal.application_id   = xet.application_id -- add to hit index XLA_AE_HEADERS_U1 which is unique
  226.            AND xah.entity_id        = xte.entity_id
  227.            AND xah.event_id         = xev.event_id
  228.            AND xev.entity_id        = xte.entity_id
  229.            AND xev.event_type_code  = xet.event_type_code
  230.            AND xev.application_id   = xet.application_id
  231.            -- 2.9          
  232.            AND xah.period_name      = :P_PERIOD_NAME
  233.            AND xah.ledger_id        = :P_LEDGER_ID
  234.            AND xte.ledger_id        = :P_LEDGER_ID
  235.            AND xah.application_id   = xal.application_id           
  236.           )
  237.        
  238. SELECT  /*+ PARALLEL(journals 5) */
  239.         analysis_level_1      ,
  240.         segment2              ,
  241.         segment3              ,
  242.         segment4              ,
  243.         segment5              ,
  244.         accounting_period     ,
  245.         accounting_date       ,
  246.         transaction_number    ,
  247.         journal_source        ,
  248.         journal_category      ,
  249.         journal_batch         ,
  250.         journal_header_name   ,
  251.         journal_line_number   ,
  252.         gl_header_description ,
  253.         transaction_type_name ,
  254.         event_type            ,
  255.         gl_line_descripton    ,
  256.         trx_description       ,
  257.         accounting_class      ,
  258.         party_name            ,
  259.         reference             ,
  260.         transaction_date      ,
  261.         currency_code         ,
  262.         journals_po_number    ,
  263.         entered_currency_net  ,
  264.         net_amount            ,            
  265.         CEIL(ROWNUM/65000) sheet_no     --2.6
  266. FROM
  267.         (
  268.                 --- payables
  269.                 SELECT
  270.                         (
  271.                                 SELECT
  272.                                         ia.description
  273.                                 FROM
  274.                                         fnd_vs_typed_values_vl ia,
  275.                                         gl_seg_val_hier_rf     gh,
  276.                                         fnd_tree_version       ftv
  277.                                 WHERE
  278.                                         ia.VALUE          = gh.ancestor_pk1_value
  279.                                 AND     gh.pk1_value      = cc.segment2
  280.                                 AND     ia.value_set_code = 'Analysis UOB Ledger'
  281.                                 AND     gh.tree_code      = 'Analysis UOB Ledger'
  282.                                 AND     ftv.tree_code     = ia.value_set_code
  283.                                 AND     SYSDATE BETWEEN ftv.effective_start_date AND     ftv.effective_end_date
  284.                                 AND     ftv.tree_structure_code = 'GL_ACCT_FLEX'
  285.                                 AND     ftv.tree_structure_code = gh.tree_structure_code
  286.                                 AND     ftv.TREE_VERSION_ID     = gh.TREE_VERSION_ID
  287.                                 AND     gh.distance             = 1)      AS analysis_level_1      ,
  288.                         cc.segment2                                       AS segment2              ,
  289.                         cc.segment3                                       AS segment3              ,
  290.                         cc.segment4                                       AS segment4              ,
  291.                         cc.segment5                                       AS segment5              ,
  292.                         :P_PERIOD_NAME                                    AS accounting_period     ,
  293.                         gl_data.gl_posted_date                            AS accounting_date       ,
  294.                         aia.invoice_num                                   AS transaction_number    ,
  295.                         gl_data.je_user_source_name                       AS journal_source        ,
  296.                         gl_data.je_user_category_name                     AS journal_category      ,
  297.                         gl_data.gl_batch_name                             AS journal_batch         ,
  298.                         gl_data.journal_header_name                       AS journal_header_name   ,
  299.                         gl_data.je_line_num                               AS journal_line_number   ,
  300.                         gl_data.je_description                            AS gl_header_description ,
  301.                         aia.invoice_type_lookup_code                      AS transaction_type_name ,
  302.                         xla.name                                          AS event_type            ,
  303.                         xla.line_description                              AS gl_line_descripton    ,
  304.                         aia.description                                   AS trx_description       ,
  305.                         xla.accounting_class_code                         AS accounting_class      ,
  306.                         hp.party_name                                     AS party_name            ,
  307.                         ''                                                AS reference             ,
  308.                         TO_CHAR(aia.invoice_date, 'DD-MON-YYYY')          AS transaction_date      ,
  309.                         aia.invoice_currency_code                         AS currency_code         ,
  310.                         ''                                                AS journals_po_number    , -- 2.1
  311.                         xla.entered_currency_net                          AS entered_currency_net  , -- 1.5 / 1.7
  312.                         xla.net_amount                                    AS net_amount              -- 1.5 / 1.7
  313.                 FROM
  314.                          code_combinations              cc
  315.                         ,gl_data
  316.                         ,gl_import_references           gir                    
  317.                         ,xla
  318.                         ,ap_invoices_all                aia
  319.                         --,ap_invoice_distributions_all   aid -- 1.8                        
  320.                         ,hz_parties                     hp
  321.                 WHERE
  322.                         1                                 =1
  323.                 AND     gl_data.je_source                 = 'Payables'
  324.                 AND     gl_data.je_header_id              = gir.je_header_id
  325.                 AND     gir.je_line_num                   = gl_data.je_line_num
  326.                 AND     aia.set_of_books_id               = gl_data.ledger_id
  327.                 AND     xla.ledger_id                     = gl_data.ledger_id
  328.                 AND     xla.gl_sl_link_id                 = gir.gl_sl_link_id
  329.                 AND     gir.gl_sl_link_table              = xla.gl_sl_link_table
  330.                 AND     cc.code_combination_id            = xla.code_combination_id
  331.              --   1.9
  332.               --  AND   aia.invoice_id                    = aid.invoice_id
  333.                 AND     aia.invoice_id                    = xla.source_id_int_1
  334.                 --AND   aid.dist_code_combination_id      = cc.code_combination_id
  335.                 --AND   aid.accounting_event_id           = xla.event_id   
  336.                 -- 1.9
  337.                 AND     aia.party_id                      = hp.party_id
  338.                 -- 3.1
  339.                 AND  xla.entity_code                      = 'AP_INVOICES'
  340.                 -- 3.1
  341.                 AND  gl_data.REVERSED_JE_HEADER_ID IS NULL -- 3.5
  342.                
  343.                 UNION ALL -- 2.9
  344.                
  345.                 --- payables - AP Payments
  346.                 SELECT
  347.                
  348.                
  349.                 (
  350.                                 SELECT
  351.                                         ia.description
  352.                                 FROM
  353.                                         fnd_vs_typed_values_vl ia,
  354.                                         gl_seg_val_hier_rf     gh,
  355.                                         fnd_tree_version       ftv
  356.                                 WHERE
  357.                                         ia.VALUE          = gh.ancestor_pk1_value
  358.                                 AND     gh.pk1_value      = cc.segment2
  359.                                 AND     ia.value_set_code = 'Analysis UOB Ledger'
  360.                                 AND     gh.tree_code      = 'Analysis UOB Ledger'
  361.                                 AND     ftv.tree_code     = ia.value_set_code
  362.                                 AND     SYSDATE BETWEEN ftv.effective_start_date AND     ftv.effective_end_date
  363.                                 AND     ftv.tree_structure_code = 'GL_ACCT_FLEX'
  364.                                 AND     ftv.tree_structure_code = gh.tree_structure_code
  365.                                 AND     ftv.TREE_VERSION_ID     = gh.TREE_VERSION_ID
  366.                                 AND     gh.distance             = 1)      AS analysis_level_1      ,
  367.                         cc.segment2                                       AS segment2              ,
  368.                         cc.segment3                                       AS segment3              ,
  369.                         cc.segment4                                       AS segment4              ,
  370.                         cc.segment5                                       AS segment5              ,
  371.                         :P_PERIOD_NAME                                    AS accounting_period     ,
  372.                         gl_data.gl_posted_date                            AS accounting_date       ,
  373.                         to_char(aca.check_number)                         AS transaction_number    ,
  374.                         gl_data.je_user_source_name                       AS journal_source        ,
  375.                         gl_data.je_user_category_name                     AS journal_category      ,
  376.                         gl_data.gl_batch_name                             AS journal_batch         ,
  377.                         gl_data.journal_header_name                       AS journal_header_name   ,
  378.                         gl_data.je_line_num                               AS journal_line_number   ,
  379.                         gl_data.je_description                            AS gl_header_description ,
  380.                         'Payment'                                         AS transaction_type_name ,
  381.                         xla.name                                          AS event_type            ,
  382.                         xla.line_description                              AS gl_line_descripton    ,
  383.                         aca.description                                   AS trx_description       ,
  384.                         xla.accounting_class_code                         AS accounting_class      ,
  385.                         hp.party_name                                     AS party_name            ,
  386.                         ''                                                AS reference             ,
  387.                         TO_CHAR(aca.check_date, 'DD-MON-YYYY')            AS transaction_date      ,
  388.                         aca.currency_code                                 AS currency_code         ,
  389.                         ''                                                AS journals_po_number    , -- 2.1
  390.                         xla.entered_currency_net                          AS entered_currency_net  , -- 1.5 / 1.7
  391.                         xla.net_amount                                    AS net_amount              -- 1.5 / 1.7
  392.                 FROM
  393.                          code_combinations              cc
  394.                         ,gl_data
  395.                         ,gl_import_references           gir                    
  396.                         ,xla
  397.                         ,ap_checks_all                  aca
  398.                         --,ap_invoice_payments_all       aipa
  399.                     --  ,ap_invoices_all                 aia                      
  400.                         ,hz_parties                     hp
  401.                 WHERE
  402.                         1                                 =1
  403.                 AND     gl_data.je_source                 = 'Payables'
  404.                 AND     gl_data.je_header_id              = gir.je_header_id
  405.                 AND     gir.je_line_num                   = gl_data.je_line_num
  406.                 --AND     aipa.set_of_books_id              = gl_data.ledger_id
  407.                 AND     xla.ledger_id                     = gl_data.ledger_id
  408.                 AND     xla.gl_sl_link_id                 = gir.gl_sl_link_id
  409.                 AND     gir.gl_sl_link_table              = xla.gl_sl_link_table
  410.                 AND     cc.code_combination_id            = xla.code_combination_id
  411.                 AND     aca.check_id                      = xla.source_id_int_1
  412.             --  and     aipa.check_id                     = aca.check_id
  413.             --  and     aipa.invoice_id                   = aia.invoice_id
  414.                 AND     aca.party_id                      = hp.party_id
  415.                 AND     xla.entity_code                   = 'AP_PAYMENTS'
  416.                 AND  gl_data.REVERSED_JE_HEADER_ID IS NULL -- 3.5
  417.                
  418.                
  419.                 UNION ALL
  420.                
  421.                
  422.                 -- Receivables
  423.                 SELECT
  424.                         (
  425.                                 SELECT
  426.                                         ia.description
  427.                                 FROM
  428.                                         fnd_vs_typed_values_vl ia,
  429.                                         gl_seg_val_hier_rf     gh,
  430.                                         fnd_tree_version       ftv
  431.                                 WHERE
  432.                                         ia.VALUE          = gh.ancestor_pk1_value
  433.                                 AND     gh.pk1_value      = cc.segment2
  434.                                 AND     ia.value_set_code = 'Analysis UOB Ledger'
  435.                                 AND     gh.tree_code      = 'Analysis UOB Ledger'
  436.                                 AND     ftv.tree_code     = ia.value_set_code
  437.                                 AND     SYSDATE BETWEEN ftv.effective_start_date AND     ftv.effective_end_date
  438.                                 AND     ftv.tree_structure_code = 'GL_ACCT_FLEX'
  439.                                 AND     ftv.tree_structure_code = gh.tree_structure_code
  440.                                 AND     ftv.TREE_VERSION_ID     = gh.TREE_VERSION_ID
  441.                                 AND     gh.distance             = 1)      AS analysis_level_1      ,
  442.                         cc.segment2                                       AS segment2              ,
  443.                         cc.segment3                                       AS segment3              ,
  444.                         cc.segment4                                       AS segment4              ,
  445.                         cc.segment5                                       AS segment5              ,
  446.                         :P_PERIOD_NAME                                    AS accounting_period     ,
  447.                         gl_data.gl_posted_date                            AS accounting_date       ,
  448.                         rct.trx_number                                    AS transaction_number    ,
  449.                         gl_data.je_user_source_name                       AS journal_source        ,
  450.                         gl_data.je_user_category_name                     AS journal_category      ,
  451.                         gl_data.gl_batch_name                             AS journal_batch         ,
  452.                         gl_data.journal_header_name                       AS journal_header_name   ,
  453.                         gl_data.je_line_num                               AS journal_line_number   ,                       
  454.                         gl_data.je_description                            AS gl_header_description ,
  455.                         rctta.name                                        AS transaction_type_name ,
  456.                         xla.name                                          AS event_type            ,
  457.                         xla.line_description                              AS gl_line_descripton    ,
  458.                         ''                                                AS trx_description       ,
  459.                         xla.accounting_class_code                         AS accounting_class      ,
  460.                         hp.party_name                                     AS party_name            ,
  461.                         ''                                                AS REFERENCE             ,
  462.                         TO_CHAR(rct.trx_date , 'DD-MON-YYYY')             AS transaction_date      ,
  463.                         rct.invoice_currency_code                         AS currency_code         ,
  464.                         ''                                                AS journals_po_number    , -- 2.1
  465.                         xla.entered_currency_net                          AS entered_currency_net  , -- 1.5 / 1.7
  466.                         xla.net_amount                                    AS net_amount              -- 1.5 / 1.7
  467.                 FROM
  468.                          code_combinations             cc
  469.                         ,gl_data
  470.                         ,gl_import_references          gir
  471.                         ,xla
  472.                         ,ra_customer_trx_all           rct
  473.                         ,ra_cust_trx_types_all         rctta
  474.                         ,hz_parties                    hp
  475.                         ,hz_cust_accounts              ca
  476.                         --2.8
  477.                       /*,ra_customer_trx_lines_all     ctl
  478.                        ,ra_cust_trx_line_gl_dist_all  ctld     
  479.                         ,xla_distribution_links        xdl
  480.                       */
  481.                         --2.8                    
  482.                 WHERE
  483.                         1                                = 1
  484.                 AND     gl_data.je_source                = 'Receivables'
  485.                 AND     gl_data.je_header_id             = gir.je_header_id
  486.                 AND     gir.je_line_num                  = gl_data.je_line_num
  487.                 AND     xla.ledger_id                    = gl_data.ledger_id
  488.                 AND     xla.gl_sl_link_id                = gir.gl_sl_link_id
  489.                 AND     gir.gl_sl_link_table             = xla.gl_sl_link_table
  490.                 AND     cc.code_combination_id           = xla.code_combination_id
  491.                 AND     rct.cust_trx_type_seq_id         = rctta.cust_trx_type_seq_id
  492.                 AND     xla.source_id_int_1              = rct.customer_trx_id         
  493.                 AND     xla.application_id               = 222
  494.                 AND     rct.bill_to_customer_id          = ca.cust_account_id
  495.                 AND     ca.party_id                      = hp.party_id
  496.                 AND     xla.entity_code                  NOT IN ('ADJUSTMENTS','RECEIPTS') -- 3.0
  497.                  -- 2.8
  498.             /*  AND     rct.customer_trx_id              = ctld.customer_trx_id                        
  499.                 AND     rct.customer_trx_id              = ctl.customer_trx_id                
  500.                 AND     ctld.customer_trx_line_id        = ctl.customer_trx_line_id    
  501.                 AND     ctl.line_type                    = 'LINE'              
  502.                 AND     cc.code_combination_id           = ctld.code_combination_id    
  503.                 AND     xdl.source_distribution_id_num_1 = ctld.cust_trx_line_gl_dist_id  
  504.                 AND     xla.ae_header_id                 = xdl.ae_header_id            
  505.                 AND     xla.ae_line_num                  = xdl.ae_line_num     
  506.             */
  507.                 -- 2.8
  508.                 AND  gl_data.REVERSED_JE_HEADER_ID IS NULL -- 3.5
  509.                
  510.                
  511.                 UNION ALL -- 2.9
  512.                 -- Receivables - Adjustments
  513.                 SELECT
  514.                         (
  515.                                 SELECT
  516.                                         ia.description
  517.                                 FROM
  518.                                         fnd_vs_typed_values_vl ia,
  519.                                         gl_seg_val_hier_rf     gh,
  520.                                         fnd_tree_version       ftv
  521.                                 WHERE
  522.                                         ia.VALUE          = gh.ancestor_pk1_value
  523.                                 AND     gh.pk1_value      = cc.segment2
  524.                                 AND     ia.value_set_code = 'Analysis UOB Ledger'
  525.                                 AND     gh.tree_code      = 'Analysis UOB Ledger'
  526.                                 AND     ftv.tree_code     = ia.value_set_code
  527.                                 AND     SYSDATE BETWEEN ftv.effective_start_date AND     ftv.effective_end_date
  528.                                 AND     ftv.tree_structure_code = 'GL_ACCT_FLEX'
  529.                                 AND     ftv.tree_structure_code = gh.tree_structure_code
  530.                                 AND     ftv.TREE_VERSION_ID     = gh.TREE_VERSION_ID
  531.                                 AND     gh.distance             = 1)      AS analysis_level_1      ,
  532.                         cc.segment2                                       AS segment2              ,
  533.                         cc.segment3                                       AS segment3              ,
  534.                         cc.segment4                                       AS segment4              ,
  535.                         cc.segment5                                       AS segment5              ,
  536.                         :P_PERIOD_NAME                                    AS accounting_period     ,
  537.                         gl_data.gl_posted_date                            AS accounting_date       ,
  538.                         ada.adjustment_number                             AS transaction_number    ,
  539.                         gl_data.je_user_source_name                       AS journal_source        ,
  540.                         gl_data.je_user_category_name                     AS journal_category      ,
  541.                         gl_data.gl_batch_name                             AS journal_batch         ,
  542.                         gl_data.journal_header_name                       AS journal_header_name   ,
  543.                         gl_data.je_line_num                               AS journal_line_number   ,                       
  544.                         xla.line_description                              AS gl_header_description ,
  545.                         rctta.name                                        AS transaction_type_name ,
  546.                         xla.name                                          AS event_type            ,
  547.                         gl_data.gl_lines_description                      AS gl_line_descripton    ,
  548.                         ''                                                AS trx_description       ,
  549.                         xla.accounting_class_code                         AS accounting_class      ,
  550.                         hp.party_name                                     AS party_name            ,
  551.                         ''                                                AS REFERENCE             ,
  552.                         TO_CHAR(rct.trx_date , 'DD-MON-YYYY')             AS transaction_date      ,
  553.                         rct.invoice_currency_code                         AS currency_code         ,
  554.                         ''                                                AS journals_po_number    , -- 2.1
  555.                         xla.entered_currency_net                          AS entered_currency_net  , -- 1.5 / 1.7
  556.                         xla.net_amount                                    AS net_amount              -- 1.5 / 1.7
  557.                 FROM
  558.                          code_combinations             cc
  559.                         ,gl_data                             
  560.                         ,gl_import_references          gir
  561.                         ,xla                                 
  562.                         ,ra_customer_trx_all           rct
  563.                         ,ra_cust_trx_types_all         rctta
  564.                         ,hz_parties                    hp
  565.                         ,hz_cust_accounts              ca
  566.                    --     ra_customer_trx_lines_all     ctl,                           
  567.                         ,ar_adjustments_all            ada
  568.                            
  569.                 WHERE
  570.                         1                                = 1
  571.                 AND     gl_data.je_source                = 'Receivables'
  572.                 AND     gl_data.je_header_id             = gir.je_header_id
  573.                 AND     gir.je_line_num                  = gl_data.je_line_num
  574.                 AND     xla.ledger_id                    = gl_data.ledger_id
  575.                 AND     xla.gl_sl_link_id                = gir.gl_sl_link_id
  576.                 AND     gir.gl_sl_link_table             = xla.gl_sl_link_table
  577.                 AND     cc.code_combination_id           = xla.code_combination_id
  578. --                AND     rct.customer_trx_id              = ctl.customer_trx_id
  579.                 AND     rct.cust_trx_type_seq_id         = rctta.cust_trx_type_seq_id
  580.                 --AND     ctl.line_type                    = 'LINE'            
  581.                 AND     xla.source_id_int_1              = ada.adjustment_id
  582.                 AND     xla.entity_code                  = 'ADJUSTMENTS'
  583.                 AND     ada.customer_trx_id              = rct.customer_trx_id
  584.                 AND     xla.application_id               = 222             
  585.                 AND     rct.bill_to_customer_id          = ca.cust_account_id
  586.                 AND     ca.party_id                      = hp.party_id
  587.                 AND  gl_data.REVERSED_JE_HEADER_ID IS NULL -- 3.5
  588.                
  589.                 UNION ALL -- 2.9
  590.                 -- Receivables - misc receipts
  591.                 -- 2.3         
  592.                
  593.                 SELECT
  594.                     (
  595.                             SELECT
  596.                                     ia.description
  597.                             FROM
  598.                                     fnd_vs_typed_values_vl ia,
  599.                                     gl_seg_val_hier_rf     gh,
  600.                                     fnd_tree_version       ftv
  601.                             WHERE
  602.                                     ia.VALUE          = gh.ancestor_pk1_value
  603.                             AND     gh.pk1_value      = cc.segment2
  604.                             AND     ia.value_set_code = 'Analysis UOB Ledger'
  605.                             AND     gh.tree_code      = 'Analysis UOB Ledger'
  606.                             AND     ftv.tree_code     = ia.value_set_code
  607.                             AND     SYSDATE BETWEEN ftv.effective_start_date AND     ftv.effective_end_date
  608.                             AND     ftv.tree_structure_code = 'GL_ACCT_FLEX'
  609.                             AND     ftv.tree_structure_code = gh.tree_structure_code
  610.                             AND     ftv.TREE_VERSION_ID     = gh.TREE_VERSION_ID
  611.                             AND     gh.distance             = 1)      AS analysis_level_1      ,
  612.                     cc.segment2                                       AS segment2              ,
  613.                     cc.segment3                                       AS segment3              ,
  614.                     cc.segment4                                       AS segment4              ,
  615.                     cc.segment5                                       AS segment5              ,
  616.                     :P_PERIOD_NAME                                    AS accounting_period     ,
  617.                     gl_data.gl_posted_date                            AS accounting_date       ,
  618.                     acra.receipt_number                               AS transaction_number    ,
  619.                     gl_data.je_user_source_name                       AS journal_source        ,
  620.                     gl_data.je_user_category_name                     AS journal_category      ,
  621.                     gl_data.gl_batch_name                             AS journal_batch         ,
  622.                     gl_data.journal_header_name                       AS journal_header_name   ,
  623.                     gl_data.je_line_num                               AS journal_line_number   ,                   
  624.                     xla.line_description                              AS gl_header_description ,
  625.                     acra.TYPE                                         AS transaction_type_name ,
  626.                     xla.name                                          AS event_type            ,
  627.                     gl_data.gl_lines_description                      AS gl_line_descripton    ,
  628.                     ''                                                AS trx_description       ,
  629.                     xla.accounting_class_code                         AS accounting_class      ,
  630.                     ''                                                AS party_name            ,
  631.                     ''                                                AS REFERENCE             ,
  632.                     TO_CHAR(acra.receipt_date , 'DD-MON-YYYY')        AS transaction_date      ,
  633.                     acra.currency_code                                AS currency_code         ,
  634.                     ''                                                AS journals_po_number    , -- 2.1
  635.                     xla.entered_currency_net                          AS entered_currency_net  , -- 1.5 / 1.7
  636.                     xla.net_amount                                    AS net_amount              -- 1.5 / 1.7
  637.             FROM
  638.                      code_combinations             cc
  639.                     ,gl_data                             
  640.                     ,gl_import_references          gir
  641.                     ,xla                                                           
  642.                     ,ar_cash_receipts_all          acra
  643.                        
  644.             WHERE
  645.                     1                                = 1
  646.             AND     gl_data.je_source                = 'Receivables'
  647.             AND     gl_data.je_header_id             = gir.je_header_id
  648.             AND     gir.je_line_num                  = gl_data.je_line_num
  649.             AND     xla.ledger_id                    = gl_data.ledger_id
  650.             AND     xla.gl_sl_link_id                = gir.gl_sl_link_id
  651.             AND     gir.gl_sl_link_table             = xla.gl_sl_link_table
  652.             AND     cc.code_combination_id           = xla.code_combination_id
  653.             AND     xla.source_id_int_1              = acra.cash_receipt_id
  654.             AND     xla.entity_code                  = 'RECEIPTS'
  655.             AND     xla.application_id               = 222             
  656.             AND  gl_data.REVERSED_JE_HEADER_ID IS NULL -- 3.5                      
  657.            
  658.                 UNION ALL -- 2.9
  659.    
  660.                 -- manual and spreadsheet
  661.                 SELECT DISTINCT -- 3.6
  662.                         (
  663.                                 SELECT
  664.                                         ia.description
  665.                                 FROM
  666.                                         fnd_vs_typed_values_vl ia,
  667.                                         gl_seg_val_hier_rf     gh,
  668.                                         fnd_tree_version       ftv
  669.                                 WHERE
  670.                                         ia.VALUE          = gh.ancestor_pk1_value
  671.                                 AND     gh.pk1_value      = cc.segment2
  672.                                 AND     ia.value_set_code = 'Analysis UOB Ledger'
  673.                                 AND     gh.tree_code      = 'Analysis UOB Ledger'
  674.                                 AND     ftv.tree_code     = ia.value_set_code
  675.                                 AND     SYSDATE BETWEEN ftv.effective_start_date AND     ftv.effective_end_date
  676.                                 AND     ftv.tree_structure_code = 'GL_ACCT_FLEX'
  677.                                 AND     ftv.tree_structure_code = gh.tree_structure_code
  678.                                 AND     ftv.TREE_VERSION_ID     = gh.TREE_VERSION_ID
  679.                                 AND     gh.distance             = 1)      AS analysis_level_1      ,
  680.                         cc.segment2                                       AS segment2              ,
  681.                         cc.segment3                                       AS segment3              ,
  682.                         cc.segment4                                       AS segment4              ,
  683.                         cc.segment5                                       AS segment5              ,
  684.                         :P_PERIOD_NAME                                    AS accounting_period     ,
  685.                         gl_data.gl_posted_date                            AS accounting_date       ,
  686.                         NULL                                              AS transaction_number    ,
  687.                         gl_data.je_user_source_name                       AS journal_source        ,
  688.                         gl_data.je_user_category_name                     AS journal_category      ,
  689.                         gl_data.gl_batch_name                             AS journal_batch         ,
  690.                         gl_data.journal_header_name                       AS journal_header_name   ,
  691.                         gl_data.je_line_num                               AS journal_line_number   ,                       
  692.                         gl_data.je_description                            AS gl_header_description ,
  693.                         NULL                                              AS transaction_type_name ,
  694.                         NULL                                              AS event_type            ,
  695.                         gl_data.gl_lines_description                      AS gl_line_descripton    ,
  696.                         NULL                                              AS trx_description       ,
  697.                         NULL                                              AS accounting_class      ,
  698.                         NULL                                              AS party_name            ,
  699.                         NULL                                              AS REFERENCE             ,
  700.                         NULL                                              AS transaction_date      ,
  701.                         gl_data.currency_code                             AS currency_code         ,
  702.                         ''                                                AS journals_po_number            , -- 2.1
  703.                         gl_data.entered_currency_net                      AS entered_currency_net  , -- 1.5
  704.                         gl_data.net_amount                                AS net_amount              -- 1.5
  705.                 FROM
  706.                         code_combinations cc
  707.                        ,gl_data
  708.                 WHERE
  709.                         1                = 1
  710.                 AND    ( (gl_data.je_source NOT IN ('Receivables','Payables', 'Receipt Accounting'))  OR
  711.                          (gl_data.je_source IN ('Receivables','Payables', 'Receipt Accounting')
  712.                          AND NOT EXISTS (
  713.                                             SELECT 1 FROM gl_import_references gir
  714.                                              WHERE  gir.je_line_num        = gl_data.je_line_num
  715.                                                 AND gl_data.je_header_id   = gir.je_header_id
  716.                                         )
  717.                          )
  718.                        )
  719.                 -- 1.8 / 3.6
  720.                 AND     cc.code_combination_id = gl_data.code_combination_id
  721.                 AND  gl_data.REVERSED_JE_HEADER_ID IS NULL -- 3.5                      
  722.                
  723.                 UNION ALL -- 2.9
  724.  
  725. --1.8 Receipt Accounting
  726.                 SELECT
  727.                        
  728.                         (
  729.                                 SELECT
  730.                                         ia.description
  731.                                 FROM
  732.                                         fnd_vs_typed_values_vl ia,
  733.                                         gl_seg_val_hier_rf     gh,
  734.                                         fnd_tree_version       ftv
  735.                                 WHERE
  736.                                         ia.VALUE          = gh.ancestor_pk1_value
  737.                                 AND     gh.pk1_value      = cc.segment2
  738.                                 AND     ia.value_set_code = 'Analysis UOB Ledger'
  739.                                 AND     gh.tree_code      = 'Analysis UOB Ledger'
  740.                                 AND     ftv.tree_code     = ia.value_set_code
  741.                                 AND     SYSDATE BETWEEN ftv.effective_start_date AND     ftv.effective_end_date
  742.                                 AND     ftv.tree_structure_code = 'GL_ACCT_FLEX'
  743.                                 AND     ftv.tree_structure_code = gh.tree_structure_code
  744.                                 AND     ftv.TREE_VERSION_ID     = gh.TREE_VERSION_ID
  745.                                 AND     gh.distance             = 1)      AS analysis_level_1      ,
  746.                         cc.segment2                                       AS segment2              ,
  747.                         cc.segment3                                       AS segment3              ,
  748.                         cc.segment4                                       AS segment4              ,
  749.                         cc.segment5                                       AS segment5              ,
  750.                         :P_PERIOD_NAME                                    AS accounting_period     ,
  751.                         gl_data.gl_posted_date                            AS accounting_date       ,
  752.                         rcpt_data.receipt_number                          AS transaction_number    ,
  753.                         gl_data.je_user_source_name                       AS journal_source        ,
  754.                         gl_data.je_user_category_name                     AS journal_category      ,
  755.                         gl_data.gl_batch_name                             AS journal_batch         ,
  756.                         gl_data.journal_header_name                       AS journal_header_name   ,
  757.                         gl_data.je_line_num                               AS journal_line_number   ,                       
  758.                         gl_data.je_description                            AS gl_header_description ,
  759.                         rcpt_data.transaction_type                        AS transaction_type_name ,
  760.                         xla.name                                          AS event_type            ,
  761.                         xla.line_description                              AS gl_line_descripton    ,
  762.                         rcpt_data.description                             AS trx_description       ,
  763.                         xla.accounting_class_code                         AS accounting_class      ,
  764.                         rcpt_data.party_unique_name                       AS party_name            ,
  765.                         ''                                                AS REFERENCE             ,
  766.                         TO_CHAR(rcpt_data.transaction_date,'DD-MON-YYYY') AS transaction_date      ,
  767.                         /*rcpt_data.entered_currency_code*/ ''            AS currency_code         ,
  768.                         rcpt_data.po_number                               AS journals_po_number    , -- 2.1
  769.                         xla.entered_currency_net                          AS entered_currency_net  , -- 1.5 / 1.7
  770.                         xla.net_amount                                    AS net_amount              -- 1.5 / 1.7
  771.                        
  772.                 FROM
  773.                          code_combinations            cc
  774.                         ,gl_data
  775.                         ,gl_import_references         gir
  776.                         ,xla                                   
  777.                         ,xla_distribution_links       xdl                      
  778.                         ,(SELECT
  779.                           hp.party_unique_name,
  780.                           cre.accounting_event_id,
  781.                          -- crd.accounting_line_type,
  782.                           cre.event_id                  AS event_id,
  783.                           cre.ledger_id                 AS ledger_id,
  784.                           cre.legal_entity_id           AS legal_entity_id,
  785.                           crt.transaction_type,
  786.                           crt.transaction_date,
  787.                          -- crd.entered_currency_code,
  788.                           crt.receipt_number,
  789.                           pl.item_description           AS description,
  790.                           crt.cmr_rcv_transaction_id    AS transaction_id,
  791.                           h.segment1                    AS po_number        --2.1
  792.                        FROM
  793.                           --cmr_rcv_distributions       crd,
  794.                           cmr_rcv_events                cre,
  795.                           fun_all_business_units_v      bu,
  796.                           cmr_rcv_transactions          crt ,
  797.                           po_headers_all                h,
  798.                           po_distributions              d,
  799.                           po_lines_all                  pl, -- 3.2
  800.                         --  por_requisition_headers_all     prh,
  801.                         --  por_requisition_lines_all   prl,
  802.                         --  por_req_distributions_all   prd,
  803.                           poz_suppliers                 ps,
  804.                           hz_parties                    hp
  805.                        WHERE 1                          = 1
  806.                          AND cre.business_unit_id       = bu.bu_id
  807.                          --AND crd.accounting_event_id  = cre.accounting_event_id
  808.                          AND cre.cmr_rcv_transaction_id = crt.cmr_rcv_transaction_id
  809.                          AND d.po_header_id             = h.po_header_id
  810.                          AND d.PO_DISTRIBUTION_ID       = crt.PO_DISTRIBUTION_ID
  811.                          AND ps.party_id                = hp.party_id
  812.                          AND h.vendor_id                = ps.vendor_id
  813.                          AND h.po_header_id             = pl.po_header_id
  814.                          AND pl.po_line_id              = d.po_line_id
  815.                         -- and d.REQ_DISTRIBUTION_ID        = prd.DISTRIBUTION_ID
  816.                         -- and prl.requisition_line_id  = prd.requisition_line_id
  817.                         -- and prh.requisition_header_id    = prl.requisition_header_id
  818.                         ) rcpt_data
  819.                 WHERE
  820.                         1                                = 1
  821.                 AND     gl_data.je_source                = 'Receipt Accounting'
  822.                 AND     gl_data.je_header_id             = gir.je_header_id
  823.                 AND     gir.je_line_num                  = gl_data.je_line_num
  824.                 AND     xla.ledger_id                    = gl_data.ledger_id
  825.                 AND     xla.gl_sl_link_id                = gir.gl_sl_link_id
  826.                 AND     gir.gl_sl_link_table             = xla.gl_sl_link_table
  827.                 AND     cc.code_combination_id           = xla.code_combination_id
  828.                 AND     xla.ledger_id                    = rcpt_data.ledger_id
  829.                 AND     xla.event_id                     = rcpt_data.event_id
  830.                 AND    ( xla.source_id_int_1              = rcpt_data.transaction_id  OR xla.source_id_int_1 =  rcpt_data.accounting_event_id)
  831.                 --AND   xla.accounting_class_code        = rcpt_data.accounting_line_type
  832.                 AND     xla.legal_entity_id              = rcpt_data.legal_entity_id
  833.                 AND     xla.ae_header_id                 = xdl.ae_header_id
  834.                 AND     xla.ae_line_num                  = xdl.ae_line_num     
  835.     --          AND     glh.currency_code                = :P_CURRENCY_CODE -- 1.9
  836.                 AND  gl_data.REVERSED_JE_HEADER_ID IS NULL -- 3.5
  837.                
  838.                 UNION ALL -- 2.9
  839.    
  840.                 -- reversal journals -- 3.5
  841.                 SELECT
  842.                         (
  843.                                 SELECT
  844.                                         ia.description
  845.                                 FROM
  846.                                         fnd_vs_typed_values_vl ia,
  847.                                         gl_seg_val_hier_rf     gh,
  848.                                         fnd_tree_version       ftv
  849.                                 WHERE
  850.                                         ia.VALUE          = gh.ancestor_pk1_value
  851.                                 AND     gh.pk1_value      = cc.segment2
  852.                                 AND     ia.value_set_code = 'Analysis UOB Ledger'
  853.                                 AND     gh.tree_code      = 'Analysis UOB Ledger'
  854.                                 AND     ftv.tree_code     = ia.value_set_code
  855.                                 AND     SYSDATE BETWEEN ftv.effective_start_date AND     ftv.effective_end_date
  856.                                 AND     ftv.tree_structure_code = 'GL_ACCT_FLEX'
  857.                                 AND     ftv.tree_structure_code = gh.tree_structure_code
  858.                                 AND     ftv.TREE_VERSION_ID     = gh.TREE_VERSION_ID
  859.                                 AND     gh.distance             = 1)      AS analysis_level_1      ,
  860.                         cc.segment2                                       AS segment2              ,
  861.                         cc.segment3                                       AS segment3              ,
  862.                         cc.segment4                                       AS segment4              ,
  863.                         cc.segment5                                       AS segment5              ,
  864.                         :P_PERIOD_NAME                                    AS accounting_period     ,
  865.                         gl_data.gl_posted_date                            AS accounting_date       ,
  866.                         NULL                                              AS transaction_number    ,
  867.                         gl_data.je_user_source_name                       AS journal_source        ,
  868.                         gl_data.je_user_category_name                     AS journal_category      ,
  869.                         gl_data.gl_batch_name                             AS journal_batch         ,
  870.                         gl_data.journal_header_name                       AS journal_header_name   ,
  871.                         gl_data.je_line_num                               AS journal_line_number   ,                       
  872.                         gl_data.je_description                            AS gl_header_description ,
  873.                         NULL                                              AS transaction_type_name ,
  874.                         NULL                                              AS event_type            ,
  875.                         gl_data.gl_lines_description                      AS gl_line_descripton    ,
  876.                         NULL                                              AS trx_description       ,
  877.                         NULL                                              AS accounting_class      ,
  878.                         NULL                                              AS party_name            ,
  879.                         NULL                                              AS REFERENCE             ,
  880.                         NULL                                              AS transaction_date      ,
  881.                         gl_data.currency_code                             AS currency_code         ,
  882.                         ''                                                AS journals_po_number            , -- 2.1
  883.                         gl_data.entered_currency_net                      AS entered_currency_net  , -- 1.5
  884.                         gl_data.net_amount                                AS net_amount              -- 1.5
  885.                 FROM
  886.                         code_combinations cc
  887.                        ,gl_data
  888.                 WHERE
  889.                         1                = 1               
  890.                 AND     cc.code_combination_id = gl_data.code_combination_id
  891.                 AND  gl_data.REVERSED_JE_HEADER_ID IS NOT NULL -- 3.5
  892.                
  893.                 ) journals
  894.                
  895.  WHERE 1      =1
  896. /*
  897. ORDER BY
  898.         segment3,
  899.         segment5,
  900.         segment4,
  901.         analysis_level_1*/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement