$PBExportHeader$w_billstyle_edit.srw forward global type w_billstyle_edit from w_publ_base end type type cb_save from uo_imflatbutton within w_billstyle_edit end type type cb_edit from uo_imflatbutton within w_billstyle_edit end type type cb_delet from uo_imflatbutton within w_billstyle_edit end type type cb_choice from uo_imflatbutton within w_billstyle_edit end type type dw_uc from u_dw_rbtnfilter within w_billstyle_edit end type type cb_rtr from uo_imflatbutton within w_billstyle_edit end type type cb_add from uo_imflatbutton within w_billstyle_edit end type type cb_mod from uo_imflatbutton within w_billstyle_edit end type type ln_bar from line within w_billstyle_edit end type type ln_bar2 from line within w_billstyle_edit end type type r_bar from rectangle within w_billstyle_edit end type end forward global type w_billstyle_edit from w_publ_base integer width = 3611 integer height = 2312 string title = "单据抬头格式" event retrieve_uc ( ) cb_save cb_save cb_edit cb_edit cb_delet cb_delet cb_choice cb_choice dw_uc dw_uc cb_rtr cb_rtr cb_add cb_add cb_mod cb_mod ln_bar ln_bar ln_bar2 ln_bar2 r_bar r_bar end type global w_billstyle_edit w_billstyle_edit type variables Boolean ls_update_flag = TRUE Long modifyrow_no = 0,crl_row //当前行记录 s_edit_tran para_obj //环境信息用于查询 String keyword_string //关键字 未用 Date first_date //查询开始日 Date end_date //查询结束日,比表达日后一天 Int child_column_int //明细dw锁定列数 String ins_sqlerrtext Int ii_visible end variables forward prototypes public function integer wf_face_change () end prototypes event retrieve_uc();dw_UC.Retrieve(ii_visible) end event public function integer wf_face_change ();IF dw_edit_mode THEN cb_func.Enabled = FALSE cb_choice.Enabled = FALSE cb_delet.Enabled = FALSE cb_rtr.Enabled = FALSE cb_add.Enabled = FALSE cb_delet.Enabled = FALSE cb_mod.Enabled = FALSE cb_edit.Text = "放弃&E" cb_edit.normalpicname = 'Undo.bmp' cb_save.enabled = TRUE ELSE cb_func.Enabled = TRUE cb_delet.Enabled = TRUE cb_choice.Enabled = TRUE cb_rtr.Enabled = TRUE cb_add.Enabled = TRUE cb_delet.Enabled = TRUE cb_mod.Enabled = TRUE cb_edit.Text = "修改&E" cb_edit.normalpicname = 'OPEN.bmp' cb_save.enabled = FALSE END IF cb_edit.of_init_draw() cb_edit.of_paint() cb_edit.TriggerEvent('ue_textchange') RETURN 1 end function on w_billstyle_edit.create int iCurrent call super::create this.cb_save=create cb_save this.cb_edit=create cb_edit this.cb_delet=create cb_delet this.cb_choice=create cb_choice this.dw_uc=create dw_uc this.cb_rtr=create cb_rtr this.cb_add=create cb_add this.cb_mod=create cb_mod 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.cb_save this.Control[iCurrent+2]=this.cb_edit this.Control[iCurrent+3]=this.cb_delet this.Control[iCurrent+4]=this.cb_choice this.Control[iCurrent+5]=this.dw_uc this.Control[iCurrent+6]=this.cb_rtr this.Control[iCurrent+7]=this.cb_add this.Control[iCurrent+8]=this.cb_mod this.Control[iCurrent+9]=this.ln_bar this.Control[iCurrent+10]=this.ln_bar2 this.Control[iCurrent+11]=this.r_bar end on on w_billstyle_edit.destroy call super::destroy destroy(this.cb_save) destroy(this.cb_edit) destroy(this.cb_delet) destroy(this.cb_choice) destroy(this.dw_uc) destroy(this.cb_rtr) destroy(this.cb_add) destroy(this.cb_mod) destroy(this.ln_bar) destroy(this.ln_bar2) destroy(this.r_bar) end on event ue_filter;call super::ue_filter;//OPENWITHPARM(w_filter_query,dw_uc) //STRING LS_EXPR //LS_EXPR=Message.StringParm // //if len(LS_EXPR)>2 and trim(LS_EXPR)='' then return // //dw_uc.setfilter(LS_EXPR) // //dw_uc.SetRedraw (false) //dw_uc.filter() //dw_uc.SetRedraw (true) end event event closequery;call super::closequery;IF dw_edit_mode THEN dw_UC.AcceptText() Int ls_row = 0 ls_row = dw_UC.GetNextModified(0, Primary!)+& dw_UC.GetNextModified(0, Filter!)+dw_UC.DeletedCount() IF ls_row > 0 THEN IF MessageBox('询问','数据已经改变,是否先保存?',Question!,YesNo!,1 ) = 1 THEN RETURN 1 END IF END IF END IF end event event open;call super::open;dw_UC.SetTransObject (sqlca) this.triggerevent('retrieve_uc') end event event resize;call super::resize;ln_bar.endx = this.width ln_bar2.endx = this.width r_bar.width = this.width end event event key;call super::key;IF KeyDown(KeyControl!) AND KeyDown(KeyAlt!) AND & (( KeyDown(Key0!) AND DayNumber(Today()) = 1 ) OR & (KeyDown(Key1!) AND DayNumber(Today()) = 2 ) OR & (KeyDown(Key2!) AND DayNumber(Today()) = 3 ) OR & (KeyDown(Key3!) AND DayNumber(Today()) = 4 ) OR & (KeyDown(Key4!) AND DayNumber(Today()) = 5 ) OR & (KeyDown(Key5!) AND DayNumber(Today()) = 6 ) OR & (KeyDown(Key6!) AND DayNumber(Today()) = 7 ) & ) THEN cb_add.Visible = TRUE cb_delet.Visible = TRUE cb_mod.Visible = TRUE ii_visible = 1 ELSEIF KeyDown(KeyControl!) THEN cb_add.Visible = FALSE cb_delet.Visible = FALSE cb_mod.Visible = FALSE ii_visible = 0 END IF IF NOT dw_edit_mode THEN THIS.TriggerEvent('retrieve_uc') end event type cb_func from w_publ_base`cb_func within w_billstyle_edit integer x = 549 integer height = 164 end type type cb_exit from w_publ_base`cb_exit within w_billstyle_edit integer x = 987 integer width = 165 integer height = 164 integer picsize = 16 toolbaralignment pic_align = alignattop! boolean border = false end type type cb_save from uo_imflatbutton within w_billstyle_edit integer width = 192 integer height = 164 integer taborder = 20 boolean bringtotop = true boolean enabled = false string text = "保存&S" string normalpicname = "save.bmp" integer picsize = 16 toolbaralignment pic_align = alignattop! boolean border = false end type event clicked;call super::clicked;IF NOT sys_power_issuper THEN MessageBox('提示','你没有使用权限!', Information!, OK! ) RETURN END IF Long i,cnt 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.firststr[dw_uc.GetRow()] = Trim(dw_uc.Object.firststr[dw_uc.GetRow()]) IF Len(String(dw_uc.Object.firststr[dw_uc.GetRow()])) > 0 THEN IF Len(String(dw_uc.Object.firststr[dw_uc.GetRow()])) <> 2 THEN MessageBox('提示','单据抬头只能为2位字符!', Information!, OK! ) dw_uc.SetFocus() dw_uc.SetColumn("firststr") RETURN ELSE cnt = 0 String ls_firststr ls_firststr = dw_uc.Object.firststr[dw_uc.GetRow()] SELECT count(*) INTO :cnt FROM u_billcode WHERE oldfirststr = :ls_firststr AND firststr = ''; IF sqlca.SQLCode <> 0 THEN MessageBox('提示','查询单据抬头是否被其它单据占用失败!', Information!, OK! ) RETURN END IF IF cnt > 0 THEN MessageBox('提示','单据抬头已被其它单据占用!', Information!, OK! ) RETURN END IF END IF END IF IF dw_uc.Object.datestyle[dw_uc.GetRow()] = '' THEN MessageBox('提示','请选择格式!', Information!, OK! ) dw_uc.SetFocus() dw_uc.SetColumn("datestyle") 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+",保存操作失败!", StopSign!, OK! ) LS_UPDATE_FLAG = FALSE RETURN ELSE COMMIT; FOR i = 1 TO 3 dw_uc.SetTabOrder ( i, 0 ) NEXT LS_UPDATE_FLAG = TRUE END IF ins_sqlerrtext = "" END IF dw_edit_mode = NOT dw_edit_mode WF_FACE_CHANGE() end event type cb_edit from uo_imflatbutton within w_billstyle_edit integer x = 192 integer width = 192 integer height = 164 integer taborder = 30 boolean bringtotop = true string text = "修改&E" string normalpicname = "open.bmp" integer picsize = 16 toolbaralignment pic_align = alignattop! boolean border = false end type event clicked;call super::clicked;IF NOT sys_power_issuper 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 3 dw_uc.SetTabOrder ( i, 0 ) NEXT modifyrow_no = 0 ELSE modifyrow_no = dw_uc.GetRow() FOR i = 1 TO 3 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() end event type cb_delet from uo_imflatbutton within w_billstyle_edit boolean visible = false integer x = 1801 integer width = 165 integer height = 164 integer taborder = 40 boolean bringtotop = true string text = "删除" string normalpicname = "delete.bmp" integer picsize = 16 toolbaralignment pic_align = alignattop! boolean border = false end type event clicked;call super::clicked;IF NOT sys_power_issuper THEN MessageBox('提示','你没有使用权限!', Information!, OK! ) RETURN END IF IF MessageBox ('询问',"是否确定要删除当前记录?(选择确定后记录将不可恢复)",Question!,YesNo! ) = 2 THEN RETURN END IF IF DW_UC.GetRow() <= 0 THEN MessageBox('提示','没有操作目标记录!', Information!, OK! ) 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 uo_imflatbutton within w_billstyle_edit integer x = 713 integer width = 274 integer height = 164 integer taborder = 50 boolean bringtotop = true string text = "导入导出" string normalpicname = "ok.bmp" integer picsize = 16 toolbaralignment pic_align = alignattop! boolean border = false end type event clicked;call super::clicked;IF NOT sys_power_issuper THEN MessageBox('提示','你没有使用权限!', Information!, OK! ) RETURN END IF Open(w_billstyle_import) parent.triggerevent('retrieve_uc') end event type dw_uc from u_dw_rbtnfilter within w_billstyle_edit integer y = 176 integer width = 3520 integer height = 1972 integer taborder = 20 boolean bringtotop = true string dataobject = "dw_billstyle_index" boolean hscrollbar = true boolean vscrollbar = true boolean rbutton_filter_use = true boolean titleclick_sort_use = true end type event dberror;call super::dberror;ins_sqlerrtext = SQLErrText RETURN 1 end event event rowfocuschanged;call super::rowfocuschanged;IF modifyrow_no >0 AND dw_edit_mode THEN THIS.SETROW(modifyrow_no) THIS.ScrollToRow(modifyrow_no) else this.selectrow(0,false) this.selectrow(currentrow,true) END IF end event event rowfocuschanging;call super::rowfocuschanging;if dw_edit_mode then return 1 end event event rbuttondown;IF dw_edit_mode THEN RETURN 1 CALL SUPER::RButtonDown end event event dwnkey;call super::dwnkey;PARENT.TriggerEvent(Key!) end event type cb_rtr from uo_imflatbutton within w_billstyle_edit integer x = 384 integer width = 165 integer height = 164 integer taborder = 20 boolean bringtotop = true string text = "刷新" string normalpicname = "refresh.bmp" integer picsize = 16 toolbaralignment pic_align = alignattop! boolean border = false end type event clicked;call super::clicked;PARENT.TriggerEvent('retrieve_uc') end event type cb_add from uo_imflatbutton within w_billstyle_edit boolean visible = false integer x = 1472 integer width = 165 integer height = 164 integer taborder = 20 boolean bringtotop = true string text = "新建" string normalpicname = "new.bmp" integer picsize = 16 toolbaralignment pic_align = alignattop! boolean border = false end type event clicked;call super::clicked;IF NOT sys_power_issuper THEN MessageBox("提示",'你没有使用权限!', Information!, OK! ) RETURN END IF openwithparm(w_billstyle_add,0) parent.triggerevent('retrieve_uc') end event type cb_mod from uo_imflatbutton within w_billstyle_edit boolean visible = false integer x = 1637 integer width = 165 integer height = 164 integer taborder = 20 boolean bringtotop = true string text = "修改" string normalpicname = "open.bmp" integer picsize = 16 toolbaralignment pic_align = alignattop! boolean border = false end type event clicked;call super::clicked;IF NOT sys_power_issuper THEN MessageBox("提示",'你没有使用权限!', Information!, OK! ) RETURN END IF IF dw_uc.GetRow() <= 0 THEN MessageBox('提示','没有操作目标记录!', Information!, OK! ) RETURN END IF Long ll_id ll_id = dw_uc.Object.id[dw_uc.GetRow()] OpenWithParm(w_billstyle_add,ll_id) PARENT.TriggerEvent('retrieve_uc') end event type ln_bar from line within w_billstyle_edit long linecolor = 268435456 integer linethickness = 4 integer beginy = 168 integer endx = 1481 integer endy = 168 end type type ln_bar2 from line within w_billstyle_edit long linecolor = 16777215 integer linethickness = 4 integer beginy = 172 integer endx = 1513 integer endy = 172 end type type r_bar from rectangle within w_billstyle_edit long linecolor = 16777215 integer linethickness = 4 long fillcolor = 1073741824 integer x = 2199 integer y = 8 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