DBA Data[Home] [Help]

APPS.PA_MC_CURRENCY_PKG SQL Statements

The following lines contain the word 'select', 'insert', 'update' or 'delete':

Line: 14

       SELECT  precision,
               minimum_accountable_unit
       INTO    l_precision,
               l_mau
       FROM    fnd_currencies
       WHERE   currency_code = x_currency_code;
Line: 59

      SELECT  gl.currency_code
        INTO    currency
        FROM    gl_sets_of_books gl,
             pa_implementations_all i
       -- WHERE    NVL(i.org_id,-99) = NVL(x_org_id,-99)
	   WHERE   i.org_id  = x_org_id  -- x_org_id also taken from Implementation table.
         AND    i.set_of_books_id = gl.set_of_books_id;
Line: 94

      SELECT set_of_books_id
        INTO sob_id
        FROM pa_implementations_all i
       -- WHERE NVL(i.org_id,-99) = NVL(x_org_id,-99);
Line: 122

 SELECT set_of_books_id
 INTO   sob_id
 FROM   pa_implementations;
Line: 142

 SELECT mrc_sob_type_code
 INTO   sob_type
 FROM   gl_sets_of_books gl
 WHERE  gl.set_of_books_id = x_set_of_books_id;
Line: 161

 SELECT mrc_sob_type_code
 INTO   sob_type
 FROM   gl_sets_of_books gl,
        pa_implementations imp
 WHERE  gl.set_of_books_id = imp.set_of_books_id;
Line: 196

    x_err_stage := ' Select from pa_expenditure_items_all';
Line: 198

 SELECT     eia.orig_transaction_reference,
            nvl(eia.adjusted_expenditure_item_id, transferred_from_exp_item_id),
            eia.system_linkage_function,
            eia.expenditure_item_date,
--Bug#1078399
--New parameter x_txn_source added in eiid_details() - to be used to
--check whether the EI is an imported-one or not.
            eia.transaction_source
 INTO       x_orig_trx,
            x_adj_item,
            x_linkage,
            x_ei_date,
--Bug#1078399
            x_txn_source
 FROM       pa_expenditure_items_all eia
 WHERE      eia.expenditure_item_id = x_eiid;
Line: 253

    x_err_stage := ' Select from pa_expenditure_items_all';
Line: 255

 SELECT     eia.orig_transaction_reference,
            nvl(eia.adjusted_expenditure_item_id, transferred_from_exp_item_id),
            eia.system_linkage_function,
            eia.expenditure_item_date
 INTO       x_orig_trx,
            x_adj_item,
            x_linkage,
            x_ei_date
 FROM       pa_expenditure_items_all eia
 WHERE      eia.expenditure_item_id = x_eiid;
Line: 293

   SELECT max(line_num)
   INTO    out_line
   FROM    pa_mc_cost_dist_lines_all
   WHERE  expenditure_item_id = x_eiid
   AND    set_of_books_id = x_sob
   AND    line_type||'' = 'R';
Line: 315

   SELECT max(line_num)
   INTO    out_line
   FROM    pa_mc_cust_rdl_all
   WHERE  expenditure_item_id = x_eiid
   AND    set_of_books_id = x_sob;
Line: 347

    x_err_stage := ' Select from pa_mc_cost_dist_lines_all';
Line: 349

    SELECT exchange_rate,
           conversion_date,
           rate_type
    INTO   x_exchange_rate,
           x_exchange_date,
           x_exchange_rate_type
    FROM   pa_mc_cost_dist_lines_all
    WHERE  expenditure_item_id = x_adj_item
    AND    line_num = x_line_num
    AND    set_of_books_id = x_set_of_books_id;
Line: 393

    x_err_stage := ' Select from pa_mc_exp_items_all';
Line: 395

    SELECT cost_exchange_rate,
           cost_conversion_date,
           cost_rate_type
    INTO   x_exchange_rate,
           x_exchange_date,
           x_exchange_rate_type
    FROM   pa_mc_exp_items_all
    WHERE  expenditure_item_id = x_exp_item_id
    AND    set_of_books_id = x_set_of_books_id;
Line: 443

    x_err_stage := ' Select from pa_mc_cost_dist_lines_all';
Line: 445

    SELECT amount,
           quantity,
	   exchange_rate,
	   conversion_date,
	   rate_type
    INTO   x_amount,
           x_quantity,
	   x_exchange_rate,
	   x_exchange_date,
	   x_exchange_rate_type
    FROM   pa_mc_cost_dist_lines_all
    WHERE  expenditure_item_id = x_exp_item_id
    AND    line_num   = x_line_num
    AND    set_of_books_id = x_set_of_books_id;
Line: 499

    x_err_stage := ' Select from pa_mc_cost_dist_lines_all';
Line: 503

    SELECT amount,
           NVL(burdened_cost,0),
           NVL(exchange_rate,0),
           conversion_date,
           rate_type
    INTO   x_raw_cost,
           x_burdened_cost,
           x_exchange_rate,
           x_exchange_date,
           x_exchange_rate_type
    FROM   pa_mc_cost_dist_lines_all
    WHERE  set_of_books_id = x_set_of_books_id
    AND    expenditure_item_id = x_exp_item_id
    AND    line_num   = ( select max(line_num)
			  from PA_COST_DISTRIBUTION_LINES_ALL
			  where expenditure_item_id = x_exp_item_id
			  and   line_type = 'R' );
Line: 559

    x_err_stage := ' Select from pa_mc_cust_rdl_all ';
Line: 563

    SELECT SUM(amount),
           SUM(NVL(bill_amount,0)),
           Min(NVL(exchange_rate,0))
    INTO   x_revenue,
           x_bill_amount,
           x_exchange_rate
    FROM   pa_mc_cust_rdl_all
    WHERE  set_of_books_id = x_set_of_books_id
    AND    expenditure_item_id = x_exp_item_id;
Line: 607

    x_err_stage := ' Select from pa_mc_cust_rdl_all';
Line: 609

    SELECT exchange_rate,
           conversion_date
    INTO   x_exchange_rate,
           x_exchange_date
    FROM   pa_mc_cust_rdl_all
    WHERE  expenditure_item_id = x_adj_item
    AND    line_num = x_line_num
    AND    set_of_books_id = x_set_of_books_id;
Line: 664

    x_err_stage := ' Select from pa_mc_exp_items_all';
Line: 666

        select RAW_COST,
               RAW_COST_RATE,
               BURDEN_COST,
               BURDEN_COST_RATE,
               BILL_AMOUNT,
               BILL_RATE,
               ACCRUED_REVENUE,
               ACCRUAL_RATE,
	       TRANSFER_PRICE,
               ADJUSTED_RATE,
               COST_EXCHANGE_RATE,
               COST_CONVERSION_DATE,
               COST_RATE_TYPE
        INTO   x_raw_cost,
               x_raw_cost_rate ,
               x_burden_cost,
               x_burden_cost_rate ,
               x_bill_amount,
               x_bill_rate ,
               x_accrued_revenue,
               x_accrual_rate ,
	       x_transfer_price,
               x_adjusted_rate,
               x_exchange_rate,
               x_exchange_date,
               x_exchange_rate_type
        FROM   PA_MC_EXP_ITEMS_ALL
        WHERE  SET_OF_BOOKS_ID = x_set_of_books_id
        AND    EXPENDITURE_ITEM_ID = nvl(x_adj_exp_item_id,x_xfer_exp_item_id);
Line: 764

    x_err_stage := ' Select from pa_mc_exp_items_all';
Line: 766

        select RAW_COST,
               RAW_COST_RATE,
               BURDEN_COST,
               BURDEN_COST_RATE,
               BILL_AMOUNT,
               BILL_RATE,
               ACCRUED_REVENUE,
               ACCRUAL_RATE,
	       TRANSFER_PRICE,
               ADJUSTED_RATE,
               COST_EXCHANGE_RATE,
               COST_CONVERSION_DATE,
               COST_RATE_TYPE,
	       RAW_REVENUE, /*3024103*/
	       ADJUSTED_REVENUE,/*3024103*/
	       FORECAST_REVENUE/*3024103*/
        INTO   x_raw_cost,
               x_raw_cost_rate ,
               x_burden_cost,
               x_burden_cost_rate ,
               x_bill_amount,
               x_bill_rate ,
               x_accrued_revenue,
               x_accrual_rate ,
	       x_transfer_price,
               x_adjusted_rate,
               x_exchange_rate,
               x_exchange_date,
               x_exchange_rate_type,
	       x_raw_revenue,/*3024103*/
               x_adj_revenue,/*3024103*/
               x_forecast_revenue /*3024103*/
        FROM   PA_MC_EXP_ITEMS_ALL
        WHERE  SET_OF_BOOKS_ID = x_set_of_books_id
        AND    EXPENDITURE_ITEM_ID = nvl(x_adj_exp_item_id,x_xfer_exp_item_id);
Line: 871

    x_err_stage := ' Select from pa_mc_events';
Line: 878

    SELECT rate_type,
           exchange_rate,
           conversion_date,
           projfunc_inv_exchange_rate,
           projfunc_inv_rate_date,
           bill_amount,
           revenue_amount
    INTO   x_rev_rate_type,
           x_rev_exchange_rate,
           x_rev_exchange_date,
           x_inv_exchange_rate,
           x_inv_exchange_date,
           x_bill_amount,
           x_revenue_amount
    FROM   PA_MC_EVENTS
    WHERE  SET_OF_BOOKS_ID  = x_set_of_books_id
    AND    PROJECT_ID       = x_project_id
    AND    EVENT_NUM        = x_event_num
    AND    nvl(TASK_ID,-99) = nvl(x_task_id, -99);
Line: 945

    x_err_stage := ' Select from pa_mc_txn_interface_all';
Line: 947

    SELECT mc.raw_cost,
           mc.raw_cost_rate,
           mc.burdened_cost,
           mc.burdened_cost_rate,
           mc.exchange_rate,
           mc.conversion_date,
           mc.rate_type
    INTO   x_raw_cost,
           x_raw_cost_rate,
           x_burden_cost,
           x_burden_cost_rate,
           x_exchange_rate,
           x_exchange_date,
           x_exchange_rate_type
    FROM   pa_mc_txn_interface_all mc,
           pa_transaction_interface_all txn
    WHERE  mc.txn_interface_id = txn.txn_interface_id
    AND    txn.expenditure_item_id = x_exp_item_id
    AND    mc.set_of_books_id = x_set_of_books_id;
Line: 1010

    x_err_stage := ' Select from pa_cost_distribution_lines_all';
Line: 1013

     SELECT cdl.system_reference2,
            cdl.system_reference3
     INTO   x_ref2, -- invoice id
            x_ref3 -- line num
     FROM   pa_cost_distribution_lines_all cdl
     WHERE  cdl.expenditure_item_id = x_eiid
     AND    rownum = 1;
Line: 1063

    x_err_stage := ' Select from ap_mc_invoice_dists';
Line: 1080

     SELECT  mc.exchange_rate, -- Bug3056201
            --  Bug3056201 decode(NVL(ap.BASE_INVOICE_PRICE_VARIANCE,0),0,mc.EXCHANGE_RATE,
            --      (mc.BASE_INVOICE_PRICE_VARIANCE/ap.BASE_INVOICE_PRICE_VARIANCE)) exchange_rate,
            nvl(mc.exchange_date,ap.exchange_date) exchange_date,
            mc.exchange_rate_type,
            nvl(nvl(mc.BASE_INVOICE_PRICE_VARIANCE,
               GL_MC_CURRENCY_PKG.CurrRound(ap.amount_variance * nvl(mc.exchange_rate,1),l_reporting_curr_code)),0) amount,/*Bug 4292891*/
            sob.currency_code
       INTO x_exchange_rate,
            x_exchange_date,
            x_exchange_rate_type,
            x_amount,
            l_reporting_curr_code
       FROM gl_sets_of_books sob,
            ap_mc_invoice_dists  mc,
            ap_invoice_distributions ap
      WHERE ap.invoice_id = x_invoice_id
        AND ap.distribution_line_number = x_line_num
        AND mc.invoice_id = ap.invoice_id
        AND mc.distribution_line_number = ap.distribution_line_number
        AND mc.set_of_books_Id = x_sob
        AND mc.set_of_books_id = sob.set_of_books_id;
Line: 1113

     SELECT  /*mc.exchange_rate, Bug3056201 */ /*reverted for bug 3927230 */
              decode(NVL(ap.EXCHANGE_RATE_VARIANCE,0),0,mc.EXCHANGE_RATE,
                  (mc.EXCHANGE_RATE_VARIANCE/ap.EXCHANGE_RATE_VARIANCE)) exchange_rate,
            nvl(mc.exchange_date,ap.exchange_date) exchange_date,
            mc.exchange_rate_type,
            nvl(mc.EXCHANGE_RATE_VARIANCE,0) amount /*bug 4292891*/
       INTO x_exchange_rate,
            x_exchange_date,
            x_exchange_rate_type,
            x_amount
       FROM ap_mc_invoice_dists  mc,
            ap_invoice_distributions ap
      WHERE ap.invoice_id = x_invoice_id
        AND ap.distribution_line_number = x_line_num
        AND mc.invoice_id = ap.invoice_id
        AND mc.distribution_line_number = ap.distribution_line_number
        AND mc.set_of_books_Id = x_sob;
Line: 1133

    SELECT   mc.exchange_rate, -- Bug3056201
           --  Bug3056201 decode(NVL(ap.base_amount,0),0,mc.exchange_rate,
	  -- (NVL(mc.base_amount,mc.amount)/ap.base_amount)) exchange_rate,
           NVL(mc.exchange_date,ap.exchange_date) exchange_date,
           mc.exchange_rate_type,
           decode(mc.base_amount,NULL,NVL(mc.amount,0),mc.base_amount) amount /*Bug 4292891 */
      INTO x_exchange_rate,
           x_exchange_date,
           x_exchange_rate_type,
           x_amount
      FROM ap_mc_invoice_dists  mc,
           ap_invoice_distributions ap
     WHERE ap.invoice_id = x_invoice_id
       AND ap.distribution_line_number = x_line_num
       AND mc.invoice_id = ap.invoice_id
       AND mc.distribution_line_number = ap.distribution_line_number
       AND mc.set_of_books_Id = x_sob;
Line: 1184

 SELECT  sum(nvl(amount,0))
 INTO rdl_amt
 FROM pa_mc_cust_rdl_all
 WHERE project_id = x_project_id
 AND draft_revenue_num = x_dr_num
 AND set_of_books_id = x_sob;
Line: 1192

 SELECT  sum(nvl(amount,0))
 INTO rdl_amt_event
 FROM pa_mc_cust_event_rdl_all
 WHERE  project_id = x_project_id
 AND draft_revenue_num = x_dr_num
 AND set_of_books_id = x_sob;
Line: 1219

 SELECT  sum(nvl(amount,0))
 INTO inv_amt
 FROM pa_mc_draft_inv_items
 WHERE project_id = x_project_id
 AND draft_invoice_num = x_di_num
 AND line_num = x_line_num
 AND set_of_books_id = x_sob;
Line: 1252

 SELECT  sum(nvl(bill_amount,0))
 INTO cust_rdl_amt
 FROM pa_mc_cust_rdl_all
 WHERE project_id = x_project_id
 AND draft_invoice_num = x_di_num
 AND draft_invoice_item_line_num = x_line_num
 AND set_of_books_id = x_sob;
Line: 1260

 SELECT  sum(nvl(mcdii.bill_amount,0))
 INTO ic_rdl_amt
 FROM pa_mc_draft_inv_details_all mcdii ,
      pa_draft_invoice_details_all dii
 WHERE dii.project_id = x_project_id
 AND dii.draft_invoice_num = x_di_num
 AND dii.draft_invoice_line_num = x_line_num
 AND dii.draft_invoice_detail_id = mcdii.draft_invoice_detail_id
 AND mcdii.set_of_books_id = x_sob;
Line: 1291

 SELECT  sum(nvl(amount,0))
 INTO    rdl_amt
 FROM    pa_mc_cust_event_rdl_all
 WHERE   project_id = x_project_id
 AND     draft_invoice_num = x_di_num
 AND     draft_invoice_item_line_num = x_line_num
 AND     set_of_books_Id = x_sob;
Line: 1319

  SELECT  sum(nvl(bill_amount,0))
  INTO    rdl_amt
  FROM    pa_mc_events
  WHERE   project_id = x_project_id
  AND     nvl(task_id,-99) = nvl(x_task_id,-99)
  AND     event_num = x_event_num
  AND     set_of_books_id = x_sob;
Line: 1347

 SELECT  completion_date
 INTO    event_date
 FROM    pa_events
 WHERE   project_id = x_project_id
 AND     nvl(task_Id, -99) = nvl(x_task_id, -99)
 AND     event_num = x_event_num;
Line: 1374

 SELECT  sum(nvl(rdl.amount,0))
 INTO    rdl_amt
 FROM    pa_mc_cust_rdl_all rdl
         -- pa_implementations imp -- Fix for Perf Bug 2695336
 WHERE   rdl.project_id                  = x_project_id
 AND     rdl.draft_revenue_num           = x_draft_revenue_num
 AND     rdl.draft_revenue_item_line_num = x_draft_revenue_item_line_num
 AND     rdl.set_of_books_id             =   NVL(TO_NUMBER( SUBSTRB( USERENV('CLIENT_INFO'), 45,10) ), -99);
Line: 1384

 SELECT  sum(nvl(erdl.amount,0))
 INTO    erdl_amt
 FROM    pa_mc_cust_event_rdl_all erdl,
         pa_cust_event_rdl_all cerdl
         -- pa_implementations imp -- Fix for Perf Bug 2695336
 WHERE   cerdl.project_id                  = x_project_id
 AND     cerdl.draft_revenue_num           = x_draft_revenue_num
 AND     cerdl.draft_revenue_item_line_num = x_draft_revenue_item_line_num
 AND     erdl.set_of_books_id             =  NVL(TO_NUMBER( SUBSTRB( USERENV('CLIENT_INFO'), 45,10) ), -99)
 AND	 cerdl.project_id = erdl.project_id
 AND	 cerdl.event_num = erdl.event_num
 AND	 NVL(cerdl.task_id,-99) = NVL(erdl.task_id,-99)
 AND	 cerdl.line_num = erdl.line_num;
Line: 1413

 SELECT org_id
 INTO   orgid
 FROM   pa_projects_all
 WHERE  project_id = x_project_id;
Line: 1431

  SELECT (inv.amount/invorg.amount)
  INTO   wo_factor
  FROM   pa_draft_invoice_items invorg,
         pa_draft_invoice_items inv
  WHERE  inv.project_id = x_project_id
  AND    inv.draft_invoice_num = x_di_num
  AND    inv.line_num = 1
  AND    invorg.project_id = inv.project_id
  AND    invorg.draft_invoice_num = x_di_num_org
  AND    invorg.line_num = inv.line_num;
Line: 1459

  SELECT NVL(canceled_flag,'N')
  INTO cancel_flag
  FROM pa_draft_invoices
  WHERE project_id = x_project_id
  AND   draft_invoice_num = x_di_num;
Line: 1495

   SELECT sum(mii.amount)
   INTO rtn_amount
   FROM pa_mc_draft_inv_items mii,
        pa_draft_invoice_items ii
   WHERE ii.project_id = x_project_id
   AND   ii.draft_invoice_num = x_di_num
   AND   ii.invoice_line_type <> 'RETENTION'
   AND   mii.set_of_books_id = x_sob_id
   AND   mii.project_id = x_project_id
   AND   mii.draft_invoice_num = x_di_num
   AND   mii.line_num = ii.line_num;
Line: 1609

    	PAAPIMP_PKG.G_err_stage := ' Insert into pa_mc_txn_interface_all';
Line: 1612

	PAAPIMP_PKG.write_log(LOG, 'Inserting transaction source: '||p_transaction_source||
                        'system_ref2 : ' ||p_system_reference2||
			'system_ref3 : ' ||p_system_reference3 ||
                        'system_ref4:  ' ||p_system_reference4||
			' into pa_mc_txn_interface_all......');
Line: 1619

    	--select NVL(org_id,-99)
	select org_id
    	into   l_org_id
    	from pa_implementations;
Line: 1642

      SELECT txn_interface_id,
             denom_burdened_cost,
             denom_raw_cost,
             --removed, should get from MRC table   acct_rate_type,
             --removed, should get from MRC table   acct_exchange_rate,
             denom_currency_code
        into l_txn_interface_id,
             l_burdened_cost,
             l_txn_raw_cost,
             --removed  l_exchange_rate_type,
             --removed  l_exchange_rate,
             l_currency
        from pa_transaction_interface_all
       where interface_id = p_interface_id
         and cdl_system_reference1  = to_char(p_system_reference1)
         and cdl_system_reference2  = to_char(p_system_reference2)
         and cdl_system_reference3  = to_char(p_system_reference3)
         and transaction_source||'' = p_transaction_source;
Line: 1668

         SELECT txn_interface_id,
                denom_burdened_cost,
                denom_raw_cost,
                denom_currency_code
           into l_txn_interface_id,
                l_burdened_cost,
                l_txn_raw_cost,
                l_currency
           from pa_transaction_interface_all
          where interface_id = p_interface_id
            and cdl_system_reference1 = to_char(p_system_reference1)
            and cdl_system_reference2 = to_char(p_system_reference2)
            and cdl_system_reference3 = to_char(p_system_reference3)
            and cdl_system_reference4 = p_system_reference4
            and transaction_source||''= p_transaction_source;
Line: 1766

                    SELECT nvl(b.exchange_date,a.invoice_date)
                      INTO l_exchange_date
                      FROM ap_invoices_all a,
                           ap_invoice_distributions_all b
                     WHERE  a.invoice_id               = p_system_reference2
                       AND  a.invoice_id               = b.invoice_id
                       AND  b.distribution_line_number = p_system_reference3;
Line: 1780

                  SELECT nvl(b.exchange_date,a.invoice_date)
                    INTO l_exchange_date
                    FROM ap_invoices_all a,
                         ap_invoice_distributions_all b,
                         ap_invoice_payments c
                   WHERE c.invoice_payment_id           = l_inv_pay_id
                     AND c.invoice_id                   = p_system_reference2
                     AND c.invoice_id                   = b.invoice_id
                     AND a.invoice_id                   = b.invoice_id
                     AND b.distribution_line_number     = p_system_reference3;
Line: 1798

                       SELECT nvl(a.currency_conversion_date,a.transaction_date)
                         INTO l_exchange_date
                         FROM rcv_transactions a
                        WHERE a.po_distribution_id       = p_system_reference3
                          AND a.transaction_id           = l_rcv_txn_id;
Line: 1905

        PAAPIMP_PKG.write_log(LOG,'before inserting into pa_mc_txn_interface_all table');
Line: 1907

	PAAPIMP_PKG.G_err_stage := 'INSERT RECORD INTO PA_MC_TXN_INTERFACE_ALL';
Line: 1908

        PAAPIMP_PKG.write_log(LOG,'insert SOBID:'||g_rsob_tab(i).rsob_id||
                          'insert txn_interface_id:'||l_txn_interface_id||
                          'insert raw_cost:'||l_raw_cost||
                          'exchange rate:'||l_exchange_rate);
Line: 1913

       	INSERT INTO pa_mc_txn_interface_all (
          			set_of_books_id    ,
           			txn_interface_id   ,
           			raw_cost           ,
           			raw_cost_rate      ,
           			burdened_cost      ,
           			burdened_cost_rate ,
           			currency_code      ,
           			exchange_rate      ,
           			conversion_date    )
         VALUES (
           	g_rsob_tab(i).rsob_id,
           	l_txn_interface_id              ,
           	l_raw_cost                      ,
           	NULL                            ,
           	l_burdened_cost                 ,
           	NULL                            ,
           	g_rsob_tab(i).rcurrency_code    ,
           	l_exchange_rate                 ,
           	l_exchange_date                 );
Line: 1936

    PAAPIMP_PKG.write_log(LOG,'after inserting');
Line: 1945

	PAAPIMP_PKG.G_TRANSACTION_REJECTION_CODE := 'PA_INSERT_MRC_FAILED';
Line: 1946

	PAAPIMP_PKG.write_log(LOG, 'Inserting system reference2: ' || to_char(p_system_reference2) ||
            	' system reference3: ' || to_char(p_system_reference3) ||
               	' into pa_mc_txn_interface_all failed in stage: ' || PAAPIMP_PKG.G_err_stage);
Line: 1969

    SELECT amount,
           acct_tp_exchange_rate,
           acct_tp_rate_date,
           acct_tp_rate_type
    FROM   pa_mc_cc_dist_lines_all
    WHERE  set_of_books_id = x_set_of_books_id
    AND    expenditure_item_id = x_exp_item_id
    AND    line_num   = ( select max(line_num)
			  from PA_CC_DIST_LINES_ALL
			  where expenditure_item_id = x_exp_item_id
			  and   line_type = 'BL' );
Line: 1986

    x_err_stage := ' Select from pa_mc_cc_dist_lines_all';
Line: 2026

    SELECT SUM(bill_amount),
           Min(acct_exchange_rate),
           Min(acct_rate_type),
           Min(acct_rate_date)
    FROM   pa_mc_draft_inv_details_all
    WHERE  set_of_books_id = x_set_of_books_id
    AND    draft_invoice_detail_id in
	   (select draft_invoice_detail_id
	    from pa_draft_invoice_details_all
	    where expenditure_item_id = x_exp_item_id) ;
Line: 2044

    x_err_stage := ' Select from pa_mc_draft_inv_details_all';
Line: 2092

    x_err_stage := ' Select from rcv_mc_rec_sub_ledger';
Line: 2107

   /* for the amount that we are selecting, we need to see whether the transaction is an
      EXPENSE or RECEIVING transactions. EXPENSE means we take the positive value of dr column
      minus the tax amount while RECEIVNG transaction means it is a return, so we take the
      negative of the cr column plus the tax amount */

   SELECT mcsub.CURRENCY_CONVERSION_RATE exchange_rate,  --Bug#3218750
            -- Bug#3218750 decode(NVL(rcvsub.ACCOUNTED_DR,0),0,mcsub.CURRENCY_CONVERSION_RATE,
           --       (mcsub.ACCOUNTED_DR/rcvsub.accounted_dr )) exchange_rate,
          nvl(mcsub.CURRENCY_CONVERSION_DATE,mctxn.CURRENCY_CONVERSION_DATE) exchange_date,
          nvl(mctxn.CURRENCY_CONVERSION_TYPE,rcvtxn.CURRENCY_CONVERSION_TYPE) excahnge_rate_type,
          decode(rcvtxn.transaction_type,
                 'RETURN TO RECEIVING',(-nvl(mcsub.accounted_cr,0)+nvl(mcsub.accounted_nr_tax,0)),
                 'RETURN TO VENDOR',(-nvl(mcsub.accounted_cr,0)+nvl(mcsub.accounted_nr_tax,0)),
                 (nvl(mcsub.ACCOUNTED_DR,0)-nvl(mcsub.accounted_nr_tax,0))) amount -- Bug 40571541 Added Nvl() clause for accounted_cr or accounted_cr as only one can be populated at a time
     INTO x_exchange_rate,
          x_exchange_date,
          x_exchange_rate_type,
          x_amount
     FROM rcv_transactions rcvtxn,
          rcv_receiving_sub_ledger rcvsub,
          rcv_mc_rec_sub_ledger mcsub,
          rcv_mc_transactions mctxn,
          po_distributions po_dist
    WHERE rcvtxn.transaction_id           = l_rcv_txn_id
      AND rcvtxn.po_distribution_id       = x_po_dist_id
      AND rcvtxn.po_distribution_id       = po_dist.po_distribution_id
      AND po_dist.code_combination_id     = rcvsub.code_combination_id
      AND po_dist.code_combination_id     = mcsub.code_combination_id
      AND rcvsub.actual_flag              = 'A'
      AND mcsub.actual_flag              = 'A'
      AND rcvtxn.transaction_id           = rcvsub.rcv_transaction_id
      AND rcvtxn.transaction_id           = mctxn.transaction_id
      AND rcvtxn.transaction_id           = mcsub.RCV_TRANSACTION_ID
      AND mctxn.SET_OF_BOOKS_ID           = x_sob
      AND mcsub.SET_OF_BOOKS_ID           = x_sob
      AND rcvsub.accounting_event_id      = nvl(x_acct_evt_id, rcvsub.accounting_event_id) -- pricing changes
      AND mcsub.accounting_event_id       = nvl(x_acct_evt_id, mcsub.accounting_event_id); -- pricing changes
Line: 2151

   SELECT mcsub.CURRENCY_CONVERSION_RATE exchange_rate,  --Bug#3218750
          -- Bug#3218750 decode(NVL(rcvsub.ACCOUNTED_DR,0),0,mcsub.CURRENCY_CONVERSION_RATE,
          -- Bug#3218750  (mcsub.ACCOUNTED_DR/rcvsub.accounted_dr)) exchange_rate,
          nvl(mcsub.CURRENCY_CONVERSION_DATE,mctxn.CURRENCY_CONVERSION_DATE) exchange_date,
          nvl(mctxn.CURRENCY_CONVERSION_TYPE,rcvtxn.CURRENCY_CONVERSION_TYPE) excahnge_rate_type,
          decode(rcvtxn.transaction_type,
                 'RETURN TO RECEIVING',nvl(-mcsub.accounted_nr_tax,0),
                 'RETURN TO VENDOR',nvl(-mcsub.accounted_nr_tax,0),
		 nvl(mcsub.accounted_nr_tax,0)) amount /* Bug 4292891 */
     INTO x_exchange_rate,
          x_exchange_date,
          x_exchange_rate_type,
          x_amount
     FROM rcv_transactions rcvtxn,
          rcv_receiving_sub_ledger rcvsub,
          rcv_mc_rec_sub_ledger mcsub,
          rcv_mc_transactions mctxn,
          po_distributions po_dist
    WHERE rcvtxn.transaction_id           = l_rcv_txn_id
      AND rcvtxn.po_distribution_id       = x_po_dist_id
      AND rcvtxn.po_distribution_id       = po_dist.po_distribution_id
      AND po_dist.code_combination_id     = rcvsub.code_combination_id
      AND po_dist.code_combination_id     = mcsub.code_combination_id
      AND rcvsub.actual_flag              = 'A'
      AND mcsub.actual_flag              = 'A'
      AND rcvtxn.transaction_id           = rcvsub.rcv_transaction_id
      AND rcvtxn.transaction_id           = mctxn.transaction_id
      AND rcvtxn.transaction_id           = mcsub.RCV_TRANSACTION_ID
      AND mctxn.SET_OF_BOOKS_ID           = x_sob
      AND mcsub.SET_OF_BOOKS_ID           = x_sob
      AND rcvsub.accounting_event_id      = nvl(x_acct_evt_id, rcvsub.accounting_event_id) -- pricing changes
      AND mcsub.accounting_event_id       = nvl(x_acct_evt_id, mcsub.accounting_event_id); -- pricing changes
Line: 2233

    x_err_stage := ' Select from pa_expenditure_items_all';
Line: 2235

 SELECT     eia.orig_transaction_reference,
            nvl(eia.adjusted_expenditure_item_id, transferred_from_exp_item_id),
            eia.system_linkage_function,
            eia.expenditure_item_date,
            eia.transaction_source,
            eia.burden_cost,
            eia.posted_projfunc_burdened_cost
 INTO       x_orig_trx,
            x_adj_item,
            x_linkage,
            x_ei_date,
            x_txn_source,
            x_ei_burdened_cost,
            x_ei_burdened_delta
 FROM       pa_expenditure_items_all eia
 WHERE      eia.expenditure_item_id = x_eiid;