private void simpleAction_AddReportData_Execute(object sender, SimpleActionExecuteEventArgs e)
        {
            var form = new XRDesignRibbonFormEx();

            form.DesignPanel.DesignerHostLoaded += DesignPanel_DesignerHostLoaded;
            ViewCurrentObject.CreateDataSourceFromXml();
            var xml = ViewCurrentObject.ReportDataXml;

            if (string.IsNullOrEmpty(xml))
            {
                form.DesignPanel.ExecCommand(ReportCommand.NewReport);
                var result = form.ShowDialog();
            }
            else
            {
                var report = new DevExpress.XtraReports.UI.XtraReport();
                ViewCurrentObject.AddDataSource2Report(report);

                using (var ms = new MemoryStream())
                {
                    using (var sr = new StreamWriter(ms, Encoding.Default))
                    {
                        var doc = new XmlDocument();
                        doc.LoadXml(xml);
                        var definitionXml = doc.OuterXml;
                        sr.Write(definitionXml);
                        sr.Flush();
                        ms.Position = 0;
                        report.LoadLayoutFromXml(ms);
                        form.DesignPanel.OpenReport(report);
                        form.ShowDialog();
                    }
                }
            }
        }
Example #2
0
        private void barManager1_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            Form f = null;

            switch ((string)e.Item.Tag)
            {
            case "print":
                DevExpress.XtraReports.UI.XtraReport r = this.GetReport();
                if (r != null)
                {
                    r.ShowPreviewDialog();
                }
                break;

            case "pro":
                f = this.GetProViewForm();
                (f as BaseViewForm).ShowDialog(this);
                break;

            case "next":
                f = this.GetNextViewForm();
                (f as BaseViewForm).ShowDialog(this);
                break;

            default:
                break;
            }
        }
        public override string SetNewData(DevExpress.XtraReports.UI.XtraReport report, string defaultUrl)
        {
            using (MemoryStream ms = new MemoryStream())
            {
                report.SaveLayoutToXml(ms);
                if (!unitOfWork.TemplatesRepo.Fetch(m => m.ReportName == defaultUrl).Any())
                {
                    report.SaveLayoutToXml(ms);
                    unitOfWork.TemplatesRepo.Insert(new Models.Templates()
                    {
                        ReportName = defaultUrl,
                        Template   = ms.ToArray()
                    });
                    unitOfWork.Save();
                }
                else
                {
                    report.SaveLayoutToXml(ms);

                    var model = unitOfWork.TemplatesRepo.Find(m => m.ReportName == defaultUrl);
                    model.Template = ms.GetBuffer();
                    unitOfWork.Save();
                }
            }
            return(unitOfWork.TemplatesRepo.Find().ReportName.ToString());
        }
Example #4
0
 void LoadReport(ReportTemplateInfo info)
 {
     _template = DataProcessor.GetReportTemplate(info.TypeCodes[0], info.Code);
     DevExpress.XtraReports.UI.XtraReport report = DevExpress.XtraReports.UI.XtraReport.FromStream(new System.IO.MemoryStream(_template.TemplateContent, true), true);
     xrDesignMdiController1.OpenReport(report);
     //template.
 }
Example #5
0
        private void ImprimirBoletasdeInventario()
        {
            DevExpress.XtraReports.UI.XtraReport report = DevExpress.XtraReports.UI.XtraReport.FromFile("./Reportes/rptBoletasInv.repx", true);

            SqlDataSource sqlDataSource = report.DataSource as SqlDataSource;

            SqlDataSource ds = report.DataSource as SqlDataSource;

            ds.ConnectionName = "sqlDataSource1";
            String sNameConexion = (Security.Esquema.Compania == "CEDETSA") ? "StringConCedetsa" : "StringConDasa";

            System.Data.SqlClient.SqlConnectionStringBuilder builder = new System.Data.SqlClient.SqlConnectionStringBuilder(System.Configuration.ConfigurationManager.ConnectionStrings[sNameConexion].ConnectionString);
            ds.ConnectionParameters = new DevExpress.DataAccess.ConnectionParameters.MsSqlConnectionParameters(builder.DataSource, builder.InitialCatalog, builder.UserID, builder.Password, MsSqlAuthorizationType.SqlServer);

            // Obtain a parameter, and set its value.
            report.Parameters["IDBodega"].Value            = Convert.ToInt32(GetDefaultValue(this.slkupBodega));
            report.Parameters["IDProducto"].Value          = Convert.ToInt32(GetDefaultValue(this.slkupProducto));
            report.Parameters["Clasif1"].Value             = Convert.ToInt32(GetDefaultValue(this.slkupClasif1));
            report.Parameters["Clasif2"].Value             = Convert.ToInt32(GetDefaultValue(this.slkupClasif2));
            report.Parameters["Clasif3"].Value             = Convert.ToInt32(GetDefaultValue(this.slkupClasif3));
            report.Parameters["Clasif4"].Value             = Convert.ToInt32(GetDefaultValue(this.slkupClasif4));
            report.Parameters["Clasif5"].Value             = Convert.ToInt32(GetDefaultValue(this.slkupClasif5));
            report.Parameters["Clasif6"].Value             = Convert.ToInt32(GetDefaultValue(this.slkupClasif6));
            report.Parameters["ConsolidaByProducto"].Value = Convert.ToBoolean(swichtAgrupa.EditValue);


            // Show the report's print preview.
            DevExpress.XtraReports.UI.ReportPrintTool tool = new DevExpress.XtraReports.UI.ReportPrintTool(report);

            tool.ShowPreview();
        }
        void RaporOnizleme(bool Disigner)
        {
            string exedizini    = Path.GetDirectoryName(Application.ExecutablePath);
            string RaporDosyasi = "Rapor.repx";

            DevExpress.XtraReports.UI.XtraReport rapor = new DevExpress.XtraReports.UI.XtraReport();
            RaporDosyasi = exedizini + "\\Raporlar\\KasaHareketRaporu.repx";
            //rapor.DataSource = gCPerHareketleri.DataSource;
            //rapor.CreateDocument();
            if (!File.Exists(RaporDosyasi))
            {
                Print(); return;
            }
            rapor.LoadLayout(RaporDosyasi);
            rapor.FindControl("xlKasaAdi", true).Text = lueKasa.Text + " " + ilkdate.DateTime.ToString("dd.MM.yyyy") +
                                                        "-" + sondate.DateTime.ToString("dd.MM.yyyy");
            if (Disigner)
            {
                rapor.ShowDesignerDialog();
            }
            else
            {
                rapor.ShowRibbonPreview();
            }
        }
Example #7
0
        private void SaveReport(DevExpress.XtraReports.UI.XtraReport r)
        {
            MemoryStream stream = new MemoryStream();

            r.SaveLayout(stream);
            DataLib.DataHelper myHelper = new DataLib.DataHelper();
            DataSet            ds       = myHelper.GetDs("select * from t_Report where FType = '" + this.Name + "'");
            DataRow            dr       = null;

            if (ds.Tables[0].Rows.Count == 0)
            {
                dr             = ds.Tables[0].NewRow();
                dr["FType"]    = this.Name;
                dr["FName"]    = this.Text;
                dr["FReport"]  = stream.ToArray();
                dr["FDefault"] = 1;
                ds.Tables[0].Rows.Add(dr);
            }
            else
            {
                dr = ds.Tables[0].Rows[0];
                dr.BeginEdit();
                dr["FReport"] = stream.ToArray();
                dr.EndEdit();
            }

            myHelper.SaveData(ds, "select * from t_Report where FType = '" + this.Name + "'");
        }
        void RaporOnizleme(bool Disigner)
        {
            string exedizini    = Path.GetDirectoryName(Application.ExecutablePath);
            string RaporDosyasi = "Rapor.repx";


            DevExpress.XtraReports.UI.XtraReport rapor = new DevExpress.XtraReports.UI.XtraReport();
            RaporDosyasi     = exedizini + "\\Raporlar\\VardiyaListesi.repx";
            rapor.DataSource = gcVardiya.DataSource;
            //rapor.CreateDocument();
            if (!File.Exists(RaporDosyasi))
            {
                Print(); return;
            }
            rapor.LoadLayout(RaporDosyasi);
            rapor.FindControl("label15", true).Text = lUSirket.Text;
            rapor.FindControl("label16", true).Text = luekurum.Text;
            if (Disigner)
            {
                rapor.ShowDesignerDialog();
            }
            else
            {
                rapor.ShowRibbonPreview();
            }
        }
        void RaporOnizleme(bool Disigner)
        {
            DataRow dr           = gridView1.GetDataRow(gridView1.FocusedRowHandle);
            string  pkSatislar   = dr["pkSatislar"].ToString();
            string  exedizini    = Path.GetDirectoryName(Application.ExecutablePath);
            string  RaporDosyasi = "Rapor.repx";

            //xrBarkod Barkod = new xrBarkod();
            DevExpress.XtraReports.UI.XtraReport Barkod = new DevExpress.XtraReports.UI.XtraReport();
            string sql = @"SELECT sk.pkStokKarti,sk.StokKod,sk.Stokadi,sd.Adet,sd.SatisFiyati,sd.iskontotutar,sd.iskontoyuzde,sd.Tarih FROM Satislar s 
inner join SatisDetay sd on sd.fkSatislar=s.pkSatislar
inner join StokKarti sk on sk.pkStokKarti=sd.fkStokKarti
where s.pkSatislar =" + pkSatislar;

            Barkod.DataSource = DB.GetData(sql);

            RaporDosyasi = exedizini + "\\Raporlar\\satisfisia4.repx";
            //rapor.DataSource = gCPerHareketleri.DataSource;
            //rapor.CreateDocument();
            Barkod.LoadLayout(RaporDosyasi);
            //rapor.FindControl("xlKasaAdi", true).Text = lueKasa.Text + " " + ilkdate.DateTime.ToString("dd.MM.yyyy") +
            //    "-" + sondate.DateTime.ToString("dd.MM.yyyy");
            if (Disigner)
            {
                Barkod.ShowDesignerDialog();
            }
            else
            {
                Barkod.ShowRibbonPreview();
            }
        }
        public override string SetNewData(DevExpress.XtraReports.UI.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 TSOUTERREPORT(session)
                    {
                        Url = defaultUrl
                    };
                    this.SaveToFile(reportEntity.Url, ms);
                    session.CommitChanges();
                }
            }
            return(defaultUrl);
        }
Example #11
0
        void ofrmListarFormatos_FormClosed(object sender, FormClosedEventArgs e)
        {
            frmSeleccionFormatoCheque ofrm = (frmSeleccionFormatoCheque)sender;
            String path = Path.Combine(Directory.GetCurrentDirectory(), "FormatosCheques", string.Format("Formato-{0}.repx", ofrm.IDFormato)).ToString();

            DevExpress.XtraReports.UI.XtraReport report = DevExpress.XtraReports.UI.XtraReport.FromFile(path, true);


            SqlDataSource sqlDataSource = report.DataSource as SqlDataSource;

            SqlDataSource ds = report.DataSource as SqlDataSource;

            ds.ConnectionName = "sqlDataSource1";
            String sNameConexion = (Security.Esquema.Compania == "CEDETSA") ? "StringConCedetsa" : "StringConDasa";

            System.Data.SqlClient.SqlConnectionStringBuilder builder = new System.Data.SqlClient.SqlConnectionStringBuilder(System.Configuration.ConfigurationManager.ConnectionStrings[sNameConexion].ConnectionString);
            ds.ConnectionParameters = new DevExpress.DataAccess.ConnectionParameters.MsSqlConnectionParameters(builder.DataSource, builder.InitialCatalog, builder.UserID, builder.Password, MsSqlAuthorizationType.SqlServer);

            // Obtain a parameter, and set its value.
            report.Parameters["Numero"].Value        = Convert.ToInt32(_currentRow["Numero"]);
            report.Parameters["IDCuentaBanco"].Value = Convert.ToInt32(_currentRow["IDCuentaBanco"]);;
            report.Parameters["IDTipo"].Value        = Convert.ToInt32(_currentRow["IDTipo"]);;
            report.Parameters["IDSubTipo"].Value     = Convert.ToInt32(_currentRow["IDSubTipo"]);;

            // Show the report's print preview.
            DevExpress.XtraReports.UI.ReportPrintTool tool = new DevExpress.XtraReports.UI.ReportPrintTool(report);

            tool.ShowPreview();
            SetChequeImpreso();
        }
Example #12
0
        public ActionResult Report()
        {
            // DevExpress.Net.17.2.7 é compativel como .Net Framework 4.5
            //
            // DevExpress.XtraReports.UI.XtraReport -> Dependencias:
            //   Library/DevExpress.Charts.v17.2.Core.dll
            //   Library/DevExpress.Data.v17.2.dll
            //   Library/DevExpress.DataAccess.v17.2.dll
            //   Library/DevExpress.Office.v17.2.Core.dll
            //   Library/DevExpress.Pdf.v17.2.Core.dll
            //   Library/DevExpress.PivotGrid.v17.2.Core.dll
            //   Library/DevExpress.Printing.v17.2.Core.dll
            //   Library/DevExpress.RichEdit.v17.2.Core.dll
            //   Library/DevExpress.RichEdit.v17.2.Export.dll
            //   Library/DevExpress.Sparkline.v17.2.Core.dll
            //   Library/DevExpress.Web.ASPxThemes.v17.2.dll
            //   Library/DevExpress.Web.Mvc5.v17.2.dll
            //   Library/DevExpress.Web.Resources.v17.2.dll
            //   Library/DevExpress.Web.v17.2.dll
            //   Library/DevExpress.Xpo.v17.2.dll
            //   Library/DevExpress.XtraCharts.v17.2.dll
            //   Library/DevExpress.XtraCharts.v17.2.Web.dll
            //   Library/DevExpress.XtraGauges.v17.2.Core.dll
            //   Library/DevExpress.XtraReports.v17.2.dll
            //   Library/DevExpress.XtraReports.v17.2.Web.dll

            // Criando o objeto XtraReport, que representa o relatório.
            DevExpress.XtraReports.UI.XtraReport report = new DevExpress.XtraReports.UI.XtraReport();

            // Arquivo repx que contém o layout do relatório.
            var reportPath = Server.MapPath("~/Reports/XtraReport.repx");

            // Criando um business object com os dados para o relatório.
            var listDataSource = new ArrayList();

            for (int i = 0; i < 200; i++)
            {
                var index = i + 1;

                listDataSource.Add(new ReportProduto
                {
                    ID        = index,
                    Descricao = $"Produto {index.ToString("D2")}",
                    Marca     = $"Marca {index.ToString("D2")}",
                    Foto      = $"Foto {index.ToString("D2")}"
                });
            }

            // Informando para o DataSource do relatório qual será os dados.
            report.DataSource = listDataSource;

            // Configurado o arquivo repx como arquivo de layout.
            report.LoadLayout(reportPath);

            // Passando o XtraReports configurado para a View.
            ViewData["Report1"] = report;

            return(View());
        }
Example #13
0
 private void barButtonItemPrint_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     DevExpress.XtraReports.UI.XtraReport r = this.GetReport();
     if (r != null)
     {
         r.ShowPreviewDialog();
     }
 }
Example #14
0
        private void SetCustomPageQR(DevExpress.XtraReports.UI.XtraReport oReport, String isMauIn = "25_15")
        {
            switch (isMauIn)
            {
            case "25_15":
                oReport.ReportUnit = global::DevExpress.XtraReports.UI.ReportUnit.TenthsOfAMillimeter;

                //PrinterSettingsUsing pst = new PrinterSettingsUsing();

                oReport.PaperKind = System.Drawing.Printing.PaperKind.Custom;
                //oReport.PageSize=new System.Drawing.Size(945,312);
                oReport.PageSize = new System.Drawing.Size(1050, 150);
                oReport.DefaultPrinterSettingsUsing.UsePaperKind = false;
                oReport.DefaultPrinterSettingsUsing.UseLandscape = false;
                oReport.DefaultPrinterSettingsUsing.UseMargins   = false;


                oReport.PrintingSystem.PageSettings.LeftMargin   = 30;
                oReport.PrintingSystem.PageSettings.RightMargin  = 30;
                oReport.PrintingSystem.PageSettings.TopMargin    = 30;
                oReport.PrintingSystem.PageSettings.BottomMargin = 30;

                break;

            case "35_22":
                oReport.ReportUnit = global::DevExpress.XtraReports.UI.ReportUnit.TenthsOfAMillimeter;
                oReport.PaperKind  = System.Drawing.Printing.PaperKind.Custom;
                //oReport.PageSize=new System.Drawing.Size(945,312);
                //oReport.PageSize = new System.Drawing.Size(1050, 220);
                oReport.DefaultPrinterSettingsUsing.UseLandscape = false;
                oReport.DefaultPrinterSettingsUsing.UseMargins   = false;
                oReport.DefaultPrinterSettingsUsing.UsePaperKind = false;

                oReport.PrintingSystem.PageSettings.LeftMargin   = 30;
                oReport.PrintingSystem.PageSettings.RightMargin  = 30;
                oReport.PrintingSystem.PageSettings.TopMargin    = 30;
                oReport.PrintingSystem.PageSettings.BottomMargin = 30;
                oReport.RequestParameters = false;
                break;

            case "30_30":
                oReport.ReportUnit = global::DevExpress.XtraReports.UI.ReportUnit.TenthsOfAMillimeter;
                oReport.PaperKind  = System.Drawing.Printing.PaperKind.Custom;
                oReport.PageSize   = new System.Drawing.Size(945, 312);
                oReport.DefaultPrinterSettingsUsing.UseLandscape = false;
                oReport.DefaultPrinterSettingsUsing.UseMargins   = false;
                oReport.DefaultPrinterSettingsUsing.UsePaperKind = false;
                oReport.RequestParameters = false;

                oReport.PrintingSystem.PageSettings.LeftMargin   = 3;
                oReport.PrintingSystem.PageSettings.RightMargin  = 3;
                oReport.PrintingSystem.PageSettings.TopMargin    = 3;
                oReport.PrintingSystem.PageSettings.BottomMargin = 3;
                break;
            }
        }
 private void SetViewsOptions(DevExpress.XtraReports.UI.XtraReport rpt)
 {
     rpt.PrintingSystem.SetCommandVisibility(DevExpress.XtraPrinting.PrintingSystemCommand.Watermark, DevExpress.XtraPrinting.CommandVisibility.None);
     rpt.PrintingSystem.SetCommandVisibility(DevExpress.XtraPrinting.PrintingSystemCommand.Customize, DevExpress.XtraPrinting.CommandVisibility.None);
     rpt.PrintingSystem.SetCommandVisibility(DevExpress.XtraPrinting.PrintingSystemCommand.ExportXls, DevExpress.XtraPrinting.CommandVisibility.None);
     rpt.PrintingSystem.SetCommandVisibility(DevExpress.XtraPrinting.PrintingSystemCommand.ExportXlsx, DevExpress.XtraPrinting.CommandVisibility.None);
     rpt.PrintingSystem.SetCommandVisibility(DevExpress.XtraPrinting.PrintingSystemCommand.ExportHtm, DevExpress.XtraPrinting.CommandVisibility.None);
     rpt.PrintingSystem.SetCommandVisibility(DevExpress.XtraPrinting.PrintingSystemCommand.SendXls, DevExpress.XtraPrinting.CommandVisibility.None);
     rpt.PrintingSystem.SetCommandVisibility(DevExpress.XtraPrinting.PrintingSystemCommand.SendXlsx, DevExpress.XtraPrinting.CommandVisibility.None);
 }
Example #16
0
        private void simpleButton5_Click(object sender, EventArgs e)
        {
            string exedizini    = Path.GetDirectoryName(Application.ExecutablePath);
            string RaporDosyasi = exedizini + "\\Raporlar\\PersonelMaasOdemeleri.repx";

            DevExpress.XtraReports.UI.XtraReport rapor = new DevExpress.XtraReports.UI.XtraReport();
            rapor.LoadLayout(RaporDosyasi);
            rapor.DataSource = gridControl2.DataSource;
            rapor.ShowRibbonPreview();
        }
        public override void SetData(DevExpress.XtraReports.UI.XtraReport report, string url)
        {
            using (MemoryStream ms = new MemoryStream())
            {
                report.SaveLayoutToXml(ms);

                var model = unitOfWork.TemplatesRepo.Find(m => m.ReportName == url);
                model.Template = ms.GetBuffer();
                unitOfWork.Save();
            }
        }
Example #18
0
        private void btnImprimir_ItemClick_1(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            String path = "";

            if (_currentRow["Asiento"].ToString() != "")
            {
                //Obtener el listado de formatos
                DataSet dsFormatos = CuentaFormatoChequeDAC.GetData(Convert.ToInt32(_currentRow["IDCuentaBanco"]), -1);
                if (dsFormatos.Tables.Count > 0)
                {
                    if (dsFormatos.Tables[0].Rows.Count > 0)
                    {
                        DataTable tmpTable = new DataTable();
                        DataView  dv       = new DataView(dsFormatos.Tables[0]);
                        dv.RowFilter = "Activo=1";
                        tmpTable     = dv.ToTable();
                        if (tmpTable.Rows.Count == 1)
                        {
                            //cargar el formato por defecto
                            path = Path.Combine(Directory.GetCurrentDirectory(), "FormatosCheques", string.Format("Formato-{0}.repx", tmpTable.Rows[0]["IDFormato"].ToString())).ToString();
                            DevExpress.XtraReports.UI.XtraReport report = DevExpress.XtraReports.UI.XtraReport.FromFile(path, true);


                            SqlDataSource sqlDataSource = report.DataSource as SqlDataSource;

                            SqlDataSource ds = report.DataSource as SqlDataSource;
                            ds.ConnectionName = "sqlDataSource1";
                            String sNameConexion = (Security.Esquema.Compania == "CEDETSA") ? "StringConCedetsa" : "StringConDasa";
                            System.Data.SqlClient.SqlConnectionStringBuilder builder = new System.Data.SqlClient.SqlConnectionStringBuilder(System.Configuration.ConfigurationManager.ConnectionStrings[sNameConexion].ConnectionString);
                            ds.ConnectionParameters = new DevExpress.DataAccess.ConnectionParameters.MsSqlConnectionParameters(builder.DataSource, builder.InitialCatalog, builder.UserID, builder.Password, MsSqlAuthorizationType.SqlServer);

                            // Obtain a parameter, and set its value.
                            report.Parameters["Numero"].Value        = Convert.ToInt32(_currentRow["Numero"]);
                            report.Parameters["IDCuentaBanco"].Value = Convert.ToInt32(_currentRow["IDCuentaBanco"]);
                            report.Parameters["IDTipo"].Value        = Convert.ToInt32(_currentRow["IDTipo"]);
                            report.Parameters["IDSubTipo"].Value     = Convert.ToInt32(_currentRow["IDSubTipo"]);

                            // Show the report's print preview.
                            DevExpress.XtraReports.UI.ReportPrintTool tool = new DevExpress.XtraReports.UI.ReportPrintTool(report);
                            tool.ShowPreview();
                            SetChequeImpreso();
                        }
                        else
                        {
                            //Seleccionar de la lista de formatos
                            frmSeleccionFormatoCheque ofrmListarFormatos = new frmSeleccionFormatoCheque(tmpTable);
                            ofrmListarFormatos.FormClosed += ofrmListarFormatos_FormClosed;
                            ofrmListarFormatos.ShowDialog();
                        }
                    }
                }
            }
        }
Example #19
0
        private void btnAceptar_Click(object sender, EventArgs e)
        {
            try
            {
                //Mostrar el reporte de Balance General
                String sMensaje = "";
                if (this.dtpFechaInicial.EditValue == null)
                {
                    sMensaje = "  •Seleccione la fecha Inicial del Reporte \n\r ";
                }
                if (this.dtpFechaFinal.EditValue == null)
                {
                    sMensaje = "  •Seleccione la fecha final del Reporte \n\r ";
                }
                if (sMensaje != "")
                {
                    MessageBox.Show("Han ocurrido los siguientes errores: \n\r " + sMensaje);
                    return;
                }



                DevExpress.XtraReports.UI.XtraReport report = DevExpress.XtraReports.UI.XtraReport.FromFile("./Reporte/ReportesFinancieros/Plantilla/rptBalanceGeneral.repx", true);
                //Reporte.Asiento.rptAsiento report = new Reporte.Asiento.rptAsiento();

                SqlDataSource sqlDataSource = report.DataSource as SqlDataSource;



                SqlDataSource ds = report.DataSource as SqlDataSource;

                ds.ConnectionName = "sqlDataSource1";
                String sNameConexion = (Security.Esquema.Compania == "CEDETSA") ? "StringConCedetsa" : "StringConDasa";
                System.Data.SqlClient.SqlConnectionStringBuilder builder = new System.Data.SqlClient.SqlConnectionStringBuilder(System.Configuration.ConfigurationManager.ConnectionStrings[sNameConexion].ConnectionString);
                ds.ConnectionParameters = new DevExpress.DataAccess.ConnectionParameters.MsSqlConnectionParameters(builder.DataSource, builder.InitialCatalog, builder.UserID, builder.Password, MsSqlAuthorizationType.SqlServer);



                // Obtain a parameter, and set its value.
                report.Parameters["PFechaInicial"].Value = Convert.ToDateTime(this.dtpFechaInicial.EditValue);
                report.Parameters["PFechaFinal"].Value   = Convert.ToDateTime(this.dtpFechaFinal.EditValue);
                report.Parameters["Moneda"].Value        = (this.rgMoneda.SelectedIndex == 0) ? "L" : "D";

                // Show the report's print preview.
                DevExpress.XtraReports.UI.ReportPrintTool tool = new DevExpress.XtraReports.UI.ReportPrintTool(report);

                tool.ShowPreview();
            }
            catch (Exception ex) {
                MessageBox.Show(ex.Message);
            }
        }
Example #20
0
        public frmReportEditGeneral(DevExpress.XtraReports.UI.XtraReport _rpt, string _sheetname, string name, string madvcs)
        {
            InitializeComponent();
            this.rpt       = _rpt;
            this.sheetname = _sheetname;
            NameFile       = name;
            NameDVCS       = madvcs;
            string pathpdf = Application.StartupPath + "\\PhieuKetQua\\" + "\\" + NameDVCS + "\\";

            System.IO.Directory.CreateDirectory(pathpdf);
            //DataTable dt= rpt.DataSource as DataTable;
            //name = dt.Rows[10][0].ToString();
        }
Example #21
0
    public static string GetReportPath(DevExpress.XtraReports.UI.XtraReport fReport, string ext)
    {
        System.Reflection.Assembly asm = System.Reflection.Assembly.GetExecutingAssembly();
        string repName = fReport.Name;

        if (repName.Length == 0)
        {
            repName = fReport.GetType().Name;
        }
        string dirName = Path.GetDirectoryName(asm.Location);

        return(Path.Combine(dirName, repName + "." + ext));
    }
        public override void SetData(DevExpress.XtraReports.UI.XtraReport report, string url)
        {
            CloudBlockBlob blob = container.GetBlockBlobReference(url);

            if (blob.Exists())
            {
                using (var stream = new MemoryStream())
                {
                    report.SaveLayoutToXml(stream);
                    stream.Position = 0;
                    blob.UploadFromStream(stream);
                }
            }
        }
Example #23
0
 public static void PrintBarcodes(List <int> rolls)
 {
     DevExpress.XtraReports.UI.XtraReport rpt = new DevExpress.XtraReports.UI.XtraReport();
     rpt.CreateDocument();
     rpt.PrintingSystem.ContinuousPageNumbering = false;
     foreach (int r in rolls)
     {
         Models.Stock.Reports.rptStockRollBarcode frm = new Models.Stock.Reports.rptStockRollBarcode();
         frm.Parameters["StockRollID"].Value = r;
         frm.CreateDocument();
         rpt.Pages.AddRange(frm.Pages);
     }
     DevExpress.XtraReports.UI.ReportPrintTool print = new DevExpress.XtraReports.UI.ReportPrintTool(rpt);
     print.ShowPreview();
 }
Example #24
0
 private void SetMarginReport(DevExpress.XtraReports.UI.XtraReport oReport, Boolean isLandCape, Int16 isTop, Int16 isBottom, Int16 isLeft, Int16 isRight)
 {
     try
     {
         oReport.DefaultPrinterSettingsUsing.UseMargins   = true;
         oReport.DefaultPrinterSettingsUsing.UsePaperKind = true;
         oReport.PaperKind = System.Drawing.Printing.PaperKind.A4;
         oReport.PrintingSystem.PageSettings.LeftMargin   = isLeft;
         oReport.PrintingSystem.PageSettings.RightMargin  = isRight;
         oReport.PrintingSystem.PageSettings.TopMargin    = isTop;
         oReport.PrintingSystem.PageSettings.BottomMargin = isBottom;
         oReport.PrintingSystem.PageSettings.Landscape    = isLandCape;
     }
     catch { }
 }
Example #25
0
        private void ucGe_Menu_event_btnImpRep_Click(object sender, EventArgs e)
        {
            try
            {
                string nombre_dll    = "";
                string Nom_asambly   = "";
                string NombreReporte = "";
                string RutaPantalla  = "";

                Nom_asambly   = txt_asembly.Text.Trim();
                NombreReporte = txt_class_rpt.Text.Trim();

                nombre_dll = Nom_asambly + ".dll";

                //cargando la dll
                Ensamblado = Assembly.LoadFrom(nombre_dll);

                // Load the object
                string nAsambly2 = txt_asembly.Text;

                Object ObjFrm;
                Type   tipo = Ensamblado.GetType(Nom_asambly + "." + NombreReporte);

                AssemblyName assemName = Ensamblado.GetName();
                Version      ver       = assemName.Version;
                //
                RutaPantalla = Nom_asambly + "." + NombreReporte;

                if (tipo == null)
                {
                    MessageBox.Show("No se encontró el Reporte Emsamblado:" + Nom_asambly + "  Reporte:" + NombreReporte, param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else
                {
                    ObjFrm = Activator.CreateInstance(tipo);
                    DevExpress.XtraReports.UI.XtraReport reporte1 = (DevExpress.XtraReports.UI.XtraReport)ObjFrm;
                    reporte1.ShowPreviewDialog();
                }
            }
            catch (Exception ex)
            {
                string NameMetodo = System.Reflection.MethodBase.GetCurrentMethod().Name;
                NameMetodo = NameMetodo + " - " + ex.ToString();
                Log_Error_bus.Log_Error(NameMetodo + " - " + ex.ToString());
                MessageBox.Show(NameMetodo + " " + param.Get_Mensaje_sys(enum_Mensajes_sys.Error_comunicarse_con_sistemas)
                                , param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        public override void SetData(DevExpress.XtraReports.UI.XtraReport report, string url)
        {
            // Write a report to the storage under the specified URL.
            using (var session = SessionFactory.Create())
            {
                var reportEntity = GetObjectByUrl(url); // session.GetObjectByKey<TSOUTERREPORT>(url);


                MemoryStream ms = new MemoryStream();
                report.SaveLayout(ms);
                //reportEntity.Layout = ms.ToArray();
                this.SaveToFile(reportEntity.Url, ms);

                session.CommitChanges();
            }
        }
Example #27
0
        private void barButtonItem1_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            DB.RPT_Report rptReport = BL.RPT.RPT_Report.Load(1, DataContext);
            //this.Text = rptReport.Name;
            System.IO.Stream xmlstream = new System.IO.MemoryStream(System.Text.Encoding.UTF8.GetBytes(rptReport.Data));

            //XtraReport report = new XtraReport();
            DevExpress.XtraReports.UI.XtraReport report = new DevExpress.XtraReports.UI.XtraReport();
            report.LoadLayoutFromXml(xmlstream);
            //report.CurrentPrintControl = PrintControl;
            //SqlDataAdapter adp = (SqlDataAdapter)report.DataAdapter;

            if (report.DataSource is DevExpress.DataAccess.Sql.SqlDataSource)
            {
                ((DevExpress.DataAccess.Sql.SqlDataSource)(report.DataSource)).Connection.ConnectionString = BL.ApplicationDataContext.Instance.SqlConnectionString.ConnectionString;
            }
            else if (report.DataSource is DevExpress.DataAccess.EntityFramework.EFDataSource)
            {
                ((DevExpress.DataAccess.EntityFramework.EFDataSource)(report.DataSource)).Connection.ConnectionString = BL.ApplicationDataContext.Instance.EntityViewConnectionString.ConnectionString;
            }
            else
            {
                throw new Exception("Data Source type not implemented in reports");
            }

            //adp.SelectCommand.Connection.ConnectionString = BL.ApplicationDataContext.Instance.SqlConnectionString.ConnectionString;
            DevExpress.XtraReports.Parameters.ParameterCollection Parameters = new DevExpress.XtraReports.Parameters.ParameterCollection();
            Parameters.Add(new DevExpress.XtraReports.Parameters.Parameter()
            {
                Name = "Code_Main_starts_with", Value = "00100"
            });
            if (Parameters.Count != 0)
            {
                foreach (var extparam in Parameters)
                {
                    foreach (var param in report.Parameters)
                    {
                        if (extparam.Name == param.Name)
                        {
                            param.Value = extparam.Value;
                            break;
                        }
                    }
                }
            }
            report.ExportToPdf(@"C:\accounts_report.pdf");
        }
Example #28
0
        protected virtual void PrintDesign()
        {
            DevExpress.XtraReports.UI.XtraReport r = new DevExpress.XtraReports.UI.XtraReport();
            r.DataSource = GetPrintDS();
            Stream s = LoadReport();

            if (s != null)
            {
                r.LoadLayout(s);
            }

            myControl.CustomDesignForm d = new myControl.CustomDesignForm();
            d.OpenReport(r);
            d.ShowDialog();
            SaveReport(r);
            d.Dispose();
        }
        public override string SetNewData(DevExpress.XtraReports.UI.XtraReport report, string defaultUrl)
        {
            string         id   = defaultUrl;
            CloudBlockBlob blob = container.GetBlockBlobReference(defaultUrl);

            if (blob.Exists())
            {
                id   = defaultUrl + Guid.NewGuid().ToString("N");
                blob = container.GetBlockBlobReference(id);
            }
            using (var stream = new MemoryStream())
            {
                report.SaveLayoutToXml(stream);
                stream.Position = 0;
                blob.UploadFromStream(stream);
            }
            return(id);
        }
Example #30
0
        public ActionResult Pdf()
        {
            // Criando o objeto XtraReport, que representa o relatório.
            DevExpress.XtraReports.UI.XtraReport report = new DevExpress.XtraReports.UI.XtraReport();

            // Arquivo repx que contém o layout do relatório.
            string reportPath = Server.MapPath("~/Reports/XtraReport.repx");

            // Criando um business object com os dados para o relatório.
            ArrayList listDataSource = new ArrayList();

            for (int i = 0; i < 200; i++)
            {
                var index = i + 1;

                listDataSource.Add(new ReportProduto
                {
                    ID        = index,
                    Descricao = $"Produto {index.ToString("D2")}",
                    Marca     = $"Marca {index.ToString("D2")}",
                    Foto      = $"Foto {index.ToString("D2")}"
                });
            }

            // Informando para o DataSource do relatório qual será os dados.
            report.DataSource = listDataSource;

            // Configurado o arquivo repx como arquivo de layout.
            report.LoadLayout(reportPath);

            // Informando onde será gerado o arquivo pdf.
            var pdfExportFile = Server.MapPath("~/Files/Pdf/XtraReport.pdf");

            // Configurando as opções de exportação do pdf.
            PdfExportOptions options = new PdfExportOptions();

            options.PdfACompatibility = PdfACompatibility.PdfA1b;

            // Exportando o arquivo pdf.
            report.ExportToPdf(pdfExportFile, options);

            return(View());
        }
Example #31
0
 private void barButtonItem33_ItemClick_1(object sender, ItemClickEventArgs e)
 {
     DevExpress.XtraReports.UI.XtraReport xr = new DevExpress.XtraReports.UI.XtraReport();
     xr.ShowDesigner();
     //xtraMegrendeles.FromFile( DEFS.DefProgramLocation + @"\Templates\repMegrendeles.repx",true).ShowDesigner();
 }