private XtraReportFactura CalcularReport() { Factura factura = Factura; factura.Lineas.Clear(); factura.Lineas.AddRange(bsLineas.Cast<LineaFactura>()); factura.CalcularSubtotales(); XtraReportFactura xtraReport = new XtraReportFactura(); var cliente = Cliente ?? new Cliente(); try { using (var ms = new MemoryStream(cliente.ModeloDocumento)) { ms.Position = 0; xtraReport.LoadLayout(ms); } } catch (Exception) { } xtraReport.Factura = factura; xtraReport.RequestParameters = false; ParameterCollection parameters = xtraReport.Parameters; parameters["licenciaMunicipal"].Value = Settings.Default.licencia; parameters["email"].Value = Settings.Default.email; parameters["Movil"].Value = Settings.Default.movil; parameters["Nif"].Value = Settings.Default.nif; parameters["Telefono"].Value = Settings.Default.telefono; parameters["nombre"].Value = Settings.Default.nombre; parameters["direccion"].Value = Settings.Default.direccion; parameters["poblacion"].Value = Settings.Default.poblacionCP; if (!string.IsNullOrEmpty(Settings.Default.Iban)) { parameters["iban"].Value = string.Format("IBAN: {0}", Settings.Default.Iban); } else { parameters["iban"].Value = string.Format("IBAN: {0}", Settings.Default.ccc); } return xtraReport; }
public void Disenyar() { Factura factura = bsFactura.Current as Factura; if (factura != null) { var cliente = Cliente ?? new Cliente(); XtraReportFactura xtraReport = new XtraReportFactura { Factura = factura }; try { using (var ms = new MemoryStream(cliente.ModeloDocumento)) { ms.Position = 0; xtraReport.LoadLayout(ms); } } catch (Exception) { } ReportDesignTool dt = new ReportDesignTool(xtraReport); // Invoke the Ribbon End-User Designer form modally. dt.ShowRibbonDesignerDialog(); using (var ms = new MemoryStream()) { xtraReport.SaveLayout(ms); ms.Position = 0; cliente.ModeloDocumento = ms.ToArray(); } } }