コード例 #1
0
        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());
            }
        }
コード例 #2
0
        private void btnimprimir_Click(object sender, EventArgs e)
        {
            Recibo objServicio = new Recibo()
            {
                recibo = recibo, usuario = usuario
            };
            List <reciboEntidad> servicio = objServicio.obtenerRecibo();

            if (medio_pago == 1)
            {
                try
                {
                    //MUESTRA LA VISTA PREVIA DEL REPORTE
                    LocalReport rdlc = new LocalReport();
                    rdlc.ReportPath = @"..\..\Reportes\RptImpresionEfectivo.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
                    frmReciboEvento nre = new frmReciboEvento();
                    this.Hide();
                    nre.ShowDialog();
                    this.Close();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
            else if (medio_pago == 2)
            {
                try
                {
                    //MUESTRA LA VISTA PREVIA DEL REPORTE
                    LocalReport rdlc = new LocalReport();
                    rdlc.ReportPath = @"..\..\Reportes\RptImpresionCheque.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
                    frmReciboEvento nre = new frmReciboEvento();
                    this.Hide();
                    nre.ShowDialog();
                    this.Close();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
        }