private void btn_EliminarProducto_Click(object sender, RoutedEventArgs e)
        {
            decimal capturaSTotal = 0;
            decimal restaStotal   = 0;

            decimal.TryParse(txt_SubTotal.Text, out capturaSTotal);

            ListaProductoVenta lpv = new ListaProductoVenta();

            if (dg_ListaProductos.SelectedIndex >= 0)
            {
                lpv         = (ListaProductoVenta)dg_ListaProductosVenta.SelectedValue;
                restaStotal = capturaSTotal - lpv.precioTotal;

                lProVent.Remove(lpv);
                LLenarTablaVenta();

                txt_SubTotal.Text = restaStotal.ToString();
                txt_Total.Text    = restaStotal.ToString();
            }
        }
        private void btn_Agregar_Click(object sender, RoutedEventArgs e)
        {
            int     capturarCantidad = 0;
            decimal capturaSTotal    = 0;
            decimal sumaStotal       = 0;

            int.TryParse(txt_CantidadProducto.Text, out capturarCantidad);
            decimal.TryParse(txt_SubTotal.Text, out capturaSTotal);

            ListaProductoVenta lpv = new ListaProductoVenta();

            if (dg_ListaProductos.SelectedIndex >= 0 && capturarCantidad > 0)
            {
                ListaProductoFactura lpf = new ListaProductoFactura();
                lpf             = (ListaProductoFactura)dg_ListaProductos.SelectedValue;
                lpv.codigo      = lpf.codigo;
                lpv.nombre      = lpf.nombre;
                lpv.cantidad    = int.Parse(txt_CantidadProducto.Text);
                lpv.precio      = lpf.precio;
                lpv.precioTotal = (lpf.precio * int.Parse(txt_CantidadProducto.Text));

                sumaStotal = capturaSTotal + lpv.precioTotal;

                lProVent.Add(lpv);
                LLenarTablaVenta();

                txt_SubTotal.Text = sumaStotal.ToString();
                txt_Total.Text    = sumaStotal.ToString();
            }
            else if (capturarCantidad == 0)
            {
                MessageBox.Show("Debe asignar una cantidad!");
            }

            txt_CantidadProducto.Text = "";
            txt_FiltrarNombre.Text    = "";
        }