$PBExportHeader$w_rpt_edit.srw $PBExportComments$对象属性--窗口 forward global type w_rpt_edit from window end type type uo_color from uo_scolor within w_rpt_edit end type type tab_1 from tab within w_rpt_edit end type type tp_1 from userobject within tab_1 end type type cb_6 from commandbutton within tp_1 end type type st_msg from statictext within tp_1 end type type st_2 from statictext within tp_1 end type type tab_2 from tab within tp_1 end type type tabpage_1 from userobject within tab_2 end type type dw_6 from datawindow within tabpage_1 end type type tabpage_1 from userobject within tab_2 dw_6 dw_6 end type type tabpage_2 from userobject within tab_2 end type type dw_10 from datawindow within tabpage_2 end type type dw_9 from datawindow within tabpage_2 end type type tabpage_2 from userobject within tab_2 dw_10 dw_10 dw_9 dw_9 end type type tab_2 from tab within tp_1 tabpage_1 tabpage_1 tabpage_2 tabpage_2 end type type cbx_1 from checkbox within tp_1 end type type st_1 from statictext within tp_1 end type type dw_4 from datawindow within tp_1 end type type cb_5 from commandbutton within tp_1 end type type cb_4 from commandbutton within tp_1 end type type cb_3 from commandbutton within tp_1 end type type cb_right from commandbutton within tp_1 end type type cb_left from commandbutton within tp_1 end type type cb_divide from commandbutton within tp_1 end type type cb_multiplication from commandbutton within tp_1 end type type cb_minus from commandbutton within tp_1 end type type cb_plus from commandbutton within tp_1 end type type mle_1 from multilineedit within tp_1 end type type tp_1 from userobject within tab_1 cb_6 cb_6 st_msg st_msg st_2 st_2 tab_2 tab_2 cbx_1 cbx_1 st_1 st_1 dw_4 dw_4 cb_5 cb_5 cb_4 cb_4 cb_3 cb_3 cb_right cb_right cb_left cb_left cb_divide cb_divide cb_multiplication cb_multiplication cb_minus cb_minus cb_plus cb_plus mle_1 mle_1 end type type tp_2 from userobject within tab_1 end type type dw_5 from datawindow within tp_2 end type type tp_2 from userobject within tab_1 dw_5 dw_5 end type type tp_3 from userobject within tab_1 end type type dw_8 from datawindow within tp_3 end type type dw_7 from datawindow within tp_3 end type type tp_3 from userobject within tab_1 dw_8 dw_8 dw_7 dw_7 end type type tab_1 from tab within w_rpt_edit tp_1 tp_1 tp_2 tp_2 tp_3 tp_3 end type type cb_2 from commandbutton within w_rpt_edit end type type cb_1 from commandbutton within w_rpt_edit end type type cb_20 from commandbutton within w_rpt_edit end type end forward global type w_rpt_edit from window integer y = 204 integer width = 2949 integer height = 1728 boolean titlebar = true string title = "表达式属性窗口" boolean controlmenu = true windowtype windowtype = response! long backcolor = 80269524 uo_color uo_color tab_1 tab_1 cb_2 cb_2 cb_1 cb_1 cb_20 cb_20 end type global w_rpt_edit w_rpt_edit type prototypes end prototypes type variables transaction it_report=sqlca datawindow dw1,dw2,dw3,dw5,dw4,dw7,dw8,dw9 string is_oexp,is_o2exp string is_errors,iso,is_value,is_temp,is_crossmode,is_crossdata,is_data string is_format,is_type,s[10] int ii_rows,i,j,ii_rows4,ii_row str_rpt istr_rpt datastore ids,ids2 DataWindowChild dw_child1,dw_child2,dw_child7,dw_child8,dw_child9 robj io[] datastore idsx int iio w_rpt_main win_parent end variables forward prototypes public function integer wf_verify () public subroutine wf_dw () public subroutine wf_var () public subroutine wf_sxs0 () public function long wf_sxg0 () public function long wf_check () public function long wf_name () public subroutine wf_modify () public subroutine wf_graph () public subroutine wf_graph2 (integer f_type) public subroutine wf_dddw (string s_dw) public subroutine wf_sxs1 (string s1, string s2, integer f_label) public function string wf_sxg1 (string s1) public subroutine wf_dw5m7 (datawindow fdw) public subroutine wf_crosstabr () public function integer wf_crosstabw () public function long wf_crossdata () public subroutine wf_dwchild8 (string fs, datawindowchild fdw) public subroutine wf_read_col (string arg_cname) end prototypes public function integer wf_verify ();is_oexp=tab_1.tp_1.mle_1.text if not (pos('column,compute,band,expr,',is_type)>0 and pos('band1,band2,band3,band4',left(iso,5))=0) then if is_type='text' then wf_sxs1('text',is_oexp,1) elseif is_type='graph' then dw3.accepttext() wf_sxs1('title',dw3.getitemstring(1,'gtitle'),1) wf_sxs1('graphtype',dw3.getitemstring(1,'gtype'),1) wf_sxs1('category',dw3.getitemstring(1,'gfl'),1) wf_sxs1('category.label',dw3.getitemstring(1,'gtfl'),1) wf_sxs1('values',dw3.getitemstring(1,'gvalue'),1) wf_sxs1('values.label',dw3.getitemstring(1,'gtvalue'),1) end if return 0 end if string ls_oexp,ls_o2exp is_o2exp=is_oexp ii_rows=dw1.rowcount() for i=1 to ii_rows //替换函数 ls_oexp=f_replace(dw1.getitemstring(i,'func_china'),')','') ls_o2exp=f_replace(dw1.getitemstring(i,'func_english'),')','') is_o2exp=f_replace(is_o2exp,ls_oexp,ls_o2exp) next ii_rows=ids.rowcount()//ids由大到小排序是为了避免字段包含关系,如日期在前,收费日期在后 for i=1 to ii_rows //替换所有字段,字段中间可以有空格,括号等 ls_oexp=ids.getitemstring(i,'ctag') ls_o2exp=ids.getitemstring(i,'cname') is_o2exp=f_replace(is_o2exp,ls_oexp,ls_o2exp) next is_o2exp=f_replace(is_o2exp,'并且',' and ') is_o2exp=f_replace(is_o2exp,'或者',' or ') if is_type='expr' then return 0 if pos(iso,'band_g_')=1 then//分组表达式 if win_parent.ids.setsort(is_o2exp)=-1 then is_errors="表达式有错,请仔细检查表达式!" goto myerror end if if io[1].otext<>is_oexp then io[1].otext=is_oexp wf_sxs1('text',is_oexp,1) end if if io[1].ofname<>is_o2exp then io[1].ofname=is_o2exp wf_sxs1('group by',is_o2exp,1) end if else //此句作用是??? //if win_parent.ids.rowcount()=0 then win_parent.ids.insertrow(0) is_value=win_parent.ids.Describe("Evaluate('"+f_replace(is_o2exp,"'","~~~'")+"',1)") if pos('?!',is_value)>0 then is_errors="表达式有错,请仔细检查表达式!" goto myerror else if pos(is_o2exp,"'")=0 then i=dw2.find("cname='"+is_o2exp+"'",1,999) else//这四行比i=dw2.find("cname='"+f_replace(is_o2exp,"'","~~~'")+"'",1,999)快 i=0 end if if i>0 then is_type='column' f_wsx(io[1].others,'id',string(i)) wf_sxs1('id',string(i),1) if io[1].otext<>is_oexp then io[1].oname=is_o2exp//为了把column的名字设置成默认的名字,这样出现非法名的机会就大大降低 wf_sxs1('name',is_o2exp,1) end if else is_type='compute' if io[1].oexpression<>is_o2exp then io[1].oexpression=is_o2exp wf_sxs1('expression',is_o2exp,1) end if end if if is_type<>io[1].otype then if is_type='column' then io[1].oexpression='edit' end if io[1].otype=is_type io[1].otext=is_oexp wf_sxs0() else if io[1].otext<>is_oexp then io[1].otext=is_oexp wf_sxs1('tag',is_oexp,1) end if end if end if end if return 0 myerror: MessageBox("出错信息",is_errors+char(13)+char(13)+'翻译成英文表达式为:'+char(13)+char(13)+is_o2exp,stopsign!) return 1 end function public subroutine wf_dw ();if istr_rpt.datasource<>'dw' then return datawindow ldw int li[9] for i=2 to 3 choose case i case 2 ldw=istr_rpt.userdw2 case 3 ldw=istr_rpt.userdw3 end choose if isvalid(ldw) then s[1]=ldw.tag if s[1]='' then s[1]=ldw.dataobject//如果TAG名='',取dataobject名 if s[1]='' then continue li[1]=long(ldw.Object.DataWindow.Column.Count)//字段总数 for j=1 to li[1] s[2]=ldw.describe("#"+string(j)+'.name')//字段英文名 s[3]=ldw.describe(s[2]+'_t.text')//字段中文名 if pos('!?',s[3])>0 then s[3]=ldw.describe(s[2]+'.tag') if s[3]>'' and pos('!?',s[3])=0 then li[2]=dw3.insertrow(0) s[4]='前台取数("'+s[1]+'","'+s[3]+'","",1)' s[5]='f_getfromdw("'+s[1]+'","'+s[2]+'","",1)' dw3.setitem(li[2],'ctag',s[4]) dw3.setitem(li[2],'cname',s[5]) li[3]=ids.find("ctag='"+f_replace(s[3],"'","~~~'")+"'",1,999) if li[3]=0 then//为了翻译前台取数()的字段名 li[4]=ids.insertrow(0) ids.setitem(li[4],'ctag',s[3]) ids.setitem(li[4],'cname',s[2]) end if end if next end if next end subroutine public subroutine wf_var ();dw3.modify("ctag_t.text='自定义变量或函数' ctype.width='0'") int li[9] s[1]=istr_rpt.uservar if pos(s[1],"打印条件=")=0 then s[1]="打印条件='',"+s[1]//打印条件为本报表设计自动添加的一个变量,在w_report_condition中赋值 if s[1]>'' then if right(s[1],1)<>',' then s[1]=s[1]+',' do while true li[1]=pos(s[1],',') if li[1]=0 then exit s[2]=left(s[1],li[1] -1) s[1]=mid(s[1],li[1]+1) li[1]=pos(s[2],'=') if li[1]>0 then li[2]=dw3.insertrow(0) s[2]=left(s[2],li[1] -1) dw3.setitem(li[2],'ctag',"变量('"+s[2]+"')") dw3.setitem(li[2],'cname',"f_var('"+s[2]+"')") end if loop end if end subroutine public subroutine wf_sxs0 ();///////////以下为所有属性新加代码///////////// int k,m,n,l dw5.reset() ii_rows=idsx.rowcount() k=idsx.find("otype='"+is_type+"'",1,ii_rows) if k=0 then return s[9]=io[1].others for i=k to ii_rows if idsx.object.data[i,1]<>is_type then exit m++ s[2]=idsx.object.data[i,3] s[1]=idsx.object.data[i,4] choose case m case 1 s[3]=io[1].otype case 2 s[3]=io[1].oname case 3 s[3]=io[1].oband case 4 s[3]=io[1].ox1 case 5 s[3]=io[1].oy1 case 6 s[3]=io[1].ox2 case 7 s[3]=io[1].oy2 case 8 s[3]=io[1].oborder case 9 s[3]=io[1].otext case 10 s[3]=io[1].ocolor case 11 s[3]=io[1].obcolor case 12 s[3]=io[1].ofname case 13 s[3]=io[1].ofsize case 14 s[3]=io[1].ofweight case 15 s[3]=io[1].ofitalic case 16 s[3]=io[1].ofunderline case 17 s[3]=io[1].oalignment case 18 s[3]=io[1].oexpression end choose s[5]='{'+idsx.object.data[i,3]+'=' // s[5]='{'+string(m)+'='//此行要跟win_parent.wf_sxg0()配合使用,考虑到删除属性表会有遗留问题,所以不能使用 s[6]='}' n=pos(s[9],s[5]) if n>0 then l=pos(s[9],s[6],n) s[8]=mid(s[9],n+len(s[5]),l -n -len(s[5])) else s[8]='' end if if m<19 then s[4]=s[8] else n=pos(s[8],char(9)) if n>0 then s[3]=left(s[8],n -1) s[4]=mid(s[8],n+1) else s[3]=s[8] s[4]='' end if end if dw5.InsertRow(0) dw5.SetItem(m,1,s[1]) dw5.SetItem(m,2,s[2]) if idsx.object.data[i,8]=1 then//保护"表达式"不让输入 if s[4]>'' then s[3]=s[3]+'~t'+s[4] dw5.SetItem(m,3,s[3])//value else dw5.SetItem(m,3,s[3])//value dw5.SetItem(m,4,s[4])//表达式 end if dw5.SetItem(m,5,idsx.object.data[i,7])//保护"value"不让输入 dw5.SetItem(m,6,idsx.object.data[i,8])//保护"表达式"不让输入 dw5.SetItem(m,7,idsx.object.data[i,6])//obz dw5.SetItem(m,8,idsx.object.data[i,2])//osort dw5.SetItem(m,9,long(s[3]))//o01 dw5.SetItem(m,10,s[3])//o02 dw5.SetItem(m,11,s[3])//o03 dw5.SetItem(m,12,s[3])//o04 dw5.SetItem(m,13,s[3])//o05 dw5.SetItem(m,14,s[3])//o06 dw5.SetItem(m,15,s[3])//o07 dw5.SetItem(m,16,s[3])//o08 dw5.SetItem(m,17,s[3])//o09 next if io[1].otype='band' then choose case left(io[1].oname,5) case 'band1','band3','band4' dw5.setfilter("pos(oproperties,'group by')+pos(oproperties,'height.autosize')+pos(oproperties,'newpage')+pos(oproperties,'resetpagecount')=0") case 'band2' dw5.setfilter("pos(oproperties,'group by')+pos(oproperties,'newpage')+pos(oproperties,'resetpagecount')=0") case else//分组 dw5.setfilter("pos(oproperties,'height.autosize')=0") end choose dw5.filter() dw5.sort() end if end subroutine public function long wf_sxg0 ();string ls0,ls1,ls2,ls3 ii_rows=dw5.rowcount() for i=1 to ii_rows ls0=dw5.object.data[i,2] ls1=trim(dw5.object.data[i,3]) ls2=trim(dw5.object.data[i,4]) choose case i case 1 io[1].otype=ls1 case 2 io[1].oname=ls1 case 3 io[1].oband=ls1 case 4 io[1].ox1=ls1 case 5 io[1].oy1=ls1 case 6 io[1].ox2=ls1 case 7 io[1].oy2=ls1 case 8 io[1].oborder=ls1 case 9 io[1].otext=ls1 case 10 io[1].ocolor=ls1 case 11 io[1].obcolor=ls1 case 12 io[1].ofname=ls1 case 13 io[1].ofsize=ls1 case 14 io[1].ofweight=ls1 case 15 io[1].ofitalic=ls1 case 16 io[1].ofunderline=ls1 case 17 io[1].oalignment=ls1 case 18 io[1].oexpression=ls1 case else//>=19 if ls2>'' and pos('?!',ls2)=0 then ls2=ls1+char(9)+ls2 else ls2=ls1 end if end choose if i>3 and pos('?!',ls2)=0 and ls2>'' then ls3=ls3+'{'+ls0+'='+ls2+'}' // ls3=ls3+'{'+string(i)+'='+ls2+'}'//比上行快200ms左右 end if next io[1].others=ls3 win_parent.io[iio]=io[1] if is_type='column' then//读取values属性 s[3]='' if dw8.visible=true then for i=1 to dw8.rowcount() s[1]=trim(dw8.getitemstring(i,1)) s[2]=trim(dw8.getitemstring(i,2)) if s[1]+s[2]>'' then s[3]=s[3]+s[1]+' '+s[2]+'/' next end if s[4]=f_rsx(io[1].others,'id') i=long(s[4]) if i>0 then win_parent.dw3.setitem(i,'cvalues',s[3]) end if end if return 0 end function public function long wf_check ();return 0 end function public function long wf_name ();//if is_type<>'datawindow' then s[3]=wf_sxg1('name') if s[3]='' then messagebox('提示','对象名不能为空!',stopsign!) return 1 end if for i=1 to win_parent.iis if i<>iio and win_parent.io[i].oname=s[3] then messagebox('提示',s[3]+'对象名已经存在!',stopsign!) return 1 end if next //end if return 0 end function public subroutine wf_modify ();s[3]=wf_sxg1('name') if s[3]=iso or is_type='datawindow' then//对象名没改 win_parent.post wf_object(iio,1) win_parent.post wf_setcolor() else//对象名已改 win_parent.dw1.modify('destroy '+iso)//删除原来对象 win_parent.iso=s[3] win_parent.post wf_object(iio,0) win_parent.post wf_setcolor() end if return end subroutine public subroutine wf_graph ();long l[2] l[1]=dw2.rowcount() for i=1 to l[1] is_temp=dw2.getitemstring(i,'ctype') if pos('long,decimal,double,number',left(is_temp,4))>0 then l[2]=dw_child2.insertrow(0) dw_child2.setitem(l[2],'ctag',dw2.getitemstring(i,'ctag')+'合计') is_temp=dw2.getitemstring(i,'cname') dw_child2.setitem(l[2],'cname','sum('+is_temp+' for graph)') end if next dw3.setitem(1,'gtitle',io[1].otext) dw3.setitem(1,'gtype',io[1].ofname) dw3.setitem(1,'gfl',io[1].ofsize) dw3.setitem(1,'gtfl',io[1].ofweight) dw3.setitem(1,'gvalue',io[1].ofitalic) dw3.setitem(1,'gtvalue',io[1].ofunderline) wf_graph2(long(io[1].ofname)) end subroutine public subroutine wf_graph2 (integer f_type);choose case f_type case 1 dw3.modify("t.x='134' t.y='155' t.text='Area'") case 2 dw3.modify("t.x='197' t.y='155' t.text='Bar'") case 7 dw3.modify("t.x='258' t.y='155' t.text='Column'") case 12 dw3.modify("t.x='321' t.y='155' t.text='Line'") case 13 dw3.modify("t.x='384' t.y='155' t.text='Pie'") case 14 dw3.modify("t.x='448' t.y='155' t.text='Scatter'") case 15 dw3.modify("t.x='134' t.y='237' t.text='Area'") case 3 dw3.modify("t.x='197' t.y='237' t.text='Bar'") case 8 dw3.modify("t.x='258' t.y='237' t.text='Column'") case 16 dw3.modify("t.x='321' t.y='237' t.text='Line'") case 17 dw3.modify("t.x='384' t.y='237' t.text='Pie'") case 5 dw3.modify("t.x='134' t.y='316' t.text='Bar'") case 10 dw3.modify("t.x='197' t.y='316' t.text='Column'") case 4 dw3.modify("t.x='258' t.y='316' t.text='Bar'") case 9 dw3.modify("t.x='321' t.y='316' t.text='Column'") case 6 dw3.modify("t.x='384' t.y='316' t.text='Bar'") case 11 dw3.modify("t.x='448' t.y='316' t.text='Column'") case else dw3.modify("t.x='999' t.y='999'") end choose end subroutine public subroutine wf_dddw (string s_dw);ids2.dataobject=s_dw dw_child7.reset() i=long(ids2.describe('DataWindow.Column.Count'))//字段总数 for j=1 to i s[1]=ids2.describe("#"+string(j)+'.name')//字段英文名 s[2]=trim(ids2.describe(s[1]+'_t.text'))//字段中文名 if s[2]='!' then//取不到就取字段的tag名 s[2]=trim(ids2.describe(s[1]+'.tag')) end if if s[2]='?' then s[2]=s[1] s[3]=ids2.describe(s[1]+'.coltype')//字段类型 dw_child7.insertrow(0) dw_child7.setitem(j,1,s[1]) dw_child7.setitem(j,2,s[2]) dw_child7.setitem(j,3,s[3]) next end subroutine public subroutine wf_sxs1 (string s1, string s2, integer f_label);i=dw5.find("oproperties='"+s1+"'",1,999) if i>0 then s[1]=dw5.object.data[i,3] if s[1]='' or (s1='radiobuttons.columns' and s[1]='0') or f_label=1 then dw5.setitem(i,3,s2) dw5.setitem(i,9,long(s2))//o01 dw5.setitem(i,10,s2)//o02 dw5.setitem(i,11,s2)//o03 dw5.setitem(i,12,s2)//o04 dw5.setitem(i,13,s2)//o05 dw5.setitem(i,14,s2)//o06 dw5.setitem(i,15,s2)//o07 dw5.setitem(i,16,s2)//o08 dw5.setitem(i,17,s2)//o09 end if end if end subroutine public function string wf_sxg1 (string s1);i=dw5.find("oproperties='"+s1+"'",1,999) if i>0 then s[1]=dw5.object.data[i,3] else s[1]='' end if return s[1] end function public subroutine wf_dw5m7 (datawindow fdw);s[1] = fdw.Object.datawindow.objects+'~t' DO WHILE TRUE i = Pos(s[1],Char(9)) //tab IF i = 0 THEN EXIT s[2] = Trim(Left(s[1],i -1)) s[1] = Mid(s[1],i+1) i = Long(fdw.Describe(s[2]+'.x')) IF i > 640 THEN fdw.Modify(s[2]+".x='"+fdw.Object.ovalue1.X+"'") fdw.Modify(s[2]+".width='"+fdw.Object.ovalue1.Width+"'") END IF LOOP end subroutine public subroutine wf_crosstabr ();string ls2[],ls3[],ls4[],ls datawindow ldw tab_1.tp_2.visible=false tab_1.tp_1.text='Crosstab(交叉表)属性' int liw,lih liw=tab_1.tp_1.width lih=tab_1.tp_1.height -80 dw1.x=0 dw1.y=0 dw1.width=liw/2 dw1.height=lih*2/3// -80 dw1.dataobject='dw_rpt_column' dw1.modify("ctag_t.text='source data(数据源列名)'") dw2.x=liw/2 dw2.y=lih/3 dw2.width=liw/2 dw2.height=lih/3 dw2.modify("ctag_t.text='columns(各列列名)'") dw3.x=0 dw3.y=lih*2/3 dw3.width=liw/2 dw3.height=lih/3 dw3.modify("ctag_t.text='rows(各行行名)'") dw4.x=liw/2 dw4.y=lih*2/3 dw4.width=liw/2 dw4.height=lih/3 dw4.modify("ctag_t.text='values(列值)'") tab_1.tp_1.st_1.x=liw/2+60 tab_1.tp_1.st_1.y=60 tab_1.tp_1.st_1.width=liw/2 tab_1.tp_1.st_1.height=lih/3 -60 tab_1.tp_1.mle_1.visible=false tab_1.tp_1.st_1.text='1)拖动字段到columns,rows,values中~n~n2)双击进入修改表达式' tab_1.tp_1.cbx_1.text='Rebuild at runtime(运行时重建列,列不固定模式)' if istr_rpt.rsql2>'' then//兼容含参数的情况 f_rpt_gdw(istr_rpt.rsql2,dw1,it_report,'','') elseif istr_rpt.rsqlselect>'' then f_rpt_gdw(istr_rpt.rsqlselect,dw1,it_report,'','') end if j=dw1.rowcount() for i=1 to j dw1.setitem(i,'ckey',dw1.getitemstring(i,'cname')) dw1.setitem(i,'cupdate',dw1.getitemstring(i,'ctag')) next f_atab(ls2[],f_replace(f_rsx(io[1].others,'crosstab.columns'),',','~t')+'~t') f_atab(ls3[],f_replace(f_rsx(io[1].others,'crosstab.rows'),',','~t')+'~t') f_atab(ls4[],f_replace(f_rsx(io[1].others,'crosstab.values'),',','~t')+'~t') j=upperbound(ls2[]) dwobject ldwo for i=1 to j ii_row=dw1.find("cname='"+ls2[i]+"'",1,999) if ii_row=0 then ii_row=dw1.find("right(cname,"+string(len(ls2[i])+1)+")='_"+ls2[i]+"'",1,999) end if if ii_row>0 then dw1.RowsCopy(ii_row,ii_row,primary!,dw2,dw2.RowCount()+1,primary!) end if next j=upperbound(ls3[]) for i=1 to j ii_row=dw1.find("cname='"+ls3[i]+"'",1,999) if ii_row=0 then ii_row=dw1.find("right(cname,"+string(len(ls3[i])+1)+")='_"+ls3[i]+"'",1,999) end if if ii_row>0 then dw1.RowsCopy(ii_row,ii_row,primary!,dw3,dw3.RowCount()+1,primary!) end if next j=upperbound(ls4[]) for i=1 to j ls=ls4[i] ls=trim(f_replace(ls,'sum(','')) ls=trim(f_replace(ls,'count(','')) ls=trim(f_replace(ls,'for crosstab)','')) ii_row=dw1.find("cname='"+ls+"'",1,999) if ii_row=0 then ii_row=dw1.find("right(cname,"+string(len(ls)+1)+")='_"+ls+"'",1,999) end if if ii_row>0 then dw1.RowsCopy(ii_row,ii_row,primary!,dw4,dw4.RowCount()+1,primary!) ii_row=dw4.rowcount() if ii_row>0 then is_temp=dw4.getitemstring(ii_row,'ctype') if pos('decimal,number,long,',left(is_temp,7))>0 then is_temp='求和('+dw4.getitemstring(ii_row,'ctag')+' for crosstab)' dw4.setitem(ii_row,'ctag',is_temp) is_temp='sum('+dw4.getitemstring(ii_row,'cname')+' for crosstab)' dw4.setitem(ii_row,'cname',is_temp) else is_temp='计数('+dw4.getitemstring(ii_row,'ctag')+' for crosstab)' dw4.setitem(ii_row,'ctag',is_temp) is_temp='count('+dw4.getitemstring(ii_row,'cname')+' for crosstab)' dw4.setitem(ii_row,'cname',is_temp) end if end if else//sum(sl*lsj for crosstab)情况 ldw=win_parent.dw3 ii_row=dw3.rowcount()+i if ldw.rowcount()>=ii_row then is_temp=ldw.getitemstring(ii_row,'ctype') if pos(',number,',left(is_temp,7))>0 then ldw.RowsCopy(ii_row,ii_row,primary!,dw4,dw4.RowCount()+1,primary!) ii_row=dw4.rowcount() if ii_row>0 then dw4.setitem(ii_row,'ckey',dw4.getitemstring(ii_row,'cname')) dw4.setitem(ii_row,'cupdate',dw4.getitemstring(ii_row,'ctag')) dw4.setitem(ii_row,'ctag',ls4[i]) dw4.setitem(ii_row,'cname',ls4[i]) end if end if end if end if next is_crossmode=f_rsx(io[1].others,'crosstab.dynamic') if is_crossmode='yes' then tab_1.tp_1.cbx_1.checked=true end if end subroutine public function integer wf_crosstabw ();string ls[] datawindow ldw if tab_1.tp_1.cbx_1.checked=true then is_crossmode='yes' else is_crossmode='no' end if wf_sxs1('crosstab.dynamic',is_crossmode,1) for j=1 to 4 choose case j case 1 ldw=dw1 ls[9]='crosstab.sourcenames' ls[10]='请选择数据源!' case 2 ldw=dw2 ls[9]='crosstab.columns' ls[10]='请选择columns!' if is_crossmode='no' then//对于列静态模式 if wf_crossdata()=1 then ls[10]='对于列静态模式,数据源的表中要有记录!' goto myerror end if end if case 3 ldw=dw3 ls[9]='crosstab.rows' ls[10]='请选择rows!' case 4 ldw=dw4 ls[9]='crosstab.values' ls[10]='请选择values!' end choose ii_rows=ldw.rowcount() if ii_rows=0 then goto myerror for i=1 to ii_rows ls[j]=ls[j]+','+ldw.getitemstring(i,2) next ls[j]=mid(ls[j],2) wf_sxs1(ls[9],ls[j],1) next win_parent.wf_crosstabc() iio=win_parent.iio return 0 myerror: messagebox('提示',ls[10]) return 1 end function public function long wf_crossdata ();string ls_field,ls_sql,ls_get int li_rows li_rows=dw4.rowcount() is_crossdata='' is_data='' ii_rows=dw2.rowcount() for i=2 to ii_rows//暂时只考虑1个columns的情况,因为2个以上的算法比较复杂 dw2.deleterow(2) next if ii_rows>0 then ls_field=dw2.getitemstring(1,'cdbname') ls_sql='select DISTINCT '+ls_field+' from '+left(ls_field,pos(ls_field,'.') -1)+' order by '+ls_field prepare sqlsa from :ls_sql using it_report; describe sqlsa into sqlda; declare my_cursor dynamic cursor for sqlsa; open dynamic my_cursor using descriptor sqlda; do while true fetch my_cursor using descriptor sqlda; if sqlda.numoutputs>0 and sqlca.sqlcode=0 then choose case sqlda.outparmtype[1] case TypeString! if it_report.sqlcode=0 then ls_get=GetDynamicString(sqlda,1) case TypeDate! if it_report.sqlcode=0 then ls_get=string(GetDynamicDate(sqlda,1),'yyyy/mm/dd') case TypeDateTime! if it_report.sqlcode=0 then ls_get=string(GetDynamicDatetime(sqlda,1)) case TypeDecimal!,TypeDouble!,TypeInteger!,TypeLong!,TypeReal! if it_report.sqlcode=0 then ls_get=string(GetDynamicNumber(sqlda,1)) case TypeTime! if it_report.sqlcode=0 then ls_get=string(GetDynamicTime(sqlda,1)) end choose is_data=is_data+'~t'+ls_get is_crossdata=is_crossdata+'~t'+ls_get for i=2 to li_rows is_crossdata=is_crossdata+'~t'+ls_get next else exit end if loop close my_cursor; if is_crossdata='' then return 1 end if is_data=mid(is_data,2) is_crossdata="crosstabdata='"+mid(is_crossdata,2)+"'" wf_sxs1('crosstabdata',is_crossdata,1) end if return 0 end function public subroutine wf_dwchild8 (string fs, datawindowchild fdw);s[4] = LibraryDirectory(fs,DirDataWindow!) //name ~t date/time modified ~t comments ~n fdw.Reset() DO WHILE TRUE j = Pos(s[4],'~t') IF j = 0 THEN EXIT s[1] = Left(s[4],j -1) s[4] = Mid(s[4],j+1) j = Pos(s[4],'~t') s[3] = Left(s[4],j -1) s[4] = Mid(s[4],j+1) j = Pos(s[4],'~n') s[2] = Left(s[4],j -1) s[4] = Mid(s[4],j+1) j = fdw.InsertRow(0) fdw.SetItem(j,1,s[1]) fdw.SetItem(j,2,s[2]) fdw.SetItem(j,3,s[3]) LOOP fdw.SetSort('ctag a') fdw.Sort() FOR j = fdw.RowCount() TO 12 fdw.InsertRow(0) //在PB6.5下,如果dddw的allow edit=true以及下拉行数指定,则需要此三行代码,否则多记录时只显示1行 NEXT end subroutine public subroutine wf_read_col (string arg_cname);/////用于说明字段 Long ll_count IF Pos(arg_cname,"'") = 0 THEN ll_count = dw2.Find("cname='"+arg_cname+"'",1,999) IF ll_count > 0 THEN tab_1.tp_1.st_msg.Text = dw2.Object.ctag[ll_count] END IF END IF return end subroutine on w_rpt_edit.create this.uo_color=create uo_color this.tab_1=create tab_1 this.cb_2=create cb_2 this.cb_1=create cb_1 this.cb_20=create cb_20 this.Control[]={this.uo_color,& this.tab_1,& this.cb_2,& this.cb_1,& this.cb_20} end on on w_rpt_edit.destroy destroy(this.uo_color) destroy(this.tab_1) destroy(this.cb_2) destroy(this.cb_1) destroy(this.cb_20) end on event open;win_parent = this.parentwindow() f_wcenter(THIS) istr_rpt = Message.PowerObjectParm it_report = istr_rpt.transation idsx = win_parent.idsx ids2 = CREATE datastore //wf_dddw()取下拉字段列表用 iio = win_parent.iio io[1] = win_parent.io[iio] iso = io[1].oname is_type = io[1].otype if is_type <> 'column' and is_type <> 'datawindow' and & Pos('libexport,libimport',is_type) = 0 and & Pos('report',is_type) = 0 then tab_1.tp_3.visible = false end if //dw1=tab_1.tp_1.dw_1 //dw2=tab_1.tp_1.dw_2 //dw3=tab_1.tp_1.dw_3 dw1 = tab_1.tp_1.tab_2.tabpage_2.dw_9 dw2 = tab_1.tp_1.tab_2.tabpage_1.dw_6 dw3 = tab_1.tp_1.tab_2.tabpage_2.dw_10 dw4 = tab_1.tp_1.dw_4 //crosstab用到 dw5 = tab_1.tp_2.dw_5 dw7 = tab_1.tp_3.dw_7 dw8 = tab_1.tp_3.dw_8 dw7.GetChild('odddwcolumn',dw_child7) dw7.GetChild('odddwname',dw_child8) dw5.GetChild('odddwname',dw_child9) dw5.ShareData(dw7) IF istr_rpt.tt = 'expr' THEN Y = Y+80 Title = '表达式' tab_1.tp_2.Visible = FALSE tab_1.tp_3.Visible = FALSE is_type = istr_rpt.tt io[1].otext = istr_rpt.t1 IF istr_rpt.t2 = 'expr' THEN tab_1.tp_1.cbx_1.Checked = TRUE END IF ELSE CHOOSE CASE is_type CASE 'line' Title = '线条属性' tab_1.tp_1.Visible = FALSE CASE 'groupbox' Title = '分组框属性' tab_1.tp_1.Visible = FALSE CASE 'ellipse' Title = '椭圆属性' tab_1.tp_1.Visible = FALSE CASE 'roundrectangle' Title = '圆角矩形属性' tab_1.tp_1.Visible = FALSE CASE 'button' Title = '按钮属性' tab_1.tp_1.Visible = FALSE CASE 'bitmap' Title = '位图属性' tab_1.tp_1.Visible = FALSE CASE 'tableblob' Title = 'tableblob属性' tab_1.tp_1.Visible = FALSE CASE 'report' Title = 'report属性' tab_1.tp_1.Visible = FALSE CASE 'datawindow' Title = 'datawindow属性' IF istr_rpt.tt = 'crosstab' THEN wf_crosstabr() ELSE //crosstab tab_1.tp_1.Visible = FALSE END IF CASE 'band' IF Pos(iso,'band_g_') = 1 THEN Title = '分组表达式' ELSE Title = io[1].oband+'属性' tab_1.tp_1.Visible = FALSE tab_1.POST SelectTab(2) END IF CASE 'text' Title = '文本属性' tab_1.tp_1.Text = '文本' dw1.Visible = FALSE dw3.Visible = FALSE tab_1.tp_1.mle_1.Height = tab_1.tp_1.mle_1.Height+100 CASE 'graph' Title = '统计图属性' tab_1.tp_1.Text = '统计图属性' dw3.X = 0 dw3.Y = 0 dw3.Width = tab_1.tp_1.Width dw3.Height = tab_1.tp_1.Height dw3.HSplitScroll = FALSE dw3.HScrollBar = FALSE dw3.Border = FALSE dw3.DataObject = 'dw_rpt_graph' dw3.InsertRow(0) CASE 'libexport','libimport' IF is_type = 'libexport' THEN Title = '引出的数据窗口名' ELSE Title = '引入的数据窗口名' END IF tab_1.tp_3.Text = Title tab_1.tp_1.Visible = FALSE tab_1.tp_2.Visible = FALSE tab_1.POST SelectTab(3) RETURN END CHOOSE END IF IF Pos('column,compute,',is_type) = 0 THEN tab_1.tp_3.Visible = FALSE END IF IF Pos('column,compute,band,text,graph,expr,',is_type) > 0 THEN is_oexp = io[1].otext tab_1.tp_1.mle_1.Text = is_oexp tab_1.tp_1.mle_1.SelectText(1,Len(tab_1.tp_1.mle_1.text)) tab_1.tp_1.mle_1.SetFocus() IF istr_rpt.t2 = 'crossvalue' THEN f_rpt_gdw(istr_rpt.rsqlselect,dw2,it_report,'','') ELSE win_parent.dw3.RowsCopy(1,win_parent.dw3.RowCount(),Primary!,dw2,1,Primary!) END IF IF istr_rpt.Text = '0' AND Pos('column,compute,band,',is_type) > 0 THEN //不进行翻译 CHOOSE CASE is_type CASE 'column' i = Long(f_rsx(io[1].others,'id')) IF i > 0 THEN is_oexp = f_myget(dw2,i,'cname') CASE 'compute' is_oexp = io[1].oexpression CASE 'band' is_oexp = io[1].ofsize END CHOOSE tab_1.tp_1.mle_1.Text = is_oexp ii_rows = dw2.RowCount() FOR i = 1 TO ii_rows dw2.SetItem(i,1,dw2.GetItemString(i,2)) NEXT END IF IF Pos('graph',is_type) > 0 THEN dw3.GetChild('gfl',dw_child1) dw3.GetChild('gvalue',dw_child2) dw2.ShareData(dw_child1) wf_graph() ELSE wf_var() END IF ids = CREATE datastore ids.DataObject = dw2.DataObject dw2.RowsCopy(1,dw2.RowCount(),Primary!,ids,1,Primary!) IF Pos('graph',is_type) = 0 THEN wf_dw() END IF ids.SetSort("len(ctag) D") //中文名长度按降序索引 ids.Sort() dw2.ScrollToRow(1) dw3.ScrollToRow(1) dw2.SetSort("ctag D") dw2.Sort() ELSEIF Pos('datawindow',is_type) > 0 THEN IF istr_rpt.tt <> 'crosstab' THEN tab_1.POST SelectTab(2) END IF ELSE tab_1.POST SelectTab(2) END IF wf_sxs0() IF Pos(',datawindow,expr,',is_type) = 0 THEN Title = Title+'(对象名: '+iso+')' IF is_type = 'column' THEN tab_1.EVENT SelectionChanging(1,3) END IF wf_read_col(is_oexp) RETURN f_getfromdw('','','',1) //为了编译后不会丢失此函数 f_getfromtable('','','',1) f_convert(0) f_var('') end event event closequery;destroy ids destroy ids2 end event type uo_color from uo_scolor within w_rpt_edit boolean visible = false integer x = 1925 integer y = 324 integer taborder = 40 end type event ue_close;call super::ue_close;int li_row li_row=dw5.getrow() if li_row>0 then dw5.setitem(li_row,'ovalue1',is_color) end if end event type tab_1 from tab within w_rpt_edit event create ( ) event destroy ( ) integer width = 2944 integer height = 1516 integer taborder = 10 integer textsize = -9 integer weight = 400 fontpitch fontpitch = variable! string facename = "宋体" long backcolor = 80269524 boolean fixedwidth = true alignment alignment = center! integer selectedtab = 1 tp_1 tp_1 tp_2 tp_2 tp_3 tp_3 end type on tab_1.create this.tp_1=create tp_1 this.tp_2=create tp_2 this.tp_3=create tp_3 this.Control[]={this.tp_1,& this.tp_2,& this.tp_3} end on on tab_1.destroy destroy(this.tp_1) destroy(this.tp_2) destroy(this.tp_3) end on event selectionchanging;IF newindex > 1 THEN //if isvalid(dw5) then dw5.SetRedraw(FALSE) dw5.SetFilter('') //为了保证能找到Tag dw5.Filter() wf_verify() //主要是为了设置COLUMN的默认名字 dw5.SetRedraw(TRUE) //end if END IF dwobject ldwo IF is_type = 'column' THEN //为了设置EDIT.TYPE CHOOSE CASE newindex CASE 2 i = dw5.Find("#2='edit.style'",1,999) IF i > 0 THEN dw5.EVENT ItemChanged(i,ldwo,dw5.Object.Data[i,3]) CASE 3 dw5.SetRedraw(FALSE) dw5.SetFilter('') dw5.Filter() i = dw7.Find("#2='edit.style'",1,999) IF i > 0 THEN dw7.EVENT ItemChanged(i,ldwo,dw7.Object.Data[i,3]) END CHOOSE ELSEIF is_type = 'datawindow' THEN CHOOSE CASE newindex CASE 2 i = dw5.Find("#2='processing'",1,999) IF i > 0 THEN dw5.EVENT ItemChanged(i,ldwo,dw5.Object.Data[i,3]) CASE 1 IF oldindex > 1 THEN i = dw5.Find("#2='processing'",1,999) IF i > 0 THEN IF dw5.GetItemString(i,3) <> '4' THEN MessageBox('提示','Crosstab风格才有此设置') RETURN 1 END IF END IF END IF END CHOOSE ELSEIF Pos('libexport,libimport',is_type) > 0 THEN IF dw7.RowCount() = 0 THEN dw7.Modify("datawindow.header.height='0'") dw8.Visible = FALSE dw5.InsertRow(0) dw5.InsertRow(0) s[1] = 'ljerp1_printbill_cust.pbd' dw5.SetItem(1,3,s[1]) dw5.SetItem(1,1,'选择PBL或PBD文件名') dw5.SetItem(1,5,1) dw5.SetItem(1,6,1) dw5.SetItem(1,'osort',1) dw5.SetItem(2,2,'dataobject') dw5.SetItem(2,1,'选择或输入数据窗口名') dw5.SetItem(2,6,1) dw5.SetItem(2,'osort',2) wf_dwchild8(s[1],dw_child8) dw7.ScrollToRow(2) // dw7.width = 2300 // dw7.Modify("odddwname.width=230") // // IF is_type = 'libexport' THEN // datawindow ldw // ldw = w_bill_rpt_def.dw_report // IF IsValid(ldw) THEN // i = ldw.GetRow() // IF i > 0 THEN // s[1] = ldw.GetItemString(i,'rpname') // dw5.SetItem(2,3,s[1]) // END IF // END IF // END IF END IF ELSEIF Pos('report',is_type) > 0 THEN IF dw_child9.RowCount() = 0 THEN wf_dwchild8('ljerp1_printbill_cust.pbd',dw_child9) END IF ELSE IF newindex = 3 THEN MessageBox('提示','column才有此设置') RETURN 1 END IF END IF end event type tp_1 from userobject within tab_1 integer x = 18 integer y = 96 integer width = 2907 integer height = 1404 long backcolor = 80269524 string text = "表达式" long tabtextcolor = 33554432 long tabbackcolor = 80269524 long picturemaskcolor = 536870912 cb_6 cb_6 st_msg st_msg st_2 st_2 tab_2 tab_2 cbx_1 cbx_1 st_1 st_1 dw_4 dw_4 cb_5 cb_5 cb_4 cb_4 cb_3 cb_3 cb_right cb_right cb_left cb_left cb_divide cb_divide cb_multiplication cb_multiplication cb_minus cb_minus cb_plus cb_plus mle_1 mle_1 end type on tp_1.create this.cb_6=create cb_6 this.st_msg=create st_msg this.st_2=create st_2 this.tab_2=create tab_2 this.cbx_1=create cbx_1 this.st_1=create st_1 this.dw_4=create dw_4 this.cb_5=create cb_5 this.cb_4=create cb_4 this.cb_3=create cb_3 this.cb_right=create cb_right this.cb_left=create cb_left this.cb_divide=create cb_divide this.cb_multiplication=create cb_multiplication this.cb_minus=create cb_minus this.cb_plus=create cb_plus this.mle_1=create mle_1 this.Control[]={this.cb_6,& this.st_msg,& this.st_2,& this.tab_2,& this.cbx_1,& this.st_1,& this.dw_4,& this.cb_5,& this.cb_4,& this.cb_3,& this.cb_right,& this.cb_left,& this.cb_divide,& this.cb_multiplication,& this.cb_minus,& this.cb_plus,& this.mle_1} end on on tp_1.destroy destroy(this.cb_6) destroy(this.st_msg) destroy(this.st_2) destroy(this.tab_2) destroy(this.cbx_1) destroy(this.st_1) destroy(this.dw_4) destroy(this.cb_5) destroy(this.cb_4) destroy(this.cb_3) destroy(this.cb_right) destroy(this.cb_left) destroy(this.cb_divide) destroy(this.cb_multiplication) destroy(this.cb_minus) destroy(this.cb_plus) destroy(this.mle_1) end on type cb_6 from commandbutton within tp_1 integer x = 1189 integer y = 288 integer width = 128 integer height = 76 integer taborder = 100 integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" string text = "全选" end type event clicked;tab_1.tp_1.mle_1.SetFocus() tab_1.tp_1.mle_1.SelectText(1,Len(tab_1.tp_1.mle_1.text)) end event type st_msg from statictext within tp_1 integer x = 1847 integer y = 304 integer width = 1051 integer height = 48 integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 255 long backcolor = 67108864 boolean focusrectangle = false end type type st_2 from statictext within tp_1 integer x = 1600 integer y = 304 integer width = 270 integer height = 48 integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 255 long backcolor = 67108864 string text = "字段说明:" boolean focusrectangle = false end type type tab_2 from tab within tp_1 integer y = 372 integer width = 2898 integer height = 948 integer taborder = 50 integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long backcolor = 80269524 boolean raggedright = true boolean focusonbuttondown = true integer selectedtab = 1 tabpage_1 tabpage_1 tabpage_2 tabpage_2 end type on tab_2.create this.tabpage_1=create tabpage_1 this.tabpage_2=create tabpage_2 this.Control[]={this.tabpage_1,& this.tabpage_2} end on on tab_2.destroy destroy(this.tabpage_1) destroy(this.tabpage_2) end on type tabpage_1 from userobject within tab_2 integer x = 18 integer y = 96 integer width = 2862 integer height = 836 long backcolor = 80269524 string text = "字段" long tabtextcolor = 33554432 long tabbackcolor = 80269524 long picturemaskcolor = 536870912 dw_6 dw_6 end type on tabpage_1.create this.dw_6=create dw_6 this.Control[]={this.dw_6} end on on tabpage_1.destroy destroy(this.dw_6) end on type dw_6 from datawindow within tabpage_1 integer width = 2853 integer height = 840 integer taborder = 11 string dataobject = "dw_rpt_column" boolean hscrollbar = true boolean vscrollbar = true boolean livescroll = true borderstyle borderstyle = stylelowered! end type event clicked;IF row = 0 THEN RETURN IF Pos('text,column,compute,band,expr,',is_type) > 0 THEN IF tab_1.tp_1.cbx_1.Checked = TRUE THEN is_temp = 'cname' ELSE is_temp = 'ctag' END IF tab_1.tp_1.mle_1.ReplaceText(GetItemString(row,is_temp)) tab_1.tp_1.mle_1.SetFocus() tab_1.tp_1.mle_1.SelectText(pos(tab_1.tp_1.mle_1.text,GetItemString(row,is_temp)),Len(GetItemString(row,is_temp))) ELSEIF Pos('datawindow',is_type) > 0 THEN SelectRow(0,FALSE) SelectRow(row,TRUE) Drag(Begin!) END IF wf_read_col(GetItemString(row,is_temp)) end event event dragdrop;if pos('datawindow',is_type)>0 then DragObject ldo DataWindow ldw ldo=DraggedObject() if TypeOf(ldo)=DataWindow! then ldw=ldo if ldw.classname()='dw_1' then dw1.RowsCopy(dw1.getrow(),dw1.getrow(),primary!,this,this.RowCount()+1,primary!) end if end if end if end event event rowfocuschanged;if pos('text,column,compute,band,expr,',is_type)>0 then if currentrow>0 then this.SelectRow(0,False) this.SelectRow(currentrow,true) end if end if end event type tabpage_2 from userobject within tab_2 integer x = 18 integer y = 96 integer width = 2862 integer height = 836 long backcolor = 80269524 string text = "函数" long tabtextcolor = 33554432 long tabbackcolor = 80269524 long picturemaskcolor = 536870912 dw_10 dw_10 dw_9 dw_9 end type on tabpage_2.create this.dw_10=create dw_10 this.dw_9=create dw_9 this.Control[]={this.dw_10,& this.dw_9} end on on tabpage_2.destroy destroy(this.dw_10) destroy(this.dw_9) end on type dw_10 from datawindow within tabpage_2 integer x = 896 integer width = 1966 integer height = 840 integer taborder = 11 string title = "none" string dataobject = "dw_rpt_column" boolean hscrollbar = true boolean vscrollbar = true boolean livescroll = true borderstyle borderstyle = stylelowered! end type event clicked;if row=0 then return if pos('text,column,compute,band,expr,',is_type)>0 then if tab_1.tp_1.cbx_1.checked=true then is_temp='cname' else is_temp='ctag' end if tab_1.tp_1.mle_1.replacetext(getitemstring(row,is_temp)) tab_1.tp_1.mle_1.setfocus() elseif pos('datawindow',is_type)>0 then SelectRow(0,False) SelectRow(row,true) drag(begin!) else if dwo.name='ograph' then i=0 if xpos>=124 and xpos<=187 and ypos>=115 and ypos<=174 then//2D i=1 elseif xpos>=187 and xpos<=248 and ypos>=115 and ypos<=174 then i=2 elseif xpos>=248 and xpos<=311 and ypos>=115 and ypos<=174 then i=7 elseif xpos>=311 and xpos<=374 and ypos>=115 and ypos<=174 then i=12 elseif xpos>=374 and xpos<=435 and ypos>=115 and ypos<=174 then i=13 elseif xpos>=435 and xpos<=498 and ypos>=115 and ypos<=174 then i=14 elseif xpos>=124 and xpos<=187 and ypos>=196 and ypos<=255 then//3D i=15 elseif xpos>=187 and xpos<=248 and ypos>=196 and ypos<=255 then i=3 elseif xpos>=248 and xpos<=311 and ypos>=196 and ypos<=255 then i=8 elseif xpos>=311 and xpos<=374 and ypos>=196 and ypos<=255 then i=16 elseif xpos>=374 and xpos<=435 and ypos>=196 and ypos<=255 then i=17 elseif xpos>=124 and xpos<=187 and ypos>=280 and ypos<=339 then//stacked i=5 elseif xpos>=187 and xpos<=248 and ypos>=280 and ypos<=339 then i=10 elseif xpos>=248 and xpos<=311 and ypos>=280 and ypos<=339 then//solid i=4 elseif xpos>=311 and xpos<=374 and ypos>=280 and ypos<=339 then i=9 elseif xpos>=374 and xpos<=435 and ypos>=280 and ypos<=339 then//stacked/solid i=6 elseif xpos>=435 and xpos<=498 and ypos>=280 and ypos<=339 then i=11 end if wf_graph2(i) if i>0 then//统计图类型 setitem(row,'gtype',string(i)) end if end if end if end event event dragdrop;if pos('datawindow',is_type)>0 then DragObject ldo DataWindow ldw ldo=DraggedObject() if TypeOf(ldo)=DataWindow! then ldw=ldo if ldw.classname()='dw_1' then dw1.RowsCopy(dw1.getrow(),dw1.getrow(),primary!,this,this.RowCount()+1,primary!) end if end if end if end event event itemchanged;if row>0 and pos('graph',is_type)>0 then choose case getcolumn() case 2 i=dw_child1.getrow() if i>0 then setitem(row,'gtfl',dw_child1.getitemstring(i,'ctag')) end if case 4 i=dw_child2.getrow() if i>0 then setitem(row,'gtvalue',dw_child2.getitemstring(i,'ctag')) end if end choose end if end event event rowfocuschanged;if pos('text,column,compute,band,expr,',is_type)>0 then if currentrow>0 and pos('graph',is_type)=0 then this.SelectRow(0,False) this.SelectRow(currentrow,true) end if end if end event type dw_9 from datawindow within tabpage_2 integer width = 891 integer height = 840 integer taborder = 11 string title = "none" string dataobject = "dw_rpt_function" boolean hscrollbar = true boolean vscrollbar = true boolean livescroll = true borderstyle borderstyle = stylelowered! end type event clicked;if row=0 then return if pos('text,column,compute,band,expr,',is_type)>0 then if tab_1.tp_1.cbx_1.checked=true then is_temp='func_english' else is_temp='func_china' end if tab_1.tp_1.mle_1.replacetext(getitemstring(row,is_temp)) tab_1.tp_1.mle_1.SelectText(len(tab_1.tp_1.mle_1.Text),0) tab_1.tp_1.mle_1.setfocus() elseif pos('datawindow',is_type)>0 then SelectRow(0,False) SelectRow(row,true) drag(begin!) end if end event event dragdrop;if pos('datawindow',is_type)>0 then DragObject ldo DataWindow ldw ldo=DraggedObject() if TypeOf(ldo)=DataWindow! then ldw=ldo if pos('dw_2,dw_3,dw_4',ldw.classname())>0 then i=ldw.getrow() if i>0 then ldw.deleterow(i) end if end if end if end event event rowfocuschanged;if pos('text,column,compute,band,expr,',is_type)>0 then if currentrow>0 then SelectRow(0,False) SelectRow(currentrow,true) end if end if end event type cbx_1 from checkbox within tp_1 integer y = 1332 integer width = 1362 integer height = 76 integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 long backcolor = 67108864 string text = "取英文名称" boolean checked = true end type type st_1 from statictext within tp_1 integer x = 1563 integer y = 1436 integer width = 247 integer height = 76 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 = "st_1" boolean focusrectangle = false end type type dw_4 from datawindow within tp_1 integer x = 1938 integer y = 1420 integer width = 494 integer height = 96 string dragicon = "Warning!" string dataobject = "dw_rpt_column" boolean hscrollbar = true boolean vscrollbar = true boolean hsplitscroll = true boolean livescroll = true borderstyle borderstyle = stylelowered! end type event clicked;if row=0 then return if pos('datawindow',is_type)>0 then SelectRow(0,False) SelectRow(row,true) drag(begin!) end if end event event dragdrop;if pos('datawindow',is_type)>0 then DragObject ldo DataWindow ldw ldo=DraggedObject() if TypeOf(ldo)=DataWindow! then ldw=ldo if ldw.classname()='dw_1' then dw1.RowsCopy(dw1.getrow(),dw1.getrow(),primary!,this,this.RowCount()+1,primary!) i=this.rowcount() if i>0 then is_temp=this.getitemstring(i,'ctype') if pos('decimal,number,long,',left(is_temp,7))>0 then is_temp='求和('+this.getitemstring(i,'ctag')+' for crosstab)' this.setitem(i,'ctag',is_temp) is_temp='sum('+this.getitemstring(i,'cname')+' for crosstab)' this.setitem(i,'cname',is_temp) else is_temp='计数('+this.getitemstring(i,'ctag')+' for crosstab)' this.setitem(i,'ctag',is_temp) is_temp='count('+this.getitemstring(i,'cname')+' for crosstab)' this.setitem(i,'cname',is_temp) end if end if end if end if end if end event event doubleclicked;if row=0 then return str_rpt lstr lstr=istr_rpt lstr.tt='expr' lstr.t1=f_myget(this,row,'ctag') lstr.t2='crossvalue' w_rpt_edit w_temp openwithparm(w_temp,lstr) lstr=message.powerobjectparm if isvalid(lstr) then setitem(row,'ctag',lstr.t2)//t1 setitem(row,'cname',lstr.t2) setitem(row,'cupdate',lstr.t2)//改为t1时,双击字段后中英翻译有问题. end if end event type cb_5 from commandbutton within tp_1 integer x = 1038 integer y = 288 integer width = 128 integer height = 76 integer taborder = 80 integer textsize = -9 integer weight = 400 fontpitch fontpitch = variable! string facename = "宋体" string text = "或者" end type event clicked;if cbx_1.checked=true then is_temp=' or ' else is_temp=' 或者 ' end if mle_1.replacetext(is_temp) mle_1.setfocus() end event type cb_4 from commandbutton within tp_1 integer x = 891 integer y = 288 integer width = 128 integer height = 76 integer taborder = 50 integer textsize = -9 integer weight = 400 fontpitch fontpitch = variable! string facename = "宋体" string text = "并且" end type event clicked;if cbx_1.checked=true then is_temp=' and ' else is_temp=' 并且 ' end if mle_1.replacetext(is_temp) mle_1.setfocus() end event type cb_3 from commandbutton within tp_1 integer x = 1339 integer y = 288 integer width = 224 integer height = 76 integer taborder = 90 integer textsize = -9 integer weight = 400 fontpitch fontpitch = variable! string facename = "宋体" string text = "校验(&V)" end type event clicked;is_oexp = tab_1.tp_1.mle_1.Text IF wf_verify() = 0 THEN MessageBox("提示",'表达式检查正确!'+Char(13)+Char(13)+'翻译成英文表达式为:'+Char(13)+Char(13)+is_o2exp) END IF end event type cb_right from commandbutton within tp_1 integer x = 745 integer y = 288 integer width = 128 integer height = 76 integer taborder = 120 integer textsize = -9 integer weight = 400 fontpitch fontpitch = variable! string facename = "宋体" string text = ")" end type event clicked;mle_1.replacetext(')') mle_1.setfocus() end event type cb_left from commandbutton within tp_1 integer x = 599 integer y = 288 integer width = 128 integer height = 76 integer taborder = 130 integer textsize = -9 integer weight = 400 fontpitch fontpitch = variable! string facename = "宋体" string text = "(" end type event clicked;mle_1.replacetext('(') mle_1.setfocus() end event type cb_divide from commandbutton within tp_1 integer x = 453 integer y = 288 integer width = 128 integer height = 76 integer taborder = 110 integer textsize = -9 integer weight = 400 fontpitch fontpitch = variable! string facename = "宋体" string text = "/" end type event clicked;mle_1.replacetext('/') mle_1.setfocus() end event type cb_multiplication from commandbutton within tp_1 integer x = 302 integer y = 288 integer width = 128 integer height = 76 integer taborder = 100 integer textsize = -9 integer weight = 400 fontpitch fontpitch = variable! string facename = "宋体" string text = "*" end type event clicked;mle_1.replacetext('*') mle_1.setfocus() end event type cb_minus from commandbutton within tp_1 integer x = 155 integer y = 288 integer width = 128 integer height = 76 integer taborder = 70 integer textsize = -9 integer weight = 400 fontpitch fontpitch = variable! string facename = "宋体" string text = "-" end type event clicked;mle_1.replacetext('-') mle_1.setfocus() end event type cb_plus from commandbutton within tp_1 integer x = 9 integer y = 288 integer width = 128 integer height = 76 integer taborder = 30 integer textsize = -9 integer weight = 400 fontpitch fontpitch = variable! string facename = "宋体" string text = "+" end type event clicked;mle_1.replacetext('+') mle_1.setfocus() end event type mle_1 from multilineedit within tp_1 integer y = 4 integer width = 2898 integer height = 268 integer taborder = 10 boolean bringtotop = true integer textsize = -9 integer weight = 400 fontpitch fontpitch = variable! string facename = "宋体" long backcolor = 16777215 boolean vscrollbar = true boolean autovscroll = true integer limit = 255 borderstyle borderstyle = stylelowered! end type type tp_2 from userobject within tab_1 integer x = 18 integer y = 96 integer width = 2907 integer height = 1404 long backcolor = 80269524 string text = "常用属性" long tabtextcolor = 33554432 long tabbackcolor = 80269524 long picturemaskcolor = 536870912 dw_5 dw_5 end type on tp_2.create this.dw_5=create dw_5 this.Control[]={this.dw_5} end on on tp_2.destroy destroy(this.dw_5) end on type dw_5 from datawindow within tp_2 integer y = 8 integer width = 2907 integer height = 1384 integer taborder = 1 string dataobject = "dw_rpt_cysx" boolean vscrollbar = true boolean livescroll = true end type event constructor;wf_dw5m7(this) end event event getfocus;if getrow()=1 then send(handle(this),256,9,0)//此行是在保护名称时有用,不能删除 end event event itemchanged;if is_type='column' and object.data[row,2]='edit.style' then//edit.style,这里的setfilter跟dw8的有些不同 setfilter("(pos(oproperties,'edit.')+pos(oproperties,'checkbox.')+pos(oproperties,'dddw.')+pos(oproperties,'ddlb.')+pos(oproperties,'editmask.')+pos(oproperties,'radiobuttons.')=0)") filter() sort() elseif is_type='datawindow' and object.data[row,2]='processing' then choose case data case '1'//grid setfilter("osort<=40") case '2'//label setfilter("osort<=20 or osort>50") case '4'//crosstab setfilter("osort<=50") case else//'0'//freeform setfilter("osort<=20") end choose filter() sort() end if if isvalid(dwo) then choose case dwo.name case 'o01','o02','o04','o05','o06','o07','o08','o09' setitem(row,3,data) case 'o03'//1_0 if object.data[row,2]='background.mode' and data='0' then setitem(row,3,'2')//1=透明,2=不透明,但书上写0=不透明,检测为0时如果dw也为透明,则对象什么也看不见 else setitem(row,3,data) end if end choose end if end event event buttonclicked;IF dwo.Name = 'sort1' THEN SetSort('oproperties a') Sort() Modify("sort1.text='按字母排序▲' sort2.text='按习惯排序'") ELSEIF dwo.Name = 'sort2' THEN SetSort('osort a') Sort() Modify("sort1.text='按字母排序' sort2.text='按习惯排序▲'") ELSEIF dwo.Name = 'mydddw' THEN IF Pos('libexport',is_type) > 0 THEN GetFileOpenName("Select File",s[1],s[2],"pbl","Pb Files,*.pbl") ELSE GetFileOpenName("Select File",s[1],s[2],"pbl","Pb Files,*.pb?") END IF IF s[1] > '' THEN IF Pos('libexport,libimport',is_type) > 0 THEN dw7.SetItem(1,3,s[1]) END IF wf_dwchild8(s[1],dw_child9) END IF END IF end event event doubleclicked;s[1]=dwo.name if pos(',ovalue1,ovalue2,',','+s[1]+',')=0 or row=0 then return s[2]=f_myget(this,row,s[1]) str_rpt lstr lstr=istr_rpt lstr.tt='expr' lstr.t1=s[2] lstr.t2='expr' w_rpt_edit w_temp openwithparm(w_temp,lstr,win_parent) lstr=message.powerobjectparm if isvalid(lstr) then setitem(row,s[1],lstr.t1) end if end event event clicked;if row>0 then s[1]=f_myget(this,row,'oproperties') if pos(s[1],'color')>0 and dwo.name='ovalue1' then s[1]=f_myget(this,row,'ovalue1') uo_color.uf_scolor(s[1]) uo_color.y=PixelsToUnits(ypos,YPixelsToUnits!)+80 else uo_color.visible=false end if end if end event type tp_3 from userobject within tab_1 integer x = 18 integer y = 96 integer width = 2907 integer height = 1404 long backcolor = 80269524 string text = "编辑风格" long tabtextcolor = 33554432 long tabbackcolor = 80269524 long picturemaskcolor = 536870912 dw_8 dw_8 dw_7 dw_7 end type on tp_3.create this.dw_8=create dw_8 this.dw_7=create dw_7 this.Control[]={this.dw_8,& this.dw_7} end on on tp_3.destroy destroy(this.dw_8) destroy(this.dw_7) end on type dw_8 from datawindow within tp_3 integer x = 1906 integer y = 8 integer width = 1001 integer height = 1396 integer taborder = 11 string dataobject = "dw_datavalue" boolean vscrollbar = true boolean livescroll = true end type event constructor;insertrow(0) end event type dw_7 from datawindow within tp_3 integer y = 8 integer width = 1902 integer height = 1396 integer taborder = 11 string dataobject = "dw_rpt_cysx" boolean livescroll = true end type event constructor;wf_dw5m7(this) modify('sort1.visible=false sort2.visible=false') end event event editchanged;if is_type='column' and object.data[row,2]='dddw.name' then wf_dddw(data) elseif is_type='column' and object.data[row,2]='edit.codetable' then if data='yes' then dw8.visible=true else dw8.visible=false end if end if end event event itemchanged;if isvalid(dwo) then choose case dwo.name case 'o02' dw5.setitem(row,3,data) if is_type='column' and object.data[row,2]='edit.codetable' then if data='yes' then goto mydw8 else dw8.visible=false end if end if case 'o01','o02','o03','o04','o05','o06','o07','o08','o09' dw5.setitem(row,3,data) case 'odddwname' if pos('libexport,libimport',is_type)=0 then accepttext() wf_dddw(data) end if end choose end if if is_type='column' and object.data[row,2]='edit.style' then//edit.style accepttext() dw5.setredraw(false)//不能删除,否则在pb65下会出错 setredraw(false) dw5.setfilter("pos(oproperties,'"+data+".')>0 or oproperties='edit.style'") dw5.filter() dw5.sort() dw5.setredraw(true) setredraw(true) send(handle(this),256,9,0)//为了显示下拉箭头,原因是ovalue1在底下,而ovalue1.visible=true choose case data case 'edit' wf_sxs1(data+'.case','any',0) wf_sxs1(data+'.limit','0',0) if wf_sxg1('edit.codetable')='yes' then goto mydw8 else dw8.visible=false end if case 'checkbox' dw8.visible=false wf_sxs1(data+'.text','',0) wf_sxs1(data+'.on','1',0) wf_sxs1(data+'.off','0',0) wf_sxs1(data+'.threed','yes',0) case 'radiobuttons' wf_sxs1(data+'.columns','1',0) wf_sxs1(data+'.threed','yes',0) goto mydw8 case 'ddlb' wf_sxs1(data+'.case','any',0) wf_sxs1(data+'.limit','0',0) wf_sxs1(data+'.useasborder','yes',0) wf_sxs1(data+'.vscrollbar','yes',0) goto mydw8 case 'editmask' dw8.visible=false wf_sxs1(data+'.mask','###',0) wf_sxs1(data+'.spinincr','1',0) wf_sxs1(data+'.spin','yes',0) case 'dddw' dw8.visible=false wf_sxs1(data+'.name','',0) wf_sxs1(data+'.datacolumn','',0) wf_sxs1(data+'.displaycolumn','',0) wf_sxs1(data+'.case','any',0) wf_sxs1(data+'.limit','0',0) wf_sxs1(data+'.lines','0',0) wf_sxs1(data+'.percentwidth','100',0) wf_sxs1(data+'.useasborder','yes',0) wf_sxs1(data+'.vscrollbar','yes',0) is_temp=dw7.getitemstring(2,3)//dddw.name if dw_child8.rowcount()=0 then wf_dwchild8('exportdw.pbd',dw_child8) end if if is_temp>'' then wf_dddw(is_temp) end if end choose end if return mydw8: dw8.visible=true s[4]=f_rsx(io[1].others,'id') i=long(s[4]) if i>0 then s[3]=win_parent.dw3.getitemstring(i,'cvalues') dw8.reset() if s[3]='' then dw8.insertrow(0) return end if if right(s[3],1)<>'/' then s[3]=s[3]+'/' do while true i=pos(s[3],char(9)) if i=0 then exit s[1]=left(s[3],i -1) s[3]=mid(s[3],i+1) i=pos(s[3],'/') s[2]=left(s[3],i -1) s[3]=mid(s[3],i+1) i=dw8.insertrow(0) dw8.setitem(i,1,s[1]) dw8.setitem(i,2,s[2]) loop end if end event event buttonclicked;IF Pos('libexport',is_type) > 0 THEN GetFileOpenName("Select File",s[1],s[2],"pbl","Pb Files,*.pbl") ELSE GetFileOpenName("Select File",s[1],s[2],"pbl","Pb Files,*.pb?") END IF IF s[1] > '' THEN IF Pos('libexport,libimport',is_type) > 0 THEN dw7.SetItem(1,3,s[1]) END IF wf_dwchild8(s[1],dw_child8) END IF end event type cb_2 from commandbutton within w_rpt_edit integer x = 1385 integer y = 1528 integer width = 274 integer height = 100 integer taborder = 30 integer textsize = -9 integer weight = 400 fontpitch fontpitch = variable! string facename = "宋体" string text = "取消(&N)" boolean cancel = true end type event clicked;close(parent) end event type cb_1 from commandbutton within w_rpt_edit integer x = 777 integer y = 1528 integer width = 274 integer height = 100 integer taborder = 20 integer textsize = -9 integer weight = 400 fontpitch fontpitch = variable! string facename = "宋体" string pointer = "Icon!" string text = "确认(&Y)" boolean default = true end type event clicked;dw5.accepttext() dw7.accepttext() dw8.accepttext() dw5.setfilter('')//column中有setfilter() dw5.filter() dw5.setsort('osort a') dw5.sort() if istr_rpt.tt='crosstab' then if wf_crosstabw()=1 then goto myerror end if end if if pos("libexport,libimport,datawindow,",is_type)=0 then if wf_verify()=1 then goto myerror if pos('expr,',is_type)=0 then if wf_name()=1 then goto myerror//检查对象名是否有效 end if end if if wf_sxg0()=1 then goto myerror//读取常用属性到win_parent.io[iio] if is_type='libexport' then if isvalid(win_parent.idwm) then int li_rows li_rows=win_parent.idwm.rowcount() for i=1 to li_rows//检查另存dw有无重名 if i<>win_parent.ii_rowm and io[1].oname=f_myget(win_parent.idwm,i,'rdname') then messagebox('提示信息',f_myget(win_parent.idwm,i,'rid')+'['+f_myget(win_parent.idwm,i,'rcname')+']已使用<'+io[1].oname+'>名字,请改名!') goto myerror end if next win_parent.idwm.setitem(win_parent.ii_rowm,'rdname',io[1].oname) end if s[1]=win_parent.is_dw if io[1].oname>'' and LibraryImport(io[1].otype,io[1].oname,ImportDataWindow!,s[1],s[2],win_parent.istr_rpt.rcname)=1 then//io[1].oname=dw_name,s[1]=dw_Syntax,s[2]=errors messagebox('提示信息','另存为'+io[1].oname+'成功!') else messagebox('出错信息',io[1].oname+'存档失败!',stopsign!) end if elseif is_type='libimport' then elseif is_type='expr' then istr_rpt.t1=is_oexp istr_rpt.t2=is_o2exp else wf_modify()//设置新的属性 end if closewithreturn(parent,istr_rpt) return myerror: tab_1.event selectionchanging(1,tab_1.SelectedTab)//恢复dw5.setfilter return end event type cb_20 from commandbutton within w_rpt_edit event clicked pbm_bnclicked integer x = 1952 integer y = 1528 integer width = 274 integer height = 100 integer taborder = 50 integer textsize = -9 integer weight = 400 fontpitch fontpitch = variable! string facename = "宋体" string text = "帮助(&H)" end type event clicked;ShowHelp("report.HLP", keyword!, "report_edit") end event