$PBExportHeader$w_publ_preview_billformatset.srw forward global type w_publ_preview_billformatset from w_publ_base end type type cb_open from uo_imflatbutton within w_publ_preview_billformatset end type type cb_1 from uo_imflatbutton within w_publ_preview_billformatset end type type cb_def from uo_imflatbutton within w_publ_preview_billformatset end type type cb_del from uo_imflatbutton within w_publ_preview_billformatset end type type dw_formatlist from datawindow within w_publ_preview_billformatset end type type sle_name from singlelineedit within w_publ_preview_billformatset end type type st_1 from statictext within w_publ_preview_billformatset end type type gb_1 from groupbox within w_publ_preview_billformatset end type end forward global type w_publ_preview_billformatset from w_publ_base integer width = 1755 integer height = 1156 string title = "单据格式" boolean minbox = false windowtype windowtype = response! cb_open cb_open cb_1 cb_1 cb_def cb_def cb_del cb_del dw_formatlist dw_formatlist sle_name sle_name st_1 st_1 gb_1 gb_1 end type global w_publ_preview_billformatset w_publ_preview_billformatset type variables s_preview_billformatset_tran s_billformat long defpos=0 boolean editmode=false,editname=false end variables forward prototypes public subroutine wf_addformat (dropdownlistbox ddlb, string dwname) public function integer wf_checkname (ref string arg_msg) public subroutine wf_facechange () public subroutine wf_finddef () public function integer wf_readsubdwpos_blob (string dwname, string dname, blob dwpos) public subroutine wf_setmode (datawindow dw, integer mode) end prototypes public subroutine wf_addformat (dropdownlistbox ddlb, string dwname);string formatname int defflag int ls_defpos=0 Declare getbillformat cursor for select dname,default_flag from sys_dwnSyntax where dwname=:dwname ; open getbillformat; Do While sqlca.sqlcode=0 Fetch getbillformat into :formatname,:defflag; if sqlca.sqlcode<>0 then exit; ddlb.additem(formatname) ls_defpos++ if defflag=1 then defpos=ls_defpos end if loop Close getbillformat; end subroutine public function integer wf_checkname (ref string arg_msg);long findrow if trim(dw_formatlist.object.dname[dw_formatlist.getrow()])='' then arg_msg='格式名不能空!' return 0 end if findrow=dw_formatlist.find("dwname='"+trim(dw_formatlist.object.dname[dw_formatlist.getrow()])+"'",1,dw_formatlist.rowcount()) messagebox('',findrow) if findrow>0 then arg_msg='格式名称重复!' return 0 end if return 1 end function public subroutine wf_facechange ();cb_open.enabled= not editmode cb_del.enabled= not editmode cb_def.enabled= not editmode cb_def.enabled= not editmode end subroutine public subroutine wf_finddef ();long findrow,currow if dw_formatlist.rowcount()=1 then dw_formatlist.selectrow(0,false) dw_formatlist.selectrow(1,true) dw_formatlist.SETROW(1) dw_formatlist.ScrollToRow (1) dw_formatlist.object.default_flag[1]=1 return end if findrow=dw_formatlist.find("dname='"+s_billformat.dname+"'",2,dw_formatlist.rowcount()) if findrow=0 then dw_formatlist.selectrow(0,false) dw_formatlist.selectrow(1,true) dw_formatlist.SETROW(1) dw_formatlist.ScrollToRow (1) dw_formatlist.object.default_flag[1]=1 else findrow=dw_formatlist.find("default_flag=1",1,dw_formatlist.rowcount()) if findrow>0 then dw_formatlist.object.default_flag[findrow]=1 currow=findrow else dw_formatlist.object.default_flag[1]=1 currow=1 end if dw_formatlist.selectrow(0,false) dw_formatlist.selectrow(currow,true) dw_formatlist.SETROW(currow) dw_formatlist.ScrollToRow (currow) end if sle_name.text=s_billformat.dname end subroutine public function integer wf_readsubdwpos_blob (string dwname, string dname, blob dwpos);blob subdwpos select subdwSyntaxB into :subdwpos from sys_dwnSyntax where dwname=:dwname and dname=:dname; if sqlca.sqlcode=-1 then Messagebox('系统信息','读取明细格式失败!'+sqlca.sqlerrtext) return 0 end if return 1 end function public subroutine wf_setmode (datawindow dw, integer mode);dw.SetTabOrder('dname',mode*10) //dw.SetTabOrder('default_flag',mode*20) end subroutine on w_publ_preview_billformatset.create int iCurrent call super::create this.cb_open=create cb_open this.cb_1=create cb_1 this.cb_def=create cb_def this.cb_del=create cb_del this.dw_formatlist=create dw_formatlist this.sle_name=create sle_name this.st_1=create st_1 this.gb_1=create gb_1 iCurrent=UpperBound(this.Control) this.Control[iCurrent+1]=this.cb_open this.Control[iCurrent+2]=this.cb_1 this.Control[iCurrent+3]=this.cb_def this.Control[iCurrent+4]=this.cb_del this.Control[iCurrent+5]=this.dw_formatlist this.Control[iCurrent+6]=this.sle_name this.Control[iCurrent+7]=this.st_1 this.Control[iCurrent+8]=this.gb_1 end on on w_publ_preview_billformatset.destroy call super::destroy destroy(this.cb_open) destroy(this.cb_1) destroy(this.cb_def) destroy(this.cb_del) destroy(this.dw_formatlist) destroy(this.sle_name) destroy(this.st_1) destroy(this.gb_1) end on event open;call super::open;Long currow,findrow s_billformat = Message.PowerObjectParm dw_formatlist.SetTransObject(sqlca) dw_formatlist.Retrieve(s_billformat.dwname) currow = dw_formatlist.InsertRow(1) dw_formatlist.Object.dwname[currow] = '标准格式' dw_formatlist.Object.dname[currow] = '标准格式' wf_finddef() sle_name.SetFocus() sle_name.SelectText(1, Len(sle_name.Text)) end event event close;call super::close;closewithreturn(this,s_billformat) end event type cb_func from w_publ_base`cb_func within w_publ_preview_billformatset boolean visible = false integer x = 1207 integer y = 912 integer width = 146 integer height = 92 boolean enabled = false end type type cb_exit from w_publ_base`cb_exit within w_publ_preview_billformatset integer x = 1390 integer y = 912 integer width = 274 integer height = 92 end type type cb_open from uo_imflatbutton within w_publ_preview_billformatset integer x = 23 integer y = 912 integer width = 274 integer height = 92 integer taborder = 50 string text = "打开格式" end type event clicked;call super::clicked;if dw_formatlist.getrow()<=0 then messagebox('系统提示','没有可打开的格式!') return end if s_billformat.dname=dw_formatlist.object.dname[dw_formatlist.getrow()] cb_exit.triggerevent(clicked!) end event type cb_1 from uo_imflatbutton within w_publ_preview_billformatset integer x = 325 integer y = 912 integer width = 274 integer height = 92 integer taborder = 50 string text = "保存格式" end type event clicked;call super::clicked;long findrow,currow,defflag,updaterow string dwname,dname,errmsg if trim(sle_name.text) = '' then messagebox('系统信息','格式名不能为空!') return end if findrow = dw_formatlist.find("dname='"+trim(sle_name.text)+"'",1,dw_formatlist.rowcount()) if findrow = 0 then dwname = s_billformat.dwname dname = sle_name.text defflag = 0 insert into sys_dwnsyntax (dwname,dname,default_flag) values (:dwname,:dname,:defflag); if sqlca.sqlcode = -1 then errmsg = sqlca.sqlerrtext rollback; messagebox('系统提示','保存格式名称出错!'+errmsg) return end if commit; else if dw_formatlist.getrow() = 1 then messagebox('系统信息','不能保存到标准格式!') return end if if messagebox ("全部","是否确定要覆盖当前单式吗?",question!,yesno! ) = 2 then return dwname = dw_formatlist.object.dwname[dw_formatlist.getrow()] dname = dw_formatlist.object.dname[dw_formatlist.getrow()] end if updateblob sys_dwnsyntax set dwsyntaxb = :s_billformat.dwsyntaxb where dwname = :dwname and dname = :dname; if sqlca.sqlcode = -1 then messagebox('系统提示','保存单据格式失败!原因:'+sqlca.sqlerrtext) rollback; return else commit; end if //messagebox('sb',len(s_billformat.subdwsyntaxb)) if len(s_billformat.subdwsyntaxb) > 0 then updateblob sys_dwnsyntax set subdwsyntaxb = :s_billformat.subdwsyntaxb where dwname = :dwname and dname = :dname; if sqlca.sqlcode = -1 then messagebox('系统提示','保存单据格式失败!原因:'+sqlca.sqlerrtext) rollback; return else commit; end if end if messagebox('系统信息','保存格式成功!') dw_formatlist.retrieve(s_billformat.dwname) currow = dw_formatlist.insertrow(1) dw_formatlist.object.dwname[currow] = '标准格式' dw_formatlist.object.dname[currow] = '标准格式' // cb_exit.triggerevent(clicked!) end event type cb_def from uo_imflatbutton within w_publ_preview_billformatset integer x = 910 integer y = 912 integer width = 274 integer height = 92 integer taborder = 50 string text = "设为默认" end type event clicked;call super::clicked;IF dw_formatlist.GetRow() <= 0 THEN MessageBox('系统提示','请选择格式!') END IF Long i,currow,rslt = 1 String dwname,dname dw_formatlist.SetRedraw(FALSE) FOR i = 1 TO dw_formatlist.RowCount() dw_formatlist.Object.default_flag[i] = 0 NEXT dw_formatlist.Object.default_flag[dw_formatlist.GetRow()] = 1 dw_formatlist.SetRedraw(TRUE) IF dw_formatlist.GetRow() = 1 THEN dwname = s_billformat.dwname ELSE dwname = dw_formatlist.Object.dwname[dw_formatlist.GetRow()] END IF dname = dw_formatlist.Object.dname[dw_formatlist.GetRow()] UPDATE sys_dwnSyntax Set default_flag = 0 Where dwname = :dwname; IF sqlca.SQLCode <> 0 THEN MessageBox('系统提示','设置默认值失败'+sqlca.SQLErrText) ROLLBACK; rslt = 0 END IF IF dw_formatlist.GetRow() > 1 THEN UPDATE sys_dwnSyntax Set default_flag = 1 Where dwname = :dwname AND dname = :dname; IF sqlca.SQLCode = -1 THEN MessageBox('系统提示','设置默认值失败'+sqlca.SQLErrText) ROLLBACK; rslt = 0 END IF END IF IF rslt = 1 THEN MessageBox('系统提示','设置默认值成功!') COMMIT; END IF end event type cb_del from uo_imflatbutton within w_publ_preview_billformatset integer x = 594 integer y = 912 integer width = 274 integer height = 92 integer taborder = 50 string text = "删除格式" end type event clicked;call super::clicked;String dwname,dname IF dw_formatlist.GetRow() = 1 OR Trim(sle_name.Text) = '标准格式' THEN MessageBox('系统提示','该格式为标准格式,不能删除!') RETURN END IF If (dw_formatlist.RowCount() = 0) Or (dw_formatlist.GetRow() <= 0) THEN MessageBox('系统提示','没有可删除的格式!') RETURN END IF IF MessageBox ("全部","是否确定要删除当前单式吗?",Question!,YesNo! ) = 2 THEN RETURN dwname = dw_formatlist.Object.dwname[dw_formatlist.GetRow()] dname = dw_formatlist.Object.dname[dw_formatlist.GetRow()] DELETE FROM sys_dwnSyntax Where dwname = :dwname AND dname = :dname; IF sqlca.SQLCode <> 0 THEN MessageBox('系统提示','删除格式失败!') ROLLBACK; RETURN END IF COMMIT; dw_formatlist.DeleteRow(dw_formatlist.GetRow()) MessageBox('系统提示','删除格式成功!') end event type dw_formatlist from datawindow within w_publ_preview_billformatset integer x = 32 integer y = 176 integer width = 1641 integer height = 668 integer taborder = 20 string dataobject = "dw_publ_preview_formatlist" boolean hscrollbar = true boolean vscrollbar = true boolean livescroll = true borderstyle borderstyle = stylelowered! end type event doubleclicked;IF row > 0 THEN cb_open.TriggerEvent(Clicked!) END IF end event event rowfocuschanged;IF editmode THEN RETURN IF this.getrow() <= 0 THEN RETURN THIS.SelectRow(0,FALSE) THIS.SelectRow(this.getrow(),TRUE) dw_formatlist.SetRow(this.getrow()) dw_formatlist.ScrollToRow (this.getrow()) sle_name.Text = dw_formatlist.Object.dname[this.getrow()] end event type sle_name from singlelineedit within w_publ_preview_billformatset integer x = 242 integer y = 68 integer width = 1417 integer height = 84 integer taborder = 10 integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 boolean autohscroll = false borderstyle borderstyle = stylelowered! boolean hideselection = false end type type st_1 from statictext within w_publ_preview_billformatset integer x = 55 integer y = 80 integer width = 174 integer height = 60 integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 long backcolor = 67108864 boolean enabled = false string text = "格式名" boolean focusrectangle = false end type type gb_1 from groupbox within w_publ_preview_billformatset integer width = 1719 integer height = 864 integer taborder = 10 integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 long backcolor = 67108864 string text = "格式设置" end type