复制往来单位到其他企业

复制往来单位到其他企业

create or replace procedure CPROC_往来单位复制其他企业(p_compid   NUMBER,
                                             p_vencuscode varchar2,
                                             p_userid   NUMBER) as
  v_compid t_vencus.compid%TYPE := 1;
  v_vencusno t_vencus.vencusno%TYPE ;

begin

 select vencusno into  v_vencusno from t_vencus where vencuscode = p_vencuscode and compid = p_compid;

  insert into t_vencus
    (compid,
     vencusno,
     vencusname,
     vencustype,
     vencuscode,
     vencusflag,
     address,
     postcode,
     ordername,
     ordertel,
     orderfax,
     ordermobil,
     orderemail,
     orderurl,
     managename,
     managetel,
     taxtype,
     bank,
     bankno,
     conn_qlt,
     register_amt,
     lastmodify,
     lasttime,
     inituser,
     inittime,
     maxdebt,
     buyer,
     salespolicy,
     notes,
     stamp,
     corporation,
     daydebt,
     extno,
     accounttype,
     enrouteday,
     taxheader,
     invoicetype,
     ifcredit,
     creditlevel,
     maxday,
     firstdate,
     lastdate,
     badlist,
     backrate,
     oldname,
     taxbackrate,
     backrate2,
     bestrow,
     supervisiocode,
     fileno,
     warehouseaddress,
     establishedtime,
     areacode,
     status,
     paytype,
     documentno,
     control_proxy,
     control_gmp,
     control_contract,
     sample_batsale_bill,
     sample_batsale_bill_image,
     factoryid,
     salezone,
     operationtype,
     voidreason,
     data_src,
     voiduser,
     voidtime,
     descode_corpid,
     documentno_1,
     documentno_status,
     documentno_date,
     chaincompid,
     chainbusno,
     effdays,
     maxdebt_tem,
     daydebt_tem,
     startdate,
     enddate,
     cashtype,
     sendstype,
     weekdays,
     days,
     srccode,
     quality_guarantee,
     province,
     city,
     area,
     purstatus,
     paystatus,
     customtype,
     bak5_dt,
     bak6_dt,
     bak1,
     bak2,
     bak3,
     bak4,
     bak7,
     bak8,
     send_lastmodify,
     send_lasttime,
     annual_chk,
     jobno,
     edu,
     grade,
     integral,
     email,
     bpvendorno,
     temp_invalidate,
     control_range,
     oldbatch,
     mixbatch,
     year_report,
     badlist_enddate,
     ifbatch,
     jmchaincompid,
     jmchainbusno,
     incompid,
     inbusno,
     bak9,
     twocard_ventype,
     twocard_custype,
     inspectionrpt_flag,
     age_control_code,
     amt_control_code,
     salenumber,
     salename,
     saleaddress,
     saletel,
     salebank,
     salebankno,
     mail_yn,
     mail_addr,
     ve_date01,
     ve_date02,
     ve_date03,
     ve_date04,
     ve_date05,
     ve_num01,
     ve_num02,
     ve_num03,
     ve_num04,
     ve_num05,
     ve_int01,
     ve_int02,
     ve_int03,
     ve_int04,
     ve_int05,
     ve_schar01,
     ve_schar02,
     ve_schar03,
     ve_schar04,
     ve_schar05,
     ref_ent_id,
     ent_id,
     invalidate_check,
     makeno_check,
     check_batch_flag,
     auto_invpaybill,
     auto_subitem_flag)
    select v_compid,
           vencusno,
           vencusname,
           vencustype,
           vencuscode,
           vencusflag,
           address,
           postcode,
           ordername,
           ordertel,
           orderfax,
           ordermobil,
           orderemail,
           orderurl,
           managename,
           managetel,
           taxtype,
           bank,
           bankno,
           conn_qlt,
           register_amt,
           lastmodify,
           lasttime,
           inituser,
           inittime,
           maxdebt,
           buyer,
           salespolicy,
           notes,
           stamp,
           corporation,
           daydebt,
           extno,
           accounttype,
           enrouteday,
           taxheader,
           invoicetype,
           ifcredit,
           creditlevel,
           maxday,
           firstdate,
           lastdate,
           badlist,
           backrate,
           oldname,
           taxbackrate,
           backrate2,
           bestrow,
           supervisiocode,
           fileno,
           warehouseaddress,
           establishedtime,
           areacode,
           status,
           paytype,
           documentno,
           control_proxy,
           control_gmp,
           control_contract,
           sample_batsale_bill,
           sample_batsale_bill_image,
           factoryid,
           salezone,
           operationtype,
           voidreason,
           data_src,
           voiduser,
           voidtime,
           descode_corpid,
           documentno_1,
           documentno_status,
           documentno_date,
           chaincompid,
           chainbusno,
           effdays,
           maxdebt_tem,
           daydebt_tem,
           startdate,
           enddate,
           cashtype,
           sendstype,
           weekdays,
           days,
           srccode,
           quality_guarantee,
           province,
           city,
           area,
           purstatus,
           paystatus,
           customtype,
           bak5_dt,
           bak6_dt,
           bak1,
           bak2,
           bak3,
           bak4,
           bak7,
           '企业2复制',
           send_lastmodify,
           send_lasttime,
           annual_chk,
           jobno,
           edu,
           grade,
           integral,
           email,
           bpvendorno,
           temp_invalidate,
           control_range,
           oldbatch,
           mixbatch,
           year_report,
           badlist_enddate,
           ifbatch,
           jmchaincompid,
           jmchainbusno,
           incompid,
           inbusno,
           bak9,
           twocard_ventype,
           twocard_custype,
           inspectionrpt_flag,
           age_control_code,
           amt_control_code,
           salenumber,
           salename,
           saleaddress,
           saletel,
           salebank,
           salebankno,
           mail_yn,
           mail_addr,
           ve_date01,
           ve_date02,
           ve_date03,
           ve_date04,
           ve_date05,
           ve_num01,
           ve_num02,
           ve_num03,
           ve_num04,
           ve_num05,
           ve_int01,
           ve_int02,
           ve_int03,
           ve_int04,
           ve_int05,
           ve_schar01,
           ve_schar02,
           ve_schar03,
           ve_schar04,
           ve_schar05,
           ref_ent_id,
           ent_id,
           invalidate_check,
           makeno_check,
           check_batch_flag,
           auto_invpaybill,
           auto_subitem_flag
      from t_vencus tv
     where tv.compid = p_compid
       and tv.vencusno = v_vencusno;

  insert into t_vencus_certificate
    (compid,
     vencusno,
     certificateid,
     invalidate,
     certifying_author,
     photo_no,
     scope,
     notes,
     lastmodify,
     lasttime,
     idcard,
     invalidate_status,
     photono_status,
     classgroupno,
     classcodelist,
     classnamelist,
     status,
     operate_flag,
     invalidate_tem,
     gsp_address,
     stamp,
     invalidate_char,
     grant_date)
    select v_compid,
           vencusno,
           certificateid,
           invalidate,
           certifying_author,
           photo_no,
           scope,
           notes,
           lastmodify,
           lasttime,
           idcard,
           invalidate_status,
           photono_status,
           classgroupno,
           classcodelist,
           classnamelist,
           status,
           operate_flag,
           invalidate_tem,
           gsp_address,
           stamp,
           invalidate_char,
           grant_date
      from t_vencus_certificate tvc
     where tvc.compid = p_compid
       and tvc.vencusno = v_vencusno;
  insert into t_vencus_range
    (compid,
     vencusno,
     classcode,
     status,
     stamp,
     lastmodify,
     lasttime,
     notes)
    select v_compid,
           vencusno,
           classcode,
           status,
           stamp,
           lastmodify,
           lasttime,
           '企业2复制'
      from t_vencus_range tvr
     where tvr.compid = p_compid
       and tvr.vencusno = v_vencusno;
  insert into t_vencus_saler
    (vencusno,
     ownerid,
     reckonerid,
     saler,
     paytype,
     status,
     notes,
     whlgroupid,
     whlsign,
     stamp,
     compid,
     cashtype,
     subitemid,
     priority,
     isdefault)
    select vencusno,
           ownerid,
           reckonerid,
           saler,
           paytype,
           status,
           '企业2 复制',
           whlgroupid,
           whlsign,
           stamp,
           v_compid,
           cashtype,
           subitemid,
           priority,
           isdefault
      from t_vencus_saler ts
     where ts.compid = p_compid
       and ts.vencusno = v_vencusno;

   insert into t_comp_vencus(compid,vencusno,status) 
    select v_compid,v_vencusno,1 from dual;  
  /*    insert into t_vencus_subitem
    (vencusno,
     subitemid,
     subitemname,
     notes,
     stamp,
     address,
     postcode,
     contact,
     phone,
     fax,
     mobile,
     email,
     compid,
     isdefault,
     c_subitemid,
     c_vencusno,
     invoicedate,
     pay_datetype,
     invaliday,
     pickuptype,
     selectbat_rule,
     wholezero_rule,
     waregsp,
     payment_days,
     business_promise_days,
     credit_days,
     hli_flag,
     hli_start_date,
     nhli_flag,
     nhli_start_date,
     jicai_flag,
     jicai_start_date,
     cashtype,
     paytype,
     subitem_status,
     invoiceflag,
     print_no,
     mutual_client,
     taxheader,
     classcode,
     invalidate,
     status,
     sub_busno,
     sub_compid)
    select vencusno,
           subitemid,
           subitemname,
           notes,
           stamp,
           address,
           postcode,
           contact,
           phone,
           fax,
           mobile,
           email,
           v_compid,
           isdefault,
           c_subitemid,
           c_vencusno,
           invoicedate,
           pay_datetype,
           invaliday,
           pickuptype,
           selectbat_rule,
           wholezero_rule,
           waregsp,
           payment_days,
           business_promise_days,
           credit_days,
           hli_flag,
           hli_start_date,
           nhli_flag,
           nhli_start_date,
           jicai_flag,
           jicai_start_date,
           cashtype,
           paytype,
           subitem_status,
           invoiceflag,
           print_no,
           mutual_client,
           taxheader,
           classcode,
           invalidate,
           status,
           sub_busno,
           sub_compid
      from t_vencus_subitem tvs
     where tvs.compid = p_compid
       and tvs.vencusno = v_vencusno;   */

end;

往来单位档案增加按钮

String ls_err,ls_vencuscode
Long ll_userid, ll_row, ll_compid
ll_row = dw_master.GetRow()
If ll_row < 1 Then
    MessageBox('提示!', '请选择您需要处理的往来单位')
    Return 0
End If

ll_compid = dw_master.GetItemNumber(ll_row, 'compid')
ls_vencuscode = dw_master.GetItemString(ll_row, 'vencuscode')
ll_userid = dw_master.GetItemNumber(ll_row, 'lastmodify')

str_DBParam lstr_dbp[]

lstr_dbp[1].Item[1].pname = 'p_compid'
lstr_dbp[1].Item[1].pvalue = ll_compid
lstr_dbp[1].Item[2].pname = 'p_vencuscode'
lstr_dbp[1].Item[2].pvalue = ls_vencuscode
lstr_dbp[1].Item[3].pname = 'p_userid'
lstr_dbp[1].Item[3].pvalue = String(ll_userid) 

If Not gnvo_datasource.of_execproc({'CPROC_往来单位复制其他企业'}, Ref lstr_dbp, Ref ls_err) Then
    MessageBox("提示", '处理失败', ls_err, stopsign!, ok!, 1)
    Return 0
Else
    MessageBox("提示", "处理成功,请确认!")
End If
Return 0

批量执行

declare
begin
  for rec in (select compid, vencuscode, 168 as userid
                from t_vencus a
               where a.vencusno not in
                     (select vencusno from t_vencus where compid = 1)
                 and compid = 2
                 and status = 1) loop

    begin
      CPROC_往来单位复制其他企业(rec.compid, rec.vencuscode, rec.userid);
    end;
  end loop;
end;
暂无评论

发送评论 编辑评论


				
|´・ω・)ノ
ヾ(≧∇≦*)ゝ
(☆ω☆)
(╯‵□′)╯︵┴─┴
 ̄﹃ ̄
(/ω\)
∠( ᐛ 」∠)_
(๑•̀ㅁ•́ฅ)
→_→
୧(๑•̀⌄•́๑)૭
٩(ˊᗜˋ*)و
(ノ°ο°)ノ
(´இ皿இ`)
⌇●﹏●⌇
(ฅ´ω`ฅ)
(╯°A°)╯︵○○○
φ( ̄∇ ̄o)
ヾ(´・ ・`。)ノ"
( ง ᵒ̌皿ᵒ̌)ง⁼³₌₃
(ó﹏ò。)
Σ(っ °Д °;)っ
( ,,´・ω・)ノ"(´っω・`。)
╮(╯▽╰)╭
o(*////▽////*)q
>﹏<
( ๑´•ω•) "(ㆆᴗㆆ)
😂
😀
😅
😊
🙂
🙃
😌
😍
😘
😜
😝
😏
😒
🙄
😳
😡
😔
😫
😱
😭
💩
👻
🙌
🖕
👍
👫
👬
👭
🌚
🌝
🙈
💊
😶
🙏
🍦
🍉
😣
Source: github.com/k4yt3x/flowerhd
颜文字
Emoji
小恐龙
花!
上一篇
下一篇