private void TxtCantidadArt_KeyPress(object sender, KeyPressEventArgs e) { if (!Soporte.ValidarFormatoMoneda(TxtCantidadArt.Text)) { } }
/// <summary> /// Asignamos el valor a La varaible cantidad, este se obtiene del TextBox TxtCantidadArt /// </summary> private bool AsignarValorCantidadArticulo() { if (dCantidad == 0) { if (string.IsNullOrEmpty(TxtCantidadArt.Text) || TxtCantidadArt.Text == "0") { dCantidad = 1; return(true); } else { if (sUnidad_MedidaVenta == "Pieza") { if (!ValidarEsDecimal()) { dCantidad = 1; } else { dCantidad = Convert.ToDecimal(TxtCantidadArt.Text); } return(true); } else { if (Soporte.ValidarFormatoMoneda(TxtCantidadArt.Text)) { dCantidad = Convert.ToDecimal(TxtCantidadArt.Text); return(true); } else { Soporte.MsgError("Error en los Datos ingresados de la cantidad"); return(false); } } } } else { if (sUnidad_MedidaVenta == "Pieza") { if (!ValidarEsDecimal()) { dCantidad = 1; return(true); } else { return(false); } } else { if (Soporte.ValidarFormatoMoneda(TxtCantidadArt.Text)) { dCantidad += Convert.ToDecimal(TxtCantidadArt.Text); return(true); } else { Soporte.MsgError("Error en los Datos ingresados de la cantidad"); return(false); } } } }
private bool ValidarTextBox() { if (CmbComprobante.SelectedIndex == 0) { Soporte.MsgInformacion("Seleccione un comprobante de la compra del Articulo"); CmbComprobante.Focus(); return(false); } if (Convert.ToInt32(CmbEmpresa.SelectedValue) == 0) { Soporte.MsgInformacion("Seleccione una Empres"); CmbEmpresa.Focus(); return(false); } if (Convert.ToInt32(CmbSucursal.SelectedValue) == 0) { Soporte.MsgInformacion("Seleccione una Sucursal"); CmbSucursal.Focus(); return(false); } if (Convert.ToInt32(CmbTipEntradas.SelectedValue) == 0) { Soporte.MsgInformacion("Seleccione un Tipo Entrada"); CmbTipEntradas.Focus(); return(false); } if (CmbProveedores.SelectedIndex == 0) { Soporte.MsgInformacion("Seleccione un Proveedor del comprobante."); CmbProveedores.Focus(); return(false); } if (string.IsNullOrEmpty(TxtCodigo.Text)) { Soporte.MsgInformacion("Ingrese Codigo del Articulo para poder agregar a la Lista"); TxtCodigo.Focus(); return(false); } if (string.IsNullOrEmpty(TxtDescripcion.Text)) { Soporte.MsgInformacion("Busque el Articulo ya que faltan datos para Agregar a la Lista."); TxtCodigo.Focus(); return(false); } if (string.IsNullOrEmpty(TxtCantidad.Text) && TxtCantidad.Text != "0") { Soporte.MsgInformacion("Ingrese la cantidad del articulo a Ingresar"); TxtCantidad.Focus(); return(false); } if (!Soporte.ValidarFormatoMoneda(TxtCantidad.Text)) { Soporte.MsgInformacion("El formato de la Cantidad no es Valido."); TxtCantidad.Focus(); return(false); } if (string.IsNullOrEmpty(TxtPrecioCompra.Text) && TxtPrecioCompra.Text != "0") { Soporte.MsgInformacion("Ingrese Precio del articulo"); TxtPrecioCompra.Focus(); return(false); } if (!Soporte.ValidarFormatoMoneda(TxtPrecioCompra.Text)) { Soporte.MsgInformacion("El formato de Precio de Compra no es Valido."); TxtPrecioCompra.Focus(); return(false); } if (string.IsNullOrEmpty(TxtGananciaObtener.Text) && TxtGananciaObtener.Text != "0") { Soporte.MsgInformacion("Ingrese la cantidad de la Ganancia a Obtener"); TxtGananciaObtener.Focus(); return(false); } if (!Soporte.ValidarFormatoMoneda(TxtGananciaObtener.Text)) { Soporte.MsgInformacion("El formato de Ganancia a Obtener no es Valido."); TxtGananciaObtener.Focus(); return(false); } if (Convert.ToInt32(CmbTipEntradas.SelectedValue) == 4) { if (string.IsNullOrEmpty(TxtNumComprobante.Text) && TxtNumComprobante.MaxLength < 2) { Soporte.MsgInformacion("El numero de comprobante no tiene el Formato correcto, revise."); TxtNumComprobante.Focus(); return(false); } if (string.IsNullOrEmpty(TxtTotalArticulos.Text) && TxtTotalArticulos.Text != "0") { Soporte.MsgInformacion("Ingrese la cantidad Total del Comprobante"); TxtTotalArticulos.Focus(); return(false); } if (!Soporte.ValidarFormatoMoneda(TxtTotalArticulos.Text)) { Soporte.MsgInformacion("El formato de Total Articulos no es Valido."); TxtTotalArticulos.Focus(); return(false); } if (string.IsNullOrEmpty(TxtMontoTotal.Text) && TxtMontoTotal.Text != "0") { Soporte.MsgInformacion("Ingrese el Monto Total del Comprobante"); TxtMontoTotal.Focus(); return(false); } if (!Soporte.ValidarFormatoMoneda(TxtMontoTotal.Text)) { Soporte.MsgInformacion("El formato del Monto Total no es Valido."); TxtMontoTotal.Focus(); return(false); } if (string.IsNullOrEmpty(TxtIvaTotal.Text) && TxtIvaTotal.Text != "0") { Soporte.MsgInformacion("Ingrese el Monto Total del Iva"); TxtIvaTotal.Focus(); return(false); } if (!Soporte.ValidarFormatoMoneda(TxtIvaTotal.Text)) { Soporte.MsgInformacion("El formato del Iva Total no es Valido."); TxtIvaTotal.Focus(); return(false); } } else { } return(true); }