123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472 |
- $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
|