Public Class Invoice_Report_Pdf
    Inherits System.Web.UI.Page

#Region " Web Form Designer Generated Code "

    'This call is required by the Web Form Designer.
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

    End Sub

    'NOTE: The following placeholder declaration is required by the Web Form Designer.
    'Do not delete or move it.
    Private designerPlaceholderDeclaration As System.Object

    Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
        'CODEGEN: This method call is required by the Web Form Designer
        'Do not modify it using the code editor.
        InitializeComponent()
    End Sub

#End Region

    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load


        Dim code, Sub_Script As String

        If Session("Sub_Script") <> Nothing Then

        
        code = Left(Session("Sub_Script").ToString, 3)
            Sub_Script = Session("Sub_Script").ToString
            config.configer(1, Sub_Script, code)
        PDF_CONVERTER.Invoice_Report_Var.SetDataSource(config.DataSet_report12)


        If PDF_CONVERTER.CONVERT = True Then

                PDF_CONVERTER.Invoice_Report_Var.Refresh()
                PDF_CONVERTER.Invoice_Report_Var.Export()
                Response.ClearContent()
                Response.ClearHeaders()
                Response.ContentType = "application/pdf"
                Response.WriteFile(Fname)
                Response.Flush()
                Response.Close()
                System.IO.File.Delete(Fname)
               
        End If

        Else
            config.DataSet_report12.Dispose()
            Session.Abandon()
            Response.Redirect("subscript_validation.aspx")

        End If

    End Sub

End Class
