Dim rpt As New ReportDocument
Dim strExportFile As String = Server.MapPath(".") + "\Reports\Exports\" + Session.SessionID.ToString + ".pdf"
Dim DiskOpts As CrystalDecisions.Shared.DiskFileDestinationOptions = _
New CrystalDecisions.Shared.DiskFileDestinationOptions
If Page.Request.QueryString("Quotation") <> "" AndAlso Page.Request.QueryString("Quotation") = "true" Then
Page.Title = "Quotation"
rpt.FileName = Server.MapPath(".") + "\Reports\Quotation.rpt"
Dim QuoteID As Decimal = Decimal.Parse(Page.Request.QueryString("QuoteID"))
Dim Revision As String = Page.Request.QueryString("Revision")
For Each parm As CrystalDecisions.Shared.ParameterField In _
rpt.ParameterFields
With parm
Dim ParmName As String = .ParameterFieldName
Select Case ParmName.ToLower
Case "@pQuoteID".ToLower
.CurrentValues.AddValue(QuoteID)
Case "@pRevision".ToLower
.CurrentValues.AddValue(Revision)
Case "TermsConditions".ToLower
'Load the terms and conditions from the file.
.CurrentValues.AddValue(LoadTermsAndConditions())
Case "CompanyName".ToLower
'Load the company name
.CurrentValues.AddValue(LoadCompanyInfo(True))
Case "CompanyContactInfo".ToLower
'Load the company address info and phone and fax
.CurrentValues.AddValue(LoadCompanyInfo(False))
End Select
End With
Next
ElseIf Page.Request.QueryString("CustPros") <> "" AndAlso Page.Request.QueryString("CustPros") = "true" Then
Page.Title = "Customer/Prospect Report"
rpt.FileName = Server.MapPath(".") + "\Reports\CustomerProspects.rpt"
End If
With rpt.ExportOptions
.ExportDestinationType = ExportDestinationType.DiskFile
.ExportFormatType = ExportFormatType.PortableDocFormat
DiskOpts.DiskFileName = strExportFile
.DestinationOptions = DiskOpts
End With
rpt.Export()
rpt.Close()
rpt.Dispose()
DiskOpts = Nothing
Response.Redirect("Reports/Exports/" + Session.SessionID.ToString + ".pdf", False)