[Home] [Help]
835: -- Refer to Update "16-JAN-04 sagarwal" in the history above.
836: -- This has been added as part of code merge
837: -- This procedure deletes the Financial Planning data pertaining
838: -- to the project id given as input parameter from
839: -- 1. pa_fp_txn_currencies
840: -- 2. pa_proj_fp_options
841: -- 3. pa_fp_elements
842: -- 4. pa_proj_period_profiles
843: --==========================================================================
842: -- 4. pa_proj_period_profiles
843: --==========================================================================
844:
845: procedure Delete_Fp_Options(
846: p_project_id IN PA_FP_TXN_CURRENCIES.PROJECT_ID%TYPE
847: , x_err_code IN OUT NOCOPY NUMBER) --File.Sql.39 bug 4440895
848: is
849: begin
850:
850:
851: -- delete from pa_proj_fp_options table
852: delete from pa_proj_fp_options where project_id=p_project_id;
853:
854: -- delete from pa_fp_txn_currencies table
855: delete from pa_fp_txn_currencies where project_id=p_project_id;
856:
857: /* Changes for FPM, Tracking Bug No - 3354518
858: Commenting out code below for delete statment from pa_fp_elements
851: -- delete from pa_proj_fp_options table
852: delete from pa_proj_fp_options where project_id=p_project_id;
853:
854: -- delete from pa_fp_txn_currencies table
855: delete from pa_fp_txn_currencies where project_id=p_project_id;
856:
857: /* Changes for FPM, Tracking Bug No - 3354518
858: Commenting out code below for delete statment from pa_fp_elements
859: as this table is getting obsoleted */
892: --=========================================================================
893: --bug #3224177
894: -- Refer to Update "16-JAN-04 sagarwal" in the history above.
895: -- This has been added as part of code merge
896: -- This procedure updates the Project Currency in pa_fp_txn_currencies
897: -- whenever Porject currency is updated
898:
899: -- FP M Phase II Development
900: -- Bug 3583619
907: -- options of the project should be updated when this api is called.
908: -- Rewritten the complete api to update multiple options
909: --==========================================================================
910: PROCEDURE Update_Txn_Currencies
911: (p_project_id IN PA_FP_TXN_CURRENCIES.PROJECT_ID%TYPE
912: ,p_proj_curr_code IN PA_FP_TXN_CURRENCIES.TXN_CURRENCY_CODE%TYPE)
913: is
914: cursor get_all_fp_options_cur is
915: select proj_fp_options_id
908: -- Rewritten the complete api to update multiple options
909: --==========================================================================
910: PROCEDURE Update_Txn_Currencies
911: (p_project_id IN PA_FP_TXN_CURRENCIES.PROJECT_ID%TYPE
912: ,p_proj_curr_code IN PA_FP_TXN_CURRENCIES.TXN_CURRENCY_CODE%TYPE)
913: is
914: cursor get_all_fp_options_cur is
915: select proj_fp_options_id
916: from pa_proj_fp_options
920:
921: cursor get_project_currency (c_proj_fp_options_id NUMBER)is
922: select fp_txn_currency_id,
923: txn_currency_code
924: from pa_fp_txn_currencies
925: where project_id = p_project_id
926: and project_currency_flag='Y'
927: and proj_fp_options_id = c_proj_fp_options_id;
928:
928:
929: cursor get_proj_func_currency (c_proj_fp_options_id NUMBER)is
930: select fp_txn_currency_id,
931: txn_currency_code
932: from pa_fp_txn_currencies
933: where project_id = p_project_id
934: and projfunc_currency_flag='Y'
935: and proj_fp_options_id = c_proj_fp_options_id;
936:
935: and proj_fp_options_id = c_proj_fp_options_id;
936:
937: cursor check_proj_currency_exists (c_proj_fp_options_id NUMBER)is
938: select fp_txn_currency_id
939: from pa_fp_txn_currencies
940: where project_id = p_project_id
941: and txn_currency_code = p_proj_curr_code
942: and project_currency_flag='N'
943: and proj_fp_options_id = c_proj_fp_options_id;
949: INDEX BY BINARY_INTEGER;
950: l_plan_in_multi_curr_tbl plan_in_multi_curr_tbl;
951: cnt NUMBER := 0;
952:
953: l_proj_curr_code pa_fp_txn_currencies.txn_currency_code%TYPE;
954: l_projfunc_curr_code pa_fp_txn_currencies.txn_currency_code%TYPE;
955: l_txn_currency_id NUMBER;
956: l_pc_currency_id NUMBER;
957: l_pfc_currency_id NUMBER;
950: l_plan_in_multi_curr_tbl plan_in_multi_curr_tbl;
951: cnt NUMBER := 0;
952:
953: l_proj_curr_code pa_fp_txn_currencies.txn_currency_code%TYPE;
954: l_projfunc_curr_code pa_fp_txn_currencies.txn_currency_code%TYPE;
955: l_txn_currency_id NUMBER;
956: l_pc_currency_id NUMBER;
957: l_pfc_currency_id NUMBER;
958:
997: if (l_txn_currency_id is not NULL) then
998:
999: -- delete the old project currency
1000:
1001: delete from pa_fp_txn_currencies
1002: where fp_txn_currency_id = l_txn_currency_id;
1003:
1004: -- check if the new project currency selected by user is PFC
1005: if (l_pfc_currency_id <> l_txn_currency_id) then
1003:
1004: -- check if the new project currency selected by user is PFC
1005: if (l_pfc_currency_id <> l_txn_currency_id) then
1006:
1007: update pa_fp_txn_currencies
1008: set txn_currency_code = p_proj_curr_code
1009: where fp_txn_currency_id = l_pc_currency_id;
1010:
1011: else
1010:
1011: else
1012: -- new PC selected by user is PFC
1013:
1014: update pa_fp_txn_currencies
1015: set txn_currency_code = p_proj_curr_code,
1016: projfunc_currency_flag = 'Y'
1017: where fp_txn_currency_id = l_pc_currency_id;
1018: end if; -- END FOR l_pfc_currency_id <> l_txn_currency_id
1016: projfunc_currency_flag = 'Y'
1017: where fp_txn_currency_id = l_pc_currency_id;
1018: end if; -- END FOR l_pfc_currency_id <> l_txn_currency_id
1019: else
1020: update pa_fp_txn_currencies
1021: set txn_currency_code = p_proj_curr_code
1022: where fp_txn_currency_id = l_pc_currency_id;
1023:
1024: end if;
1025: else
1026: -- project currency and project functional currency are the same
1027: -- update PC flag to N
1028:
1029: update pa_fp_txn_currencies
1030: set project_currency_flag='N'
1031: where fp_txn_currency_id = l_pc_currency_id;
1032:
1033: if (l_txn_currency_id is not NULL) then
1031: where fp_txn_currency_id = l_pc_currency_id;
1032:
1033: if (l_txn_currency_id is not NULL) then
1034: -- if already existing txn currency is selected as PC
1035: update pa_fp_txn_currencies
1036: set project_currency_flag='Y'
1037: where fp_txn_currency_id = l_txn_currency_id;
1038: else
1039: -- insert the new PC
1037: where fp_txn_currency_id = l_txn_currency_id;
1038: else
1039: -- insert the new PC
1040:
1041: INSERT INTO PA_FP_TXN_CURRENCIES (
1042: fp_txn_currency_id
1043: ,proj_fp_options_id
1044: ,project_id
1045: ,fin_plan_type_id
1059: ,project_rev_exchange_rate
1060: ,projfunc_cost_exchange_Rate
1061: ,projfunc_rev_exchange_Rate
1062: )
1063: SELECT pa_fp_txn_currencies_s.NEXTVAL
1064: , PROJ_FP_OPTIONS_ID
1065: , PROJECT_ID
1066: , FIN_PLAN_TYPE_ID
1067: , FIN_PLAN_VERSION_ID
1079: , PROJECT_COST_EXCHANGE_RATE
1080: , PROJECT_REV_EXCHANGE_RATE
1081: , PROJFUNC_COST_EXCHANGE_RATE
1082: , PROJFUNC_REV_EXCHANGE_RATE
1083: FROM PA_FP_TXN_CURRENCIES
1084: where fp_txn_currency_id = l_pc_currency_id;
1085: end if; -- l_txn_currency_id is not NULL ends
1086: end if; -- l_proj_curr_code <> l_projfunc_curr_code ends
1087: end if; -- trim(l_proj_curr_code) <> trim(p_proj_curr_code)
2816: END Check_Version_Name_Or_Id;
2817:
2818: PROCEDURE Check_Currency_Name_Or_Code
2819: (
2820: p_txn_currency_code IN pa_fp_txn_currencies.txn_currency_code%TYPE
2821: ,p_currency_code_name IN VARCHAR2
2822: ,p_check_id_flag IN VARCHAR2
2823: ,x_txn_currency_code OUT NOCOPY pa_fp_txn_currencies.txn_currency_code%TYPE --File.Sql.39 bug 4440895
2824: ,x_return_status OUT NOCOPY VARCHAR2 --File.Sql.39 bug 4440895
2819: (
2820: p_txn_currency_code IN pa_fp_txn_currencies.txn_currency_code%TYPE
2821: ,p_currency_code_name IN VARCHAR2
2822: ,p_check_id_flag IN VARCHAR2
2823: ,x_txn_currency_code OUT NOCOPY pa_fp_txn_currencies.txn_currency_code%TYPE --File.Sql.39 bug 4440895
2824: ,x_return_status OUT NOCOPY VARCHAR2 --File.Sql.39 bug 4440895
2825: ,x_msg_count OUT NOCOPY NUMBER --File.Sql.39 bug 4440895
2826: ,x_msg_data OUT NOCOPY VARCHAR2 --File.Sql.39 bug 4440895
2827: ) IS
2837:
2838: IF p_check_id_flag = 'Y' THEN
2839: SELECT txn_currency_code
2840: INTO x_txn_currency_code
2841: FROM pa_fp_txn_currencies
2842: WHERE txn_currency_code = p_txn_currency_code;
2843: ELSIF p_check_id_flag = 'N' THEN
2844: x_txn_currency_code := p_txn_currency_code;
2845: END IF;
3534: return VARCHAR2 is
3535: l_return VARCHAR2(1) := 'N';
3536: BEGIN
3537: /* Bug 3106741
3538: Modified the second exists clause to avoid FT scan on pa_fp_txn_currencies
3539: table. As an index is available on proj_fp_options_id for the above table,
3540: pa_proj_fp_options table has been included to fetch all the options that
3541: belong to a given project.
3542: */
3563: pa.project_id = p_project_id and
3564: pfo.fin_plan_option_level_code = 'PLAN_TYPE');
3565: /* commented for bug 3224177 starts
3566: OR exists (Select 'x'
3567: from pa_fp_txn_currencies fpcurr,
3568: pa_proj_fp_options pfo, -- bug 3106741
3569: pa_projects_all pa
3570: where pa.project_currency_code = fpcurr.txn_currency_code
3571: and pa.project_id = fpcurr.project_id