Beispiel #1
0
        private void lblAbrir_Click(object sender, EventArgs e)
        {
            Frm_Advertencia adv      = new Frm_Advertencia();
            Frm_Filtro      fil      = new Frm_Filtro();
            var             FilePath = string.Empty;

            try
            {
                if (openFileDialog1.ShowDialog() == DialogResult.OK)
                {
                    xFotoruta = openFileDialog1.FileName;
                    piclogo.Load(xFotoruta);
                }
            }
            catch (Exception ex)
            {
                piclogo.Load(Application.StartupPath + @"\user.png");
                xFotoruta = Application.StartupPath + @"\user.png";
                fil.Show();
                adv.lbl_Msm1.Text = "Error al Guardar el Personal: " + ex.Message;
                adv.ShowDialog();
                fil.Hide();
            }
        }
Beispiel #2
0
        private bool Validar_Texbox()
        {
            Frm_Filtro      fil = new Frm_Filtro();
            Frm_Advertencia ver = new Frm_Advertencia();

            if (txtIdProducto.Text.Trim().Length < 2)
            {
                fil.Show(); ver.lbl_Msm1.Text = "Ingrese el id del Producto"; ver.ShowDialog(); fil.Hide(); txtIdProducto.Focus(); return(false);
            }
            if (txtdescripcion_producto.Text.Trim().Length < 2)
            {
                fil.Show(); ver.lbl_Msm1.Text = "Ingrese la descripcion del producto"; ver.ShowDialog(); fil.Hide();  txtdescripcion_producto.Focus(); return(false);
            }
            if (txtPesoUnit.Text.Trim().Length < 2)
            {
                fil.Show(); ver.lbl_Msm1.Text = "Ingrese el peso por unidad del producto"; ver.ShowDialog(); fil.Hide(); txtPesoUnit.Focus(); return(false);
            }

            if (cmbTipoProducto.SelectedIndex == -1)
            {
                fil.Show(); ver.lbl_Msm1.Text = "Seleccione el tipo de Producto"; ver.ShowDialog(); fil.Hide(); cmbTipoProducto.Focus(); return(false);
            }
            if (cmbUnidadMedida.SelectedIndex == -1)
            {
                fil.Show(); ver.lbl_Msm1.Text = "Seleccione la unidad de medida del producto"; ver.ShowDialog(); fil.Hide(); cmbUnidadMedida.Focus(); return(false);
            }

            if (txtPrecioCompra.Text.Trim() == "")
            {
                fil.Show(); ver.lbl_Msm1.Text = "Ingrese el precio de compra del producto"; ver.ShowDialog(); fil.Hide(); txtPrecioCompra.Focus(); return(false);
            }
            if (Convert.ToDouble(txtPrecioCompra.Text) == 0)
            {
                fil.Show(); ver.lbl_Msm1.Text = "El precio de compra del producto no puede ser 0"; ver.ShowDialog(); fil.Hide(); txtPrecioCompra.Focus(); return(false);
            }

            if (txtPrecioVentaMenor.Text.Trim() == "")
            {
                fil.Show(); ver.lbl_Msm1.Text = "Ingrese el precio de venta por menor del producto "; ver.ShowDialog(); fil.Hide(); txtPrecioVentaMenor.Focus(); return(false);
            }
            if (Convert.ToDouble(txtPrecioVentaMenor.Text) == 0)
            {
                fil.Show(); ver.lbl_Msm1.Text = "El precio de venta minorista no puede ser 0"; ver.ShowDialog(); fil.Hide(); txtPrecioVentaMenor.Focus(); return(false);
            }

            if (txtPrecioVentaMayor.Text.Trim() == "")
            {
                fil.Show(); ver.lbl_Msm1.Text = "Ingrese el precio de venta mayorista del producto"; ver.ShowDialog(); fil.Hide(); txtPrecioVentaMayor.Focus(); return(false);
            }
            if (Convert.ToDouble(txtPrecioVentaMayor.Text) == 0)
            {
                fil.Show(); ver.lbl_Msm1.Text = "El precio de venta mayorista no puede ser 0"; ver.ShowDialog(); fil.Hide(); txtPrecioVentaMayor.Focus(); return(false);
            }

            if (txtPrecioVenta.Text.Trim() == "")
            {
                fil.Show(); ver.lbl_Msm1.Text = "Ingrese el precio de venta del producto"; ver.ShowDialog(); fil.Hide(); txtPrecioVenta.Focus(); return(false);
            }
            if (Convert.ToDouble(txtPrecioVenta.Text) == 0)
            {
                fil.Show(); ver.lbl_Msm1.Text = "El precio de venta del producto no puede ser 0"; ver.ShowDialog(); fil.Hide(); txtPrecioVenta.Focus(); return(false);
            }

            if (txtClaveSat.Text.Trim() == "")
            {
                fil.Show(); ver.lbl_Msm1.Text = "Ingrese la clave de Sat del producto"; ver.ShowDialog(); fil.Hide(); txtClaveSat.Focus(); return(false);
            }
            if (Convert.ToDouble(txtClaveSat.Text) == 0)
            {
                fil.Show(); ver.lbl_Msm1.Text = "La clave sat del producto no puede ser 0"; ver.ShowDialog(); fil.Hide(); txtClaveSat.Focus(); return(false);
            }

            return(true);
        }
Beispiel #3
0
        private void btnAceptar_Click(object sender, EventArgs e)
        {
            Frm_Filtro      fil = new Frm_Filtro();
            Frm_Advertencia adv = new Frm_Advertencia();

            if (txtPrecio.Text == "")
            {
                fil.Show();
                adv.lbl_Msm1.Text = "Por favor ingresa un precio";
                adv.ShowDialog();
                fil.Hide();
                txtPrecio.Focus();
                return;
            }
            if (Convert.ToDouble(txtPrecio.Text) == 0)
            {
                fil.Show();
                adv.lbl_Msm1.Text = "El precio de venta no puede ser 0";
                adv.ShowDialog();
                fil.Hide();
                txtPrecio.Focus();
                return;
            }

            if (txtCantidad.Text == "")
            {
                fil.Show();
                adv.lbl_Msm1.Text = "Por favor ingresa una cantidad";
                adv.ShowDialog();
                fil.Hide();
                txtCantidad.Focus();
                return;
            }
            if (Convert.ToDouble(txtCantidad.Text) == 0)
            {
                fil.Show();
                adv.lbl_Msm1.Text = "La cantidad ingresada no puede ser 0";
                adv.ShowDialog();
                fil.Hide();
                txtCantidad.Focus();
                return;
            }
            try
            {
                double preCopra      = Convert.ToDouble(Lbl_precompra.Text);
                double preVenta      = Convert.ToDouble(txtPrecio.Text);
                double xUtilidadUnit = 0;

                xUtilidadUnit = preVenta - preCopra;

                Lbl_UtilidadUnit.Text = xUtilidadUnit.ToString();

                if (lblTipoProducto.Text.Trim().ToString() == "Producto")
                {
                    if (Convert.ToDouble(txtCantidad.Text) > Convert.ToDouble(Lbl_stockActual.Text))
                    {
                        txtCantidad.Text = "1";
                        fil.Show();
                        adv.lbl_Msm1.Text = "La cantidad a vender no puede ser mayor que el stock";
                        adv.ShowDialog();
                        fil.Hide();
                        txtCantidad.Focus();
                        return;
                    }
                    else
                    {
                        this.Tag = "A";
                        this.Close();
                    }
                }
                else
                {
                    this.Tag = "A";
                    this.Close();
                }
            }
            catch (Exception ex)
            {
                txtCantidad.Text = "1";
                fil.Show();
                adv.lbl_Msm1.Text = "Error: " + ex.Message;
                adv.ShowDialog();
                fil.Hide();
                txtCantidad.Focus();
            }
        }
Beispiel #4
0
        private void bt_desaprobarJustificacion_Click(object sender, EventArgs e)
        {
            Frm_Advertencia  adv  = new Frm_Advertencia();
            Frm_Sino         sino = new Frm_Sino();
            Msm_Bueno        ok   = new Msm_Bueno();
            Frm_Filtro       fil  = new Frm_Filtro();
            RN_Justificacion obj  = new RN_Justificacion();

            if (lsv_justifi.SelectedIndices.Count == 0)
            {
                fil.Show();
                MessageBox.Show("Seleccione un item que desea desaprobar", "Advertencia de Seguridad", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                fil.Hide();
            }
            else
            {
                var    lsv       = lsv_justifi.SelectedItems[0];
                string xidjus    = lsv.SubItems[0].Text;
                string xidper    = lsv.SubItems[1].Text;
                string xstadojus = lsv.SubItems[6].Text;

                if (xstadojus.Trim() == "Falta Aprobado")
                {
                    fil.Show(); adv.Lbl_Msm1.Text = "La Justificacion Seleccionada, aun no fue aprobada"; adv.ShowDialog(); fil.Hide(); return;
                }
                ;

                sino.Lbl_msm1.Text = "¿estas Seguro que desea  desaprobar la Justificacion?" + "\n\r" + " -Recuerda que este proceso esta bajo tu responsabilidad";
                fil.Show();
                sino.ShowDialog();
                fil.Hide();


                if (Convert.ToString(sino.Tag) == "Si")
                {
                    obj.RN_Desaprobar_Justificacion(xidjus, xidper);
                    if (BD_Justificacion.tryed == true)
                    {
                        fil.Show();
                        ok.Lbl_msm1.Text = "Justificacion Desaprobada";
                        ok.ShowDialog();
                        fil.Hide();


                        BuscarJustificacion_porValor(xidjus);
                    }
                }
            }
        }
Beispiel #5
0
        private void Seleccionar_Producto_Vender()
        {
            Frm_Filtro      fil  = new Frm_Filtro();
            Frm_Edit_Cant   solo = new Frm_Edit_Cant();
            Frm_Advertencia adv  = new Frm_Advertencia();

            if (ltsProductos.SelectedIndices.Count == 0)
            {
                fil.Show(); adv.lbl_Msm1.Text = "Debes seleccionar un producto"; adv.ShowDialog(); fil.Hide(); return;
            }

            if (cbxCotizacion.Checked == true)
            {
                Seleccionar_Producto_ModoCotizacion();
            }
            else
            {
                double stock      = 0;
                string estadoProd = "";
                double xpreCompr  = 0;
                double xUtilidad  = 0;

                var lis = ltsProductos.SelectedItems[0];

                lblNomProd.Text    = lis.SubItems[1].Text;
                lblPreUnid.Text    = lis.SubItems[4].Text;
                lblIdProducto.Text = lis.SubItems[0].Text;
                stock            = Convert.ToDouble(lis.SubItems[2].Text);
                lblUtiUnit.Text  = lis.SubItems[9].Text;
                estadoProd       = lis.SubItems[10].Text;
                xpreCompr        = Convert.ToDouble(lis.SubItems[3].Text);
                lblTipoProd.Text = lis.SubItems[11].Text;
                lblUnid.Text     = lis.SubItems[8].Text;

                if (estadoProd.Trim() == "Eliminado")
                {
                    fil.Show(); adv.lbl_Msm1.Text = "El producto esta eliminado"; adv.ShowDialog(); fil.Hide(); return;
                }
                if (lblTipoProd.Text.Trim().ToString() == "Producto")
                {
                    if (stock == 0)
                    {
                        fil.Show(); adv.lbl_Msm1.Text = "El producto no cuenta con la cantidad suficiente"; adv.ShowDialog(); fil.Hide(); return;
                    }
                }
                if (cbxLlenarCarrito.Checked == true)
                {
                    fil.Show();
                    solo.lblTipoProd.Text = lblTipoProd.Text;
                    solo.lblStock.Text    = stock.ToString();
                    solo.txt_cant.Text    = "1";
                    solo.ShowDialog();
                    fil.Hide();
                    if (solo.Tag.ToString() == "A")
                    {
                        lblCant.Text       = solo.txt_cant.Text;
                        solo.txt_cant.Text = "";
                        //xUtilidad = Convert.ToDouble(lblCant.Text) - Convert.ToDouble(xpreCompr);
                        //lblUtiUnit.Text = xUtilidad.ToString("###0.00");
                        double importxx = Convert.ToDouble(lblCant.Text) * Convert.ToDouble(lblPreUnid.Text);
                        lblImport.Text = importxx.ToString("###0.00");
                        lblTotal.Text  = importxx.ToString();;

                        Agregar_Producto_Pedido(lblIdProducto.Text, lblNomProd.Text, lblUnid.Text, Convert.ToDouble(lblCant.Text),
                                                Convert.ToDouble(lblPreUnid.Text), Convert.ToDouble(lblImport.Text), Convert.ToDouble(lblUtiUnit.Text),
                                                Convert.ToDouble(lblTotal.Text), lblTipoProd.Text);
                        LimpiarLabels();
                    }
                }
                else
                {
                    fil.Show();
                    solo.lblTipoProd.Text = lblTipoProd.Text;
                    solo.lblStock.Text    = stock.ToString();
                    solo.txt_cant.Text    = "1";
                    solo.ShowDialog();
                    fil.Hide();

                    try
                    {
                        if (solo.Tag.ToString() == "A")
                        {
                            lblCant.Text       = solo.txt_cant.Text;
                            solo.txt_cant.Text = "";
                            //xUtilidad = Convert.ToDouble(lblCant.Text) - Convert.ToDouble(xpreCompr);
                            //lblUtiUnit.Text = xUtilidad.ToString("###0.00");
                            double importxx = Convert.ToDouble(lblCant.Text) * Convert.ToDouble(lblPreUnid.Text);
                            lblImport.Text = importxx.ToString("###0.00");
                            this.Tag       = "A";
                            this.Close();
                        }
                    }
                    catch (Exception)
                    {
                        solo.Tag = "";
                        this.Close();
                    }
                }
            }
        }
Beispiel #6
0
        //private void txtMargenUtilidad_TextChanged(object sender, EventArgs e)
        //{
        //txtMargenUtilidad.Text = txtMargenUtilidad.Text.Replace(",", ".");
        //txtMargenUtilidad.SelectionStart = txtMargenUtilidad.Text.Length;

        //try
        //{
        //    if (txtMargenUtilidad.Text.Trim() == "") { return; }
        //    if (txtPrecioCompra.Text.Trim() == "") { return; }

        //    double precio_compra = 0;
        //    double utilidad = 0;

        //    precio_compra = Convert.ToDouble(txtPrecioCompra.Text) * Convert.ToDouble(txtMargenUtilidad.Text);
        //    txtPrecioVentaMenor.Text = precio_compra.ToString("##.00");

        //    utilidad = Convert.ToDouble(txtPrecioVentaMenor.Text) - Convert.ToDouble(txtPrecioCompra.Text);
        //    txtUtilidad.Text = utilidad.ToString("##.00");
        //}
        //catch(Exception ex)
        //{
        //    string sms = ex.Message;
        //}
        //}

        private void registrar()
        {
            RN_Productos    obj      = new RN_Productos();
            EN_Producto     producto = new EN_Producto();
            Frm_Filtro      fil      = new Frm_Filtro();
            Frm_Exito       ex       = new Frm_Exito();
            Frm_Advertencia adv      = new Frm_Advertencia();

            try
            {
                producto.Idpro       = txtIdProducto.Text;
                producto.Idprove     = lblidproveedor.Text;
                producto.Descripcion = txtdescripcion_producto.Text;
                producto.Utilidad    = Convert.ToDouble(txtUtilidad.Text);
                producto.Pre_compra  = Convert.ToDouble(txtPrecioCompra.Text);
                producto.StockActual = 0;
                producto.Pre_Venta   = Convert.ToDouble(txtPrecioVenta.Text);
                producto.IdCat       = Convert.ToInt32(lblidcat.Text);
                producto.IdMar       = Convert.ToInt32(lblidmarca.Text);
                if (xFotoruta.Trim().Length < 5)
                {
                    producto.Foto = ".";
                }
                else
                {
                    producto.Foto = xFotoruta;
                }
                producto.Pre_Venta_Menor = Convert.ToDouble(txtPrecioVentaMenor.Text);
                producto.Pre_Venta_Mayor = Convert.ToDouble(txtPrecioVentaMayor.Text);
                producto.UndMdida        = cmbUnidadMedida.Text;
                producto.PesoUnit        = Convert.ToDouble(txtPesoUnit.Text);
                producto.Utilidad        = Convert.ToDouble(txtUtilidad.Text);
                producto.TipoProd        = cmbTipoProducto.Text;
                producto.ValorporProd    = 0;
                producto.ClaveSAT        = txtClaveSat.Text;

                obj.RN_Registrar_Producoto(producto);

                if (BD_Productos.seguardo == true)
                {
                    if (cmbTipoProducto.SelectedIndex == 0)
                    {
                        Registrar_Kardex(txtIdProducto.Text);
                    }

                    RN_TipoDoc.RN_Actualizar_NumeroCorrelativo_Producto(4);
                    //RN_TipoDoc.RN_Actualizar_Tipo_Doc(4);
                    fil.Show();
                    ex.lbl_Msm1.Text = "Producto Guardado Exitosamente.";
                    ex.ShowDialog();
                    fil.Hide();

                    this.Tag = "A";
                    this.Close();
                }
            }
            catch (Exception e)
            {
                fil.Show();
                adv.lbl_Msm1.Text = "Error al guardar el producto: " + e.Message;
                adv.ShowDialog();
                fil.Hide();
            }
        }
Beispiel #7
0
        private void Registrar_Compra()
        {
            EN_IngresoCompra     com = new EN_IngresoCompra();
            EN_Det_IngresoCompra det = new EN_Det_IngresoCompra();
            RN_IngresoCompra     obj = new RN_IngresoCompra();
            RN_Productos         pro = new RN_Productos();

            Frm_Filtro      fil  = new Frm_Filtro();
            Frm_Advertencia adv  = new Frm_Advertencia();
            Frm_Exito       exit = new Frm_Exito();

            try
            {
                com.IdCom            = txt_IdComp.Text;
                com.Nro_Fac_Fisico1  = txt_NroFisico.Text;
                com.IdProvee1        = cbo_provee.SelectedValue.ToString();
                com.SubTotal_Com1    = Convert.ToDouble(lbl_subtotal.Text);
                com.FechaIngre1      = dtp_FechaCom.Value;
                com.IdUsu1           = Convert.ToInt32(Cls_Libreria.IdUsu);
                com.ModalidadPago1   = cbo_tipoPago.Text;
                com.TiempoEspera1    = 0;
                com.FechaVence1      = dtp_FechaVenc.Value;
                com.EstadoIngre1     = "Activo";
                com.RecibiConforme1  = conforme;
                com.Datos_Adicional1 = txt_obser.Text;
                com.Tipo_Doc_Compra1 = cbo_tipoDoc.Text;

                obj.RN_Ingresar_RegistroCompra(com);

                if (BD_IngresoCompra.guardado == true)
                {
                    RN_TipoDoc.RN_Actualizar_NumeroCorrelativo_Producto(9);

                    for (int i = 0; i < lsv_Det.Items.Count; i++)
                    {
                        var item = lsv_Det.Items[i];
                        det.Id_ingreso1 = txt_IdComp.Text;
                        det.Id_Pro1     = item.SubItems[0].Text;
                        det.Cantidad1   = Convert.ToDouble(item.SubItems[2].Text);
                        det.Precio1     = Convert.ToDouble(item.SubItems[3].Text);
                        det.Importe1    = Convert.ToDouble(item.SubItems[4].Text);

                        obj.RN_Insertar_Detalle_RegistroCompra(det);
                        Registrar_Movimiento_Kardex(det.Id_Pro1.Trim(), det.Cantidad1, det.Precio1);

                        double utilidad     = 0;
                        double valorAlmacen = 0;
                        double preCompra    = det.Precio1;
                        double PreVenta     = 0;
                        double xUtilidad    = 0;

                        xUtilidad    = BuscarUtilidad_Producto(det.Id_Pro1.Trim());
                        PreVenta     = xUtilidad * preCompra;
                        utilidad     = PreVenta - preCompra;
                        valorAlmacen = det.Cantidad1 * preCompra;
                        pro.RN_Actualizar_PrecioCompra_Producto(det.Id_Pro1.Trim(), preCompra,
                                                                PreVenta, utilidad, valorAlmacen);
                    }
                    fil.Show();
                    exit.lbl_Msm1.Text = "La compra se ha registrado correctamente";
                    exit.ShowDialog();
                    fil.Hide();
                    lsv_Det.Items.Clear();
                    cbo_provee.SelectedIndex = -1;
                    txt_NroFisico.Text       = "";
                    cbo_tipoPago.Text        = "";
                    this.Tag = "A";
                    this.Close();
                }
            }
            catch (Exception ex)
            {
                fil.Show();
                adv.lbl_Msm1.Text = "Error al Guardar la compra: " + ex.Message;
                adv.ShowDialog();
                fil.Hide();
            }
        }
Beispiel #8
0
        private void Guardar_Cotizacion()
        {
            RN_Cotizacion          obj        = new RN_Cotizacion();
            EN_Cotizacion          coti       = new EN_Cotizacion();
            Frm_Filtro             fil        = new Frm_Filtro();
            Frm_Exito              ex         = new Frm_Exito();
            Frm_Advertencia        adv        = new Frm_Advertencia();
            Frm_Print_Cotizaciones informeCot = new Frm_Print_Cotizaciones();

            try
            {
                GuardarPedido();
                if (BD_Pedido.guarda == true && BD_Pedido.detalleguarda == true)
                {
                    txtNroCotiza.Text    = RN_TipoDoc.RN_Nro_id(11);
                    coti.IdCotizacion    = txtNroCotiza.Text;
                    coti.IdPedido        = txtIdPedido.Text;
                    coti.FechaCotizacion = dtp_FechaEmi.Value;
                    coti.Vigencia        = Convert.ToInt32(nud_vigencia.Value);
                    coti.TotalCoti       = Convert.ToDouble(lbl_TotalPagar.Text);
                    coti.Condiciones     = txt_condicion.Text;
                    if (chk_sinIgv.Checked == true)
                    {
                        coti.PrecioConIgv = "No";
                    }
                    else
                    {
                        coti.PrecioConIgv = "Si";
                    }
                    coti.EstadoCoti = "Pendiente";

                    obj.RN_Registrar_Cotizacion(coti);

                    if (BD_Cotizacion.guardo == true)
                    {
                        //Mandar a imprimir cotizacion
                        fil.Show();
                        informeCot.Tag = txtNroCotiza.Text;
                        informeCot.Crear_Impresion_Cotizacion();
                        informeCot.ShowDialog();
                        fil.Hide();


                        RN_TipoDoc.RN_Actualizar_NumeroCorrelativo_Producto(11);
                        fil.Show();
                        ex.lbl_Msm1.Text = "Cotizacion Guardada Exitosamente.";
                        ex.ShowDialog();
                        fil.Hide();

                        pnl_sinProd.Visible = true;
                        lsv_Det.Items.Clear();
                        txt_cliente.Text   = "";
                        txtNroCotiza.Text  = "";
                        txtIdPedido.Text   = "";
                        lblIdCliente.Text  = "-";
                        txt_condicion.Text = ""; chk_sinIgv.Checked = false;
                        nud_vigencia.Value = 1;
                    }
                }
            }
            catch (Exception e)
            {
                fil.Show();
                adv.lbl_Msm1.Text = "Error al guardar la cotización: " + e.Message;
                adv.ShowDialog();
                fil.Hide();
            }
        }
Beispiel #9
0
        private void Agregar_Productos_carro(string xxidProd, string xxnomprod, double xxcant, double xxprecio, double xximporte, string xunid, string xtipoProd, double xutilidadUnit)
        {
            Frm_Advertencia adv = new Frm_Advertencia();
            Frm_Filtro      fil = new Frm_Filtro();

            try
            {
                if (lsv_Det.Items.Count == 0)
                {
                    ListViewItem item = new ListViewItem();
                    item = lsv_Det.Items.Add(xxidProd);
                    item.SubItems.Add(xxnomprod.Trim());
                    item.SubItems.Add(xxcant.ToString());
                    item.SubItems.Add(xxprecio.ToString("###0.00"));
                    item.SubItems.Add(xximporte.ToString("###0.00"));
                    item.SubItems.Add(xtipoProd.ToString());
                    item.SubItems.Add(xunid.ToString());
                    item.SubItems.Add(xutilidadUnit.ToString("###0.00"));
                    item.SubItems.Add(xutilidadUnit.ToString("###0.00"));

                    Calcular();
                    lsv_Det.Focus();
                    lsv_Det.Items[0].Selected = true;
                    pnl_sinProd.Visible       = false;
                }
                else
                {
                    for (int i = 0; i < lsv_Det.Items.Count; i++)
                    {
                        if (lsv_Det.Items[i].Text.Trim() == xxidProd.Trim())
                        {
                            fil.Show();
                            adv.lbl_Msm1.Text = "El producto ya fue agregado al carrito de compras";
                            adv.ShowDialog();
                            fil.Hide();
                        }
                    }

                    ListViewItem item = new ListViewItem();
                    item = lsv_Det.Items.Add(xxidProd);
                    item.SubItems.Add(xxnomprod.Trim());
                    item.SubItems.Add(xxcant.ToString());
                    item.SubItems.Add(xxprecio.ToString("###0.00"));
                    item.SubItems.Add(xximporte.ToString("###0.00"));
                    item.SubItems.Add(xtipoProd.ToString());
                    item.SubItems.Add(xunid.ToString());
                    item.SubItems.Add(xutilidadUnit.ToString("###0.00"));
                    item.SubItems.Add(xutilidadUnit.ToString("###0.00"));

                    Calcular();
                    lsv_Det.Focus();
                    lsv_Det.Items[0].Selected = true;
                }
            }
            catch (Exception ex)
            {
                fil.Show();
                adv.lbl_Msm1.Text = "Ha ocurrido un error al guardar: " + ex.Message;
                adv.ShowDialog();
                fil.Hide();
            }
        }