$PBExportHeader$w_cust_crm_add.srw forward global type w_cust_crm_add from w_publ_base end type type dw_1 from datawindow within w_cust_crm_add end type type cb_2 from uo_imflatbutton within w_cust_crm_add end type type cb_1 from uo_imflatbutton within w_cust_crm_add end type end forward global type w_cust_crm_add from w_publ_base integer width = 2432 integer height = 1820 string title = "客户资料" boolean minbox = false windowtype windowtype = response! dw_1 dw_1 cb_2 cb_2 cb_1 cb_1 end type global w_cust_crm_add w_cust_crm_add type variables s_custom s_cust_open uo_crm uo_cus end variables forward prototypes public function integer wf_save () public function integer wf_insertrow () end prototypes public function integer wf_save ();Int rslt = 1 Long li_row dw_1.AcceptText() li_row = dw_1.GetRow() IF li_row <= 0 THEN MessageBox('提示','记录错误',information!,ok!) rslt = 0 GOTO ext END IF String arg_msg s_custom arg_s_cust arg_s_cust.cusid = dw_1.Object.cusid[dw_1.GetRow()] arg_s_cust.cuscode = dw_1.Object.cuscode[dw_1.GetRow()] arg_s_cust.Name = dw_1.Object.Name[dw_1.GetRow()] arg_s_cust.bsntype = dw_1.Object.custype[dw_1.GetRow()] arg_s_cust.rep = dw_1.Object.rep[dw_1.GetRow()] arg_s_cust.tele = dw_1.Object.tele[dw_1.GetRow()] arg_s_cust.tele1 = dw_1.Object.tele1[dw_1.GetRow()] arg_s_cust.bank = dw_1.Object.bank[dw_1.GetRow()] arg_s_cust.cunt = dw_1.Object.cunt[dw_1.GetRow()] arg_s_cust.Address = dw_1.Object.Address[dw_1.GetRow()] arg_s_cust.code = dw_1.Object.code[dw_1.GetRow()] arg_s_cust.dscrp = dw_1.Object.dscrp[dw_1.GetRow()] arg_s_cust.givebackrate = dw_1.Object.givebackrate[dw_1.GetRow()] arg_s_cust.freight = dw_1.Object.freight[dw_1.GetRow()] arg_s_cust.freight_tele = dw_1.Object.freight_tele[dw_1.GetRow()] arg_s_cust.fax = dw_1.Object.faxno[dw_1.GetRow()] arg_s_cust.upname = dw_1.Object.upname[dw_1.GetRow()] arg_s_cust.inuse = dw_1.Object.inuse[dw_1.GetRow()] arg_s_cust.cusareaid = dw_1.Object.cusareaid[dw_1.GetRow()] arg_s_cust.areaname = dw_1.Object.areaname[dw_1.GetRow()] arg_s_cust.cusareaname = dw_1.Object.cusareaname[dw_1.GetRow()] arg_s_cust.email = dw_1.Object.email[dw_1.GetRow()] arg_s_cust.State = dw_1.Object.State[dw_1.GetRow()] arg_s_cust.peoplenum = dw_1.Object.peoplenum[dw_1.GetRow()] arg_s_cust.mainmarket = dw_1.Object.mainmarket[dw_1.GetRow()] arg_s_cust.saleamt = dw_1.Object.saleamt[dw_1.GetRow()] arg_s_cust.nethttp = dw_1.Object.nethttp[dw_1.GetRow()] arg_s_cust.trade = dw_1.Object.trade[dw_1.GetRow()] arg_s_cust.corporation = dw_1.Object.corporation[dw_1.GetRow()] arg_s_cust.grade = dw_1.Object.grade[dw_1.GetRow()] arg_s_cust.simplename = dw_1.Object.simplename[dw_1.GetRow()] IF uo_cus.uof_add_cust(arg_s_cust,publ_operator,arg_msg,TRUE) = 0 THEN MessageBox ("错误",arg_msg+",保存操作失败!",stopsign!,ok!) rslt = 0 GOTO ext END IF ext: RETURN rslt end function public function integer wf_insertrow ();Long ll_row ll_row = dw_1.InsertRow(0) dw_1.Object.cusareaid[ll_row] = s_cust_open.cusareaid IF sys_option_cust_audit = 1 THEN dw_1.Object.State[ll_row] = 0 ELSE dw_1.Object.State[ll_row] = 1 END IF dw_1.SetFocus() dw_1.SetColumn('cuscode') RETURN 1 end function on w_cust_crm_add.create int iCurrent call super::create this.dw_1=create dw_1 this.cb_2=create cb_2 this.cb_1=create cb_1 iCurrent=UpperBound(this.Control) this.Control[iCurrent+1]=this.dw_1 this.Control[iCurrent+2]=this.cb_2 this.Control[iCurrent+3]=this.cb_1 end on on w_cust_crm_add.destroy call super::destroy destroy(this.dw_1) destroy(this.cb_2) destroy(this.cb_1) end on event open;call super::open;dw_1.SetTransObject(sqlca) s_cust_open = Message.PowerObjectParm uo_cus = CREATE uo_crm IF s_cust_open.cusid = 0 THEN wf_insertrow() ELSE dw_1.Retrieve(s_cust_open.cusid) END IF end event event close;call super::close;destroy uo_cus end event type cb_func from w_publ_base`cb_func within w_cust_crm_add boolean visible = false integer x = 1056 integer y = 580 boolean enabled = false end type type cb_exit from w_publ_base`cb_exit within w_cust_crm_add integer x = 1705 integer y = 1596 integer taborder = 30 string text = "取消" end type type dw_1 from datawindow within w_cust_crm_add event key pbm_dwnkey event dwnkey pbm_dwnkey integer x = 55 integer y = 64 integer width = 2309 integer height = 1492 integer taborder = 10 boolean bringtotop = true string dataobject = "dw_cust_crm_edit" boolean livescroll = true borderstyle borderstyle = stylelowered! end type event dwnkey;IF Key = KeyDownArrow! THEN RETURN 1 IF Key = keyenter! OR Key = KeyDownArrow! THEN // keybd_event ( 9, 0, 0 , 0 ) // 按下tab keybd_event ( 9, 0, 2, 0 ) // 释放tab RETURN 0 ELSEIF Key = keyuparrow! THEN keybd_event ( 16, 0, 0 , 0 ) keybd_event ( 9, 0, 0 , 0 ) keybd_event ( 9, 0, 2, 0 ) keybd_event ( 16, 0, 2, 0 ) RETURN 0 END IF end event event buttonclicked; IF dwo.Name = 'b_s' THEN s_edit_index_tran s_ch_tran //传递参数使用 s_ch_tran.if_retrieve_all = FALSE //是否一次RETRIEVE所有行 s_ch_tran.work_mode = 1 //0-单纯编辑模式 1-选择\编辑模式 s_ch_tran.arg_pkid = 0 //目标定位PKID (备用) OpenWithParm(w_station_edit,s_ch_tran) //调用 s_station S_INSCUST S_INSCUST = Message.PowerObjectParm //接受返回结构 IF S_INSCUST.stationid > 0 THEN //正常返回值则可以取以下值 dw_1.SetRedraw(FALSE) dw_1.Object.freight[row] = S_INSCUST.stationname dw_1.Object.freight_tele[row] = S_INSCUST.tele dw_1.SetRedraw(TRUE) END IF END IF end event type cb_2 from uo_imflatbutton within w_cust_crm_add integer x = 1134 integer y = 1596 integer width = 407 integer height = 96 integer taborder = 40 string text = "保存[C^+S]" string normalpicname = "save.bmp" end type event clicked;call super::clicked;if wf_save() = 0 then return close(parent) end event type cb_1 from uo_imflatbutton within w_cust_crm_add integer x = 480 integer y = 1596 integer width = 489 integer height = 96 integer taborder = 40 string text = "保存&新增[&S]" string normalpicname = "save.bmp" end type event clicked;call super::clicked;IF wf_save() = 0 THEN RETURN wf_insertrow() end event