byte[] GetBuffer(XtraReport report)
 {
     using (MemoryStream stream = new MemoryStream()) {
         report.SaveLayout(stream);
         return(stream.ToArray());
     }
 }
Beispiel #2
0
        public void Save()
        {
            // Save the report to a stream.
            MemoryStream stream = new MemoryStream();

            MyReport1.SaveLayout(stream);

            // Prepare the stream for reading.
            stream.Position = 0;

            // Insert the report to a database.
            using (StreamReader sr = new StreamReader(stream))
            {
                Model1 MyContext = new Model1();

                int id = GetMaxId(MyContext) + 1;

                string s = sr.ReadToEnd();
                MyContext.Reports.Add(new Report()
                {
                    Id = id, Report1 = s, ReportName = strReportName
                });
                MyContext.SaveChanges();
            }
        }
Beispiel #3
0
        public static MemoryStream ReportToStream(this XtraReport rapor)
        {
            var stream = new MemoryStream();

            rapor.SaveLayout(stream);
            return(stream);
        }
        public static MemoryStream ReportToStream(this XtraReport rapor)
        {
            var stream = new MemoryStream();

            rapor.SaveLayout(stream);  //rapor dizaynı kayıt edilir
            return(stream);
        }
Beispiel #5
0
 /// <summary>
 /// 获取布局数据
 /// </summary>
 /// <param name="dockManager">停靠管理器</param>
 /// <returns>布局数据</returns>
 public static byte[] GetLayoutData(this XtraReport control)
 {
     using (MemoryStream buffer = new MemoryStream()) {
         control.SaveLayout(buffer);
         return(buffer.ToArray());
     }
 }
        private void _btnDesign_Click(object sender, EventArgs e)
        {
            try
            {
                var ds = DataSourceHelper.GetDataSource(_txtDataSource.Text);
                if (_reportContent == null)
                {
                    var memoryStream = new MemoryStream();
                    var rep          = new XtraReport
                    {
                        DataSource = ds
                    };
                    rep.SaveLayout(memoryStream);
                    _reportContent = memoryStream.ToArray();
                }

                ReportDesignerHelper.ShowDesigner(
                    _reportContent,
                    _txtDataSource.Text,
                    ms => _reportContent = ms);
            }
            catch (Exception ex)
            {
                MessageBoxHelper.Warn(ex.Message);
            }
        }
Beispiel #7
0
        private void CrearModel(string linea)
        {
            var vector = linea.Split(';');

            var report = new XtraReport();

            using (var ms = new MemoryStream(File.ReadAllBytes(_context.ServerMapPath(Path.Combine("~/App_Data/Documentos/", vector[4])))))
            {
                report.LoadLayout(ms);
                report.DataSource = FDocumentosDatasourceReport.CreateReport((TipoDocumentoImpresion)Enum.Parse(typeof(TipoDocumentoImpresion), vector[0]), _context).DataSource;

                using (var stream = new MemoryStream())
                {
                    report.SaveLayout(stream);
                    var model = new DocumentosModel()
                    {
                        Usuario        = Guid.Empty.ToString(),
                        Tipo           = (TipoDocumentoImpresion)Enum.Parse(typeof(TipoDocumentoImpresion), vector[0]),
                        Nombre         = vector[1],
                        Tipoprivacidad = (TipoPrivacidadDocumento)Enum.Parse(typeof(TipoPrivacidadDocumento), vector[2]),
                        Tiporeport     = (TipoReport)Enum.Parse(typeof(TipoReport), vector[3]),
                        Datos          = stream.ToArray(),
                        Defecto        = Funciones.Qbool(vector[5])
                    };

                    _documentosService.SetPreferencia(model.Tipo, new Guid(model.Usuario), model.Tipoprivacidad, model.Tiporeport, model.Nombre, model.Datos, model.Defecto);
                }
            }
        }
        private void NewReport()
        {
            using (XF_ReportNew form = new XF_ReportNew())
            {
                if (form.ShowDialog() == DialogResult.Yes)
                {
                    XtraReport report = new XtraReport();
                    report.CreateDocument(false);

                    using (MemoryStream stream = new MemoryStream())
                    {
                        report.SaveLayout(stream);
                        FileObject rep = new FileObject();
                        rep.FileName        = form.FileName;
                        rep.FileDescription = form.FileDescription;
                        rep.FileExtension   = "repx";
                        rep.FileBlob        = stream.ToArray();
                        this.DbContext.Add(rep);
                        this.DbContext.SaveChanges();

                        report.DisplayName = form.FileName;
                        report.Tag         = rep.FileID;

                        this.Editor.OpenReport(report);
                        this.Editor.ActiveDesignPanel.ReportState = ReportState.Opened;
                    }
                }
            }
        }
        private void SaveReport()
        {
            if (currentREPORT == null)
            {
                return;
            }

            // Save the report to a stream.
            MemoryStream ms = new MemoryStream();

            currentREPORT.SaveLayout(ms);

            // Prepare the stream for reading.
            ms.Position = 0;
            // Insert the report to a database.
            using (StreamReader sr = new StreamReader(ms))
            {
                // Read the report from the stream to a string variable.
                string reportString = sr.ReadToEnd();
                if (currentPROJECT_REPORT == null)
                {
                    currentPROJECT_REPORT = new PROJECT_REPORT();
                    currentPROJECT_REPORT.GUID_PROJECT = currentPROJECT.GUID;
                    currentPROJECT_REPORT.REPORT_TYPE  = currentReportType.ToString();
                    currentPROJECT_REPORT.REPORT       = reportString;
                }
                else
                {
                    currentPROJECT_REPORT.REPORT = reportString;
                }

                collectionViewModel.Save(currentPROJECT_REPORT);
            }
        }
        public override string SetNewData(XtraReport report, string defaultUrl)
        {
            // Save a report to the storage under a new URL.
            // The defaultUrl parameter contains the report display name specified by a user.
            if (CanSetData(defaultUrl))
            {
                SetData(report, defaultUrl);
            }
            else
            {
                using (var session = SessionFactory.Create()) {
                    MemoryStream ms = new MemoryStream();
                    report.SaveLayout(ms);

                    var reportEntity = new ReportEntity(session)
                    {
                        Url    = defaultUrl,
                        Layout = ms.ToArray()
                    };

                    session.CommitChanges();
                }
            }
            return(defaultUrl);
        }
Beispiel #11
0
        public void Should_Load_From_Relative_Base_Path()
        {
            report1.Name = "TestLoad";

            // Save Report (using Full Path)
            report1.SaveLayout(report1FullPath);
            Assert.IsTrue(File.Exists(report1FullPath));

            // Open Report - using Report Storage
            var bytes        = storage.GetData(report1RelativePath);
            var stream       = new MemoryStream(bytes);
            var openedReport = XtraReport.FromStream(stream, true);

            // Assert Opened Properly
            Assert.AreEqual(report1.Name, openedReport.Name);
        }
 public void GivenASubreportExistsAsAFile()
 {
     _subReportFilePath = Helpers.GetNewTempFile() + ".repx";
     Path.GetDirectoryName(_subReportFilePath).Should().NotBeNullOrEmpty();
     var subReport = new XtraReport();
     subReport.SaveLayout(_subReportFilePath);
     File.Exists(_subReportFilePath).Should().BeTrue();
 }
Beispiel #13
0
        public static Stream ToStream(this XtraReport report)
        {
            var stream = new MemoryStream();

            report.SaveLayout(stream);

            return(stream);
        }
Beispiel #14
0
 public static byte[] GetBuffer(this XtraReport xtraReport)
 {
     using (var reportStream = new MemoryStream())
     {
         xtraReport.SaveLayout(reportStream);
         return(reportStream.GetBuffer());
     }
 }
Beispiel #15
0
        public byte[] GetReportLayout(string reportName)
        {
            XtraReport   report       = CreateReportByName(reportName);
            MemoryStream memoryStream = new MemoryStream();

            report.SaveLayout(memoryStream);

            return(memoryStream.ToArray());
        }
Beispiel #16
0
        public void GivenASubreportExistsAsAFile()
        {
            _subReportFilePath = Helpers.GetNewTempFile() + ".repx";
            Path.GetDirectoryName(_subReportFilePath).Should().NotBeNullOrEmpty();
            var subReport = new XtraReport();

            subReport.SaveLayout(_subReportFilePath);
            File.Exists(_subReportFilePath).Should().BeTrue();
        }
Beispiel #17
0
            private void StoreReport(XtraReport report)
            {
                MemoryStream stream = new MemoryStream();

                report.SaveLayout(stream);
                if (panel.ReportState == ReportState.Changed)
                {
                    _saveAction(stream.ToArray());
                }
            }
Beispiel #18
0
        public override byte[] GetData(string url)
        {
            Type       reportType = Type.GetType(url);
            XtraReport report     = (XtraReport)Activator.CreateInstance(reportType);

            using (MemoryStream ms = new MemoryStream()) {
                report.SaveLayout(ms);
                return(ms.ToArray());
            }
        }
Beispiel #19
0
    public override string SetNewData(XtraReport report, string defaultUrl)
    {
        try
        {
            //Dim reportPath As String = (storagePath & defaultUrl) + ".resx"
            //Dim filePath As String = GetPath(reportPath)
            string filePath = GetPath(defaultUrl);
            //string filePath = GetPath(defaultUrl);
            // throw new NotSupportedException("Saving is not allowed."); //Comment this line to enable saving
            report.SaveLayout(filePath, true);

            //int MenuID = 0;
            //string str_Query = "select max(mnu_id) as mnu_id from l_menu ";
            //dynamic dt_EmpID = null; // DbInteract.Get_DataTable(str_Query);
            //if (dt_EmpID != null)
            //{
            //    if ((dt_EmpID.Rows.Count > 0))
            //    {
            //        MenuID = dt_EmpID.Rows(0)("mnu_id");
            //        MenuID = MenuID + 1;
            //    }
            //}

            //string qry_ReportExists = "select * from l_menu where title=N'" + defaultUrl + "' ";
            //dynamic dt_report = null; //DbInteract.Get_DataTable(qry_ReportExists);
            //if (dt_report != null)
            //{
            //    if ((dt_report.Rows.Count == 0))
            //    {
            //        str_Query = "insert into l_menu(pid, mnu_id, title, img_file, page_url, menu_type, menu_header, Content_Type, Target, So, isDel, Cdt, Cby, Mby,defaultreport, PublishedReport, Menu_Rights)" + "VALUES(141," + MenuID + ",N'" + defaultUrl + "','default.jpg','~/AppAdmin/DevExReport.aspx',3,N'" + defaultUrl + "',NULL,0,1000,0,GETDATE(),NULL,0,0,0,0)";
            //    }
            //    else {
            //        str_Query = "update l_menu set img_file='default.jpg', page_url ='~/AppAdmin/DevExReport.aspx',  menu_header = N'" + defaultUrl + "' where title = N'" + defaultUrl + "'";
            //    }


            //    string constr = "";// DbInteract.get_ConnLMS;
            //    SqlConnection con = new SqlConnection(constr);
            //    SqlCommand cmd = new SqlCommand(str_Query, con);
            //    cmd.CommandType = CommandType.Text;
            //    con.Open();
            //    cmd.ExecuteNonQuery();
            //    con.Close();

            //}
            return(filePath);
        }
        catch (Exception ex)
        {
            //Pass readable exception message to the Web Report Designer
            throw null;
        }
    }
        public override void SetData(XtraReport report, string url)
        {
            // Write a report to the storage under the specified URL.
            using (var session = SessionFactory.Create()) {
                var reportEntity = session.GetObjectByKey <ReportEntity>(url);

                MemoryStream ms = new MemoryStream();
                report.SaveLayout(ms);
                reportEntity.Layout = ms.ToArray();

                session.CommitChanges();
            }
        }
        public static MyReportBase CloneLayoutAsMyReportBase(this XtraReport report)
        {
            var stream = new MemoryStream();

            report.SaveLayout(stream);
            stream.Position = 0;

            var newReport = new MyReportBase();

            newReport.LoadLayout(stream);
            newReport.DataSource = report.DataSource;

            return(newReport);
        }
Beispiel #22
0
        void UpdateView()
        {
            XtraReport   report  = xrDesignPanel1.Report;
            XtraReport   report2 = new XtraReport();
            MemoryStream ms      = new MemoryStream();

            report.SaveLayout(ms);
            ms.Seek(0, SeekOrigin.Begin);
            report2.LoadLayout(ms);
            report2.DataSource = report.DataSource;
            report2.CreateDocument();

            printControl1.PrintingSystem = report2.PrintingSystem;
            printControl1.ExecCommand(DevExpress.XtraPrinting.PrintingSystemCommand.ZoomToWholePage);
        }
Beispiel #23
0
    public override void SetData(XtraReport report, string url)
    {
        try
        {
            // string storagePath = Context.Server.MapPath(@"~\ReportStorage\");
            //Dim reportPath As String = (storagePath & url) + ".resx"
            //Dim filePath As String = GetPath(reportPath)
            string filePath = GetPath(url);

            //string filePath = GetPath(url);
            //throw new NotSupportedException("Saving is not allowed."); //Comment this line to enable saving
            report.SaveLayout(filePath, true);
        }
        catch (Exception ex)
        {
            //Pass readable exception message to the Web Report Designer
            // throw new FaultException(ex.Message);
        }
    }
Beispiel #24
0
        //  public XRDesignFormEx xrd = new XRDesignFormEx();
        public MyReport(XtraReport xr, string filePath, bool flag)
        {
            SplashScreenManager.ShowForm(typeof(WaitForm1));
            string root = @"C:/jdk/reports";

            if (File.Exists(Path.Combine(root, filePath)))
            {
                object ds = xr.DataSource;
                xr = new XtraReport();
                xr.LoadLayout(Path.Combine(root, filePath));
                xr.DataSource = ds;
            }
            SplashScreenManager.CloseForm();
            if (flag == false)
            {
                xr.ShowPreviewDialog();
                return;
            }

            XRDesignFormEx xrd = new XRDesignFormEx();

            xrd.FormClosing += (s, e) =>
            {
                if (!Directory.Exists(root))
                {
                    Directory.CreateDirectory(root);
                }
                xr.SaveLayout(Path.Combine(root, filePath));
            };
            xrd.ReportStateChanged += (s, e) =>
            {
                if (e.ReportState == ReportState.Changed)
                {
                    ((XRDesignFormEx)s).DesignPanel.ReportState = ReportState.Saved;
                }
            };
            xrd.OpenReport(xr);
            xrd.ShowDialog();
            xrd.Dispose();
        }
Beispiel #25
0
        public override void SetData(XtraReport report, string url)
        {
            if (!_reportIdRegex.IsMatch(url))
            {
                return;
            }

            _user    = GetCustomPrincipal();
            _service = new DocumentosUsuarioService(MarfilEntities.ConnectToSqlServer(_user.BaseDatos));
            // Write a report to the storage under the specified URL.
            using (var stream = new MemoryStream())
            {
                TipoDocumentoImpresion TipoDocumentoImpresion;
                Guid   usuario;
                string name;

                DocumentosUsuarioService.GetFromCustomId(url, out TipoDocumentoImpresion, out usuario, out name);
                report.Name        = url;
                report.DisplayName = name;
                report.SaveLayout(stream);
                //_service.SetPreferencia(TipoDocumentoImpresion, usuario, name, stream.ToArray());
            }
        }
Beispiel #26
0
        public override string SetNewData(XtraReport report, string defaultUrl)
        {
            if (_reportIdRegex.IsMatch(defaultUrl))
            {
                throw new Exception("No se pude guardar el nuevo report");
            }

            _user    = GetCustomPrincipal();
            _service = new DocumentosUsuarioService(MarfilEntities.ConnectToSqlServer(_user.BaseDatos));
            using (var stream = new MemoryStream())
            {
                var objTag = report.Name;
                var vector = objTag.Split(';');
                var TipoDocumentoImpresion = (TipoDocumentoImpresion)Enum.Parse(typeof(TipoDocumentoImpresion), vector[1]);
                var usuario  = new Guid(vector[0]);
                var idReport = DocumentosUsuarioService.CreateCustomId(TipoDocumentoImpresion, usuario, defaultUrl);
                report.Name        = idReport;
                report.DisplayName = defaultUrl;
                report.SaveLayout(stream);
                //_service.SetPreferencia(TipoDocumentoImpresion, usuario, defaultUrl, stream.ToArray());
                return(idReport);
            }
        }
Beispiel #27
0
        public DevExpress.XtraReports.UI.XtraReport Optener_reporte(tb_Comprobante_Info InfoCbte, ref string mensajeErrorOut)
        {
            try
            { // consulto si hay reporte guardado para esa empresa por documento
                Info = data_.consultar_tipo(InfoCbte.IdEmpresa, Convert.ToString(InfoCbte.IdTipoDocumento), ref mensajeErrorOut);
                //**********************

                tb_Comprobante_Data DataCbte = new tb_Comprobante_Data();
                XtraReport          Reporte  = new XtraReport();
                Image Logo = null;

                Instanciando_clases_reporte(InfoCbte.IdEmpresa, ref mensajeErrorOut);


                #region Opteniendo Logo

                var q = from c in listEmpresa
                        where c.IdEmpresa == InfoCbte.IdEmpresa
                        select c;


                foreach (var item in q)
                {
                    Logo = Funciones.ArrayAImage(item.logo);
                }

                #endregion


                switch (InfoCbte.IdTipoDocumento)
                {
                case "01":
                    factura_Ride_Info InfoFactura = new factura_Ride_Info();

                    //  si no esta guardado el reporte en la bd
                    if (Info.ReporteBy == null)
                    {
                        InfoFactura      = DataCbte.consultar_Factura_ride(InfoCbte.IdEmpresa, InfoCbte.IdComprobante, InfoCbte.IdTipoDocumento, InfoCbte.IdEstado_cbte, ref mensajeErrorOut);
                        InfoFactura.Logo = Logo;
                        InfoFactura.numeros_en_letras = funciones.NumeroALetras(InfoFactura.factura.infoFactura.importeTotal.ToString());

                        Reporte = OBusReporteFactura.Optener_reporte(InfoFactura);
                        using (MemoryStream stream = new MemoryStream())
                        {
                            byte[] data;
                            Reporte.SaveLayout(stream);
                            data = stream.ToArray();



                            // grabar bd
                            InfoComprobanteem.IdEmpresa          = InfoCbte.IdEmpresa;
                            InfoComprobanteem.idComprobante_tipo = InfoCbte.IdTipoDocumento;
                            InfoComprobanteem.File_disenio_rpt   = data;
                            IBusComprobanteem.ModificarDB(InfoComprobanteem, ref mensajeErrorOut);
                        }
                    }
                    else
                    {
                        InfoFactura      = DataCbte.consultar_Factura_ride(InfoCbte.IdEmpresa, InfoCbte.IdComprobante, InfoCbte.IdTipoDocumento, InfoCbte.IdEstado_cbte, ref mensajeErrorOut);
                        InfoFactura.Logo = Logo;
                        InfoFactura.numeros_en_letras = funciones.NumeroALetras(InfoFactura.factura.infoFactura.importeTotal.ToString());
                        File.WriteAllBytes(Ruta_Reporte_Fac, Info.ReporteBy);
                        Reporte = OBusReporteFactura.Optener_reporte(InfoFactura);
                        Reporte.LoadLayout(Ruta_Reporte_Fac);
                    }



                    break;

                case "04":
                    notaCredito_Ride_Info InfoNotaCred = new notaCredito_Ride_Info();
                    //  si no esta guardado el reporte en la bd
                    if (Info.ReporteBy == null)
                    {
                        InfoNotaCred = DataCbte.consultar_NotaCredito_Ride(InfoCbte.IdEmpresa, InfoCbte.IdComprobante, InfoCbte.IdTipoDocumento, InfoCbte.IdEstado_cbte, ref mensajeErrorOut);
                        InfoNotaCred.numeros_en_letras = funciones.NumeroALetras(InfoNotaCred.notaCredito.infoNotaCredito.valorModificacion.ToString());
                        InfoNotaCred.Logo = Logo;
                        Reporte           = OBusReporteNotaCred.Optener_reporte(InfoNotaCred);
                        using (MemoryStream stream = new MemoryStream())
                        {
                            byte[] data;
                            Reporte.SaveLayout(stream);
                            data = stream.ToArray();
                            // grabar bd
                            InfoComprobanteem.IdEmpresa          = InfoCbte.IdEmpresa;
                            InfoComprobanteem.idComprobante_tipo = InfoCbte.IdTipoDocumento;
                            InfoComprobanteem.File_disenio_rpt   = data;
                            IBusComprobanteem.ModificarDB(InfoComprobanteem, ref mensajeErrorOut);
                        }
                    }
                    else
                    {
                        InfoNotaCred      = DataCbte.consultar_NotaCredito_Ride(InfoCbte.IdEmpresa, InfoCbte.IdComprobante, InfoCbte.IdTipoDocumento, InfoCbte.IdEstado_cbte, ref mensajeErrorOut);
                        InfoNotaCred.Logo = Logo;
                        InfoNotaCred.numeros_en_letras = funciones.NumeroALetras(InfoNotaCred.notaCredito.infoNotaCredito.valorModificacion.ToString());

                        File.WriteAllBytes(Ruta_Reporte_NC, Info.ReporteBy);
                        Reporte = OBusReporteNotaCred.Optener_reporte(InfoNotaCred);
                        Reporte.LoadLayout(Ruta_Reporte_NC);
                    }

                    break;

                case "05":
                    notaDebito_Ride_Info InfoNotaDeb = new notaDebito_Ride_Info();

                    //  si no esta guardado el reporte en la bd
                    if (Info.ReporteBy == null)
                    {
                        InfoNotaDeb = DataCbte.consultar_NotaDebito(InfoCbte.IdEmpresa, InfoCbte.IdComprobante, InfoCbte.IdTipoDocumento, InfoCbte.IdEstado_cbte, ref mensajeErrorOut);
                        InfoNotaDeb.numeros_en_letras = funciones.NumeroALetras(InfoNotaDeb.notaDebito.infoNotaDebito.valorTotal.ToString());

                        InfoNotaDeb.Logo = Logo;
                        Reporte          = OBusReporteNotaDeb.Optener_reporte(InfoNotaDeb);
                        using (MemoryStream stream = new MemoryStream())
                        {
                            byte[] data;
                            Reporte.SaveLayout(stream);
                            data = stream.ToArray();
                            // grabar bd
                            InfoComprobanteem.IdEmpresa          = InfoCbte.IdEmpresa;
                            InfoComprobanteem.idComprobante_tipo = InfoCbte.IdTipoDocumento;
                            InfoComprobanteem.File_disenio_rpt   = data;
                            IBusComprobanteem.ModificarDB(InfoComprobanteem, ref mensajeErrorOut);
                        }
                    }
                    else
                    {
                        InfoNotaDeb      = DataCbte.consultar_NotaDebito(InfoCbte.IdEmpresa, InfoCbte.IdComprobante, InfoCbte.IdTipoDocumento, InfoCbte.IdEstado_cbte, ref mensajeErrorOut);
                        InfoNotaDeb.Logo = Logo;
                        InfoNotaDeb.numeros_en_letras = funciones.NumeroALetras(InfoNotaDeb.notaDebito.infoNotaDebito.valorTotal.ToString());

                        File.WriteAllBytes(Ruta_Reporte_ND, Info.ReporteBy);
                        Reporte = OBusReporteNotaDeb.Optener_reporte(InfoNotaDeb);
                        Reporte.LoadLayout(Ruta_Reporte_ND);
                    }



                    break;

                case "06":
                    guiaRemision_Ride_Info InfoGuia = new guiaRemision_Ride_Info();


                    //  si no esta guardado el reporte en la bd
                    if (Info.ReporteBy == null)
                    {
                        InfoGuia      = DataCbte.consultar_Guia(InfoCbte.IdEmpresa, InfoCbte.IdComprobante, InfoCbte.IdTipoDocumento, InfoCbte.IdEstado_cbte, ref mensajeErrorOut);
                        InfoGuia.Logo = Logo;
                        Reporte       = OBusReporteGuia_Remi.Optener_reporte(InfoGuia);
                        using (MemoryStream stream = new MemoryStream())
                        {
                            byte[] data;
                            Reporte.SaveLayout(stream);
                            data = stream.ToArray();
                            // grabar bd
                            InfoComprobanteem.IdEmpresa          = InfoCbte.IdEmpresa;
                            InfoComprobanteem.idComprobante_tipo = InfoCbte.IdTipoDocumento;
                            InfoComprobanteem.File_disenio_rpt   = data;
                            IBusComprobanteem.ModificarDB(InfoComprobanteem, ref mensajeErrorOut);
                        }
                    }
                    else
                    {
                        InfoGuia      = DataCbte.consultar_Guia(InfoCbte.IdEmpresa, InfoCbte.IdComprobante, InfoCbte.IdTipoDocumento, InfoCbte.IdEstado_cbte, ref mensajeErrorOut);
                        InfoGuia.Logo = Logo;
                        File.WriteAllBytes(Ruta_Reporte_Guia, Info.ReporteBy);
                        Reporte = OBusReporteGuia_Remi.Optener_reporte(InfoGuia);
                        Reporte.LoadLayout(Ruta_Reporte_Guia);
                    }



                    break;

                case "07":
                    comprobanteRetencion_Ride_Info InfoCbteRet = new comprobanteRetencion_Ride_Info();

                    //  si no esta guardado el reporte en la bd
                    if (Info.ReporteBy == null)
                    {
                        InfoCbteRet      = DataCbte.consultar_Retencion(InfoCbte.IdEmpresa, InfoCbte.IdComprobante, InfoCbte.IdTipoDocumento, InfoCbte.IdEstado_cbte, ref mensajeErrorOut);
                        InfoCbteRet.Logo = Logo;
                        Reporte          = OBusReporteRetencion.Optener_reporte(InfoCbteRet);
                        using (MemoryStream stream = new MemoryStream())
                        {
                            byte[] data;
                            Reporte.SaveLayout(stream);
                            data = stream.ToArray();
                            // grabar bd
                            InfoComprobanteem.IdEmpresa          = InfoCbte.IdEmpresa;
                            InfoComprobanteem.idComprobante_tipo = InfoCbte.IdTipoDocumento;
                            InfoComprobanteem.File_disenio_rpt   = data;
                            IBusComprobanteem.ModificarDB(InfoComprobanteem, ref mensajeErrorOut);
                        }
                    }
                    else
                    {
                        InfoCbteRet      = DataCbte.consultar_Retencion(InfoCbte.IdEmpresa, InfoCbte.IdComprobante, InfoCbte.IdTipoDocumento, InfoCbte.IdEstado_cbte, ref mensajeErrorOut);
                        InfoCbteRet.Logo = Logo;
                        File.WriteAllBytes(Ruta_Reporte_Ret, Info.ReporteBy);
                        Reporte = OBusReporteRetencion.Optener_reporte(InfoCbteRet);
                        Reporte.LoadLayout(Ruta_Reporte_Ret);
                    }


                    break;
                }

                return(Reporte);
            }
            catch (Exception ex)
            {
                return(new XtraReport());
            }
        }
Beispiel #28
0
        private byte[] AddCollectionDataSource(byte[] content, string typeName)
        {
            XtraReport report = new XtraReport();

            using (MemoryStream stream = new MemoryStream(content))
            {
                report.LoadLayout(stream);
            }

            report.DataSource = new CollectionDataSource() { ObjectTypeName = typeName, Name = "collectionDataSource" };

            using (MemoryStream stream = new MemoryStream())
            {
                report.SaveLayout(stream);
                return stream.ToArray();
            }
        }
        private void NewReport()
        {
            using (XF_ReportNew form = new XF_ReportNew())
            {
                if (form.ShowDialog() == DialogResult.Yes)
                {
                    XtraReport report = new XtraReport();
                    report.CreateDocument(false);

                    using (MemoryStream stream = new MemoryStream())
                    {
                        report.SaveLayout(stream);
                        FileObject rep = new FileObject();
                        rep.FileName = form.FileName;
                        rep.FileDescription = form.FileDescription;
                        rep.FileExtension = "repx";
                        rep.FileBlob = stream.ToArray();
                        this.DbContext.Add(rep);
                        this.DbContext.SaveChanges();

                        report.DisplayName = form.FileName;
                        report.Tag = rep.FileID;

                        this.Editor.OpenReport(report);
                        this.Editor.ActiveDesignPanel.ReportState = ReportState.Opened;
                    }
                }
            }
        }