$PBExportHeader$w_script_edit.srw forward global type w_script_edit from window end type type rb_zy from radiobutton within w_script_edit end type type rb_cg from radiobutton within w_script_edit end type type cb_8 from commandbutton within w_script_edit end type type cb_7 from commandbutton within w_script_edit end type type cb_6 from commandbutton within w_script_edit end type type cb_5 from commandbutton within w_script_edit end type type cb_4 from commandbutton within w_script_edit end type type cb_3 from commandbutton within w_script_edit end type type cb_2 from commandbutton within w_script_edit end type type st_4 from statictext within w_script_edit end type type st_3 from statictext within w_script_edit end type type st_2 from statictext within w_script_edit end type type st_1 from statictext within w_script_edit end type type mle_2 from multilineedit within w_script_edit end type type cb_1 from commandbutton within w_script_edit end type type lb_1 from listbox within w_script_edit end type type mle_1 from multilineedit within w_script_edit end type type lb_3 from listbox within w_script_edit end type type lb_2 from listbox within w_script_edit end type type ostr_script from structure within w_script_edit end type end forward type ostr_script from structure string s_scriptname string s_source end type global type w_script_edit from window integer width = 3333 integer height = 1524 boolean titlebar = true string title = "公式修改" boolean controlmenu = true windowtype windowtype = response! long backcolor = 67108864 string icon = "AppIcon!" boolean center = true rb_zy rb_zy rb_cg rb_cg cb_8 cb_8 cb_7 cb_7 cb_6 cb_6 cb_5 cb_5 cb_4 cb_4 cb_3 cb_3 cb_2 cb_2 st_4 st_4 st_3 st_3 st_2 st_2 st_1 st_1 mle_2 mle_2 cb_1 cb_1 lb_1 lb_1 mle_1 mle_1 lb_3 lb_3 lb_2 lb_2 end type global w_script_edit w_script_edit type variables s_script_edit s_script long cur_billtype end variables forward prototypes public subroutine of_get_scripts (string as_object, ref ostr_script astr_events[], ref ostr_script astr_functions[]) public function string of_globalreplace (string as_source, string as_old, string as_new) public function string change_c (string arg_str) public subroutine wf_additem_zy (long arg_billtype) end prototypes public subroutine of_get_scripts (string as_object, ref ostr_script astr_events[], ref ostr_script astr_functions[]);try ClassDefinition lcd_Object ScriptDefinition lsd_Scripts[] TypeDefinition ltd_Returns Integer li_Events, li_Functions, li_Cnt, li_Limit, li_Cnt2, li_Args String ls_Returns, ls_ArgList,is_LibraryList1[] f_split(GetLibraryList (), ',', Ref is_LibraryList1) lcd_Object = FindClassDefinition(as_Object, is_LibraryList1) lsd_Scripts = lcd_Object.ScriptList li_Events = 0 li_Functions = 0 li_Limit = UpperBound(lsd_Scripts) For li_Cnt = 1 To li_Limit If (lsd_Scripts[li_Cnt].islocallyscripted) And ((lsd_Scripts[li_Cnt].name <> "create") And (lsd_Scripts[li_Cnt].name <> "destroy")) Then // Format function or event call ltd_Returns = lsd_Scripts[li_Cnt].returntype If IsValid(ltd_Returns) Then ls_Returns = "returns " + ltd_Returns.name Else ls_Returns = "" End If li_Args = UpperBound(lsd_Scripts[li_Cnt].argumentlist) ls_ArgList = " (" For li_Cnt2 = 1 To li_Args If li_Cnt2 > 1 Then ls_ArgList += ", " End If ls_ArgList += lsd_Scripts[li_Cnt].argumentlist[li_Cnt2].typeinfo.name + " " + & lsd_Scripts[li_Cnt].argumentlist[li_Cnt2].name Next ls_ArgList += ") " If lsd_Scripts[li_Cnt].kind = ScriptEvent! Then li_Events ++ astr_Events[li_Events].s_ScriptName = lsd_Scripts[li_Cnt].name + ls_ArgList + ls_Returns astr_Events[li_Events].s_Source = lsd_Scripts[li_Cnt].source Else li_Functions ++ astr_Functions[li_Functions].s_ScriptName = lsd_Scripts[li_Cnt].name + ls_ArgList + ls_Returns astr_Functions[li_Functions].s_Source = lsd_Scripts[li_Cnt].source End If End If Next catch(runtimeerror err) RETURN END try end subroutine public function string of_globalreplace (string as_source, string as_old, string as_new);long ll_oldlen, ll_newlen, ll_pos ll_pos = Pos(as_source,as_old) IF ll_pos > 0 Then ll_oldlen = Len(as_old) ll_newlen = Len(as_new) DO WHILE ll_pos > 0 as_source = Replace(as_source,ll_pos,ll_oldlen,as_new) ll_pos = Pos(as_source,as_old,ll_pos + ll_newlen) LOOP END IF RETURN as_source end function public function string change_c (string arg_str); string str,str1,rts,z_s integer c_s,c_e,c_l,num num=0 str=trim(arg_str) c_s=pos(str,"(") c_e=pos(str,")") c_l=len(str) str=mid(str,c_s + 1, c_e - c_s - 1 ) str1=str do while(pos(str,',')<>0) num=num+1 rts= trim(mid(str,1,pos(str,',') - 1)) z_s=trim(mid(rts,1,pos(rts,' ') - 1)) str1 =of_globalreplace(str1,rts,'#' + z_s + "参数" + string(num) +'#' ) str=trim(right(str,len(str) - pos(str,','))) loop z_s=trim(mid(str,1,pos(str,' ') - 1)) str1 =of_globalreplace(str1,str,'#' + z_s + "参数" + string(num + 1) +'#' ) str1= '(' + str1 + ')' //messagebox("",str1) return str1 end function public subroutine wf_additem_zy (long arg_billtype);// lb_3.Reset() //messagebox('',string(arg_billtype)) IF arg_billtype = 104 THEN //销售发货单 lb_3.AddItem('outwaresale_业务员') lb_3.AddItem('outwaresale_业务员备注') lb_3.AddItem('outwaresale_产品名称_规格_配置_配置1_备注') lb_3.AddItem('outwaresale_相关号') lb_3.AddItem('outwaresale_单据编号') lb_3.AddItem('outwaresale_货运部') lb_3.AddItem('outwaresale_货运单号') lb_3.AddItem('outwaresale_包装总件数') ELSEIF arg_billtype = 102 THEN //销售订单 lb_3.AddItem('saletask_相关号') lb_3.AddItem('saletask_单据编号') lb_3.AddItem('saletask_货运部') lb_3.AddItem('saletask_货运单号') lb_3.AddItem('saletask_包装总件数') ELSEIF arg_billtype = 532 THEN //客户收款单 lb_3.AddItem('custamt_相关号') lb_3.AddItem('custamt_客户名称') lb_3.AddItem('custamt_客户联系人') lb_3.AddItem('custamt_摘要') lb_3.AddItem('custamt_客户编号') lb_3.AddItem('custamt_到账日期') lb_3.AddItem('custamt_账号名称') ELSEIF arg_billtype = 540 THEN //供应商收款单 lb_3.AddItem('sptamt_相关号') lb_3.AddItem('sptamt_供应商名称') lb_3.AddItem('sptamt_摘要') lb_3.AddItem('sptamt_供应商编号') lb_3.AddItem('sptamt_付账日期') lb_3.AddItem('sptamt_账号名称') END IF end subroutine on w_script_edit.create this.rb_zy=create rb_zy this.rb_cg=create rb_cg this.cb_8=create cb_8 this.cb_7=create cb_7 this.cb_6=create cb_6 this.cb_5=create cb_5 this.cb_4=create cb_4 this.cb_3=create cb_3 this.cb_2=create cb_2 this.st_4=create st_4 this.st_3=create st_3 this.st_2=create st_2 this.st_1=create st_1 this.mle_2=create mle_2 this.cb_1=create cb_1 this.lb_1=create lb_1 this.mle_1=create mle_1 this.lb_3=create lb_3 this.lb_2=create lb_2 this.Control[]={this.rb_zy,& this.rb_cg,& this.cb_8,& this.cb_7,& this.cb_6,& this.cb_5,& this.cb_4,& this.cb_3,& this.cb_2,& this.st_4,& this.st_3,& this.st_2,& this.st_1,& this.mle_2,& this.cb_1,& this.lb_1,& this.mle_1,& this.lb_3,& this.lb_2} end on on w_script_edit.destroy destroy(this.rb_zy) destroy(this.rb_cg) destroy(this.cb_8) destroy(this.cb_7) destroy(this.cb_6) destroy(this.cb_5) destroy(this.cb_4) destroy(this.cb_3) destroy(this.cb_2) destroy(this.st_4) destroy(this.st_3) destroy(this.st_2) destroy(this.st_1) destroy(this.mle_2) destroy(this.cb_1) destroy(this.lb_1) destroy(this.mle_1) destroy(this.lb_3) destroy(this.lb_2) end on event open;String libs[] String lpo_object f_split(GetLibraryList (), ',', Ref libs) Long ll_i, ll_j String ls_name String ls_syntax uo_string_helper uo_helper datastore ds ds = Create datastore ds.DataObject = 'ds_libs_dirs' FOR ll_i = 1 To UpperBound(libs) ds.Reset() ds.ImportString(Text!, LibraryDirectoryEx (libs[ll_i], DirFunction!)) FOR ll_j = 1 To ds.RowCount() ls_name = ds.Object.Name[ll_j] IF Lower(Mid(ls_name, 1, 2)) = 'ef' THEN // MessageBox('', LibraryExport(libs[ll_i], ls_name, ExportFunction! )) ls_syntax = LibraryExport(libs[ll_i], ls_name, ExportFunction! ) uo_helper.ins_string = ls_syntax lb_1.AddItem(uo_helper.uf_getfunname(ls_name)) END IF NEXT NEXT ds.Reset() ds.DataObject = 'ds_buytask_event' f_split(ds.Describe('DataWindow.Objects'), '~t', Ref libs) FOR ll_i = 1 To UpperBound(libs) IF Lower(ds.Describe(libs[ll_i] + '.Type')) = 'column' And Pos(libs[ll_i],'arg_') > 0 THEN lb_2.AddItem(libs[ll_i]) END IF NEXT ///////////////////////// // s_script = Message.PowerObjectParm lpo_object = s_script.lpo_object cur_billtype = s_script.billtype wf_additem_zy(cur_billtype) //messagebox('',string(cur_billtype)) // lpo_object =string( message.stringparm) mle_1.Text = lpo_object Destroy ds end event event close;//closewithreturn(this, "") end event type rb_zy from radiobutton within w_script_edit integer x = 3081 integer y = 564 integer width = 219 integer height = 92 integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 long backcolor = 67108864 string text = "专用" end type event clicked;IF rb_zy.Checked THEN lb_2.Visible = False lb_3.Visible = True END IF end event type rb_cg from radiobutton within w_script_edit integer x = 2816 integer y = 564 integer width = 219 integer height = 92 integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 long backcolor = 67108864 string text = "常规" boolean checked = true end type event clicked;IF rb_cg.Checked THEN lb_2.Visible = True lb_3.Visible = false END IF end event type cb_8 from commandbutton within w_script_edit integer x = 238 integer y = 1236 integer width = 142 integer height = 128 integer taborder = 50 integer textsize = -12 integer weight = 400 fontcharset fontcharset = ansi! fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "Arial" string text = ")" end type event clicked;mle_1.ReplaceText(" ) ") end event type cb_7 from commandbutton within w_script_edit integer x = 27 integer y = 1232 integer width = 142 integer height = 128 integer taborder = 40 integer textsize = -12 integer weight = 400 fontcharset fontcharset = ansi! fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "Arial" string text = "(" end type event clicked;mle_1.ReplaceText(" ( ") end event type cb_6 from commandbutton within w_script_edit integer x = 238 integer y = 972 integer width = 142 integer height = 128 integer taborder = 40 integer textsize = -12 integer weight = 400 fontcharset fontcharset = ansi! fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "Arial" string text = "/" end type event clicked;mle_1.ReplaceText(" / ") end event type cb_5 from commandbutton within w_script_edit integer x = 27 integer y = 972 integer width = 142 integer height = 128 integer taborder = 50 integer textsize = -12 integer weight = 400 fontcharset fontcharset = ansi! fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "Arial" string text = "*" end type event clicked;mle_1.ReplaceText(" * ") end event type cb_4 from commandbutton within w_script_edit integer x = 238 integer y = 680 integer width = 142 integer height = 128 integer taborder = 40 integer textsize = -12 integer weight = 400 fontcharset fontcharset = ansi! fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "Arial" string text = "-" end type event clicked;mle_1.ReplaceText(" - ") end event type cb_3 from commandbutton within w_script_edit integer x = 27 integer y = 676 integer width = 142 integer height = 128 integer taborder = 30 integer textsize = -12 integer weight = 400 fontcharset fontcharset = ansi! fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "Arial" string text = "+" end type event clicked;mle_1.ReplaceText(" + ") end event type cb_2 from commandbutton within w_script_edit integer x = 2651 integer y = 316 integer width = 457 integer height = 128 integer taborder = 30 integer textsize = -12 integer weight = 400 fontcharset fontcharset = ansi! fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "Arial" string text = "Cancel" end type event clicked;closewithreturn(parent, "") end event type st_4 from statictext within w_script_edit integer x = 2386 integer y = 576 integer width = 457 integer height = 72 integer textsize = -12 integer weight = 700 fontcharset fontcharset = ansi! fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "Arial" long textcolor = 33554432 long backcolor = 67108864 string text = "Argument:" boolean focusrectangle = false end type type st_3 from statictext within w_script_edit integer x = 411 integer y = 1012 integer width = 457 integer height = 72 integer textsize = -12 integer weight = 700 fontcharset fontcharset = ansi! fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "Arial" long textcolor = 33554432 long backcolor = 67108864 string text = "Describe:" boolean focusrectangle = false end type type st_2 from statictext within w_script_edit integer x = 398 integer y = 592 integer width = 457 integer height = 72 integer textsize = -12 integer weight = 700 fontcharset fontcharset = ansi! fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "Arial" long textcolor = 33554432 long backcolor = 67108864 string text = "Function:" boolean focusrectangle = false end type type st_1 from statictext within w_script_edit integer x = 37 integer y = 16 integer width = 457 integer height = 72 integer textsize = -12 integer weight = 700 fontcharset fontcharset = ansi! fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "Arial" long textcolor = 33554432 long backcolor = 67108864 string text = "Expression:" boolean focusrectangle = false end type type mle_2 from multilineedit within w_script_edit integer x = 398 integer y = 1112 integer width = 1957 integer height = 324 integer taborder = 30 integer textsize = -12 integer weight = 400 fontcharset fontcharset = ansi! fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "Arial" long textcolor = 134217751 long backcolor = 134217732 boolean autovscroll = true boolean displayonly = true end type type cb_1 from commandbutton within w_script_edit integer x = 2651 integer y = 116 integer width = 457 integer height = 128 integer taborder = 20 integer textsize = -12 integer weight = 400 fontcharset fontcharset = ansi! fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "Arial" string text = "OK " end type event clicked;string ls_new_string ,k_13,k_10 k_13=char(13) K_10=char(10) ls_new_string=trim(mle_1.text) ls_new_string =of_globalreplace(ls_new_string,k_13,' ') ls_new_string =of_globalreplace(ls_new_string,k_10,' ') ls_new_string =of_globalreplace(ls_new_string,' ',' ') closewithreturn(parent,ls_new_string ) end event type lb_1 from listbox within w_script_edit integer x = 402 integer y = 668 integer width = 1957 integer height = 324 integer taborder = 20 integer textsize = -12 integer weight = 400 fontcharset fontcharset = ansi! fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "Arial" long textcolor = 33554432 boolean vscrollbar = true borderstyle borderstyle = stylelowered! end type event doubleclicked;integer li_Index li_Index = THIS.SelectedIndex() mle_1.ReplaceText(" " +Trim(THIS.text(li_Index)) + change_c(mle_2.text)) mle_1.setfocus( ) end event event selectionchanged;integer li_Index ostr_script e[],f[] try li_Index = THIS.SelectedIndex() of_get_scripts(Trim(THIS.text(li_Index)),e,f) mle_2.text=" " + f[UpperBound(f)].s_scriptname catch(runtimeerror err) RETURN END try end event type mle_1 from multilineedit within w_script_edit integer x = 27 integer y = 116 integer width = 2437 integer height = 432 integer taborder = 10 integer textsize = -12 integer weight = 400 fontcharset fontcharset = ansi! fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "Arial" long textcolor = 33554432 boolean vscrollbar = true boolean autovscroll = true borderstyle borderstyle = stylelowered! end type type lb_3 from listbox within w_script_edit integer x = 2386 integer y = 656 integer width = 923 integer height = 772 integer taborder = 40 integer textsize = -12 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 boolean hscrollbar = true boolean vscrollbar = true boolean sorted = false borderstyle borderstyle = stylelowered! end type event doubleclicked;integer li_Index li_Index = THIS.SelectedIndex() mle_1.ReplaceText(" " +Trim(THIS.text(li_Index)) + " ") mle_1.setfocus( ) end event event constructor;IF rb_zy.Checked THEN lb_2.Visible = False lb_3.Visible = True END IF end event type lb_2 from listbox within w_script_edit integer x = 2386 integer y = 660 integer width = 923 integer height = 772 integer taborder = 20 integer textsize = -12 integer weight = 400 fontcharset fontcharset = ansi! fontpitch fontpitch = variable! fontfamily fontfamily = swiss! string facename = "Arial" long textcolor = 33554432 boolean vscrollbar = true borderstyle borderstyle = stylelowered! end type event doubleclicked;integer li_Index li_Index = THIS.SelectedIndex() mle_1.ReplaceText(" " +Trim(THIS.text(li_Index)) + " ") mle_1.setfocus( ) end event event constructor;IF rb_cg.Checked THEN lb_2.Visible = True lb_3.Visible = false END IF end event