home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2001 May
/
W2KPRK.iso
/
apps
/
crystal
/
disk24
/
Xasp23
< prev
next >
Wrap
Text File
|
1999-08-23
|
7KB
|
231 lines
<% if Session("username") = "" then
Response.Redirect("logon.asp")
end if
%>
<%
' Make sure the browser does not cache this file
response.expires = 0
' Get the requested report name
rpttoview = request.querystring("rpt")
' Set a default, to show a group tree
' this can be modified for indivual reports
showgrouptree = "1"
' the viewer type is detected and stored in this variable
viewer = Session("init")
'Save the reportn name that is being processed
Session("report") = rpttoview
'build full path for report
fullpathtorpt = MID(request.ServerVariables("PATH_TRANSLATED"), 1, (LEN(request.ServerVariables("PATH_TRANSLATED"))-32)) & "\reports\xtreme\" & rpttoview & ".rpt"
' Need to set the location of the data, this is done to illustrate
' the capability of the automation server.
' Build the path to the xtreme.mdb
pathtomdb = MID(request.ServerVariables("PATH_TRANSLATED"), 1, (LEN(request.ServerVariables("PATH_TRANSLATED"))-32)) & "\xtreme.mdb"
' Only create the Crystal Application Object on first time through
If Not IsObject ( Session ("oApp")) Then
Set Session ("oApp") = Server.CreateObject("Crystal.CRPE.Application")
End If
' Turn off all Error Message dialogs
Set oGlobalOptions = Session ("oApp").Options
oGlobalOptions.MorePrintEngineErrorMessages = 0
' Open the report
Set Session("oRpt") = Session("oApp").OpenReport(fullpathtorpt)
' Turn off sepecific report error messages
Set oRptOptions = Session("oRpt").Options
oRptOptions.MorePrintEngineErrorMessages = 0
' now set the table location
Set oDB = session("oRpt").Database
For Each oDBTable In oDB.Tables
oDBTable.Location = pathtomdb
Next
' Based on the selected report, modify various report parameters
Select Case rpttoview
Case "customer"
' this report is dynamically personalized based on the current user,
' by changing a parameter field
Set paramFlds = Session("oRpt").ParameterFields
Set paramFld = paramFlds(1)
paramFld.SetCurrentValue session("username"), 12
' now set the table location on the subreport
Set oSubReport = session("oRpt").OpenSubReport("orders.rpt")
' Turn off sepecific report error messages
Set oRptOptions = Session("oRpt").Options
oRptOptions.MorePrintEngineErrorMessages = 0
Set oDB = oSubReport.Database
For Each oDBTable In oDB.Tables
oDBTable.Location = pathtomdb
Next
Case "empsales"
' this report is dynamically personalized based on the current user,
' by changing a parameter field
Set paramFlds = Session("oRpt").ParameterFields
Set paramFld = paramFlds(1)
paramFld.SetCurrentValue session("username"), 12
Case "statemnt"
' this report is dynamically personalized based on the current user,
' by changing a parameter field
Set paramFlds = Session("oRpt").ParameterFields
Set paramFld = paramFlds(1)
paramFld.SetCurrentValue session("username"), 12
Case "maillabl"
' Turn off grouptree for this report
showgrouptree = "0"
Case "balance"
' Turn off grouptree for this report
showgrouptree = "0"
Case "finstate"
' Turn off grouptree for this report
showgrouptree = "0"
' now set the table location on the subreport
Set oSubReport = session("oRpt").OpenSubReport("income.rpt")
' Turn off sepecific report error messages
Set oRptOptions = Session("oRpt").Options
oRptOptions.MorePrintEngineErrorMessages = 0
Set oDB = oSubReport.Database
For Each oDBTable In oDB.Tables
oDBTable.Location = pathtomdb
Next
' now set the table location on the subreport
Set oSubReport = session("oRpt").OpenSubReport("fr2.rpt")
' Turn off sepecific report error messages
Set oRptOptions = Session("oRpt").Options
oRptOptions.MorePrintEngineErrorMessages = 0
Set oDB = oSubReport.Database
For Each oDBTable In oDB.Tables
oDBTable.Location = pathtomdb
Next
Case "income"
' Turn off grouptree for this report
showgrouptree = "0"
End Select
' This method forces all records to be read
Session("oRpt").ReadRecords
' The PageEngine object can derive all (drill down)views of the report
Set Session("oPageEngine") = Session("oRpt").PageEngine
' Now decide what viewer to create
Select Case viewer
Case "java"
%>
<html><body
<%
if(Session("page")="fr_sales" ) then
response.write(" bgcolor=#003366")
elseif(Session("page")="fr_company") then
response.write(" bgcolor=#330066")
elseif(Session("page")="fr_eis") then
response.write(" bgcolor=#186666")
elseif(Session("page")="fr_warehouse") then
response.write(" bgcolor=#990000")
end if
%>
>
<SCRIPT LANGUAGE="JavaScript"><!--
var _ns3 = false;
var _ns4 = false;
//--></SCRIPT>
<COMMENT><SCRIPT LANGUAGE="JavaScript1.1"><!--
var _info = navigator.userAgent;
var _ns3 = (navigator.appName.indexOf("Netscape") >= 0 && _info.indexOf("Win16") < 0 && _info.indexOf("Mozilla/3") >= 0);
var _ns4 = (navigator.appName.indexOf("Netscape") >= 0 && _info.indexOf("Win16") < 0 && _info.indexOf("Mozilla/4") >= 0 );
//--></SCRIPT></COMMENT>
<SCRIPT LANGUAGE="JavaScript"><!--
if(_ns3==true)
document.writeln( '<applet code=com.seagatesoftware.img.ReportViewer.ReportViewer codebase="/viewer/JavaViewer" id=ReportViewer width=100% height=95% archive="/viewer/JavaViewer/ReportViewer.zip">' );
else if (_ns4 == true)
document.writeln( '<applet code=com.seagatesoftware.img.ReportViewer.ReportViewer codebase="/viewer/JavaViewer" id=ReportViewer width=100% height=95% archive="/viewer/JavaViewer/ReportViewer.jar">' );
else
document.writeln( '<applet code=com.seagatesoftware.img.ReportViewer.ReportViewer codebase="/viewer/JavaViewer" id=ReportViewer width=100% height=95% >' );
//--></SCRIPT>
<param name=ReportName value="rptserver.asp">
<param name=HasGroupTree value=true>
<param name=ShowGroupTree value=<% response.write showgrouptree %>>
<param name=HasRefreshButton value=true>
<param name=HasPrintButton value=true>
<param name=cabbase value="/viewer/JavaViewer/ReportViewer.cab">
</applet>
</body>
</html>
<%
Case "actx"
%>
<html><body
<%
if(Session("page")="fr_sales" ) then
response.write(" bgcolor=#003366")
elseif(Session("page")="fr_company") then
response.write(" bgcolor=#330066")
elseif(Session("page")="fr_eis") then
response.write(" bgcolor=#186666")
elseif(Session("page")="fr_warehouse") then
response.write(" bgcolor=#990000")
end if
%>
>
<OBJECT ALIGN = LEFT ID="CRViewer" WIDTH=100% HEIGHT=95%
CLASSID="CLSID:C4847596-972C-11D0-9567-00A0C9273C2A"
CODEBASE="/viewer/activeXViewer/CRViewer.dll#Version=1,2,0,30">
<PARAM NAME="Report Name" VALUE="rptserver.asp">
<PARAM NAME="Show Group Tree" VALUE= <% response.write showgrouptree %>>
<PARAM NAME="Show Toolbar" VALUE= 1>
</OBJECT>
<%
Case "html_frame"
response.redirect "htmstart.asp"
Case "html_page"
response.redirect "rptserver.asp"
end select
%>