1: PACKAGE BODY PATC AS
2: /* $Header: PAXTTXCB.pls 120.20.12010000.4 2008/11/05 12:29:56 abjacob ship $ */
3:
4: temp_status VARCHAR2(30) := NULL;
5: temp_bill_flag VARCHAR2(1) := NULL;
305: tc task_level_tc%ROWTYPE;
306:
307: proj project_info%ROWTYPE;
308:
309: patcx_bill_flag VARCHAR2(1);
310:
311: X_org_id NUMBER(15) DEFAULT NULL;
312:
313: -- =====================================================================
326: -- which transfers records from AP
327: IF ( X_calling_Module <> 'PAAPIMP')
328: OR -- added this for bug fix :2345895
329: ( X_calling_Module = 'PAAPIMP' and Pa_Trx_Import.G_Skip_Tc_Flag <> 'Y' ) THEN
330: print_message('PATC ERROR:'||msg_name);
331: X_status := msg_name;
332: -- Begin bug 4518893
333: If ( nvl(X_msg_type,'W') = 'E' ) THEN
334: X_billable_flag := NULL;
711:
712: BEGIN
713:
714: /** assign the in param assignment id to global variable **/
715: PATC.G_OVERIDE_ASSIGNMENT_ID := p_assignment_id;
716: print_message('Stage:PATC:10.10.001 GET_STATUS API');
717: print_message('IN PARAMS : Project_id:['||X_project_id||'] Task_id :['||X_task_id||'] EI_date:['||X_ei_date||
718: ']Exp Type:['||X_expenditure_type||'] non_labor_resource:['||X_non_labor_resource||']'||
719: 'person_id:['||X_person_id||']quantity:['||X_quantity||']denom_currency_code:['||
712: BEGIN
713:
714: /** assign the in param assignment id to global variable **/
715: PATC.G_OVERIDE_ASSIGNMENT_ID := p_assignment_id;
716: print_message('Stage:PATC:10.10.001 GET_STATUS API');
717: print_message('IN PARAMS : Project_id:['||X_project_id||'] Task_id :['||X_task_id||'] EI_date:['||X_ei_date||
718: ']Exp Type:['||X_expenditure_type||'] non_labor_resource:['||X_non_labor_resource||']'||
719: 'person_id:['||X_person_id||']quantity:['||X_quantity||']denom_currency_code:['||
720: X_denom_currency_code||']acct_currency_code:['||X_acct_currency_code||']transfer_ei:['||
755: IF ( (X_Calling_Module not in ('PAXPRRPE', 'PAXINADI')) AND
756: (substr(X_Calling_Module, 1, 2) <> 'PO' )) THEN
757:
758: -- No Need to do quanitity checks for calls from GUI Forms
759: print_message('Stage:PATC:10.10.002');
760: IF P_sys_link_function = 'VI' THEN
761: check_quantity;
762: END IF;
763: END IF;
764:
765: /* Bug# 3494771 : If calling module is from IProcurement then we need to
766: validate expenditure type maually entered by user */
767: IF X_Calling_Module ='POWEBREQ' THEN
768: print_message('Stage:PATC:10.10.02.5');
769: check_exp_type;
770: END IF;
771: /*End of changes for Bug# 3494771*/
772:
776: -- tc_extension so that client controls and TC are not ignored
777:
778: IF X_Calling_Module <> 'CreateRelatedItem' THEN
779:
780: print_message('Stage:PATC:10.10.003');
781:
782: IF (nvl(G_PREV_EI_DATE,trunc(sysdate-100000)) <> X_ei_date OR nvl(G_PREV_EXP_TYPE,'NO EXP TYPE') <> X_expenditure_type) THEN
783:
784: G_PREV_EI_DATE := X_ei_date;
820: /** added 'APXIIMPT','apiimptb.pls' for payable import process bug fix : 2467454**/
821: /** Added SelfService for validation during Self Service Expense Report Entry. 2971043 **/
822: IF x_calling_module in ('APXINENT','apiindib.pls','apiimptb.pls','APXIIMPT','SelfService') THEN
823:
824: print_message('Stage:PATC:10.10.003.1');
825: check_person_id ; /*2955795*/
826:
827: /*If ( l_return_string = 'VI,ER,' or l_return_string = 'ER,VI,'
828: or l_return_string = 'VI,') then
825: check_person_id ; /*2955795*/
826:
827: /*If ( l_return_string = 'VI,ER,' or l_return_string = 'ER,VI,'
828: or l_return_string = 'VI,') then
829: print_message('Stage:PATC:Setting the l_sys_link_func to VI');
830: l_sys_link_func := 'VI';
831: End if;
832: :Bug# 2955795 :Setting of l_sys_link_func is not required now */
833:
868: IF X_Calling_Module not in ('PAXPRRPE', 'PAXINADI','CreateRelatedItem') THEN
869: -- Project level and task level checks are not required
870: -- because as they are validated in the GUI forms for these
871: -- Calling Modules.
872: print_message('Stage:PATC:10.10.004');
873: IF ( project_info%ROWCOUNT = 0 ) THEN -- Project/Task combination is
874: -- not valid
875: IF Pa_Trx_Import.G_Skip_Tc_Flag <> 'Y' Then /* Added If Condition for bug 1299909 */
876: print_message('Stage:PATC:10.10.005');
872: print_message('Stage:PATC:10.10.004');
873: IF ( project_info%ROWCOUNT = 0 ) THEN -- Project/Task combination is
874: -- not valid
875: IF Pa_Trx_Import.G_Skip_Tc_Flag <> 'Y' Then /* Added If Condition for bug 1299909 */
876: print_message('Stage:PATC:10.10.005');
877: return_error( 'PA_EXP_INV_PJTK' );
878: End If;
879:
880: ELSIF ( proj.p_template_flag = 'Y' ) THEN -- Checks if it is a
880: ELSIF ( proj.p_template_flag = 'Y' ) THEN -- Checks if it is a
881: -- template project
882:
883: IF Pa_Trx_Import.G_Skip_Tc_Flag <> 'Y' Then /* Added If Condition for bug 1299909 */
884: print_message('Stage:PATC:10.10.006');
885: return_error( 'PA_EX_TEMPLATE_PROJECT');
886: End If;
887:
888: -- BUG: 4600792 PQE:R12 CHANGE AWARD END WHEN ENCUMBRANCE EXISTS, IMPORT ENC REVERSALS FOR CLOSE
891: ELSIF ( trunc(X_ei_date) NOT BETWEEN trunc(proj.p_start_date) AND trunc(proj.p_end_date) )
892: AND PA_TRX_IMPORT.Get_GVal_ProjTskEi_Date ='Y' THEN
893:
894: IF Pa_Trx_Import.G_Skip_Tc_Flag <> 'Y' Then /* Added If Condition for bug 1299909 */
895: print_message('Stage:PATC:10.10.007');
896: return_error( 'PA_EX_PROJECT_DATE' );
897: End If;
898:
899: ELSIF (PA_PROJECT_UTILS.Check_prj_stus_action_allowed(proj.project_status_code,'NEW_TXNS') = 'N' ) THEN
898:
899: ELSIF (PA_PROJECT_UTILS.Check_prj_stus_action_allowed(proj.project_status_code,'NEW_TXNS') = 'N' ) THEN
900:
901: IF Pa_Trx_Import.G_Skip_Tc_Flag <> 'Y' Then /* Added If Condition for bug 1299909 */
902: print_message('Stage:PATC:10.10.008');
903: return_error( 'PA_NEW_TXNS_NOT_ALLOWED' );
904: End If;
905:
906: -- BUG: 4600792 PQE:R12 CHANGE AWARD END WHEN ENCUMBRANCE EXISTS, IMPORT ENC REVERSALS FOR CLOSE
907: --
908: ELSIF ( X_ei_date NOT BETWEEN proj.t_start_date AND proj.t_end_date ) AND PA_TRX_IMPORT.Get_GVal_ProjTskEi_Date ='Y' THEN
909:
910: IF Pa_Trx_Import.G_Skip_Tc_Flag <> 'Y' Then /* Added If Condition for bug 1299909 */
911: print_message('Stage:PATC:10.10.009');
912: return_error( 'PA_EXP_TASK_EFF' );
913: End If;
914:
915: ELSIF ( proj.t_chargeable_flag = 'N' ) THEN
914:
915: ELSIF ( proj.t_chargeable_flag = 'N' ) THEN
916:
917: IF Pa_Trx_Import.G_Skip_Tc_Flag <> 'Y' Then /* Added If Condition for bug 1299909 */
918: print_message('Stage:PATC:10.10.010');
919: return_error( 'PA_EXP_TASK_STATUS' );
920: End If;
921:
922: ELSIF (Pa_Trx_Import.G_Skip_Tc_Flag <> 'Y') Then
1044: ---******** Selva Code starts
1045:
1046: IF task_level_tc%NOTFOUND THEN
1047:
1048: print_message('Stage:PATC:10.11.001');
1049:
1050: IF proj.t_limit_flag = 'Y' THEN
1051:
1052: /* Commented for bug 2939224
1055: -- Added x_person_id parameter to function call for bug 4585740
1056: If check_person_level_TCs(p_sys_link_function, x_project_id, x_task_id,x_person_id) THEN -- added for bug 2939224/bug 4912880 added x_person_id to call
1057:
1058: IF Pa_Trx_Import.G_Skip_Tc_Flag <> 'Y' Then /* Added If Condition for bug 1299909 */
1059: print_message('Stage:PATC:10.11.002');
1060:
1061: -- Added following block for CWk changes bug# 5948324
1062: if l_person_Type = 'CWK' Then
1063: return_error('PA_CWK_TXN_NOT_ALLOWED');
1087: -- Added x_person_id parameter to function call for bug 4585740
1088: IF check_person_level_TCs(p_sys_link_function, x_project_id,x_person_id) THEN -- added for bug 2939224/bug 4912880 added x_person_id to call
1089:
1090: IF Pa_Trx_Import.G_Skip_Tc_Flag <> 'Y' Then /* Added If Condition for bug 1299909 */
1091: print_message('Stage:PATC:10.11.003');
1092: return_error( 'PA_EXP_PJ_TC' );
1093: End If;
1094:
1095: END IF;
1097: END IF ;
1098:
1099: ELSE -- task_level_tc found
1100:
1101: print_message('Stage:PATC:10.12.001');
1102: print_message('Transaction contol record:task_id['||tc.task_id||
1103: ']person_id['||tc.person_id||']exp_cat['||tc.expenditure_category||
1104: ']exp_type['||tc.expenditure_type||']non_lab_res['||tc.non_labor_resource||
1105: ']charge_flag['||tc.chargeable_flag||']bill_flag['||tc.billable_indicator||
1111: IF ( proj.t_limit_flag = 'Y' AND tc.task_id is NULL ) THEN
1112:
1113: IF Pa_Trx_Import.G_Skip_Tc_Flag <> 'Y' Then /* Added If Condition for bug 1299909 */
1114:
1115: print_message('Stage:PATC:10.12.002');
1116: -- Begin CWK/FP_M changes
1117: /* IF p_sys_link_function not in ('USG', 'PJ') THEN --Bug 4266933*//*Commented for Bug 5735180*/
1118:
1119:
1176:
1177: IF ( x_calling_module = 'PAAPIMP' and x_transaction_source = 'AP EXPENSE') OR
1178: ( x_calling_module <> 'PAAPIMP' and Pa_Trx_Import.G_Skip_Tc_Flag <> 'Y' ) Then
1179:
1180: print_message('Stage:PATC:10.12.003.1');
1181: l_check_pjrm_tc_flag := 'Y';
1182:
1183: END IF;
1184: /** added 'APXIIMPT','apiimptb.pls' for bug fix : 2467454 **/
1186: /** Based on the expenditure_type derive the system linkage function
1187: * IF expenditure_type is part of ER,VI the display warning
1188: * else raise error **/
1189:
1190: print_message('Stage:PATC:10.12.003.2');
1191: /*This is not required now since we have p_sys_link_function now that contains
1192: store 'ER'/'VI' for Expense Report/Supplier Invoice
1193: check_person_id(p_mode => 'SYS_LINK_CHECK'
1194: ,x_return_string => l_return_string ); Bug# 2955795*/
1200: End if;
1201:
1202: ELSIF ( x_calling_module IN ('SelfService','PAXVSSTS','PAXVOTCB')) Then
1203:
1204: print_message('Stage:PATC:10.12.003.3');
1205: l_check_pjrm_tc_flag := 'Y';
1206:
1207: ELSIF Pa_Trx_Import.G_Skip_Tc_Flag <> 'Y' then
1208:
1205: l_check_pjrm_tc_flag := 'Y';
1206:
1207: ELSIF Pa_Trx_Import.G_Skip_Tc_Flag <> 'Y' then
1208:
1209: print_message('Stage:PATC:10.12.003.4');
1210: l_check_pjrm_tc_flag := 'N';
1211:
1212: END IF;
1213:
1213:
1214: /* Bug 4092732
1215: ELSE -- prm is not installed
1216:
1217: print_message('Stage:PATC:10.12.003.5');
1218: l_check_pjrm_tc_flag := 'N';
1219: PATC.G_OVERIDE_ASSIGNMENT_ID := p_assignment_id;
1220:
1221: END If;
1215: ELSE -- prm is not installed
1216:
1217: print_message('Stage:PATC:10.12.003.5');
1218: l_check_pjrm_tc_flag := 'N';
1219: PATC.G_OVERIDE_ASSIGNMENT_ID := p_assignment_id;
1220:
1221: END If;
1222: */
1223: Temp_allow_unscheduled_exp := nvl(tc.SCHEDULED_EXP_ONLY,'N') ;
1222: */
1223: Temp_allow_unscheduled_exp := nvl(tc.SCHEDULED_EXP_ONLY,'N') ;
1224: IF ( p_assignment_id is NULL and x_person_id is NOT NULL and l_check_pjrm_tc_flag = 'Y') Then
1225:
1226: print_message('Stage:PATC:10.12.003.6');
1227: temp_assignment_id := PA_UTILS4.get_assignment_id
1228: (p_person_id => x_person_id
1229: ,p_project_id => x_project_id
1230: ,p_task_id => x_task_id
1230: ,p_task_id => x_task_id
1231: ,p_ei_date => x_ei_date );
1232: Else
1233:
1234: print_message('Stage:PATC:10.12.003.7');
1235: temp_assignment_id := p_assignment_id;
1236:
1237: End If;
1238:
1244: ']project_limit_flag['||proj.p_limit_flag||']' );
1245:
1246: If (nvl(temp_assignment_id,0) = 0 and l_check_pjrm_tc_flag = 'Y' and nvl(tc.SCHEDULED_EXP_ONLY,'N') = 'Y' ) then
1247:
1248: Print_Message('Stage:PATC:10.12.003.8');
1249: X_status := 'PA_NO_ASSIGNMENT'; -- Bug#3442186 Changed status from PA_INVALID_ASSIGNMENT
1250: X_Billable_Flag := NULL;
1251: Print_Message('PATC ERROR: ' || X_status);
1252: RAISE INVALID_DATA;
1247:
1248: Print_Message('Stage:PATC:10.12.003.8');
1249: X_status := 'PA_NO_ASSIGNMENT'; -- Bug#3442186 Changed status from PA_INVALID_ASSIGNMENT
1250: X_Billable_Flag := NULL;
1251: Print_Message('PATC ERROR: ' || X_status);
1252: RAISE INVALID_DATA;
1253:
1254: Else
1255:
1252: RAISE INVALID_DATA;
1253:
1254: Else
1255:
1256: Print_Message('Stage:PATC:10.12.003.9');
1257: PATC.G_OVERIDE_ASSIGNMENT_ID := temp_assignment_id;
1258:
1259: End if; -- PA_NO_ASSIGNMENT
1260:
1253:
1254: Else
1255:
1256: Print_Message('Stage:PATC:10.12.003.9');
1257: PATC.G_OVERIDE_ASSIGNMENT_ID := temp_assignment_id;
1258:
1259: End if; -- PA_NO_ASSIGNMENT
1260:
1261: /** End of PJRM changes **/
1270:
1271: -- If P_Person_Type = 'CWK' and Tc.Employees_Only_flag = 'Y' Then
1272: If l_Person_Type = 'CWK' and Tc.Employees_Only_flag = 'E' Then
1273:
1274: Print_Message('Stage:PATC:10.12.004.1a');
1275: X_Status := 'PA_CWK_TXN_NOT_ALLOWED';
1276: X_Billable_Flag := NULL;
1277: Print_Message('PATC ERROR: ' || X_status);
1278: RAISE INVALID_DATA;
1273:
1274: Print_Message('Stage:PATC:10.12.004.1a');
1275: X_Status := 'PA_CWK_TXN_NOT_ALLOWED';
1276: X_Billable_Flag := NULL;
1277: Print_Message('PATC ERROR: ' || X_status);
1278: RAISE INVALID_DATA;
1279:
1280: ElsIf l_Person_Type = 'EMP' and Tc.Employees_Only_flag = 'C' Then
1281:
1278: RAISE INVALID_DATA;
1279:
1280: ElsIf l_Person_Type = 'EMP' and Tc.Employees_Only_flag = 'C' Then
1281:
1282: Print_Message('Stage:PATC:10.12.004.1b');
1283: If level_flag_local = 'P' Then
1284: X_Status := 'PA_TR_EPE_PROJ_TXN_CTRLS';
1285: Else
1286: X_Status := 'PA_TR_EPE_TASK_TXN_CTRLS';
1285: Else
1286: X_Status := 'PA_TR_EPE_TASK_TXN_CTRLS';
1287: End If;
1288: X_Billable_Flag := NULL;
1289: Print_Message('PATC ERROR: ' || X_status);
1290: RAISE INVALID_DATA;
1291:
1292: Else
1293:
1290: RAISE INVALID_DATA;
1291:
1292: Else
1293:
1294: print_message('Stage:PATC:10.12.004.1c');
1295:
1296: End If;
1297:
1298: End If; /* Added for bug 4549869 */
1304: If l_Person_Type = 'CWK' and (tc.Employees_Only_Flag = 'C' or tc.Employees_Only_flag is Null) Then
1305:
1306: If tc.chargeable_flag = 'N' Then -- Added for Bug#4549448
1307:
1308: Print_Message('Stage:PATC:10.12.004.1d');
1309: X_Status := 'PA_CWK_TXN_NOT_ALLOWED';
1310: X_Billable_Flag := NULL;
1311: Print_Message('PATC ERROR: ' || X_status);
1312: RAISE INVALID_DATA;
1307:
1308: Print_Message('Stage:PATC:10.12.004.1d');
1309: X_Status := 'PA_CWK_TXN_NOT_ALLOWED';
1310: X_Billable_Flag := NULL;
1311: Print_Message('PATC ERROR: ' || X_status);
1312: RAISE INVALID_DATA;
1313:
1314: End If; -- Added for Bug#4549448
1315:
1316: ElsIf l_Person_Type = 'EMP' and (tc.Employees_Only_Flag = 'E' or tc.Employees_Only_flag is Null) Then
1317:
1318: If tc.chargeable_flag = 'N' Then -- Added for Bug#4549448
1319:
1320: Print_Message('Stage:PATC:10.12.004.1e');
1321:
1322: If level_flag_local = 'P' Then
1323: X_Status := 'PA_TR_EPE_PROJ_TXN_CTRLS';
1324: Else
1325: X_Status := 'PA_TR_EPE_TASK_TXN_CTRLS';
1326: End If;
1327:
1328: X_Billable_Flag := NULL;
1329: Print_Message('PATC ERROR: ' || X_status);
1330: RAISE INVALID_DATA;
1331:
1332: End If; -- Added for Bug#4549448
1333:
1336: ElsIf (p_sys_link_function in ('USG', 'PJ', 'VI', 'BTC', 'WIP', 'INV') and x_person_id is NULL) Then
1337:
1338: If tc.chargeable_flag = 'N' Then
1339:
1340: Print_Message('Stage:PATC:10.12.004.1e');
1341:
1342: If level_flag_local = 'P' Then
1343: X_Status := 'PA_TR_EPE_PROJ_TXN_CTRLS';
1344: Else
1345: X_Status := 'PA_TR_EPE_TASK_TXN_CTRLS';
1346: End If;
1347:
1348: X_Billable_Flag := NULL;
1349: Print_Message('PATC ERROR: ' || X_status);
1350: RAISE INVALID_DATA;
1351:
1352: End If;
1353: -- End, added the following block for bug 4556126
1356: End If; -- Pa_Trx_Import.G_Skip_Tc_Flag <> 'Y' /* Added for bug 4549869 */
1357:
1358: Else
1359:
1360: print_message('Stage:PATC:10.12.004.2');
1361:
1362: End If;
1363: -- End bug 4068808
1364:
1369: P_PO_Line_Id Is Not Null Then
1370:
1371: If Pa_Trx_Import.G_Skip_Tc_Flag <> 'Y' Then /* Added for bug 4549869 */
1372:
1373: Print_Message('Stage:PATC:10.12.004.3');
1374: X_Status := 'PA_CWK_TC_NOT_ALLOWED';
1375: X_Billable_Flag := NULL;
1376: Print_Message('PATC ERROR: '|| X_status);
1377: RAISE INVALID_DATA;
1372:
1373: Print_Message('Stage:PATC:10.12.004.3');
1374: X_Status := 'PA_CWK_TC_NOT_ALLOWED';
1375: X_Billable_Flag := NULL;
1376: Print_Message('PATC ERROR: '|| X_status);
1377: RAISE INVALID_DATA;
1378:
1379: End If; /* Added for bug 4549869 */
1380:
1379: End If; /* Added for bug 4549869 */
1380:
1381: Else
1382:
1383: Print_Message('Stage:PATC:10.12.004.4');
1384:
1385: End If;
1386:
1387: /** End PA.M/CWK changes **/
1396: P_Person_Id => X_Person_id,
1397: P_Financial_Task_Id => X_Task_Id,
1398: P_Ei_Date => X_Ei_Date ) = 'N' Then
1399:
1400: Print_Message('Stage:PATC:10.12.004.5');
1401: X_Status := 'PA_WP_RES_NOT_DEFINED';
1402: X_Billable_Flag := NULL;
1403: Print_Message('PATC ERROR: ' || X_Status);
1404: RAISE INVALID_DATA;
1399:
1400: Print_Message('Stage:PATC:10.12.004.5');
1401: X_Status := 'PA_WP_RES_NOT_DEFINED';
1402: X_Billable_Flag := NULL;
1403: Print_Message('PATC ERROR: ' || X_Status);
1404: RAISE INVALID_DATA;
1405:
1406: Else
1407:
1404: RAISE INVALID_DATA;
1405:
1406: Else
1407:
1408: Print_Message('Stage:PATC:10.12.004.6');
1409:
1410: End If;
1411:
1412: Else
1410: End If;
1411:
1412: Else
1413:
1414: Print_Message('Stage:PATC:10.12.004.7');
1415:
1416: End If;
1417:
1418: /** End PA.M/Task Assignment changes **/
1426: IF level_flag_local = 'T' THEN
1427:
1428: IF Pa_Trx_Import.G_Skip_Tc_Flag <> 'Y' Then /* Added If Condition for bug 1299909 */
1429:
1430: print_message('Stage:PATC:10.12.005');
1431: return_error( 'PA_EXP_TASK_TC' );
1432:
1433: End If;
1434:
1435: END IF ;
1436: IF level_flag_local = 'P' THEN
1437:
1438: IF Pa_Trx_Import.G_Skip_Tc_Flag <> 'Y' Then /* Added If Condition for bug 1299909 */
1439: print_message('Stage:PATC:10.12.006');
1440: return_error( 'PA_EXP_PJ_TC' );
1441: End If;
1442: END IF ;
1443:
1442: END IF ;
1443:
1444: ELSE
1445:
1446: print_message('Stage:PATC:10.12.007');
1447: IF tc.person_id is NOT NULL AND tc.expenditure_category is NULL THEN
1448:
1449: FETCH task_level_tc INTO tc;
1450: IF task_level_tc%FOUND THEN
1452: tc.task_id is NOT NULL AND
1453: tc.chargeable_flag = 'N' THEN
1454:
1455: IF Pa_Trx_Import.G_Skip_Tc_Flag <> 'Y' Then /* Added If Condition for bug 1299909 */
1456: print_message('Stage:PATC:10.12.008');
1457: return_error( 'PA_EXP_TASK_TC' );
1458: End If;
1459: END IF ;
1460: IF level_flag = 'P' AND
1460: IF level_flag = 'P' AND
1461: tc.chargeable_flag = 'N' THEN
1462:
1463: IF Pa_Trx_Import.G_Skip_Tc_Flag <> 'Y' Then /* Added If Condition for bug 1299909 */
1464: print_message('Stage:PATC:10.12.009');
1465: return_error( 'PA_EXP_PJ_TC' );
1466: End If;
1467: END IF ;
1468:
1477: End If; -- proj.p_limit_flag = 'Y' or proj.t_limit_flag = 'Y'
1478:
1479: END IF ; -- IF task_level_tc%NOTFOUND
1480:
1481: print_message('Stage:PATC:10.12.010');
1482: set_billable_flag( tc.billable_indicator, proj.t_billable_flag );
1483:
1484: ---******** Selva Code ends
1485:
1496: /* If (x_calling_module in ('APXINENT','apiindib.pls','APXIIMPT','apiimptb.pls')) OR
1497: (x_calling_module = 'PAAPIMP' AND x_transaction_source = 'AP EXPENSE' ) Then
1498: check_person_id(p_mode => 'SYS_LINK_CHECK'
1499: ,x_return_string => l_return_string );
1500: print_message('Stage:PATC:10.12.010.1');
1501: End If; Commented for bug# 2955795 */
1502:
1503: /** Added SelfService for validation during Self Service Expense Report Entry. 2971043 **/
1504: /** At present Iexpenses does not pass the p_sys_link_function parameter. But since
1509: OR
1510: ( x_calling_module = 'PAAPIMP' AND
1511: x_transaction_source = 'AP EXPENSE' AND p_sys_link_function = 'ER' ) THEN /*Bug# 2955795*/
1512:
1513: print_message('Stage:PATC:10.12.010.2');
1514:
1515: IF nvl(check_active_employee
1516: (p_vendor_id => x_vendor_id
1517: ,p_person_id => x_person_id
1515: IF nvl(check_active_employee
1516: (p_vendor_id => x_vendor_id
1517: ,p_person_id => x_person_id
1518: ,p_ei_date => x_ei_date),'N') = 'N' then
1519: print_message('Stage:PATC:10.12.010.3');
1520: return_error( 'NO_ASSIGNMENT');
1521:
1522: End if;
1523:
1536: -- Added PO params for bug 4044057
1537: -- Need to validate the assigment for the entered PO
1538: IF l_job_id is NULL THEN
1539:
1540: print_message('Stage:PATC:10.12.010.4');
1541: return_error('NO_PO_ASSIGNMENT');
1542:
1543: END IF;
1544:
1550: IF pa_trx_import.g_skip_tc_flag <> 'Y' then /* Added for Bug # 2170237 */
1551:
1552: IF pa_utils2.CheckExporg(X_incurred_by_org_id,X_ei_date) = 'N' then
1553:
1554: print_message('Stage:PATC:10.12.011');
1555: return_error( 'PA_EXP_ORG_NOT_ACTIVE');
1556: END IF;
1557:
1558: END IF; /* Added for Bug # 2170237 */
1563: -- Bug 6156072: Base Bug 6045051: start
1564: -- Bug 6156072: Base Bug 6045051: If condition introduced to check for person_type and then
1565: -- call corresponding procedure to check for termination
1566: IF (l_Person_Type = 'EMP') THEN
1567: patc.check_termination (X_person_id, x_ei_date, l_ac_termination_date);
1568: ELSIF (l_Person_Type = 'CWK') THEN
1569: patc.check_termination_for_cwk (X_person_id, x_ei_date, l_ac_termination_date);
1570: END IF;
1571: -- Bug 6156072: Base Bug 6045051: end
1565: -- call corresponding procedure to check for termination
1566: IF (l_Person_Type = 'EMP') THEN
1567: patc.check_termination (X_person_id, x_ei_date, l_ac_termination_date);
1568: ELSIF (l_Person_Type = 'CWK') THEN
1569: patc.check_termination_for_cwk (X_person_id, x_ei_date, l_ac_termination_date);
1570: END IF;
1571: -- Bug 6156072: Base Bug 6045051: end
1572: end if;
1573:
1578: END IF;
1579: /* Added for Bug#4604614 (BaseBug#4118885) -- End */
1580:
1581: IF ( X_org_id IS NULL ) THEN
1582: print_message('Stage:PATC:10.12.012');
1583: return_error( 'NO_ASSIGNMENT');
1584: END IF;
1585:
1586: IF pa_trx_import.g_skip_tc_flag <> 'Y' then /* Added for Bug # 2170237 */
1585:
1586: IF pa_trx_import.g_skip_tc_flag <> 'Y' then /* Added for Bug # 2170237 */
1587:
1588: IF pa_utils2.CheckExporg(X_org_id,X_ei_date) = 'N' then
1589: print_message('Stage:PATC:10.12.013');
1590: return_error( 'PA_EXP_ORG_NOT_ACTIVE');
1591: END IF;
1592: END IF; /* Added for Bug # 2170237 */
1593:
1595:
1596: -- Check for Non_labor_resource_org
1597:
1598: if ( X_nl_resource_org_id is NOT NULL ) then
1599: print_message('Stage:PATC:10.12.014');
1600: check_nlro_date ;
1601: end if ;
1602:
1603: END IF ; -- IF ( X_Calling_Module <> 'CreateRelatedItem')
1601: end if ;
1602:
1603: END IF ; -- IF ( X_Calling_Module <> 'CreateRelatedItem')
1604:
1605: patcx_bill_flag := temp_bill_flag;
1606:
1607: print_message('Stage:PATC:10.13.00:Calling patcx.tc_extension api');
1608:
1609: --Bug 3017533
1603: END IF ; -- IF ( X_Calling_Module <> 'CreateRelatedItem')
1604:
1605: patcx_bill_flag := temp_bill_flag;
1606:
1607: print_message('Stage:PATC:10.13.00:Calling patcx.tc_extension api');
1608:
1609: --Bug 3017533
1610: L_BeforeCE_AsgnId := PATC.G_OVERIDE_ASSIGNMENT_ID;
1611:
1606:
1607: print_message('Stage:PATC:10.13.00:Calling patcx.tc_extension api');
1608:
1609: --Bug 3017533
1610: L_BeforeCE_AsgnId := PATC.G_OVERIDE_ASSIGNMENT_ID;
1611:
1612: patcx.tc_extension(
1613: X_project_id => X_project_id
1614: , X_task_id => X_task_id
1608:
1609: --Bug 3017533
1610: L_BeforeCE_AsgnId := PATC.G_OVERIDE_ASSIGNMENT_ID;
1611:
1612: patcx.tc_extension(
1613: X_project_id => X_project_id
1614: , X_task_id => X_task_id
1615: , X_expenditure_item_date => X_ei_date
1616: , X_expenditure_type => X_expenditure_type
1647: , X_attribute13 => X_attribute13
1648: , X_attribute14 => X_attribute14
1649: , X_attribute15 => X_attribute15
1650: , X_msg_application => X_msg_application
1651: , X_billable_flag => patcx_bill_flag
1652: , X_msg_type => temp_msg_type
1653: , X_msg_token1 => temp_msg_token1
1654: , X_msg_token2 => temp_msg_token2
1655: , X_msg_token3 => temp_msg_token3
1658: , p_projfunc_currency_code => p_projfunc_currency_code
1659: , p_projfunc_cost_rate_type => p_projfunc_cost_rate_type
1660: , p_projfunc_cost_rate_date => p_projfunc_cost_rate_date
1661: , p_projfunc_cost_exchg_rate => p_projfunc_cost_exchg_rate
1662: , x_assignment_id => PATC.G_OVERIDE_ASSIGNMENT_ID
1663: , p_work_type_id => p_work_type_id
1664: , p_sys_link_function => p_sys_link_function
1665: , P_Po_Header_Id => P_Po_Header_Id
1666: , P_Po_Line_Id => P_Po_Line_Id
1689: , P_pa_ref_var8 => P_pa_ref_var8
1690: , P_pa_ref_var9 => P_pa_ref_var9
1691: , P_pa_ref_var10 => P_pa_ref_var10 );
1692:
1693: print_message('Stage:PATC:10.13.001');
1694: print_message('End of patcx.tc_extension api patcx_bill_flag :'||patcx_bill_flag||
1695: 'Assignment :'||PATC.G_OVERIDE_ASSIGNMENT_ID||'patcx_status['||temp_status||']');
1696:
1697: /*Start Bug4518893 */
1690: , P_pa_ref_var9 => P_pa_ref_var9
1691: , P_pa_ref_var10 => P_pa_ref_var10 );
1692:
1693: print_message('Stage:PATC:10.13.001');
1694: print_message('End of patcx.tc_extension api patcx_bill_flag :'||patcx_bill_flag||
1695: 'Assignment :'||PATC.G_OVERIDE_ASSIGNMENT_ID||'patcx_status['||temp_status||']');
1696:
1697: /*Start Bug4518893 */
1698: IF ( patcx_bill_flag = 'N' OR patcx_bill_flag = 'Y' ) THEN
1691: , P_pa_ref_var10 => P_pa_ref_var10 );
1692:
1693: print_message('Stage:PATC:10.13.001');
1694: print_message('End of patcx.tc_extension api patcx_bill_flag :'||patcx_bill_flag||
1695: 'Assignment :'||PATC.G_OVERIDE_ASSIGNMENT_ID||'patcx_status['||temp_status||']');
1696:
1697: /*Start Bug4518893 */
1698: IF ( patcx_bill_flag = 'N' OR patcx_bill_flag = 'Y' ) THEN
1699: X_billable_flag := patcx_bill_flag;
1694: print_message('End of patcx.tc_extension api patcx_bill_flag :'||patcx_bill_flag||
1695: 'Assignment :'||PATC.G_OVERIDE_ASSIGNMENT_ID||'patcx_status['||temp_status||']');
1696:
1697: /*Start Bug4518893 */
1698: IF ( patcx_bill_flag = 'N' OR patcx_bill_flag = 'Y' ) THEN
1699: X_billable_flag := patcx_bill_flag;
1700: ELSE
1701: X_billable_flag := temp_bill_flag;
1702: END IF;
1695: 'Assignment :'||PATC.G_OVERIDE_ASSIGNMENT_ID||'patcx_status['||temp_status||']');
1696:
1697: /*Start Bug4518893 */
1698: IF ( patcx_bill_flag = 'N' OR patcx_bill_flag = 'Y' ) THEN
1699: X_billable_flag := patcx_bill_flag;
1700: ELSE
1701: X_billable_flag := temp_bill_flag;
1702: END IF;
1703: /*End Bug4518893 */
1705: IF ( temp_status IS NOT NULL ) THEN
1706:
1707: If pa_trx_import.g_skip_tc_flag <> 'Y' then /* Added for Bug # 2108456 */
1708:
1709: print_message('Stage:PATC:10.13.002');
1710: X_msg_type := temp_msg_type;
1711: X_msg_count := temp_msg_count;
1712: X_msg_token1 := temp_msg_token1;
1713: X_msg_token2 := temp_msg_token2;
1720:
1721: CLOSE project_info;
1722:
1723: /* Start bug4518893
1724: IF ( patcx_bill_flag = 'N' OR patcx_bill_flag = 'Y' ) THEN
1725: X_billable_flag := patcx_bill_flag;
1726: ELSE
1727: X_billable_flag := temp_bill_flag;
1728: END IF;
1721: CLOSE project_info;
1722:
1723: /* Start bug4518893
1724: IF ( patcx_bill_flag = 'N' OR patcx_bill_flag = 'Y' ) THEN
1725: X_billable_flag := patcx_bill_flag;
1726: ELSE
1727: X_billable_flag := temp_bill_flag;
1728: END IF;
1729: End bug4518893 */
1729: End bug4518893 */
1730:
1731: /* Bug 2648550 starts */
1732: -- new work_type_id and tp_amt_type_code,assignment_name,work_type_name
1733: -- is derived using the new assignment_id all references to PATC to be changed
1734: -- to use the newly derived work_type_id,tp_amt_type_code,assignment_name,work_type_name
1735: --Bug 3017533, only if the asgn has changed from previous and assign_precedes_task is set
1736: --for all modules other than PAXTREPE then override the WT, TP amt type
1737:
1734: -- to use the newly derived work_type_id,tp_amt_type_code,assignment_name,work_type_name
1735: --Bug 3017533, only if the asgn has changed from previous and assign_precedes_task is set
1736: --for all modules other than PAXTREPE then override the WT, TP amt type
1737:
1738: If ( (nvl(PATC.G_OVERIDE_ASSIGNMENT_ID,0) <> nvl(L_BeforeCE_AsgnId,0)) and
1739: (proj.p_assign_precedes_task = 'Y') and
1740: (X_Calling_Module <> 'PAXTREPE') ) Then
1741:
1742: PATC.G_OVERIDE_WORK_TYPE_ID := PA_UTILS4.get_work_type_id (
1738: If ( (nvl(PATC.G_OVERIDE_ASSIGNMENT_ID,0) <> nvl(L_BeforeCE_AsgnId,0)) and
1739: (proj.p_assign_precedes_task = 'Y') and
1740: (X_Calling_Module <> 'PAXTREPE') ) Then
1741:
1742: PATC.G_OVERIDE_WORK_TYPE_ID := PA_UTILS4.get_work_type_id (
1743: p_project_id =>X_project_id
1744: , p_task_id =>X_task_id
1745: , p_assignment_id=>nvl(PATC.G_OVERIDE_ASSIGNMENT_ID,0) );
1746:
1741:
1742: PATC.G_OVERIDE_WORK_TYPE_ID := PA_UTILS4.get_work_type_id (
1743: p_project_id =>X_project_id
1744: , p_task_id =>X_task_id
1745: , p_assignment_id=>nvl(PATC.G_OVERIDE_ASSIGNMENT_ID,0) );
1746:
1747: PATC.G_OVERIDE_TP_AMT_TYPE_CODE := pa_utils4.get_tp_amt_type_code(
1748: p_work_type_id => PATC.G_OVERIDE_WORK_TYPE_ID );
1749:
1743: p_project_id =>X_project_id
1744: , p_task_id =>X_task_id
1745: , p_assignment_id=>nvl(PATC.G_OVERIDE_ASSIGNMENT_ID,0) );
1746:
1747: PATC.G_OVERIDE_TP_AMT_TYPE_CODE := pa_utils4.get_tp_amt_type_code(
1748: p_work_type_id => PATC.G_OVERIDE_WORK_TYPE_ID );
1749:
1750: PATC.G_OVERIDE_ASSIGNMENT_NAME := pa_utils4.get_assignment_name(
1751: p_assignment_id =>PATC.G_OVERIDE_ASSIGNMENT_ID);
1744: , p_task_id =>X_task_id
1745: , p_assignment_id=>nvl(PATC.G_OVERIDE_ASSIGNMENT_ID,0) );
1746:
1747: PATC.G_OVERIDE_TP_AMT_TYPE_CODE := pa_utils4.get_tp_amt_type_code(
1748: p_work_type_id => PATC.G_OVERIDE_WORK_TYPE_ID );
1749:
1750: PATC.G_OVERIDE_ASSIGNMENT_NAME := pa_utils4.get_assignment_name(
1751: p_assignment_id =>PATC.G_OVERIDE_ASSIGNMENT_ID);
1752:
1746:
1747: PATC.G_OVERIDE_TP_AMT_TYPE_CODE := pa_utils4.get_tp_amt_type_code(
1748: p_work_type_id => PATC.G_OVERIDE_WORK_TYPE_ID );
1749:
1750: PATC.G_OVERIDE_ASSIGNMENT_NAME := pa_utils4.get_assignment_name(
1751: p_assignment_id =>PATC.G_OVERIDE_ASSIGNMENT_ID);
1752:
1753: PATC.G_OVERIDE_WORK_TYPE_NAME := pa_utils4.get_work_type_name(
1754: p_work_type_id => PATC.G_OVERIDE_WORK_TYPE_ID);
1747: PATC.G_OVERIDE_TP_AMT_TYPE_CODE := pa_utils4.get_tp_amt_type_code(
1748: p_work_type_id => PATC.G_OVERIDE_WORK_TYPE_ID );
1749:
1750: PATC.G_OVERIDE_ASSIGNMENT_NAME := pa_utils4.get_assignment_name(
1751: p_assignment_id =>PATC.G_OVERIDE_ASSIGNMENT_ID);
1752:
1753: PATC.G_OVERIDE_WORK_TYPE_NAME := pa_utils4.get_work_type_name(
1754: p_work_type_id => PATC.G_OVERIDE_WORK_TYPE_ID);
1755:
1749:
1750: PATC.G_OVERIDE_ASSIGNMENT_NAME := pa_utils4.get_assignment_name(
1751: p_assignment_id =>PATC.G_OVERIDE_ASSIGNMENT_ID);
1752:
1753: PATC.G_OVERIDE_WORK_TYPE_NAME := pa_utils4.get_work_type_name(
1754: p_work_type_id => PATC.G_OVERIDE_WORK_TYPE_ID);
1755:
1756: -- start of projcurrency and EI attrib changes
1757: -- Override the Billable flag if the work type biilability is enabled
1750: PATC.G_OVERIDE_ASSIGNMENT_NAME := pa_utils4.get_assignment_name(
1751: p_assignment_id =>PATC.G_OVERIDE_ASSIGNMENT_ID);
1752:
1753: PATC.G_OVERIDE_WORK_TYPE_NAME := pa_utils4.get_work_type_name(
1754: p_work_type_id => PATC.G_OVERIDE_WORK_TYPE_ID);
1755:
1756: -- start of projcurrency and EI attrib changes
1757: -- Override the Billable flag if the work type biilability is enabled
1758: print_message('Stage:PATC:10.13.003');
1754: p_work_type_id => PATC.G_OVERIDE_WORK_TYPE_ID);
1755:
1756: -- start of projcurrency and EI attrib changes
1757: -- Override the Billable flag if the work type biilability is enabled
1758: print_message('Stage:PATC:10.13.003');
1759:
1760: X_billable_flag := PA_UTILS4.get_trxn_work_billabilty
1761: /* (p_work_type_id => p_work_type_id commented for bug 2648550 */
1762: /* Bug 2648550 used global variable in work_type_id parameter */
1759:
1760: X_billable_flag := PA_UTILS4.get_trxn_work_billabilty
1761: /* (p_work_type_id => p_work_type_id commented for bug 2648550 */
1762: /* Bug 2648550 used global variable in work_type_id parameter */
1763: (p_work_type_id => PATC.G_OVERIDE_WORK_TYPE_ID
1764: ,p_tc_extn_bill_flag => X_billable_flag);
1765: /* end of bug 2648550 */
1766:
1767: Else
1765: /* end of bug 2648550 */
1766:
1767: Else
1768:
1769: PATC.G_OVERIDE_WORK_TYPE_ID := p_work_type_id;
1770: PATC.G_OVERIDE_TP_AMT_TYPE_CODE := pa_utils4.get_tp_amt_type_code(
1771: p_work_type_id => p_work_type_id);
1772: PATC.G_OVERIDE_ASSIGNMENT_NAME := pa_utils4.get_assignment_name(
1773: p_assignment_id =>p_assignment_id);
1766:
1767: Else
1768:
1769: PATC.G_OVERIDE_WORK_TYPE_ID := p_work_type_id;
1770: PATC.G_OVERIDE_TP_AMT_TYPE_CODE := pa_utils4.get_tp_amt_type_code(
1771: p_work_type_id => p_work_type_id);
1772: PATC.G_OVERIDE_ASSIGNMENT_NAME := pa_utils4.get_assignment_name(
1773: p_assignment_id =>p_assignment_id);
1774: PATC.G_OVERIDE_WORK_TYPE_NAME := pa_utils4.get_work_type_name(
1768:
1769: PATC.G_OVERIDE_WORK_TYPE_ID := p_work_type_id;
1770: PATC.G_OVERIDE_TP_AMT_TYPE_CODE := pa_utils4.get_tp_amt_type_code(
1771: p_work_type_id => p_work_type_id);
1772: PATC.G_OVERIDE_ASSIGNMENT_NAME := pa_utils4.get_assignment_name(
1773: p_assignment_id =>p_assignment_id);
1774: PATC.G_OVERIDE_WORK_TYPE_NAME := pa_utils4.get_work_type_name(
1775: p_work_type_id => p_work_type_id);
1776:
1770: PATC.G_OVERIDE_TP_AMT_TYPE_CODE := pa_utils4.get_tp_amt_type_code(
1771: p_work_type_id => p_work_type_id);
1772: PATC.G_OVERIDE_ASSIGNMENT_NAME := pa_utils4.get_assignment_name(
1773: p_assignment_id =>p_assignment_id);
1774: PATC.G_OVERIDE_WORK_TYPE_NAME := pa_utils4.get_work_type_name(
1775: p_work_type_id => p_work_type_id);
1776:
1777: -- start of projcurrency and EI attrib changes
1778: -- Override the Billable flag if the work type biilability is enabled
1775: p_work_type_id => p_work_type_id);
1776:
1777: -- start of projcurrency and EI attrib changes
1778: -- Override the Billable flag if the work type biilability is enabled
1779: print_message('Stage:PATC:10.13.004');
1780: X_billable_flag := PA_UTILS4.get_trxn_work_billabilty
1781: (p_work_type_id => p_work_type_id
1782: ,p_tc_extn_bill_flag => X_billable_flag);
1783:
1786:
1787:
1788: -- end of projcurrency and EI attrib changes
1789:
1790: print_message('Stage:PATC:10.13.005');
1791: print_message('Billable Flag after override:['||X_billable_flag||
1792: ']override assn:['||PATC.G_OVERIDE_ASSIGNMENT_ID||']x_status ['||x_status||']');
1793:
1794: -- Begin PA.L Retirement Cost Processing changes
1788: -- end of projcurrency and EI attrib changes
1789:
1790: print_message('Stage:PATC:10.13.005');
1791: print_message('Billable Flag after override:['||X_billable_flag||
1792: ']override assn:['||PATC.G_OVERIDE_ASSIGNMENT_ID||']x_status ['||x_status||']');
1793:
1794: -- Begin PA.L Retirement Cost Processing changes
1795: print_message('Stage:PATC:10.14.00: Check capitalizable_flag against retirement_cost_flag');
1796: If pa_trx_import.g_skip_tc_flag <> 'Y' then
1791: print_message('Billable Flag after override:['||X_billable_flag||
1792: ']override assn:['||PATC.G_OVERIDE_ASSIGNMENT_ID||']x_status ['||x_status||']');
1793:
1794: -- Begin PA.L Retirement Cost Processing changes
1795: print_message('Stage:PATC:10.14.00: Check capitalizable_flag against retirement_cost_flag');
1796: If pa_trx_import.g_skip_tc_flag <> 'Y' then
1797:
1798: If proj.p_proj_typ_class_code = 'CAPITAL' and
1799: proj.t_ret_cost_flag = 'Y' and
1818: WHEN OTHERS THEN
1819: Pa_Trx_Import.G_Skip_Tc_Flag := G_TRX_SKIP_FLAG;
1820: X_status := SQLCODE;
1821: X_billable_flag := NULL;
1822: print_message('Failed in GET_PATC api sqlerror:'||X_status);
1823:
1824: END get_status;
1825:
1826:
1909:
1910: end check_termination_for_cwk;
1911: -- Bug 6156072: Base Bug 6045051: end
1912:
1913: END PATC;