分享
 
 
 

(5)ASPCallCrystalReportwithStoreProcedure

王朝厨房·作者佚名  2007-01-04
窄屏简体版  字體: |||超大  

<%@ LANGUAGE="VBSCRIPT" %>

<%

On Error Resume Next

’ The oEMF object is a helper object to create EMFs (Ecapsulated Messages) for the viewers.

’ The viewers use EMFs to display errors and navigate to specific pages of the report.

If Not IsObject(session("oEMF")) then

Set session("oEMF") = Server.CreateObject("CREmfgen.CREmfgen.1")

Call CheckForError

End if

’ Initialize all Global variables

’ These will contain the page generator and page collection

Dim goPageGenerator ’ page generator object

Dim goPageCollection ’ page collection object

Dim goPageGeneratorDrill’ page generator object in Drill Down Context

Dim goPage ’ the page object

Dim gvGroupPathDD ’ drill down group path, this is an array.

Dim gvGroupPath ’ this is branch, aka Group Path converted from string passed on the QS, it is an Array

Dim gvGroupLevel ’ this is the Group level, converted from the string passed on the QS, it is an Array

Dim gvMaxNode ’ this represents the number of nodes to retrieve for the totaller, it is set to an empty array

Dim gvTotallerInfo ’ this represents the group path of the requested totaller.

Dim glX ’ this is the X Coordinate for a drill down on a graph or Map

Dim glY ’ this is the Y Coordinate for a drill down on a graph or Map

Dim gvPageNumber ’ holds the requested page number

Dim gvURL ’ URL to redirect to

Dim gsErrorText ’ holds the error text to be sent to the viewer.

Dim ExportOptions ’ Export Options Object

Dim slX ’ this is the X Coordinate for a selection of Out of Place subreport

Dim slY ’ this is the Y Coordinate for a selection of Out of Place subreport

’ Vaiables that represent what was passed on the Query String

Dim CMD ’ This determines the main function to perform

Dim PAGE ’ the page to return

Dim BRCH ’ the branch is a mechanism to determine the drill down level.

’ A drill down level is like a view of the report, a new tab

’ is created to indicate that it is a new view

Dim VIEWER ’ This is the viewer that is calling the server

Dim VFMT ’ the format that the viewer understands

Dim NODE ’ Currently not used??

Dim GRP ’ this is a way of specifing the actual group

Dim COORD ’ these are the coordinates on the graph to process

Dim DIR ’ this is the search direction

Dim CSE ’ indicates if the search is case sensitive

Dim TEXT ’ this is the text to search for.

Dim INIT ’ used to build the frames for the html viewer

Dim NEWBRCH ’ used to keep track of when a new branch is to be viewed.

Dim EXPORT_FMT ’ used to hold the export format and type

Dim SUBRPT ’ used to hold the Out Of Place Subreport page, number,

’ and coordinates on the main report.

Dim INCOMPLETE_PAGE ’ used to indicate whether the page generated should contain placeholders.

Dim INCOMPLETE_PAGE_COUNT ’ used to indicate whether the page should contain the total page count if not yet generated.

Dim PVERSION ’ used to indicate the protocol version of the viewer.

Dim TTL_INFO ’ used to indicate the group path of the totaller request.

’ Constant Values

Dim CREFTWORDFORWINDOWS

Dim CREFTRICHTEXT

Dim CREFTEXCEL21

Dim CREFTCRYSTALREPORT

Dim CREDTDISKFILE

Dim EMFMIMETYPE

CREFTWORDFORWINDOWS = 14

CREFTRICHTEXT = 4

CREFTEXCEL21 = 18

CREFTCRYSTALREPORT = 1

CREDTDISKFILE = 1

crAllowPlaceHolders = 2

crDelayTotalPageCountCalc = 1

EMFMIMETYPe = "application/x-emf"

EPFMIMETYPE = "application/x-epf"

ETFMIMETYPE = "application/x-etf"

’ Initialize Arrays

gvGroupPath = Array()

gvGroupLevel = Array()

gvMaxNode = Array() ’ reteive all nodes

gvTotallerInfo = Array()

NEWBRCH = "0"

’ To ensure that the browser does not cache the html pages for the group trees.

Response.Expires = 0

’ Parse Query String for paramaters

Call ParseQS()

’ INIT is a special QS case, we only care about HTML viewer, if it is then save send page and branch info

’ to the frame page

if INIT = "HTML_FRAME" then

’ build URL and send the QS

if BRCH <> "" and NEWBRCH = "1" then

’ htmstart is the base page that creates the frames for the HTML viewer

’ if there is branch information it needs to be passed along.

tmpArray = session("tabArray")

if tmpArray(0) <> "EMPTY" then

val = UBound(tmpArray, 1) + 1

redim preserve tmpArray(val + 4)

else

val = 0

end if

tmpArray(val) = CStr(val)

tmpArray(val + 1) = session("lastBrch")

session("lastBrch") = BRCH

tmpArray(val + 2) = session("CurrentPageNumber")

tmpArray(val + 3) = session("lastknownpage")

tmpArray(val + 4) = session("LastPageNumber")

session("tabArray") = tmpArray

gvURL = "htmstart.asp?brch=" & BRCH & "&"

else

if BRCH <> "" then

gvURL = "htmstart.asp?brch=" & BRCH

else

gvURL = "htmstart.asp"

end if

end if

response.redirect gvURL

end if

’ If there is a BRCH then create the gvGroupPath array that represents it.

if BRCH <> "" then

gvGroupPath = CreateArray(BRCH)

end if

’ If there is a GRP then create the gvGroupLevel array that represents it.

if GRP <> "" then

gvGroupLevel = CreateArray(GRP)

end if

’ If there is a TTL_INFO then create the gvTotallerInfo array that represents it.

if TTL_INFO <> "" then

gvTotallerInfo = CreateArray(TTL_INFO)

end if

’ If there are COORDs, then get them

if COORD <> "" then

Call GetDrillDownCoordinates(COORD, glX, glY)

end if

’ This case statement determines what action to perform based on CMD

’ there are sub cases for each viewer type

Select Case CMD

Case "GET_PG"

Call RetrieveObjects

’ create the actual page

Set goPage = goPageCollection(PAGE)

’ check for an exception on the page number

Call ValidatePageNumber

’ 0 is for epf, 8209 is a SafeArray

Select Case VFMT

Case "ENCP"

session("oPageEngine").PlaceHolderOptions = 0

if(PVERSION > 2)then

if INCOMPLETE_PAGE > 0 then

session("oPageEngine").PlaceHolderOptions = crAllowPlaceHolders

end if

if INCOMPLETE_PAGE_COUNT > 0 then

session("oPageEngine").PlaceHolderOptions = session("oPageEngine").PlaceHolderOptions + crDelayTotalPageCountCalc

end if

end if

session("oPageEngine").ImageOptions = 1

temp = goPage.Renderepf(8209)

Response.AddHeader "CONTENT-LENGTH", lenb(temp)

Response.ContentType = EPFMIMETYPE

response.binarywrite temp

Case "HTML_FRAME"

session("oPageEngine").ImageOptions = 1

response.binarywrite goPage.Renderhtml(1,2,1,request.ServerVariables("SCRIPT_NAME"),8209)

’ Need to know if it is the last page to construct the toolbar correctly

if goPage.IsLastPage then

session("LastPageNumber") = goPage.pagenumber

session("CurrentPageNumber") = session("LastPageNumber")

end if

Case "HTML_PAGE"

session("oPageEngine").ImageOptions = 1

response.binarywrite goPage.Renderhtml(1,3,3,request.ServerVariables("SCRIPT_NAME"),8209)

end select

Case "GET_TTL"

Call RetrieveObjects

Select Case VFMT

Case "ENCP"

Response.ContentType = ETFMIMETYPE

if(PVERSION > 2)then

temp = goPageGenerator.RenderTotallerETF(gvTotallerInfo, 0, 1, gvMaxNode, 8209)

else

temp = goPageGenerator.RenderTotallerETF(gvGroupPath, 0, 0, gvMaxNode, 8209)

end if

Response.AddHeader "CONTENT-LENGTH", lenb(temp)

response.binarywrite temp

Case "HTML_FRAME"

response.binarywrite goPageGenerator.RenderTotallerHTML(gvGroupPath, 1, 0, gvMaxNode, gvGroupLevel, 1, request.ServerVariables("SCRIPT_NAME"), 8209)

end select

Case "RFSH"

’ This command forces the database to be read again.

session("oRpt").DiscardSavedData

session("oRpt").ReadRecords

If Err.Number <> 0 Then

Call CheckForError

Else

session("oRpt").EnableParameterPrompting = False

Set session("oPageEngine") = session("oRpt").PageEngine

End If

Call RetrieveObjects

Set goPage = goPageCollection(PAGE)

Call ValidatePageNumber

session("oPageEngine").ImageOptions = 1

Select Case VFMT

Case "ENCP"

’ Java and Active X Viewers will make a get page command when receiving 0 error msg value

if VIEWER = "JAVA" then

session("oPageEngine").PlaceHolderOptions = 0

if(PVERSION > 2)then

if INCOMPLETE_PAGE > 0 then

session("oPageEngine").PlaceHolderOptions = crAllowPlaceHolders

end if

if INCOMPLETE_PAGE_COUNT > 0 then

session("oPageEngine").PlaceHolderOptions = session("oPageEngine").PlaceHolderOptions + crDelayTotalPageCountCalc

end if

end if

temp = goPage.Renderepf(8209)

Response.AddHeader "CONTENT-LENGTH", lenb(temp)

Response.ContentType = EPFMIMETYPE

response.binarywrite temp

else

Response.ContentType = EMFMIMETYPE

session("oEMF").SendErrorMsg 0,""

end if

Case "HTML_FRAME"

InitializeFrameArray()

gvURL = "htmstart.asp"

response.redirect gvURL

Case "HTML_PAGE"

session("oPageEngine").ImageOptions = 1

response.binarywrite goPage.Renderhtml(1,3,1,request.ServerVariables("SCRIPT_NAME"),8209)

end select

Case "NAV"

Call RetrieveObjects

Call CheckForError

’ Get the page number that the group in on, for this particular branch

gvPageNumber = goPageGenerator.GetPageNumberForGroup(gvGroupLevel)

Select Case VFMT

’ 0 is for epf, 8209 is a SafeArray, 8 is a BSTR

Case "ENCP"

’ Create a byte array for the EMF, which will contain the page number

Response.ContentType = EMFMIMETYPE

session("oEMF").sendpagenumberrecord(gvPageNumber)

Case "HTML_FRAME"

’ for html browser send back the page

dim appendQuery

appendQuery = "?"

session("CurrentPageNumber") = gvPageNumber

if BRCH <> "" then

appendQuery = appendQuery & "BRCH=" & BRCH & "&"

end if

if GRP <> "" then

appendQuery = appendQuery & "GRP=" & GRP

end if

response.redirect "framepage.asp" & appendQuery

end select

Case "CHRT_DD"

’ only supported in java and active X smart viewers

Select Case VFMT

Case "ENCP"

’ Get page collection

Call RetrieveObjects

Call CheckForError

’ Pass the coordinates to the report engine to determine what

’ branch the drill down goes to.

Set goPageGeneratorDrill = goPageGenerator.DrillOnGraph(PAGE, glX, glY)

’ Check for an exception because of coordinates

if err.number <> 0 then

gsErrorText = "Not part of the Graph "

Response.ContentType = EMFMIMETYPE

session("oEMF").SendErrorMsg 40, gsErrorText

err.clear

response.end

end if

’ pass the group level and group path to helper function to create

’ the EMF message, this tells the viewer where to get the page.

gvGroupPathDD = goPageGeneratorDrill.grouppath

gvGroupNameDD = goPageGeneratorDrill.groupname

Response.ContentType = EMFMIMETYPE

session("oEMF").GroupName = gvGroupNameDD

session("oEMF").sendbranchesemf(gvGroupPathDD)

end select

Case "GET_LPG"

’ only support in smart viewers

Select Case VFMT

Case "ENCP"

’ this command returns the page number of the last page

’ Get page collection

Call RetrieveObjects

Call CheckForError

’ Get the count from the Pages collection

gvPageNumber = goPageCollection.Count

’ Send the EMF representing the page number

Response.ContentType = EMFMIMETYPE

session("oEMF").sendpagenumberrecord(gvPageNumber)

end select

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
2023年上半年GDP全球前十五强
 百态   2023-10-24
美众议院议长启动对拜登的弹劾调查
 百态   2023-09-13
上海、济南、武汉等多地出现不明坠落物
 探索   2023-09-06
印度或要将国名改为“巴拉特”
 百态   2023-09-06
男子为女友送行,买票不登机被捕
 百态   2023-08-20
手机地震预警功能怎么开?
 干货   2023-08-06
女子4年卖2套房花700多万做美容:不但没变美脸,面部还出现变形
 百态   2023-08-04
住户一楼被水淹 还冲来8头猪
 百态   2023-07-31
女子体内爬出大量瓜子状活虫
 百态   2023-07-25
地球连续35年收到神秘规律性信号,网友:不要回答!
 探索   2023-07-21
全球镓价格本周大涨27%
 探索   2023-07-09
钱都流向了那些不缺钱的人,苦都留给了能吃苦的人
 探索   2023-07-02
倩女手游刀客魅者强控制(强混乱强眩晕强睡眠)和对应控制抗性的关系
 百态   2020-08-20
美国5月9日最新疫情:美国确诊人数突破131万
 百态   2020-05-09
荷兰政府宣布将集体辞职
 干货   2020-04-30
倩女幽魂手游师徒任务情义春秋猜成语答案逍遥观:鹏程万里
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案神机营:射石饮羽
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案昆仑山:拔刀相助
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案天工阁:鬼斧神工
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案丝路古道:单枪匹马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:与虎谋皮
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:李代桃僵
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:指鹿为马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:小鸟依人
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:千金买邻
 干货   2019-11-12
 
推荐阅读
 
 
 
>>返回首頁<<
 
靜靜地坐在廢墟上,四周的荒凉一望無際,忽然覺得,淒涼也很美
© 2005- 王朝網路 版權所有