123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300 |
- $PBExportHeader$w_rpt_condition.srw
- $PBExportComments$组合条件--窗口
- forward
- global type w_rpt_condition from Window
- end type
- type cb_3 from commandbutton within w_rpt_condition
- end type
- type dw1 from datawindow within w_rpt_condition
- end type
- type cb_2 from commandbutton within w_rpt_condition
- end type
- type cb_1 from commandbutton within w_rpt_condition
- end type
- end forward
- global type w_rpt_condition from Window
- int X=654
- int Y=604
- int Width=1920
- int Height=948
- boolean TitleBar=true
- string Title="打印条件"
- long BackColor=12632256
- boolean ControlMenu=true
- WindowType WindowType=response!
- cb_3 cb_3
- dw1 dw1
- cb_2 cb_2
- cb_1 cb_1
- end type
- global w_rpt_condition w_rpt_condition
- type variables
- int i,ii_rows,j
- datawindow id_dw
- string is_return,is_dwobject,is_con
- transaction it_dw=sqlca
- string is_chinese,is_english,is_type,is_dbms
- DataWindowChild idw_child
- str_rpt istr_rpt
- end variables
- forward prototypes
- public subroutine wf_dddw ()
- public subroutine wf_con ()
- end prototypes
- public subroutine wf_dddw ();int li_rows
- choose case left(is_type,5)
- case 'char(','char' //char(n)
- is_english='c'+is_english
- case 'date' //date
- is_english='d'+is_english
- case 'datet' //datetime
- is_english='d'+is_english
- case 'numbe','decim' //number,decimal(n)
- is_english='n'+is_english
- case 'time' //time
- is_english='i'+is_english
- case else
- is_english='n'+is_english
- end choose
- li_rows=idw_child.insertrow(0)
- idw_child.setitem(li_rows,1,is_chinese)
- idw_child.setitem(li_rows,2,is_english)
- end subroutine
- public subroutine wf_con ();if isvalid(w_rpt_preview) then
- //w_rpt_preview.istr_rpt.uservar="打印条件='"+is_con+"',"+w_rpt_preview.istr_rpt.uservar
- end if
- end subroutine
- on w_rpt_condition.create
- this.cb_3=create cb_3
- this.dw1=create dw1
- this.cb_2=create cb_2
- this.cb_1=create cb_1
- this.Control[]={this.cb_3,&
- this.dw1,&
- this.cb_2,&
- this.cb_1}
- end on
- on w_rpt_condition.destroy
- destroy(this.cb_3)
- destroy(this.dw1)
- destroy(this.cb_2)
- destroy(this.cb_1)
- end on
- event open;f_wcenter(this)
- istr_rpt=message.powerobjectparm
- if not isvalid(istr_rpt) then return
- it_dw=istr_rpt.transation
- id_dw=istr_rpt.userdw
- dw1.GetChild('s_field',idw_child)
- is_dwobject=id_dw.dataobject
- if is_dwobject='' then is_dwobject=string(istr_rpt.rid)//id_dw.tag
- ii_rows=long(id_dw.Object.DataWindow.Column.Count)
- for i=1 to ii_rows
- is_english=trim(id_dw.describe("#"+string(i)+'.name'))
- is_chinese=trim(id_dw.describe(is_english+'_t.text'))
- if is_chinese='!' then
- is_chinese=trim(id_dw.describe(is_english+'.tag'))
- end if
- if not(is_chinese='?') then
- is_type=id_dw.describe(is_english+'.coltype')
- wf_dddw()
- end if
- next
- dw1.SetTransobject(it_dw)
- f_myretrieve(dw1,"dwobject>='"+is_dwobject+"_1' and dwobject<='"+is_dwobject+"_6'")
- j=dw1.rowcount()
- for i=j+1 to 6
- dw1.insertrow(0)
- dw1.setitem(i,'dwobject',is_dwobject+'_'+string(i))
- next
- end event
- type cb_3 from commandbutton within w_rpt_condition
- int X=818
- int Y=708
- int Width=247
- int Height=108
- int TabOrder=30
- string Text="全部"
- int TextSize=-9
- int Weight=400
- string FaceName="宋体"
- FontCharSet FontCharSet=GB2312CharSet!
- FontPitch FontPitch=Variable!
- end type
- event clicked;f_mysave(dw1,it_dw,0)
- is_con='全部记录'
- wf_con()
- closewithreturn(parent,'1=1')
- end event
- type dw1 from datawindow within w_rpt_condition
- event ue_auto ( )
- int X=32
- int Y=28
- int Width=1829
- int Height=636
- int TabOrder=10
- string DataObject="dw_rpt_condition"
- BorderStyle BorderStyle=StyleLowered!
- boolean LiveScroll=true
- end type
- event ue_auto;int li_column_no,li_row
- string ls_get,ls_get2
- li_row=getrow()
- li_column_no=getcolumn()
- if li_row>0 then
- choose case li_column_no
- case 2
- ls_get=getitemstring(li_row,li_column_no)
- if ls_get>'' then
- ls_get=getitemstring(li_row,li_column_no - 1)
- if (isnull(ls_get) or ls_get='') then
- setitem(li_row,li_column_no - 1,'and')
- end if
- end if
- case 4
- ls_get=getitemstring(li_row,li_column_no - 2)
- ls_get2=getitemstring(li_row,li_column_no - 1)
- if ls_get>'' and (isnull(ls_get2) or ls_get2='') then
- setitem(li_row,li_column_no - 1,'=')
- end if
- end choose
- end if
- end event
- event clicked;if dwo.name='rowclear' then
- setitem(row,'s_relation','')
- setitem(row,'s_field','')
- setitem(row,'s_compare','')
- setitem(row,'s_value','')
- else
- event ue_auto()
- end if
- end event
- event itemchanged;event ue_auto()
- end event
- event itemfocuschanged;event ue_auto()
- end event
- event doubleclicked;//如果要开放以下通用数据字典代码,需要saledemo.pbl中的w_zkl_fzsr和dw_fzsr,以及report.db中的表fzsr才能运行
- //if row>0 then
- // if this.getcolumnname()='s_value' then
- // if left(this.getitemstring(row,'s_field'),1)='c' then
- // openwithparm(w_zkl_fzsr,this)
- // end if
- // end if
- //end if
- end event
- type cb_2 from commandbutton within w_rpt_condition
- int X=1243
- int Y=708
- int Width=247
- int Height=108
- int TabOrder=40
- string Text="取消"
- int TextSize=-9
- int Weight=400
- string FaceName="宋体"
- FontPitch FontPitch=Variable!
- end type
- event clicked;close(parent)
- end event
- type cb_1 from commandbutton within w_rpt_condition
- int X=402
- int Y=708
- int Width=247
- int Height=108
- int TabOrder=20
- string Text="确认"
- int TextSize=-9
- int Weight=400
- string FaceName="宋体"
- FontPitch FontPitch=Variable!
- end type
- event clicked;is_dbms=left(lower(it_dw.dbms),2)//用于判断数据库,o90为oracle9i
- f_mysave(dw1,it_dw,0)//err,ok
- is_return=''
- string ls1,ls2,ls3,ls4,lstype,ls2c
- for i=1 to 6
- ls1=f_myget(dw1,i,'s_relation')
- ls1=' '+ls1+' '
- ls2=f_myget(dw1,i,'s_field')
- ls3=f_myget(dw1,i,'s_compare')
- ls4=f_myget(dw1,i,'s_value')
- if not (ls2='' or ls3='') then
- ls4=f_replace(ls4,"'",'')
- ls4=f_replace(ls4,'"','')
- if trim(ls3)='like' then ls3=' like '
- if ls3=' like ' then ls4=ls4+'%'
- if is_return='' then ls1=''
- lstype=left(ls2,1)
-
- j=idw_child.find("#2='"+ls2+"'",1,ii_rows)
- if j>0 then
- ls2c=idw_child.getitemstring(j,1)//取中文字段名
- is_con=is_con+ls1+ls2c+ls3+ls4//中文打印条件
- end if
-
- ls2=mid(ls2,2)
- ls2=id_dw.Describe(ls2+".dbName")
- choose case lstype
- case 'c'
- if is_dbms>='o7' and is_dbms<='o9' and ls4='' then//对于oracle7i,8i,9i,''即为null值.
- if ls3='=' then
- is_return=is_return+ls1+ls2+" is null"
- elseif ls3='>' or ls3='>=' or ls3='<' or ls3='<=' then
- is_return=is_return+ls1+ls2+ls3+"' '"
- else
- is_return=is_return+ls1+ls2+ls3+"'"+ls4+"'"
- end if
- else
- is_return=is_return+ls1+ls2+ls3+"'"+ls4+"'"
- end if
- case 'n'
- is_return=is_return+ls1+ls2+ls3+string(dec(ls4))
- case 'd'
- if is_dbms>='o7' and is_dbms<='o9' then
- is_return=is_return+ls1+ls2+ls3+"to_date('"+string(date(ls4),'yyyy-mm-dd')+"','yyyy-mm-dd')"
- else
- is_return=is_return+ls1+ls2+ls3+"'"+string(date(ls4))+"'"
- end if
- case 't'
- is_return=is_return+ls1+ls2+ls3+"'"+string(date(ls4))+"'"
- case 'i'
- is_return=is_return+ls1+ls2+ls3+"'"+string(time(ls4))+"'"
- case else
- is_return=is_return+ls1+ls2+ls3+ls4
- end choose
- end if
- next
- is_con=f_replace(is_con,' like ',' 包含 ')
- is_con=f_replace(is_con,' and ',' 并且 ')
- is_con=f_replace(is_con,' or ',' 或者 ')
- is_con=f_replace(is_con,"'",'')
- wf_con()//中文打印条件赋值到w_rpt_preview
- closewithreturn(parent,is_return)
- end event
|