SUPPLIER_INFO_API.Copy_Existing_Supplier_Inv
- PROCEDURE Copy_Existing_Supplier_Inv (
- supplier_id_ IN VARCHAR2,
- new_id_ IN VARCHAR2,
- company_ IN VARCHAR2,
- new_name_ IN VARCHAR2,
- association_no_ IN VARCHAR2 DEFAULT NULL )
- IS
- info_ VARCHAR2(32000);
- objid_ VARCHAR2(100);
- objversion_ VARCHAR2(200);
- attr_ VARCHAR2(2000);
- temp_id_ VARCHAR2(20);
- newrec_ SUPPLIER_INFO_TAB%ROWTYPE;
- CURSOR get_attr IS
- SELECT *
- FROM SUPPLIER_INFO_TAB
- WHERE supplier_id = supplier_id_;
- BEGIN
- General_SYS.Init_Method(lu_name_, 'SUPPLIER_INFO_API', 'Copy_Existing_Supplier_Inv');
- Trace_SYS.message('SUPPLIER_INFO_API.Copy_Existing_Supplier_Inv('||supplier_id_||')');
- OPEN get_attr;
- FETCH get_attr INTO newrec_;
- IF get_attr%NOTFOUND THEN
- error_sys.record_general(lu_name_, 'NOSUPP:Supplier :P1 does not exist', supplier_id_);
- CLOSE get_attr;
- ELSE
- Client_SYS.Clear_Attr(attr_);
- Client_SYS.Add_To_Attr('SUPPLIER_ID', new_id_, attr_);
- Client_SYS.Add_To_Attr('NAME', new_name_, attr_);
- Client_SYS.Add_To_Attr('CREATION_DATE', trunc(sysdate), attr_);
- Client_SYS.Add_To_Attr('PARTY_TYPE', party_type_api.decode('SUPPLIER'), attr_);
- Client_SYS.Add_To_Attr('DEFAULT_DOMAIN', 'TRUE', attr_);
- client_sys.add_to_attr('ASSOCIATION_NO', association_no_, attr_);
- Client_SYS.Add_To_Attr('COUNTRY', iso_country_api.decode(newrec_.country), attr_);
- Client_SYS.Add_To_Attr('DEFAULT_LANGUAGE', iso_language_api.decode(newrec_.default_language), attr_);
- Client_SYS.Add_To_Attr('SUPPLIERS_OWN_ID', newrec_.suppliers_own_id, attr_);
- Client_SYS.Add_To_Attr('CORPORATE_FORM', newrec_.corporate_form, attr_);
- New__(info_, objid_, objversion_, attr_, 'DO');
- IF (new_id_ IS NULL) THEN
- temp_id_:= client_sys.get_item_value('SUPPLIER_ID', attr_);
- copy_details___(supplier_id_, temp_id_, company_);
- ELSE
- copy_details___(supplier_id_, new_id_, company_);
- END IF;
- END IF;
- END Copy_Existing_Supplier_Inv;
複製代碼- PROCEDURE Copy_Details___ (
- supplier_id_ IN VARCHAR2,
- new_id_ IN VARCHAR2,
- company_ IN VARCHAR2 )
- IS
- pkg_method_name_ VARCHAR2(200);
- module_ VARCHAR2(6);
- cursor_ NUMBER;
- count_ NUMBER;
- stmt_ VARCHAR2(100);
- CURSOR get_copying_info IS
- SELECT pkg_and_method_name, module
- FROM copying_info_tab
- WHERE party_type = 'SUPPLIER'
- ORDER BY exec_order;
- BEGIN
- General_SYS.Init_Method(lu_name_, 'SUPPLIER_INFO_API', 'Copy_Details___');
- OPEN get_copying_info;
- WHILE (TRUE) LOOP
- FETCH get_copying_info INTO pkg_method_name_, module_;
- EXIT WHEN get_copying_info%NOTFOUND;
- Assert_SYS.Assert_Is_Package_Method(pkg_method_name_);
- cursor_ := dbms_sql.open_cursor;
- IF (module_ = 'INVOIC') THEN
- stmt_ := 'BEGIN '||pkg_method_name_||'(:supplier_id_, :new_id_, :company_); END;';
- dbms_sql.parse(cursor_, stmt_, dbms_sql.native);
- dbms_sql.bind_variable(cursor_, 'supplier_id_', supplier_id_);
- dbms_sql.bind_variable(cursor_, 'new_id_', new_id_);
- dbms_sql.bind_variable(cursor_, 'company_', company_);
- ELSIF (module_ = 'PAYLED') THEN
- stmt_ := 'BEGIN '||pkg_method_name_||'(:supplier_id_, :new_id_, :company_); END;';
- dbms_sql.parse(cursor_, stmt_, dbms_sql.native);
- dbms_sql.bind_variable(cursor_, 'supplier_id_', supplier_id_);
- dbms_sql.bind_variable(cursor_, 'new_id_', new_id_);
- dbms_sql.bind_variable(cursor_, 'company_', company_);
- ELSE
- stmt_ := 'BEGIN '||pkg_method_name_||'(:supplier_id_, :new_id_); END;';
- dbms_sql.parse(cursor_, stmt_, dbms_sql.native);
- dbms_sql.bind_variable(cursor_, 'supplier_id_', supplier_id_);
- dbms_sql.bind_variable(cursor_, 'new_id_', new_id_);
- END IF;
- count_ := dbms_sql.execute(cursor_);
- dbms_sql.close_cursor(cursor_);
- END LOOP;
- CLOSE get_copying_info;
- EXCEPTION
- WHEN OTHERS THEN
- IF (dbms_sql.is_open(cursor_)) THEN
- dbms_sql.close_cursor(cursor_);
- END IF;
- RAISE;
- END Copy_Details___;
複製代碼 select * from COPYING_INFO_TAB
where party_type ='SUPPLIER'
PARTY_TYPE MODULE PKG_AND_METHOD_NAME ROWVERSION EXEC_ORDER
1 SUPPLIER ENTERP Supplier_Info_Address_API.Copy_Supplier 1 5
2 SUPPLIER ENTERP Supplier_Info_Address_Type_API.Copy_Supplier 1 6
3 SUPPLIER ENTERP Supplier_Info_Comm_Method_API.Copy_Supplier 1 7
4 SUPPLIER ENTERP Supplier_Info_Msg_Setup_API.Copy_Supplier 1 8
5 SUPPLIER ENTERP Supplier_Info_Our_Id_API.Copy_Supplier 1 9
6 SUPPLIER INVOIC Identity_Invoice_Info_API.Copy_Supplier 1 52
7 SUPPLIER INVOIC Party_Type_Id_Property_API.Copy_Supplier 1 53
8 SUPPLIER INVOIC TYPE1099_PER_SUPPLIER_API.Copy_Supplier 1 54
9 SUPPLIER INVOIC INCOME_TYPE_PER_SUPPLIER_API.Copy_Supplier 1 55
10 SUPPLIER INVOIC TAX_WITHHOLD_PER_IDENTITY_API.Copy_Supplier 1 56
11 SUPPLIER INVOIC SUPP_DEF_COST_CODE_STRING_API.Copy_Supplier 1 57FOR NTCH
12 SUPPLIER PAYLED Identity_Pay_Info_API.Copy_Supplier 1 101
13 SUPPLIER PURCH Supplier_API.Copy_Supplier 1 550
14 SUPPLIER PURCH Supplier_Address_API.Copy_Supplier 1 551
15 SUPPLIER PURCH Purchase_Charge_Supplier_API.Copy_Supplier 1 552
16 SUPPLIER PURCH Supplier_Info_Vat_API.Copy_Supplier 1 553
17 SUPPLIER PURCH Supplier_Fee_Code_API.Copy_Supplier 1 554
SUPPLIER PAYLED Identity_Pay_Info_API.Copy_Supplier NEED TO BE COMMENTED ON Copy_Payment_Address FOR NTCH
PROCEDURE Copy_Supplier (
supplier_identity_old_ IN VARCHAR2,
supplier_identity_new_ IN VARCHAR2,
company_ IN VARCHAR2 )
IS
CURSOR get_supplier IS
SELECT *
FROM IDENTITY_PAY_INFO_TAB
WHERE identity = supplier_identity_old_
AND company = company_
AND party_type = 'SUPPLIER';
attr_ VARCHAR2(2000);
info_ VARCHAR2(2000);
objid_ VARCHAR2(2000);
objversion_ VARCHAR2(2000);
format_no_ NUMBER;
BEGIN
General_SYS.Init_Method(lu_name_, 'IDENTITY_PAY_INFO_API', 'Copy_Supplier');
FOR supplier_ IN get_supplier LOOP
format_no_ := Get_Next_Format_No___ (company_);
INSERT INTO IDENTITY_PAY_INFO_TAB (company, identity, party_type,
priority, blocked_for_payment,
reminder_template, interest_template,
amount_tolerance, percent_tolerance,
netting_allowed, format_no,
payment_advice, next_payment_matching_id, rowversion )
VALUES (supplier_.company, supplier_identity_new_, 'SUPPLIER',
supplier_.priority, supplier_.blocked_for_payment,
supplier_.reminder_template, supplier_.interest_template,
supplier_.amount_tolerance, supplier_.percent_tolerance,
supplier_.netting_allowed, format_no_,
supplier_.payment_advice, 1, 1 );
Copy_Payway_Per_Identity___( supplier_.company,
supplier_identity_old_,
'SUPPLIER',
supplier_identity_new_ );
-- Copy_Payment_Address___( supplier_.company,
-- supplier_identity_old_,
-- 'SUPPLIER',
-- supplier_identity_new_ );
END LOOP;
END Copy_Supplier;
|