19: l_revenue NUMBER := 0;
20: l_margin NUMBER := 0;
21: l_margin_percent NUMBER := 0;
22: begin
23: select SUM(DECODE(pa_fp_view_plans_pub.G_FP_CALC_MARGIN_FROM,
24: 'R', DECODE(amount_subtype,
25: 'RAW_COST', nvl(period_amount1, 0) + nvl(period_amount2, 0) +
26: nvl(period_amount3, 0) + nvl(period_amount4, 0) +
27: nvl(period_amount5, 0) + nvl(period_amount6, 0) +
24: 'R', DECODE(amount_subtype,
25: 'RAW_COST', nvl(period_amount1, 0) + nvl(period_amount2, 0) +
26: nvl(period_amount3, 0) + nvl(period_amount4, 0) +
27: nvl(period_amount5, 0) + nvl(period_amount6, 0) +
28: DECODE(pa_fp_view_plans_pub.Get_Prec_Pds_Flag,
29: 'Y', nvl(preceding_periods_amount,0),
30: 0) +
31: DECODE(pa_fp_view_plans_pub.Get_Succ_Pds_Flag,
32: 'Y', nvl(succeeding_periods_amount,0),
27: nvl(period_amount5, 0) + nvl(period_amount6, 0) +
28: DECODE(pa_fp_view_plans_pub.Get_Prec_Pds_Flag,
29: 'Y', nvl(preceding_periods_amount,0),
30: 0) +
31: DECODE(pa_fp_view_plans_pub.Get_Succ_Pds_Flag,
32: 'Y', nvl(succeeding_periods_amount,0),
33: 0),
34: 0),
35: DECODE(amount_subtype,
35: DECODE(amount_subtype,
36: 'BURDENED_COST', nvl(period_amount1, 0) + nvl(period_amount2, 0) +
37: nvl(period_amount3, 0) + nvl(period_amount4, 0) +
38: nvl(period_amount5, 0) + nvl(period_amount6, 0) +
39: DECODE(pa_fp_view_plans_pub.Get_Prec_Pds_Flag,
40: 'Y', nvl(preceding_periods_amount,0),
41: 0) +
42: DECODE(pa_fp_view_plans_pub.Get_Succ_Pds_Flag,
43: 'Y', nvl(succeeding_periods_amount,0),
38: nvl(period_amount5, 0) + nvl(period_amount6, 0) +
39: DECODE(pa_fp_view_plans_pub.Get_Prec_Pds_Flag,
40: 'Y', nvl(preceding_periods_amount,0),
41: 0) +
42: DECODE(pa_fp_view_plans_pub.Get_Succ_Pds_Flag,
43: 'Y', nvl(succeeding_periods_amount,0),
44: 0),
45: 0))),
46: SUM(DECODE(amount_subtype,
46: SUM(DECODE(amount_subtype,
47: 'REVENUE', nvl(period_amount1, 0) + nvl(period_amount2, 0) +
48: nvl(period_amount3, 0) + nvl(period_amount4, 0) +
49: nvl(period_amount5, 0) + nvl(period_amount6, 0) +
50: DECODE(pa_fp_view_plans_pub.Get_Prec_Pds_Flag,
51: 'Y', nvl(preceding_periods_amount,0),
52: 0) +
53: DECODE(pa_fp_view_plans_pub.Get_Succ_Pds_Flag,
54: 'Y', nvl(succeeding_periods_amount,0),
49: nvl(period_amount5, 0) + nvl(period_amount6, 0) +
50: DECODE(pa_fp_view_plans_pub.Get_Prec_Pds_Flag,
51: 'Y', nvl(preceding_periods_amount,0),
52: 0) +
53: DECODE(pa_fp_view_plans_pub.Get_Succ_Pds_Flag,
54: 'Y', nvl(succeeding_periods_amount,0),
55: 0),
56: 0))
57: into l_burdened_cost,
89: l_margin_percent NUMBER := 0;
90: begin
91: -- bug fix 2746025: calculate margin from RAW_COST or BURDENED_COST based
92: -- on margin_derived_from_code
93: select SUM(DECODE(pa_fp_view_plans_pub.G_FP_CALC_MARGIN_FROM,
94: 'R', DECODE(amount_subtype,
95: 'RAW_COST', nvl(period_amount1, 0) + nvl(period_amount2, 0) +
96: nvl(period_amount3, 0) + nvl(period_amount4, 0) +
97: nvl(period_amount5, 0) + nvl(period_amount6, 0) +
98: nvl(period_amount7, 0) + nvl(period_amount8, 0) +
99: nvl(period_amount9, 0) + nvl(period_amount10, 0) +
100: nvl(period_amount11, 0) + nvl(period_amount12, 0) +
101: nvl(period_amount13, 0) +
102: DECODE(pa_fp_view_plans_pub.Get_Prec_Pds_Flag,
103: 'Y', nvl(preceding_periods_amount,0),
104: 0) +
105: DECODE(pa_fp_view_plans_pub.Get_Succ_Pds_Flag,
106: 'Y', nvl(succeeding_periods_amount,0),
101: nvl(period_amount13, 0) +
102: DECODE(pa_fp_view_plans_pub.Get_Prec_Pds_Flag,
103: 'Y', nvl(preceding_periods_amount,0),
104: 0) +
105: DECODE(pa_fp_view_plans_pub.Get_Succ_Pds_Flag,
106: 'Y', nvl(succeeding_periods_amount,0),
107: 0),
108: 0),
109: DECODE(amount_subtype,
113: nvl(period_amount7, 0) + nvl(period_amount8, 0) +
114: nvl(period_amount9, 0) + nvl(period_amount10, 0) +
115: nvl(period_amount11, 0) + nvl(period_amount12, 0) +
116: nvl(period_amount13, 0) +
117: DECODE(pa_fp_view_plans_pub.Get_Prec_Pds_Flag,
118: 'Y', nvl(preceding_periods_amount,0),
119: 0) +
120: DECODE(pa_fp_view_plans_pub.Get_Succ_Pds_Flag,
121: 'Y', nvl(succeeding_periods_amount,0),
116: nvl(period_amount13, 0) +
117: DECODE(pa_fp_view_plans_pub.Get_Prec_Pds_Flag,
118: 'Y', nvl(preceding_periods_amount,0),
119: 0) +
120: DECODE(pa_fp_view_plans_pub.Get_Succ_Pds_Flag,
121: 'Y', nvl(succeeding_periods_amount,0),
122: 0),
123: 0))),
124: SUM(DECODE(amount_subtype,
128: nvl(period_amount7, 0) + nvl(period_amount8, 0) +
129: nvl(period_amount9, 0) + nvl(period_amount10, 0) +
130: nvl(period_amount11, 0) + nvl(period_amount12, 0) +
131: nvl(period_amount13, 0) +
132: DECODE(pa_fp_view_plans_pub.Get_Prec_Pds_Flag,
133: 'Y', nvl(preceding_periods_amount,0),
134: 0) +
135: DECODE(pa_fp_view_plans_pub.Get_Succ_Pds_Flag,
136: 'Y', nvl(succeeding_periods_amount,0),
131: nvl(period_amount13, 0) +
132: DECODE(pa_fp_view_plans_pub.Get_Prec_Pds_Flag,
133: 'Y', nvl(preceding_periods_amount,0),
134: 0) +
135: DECODE(pa_fp_view_plans_pub.Get_Succ_Pds_Flag,
136: 'Y', nvl(succeeding_periods_amount,0),
137: 0),
138: 0))
139: into l_burdened_cost,
220: l_res_parent_member_id pa_resource_list_members.parent_member_id%TYPE;
221: BEGIN
222: l_return_value := -1;
223: -- NEED TO ACCOUNT FOR PROJECT AND TASK LEVEL ROWS THAT ARE USER-ENTERED
224: if p_resource_list_member_id = pa_fp_view_plans_pub.Get_Uncat_Res_List_Member_Id then
225: if p_task_id = 0 then
226: -- this is a PROJECT row
227: l_return_value := 1;
228: else
332:
333: BEGIN
334: l_return_value := -1;
335: -- NEED TO ACCOUNT FOR PROJECT AND TASK LEVEL ROWS THAT ARE USER-ENTERED
336: if p_resource_list_member_id = pa_fp_view_plans_pub.Get_Uncat_Res_List_Member_Id then
337: if p_task_id = 0 then
338: -- this is a PROJECT ROW
339: l_return_value := 'NONE';
340: else
490:
491: BEGIN
492: l_return_value := 'dummy element name';
493: -- NEED TO ACCOUNT FOR PROJECT AND TASK LEVEL ROWS THAT ARE USER-ENTERED
494: if p_resource_list_member_id = pa_fp_view_plans_pub.Get_Uncat_Res_List_Member_Id then
495: if p_task_id = 0 then
496: -- retrieve PROJECT NAME
497: select name || ' (' || segment1 || ')'
498: into l_return_value
578: BEGIN
579: l_return_value := 'dummy element level';
580:
581: -- NEED TO ACCOUNT FOR PROJECT AND TASK LEVEL ROWS THAT ARE USER-ENTERED
582: if p_resource_list_member_id = pa_fp_view_plans_pub.Get_Uncat_Res_List_Member_Id then
583: if p_task_id = 0 then
584: l_return_value := 'PROJECT';
585: else
586: l_return_value := 'TASK';
794: when others then
795: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
796: x_msg_count := 1;
797: x_msg_data := SQLERRM;
798: FND_MSG_PUB.add_exc_msg( p_pkg_name => 'PA_FP_VIEW_PLANS_PUB',
799: p_procedure_name => 'Assign_Default_Amount');
800: pa_debug.reset_err_stack;
801: return;
802: END assign_default_amount;
822: into l_return_value
823: from pa_budget_lines bl
824: where bl.resource_assignment_id = p_resource_assignment_id
825: and bl.budget_version_id = p_budget_version_id
826: and trunc(bl.start_date) = pa_fp_view_plans_pub.Get_Period_Start_Date1();
827:
828: elsif p_period_number = 2 then
829:
830: select sum(decode(p_amount_type_id, 215, bl.quantity, 160, decode(p_project_currency_type, 'PROJECT', bl.project_raw_cost, bl.raw_cost),
832: into l_return_value
833: from pa_budget_lines bl
834: where bl.resource_assignment_id = p_resource_assignment_id
835: and bl.budget_version_id = p_budget_version_id
836: and trunc(bl.start_date) = pa_fp_view_plans_pub.Get_Period_Start_Date2();
837:
838: elsif p_period_number = 3 then
839:
840: select sum(decode(p_amount_type_id, 215, bl.quantity, 160, decode(p_project_currency_type, 'PROJECT', bl.project_raw_cost, bl.raw_cost),
842: into l_return_value
843: from pa_budget_lines bl
844: where bl.resource_assignment_id = p_resource_assignment_id
845: and bl.budget_version_id = p_budget_version_id
846: and trunc(bl.start_date) = pa_fp_view_plans_pub.Get_Period_Start_Date3();
847:
848: elsif p_period_number = 4 then
849:
850: select sum(decode(p_amount_type_id, 215, bl.quantity, 160, decode(p_project_currency_type, 'PROJECT', bl.project_raw_cost, bl.raw_cost),
852: into l_return_value
853: from pa_budget_lines bl
854: where bl.resource_assignment_id = p_resource_assignment_id
855: and bl.budget_version_id = p_budget_version_id
856: and trunc(bl.start_date) = pa_fp_view_plans_pub.Get_Period_Start_Date4();
857:
858: elsif p_period_number = 5 then
859:
860: select sum(decode(p_amount_type_id, 215, bl.quantity, 160, decode(p_project_currency_type, 'PROJECT', bl.project_raw_cost, bl.raw_cost),
862: into l_return_value
863: from pa_budget_lines bl
864: where bl.resource_assignment_id = p_resource_assignment_id
865: and bl.budget_version_id = p_budget_version_id
866: and trunc(bl.start_date) = pa_fp_view_plans_pub.Get_Period_Start_Date5();
867:
868: elsif p_period_number = 6 then
869:
870: select sum(decode(p_amount_type_id, 215, bl.quantity, 160, decode(p_project_currency_type, 'PROJECT', bl.project_raw_cost, bl.raw_cost),
872: into l_return_value
873: from pa_budget_lines bl
874: where bl.resource_assignment_id = p_resource_assignment_id
875: and bl.budget_version_id = p_budget_version_id
876: and trunc(bl.start_date) = pa_fp_view_plans_pub.Get_Period_Start_Date6();
877:
878: elsif p_period_number = 7 then
879:
880: select sum(decode(p_amount_type_id, 215, bl.quantity, 160, decode(p_project_currency_type, 'PROJECT', bl.project_raw_cost, bl.raw_cost),
882: into l_return_value
883: from pa_budget_lines bl
884: where bl.resource_assignment_id = p_resource_assignment_id
885: and bl.budget_version_id = p_budget_version_id
886: and trunc(bl.start_date) = pa_fp_view_plans_pub.Get_Period_Start_Date7();
887:
888: elsif p_period_number = 8 then
889:
890: select sum(decode(p_amount_type_id, 215, bl.quantity, 160, decode(p_project_currency_type, 'PROJECT', bl.project_raw_cost, bl.raw_cost),
892: into l_return_value
893: from pa_budget_lines bl
894: where bl.resource_assignment_id = p_resource_assignment_id
895: and bl.budget_version_id = p_budget_version_id
896: and trunc(bl.start_date) = pa_fp_view_plans_pub.Get_Period_Start_Date8();
897:
898: elsif p_period_number = 9 then
899:
900: select sum(decode(p_amount_type_id, 215, bl.quantity, 160, decode(p_project_currency_type, 'PROJECT', bl.project_raw_cost, bl.raw_cost),
902: into l_return_value
903: from pa_budget_lines bl
904: where bl.resource_assignment_id = p_resource_assignment_id
905: and bl.budget_version_id = p_budget_version_id
906: and trunc(bl.start_date) = pa_fp_view_plans_pub.Get_Period_Start_Date9();
907:
908: elsif p_period_number = 10 then
909:
910: select sum(decode(p_amount_type_id, 215, bl.quantity, 160, decode(p_project_currency_type, 'PROJECT', bl.project_raw_cost, bl.raw_cost),
912: into l_return_value
913: from pa_budget_lines bl
914: where bl.resource_assignment_id = p_resource_assignment_id
915: and bl.budget_version_id = p_budget_version_id
916: and trunc(bl.start_date) = pa_fp_view_plans_pub.Get_Period_Start_Date10();
917:
918: elsif p_period_number = 11 then
919:
920: select sum(decode(p_amount_type_id, 215, bl.quantity, 160, decode(p_project_currency_type, 'PROJECT', bl.project_raw_cost, bl.raw_cost),
922: into l_return_value
923: from pa_budget_lines bl
924: where bl.resource_assignment_id = p_resource_assignment_id
925: and bl.budget_version_id = p_budget_version_id
926: and trunc(bl.start_date) = pa_fp_view_plans_pub.Get_Period_Start_Date11();
927:
928: elsif p_period_number = 12 then
929:
930: select sum(decode(p_amount_type_id, 215, bl.quantity, 160, decode(p_project_currency_type, 'PROJECT', bl.project_raw_cost, bl.raw_cost),
932: into l_return_value
933: from pa_budget_lines bl
934: where bl.resource_assignment_id = p_resource_assignment_id
935: and bl.budget_version_id = p_budget_version_id
936: and trunc(bl.start_date) = pa_fp_view_plans_pub.Get_Period_Start_Date12();
937:
938: elsif p_period_number = 13 then
939:
940: select sum(decode(p_amount_type_id, 215, bl.quantity, 160, decode(p_project_currency_type, 'PROJECT', bl.project_raw_cost, bl.raw_cost),
942: into l_return_value
943: from pa_budget_lines bl
944: where bl.resource_assignment_id = p_resource_assignment_id
945: and bl.budget_version_id = p_budget_version_id
946: and trunc(bl.start_date) = pa_fp_view_plans_pub.Get_Period_Start_Date13();
947: end if;
948:
949: return l_return_value;
950:
983: l_return_value NUMBER;
984:
985: begin
986: --hr_utility.trace('entering');
987: --hr_utility.trace('date= ' || pa_fp_view_plans_pub.Get_Period_Start_Date1());
988: -- *** PERFORMANCE ISSUE 2773408: get budget_version_id to use index
989: -- PA_PROJECT_PERIODS_DENORM_N1
990:
991: if p_period_number = 1 then
988: -- *** PERFORMANCE ISSUE 2773408: get budget_version_id to use index
989: -- PA_PROJECT_PERIODS_DENORM_N1
990:
991: if p_period_number = 1 then
992: select SUM(DECODE(pa_fp_view_plans_pub.Get_Period_Start_Date1(),
993: pppp.period1_start_Date, nvl(pppd.period_amount1,0),
994: pppp.period2_start_Date, nvl(pppd.period_amount2,0),
995: pppp.period3_start_Date, nvl(pppd.period_amount3,0),
996: pppp.period4_start_Date, nvl(pppd.period_amount4,0),
1055: (p_amount_type_id <> 215 and pppd.currency_type = p_project_currency_type));
1056: --group by pppd.amount_subtype_id;
1057:
1058: elsif p_period_number = 2 then
1059: select SUM(DECODE(pa_fp_view_plans_pub.Get_Period_Start_Date2(),
1060: pppp.period1_start_Date, nvl(pppd.period_amount1,0),
1061: pppp.period2_start_Date, nvl(pppd.period_amount2,0),
1062: pppp.period3_start_Date, nvl(pppd.period_amount3,0),
1063: pppp.period4_start_Date, nvl(pppd.period_amount4,0),
1122: (p_amount_type_id <> 215 and pppd.currency_type = p_project_currency_type));
1123: --group by pppd.amount_subtype_id;
1124:
1125: elsif p_period_number = 3 then
1126: select SUM(DECODE(pa_fp_view_plans_pub.Get_Period_Start_Date3(),
1127: pppp.period1_start_Date, nvl(pppd.period_amount1,0),
1128: pppp.period2_start_Date, nvl(pppd.period_amount2,0),
1129: pppp.period3_start_Date, nvl(pppd.period_amount3,0),
1130: pppp.period4_start_Date, nvl(pppd.period_amount4,0),
1189: (p_amount_type_id <> 215 and pppd.currency_type = p_project_currency_type));
1190: --group by pppd.amount_subtype_id;
1191:
1192: elsif p_period_number = 4 then
1193: select SUM(DECODE(pa_fp_view_plans_pub.Get_Period_Start_Date4(),
1194: pppp.period1_start_Date, nvl(pppd.period_amount1,0),
1195: pppp.period2_start_Date, nvl(pppd.period_amount2,0),
1196: pppp.period3_start_Date, nvl(pppd.period_amount3,0),
1197: pppp.period4_start_Date, nvl(pppd.period_amount4,0),
1256: (p_amount_type_id <> 215 and pppd.currency_type = p_project_currency_type));
1257: --group by pppd.amount_subtype_id;
1258:
1259: elsif p_period_number = 5 then
1260: select SUM(DECODE(pa_fp_view_plans_pub.Get_Period_Start_Date5(),
1261: pppp.period1_start_Date, nvl(pppd.period_amount1,0),
1262: pppp.period2_start_Date, nvl(pppd.period_amount2,0),
1263: pppp.period3_start_Date, nvl(pppd.period_amount3,0),
1264: pppp.period4_start_Date, nvl(pppd.period_amount4,0),
1323: (p_amount_type_id <> 215 and pppd.currency_type = p_project_currency_type));
1324: --group by pppd.amount_subtype_id;
1325:
1326: elsif p_period_number = 6 then
1327: select SUM(DECODE(pa_fp_view_plans_pub.Get_Period_Start_Date6(),
1328: pppp.period1_start_Date, nvl(pppd.period_amount1,0),
1329: pppp.period2_start_Date, nvl(pppd.period_amount2,0),
1330: pppp.period3_start_Date, nvl(pppd.period_amount3,0),
1331: pppp.period4_start_Date, nvl(pppd.period_amount4,0),
1390: (p_amount_type_id <> 215 and pppd.currency_type = p_project_currency_type));
1391: --group by pppd.amount_subtype_id;
1392:
1393: elsif p_period_number = 7 then
1394: select SUM(DECODE(pa_fp_view_plans_pub.Get_Period_Start_Date7(),
1395: pppp.period1_start_Date, nvl(pppd.period_amount1,0),
1396: pppp.period2_start_Date, nvl(pppd.period_amount2,0),
1397: pppp.period3_start_Date, nvl(pppd.period_amount3,0),
1398: pppp.period4_start_Date, nvl(pppd.period_amount4,0),
1457: (p_amount_type_id <> 215 and pppd.currency_type = p_project_currency_type));
1458: --group by pppd.amount_subtype_id;
1459:
1460: elsif p_period_number = 8 then
1461: select SUM(DECODE(pa_fp_view_plans_pub.Get_Period_Start_Date8(),
1462: pppp.period1_start_Date, nvl(pppd.period_amount1,0),
1463: pppp.period2_start_Date, nvl(pppd.period_amount2,0),
1464: pppp.period3_start_Date, nvl(pppd.period_amount3,0),
1465: pppp.period4_start_Date, nvl(pppd.period_amount4,0),
1524: (p_amount_type_id <> 215 and pppd.currency_type = p_project_currency_type));
1525: --group by pppd.amount_subtype_id;
1526:
1527: elsif p_period_number = 9 then
1528: select SUM(DECODE(pa_fp_view_plans_pub.Get_Period_Start_Date9(),
1529: pppp.period1_start_Date, nvl(pppd.period_amount1,0),
1530: pppp.period2_start_Date, nvl(pppd.period_amount2,0),
1531: pppp.period3_start_Date, nvl(pppd.period_amount3,0),
1532: pppp.period4_start_Date, nvl(pppd.period_amount4,0),
1591: (p_amount_type_id <> 215 and pppd.currency_type = p_project_currency_type));
1592: --group by pppd.amount_subtype_id;
1593:
1594: elsif p_period_number = 10 then
1595: select SUM(DECODE(pa_fp_view_plans_pub.Get_Period_Start_Date10(),
1596: pppp.period1_start_Date, nvl(pppd.period_amount1,0),
1597: pppp.period2_start_Date, nvl(pppd.period_amount2,0),
1598: pppp.period3_start_Date, nvl(pppd.period_amount3,0),
1599: pppp.period4_start_Date, nvl(pppd.period_amount4,0),
1658: (p_amount_type_id <> 215 and pppd.currency_type = p_project_currency_type));
1659: --group by pppd.amount_subtype_id;
1660:
1661: elsif p_period_number = 11 then
1662: select SUM(DECODE(pa_fp_view_plans_pub.Get_Period_Start_Date11(),
1663: pppp.period1_start_Date, nvl(pppd.period_amount1,0),
1664: pppp.period2_start_Date, nvl(pppd.period_amount2,0),
1665: pppp.period3_start_Date, nvl(pppd.period_amount3,0),
1666: pppp.period4_start_Date, nvl(pppd.period_amount4,0),
1725: (p_amount_type_id <> 215 and pppd.currency_type = p_project_currency_type));
1726: --group by pppd.amount_subtype_id;
1727:
1728: elsif p_period_number = 12 then
1729: select SUM(DECODE(pa_fp_view_plans_pub.Get_Period_Start_Date12(),
1730: pppp.period1_start_Date, nvl(pppd.period_amount1,0),
1731: pppp.period2_start_Date, nvl(pppd.period_amount2,0),
1732: pppp.period3_start_Date, nvl(pppd.period_amount3,0),
1733: pppp.period4_start_Date, nvl(pppd.period_amount4,0),
1792: (p_amount_type_id <> 215 and pppd.currency_type = p_project_currency_type));
1793: --group by pppd.amount_subtype_id;
1794:
1795: elsif p_period_number = 13 then
1796: select SUM(DECODE(pa_fp_view_plans_pub.Get_Period_Start_Date13(),
1797: pppp.period1_start_Date, nvl(pppd.period_amount1,0),
1798: pppp.period2_start_Date, nvl(pppd.period_amount2,0),
1799: pppp.period3_start_Date, nvl(pppd.period_amount3,0),
1800: pppp.period4_start_Date, nvl(pppd.period_amount4,0),
1922: -- we use SUM(DECODE) because for COST or REVENUE amount type, there's
1923: -- one AMOUNT_SUBTYPE_ID which will require us to subtract instead of add
1924: -- COST: TP_COST_OUT (185)
1925: -- REVENUE: TP_REVENUE_OUT (120)
1926: --hr_utility.trace('pa_fp_view_plans_pub.Get_Period_Start_Date1()= ' ||
1927: to_char(pa_fp_view_plans_pub.Get_Period_Start_Date1()));
1928: if p_period_number = 1 then
1929: select SUM(DECODE(pa_fp_view_plans_pub.Get_Period_Start_Date1(),
1930: pppp.period1_start_Date, DECODE(pppd.amount_subtype_id,
1923: -- one AMOUNT_SUBTYPE_ID which will require us to subtract instead of add
1924: -- COST: TP_COST_OUT (185)
1925: -- REVENUE: TP_REVENUE_OUT (120)
1926: --hr_utility.trace('pa_fp_view_plans_pub.Get_Period_Start_Date1()= ' ||
1927: to_char(pa_fp_view_plans_pub.Get_Period_Start_Date1()));
1928: if p_period_number = 1 then
1929: select SUM(DECODE(pa_fp_view_plans_pub.Get_Period_Start_Date1(),
1930: pppp.period1_start_Date, DECODE(pppd.amount_subtype_id,
1931: 185, -pppd.period_amount1,
1925: -- REVENUE: TP_REVENUE_OUT (120)
1926: --hr_utility.trace('pa_fp_view_plans_pub.Get_Period_Start_Date1()= ' ||
1927: to_char(pa_fp_view_plans_pub.Get_Period_Start_Date1()));
1928: if p_period_number = 1 then
1929: select SUM(DECODE(pa_fp_view_plans_pub.Get_Period_Start_Date1(),
1930: pppp.period1_start_Date, DECODE(pppd.amount_subtype_id,
1931: 185, -pppd.period_amount1,
1932: 120, -pppd.period_amount1,
1933: pppd.period_amount1),
2145: pppd.currency_type = p_project_currency_type
2146: group by pppd.amount_type_id;
2147:
2148: elsif p_period_number = 2 then
2149: select SUM(DECODE(pa_fp_view_plans_pub.Get_Period_Start_Date2(),
2150: pppp.period1_start_Date, DECODE(pppd.amount_subtype_id,
2151: 185, -pppd.period_amount1,
2152: 120, -pppd.period_amount1,
2153: pppd.period_amount1),
2365: pppd.currency_type = p_project_currency_type
2366: group by pppd.amount_type_id;
2367:
2368: elsif p_period_number = 3 then
2369: select SUM(DECODE(pa_fp_view_plans_pub.Get_Period_Start_Date3(),
2370: pppp.period1_start_Date, DECODE(pppd.amount_subtype_id,
2371: 185, -pppd.period_amount1,
2372: 120, -pppd.period_amount1,
2373: pppd.period_amount1),
2585: pppd.currency_type = p_project_currency_type
2586: group by pppd.amount_type_id;
2587:
2588: elsif p_period_number = 4 then
2589: select SUM(DECODE(pa_fp_view_plans_pub.Get_Period_Start_Date4(),
2590: pppp.period1_start_Date, DECODE(pppd.amount_subtype_id,
2591: 185, -pppd.period_amount1,
2592: 120, -pppd.period_amount1,
2593: pppd.period_amount1),
2805: pppd.currency_type = p_project_currency_type
2806: group by pppd.amount_type_id;
2807:
2808: elsif p_period_number = 5 then
2809: select SUM(DECODE(pa_fp_view_plans_pub.Get_Period_Start_Date5(),
2810: pppp.period1_start_Date, DECODE(pppd.amount_subtype_id,
2811: 185, -pppd.period_amount1,
2812: 120, -pppd.period_amount1,
2813: pppd.period_amount1),
3025: pppd.currency_type = p_project_currency_type
3026: group by pppd.amount_type_id;
3027:
3028: elsif p_period_number = 6 then
3029: select SUM(DECODE(pa_fp_view_plans_pub.Get_Period_Start_Date6(),
3030: pppp.period1_start_Date, DECODE(pppd.amount_subtype_id,
3031: 185, -pppd.period_amount1,
3032: 120, -pppd.period_amount1,
3033: pppd.period_amount1),
3245: pppd.currency_type = p_project_currency_type
3246: group by pppd.amount_type_id;
3247:
3248: elsif p_period_number = 7 then
3249: select SUM(DECODE(pa_fp_view_plans_pub.Get_Period_Start_Date7(),
3250: pppp.period1_start_Date, DECODE(pppd.amount_subtype_id,
3251: 185, -pppd.period_amount1,
3252: 120, -pppd.period_amount1,
3253: pppd.period_amount1),
3465: pppd.currency_type = p_project_currency_type
3466: group by pppd.amount_type_id;
3467:
3468: elsif p_period_number = 8 then
3469: select SUM(DECODE(pa_fp_view_plans_pub.Get_Period_Start_Date8(),
3470: pppp.period1_start_Date, DECODE(pppd.amount_subtype_id,
3471: 185, -pppd.period_amount1,
3472: 120, -pppd.period_amount1,
3473: pppd.period_amount1),
3685: pppd.currency_type = p_project_currency_type
3686: group by pppd.amount_type_id;
3687:
3688: elsif p_period_number = 9 then
3689: select SUM(DECODE(pa_fp_view_plans_pub.Get_Period_Start_Date9(),
3690: pppp.period1_start_Date, DECODE(pppd.amount_subtype_id,
3691: 185, -pppd.period_amount1,
3692: 120, -pppd.period_amount1,
3693: pppd.period_amount1),
3905: pppd.currency_type = p_project_currency_type
3906: group by pppd.amount_type_id;
3907:
3908: elsif p_period_number = 10 then
3909: select SUM(DECODE(pa_fp_view_plans_pub.Get_Period_Start_Date10(),
3910: pppp.period1_start_Date, DECODE(pppd.amount_subtype_id,
3911: 185, -pppd.period_amount1,
3912: 120, -pppd.period_amount1,
3913: pppd.period_amount1),
4125: pppd.currency_type = p_project_currency_type
4126: group by pppd.amount_type_id;
4127:
4128: elsif p_period_number = 11 then
4129: select SUM(DECODE(pa_fp_view_plans_pub.Get_Period_Start_Date11(),
4130: pppp.period1_start_Date, DECODE(pppd.amount_subtype_id,
4131: 185, -pppd.period_amount1,
4132: 120, -pppd.period_amount1,
4133: pppd.period_amount1),
4345: pppd.currency_type = p_project_currency_type
4346: group by pppd.amount_type_id;
4347:
4348: elsif p_period_number = 12 then
4349: select SUM(DECODE(pa_fp_view_plans_pub.Get_Period_Start_Date12(),
4350: pppp.period1_start_Date, DECODE(pppd.amount_subtype_id,
4351: 185, -pppd.period_amount1,
4352: 120, -pppd.period_amount1,
4353: pppd.period_amount1),
4565: pppd.currency_type = p_project_currency_type
4566: group by pppd.amount_type_id;
4567:
4568: elsif p_period_number = 13 then
4569: select SUM(DECODE(pa_fp_view_plans_pub.Get_Period_Start_Date13(),
4570: pppp.period1_start_Date, DECODE(pppd.amount_subtype_id,
4571: 185, -pppd.period_amount1,
4572: 120, -pppd.period_amount1,
4573: pppd.period_amount1),