Ejemplo n.º 1
0
        public void CreateReport(string id)
        {
            string KH      = (String)id;
            string KH_ID   = KH.Substring(2);
            var    results = (from sup1 in data.Inf_Customers
                              join sup2 in data.Inf_Repair on sup1.Customer_Id equals sup2.Customer_Id
                              join sup3 in data.Detail_Inf_Repair on sup2.Repair_Id equals sup3.Repair_Id
                              where sup1.Customer_Id == "KH" + KH_ID
                              select new { sup1.Customer_Name, sup1.Customer_Phone, sup2.Detail_Inf_Repair.Repair_Money, sup2.Laptop_Name, sup2.Repair_Id });
            CrystalReport5 rp = new CrystalReport5();

            rp.SetDataSource(results);
            crystalReportViewer1.ReportSource = rp;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Download PDF of loan's installments
        /// </summary>
        /// <returns></returns>
        public ActionResult ExportLoanInstallments()
        {
            List <Installement> allCustomer = new List <Installement>();

            allCustomer = db.Installements.ToList();


            CrystalReport5 rd = new CrystalReport5();

            rd.Load(Path.Combine(Server.MapPath("~/CrystalReports"), "ReportCustomer.rpt"));

            rd.SetDataSource(allCustomer);

            Response.Buffer = false;
            Response.ClearContent();
            Response.ClearHeaders();


            Stream stream = rd.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);

            stream.Seek(0, SeekOrigin.Begin);
            return(File(stream, "application/pdf", "ViewInstallment.pdf"));
        }