123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151 |
- $PBExportHeader$uo_tv_sendmail.sru
- forward
- global type uo_tv_sendmail from treeview
- end type
- end forward
- global type uo_tv_sendmail from treeview
- integer width = 640
- integer height = 564
- integer textsize = -9
- fontcharset fontcharset = gb2312charset!
- fontpitch fontpitch = variable!
- string facename = "宋体"
- end type
- global uo_tv_sendmail uo_tv_sendmail
- type variables
- private:
- DataStore _ds_tv
- Transaction _tran
- string ori_oldselect
- long empid
- long cusareaid[]
- long spttypeid[]
- end variables
- forward prototypes
- public function integer f_init (transaction arg_tran)
- public function integer f_retrieve (long arg_empid, long arg_cusareaid[], long arg_spttypeid_arr[])
- public function integer f_maketree ()
- public function s_tv_sendmail f_getcontent (long arg_index)
- public function integer f_filter (string arg_parm)
- public function integer uf_getreltype (string arg_mailaddress)
- end prototypes
- public function integer f_init (transaction arg_tran);this._tran = arg_tran
- connect using this._tran;
- if isvalid(_ds_tv) then
- destroy this._ds_tv
- end if
- this._ds_tv = Create DataStore
- this._ds_tv.dataobject = 'ddd_tv_sandmail'
- this._ds_tv.SetTrans(this._tran)
- this.ori_oldselect = this._ds_tv.Describe("DataWindow.Table.Select")
- return 1
- end function
- public function integer f_retrieve (long arg_empid, long arg_cusareaid[], long arg_spttypeid_arr[]);this._ds_tv.retrieve(arg_empid, arg_cusareaid, arg_spttypeid_arr)
- this.empid = arg_empid
- this.cusareaid = arg_cusareaid
- this.spttypeid = arg_spttypeid_arr
- this.f_maketree( )
- return 0
- end function
- public function integer f_maketree ();//wf_maketree()
- long ll_rep_hand, ll_cus_hand, ll_spt_hand
- long i, li_parent,li_hand
- //uo_deep=1
- long tvi_hdl = 0
- DO UNTIL this.FindItem(RootTreeItem!, 0) = -1
- this.DeleteItem(tvi_hdl)
- LOOP
- li_parent = this.insertitemlast(0,'[双击添加]', 1)
- ll_rep_hand = this.insertitemlast(li_parent,'通讯录',2)
- ll_cus_hand = this.insertitemlast(li_parent, '客户', 2)
- ll_spt_hand = this.insertitemlast(li_parent, '供应商', 2)
- TreeViewItem l_tvi
- for i = 1 to this._ds_tv.rowcount( )
- if this._ds_tv.object.GroupID[i] = 0 then
- li_hand = ll_rep_hand
- elseif this._ds_tv.object.GroupID[i] = 1 then
- li_hand = ll_cus_hand
- else
- li_hand = ll_spt_hand
- end if
- li_hand = this.insertitemlast(li_hand,this._ds_tv.object.mailname[i],3)
- if this.GetItem(li_hand, l_tvi) = 1 then
- l_tvi.label = this._ds_tv.object.mailname[i] + '<' + this._ds_tv.object.mailaddress[i] + '>'
- l_tvi.data = i
- this.SetItem(li_hand, l_tvi)
- end if
- next
- this.ExpandItem( li_parent )
- return 1
- end function
- public function s_tv_sendmail f_getcontent (long arg_index);s_tv_sendmail rslt
- if arg_index > 0 and arg_index < this._ds_tv.rowcount( ) then
- rslt.groupid = this._ds_tv.object.GroupID[arg_index]
- rslt.reltype = this._ds_tv.object.reltype[arg_index]
- rslt.relid = this._ds_tv.object.relid[arg_index]
- rslt.mailname = this._ds_tv.object.mailname[arg_index]
- rslt.mailaddress = this._ds_tv.object.mailaddress[arg_index]
- rslt.dscrp = this._ds_tv.object.dscrp[arg_index]
- else
- rslt.groupid = -1
- end if
- return rslt
-
- end function
- public function integer f_filter (string arg_parm);integer rslt = 1
- string ls_filter
- arg_parm =lower(arg_parm)
- if trim(arg_parm) = '' then
- ls_filter = ''
- else
- ls_filter = "(lower(mailname) like '%" + arg_parm + "%') OR (lower(mailaddress) like '%" + arg_parm + "%')"
- end if
- this.setredraw(false)
- this._ds_tv.setFilter(ls_filter)
- this._ds_tv.filter()
- this.f_maketree( )
- this.setredraw(true)
- return rslt
- end function
- public function integer uf_getreltype (string arg_mailaddress);long index
- index = this._ds_tv.find("lower(mailaddress)='" + trim(lower(arg_mailaddress)) + "'", 0, this._ds_tv.rowcount())
- if index > 0 then
- return this._ds_tv.object.reltype[index]
- end if
-
- return 3
- end function
- on uo_tv_sendmail.create
- end on
- on uo_tv_sendmail.destroy
- end on
- event destructor;if isvalid(this._ds_tv) then
- destroy this._ds_tv
- end if
- end event
- event constructor;setnull(this._ds_tv)
- end event
|