DBA Data[Home] [Help]

APPS.AP_WEB_EXPENSE_WF SQL Statements

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

Line: 49

th_select varchar2(200) := '';
Line: 64

td_select varchar2(200) := '';
Line: 175

             SELECT name
             INTO   tvalue
             FROM   wf_role_lov_vl
             WHERE  upper(display_name) = upper(p_from_role)
             AND    rownum = 1;
Line: 283

  UpdateHeaderLines(p_report_header_id);  --Bug 2777245
Line: 286

  select nvl(AMT_DUE_CCARD_COMPANY,0)+nvl(AMT_DUE_EMPLOYEE,0)+nvl(MAXIMUM_AMOUNT_TO_APPLY,0)
  into   l_total
  from   ap_expense_report_headers_all
  where  report_header_id = p_report_header_id;
Line: 350

  SELECT   org_id
    INTO   l_n_org_id
    FROM   ap_expense_report_headers_all
   WHERE   report_header_id = l_item_key;
Line: 444

  l_debug_info := 'Update Withdraw Message';
Line: 758

    SELECT count(*)
    INTO   l_violation_count
    FROM   ap_pol_violations
    WHERE  report_header_id = p_report_header_id
    and    distribution_line_number > 0;
Line: 881

    UPDATE ap_expense_report_headers erh
    SET    workflow_approved_flag = 'S',
           expense_status_code = null,
           source = 'NonValidatedWebExpense'
    WHERE  report_header_id = p_report_header_id;
Line: 955

      l_table_header := l_table_header || th_select || l_prompts(4) || td_end;
Line: 1100

            l_table_row := l_table_row || td_select || to_char(l_line_num) || td_end;
Line: 1220

    select count(*)
    into   l_num_lines
    from   ap_expense_report_lines
    where  report_header_id = l_report_header_id
    and    credit_card_trx_id is not null
    and    ap_validation_error is not null;
Line: 1236

    select count(*)
    into   l_num_lines
    from   ap_expense_report_lines
    where  report_header_id = l_report_header_id
    and    credit_card_trx_id is null
    and    ap_validation_error is not null;
Line: 1625

      SELECT fndl.meaning
      INTO l_yes
      FROM FND_LOOKUPS fndl
      WHERE fndl.LOOKUP_TYPE = C_YES_NO
      AND   fndl.LOOKUP_CODE = C_Y;
Line: 1637

      SELECT fndl.meaning
      INTO l_no
      FROM FND_LOOKUPS fndl
      WHERE fndl.LOOKUP_TYPE = C_YES_NO
      AND   fndl.LOOKUP_CODE = C_N;
Line: 1652

    select count(*)
    into   l_num_line_errors
    from   ap_expense_report_lines
    where  report_header_id = l_report_header_id
    and    ap_validation_error is not null;
Line: 1806

                 AP_WEB_DB_EXPDIST_PKG.updateAccountValues (
                     p_report_header_id => p_report_header_id,
                     p_report_line_id => p_ReportLineId,
                     p_report_distribution_id => p_report_distribution_id,
                     p_ccid             => p_exp_dist_ccid);
Line: 2000

  UPDATE ap_expense_report_headers erh
  SET    workflow_approved_flag = '',
         source = 'NonValidatedWebExpense'
  WHERE  report_header_id = p_report_header_id;
Line: 2223

        SELECT card_program_id, transaction_date
        INTO   l_card_program_id, l_transaction_date
        FROM   ap_credit_card_trxns
        WHERE  trx_id = V_CreditCardTrxID;
Line: 2286

            /* Also update the segment values in the dist table to ensure the ccid
             and the segment values are in sync. */
    	    --------------------------------------------------------------
    	    l_debug_info:='Synch Account Segments with CCID';
Line: 2290

    	    -- updateAccountValues calls AddDistributionLine if dist does not
    	    -- exist and then updates the ccid and segments based on l_exp_dist_ccid
    	    --------------------------------------------------------------
          AP_WEB_DB_EXPDIST_PKG.updateAccountValues (
                   p_report_header_id => p_report_header_id,
                   p_report_line_id => V_ReportLineId,
                   p_report_distribution_id => l_report_distribution_id,
                   p_ccid             => l_exp_dist_ccid);
Line: 2314

        SELECT card_program_id, transaction_date
        INTO   l_card_program_id, l_transaction_Date
        FROM   ap_credit_card_trxns
        WHERE  trx_id = V_CreditCardTrxID;
Line: 2455

          /* Also update the segment values in the dist table to ensure the ccid
             and the segment values are in sync. */
    	    --------------------------------------------------------------
    	    l_debug_info:='Synch Account Segments with CCID';
Line: 2459

    	    -- updateAccountValues calls AddDistributionLine if dist does not
    	    -- exist and then updates the ccid and segments based on l_exp_dist_ccid
    	    --------------------------------------------------------------
          AP_WEB_DB_EXPDIST_PKG.updateAccountValues (
                   p_report_header_id => p_report_header_id,
                   p_report_line_id => V_ReportLineId,
                   p_report_distribution_id => l_report_distribution_id,
                   p_ccid             => l_exp_dist_ccid);
Line: 2481

      AP_WEB_DB_EXPLINE_PKG.UpdateAPValidationError(
                                       p_report_header_id => p_report_header_id,
                                       p_dist_line_number => l_dist_line_number,
                                       p_ap_validation_error => l_line_error_message);
Line: 2503

    SELECT fndl.meaning
    INTO l_yes
    FROM FND_LOOKUPS fndl
    WHERE fndl.LOOKUP_TYPE = C_YES_NO
    AND   fndl.LOOKUP_CODE = C_Y;
Line: 2514

    SELECT fndl.meaning
    INTO l_no
    FROM FND_LOOKUPS fndl
    WHERE fndl.LOOKUP_TYPE = C_YES_NO
    AND   fndl.LOOKUP_CODE = C_N;
Line: 2602

  l_debug_info := 'Update ap_expense_report_headers';
Line: 2621

  l_debug_info := 'Update ap_expense_report_lines';
Line: 2691

    select HOME_URL
    into   l_url
    from   ICX_PARAMETERS;
Line: 2842

    l_debug_info := 'Update the Expense Report as Manager Approved';
Line: 2849

    l_debug_info := 'Update Receipts Status to Missing if Pending Resolution';
Line: 2851

    update ap_expense_report_headers
    set    receipts_status = 'MISSING'
    where  report_header_id = l_report_header_id
    and    receipts_status = 'RESOLUTN';
Line: 3181

  select wa.result_type
  into l_resultType
  from WF_PROCESS_ACTIVITIES WPA, WF_ACTIVITIES WA, wf_items wi
  where WPA.INSTANCE_ID = p_actid
    and WPA.ACTIVITY_ITEM_TYPE = WA.ITEM_TYPE
    and WPA.ACTIVITY_NAME = WA.NAME
    and wi.begin_date >= WA.BEGIN_DATE
    and wi.begin_date < nvl(WA.END_DATE, wi.begin_date+1)
    and wi.item_type = wa.item_type
    and wi.item_key  = p_item_key;
Line: 3236

  SELECT nvl(workflow_approved_flag, 'N')
  INTO   l_ap_review_status
  FROM   ap_expense_report_headers
  WHERE  report_header_id = l_report_header_id;
Line: 3264

    UPDATE WF_ITEM_ACTIVITY_STATUSES
    SET    begin_date = l_wakeup_time
    WHERE  item_type = p_item_type
    AND    item_key = p_item_key
    AND    process_activity = p_actid;
Line: 3361

       UPDATE ap_expense_report_headers_all
       SET expense_status_code = 'MGRAPPR'
       WHERE report_header_id = l_report_header_id;
Line: 3382

    UPDATE WF_ITEM_ACTIVITY_STATUSES
    SET    begin_date = l_wakeup_time
    WHERE  item_type = p_item_type
    AND    item_key = p_item_key
    AND    process_activity = p_actid;
Line: 3561

      l_debug_info := 'Update the Headers table with the new Amt
			  Dues and Total columns';
Line: 3888

    l_debug_info := 'Update the Expense Report as Approved, if the expense
                     report has only been manager approved then mark it as
                     approved automatic';
Line: 3913

       UPDATE ap_expense_report_headers_all
       SET expense_status_code = 'INVOICED'
       WHERE report_header_id = l_report_header_id;
Line: 3919

    l_debug_info := 'Update the Credit Card Trxns associated with the Expense
		     Report as Approved';
Line: 4266

    l_ExpenseRec.last_updated_by := NULL;
Line: 4273

    l_ExpenseRec.last_update_login := NULL;
Line: 4289

    IF (NOT AP_WEB_DB_EXPRPT_PKG.InsertReportHeaderLikeExisting(
			p_orig_expense_report_id, l_ExpenseRec)) THEN
	NULL;
Line: 4297

    l_debug_info := 'Insert the lines that cannot be paid into
		     ap_expense_report_lines with new report_header_id';
Line: 4315

      l_debug_info := 'Update the report header id in the violations table
			with the new expense report id';
Line: 4324

    l_debug_info := 'Insert the lines that cannot be paid into
		     ap_expense_report_lines with new report_header_id for
			missing receipts shortpay';
Line: 4344

      l_debug_info := 'Update the report header id in the violations table
                        with the new expense report id';
Line: 4625

      l_debug_info := 'Delete the original expense report if everything
	  	       is getting shortpaid';
Line: 4628

      IF (NOT AP_WEB_DB_EXPRPT_PKG.DeleteExpenseReport(l_report_header_id)) THEN
	NULL;
Line: 4635

      l_debug_info := 'Update the total of the original expense report
	  	       to not include the amount of the new expense report';
Line: 4676

PROCEDURE DeleteExpReportFromAPTables(p_report_header_id	IN AP_WEB_DB_EXPRPT_PKG.expHdr_headerID) IS
  l_debug_info		VARCHAR2(200);
Line: 4684

  AP_WEB_UTILITIES_PKG.logProcedure('AP_WEB_EXPENSE_WF', 'start DeleteExpReportFromAPTables');
Line: 4693

    l_debug_info := 'Update manager rejected/returned credit card transactions that
		are deleted after a timeout';
Line: 4705

    l_debug_info := 'Update shortpaid credit card transactions';
Line: 4712

    l_debug_info := 'Delete the expense lines for the given expense report id';
Line: 4714

    IF (NOT AP_WEB_DB_EXPLINE_PKG.DeleteReportLines(p_report_header_id)) THEN
	NULL;
Line: 4719

    l_debug_info := 'Delete the expense report header';
Line: 4721

    IF (NOT AP_WEB_DB_EXPRPT_PKG.DeleteExpenseReport(p_report_header_id)) THEN
	NULL;
Line: 4725

  AP_WEB_UTILITIES_PKG.logProcedure('AP_WEB_EXPENSE_WF', 'end DeleteExpReportFromAPTables');
Line: 4732

      FND_MESSAGE.SET_TOKEN('CALLING_SEQUENCE', 'DeleteExpReportFromAPTables');
Line: 4736

END DeleteExpReportFromAPTables;
Line: 5007

  l_debug_info := 'Update for Credit Card Integration';
Line: 5009

       IF (NOT AP_WEB_DB_EXPLINE_PKG.DeletePersonalLines(p_report_header_id))
         THEN
          NULL;
Line: 5022

  l_debug_info := 'Update for Credit Card Integration Bothpay';
Line: 5084

      select   end_date
      into     l_end_date
      from     wf_items
      where    item_type = l_itemtype
      and      item_key  = l_childItemKey;
Line: 5272

      update ap_expense_report_lines
      set    receipt_verified_flag = l_No
      where  report_header_id = l_report_header_id;
Line: 5304

PROCEDURE DeleteExpenseReport(p_item_type	IN VARCHAR2,
		   	      p_item_key	IN VARCHAR2,
		   	      p_actid		IN NUMBER,
		   	      p_funmode		IN VARCHAR2,
		   	      p_result	 OUT NOCOPY VARCHAR2) IS
----------------------------------------------------------------------
  l_report_header_id		AP_WEB_DB_EXPRPT_PKG.expHdr_headerID;
Line: 5314

  AP_WEB_UTILITIES_PKG.logProcedure('AP_WEB_EXPENSE_WF', 'start DeleteExpenseReport');
Line: 5325

    DeleteExpReportFromAPTables(l_report_header_id);
Line: 5327

    AP_WEB_DB_VIOLATIONS_PKG.deleteViolationEntry(l_report_header_id);
Line: 5333

  AP_WEB_UTILITIES_PKG.logProcedure('AP_WEB_EXPENSE_WF', 'end DeleteExpenseReport');
Line: 5337

    Wf_Core.Context('AP_WEB_EXPENSE_WF', 'DeleteExpenseReport',
                     p_item_type, p_item_key, to_char(p_actid), l_debug_info);
Line: 5340

END DeleteExpenseReport;
Line: 5610

    l_debug_info := 'Update all expense lines as receipt missing';
Line: 5618

    l_debug_info := 'Update Receipts Status to Required if Pending Resolution';
Line: 5620

    update ap_expense_report_headers
    set    receipts_status = 'REQUIRED'
    where  report_header_id = l_report_header_id
    and    receipts_status = 'RESOLUTN';
Line: 5629

    update ap_expense_report_lines
    set    receipt_missing_flag = l_No
    where  report_header_id = l_report_header_id;
Line: 5680

    l_debug_info := 'Update all expense lines as receipt missing';
Line: 5871

  	   l_XpenseRec.last_update_login:= NULL;
Line: 5872

  	   l_XpenseRec.last_updated_by	:= NULL;
Line: 5887

           select report_submitted_date
           into   l_report_submitted_date
           from   ap_expense_report_headers
           where  report_header_id = l_report_header_id;
Line: 5911

	   IF (NOT AP_WEB_DB_EXPRPT_PKG.InsertReportHeaderLikeExisting(
      					l_report_header_id, l_XpenseRec)) THEN
		NULL;
Line: 5917

           l_debug_info := 'Insert the lines for the credit card company into
	   	         ap_expense_report_lines with new report_header_id';
Line: 7356

  l_debug_info := 'Update all expense lines as receipt missing';
Line: 7701

   /* Bug 3566496: Need to update expense_current_approver_id since that
    * is used to display the approver in the Track expenses page.
    */

    UPDATE ap_expense_report_headers_all
    SET    expense_current_approver_id = p_manager_id
    WHERE  report_header_id = l_report_header_id;
Line: 8883

PROCEDURE DeleteShortPayExpReport(p_item_type	IN VARCHAR2,
		   	      	  p_item_key	IN VARCHAR2,
		   	      	  p_actid	IN NUMBER,
		   	      	  p_funmode	IN VARCHAR2,
		   	      	  p_result OUT NOCOPY VARCHAR2) IS
----------------------------------------------------------------------
  l_report_header_id		AP_WEB_DB_EXPRPT_PKG.expHdr_headerID;
Line: 8893

  AP_WEB_UTILITIES_PKG.logProcedure('AP_WEB_EXPENSE_WF', 'start DeleteShortPayExpReport');
Line: 8904

    DeleteExpReportFromAPTables(l_report_header_id);
Line: 8910

  AP_WEB_UTILITIES_PKG.logProcedure('AP_WEB_EXPENSE_WF', 'end DeleteShortPayExpReport');
Line: 8914

    Wf_Core.Context('AP_WEB_EXPENSE_WF', 'DeleteShortPayExpReport',
                     p_item_type, p_item_key, to_char(p_actid), l_debug_info);
Line: 8917

END DeleteShortPayExpReport;
Line: 9774

    select nls_language
    into   l_orig_language
    from   fnd_languages
    where  language_code = l_orig_language_code;
Line: 9783

      select note_language_code
      into   l_new_language_code
      from   ap_expense_params;
Line: 9796

      select language_code
      into   l_new_language_code
      from   fnd_languages
      where  installed_flag in ('B');
Line: 9805

    select nls_language
    into   l_new_language
    from   fnd_languages
    where  language_code = l_new_language_code;
Line: 9900

    SELECT orig_system_id
    FROM   wf_roles
    WHERE  orig_system = 'PER'
    AND    name = l_TransferToName;
Line: 9919

    select nls_language
    into   l_orig_language
    from   fnd_languages
    where  language_code = l_orig_language_code;
Line: 9928

      select note_language_code
      into   l_new_language_code
      from   ap_expense_params;
Line: 9941

      select language_code
      into   l_new_language_code
      from   fnd_languages
      where  installed_flag in ('B');
Line: 9950

    select nls_language
    into   l_new_language
    from   fnd_languages
    where  language_code = l_new_language_code;
Line: 10110

        l_forwardee.api_insertion := ame_util.apiAuthorityInsertion;
Line: 10115

        AME_API.updateApprovalStatus(applicationIdIn => AP_WEB_DB_UTIL_PKG.GetApplicationID,
                                  transactionIdIn     => p_item_key,
				  approverIn          => l_forwarder,
                                  forwardeeIn         => l_forwardee,
                                  transactionTypeIn   => p_item_type);
Line: 10131

 	             l_forwarder.api_insertion <>  ame_util.apiInsertion) then
             l_forwardee.api_insertion := ame_util.apiAuthorityInsertion;
Line: 10134

             l_forwardee.api_insertion := ame_util.apiInsertion;
Line: 10138

        AME_API2.updateApprovalStatus(applicationIdIn    => AP_WEB_DB_UTIL_PKG.GetApplicationID,
                              	    transactionTypeIn  => p_item_type,
                               	    transactionIdIn    => l_itemkey,
                                    approverIn => l_forwarder,
                                    forwardeeIn => l_forwardee);
Line: 10390

       IF (NOT AP_WEB_DB_EXPLINE_PKG.DeletePersonalLines(l_report_header_id)) THEN
	  NULL;
Line: 10451

      update ap_expense_report_lines
      set    receipt_verified_flag = l_No
      where  report_header_id = l_report_header_id;
Line: 10776

    select report_submitted_date
    into   l_report_submitted_date
    from   ap_expense_report_headers
    where  report_header_id = l_report_header_id;
Line: 10799

    UPDATE ap_expense_report_headers_all
    SET expense_status_code = l_expense_status_code,
        expense_current_approver_id = l_current_approver_id,
        expense_last_status_date=sysdate,
        source = nvl(l_source, source)
    WHERE report_header_id = l_report_header_id;
Line: 10925

    select   end_date
    into     l_end_date
    from     wf_items
    where    item_type = l_itemtype
    and      item_key  = l_itemkey;
Line: 10985

  l_debug_info := 'Update AME as if rejected';
Line: 11047

    update ap_expense_report_headers
    set    report_submitted_date = null,
           expense_status_code = AP_WEB_OA_ACTIVE_PKG.C_WITHDRAWN
    where  report_header_id = p_rep_header_id;
Line: 11060

    update ap_expense_report_lines
    set    receipt_verified_flag = l_No
    where  report_header_id = p_rep_header_id;
Line: 11102

    select nls_language
    into   l_orig_language
    from   fnd_languages
    where  language_code = l_orig_language_code;
Line: 11111

      select note_language_code
      into   l_new_language_code
      from   ap_expense_params;
Line: 11124

      select language_code
      into   l_new_language_code
      from   fnd_languages
      where  installed_flag in ('B');
Line: 11133

    select nls_language
    into   l_new_language
    from   fnd_languages
    where  language_code = l_new_language_code;
Line: 11144

      select message_text
      into   l_note
      from   fnd_new_messages
      where  application_id = 200
      and    message_name = l_message_name
      and    language_code = l_new_language_code;
Line: 11598

      l_debug_info := 'Traverse selected lines';
Line: 11635

        l_document := l_document || th_select || l_prompts(13) || td_end;
Line: 11761

              l_document := l_document || td_select;
Line: 11769

              l_document := l_document || td_select;
Line: 11940

      end if; -- traverse selected lines
Line: 12234

    SELECT count(*)
    INTO   l_modified_count
    FROM   ap_expense_report_lines xl
    WHERE  xl.report_header_id = l_report_header_id
    AND	   xl.mileage_rate_adjusted_flag = AP_WEB_DB_EXPLINE_PKG.C_Modified;
Line: 12247

      SELECT count(*)
      INTO   l_new_count
      FROM   ap_expense_report_lines xl
      WHERE  xl.report_header_id = l_report_header_id
      AND    (xl.mileage_rate_adjusted_flag = AP_WEB_DB_EXPLINE_PKG.C_New
           OR xl.mileage_rate_adjusted_flag = AP_WEB_DB_EXPLINE_PKG.C_Split);
Line: 12326

  SELECT XL.VEHICLE_CATEGORY_CODE,
	 XL.VEHICLE_TYPE,
	 XL.FUEL_TYPE,
	 nvl(XL.TRIP_DISTANCE,0),
	 XL.DISTANCE_UNIT_CODE,
	 XL.CURRENCY_CODE,
	 XL.START_EXPENSE_DATE,
	 XL.END_EXPENSE_DATE,
	 XL.WEB_PARAMETER_ID,
	 XP.COMPANY_POLICY_ID,
         SH.CURRENCY_PREFERENCE
  INTO   l_vehicle_category_code,
	 l_vehicle_type,
	 l_fuel_type,
	 l_trip_distance,
	 l_distance_unit_code,
	 l_currency_code,
	 l_start_expense_date,
	 l_end_expense_date,
	 l_web_parameter_id,
	 l_policy_id,
	 l_currency_preference
  FROM   ap_expense_report_lines XL,
         AP_EXPENSE_REPORT_HEADERS XH,
	 AP_EXPENSE_REPORT_PARAMS XP,
	 AP_POL_HEADERS SH
  WHERE  XH.report_header_id = p_report_header_id
   AND   XH.report_header_id = XL.report_header_id
   AND	 XL.distribution_line_number = p_distribution_line_number
   AND   (XP.WEB_ENABLED_FLAG   = 'Y'
         OR    XH.EXPENSE_REPORT_ID = XP.EXPENSE_REPORT_ID)
   AND   XL.web_parameter_id = XP.parameter_id
   AND	 XP.company_policy_id = SH.policy_id;
Line: 12363

  SELECT AH.DISTANCE_UOM,
	 AH.DISTANCE_THRESHOLDS_FLAG,
	 AH.EMPLOYEE_ROLE_FLAG
  INTO   l_distance_uom,
	 l_distance_thresholds_flag,
	 l_employee_role_flag
  FROM   AP_POL_HEADERS AH
  WHERE  AH.POLICY_ID = l_policy_id;
Line: 12460

PROCEDURE updateCumulativeMileage(
	p_cumulative_mileage	IN AP_WEB_EMPLOYEE_INFO.NUMERIC_VALUE%TYPE,
	p_period_id		IN AP_WEB_EMPLOYEE_INFO.PERIOD_ID%TYPE,
	p_employee_id		IN AP_WEB_EMPLOYEE_INFO.EMPLOYEE_ID%TYPE)  IS
-------------------------------------------------------------------------------
  l_count NUMBER := 0;
Line: 12468

  SELECT count(*)
  INTO	 l_count
  FROM	 ap_web_employee_info_all
  WHERE	 value_type = 'CUM_REIMB_DISTANCE'
  AND	 period_id = p_period_id
  AND	 employee_id = p_employee_id;
Line: 12476

    UPDATE ap_web_employee_info_all
    SET	   numeric_value = p_cumulative_mileage,
           last_update_date = sysdate,
           last_updated_by = p_employee_id
    WHERE  value_type = 'CUM_REIMB_DISTANCE'
    AND	   period_id = p_period_id
    AND	   employee_id = p_employee_id;
Line: 12484

    INSERT INTO ap_web_employee_info_all
	  (EMPLOYEE_ID,
	   VALUE_TYPE,
	   NUMERIC_VALUE,
	   PERIOD_ID,
	   CREATION_DATE,
	   CREATED_BY,
	   LAST_UPDATE_DATE,
	   LAST_UPDATED_BY,
           ORG_ID)
    VALUES(p_employee_id,
	   'CUM_REIMB_DISTANCE',
	   p_cumulative_mileage,
	   p_period_id,
	   sysdate,
	   p_employee_id,
	   sysdate,
	   p_employee_id,
           mo_global.get_current_org_id() );
Line: 12507

    AP_WEB_DB_UTIL_PKG.RaiseException('updateCumulativeMileage');
Line: 12509

END updateCumulativeMileage;
Line: 12518

  select nvl(sum(mileage_rate),0)
  into l_addon_rate_sum
  from oie_addon_mileage_rates
  where report_line_id = (select report_line_id
                          from ap_expense_report_lines
                          where report_header_id = p_report_header_id
                          and distribution_line_number = p_dist_line_number
                          and rownum = 1);
Line: 12689

PROCEDURE updateNewDistNumber(
	p_index			IN NUMBER,
	p_last_index		IN NUMBER,
	p_added_total		IN NUMBER,
	p_mileage_line_array	IN OUT NOCOPY AP_WEB_DB_EXPLINE_PKG.Mileage_Line_Array)IS
-------------------------------------------------------------------------------
  l_debug_info	     VARCHAR2(200);
Line: 12717

    AP_WEB_DB_UTIL_PKG.RaiseException('updateNewDistNumber');
Line: 12719

END updateNewDistNumber;
Line: 12741

  l_updated_trip_dist	    NUMBER;
Line: 12743

  l_insert_index	    NUMBER := p_mileage_line_array_count + 1;
Line: 12871

        SELECT max(distribution_line_number) + 1
        INTO   l_next_dist_number
        FROM   AP_EXPENSE_REPORT_LINES
        WHERE  report_header_id = p_mileage_line_array(p_ml_index).report_header_id;
Line: 12880

	  l_updated_trip_dist := l_range_high - l_range_low;
Line: 12882

          l_updated_trip_dist := l_over_threshold_distance;
Line: 12885

        l_daily_distance := l_updated_trip_dist / p_mileage_line_array(p_ml_index).number_of_days;
Line: 12907

        addToMileageArray(l_insert_index,
			l_next_dist_number,
			round(l_updated_trip_dist),
			round(l_daily_distance),
			l_new_rate,
			p_mileage_line_array(p_ml_index).report_header_id,
			p_ml_index,
			p_mileage_line_array);
Line: 12916

        p_mileage_line_array_count := l_insert_index ;
Line: 12943

     updateNewDistNumber. -Akita */
  updateNewDistNumber(p_ml_index + 1,
		   l_sl_array_count,
		   l_added_total,
		   p_mileage_line_array);
Line: 13001

  l_bHeaderUpdated		BOOLEAN := FALSE;
Line: 13026

  cursor getAddonRates(l_report_line_id NUMBER) is select addon_rate_type
  from oie_addon_mileage_rates
  where report_line_id = l_report_line_id;
Line: 13253

	    -- update reimbursable amount (Rate)

	    l_new_rate := getRate(
			  p_sh_distance_uom       => l_sh_distance_uom,
			  p_sh_currency_code	  => l_sh_currency_code,
			  p_mileage_line	  => l_mileage_line_array(i),
			  p_schedule_line	  => l_schedule_line_array(1));
Line: 13272

                      updateExpenseMileageLines.
     */

	    l_mileage_line_array(i).amount :=
                AP_UTILITIES_PKG.AP_ROUND_CURRENCY(
	                   l_new_rate * l_mileage_line_array(i).trip_distance,
                           l_mileage_line_array(i).reimbursement_currency_code);
Line: 13311

              updateCumulativeMileage(l_cumulative_mileage,
			      l_period_id,
			      l_employee_id);
Line: 13318

                SELECT CALCULATE_AMOUNT_FLAG
                INTO l_client_extension_enabled
                FROM ap_expense_report_params
                WHERE parameter_id = l_mileage_line_array(i).web_parameter_id;
Line: 13399

	        l_temp_array.delete; -- bug 5358186
Line: 13407

  AP_WEB_DB_EXPLINE_PKG.updateExpenseMileageLines(l_mileage_line_array, l_bHeaderUpdated);
Line: 13410

  l_debug_info := 'update display_total item attribute if ap_expense_report_headers has been updated';
Line: 13412

  IF (l_bHeaderUpdated = TRUE) THEN
    IF (NOT AP_WEB_DB_EXPRPT_PKG.UpdateHeaderTotal(l_report_header_id)) THEN
      NULL;
Line: 13469

    l_debug_info := 'Select from ap_pol_violations table';
Line: 13472

    SELECT count(*)
    INTO   l_violations_count
    FROM   ap_pol_violations
    WHERE  report_header_id = l_report_header_id
    and    distribution_line_number > 0;
Line: 13620

    select audit_code
    from   ap_expense_report_headers
    where  report_header_id = p_report_header_id;
Line: 13625

    select rs.assign_auditor_stage_code
    from   ap_expense_report_headers aerh,
           ap_aud_rule_sets rs,
           ap_aud_rule_assignments_all rsa
    where aerh.report_header_id = p_report_header_id
    and   aerh.org_id = rsa.org_id
    and   rsa.rule_set_id = rs.rule_set_id
    and   rs.rule_set_type = 'RULE'
    and   TRUNC(SYSDATE)
            BETWEEN TRUNC(NVL(rsa.START_DATE,SYSDATE))
            AND     TRUNC(NVL(rsa.END_DATE,SYSDATE));
Line: 14113

    SELECT WORKFLOW_APPROVED_FLAG
    INTO   l_workflow_approved_flag
    FROM   AP_EXPENSE_REPORT_HEADERS
    WHERE  REPORT_HEADER_ID = l_report_header_id;
Line: 14161

    select audit_code, workflow_approved_flag
    from   ap_expense_report_headers
    where  report_header_id = p_report_header_id;
Line: 14182

    l_debug_info := 'Retrieve UPDATE_MANAGER_APPROVED Activity Attribute';
Line: 14187

                                           'UPDATE_MANAGER_APPROVED');
Line: 14204

       l_debug_info := 'Update the Expense Report as Mgr Approved so that it can be auditable';
Line: 14361

    select nls_language
    into   l_orig_language
    from   fnd_languages
    where  language_code = l_orig_language_code;
Line: 14370

      select note_language_code
      into   l_new_language_code
      from   ap_expense_params;
Line: 14383

      select language_code
      into   l_new_language_code
      from   fnd_languages
      where  installed_flag in ('B');
Line: 14392

    select nls_language
    into   l_new_language
    from   fnd_languages
    where  language_code = l_new_language_code;
Line: 14420

          SELECT recipient_role INTO l_user_name
          FROM  wf_notifications
          WHERE message_type = 'APEXP'
          AND message_name = 'OIE_REQ_EXPENSE_REPORT_APPRVL'
          AND ( item_key = p_item_key
              OR p_item_key = SubStr(context,7,length(p_item_key)) )
          AND status <> 'CANCELED';
Line: 14462

      select message_text
      into   l_note_prefix
      from   fnd_new_messages
      where  application_id = 200
      and    message_name = l_message_name
      and    language_code = l_new_language_code;
Line: 14578

        SELECT
           nvl(pj.approval_authority, 0)
        INTO  p_jobLevel
        FROM
          per_jobs pj,
          per_all_assignments_f pa
        WHERE
             pj.job_id = pa.job_id
        AND  pa.person_id = p_personId
        AND  pa.primary_flag = 'Y'
        AND  pa.assignment_type in ('E' , 'C') --Support Contingent Workres
        AND  pa.assignment_status_type_id not in
                      (select assignment_status_type_id
                       from per_assignment_status_types
                       where per_system_status = 'TERM_ASSIGN')
        AND trunc(sysdate) between pa.effective_start_date and  pa.effective_end_date;
Line: 14845

     UPDATE AP_EXPENSE_REPORT_HEADERS
     SET    EXPENSE_STATUS_CODE = 'PAID'
     WHERE REPORT_HEADER_ID = p_report_header_id;
Line: 14858

   Bug 2777245: Update expense report header and lines data after submission
                through self-service and just before workflow kicks off.

   Note:        Customer can use this procedure to manipualte the values in
                Header and Lines table.
*/
----------------------------------------------------------------------------

Procedure  UpdateHeaderLines(p_report_header_id IN Number)
IS
----------------------------------------------------------------------------

BEGIN

     UPDATE AP_EXPENSE_REPORT_HEADERS
     SET DESCRIPTION= AP_WEB_UTILITIES_PKG.RtrimMultiByteSpaces(description)
     WHERE REPORT_HEADER_ID = p_report_header_id;
Line: 14876

     UPDATE AP_EXPENSE_REPORT_LINES
     SET JUSTIFICATION = AP_WEB_UTILITIES_PKG.RtrimMultiByteSpaces(justification),
         SUBMITTED_AMOUNT = AMOUNT
     WHERE REPORT_HEADER_ID = p_report_header_id;
Line: 14881

END UpdateHeaderLines;
Line: 14942

    UPDATE ap_expense_report_headers erh
    SET    workflow_approved_flag = 'S',
           expense_status_code = null,
           source = 'NonValidatedWebExpense'
    WHERE  report_header_id = p_report_header_id;
Line: 14995

  select aerh.report_header_id,
         fnd.employee_id,
         aerh.employee_id,
         aerh.invoice_num,
         aerh.default_currency_code,
         aerh.flex_concatenated,
         aerh.description,
         aerh.override_approver_id,
         aerh.week_end_date,
         aerh.workflow_approved_flag
  into   l_report_header_id,
         l_preparer_id,
         l_employee_id,
         l_document_number,
         l_reimb_curr,
         l_cost_center,
         l_purpose,
         l_approver_id,
         l_week_end_date,
         l_workflow_flag
  from   ap_expense_report_headers aerh,
         fnd_user fnd
  where  aerh.report_header_id = l_report_header_id
  and    fnd.user_id = aerh.created_by;
Line: 15020

  select sum(aerl.amount),
         sum(decode(sign(aerl.amount),-1,0,aerl.amount))
  into   l_total,
         l_new_total
  from   ap_expense_report_lines aerl
  where  aerl.report_header_id = l_report_header_id
  and    (itemization_parent_id is null OR itemization_parent_id <> -1);
Line: 15073

  select message_type
  into   l_item_type
  from   wf_notifications
  where  notification_id = p_ntf_id
  and    rownum = 1;
Line: 15084

      select 'Y'
      into   l_access_granted
      from   wf_item_activity_statuses
      where  item_type = l_item_type
      and    ((item_key = to_char(p_item_key)) or (item_key like to_char(p_item_key)  || '-%'))
      and    notification_id = p_ntf_id
      and    rownum = 1;
Line: 15092

         select 'Y'
         into   l_access_granted
         from   wf_item_activity_statuses_h
         where  item_type = l_item_type
         and    ((item_key = to_char(p_item_key)) or (item_key like to_char(p_item_key)  || '-%'))
         and    notification_id = p_ntf_id
         and    rownum = 1;
Line: 15104

      select item_key
      into   l_item_key
      from   wf_item_activity_statuses
      where  item_type = l_item_type
      and    notification_id = p_ntf_id
      and    rownum = 1;
Line: 15111

         select item_key
         into   l_item_key
         from   wf_item_activity_statuses_h
         where  item_type = l_item_type
         and    notification_id = p_ntf_id
         and    rownum = 1;
Line: 15119

    select 'Y'
    into   l_access_granted
    from   dual
    where
    (p_item_key = WF_ENGINE.GetItemAttrNumber(l_item_type, l_item_key, 'EXPENSE_REPORT_ID')
     or
     p_item_key = WF_ENGINE.GetItemAttrNumber(l_item_type, l_item_key, 'HOLDING_EXPENSE_REPORT_ID'))
    and    rownum = 1;
Line: 15131

      select 'Y'
      into   l_access_granted
      from   wf_item_activity_statuses
      where  item_type = l_item_type
      and    item_key like '%'||to_char(p_item_key)||'%'
      and    notification_id = p_ntf_id
      and    rownum = 1;
Line: 15139

         select 'Y'
         into   l_access_granted
         from   wf_item_activity_statuses_h
         where  item_type = l_item_type
         and    item_key like '%'||to_char(p_item_key)||'%'
         and    notification_id = p_ntf_id
         and    rownum = 1;
Line: 15160

  select 'Y'
  into   l_access_granted
  from   wf_notifications wfn ,
         WF_USER_ROLES wur
  where  wur.user_name = p_user_name
  and    wfn.notification_id = p_ntf_id
  and  ( wfn.recipient_role = wur.role_name
       OR
       ( wfn.more_info_role is not null and wfn.more_info_role = wur.role_name )
       OR
       ( wfn.from_role is not null and wfn.from_role = wur.role_name ) )
  and    rownum = 1;
Line: 15747

  We get the approver response and update the attribute 'AME Approver Response'
  with approver response, which would be used in AME Approval Process'.
  Update AME of approver response.
*/
----------------------------------------------------------------------
PROCEDURE AMEPropagateApprovalResult(p_item_type	IN VARCHAR2,
		       p_item_key	IN VARCHAR2,
		       p_actid		IN NUMBER,
		       p_funmode	IN VARCHAR2,
		       p_result	 OUT NOCOPY VARCHAR2) IS
----------------------------------------------------------------------

  l_debug_info		  varchar2(200);
Line: 15866

    l_debug_info := 'Call AME_API2.updateApprovalStatus ';
Line: 15873

    AME_API2.updateApprovalStatus(applicationIdIn    => AP_WEB_DB_UTIL_PKG.GetApplicationID,
                              	    transactionTypeIn  => p_item_type,
                               	    transactionIdIn    => l_AmeMasterItemKey,
                                    approverIn => l_approverIn);
Line: 15878

    AME_API2.updateApprovalStatus2(applicationIdIn    => AP_WEB_DB_UTIL_PKG.GetApplicationID,
                               	    transactionIdIn    => l_AmeMasterItemKey,
                                    approvalStatusIn   => l_approvalStatusIn,
                                    approverNameIn     => l_approver_name,
                              	    transactionTypeIn  => 'APEXP');
Line: 16093

       UPDATE ap_expense_report_headers_all
       SET expense_current_approver_id = C_AME_MULTIPLE_CURR_APPROVER
       WHERE report_header_id = l_report_header_id;
Line: 16097

       UPDATE ap_expense_report_headers_all
       SET expense_current_approver_id = l_approversOut(1).orig_system_id
       WHERE report_header_id = l_report_header_id;
Line: 16118

FUNCTION IsExpAccountsUpdated(p_report_line_id	IN NUMBER)
RETURN VARCHAR2 IS
-----------------------------------------------------------------------
  l_ExpAccountsUpdated	        VARCHAR2(10);
Line: 16124

  AP_WEB_UTILITIES_PKG.logProcedure('AP_WEB_EXPENSE_WF', 'start IsExpAccountsUpdated');
Line: 16126

  select  decode(nvl(preparer_modified_flag, 'N'), 'Y', AP_WEB_FND_LOOKUPS_PKG.getYesNoMeaning('Y'), null)
  into    l_ExpAccountsUpdated
  from    ap_exp_report_dists
  where   report_line_id = p_report_line_id
  and     rownum = 1;
Line: 16133

  AP_WEB_UTILITIES_PKG.logProcedure('AP_WEB_EXPENSE_WF', 'end IsExpAccountsUpdated');
Line: 16135

  RETURN l_ExpAccountsUpdated;
Line: 16139

    RETURN l_ExpAccountsUpdated;
Line: 16140

END IsExpAccountsUpdated;
Line: 16150

  select context into l_context
  from wf_notifications
  where notification_id = p_notification_id;