Exemplo n.º 1
0
        public ActionResult ISR020_GetChangeSlipData(string strSlipNo)
        {
            IReportHandler         reportHandler = ServiceContainer.GetService <IReportHandler>() as IReportHandler;
            List <RPTChangeSlipDo> rptList       = reportHandler.GetRptChangeSlipReport(strSlipNo);

            IDocumentHandler            dochandler = ServiceContainer.GetService <IDocumentHandler>() as IDocumentHandler;
            List <tbm_DocumentTemplate> dLst       = dochandler.GetDocumentTemplateByDocumentCode(DocumentCode.C_DOCUMENT_CODE_CHANGE_INSTALL_SLIP);

            ReportDocument rptH = new ReportDocument();
            //string path = ReportUtil.GetReportTemplatePath("ISR020_ChangeInstallationSlip.rpt");
            string path = ReportUtil.GetReportPath("Reports/ISR020_ChangeInstallationSlip.rpt", Server.MapPath("/"));

            rptH.Load(path);
            List <RPTChangeSlipDo> lst = new List <RPTChangeSlipDo>();

            if (rptList != null && rptList.Count > 0)
            {
                lst.Add(rptList[0]);

                if (dLst.Count > 0)
                {
                    lst[0].DocumentNameEN  = dLst[0].DocumentNameEN;
                    lst[0].DocumentVersion = dLst[0].DocumentVersion;
                }
            }
            else
            {
                rptList.Add(new RPTChangeSlipDo());
            }

            rptH.SetDataSource(lst);
            rptH.Subreports["Page1"].SetDataSource(rptList);
            rptH.Subreports["Page2"].SetDataSource(rptList);
            rptH.Subreports["Page3"].SetDataSource(rptList);

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

            rptH.Close();

            return(File(stream, "application/pdf"));
        }