$PBExportHeader$w_item_cust_spt_edit.srw forward global type w_item_cust_spt_edit from w_publ_edit_choice end type type cb_1 from uo_imflatbutton within w_item_cust_spt_edit end type type dw_1 from u_dw_rbtnfilter within w_item_cust_spt_edit end type type cb_addmx from uo_imflatbutton within w_item_cust_spt_edit end type type cb_delmx from uo_imflatbutton within w_item_cust_spt_edit end type end forward global type w_item_cust_spt_edit from w_publ_edit_choice integer width = 3611 integer height = 2380 string title = "客户及供应商辅助项目" boolean minbox = true windowtype windowtype = popup! event retrieve_mx ( ) cb_1 cb_1 dw_1 dw_1 cb_addmx cb_addmx cb_delmx cb_delmx end type global w_item_cust_spt_edit w_item_cust_spt_edit forward prototypes public subroutine wf_face () end prototypes event retrieve_mx();Long ll_row,ll_itemid ll_row = dw_uc.GetRow() IF ll_row <= 0 THEN dw_1.Reset() ELSE ll_itemid = dw_uc.Object.itemid[ll_row] dw_1.Retrieve(ll_itemid) END IF end event public subroutine wf_face ();cb_addmx.Enabled = NOT dw_edit_mode cb_delmx.Enabled = NOT dw_edit_mode end subroutine on w_item_cust_spt_edit.create int iCurrent call super::create this.cb_1=create cb_1 this.dw_1=create dw_1 this.cb_addmx=create cb_addmx this.cb_delmx=create cb_delmx iCurrent=UpperBound(this.Control) this.Control[iCurrent+1]=this.cb_1 this.Control[iCurrent+2]=this.dw_1 this.Control[iCurrent+3]=this.cb_addmx this.Control[iCurrent+4]=this.cb_delmx end on on w_item_cust_spt_edit.destroy call super::destroy destroy(this.cb_1) destroy(this.dw_1) destroy(this.cb_addmx) destroy(this.cb_delmx) end on event ue_before_open;call super::ue_before_open;dw_1.SetTransObject(sqlca) end event type cb_func from w_publ_edit_choice`cb_func within w_item_cust_spt_edit end type type cb_exit from w_publ_edit_choice`cb_exit within w_item_cust_spt_edit integer x = 1454 end type type cb_add from w_publ_edit_choice`cb_add within w_item_cust_spt_edit end type event cb_add::clicked;call super::clicked;IF Not (f_power_ind(1274) OR f_power_ind(1276)) THEN MessageBox('提示','你没有使用权限!',information!,ok!) RETURN END IF Long ll_newid,i String errmsg 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.itemcode[dw_uc.GetRow()] = Trim(dw_uc.Object.itemcode[dw_uc.GetRow()]) dw_uc.Object.itemname[dw_uc.GetRow()] = Trim(dw_uc.Object.itemname[dw_uc.GetRow()]) IF dw_uc.Object.itemcode[dw_uc.GetRow()] = '' THEN MessageBox('提示','请输入项目编号!',information!,ok!) RETURN END IF IF dw_uc.Object.itemname[dw_uc.GetRow()] = '' THEN MessageBox('提示','请输入项目名称!',information!,ok!) RETURN END IF IF dw_uc.Object.itemid[dw_uc.GetRow()] = 0 THEN ll_newid = f_sys_scidentity(0,"u_item_cust_spt_def","itemid",errmsg,FALSE,sqlca) IF ll_newid <= 0 THEN MessageBox('错误',errmsg,stopsign!,ok!) RETURN ELSE dw_uc.Object.itemid[dw_uc.GetRow()] = ll_newid END IF END IF END IF IF dw_edit_mode THEN 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+",保存操作失败!",stopsign!,OK!) LS_UPDATE_FLAG = FALSE RETURN ELSE COMMIT; FOR i = 1 TO 6 dw_uc.SetTabOrder ( i, 0 ) NEXT LS_UPDATE_FLAG = TRUE 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 6 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() modifyrow_no = li_row END IF dw_edit_mode = NOT dw_edit_mode WF_FACE_CHANGE() wf_face() end event type cb_edit from w_publ_edit_choice`cb_edit within w_item_cust_spt_edit end type event cb_edit::clicked;call super::clicked;IF Not (f_power_ind(1274) OR f_power_ind(1276)) 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 6 dw_uc.SetTabOrder ( i, 0 ) NEXT modifyrow_no = 0 ELSE modifyrow_no = dw_uc.GetRow() FOR i = 1 TO 6 dw_uc.SetTabOrder ( i, i*10 ) NEXT 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() wf_face() end event type cb_delet from w_publ_edit_choice`cb_delet within w_item_cust_spt_edit end type event cb_delet::clicked;call super::clicked;IF Not (f_power_ind(1274) OR f_power_ind(1276)) THEN MessageBox('提示','你没有使用权限!',information!,ok!) RETURN END IF String arg_msg IF DW_UC.GetRow() <= 0 THEN MessageBox('提示','没有操作目标记录!',information!,ok!) RETURN END IF IF MessageBox ('询问',"是否确定要删除当前记录?(选择确定后记录将不可恢复)",Question!,YesNo! ) = 2 THEN RETURN END IF Long LS_LONG,ll_itemid ll_itemid = DW_UC.Object.itemid[DW_UC.GetRow()] LS_LONG = 0 SELECT COUNT(*) INTO :LS_LONG FROM u_item_cust_spt Where itemid = :ll_itemid ; IF SQLCA.SQLCode <> 0 THEN MessageBox ("错误","数据查询操作失败!(请重试!)",stopsign!,OK!) RETURN END IF IF LS_LONG > 0 THEN IF MessageBox ('询问',"该资料已用于客户或供应商资料,删除时会将相关资料删除,是否确定要删除当前记录?(选择确定后记录将不可恢复)",Question!,YesNo! ) = 2 THEN RETURN END IF END IF DELETE FROM u_item_cust_spt Where itemid = :ll_itemid; IF SQLCA.SQLCode <> 0 THEN MessageBox ("错误","删除操作失败(客户供应商)!~n"+SQLCA.SQLErrText,stopsign!,OK!) ROLLBACK; RETURN END IF DELETE FROM u_item_cust_spt_def_mx Where itemid = :ll_itemid; IF SQLCA.SQLCode <> 0 THEN MessageBox ("错误","删除操作失败(项目明细)!~n"+SQLCA.SQLErrText,stopsign!,OK!) ROLLBACK; 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_item_cust_spt_edit boolean visible = false integer x = 1806 integer width = 165 boolean enabled = false end type type dw_uc from w_publ_edit_choice`dw_uc within w_item_cust_spt_edit integer width = 2062 integer height = 2064 string dataobject = "dw_item_cust_spt_def" end type event dw_uc::rowfocuschanged;call super::rowfocuschanged;PARENT.TriggerEvent('retrieve_mx') end event type cb_rtr from w_publ_edit_choice`cb_rtr within w_item_cust_spt_edit end type event cb_rtr::clicked;call super::clicked;PARENT.TriggerEvent('retrieve_mx') end event type cb_help from w_publ_edit_choice`cb_help within w_item_cust_spt_edit integer x = 1303 end type type ln_bar from w_publ_edit_choice`ln_bar within w_item_cust_spt_edit end type type ln_bar2 from w_publ_edit_choice`ln_bar2 within w_item_cust_spt_edit end type type r_bar from w_publ_edit_choice`r_bar within w_item_cust_spt_edit integer x = 2043 end type type cb_1 from uo_imflatbutton within w_item_cust_spt_edit integer x = 837 integer width = 466 integer height = 164 integer taborder = 30 boolean bringtotop = true string text = "加入客户/供应商" string normalpicname = "mx.bmp" integer picsize = 16 toolbaralignment pic_align = alignattop! boolean border = false end type event clicked;call super::clicked;IF Not (f_power_ind(1274) OR f_power_ind(1276)) THEN MessageBox('提示','你没有使用权限!',information!,ok!) RETURN END IF String arg_msg IF DW_UC.GetRow() <= 0 THEN MessageBox('提示','没有操作目标记录!',information!,ok!) RETURN END IF IF MessageBox ('询问',"是否确定要当前记录加入到客户或供应商资料?",Question!,YesNo! ) = 2 THEN RETURN END IF Long LS_LONG,ll_itemid Int li_itemtype ll_itemid = DW_UC.Object.itemid[DW_UC.GetRow()] li_itemtype = DW_UC.Object.itemtype[DW_UC.GetRow()] IF li_itemtype = 0 THEN INSERT INTO u_item_cust_spt (itemid,relid,reltype,dscrp) SELECT :ll_itemid,cusid,0,'' FROM u_cust WHERE inuse = 1 and cusid NOT IN (SELECT relid FROM u_item_cust_spt Where reltype = 0 and itemid = :ll_itemid ); IF SQLCA.SQLCode <> 0 THEN MessageBox ("错误","数据加入客户资料失败!~n"+SQLCA.SQLErrText,stopsign!,OK!) ROLLBACK; RETURN END IF ELSE INSERT INTO u_item_cust_spt (itemid,relid,reltype,dscrp) SELECT :ll_itemid,sptid,1,'' FROM u_spt WHERE inuse = 1 and sptid NOT IN (SELECT relid FROM u_item_cust_spt Where reltype = 1 and itemid = :ll_itemid ); IF SQLCA.SQLCode <> 0 THEN MessageBox ("错误","数据加入供应商资料失败!~n"+SQLCA.SQLErrText,stopsign!,OK!) ROLLBACK; RETURN END IF END IF COMMIT; MessageBox ("提示","操作成功",information!,ok!) end event type dw_1 from u_dw_rbtnfilter within w_item_cust_spt_edit integer x = 2062 integer y = 176 integer width = 1477 integer height = 2064 integer taborder = 20 boolean bringtotop = true string dataobject = "dw_item_cust_spt_def_mx" boolean hscrollbar = true boolean vscrollbar = true end type event rowfocuschanged;call super::rowfocuschanged;IF currentrow <= 0 THEN RETURN THIS.SelectRow(0,FALSE) THIS.SelectRow(currentrow,TRUE) end event type cb_addmx from uo_imflatbutton within w_item_cust_spt_edit integer x = 2075 integer width = 233 integer height = 164 integer taborder = 60 boolean bringtotop = true string text = "增项目" string normalpicname = "mx1.bmp" integer picsize = 16 toolbaralignment pic_align = alignattop! boolean border = false end type event clicked;call super::clicked;IF Not (f_power_ind(1067) OR f_power_ind(1069)) THEN MessageBox('提示','你没有使用权限!',information!,ok!) RETURN END IF IF DW_UC.GetRow() <= 0 THEN MessageBox('提示','没有操作目标记录!',information!,ok!) RETURN END IF Int li_inputtype Long ll_itemid ll_itemid = DW_UC.Object.itemid[DW_UC.GetRow()] li_inputtype = DW_UC.Object.inputtype[DW_UC.GetRow()] IF li_inputtype <> 0 THEN MessageBox('提示','不是选项类型的项目不能增加明细项目!',information!,ok!) RETURN END IF OpenWithParm(w_item_cust_spt_mx_add,ll_itemid) PARENT.TriggerEvent('retrieve_mx') end event type cb_delmx from uo_imflatbutton within w_item_cust_spt_edit integer x = 2309 integer width = 233 integer height = 164 integer taborder = 70 boolean bringtotop = true string text = "删项目" string normalpicname = "mx2.bmp" integer picsize = 16 toolbaralignment pic_align = alignattop! boolean border = false end type event clicked;call super::clicked;IF Not (f_power_ind(1067) OR f_power_ind(1069)) THEN MessageBox('提示','你没有使用权限!',information!,ok!) RETURN END IF String arg_msg IF dw_1.GetRow() <= 0 THEN MessageBox('提示','没有操作目标记录!',information!,ok!) RETURN END IF IF MessageBox ('询问',"是否确定要删除当前记录?(选择确定后记录将不可恢复)",Question!,YesNo! ) = 2 THEN RETURN END IF Long ll_mxid ll_mxid = dw_1.Object.mxid[dw_1.GetRow()] DELETE FROM u_item_cust_spt_def_mx Where mxid = :ll_mxid; IF SQLCA.SQLCode <> 0 THEN MessageBox ("错误","删除操作失败(项目明细)!~n"+SQLCA.SQLErrText,stopsign!,OK!) ROLLBACK; RETURN END IF COMMIT; PARENT.TriggerEvent('retrieve_mx') end event