예제 #1
0
        private void btnBuscarRuc_Click(object sender, EventArgs e)
        {
            string tipo = "";

            if (rdbEmpresa.Checked == true)
            {
                tipo = "FA";
            }
            else if (rdbPersona.Checked == true)
            {
                tipo = "BO";
            }
            else
            {
                MessageBox.Show("Seleccione si es Persona o Empresa."); return;
            }

            frmBuscarCliente frm = new frmBuscarCliente(String.Empty, "dni", tipo);

            frm.ShowDialog();

            if (frm.ent_cliente != null)
            {
                cliente            = frm.ent_cliente;
                txtDesCliente.Text = (frm.ent_cliente.nombres == null) ? "" : frm.ent_cliente.nombres + ((frm.ent_cliente.apellidos == null) ? "" : " " + frm.ent_cliente.apellidos);
                txtDesRuc.Text     = (frm.ent_cliente.dni == null) ? "" : frm.ent_cliente.dni;
            }
        }
예제 #2
0
        private void showDetallesDoc(DataGridViewCellEventArgs e)
        {
            reiniciarCotizacion();
            string id = dgvDocumentos.Rows[e.RowIndex].Cells["ID_CAB"].Value.ToString();

            id_cab = id;
            fillDetalles(id);
            tipo         = dgvDocumentos.Rows[e.RowIndex].Cells["TIPO_VENTA"].Value.ToString();
            lblTipo.Text = dgvDocumentos.Rows[e.RowIndex].Cells["TIPO_VENTA"].Value.ToString() == "CO" ? "Compra" : "Alquiler";

            lblFecha.Text        = dgvDocumentos.Rows[e.RowIndex].Cells["FECHA"].Value.ToString();
            lblUsuario.Text      = dgvDocumentos.Rows[e.RowIndex].Cells["USUARIO"].Value.ToString();
            lblDNI.Text          = dgvDocumentos.Rows[e.RowIndex].Cells["DNI"].Value.ToString();
            lblNombre.Text       = dgvDocumentos.Rows[e.RowIndex].Cells["NOMBRE"].Value.ToString();
            lblTotal.Text        = dgvDocumentos.Rows[e.RowIndex].Cells["MONEDA"].Value.ToString() + " " + String.Format("{0:f2}", dgvDocumentos.Rows[e.RowIndex].Cells["MONTO_TOTAL"].Value);
            gbDetalle.Visible    = true;
            btnConfirmar.Enabled = true;

            cotizacion.id_cab      = Convert.ToInt32(id_cab);
            cotizacion.cliente     = lblNombre.Text;
            cotizacion.cliente_doc = lblDNI.Text;
            Ent_Clientes cliente = BL_Clientes.getCliente(lblDNI.Text);

            cotizacion.direccion       = cliente.direccion;
            cotizacion.tipo_cotizacion = tipo;
            cotizacion.dias_alquiler   = Convert.ToInt32(dgvDocumentos.Rows[e.RowIndex].Cells["DIAS_ALQUILER"].Value.ToString());
            cotizacion.monto_total     = Convert.ToDouble(lblTotal.Text.Split(' ')[1]);
            cotizacion.monto_subtotal  = Convert.ToDouble(cotizacion.monto_total / (0.18 + 1));
            cotizacion.monto_igv       = (cotizacion.monto_total - Convert.ToDouble(cotizacion.monto_subtotal));
            cotizacion.moneda          = dgvDocumentos.Rows[e.RowIndex].Cells["MONEDA"].Value.ToString();
        }
예제 #3
0
        public static Ent_Clientes getCliente(string dni)
        {
            Ent_Clientes cliente = new Ent_Clientes();

            con = Conexion.getConnection();
            MySqlCommand cmd = new MySqlCommand();

            con.Open();

            cmd.Connection  = con;
            cmd.CommandText = "SP_SYS_GET_CLIENTE";
            cmd.CommandType = CommandType.StoredProcedure;

            cmd.Parameters.AddWithValue("@PSTR_COD_CLIENTE", dni);
            cmd.Parameters["@PSTR_COD_CLIENTE"].Direction = ParameterDirection.Input;

            MySqlDataReader dr = cmd.ExecuteReader();

            while (dr.Read())
            {
                cliente                   = new Ent_Clientes();
                cliente.id                = Convert.ToString(dr["ID"]);
                cliente.nombres           = Convert.ToString(dr["NOMBRES"]);
                cliente.apellidos         = Convert.ToString(dr["APELLIDOS"]);
                cliente.apellidos_nombres = ((cliente.apellidos != String.Empty) ? cliente.apellidos + ", " : "") + cliente.nombres;
                cliente.dni               = Convert.ToString(dr["DNI"]);
                cliente.direccion         = Convert.ToString(dr["DIRECCION"]);
                cliente.email             = Convert.ToString(dr["EMAIL"]);
                cliente.telefono          = Convert.ToString(dr["TELEFONO"]);
                cliente.fecha_reg         = Convert.ToString(dr["FECHA_REG"]);
                cliente.tipo              = Convert.ToString(dr["TIPO"]);
            }

            return(cliente);
        }
예제 #4
0
        public static string insertarCliente(Ent_Clientes cliente)
        {
            con = Conexion.getConnection();
            MySqlCommand cmd = new MySqlCommand();

            con.Open();

            cmd.Connection  = con;
            cmd.CommandText = "SP_SYS_SET_CLIENTE";
            cmd.CommandType = CommandType.StoredProcedure;

            cmd.Parameters.AddWithValue("@RETVAL", MySqlDbType.VarChar);
            cmd.Parameters["@RETVAL"].Direction = ParameterDirection.Output;

            cmd.Parameters.AddWithValue("@PSTR_DNI", cliente.dni);
            cmd.Parameters["@PSTR_DNI"].Direction = ParameterDirection.Input;

            cmd.Parameters.AddWithValue("@PSTR_NOMBRES", cliente.nombres);
            cmd.Parameters["@PSTR_NOMBRES"].Direction = ParameterDirection.Input;

            cmd.Parameters.AddWithValue("@PSTR_APELLIDOS", (cliente.apellidos == String.Empty) ? null : cliente.apellidos);
            cmd.Parameters["@PSTR_APELLIDOS"].Direction = ParameterDirection.Input;

            cmd.Parameters.AddWithValue("@PSTR_DIRECCION", cliente.direccion);
            cmd.Parameters["@PSTR_DIRECCION"].Direction = ParameterDirection.Input;

            cmd.Parameters.AddWithValue("@PSTR_TELEFONO", cliente.telefono);
            cmd.Parameters["@PSTR_TELEFONO"].Direction = ParameterDirection.Input;

            cmd.Parameters.AddWithValue("@PSTR_EMAIL", cliente.email);
            cmd.Parameters["@PSTR_EMAIL"].Direction = ParameterDirection.Input;

            cmd.Parameters.AddWithValue("@PSTR_TIPO", cliente.tipo);
            cmd.Parameters["@PSTR_TIPO"].Direction = ParameterDirection.Input;

            cmd.Parameters.AddWithValue("@PSTR_POSIBLE", cliente.posible);
            cmd.Parameters["@PSTR_POSIBLE"].Direction = ParameterDirection.Input;

            cmd.Parameters.AddWithValue("@PSTR_MEDIO", cliente.medio);
            cmd.Parameters["@PSTR_MEDIO"].Direction = ParameterDirection.Input;

            cmd.Parameters.AddWithValue("@PSTR_OTRO_MEDIO", cliente.otro_medio);
            cmd.Parameters["@PSTR_OTRO_MEDIO"].Direction = ParameterDirection.Input;

            cmd.ExecuteNonQuery();

            string retval = cmd.Parameters["@RETVAL"].Value.ToString();

            con.Close();

            return(retval);
        }
예제 #5
0
        private void dgvClientes_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex > -1 && e.ColumnIndex > -1)
            {
                ent_cliente           = new Ent_Clientes();
                ent_cliente.id        = dgvClientes.Rows[e.RowIndex].Cells["id"].Value.ToString();
                ent_cliente.nombres   = dgvClientes.Rows[e.RowIndex].Cells["nombres"].Value.ToString();
                ent_cliente.apellidos = dgvClientes.Rows[e.RowIndex].Cells["apellidos"].Value.ToString();
                ent_cliente.telefono  = dgvClientes.Rows[e.RowIndex].Cells["telefono"].Value.ToString();
                ent_cliente.email     = dgvClientes.Rows[e.RowIndex].Cells["email"].Value.ToString();
                ent_cliente.dni       = dgvClientes.Rows[e.RowIndex].Cells["dni"].Value.ToString();
                ent_cliente.direccion = dgvClientes.Rows[e.RowIndex].Cells["direccion"].Value.ToString();

                this.Close();
            }
        }
예제 #6
0
        public static List <Ent_Clientes> getClientesxDNI(string dni, string tipo)
        {
            List <Ent_Clientes> lstClientes = new List <Ent_Clientes>();

            con = Conexion.getConnection();
            MySqlCommand cmd = new MySqlCommand();

            con.Open();

            cmd.Connection  = con;
            cmd.CommandText = "SP_SYS_GET_CLIENTES_X_DNI";
            cmd.CommandType = CommandType.StoredProcedure;

            cmd.Parameters.AddWithValue("@PSTR_DNI", dni);
            cmd.Parameters["@PSTR_DNI"].Direction = ParameterDirection.Input;

            cmd.Parameters.AddWithValue("@PSTR_TIPO", tipo);
            cmd.Parameters["@PSTR_TIPO"].Direction = ParameterDirection.Input;

            MySqlDataReader dr = cmd.ExecuteReader();

            while (dr.Read())
            {
                Ent_Clientes cliente = new Ent_Clientes();
                cliente.id                = Convert.ToString(dr["ID"]);
                cliente.nombres           = Convert.ToString(dr["NOMBRES"]);
                cliente.apellidos         = Convert.ToString(dr["APELLIDOS"]);
                cliente.apellidos_nombres = ((cliente.apellidos != String.Empty) ? cliente.apellidos + ", " : "") + cliente.nombres;
                cliente.dni               = Convert.ToString(dr["DNI"]);
                cliente.direccion         = Convert.ToString(dr["DIRECCION"]);
                cliente.email             = Convert.ToString(dr["EMAIL"]);
                cliente.telefono          = Convert.ToString(dr["TELEFONO"]);

                lstClientes.Add(cliente);
            }

            con.Close();

            return(lstClientes);
        }
예제 #7
0
        private void btnGuardar_Click_1(object sender, EventArgs e)
        {
            if (txtNombreDet.Text.Equals(String.Empty))
            {
                MessageBox.Show("El nombre no puede estar vacío.", "Agregar cliente", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtNombreDet.Focus();
                return;
            }

            if (txtApellidos.Text.Equals(String.Empty) && cboTipo.SelectedValue.ToString().Equals("N"))
            {
                MessageBox.Show("El apellido no puede estar vacío.", "Agregar cliente", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtApellidos.Focus();
                return;
            }

            if (txtDireccion.Text.Equals(String.Empty))
            {
                MessageBox.Show("La dirección no puede estar vacía.", "Agregar cliente", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtDireccion.Focus();
                return;
            }

            if (txtTelefono.Text.Equals(String.Empty))
            {
                MessageBox.Show("El teléfono no puede estar vacío.", "Agregar cliente", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtApellidos.Focus();
                return;
            }

            var confirm = MessageBox.Show("¿Está seguro que desea agregar al cliente?.", "Atención", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (confirm == DialogResult.Yes)
            {
                Ent_Clientes cliente = new Ent_Clientes();
                cliente.dni        = txtDNIDet.Text;
                cliente.nombres    = txtNombreDet.Text;
                cliente.apellidos  = txtApellidos.Text;
                cliente.direccion  = txtDireccion.Text;
                cliente.telefono   = txtTelefono.Text;
                cliente.email      = txtEmail.Text;
                cliente.tipo       = cboTipo.SelectedValue.ToString();
                cliente.medio      = cboMedio.SelectedValue.ToString();
                cliente.otro_medio = txtRecomendado.Text;

                try
                {
                    string result = BL_Clientes.insertarCliente(cliente);

                    if (result == "1")
                    {
                        MessageBox.Show("¡Cliente agregado exitosamente!", "Agregar cliente", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    else
                    {
                        MessageBox.Show("¡Ocurrió un error al agregar el cliente!", "Agregar cliente", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Error: " + ex.Message, "Agregar cliente", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
예제 #8
0
        public static string editarCliente(Ent_Clientes cliente)
        {
            MySqlTransaction tr = null;

            con = Conexion.getConnection();

            string retval = "1";

            try
            {
                con.Open();

                tr = con.BeginTransaction();

                MySqlCommand cmd = new MySqlCommand();

                cmd.Connection  = con;
                cmd.Transaction = tr;

                cmd.CommandText = "SP_SYS_UPD_CLIENTE";
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.AddWithValue("@RETVAL", MySqlDbType.VarChar);
                cmd.Parameters["@RETVAL"].Direction = ParameterDirection.Output;

                cmd.Parameters.AddWithValue("@PSTR_ID", cliente.id);
                cmd.Parameters["@PSTR_ID"].Direction = ParameterDirection.Input;

                cmd.Parameters.AddWithValue("@PSTR_DNI", cliente.dni);
                cmd.Parameters["@PSTR_DNI"].Direction = ParameterDirection.Input;

                cmd.Parameters.AddWithValue("@PSTR_NOMBRE", cliente.nombres);
                cmd.Parameters["@PSTR_NOMBRE"].Direction = ParameterDirection.Input;

                cmd.Parameters.AddWithValue("@PSTR_APELLIDO", cliente.apellidos);
                cmd.Parameters["@PSTR_APELLIDO"].Direction = ParameterDirection.Input;

                cmd.Parameters.AddWithValue("@PSTR_DIRECCION", cliente.direccion);
                cmd.Parameters["@PSTR_DIRECCION"].Direction = ParameterDirection.Input;

                cmd.Parameters.AddWithValue("@PSTR_EMAIL", cliente.email);
                cmd.Parameters["@PSTR_EMAIL"].Direction = ParameterDirection.Input;

                cmd.Parameters.AddWithValue("@PSTR_TELEFONO", cliente.telefono);
                cmd.Parameters["@PSTR_TELEFONO"].Direction = ParameterDirection.Input;

                cmd.Parameters.AddWithValue("@PSTR_TIPO", cliente.tipo);
                cmd.Parameters["@PSTR_TIPO"].Direction = ParameterDirection.Input;

                cmd.ExecuteNonQuery();

                retval = cmd.Parameters["@RETVAL"].Value.ToString();

                if (retval == "1")
                {
                    tr.Commit();
                }
                else
                {
                    tr.Rollback();
                    return(retval);
                }
            }
            catch (MySqlException ex)
            {
                try
                {
                    tr.Rollback();
                }
                catch (MySqlException ex1)
                {
                    return(ex1.ToString());
                }

                return(ex.ToString());
            }
            finally
            {
                con.Close();
            }

            return(retval);
        }
예제 #9
0
        private void procesarCompra()
        {
            forma_pago = cboFormaPago.SelectedValue.ToString();

            Ent_Venta venta = new Ent_Venta();

            venta.nro_doc         = int.Parse(correlativo);
            venta.nro_doc_str     = lblSerie.Text;
            venta.cod_tienda      = cod_tienda;
            venta.tipo_venta      = tipo_venta;
            venta.forma_pago      = forma_pago;
            venta.cantidad        = sumarCantidad();
            venta.monto_total     = total;
            venta.monto_subtotal  = double.Parse(txtSubTotal.Text);
            venta.monto_igv       = double.Parse(txtIGV.Text);
            venta.monto_recibido  = double.Parse(txtRecibido.Text);
            venta.monto_vuelto    = double.Parse(txtVuelto.Text);
            venta.monto_descuento = double.Parse(txtDescuento.Text);
            venta.cliente_doc     = txtDNI.Text;
            venta.cliente         = txtNombres.Text + " " + txtApellidos.Text;
            venta.direccion       = txtDireccion.Text;
            venta.usuario         = ent_usuario.username;

            venta.fecha_inicio = dtpFechaInicio.Value.ToShortDateString();
            venta.fecha_fin    = dtpFechaEntrega.Value.ToShortDateString();

            venta.moneda = cboMoneda.SelectedValue.ToString();

            bool existe_cliente = BL_Clientes.existeCliente(venta.cliente_doc);

            //save customer if doesnt exists
            if (!existe_cliente)
            {
                log.Info("Cliente " + txtDNI.Text + " no existe en la base de datos.", System.Reflection.MethodBase.GetCurrentMethod().Name);

                var confirm = MessageBox.Show("¿Desea guardar el cliente en el sistema?", "Atención", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (confirm == DialogResult.Yes)
                {
                    Ent_Clientes nuevo_cliente = new Ent_Clientes();
                    nuevo_cliente.dni       = txtDNI.Text;
                    nuevo_cliente.nombres   = txtNombres.Text;
                    nuevo_cliente.apellidos = txtApellidos.Text;
                    nuevo_cliente.direccion = txtDireccion.Text;
                    nuevo_cliente.telefono  = txtTelefono.Text;
                    nuevo_cliente.email     = txtEmail.Text;
                    nuevo_cliente.tipo      = (tipo_venta == "FA") ? "E" : "N";
                    nuevo_cliente.posible   = "1";

                    try
                    {
                        string _result = BL_Clientes.insertarCliente(nuevo_cliente);

                        if (_result == "1")
                        {
                            log.Info("Cliente " + nuevo_cliente.dni + " grabado con éxito.", System.Reflection.MethodBase.GetCurrentMethod().Name);
                        }
                        else
                        {
                            log.Error("Error al grabar cliente: " + _result, System.Reflection.MethodBase.GetCurrentMethod().Name);
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show("Ocurrió un error al grabar al cliente, sin embargo, el proceso de compra continuará.\n\n" + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        log.Error("Error al grabar cliente: " + ex.Message, System.Reflection.MethodBase.GetCurrentMethod().Name);
                    }
                }
                else
                {
                    log.Info("Cliente " + txtDNI.Text + " no se guardará en la base de datos.", System.Reflection.MethodBase.GetCurrentMethod().Name);
                }
            }

            foreach (DataGridViewRow row in dgvProductos.Rows)
            {
                Ent_Productos prd = new Ent_Productos();
                prd.id       = int.Parse(row.Cells["ID"].Value.ToString());
                prd.nombre   = row.Cells["DESCRIPCION"].Value.ToString();
                prd.cantidad = int.Parse(row.Cells["CANTIDAD"].Value.ToString());
                prd.precio   = float.Parse(row.Cells["PU"].Value.ToString());

                venta.lstProductos.Add(prd);
            }

            try
            {
                string result = BL_Ventas.procesarVenta(venta);

                if (result == "1")
                {
                    MessageBox.Show("Venta Realizada con Éxito!.", "Venta", MessageBoxButtons.OK, MessageBoxIcon.Information);

                    InvoicePDF pdf = new InvoicePDF();
                    if (venta.tipo_venta == "BO")
                    {
                        pdf.createBoleta(ent_configuracion, venta);
                    }
                    else
                    {
                        pdf.createFactura(ent_configuracion, venta);
                    }

                    log.Info("Venta " + lblSerie.Text + " realizada con éxito.", System.Reflection.MethodBase.GetCurrentMethod().Name);
                    string resumen =
                        "\n-----------------------------------\n" +
                        "Resumen Venta:\n" +
                        "Serie: " + lblSerie.Text + "\n" +
                        "Tipo Venta: " + tipo_venta + "\n" +
                        "Forma de Pago: " + cboFormaPago.Text + "\n" +
                        "Cliente: " + txtDNI.Text + "\n" +
                        "Productos:\n";
                    foreach (DataGridViewRow item in dgvProductos.Rows)
                    {
                        resumen += "  - " + item.Cells["CODIGO"].Value.ToString() + " | " +
                                   item.Cells["DESCRIPCION"].Value.ToString() + " | " +
                                   item.Cells["CANTIDAD"].Value.ToString() + " | " +
                                   item.Cells["PU"].Value.ToString() + " | " +
                                   item.Cells["IMPORTE"].Value.ToString() + "\n";
                    }
                    resumen +=
                        "Subtotal: " + txtSubTotal.Text + "\n" +
                        "IGV: " + txtIGV.Text + "\n" +
                        "TOTAL: " + txtTotal.Text + "\n" +
                        "Recibido: " + txtRecibido.Text + "\n" +
                        "Vuelto: " + txtVuelto.Text + "\n" +
                        "-----------------------------------\n\n";
                    log.Info(resumen, System.Reflection.MethodBase.GetCurrentMethod().Name);
                    reiniciarVenta();
                }
                else
                {
                    MessageBox.Show(result, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error en el proceso de compra.\n\n" + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                log.Error("Error en el proceso de compra: " + ex.Message, System.Reflection.MethodBase.GetCurrentMethod().Name);
            }
        }
예제 #10
0
 public static string editarCliente(Ent_Clientes cliente)
 {
     return(DAO_Clientes.editarCliente(cliente));
 }
예제 #11
0
 public static string insertarCliente(Ent_Clientes cliente)
 {
     return(DAO_Clientes.insertarCliente(cliente));
 }
예제 #12
0
        private void procesarCotizacion()
        {
            Ent_Venta venta = new Ent_Venta();

            venta.cod_tienda      = cod_tienda;
            venta.tipo_venta      = tipo_venta;
            venta.cantidad        = sumarCantidad();
            venta.cliente_doc     = txtDesRuc.Text;
            venta.emision         = DateTime.Now.ToString("dd/MM/yyyy");
            venta.cliente         = txtDesCliente.Text;
            venta.email           = txtEmail.Text;
            venta.usuario         = usuario;
            venta.tipo_cotizacion = cboTipo.SelectedValue.ToString();
            venta.dias_alquiler   = int.Parse(txtDias.Text);
            venta.monto_subtotal  = double.Parse(txtSubTotal.Text);
            venta.monto_igv       = double.Parse(txtIGV.Text);
            venta.monto_total     = total;
            venta.denominacion    = txtDenominación.Text;
            venta.observacion     = txtObservacion.Text;
            venta.moneda          = cboMoneda.SelectedValue.ToString();

            bool existe_cliente = BL_Clientes.existeCliente(venta.cliente_doc);

            //save customer if doesnt exists
            if (!existe_cliente)
            {
                var confirm = MessageBox.Show("¿Desea guardar el cliente en el sistema?", "Atención", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (confirm == DialogResult.Yes)
                {
                    Ent_Clientes nuevo_cliente = new Ent_Clientes();
                    nuevo_cliente.dni       = txtDesRuc.Text;
                    nuevo_cliente.nombres   = txtDesCliente.Text;
                    nuevo_cliente.apellidos = "";
                    nuevo_cliente.direccion = "";
                    nuevo_cliente.telefono  = "";
                    nuevo_cliente.email     = txtEmail.Text;
                    nuevo_cliente.tipo      = (nuevo_cliente.dni.Length > 8) ? "E" : "N";
                    nuevo_cliente.posible   = "1";

                    try
                    {
                        string _result = BL_Clientes.insertarCliente(nuevo_cliente);
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show("Ocurrió un error al grabar al cliente, sin embargo, el proceso de compra continuará.\n\n" + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                else
                {
                }
            }

            foreach (DataGridViewRow row in dgvProductos.Rows)
            {
                Ent_Productos prd = new Ent_Productos();
                prd.cod_producto = row.Cells["CODIGO"].Value.ToString();
                prd.id           = int.Parse(row.Cells["ID"].Value.ToString());
                prd.nombre       = row.Cells["DESCRIPCION"].Value.ToString();
                prd.cantidad     = int.Parse(row.Cells["CANTIDAD"].Value.ToString());
                prd.precio       = float.Parse(row.Cells["PU"].Value.ToString());
                prd.monto_total  = float.Parse(row.Cells["IMPORTE"].Value.ToString());

                venta.lstProductos.Add(prd);
            }

            try
            {
                string id_cab = "";
                string result = BL_Ventas.procesarCotizacion(venta, out id_cab);

                venta.id_cab = Convert.ToInt32(id_cab);

                Email email = new Email();
                email.Send_Email(venta, _ent_tienda, ent_configuracion, txtObservacion.Text, adjunto);

                if (result == "1")
                {
                    MessageBox.Show("Cotización Realizada con Éxito!.", "Cotización", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    InvoicePDF pdf = new InvoicePDF();
                    pdf.createCotizacion(ent_configuracion, venta);
                    reiniciarVenta();
                }
                else
                {
                    MessageBox.Show(result, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error en el proceso de cotización.\n\n" + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }