private bool ValidarCamposDetalle()
        {
            bool paso = true;

            if (string.IsNullOrWhiteSpace(CategoriacomboBox.Text))
            {
                MyerrorProvider.SetError(CategoriacomboBox, "El campo Categoria no puede estar vacio");
                CategoriacomboBox.Focus();
                paso = false;
            }

            if (CantidadnumericUpDown.Value == 0)
            {
                MyerrorProvider.SetError(CantidadnumericUpDown, "El campo Cantidad no puede ser cero");
                CantidadnumericUpDown.Focus();
                paso = false;
            }

            if (PrecionumericUpDown.Value == 0)
            {
                MyerrorProvider.SetError(PrecionumericUpDown, "El campo Precio no puede ser cero");
                PrecionumericUpDown.Focus();
                paso = false;
            }

            if (string.IsNullOrWhiteSpace(ImportetextBox.Text))
            {
                MyerrorProvider.SetError(ImportetextBox, "El campo Importe no puede ser cero");
                ImportetextBox.Focus();
                paso = false;
            }

            return(paso);
        }
Пример #2
0
        private bool Validar()
        {
            bool paso = true;

            MyErrorProvider.Clear();

            if (NombreTextBox.Text == string.Empty)
            {
                MyErrorProvider.SetError(NombreTextBox, "Este campo no puede estar vacio");
                NombreTextBox.Focus();
                paso = false;
            }
            if (CodigoNumericUpDown.Text == string.Empty)
            {
                MyErrorProvider.SetError(CodigoNumericUpDown, "Este campo no puede estar vacio");
                CodigoNumericUpDown.Focus();
                paso = false;
            }
            if (PrecionumericUpDown.Text == string.Empty)
            {
                MyErrorProvider.SetError(PrecionumericUpDown, "Este campo no puede estar vacio");
                PrecionumericUpDown.Focus();
                paso = false;
            }

            if (CantidadnumericUpDown3.Text == string.Empty)
            {
                MyErrorProvider.SetError(CantidadnumericUpDown3, "No puede dejar este campo vacio");
                CantidadnumericUpDown3.Focus();
                paso = false;
            }
            return(paso);
        }
Пример #3
0
 public bool Validar()
 {
     if (string.IsNullOrEmpty(DescripcionrichTextBox.Text))
     {
         errorProvider1.SetError(DescripcionrichTextBox, "Llenar Descripcion");
         return(false);
     }
     if (string.IsNullOrEmpty(PrecionumericUpDown.ToString()))
     {
         errorProvider1.SetError(PrecionumericUpDown, "No debes dejar el campo vacio!!!");
         return(false);
     }
     return(true);
 }
Пример #4
0
        private void AgragraAlGrid_Click(object sender, EventArgs e)
        {
            RepositorioBase <Productos> db = new RepositorioBase <Productos>();
            Productos producto;

            if (ProductocomboBox.Text == "")
            {
                return;
            }
            producto = db.Buscar((int)ProductocomboBox.SelectedValue);

            if (ProductocomboBox.Text == "")
            {
                errorProvider.SetError(ProductocomboBox, "Debe elegir un Producto");
                ProductocomboBox.Focus();
                return;
            }


            if (PrecionumericUpDown.Value < Convert.ToDecimal(producto.Costo))
            {
                errorProvider.SetError(PrecionumericUpDown, "El precio de venta debe ser mayor al precio del costo");
                PrecionumericUpDown.Focus();
                return;
            }

            if (producto.Existencia - Convert.ToDouble(CantidadnumericUpDown.Value) < 0)
            {
                errorProvider.SetError(CantidadnumericUpDown, "El almacen del producto no es suficiente ");
                CantidadnumericUpDown.Focus();
                return;
            }
            if (ExisteEnGrid() == false)
            {
                errorProvider.SetError(ProductocomboBox, "El Producto ya existe en el Grid");
                ProductocomboBox.Focus();
                return;
            }
            if (CantidadnumericUpDown.Value < 1)
            {
                errorProvider.SetError(CantidadnumericUpDown, "Debe elegir una cantidad ");
                CantidadnumericUpDown.Focus();
                return;
            }


            double import = Convert.ToDouble(PrecionumericUpDown.Value * CantidadnumericUpDown.Value);


            if (detalleDataGridView.DataSource != null)
            {
                this.Detalle = (List <VentasDetalle>)detalleDataGridView.DataSource;
            }

            this.Detalle.Add(new VentasDetalle()
            {
                VentaId    = Convert.ToInt32(VentaIdnumericUpDown.Value),
                ProductoId = Convert.ToInt32(ProductocomboBox.SelectedValue),
                Cantidad   = Convert.ToDouble(CantidadnumericUpDown.Value),
                Precio     = Convert.ToDouble(PrecionumericUpDown.Value),
                Importe    = import,
                Itbis      = (producto.ProductoItbis * import) / 100
            });

            LimpiaProducto();
            CargarGrid();
            CalcularItbis();
            CalcularSubtotal();
            CalcularTotal();
        }
Пример #5
0
        private bool Validar()
        {
            RepositorioBase <Productos> db = new RepositorioBase <Productos>();

            bool paso = true;

            errorProvider.Clear();

            if (DescripciontextBox.Text == string.Empty)
            {
                errorProvider.SetError(DescripciontextBox, "El campo Nombre no puede estar vacio");
                DescripciontextBox.Focus();
                paso = false;
            }

            if (ProveedorcomboBox.Text == string.Empty)
            {
                errorProvider.SetError(ProveedorcomboBox, "El proveedor no puede estra vacio");
                ProveedorcomboBox.Focus();
                paso = false;
            }

            if (NoDuplicadoProducto(DescripciontextBox.Text, (int)ProductoIdnumericUpDown.Value) == true)
            {
                errorProvider.SetError(DescripciontextBox, "El producto ya existe");
                DescripciontextBox.Focus();
                paso = false;
            }

            if (ProductoItbisnumericUpDown.Value < 0)
            {
                errorProvider.SetError(ProductoItbisnumericUpDown, "El rango debe ser de 0% a 18%");
                ProductoItbisnumericUpDown.Focus();
                paso = false;
            }

            if (ProductoItbisnumericUpDown.Value > 18)
            {
                errorProvider.SetError(ProductoItbisnumericUpDown, "El rango debe ser de 0% a 18%");
                ProductoItbisnumericUpDown.Focus();
                paso = false;
            }

            if (CostonumericUpDown.Value < 1)
            {
                errorProvider.SetError(CostonumericUpDown, "Seleccione un costo mayor");
                CostonumericUpDown.Focus();
                paso = false;
            }

            if (PrecionumericUpDown.Value < 1)
            {
                errorProvider.SetError(PrecionumericUpDown, "Seleccione un precio mayor");
                PrecionumericUpDown.Focus();
                paso = false;
            }
            if (PrecionumericUpDown.Value < CostonumericUpDown.Value)
            {
                errorProvider.SetError(PrecionumericUpDown, "El precio debe ser mayor o igual al costo");
                PrecionumericUpDown.Focus();
                paso = false;
            }
            return(paso);
        }