コード例 #1
0
        private void btnFormatoRide_Click(object sender, EventArgs e)
        {
            try
            {
                if (dbAyudaFacturas.iId == 0)
                {
                    ok.LblMensaje.Text = "No ha seleccionado ninguna factura.";
                    ok.ShowDialog();
                }

                else
                {
                    dtConsulta = new DataTable();
                    dtConsulta.Clear();

                    this.Cursor = Cursors.WaitCursor;

                    bRespuesta = conexion.GFun_Lo_Genera_Ride(dtConsulta, dbAyudaFacturas.iId);

                    if (bRespuesta == true)
                    {
                        //bRespuesta = ride.generarRide(dtConsulta, "", dbAyudaFacturas.iId);

                        //if (bRespuesta == false)
                        //{
                        //    ok.LblMensaje.Text = "Error al crear el reporte RIDE de la factura ";
                        //    ok.ShowDialog();
                        //}

                        Facturacion_Electronica.frmVistaPreviaFacturaElectronica vista = new frmVistaPreviaFacturaElectronica(dtConsulta, "", dbAyudaFacturas.iId);
                        vista.ShowDialog();
                    }

                    this.Cursor = Cursors.Default;
                }
            }

            catch (Exception ex)
            {
                catchMensaje.LblMensaje.Text = ex.ToString();
                catchMensaje.ShowDialog();
                this.Cursor = Cursors.Default;
            }
        }
コード例 #2
0
        private void btnFormatoRide_Click(object sender, EventArgs e)
        {
            try
            {
                if (dbAyudaFacturas.iId == 0)
                {
                    ok.LblMensaje.Text = "No ha seleccionado ninguna factura.";
                    ok.ShowDialog();
                }

                else
                {
                    //OBTENGO EL LOGO
                    //-------------------------------------------------------------------------------------
                    logo = new Clases_Factura_Electronica.ClaseObtenerLogo();

                    if (logo.obtenerRutaLogo() == false)
                    {
                        ok = new VentanasMensajes.frmMensajeOK();
                        ok.LblMensaje.Text = logo.sRespuesta;
                        ok.ShowDialog();
                        return;
                    }

                    else
                    {
                        sRutaLogo = logo.sRespuesta;
                    }

                    //-------------------------------------------------------------------------------------

                    dtConsulta = new DataTable();
                    dtConsulta.Clear();

                    this.Cursor = Cursors.WaitCursor;

                    bRespuesta = conexion.GFun_Lo_Genera_Ride(dtConsulta, dbAyudaFacturas.iId);

                    if (bRespuesta == true)
                    {
                        //bRespuesta = ride.generarRide(dtConsulta, "", dbAyudaFacturas.iId);

                        //if (bRespuesta == false)
                        //{
                        //    ok.LblMensaje.Text = "Error al crear el reporte RIDE de la factura ";
                        //    ok.ShowDialog();
                        //}

                        if (sRutaLogo == "")
                        {
                            Bitmap My_Logo = Properties.Resources.SIN_LOGO;
                            var    ms      = new MemoryStream();

                            My_Logo.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);
                            Logo_Factura = ms.ToArray();
                        }

                        else
                        {
                            if (File.Exists(sRutaLogo))
                            {
                                Logo_Factura = File.ReadAllBytes(sRutaLogo);
                            }
                            else
                            {
                                Bitmap My_Logo = Properties.Resources.SIN_LOGO;
                                var    ms      = new MemoryStream();

                                My_Logo.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);
                                Logo_Factura = ms.ToArray();
                            }
                        }

                        Facturacion_Electronica.frmVistaPreviaFacturaElectronica vista = new frmVistaPreviaFacturaElectronica(dtConsulta, "", dbAyudaFacturas.iId, Logo_Factura);
                        vista.ShowDialog();
                    }

                    this.Cursor = Cursors.Default;
                }
            }

            catch (Exception ex)
            {
                catchMensaje.LblMensaje.Text = ex.Message;
                catchMensaje.ShowDialog();
                this.Cursor = Cursors.Default;
            }
        }