設為首頁收藏本站

艾歐踢論壇

 找回密碼
 立即註冊

QQ登錄

只需一步,快速開始

搜索
熱搜: 活動 交友 discuz
查看: 626|回復: 0
打印 上一主題 下一主題

複製供應商 <copy supplier >

[複製鏈接]
跳轉到指定樓層
樓主
發表於 2019-10-23 05:57:26 | 只看該作者 回帖獎勵 |倒序瀏覽 |閱讀模式
SUPPLIER_INFO_API.Copy_Existing_Supplier_Inv

  1. PROCEDURE Copy_Existing_Supplier_Inv (
  2.    supplier_id_ IN VARCHAR2,
  3.    new_id_ IN VARCHAR2,
  4.    company_ IN VARCHAR2,
  5.    new_name_ IN VARCHAR2,
  6.    association_no_ IN VARCHAR2 DEFAULT NULL )
  7. IS
  8.    info_         VARCHAR2(32000);
  9.    objid_        VARCHAR2(100);
  10.    objversion_   VARCHAR2(200);
  11.    attr_         VARCHAR2(2000);
  12.    temp_id_      VARCHAR2(20);
  13.    newrec_ SUPPLIER_INFO_TAB%ROWTYPE;
  14.    CURSOR get_attr IS
  15.       SELECT *
  16.       FROM SUPPLIER_INFO_TAB
  17.       WHERE supplier_id = supplier_id_;
  18. BEGIN
  19.    General_SYS.Init_Method(lu_name_, 'SUPPLIER_INFO_API', 'Copy_Existing_Supplier_Inv');
  20.    Trace_SYS.message('SUPPLIER_INFO_API.Copy_Existing_Supplier_Inv('||supplier_id_||')');
  21.    OPEN get_attr;
  22.    FETCH get_attr INTO newrec_;
  23.    IF get_attr%NOTFOUND THEN
  24.       error_sys.record_general(lu_name_, 'NOSUPP:Supplier :P1 does not exist', supplier_id_);
  25.       CLOSE get_attr;
  26.    ELSE
  27.       Client_SYS.Clear_Attr(attr_);
  28.       Client_SYS.Add_To_Attr('SUPPLIER_ID', new_id_, attr_);
  29.       Client_SYS.Add_To_Attr('NAME', new_name_, attr_);
  30.       Client_SYS.Add_To_Attr('CREATION_DATE', trunc(sysdate), attr_);
  31.       Client_SYS.Add_To_Attr('PARTY_TYPE', party_type_api.decode('SUPPLIER'), attr_);
  32.       Client_SYS.Add_To_Attr('DEFAULT_DOMAIN', 'TRUE', attr_);
  33.       client_sys.add_to_attr('ASSOCIATION_NO',    association_no_,   attr_);
  34.       Client_SYS.Add_To_Attr('COUNTRY',           iso_country_api.decode(newrec_.country),          attr_);
  35.       Client_SYS.Add_To_Attr('DEFAULT_LANGUAGE',  iso_language_api.decode(newrec_.default_language), attr_);
  36.       Client_SYS.Add_To_Attr('SUPPLIERS_OWN_ID',  newrec_.suppliers_own_id, attr_);
  37.       Client_SYS.Add_To_Attr('CORPORATE_FORM',  newrec_.corporate_form, attr_);
  38.       New__(info_, objid_, objversion_, attr_, 'DO');
  39.       IF (new_id_ IS NULL) THEN
  40.          temp_id_:= client_sys.get_item_value('SUPPLIER_ID', attr_);
  41.          copy_details___(supplier_id_, temp_id_, company_);
  42.       ELSE
  43.          copy_details___(supplier_id_, new_id_, company_);
  44.       END IF;
  45.    END IF;
  46. END Copy_Existing_Supplier_Inv;
複製代碼
  1. PROCEDURE Copy_Details___ (
  2.    supplier_id_ IN VARCHAR2,
  3.    new_id_ IN VARCHAR2,
  4.    company_ IN VARCHAR2 )
  5. IS
  6.    pkg_method_name_   VARCHAR2(200);
  7.    module_            VARCHAR2(6);
  8.    cursor_            NUMBER;
  9.    count_             NUMBER;
  10.    stmt_              VARCHAR2(100);
  11.    CURSOR get_copying_info IS
  12.       SELECT pkg_and_method_name, module
  13.       FROM   copying_info_tab
  14.       WHERE  party_type = 'SUPPLIER'
  15.       ORDER BY exec_order;
  16. BEGIN
  17.    General_SYS.Init_Method(lu_name_, 'SUPPLIER_INFO_API', 'Copy_Details___');
  18.    OPEN get_copying_info;
  19.    WHILE (TRUE) LOOP
  20.       FETCH get_copying_info INTO pkg_method_name_, module_;
  21.       EXIT WHEN get_copying_info%NOTFOUND;
  22.       Assert_SYS.Assert_Is_Package_Method(pkg_method_name_);
  23.       cursor_ := dbms_sql.open_cursor;
  24.       IF (module_ = 'INVOIC') THEN
  25.          stmt_ := 'BEGIN '||pkg_method_name_||'(:supplier_id_, :new_id_, :company_); END;';
  26.          dbms_sql.parse(cursor_, stmt_, dbms_sql.native);
  27.          dbms_sql.bind_variable(cursor_, 'supplier_id_', supplier_id_);
  28.          dbms_sql.bind_variable(cursor_, 'new_id_', new_id_);
  29.          dbms_sql.bind_variable(cursor_, 'company_', company_);
  30.       ELSIF (module_ = 'PAYLED') THEN
  31.          stmt_ := 'BEGIN '||pkg_method_name_||'(:supplier_id_, :new_id_, :company_); END;';
  32.          dbms_sql.parse(cursor_, stmt_, dbms_sql.native);
  33.          dbms_sql.bind_variable(cursor_, 'supplier_id_', supplier_id_);
  34.          dbms_sql.bind_variable(cursor_, 'new_id_', new_id_);
  35.          dbms_sql.bind_variable(cursor_, 'company_', company_);
  36.       ELSE
  37.          stmt_ := 'BEGIN '||pkg_method_name_||'(:supplier_id_, :new_id_); END;';
  38.          dbms_sql.parse(cursor_, stmt_, dbms_sql.native);
  39.          dbms_sql.bind_variable(cursor_, 'supplier_id_', supplier_id_);
  40.          dbms_sql.bind_variable(cursor_, 'new_id_', new_id_);
  41.       END IF;
  42.       count_ := dbms_sql.execute(cursor_);
  43.       dbms_sql.close_cursor(cursor_);
  44.    END LOOP;
  45.    CLOSE get_copying_info;
  46. EXCEPTION
  47.    WHEN OTHERS THEN
  48.       IF (dbms_sql.is_open(cursor_)) THEN
  49.          dbms_sql.close_cursor(cursor_);
  50.       END IF;
  51.       RAISE;
  52. 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;




分享到:  QQ好友和群QQ好友和群 QQ空間QQ空間 騰訊微博騰訊微博 騰訊朋友騰訊朋友
收藏收藏 轉播轉播 分享分享 分享淘帖
回復

使用道具 舉報

您需要登錄後才可以回帖 登錄 | 立即註冊

本版積分規則

小黑屋|Archiver|手機版|艾歐踢創新工坊    

GMT+8, 2024-4-29 21:11 , Processed in 0.248389 second(s), 18 queries .

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回復 返回頂部 返回列表