1355: End If;
1356:
1357: If l_emp_number is NOT NULL then
1358:
1359: l_return_number := pa_utils.GetEmpOrgId( l_emp_number, p_ei_date );
1360: If l_return_number is NULL then
1361: l_return_string := 'N';
1362: End If;
1363: End If;
1461:
1462: IF PG_DEBUG = 'Y' THEN
1463: log_message('log_message: Validating exp dates -> Exp Org Level' );
1464: END IF;
1465: IF pa_utils2.CheckExporg(p_incurred_by_org_id,p_exp_item_date) = 'N' then
1466: x_err_msg_cd := 'PA_EXP_ORG_NOT_ACTIVE' ;
1467: x_status := FND_API.G_RET_STS_ERROR ;
1468: RETURN ;
1469: END IF;
1897: ELSIF G_Prev_Business_Group_Name = X_Business_Group_Name THEN
1898:
1899: G_Business_Group_Id := G_Prev_Business_Group_Id ;
1900: ELSE
1901: G_Business_Group_Id := pa_utils2.GetBusinessGroupId(X_Business_Group_Name);
1902:
1903: IF G_Business_Group_Id is NULL THEN
1904:
1905: X_status := 'PA_INVALID_BUSINESS_GROUP';
2006: -- Verify that the expenditure ending date is a valid expenditure week
2007: -- ending date
2008: --
2009: IF PG_DEBUG = 'Y' THEN
2010: pa_debug.G_err_stage := 'Calling pa_utils.GetWeekEnding';
2011: log_message('log_message: ' || pa_debug.G_err_Stage);
2012: END IF;
2013: IF (trunc( X_end_date) <> trunc(pa_utils.NewGetWeekEnding( X_end_date )) ) THEN
2014: X_status := 'INVALID_END_DATE';
2009: IF PG_DEBUG = 'Y' THEN
2010: pa_debug.G_err_stage := 'Calling pa_utils.GetWeekEnding';
2011: log_message('log_message: ' || pa_debug.G_err_Stage);
2012: END IF;
2013: IF (trunc( X_end_date) <> trunc(pa_utils.NewGetWeekEnding( X_end_date )) ) THEN
2014: X_status := 'INVALID_END_DATE';
2015: pa_cc_utils.reset_curr_function;
2016: RETURN;
2017:
2033: G_Org_Id := P_Organization_Id;
2034:
2035: /* Bug 6519602: Base Bug 6519570 - Changes start */
2036: IF PG_DEBUG = 'Y' THEN
2037: pa_debug.G_err_stage := 'Calling pa_utils.GetEmpJobId';
2038: log_message('log_message: ' || pa_debug.G_err_Stage);
2039: END IF;
2040:
2041: -- 10253400: Payroll integration enhancement for 12.2..start
2042: -- Job related parameters are now sent for ST. Validate them.
2043: IF (p_job_id is not null or p_job_name is not null) and X_system_linkage = 'ST' then
2044:
2045: IF PG_DEBUG = 'Y' THEN
2046: pa_debug.G_err_Stage := 'Calling pa_utils.GetJobId';
2047: log_message('log_message: ' || pa_debug.G_err_Stage);
2048: END IF;
2049:
2050: /* Start changes for bug#12646514 */
2047: log_message('log_message: ' || pa_debug.G_err_Stage);
2048: END IF;
2049:
2050: /* Start changes for bug#12646514 */
2051: G_job_id := pa_utils.GetJobId(X_Business_Group_Id => G_Business_Group_Id
2052: ,X_Job_Id => p_job_id
2053: ,X_Job_Name => p_job_name
2054: ,X_Date => X_ei_Date);
2055: /* End changes for bug#12646514 */
2055: /* End changes for bug#12646514 */
2056:
2057: ELSE
2058: IF PG_DEBUG = 'Y' THEN
2059: pa_debug.G_err_Stage := 'Calling pa_utils.GetEmpJobId..2';
2060: log_message('log_message: ' || pa_debug.G_err_Stage);
2061: END IF;
2062:
2063: G_job_id := pa_utils.GetEmpJobId(
2059: pa_debug.G_err_Stage := 'Calling pa_utils.GetEmpJobId..2';
2060: log_message('log_message: ' || pa_debug.G_err_Stage);
2061: END IF;
2062:
2063: G_job_id := pa_utils.GetEmpJobId(
2064: X_person_id => G_person_id,
2065: X_date => X_ei_date ,
2066: X_po_number => p_po_number,
2067: X_po_line_num => p_po_line_num);
2069:
2070: IF ( G_job_id IS NULL ) THEN
2071: /* Start changes for bug#12646514 */
2072: -- X_status := 'NO_ASSIGNMENT';
2073: X_status := pa_utils.G_return_status;
2074: /* End changes for bug#12646514 */
2075: pa_cc_utils.reset_curr_function;
2076: RETURN;
2077: END IF;
2097:
2098: G_person_id := NULL;
2099:
2100: IF PG_DEBUG = 'Y' THEN
2101: pa_debug.G_err_Stage := 'Calling pa_utils.GetOrgnId';
2102: log_message('log_message: ' || pa_debug.G_err_Stage);
2103: END IF;
2104:
2105: IF ( X_oname IS NOT NULL ) THEN
2104:
2105: IF ( X_oname IS NOT NULL ) THEN
2106:
2107: --Start of changes for bug 3010848
2108: --G_org_id := pa_utils.GetOrgId(X_oname);
2109: pa_utils.GetOrgnId(X_org_name => X_oname,
2110: X_bg_id => G_Business_Group_Id,
2111: X_Orgn_Id => G_org_id,
2112: X_Return_Status => L_Org_RetSts);
2105: IF ( X_oname IS NOT NULL ) THEN
2106:
2107: --Start of changes for bug 3010848
2108: --G_org_id := pa_utils.GetOrgId(X_oname);
2109: pa_utils.GetOrgnId(X_org_name => X_oname,
2110: X_bg_id => G_Business_Group_Id,
2111: X_Orgn_Id => G_org_id,
2112: X_Return_Status => L_Org_RetSts);
2113:
2134: -- Get the person ID for the employee number given
2135: ELSIF ( X_enum IS NOT NULL ) THEN
2136:
2137: IF PG_DEBUG = 'Y' THEN
2138: pa_debug.G_err_stage := 'Calling pa_utils.GetEmpId, G_business_Group_id = ' || G_business_Group_id;
2139: log_message('log_message: ' || pa_debug.G_err_Stage);
2140: END IF;
2141: -- Fixed Bug 1534973, 1581184
2142: -- Passing X_Ei_Date parameter to GetEmpId
2140: END IF;
2141: -- Fixed Bug 1534973, 1581184
2142: -- Passing X_Ei_Date parameter to GetEmpId
2143:
2144: pa_utils2.GetEmpId( G_business_Group_id,
2145: X_enum,
2146: G_person_id,
2147: P_person_type, /* cwk */
2148: X_Ei_Date );
2146: G_person_id,
2147: P_person_type, /* cwk */
2148: X_Ei_Date );
2149:
2150: IF ( pa_utils2.G_return_status IS NOT NULL ) THEN
2151: X_status := pa_utils2.G_return_status ;
2152: pa_cc_utils.reset_curr_function;
2153: RETURN;
2154: ELSE
2147: P_person_type, /* cwk */
2148: X_Ei_Date );
2149:
2150: IF ( pa_utils2.G_return_status IS NOT NULL ) THEN
2151: X_status := pa_utils2.G_return_status ;
2152: pa_cc_utils.reset_curr_function;
2153: RETURN;
2154: ELSE
2155: last_empno := X_enum;
2168: RETURN;
2169: END IF;
2170:
2171: IF PG_DEBUG = 'Y' THEN
2172: pa_debug.G_err_Stage := 'Calling pa_utils.GetOrgId';
2173: log_message('log_message: ' || pa_debug.G_err_Stage);
2174: END IF;
2175:
2176: G_org_id := pa_utils.GetOrgId(X_oname);
2172: pa_debug.G_err_Stage := 'Calling pa_utils.GetOrgId';
2173: log_message('log_message: ' || pa_debug.G_err_Stage);
2174: END IF;
2175:
2176: G_org_id := pa_utils.GetOrgId(X_oname);
2177:
2178: IF (G_org_id IS NULL) THEN
2179: X_status := 'PA_EXP_ORG_INVALID';
2180: pa_cc_utils.reset_curr_function;
2184: -- Bug 2655157 : Below code added for the error being raised in
2185: -- Review Transactions form
2186: IF ( X_oname IS NULL ) THEN
2187: IF PG_DEBUG = 'Y' THEN
2188: pa_debug.G_err_Stage := 'Calling pa_utils.GetEmpOrgId';
2189: log_message('log_message: ' || pa_debug.G_err_Stage);
2190: END IF;
2191:
2192: G_org_id := pa_utils.GetEmpOrgId(G_person_id, X_Ei_Date);
2188: pa_debug.G_err_Stage := 'Calling pa_utils.GetEmpOrgId';
2189: log_message('log_message: ' || pa_debug.G_err_Stage);
2190: END IF;
2191:
2192: G_org_id := pa_utils.GetEmpOrgId(G_person_id, X_Ei_Date);
2193:
2194: IF ( G_org_id IS NULL ) THEN
2195: X_status := 'PA_EXP_ORG_MANDATORY';
2196: pa_cc_utils.reset_curr_function;
2199:
2200: ELSE
2201:
2202: IF PG_DEBUG = 'Y' THEN
2203: pa_debug.G_err_Stage := 'Calling pa_utils.GetOrgnId';
2204: log_message('log_message: ' || pa_debug.G_err_Stage);
2205: END IF;
2206:
2207: --Start of changes for Bug 3010848
2204: log_message('log_message: ' || pa_debug.G_err_Stage);
2205: END IF;
2206:
2207: --Start of changes for Bug 3010848
2208: --G_org_id := pa_utils.GetOrgId(X_oname);
2209: pa_utils.GetOrgnId(X_org_name => X_oname,
2210: X_bg_id => G_Business_Group_Id,
2211: X_Orgn_Id => G_org_id,
2212: X_Return_Status => L_Org_RetSts);
2205: END IF;
2206:
2207: --Start of changes for Bug 3010848
2208: --G_org_id := pa_utils.GetOrgId(X_oname);
2209: pa_utils.GetOrgnId(X_org_name => X_oname,
2210: X_bg_id => G_Business_Group_Id,
2211: X_Orgn_Id => G_org_id,
2212: X_Return_Status => L_Org_RetSts);
2213:
2232: -- Get the job ID of the employee's job
2233: -- assignment as of the item date
2234:
2235: IF PG_DEBUG = 'Y' THEN
2236: pa_debug.G_err_stage := 'Calling pa_utils.GetEmpJobId..3';
2237: log_message('log_message: ' || pa_debug.G_err_Stage);
2238: END IF;
2239:
2240: -- 10253400: Payroll integration enhancement for 12.2..start
2240: -- 10253400: Payroll integration enhancement for 12.2..start
2241: -- Job related parameters are now sent for ST. Validate them.
2242: IF (p_job_id is not null or p_job_name is not null) and X_system_linkage = 'ST' then
2243: IF PG_DEBUG = 'Y' THEN
2244: pa_debug.G_err_Stage := 'Calling pa_utils.GetJobId..2';
2245: log_message('log_message: ' || pa_debug.G_err_Stage);
2246: END IF;
2247: /* Start changes for bug#12646514 */
2248:
2245: log_message('log_message: ' || pa_debug.G_err_Stage);
2246: END IF;
2247: /* Start changes for bug#12646514 */
2248:
2249: G_job_id := pa_utils.GetJobId(X_Business_Group_Id => G_Business_Group_Id
2250: ,X_Job_Id => p_job_id
2251: ,X_Job_Name => p_job_name
2252: ,X_Date => X_ei_Date);
2253: /* End changes for bug#12646514 */
2254:
2255: -- 10253400: Payroll integration enhancement for 12.2..end
2256: ELSE
2257: IF PG_DEBUG = 'Y' THEN
2258: pa_debug.G_err_Stage := 'Calling pa_utils.GetEmpJobId';
2259: log_message('log_message: ' || pa_debug.G_err_Stage);
2260: END IF;
2261:
2262: G_job_id := pa_utils.GetEmpJobId(
2258: pa_debug.G_err_Stage := 'Calling pa_utils.GetEmpJobId';
2259: log_message('log_message: ' || pa_debug.G_err_Stage);
2260: END IF;
2261:
2262: G_job_id := pa_utils.GetEmpJobId(
2263: X_person_id => G_person_id,
2264: X_date => X_ei_date ,
2265: X_po_number => p_po_number,
2266: X_po_line_num => p_po_line_num);
2297: end;
2298: ELSIF p_po_number is null then
2299:
2300: /* Start changes for bug#12646514 */
2301: X_status := pa_utils.G_return_status;
2302: -- X_status := 'NO_ASSIGNMENT';
2303: /* End changes for bug#12646514 */
2304:
2305: pa_cc_utils.reset_curr_function;
2325: G_Job_Id := P_Emp_Job_Id;
2326:
2327: If G_org_id is NULL or G_Job_Id is NULL Then
2328: IF PG_DEBUG = 'Y' THEN
2329: pa_debug.G_err_stage := 'Calling pa_utils.GetEmpOrgJobId..1';
2330: log_message('log_message: ' || pa_debug.G_err_Stage);
2331: END IF;
2332:
2333: -- 10253400: Payroll integration enhancement for 12.2.. start
2333: -- 10253400: Payroll integration enhancement for 12.2.. start
2334: IF p_job_id is not null or p_job_name is not null then
2335:
2336: IF PG_DEBUG = 'Y' THEN
2337: pa_debug.G_err_stage := 'Calling pa_utils.GetEmpOrgJobId..3';
2338: log_message('log_message: ' || pa_debug.G_err_Stage);
2339: END IF;
2340: /* Start changes for bug#12646514 */
2341: G_Job_ID := pa_utils.getjobid(X_Business_Group_Id => G_Business_Group_Id,X_Job_Id => p_Job_Id,
2337: pa_debug.G_err_stage := 'Calling pa_utils.GetEmpOrgJobId..3';
2338: log_message('log_message: ' || pa_debug.G_err_Stage);
2339: END IF;
2340: /* Start changes for bug#12646514 */
2341: G_Job_ID := pa_utils.getjobid(X_Business_Group_Id => G_Business_Group_Id,X_Job_Id => p_Job_Id,
2342: X_Job_Name => p_Job_Name,
2343: X_Date => X_Ei_Date);
2344: /* End changes for bug#12646514 */
2345:
2346: IF G_Job_Id is null THEN
2347:
2348: /* Start changes for bug#12646514 */
2349: -- X_status := 'NO_ASSIGNMENT';
2350: X_status := pa_utils.G_return_status;
2351: /* End changes for bug#12646514 */
2352:
2353: pa_cc_utils.reset_curr_function;
2354: RETURN;
2355: END IF;
2356: END IF;
2357:
2358: IF G_Org_Id is null then
2359: G_Org_Id := pa_utils.getEmpOrgId(X_Person_Id => G_Person_Id,
2360: X_Date => X_Ei_Date);
2361: END IF;
2362:
2363: If G_Job_Id IS NULL OR G_Org_Id IS NULL THEN
2361: END IF;
2362:
2363: If G_Job_Id IS NULL OR G_Org_Id IS NULL THEN
2364: -- 10253400: Payroll integration enhancement for 12.2.. end
2365: pa_utils.GetEmpOrgJobId( G_person_id, X_ei_date, G_Org_Id, G_Job_Id ,p_po_number, p_po_line_num);
2366: End if;
2367: -- Added PO params for bug 4044057
2368: -- Need to validate the assigment for the entered PO
2369:
2422: -- Get the organization ID for the incurred by organization name given
2423: ELSIF ( X_enum IS NULL AND X_oname IS NOT NULL ) THEN
2424:
2425: IF PG_DEBUG = 'Y' THEN
2426: pa_debug.G_err_Stage := 'Calling pa_utils.GetOrgnId';
2427: log_message('log_message: ' || pa_debug.G_err_Stage);
2428: END IF;
2429:
2430: G_person_id := NULL;
2428: END IF;
2429:
2430: G_person_id := NULL;
2431: --Start of changes for 3010848
2432: --G_org_id := pa_utils.GetOrgId( X_oname );
2433: pa_utils.GetOrgnId(X_org_name => X_oname,
2434: X_bg_id => G_Business_Group_Id,
2435: X_Orgn_Id => G_org_id,
2436: X_Return_Status => L_Org_RetSts);
2429:
2430: G_person_id := NULL;
2431: --Start of changes for 3010848
2432: --G_org_id := pa_utils.GetOrgId( X_oname );
2433: pa_utils.GetOrgnId(X_org_name => X_oname,
2434: X_bg_id => G_Business_Group_Id,
2435: X_Orgn_Id => G_org_id,
2436: X_Return_Status => L_Org_RetSts);
2437:
2456: -- with supplier not being an employee
2457: ELSE
2458: G_person_id := NULL;
2459: G_org_id := NULL;
2460: END IF; /*IF ( X_end_date <> trunc(pa_utils.GetWeekEnding( X_end_date )) ) */
2461:
2462: END IF; --Predefined source check for person and organization id
2463:
2464: -- PA-K Changes: Moved CheckExporg to below one place
2465: IF G_org_id is not NULL THEN
2466: IF pa_trx_import.g_skip_tc_flag <> 'Y' and PA_TRX_IMPORT.Get_GVal_ProjTskEi_Date = 'Y' then /* Added for Bug # 2170237 */
2467: -- Modified the above condition for BUG6931833
2468: IF PG_DEBUG = 'Y' THEN
2469: pa_debug.G_err_stage := 'Calling pa_utils2.CheckExporg';
2470: log_message('log_message: ' || pa_debug.G_err_Stage);
2471: log_message('log_message: ' || 'G_org_id = ' || G_org_id);
2472: END IF;
2473: IF pa_utils2.CheckExporg(G_org_id,X_ei_date) = 'N' then
2469: pa_debug.G_err_stage := 'Calling pa_utils2.CheckExporg';
2470: log_message('log_message: ' || pa_debug.G_err_Stage);
2471: log_message('log_message: ' || 'G_org_id = ' || G_org_id);
2472: END IF;
2473: IF pa_utils2.CheckExporg(G_org_id,X_ei_date) = 'N' then
2474: X_status := 'PA_EXP_ORG_NOT_ACTIVE';
2475: pa_cc_utils.reset_curr_function;
2476: RETURN;
2477: END IF;
2482: -- 12.2 payroll intg. Validate the Location data and populate the location
2483: -- 10253400: Payroll integration enhancement for 12.2.
2484: -- =========================================================================
2485: IF P_Location_Id is null and P_Location_Code is null then
2486: G_location_id := pa_utils.GetAsgnLocationId(p_person_id => G_Person_Id,
2487: p_ei_date => X_ei_date);
2488: END IF;
2489:
2490: IF P_Location_Id is not null or P_Location_Code is not null then
2489:
2490: IF P_Location_Id is not null or P_Location_Code is not null then
2491:
2492: IF PG_DEBUG = 'Y' THEN
2493: pa_debug.G_err_stage := 'Calling pa_utils.GetLocationId';
2494: log_message('log_message: ' || pa_debug.G_err_Stage);
2495: log_message('log_message: ' || 'G_org_id = ' || G_org_id);
2496: END IF;
2497:
2494: log_message('log_message: ' || pa_debug.G_err_Stage);
2495: log_message('log_message: ' || 'G_org_id = ' || G_org_id);
2496: END IF;
2497:
2498: G_location_id := pa_utils.getlocationId(p_location_id
2499: ,p_location_code
2500: ,X_ei_Date);
2501:
2502: IF PG_DEBUG = 'Y' THEN
2499: ,p_location_code
2500: ,X_ei_Date);
2501:
2502: IF PG_DEBUG = 'Y' THEN
2503: pa_debug.G_err_stage := 'Called pa_utils.GetLocationId';
2504: log_message('log_message: ' || pa_debug.G_err_Stage);
2505: log_message('log_message: ' || 'G_location_id = ' || G_location_id);
2506: END IF;
2507:
2524: ELSE
2525: IF (X_override_to_oname IS NOT NULL) THEN
2526:
2527: IF PG_DEBUG = 'Y' THEN
2528: pa_debug.G_err_stage := 'Calling pa_utils.GetOrgnId for override org';
2529: log_message('log_message: ' || pa_debug.G_err_Stage);
2530: END IF;
2531:
2532: --Start of changes for bug 3010848
2529: log_message('log_message: ' || pa_debug.G_err_Stage);
2530: END IF;
2531:
2532: --Start of changes for bug 3010848
2533: --G_override_to_org_id := pa_utils.GetOrgId(X_override_to_oname);
2534:
2535: pa_cc_utils.log_message('X_override_to_oname = ' || X_override_to_oname
2536: || ' G_Business_Group_Id = ' || G_Business_Group_Id);
2537:
2535: pa_cc_utils.log_message('X_override_to_oname = ' || X_override_to_oname
2536: || ' G_Business_Group_Id = ' || G_Business_Group_Id);
2537:
2538:
2539: pa_utils.GetOrgnId(X_org_name => X_override_to_oname,
2540: X_bg_id => G_Business_Group_Id,
2541: X_Orgn_Id => G_override_to_org_id,
2542: X_Return_Status => L_Org_RetSts);
2543:
2552: pa_cc_utils.reset_curr_function;
2553: RETURN;
2554: ELSIF pa_trx_import.g_skip_tc_flag <> 'Y' and PA_TRX_IMPORT.Get_GVal_ProjTskEi_Date = 'Y' THEN /* Added for Bug # 2170237 */
2555: --Modified above condition for bug6931833
2556: IF pa_utils2.CheckExporg(G_override_to_org_id, X_ei_date) = 'N' THEN
2557: X_status := 'PA_OVERRIDE_ORG_NOT_ACTIVE';
2558: pa_cc_utils.reset_curr_function;
2559: RETURN;
2560: END IF;
2613: IF P_Project_Id is not null THEN
2614: G_project_id := P_Project_Id;
2615: ELSE
2616: IF PG_DEBUG = 'Y' THEN
2617: pa_debug.G_err_stage := 'Calling pa_utils.GetProjId';
2618: log_message('log_message: ' || pa_debug.G_err_Stage);
2619: END IF;
2620:
2621: G_project_id := pa_utils.GetProjId( X_pnum );
2617: pa_debug.G_err_stage := 'Calling pa_utils.GetProjId';
2618: log_message('log_message: ' || pa_debug.G_err_Stage);
2619: END IF;
2620:
2621: G_project_id := pa_utils.GetProjId( X_pnum );
2622: END IF;
2623:
2624: --PA-K Changes:
2625: --IF (G_Task_Id IS NULL) THEN
2628: IF P_Task_Id is not NULL THEN
2629: G_task_id := P_Task_Id;
2630: ELSE
2631: IF PG_DEBUG = 'Y' THEN
2632: pa_debug.G_err_stage := 'Calling pa_utils.GetTaskId';
2633: log_message('log_message: ' || pa_debug.G_err_Stage);
2634: END IF;
2635:
2636: G_task_id := pa_utils.GetTaskId( G_project_id, X_tnum );
2632: pa_debug.G_err_stage := 'Calling pa_utils.GetTaskId';
2633: log_message('log_message: ' || pa_debug.G_err_Stage);
2634: END IF;
2635:
2636: G_task_id := pa_utils.GetTaskId( G_project_id, X_tnum );
2637: END IF;
2638:
2639: -- ===========================================================================
2640: -- EXPENDITURE TYPE validation
2891: If pa_trx_import.g_skip_tc_flag <> 'Y' and PA_TRX_IMPORT.Get_GVal_ProjTskEi_Date = 'Y' then
2892: --Modified above condition for BUG6931833
2893:
2894: IF PG_DEBUG = 'Y' THEN
2895: pa_debug.G_err_stage := 'Calling pa_utils.IsCrossChargeable';
2896: log_message('log_message: ' || pa_debug.G_err_Stage);
2897: END IF;
2898:
2899: If not pa_utils.IsCrossChargeable(G_Project_Id) then
2895: pa_debug.G_err_stage := 'Calling pa_utils.IsCrossChargeable';
2896: log_message('log_message: ' || pa_debug.G_err_Stage);
2897: END IF;
2898:
2899: If not pa_utils.IsCrossChargeable(G_Project_Id) then
2900: X_Status := 'PA_PROJECT_NOT_VALID' ;
2901: pa_cc_utils.reset_curr_function;
2902: return ;
2903: End If ;
2916: pa_cc_utils.reset_curr_function;
2917: RETURN;
2918: ELSE
2919: IF PG_DEBUG = 'Y' THEN
2920: pa_debug.G_err_stage := 'Calling pa_utils2.GetLaborCostMultiplier';
2921: log_message('log_message: ' || pa_debug.G_err_Stage);
2922: END IF;
2923: G_lcm := pa_utils2.GetLaborCostMultiplier(G_Task_id);
2924: last_task := X_tnum;
2919: IF PG_DEBUG = 'Y' THEN
2920: pa_debug.G_err_stage := 'Calling pa_utils2.GetLaborCostMultiplier';
2921: log_message('log_message: ' || pa_debug.G_err_Stage);
2922: END IF;
2923: G_lcm := pa_utils2.GetLaborCostMultiplier(G_Task_id);
2924: last_task := X_tnum;
2925: END IF;
2926:
2927: END IF;
3819:
3820: IF ( X_system_linkage in ( 'ST', 'OT' )) THEN
3821:
3822: IF PG_DEBUG = 'Y' THEN
3823: pa_debug.G_err_stage := 'Calling pa_utils.DateInExpWeek';
3824: log_message('log_message: ' || pa_debug.G_err_Stage);
3825: END IF;
3826:
3827: IF ( NOT pa_utils.DateInExpWeek( X_ei_date , X_end_date ) ) THEN
3823: pa_debug.G_err_stage := 'Calling pa_utils.DateInExpWeek';
3824: log_message('log_message: ' || pa_debug.G_err_Stage);
3825: END IF;
3826:
3827: IF ( NOT pa_utils.DateInExpWeek( X_ei_date , X_end_date ) ) THEN
3828: X_status := 'ITEM_NOT_IN_WEEK';
3829: pa_cc_utils.reset_curr_function;
3830: RETURN;
3831: ELSIF ( X_enum IS NULL ) THEN
3882: IF P_NLR_Org_Id is not null Then
3883: G_nlro_id := P_NLR_Org_Id;
3884: ELSE
3885: IF PG_DEBUG = 'Y' THEN
3886: pa_debug.G_err_stage := 'Calling pa_utils.GetOrgnId';
3887: log_message('log_message: ' || pa_debug.G_err_Stage);
3888: END IF;
3889: --Start of changes for Bug 3010848
3890:
3887: log_message('log_message: ' || pa_debug.G_err_Stage);
3888: END IF;
3889: --Start of changes for Bug 3010848
3890:
3891: --G_nlro_id := pa_utils.GetOrgId( X_nlro_name );
3892: pa_utils.GetOrgnId(X_org_name => X_nlro_name,
3893: X_bg_id => G_Business_Group_Id,
3894: X_Orgn_Id => G_nlro_id,
3895: X_Return_Status => L_Org_RetSts);
3888: END IF;
3889: --Start of changes for Bug 3010848
3890:
3891: --G_nlro_id := pa_utils.GetOrgId( X_nlro_name );
3892: pa_utils.GetOrgnId(X_org_name => X_nlro_name,
3893: X_bg_id => G_Business_Group_Id,
3894: X_Orgn_Id => G_nlro_id,
3895: X_Return_Status => L_Org_RetSts);
3896:
4445: into l_SobId
4446: from pa_implementations_all
4447: where nvl(org_id,-99) = nvl(X_org_id,-99);
4448:
4449: X_gl_date := pa_utils2.get_prvdr_gl_date( X_ei_date, l_appl_id , l_SobId) ;
4450:
4451: END IF;
4452: */
4453:
4715: /* IC Change: we need to get receiver org ID regarldess
4716: of accounted or unaccounted transaction. For accounted
4717: case, we call PA_CC_IDENT.pa_cc_identify_txn_adj to
4718: get receiver org ID along with other info. For
4719: unaccounted case, we call PA_UTILS2.GetPrjOrgId to get
4720: only the reciever org id info. */
4721: ELSE
4722: /* IC Changes: Get receiver organization ID */
4723: IF PG_DEBUG = 'Y' THEN
4720: only the reciever org id info. */
4721: ELSE
4722: /* IC Changes: Get receiver organization ID */
4723: IF PG_DEBUG = 'Y' THEN
4724: pa_debug.G_err_stage := 'Calling PA_UTILS2.GetPrjOrgId';
4725: log_message('log_message: ' || pa_debug.G_err_Stage);
4726: END IF;
4727: G_RecvrOrgId := PA_UTILS2.GetPrjOrgId(p_project_id => G_project_id,
4728: p_task_id => NULL);
4723: IF PG_DEBUG = 'Y' THEN
4724: pa_debug.G_err_stage := 'Calling PA_UTILS2.GetPrjOrgId';
4725: log_message('log_message: ' || pa_debug.G_err_Stage);
4726: END IF;
4727: G_RecvrOrgId := PA_UTILS2.GetPrjOrgId(p_project_id => G_project_id,
4728: p_task_id => NULL);
4729: END IF; -- End gl_accted_flag = Y
4730: -- ==========================================================================
4731:
4952:
4953: END IF; --Accted = Y and Period_End = N
4954:
4955: --If transaction is accounted or unaccounted, period end accrual transaction then call
4956: --pa_utils2.get_period_information to derive the accrual period information for the original
4957: --and reversing line.
4958: IF ( l_period_end_txn = 'Y' ) THEN
4959:
4960: IF PG_DEBUG = 'Y' THEN
4962: log_message('log_message: ' || pa_debug.G_err_Stage);
4963: END IF;
4964:
4965: IF PG_DEBUG = 'Y' THEN
4966: pa_debug.G_err_stage := 'Calling pa_utils2.get_accrual_period_information';
4967: log_message('log_message: ' || pa_debug.G_err_Stage);
4968: END IF;
4969:
4970: G_GlDate := X_gl_date;
4969:
4970: G_GlDate := X_gl_date;
4971:
4972: --Call get_accrual_period_information API for the original line
4973: pa_utils2.get_accrual_period_information (
4974: p_expenditure_item_date => X_ei_date --in
4975: ,x_prvdr_accrual_date => G_AccDate --in/out. For original item this is passed OUT
4976: ,x_recvr_accrual_date => G_RecvrAccDate --in/out. For original item this is passed OUT
4977: ,p_prvdr_org_id => X_org_id --in
5024: G_RevAccDate := G_AccDate;
5025: G_RevRecvrAccDate := G_RecvrAccDate;
5026:
5027: IF PG_DEBUG = 'Y' THEN
5028: pa_debug.G_err_stage := 'Calling pa_utils2.get_accrual_period_information for the reversing line';
5029: log_message('log_message: ' || pa_debug.G_err_Stage);
5030: END IF;
5031:
5032:
5030: END IF;
5031:
5032:
5033: --Call get_accrual_period_information API for the reversing line
5034: pa_utils2.get_accrual_period_information (
5035: p_expenditure_item_date => X_ei_date
5036: ,x_prvdr_accrual_date => G_RevAccDate --in/out (both)
5037: ,x_recvr_accrual_date => G_RevRecvrAccDate --in/out (both)
5038: ,p_prvdr_org_id => X_org_id
5088: -- Assignment_Id and Work_Type_Id derivation/validation checks
5089:
5090: -- PA-J Txn Ctrl Changes
5091: -- Assignment Id will now be derived for Expense Reports (system_linkage of ER)
5092: -- The derivation of assignment id for ER is done in pa_utils4.
5093:
5094: -- PA-K Changes: For pre-defined sources the values in assignment_name and
5095: -- work_type_name will be ignored. If ids are given they will used else it will be derived.
5096: -- For user defined sources ids will be ignored and the names if given will be validated
5129: pa_debug.G_err_stage := 'P_Assignment_id is null';
5130: log_message('log_message: ' || pa_debug.G_err_Stage);
5131: END IF;
5132:
5133: G_Assignment_Id := pa_utils4.get_assignment_id(
5134: p_person_id => G_Person_Id
5135: ,p_project_id => G_Project_Id
5136: ,p_task_id => G_Task_Id
5137: ,p_ei_date => X_Ei_Date);
5154:
5155: End If;
5156:
5157: /*Bug# 2737538:Added check of profile option value for deriving work type */
5158: /* If (nvl(pa_utils4.is_exp_work_type_enabled,'N') = 'Y') Then ** moved condition below bug 3104004 */
5159:
5160: log_message('log_message: p work type id: ' || p_work_type_id);
5161:
5162: If (P_Work_Type_Id is not null) Then
5179: pa_debug.G_err_stage := 'P_Work_Type_Id is null';
5180: log_message('log_message: ' || pa_debug.G_err_Stage);
5181: END IF;
5182:
5183: G_Work_Type_Id := pa_utils4.get_work_type_id(
5184: p_project_id => G_Project_Id
5185: ,p_task_id => G_Task_Id
5186: ,p_assignment_id => nvl(G_Assignment_Id,0));
5187:
5189: pa_debug.G_err_stage := 'G_Work_Type_Id = ' || G_Work_Type_Id;
5190: log_message('log_message: ' || pa_debug.G_err_Stage);
5191: END IF;
5192:
5193: If (G_Work_Type_Id is NULL and nvl(pa_utils4.is_exp_work_type_enabled,'N') = 'Y') Then
5194: /*** added and condition bug 3104004 */
5195: X_Status := 'INVALID_WORK_TYPE';
5196: pa_cc_utils.reset_curr_function;
5197: Return;
5203: pa_debug.G_err_stage := 'Get Tp Amt Type';
5204: log_message('log_message: ' || pa_debug.G_err_Stage);
5205: END IF;
5206:
5207: G_Tp_Amt_Type_Code := pa_utils4.get_tp_amt_type_code(
5208: p_work_type_id => G_Work_Type_Id);
5209:
5210: IF PG_DEBUG = 'Y' THEN
5211: pa_debug.G_err_stage := 'G_Tp_Amt_Type_Code = ' || G_Tp_Amt_Type_Code;
5221: log_message('log_message: ' || pa_debug.G_err_Stage);
5222: log_message('log_message: ' || 'Assignment Name = ' || X_Assignment_Name || ' Work Type Name = ' || X_Work_Type_Name);
5223: END IF;
5224:
5225: pa_utils4.get_work_assignment(
5226: p_person_id => G_Person_Id
5227: , p_project_id => G_Project_Id
5228: , p_task_id => G_Task_Id
5229: , p_ei_date => X_Ei_Date
5892: BEGIN
5893: pa_cc_utils.set_curr_function('ValidateOrgId');
5894:
5895: --PA.K Changes: For Performance moved the Multi-Org check to init procedure.
5896: --IF pa_utils.pa_morg_implemented = 'Y' THEN
5897:
5898: /* Added for bug 3590027 */
5899: IF PG_DEBUG = 'Y' THEN
5900: log_message('Before call, G_Morg: ' || G_Morg);
5900: log_message('Before call, G_Morg: ' || G_Morg);
5901: END IF;
5902:
5903: If G_Morg is Null Then
5904: G_Morg := pa_utils.pa_morg_implemented;
5905: End If;
5906:
5907: IF PG_DEBUG = 'Y' THEN
5908: log_message('After call, G_Morg: ' || G_Morg);
5956: RETURN G_OrgNameOrgName;
5957:
5958: Else
5959:
5960: G_OrgNameBGId := pa_utils2.GetBusinessGroupId(business_group_name);
5961:
5962: BEGIN
5963:
5964: pa_utils2.GetEmpId ( P_Business_Group_Id => G_OrgNameBGId
5960: G_OrgNameBGId := pa_utils2.GetBusinessGroupId(business_group_name);
5961:
5962: BEGIN
5963:
5964: pa_utils2.GetEmpId ( P_Business_Group_Id => G_OrgNameBGId
5965: , P_Employee_Number => employee_number
5966: , X_Employee_Id => X_emp_id
5967: , P_Person_Type => person_type
5968: , P_EiDate => expenditure_item_date);
5975: WHEN OTHERS THEN
5976: NULL;
5977: END;
5978:
5979: --X_emp_id := pa_utils.GetEmpId(employee_number) ;
5980: if X_emp_id is null then
5981: RETURN NULL;
5982: else
5983:
5980: if X_emp_id is null then
5981: RETURN NULL;
5982: else
5983:
5984: X_org_name := pa_expenditures_utils.getorgtlname(pa_utils.GetEmpOrgId(X_emp_id, expenditure_item_date));
5985:
5986: G_OrgNameEmpNum := employee_number;
5987: G_OrgNameDate := expenditure_item_date;
5988: G_OrgNameBGName := business_group_name;
6091: IF PG_DEBUG = 'Y' THEN
6092: log_message('log_message: Determine the week ending date for the affected transactions. ' );
6093: END IF ;
6094:
6095: select pa_utils.getweekending(max(a.expenditure_item_date)),
6096: a.cdl_system_reference2
6097: BULK Collect into
6098: v_week_ending_dtTab,
6099: v_doc_headerIDTab
6786: log_message('populate_person_type: Person ID = ' || p_person_id);
6787: log_message('populate_person_type: Date = ' || p_date);
6788: END IF;
6789:
6790: l_Cross_BG_Profile:= pa_utils.IsCrossBGProfile_WNPS;
6791:
6792: SELECT business_group_id
6793: INTO l_business_group_id
6794: FROM pa_implementations;
7347: pa_transactions.FlushEiTabs;
7348:
7349: -- Bug 752915, added the following to flush the adjustments ei pl/sql table
7350: --
7351: pa_adjustments.ExpAdjItemTab := pa_utils.EmptyIdTab;
7352:
7353: /***** Bug 4106188 CWK Changes *****/
7354: -- release_po_line_task_lock;
7355: -- init_po_amt_chk;
8320:
8321: If (nvl(G_emp_org_oride,'N') = 'N' and l_PersonIdTab(j) is not NULL) Then /* bug#2719674 added nvl */
8322:
8323: IF PG_DEBUG = 'Y' THEN
8324: pa_debug.G_err_stage := 'Calling pa_utils.GetEmpOrgJobId';
8325: log_message('log_message: ' || pa_debug.G_err_Stage);
8326: END IF;
8327: pa_utils.GetEmpOrgJobId( l_PersonIdTab(j),
8328: l_EiDateTab(j),
8323: IF PG_DEBUG = 'Y' THEN
8324: pa_debug.G_err_stage := 'Calling pa_utils.GetEmpOrgJobId';
8325: log_message('log_message: ' || pa_debug.G_err_Stage);
8326: END IF;
8327: pa_utils.GetEmpOrgJobId( l_PersonIdTab(j),
8328: l_EiDateTab(j),
8329: l_EmpOrgIdTab(j),
8330: l_EmpJobIdTab(j) );
8331:
8372: and PTYPE.PERSON_TYPE_ID = PPL.PERSON_TYPE_ID
8373: and PTYPE.SYSTEM_PERSON_TYPE in ('OTHER','CWK');
8374:
8375:
8376: PA_UTILS.GETEMPORGJOBID( L_PERSONIDTAB(J),
8377: l_EiDateTab(j),
8378: l_EmpOrgIdTab(j),
8379: L_EMPJOBIDTAB(J) );
8380: exception
8503: X_ei_id := NULL ;
8504: -- null value of expenditure item id would indicate that expenditure item
8505: -- will not be created.
8506: ELSE
8507: X_ei_id := pa_utils.GetNextEiId;
8508:
8509: -- REL12 : AP Lines uptake
8510: -- Support net zero adjusted transactions for the supplier invoice interface.
8511: --
8720: g_rate_source_code := NULL;
8721: g_enable_accrual_code := NULL;
8722: g_payroll_accrual_flag := NULL;
8723:
8724: pa_utils.get_rate_source_cost_method(l_ExpItemIdTab(j),l_EiDateTab(j),g_rate_source_code,
8725: g_costing_method,g_enable_accrual_code);
8726:
8727: IF (g_enable_accrual_code = 'YES') THEN
8728: --{
9324: --two profiles and if it is Y then use the billable_flag from
9325: --validate_transaction and if N then override with what user entered.
9326:
9327: IF PG_DEBUG = 'Y' THEN
9328: pa_debug.G_err_stage := 'Calling pa_utils4.get_transaction_billability';
9329: log_message('log_message: ' || pa_debug.G_err_stage);
9330: log_message('log_message: ' || 'Billable Flag before get_trxn_work_billabilty = ' || X_billable_flag);
9331: log_message('log_message: ' || 'Work Type Id = ' || G_work_type_id);
9332: END IF;
9330: log_message('log_message: ' || 'Billable Flag before get_trxn_work_billabilty = ' || X_billable_flag);
9331: log_message('log_message: ' || 'Work Type Id = ' || G_work_type_id);
9332: END IF;
9333:
9334: X_billable_flag := pa_utils4.get_trxn_work_billabilty(
9335: p_work_type_id => G_work_type_id,
9336: p_tc_extn_bill_flag => X_billable_flag);
9337:
9338: IF PG_DEBUG = 'Y' THEN
9478: ,X_raw_cost_rate => l_rawCostRateTab(j)
9479: -- Trx_import enhancement
9480: ,X_override_to_org_id => G_override_to_org_id -- Changed from NULL
9481: /* Added for bug 3220230 for getting billability of items reversed in OIT */
9482: ,X_billable_flag => pa_utils4.GetOrig_EiBillability_SST(l_temp_adjItemID,X_billable_flag,X_transaction_source)
9483: /* Added for bug 4057474 for getting bill_hold_flag of items reversed in external txn sources like OTL. */
9484: ,X_bill_hold_flag => pa_utils4.GetOrig_EiBill_hold(l_temp_adjItemID,'N')
9485: ,X_orig_transaction_ref => l_OrigTxnRefTab(j)
9486: ,X_transferred_from_ei => NULL
9480: ,X_override_to_org_id => G_override_to_org_id -- Changed from NULL
9481: /* Added for bug 3220230 for getting billability of items reversed in OIT */
9482: ,X_billable_flag => pa_utils4.GetOrig_EiBillability_SST(l_temp_adjItemID,X_billable_flag,X_transaction_source)
9483: /* Added for bug 4057474 for getting bill_hold_flag of items reversed in external txn sources like OTL. */
9484: ,X_bill_hold_flag => pa_utils4.GetOrig_EiBill_hold(l_temp_adjItemID,'N')
9485: ,X_orig_transaction_ref => l_OrigTxnRefTab(j)
9486: ,X_transferred_from_ei => NULL
9487: ,X_adj_expend_item_id => G_adj_item_id
9488: ,X_attribute_category => l_AttCatTab(j)
9595: -- increment the counter
9596: i := i + 1;
9597:
9598: pa_transactions.LoadEi(
9599: X_expenditure_item_id => pa_utils.GetNextEiId
9600: ,X_expenditure_id => G_expenditure_id
9601: ,X_expenditure_item_date => l_EiDateTab(j)
9602: ,X_project_id => G_project_id
9603: ,X_task_id => G_task_id
10171:
10172: GetTrxSrcInfo ( X_trx_src => P_transaction_source );
10173:
10174: --Pa.K Changes: For performance moved the Multi-Org check to the init procedure.
10175: G_Morg := pa_utils.pa_morg_implemented;
10176:
10177: -- MOAC changes. populate the operating unit org id variable.
10178: g_moac_org_id := pa_moac_utils.get_current_org_id ;
10179:
12137:
12138: G_Assignment_Id := P_Assignment_Id;
12139: G_Work_Type_Id := P_Work_Type_Id;
12140:
12141: G_Tp_Amt_Type_Code := pa_utils4.get_tp_amt_type_code(p_work_type_id => p_work_type_id);
12142:
12143: END IF;
12144:
12145: IF PG_DEBUG = 'Y' THEN
12313:
12314: END IF;
12315:
12316: IF PG_DEBUG = 'Y' THEN
12317: pa_debug.G_err_stage := 'Calling PA_UTILS2.GetPrjOrgId';
12318: log_message('log_message: ' || pa_debug.G_err_Stage);
12319: END IF;
12320: G_RecvrOrgId := PA_UTILS2.GetPrjOrgId(p_project_id => G_project_id,
12321: p_task_id => NULL);
12316: IF PG_DEBUG = 'Y' THEN
12317: pa_debug.G_err_stage := 'Calling PA_UTILS2.GetPrjOrgId';
12318: log_message('log_message: ' || pa_debug.G_err_Stage);
12319: END IF;
12320: G_RecvrOrgId := PA_UTILS2.GetPrjOrgId(p_project_id => G_project_id,
12321: p_task_id => NULL);
12322:
12323: IF PG_DEBUG = 'Y' THEN
12324: pa_debug.G_err_stage := 'Calling API to derive/validate assignment and work type info';
12328:
12329: /*S.N. 5297060*/
12330: If ( X_match_flag <> 'N' ) THEN
12331:
12332: pa_utils4.get_work_assignment(
12333: p_person_id => G_Person_Id
12334: , p_project_id => G_Project_Id
12335: , p_task_id => G_Task_Id
12336: , p_ei_date => X_Ei_Date
12444: /*E.N. 5297060*/
12445:
12446: /* 12.2 payroll intg .. validate location and populate default assign location if not passed */
12447: if p_location_id is null then
12448: G_location_id := pa_utils.GetAsgnLocationId(p_person_id => G_Person_Id,
12449: p_ei_date => X_ei_date);
12450: else
12451: G_Location_Id := p_location_id;
12452: end if;