Example #1
0
    protected void btnOpenReport_Click(object sender, EventArgs e)
    {
        Save_Schedule();
        Load_Current_Schedules();
        if (ViewState["ScheduleID"] == null)
        {
            string js = "ald()";
            ScriptManager.RegisterStartupScript(this, this.GetType(), "ValidateAllJS", js, true);
            UpdatePanel_Routine.UpdateMode = UpdatePanelUpdateMode.Conditional;
            UpdatePanel_Routine.Update();
            return;
        }



        DataTable dt         = BLL_Infra_DaemonSettings.Generate_Report(Convert.ToInt32(ViewState["ScheduleID"]));
        string    htmlString = dt.Rows[0].ItemArray[0].ToString();

        string filepath = Server.MapPath("~/Uploads/Temp/");

        string filename = "WorkListReport" + DateTime.Now.Day + DateTime.Now.Month + DateTime.Now.Second + DateTime.Now.Millisecond + ".pdf";

        string filenamewithpath = filepath + filename;


        EO.Pdf.HtmlToPdf.ConvertHtml(htmlString, filenamewithpath);

        ResponseHelper.Redirect("~/Uploads/Temp/" + filename, "blank", "");
    }
Example #2
0
    protected void btnPOReport_Click(object sender, EventArgs e)
    {
        Save_Schedule();
        Load_Current_Schedules();
        if (ViewState["ScheduleID"] == null)
        {
            string js = "ald()";
            ScriptManager.RegisterStartupScript(this, this.GetType(), "ValidateAllJS", js, true);
            UpdatePanel_Routine.UpdateMode = UpdatePanelUpdateMode.Conditional;
            UpdatePanel_Routine.Update();
            return;
        }

        DataTable dt         = BLL_Infra_DaemonSettings.Generate_PO_Report(Convert.ToInt32(ViewState["ScheduleID"]));
        string    htmlString = dt.Rows[0].ItemArray[0].ToString();

        System.IO.StreamWriter excelDoc;
        excelDoc = new System.IO.StreamWriter(System.IO.Path.Combine(Server.MapPath("~") + @"\" + "Uploads/Purchase/", "POReport_" + DateTime.Now.Day + "-" + DateTime.Now.Month + "-" + DateTime.Now.Year + "_" + DateTime.Now.Hour + "h" + DateTime.Now.Minute + "m" + DateTime.Now.Second + "s" + ".xls"));
        excelDoc.Write(htmlString);
        excelDoc.Close();
        excelDoc.Dispose();
        ResponseHelper.Redirect("~/Uploads/Purchase/" + "POReport_" + DateTime.Now.Day + "-" + DateTime.Now.Month + "-" + DateTime.Now.Year + "_" + DateTime.Now.Hour + "h" + DateTime.Now.Minute + "m" + DateTime.Now.Second + "s" + ".xls", "blank", "");
    }