Example #1
0
    protected void PDFPrintButton_Click(object sender, EventArgs e)
    {
        PerformSearch();

        try
        {
            rsm = new ReportSourceManager();
            rsm.LoadDataSet(ds);
            rsm.LoadCompanyInfo(elt_account_number, Server.MapPath("../../ClientLogos/" + elt_account_number + ".jpg"));
            rsm.LoadOtherInfo(AddFilter());
            rsm.WriteXSD(Server.MapPath("../../CrystalReportResources/xsd/customer_recap.xsd"));
            rsm.BindNow(Server.MapPath("../../CrystalReportResources/rpt/customer_recap.rpt"));
            Response.Clear();
            Response.Buffer      = true;
            Response.ContentType = "application/pdf";
            Response.AddHeader("Content-Type", "application/pdf");
            Response.AddHeader("Content-disposition", "attachment;filename=customer_recap_" + System.DateTime.Today.ToString("yyyy-MM-dd") + ".pdf");

            MemoryStream oStream;
            oStream = (MemoryStream)rsm.getReportDocument().ExportToStream(ExportFormatType.PortableDocFormat);
            Response.BinaryWrite(oStream.ToArray());
        }
        catch { }
        finally
        {
            rsm.CloseReportDocumnet();
            Response.Flush();
            Response.End();
        }
    }
Example #2
0
        private void LoadReport()
        {
            rsm = new ReportSourceManager();
            DataColumn col = null;

            string[] str = new string[10];

            str[0] = Session["Accounting_sPeriod"].ToString();
            str[1] = Request.Cookies["CurrentUserInfo"]["login_name"];
            str[2] = Session["PNLkey"].ToString();
            string rsType = Request.QueryString["rs"];

            string elt_num = Request.Cookies["CurrentUserInfo"]["elt_account_number"];

            try
            {
                rsm.LoadDataSet(ds);
                rsm.LoadCompanyInfo(elt_num, Server.MapPath("../../../ClientLogos/" + elt_num + ".jpg"));
                rsm.LoadOtherInfo(str);
                rsm.WriteXSD(Server.MapPath("../../../CrystalReportResources/xsd/pnl.xsd"));

                rsm.TableRename("Invoice", "cTmp");

                if (!rsm.BindNow(Server.MapPath("../../../CrystalReportResources/rpt/pnl_" + rsType + ".rpt")))
                {
                    Response.Write("failed to bind");
                    Response.End();
                }
            }
            catch (Exception e)
            {
                Response.Write(e.ToString());
                Response.End();
            }
        }
Example #3
0
    protected void SENDMAIL(object sender, EventArgs e)
    {
        PerformSearch();
        string fileLocation = "C://temp//Customer_daily_Recap_" + System.DateTime.Today.ToString("yyyy-MM-dd") + ".pdf";
        string orgNum       = hCustomerAcct.Value.ToString();

        if (orgNum != "" && orgNum != "0")
        {
            try
            {
                File.Delete(fileLocation);
                rsm = new ReportSourceManager();
                rsm.LoadDataSet(ds);
                rsm.LoadCompanyInfo(elt_account_number, Server.MapPath("../../ClientLogos/" + elt_account_number + ".jpg"));
                rsm.LoadOtherInfo(AddFilter());
                rsm.WriteXSD(Server.MapPath("../../CrystalReportResources/xsd/customer_recap.xsd"));
                rsm.BindNow(Server.MapPath("../../CrystalReportResources/rpt/customer_recap.rpt"));
                Response.Clear();
                MemoryStream oStream;
                oStream = (MemoryStream)rsm.getReportDocument().ExportToStream(ExportFormatType.PortableDocFormat);
                FileStream fs = new FileStream(fileLocation, FileMode.CreateNew, FileAccess.Write);
                fs.Write(oStream.ToArray(), 0, oStream.ToArray().Length);
                fs.Close();
                oStream.Close();
            }
            catch { }
            finally
            {
                //rsm.CloseReportDocumnet();
                Response.Flush();
            }
            reload.Value = "Y";
        }
    }