欢迎光临
我们一直在努力

ASP Call Crystal Report with Store Procedure(5)

建站超值云服务器,限时71元/月

<%@ 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

赞(0)
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com 特别注意:本站所有转载文章言论不代表本站观点! 本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。未经允许不得转载:IDC资讯中心 » ASP Call Crystal Report with Store Procedure(5)
分享到: 更多 (0)

相关推荐

  • 暂无文章