1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- $PBExportHeader$f_rpt_import.srf
- $PBExportComments$引入所有报表-- 函数
- global type f_rpt_import from function_object
- end type
- forward prototypes
- global function long f_rpt_import (transaction f_t)
- end prototypes
- global function long f_rpt_import (transaction f_t);datastore lds
- long ll,lls,llc,lll
- string ls_id,ls_dw,ls_dws
- BLOB lblob
- if MESSAGEBOX('提示','此操作将会先删除现有的全部报表!~n~n是否继续?',QUESTION!,YESNO!,2)=2 then
- return 0
- end if
- lds=create datastore
- lds.dataobject='dw_rpts'
- lds.settransobject(f_t)
- if not fileexists('reports.txt') then
- messagebox('提示','reports.txt文件不存在,不能引入!')
- return 0
- end if
- openwithparm(w_rpt_message,'正在进行,请等候......')
- lll=FileLength('reports.txt')
- llc=Ceiling(lll/32765)
- lll=FileOpen('reports.txt',StreamMode!,Read!,Shared!)
- for ll=1 to llc
- FileRead(lll,ls_dw)
- ls_dws=ls_dws+ls_dw
- next
- FileClose(lll)
- lll=pos(ls_dws,'$$&')
- ls_dw=left(ls_dws,lll -1)
- ls_dws=mid(ls_dws,lll)
- lds.ImportString(ls_dw)
- delete from reports using f_t;
- commit using f_t;
- lds.update()
- commit using f_t;
- lls=lds.rowcount()
- for ll=1 to lls
- w_rpt_message.event ue_percent(ll*100/lls)
- ls_id=lds.getitemstring(ll,'rid')
- llc=pos(ls_dws,'$$&'+ls_id+'$')
- lll=pos(ls_dws,'&&$'+ls_id+'&')
- ls_dw=mid(ls_dws,llc+len(ls_id)+4,lll -llc -len(ls_id) -4)
- ls_dws=mid(ls_dws,lll)
- lblob=blob(ls_dw, EncodingANSI!)
- updateblob reports set rsyntax=:lblob where rid=:ls_id using f_t;
- commit using f_t;
- next
- close(w_rpt_message)
- messagebox('提示','共引入'+string(lls)+'个报表!')
- destroy lds
- return lls
- end function
|