$PBExportHeader$w_rpt_sql.srw $PBExportComments$设置数据源--窗口 forward global type w_rpt_sql from w_rpt_base end type type tab_1 from tab within w_rpt_sql end type type tp_table from userobject within tab_1 end type type dw_1 from datawindow within tp_table end type type tp_table from userobject within tab_1 dw_1 dw_1 end type type tp_where from userobject within tab_1 end type type dw_2 from datawindow within tp_where end type type dw_5 from datawindow within tp_where end type type tp_where from userobject within tab_1 dw_2 dw_2 dw_5 dw_5 end type type tp_col from userobject within tab_1 end type type dw_3 from datawindow within tp_col end type type cb_2 from commandbutton within tp_col end type type cb_3 from commandbutton within tp_col end type type tp_col from userobject within tab_1 dw_3 dw_3 cb_2 cb_2 cb_3 cb_3 end type type tp_sort from userobject within tab_1 end type type dw_4 from datawindow within tp_sort end type type tp_sort from userobject within tab_1 dw_4 dw_4 end type type tp_sql from userobject within tab_1 end type type mle_1 from multilineedit within tp_sql end type type dw_10 from datawindow within tp_sql end type type tp_sql from userobject within tab_1 mle_1 mle_1 dw_10 dw_10 end type type tp_procedure from userobject within tab_1 end type type dw_6 from datawindow within tp_procedure end type type sle_1 from singlelineedit within tp_procedure end type type st_1 from statictext within tp_procedure end type type st_2 from statictext within tp_procedure end type type tp_procedure from userobject within tab_1 dw_6 dw_6 sle_1 sle_1 st_1 st_1 st_2 st_2 end type type tp_wbsjy from userobject within tab_1 end type type dw_7 from datawindow within tp_wbsjy end type type tp_wbsjy from userobject within tab_1 dw_7 dw_7 end type type tp_bbgs from userobject within tab_1 end type type gb_3 from groupbox within tp_bbgs end type type gb_2 from groupbox within tp_bbgs end type type gb_1 from groupbox within tp_bbgs end type type rb_1 from radiobutton within tp_bbgs end type type rb_2 from radiobutton within tp_bbgs end type type rb_3 from radiobutton within tp_bbgs end type type ddlb_1 from dropdownlistbox within tp_bbgs end type type dw_8 from datawindow within tp_bbgs end type type ddlb_3 from dropdownlistbox within tp_bbgs end type type dw_9 from datawindow within tp_bbgs end type type ddlb_2 from dropdownlistbox within tp_bbgs end type type ddlb_4 from dropdownlistbox within tp_bbgs end type type rb_6 from radiobutton within tp_bbgs end type type rb_5 from radiobutton within tp_bbgs end type type rb_7 from radiobutton within tp_bbgs end type type rb_9 from radiobutton within tp_bbgs end type type rb_4 from radiobutton within tp_bbgs end type type rb_8 from radiobutton within tp_bbgs end type type rb_10 from radiobutton within tp_bbgs end type type em_1 from editmask within tp_bbgs end type type st_3 from statictext within tp_bbgs end type type tp_bbgs from userobject within tab_1 gb_3 gb_3 gb_2 gb_2 gb_1 gb_1 rb_1 rb_1 rb_2 rb_2 rb_3 rb_3 ddlb_1 ddlb_1 dw_8 dw_8 ddlb_3 ddlb_3 dw_9 dw_9 ddlb_2 ddlb_2 ddlb_4 ddlb_4 rb_6 rb_6 rb_5 rb_5 rb_7 rb_7 rb_9 rb_9 rb_4 rb_4 rb_8 rb_8 rb_10 rb_10 em_1 em_1 st_3 st_3 end type type tab_1 from tab within w_rpt_sql tp_table tp_table tp_where tp_where tp_col tp_col tp_sort tp_sort tp_sql tp_sql tp_procedure tp_procedure tp_wbsjy tp_wbsjy tp_bbgs tp_bbgs end type type dw11 from datawindow within w_rpt_sql end type type rb_s1 from radiobutton within w_rpt_sql end type type rb_s2 from radiobutton within w_rpt_sql end type type rb_s3 from radiobutton within w_rpt_sql end type type rb_s4 from radiobutton within w_rpt_sql end type type cb_yes from commandbutton within w_rpt_sql end type type cb_no from commandbutton within w_rpt_sql end type end forward global type w_rpt_sql from w_rpt_base integer y = 4 integer width = 3282 integer height = 1816 string title = "自动生成数据窗口向导" boolean minbox = false boolean maxbox = false boolean resizable = false windowtype windowtype = response! windowstate windowstate = normal! long backcolor = 80269524 tab_1 tab_1 dw11 dw11 rb_s1 rb_s1 rb_s2 rb_s2 rb_s3 rb_s3 rb_s4 rb_s4 cb_yes cb_yes cb_no cb_no end type global w_rpt_sql w_rpt_sql type variables datawindow dw01,dw02,dw03,dw04,dw05,dw06,dw07,dw10 DataWindowChild dw_child1,dw_child2,dw_child3 string is_ctag int ii_bbgs=1,ii_band_size,ii_tables,ii_select_count,ii_select_row datastore ids,ids2 int ii_rowc=50,ii_sqlno=1 string is_sqlselect,is_where,is_fields,is_from,is_sort,is_group,is_from_old,is_arguments string is_procedure w_rpt_main win_parent end variables forward prototypes public subroutine wf_select (datawindow f_dw, integer f_row, integer f_label) public subroutine wf_dwclick (datawindow f_dw, integer f_row) public subroutine wf_button (datawindow f_dw, integer f_label) public subroutine wf_sql () public subroutine wf_getfrom () public subroutine wf_bbgs (string s_bbgs) public subroutine wf_arg () public function integer wf_dw11 (string ssql) end prototypes public subroutine wf_select (datawindow f_dw, integer f_row, integer f_label);int li_row,li_select_row,j string ls_select_row if f_label= -1 then ii_select_count=ii_select_count -1 is_ctag=f_dw.getitemstring(f_row,'ctag') ii_select_row=long(left(is_ctag,3)) is_ctag=right(is_ctag,len(is_ctag) -4) f_dw.setitem(f_row,'ctag',is_ctag) for j=1 to 999 li_row=f_dw.getSelectedRow(li_row) if li_row=0 then exit is_ctag=f_dw.getitemstring(li_row,'ctag') li_select_row=long(left(is_ctag,3)) ls_select_row=string(li_select_row -1) ls_select_row=space(3 -len(ls_select_row))+ls_select_row if li_select_row>ii_select_row then is_ctag=ls_select_row+'.'+right(is_ctag,len(is_ctag) -4) f_dw.setitem(li_row,'ctag',is_ctag) end if next else ii_select_count=ii_select_count+1 is_ctag=string(ii_select_count) is_ctag=space(3 -len(is_ctag))+is_ctag is_ctag=is_ctag+'.'+f_dw.getitemstring(f_row,'ctag') f_dw.setitem(f_row,'ctag',is_ctag) end if return end subroutine public subroutine wf_dwclick (datawindow f_dw, integer f_row);if f_row>0 then if f_dw.getSelectedrow(f_row -1)=f_row then f_dw.Selectrow(f_row,false) wf_select(f_dw,f_row,-1) else f_dw.Selectrow(f_row,true) wf_select(f_dw,f_row,1) end if end if end subroutine public subroutine wf_button (datawindow f_dw, integer f_label);int li,li_rows li_rows=f_dw.rowcount() for li=1 to li_rows if f_dw.getSelectedRow(li -1)=li then if f_label=-1 then f_dw.SelectRow(li,false) wf_select(f_dw,li,-1) end if else if f_label=1 then f_dw.SelectRow(li,true) wf_select(f_dw,li,1) end if end if next end subroutine public subroutine wf_sql ();string ls_fields,ls_dbname,ls_name,ls_tag,ls_type,ls_table int j,li_row,li_len2,li_pos ids.reset() dw11.reset() dw02.accepttext() dw04.accepttext() ii_rows=dw03.rowcount() dw03.rowscopy(1,ii_rows,Primary!,ids,1,Primary!) ids.setfilter("mid(ctag,4,1)='.'") ids.filter()//过滤选择好的字段 ids.setsort("ctag") ids.sort()//按选择字段的顺序排序 if is_datasource='dw' then//前台 is_sqlselect=f_replace(trim(ids2.object.datawindow.table.sqlselect),'~~~"','')//SQL语句里的~"可以去掉 else//后台 wf_getfrom() end if ii_rows=ids.rowcount() for i=1 to ii_rows ls_dbname=ids.getitemstring(i,2) ls_fields=ls_fields+','+ls_dbname if is_datasource='dw' then//前台 ls_tag=mid(ids.getitemstring(i,1),5) ls_type=ids.getitemstring(i,3) ls_name=ids.getitemstring(i,4) ls_tag=mid(ls_tag,pos(ls_tag,'.')+1) li_pos=pos(ls_dbname,'.') ls_table=left(ls_dbname,li_pos -1) ii_row=dw11.insertrow(0) dw11.setitem(ii_row,'cname',ls_name) dw11.setitem(ii_row,'cdbname',ls_dbname) dw11.setitem(ii_row,'ctag',ls_tag) dw11.setitem(ii_row,'ctype',ls_type) dw11.setitem(ii_row,'cinitial',ids.getitemstring(i,'cinitial')) if pos(is_from,',')=0 then dw11.setitem(ii_row,'cupdate','yes') dw11.setitem(ii_row,'ckey',ids.getitemstring(i,'ckey')) end if end if next if is_datasource<>'dw' then//后台 is_where='' ii_row=dw02.rowcount() for i=1 to ii_row//通过关联字段生成where子句语法 s[1]=dw02.getitemstring(i,'s_col1') s[2]=dw02.getitemstring(i,'s_col2') s[5]=dw02.getitemstring(i,'s_zkh') s[6]=dw02.getitemstring(i,'s_ykh') if s[1]>'' and s[2]>'' then s[3]=' '+dw02.getitemstring(i,'s_relation')+' ' if i=1 then s[4]='' else s[4]=dw02.getitemstring(i -1,'s_label') end if if s[4]='' then s[4]=' and ' if is_where>'' then is_where=is_where+s[4]+s[5]+s[1]+s[3]+s[2]+s[6] else is_where=s[5]+s[1]+s[3]+s[2]+s[6] end if end if next is_sort='' for j=1 to ii_rowc//提取排序表达式 s[1]=trim(dw04.getitemstring(j,1)) s[2]=dw04.getitemstring(j,2) if s[1]>'' then if s[2]='2' then s[1]=s[1]+' desc' else s[1]=s[1]+' asc' end if is_sort=is_sort+','+s[1] end if next is_sort=mid(is_sort,2) ls_fields=mid(ls_fields,2) is_sqlselect='select '+ls_fields+' from '+is_from if is_where>'' then is_sqlselect=is_sqlselect+' where '+is_where if is_group>'' then is_sqlselect=is_sqlselect+' group by '+is_group if is_sort>'' then is_sqlselect=is_sqlselect+' order by '+is_sort end if //messagebox('',is_sqlselect) return end subroutine public subroutine wf_getfrom ();int li ii_tables=0 is_from='' ii_rows=dw01.rowcount() for i=1 to ii_rows li=dw01.getSelectedRow(li) if li=0 then exit ii_tables++ is_from=is_from+','+dw01.getitemstring(li,'table_english') next is_from=mid(is_from,2) end subroutine public subroutine wf_bbgs (string s_bbgs);ii_bbgs=long(left(s_bbgs,2)) if ii_bbgs=0 then ii_bbgs=long(win_parent.id[1].ox1) if ii_bbgs>0 then ii_bbgs=ii_bbgs+5 else is_temp=win_parent.id[1].ofweight if long(is_temp)>1 then ii_bbgs=5 tab_1.tp_bbgs.em_1.text=is_temp else ii_bbgs=1 end if end if choose case ii_bbgs case 1 tab_1.tp_bbgs.rb_1.postevent(clicked!) case 5 tab_1.tp_bbgs.rb_5.postevent(clicked!) case 6 tab_1.tp_bbgs.rb_6.postevent(clicked!) case 7 tab_1.tp_bbgs.rb_7.postevent(clicked!) case 8 tab_1.tp_bbgs.rb_8.postevent(clicked!) case 9 tab_1.tp_bbgs.rb_9.postevent(clicked!) case 10 tab_1.tp_bbgs.rb_10.postevent(clicked!) end choose elseif ii_bbgs=5 then tab_1.tp_bbgs.st_3.visible=true tab_1.tp_bbgs.em_1.visible=true else tab_1.tp_bbgs.st_3.visible=false tab_1.tp_bbgs.em_1.visible=false end if end subroutine public subroutine wf_arg ();is_arguments='' ii_rows=dw05.rowcount() for i=1 to ii_rows//提取参数 s[1]=trim(dw05.getitemstring(i,1)) s[2]=trim(dw05.getitemstring(i,2)) if s[1]>'' then if is_arguments>'' then is_arguments=is_arguments+',' is_arguments=is_arguments+'("'+s[1]+'",'+s[2]+')' end if next if is_arguments>'' then is_arguments='('+is_arguments+')' end subroutine public function integer wf_dw11 (string ssql);ii_rows=dw05.rowcount() for i=1 to ii_rows//提取参数 s[3]=trim(dw05.getitemstring(i,1)) if s[3]='' then continue s[4]=trim(dw05.getitemstring(i,2)) choose case s[4] case 'date' s[5]=string(today()) ssql=f_replace(ssql,':'+s[3],"'"+s[5]+"'") case 'datetime' s[5]=string(now()) ssql=f_replace(ssql,':'+s[3],"'"+s[5]+"'") case 'time' s[5]=string(time(now())) case 'string','number','numberlist' s[5]='0' ssql=f_replace(ssql,':'+s[3],s[5]) case else s[5]='0' ssql=f_replace(ssql,':'+s[3],s[5]) end choose next dw11.reset() s[6]=f_rpt_gdw(ssql,dw11,it_report,'','') if s[6]>'' then messagebox('出错信息',s[6]) return 1 end if istr_rpt.rsql2=ssql//此SQL的参数已经有值,可以直接运行 return 0 end function on w_rpt_sql.create int iCurrent call super::create this.tab_1=create tab_1 this.dw11=create dw11 this.rb_s1=create rb_s1 this.rb_s2=create rb_s2 this.rb_s3=create rb_s3 this.rb_s4=create rb_s4 this.cb_yes=create cb_yes this.cb_no=create cb_no iCurrent=UpperBound(this.Control) this.Control[iCurrent+1]=this.tab_1 this.Control[iCurrent+2]=this.dw11 this.Control[iCurrent+3]=this.rb_s1 this.Control[iCurrent+4]=this.rb_s2 this.Control[iCurrent+5]=this.rb_s3 this.Control[iCurrent+6]=this.rb_s4 this.Control[iCurrent+7]=this.cb_yes this.Control[iCurrent+8]=this.cb_no end on on w_rpt_sql.destroy call super::destroy destroy(this.tab_1) destroy(this.dw11) destroy(this.rb_s1) destroy(this.rb_s2) destroy(this.rb_s3) destroy(this.rb_s4) destroy(this.cb_yes) destroy(this.cb_no) end on event open;call super::open;win_parent = this.parentwindow() f_wcenter(this) //定义dw01,dw02,dw03,dw04是为了之后编程书写方便 dw01=tab_1.tp_table.dw_1 dw02=tab_1.tp_where.dw_2 dw03=tab_1.tp_col.dw_3 dw04=tab_1.tp_sort.dw_4 dw05=tab_1.tp_where.dw_5 dw06=tab_1.tp_procedure.dw_6 dw07=tab_1.tp_wbsjy.dw_7 dw10=tab_1.tp_sql.dw_10 //ctag是选择的字段前面加了编号,ctag2则是没有加编号的字段中文名 dw03.modify("ctag.visible=1 ctag2.visible=0") it_report=istr_rpt.transation//接收参数 is_datasource=istr_rpt.datasource ids=create datastore ids.dataobject=dw03.dataobject ids2=create datastore if is_datasource='dw' then tab_1.tp_table.visible=false tab_1.tp_where.visible=false tab_1.tp_sort.visible=false istr_rpt.isdw=istr_rpt.userdw.object.datawindow.syntax ids2.create(istr_rpt.isdw) ids2.settransobject(it_report) else dw01.SETTRANSOBJECT(it_report) dw01.retrieve() for i=1 to ii_rowc dw02.insertrow(0) dw04.insertrow(0) next dw02.GetChild('s_col1',dw_child1) dw02.GetChild('s_col2',dw_child2) dw04.GetChild('s_sort',dw_child3) dw03.sharedata(dw_child1) dw03.sharedata(dw_child2) dw03.sharedata(dw_child3) end if tab_1.tp_bbgs.dw_8.INSERTROW(0) tab_1.tp_bbgs.dw_9.INSERTROW(0) tab_1.tp_bbgs.dw_8.modify("text_1.text='标题字体示例' text_1.font.height='24'") tab_1.tp_bbgs.dw_9.modify("text_1.text='内容字体示例' text_1.font.height='12'") if istr_rpt.auto='sql' then//重新设置数据源 tab_1.tp_bbgs.visible=false title='重新设置数据源' end if wf_bbgs('0') is_arguments=istr_rpt.rarguments is_sqlselect=istr_rpt.rsqlselect is_procedure=istr_rpt.rprocedure if is_sqlselect='' and is_procedure='' and win_parent.dw3.rowcount()>0 then ii_sqlno=3 elseif is_sqlselect='' and is_procedure>'' then ii_sqlno=4 else if pos(is_sqlselect,'~n')>0 then//SQL中有回车符,则认为是直接写SQL语句 ii_sqlno=2 else ii_sqlno=1 end if end if f_rpt_cksql(is_sqlselect,is_fields,is_from,is_where,is_group,is_sort) /////////////修改点////////////--------is_where if istr_rpt.auto <> 'sql' then is_where = istr_rpt.wheresql is_from = istr_rpt.tablename end if if ii_sqlno=1 then is_from=is_from+',' is_where=is_where+' and ' is_sort=is_sort+',' do while 1=1//重新标记已选的表 l[1]=pos(is_from,',') if l[1]<2 then exit s[1]=trim(left(is_from,l[1] -1)) is_from=mid(is_from,l[1]+1) ii_row=dw01.Find("table_english='"+s[1]+"'",1,999) if ii_row>0 then dw01.SelectRow(ii_row,TRUE) else ii_sqlno=2 end if loop tab_1.event selectionchanged(1,3)//去取dw03的数据 if is_where<>' and ' then string ls[] int j,k,m is_temp=dw02.describe('s_relation.values') is_temp=f_replace(is_temp,'/','~t') f_atab(ls[],is_temp) k=upperbound(ls[]) for i=1 to ii_rowc l[1]=pos(is_where,' and ') l[2]=pos(is_where,' or ') if l[1]+l[2]=0 then exit if l[1]>0 and l[2]>0 then l[3]=min(l[1],l[2]) elseif l[1]>0 then l[3]=l[1] else l[3]=l[2] end if s[3]=trim(left(is_where,l[3] -1)) is_where=lefttrim(mid(is_where,l[3]+4))//lefttrim不能改为trim,因为最后是' and ' if is_where>'' then if l[1]=l[3] then dw02.setitem(i,'s_label',' and ') else dw02.setitem(i,'s_label',' or ') end if end if if s[3]>'' then for j=k to 1 step -1 l[1]=pos(s[3],ls[j]) if l[1]>0 then if pos(ls[j],'=')+pos(ls[j],'>')+pos(ls[j],'<')=0 then if l[1]=1 or pos(' '+char(9),mid(s[3],l[1] -1,1))=0 or pos(' '+char(9),mid(s[3],l[1]+len(ls[j]),1))=0 then//比较符为英文单词时,前面一个字符必须为空格或Tab字符 continue end if end if s[1]=trim(left(s[3],l[1] -1)) s[2]=trim(mid(s[3],l[1]+len(ls[j]))) s[3]='' s[4]='' for m=1 to 6 if left(s[1],1)='(' then s[3]=s[3]+'(' s[1]=trim(mid(s[1],2)) else exit end if next for m=1 to 6 if right(s[2],1)=')' then s[4]=s[4]+')' s[2]=trim(left(s[2],len(s[2])-1)) else exit end if next dw02.setitem(i,'s_col1',s[1]) dw02.setitem(i,'s_col2',s[2]) dw02.setitem(i,'s_relation',ls[j]) dw02.setitem(i,'s_zkh',s[3]) dw02.setitem(i,'s_ykh',s[4]) exit end if next if j=0 then ii_sqlno=2 end if end if next end if l[2]=1//重新标记已选的索引 for i=1 to ii_rowc//is_sort=表达式1 asc,表达式2 desc,索引字段也带表名 l[1]=pos(is_sort,',',l[2]) if l[1]=0 then exit s[2]='1' s[3]=trim(left(is_sort,l[1] -1)) if right(lower(s[3]),5)=' desc' then s[1]=trim(left(s[3],l[1] -6)) s[2]='2' elseif right(lower(s[3]),4)=' asc' then s[1]=trim(left(s[3],l[1] -5)) elseif pos(s[3],'(',l[2])=0 then//没有函数情况 s[1]=s[3] elseif pos(s[3],'(',l[2])>0 then//暂时只能处理只有一个函数有','的情况,否则此索引会变成两个 l[2]=l[1]+1 i -- continue end if dw04.setitem(i,1,s[1]) if s[2]='2' then dw04.setitem(i,2,'2') is_sort=trim(mid(is_sort,l[1]+1)) l[2]=1 next end if is_arguments=mid(is_arguments,2,len(is_arguments)-2)//把两边的括号去掉 /////////////修改点////////////--------is_arguments if istr_rpt.auto <> 'sql' then is_arguments=istr_rpt.arguments end if do while 1=1//重新标记参数 l[1]=pos(is_arguments,'(') l[2]=pos(is_arguments,',',l[1]) l[3]=pos(is_arguments,')',l[1]) if l[1]<1 then exit s[1]=trim(mid(is_arguments,l[1]+2,l[2] -l[1] -3)) s[2]=trim(mid(is_arguments,l[2]+1,l[3] -l[2] -1)) is_arguments=mid(is_arguments,l[3]+1) i=dw05.insertrow(0) dw05.setitem(i,1,s[1]) dw05.setitem(i,2,s[2]) loop dw05.sharedata(dw06) dw05.sharedata(dw10) if ii_bbgs=9 then//crosstab wf_dw11(istr_rpt.rsqlselect+istr_rpt.rprocedure)// else win_parent.dw3.sharedata(dw11) end if ii_rows=dw11.rowcount() for i=1 to ii_rows if ii_sqlno=3 then//外部数据源 s[1]=dw11.getitemstring(i,'cname') s[2]=dw11.getitemstring(i,'ctype') dw07.insertrow(0) dw07.setitem(i,1,s[1]) if pos(s[2],'decimal')=1 then dw07.setitem(i,2,'decimal') dw07.setitem(i,4,long(mid(s[2],9,len(s[2])-9))) elseif pos(s[2],'char')=1 then dw07.setitem(i,2,'string') dw07.setitem(i,3,long(mid(s[2],6,len(s[2])-6))) elseif pos(s[2],'varchar')=1 then dw07.setitem(i,2,'string') dw07.setitem(i,3,long(mid(s[2],9,len(s[2])-9))) else dw07.setitem(i,2,s[2]) end if elseif ii_sqlno<3 then//存储过程跳过 s[1]=dw11.getitemstring(i,'cdbname') l[2]=dw03.find("cdbname='"+s[1]+"'",1,999) if l[2]>0 then wf_dwclick(dw03,l[2]) else ii_sqlno=2 end if end if next if ii_bbgs<>9 then//非crosstab win_parent.dw3.sharedataoff() end if if is_procedure>'' then l[1]=pos(is_procedure,'execute ') l[2]=pos(is_procedure,';') if l[2]=0 then l[2]=pos(is_procedure,' ',l[1]+8) if l[1]>0 and l[2]>0 then s[1]=trim(mid(is_procedure,l[1]+8,l[2] -l[1] -8)) tab_1.tp_procedure.sle_1.text=s[1] end if end if if is_datasource='dw' then choose case ii_sqlno case 1 rb_s1.checked=true case 2 rb_s2.checked=true case 3 rb_s3.checked=true case 4 rb_s4.checked=true end choose rb_s1.enabled=false rb_s2.enabled=false rb_s3.enabled=false rb_s4.enabled=false tab_1.tp_sql.visible=true tab_1.tp_table.visible=false tab_1.tp_where.visible=false tab_1.tp_col.visible=true tab_1.tp_sort.visible=false tab_1.tp_procedure.visible=false tab_1.tp_wbsjy.visible=false tab_1.tp_sql.mle_1.text=is_sqlselect l[1]=long(ids2.Object.DataWindow.Column.Count)//字段总数 for j=1 to l[1] s[1]=ids2.describe("#"+string(j)+'.name')//字段英文名 s[2]=trim(ids2.describe(s[1]+'_t.text'))//字段中文名 if pos('?!',s[2])>0 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')//字段类型 s[4]=ids2.describe(s[1]+'.dbname') s[5]=ids2.describe(s[1]+'.initial') ii_row=dw03.insertrow(0) dw03.setitem(ii_row,'cname',s[1]) dw03.setitem(ii_row,'ctag',s[2]) dw03.setitem(ii_row,'ctype',s[3]) dw03.setitem(ii_row,'cdbname',s[4]) dw03.setitem(ii_row,'cinitial',s[5]) next if istr_rpt.auto<>'auto' then ii_rows=dw03.rowcount() for i=1 to ii_rows wf_dwclick(dw03,i) next end if tab_1.post selecttab(tab_1.tp_col) else choose case ii_sqlno case 1 rb_s1.postevent(clicked!) case 2 rb_s2.postevent(clicked!) case 3 rb_s3.postevent(clicked!) case 4 rb_s4.postevent(clicked!) end choose end if f_getfont(tab_1.tp_bbgs.ddlb_1) f_getfont(tab_1.tp_bbgs.ddlb_3) if istr_rpt.tt='crosstab_auto' then//此参数纯粹为了取参数如istr_rpt.rprocedur2 cb_yes.event clicked() end if end event event close;destroy ids destroy ids2 end event event resize;////根据显示分辨率调整对象位置,大小 //if ii_sqlno=1 then // tab_1.x=0 // tab_1.y=0 // tab_1.width=newwidth // tab_1.height=newheight // dw01.x=(newwidth - dw01.width -30)/2 // dw01.height=newheight -150 // dw02.x=(newwidth - dw02.width -30)/2 // dw02.height=newheight -160 -dw05.height // dw05.x=dw02.x // dw05.y=dw02.y+dw02.height+8 // ii_temp=newheight -240 // dw03.x=(newwidth - dw03.width -30)/2 // dw03.height=ii_temp // dw04.x=(newwidth - dw04.width -30)/2 // dw04.height=newheight -150 // tab_1.tp_col.cb_2.x=(newwidth -30)/2 -30 -tab_1.tp_col.cb_2.width // tab_1.tp_col.cb_3.x=(newwidth -30)/2 +30 // tab_1.tp_sql.mle_1.width=newwidth -2*tab_1.tp_sql.mle_1.x //end if end event event ue_cond;tab_1.SelectTab(3) end event type tab_1 from tab within w_rpt_sql integer x = 5 integer width = 3273 integer height = 1612 integer taborder = 10 boolean bringtotop = true integer textsize = -9 integer weight = 400 fontpitch fontpitch = variable! string facename = "宋体" long backcolor = 80269524 alignment alignment = center! integer selectedtab = 1 tp_table tp_table tp_where tp_where tp_col tp_col tp_sort tp_sort tp_sql tp_sql tp_procedure tp_procedure tp_wbsjy tp_wbsjy tp_bbgs tp_bbgs end type on tab_1.create this.tp_table=create tp_table this.tp_where=create tp_where this.tp_col=create tp_col this.tp_sort=create tp_sort this.tp_sql=create tp_sql this.tp_procedure=create tp_procedure this.tp_wbsjy=create tp_wbsjy this.tp_bbgs=create tp_bbgs this.Control[]={this.tp_table,& this.tp_where,& this.tp_col,& this.tp_sort,& this.tp_sql,& this.tp_procedure,& this.tp_wbsjy,& this.tp_bbgs} end on on tab_1.destroy destroy(this.tp_table) destroy(this.tp_where) destroy(this.tp_col) destroy(this.tp_sort) destroy(this.tp_sql) destroy(this.tp_procedure) destroy(this.tp_wbsjy) destroy(this.tp_bbgs) end on event selectionchanged;int j,li_row string ls_sql,ls_errors if ii_sqlno<>1 then return if oldindex=1 and newindex<>1 then if is_datasource='dw' then//前台 else wf_getfrom() if is_from<>is_from_old then//如果选择的表改变 is_from_old=is_from dw03.reset() li_row=0 ii_select_count=0 for i=1 to ii_tables li_row=dw01.getSelectedRow(li_row) if li_row=0 then exit s[5]=dw01.getitemstring(li_row,'table_chinese')//表的中文名 s[6]=dw01.getitemstring(li_row,'table_english')//表的英文名 ls_sql='SELECT '+s[6]+'.* from '+s[6] if ii_tables>1 then s[2]=mid('ABCDEFGHIJKLMNOPQRSTUVWXYZ',i,1)+s[5]+'.' else s[2]='' end if ls_errors=f_rpt_gdw(ls_sql,dw03,it_report,s[2],s[6]) next end if end if end if if newindex=5 then wf_sql() tab_1.tp_sql.mle_1.text=is_sqlselect end if return end event type tp_table from userobject within tab_1 integer x = 18 integer y = 112 integer width = 3237 integer height = 1484 long backcolor = 80269524 string text = "选表或视图" long tabtextcolor = 33554432 long tabbackcolor = 80269524 string picturename = "Database!" long picturemaskcolor = 553648127 dw_1 dw_1 end type on tp_table.create this.dw_1=create dw_1 this.Control[]={this.dw_1} end on on tp_table.destroy destroy(this.dw_1) end on type dw_1 from datawindow within tp_table integer x = 571 integer y = 4 integer width = 2094 integer height = 1484 integer taborder = 2 boolean bringtotop = true string dataobject = "dw_rpt_table" boolean vscrollbar = true boolean livescroll = true borderstyle borderstyle = stylelowered! end type event clicked;if row>0 then if getSelectedRow(Row - 1)=row then SelectRow(Row,false) else SelectRow(Row,true) end if end if return 1 end event type tp_where from userobject within tab_1 integer x = 18 integer y = 112 integer width = 3237 integer height = 1484 long backcolor = 80269524 string text = "关联或条件" long tabtextcolor = 33554432 long tabbackcolor = 80269524 string picturename = "Join!" long picturemaskcolor = 553648127 dw_2 dw_2 dw_5 dw_5 end type on tp_where.create this.dw_2=create dw_2 this.dw_5=create dw_5 this.Control[]={this.dw_2,& this.dw_5} end on on tp_where.destroy destroy(this.dw_2) destroy(this.dw_5) end on type dw_2 from datawindow within tp_where event ue_auto ( ) integer width = 3237 integer height = 1136 integer taborder = 2 string dragicon = "one!" boolean bringtotop = true string dataobject = "dw_rpt_relation" boolean hscrollbar = true boolean vscrollbar = true boolean hsplitscroll = true boolean livescroll = true borderstyle borderstyle = stylelowered! end type event ue_auto;accepttext() l[1]=getrow() l[2]=getcolumn() if l[1]>0 then choose case l[2] case 1 s[1]=getitemstring(l[1],1) if s[1]>'' then s[2]=getitemstring(l[1],2) if s[2]='' then setitem(l[1],2,'=') for i=l[1] -1 to 1 step -1 s[1]=getitemstring(i,1) s[2]=getitemstring(i,4) if s[1]>'' and s[2]='' then setitem(i,4,' and ') exit end if next end if case 3,4 s[1]=getitemstring(l[1],1) s[2]=getitemstring(l[1],2) if s[1]>'' and s[2]='' then setitem(l[1],2,'=') end if end choose end if end event event buttonclicked;if row>0 then deleterow(row) insertrow(0) end if end event event clicked;event ue_auto() end event event itemchanged;event ue_auto() end event event rowfocuschanged;event ue_auto() end event type dw_5 from datawindow within tp_where integer y = 1144 integer width = 3232 integer height = 340 integer taborder = 110 boolean bringtotop = true string dataobject = "dw_rpt_argument" boolean vscrollbar = true boolean livescroll = true borderstyle borderstyle = stylelowered! end type type tp_col from userobject within tab_1 integer x = 18 integer y = 112 integer width = 3237 integer height = 1484 long backcolor = 80269524 string text = "选字段" long tabtextcolor = 33554432 long tabbackcolor = 80269524 string picturename = "ArrangeIcons!" long picturemaskcolor = 553648127 dw_3 dw_3 cb_2 cb_2 cb_3 cb_3 end type on tp_col.create this.dw_3=create dw_3 this.cb_2=create cb_2 this.cb_3=create cb_3 this.Control[]={this.dw_3,& this.cb_2,& this.cb_3} end on on tp_col.destroy destroy(this.dw_3) destroy(this.cb_2) destroy(this.cb_3) end on type dw_3 from datawindow within tp_col event clicked pbm_dwnlbuttonclk integer x = 69 integer y = 96 integer width = 2752 integer height = 1372 integer taborder = 10 string dataobject = "dw_rpt_field_drop" boolean vscrollbar = true boolean livescroll = true borderstyle borderstyle = stylelowered! end type event clicked;wf_dwclick(this,row) end event type cb_2 from commandbutton within tp_col integer x = 1175 integer y = 12 integer width = 178 integer height = 76 integer taborder = 10 boolean bringtotop = true integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" string text = "全选" end type event clicked;wf_button(dw_3,1) end event type cb_3 from commandbutton within tp_col integer x = 1399 integer y = 12 integer width = 219 integer height = 76 integer taborder = 20 boolean bringtotop = true integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" string text = "全不选" end type event clicked;wf_button(dw_3,-1) end event type tp_sort from userobject within tab_1 integer x = 18 integer y = 112 integer width = 3237 integer height = 1484 long backcolor = 80269524 string text = "选索引" long tabtextcolor = 33554432 long tabbackcolor = 80269524 string picturename = "Sort!" long picturemaskcolor = 553648127 dw_4 dw_4 end type on tp_sort.create this.dw_4=create dw_4 this.Control[]={this.dw_4} end on on tp_sort.destroy destroy(this.dw_4) end on type dw_4 from datawindow within tp_sort integer x = 238 integer y = 12 integer width = 2405 integer height = 1460 integer taborder = 20 boolean bringtotop = true string dataobject = "dw_rpt_sort" boolean vscrollbar = true boolean livescroll = true borderstyle borderstyle = stylelowered! end type type tp_sql from userobject within tab_1 integer x = 18 integer y = 112 integer width = 3237 integer height = 1484 long backcolor = 80269524 string text = "语句" long tabtextcolor = 33554432 long tabbackcolor = 80269524 string picturename = "SQL!" long picturemaskcolor = 553648127 mle_1 mle_1 dw_10 dw_10 end type on tp_sql.create this.mle_1=create mle_1 this.dw_10=create dw_10 this.Control[]={this.mle_1,& this.dw_10} end on on tp_sql.destroy destroy(this.mle_1) destroy(this.dw_10) end on type mle_1 from multilineedit within tp_sql integer y = 28 integer width = 3232 integer height = 1060 integer taborder = 20 boolean bringtotop = true integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long backcolor = 80269524 boolean vscrollbar = true boolean autovscroll = true boolean displayonly = true borderstyle borderstyle = stylelowered! end type type dw_10 from datawindow within tp_sql integer y = 1100 integer width = 3227 integer height = 360 integer taborder = 90 boolean bringtotop = true string dataobject = "dw_rpt_argument" boolean vscrollbar = true boolean livescroll = true borderstyle borderstyle = stylelowered! end type type tp_procedure from userobject within tab_1 integer x = 18 integer y = 112 integer width = 3237 integer height = 1484 long backcolor = 80269524 string text = "存储过程" long tabtextcolor = 33554432 long tabbackcolor = 80269524 string picturename = "DeclareProcedure!" long picturemaskcolor = 553648127 dw_6 dw_6 sle_1 sle_1 st_1 st_1 st_2 st_2 end type on tp_procedure.create this.dw_6=create dw_6 this.sle_1=create sle_1 this.st_1=create st_1 this.st_2=create st_2 this.Control[]={this.dw_6,& this.sle_1,& this.st_1,& this.st_2} end on on tp_procedure.destroy destroy(this.dw_6) destroy(this.sle_1) destroy(this.st_1) destroy(this.st_2) end on type dw_6 from datawindow within tp_procedure integer x = 78 integer y = 780 integer width = 2802 integer height = 604 integer taborder = 120 boolean bringtotop = true string dataobject = "dw_rpt_argument" boolean vscrollbar = true boolean livescroll = true borderstyle borderstyle = stylelowered! end type type sle_1 from singlelineedit within tp_procedure integer x = 78 integer y = 212 integer width = 2802 integer height = 92 integer taborder = 50 boolean bringtotop = true integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 boolean autohscroll = false borderstyle borderstyle = stylelowered! end type type st_1 from statictext within tp_procedure integer x = 78 integer y = 116 integer width = 2802 integer height = 76 boolean bringtotop = true integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 long backcolor = 80269524 boolean enabled = false string text = "存储过程名称(如:sp_name)" boolean focusrectangle = false end type type st_2 from statictext within tp_procedure integer x = 78 integer y = 672 integer width = 2802 integer height = 76 boolean bringtotop = true 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 tp_wbsjy from userobject within tab_1 integer x = 18 integer y = 112 integer width = 3237 integer height = 1484 long backcolor = 80269524 string text = "外部数据源" long tabtextcolor = 33554432 long tabbackcolor = 80269524 string picturename = "ScriptYes!" long picturemaskcolor = 553648127 dw_7 dw_7 end type on tp_wbsjy.create this.dw_7=create dw_7 this.Control[]={this.dw_7} end on on tp_wbsjy.destroy destroy(this.dw_7) end on type dw_7 from datawindow within tp_wbsjy integer x = 197 integer y = 24 integer width = 2583 integer height = 1440 integer taborder = 20 boolean bringtotop = true string dataobject = "dw_rpt_wbsjy" boolean vscrollbar = true boolean livescroll = true borderstyle borderstyle = stylelowered! end type type tp_bbgs from userobject within tab_1 event create ( ) event destroy ( ) integer x = 18 integer y = 112 integer width = 3237 integer height = 1484 long backcolor = 80269524 string text = "数据窗口格式" long tabtextcolor = 33554432 long tabbackcolor = 80269524 string picturename = "RunReport!" long picturemaskcolor = 553648127 gb_3 gb_3 gb_2 gb_2 gb_1 gb_1 rb_1 rb_1 rb_2 rb_2 rb_3 rb_3 ddlb_1 ddlb_1 dw_8 dw_8 ddlb_3 ddlb_3 dw_9 dw_9 ddlb_2 ddlb_2 ddlb_4 ddlb_4 rb_6 rb_6 rb_5 rb_5 rb_7 rb_7 rb_9 rb_9 rb_4 rb_4 rb_8 rb_8 rb_10 rb_10 em_1 em_1 st_3 st_3 end type on tp_bbgs.create this.gb_3=create gb_3 this.gb_2=create gb_2 this.gb_1=create gb_1 this.rb_1=create rb_1 this.rb_2=create rb_2 this.rb_3=create rb_3 this.ddlb_1=create ddlb_1 this.dw_8=create dw_8 this.ddlb_3=create ddlb_3 this.dw_9=create dw_9 this.ddlb_2=create ddlb_2 this.ddlb_4=create ddlb_4 this.rb_6=create rb_6 this.rb_5=create rb_5 this.rb_7=create rb_7 this.rb_9=create rb_9 this.rb_4=create rb_4 this.rb_8=create rb_8 this.rb_10=create rb_10 this.em_1=create em_1 this.st_3=create st_3 this.Control[]={this.gb_3,& this.gb_2,& this.gb_1,& this.rb_1,& this.rb_2,& this.rb_3,& this.ddlb_1,& this.dw_8,& this.ddlb_3,& this.dw_9,& this.ddlb_2,& this.ddlb_4,& this.rb_6,& this.rb_5,& this.rb_7,& this.rb_9,& this.rb_4,& this.rb_8,& this.rb_10,& this.em_1,& this.st_3} end on on tp_bbgs.destroy destroy(this.gb_3) destroy(this.gb_2) destroy(this.gb_1) destroy(this.rb_1) destroy(this.rb_2) destroy(this.rb_3) destroy(this.ddlb_1) destroy(this.dw_8) destroy(this.ddlb_3) destroy(this.dw_9) destroy(this.ddlb_2) destroy(this.ddlb_4) destroy(this.rb_6) destroy(this.rb_5) destroy(this.rb_7) destroy(this.rb_9) destroy(this.rb_4) destroy(this.rb_8) destroy(this.rb_10) destroy(this.em_1) destroy(this.st_3) end on event constructor;st_3.visible=false em_1.visible=false end event type gb_3 from groupbox within tp_bbgs integer x = 1787 integer y = 792 integer width = 1024 integer height = 608 integer taborder = 30 integer textsize = -9 integer weight = 400 fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 long backcolor = 80269524 string text = "内容字体" end type type gb_2 from groupbox within tp_bbgs integer x = 1792 integer y = 60 integer width = 1024 integer height = 608 integer taborder = 20 integer textsize = -9 integer weight = 400 fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 long backcolor = 80269524 string text = "标题字体" end type type gb_1 from groupbox within tp_bbgs integer x = 46 integer y = 56 integer width = 1504 integer height = 1356 integer taborder = 10 integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long backcolor = 80269524 string text = "数据窗口类型" end type type rb_1 from radiobutton within tp_bbgs event clicked pbm_bnclicked integer x = 201 integer y = 148 integer width = 987 integer height = 76 boolean bringtotop = true integer textsize = -9 integer weight = 400 fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 long backcolor = 80269524 string text = " 1 FreeForm - 表格式(标准宽度)" boolean checked = true end type event clicked;wf_bbgs(text) checked=true end event type rb_2 from radiobutton within tp_bbgs event clicked pbm_bnclicked integer x = 201 integer y = 228 integer width = 987 integer height = 76 boolean bringtotop = true integer textsize = -9 integer weight = 400 fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 long backcolor = 80269524 string text = " 2 FreeForm - 表格式(压缩宽度)" end type event clicked;wf_bbgs(text) checked=true end event type rb_3 from radiobutton within tp_bbgs event clicked pbm_bnclicked integer x = 201 integer y = 308 integer width = 987 integer height = 92 boolean bringtotop = true integer textsize = -9 integer weight = 400 fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 long backcolor = 80269524 string text = " 3 FreeForm - 纯自由式" end type event clicked;wf_bbgs(text) checked=true end event type ddlb_1 from dropdownlistbox within tp_bbgs event selectionchanged pbm_cbnselchange integer x = 1833 integer y = 136 integer width = 736 integer height = 492 integer taborder = 40 boolean bringtotop = true integer textsize = -9 integer weight = 400 fontpitch fontpitch = variable! string facename = "宋体" long backcolor = 16777215 string text = "宋体" boolean vscrollbar = true end type event selectionchanged;dw_8.modify("text_1.font.face='"+this.text+"'") end event type dw_8 from datawindow within tp_bbgs integer x = 1829 integer y = 280 integer width = 942 integer height = 356 integer taborder = 50 boolean bringtotop = true string dataobject = "dw_rpt_font" boolean border = false boolean livescroll = true end type type ddlb_3 from dropdownlistbox within tp_bbgs event selectionchanged pbm_cbnselchange integer x = 1824 integer y = 868 integer width = 736 integer height = 492 integer taborder = 70 boolean bringtotop = true integer textsize = -9 integer weight = 400 fontpitch fontpitch = variable! string facename = "宋体" long backcolor = 16777215 string text = "宋体" boolean vscrollbar = true end type event selectionchanged;dw_9.modify("text_1.font.face='"+this.text+"'") end event type dw_9 from datawindow within tp_bbgs integer x = 1824 integer y = 1012 integer width = 942 integer height = 356 integer taborder = 80 boolean bringtotop = true string dataobject = "dw_rpt_font" boolean border = false boolean livescroll = true end type type ddlb_2 from dropdownlistbox within tp_bbgs event selectionchanged pbm_cbnselchange integer x = 2578 integer y = 136 integer width = 192 integer height = 492 integer taborder = 60 boolean bringtotop = true integer textsize = -9 integer weight = 400 fontpitch fontpitch = variable! string facename = "宋体" long backcolor = 16777215 string text = "18" boolean allowedit = true boolean sorted = false boolean vscrollbar = true string item[] = {"8","9","10","11","12","14","16","18","20","22","24","26","28","36","48","72"} end type event selectionchanged;dw_8.modify("text_1.font.height='"+this.text+"'") end event type ddlb_4 from dropdownlistbox within tp_bbgs event selectionchanged pbm_cbnselchange integer x = 2574 integer y = 868 integer width = 192 integer height = 492 integer taborder = 90 boolean bringtotop = true integer textsize = -9 integer weight = 400 fontpitch fontpitch = variable! string facename = "宋体" long backcolor = 16777215 string text = "9" boolean allowedit = true boolean sorted = false boolean vscrollbar = true string item[] = {"8","9","10","11","12","14","16","18","20","22","24","26","28","36","48","72"} end type event selectionchanged;dw_9.modify("text_1.font.height='"+this.text+"'") end event type rb_6 from radiobutton within tp_bbgs integer x = 201 integer y = 564 integer width = 987 integer height = 76 boolean bringtotop = true integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 long backcolor = 67108864 string text = " 6 Grid - 网格" end type event clicked;wf_bbgs(text) checked=true end event type rb_5 from radiobutton within tp_bbgs integer x = 201 integer y = 484 integer width = 658 integer height = 76 boolean bringtotop = true integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 long backcolor = 67108864 string text = " 5 N-UP - 格式" end type event clicked;wf_bbgs(text) checked=true end event type rb_7 from radiobutton within tp_bbgs integer x = 201 integer y = 644 integer width = 987 integer height = 76 boolean bringtotop = true integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 long backcolor = 67108864 string text = " 7 Label - 标签格式" end type event clicked;wf_bbgs(text) checked=true end event type rb_9 from radiobutton within tp_bbgs integer x = 201 integer y = 804 integer width = 987 integer height = 76 boolean bringtotop = true integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 long backcolor = 67108864 string text = " 9 Crosstab - 交叉表" end type event clicked;wf_bbgs(text) checked=true end event type rb_4 from radiobutton within tp_bbgs integer x = 201 integer y = 404 integer width = 987 integer height = 76 boolean bringtotop = true integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 long backcolor = 67108864 string text = " 4 Tabular - 格式" end type event clicked;wf_bbgs(text) checked=true end event type rb_8 from radiobutton within tp_bbgs integer x = 201 integer y = 724 integer width = 987 integer height = 76 boolean bringtotop = true integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 long backcolor = 67108864 string text = " 8 Graph - 图表" end type event clicked;wf_bbgs(text) checked=true end event type rb_10 from radiobutton within tp_bbgs integer x = 201 integer y = 884 integer width = 987 integer height = 76 boolean bringtotop = true integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 long backcolor = 67108864 string text = "10 Composite - 复合表" end type event clicked;wf_bbgs(text) checked=true rb_s3.postevent(clicked!) end event type em_1 from editmask within tp_bbgs integer x = 1330 integer y = 480 integer width = 178 integer height = 84 integer taborder = 60 boolean bringtotop = true integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 string text = "2" alignment alignment = right! borderstyle borderstyle = stylelowered! string mask = "0" boolean spin = true double increment = 1 end type type st_3 from statictext within tp_bbgs integer x = 878 integer y = 492 integer width = 453 integer height = 76 boolean bringtotop = true 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 = "- 细节区重复行数" alignment alignment = center! boolean focusrectangle = false end type type dw11 from datawindow within w_rpt_sql boolean visible = false integer x = 841 integer y = 1764 integer width = 1262 integer height = 368 integer taborder = 20 boolean bringtotop = true string dataobject = "dw_rpt_column" boolean hscrollbar = true boolean vscrollbar = true boolean hsplitscroll = true boolean livescroll = true end type type rb_s1 from radiobutton within w_rpt_sql integer x = 41 integer y = 1632 integer width = 439 integer height = 76 boolean bringtotop = true 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 event clicked;ii_sqlno=1 tab_1.tp_table.visible=true tab_1.selecttab(tab_1.tp_table) tab_1.tp_sql.visible=true tab_1.tp_sql.mle_1.displayonly=true tab_1.tp_sql.mle_1.BackColor=80269524 tab_1.tp_where.visible=true tab_1.tp_col.visible=true tab_1.tp_sort.visible=true tab_1.tp_procedure.visible=false tab_1.tp_wbsjy.visible=false checked=true end event type rb_s2 from radiobutton within w_rpt_sql integer x = 457 integer y = 1632 integer width = 439 integer height = 76 boolean bringtotop = true integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 long backcolor = 67108864 string text = "直接写SQL语句" end type event clicked;ii_sqlno=2 tab_1.tp_sql.visible=true tab_1.tp_sql.mle_1.displayonly=false tab_1.tp_sql.mle_1.BackColor=16777215 tab_1.selecttab(tab_1.tp_sql) tab_1.tp_table.visible=false tab_1.tp_where.visible=false tab_1.tp_col.visible=false tab_1.tp_sort.visible=false tab_1.tp_procedure.visible=false tab_1.tp_wbsjy.visible=false tab_1.tp_sql.mle_1.text=is_sqlselect checked=true end event type rb_s3 from radiobutton within w_rpt_sql integer x = 983 integer y = 1632 integer width = 439 integer height = 76 boolean bringtotop = true integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 long backcolor = 67108864 string text = "外部数据源" end type event clicked;ii_sqlno=3 tab_1.tp_wbsjy.visible=true tab_1.selecttab(tab_1.tp_wbsjy) tab_1.tp_table.visible=false tab_1.tp_where.visible=false tab_1.tp_col.visible=false tab_1.tp_sort.visible=false tab_1.tp_sql.visible=false tab_1.tp_procedure.visible=false checked=true end event type rb_s4 from radiobutton within w_rpt_sql integer x = 1454 integer y = 1632 integer width = 439 integer height = 76 boolean bringtotop = true integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 long backcolor = 67108864 string text = "存储过程" end type event clicked;ii_sqlno=4 tab_1.tp_procedure.visible=true tab_1.tp_table.visible=false tab_1.tp_where.visible=false tab_1.tp_col.visible=false tab_1.tp_sort.visible=false tab_1.tp_sql.visible=false tab_1.tp_wbsjy.visible=false tab_1.selecttab(tab_1.tp_procedure) checked=true end event type cb_yes from commandbutton within w_rpt_sql integer x = 2181 integer y = 1624 integer width = 265 integer height = 88 integer taborder = 30 boolean bringtotop = true integer textsize = -9 integer weight = 400 fontpitch fontpitch = variable! string facename = "宋体" string text = "确定(&Y)" end type event clicked;dw11.reset() dw02.accepttext() dw04.accepttext() dw05.accepttext() dw06.accepttext() dw07.accepttext() dw10.accepttext() if is_datasource='dw' then//前台 wf_sql()//处理is_sqlselect和coldw else choose case ii_sqlno case 1//视图方式 is_procedure='' tab_1.event selectionchanged(1,3)//先选字段后再去改选表,需要触发此事件 wf_sql()//处理is_sqlselect和coldw if is_from='' then is_temp='请选择表名.' goto myerror end if if ids.rowcount()=0 then is_temp='请选择字段.' goto myerror end if if is_where='' and pos(is_from,',')>0 then is_temp='请选择关联.' goto myerror end if if wf_dw11(is_sqlselect)=1 then return case 2//直接写SQL语句 is_procedure='' s[1]=tab_1.tp_sql.mle_1.text if wf_dw11(s[1])=1 then return if right(s[1],1)<>'~n' then s[1]=s[1]+'~n'//为了在OPEN事件中好识别是直接写SQL语句 is_sqlselect=s[1] case 3//外部数据源 is_sqlselect='' is_procedure='' ii_rows=dw07.rowcount() for i=1 to ii_rows s[1]=dw07.getitemstring(i,1) s[2]=dw07.getitemstring(i,2) dw11.insertrow(0) dw11.setitem(i,'cname',s[1]) dw11.setitem(i,'cdbname',s[1]) dw11.setitem(i,'ctag',s[1]) if s[2]='decimal' then dw11.setitem(i,'ctype','decimal('+string(dw07.object.data[i,4])+')') elseif s[2]='string' then dw11.setitem(i,'ctype','char('+string(dw07.object.data[i,3])+')') else dw11.setitem(i,'ctype',s[2]) end if next case 4//存储过程//execute dba.sp3 '','' is_sqlselect='' s[1]=tab_1.tp_procedure.sle_1.text s[1]='execute '+s[1]+' ' ii_rows=dw05.rowcount() for i=1 to ii_rows//提取参数 s[3]=trim(dw05.getitemstring(i,1)) if s[3]='' then continue s[1]=s[1]+':'+s[3]+',' next if right(s[1],1)=',' then s[1]=left(s[1],len(s[1])-1) if wf_dw11(s[1])=1 then return is_procedure=s[1] end choose end if if ii_bbgs<>9 then//非crosstab if istr_rpt.auto='auto' then if ii_sqlno=1 and pos(is_from,',')=0 then win_parent.is_updatetable=is_from end if ii_band_size=long(tab_1.tp_bbgs.ddlb_4.text)*4/3 ii_rows=dw11.rowcount() for i=1 to ii_rows s[1]=dw11.getitemstring(i,'ctag') s[2]=dw11.getitemstring(i,'ctype') dw11.setitem(i,'clen1',len(s[1])*ii_band_size/2)//字段标题象素 dw11.setitem(i,'clen2',min(f_clen(s[2])*ii_band_size/2,800)) next end if ii_rows=dw11.rowcount() for i=1 to ii_rows//恢复设置的initial,value, is_temp=dw11.getitemstring(i,'cdbname') ii_row=win_parent.dw3.find("cdbname='"+is_temp+"'",1,999) if ii_row>0 then dw11.setitem(i,'cinitial',win_parent.dw3.getitemstring(ii_row,'cinitial')) dw11.setitem(i,'cvalues',win_parent.dw3.getitemstring(ii_row,'cvalues')) dw11.setitem(i,'cvalidation',win_parent.dw3.getitemstring(ii_row,'cvalidation')) dw11.setitem(i,'cvalidationmsg',win_parent.dw3.getitemstring(ii_row,'cvalidationmsg')) dw11.setitem(i,'cidentity',win_parent.dw3.getitemstring(ii_row,'cidentity')) end if next win_parent.dw3.reset() dw11.RowsCopy(1,dw11.RowCount(),Primary!,win_parent.dw3,1,Primary!) end if if is_datasource<>'dw' then//后台 wf_arg() istr_rpt.rsqlselect=is_sqlselect istr_rpt.rarguments=is_arguments istr_rpt.rprocedure=is_procedure end if if istr_rpt.auto='auto' then istr_rpt.tt=string(ii_bbgs) istr_rpt.t1=tab_1.tp_bbgs.ddlb_1.text//title font name istr_rpt.t2=string(round(long(tab_1.tp_bbgs.ddlb_2.text)*4/3,0))//title font size istr_rpt.t3=tab_1.tp_bbgs.ddlb_3.text//band font name istr_rpt.t4=string(round(long(tab_1.tp_bbgs.ddlb_4.text)*4/3,0)) istr_rpt.t5=tab_1.tp_bbgs.em_1.text end if closewithreturn(parent,istr_rpt) return myerror: //清除已经生成的有关字段 ids.setfilter("") ids.setsort("") messagebox('提示信息',is_temp) return end event type cb_no from commandbutton within w_rpt_sql integer x = 2587 integer y = 1624 integer width = 265 integer height = 88 integer taborder = 40 boolean bringtotop = true integer textsize = -9 integer weight = 400 fontpitch fontpitch = variable! string facename = "宋体" string text = "取消(&N)" end type event clicked;close(parent) end event