Imports System.Web.Configuration
Public Class Schuelerreport
Inherits System.Web.UI.Page
Dim scounter As Integer = 0
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
Try
Dim reportnr As String = "23"
Dim dh As New clsDatahandling
Dim ds As New DataSet
ds = dh.Get_Tabledata("Select * from web_report where id=" + reportnr, False, True)
show_report(ds.Tables(0).Rows(0).Item("SQL"), ds.Tables(0).Rows(0).Item("SQLType"), ds.Tables(0).Rows(0).Item("Reportdatei"), ds.Tables(0).Rows(0).Item("Dokumentnr").ToString)
show_report(ds.Tables(0).Rows(0).Item("SQL"), ds.Tables(0).Rows(0).Item("SQLType"), ds.Tables(0).Rows(0).Item("Reportdatei"), ds.Tables(0).Rows(0).Item("Dokumentnr").ToString)
Me.WebReport1.Visible = True
Me.WebReport1.Zoom = 1
Catch
End Try
'show_report("Berufsliste", "SP", "Berufsliste.frx")
End If
End Sub
Sub Open_Report(ByVal reportnr As Integer)
Dim url As String = Server.MapPath("/default.aspx")
Response.Write("")
'HttpContext.Current.Response.Write("")
Exit Sub
'Page.ClientScript.RegisterStartupScript(Me.RadTreeView1.GetType.GetType, "New Windows", "window.open('" + url + "','','')", True)
Page.ClientScript.RegisterClientScriptBlock(Me.GetType, "New windows", "window.open('" + url + "','baba','')", True)
End Sub
Sub show_report(ByVal sql As String, ByVal sqltype As String, ByVal filename As String, dokumentnr As String)
Try
If dokumentnr <> "" Then
If dokumentnr <> "-1" Then sql = sql.Replace("%DOKNR%", dokumentnr)
End If
Dim ds1 As New DataSet
Dim ds As New DataSet
Dim dh As New clsDatahandling
ds = dh.Get_Tabledata("Select * from schuelerdaten1 where schuelernr=" + Session("schuelernr").ToString, False, True)
'If sqltype = "SP" Then
' ds = dh.Get_Tabledata(sql, True, False)
'Else
' If sqltype = "SQL" Then
' ds = dh.Get_Tabledata(sql, False, True)
' Else
' ds = dh.Get_Tabledata(sql, False, False)
' End If
'End If
Me.WebReport1.Prepare()
Me.WebReport1.ReportFile = "~/Reporting/" + filename
Me.WebReport1.DataBind()
Dim x As FastReport.Report = WebReport1.Report
x.RegisterData(ds)
scounter = scounter + 1
'If scounter > 1 Then
' Dim exp As New FastReport.Export.Pdf.PDFExport
' Me.WebReport1.Report.Export(exp, "E:\WebProjects\LPWeb\LPWeb\reporting\exported.pdf")
'End If
Catch ex As Exception
End Try
End Sub
Private Sub WebReport1_PreRender(sender As Object, e As System.EventArgs) Handles WebReport1.PreRender
Me.WebReport1.Prepare()
End Sub
Private Sub WebReport1_StartReport(sender As Object, e As System.EventArgs) Handles WebReport1.StartReport
Dim dh As New clsDatahandling
Me.WebReport1.Report.SetParameterValue("Parcours", dh.Get_Option(2))
Me.WebReport1.Report.SetParameterValue("Spruch", dh.Get_Option(3))
Me.WebReport1.Report.SetParameterValue("URL", dh.Get_Option(27))
End Sub
Protected Sub RadButton1_Click(sender As Object, e As EventArgs) Handles RadButton1.Click
Dim exp As New FastReport.Export.Pdf.PDFExport
'If exp.ShowDialog Then
'End If
Dim s As String = Session("RedirPath")
Session("RedirPath") = ""
Response.Redirect("~/Administration/Schueler.aspx?Schuelernr=" + Session("Schuelernr").ToString)
End Sub
'Protected Sub RadButton2_Click(sender As Object, e As EventArgs) Handles RadButton2.Click
' Me.WebReport1.Prepare()
' Me.WebReport1.Prepare()
' Dim exp As New FastReport.Export.Pdf.PDFExport
' Dim fn As String = Server.MapPath("~/Reporting/") + System.IO.Path.GetRandomFileName + ".pdf"
' Me.WebReport1.Report.Export(exp, fn)
' Dim downloadfile As New System.IO.FileInfo(fn)
' HttpContext.Current.Response.Clear()
' HttpContext.Current.Response.AddHeader("Content-Disposition", String.Format("attachment; filename={0}", downloadfile.Name))
' HttpContext.Current.Response.AddHeader("Content-Length", downloadfile.Length.ToString())
' HttpContext.Current.Response.ContentType = "application/octet-stream"
' HttpContext.Current.Response.WriteFile(downloadfile.FullName)
' HttpContext.Current.Response.End()
'End Sub
End Class