$PBExportHeader$w_cus_ecomm_edit_add.srw forward global type w_cus_ecomm_edit_add from w_publ_base end type type st_1 from statictext within w_cus_ecomm_edit_add end type type sle_summary from singlelineedit within w_cus_ecomm_edit_add end type type cb_save from uo_imflatbutton within w_cus_ecomm_edit_add end type type cb_paste from uo_imflatbutton within w_cus_ecomm_edit_add end type type dw_cus_rep from u_dw_rbtnfilter within w_cus_ecomm_edit_add end type type tv_pwr from uo_ljfieb_tv_pwr within w_cus_ecomm_edit_add end type type ln_bar from line within w_cus_ecomm_edit_add end type type ln_bar2 from line within w_cus_ecomm_edit_add end type type r_bar from rectangle within w_cus_ecomm_edit_add end type end forward global type w_cus_ecomm_edit_add from w_publ_base integer width = 3611 integer height = 2380 string title = "电子商务用户新建/修改" boolean minbox = false windowtype windowtype = response! st_1 st_1 sle_summary sle_summary cb_save cb_save cb_paste cb_paste dw_cus_rep dw_cus_rep tv_pwr tv_pwr ln_bar ln_bar ln_bar2 ln_bar2 r_bar r_bar end type global w_cus_ecomm_edit_add w_cus_ecomm_edit_add type prototypes Function long GetCursor () Library "user32.dll" Alias for "GetCursor" Function long LoadCursor (long hInstance, long lpCursorName) Library "user32.dll" Alias for "LoadCursorW" end prototypes type variables long cur_cusid long cur_repid long copy_repid end variables forward prototypes public function integer wf_save () public function integer wf_insertrow () public subroutine wf_set_tvchild (long arg_handl, integer arg_index) public subroutine wf_set_tvparent (long arg_handl, integer arg_index) end prototypes public function integer wf_save ();Int rslt = 1 Long li_row String arg_msg uo_ljfieb_cus uo_ljc uo_ljc = Create uo_ljfieb_cus uo_ljfieb uo_fieb uo_fieb = Create uo_ljfieb uo_fieb.commit_transaction = sys_email_sqlca dw_cus_rep.AcceptText() li_row = dw_cus_rep.GetRow() IF li_row <= 0 THEN arg_msg = "没有可保存的信息" rslt = 0 GOTO ext END IF s_cus_rep_ljfieb s_rep String ls_Permissions Long ll_handl Long ll_repid_arr[] Long ll_cnt Boolean lb_SetPwd ls_Permissions = Fill('0', 5000) ll_handl = tv_pwr.FindItem(RootTreeItem!,0) IF ll_handl > 0 THEN tv_pwr.pf_get_value(ll_handl, ls_Permissions) s_rep.repid = dw_cus_rep.Object.repid[li_row] IF s_rep.repid = 0 THEN //新用户传密码 lb_SetPwd = True ELSE //修改的不传密码 lb_SetPwd = False END IF s_rep.cusid = dw_cus_rep.Object.cusid[li_row] s_rep.loginname = Trim(dw_cus_rep.Object.loginname[li_row]) s_rep.repname = Trim(dw_cus_rep.Object.repname[li_row]) s_rep.deptname = Trim(dw_cus_rep.Object.deptname[li_row]) s_rep.duty = Trim(dw_cus_rep.Object.duty[li_row]) s_rep.sex = Trim(dw_cus_rep.Object.sex[li_row]) s_rep.officetel = Trim(dw_cus_rep.Object.officetel[li_row]) s_rep.handtel = Trim(dw_cus_rep.Object.handtel[li_row]) s_rep.faxno = Trim(dw_cus_rep.Object.faxno[li_row]) s_rep.email = Trim(dw_cus_rep.Object.email[li_row]) s_rep.interest = Trim(dw_cus_rep.Object.interest[li_row]) s_rep.mainproduct = Trim(dw_cus_rep.Object.mainproduct[li_row]) s_rep.qqcode = Trim(dw_cus_rep.Object.qqcode[li_row]) s_rep.msncode = Trim(dw_cus_rep.Object.msncode[li_row]) s_rep.dscrp = Trim(dw_cus_rep.Object.dscrp[li_row]) s_rep.Address = Trim(dw_cus_rep.Object.Address[li_row]) s_rep.Permissions = ls_Permissions s_rep.reptype = 2 //1-供应商; 2-客户; s_rep.ljemail = Trim(dw_cus_rep.Object.ljemail[li_row]) //保存本地数据库 IF uo_ljc.uof_add_cust_rep(s_rep,arg_msg,False) = 0 THEN rslt = 0 GOTO ext END IF //发送电商数据库 ll_repid_arr[1] = uo_ljc.uo_repid IF uo_fieb.send_cust_rep(0, ll_repid_arr, '', '', '', lb_SetPwd, arg_msg, False) = 0 THEN rslt = 0 GOTO ext END IF long ll_cusid_arr[] ll_cusid_arr[1] = dw_cus_rep.Object.cusid[li_row] IF uo_fieb.send_cust(0, ll_cusid_arr, '', '', '', arg_msg, False) = 0 THEN rslt = 0 GOTO ext END IF ext: Destroy uo_ljc Destroy uo_fieb IF rslt = 0 THEN ROLLBACK Using sqlca; ROLLBACK Using sys_email_sqlca; MessageBox('系统提示',arg_msg) ELSE COMMIT Using sqlca; COMMIT Using sys_email_sqlca; MessageBox('系统提示',"保存成功") END IF RETURN rslt end function public function integer wf_insertrow ();Long ll_row ll_row = dw_cus_rep.InsertRow(0) dw_cus_rep.Object.cusid[ll_row] = cur_cusid IF cur_repid > 0 THEN dw_cus_rep.Retrieve(cur_repid) String ls_Permissions SELECT Permissions INTO :ls_Permissions FROM ros_cust_rep Where repid = :cur_repid; IF sqlca.SQLCode <> 0 THEN ls_Permissions = '' END IF Long ll_handl ll_handl = tv_pwr.FindItem(RootTreeItem!,0) IF ll_handl > 0 THEN tv_pwr.pf_refresh_value(ll_handl,ls_Permissions) END IF dw_cus_rep.SetFocus() dw_cus_rep.SetColumn('loginname') RETURN 1 end function public subroutine wf_set_tvchild (long arg_handl, integer arg_index); Long ll_handl treeviewitem tvi ll_handl = arg_handl tv_pwr.GetItem(ll_handl,tvi) tvi.StatePictureIndex = arg_index tv_pwr.SetItem(ll_handl,tvi) ll_handl = tv_pwr.FindItem(ChildTreeItem!,ll_handl) DO WHILE ll_handl > 0 wf_set_tvchild(ll_handl, arg_index) ll_handl = tv_pwr.FindItem(NextTreeItem!,ll_handl) LOOP end subroutine public subroutine wf_set_tvparent (long arg_handl, integer arg_index); Long ll_handl treeviewitem tvi ll_handl = arg_handl tv_pwr.GetItem(ll_handl,tvi) tvi.StatePictureIndex = arg_index tv_pwr.SetItem(ll_handl,tvi) ll_handl = tv_pwr.FindItem(ParentTreeItem!,ll_handl) DO WHILE ll_handl > 0 tv_pwr.GetItem(ll_handl,tvi) tvi.StatePictureIndex = arg_index tv_pwr.SetItem(ll_handl,tvi) ll_handl = tv_pwr.FindItem(ParentTreeItem!,ll_handl) LOOP end subroutine on w_cus_ecomm_edit_add.create int iCurrent call super::create this.st_1=create st_1 this.sle_summary=create sle_summary this.cb_save=create cb_save this.cb_paste=create cb_paste this.dw_cus_rep=create dw_cus_rep this.tv_pwr=create tv_pwr this.ln_bar=create ln_bar this.ln_bar2=create ln_bar2 this.r_bar=create r_bar iCurrent=UpperBound(this.Control) this.Control[iCurrent+1]=this.st_1 this.Control[iCurrent+2]=this.sle_summary this.Control[iCurrent+3]=this.cb_save this.Control[iCurrent+4]=this.cb_paste this.Control[iCurrent+5]=this.dw_cus_rep this.Control[iCurrent+6]=this.tv_pwr this.Control[iCurrent+7]=this.ln_bar this.Control[iCurrent+8]=this.ln_bar2 this.Control[iCurrent+9]=this.r_bar end on on w_cus_ecomm_edit_add.destroy call super::destroy destroy(this.st_1) destroy(this.sle_summary) destroy(this.cb_save) destroy(this.cb_paste) destroy(this.dw_cus_rep) destroy(this.tv_pwr) destroy(this.ln_bar) destroy(this.ln_bar2) destroy(this.r_bar) end on event open;call super::open;dw_cus_rep.SetTransObject(sqlca) s_edit_index_tran s_tran //传递参数使用 s_tran = Message.PowerObjectParm cur_cusid = s_tran.b_long cur_repid = s_tran.c_long copy_repid = s_tran.d_long cb_paste.Enabled = copy_repid > 0 wf_insertrow() end event event close;call super::close;//closewithreturn(this,s_return) end event event resize;call super::resize;ln_bar.endx = this.width ln_bar2.endx = this.width r_bar.width = this.width dw_cus_rep.height = this.height - dw_cus_rep.y - 140 tv_pwr.x = dw_cus_rep.x +dw_cus_rep.width +10 tv_pwr.y = dw_cus_rep.y tv_pwr.width = this.width - tv_pwr.x - 40 tv_pwr.height = dw_cus_rep.height end event type cb_func from w_publ_base`cb_func within w_cus_ecomm_edit_add boolean visible = false integer taborder = 30 end type type cb_exit from w_publ_base`cb_exit within w_cus_ecomm_edit_add integer x = 311 integer width = 151 integer height = 164 integer picsize = 16 toolbaralignment pic_align = alignattop! boolean border = false end type event cb_exit::clicked;//s_return.returnflag = 0 close(parent) end event type st_1 from statictext within w_cus_ecomm_edit_add boolean visible = false integer y = 32 integer width = 160 integer height = 48 boolean bringtotop = true integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 long backcolor = 134217739 string text = "摘要" alignment alignment = right! boolean focusrectangle = false end type type sle_summary from singlelineedit within w_cus_ecomm_edit_add boolean visible = false integer x = 169 integer y = 28 integer width = 2144 integer height = 84 integer taborder = 60 boolean bringtotop = true integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 borderstyle borderstyle = stylelowered! end type type cb_save from uo_imflatbutton within w_cus_ecomm_edit_add integer width = 151 integer height = 164 integer taborder = 50 boolean bringtotop = true string text = "保存" string normalpicname = "save.bmp" integer picsize = 16 toolbaralignment pic_align = alignattop! boolean border = false end type event clicked;call super::clicked;IF wf_save() = 1 THEN Close(Parent) END IF end event type cb_paste from uo_imflatbutton within w_cus_ecomm_edit_add integer x = 155 integer width = 151 integer height = 164 integer taborder = 20 boolean bringtotop = true string text = "粘贴" string normalpicname = "paste.bmp" integer picsize = 16 toolbaralignment pic_align = alignattop! boolean border = false end type event clicked;call super::clicked;if copy_repid <= 0 then return String ls_Permissions SELECT Permissions INTO :ls_Permissions FROM ros_cust_rep Where repid = :copy_repid; IF sqlca.SQLCode <> 0 THEN ls_Permissions = '' END IF Long ll_handl ll_handl = tv_pwr.FindItem(RootTreeItem!,0) IF ll_handl > 0 THEN tv_pwr.pf_refresh_value(ll_handl,ls_Permissions) end event type dw_cus_rep from u_dw_rbtnfilter within w_cus_ecomm_edit_add integer y = 180 integer width = 1495 integer height = 1908 integer taborder = 70 boolean bringtotop = true string title = "客户资料" string dataobject = "dw_cus_rep_ecomm_edit_add" boolean maxbox = true boolean livescroll = false boolean titleclick_sort_use = true end type event doubleclicked;call super::doubleclicked;//IF Not dw_edit_mode THEN RETURN // //Long ll_row // //ll_row = dw_cus.GetRow() // //IF ll_row <= 0 THEN RETURN // //OpenWithParm(w_cuscomm_list_ch,2) // //s_cuscomm_ljfieb INS_RT_STRU // //INS_RT_STRU = Message.PowerObjectParm // //dw_cus.Object.ifecomm[ll_row] = 1 //dw_cus.Object.commcode[ll_row] = INS_RT_STRU.CusCode // // //dw_cus.accepttext() // // end event event dwnkey;call super::dwnkey;Parent.TriggerEvent('user_key') IF Key = KeyDownArrow! THEN RETURN 1 IF Key = KeyEnter! THEN // keybd_event ( 9, 0, 0 , 0 ) // 按下tab keybd_event ( 9, 0, 2, 0 ) // 释放tab RETURN 1 END IF end event event rowfocuschanging;call super::rowfocuschanging;return 1 end event event constructor;// end event type tv_pwr from uo_ljfieb_tv_pwr within w_cus_ecomm_edit_add integer x = 1509 integer y = 192 integer taborder = 20 boolean bringtotop = true end type event clicked;call super::clicked;Int li_state Long ll_handl treeviewitem tvi Boolean lb_changed = False IF GetCursor() = LoadCursor(0, 32649) THEN lb_changed = True END IF IF This.GetItem(Handle,tvi) = 1 THEN li_state = tvi.StatePictureIndex //当前的状态 IF lb_changed THEN //3 - li_state IF li_state = 1 THEN //没有权限 --> 有权限 li_state = 2 //父级同时变更 ELSE //2 有权限 --> 没有权限 li_state = 1 //子级同时变更 END IF tvi.StatePictureIndex = li_state This.SetItem(Handle,tvi) IF li_state = 2 THEN wf_set_tvparent(Handle, li_state) ELSE wf_set_tvchild(Handle, li_state) END IF END IF END IF end event type ln_bar from line within w_cus_ecomm_edit_add long linecolor = 268435456 integer linethickness = 4 integer beginy = 172 integer endx = 2007 integer endy = 172 end type type ln_bar2 from line within w_cus_ecomm_edit_add long linecolor = 16777215 integer linethickness = 4 integer beginy = 176 integer endx = 2039 integer endy = 176 end type type r_bar from rectangle within w_cus_ecomm_edit_add long linecolor = 16777215 integer linethickness = 4 long fillcolor = 1073741824 integer x = 1531 integer width = 146 integer height = 68 end type event constructor;this.fillcolor = 14215660 this.linecolor = 14215660 this.x = -1 this.y = -1 this.height = ln_bar.beginy - 5 end event