private void btnimprimir_Click(object sender, EventArgs e) { Recibo objServicio = new Recibo(); objServicio.recibo = this.recibo; List <Recibo> servicio = objServicio.datosRecibo(); try { //MUESTRA LA VISTA PREVIA DEL REPORTE LocalReport rdlc = new LocalReport(); rdlc.ReportPath = @"..\..\Reportes\RptImpresionRecibo.rdlc"; rdlc.DataSources.Clear(); ReportDataSource ds = new ReportDataSource("dts_recibo", servicio); rdlc.DataSources.Add(ds); //ENVIA EL REPORTE A LA IMPRESORA impresor imp = new impresor(); imp.Imprime(rdlc); //SE CIERRA VENTANA DE VISTA PREVIA Y SE HABRE LA PANTALLA DEL MENU PRINCIPAL frmListadoIglesias nre = new frmListadoIglesias(); this.Hide(); nre.ShowDialog(); this.Close(); } catch (Exception ex) { MessageBox.Show("Referencia: " + ex.ToString()); } }
private void frmVistaPrevia_Load(object sender, EventArgs e) { Recibo objServicio = new Recibo(); objServicio.recibo = this.recibo; List <Recibo> servicio = objServicio.datosRecibo(); try { this.rptdiseno.LocalReport.ReportPath = @"..\..\Reportes\RptImpresionRecibo.rdlc"; this.rptdiseno.LocalReport.DataSources.Clear(); ReportDataSource ds = new ReportDataSource("dts_recibo", servicio); this.rptdiseno.LocalReport.DataSources.Add(ds); this.rptdiseno.LocalReport.Refresh(); this.rptdiseno.RefreshReport(); } catch (Exception ex) { MessageBox.Show("Referencia: " + ex.ToString()); } }