SET DEFINE OFF;
create or replace PACKAGE apps.xxal_pa_project_creation AUTHID DEFINER
IS
PROCEDURE create_project (
p_api_version_number IN NUMBER
:= pa_interface_utils_pub.g_pa_miss_num,
p_commit IN VARCHAR2 := fnd_api.g_false,
p_init_msg_list IN VARCHAR2 := fnd_api.g_false,
p_msg_count OUT NOCOPY NUMBER,
p_msg_data OUT NOCOPY VARCHAR2,
p_return_status OUT NOCOPY VARCHAR2,
p_workflow_started OUT NOCOPY VARCHAR2,
p_pm_product_code IN VARCHAR2
:= pa_interface_utils_pub.g_pa_miss_char,
p_op_validate_flag IN VARCHAR2 := 'Y',
p_project_in IN pa_project_pub.project_in_rec_type,
p_project_out OUT NOCOPY pa_project_pub.project_out_rec_type,
p_customers_in IN pa_project_pub.customer_tbl_type,
p_key_members IN pa_project_pub.project_role_tbl_type,
p_class_categories IN pa_project_pub.class_category_tbl_type,
p_tasks_in IN pa_project_pub.task_in_tbl_type,
p_tasks_out OUT NOCOPY pa_project_pub.task_out_tbl_type,
p_org_roles IN pa_project_pub.project_role_tbl_type,
p_structure_in IN pa_project_pub.structure_in_rec_type,
p_ext_attr_tbl_in IN pa_project_pub.pa_ext_attr_table_type,
p_deliverables_in IN pa_project_pub.deliverable_in_tbl_type,
p_deliverable_actions_in IN pa_project_pub.action_in_tbl_type
);
END xxal_pa_project_creation;
/
SHOW ERRORS;
EXIT;
SET DEFINE OFF;
CREATE OR REPLACE PACKAGE BODY apps.xxal_pa_project_creation
AS
PROCEDURE create_project (
p_api_version_number IN NUMBER
:= pa_interface_utils_pub.g_pa_miss_num,
p_commit IN VARCHAR2 := fnd_api.g_false,
p_init_msg_list IN VARCHAR2 := fnd_api.g_false,
p_msg_count OUT NOCOPY NUMBER,
p_msg_data OUT NOCOPY VARCHAR2,
p_return_status OUT NOCOPY VARCHAR2,
p_workflow_started OUT NOCOPY VARCHAR2,
p_pm_product_code IN VARCHAR2
:= pa_interface_utils_pub.g_pa_miss_char,
p_op_validate_flag IN VARCHAR2 := 'Y',
p_project_in IN pa_project_pub.project_in_rec_type,
p_project_out OUT NOCOPY pa_project_pub.project_out_rec_type,
p_customers_in IN pa_project_pub.customer_tbl_type,
p_key_members IN pa_project_pub.project_role_tbl_type,
p_class_categories IN pa_project_pub.class_category_tbl_type,
p_tasks_in IN pa_project_pub.task_in_tbl_type,
p_tasks_out OUT NOCOPY pa_project_pub.task_out_tbl_type,
p_org_roles IN pa_project_pub.project_role_tbl_type,
p_structure_in IN pa_project_pub.structure_in_rec_type,
p_ext_attr_tbl_in IN pa_project_pub.pa_ext_attr_table_type,
p_deliverables_in IN pa_project_pub.deliverable_in_tbl_type,
p_deliverable_actions_in IN pa_project_pub.action_in_tbl_type
)
IS
l_project_type VARCHAR2 (50);
l_std_bill_rate_schedule VARCHAR2 (100);
CURSOR l_template_task (l_orig_project_id NUMBER)
IS
SELECT b.task_number parent_task_ref, a.*
FROM pa_tasks a, pa_tasks b
WHERE a.project_id = l_orig_project_id AND a.parent_task_id = b.task_id(+)
ORDER BY a.task_id;
l_count NUMBER;
i NUMBER;
l_tasks_in pa_project_pub.task_in_tbl_type;
l_customers_in pa_project_pub.customer_tbl_type;
l_customer_id NUMBER;
k NUMBER;
null_val VARCHAR2 (10);
p_validate_only VARCHAR2 (200);
p_validation_level NUMBER;
p_calling_module VARCHAR2 (200);
p_debug_mode VARCHAR2 (200);
p_max_msg_count NUMBER;
p_project_id NUMBER;
p_customer_id NUMBER;
p_customer_name VARCHAR2 (200);
p_customer_number VARCHAR2 (200);
p_project_relationship_code VARCHAR2 (200);
p_customer_bill_split NUMBER;
p_bill_to_customer_id NUMBER;
p_ship_to_customer_id NUMBER;
p_bill_to_customer_name VARCHAR2 (200);
p_bill_to_customer_number VARCHAR2 (200);
p_ship_to_customer_name VARCHAR2 (200);
p_ship_to_customer_number VARCHAR2 (200);
p_bill_to_address_id NUMBER;
p_ship_to_address_id NUMBER;
p_bill_site_name VARCHAR2 (200);
p_work_site_name VARCHAR2 (200);
p_inv_currency_code VARCHAR2 (200);
p_inv_rate_type VARCHAR2 (200);
p_inv_rate_date DATE;
p_inv_exchange_rate NUMBER;
p_allow_user_rate_type_flag VARCHAR2 (200);
p_receiver_task_id NUMBER;
x_customer_id NUMBER;
x_return_status VARCHAR2 (200);
x_msg_count NUMBER;
x_msg_data VARCHAR2 (200);
p_project_party_id NUMBER;
p_default_top_task_cust_flag VARCHAR2 (200);
p_en_top_task_cust_flag VARCHAR2 (200);
l_customer_bill_split NUMBER;
BEGIN
p_return_status := 'S';
l_customers_in := p_customers_in;
l_tasks_in := p_tasks_in;
l_count := l_tasks_in.COUNT;
i := l_count + 1;
BEGIN
SELECT ppa.project_type
INTO l_project_type
FROM pa_projects_all ppa, pa_project_types_all ppt
WHERE ppa.project_type = ppt.project_type
AND ppt.project_type_class_code = 'CONTRACT'
AND ppa.project_id = p_project_in.created_from_project_id;
EXCEPTION
WHEN NO_DATA_FOUND
THEN
NULL;
WHEN OTHERS
THEN
p_return_status := 'E';
raise_application_error (-20101,
'Obtaining Project type error: '
|| SQLERRM
);
END;
DBMS_OUTPUT.put_line ( 'Customer count in pkg '
|| p_customers_in.COUNT
|| p_project_in.created_from_project_id
);
IF l_project_type IS NOT NULL
THEN
BEGIN
SELECT std_bill_rate_schedule
INTO l_std_bill_rate_schedule
FROM pa_std_bill_rate_schedules_all
WHERE bill_rate_sch_id = p_project_in.non_lab_std_bill_rt_sch_id;
EXCEPTION
WHEN NO_DATA_FOUND
THEN
NULL;
-- raise_application_error (-20101,
-- 'Non Labour Schedule is Invalid: '
-- || SQLERRM
-- );
END;
END IF;
FOR cur_cur_task IN
l_template_task (p_project_in.created_from_project_id)
LOOP
DBMS_OUTPUT.put_line ('inside');
l_tasks_in (i).pm_task_reference := cur_cur_task.task_number;
l_tasks_in (i).task_name := cur_cur_task.task_name;
l_tasks_in (i).long_task_name := cur_cur_task.long_task_name;
l_tasks_in (i).pa_task_number := cur_cur_task.task_number;
l_tasks_in (i).task_description := cur_cur_task.description;
l_tasks_in (i).task_start_date := p_project_in.start_date;
l_tasks_in (i).task_completion_date := p_project_in.completion_date;
l_tasks_in (i).pm_parent_task_reference :=
cur_cur_task.parent_task_ref;
l_tasks_in (i).address_id := cur_cur_task.address_id;
l_tasks_in (i).carrying_out_organization_id :=
p_project_in.carrying_out_organization_id;
l_tasks_in (i).service_type_code := cur_cur_task.service_type_code;
l_tasks_in (i).task_manager_person_id :=
cur_cur_task.task_manager_person_id;
l_tasks_in (i).billable_flag := cur_cur_task.billable_flag;
l_tasks_in (i).chargeable_flag := cur_cur_task.chargeable_flag;
l_tasks_in (i).attribute_category := cur_cur_task.attribute_category;
l_tasks_in (i).attribute1 := cur_cur_task.attribute1;
l_tasks_in (i).attribute2 := cur_cur_task.attribute2;
l_tasks_in (i).attribute3 := cur_cur_task.attribute3;
l_tasks_in (i).attribute4 := cur_cur_task.attribute4;
l_tasks_in (i).attribute5 := cur_cur_task.attribute5;
l_tasks_in (i).attribute6 := cur_cur_task.attribute6;
l_tasks_in (i).attribute7 := cur_cur_task.attribute7;
l_tasks_in (i).attribute8 := cur_cur_task.attribute8;
l_tasks_in (i).attribute9 := cur_cur_task.attribute9;
l_tasks_in (i).attribute10 := cur_cur_task.attribute10;
l_tasks_in (i).receive_project_invoice_flag :=
cur_cur_task.receive_project_invoice_flag;
l_tasks_in (i).work_type_id := cur_cur_task.work_type_id;
l_tasks_in (i).retirement_cost_flag :=
cur_cur_task.retirement_cost_flag;
-- l_tasks_in (i).non_labor_sch_type := p_project_in.non_labor_sch_type;
-- l_tasks_in (i).non_labor_std_bill_rate_schdl :=
-- l_std_bill_rate_schedule;
-- l_tasks_in (i).non_labor_bill_rate_org_id :=
-- p_project_in.non_labor_bill_rate_org_id;
-- l_tasks_in (i).non_lab_std_bill_rt_sch_id :=
-- p_project_in.non_lab_std_bill_rt_sch_id;
DBMS_OUTPUT.put_line ( 'l_tasks_in (i).pa_task_number '
|| l_tasks_in (i).pa_task_number
|| ':'
|| l_tasks_in (i).pa_parent_task_id
);
i := i + 1;
END LOOP;
BEGIN
--mo_global.init ('PA');
DBMS_OUTPUT.put_line ('INSIDE ');
PA_PROJECT_PUB.create_project (p_api_version_number,
p_commit,
p_init_msg_list,
p_msg_count,
p_msg_data,
p_return_status,
p_workflow_started,
p_pm_product_code,
p_op_validate_flag,
p_project_in,
p_project_out,
p_customers_in,
p_key_members,
p_class_categories,
l_tasks_in,
p_tasks_out,
p_org_roles,
p_structure_in,
p_ext_attr_tbl_in,
p_deliverables_in,
p_deliverable_actions_in
);
DBMS_OUTPUT.put_line (' p_return_status' || p_return_status);
EXCEPTION
WHEN OTHERS
THEN
p_return_status := 'E';
raise_application_error (-20101,
'Error CREATE_PROJECT: ' || SQLERRM
);
END;
/*IF p_return_status = 'S'
THEN
DBMS_OUTPUT.put_line ( 'p_project_out.pa_project_id '
|| p_project_out.pa_project_id
);
IF l_project_type IS NOT NULL
THEN
BEGIN
UPDATE pa_projects_all
SET non_labor_sch_type = p_project_in.non_labor_sch_type,
non_labor_bill_rate_org_id =
p_project_in.non_labor_bill_rate_org_id,
non_labor_std_bill_rate_schdl = l_std_bill_rate_schedule,
non_lab_std_bill_rt_sch_id =
p_project_in.non_lab_std_bill_rt_sch_id
WHERE project_id = p_project_out.pa_project_id;
EXCEPTION
WHEN OTHERS
THEN
raise_application_error (-20101,
'Project update Error: ' || SQLERRM
);
END;
END IF;
END IF;*/
IF p_return_status = 'S'
THEN
p_validate_only := 'FND_API.G_TRUE';
p_validation_level := fnd_api.g_valid_level_full;
p_calling_module := 'SELF_SERVICE';
p_debug_mode := 'N';
p_max_msg_count := fnd_api.g_miss_num;
p_customer_name := 'FND_API.G_MISS_CHAR';
p_customer_number := 'FND_API.G_MISS_CHAR';
p_bill_to_customer_name := 'FND_API.G_MISS_CHAR';
p_bill_to_customer_number := 'FND_API.G_MISS_CHAR';
p_ship_to_customer_name := 'FND_API.G_MISS_CHAR';
p_ship_to_customer_number := 'FND_API.G_MISS_CHAR';
p_bill_site_name := 'FND_API.G_MISS_CHAR';
p_work_site_name := 'FND_API.G_MISS_CHAR';
p_inv_rate_type := 'FND_API.G_MISS_CHAR';
p_inv_rate_date := fnd_api.g_miss_date;
p_inv_exchange_rate := fnd_api.g_miss_num;
p_receiver_task_id := fnd_api.g_miss_num;
x_customer_id := NULL;
x_return_status := NULL;
x_msg_count := NULL;
x_msg_data := NULL;
p_project_party_id := NULL;
p_default_top_task_cust_flag := NULL;
--DBMS_OUTPUT.put_line ('Cust Block');
IF l_customers_in.COUNT > 0
THEN
FOR k IN l_customers_in.FIRST .. l_customers_in.LAST
LOOP
DBMS_OUTPUT.put_line ('Cust Block' || k);
x_return_status := 'S';
BEGIN
SELECT customer_id, customer_bill_split
INTO l_customer_id, l_customer_bill_split
FROM pa_project_customers
WHERE project_id = p_project_out.pa_project_id
AND customer_id = p_customers_in (k).customer_id;
EXCEPTION
WHEN NO_DATA_FOUND
THEN
l_customer_id := NULL;
END;
IF l_customer_bill_split <= 100
THEN
UPDATE pa_project_customers
SET customer_bill_split =
p_customers_in (k).customer_bill_split,
project_relationship_code =
p_customers_in (k).project_relationship_code
WHERE project_id = p_project_out.pa_project_id
AND customer_id = p_customers_in (k).customer_id;
END IF;
-- DBMS_OUTPUT.put_line ( 'l_CUSTOMER_BILL_SPLIT '
-- || l_customer_bill_split
-- );
IF l_customer_id IS NULL
THEN
DBMS_OUTPUT.put_line ( 'Cust Block inner '
|| p_project_out.pa_project_id
|| ' '
|| p_customers_in (k).customer_id
);
BEGIN
apps.pa_customers_contacts_pub.create_project_customer
('1',
'T',
'F',
p_validate_only,
p_validation_level,
p_calling_module,
p_debug_mode,
p_max_msg_count,
p_project_out.pa_project_id,
p_customers_in (k).customer_id,
p_customer_name,
p_customer_number,
p_customers_in (k).project_relationship_code,
p_customers_in (k).customer_bill_split,
p_customers_in (k).customer_id,
p_customers_in (k).customer_id,
p_bill_to_customer_name,
p_bill_to_customer_number,
p_ship_to_customer_name,
p_ship_to_customer_number,
p_customers_in (k).bill_to_address_id,
p_customers_in (k).ship_to_address_id,
p_bill_site_name,
p_work_site_name,
p_customers_in (k).inv_currency_code,
p_customers_in (k).inv_rate_type,
p_customers_in (k).inv_rate_date,
p_customers_in (k).inv_exchange_rate,
p_customers_in (k).allow_inv_user_rate_type_flag,
p_customers_in (k).receiver_task_id,
x_customer_id,
x_return_status,
x_msg_count,
x_msg_data,
p_project_party_id,
p_default_top_task_cust_flag,
p_customers_in (k).enable_top_task_cust_flag
);
EXCEPTION
WHEN OTHERS
THEN
DBMS_OUTPUT.put_line ('EXCEPTION');
x_return_status := 'E';
x_msg_data :=
'Error in adding the customer ' || SQLERRM;
raise_application_error
(-20101,
'Project Customer Error: '
|| x_msg_data
);
END;
DBMS_OUTPUT.put_line ( 'x_return_status '
|| x_return_status
|| ' '
|| x_customer_id
);
DBMS_OUTPUT.put_line ('x_msg_data ' || x_msg_data || SQLERRM);
END IF;
p_return_status := x_return_status;
p_msg_data := x_msg_data || SQLERRM;
END LOOP;
END IF;
END IF;
END;
END xxal_pa_project_creation;
/
SHOW ERRORS;
EXIT;
create or replace PACKAGE apps.xxal_pa_project_creation AUTHID DEFINER
IS
PROCEDURE create_project (
p_api_version_number IN NUMBER
:= pa_interface_utils_pub.g_pa_miss_num,
p_commit IN VARCHAR2 := fnd_api.g_false,
p_init_msg_list IN VARCHAR2 := fnd_api.g_false,
p_msg_count OUT NOCOPY NUMBER,
p_msg_data OUT NOCOPY VARCHAR2,
p_return_status OUT NOCOPY VARCHAR2,
p_workflow_started OUT NOCOPY VARCHAR2,
p_pm_product_code IN VARCHAR2
:= pa_interface_utils_pub.g_pa_miss_char,
p_op_validate_flag IN VARCHAR2 := 'Y',
p_project_in IN pa_project_pub.project_in_rec_type,
p_project_out OUT NOCOPY pa_project_pub.project_out_rec_type,
p_customers_in IN pa_project_pub.customer_tbl_type,
p_key_members IN pa_project_pub.project_role_tbl_type,
p_class_categories IN pa_project_pub.class_category_tbl_type,
p_tasks_in IN pa_project_pub.task_in_tbl_type,
p_tasks_out OUT NOCOPY pa_project_pub.task_out_tbl_type,
p_org_roles IN pa_project_pub.project_role_tbl_type,
p_structure_in IN pa_project_pub.structure_in_rec_type,
p_ext_attr_tbl_in IN pa_project_pub.pa_ext_attr_table_type,
p_deliverables_in IN pa_project_pub.deliverable_in_tbl_type,
p_deliverable_actions_in IN pa_project_pub.action_in_tbl_type
);
END xxal_pa_project_creation;
/
SHOW ERRORS;
EXIT;
SET DEFINE OFF;
CREATE OR REPLACE PACKAGE BODY apps.xxal_pa_project_creation
AS
PROCEDURE create_project (
p_api_version_number IN NUMBER
:= pa_interface_utils_pub.g_pa_miss_num,
p_commit IN VARCHAR2 := fnd_api.g_false,
p_init_msg_list IN VARCHAR2 := fnd_api.g_false,
p_msg_count OUT NOCOPY NUMBER,
p_msg_data OUT NOCOPY VARCHAR2,
p_return_status OUT NOCOPY VARCHAR2,
p_workflow_started OUT NOCOPY VARCHAR2,
p_pm_product_code IN VARCHAR2
:= pa_interface_utils_pub.g_pa_miss_char,
p_op_validate_flag IN VARCHAR2 := 'Y',
p_project_in IN pa_project_pub.project_in_rec_type,
p_project_out OUT NOCOPY pa_project_pub.project_out_rec_type,
p_customers_in IN pa_project_pub.customer_tbl_type,
p_key_members IN pa_project_pub.project_role_tbl_type,
p_class_categories IN pa_project_pub.class_category_tbl_type,
p_tasks_in IN pa_project_pub.task_in_tbl_type,
p_tasks_out OUT NOCOPY pa_project_pub.task_out_tbl_type,
p_org_roles IN pa_project_pub.project_role_tbl_type,
p_structure_in IN pa_project_pub.structure_in_rec_type,
p_ext_attr_tbl_in IN pa_project_pub.pa_ext_attr_table_type,
p_deliverables_in IN pa_project_pub.deliverable_in_tbl_type,
p_deliverable_actions_in IN pa_project_pub.action_in_tbl_type
)
IS
l_project_type VARCHAR2 (50);
l_std_bill_rate_schedule VARCHAR2 (100);
CURSOR l_template_task (l_orig_project_id NUMBER)
IS
SELECT b.task_number parent_task_ref, a.*
FROM pa_tasks a, pa_tasks b
WHERE a.project_id = l_orig_project_id AND a.parent_task_id = b.task_id(+)
ORDER BY a.task_id;
l_count NUMBER;
i NUMBER;
l_tasks_in pa_project_pub.task_in_tbl_type;
l_customers_in pa_project_pub.customer_tbl_type;
l_customer_id NUMBER;
k NUMBER;
null_val VARCHAR2 (10);
p_validate_only VARCHAR2 (200);
p_validation_level NUMBER;
p_calling_module VARCHAR2 (200);
p_debug_mode VARCHAR2 (200);
p_max_msg_count NUMBER;
p_project_id NUMBER;
p_customer_id NUMBER;
p_customer_name VARCHAR2 (200);
p_customer_number VARCHAR2 (200);
p_project_relationship_code VARCHAR2 (200);
p_customer_bill_split NUMBER;
p_bill_to_customer_id NUMBER;
p_ship_to_customer_id NUMBER;
p_bill_to_customer_name VARCHAR2 (200);
p_bill_to_customer_number VARCHAR2 (200);
p_ship_to_customer_name VARCHAR2 (200);
p_ship_to_customer_number VARCHAR2 (200);
p_bill_to_address_id NUMBER;
p_ship_to_address_id NUMBER;
p_bill_site_name VARCHAR2 (200);
p_work_site_name VARCHAR2 (200);
p_inv_currency_code VARCHAR2 (200);
p_inv_rate_type VARCHAR2 (200);
p_inv_rate_date DATE;
p_inv_exchange_rate NUMBER;
p_allow_user_rate_type_flag VARCHAR2 (200);
p_receiver_task_id NUMBER;
x_customer_id NUMBER;
x_return_status VARCHAR2 (200);
x_msg_count NUMBER;
x_msg_data VARCHAR2 (200);
p_project_party_id NUMBER;
p_default_top_task_cust_flag VARCHAR2 (200);
p_en_top_task_cust_flag VARCHAR2 (200);
l_customer_bill_split NUMBER;
BEGIN
p_return_status := 'S';
l_customers_in := p_customers_in;
l_tasks_in := p_tasks_in;
l_count := l_tasks_in.COUNT;
i := l_count + 1;
BEGIN
SELECT ppa.project_type
INTO l_project_type
FROM pa_projects_all ppa, pa_project_types_all ppt
WHERE ppa.project_type = ppt.project_type
AND ppt.project_type_class_code = 'CONTRACT'
AND ppa.project_id = p_project_in.created_from_project_id;
EXCEPTION
WHEN NO_DATA_FOUND
THEN
NULL;
WHEN OTHERS
THEN
p_return_status := 'E';
raise_application_error (-20101,
'Obtaining Project type error: '
|| SQLERRM
);
END;
DBMS_OUTPUT.put_line ( 'Customer count in pkg '
|| p_customers_in.COUNT
|| p_project_in.created_from_project_id
);
IF l_project_type IS NOT NULL
THEN
BEGIN
SELECT std_bill_rate_schedule
INTO l_std_bill_rate_schedule
FROM pa_std_bill_rate_schedules_all
WHERE bill_rate_sch_id = p_project_in.non_lab_std_bill_rt_sch_id;
EXCEPTION
WHEN NO_DATA_FOUND
THEN
NULL;
-- raise_application_error (-20101,
-- 'Non Labour Schedule is Invalid: '
-- || SQLERRM
-- );
END;
END IF;
FOR cur_cur_task IN
l_template_task (p_project_in.created_from_project_id)
LOOP
DBMS_OUTPUT.put_line ('inside');
l_tasks_in (i).pm_task_reference := cur_cur_task.task_number;
l_tasks_in (i).task_name := cur_cur_task.task_name;
l_tasks_in (i).long_task_name := cur_cur_task.long_task_name;
l_tasks_in (i).pa_task_number := cur_cur_task.task_number;
l_tasks_in (i).task_description := cur_cur_task.description;
l_tasks_in (i).task_start_date := p_project_in.start_date;
l_tasks_in (i).task_completion_date := p_project_in.completion_date;
l_tasks_in (i).pm_parent_task_reference :=
cur_cur_task.parent_task_ref;
l_tasks_in (i).address_id := cur_cur_task.address_id;
l_tasks_in (i).carrying_out_organization_id :=
p_project_in.carrying_out_organization_id;
l_tasks_in (i).service_type_code := cur_cur_task.service_type_code;
l_tasks_in (i).task_manager_person_id :=
cur_cur_task.task_manager_person_id;
l_tasks_in (i).billable_flag := cur_cur_task.billable_flag;
l_tasks_in (i).chargeable_flag := cur_cur_task.chargeable_flag;
l_tasks_in (i).attribute_category := cur_cur_task.attribute_category;
l_tasks_in (i).attribute1 := cur_cur_task.attribute1;
l_tasks_in (i).attribute2 := cur_cur_task.attribute2;
l_tasks_in (i).attribute3 := cur_cur_task.attribute3;
l_tasks_in (i).attribute4 := cur_cur_task.attribute4;
l_tasks_in (i).attribute5 := cur_cur_task.attribute5;
l_tasks_in (i).attribute6 := cur_cur_task.attribute6;
l_tasks_in (i).attribute7 := cur_cur_task.attribute7;
l_tasks_in (i).attribute8 := cur_cur_task.attribute8;
l_tasks_in (i).attribute9 := cur_cur_task.attribute9;
l_tasks_in (i).attribute10 := cur_cur_task.attribute10;
l_tasks_in (i).receive_project_invoice_flag :=
cur_cur_task.receive_project_invoice_flag;
l_tasks_in (i).work_type_id := cur_cur_task.work_type_id;
l_tasks_in (i).retirement_cost_flag :=
cur_cur_task.retirement_cost_flag;
-- l_tasks_in (i).non_labor_sch_type := p_project_in.non_labor_sch_type;
-- l_tasks_in (i).non_labor_std_bill_rate_schdl :=
-- l_std_bill_rate_schedule;
-- l_tasks_in (i).non_labor_bill_rate_org_id :=
-- p_project_in.non_labor_bill_rate_org_id;
-- l_tasks_in (i).non_lab_std_bill_rt_sch_id :=
-- p_project_in.non_lab_std_bill_rt_sch_id;
DBMS_OUTPUT.put_line ( 'l_tasks_in (i).pa_task_number '
|| l_tasks_in (i).pa_task_number
|| ':'
|| l_tasks_in (i).pa_parent_task_id
);
i := i + 1;
END LOOP;
BEGIN
--mo_global.init ('PA');
DBMS_OUTPUT.put_line ('INSIDE ');
PA_PROJECT_PUB.create_project (p_api_version_number,
p_commit,
p_init_msg_list,
p_msg_count,
p_msg_data,
p_return_status,
p_workflow_started,
p_pm_product_code,
p_op_validate_flag,
p_project_in,
p_project_out,
p_customers_in,
p_key_members,
p_class_categories,
l_tasks_in,
p_tasks_out,
p_org_roles,
p_structure_in,
p_ext_attr_tbl_in,
p_deliverables_in,
p_deliverable_actions_in
);
DBMS_OUTPUT.put_line (' p_return_status' || p_return_status);
EXCEPTION
WHEN OTHERS
THEN
p_return_status := 'E';
raise_application_error (-20101,
'Error CREATE_PROJECT: ' || SQLERRM
);
END;
/*IF p_return_status = 'S'
THEN
DBMS_OUTPUT.put_line ( 'p_project_out.pa_project_id '
|| p_project_out.pa_project_id
);
IF l_project_type IS NOT NULL
THEN
BEGIN
UPDATE pa_projects_all
SET non_labor_sch_type = p_project_in.non_labor_sch_type,
non_labor_bill_rate_org_id =
p_project_in.non_labor_bill_rate_org_id,
non_labor_std_bill_rate_schdl = l_std_bill_rate_schedule,
non_lab_std_bill_rt_sch_id =
p_project_in.non_lab_std_bill_rt_sch_id
WHERE project_id = p_project_out.pa_project_id;
EXCEPTION
WHEN OTHERS
THEN
raise_application_error (-20101,
'Project update Error: ' || SQLERRM
);
END;
END IF;
END IF;*/
IF p_return_status = 'S'
THEN
p_validate_only := 'FND_API.G_TRUE';
p_validation_level := fnd_api.g_valid_level_full;
p_calling_module := 'SELF_SERVICE';
p_debug_mode := 'N';
p_max_msg_count := fnd_api.g_miss_num;
p_customer_name := 'FND_API.G_MISS_CHAR';
p_customer_number := 'FND_API.G_MISS_CHAR';
p_bill_to_customer_name := 'FND_API.G_MISS_CHAR';
p_bill_to_customer_number := 'FND_API.G_MISS_CHAR';
p_ship_to_customer_name := 'FND_API.G_MISS_CHAR';
p_ship_to_customer_number := 'FND_API.G_MISS_CHAR';
p_bill_site_name := 'FND_API.G_MISS_CHAR';
p_work_site_name := 'FND_API.G_MISS_CHAR';
p_inv_rate_type := 'FND_API.G_MISS_CHAR';
p_inv_rate_date := fnd_api.g_miss_date;
p_inv_exchange_rate := fnd_api.g_miss_num;
p_receiver_task_id := fnd_api.g_miss_num;
x_customer_id := NULL;
x_return_status := NULL;
x_msg_count := NULL;
x_msg_data := NULL;
p_project_party_id := NULL;
p_default_top_task_cust_flag := NULL;
--DBMS_OUTPUT.put_line ('Cust Block');
IF l_customers_in.COUNT > 0
THEN
FOR k IN l_customers_in.FIRST .. l_customers_in.LAST
LOOP
DBMS_OUTPUT.put_line ('Cust Block' || k);
x_return_status := 'S';
BEGIN
SELECT customer_id, customer_bill_split
INTO l_customer_id, l_customer_bill_split
FROM pa_project_customers
WHERE project_id = p_project_out.pa_project_id
AND customer_id = p_customers_in (k).customer_id;
EXCEPTION
WHEN NO_DATA_FOUND
THEN
l_customer_id := NULL;
END;
IF l_customer_bill_split <= 100
THEN
UPDATE pa_project_customers
SET customer_bill_split =
p_customers_in (k).customer_bill_split,
project_relationship_code =
p_customers_in (k).project_relationship_code
WHERE project_id = p_project_out.pa_project_id
AND customer_id = p_customers_in (k).customer_id;
END IF;
-- DBMS_OUTPUT.put_line ( 'l_CUSTOMER_BILL_SPLIT '
-- || l_customer_bill_split
-- );
IF l_customer_id IS NULL
THEN
DBMS_OUTPUT.put_line ( 'Cust Block inner '
|| p_project_out.pa_project_id
|| ' '
|| p_customers_in (k).customer_id
);
BEGIN
apps.pa_customers_contacts_pub.create_project_customer
('1',
'T',
'F',
p_validate_only,
p_validation_level,
p_calling_module,
p_debug_mode,
p_max_msg_count,
p_project_out.pa_project_id,
p_customers_in (k).customer_id,
p_customer_name,
p_customer_number,
p_customers_in (k).project_relationship_code,
p_customers_in (k).customer_bill_split,
p_customers_in (k).customer_id,
p_customers_in (k).customer_id,
p_bill_to_customer_name,
p_bill_to_customer_number,
p_ship_to_customer_name,
p_ship_to_customer_number,
p_customers_in (k).bill_to_address_id,
p_customers_in (k).ship_to_address_id,
p_bill_site_name,
p_work_site_name,
p_customers_in (k).inv_currency_code,
p_customers_in (k).inv_rate_type,
p_customers_in (k).inv_rate_date,
p_customers_in (k).inv_exchange_rate,
p_customers_in (k).allow_inv_user_rate_type_flag,
p_customers_in (k).receiver_task_id,
x_customer_id,
x_return_status,
x_msg_count,
x_msg_data,
p_project_party_id,
p_default_top_task_cust_flag,
p_customers_in (k).enable_top_task_cust_flag
);
EXCEPTION
WHEN OTHERS
THEN
DBMS_OUTPUT.put_line ('EXCEPTION');
x_return_status := 'E';
x_msg_data :=
'Error in adding the customer ' || SQLERRM;
raise_application_error
(-20101,
'Project Customer Error: '
|| x_msg_data
);
END;
DBMS_OUTPUT.put_line ( 'x_return_status '
|| x_return_status
|| ' '
|| x_customer_id
);
DBMS_OUTPUT.put_line ('x_msg_data ' || x_msg_data || SQLERRM);
END IF;
p_return_status := x_return_status;
p_msg_data := x_msg_data || SQLERRM;
END LOOP;
END IF;
END IF;
END;
END xxal_pa_project_creation;
/
SHOW ERRORS;
EXIT;
No comments:
Post a Comment