Imports FastReport Public Class ReportDesigner Inherits System.Web.UI.Page Private _isFirstTime As Boolean = False Private _clientWidth As Integer = 0 Private _clientHeight As Integer = 0 Public Property ClientWidth() As Integer Get Return _clientWidth End Get Set(value As Integer) _clientWidth = value End Set End Property Public Property ClientHeight() As Integer Get Return _clientHeight End Get Set(value As Integer) _clientHeight = value End Set End Property Public Property IsFirstTime() As Boolean Get Return _isFirstTime End Get Set(value As Boolean) _isFirstTime = value End Set End Property Protected Overrides Sub OnInit(e As EventArgs) If (String.IsNullOrEmpty(Request.QueryString("clientHeight")) Or String.IsNullOrEmpty(Request.QueryString("clientWidth"))) Then Me._isFirstTime = True Else Integer.TryParse(Request.QueryString("clientHeight").ToString(), ClientHeight) Integer.TryParse(Request.QueryString("clientWidth").ToString(), ClientWidth) Me._isFirstTime = False 'Me.WebReport1.Height = ClientHeight - 400 'Me.WebReport1.Width = ClientWidth - 200 Me.WebReport1.Width = ClientWidth - 600 Me.WebReport1.Height = ClientHeight - 400 End If End Sub Private Sub Webreport_InitComplete(sender As Object, e As System.EventArgs) Handles Me.InitComplete 'Me.RadTreeView1.ExpandAllNodes() End Sub Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load If Not Page.IsPostBack Then Try If Request.QueryString("Reportnr").ToString <> "" Then Dim dh As New clsDatahandling Dim ds As New DataSet ds = dh.Get_Tabledata("Select * from web_report where id=" + Request.QueryString("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 Else Me.WebReport1.Visible = False End If Me.RadListBox1.SelectedValue = Session("RadList1Value") Me.RadListBox2.SelectedValue = Session("RadList2Value") Catch End Try If Me._isFirstTime = False Then Me.WebReport1.Width = ClientWidth - 600 Me.WebReport1.Height = ClientHeight - 200 Me.WebReport1.PreviewMode = False End If End If End Sub 'Protected Sub RadTreeView1_NodeClick(sender As Object, e As Telerik.Web.UI.RadTreeNodeEventArgs) Handles RadTreeView1.NodeClick ' Dim dh As New clsDatahandling ' Dim ds As New DataSet ' 'ds = dh.Get_Tabledata("Select * from web_report where id=" + Me.RadTreeView1.SelectedNode.Value, False, True) ' If ds.Tables(0).Rows(0).Item("Folder") = False Then ' Session("Reportnr") = Me.RadTreeView1.SelectedNode.Value ' 'Response.Redirect("~/Administration/Webreport.aspx?Reportnr=" + Me.RadTreeView1.SelectedNode.Value.ToString) ' 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 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.DesignReport = True Me.WebReport1.DesignScriptCode = True Me.WebReport1.Prepare() Me.WebReport1.ReportFile = "~/Reporting/" + filename Me.WebReport1.DataBind() Dim x As FastReport.Report = WebReport1.Report x.RegisterData(ds) Me.WebReport1.DesignReport = True Catch ex As Exception MsgBox(ex.Message) End Try 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", "..\bilder\reportlogo.jpg") End Sub Private Sub RadListBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles RadListBox1.SelectedIndexChanged Me.RadListBox2.DataBind() End Sub Protected Sub RadListBox2_SelectedIndexChanged(sender As Object, e As EventArgs) Handles RadListBox2.SelectedIndexChanged Session("RadList1value") = Me.RadListBox1.SelectedValue Session("RadList2Value") = Me.RadListBox2.SelectedValue Dim dh As New clsDatahandling Dim ds As New DataSet ds = dh.Get_Tabledata("Select * from web_report where id=" + Me.RadListBox2.SelectedValue, False, True) If ds.Tables(0).Rows(0).Item("Folder") = False Then Session("Reportnr") = Me.RadListBox2.SelectedValue Response.Redirect("~/Administration/ReportDesigner.aspx?Reportnr=" + Me.RadListBox2.SelectedValue.ToString) End If End Sub Protected Sub WebReport1_SaveDesignedReport(sender As Object, e As Web.SaveDesignedReportEventArgs) Handles WebReport1.SaveDesignedReport Dim filename As String If Request.QueryString("Reportnr").ToString <> "" Then Dim dh As New clsDatahandling Dim ds As New DataSet ds = dh.Get_Tabledata("Select * from web_report where id=" + Request.QueryString("ReportNr"), False, True) filename = "~/Reporting/" + ds.Tables(0).Rows(0).Item("Reportdatei") Else Me.WebReport1.Visible = False Exit Sub End If Me.WebReport1.Report.Save(Server.MapPath(filename)) End Sub End Class