$PBExportHeader$w_outrepdef_edit.srw forward global type w_outrepdef_edit from w_publ_edit_choice end type type cb_view from uo_imflatbutton within w_outrepdef_edit end type type cbx_inuse from checkbox within w_outrepdef_edit end type type st_msg from statictext within w_outrepdef_edit end type end forward global type w_outrepdef_edit from w_publ_edit_choice integer width = 2533 integer height = 1640 string title = "业务员" boolean minbox = true windowtype windowtype = popup! boolean if_ue_retr = true boolean if_ue_filter = true boolean if_ue_sort = true boolean if_ue_sentdataout = true cb_view cb_view cbx_inuse cbx_inuse st_msg st_msg end type global w_outrepdef_edit w_outrepdef_edit type variables s_outrepdef INS_RT_STRU long il_inuse = 1 long il_Edit_column = 5 end variables on w_outrepdef_edit.create int iCurrent call super::create this.cb_view=create cb_view this.cbx_inuse=create cbx_inuse this.st_msg=create st_msg iCurrent=UpperBound(this.Control) this.Control[iCurrent+1]=this.cb_view this.Control[iCurrent+2]=this.cbx_inuse this.Control[iCurrent+3]=this.st_msg end on on w_outrepdef_edit.destroy call super::destroy destroy(this.cb_view) destroy(this.cbx_inuse) destroy(this.st_msg) end on event close;call super::close;CLOSEWITHRETURN(THIS,INS_RT_STRU) end event event retrieve_uc;dw_UC.retrieve(il_inuse) end event event open;call super::open;IF sys_option_outrep = 1 THEN st_msg.Visible = True st_msg.Text = "使用业务员限制,修改不能改名称" ELSE st_msg.Visible = False END IF end event type cb_func from w_publ_edit_choice`cb_func within w_outrepdef_edit end type type cb_exit from w_publ_edit_choice`cb_exit within w_outrepdef_edit integer x = 987 end type type cb_add from w_publ_edit_choice`cb_add within w_outrepdef_edit end type event cb_add::clicked;call super::clicked;IF Not f_power_ind(18) THEN MessageBox('提示','你没有使用权限!', Information!, OK! ) RETURN END IF Long i IF dw_edit_mode THEN dw_uc.AcceptText() IF dw_uc.GetNextModified(0, Primary!) = 0 THEN MessageBox('提示','没有任何修改,不可以保存!', Information!, OK! ) RETURN END IF dw_uc.Object.outrepcode[dw_uc.GetRow()] = Upper(Trim(dw_uc.Object.outrepcode[dw_uc.GetRow()])) dw_uc.Object.outrepname[dw_uc.GetRow()] = Trim(dw_uc.Object.outrepname[dw_uc.GetRow()]) dw_uc.Object.outrepdscrp[dw_uc.GetRow()] = Trim(dw_uc.Object.outrepdscrp[dw_uc.GetRow()]) dw_uc.Object.opdate[dw_uc.GetRow()] = Today() dw_uc.Object.opemp[dw_uc.GetRow()] = publ_operator IF dw_uc.Object.outrepcode[dw_uc.GetRow()] = '' THEN MessageBox('提示','请输入编号!', Information!, OK! ) RETURN END IF IF dw_uc.Object.outrepname[dw_uc.GetRow()] = '' THEN MessageBox('提示','请输入名称!', Information!, OK! ) RETURN END IF String ls_errmsg IF dw_uc.Update() = -1 THEN IF Pos(ins_sqlerrtext,"Cannot insert duplicate key row") > 0 THEN ls_errmsg = "关键内容重复" ELSE ls_errmsg = "因为网络或其他原因>"+ins_sqlerrtext END IF ROLLBACK; MessageBox ("提示",ls_errmsg+",保存操作失败!", Information!, OK! ) LS_UPDATE_FLAG = False RETURN ELSE COMMIT; LS_UPDATE_FLAG = True FOR i = 1 To il_Edit_column dw_uc.SetTabOrder ( i, 0 ) NEXT END IF ins_sqlerrtext = "" ELSE Long li_row, li_cur_row li_cur_row = dw_uc.GetRow() li_row = dw_uc.InsertRow (0) FOR i = 1 To il_Edit_column dw_uc.SetTabOrder ( i, i*10 ) NEXT dw_uc.SelectRow(0,False) dw_uc.ScrollToRow (li_row) dw_uc.SelectRow(li_row,True) dw_uc.SetFocus() dw_uc.SetColumn("outrepcode") modifyrow_no = li_row END IF dw_edit_mode = Not dw_edit_mode WF_FACE_CHANGE() end event type cb_edit from w_publ_edit_choice`cb_edit within w_outrepdef_edit end type event cb_edit::clicked;call super::clicked;IF Not f_power_ind(18) THEN MessageBox('提示','你没有使用权限!', Information!, OK! ) RETURN END IF Long i IF dw_edit_mode THEN IF dw_uc.GetItemStatus(dw_uc.GetRow(), 0, Primary!) = NewModified! Or dw_uc.GetItemStatus(dw_uc.GetRow(), 0, Primary!) = New! THEN dw_uc.DeleteRow(dw_uc.GetRow()) ELSE dw_uc.ReselectRow(dw_uc.GetRow()) END IF FOR i = 1 To il_Edit_column dw_uc.SetTabOrder ( i, 0 ) NEXT modifyrow_no = 0 ELSE modifyrow_no = dw_uc.GetRow() FOR i = 1 To il_Edit_column dw_uc.SetTabOrder ( i, i*10 ) NEXT //使用业务员限制,名称不能修改 IF sys_option_outrep = 1 THEN dw_uc.SetTabOrder('outrepname',0) END IF dw_uc.SetFocus() dw_uc.SelectRow(0,False) dw_uc.ScrollToRow (modifyrow_no) dw_uc.SelectRow(modifyrow_no,True) END IF dw_edit_mode = Not dw_edit_mode WF_FACE_CHANGE() end event type cb_delet from w_publ_edit_choice`cb_delet within w_outrepdef_edit end type event cb_delet::clicked;call super::clicked;IF Not f_power_ind(18) THEN MessageBox('提示','你没有使用权限!', Information!, OK! ) RETURN END IF IF MessageBox ("询问","是否确定要删除当前记录?(选择确定后记录将不可恢复)",Question!,YesNo! ) = 2 THEN RETURN END IF //检查客户资料, 销售发货单,销售订单,如果已经应用,不允许删除 String ls_outrepname Long ll_cnt, ll_row ll_row = dw_uc.GetRow() ls_outrepname = dw_uc.Object.outrepname[ll_row] SELECT count(*) INTO :ll_cnt FROM u_cust Where custype = :ls_outrepname; IF sqlca.SQLCode <> 0 THEN ll_cnt = 0 END IF IF ll_cnt > 0 THEN MessageBox('系统提示','当前业务员已经应用到客户资料中,不能删除') RETURN END IF SELECT count(*) INTO :ll_cnt FROM u_saletask Where assign_emp = :ls_outrepname; IF sqlca.SQLCode <> 0 THEN ll_cnt = 0 END IF IF ll_cnt > 0 THEN MessageBox('系统提示','当前业务员已经应用到销售订单中,不能删除') RETURN END IF SELECT count(*) INTO :ll_cnt FROM u_outware Where outrep = :ls_outrepname and billtype = 1; IF sqlca.SQLCode <> 0 THEN ll_cnt = 0 END IF IF ll_cnt > 0 THEN MessageBox('系统提示','当前业务员已经应用到销售发货单中,不能删除') RETURN END IF dw_uc.SetRedraw (False) dw_uc.DeleteRow (0) dw_uc.TriggerEvent (RowFocusChanged!) IF dw_uc.Update() = -1 THEN ROLLBACK; MessageBox ("错误","删除记录操作失败!",StopSign!,OK!) ELSE COMMIT; END IF dw_uc.SetRedraw (True) end event type cb_choice from w_publ_edit_choice`cb_choice within w_outrepdef_edit boolean visible = false integer y = 500 integer width = 279 end type event cb_choice::clicked;call super::clicked;LONG rOW ROW=dw_uc.getrow() if ROW<=0 then messagebox('提示','请先选择目标行!', Information!, OK! ) return end if INS_RT_STRU.outrepcode=dw_uc.OBJECT.outrepcode[ROW] INS_RT_STRU.outrepname=dw_uc.OBJECT.outrepname[ROW] INS_RT_STRU.outrepdscrp=dw_uc.OBJECT.outrepdscrp[ROW] CLOSE(PARENT) end event type dw_uc from w_publ_edit_choice`dw_uc within w_outrepdef_edit event dwnkey pbm_dwnkey integer y = 280 integer width = 2510 integer height = 1256 string dataobject = "dw_outrep_index" end type event dw_uc::dwnkey;call super::dwnkey;IF Key = KeyEnter! THEN // keybd_event ( 9, 0, 0 , 0 ) // 按下tab keybd_event ( 9, 0, 2, 0 ) // 释放tab RETURN 1 END IF end event type cb_rtr from w_publ_edit_choice`cb_rtr within w_outrepdef_edit end type type cb_help from w_publ_edit_choice`cb_help within w_outrepdef_edit integer x = 837 end type type ln_bar from w_publ_edit_choice`ln_bar within w_outrepdef_edit end type type ln_bar2 from w_publ_edit_choice`ln_bar2 within w_outrepdef_edit end type type r_bar from w_publ_edit_choice`r_bar within w_outrepdef_edit end type type cb_view from uo_imflatbutton within w_outrepdef_edit boolean visible = false integer x = 837 integer width = 151 integer height = 164 integer taborder = 30 boolean bringtotop = true string text = "预览" string normalpicname = "preview.bmp" integer picsize = 16 toolbaralignment pic_align = alignattop! boolean border = false end type event clicked;call super::clicked;S_print_MSG LS_PRMSG LS_PRMSG.obj_dwNAME = 'dw_rp_outrep_index' LS_PRMSG.SHARE_DW = DW_UC LS_PRMSG.TAG_TEXT = parent.title LS_PRMSG.SETUP_FLAG = 0 LS_PRMSG.PAGECH_FLAG = 1 OpenWithParm(w_publ_preview,LS_PRMSG) end event type cbx_inuse from checkbox within w_outrepdef_edit integer x = 14 integer y = 196 integer width = 402 integer height = 60 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 = "只显示有效" boolean checked = true end type event clicked;IF dw_edit_mode THEN RETURN IF THIS.Checked THEN il_inuse = 1 ELSE il_inuse = -1 END IF cb_rtr.TriggerEvent(Clicked!) end event type st_msg from statictext within w_outrepdef_edit integer x = 773 integer y = 196 integer width = 1001 integer height = 60 boolean bringtotop = true integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 255 long backcolor = 134217739 string text = "使用业务员限制,修改不能改名称" boolean focusrectangle = false end type