$PBExportHeader$w_email_move.srw forward global type w_email_move from window end type type st_9 from statictext within w_email_move end type type st_8 from statictext within w_email_move end type type sle_sendaddress from multilineedit within w_email_move end type type ddlb_sendaddess from dropdownlistbox within w_email_move end type type st_7 from statictext within w_email_move end type type sle_sendman from multilineedit within w_email_move end type type cbx_1 from checkbox within w_email_move end type type cb_3 from commandbutton within w_email_move end type type st_end from statictext within w_email_move end type type st_star from statictext within w_email_move end type type em_2 from editmask within w_email_move end type type st_6 from statictext within w_email_move end type type rb_2 from radiobutton within w_email_move end type type rb_1 from radiobutton within w_email_move end type type em_1 from editmask within w_email_move end type type ddlb_senddate from dropdownlistbox within w_email_move end type type st_5 from statictext within w_email_move end type type ddlb_sendman from dropdownlistbox within w_email_move end type type st_4 from statictext within w_email_move end type type cb_2 from commandbutton within w_email_move end type type cb_1 from commandbutton within w_email_move end type type sle_subject from singlelineedit within w_email_move end type type ddlb_subject from dropdownlistbox within w_email_move end type type st_3 from statictext within w_email_move end type type rb_4 from radiobutton within w_email_move end type type rb_3 from radiobutton within w_email_move end type type st_2 from statictext within w_email_move end type type st_1 from statictext within w_email_move end type type gb_1 from groupbox within w_email_move end type end forward global type w_email_move from window integer width = 2473 integer height = 1696 boolean titlebar = true string title = "邮件移入\移出文件夹" boolean controlmenu = true windowtype windowtype = response! long backcolor = 67108864 string icon = "AppIcon!" boolean center = true st_9 st_9 st_8 st_8 sle_sendaddress sle_sendaddress ddlb_sendaddess ddlb_sendaddess st_7 st_7 sle_sendman sle_sendman cbx_1 cbx_1 cb_3 cb_3 st_end st_end st_star st_star em_2 em_2 st_6 st_6 rb_2 rb_2 rb_1 rb_1 em_1 em_1 ddlb_senddate ddlb_senddate st_5 st_5 ddlb_sendman ddlb_sendman st_4 st_4 cb_2 cb_2 cb_1 cb_1 sle_subject sle_subject ddlb_subject ddlb_subject st_3 st_3 rb_4 rb_4 rb_3 rb_3 st_2 st_2 st_1 st_1 gb_1 gb_1 end type global w_email_move w_email_move type variables s_tv_data1 tv_data long revboxid,tboxid end variables forward prototypes public function string of_globalreplace (string as_source, string as_old, string as_new) public function string wf_find (string arg_str) public subroutine wf_move () end prototypes public function string of_globalreplace (string as_source, string as_old, string as_new);long ll_oldlen, ll_newlen, ll_pos as_source=trim(as_source) as_old=trim(as_old) 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 wf_find (string arg_str);String ls_rslt Long ll_1,ll_2,i ll_1 = Pos(arg_str,"'") FOR i = ll_1 + 1 To Len(arg_str) IF Mid(arg_str,i,1) = "'" THEN ll_2 = i EXIT END IF NEXT ls_rslt=mid(arg_str,ll_1 + 1, ll_2 - ll_1 - 1) ls_rslt=of_globalreplace(ls_rslt,"%","") RETURN ls_rslt end function public subroutine wf_move ();//游标读收费项目 String arry_sql[] Integer i DECLARE readitem_sql CURSOR FOR SELECT u_email_box.filter From u_email_box Where if_filter = 1; OPEN readitem_sql; i++ FETCH readitem_sql Into :arry_sql[i]; DO WHILE sqlca.SQLCode = 0 i++ FETCH readitem_sql Into :arry_sql[i]; LOOP CLOSE readitem_sql; FOR i = 1 To UpperBound(arry_sql) IF arry_sql[i] <> "" THEN EXECUTE Immediate :arry_sql[i] Using sys_email_sqlca; IF sys_email_sqlca.SQLCode <> 0 THEN MessageBox("错误" , "移动邮件失败~n"+sys_email_sqlca.SQLErrText) GOTO ext END IF COMMIT; END IF NEXT ext: //w_email_view.cb_fresh.TriggerEvent(Clicked!) end subroutine on w_email_move.create this.st_9=create st_9 this.st_8=create st_8 this.sle_sendaddress=create sle_sendaddress this.ddlb_sendaddess=create ddlb_sendaddess this.st_7=create st_7 this.sle_sendman=create sle_sendman this.cbx_1=create cbx_1 this.cb_3=create cb_3 this.st_end=create st_end this.st_star=create st_star this.em_2=create em_2 this.st_6=create st_6 this.rb_2=create rb_2 this.rb_1=create rb_1 this.em_1=create em_1 this.ddlb_senddate=create ddlb_senddate this.st_5=create st_5 this.ddlb_sendman=create ddlb_sendman this.st_4=create st_4 this.cb_2=create cb_2 this.cb_1=create cb_1 this.sle_subject=create sle_subject this.ddlb_subject=create ddlb_subject this.st_3=create st_3 this.rb_4=create rb_4 this.rb_3=create rb_3 this.st_2=create st_2 this.st_1=create st_1 this.gb_1=create gb_1 this.Control[]={this.st_9,& this.st_8,& this.sle_sendaddress,& this.ddlb_sendaddess,& this.st_7,& this.sle_sendman,& this.cbx_1,& this.cb_3,& this.st_end,& this.st_star,& this.em_2,& this.st_6,& this.rb_2,& this.rb_1,& this.em_1,& this.ddlb_senddate,& this.st_5,& this.ddlb_sendman,& this.st_4,& this.cb_2,& this.cb_1,& this.sle_subject,& this.ddlb_subject,& this.st_3,& this.rb_4,& this.rb_3,& this.st_2,& this.st_1,& this.gb_1} end on on w_email_move.destroy destroy(this.st_9) destroy(this.st_8) destroy(this.sle_sendaddress) destroy(this.ddlb_sendaddess) destroy(this.st_7) destroy(this.sle_sendman) destroy(this.cbx_1) destroy(this.cb_3) destroy(this.st_end) destroy(this.st_star) destroy(this.em_2) destroy(this.st_6) destroy(this.rb_2) destroy(this.rb_1) destroy(this.em_1) destroy(this.ddlb_senddate) destroy(this.st_5) destroy(this.ddlb_sendman) destroy(this.st_4) destroy(this.cb_2) destroy(this.cb_1) destroy(this.sle_subject) destroy(this.ddlb_subject) destroy(this.st_3) destroy(this.rb_4) destroy(this.rb_3) destroy(this.st_2) destroy(this.st_1) destroy(this.gb_1) end on event open; String sql_filter Long if_filter tv_data = Message.PowerObjectParm IF rb_1.Checked = True THEN st_1.Text = "目标文件夹:" + tv_data.b_string st_2.Text = "源文件夹:" + tv_data.d_string + " 收件箱" ELSEIF rb_2.Checked = True THEN st_1.Text = "目标文件夹:" + tv_data.d_string + " 收件箱" st_2.Text = "源文件夹:" + tv_data.b_string END IF IF ddlb_senddate.Text <> "范围" THEN st_star.Visible = False st_end.Visible = False em_2.Visible = False END IF tboxid = tv_data.relid SELECT boxid Into :revboxid From u_email_box Where mailid = :tv_data.a_long And boxname = "收件箱"; SELECT Filter,if_filter Into :sql_filter,:if_filter From u_email_box Where boxid = :tboxid Using sqlca; IF revboxid = 0 Or IsNull(revboxid) THEN MessageBox("错误","获取收件箱boxid出错") Close(This) END IF //messagebox(string(if_filter),sql_filter) Long L1,L2 String temp,temp1 String condition1,condition2,condition3,condition4 String subject_condition1,sendman_condition2,sendaddress_condition3,senddate_condition4 L1 = Pos(sql_filter,"where") L2 = Pos(sql_filter,"and mailtype") temp = Mid(sql_filter,L1 + 5 ,L2 - L1 -5) //MessageBox(String(L1),temp) IF Pos(temp," or") > 0 THEN // temp1 = temp +" or" rb_4.Checked = True L1 = Pos(temp,"#1s") L2 = Pos(temp,"#1e") subject_condition1 = Mid(temp,L1 + 3 ,L2 - L1 - 3) // L1 = Pos(temp,"#2s") L2 = Pos(temp,"#2e") sendman_condition2 = Mid(temp,L1 + 3 ,L2 - L1 - 3) // L1 = Pos(temp,"#3s") L2 = Pos(temp,"#3e") sendaddress_condition3 = Mid(temp,L1 + 3 ,L2 - L1 - 3) // L1 = Pos(temp,"#4s") L2 = Pos(temp,"#4e") senddate_condition4 = Mid(temp,L1 + 3 ,L2 - L1 - 3) ELSE rb_3.Checked = True // temp1 = temp +" and" L1 = Pos(temp,"#1s") L2 = Pos(temp,"#1e") subject_condition1 = Mid(temp,L1 + 3 ,L2 - L1 - 3) // L1 = Pos(temp,"#2s") L2 = Pos(temp,"#2e") sendman_condition2 = Mid(temp,L1 + 3 ,L2 - L1 - 3) // L1 = Pos(temp,"#3s") L2 = Pos(temp,"#3e") sendaddress_condition3 = Mid(temp,L1 + 3 ,L2 - L1 - 3) // L1 = Pos(temp,"#4s") L2 = Pos(temp,"#4e") senddate_condition4 = Mid(temp,L1 + 3 ,L2 - L1 - 3) END IF //MessageBox("1",subject_condition1) //MessageBox("2",sendman_condition2) //MessageBox("3",sendaddress_condition3) //MessageBox("4",senddate_condition4) IF subject_condition1 <> "" THEN IF Pos(condition1,"like") > 0 THEN ddlb_subject.Text = "包含" ELSE ddlb_subject.Text = "等于" END IF sle_subject.Text = wf_find(subject_condition1) END IF IF sendman_condition2 <> "" THEN ddlb_subject.Text = "等于" sendman_condition2 = of_globalreplace(sendman_condition2,"senduser in"," ") sendman_condition2 = of_globalreplace(sendman_condition2,"("," ") sendman_condition2 = of_globalreplace(sendman_condition2,")"," ") sle_sendman.Text = Trim(sendman_condition2) END IF IF sendaddress_condition3 <> "" THEN ddlb_sendaddess.Text = "等于" sendaddress_condition3 = of_globalreplace(sendaddress_condition3,"sendaddress in"," ") sendaddress_condition3 = of_globalreplace(sendaddress_condition3,"("," ") sendaddress_condition3 = of_globalreplace(sendaddress_condition3,")"," ") sle_sendaddress.Text = Trim(sendaddress_condition3) END IF IF senddate_condition4 <> "" THEN Integer ll_senddate String s1_senddate_condition4,s2_senddate_condition4 ll_senddate = Pos(senddate_condition4,"and") IF ll_senddate > 0 THEN ddlb_senddate.Text = "范围" ddlb_senddate.TriggerEvent('selectionchanged') s1_senddate_condition4 = Left(senddate_condition4,ll_senddate ) s2_senddate_condition4 = Right(senddate_condition4,Len(senddate_condition4) - ll_senddate ) em_1.Text = wf_find(s1_senddate_condition4) em_2.Text = wf_find(s2_senddate_condition4) ELSE IF Pos(senddate_condition4,">=") > 0 THEN ddlb_senddate.Text = ">=" ELSEIF Pos(senddate_condition4,"<=") > 0 THEN ddlb_senddate.Text = "<=" ELSEIF Pos(senddate_condition4,">") > 0 THEN ddlb_senddate.Text = ">" ELSEIF Pos(senddate_condition4,"<") > 0 THEN ddlb_senddate.Text = "<" ELSEIF Pos(senddate_condition4,"=") > 0 THEN ddlb_senddate.Text = "=" END IF em_1.Text = wf_find(senddate_condition4) END IF END IF //IF condition1 <> "" THEN // IF Pos(condition1,"subject") > 0 THEN // IF Pos(condition1,"like") > 0 THEN // ddlb_subject.Text = "包含" // ELSE // ddlb_subject.Text = "等于" // END IF // sle_subject.Text = wf_find(condition1) // ELSEIF Pos(condition1,"senduser") > 0 THEN // IF Pos(condition1,"like") > 0 THEN // ddlb_sendman.Text = "包含" // ELSE // ddlb_sendman.Text = "等于" // END IF // sle_sendman.Text = wf_find(condition1) // ELSEIF Pos(condition1,"revdate") > 0 THEN // IF Pos(condition2,"revdate") > 0 THEN // ddlb_senddate.Text = "范围" // ddlb_senddate.TriggerEvent('selectionchanged') // IF em_2.Text = "" THEN // em_2.Text = wf_find(condition2) // END IF // ELSEIF Pos(condition1,">=") > 0 THEN // ddlb_senddate.Text = ">=" // ELSEIF Pos(condition1,"<=") > 0 THEN // ddlb_senddate.Text = "<=" // ELSEIF Pos(condition1,">") > 0 THEN // ddlb_senddate.Text = ">" // ELSEIF Pos(condition1,"<") > 0 THEN // ddlb_senddate.Text = "<" // ELSEIF Pos(condition1,"=") > 0 THEN // ddlb_senddate.Text = "=" // // END IF // IF em_1.Text = "" THEN // em_1.Text = wf_find(condition1) // END IF // END IF //END IF //IF condition2 <> "" THEN // IF Pos(condition2,"subject") > 0 THEN // IF Pos(condition2,"like") > 0 THEN // ddlb_subject.Text = "包含" // ELSE // ddlb_subject.Text = "等于" // END IF // sle_subject.Text = wf_find(condition2) // ELSEIF Pos(condition2,"senduser") > 0 THEN // IF Pos(condition2,"like") > 0 THEN // ddlb_sendman.Text = "包含" // ELSE // ddlb_sendman.Text = "等于" // END IF // sle_sendman.Text = wf_find(condition2) // ELSEIF Pos(condition2,"revdate") > 0 THEN // IF Pos(condition3,"revdate") > 0 THEN // ddlb_senddate.Text = "范围" // ddlb_senddate.TriggerEvent('selectionchanged') // IF em_2.Text = "" THEN // em_2.Text = wf_find(condition3) // END IF // ELSEIF Pos(condition2,">=") > 0 THEN // ddlb_senddate.Text = ">=" // ELSEIF Pos(condition2,"<=") > 0 THEN // ddlb_senddate.Text = "<=" // ELSEIF Pos(condition2,">") > 0 THEN // ddlb_senddate.Text = ">" // ELSEIF Pos(condition2,"<") > 0 THEN // ddlb_senddate.Text = "<" // ELSEIF Pos(condition2,"=") > 0 THEN // ddlb_senddate.Text = "=" // // END IF // IF em_1.Text = "" THEN // em_1.Text = wf_find(condition2) // END IF // END IF //END IF // //IF condition3 <> "" THEN // IF Pos(condition3,"subject") > 0 THEN // IF Pos(condition3,"like") > 0 THEN // ddlb_subject.Text = "包含" // ELSE // ddlb_subject.Text = "等于" // END IF // sle_subject.Text = wf_find(condition3) // ELSEIF Pos(condition3,"senduser") > 0 THEN // IF Pos(condition3,"like") > 0 THEN // ddlb_sendman.Text = "包含" // ELSE // ddlb_sendman.Text = "等于" // END IF // sle_sendman.Text = wf_find(condition3) // ELSEIF Pos(condition3,"revdate") > 0 THEN // IF Pos(condition4,"revdate") > 0 THEN // ddlb_senddate.Text = "范围" // ddlb_senddate.TriggerEvent('selectionchanged') // IF em_2.Text = "" THEN // em_2.Text = wf_find(condition4) // END IF // ELSEIF Pos(condition3,">=") > 0 THEN // ddlb_senddate.Text = ">=" // ELSEIF Pos(condition3,"<=") > 0 THEN // ddlb_senddate.Text = "<=" // ELSEIF Pos(condition3,">") > 0 THEN // ddlb_senddate.Text = ">" // ELSEIF Pos(condition3,"<") > 0 THEN // ddlb_senddate.Text = "<" // ELSEIF Pos(condition3,"=") > 0 THEN // ddlb_senddate.Text = "=" // // END IF // IF em_1.Text = "" THEN // em_1.Text = wf_find(condition3) // END IF // END IF //END IF end event type st_9 from statictext within w_email_move integer x = 315 integer y = 1108 integer width = 1111 integer height = 48 integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 134217857 long backcolor = 67108864 string text = "例子 ~'123456@qq.com~',~'789123@163.com~'" boolean focusrectangle = false end type type st_8 from statictext within w_email_move integer x = 325 integer y = 872 integer width = 727 integer height = 48 integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 134217857 long backcolor = 67108864 string text = "例子 ~'张三~',~'李四~'" boolean focusrectangle = false end type type sle_sendaddress from multilineedit within w_email_move integer x = 1477 integer y = 956 integer width = 800 integer height = 264 integer taborder = 10 integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 boolean vscrollbar = true boolean autovscroll = true borderstyle borderstyle = stylelowered! end type type ddlb_sendaddess from dropdownlistbox within w_email_move integer x = 722 integer y = 972 integer width = 617 integer height = 400 integer taborder = 10 integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 string text = "等于" string item[] = {"等于",""} borderstyle borderstyle = stylelowered! end type type st_7 from statictext within w_email_move integer x = 320 integer y = 964 integer width = 288 integer height = 88 integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 long backcolor = 67108864 string text = "发件人邮箱" boolean focusrectangle = false end type type sle_sendman from multilineedit within w_email_move integer x = 1477 integer y = 748 integer width = 800 integer height = 164 integer taborder = 50 integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 boolean vscrollbar = true boolean autovscroll = true borderstyle borderstyle = stylelowered! end type type cbx_1 from checkbox within w_email_move integer x = 133 integer y = 1540 integer width = 805 integer height = 60 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 type cb_3 from commandbutton within w_email_move integer x = 987 integer y = 1488 integer width = 434 integer height = 112 integer taborder = 40 integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" string text = "保存规则" end type event clicked;String ls_subject,ls_sendman,ls_sendaddress,ls_senddate,ls_senddate1,ls_choose_revdate,ls_sql1,ls_sql String ls_choose_subject,ls_choose_sendman ls_subject = Trim(sle_subject.Text) ls_sendman = Trim(sle_sendman.Text) ls_sendaddress= Trim(sle_sendaddress.Text) ls_senddate = "'" +Trim(em_1.Text) + "'" ls_senddate1 = "'" +Trim(em_2.Text) + "'" ls_choose_subject = Trim(ddlb_subject.Text) ls_choose_sendman = Trim(ddlb_sendman.Text) ls_choose_revdate = Trim(ddlb_senddate.Text) /////////////////////////////////////////////////////////////////////////////////////////////////////////// IF rb_3.Checked = True THEN //满足以下所有条件 IF ls_subject <> "" THEN IF ls_choose_subject = "包含" THEN ls_sql = "#1s(subject like '%" + ls_subject + "%')#1e" ELSEIF ls_choose_subject = "等于" THEN ls_sql = "#1s(subject = '" + ls_subject + "')#1e" END IF END IF IF ls_sendman <> "" THEN IF ls_sql <> "" THEN ls_sql = ls_sql + " and " ls_sql = ls_sql + "#2s(senduser in ( " + ls_sendman + " ) )#2e" END IF IF ls_sendaddress <> "" THEN IF ls_sql <> "" THEN ls_sql = ls_sql + " and " ls_sql = ls_sql + "#3s(sendaddress in ( " + ls_sendaddress + " ) )#3e" END IF IF ls_senddate <> "''" And Date(Trim(em_1.Text)) <> Date("1900-01-01") THEN IF ls_sql <> "" THEN ls_sql = ls_sql + " and " IF ls_choose_revdate <> "范围" THEN ls_sql = ls_sql + "#4s(convert(char(10),revdate,120) " + ls_choose_revdate + ls_senddate + ")#4e" ELSE IF Date(Trim(em_2.Text)) <> Date("1900-01-01") THEN ls_sql = ls_sql + "#4s(convert(char(10),revdate,120) >= " + ls_senddate + " and convert(char(10),revdate,120) <= " + ls_senddate1 + ")#4e" END IF END IF END IF IF ls_sql <> "" THEN ls_sql = ls_sql + " and mailtype ='收件'" ELSEIF rb_4.Checked = True THEN //满足以下任意条件 IF ls_subject <> "" THEN IF ls_choose_subject = "包含" THEN ls_sql = "#1s(subject like '%" + ls_subject + "%')#1e" ELSEIF ls_choose_subject = "等于" THEN ls_sql = "#1s(subject = '" + ls_subject + "')#1e" END IF END IF IF ls_sendman <> "" THEN IF ls_sql <> "" THEN ls_sql = ls_sql + " or " ls_sql = ls_sql + "#2s(senduser in ( " + ls_sendman + " ) )#2e" END IF IF ls_sendaddress <> "" THEN IF ls_sql <> "" THEN ls_sql = ls_sql + " or " ls_sql = ls_sql + "#3s(sendaddress in ( " + ls_sendaddress + " ) )#3e" END IF IF ls_senddate <> "''" And Date(Trim(em_1.Text)) <> Date("1900-01-01") THEN IF ls_sql <> "" THEN ls_sql = ls_sql + " or " IF ls_choose_revdate <> "范围" THEN ls_sql = ls_sql + "#4s(convert(char(10),revdate,120) " + ls_choose_revdate + ls_senddate + ")#4e" ELSE IF Date(Trim(em_2.Text)) <> Date("1900-01-01") THEN ls_sql = ls_sql + "#4s(convert(char(10),revdate,120) >= " + ls_senddate + " and convert(char(10),revdate,120) <= " + ls_senddate1 + ")#4e" END IF END IF END IF IF ls_sql <> "" THEN ls_sql = ls_sql + " and mailtype ='收件'" END IF ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ls_sql1 = "" IF rb_1.Checked = True THEN //从收件箱移入到文件夹 IF ls_sql <> "" THEN ls_sql1 = "update u_email_msg set boxid=" + String(tboxid) +" where " + ls_sql + "and boxid=" + String(revboxid) END IF ELSEIF rb_2.Checked = True THEN //从文件夹移出到收件箱 IF ls_sql <> "" THEN ls_sql1 = "update u_email_msg set boxid=" + String(revboxid) +" where " + ls_sql + "and boxid=" + String(tboxid) END IF END IF ls_sql1=of_globalreplace(ls_sql1,"‘","'") ls_sql1=of_globalreplace(ls_sql1,"’","'") ls_sql1=of_globalreplace(ls_sql1,",",",") //messagebox("",ls_sql1) Long if_filter = 0 IF rb_1.Checked = True THEN IF cbx_1.Checked = True THEN if_filter = 1 END IF UPDATE u_email_box Set Filter = :ls_sql1,if_filter = :if_filter Where boxid = :tboxid Using sqlca; IF sqlca.SQLCode <> 0 THEN MessageBox("错误" , "保存规则失败~n"+sqlca.SQLErrText) GOTO ext END IF COMMIT; MessageBox("成功","保存规则成功") ext: END IF end event type st_end from statictext within w_email_move integer x = 1349 integer y = 1372 integer width = 123 integer height = 76 integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 long backcolor = 67108864 string text = "结束" boolean focusrectangle = false end type type st_star from statictext within w_email_move integer x = 1353 integer y = 1268 integer width = 123 integer height = 76 integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 long backcolor = 67108864 string text = "开始" boolean focusrectangle = false end type type em_2 from editmask within w_email_move integer x = 1472 integer y = 1352 integer width = 800 integer height = 84 integer taborder = 40 integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 borderstyle borderstyle = stylelowered! maskdatatype maskdatatype = datemask! string mask = "yyyy-mm-dd" boolean dropdowncalendar = true end type type st_6 from statictext within w_email_move integer x = 114 integer y = 1460 integer width = 864 integer height = 64 integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 long backcolor = 67108864 string text = "(发件人 不包括 <邮箱地址> 部分)" boolean focusrectangle = false end type type rb_2 from radiobutton within w_email_move integer x = 1472 integer y = 16 integer width = 841 integer height = 80 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_1.Checked = True THEN st_1.Text = "目标文件夹:" + tv_data.b_string st_2.Text = "源文件夹:" + tv_data.d_string + " 收件箱" ELSEIF rb_2.Checked = True THEN st_1.Text = "目标文件夹:" + tv_data.d_string + " 收件箱" st_2.Text = "源文件夹:" + tv_data.b_string END IF end event type rb_1 from radiobutton within w_email_move integer x = 110 integer y = 16 integer width = 841 integer height = 80 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_1.Checked = True THEN st_1.Text = "目标文件夹:" + tv_data.b_string st_2.Text = "源文件夹:" + tv_data.d_string + " 收件箱" ELSEIF rb_2.Checked = True THEN st_1.Text = "目标文件夹:" + tv_data.d_string + " 收件箱" st_2.Text = "源文件夹:" + tv_data.b_string END IF end event type em_1 from editmask within w_email_move integer x = 1472 integer y = 1268 integer width = 800 integer height = 84 integer taborder = 50 integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 borderstyle borderstyle = stylelowered! maskdatatype maskdatatype = datemask! string mask = "yyyy-mm-dd" boolean dropdowncalendar = true end type type ddlb_senddate from dropdownlistbox within w_email_move integer x = 731 integer y = 1268 integer width = 617 integer height = 548 integer taborder = 40 integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 string text = "=" boolean sorted = false string item[] = {">","<","=",">=","<=","范围"} borderstyle borderstyle = stylelowered! end type event selectionchanged;IF ddlb_senddate.Text <> "范围" THEN st_star.Visible = False st_end.Visible = False em_2.Visible = False ELSE st_star.Visible = True st_end.Visible = True em_2.Visible = True END IF end event type st_5 from statictext within w_email_move integer x = 329 integer y = 1260 integer width = 311 integer height = 88 integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 long backcolor = 67108864 string text = "发送日期" boolean focusrectangle = false end type type ddlb_sendman from dropdownlistbox within w_email_move integer x = 731 integer y = 764 integer width = 617 integer height = 400 integer taborder = 40 integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 string text = "等于" string item[] = {"等于",""} borderstyle borderstyle = stylelowered! end type type st_4 from statictext within w_email_move integer x = 329 integer y = 756 integer width = 187 integer height = 88 integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 long backcolor = 67108864 string text = "发件人" boolean focusrectangle = false end type type cb_2 from commandbutton within w_email_move integer x = 1888 integer y = 1488 integer width = 471 integer height = 112 integer taborder = 30 integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" string text = "取消" end type event clicked;close(parent) end event type cb_1 from commandbutton within w_email_move integer x = 1431 integer y = 1488 integer width = 443 integer height = 112 integer taborder = 20 integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" string text = "立即执行" end type event clicked;String ls_subject,ls_sendman,ls_sendaddress,ls_senddate,ls_senddate1,ls_choose_revdate,ls_sql1,ls_sql String ls_choose_subject,ls_choose_sendman ls_subject = Trim(sle_subject.Text) ls_sendman = Trim(sle_sendman.Text) ls_sendaddress= Trim(sle_sendaddress.Text) ls_senddate = "'" +Trim(em_1.Text) + "'" ls_senddate1 = "'" +Trim(em_2.Text) + "'" ls_choose_subject = Trim(ddlb_subject.Text) ls_choose_sendman = Trim(ddlb_sendman.Text) ls_choose_revdate = Trim(ddlb_senddate.Text) /////////////////////////////////////////////////////////////////////////////////////////////////////////// IF rb_3.Checked = True THEN //满足以下所有条件 IF ls_subject <> "" THEN IF ls_choose_subject = "包含" THEN ls_sql = "#1s(subject like '%" + ls_subject + "%')#1e" ELSEIF ls_choose_subject = "等于" THEN ls_sql = "#1s(subject = '" + ls_subject + "')#1e" END IF END IF IF ls_sendman <> "" THEN IF ls_sql <> "" THEN ls_sql = ls_sql + " and " ls_sql = ls_sql + "#2s(senduser in ( " + ls_sendman + " ) )#2e" END IF IF ls_sendaddress <> "" THEN IF ls_sql <> "" THEN ls_sql = ls_sql + " and " ls_sql = ls_sql + "#3s(sendaddress in ( " + ls_sendaddress + " ) )#3e" END IF IF ls_senddate <> "''" And Date(Trim(em_1.Text)) <> Date("1900-01-01") THEN IF ls_sql <> "" THEN ls_sql = ls_sql + " and " IF ls_choose_revdate <> "范围" THEN ls_sql = ls_sql + "#4s(convert(char(10),revdate,120) " + ls_choose_revdate + ls_senddate + ")#4e" ELSE IF Date(Trim(em_2.Text)) <> Date("1900-01-01") THEN ls_sql = ls_sql + "#4s(convert(char(10),revdate,120) >= " + ls_senddate + " and convert(char(10),revdate,120) <= " + ls_senddate1 + ")#4e" END IF END IF END IF IF ls_sql <> "" THEN ls_sql = ls_sql + " and mailtype ='收件'" ELSEIF rb_4.Checked = True THEN //满足以下任意条件 IF ls_subject <> "" THEN IF ls_choose_subject = "包含" THEN ls_sql = "#1s(subject like '%" + ls_subject + "%')#1e" ELSEIF ls_choose_subject = "等于" THEN ls_sql = "#1s(subject = '" + ls_subject + "')#1e" END IF END IF IF ls_sendman <> "" THEN IF ls_sql <> "" THEN ls_sql = ls_sql + " or " ls_sql = ls_sql + "#2s(senduser in ( " + ls_sendman + " ) )#2e" END IF IF ls_sendaddress <> "" THEN IF ls_sql <> "" THEN ls_sql = ls_sql + " or " ls_sql = ls_sql + "#3s(sendaddress in ( " + ls_sendaddress + " ) )#3e" END IF IF ls_senddate <> "''" And Date(Trim(em_1.Text)) <> Date("1900-01-01") THEN IF ls_sql <> "" THEN ls_sql = ls_sql + " or " IF ls_choose_revdate <> "范围" THEN ls_sql = ls_sql + "#4s(convert(char(10),revdate,120) " + ls_choose_revdate + ls_senddate + ")#4e" ELSE IF Date(Trim(em_2.Text)) <> Date("1900-01-01") THEN ls_sql = ls_sql + "#4s(convert(char(10),revdate,120) >= " + ls_senddate + " and convert(char(10),revdate,120) <= " + ls_senddate1 + ")#4e" END IF END IF END IF IF ls_sql <> "" THEN ls_sql = ls_sql + " and mailtype ='收件'" END IF ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ls_sql1 = "" IF rb_1.Checked = True THEN //从收件箱移入到文件夹 IF ls_sql <> "" THEN ls_sql1 = "update u_email_msg set boxid=" + String(tboxid) +" where " + ls_sql + "and boxid=" + String(revboxid) END IF ELSEIF rb_2.Checked = True THEN //从文件夹移出到收件箱 IF ls_sql <> "" THEN ls_sql1 = "update u_email_msg set boxid=" + String(revboxid) +" where " + ls_sql + "and boxid=" + String(tboxid) END IF END IF ls_sql1=of_globalreplace(ls_sql1,"‘","'") ls_sql1=of_globalreplace(ls_sql1,"’","'") ls_sql1=of_globalreplace(ls_sql1,",",",") ls_sql1=of_globalreplace(ls_sql1,"#1s"," ") ls_sql1=of_globalreplace(ls_sql1,"#2s"," ") ls_sql1=of_globalreplace(ls_sql1,"#3s"," ") ls_sql1=of_globalreplace(ls_sql1,"#4s"," ") ls_sql1=of_globalreplace(ls_sql1,"#1e"," ") ls_sql1=of_globalreplace(ls_sql1,"#2e"," ") ls_sql1=of_globalreplace(ls_sql1,"#3e"," ") ls_sql1=of_globalreplace(ls_sql1,"#4e"," ") //messagebox("",ls_sql1) IF ls_sql1 <> "" THEN EXECUTE Immediate :ls_sql1 Using sys_email_sqlca; IF sys_email_sqlca.SQLCode <> 0 THEN MessageBox("错误" , "移动邮件失败~n"+sys_email_sqlca.SQLErrText) GOTO ext END IF COMMIT; ext: Close(Parent) END IF end event type sle_subject from singlelineedit within w_email_move integer x = 1472 integer y = 608 integer width = 800 integer height = 84 integer taborder = 20 integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 borderstyle borderstyle = stylelowered! end type type ddlb_subject from dropdownlistbox within w_email_move integer x = 731 integer y = 608 integer width = 617 integer height = 400 integer taborder = 10 integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 string text = "包含" string item[] = {"包含","等于"} borderstyle borderstyle = stylelowered! end type type st_3 from statictext within w_email_move integer x = 329 integer y = 608 integer width = 187 integer height = 88 integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 long backcolor = 67108864 string text = "主题" boolean focusrectangle = false end type type rb_4 from radiobutton within w_email_move integer x = 1472 integer y = 476 integer width = 695 integer height = 80 integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 long backcolor = 67108864 string text = "满足以下任意条件" end type type rb_3 from radiobutton within w_email_move integer x = 315 integer y = 472 integer width = 695 integer height = 80 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 type st_2 from statictext within w_email_move integer x = 105 integer y = 256 integer width = 1691 integer height = 88 integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 long backcolor = 67108864 string text = "源文件夹" boolean focusrectangle = false end type type st_1 from statictext within w_email_move integer x = 105 integer y = 140 integer width = 1691 integer height = 88 integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 long backcolor = 67108864 string text = "目标文件夹" boolean focusrectangle = false end type type gb_1 from groupbox within w_email_move integer x = 110 integer y = 372 integer width = 2235 integer height = 1084 integer taborder = 20 integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 long backcolor = 67108864 string text = "条件" end type