3:
4: PROCEDURE Create_REPORT_REGION
5: (
6: p_api_version IN NUMBER := 1.0,
7: p_init_msg_list IN VARCHAR2 := fnd_api.g_true,
8: p_commit IN VARCHAR2 := FND_API.g_false,
9: p_validate_only IN VARCHAR2 := FND_API.g_true,
10: p_max_msg_count IN NUMBER := FND_API.g_miss_num,
11:
4: PROCEDURE Create_REPORT_REGION
5: (
6: p_api_version IN NUMBER := 1.0,
7: p_init_msg_list IN VARCHAR2 := fnd_api.g_true,
8: p_commit IN VARCHAR2 := FND_API.g_false,
9: p_validate_only IN VARCHAR2 := FND_API.g_true,
10: p_max_msg_count IN NUMBER := FND_API.g_miss_num,
11:
12: p_version_id IN NUMBER,
5: (
6: p_api_version IN NUMBER := 1.0,
7: p_init_msg_list IN VARCHAR2 := fnd_api.g_true,
8: p_commit IN VARCHAR2 := FND_API.g_false,
9: p_validate_only IN VARCHAR2 := FND_API.g_true,
10: p_max_msg_count IN NUMBER := FND_API.g_miss_num,
11:
12: p_version_id IN NUMBER,
13: P_REGION_SOURCE_TYPE in VARCHAR2 default 'STD',
6: p_api_version IN NUMBER := 1.0,
7: p_init_msg_list IN VARCHAR2 := fnd_api.g_true,
8: p_commit IN VARCHAR2 := FND_API.g_false,
9: p_validate_only IN VARCHAR2 := FND_API.g_true,
10: p_max_msg_count IN NUMBER := FND_API.g_miss_num,
11:
12: p_version_id IN NUMBER,
13: P_REGION_SOURCE_TYPE in VARCHAR2 default 'STD',
14: P_REGION_CODE in VARCHAR2,
83: -- Initialize the Error Stack
84: PA_DEBUG.init_err_stack('PA_PROGRESS_REPORT_PVT.Create_Report_Region');
85:
86: -- Initialize the return status to success
87: x_return_status := FND_API.G_RET_STS_SUCCESS;
88:
89: -- Issue API savepoint if the transaction is to be committed
90: IF p_commit = FND_API.G_TRUE THEN
91: SAVEPOINT Create_Report_Region;
86: -- Initialize the return status to success
87: x_return_status := FND_API.G_RET_STS_SUCCESS;
88:
89: -- Issue API savepoint if the transaction is to be committed
90: IF p_commit = FND_API.G_TRUE THEN
91: SAVEPOINT Create_Report_Region;
92: END IF;
93:
94:
102: IF l_status <> 'PROGRESS_REPORT_WORKING' THEN
103:
104: PA_UTILS.Add_Message( p_app_short_name => 'PA'
105: ,p_msg_name => 'PA_PR_STATUS_NOT_WORKING');
106: x_return_status := FND_API.G_RET_STS_ERROR;
107:
108: ELSE
109:
110: IF (p_region_code IS NULL) then
109:
110: IF (p_region_code IS NULL) then
111: PA_UTILS.Add_Message( p_app_short_name => 'PA'
112: ,p_msg_name => 'PA_REGION_CODE_INV');
113: x_return_status := FND_API.G_RET_STS_ERROR;
114: END IF;
115:
116: END IF;
117:
114: END IF;
115:
116: END IF;
117:
118: IF x_return_status <> FND_API.g_ret_sts_success THEN
119: PA_DEBUG.Reset_Err_Stack;
120: RETURN;
121: END IF;
122:
130: PA_UTILS.Add_Message( p_app_short_name => 'PA'
131: ,p_msg_name => 'PA_PR_VERSION_ID_INV'
132: , p_token1 => 'TEMPLATE_TYPE'
133: , p_value1 => l_type);
134: x_return_status := FND_API.G_RET_STS_ERROR;
135: END IF;
136:
137:
138: IF (x_return_status = FND_API.g_ret_sts_success AND p_validate_only <>FND_API.g_true) THEN
134: x_return_status := FND_API.G_RET_STS_ERROR;
135: END IF;
136:
137:
138: IF (x_return_status = FND_API.g_ret_sts_success AND p_validate_only <>FND_API.g_true) THEN
139: -- we insert to the pa_object_page_values
140:
141: -- IF p_record_sequence IS NULL THEN
142: -- SELECT pa_object_page_versions_s.NEXTVAL
201: END IF;
202:
203: -- update percent complete table
204:
205: IF (x_return_status = FND_API.g_ret_sts_success) then
206: --IF p_region_code = 'PA_PROGRESS_PROJ_DATES_TOP_IN' THEN
207: -- todo demo
208: IF p_region_code = 'PA_PROGRESS_PROJECT_DATES' then
209: --update_project_perccomplete(p_version_id,
215: END IF;
216: END IF;
217:
218: -- Commit if the flag is set and there is no error
219: IF (p_commit = FND_API.G_TRUE AND x_return_status = FND_API.g_ret_sts_success )THEN
220: COMMIT;
221: END IF;
222:
223: -- Reset the error stack when returning to the calling program
225:
226:
227: EXCEPTION
228: WHEN OTHERS THEN
229: IF p_commit = FND_API.G_TRUE THEN
230: ROLLBACK TO Create_Progress_Report;
231: END IF;
232: --
233: -- Set the excetption Message and the stack
233: -- Set the excetption Message and the stack
234: FND_MSG_PUB.add_exc_msg ( p_pkg_name => 'PA_Progress_Report_PVT.Create_Progress_Report'
235: ,p_procedure_name => PA_DEBUG.G_Err_Stack );
236: --
237: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
238: RAISE; -- This is optional depending on the needs
239:
240: END create_report_region;
241:
244: PROCEDURE Update_REPORT_REGION
245: (
246:
247: p_api_version IN NUMBER := 1.0,
248: p_init_msg_list IN VARCHAR2 := fnd_api.g_true,
249: p_commit IN VARCHAR2 := FND_API.g_false,
250: p_validate_only IN VARCHAR2 := FND_API.g_true,
251: p_max_msg_count IN NUMBER := FND_API.g_miss_num,
252:
245: (
246:
247: p_api_version IN NUMBER := 1.0,
248: p_init_msg_list IN VARCHAR2 := fnd_api.g_true,
249: p_commit IN VARCHAR2 := FND_API.g_false,
250: p_validate_only IN VARCHAR2 := FND_API.g_true,
251: p_max_msg_count IN NUMBER := FND_API.g_miss_num,
252:
253: P_VERSION_ID in NUMBER,
246:
247: p_api_version IN NUMBER := 1.0,
248: p_init_msg_list IN VARCHAR2 := fnd_api.g_true,
249: p_commit IN VARCHAR2 := FND_API.g_false,
250: p_validate_only IN VARCHAR2 := FND_API.g_true,
251: p_max_msg_count IN NUMBER := FND_API.g_miss_num,
252:
253: P_VERSION_ID in NUMBER,
254: P_REGION_SOURCE_TYPE in VARCHAR2,
247: p_api_version IN NUMBER := 1.0,
248: p_init_msg_list IN VARCHAR2 := fnd_api.g_true,
249: p_commit IN VARCHAR2 := FND_API.g_false,
250: p_validate_only IN VARCHAR2 := FND_API.g_true,
251: p_max_msg_count IN NUMBER := FND_API.g_miss_num,
252:
253: P_VERSION_ID in NUMBER,
254: P_REGION_SOURCE_TYPE in VARCHAR2,
255: P_REGION_CODE in VARCHAR2,
333: -- Initialize the Error Stack
334: PA_DEBUG.init_err_stack('PA_PROGRESS_REPORT_PVT.Update_Report_Region');
335:
336: -- Initialize the return status to success
337: x_return_status := FND_API.G_RET_STS_SUCCESS;
338:
339: -- Issue API savepoint if the transaction is to be committed
340: IF p_commit = FND_API.G_TRUE THEN
341: SAVEPOINT Update_Report_Region;
336: -- Initialize the return status to success
337: x_return_status := FND_API.G_RET_STS_SUCCESS;
338:
339: -- Issue API savepoint if the transaction is to be committed
340: IF p_commit = FND_API.G_TRUE THEN
341: SAVEPOINT Update_Report_Region;
342: END IF;
343:
344: OPEN get_template_type;
350: PA_UTILS.Add_Message( p_app_short_name => 'PA'
351: ,p_msg_name => 'PA_PR_VERSION_ID_INV'
352: , p_token1 => 'TEMPLATE_TYPE'
353: , p_value1 => l_type);
354: x_return_status := FND_API.G_RET_STS_ERROR;
355: END IF;
356: --Check mandatory region source type
357: IF (p_region_source_type IS NULL OR
358: p_region_source_type NOT IN ('STD','DFF', 'STD_CUST')) then
359: PA_UTILS.Add_Message( p_app_short_name => 'PA'
360: ,p_msg_name => 'PA_PR_REGION_SRC_INV'
361: , p_token1 => 'TEMPLATE_TYPE'
362: , p_value1 => l_type);
363: x_return_status := FND_API.G_RET_STS_ERROR;
364: END IF;
365:
366: -- check mandatory region_code
367: IF (p_region_code IS NULL) then
366: -- check mandatory region_code
367: IF (p_region_code IS NULL) then
368: PA_UTILS.Add_Message( p_app_short_name => 'PA'
369: ,p_msg_name => 'PA_REGION_CODE_INV');
370: x_return_status := FND_API.G_RET_STS_ERROR;
371: END IF;
372:
373: -- check mandatory record_sequence
374: IF (p_record_sequence IS NULL) then
375: PA_UTILS.Add_Message( p_app_short_name => 'PA'
376: ,p_msg_name => 'PA_PR_RECORD_SEQUENCE_INV'
377: , p_token1 => 'TEMPLATE_TYPE'
378: , p_value1 => l_type);
379: x_return_status := FND_API.G_RET_STS_ERROR;
380: RETURN;
381:
382: END IF;
383:
392: IF l_status <> 'PROGRESS_REPORT_WORKING' THEN
393:
394: PA_UTILS.Add_Message( p_app_short_name => 'PA'
395: ,p_msg_name => 'PA_PR_STATUS_NOT_WORKING');
396: x_return_status := FND_API.G_RET_STS_ERROR;
397: RETURN;
398:
399: END IF;
400:
407:
408: PA_UTILS.Add_Message( p_app_short_name => 'PA'
409: ,p_msg_name => 'PA_PR_RECORD_CHANGED');
410:
411: x_return_status := FND_API.G_RET_STS_ERROR;
412:
413: END IF;
414:
415: CLOSE check_record_version;
414:
415: CLOSE check_record_version;
416:
417:
418: IF (p_validate_only <>FND_API.g_true AND x_return_status = FND_API.g_ret_sts_success) THEN
419:
420: --debug_msg ('In UPdate report region **********************');
421:
422:
493: END IF;
494:
495: -- update percent complete table
496:
497: IF (p_validate_only <>FND_API.g_true AND x_return_status = FND_API.g_ret_sts_success) THEN
498:
499: --debug_msg ('update percent complete ');
500: --debug_msg ('region_code ' || p_region_code);
501: --IF p_region_code = 'PA_PROGRESS_PROJ_DATES_TOP_IN' then
510:
511: END IF;
512: END IF;
513:
514: IF (p_validate_only <>FND_API.g_true AND x_return_status = FND_API.g_ret_sts_success) THEN
515: UPDATE pa_progress_report_vers
516: SET summary_version_number = summary_version_number +1
517: WHERE version_id = p_version_id;
518:
519: END IF;
520:
521:
522: -- Commit if the flag is set and there is no error
523: IF (p_commit = FND_API.G_TRUE AND x_return_status = FND_API.g_ret_sts_success) THEN
524: COMMIT;
525: END IF;
526:
527: -- Reset the error stack when returning to the calling program
534: EXCEPTION
535: WHEN OTHERS THEN
536:
537: --debug_msg ('update percent complete: exception ');
538: IF p_commit = FND_API.G_TRUE THEN
539: ROLLBACK TO update_report_region;
540: END IF;
541: --
542: -- Set the excetption Message and the stack
542: -- Set the excetption Message and the stack
543: FND_MSG_PUB.add_exc_msg ( p_pkg_name => 'PA_PROGRESS_REPORT_PVT.Update_Progress_Report'
544: ,p_procedure_name => PA_DEBUG.G_Err_Stack );
545: --
546: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
547: RAISE; -- This is optional depending on the needs
548:
549: END update_report_region;
550:
550:
551: PROCEDURE Delete_Report_Region
552: (
553: p_api_version IN NUMBER := 1.0,
554: p_init_msg_list IN VARCHAR2 := fnd_api.g_true,
555: p_commit IN VARCHAR2 := FND_API.g_false,
556: p_validate_only IN VARCHAR2 := FND_API.g_true,
557: p_max_msg_count IN NUMBER := FND_API.g_miss_num,
558:
551: PROCEDURE Delete_Report_Region
552: (
553: p_api_version IN NUMBER := 1.0,
554: p_init_msg_list IN VARCHAR2 := fnd_api.g_true,
555: p_commit IN VARCHAR2 := FND_API.g_false,
556: p_validate_only IN VARCHAR2 := FND_API.g_true,
557: p_max_msg_count IN NUMBER := FND_API.g_miss_num,
558:
559: p_version_id IN number,
552: (
553: p_api_version IN NUMBER := 1.0,
554: p_init_msg_list IN VARCHAR2 := fnd_api.g_true,
555: p_commit IN VARCHAR2 := FND_API.g_false,
556: p_validate_only IN VARCHAR2 := FND_API.g_true,
557: p_max_msg_count IN NUMBER := FND_API.g_miss_num,
558:
559: p_version_id IN number,
560: P_REGION_SOURCE_TYPE in VARCHAR2,
553: p_api_version IN NUMBER := 1.0,
554: p_init_msg_list IN VARCHAR2 := fnd_api.g_true,
555: p_commit IN VARCHAR2 := FND_API.g_false,
556: p_validate_only IN VARCHAR2 := FND_API.g_true,
557: p_max_msg_count IN NUMBER := FND_API.g_miss_num,
558:
559: p_version_id IN number,
560: P_REGION_SOURCE_TYPE in VARCHAR2,
561: P_REGION_CODE in VARCHAR2,
600: -- Initialize the Error Stack
601: PA_DEBUG.init_err_stack('PA_PROGRESS_REPORT_PVT.Update_Report_Region');
602:
603: -- Initialize the return status to success
604: x_return_status := FND_API.G_RET_STS_SUCCESS;
605:
606: -- Issue API savepoint if the transaction is to be committed
607: IF p_commit = FND_API.G_TRUE THEN
608: SAVEPOINT Delete_Progress_Report;
603: -- Initialize the return status to success
604: x_return_status := FND_API.G_RET_STS_SUCCESS;
605:
606: -- Issue API savepoint if the transaction is to be committed
607: IF p_commit = FND_API.G_TRUE THEN
608: SAVEPOINT Delete_Progress_Report;
609: END IF;
610:
611: OPEN get_template_type;
617: PA_UTILS.Add_Message( p_app_short_name => 'PA'
618: ,p_msg_name => 'PA_PR_VERSION_ID_INV'
619: , p_token1 => 'TEMPLATE_TYPE'
620: , p_value1 => l_type);
621: x_return_status := FND_API.G_RET_STS_ERROR;
622: END IF;
623:
624: --Check mandatory region source type
625: IF (p_region_source_type IS NULL OR
627: PA_UTILS.Add_Message( p_app_short_name => 'PA'
628: ,p_msg_name => 'PA_PR_REGION_SRC_INV'
629: , p_token1 => 'TEMPLATE_TYPE'
630: , p_value1 => l_type);
631: x_return_status := FND_API.G_RET_STS_ERROR;
632: END IF;
633:
634: -- check mandatory region_code
635: IF (p_region_code IS NULL) then
634: -- check mandatory region_code
635: IF (p_region_code IS NULL) then
636: PA_UTILS.Add_Message( p_app_short_name => 'PA'
637: ,p_msg_name => 'PA_REGION_CODE_INV');
638: x_return_status := FND_API.G_RET_STS_ERROR;
639: END IF;
640:
641: -- if the report in WORKING status, we continue
642: -- otherwise, we quit
648: IF l_status <> 'PROGRESS_REPORT_WORKING' THEN
649:
650: PA_UTILS.Add_Message( p_app_short_name => 'PA'
651: ,p_msg_name => 'PA_PR_STATUS_NOT_WORKING');
652: x_return_status := FND_API.G_RET_STS_ERROR;
653: RETURN;
654:
655: END IF;
656:
660: PA_UTILS.Add_Message( p_app_short_name => 'PA'
661: ,p_msg_name => 'PA_PR_RECORD_SEQUENCE_INV'
662: , p_token1 => 'TEMPLATE_TYPE'
663: , p_value1 => l_type);
664: x_return_status := FND_API.G_RET_STS_ERROR;
665: END IF;
666: */
667:
668: IF (p_validate_only <>FND_API.g_true AND x_return_status = FND_API.g_ret_sts_success) THEN
664: x_return_status := FND_API.G_RET_STS_ERROR;
665: END IF;
666: */
667:
668: IF (p_validate_only <>FND_API.g_true AND x_return_status = FND_API.g_ret_sts_success) THEN
669: IF (p_record_sequence IS null) THEN
670: pa_progress_report_pkg.delete_progress_report_region(
671: P_VERSION_ID,
672: P_REGION_SOURCE_TYPE,
692: END IF;
693:
694:
695: -- Commit if the flag is set and there is no error
696: IF (p_commit = FND_API.G_TRUE AND x_return_status = FND_API.G_RET_STS_SUCCESS ) THEN
697: COMMIT;
698: END IF;
699:
700: -- Reset the error stack when returning to the calling program
702:
703:
704: EXCEPTION
705: WHEN OTHERS THEN
706: IF p_commit = FND_API.G_TRUE THEN
707: ROLLBACK TO Delete_Progress_Report;
708: END IF;
709:
710: -- Set the excetption Message and the stack
710: -- Set the excetption Message and the stack
711: FND_MSG_PUB.add_exc_msg( p_pkg_name => 'PA_PROGRESS_Report_PVT.Delete_Progress_Report'
712: ,p_procedure_name => PA_DEBUG.G_Err_Stack );
713: --
714: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
715: RAISE; -- This is optional depending on the needs
716:
717: END delete_report_region;
718:
719:
720: PROCEDURE cancel_report
721: (
722: p_api_version IN NUMBER := 1.0,
723: p_init_msg_list IN VARCHAR2 := fnd_api.g_true,
724: p_commit IN VARCHAR2 := FND_API.g_false,
725: p_validate_only IN VARCHAR2 := FND_API.g_true,
726: p_max_msg_count IN NUMBER := FND_API.g_miss_num,
727:
720: PROCEDURE cancel_report
721: (
722: p_api_version IN NUMBER := 1.0,
723: p_init_msg_list IN VARCHAR2 := fnd_api.g_true,
724: p_commit IN VARCHAR2 := FND_API.g_false,
725: p_validate_only IN VARCHAR2 := FND_API.g_true,
726: p_max_msg_count IN NUMBER := FND_API.g_miss_num,
727:
728: p_version_id IN NUMBER :=NULL,
721: (
722: p_api_version IN NUMBER := 1.0,
723: p_init_msg_list IN VARCHAR2 := fnd_api.g_true,
724: p_commit IN VARCHAR2 := FND_API.g_false,
725: p_validate_only IN VARCHAR2 := FND_API.g_true,
726: p_max_msg_count IN NUMBER := FND_API.g_miss_num,
727:
728: p_version_id IN NUMBER :=NULL,
729: p_record_version_number IN NUMBER := NULL,
722: p_api_version IN NUMBER := 1.0,
723: p_init_msg_list IN VARCHAR2 := fnd_api.g_true,
724: p_commit IN VARCHAR2 := FND_API.g_false,
725: p_validate_only IN VARCHAR2 := FND_API.g_true,
726: p_max_msg_count IN NUMBER := FND_API.g_miss_num,
727:
728: p_version_id IN NUMBER :=NULL,
729: p_record_version_number IN NUMBER := NULL,
730: p_cancel_comments IN VARCHAR2 := NULL,
795: -- Initialize the Error Stack
796: PA_DEBUG.init_err_stack('PA_PROGRESS_REPORT_PVT.Cancel_Report');
797:
798: -- Initialize the return status to success
799: x_return_status := FND_API.G_RET_STS_SUCCESS;
800:
801: -- Issue API savepoint if the transaction is to be committed
802: IF p_commit = FND_API.G_TRUE THEN
803: SAVEPOINT cancel_report;
798: -- Initialize the return status to success
799: x_return_status := FND_API.G_RET_STS_SUCCESS;
800:
801: -- Issue API savepoint if the transaction is to be committed
802: IF p_commit = FND_API.G_TRUE THEN
803: SAVEPOINT cancel_report;
804: END IF;
805:
806: OPEN get_template_type;
812: PA_UTILS.Add_Message( p_app_short_name => 'PA'
813: ,p_msg_name => 'PA_PR_VERSION_ID_INV'
814: , p_token1 => 'TEMPLATE_TYPE'
815: , p_value1 => l_type);
816: x_return_status := FND_API.G_RET_STS_ERROR;
817: END IF;
818:
819: -- can only obsolete the published report
820: IF x_return_status = FND_API.g_ret_sts_success THEN
816: x_return_status := FND_API.G_RET_STS_ERROR;
817: END IF;
818:
819: -- can only obsolete the published report
820: IF x_return_status = FND_API.g_ret_sts_success THEN
821:
822: OPEN check_status_published;
823: FETCH check_status_published INTO l_rowid;
824:
825: IF check_status_published%NOTFOUND THEN
826: PA_UTILS.Add_Message( p_app_short_name => 'PA'
827: ,p_msg_name => 'PA_OBSOLETE_REPORT_INV');
828:
829: x_return_status := FND_API.G_RET_STS_ERROR;
830:
831: ELSE
832: CLOSE check_status_published;
833: END IF;
834:
835: END IF;
836:
837: -- change the status of report to obsoleted.
838: IF (p_validate_only <>FND_API.g_true AND x_return_status = FND_API.g_ret_sts_success) then
839:
840: /* pa_progress_report_pkg.UPDATE_PROGRESS_REPORT_VER_ROW
841: (
842: p_version_id,
882: ) ;
883:
884: END IF;
885:
886: if ( x_return_status = FND_API.g_ret_sts_success )THEN
887:
888: if (l_current_flag = 'Y') then
889: open update_last_published_rep;
890: fetch update_last_published_rep into l_version_id,l_RECORD_VERSION_NUMBER,l_summary_version_number;
923:
924:
925:
926: -- Commit if the flag is set and there is no error
927: IF (p_commit = FND_API.G_TRUE AND x_return_status = FND_API.g_ret_sts_success )THEN
928: COMMIT;
929: END IF;
930:
931: -- Reset the error stack when returning to the calling program
933:
934:
935: EXCEPTION
936: WHEN OTHERS THEN
937: IF p_commit = FND_API.G_TRUE THEN
938: ROLLBACK TO cancel_report;
939: END IF;
940: --
941: -- Set the excetption Message and the stack
941: -- Set the excetption Message and the stack
942: FND_MSG_PUB.add_exc_msg ( p_pkg_name => 'PA_PROGRESS_REPORT_PVT.Cancel_Report'
943: ,p_procedure_name => PA_DEBUG.G_Err_Stack );
944: --
945: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
946: RAISE; -- This is optional depending on the needs
947:
948:
949: END cancel_report;
949: END cancel_report;
950:
951: PROCEDURE approve_report (
952: p_api_version IN NUMBER := 1.0,
953: p_init_msg_list IN VARCHAR2 := fnd_api.g_true,
954: p_commit IN VARCHAR2 := FND_API.g_false,
955: p_validate_only IN VARCHAR2 := FND_API.g_true,
956: p_max_msg_count IN NUMBER := FND_API.g_miss_num,
957:
950:
951: PROCEDURE approve_report (
952: p_api_version IN NUMBER := 1.0,
953: p_init_msg_list IN VARCHAR2 := fnd_api.g_true,
954: p_commit IN VARCHAR2 := FND_API.g_false,
955: p_validate_only IN VARCHAR2 := FND_API.g_true,
956: p_max_msg_count IN NUMBER := FND_API.g_miss_num,
957:
958: p_version_id IN NUMBER := null,
951: PROCEDURE approve_report (
952: p_api_version IN NUMBER := 1.0,
953: p_init_msg_list IN VARCHAR2 := fnd_api.g_true,
954: p_commit IN VARCHAR2 := FND_API.g_false,
955: p_validate_only IN VARCHAR2 := FND_API.g_true,
956: p_max_msg_count IN NUMBER := FND_API.g_miss_num,
957:
958: p_version_id IN NUMBER := null,
959: p_record_version_number IN NUMBER := NULL,
952: p_api_version IN NUMBER := 1.0,
953: p_init_msg_list IN VARCHAR2 := fnd_api.g_true,
954: p_commit IN VARCHAR2 := FND_API.g_false,
955: p_validate_only IN VARCHAR2 := FND_API.g_true,
956: p_max_msg_count IN NUMBER := FND_API.g_miss_num,
957:
958: p_version_id IN NUMBER := null,
959: p_record_version_number IN NUMBER := NULL,
960:
985: -- Initialize the Error Stack
986: PA_DEBUG.init_err_stack('PA_PROGRESS_REPORT_PVT.Approve_Report');
987:
988: -- Initialize the return status to success
989: x_return_status := FND_API.G_RET_STS_SUCCESS;
990:
991: -- Issue API savepoint if the transaction is to be committed
992: IF p_commit = FND_API.G_TRUE THEN
993: SAVEPOINT approve_report;
988: -- Initialize the return status to success
989: x_return_status := FND_API.G_RET_STS_SUCCESS;
990:
991: -- Issue API savepoint if the transaction is to be committed
992: IF p_commit = FND_API.G_TRUE THEN
993: SAVEPOINT approve_report;
994: END IF;
995:
996: OPEN get_template_type;
1002: PA_UTILS.Add_Message( p_app_short_name => 'PA'
1003: ,p_msg_name => 'PA_PR_VERSION_ID_INV'
1004: , p_token1 => 'TEMPLATE_TYPE'
1005: , p_value1 => l_type);
1006: x_return_status := FND_API.G_RET_STS_ERROR;
1007: END IF;
1008:
1009: -- can only approve the submitted report
1010: IF x_return_status = FND_API.g_ret_sts_success THEN
1006: x_return_status := FND_API.G_RET_STS_ERROR;
1007: END IF;
1008:
1009: -- can only approve the submitted report
1010: IF x_return_status = FND_API.g_ret_sts_success THEN
1011:
1012: OPEN check_status_submitted;
1013: FETCH check_status_submitted INTO l_rowid;
1014:
1015: IF check_status_submitted%NOTFOUND THEN
1016: PA_UTILS.Add_Message( p_app_short_name => 'PA'
1017: ,p_msg_name => 'PA_PR_RECORD_CHANGED');
1018:
1019: x_return_status := FND_API.G_RET_STS_ERROR;
1020:
1021: ELSE
1022: CLOSE check_status_submitted;
1023: END IF;
1023: END IF;
1024:
1025: END IF;
1026:
1027: IF (p_validate_only <>FND_API.g_true AND x_return_status = FND_API.g_ret_sts_success) then
1028:
1029: /*
1030: pa_progress_report_pkg.UPDATE_PROGRESS_REPORT_VER_ROW
1031: (
1072: END IF;
1073:
1074:
1075: -- Commit if the flag is set and there is no error
1076: IF (p_commit = FND_API.G_TRUE AND x_return_status = FND_API.g_ret_sts_success )THEN
1077: COMMIT;
1078: END IF;
1079:
1080: -- Reset the error stack when returning to the calling program
1082:
1083:
1084: EXCEPTION
1085: WHEN OTHERS THEN
1086: IF p_commit = FND_API.G_TRUE THEN
1087: ROLLBACK TO approve_report;
1088: END IF;
1089: --
1090: -- Set the excetption Message and the stack
1090: -- Set the excetption Message and the stack
1091: FND_MSG_PUB.add_exc_msg ( p_pkg_name => 'PA_PROGRESS_REPORT_PVT.Approve_Report'
1092: ,p_procedure_name => PA_DEBUG.G_Err_Stack );
1093: --
1094: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
1095: RAISE; -- This is optional depending on the needs
1096:
1097:
1098: END approve_report;
1098: END approve_report;
1099:
1100: PROCEDURE reject_report (
1101: p_api_version IN NUMBER := 1.0,
1102: p_init_msg_list IN VARCHAR2 := fnd_api.g_true,
1103: p_commit IN VARCHAR2 := FND_API.g_false,
1104: p_validate_only IN VARCHAR2 := FND_API.g_true,
1105: p_max_msg_count IN NUMBER := FND_API.g_miss_num,
1106:
1099:
1100: PROCEDURE reject_report (
1101: p_api_version IN NUMBER := 1.0,
1102: p_init_msg_list IN VARCHAR2 := fnd_api.g_true,
1103: p_commit IN VARCHAR2 := FND_API.g_false,
1104: p_validate_only IN VARCHAR2 := FND_API.g_true,
1105: p_max_msg_count IN NUMBER := FND_API.g_miss_num,
1106:
1107: p_version_id IN NUMBER := null,
1100: PROCEDURE reject_report (
1101: p_api_version IN NUMBER := 1.0,
1102: p_init_msg_list IN VARCHAR2 := fnd_api.g_true,
1103: p_commit IN VARCHAR2 := FND_API.g_false,
1104: p_validate_only IN VARCHAR2 := FND_API.g_true,
1105: p_max_msg_count IN NUMBER := FND_API.g_miss_num,
1106:
1107: p_version_id IN NUMBER := null,
1108: p_record_version_number IN NUMBER := NULL,
1101: p_api_version IN NUMBER := 1.0,
1102: p_init_msg_list IN VARCHAR2 := fnd_api.g_true,
1103: p_commit IN VARCHAR2 := FND_API.g_false,
1104: p_validate_only IN VARCHAR2 := FND_API.g_true,
1105: p_max_msg_count IN NUMBER := FND_API.g_miss_num,
1106:
1107: p_version_id IN NUMBER := null,
1108: p_record_version_number IN NUMBER := NULL,
1109:
1135: -- Initialize the Error Stack
1136: PA_DEBUG.init_err_stack('PA_PROGRESS_REPORT_PVT.Approve_Report');
1137:
1138: -- Initialize the return status to success
1139: x_return_status := FND_API.G_RET_STS_SUCCESS;
1140:
1141: -- Issue API savepoint if the transaction is to be committed
1142: IF p_commit = FND_API.G_TRUE THEN
1143: SAVEPOINT reject_report;
1138: -- Initialize the return status to success
1139: x_return_status := FND_API.G_RET_STS_SUCCESS;
1140:
1141: -- Issue API savepoint if the transaction is to be committed
1142: IF p_commit = FND_API.G_TRUE THEN
1143: SAVEPOINT reject_report;
1144: END IF;
1145:
1146: OPEN get_template_type;
1152: PA_UTILS.Add_Message( p_app_short_name => 'PA'
1153: ,p_msg_name => 'PA_PR_VERSION_ID_INV'
1154: , p_token1 => 'TEMPLATE_TYPE'
1155: , p_value1 => l_type);
1156: x_return_status := FND_API.G_RET_STS_ERROR;
1157: END IF;
1158:
1159: -- can only reject the submitted report
1160: IF x_return_status = FND_API.g_ret_sts_success THEN
1156: x_return_status := FND_API.G_RET_STS_ERROR;
1157: END IF;
1158:
1159: -- can only reject the submitted report
1160: IF x_return_status = FND_API.g_ret_sts_success THEN
1161:
1162: OPEN check_status_submitted;
1163: FETCH check_status_submitted INTO l_rowid;
1164:
1165: IF check_status_submitted%NOTFOUND THEN
1166: PA_UTILS.Add_Message( p_app_short_name => 'PA'
1167: ,p_msg_name => 'PA_PR_RECORD_CHANGED');
1168:
1169: x_return_status := FND_API.G_RET_STS_ERROR;
1170:
1171: ELSE
1172: CLOSE check_status_submitted;
1173: END IF;
1174:
1175: END IF;
1176:
1177:
1178: IF (p_validate_only <>FND_API.g_true AND x_return_status = FND_API.g_ret_sts_success) then
1179:
1180: /*
1181: pa_progress_report_pkg.UPDATE_PROGRESS_REPORT_VER_ROW
1182: (
1223: END IF;
1224:
1225:
1226: -- Commit if the flag is set and there is no error
1227: IF (p_commit = FND_API.G_TRUE AND x_return_status = FND_API.g_ret_sts_success )THEN
1228: COMMIT;
1229: END IF;
1230:
1231: -- Reset the error stack when returning to the calling program
1233:
1234:
1235: EXCEPTION
1236: WHEN OTHERS THEN
1237: IF p_commit = FND_API.G_TRUE THEN
1238: ROLLBACK TO reject_report;
1239: END IF;
1240: --
1241: -- Set the excetption Message and the stack
1241: -- Set the excetption Message and the stack
1242: FND_MSG_PUB.add_exc_msg ( p_pkg_name => 'PA_PROGRESS_REPORT_PVT.Reject_Report'
1243: ,p_procedure_name => PA_DEBUG.G_Err_Stack );
1244: --
1245: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
1246: RAISE; -- This is optional depending on the needs
1247:
1248: END reject_report;
1249:
1250:
1251: PROCEDURE update_report_details
1252: (
1253: p_api_version IN NUMBER := 1.0,
1254: p_init_msg_list IN VARCHAR2 := fnd_api.g_true,
1255: p_commit IN VARCHAR2 := FND_API.g_false,
1256: p_validate_only IN VARCHAR2 := FND_API.g_true,
1257: p_max_msg_count IN NUMBER := FND_API.g_miss_num,
1258:
1251: PROCEDURE update_report_details
1252: (
1253: p_api_version IN NUMBER := 1.0,
1254: p_init_msg_list IN VARCHAR2 := fnd_api.g_true,
1255: p_commit IN VARCHAR2 := FND_API.g_false,
1256: p_validate_only IN VARCHAR2 := FND_API.g_true,
1257: p_max_msg_count IN NUMBER := FND_API.g_miss_num,
1258:
1259: p_version_id IN NUMBER := NULL,
1252: (
1253: p_api_version IN NUMBER := 1.0,
1254: p_init_msg_list IN VARCHAR2 := fnd_api.g_true,
1255: p_commit IN VARCHAR2 := FND_API.g_false,
1256: p_validate_only IN VARCHAR2 := FND_API.g_true,
1257: p_max_msg_count IN NUMBER := FND_API.g_miss_num,
1258:
1259: p_version_id IN NUMBER := NULL,
1260:
1253: p_api_version IN NUMBER := 1.0,
1254: p_init_msg_list IN VARCHAR2 := fnd_api.g_true,
1255: p_commit IN VARCHAR2 := FND_API.g_false,
1256: p_validate_only IN VARCHAR2 := FND_API.g_true,
1257: p_max_msg_count IN NUMBER := FND_API.g_miss_num,
1258:
1259: p_version_id IN NUMBER := NULL,
1260:
1261: p_report_start_date IN DATE:= NULL,
1302: -- Initialize the Error Stack
1303: PA_DEBUG.init_err_stack('PA_PROGRESS_REPORT_PVT.update_report_details');
1304:
1305: -- Initialize the return status to success
1306: x_return_status := FND_API.G_RET_STS_SUCCESS;
1307:
1308: -- Issue API savepoint if the transaction is to be committed
1309: IF p_commit = FND_API.G_TRUE THEN
1310: SAVEPOINT update_report_details;
1305: -- Initialize the return status to success
1306: x_return_status := FND_API.G_RET_STS_SUCCESS;
1307:
1308: -- Issue API savepoint if the transaction is to be committed
1309: IF p_commit = FND_API.G_TRUE THEN
1310: SAVEPOINT update_report_details;
1311: END IF;
1312:
1313: OPEN get_template_type;
1319: PA_UTILS.Add_Message( p_app_short_name => 'PA'
1320: ,p_msg_name => 'PA_PR_VERSION_ID_INV'
1321: , p_token1 => 'TEMPLATE_TYPE'
1322: , p_value1 => l_type);
1323: x_return_status := FND_API.G_RET_STS_ERROR;
1324: END IF;
1325:
1326: --debug_msg ('before update 1' );
1327:
1327:
1328: IF (Trunc(p_report_end_date) < Trunc(p_report_start_date)) THEN
1329: PA_UTILS.Add_Message( p_app_short_name => 'PA'
1330: ,p_msg_name => 'PA_REPORT_END_DATE_INV');
1331: x_return_status := FND_API.G_RET_STS_ERROR;
1332: END IF;
1333:
1334: --debug_msg ('before update 1' || x_return_status );
1335:
1346:
1347: IF (get_person_id%notfound) THEN
1348: PA_UTILS.Add_Message( p_app_short_name => 'PA'
1349: ,p_msg_name => 'PA_PR_REPORTED_BY_INV');
1350: x_return_status := FND_API.G_RET_STS_ERROR;
1351: END IF;
1352: CLOSE get_person_id;
1353: ELSE
1354: l_reported_by := p_reported_by;
1363:
1364: IF l_ret <> 'Y' THEN
1365: PA_UTILS.Add_Message( p_app_short_name => 'PA'
1366: ,p_msg_name => 'PA_UPDATE_REPORT_INV');
1367: x_return_status := FND_API.G_RET_STS_ERROR;
1368: END IF;
1369:
1370: IF (p_validate_only <>FND_API.g_true AND x_return_status = FND_API.g_ret_sts_success) then
1371:
1366: ,p_msg_name => 'PA_UPDATE_REPORT_INV');
1367: x_return_status := FND_API.G_RET_STS_ERROR;
1368: END IF;
1369:
1370: IF (p_validate_only <>FND_API.g_true AND x_return_status = FND_API.g_ret_sts_success) then
1371:
1372: --debug_msg ('before update 2' || To_char(l_reported_by));
1373: --debug_msg ('before update 3' || p_overview);
1374: --debug_msg ('before update 4' || p_progress_status);
1403: END IF;
1404:
1405:
1406: -- Commit if the flag is set and there is no error
1407: IF (p_commit = FND_API.G_TRUE AND x_return_status = FND_API.g_ret_sts_success )THEN
1408: COMMIT;
1409: END IF;
1410:
1411: -- Reset the error stack when returning to the calling program
1415:
1416: EXCEPTION
1417: WHEN OTHERS THEN
1418: --debug_msg ('exception ');
1419: IF p_commit = FND_API.G_TRUE THEN
1420: ROLLBACK TO update_report_details;
1421: END IF;
1422: --
1423: -- Set the excetption Message and the stack
1423: -- Set the excetption Message and the stack
1424: FND_MSG_PUB.add_exc_msg ( p_pkg_name => 'PA_PROGRESS_REPORT_PVT.update_report_details'
1425: ,p_procedure_name => PA_DEBUG.G_Err_Stack );
1426: --
1427: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
1428: RAISE; -- This is optional depending on the needs
1429:
1430: END update_report_details;
1431:
1432:
1433: PROCEDURE define_progress_report_setup
1434: (
1435: p_api_version IN NUMBER := 1.0,
1436: p_init_msg_list IN VARCHAR2 := fnd_api.g_true,
1437: p_commit IN VARCHAR2 := FND_API.g_false,
1438: p_validate_only IN VARCHAR2 := FND_API.g_true,
1439: p_max_msg_count IN NUMBER := FND_API.g_miss_num,
1440:
1433: PROCEDURE define_progress_report_setup
1434: (
1435: p_api_version IN NUMBER := 1.0,
1436: p_init_msg_list IN VARCHAR2 := fnd_api.g_true,
1437: p_commit IN VARCHAR2 := FND_API.g_false,
1438: p_validate_only IN VARCHAR2 := FND_API.g_true,
1439: p_max_msg_count IN NUMBER := FND_API.g_miss_num,
1440:
1441: p_object_id IN NUMBER := NULL,
1434: (
1435: p_api_version IN NUMBER := 1.0,
1436: p_init_msg_list IN VARCHAR2 := fnd_api.g_true,
1437: p_commit IN VARCHAR2 := FND_API.g_false,
1438: p_validate_only IN VARCHAR2 := FND_API.g_true,
1439: p_max_msg_count IN NUMBER := FND_API.g_miss_num,
1440:
1441: p_object_id IN NUMBER := NULL,
1442: p_object_type IN VARCHAR2 := NULL,
1435: p_api_version IN NUMBER := 1.0,
1436: p_init_msg_list IN VARCHAR2 := fnd_api.g_true,
1437: p_commit IN VARCHAR2 := FND_API.g_false,
1438: p_validate_only IN VARCHAR2 := FND_API.g_true,
1439: p_max_msg_count IN NUMBER := FND_API.g_miss_num,
1440:
1441: p_object_id IN NUMBER := NULL,
1442: p_object_type IN VARCHAR2 := NULL,
1443: p_page_type_code IN VARCHAR2 := 'PPR',
1512:
1513: -- Initialize the Error Stack
1514: PA_DEBUG.init_err_stack('PA_PROGRESS_REPORT_PVT.define_progress_report_setup');
1515: -- Initialize the return status to success
1516: x_return_status := FND_API.G_RET_STS_SUCCESS;
1517:
1518: l_object_page_layout_id := p_object_page_layout_id;
1519: -- Issue API savepoint if the transaction is to be committed
1520:
1517:
1518: l_object_page_layout_id := p_object_page_layout_id;
1519: -- Issue API savepoint if the transaction is to be committed
1520:
1521: IF p_commit = FND_API.G_TRUE THEN
1522: SAVEPOINT define_progress_report_setup;
1523: END IF;
1524:
1525:
1527: l_page_id := p_page_id;
1528: IF ((l_page_id is null) AND (p_function_name is not null)) THEN
1529:
1530: PA_PAGE_LAYOUT_PUB.Create_Page_Layout(
1531: p_validate_only => fnd_api.g_false,
1532: p_page_name => p_page_name,
1533: p_page_type => p_page_type_code,
1534: p_function_name => p_function_name,
1535: p_description => null,
1542: );
1543: END IF;
1544:
1545: --To keep the code in sync with the existing one, return is issued.
1546: IF (x_return_status <> FND_API.g_ret_sts_success) THEN
1547: ROLLBACK TO define_progress_report_setup;
1548: END IF;
1549:
1550: -- check mandatory version_id
1560: IF pa_progress_report_utils.is_delete_page_layout_ok(p_page_type_code, p_object_type, p_object_id, p_report_Type_id ) <> 'Y' THEN
1561: -- we have to quit,
1562: PA_UTILS.Add_Message( p_app_short_name => 'PA'
1563: ,p_msg_name => 'PA_REPORT_TYPE_REMOVE_INV');
1564: x_return_status := FND_API.G_RET_STS_ERROR;
1565: RETURN;
1566:
1567: END IF;
1568:
1608:
1609: IF (get_page_id%notfound ) THEN
1610: PA_UTILS.Add_Message( p_app_short_name => 'PA'
1611: ,p_msg_name => 'PA_PAGE_LAYOUT_NAME_INV');
1612: x_return_status := FND_API.G_RET_STS_ERROR;
1613: RETURN;
1614:
1615: ELSE
1616: -- we have the valid page_id now
1626: -- l_page_id := p_page_id;
1627:
1628: --PA_UTILS.Add_Message( p_app_short_name => 'PA'
1629: -- ,p_msg_name => 'PA_PAGE_ID_INV');
1630: --x_return_status := FND_API.G_RET_STS_ERROR;
1631: END IF;
1632:
1633: --debug_msg('object_id ' || To_char(p_object_id));
1634: --debug_msg('object_type ' || p_object_type);
1646: if (page_id_l <> l_page_id or approval_required_l <> p_approval_required) then
1647: -- we have to quit,
1648: PA_UTILS.Add_Message( p_app_short_name => 'PA'
1649: ,p_msg_name => 'PA_REPORT_TYPE_EDIT_INV');
1650: x_return_status := FND_API.G_RET_STS_ERROR;
1651: RETURN;
1652: end if;
1653:
1654: END IF;
1737: FETCH report_type_exists INTO l_rowid;
1738: IF report_type_exists%NOTFOUND THEN
1739: PA_UTILS.Add_Message( p_app_short_name => 'PA'
1740: ,p_msg_name => 'PA_PS_REPORT_TYPE_INVALID');
1741: x_return_status := FND_API.G_RET_STS_ERROR;
1742: RETURN;
1743: ELSE
1744: -- we have the valid report_type_id
1745: NULL;
1746: END if;
1747: CLOSE report_type_exists;
1748: END IF;
1749:
1750: IF x_return_status = FND_API.g_ret_sts_success THEN
1751:
1752: OPEN check_object_page_layout_exits;
1753: FETCH check_object_page_layout_exits INTO page_id_l, approval_required_l;
1754:
1755: IF check_object_page_layout_exits%NOTFOUND THEN
1756: CLOSE check_object_page_layout_exits;
1757:
1758: -- we will insert into pa_object_page_layouts
1759: IF (p_validate_only <>FND_API.g_true AND x_return_status = FND_API.g_ret_sts_success) THEN
1760:
1761: pa_progress_report_pkg.insert_object_page_layout_row
1762: (
1763: P_OBJECT_ID ,
1834: ELSE
1835: CLOSE check_object_page_layout_exits;
1836:
1837: -- we will insert into pa_object_page_layouts
1838: IF (p_validate_only <>FND_API.g_true AND x_return_status = FND_API.g_ret_sts_success) THEN
1839:
1840:
1841: pa_progress_report_pkg.update_object_page_layout_row
1842: (
1909: END IF;
1910: END IF;
1911:
1912: -- Commit if the flag is set and there is no error
1913: IF (p_commit = FND_API.G_TRUE AND x_return_status = FND_API.g_ret_sts_success )THEN
1914: COMMIT;
1915: END IF;
1916:
1917: if (x_msg_count >= 1) then
1914: COMMIT;
1915: END IF;
1916:
1917: if (x_msg_count >= 1) then
1918: x_return_status := FND_API.g_ret_sts_Error;
1919: end if;
1920:
1921: -- Reset the error stack when returning to the calling program
1922: PA_DEBUG.Reset_Err_Stack;
1923:
1924:
1925: EXCEPTION
1926: WHEN OTHERS THEN
1927: IF p_commit = FND_API.G_TRUE THEN
1928: ROLLBACK TO define_progress_report_setup;
1929: END IF;
1930: --
1931: -- Set the excetption Message and the stack
1931: -- Set the excetption Message and the stack
1932: FND_MSG_PUB.add_exc_msg ( p_pkg_name => 'PA_PROGRESS_REPORT_PVT.define_progress_report_setup'
1933: ,p_procedure_name => PA_DEBUG.G_Err_Stack );
1934: --
1935: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
1936: RAISE; -- This is optional depending on the needs
1937:
1938:
1939:
1941:
1942: PROCEDURE delete_report
1943: (
1944: p_api_version IN NUMBER := 1.0,
1945: p_init_msg_list IN VARCHAR2 := fnd_api.g_true,
1946: p_commit IN VARCHAR2 := FND_API.g_false,
1947: p_validate_only IN VARCHAR2 := FND_API.g_true,
1948: p_max_msg_count IN NUMBER := FND_API.g_miss_num,
1949:
1942: PROCEDURE delete_report
1943: (
1944: p_api_version IN NUMBER := 1.0,
1945: p_init_msg_list IN VARCHAR2 := fnd_api.g_true,
1946: p_commit IN VARCHAR2 := FND_API.g_false,
1947: p_validate_only IN VARCHAR2 := FND_API.g_true,
1948: p_max_msg_count IN NUMBER := FND_API.g_miss_num,
1949:
1950: p_version_id IN NUMBER :=NULL,
1943: (
1944: p_api_version IN NUMBER := 1.0,
1945: p_init_msg_list IN VARCHAR2 := fnd_api.g_true,
1946: p_commit IN VARCHAR2 := FND_API.g_false,
1947: p_validate_only IN VARCHAR2 := FND_API.g_true,
1948: p_max_msg_count IN NUMBER := FND_API.g_miss_num,
1949:
1950: p_version_id IN NUMBER :=NULL,
1951: p_record_version_number IN NUMBER := NULL,
1944: p_api_version IN NUMBER := 1.0,
1945: p_init_msg_list IN VARCHAR2 := fnd_api.g_true,
1946: p_commit IN VARCHAR2 := FND_API.g_false,
1947: p_validate_only IN VARCHAR2 := FND_API.g_true,
1948: p_max_msg_count IN NUMBER := FND_API.g_miss_num,
1949:
1950: p_version_id IN NUMBER :=NULL,
1951: p_record_version_number IN NUMBER := NULL,
1952:
2019: -- Initialize the Error Stack
2020: PA_DEBUG.init_err_stack('PA_PROGRESS_REPORT_PVT.Delete_Report');
2021:
2022: -- Initialize the return status to success
2023: x_return_status := FND_API.G_RET_STS_SUCCESS;
2024:
2025: -- Issue API savepoint if the transaction is to be committed
2026: IF p_commit = FND_API.G_TRUE THEN
2027: SAVEPOINT delete_report;
2022: -- Initialize the return status to success
2023: x_return_status := FND_API.G_RET_STS_SUCCESS;
2024:
2025: -- Issue API savepoint if the transaction is to be committed
2026: IF p_commit = FND_API.G_TRUE THEN
2027: SAVEPOINT delete_report;
2028: END IF;
2029:
2030: OPEN get_template_type;
2036: PA_UTILS.Add_Message( p_app_short_name => 'PA'
2037: ,p_msg_name => 'PA_PR_VERSION_ID_INV'
2038: , p_token1 => 'TEMPLATE_TYPE'
2039: , p_value1 => l_type);
2040: x_return_status := FND_API.G_RET_STS_ERROR;
2041: END IF;
2042:
2043:
2044: -- cancel the workflow which if it is already launched.
2074: , x_return_status
2075: );
2076:
2077: IF (l_dummy = 'N') THEN
2078: x_return_status := FND_API.G_RET_STS_SUCCESS;
2079: END IF;
2080:
2081: END IF;
2082:
2092: -- failed, return error.
2093: -- IF (l_dummy = 'Y' or l_dummy = 'A' )THEN
2094: -- PA_UTILS.Add_Message( p_app_short_name => 'PA'
2095: -- ,p_msg_name => 'PA_PR_CANCEL_WORKFLOW_INV');
2096: -- x_return_status := FND_API.G_RET_STS_ERROR;
2097: NULL;
2098: END IF;
2099: ELSE
2100: CLOSE check_status_submitted;
2101:
2102: END IF;
2103:
2104:
2105: IF (p_validate_only <>FND_API.g_true AND x_return_status = FND_API.g_ret_sts_success) then
2106:
2107: -- delete all records in pa_progress_report_vals under the p_version_id
2108: pa_progress_report_pkg.delete_progress_report_vals
2109: (
2112: x_msg_count ,
2113: x_msg_data
2114: );
2115:
2116: IF (x_return_status = FND_API.g_ret_sts_success) THEN
2117:
2118: -- delete record in pa_progress_report_vers under the p_version_id
2119: pa_progress_report_pkg.delete_progress_report_ver_row
2120: (
2130: END IF;
2131:
2132:
2133: -- Commit if the flag is set and there is no error
2134: IF (p_commit = FND_API.G_TRUE AND x_return_status = FND_API.g_ret_sts_success )THEN
2135: COMMIT;
2136: END IF;
2137:
2138: -- Reset the error stack when returning to the calling program
2140:
2141:
2142: EXCEPTION
2143: WHEN OTHERS THEN
2144: IF p_commit = FND_API.G_TRUE THEN
2145: ROLLBACK TO delete_report;
2146: END IF;
2147: --
2148: -- Set the excetption Message and the stack
2148: -- Set the excetption Message and the stack
2149: FND_MSG_PUB.add_exc_msg ( p_pkg_name => 'PA_PROGRESS_REPORT_PVT.Delete_Report'
2150: ,p_procedure_name => PA_DEBUG.G_Err_Stack );
2151: --
2152: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
2153: RAISE; -- This is optional depending on the needs
2154:
2155: END delete_report;
2156:
2156:
2157: PROCEDURE rework_report
2158: (
2159: p_api_version IN NUMBER := 1.0,
2160: p_init_msg_list IN VARCHAR2 := fnd_api.g_true,
2161: p_commit IN VARCHAR2 := FND_API.g_false,
2162: p_validate_only IN VARCHAR2 := FND_API.g_true,
2163: p_max_msg_count IN NUMBER := FND_API.g_miss_num,
2164:
2157: PROCEDURE rework_report
2158: (
2159: p_api_version IN NUMBER := 1.0,
2160: p_init_msg_list IN VARCHAR2 := fnd_api.g_true,
2161: p_commit IN VARCHAR2 := FND_API.g_false,
2162: p_validate_only IN VARCHAR2 := FND_API.g_true,
2163: p_max_msg_count IN NUMBER := FND_API.g_miss_num,
2164:
2165: p_version_id IN NUMBER := NULL,
2158: (
2159: p_api_version IN NUMBER := 1.0,
2160: p_init_msg_list IN VARCHAR2 := fnd_api.g_true,
2161: p_commit IN VARCHAR2 := FND_API.g_false,
2162: p_validate_only IN VARCHAR2 := FND_API.g_true,
2163: p_max_msg_count IN NUMBER := FND_API.g_miss_num,
2164:
2165: p_version_id IN NUMBER := NULL,
2166: p_record_version_number IN NUMBER := NULL,
2159: p_api_version IN NUMBER := 1.0,
2160: p_init_msg_list IN VARCHAR2 := fnd_api.g_true,
2161: p_commit IN VARCHAR2 := FND_API.g_false,
2162: p_validate_only IN VARCHAR2 := FND_API.g_true,
2163: p_max_msg_count IN NUMBER := FND_API.g_miss_num,
2164:
2165: p_version_id IN NUMBER := NULL,
2166: p_record_version_number IN NUMBER := NULL,
2167:
2238: -- Initialize the Error Stack
2239: PA_DEBUG.init_err_stack('PA_PROGRESS_REPORT_PVT.Rework_Report');
2240:
2241: -- Initialize the return status to success
2242: x_return_status := FND_API.G_RET_STS_SUCCESS;
2243:
2244: -- Issue API savepoint if the transaction is to be committed
2245: SAVEPOINT rework_report;
2246:
2253: PA_UTILS.Add_Message( p_app_short_name => 'PA'
2254: ,p_msg_name => 'PA_PR_VERSION_ID_INV'
2255: , p_token1 => 'TEMPLATE_TYPE'
2256: , p_value1 => l_type);
2257: x_return_status := FND_API.G_RET_STS_ERROR;
2258: END IF;
2259:
2260:
2261: IF (p_validate_only <>FND_API.g_true AND x_return_status = FND_API.g_ret_sts_success) then
2257: x_return_status := FND_API.G_RET_STS_ERROR;
2258: END IF;
2259:
2260:
2261: IF (p_validate_only <>FND_API.g_true AND x_return_status = FND_API.g_ret_sts_success) then
2262:
2263: -- set the status to working first
2264:
2265: /*
2302: x_msg_count => x_msg_count,
2303: x_msg_data => x_msg_data
2304: ) ;
2305:
2306: IF (x_return_status = FND_API.g_ret_sts_success) THEN
2307: -- cancel the approval workflow process if that is already launched
2308: -- todo
2309:
2310: -- check whether report approval is required.
2335: IF (l_dummy = 'Y' or l_dummy = 'A') then
2336: PA_UTILS.Add_Message( p_app_short_name => 'PA'
2337: ,p_msg_name => 'PA_PR_CANCEL_WORKFLOW_INV');
2338: --todo
2339: -- x_return_status := FND_API.G_RET_STS_ERROR;
2340: END IF;
2341:
2342: else
2343:
2350: , x_return_status
2351: );
2352:
2353: IF (l_dummy = 'N') THEN
2354: x_return_status := FND_API.G_RET_STS_SUCCESS;
2355: END IF;
2356:
2357: END IF;
2358:
2366: -- failed, return error.
2367: IF (l_dummy = 'Y' or l_dummy = 'A' )THEN
2368: PA_UTILS.Add_Message( p_app_short_name => 'PA'
2369: ,p_msg_name => 'PA_PR_CANCEL_WORKFLOW_INV');
2370: x_return_status := FND_API.G_RET_STS_ERROR;
2371:
2372: END IF;
2373:
2374: END IF;
2379: END IF;
2380:
2381:
2382: -- Commit if the flag is set and there is no error
2383: IF (p_commit = FND_API.G_TRUE AND x_return_status = FND_API.g_ret_sts_success )THEN
2384: COMMIT;
2385: END IF;
2386:
2387: IF (x_return_status <> FND_API.g_ret_sts_success )THEN
2383: IF (p_commit = FND_API.G_TRUE AND x_return_status = FND_API.g_ret_sts_success )THEN
2384: COMMIT;
2385: END IF;
2386:
2387: IF (x_return_status <> FND_API.g_ret_sts_success )THEN
2388: ROLLBACK TO rework_report;
2389: END IF;
2390:
2391: -- Reset the error stack when returning to the calling program
2393:
2394:
2395: EXCEPTION
2396: WHEN OTHERS THEN
2397: IF p_commit = FND_API.G_TRUE THEN
2398: ROLLBACK TO rework_report;
2399: END IF;
2400: --
2401: -- Set the excetption Message and the stack
2401: -- Set the excetption Message and the stack
2402: FND_MSG_PUB.add_exc_msg ( p_pkg_name => 'PA_PROGRESS_REPORT_PVT.Rework_Report'
2403: ,p_procedure_name => PA_DEBUG.G_Err_Stack );
2404: --
2405: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
2406: RAISE; -- This is optional depending on the needs
2407:
2408: END rework_report;
2409:
2409:
2410: PROCEDURE publish_report
2411: (
2412: p_api_version IN NUMBER := 1.0,
2413: p_init_msg_list IN VARCHAR2 := fnd_api.g_true,
2414: p_commit IN VARCHAR2 := FND_API.g_false,
2415: p_validate_only IN VARCHAR2 := FND_API.g_true,
2416: p_max_msg_count IN NUMBER := FND_API.g_miss_num,
2417:
2410: PROCEDURE publish_report
2411: (
2412: p_api_version IN NUMBER := 1.0,
2413: p_init_msg_list IN VARCHAR2 := fnd_api.g_true,
2414: p_commit IN VARCHAR2 := FND_API.g_false,
2415: p_validate_only IN VARCHAR2 := FND_API.g_true,
2416: p_max_msg_count IN NUMBER := FND_API.g_miss_num,
2417:
2418: p_version_id IN NUMBER := NULL,
2411: (
2412: p_api_version IN NUMBER := 1.0,
2413: p_init_msg_list IN VARCHAR2 := fnd_api.g_true,
2414: p_commit IN VARCHAR2 := FND_API.g_false,
2415: p_validate_only IN VARCHAR2 := FND_API.g_true,
2416: p_max_msg_count IN NUMBER := FND_API.g_miss_num,
2417:
2418: p_version_id IN NUMBER := NULL,
2419: p_record_version_number IN NUMBER := NULL,
2412: p_api_version IN NUMBER := 1.0,
2413: p_init_msg_list IN VARCHAR2 := fnd_api.g_true,
2414: p_commit IN VARCHAR2 := FND_API.g_false,
2415: p_validate_only IN VARCHAR2 := FND_API.g_true,
2416: p_max_msg_count IN NUMBER := FND_API.g_miss_num,
2417:
2418: p_version_id IN NUMBER := NULL,
2419: p_record_version_number IN NUMBER := NULL,
2420: p_summary_version_number IN NUMBER := NULL,
2490: -- Initialize the Error Stack
2491: PA_DEBUG.init_err_stack('PA_PROGRESS_REPORT_PVT.Publish_Report');
2492:
2493: -- Initialize the return status to success
2494: x_return_status := FND_API.G_RET_STS_SUCCESS;
2495:
2496: -- Issue API savepoint if the transaction is to be committed
2497: SAVEPOINT publish_report;
2498:
2506: PA_UTILS.Add_Message( p_app_short_name => 'PA'
2507: ,p_msg_name => 'PA_PR_VERSION_ID_INV'
2508: , p_token1 => 'TEMPLATE_TYPE'
2509: , p_value1 => l_type);
2510: x_return_status := FND_API.G_RET_STS_ERROR;
2511: END IF;
2512:
2513:
2514: IF (p_validate_only <>FND_API.g_true AND x_return_status = FND_API.g_ret_sts_success) then
2510: x_return_status := FND_API.G_RET_STS_ERROR;
2511: END IF;
2512:
2513:
2514: IF (p_validate_only <>FND_API.g_true AND x_return_status = FND_API.g_ret_sts_success) then
2515:
2516: -- set the status to working first
2517:
2518: --debug_msg('UPDATE_PROGRESS_REPORT_VER_ROW');
2560: x_msg_count => x_msg_count,
2561: x_msg_data => x_msg_data
2562: ) ;
2563:
2564: IF (x_return_status = FND_API.g_ret_sts_success) THEN
2565:
2566: OPEN check_auto_approve;
2567:
2568: FETCH check_auto_approve INTO l_dummy;
2664:
2665:
2666:
2667: -- Commit if the flag is set and there is no error
2668: IF (p_commit = FND_API.G_TRUE AND x_return_status = FND_API.g_ret_sts_success )THEN
2669: COMMIT;
2670: END IF;
2671:
2672: IF (x_return_status <> FND_API.g_ret_sts_success )THEN
2668: IF (p_commit = FND_API.G_TRUE AND x_return_status = FND_API.g_ret_sts_success )THEN
2669: COMMIT;
2670: END IF;
2671:
2672: IF (x_return_status <> FND_API.g_ret_sts_success )THEN
2673: ROLLBACK TO publish_report;
2674: END IF;
2675: -- Reset the error stack when returning to the calling program
2676: PA_DEBUG.Reset_Err_Stack;
2684: -- Set the excetption Message and the stack
2685: FND_MSG_PUB.add_exc_msg ( p_pkg_name => 'PA_PROGRESS_REPORT_PVT.Publish_Report'
2686: ,p_procedure_name => PA_DEBUG.G_Err_Stack );
2687: --
2688: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
2689: RAISE; -- This is optional depending on the needs
2690:
2691: END publish_report;
2692:
2692:
2693: PROCEDURE submit_report
2694: (
2695: p_api_version IN NUMBER := 1.0,
2696: p_init_msg_list IN VARCHAR2 := fnd_api.g_true,
2697: p_commit IN VARCHAR2 := FND_API.g_false,
2698: p_validate_only IN VARCHAR2 := FND_API.g_true,
2699: p_max_msg_count IN NUMBER := FND_API.g_miss_num,
2700:
2693: PROCEDURE submit_report
2694: (
2695: p_api_version IN NUMBER := 1.0,
2696: p_init_msg_list IN VARCHAR2 := fnd_api.g_true,
2697: p_commit IN VARCHAR2 := FND_API.g_false,
2698: p_validate_only IN VARCHAR2 := FND_API.g_true,
2699: p_max_msg_count IN NUMBER := FND_API.g_miss_num,
2700:
2701: p_version_id IN NUMBER := NULL,
2694: (
2695: p_api_version IN NUMBER := 1.0,
2696: p_init_msg_list IN VARCHAR2 := fnd_api.g_true,
2697: p_commit IN VARCHAR2 := FND_API.g_false,
2698: p_validate_only IN VARCHAR2 := FND_API.g_true,
2699: p_max_msg_count IN NUMBER := FND_API.g_miss_num,
2700:
2701: p_version_id IN NUMBER := NULL,
2702: p_record_version_number IN NUMBER := NULL,
2695: p_api_version IN NUMBER := 1.0,
2696: p_init_msg_list IN VARCHAR2 := fnd_api.g_true,
2697: p_commit IN VARCHAR2 := FND_API.g_false,
2698: p_validate_only IN VARCHAR2 := FND_API.g_true,
2699: p_max_msg_count IN NUMBER := FND_API.g_miss_num,
2700:
2701: p_version_id IN NUMBER := NULL,
2702: p_record_version_number IN NUMBER := NULL,
2703: p_summary_version_number IN NUMBER := NULL,
2751: -- Initialize the Error Stack
2752: PA_DEBUG.init_err_stack('PA_PROGRESS_REPORT_PVT.Submit_Report');
2753:
2754: -- Initialize the return status to success
2755: x_return_status := FND_API.G_RET_STS_SUCCESS;
2756:
2757: -- Issue API savepoint if the transaction is to be committed
2758: SAVEPOINT submit_report;
2759:
2768: ,p_msg_name => 'PA_PR_VERSION_ID_INV'
2769: , p_token1 => 'TEMPLATE_TYPE'
2770: , p_value1 => l_type);
2771:
2772: x_return_status := FND_API.G_RET_STS_ERROR;
2773: END IF;
2774:
2775: OPEN get_object_id;
2776:
2778:
2779: IF get_object_id%notfound THEN
2780: PA_UTILS.Add_Message( p_app_short_name => 'PA'
2781: ,p_msg_name => 'PA_PR_STATUS_NOT_WORKING');
2782: x_return_status := FND_API.G_RET_STS_ERROR;
2783: END IF;
2784:
2785: CLOSE get_object_id;
2786:
2783: END IF;
2784:
2785: CLOSE get_object_id;
2786:
2787: IF (p_validate_only <>FND_API.g_true AND x_return_status = FND_API.g_ret_sts_success) then
2788:
2789: -- set the status to working first
2790:
2791: pa_progress_report_pkg.UPDATE_PROGRESS_REPORT_VER_ROW
2817: x_msg_count ,
2818: x_msg_data
2819: );
2820:
2821: IF (x_return_status = FND_API.g_ret_sts_success) THEN
2822: -- update information in other tables
2823: --update_project_perccomplete(p_version_id,
2824: -- x_return_status,
2825: -- x_msg_count,
2824: -- x_return_status,
2825: -- x_msg_count,
2826: -- x_msg_data);
2827:
2828: IF(x_return_status = FND_API.g_ret_sts_success )THEN
2829: -- launch the workflow process
2830:
2831: -- added by syao
2832: -- get the workflow process name
2849: , x_msg_data
2850: , x_return_status
2851: );
2852:
2853: IF(x_return_status = FND_API.g_ret_sts_success )THEN
2854:
2855: -- update pa_wf_process_table
2856: PA_WORKFLOW_UTILS.Insert_WF_Processes
2857: (p_wf_type_code => 'Progress Report'
2868:
2869: IF l_err_code <> 0 THEN
2870: PA_UTILS.Add_Message( p_app_short_name => 'PA'
2871: ,p_msg_name => 'PA_PR_CREATE_WF_FAILED');
2872: x_return_status := FND_API.G_RET_STS_ERROR;
2873:
2874: END IF;
2875:
2876:
2876:
2877: ELSE
2878: PA_UTILS.Add_Message( p_app_short_name => 'PA'
2879: ,p_msg_name => 'PA_PR_CREATE_WF_FAILED');
2880: x_return_status := FND_API.G_RET_STS_ERROR;
2881:
2882: END IF;
2883: ELSE
2884: CLOSE get_wf_process_name;
2895:
2896:
2897:
2898: -- Commit if the flag is set and there is no error
2899: IF (p_commit = FND_API.G_TRUE AND x_return_status = FND_API.g_ret_sts_success )THEN
2900: COMMIT;
2901: END IF;
2902:
2903: IF (x_return_status <> FND_API.g_ret_sts_success )THEN
2899: IF (p_commit = FND_API.G_TRUE AND x_return_status = FND_API.g_ret_sts_success )THEN
2900: COMMIT;
2901: END IF;
2902:
2903: IF (x_return_status <> FND_API.g_ret_sts_success )THEN
2904: ROLLBACK TO submit_report;
2905: END IF;
2906:
2907: -- Reset the error stack when returning to the calling program
2917: -- Set the excetption Message and the stack
2918: FND_MSG_PUB.add_exc_msg ( p_pkg_name => 'PA_PROGRESS_REPORT_PVT.Submit_Report'
2919: ,p_procedure_name => PA_DEBUG.G_Err_Stack );
2920: --
2921: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
2922: RAISE; -- This is optional depending on the needs
2923:
2924: END submit_report;
2925:
2925:
2926: PROCEDURE change_report_status
2927: (
2928: p_api_version IN NUMBER := 1.0,
2929: p_init_msg_list IN VARCHAR2 := fnd_api.g_true,
2930: p_commit IN VARCHAR2 := FND_API.g_false,
2931: p_validate_only IN VARCHAR2 := FND_API.g_false,
2932: p_max_msg_count IN NUMBER := FND_API.g_miss_num,
2933:
2926: PROCEDURE change_report_status
2927: (
2928: p_api_version IN NUMBER := 1.0,
2929: p_init_msg_list IN VARCHAR2 := fnd_api.g_true,
2930: p_commit IN VARCHAR2 := FND_API.g_false,
2931: p_validate_only IN VARCHAR2 := FND_API.g_false,
2932: p_max_msg_count IN NUMBER := FND_API.g_miss_num,
2933:
2934: p_version_id IN NUMBER := NULL,
2927: (
2928: p_api_version IN NUMBER := 1.0,
2929: p_init_msg_list IN VARCHAR2 := fnd_api.g_true,
2930: p_commit IN VARCHAR2 := FND_API.g_false,
2931: p_validate_only IN VARCHAR2 := FND_API.g_false,
2932: p_max_msg_count IN NUMBER := FND_API.g_miss_num,
2933:
2934: p_version_id IN NUMBER := NULL,
2935: p_report_status IN VARCHAR2 := NULL,
2928: p_api_version IN NUMBER := 1.0,
2929: p_init_msg_list IN VARCHAR2 := fnd_api.g_true,
2930: p_commit IN VARCHAR2 := FND_API.g_false,
2931: p_validate_only IN VARCHAR2 := FND_API.g_false,
2932: p_max_msg_count IN NUMBER := FND_API.g_miss_num,
2933:
2934: p_version_id IN NUMBER := NULL,
2935: p_report_status IN VARCHAR2 := NULL,
2936: p_record_version_number IN NUMBER := NULL,
2982: -- Initialize the Error Stack
2983: PA_DEBUG.init_err_stack('PA_PROGRESS_REPORT_PVT.Change_Report_Status');
2984:
2985: -- Initialize the return status to success
2986: x_return_status := FND_API.G_RET_STS_SUCCESS;
2987:
2988: -- get the project_id
2989: OPEN get_object_id;
2990:
2992:
2993: -- IF get_object_id%notfound THEN
2994: -- PA_UTILS.Add_Message( p_app_short_name => 'PA'
2995: -- ,p_msg_name => 'PA_PR_STATUS_NOT_WORKING');
2996: --x_return_status := FND_API.G_RET_STS_ERROR;
2997: --END IF;
2998: CLOSE get_object_id;
2999:
3000: --- Check for the last published report and compare dates. If date is
3057: l_current_flag := 'N';
3058: end if;
3059:
3060: -- change the progress status, launch the workflow if necessary
3061: IF (p_validate_only <>FND_API.g_true AND x_return_status = FND_API.g_ret_sts_success) then
3062: pa_progress_report_pkg.UPDATE_PROGRESS_REPORT_VER_ROW
3063: (
3064: p_version_id,
3065: NULL,
3087: x_return_status ,
3088: x_msg_count ,
3089: x_msg_data
3090: );
3091: IF (x_return_status = FND_API.g_ret_sts_success )THEN
3092:
3093:
3094: -- check whether to launch the workflow
3095: OPEN get_wf_info;
3114: , x_msg_data
3115: , x_return_status
3116: );
3117:
3118: IF(x_return_status = FND_API.g_ret_sts_success )THEN
3119:
3120: -- update pa_wf_process_table
3121: PA_WORKFLOW_UTILS.Insert_WF_Processes
3122: (p_wf_type_code => 'Progress Report'
3133:
3134: IF l_err_code <> 0 THEN
3135: PA_UTILS.Add_Message( p_app_short_name => 'PA'
3136: ,p_msg_name => 'PA_PR_CREATE_WF_FAILED');
3137: x_return_status := FND_API.G_RET_STS_ERROR;
3138:
3139: END IF;
3140:
3141:
3141:
3142: ELSE
3143: PA_UTILS.Add_Message( p_app_short_name => 'PA'
3144: ,p_msg_name => 'PA_PR_CREATE_WF_FAILED');
3145: x_return_status := FND_API.G_RET_STS_ERROR;
3146:
3147: END IF;
3148: END IF;
3149: END IF;
3155:
3156: END IF;
3157:
3158: -- Commit if the flag is set and there is no error
3159: IF (p_commit = FND_API.G_TRUE AND x_return_status = FND_API.g_ret_sts_success )THEN
3160: COMMIT;
3161: END IF;
3162:
3163: -- Reset the error stack when returning to the calling program
3170: -- Set the excetption Message and the stack
3171: FND_MSG_PUB.add_exc_msg ( p_pkg_name => 'PA_PROGRESS_REPORT_PVT.Change_Report_Status'
3172: ,p_procedure_name => PA_DEBUG.G_Err_Stack );
3173: --
3174: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
3175: RAISE; -- This is optional depending on the needs
3176: END change_report_status;
3177:
3178:
3178:
3179: PROCEDURE create_report
3180: (
3181: p_api_version IN NUMBER := 1.0,
3182: p_init_msg_list IN VARCHAR2 := fnd_api.g_true,
3183: p_commit IN VARCHAR2 := FND_API.g_false,
3184: p_validate_only IN VARCHAR2 := FND_API.g_true,
3185: p_max_msg_count IN NUMBER := FND_API.g_miss_num,
3186:
3179: PROCEDURE create_report
3180: (
3181: p_api_version IN NUMBER := 1.0,
3182: p_init_msg_list IN VARCHAR2 := fnd_api.g_true,
3183: p_commit IN VARCHAR2 := FND_API.g_false,
3184: p_validate_only IN VARCHAR2 := FND_API.g_true,
3185: p_max_msg_count IN NUMBER := FND_API.g_miss_num,
3186:
3187: p_object_id IN NUMBER := NULL,
3180: (
3181: p_api_version IN NUMBER := 1.0,
3182: p_init_msg_list IN VARCHAR2 := fnd_api.g_true,
3183: p_commit IN VARCHAR2 := FND_API.g_false,
3184: p_validate_only IN VARCHAR2 := FND_API.g_true,
3185: p_max_msg_count IN NUMBER := FND_API.g_miss_num,
3186:
3187: p_object_id IN NUMBER := NULL,
3188: p_object_type IN VARCHAR2 := NULL,
3181: p_api_version IN NUMBER := 1.0,
3182: p_init_msg_list IN VARCHAR2 := fnd_api.g_true,
3183: p_commit IN VARCHAR2 := FND_API.g_false,
3184: p_validate_only IN VARCHAR2 := FND_API.g_true,
3185: p_max_msg_count IN NUMBER := FND_API.g_miss_num,
3186:
3187: p_object_id IN NUMBER := NULL,
3188: p_object_type IN VARCHAR2 := NULL,
3189: p_report_type_id IN NUMBER := NULL,
3321: -- Initialize the Error Stack
3322: PA_DEBUG.init_err_stack('PA_PROGRESS_REPORT_PVT.create_next_progress_report');
3323:
3324: -- Initialize the return status to success
3325: x_return_status := FND_API.G_RET_STS_SUCCESS;
3326:
3327: -- Issue API savepoint if the transaction is to be committed
3328:
3329: SAVEPOINT create_next_progress_report;
3332: -- check mandatory version_id
3333: IF (p_object_id IS NULL) then
3334: PA_UTILS.Add_Message( p_app_short_name => 'PA'
3335: ,p_msg_name => 'PA_OBJECT_ID_INV');
3336: x_return_status := FND_API.G_RET_STS_ERROR;
3337: END IF;
3338: l_page_id := -99;
3339: l_call_setup := 'N';
3340:
3354:
3355: if (l_page_id = -99) then
3356: PA_UTILS.Add_Message( p_app_short_name => 'PA'
3357: ,p_msg_name => 'PA_NO_PRJ_REP_TEMPLATE');
3358: x_return_status := FND_API.G_RET_STS_ERROR;
3359:
3360: END IF;
3361:
3362: CLOSE get_page_id_type;
3360: END IF;
3361:
3362: CLOSE get_page_id_type;
3363:
3364: IF (l_call_setup = 'Y' and x_return_status = FND_API.g_ret_sts_success) then
3365: ---- call setup api
3366: define_progress_report_setup
3367: (
3368: p_validate_only => FND_API.g_false,
3364: IF (l_call_setup = 'Y' and x_return_status = FND_API.g_ret_sts_success) then
3365: ---- call setup api
3366: define_progress_report_setup
3367: (
3368: p_validate_only => FND_API.g_false,
3369: p_init_msg_list => FND_API.g_false,
3370: p_object_id => p_object_id,
3371: p_object_type => p_object_type,
3372: p_page_type_code => l_page_type,
3365: ---- call setup api
3366: define_progress_report_setup
3367: (
3368: p_validate_only => FND_API.g_false,
3369: p_init_msg_list => FND_API.g_false,
3370: p_object_id => p_object_id,
3371: p_object_type => p_object_type,
3372: p_page_type_code => l_page_type,
3373: p_page_id => l_page_id,
3380: );
3381:
3382: END IF;
3383:
3384: IF (p_validate_only <>FND_API.g_true AND x_return_status = FND_API.g_ret_sts_success) then
3385:
3386: -- create an entry in pa_progress_report_vers table
3387:
3388: --debug_msg('before get dates' || To_char(l_reporting_cycle_id));
3411:
3412: IF (Trunc(l_report_end_date) < Trunc(l_report_start_date)) THEN
3413: PA_UTILS.Add_Message( p_app_short_name => 'PA'
3414: ,p_msg_name => 'PA_REPORT_END_DATE_INV');
3415: x_return_status := FND_API.G_RET_STS_ERROR;
3416: return;
3417: END IF;
3418: ELSE
3419: l_report_cycle_flag := 'N';
3422: l_report_end_date:= Trunc(Sysdate);
3423: END IF;
3424:
3425:
3426: IF (p_validate_only <>FND_API.g_true AND x_return_status = FND_API.g_ret_sts_success) THEN
3427:
3428:
3429: --debug_msg('*********before insert: reported by ' || To_char(fnd_global.user_id));
3430:
3614: CLOSE get_publish_overview;
3615: END IF;
3616:
3617:
3618: IF x_return_status = FND_API.g_ret_sts_success then
3619: --debug_msg ('published report' || To_char(l_last_published_version_id));
3620: -- if there is existing published report
3621: -- copy it, create entries in pa_progress_report_vals table
3622: FOR obj_page_value_rec IN get_all_regions LOOP
3681:
3682: --debug_msg('***end');
3683:
3684: -- Commit if the flag is set and there is no error
3685: IF (p_commit = FND_API.G_TRUE AND x_return_status = FND_API.g_ret_sts_success )THEN
3686: COMMIT;
3687: END IF;
3688:
3689:
3686: COMMIT;
3687: END IF;
3688:
3689:
3690: IF (x_return_status <> FND_API.g_ret_sts_success )THEN
3691: ROLLBACK TO create_next_progress_report;
3692: END IF;
3693:
3694:
3697:
3698:
3699: EXCEPTION
3700: WHEN OTHERS THEN
3701: IF p_commit = FND_API.G_TRUE THEN
3702: ROLLBACK TO create_next_progress_report;
3703: END IF;
3704: --
3705: -- Set the exception Message and the stack
3705: -- Set the exception Message and the stack
3706: FND_MSG_PUB.add_exc_msg ( p_pkg_name => 'PA_PROGRESS_REPORT_PVT.create_next_progress_report'
3707: ,p_procedure_name => PA_DEBUG.G_Err_Stack );
3708: --
3709: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
3710: RAISE; -- This is optional depending on the needs
3711:
3712:
3713: END create_report;
3764: -- Initialize the Error Stack
3765: PA_DEBUG.init_err_stack('PA_PROGRESS_REPORT_PVT.update_project_perccomplete');
3766:
3767: -- Initialize the return status to success
3768: x_return_status := FND_API.G_RET_STS_SUCCESS;
3769:
3770: SAVEPOINT update_project_perccomplete;
3771:
3772: OPEN get_object_info;
3775:
3776: IF get_object_info%notfound THEN
3777: PA_UTILS.Add_Message( p_app_short_name => 'PA'
3778: ,p_msg_name => 'PA_NO_PRJ_REP');
3779: x_return_status := FND_API.G_RET_STS_ERROR;
3780: END IF;
3781:
3782: CLOSE get_object_info;
3783:
3802:
3803: IF get_percent_complete%notfound THEN
3804: -- PA_UTILS.Add_Message( p_app_short_name => 'PA'
3805: -- ,p_msg_name => 'PA_PR_PERCENT_COMPLETE_INV');
3806: -- x_return_status := FND_API.G_RET_STS_ERROR;
3807: NULL;
3808: -- todo when perc complete is null, do we update?
3809:
3810: ELSE
3834: END IF;
3835:
3836: CLOSE get_percent_complete;
3837:
3838: IF (x_return_status <> FND_API.g_ret_sts_success) THEN
3839:
3840: ROLLBACK TO update_project_perccomplete;
3841: RETURN;
3842: END IF;
3849: IF get_dates%notfound THEN
3850: CLOSE get_dates;
3851: PA_UTILS.Add_Message( p_app_short_name => 'PA'
3852: ,p_msg_name => 'PA_PR_DATES_INV');
3853: x_return_status := FND_API.G_RET_STS_ERROR;
3854:
3855: ROLLBACK TO update_project_perccomplete;
3856: PA_DEBUG.Reset_Err_Stack;
3857: RETURN;
3874:
3875: NULL;
3876: END IF;
3877:
3878: IF (x_return_status <> FND_API.g_ret_sts_success) THEN
3879:
3880: ROLLBACK TO update_project_perccomplete;
3881: END IF;
3882:
3888: -- Set the excetption Message and the stack
3889: FND_MSG_PUB.add_exc_msg ( p_pkg_name => 'PA_Progress_Report_PVT.update_project_perccomplete'
3890: ,p_procedure_name => PA_DEBUG.G_Err_Stack );
3891: --
3892: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
3893: RAISE; -- This is optional depending on the needs
3894: END update_project_perccomplete;
3895:
3896: /*
3952: l_module_name varchar2(100) := 'PA_PROGRESS_REPORT_PVT';
3953:
3954: BEGIN
3955: x_msg_count := 0;
3956: x_return_status := FND_API.G_RET_STS_SUCCESS;
3957: pa_debug.set_err_stack('PA_PROGRESS_REPORT_PVT.delete_version_data');
3958: fnd_profile.get('PA_DEBUG_MODE',l_debug_mode);
3959: fnd_profile.get('AFLOG_LEVEL',l_debug_level);
3960: l_debug_mode := NVL(l_debug_mode, 'Y');
4050: pa_debug.reset_err_stack;
4051: EXCEPTION
4052: WHEN others THEN
4053:
4054: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
4055: x_msg_count := 1;
4056: x_msg_data := SQLERRM;
4057: FND_MSG_PUB.add_exc_msg( p_pkg_name => 'PA_PROGRESS_REPORT_PVT'
4058: ,p_procedure_name => 'delete_version_data');