Example #1
0
 private void TBUsuario_TextChanged(object sender, EventArgs e)
 {
     if (Negocio.Trabajador.Buscar_Usuario(TBUsuario.Text) != null)
     {
         MensajeError();
         MessageBox.Show("Usuario:" + TBUsuario.Text);
         EPErrorIcono.SetError(TBUsuario, "El Usuario ya Existe");
     }
 }
Example #2
0
        private void BGuardar_Click(object sender, EventArgs e)
        {
            try
            {
                string respuesta = string.Empty;

                if (CBComprobante.Text == string.Empty || TBSerie.Text == string.Empty ||
                    TBCorrelativo.Text == string.Empty || IdCliente == null)
                {
                    MensajeError();
                    if (CBComprobante.Text.Equals(string.Empty))
                    {
                        EPErrorIcono.SetError(CBComprobante, "Selecciona un comprobante");
                    }
                    if (TBSerie.Text.Equals(string.Empty))
                    {
                        EPErrorIcono.SetError(TBSerie, "Ingrese un numero de serie");
                    }
                    if (TBCorrelativo.Text == string.Empty)
                    {
                        EPErrorIcono.SetError(TBCorrelativo, "Escriba un Correlativo");
                    }
                    if (TBCliente.Text.Equals(string.Empty))
                    {
                        EPErrorIcono.SetError(TBCliente, "Seleccione un Cliente");
                    }
                }
                else
                {
                    if (Nuevo())
                    {
                        respuesta = Negocio.Venta.Insertar(Convert.ToInt32(IdTrabajador), Convert.ToInt32(IdCliente), DTPFecha.Value,
                                                           CBComprobante.Text, TBSerie.Text, TBCorrelativo.Text, Convert.ToDecimal(TBIgv.Text), DtDetalles);
                    }
                    if (respuesta.Equals("Ok"))
                    {
                        if (isNuevo)
                        {
                            MensajeOK("Se Inserto de forma Correcta el registro");
                        }
                    }
                    else
                    {
                        MensajeError(respuesta);
                    }
                    Clear();
                    ClearDetalle();
                    Mostrar();
                }
            } catch (Exception ex)
            {
                MessageBox.Show(ex + ex.StackTrace, "Excepcion", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
Example #3
0
 private void BAdd_Click(object sender, EventArgs e)
 {
     try
     {
         if (IdArticulo == null || MUDCantidad.Text == string.Empty ||
             TBDescuento.Text == string.Empty || TBStockActual.Text == string.Empty)
         {
             MensajeError();
             if (TBArticulo.Text.Equals(string.Empty))
             {
                 EPErrorIcono.SetError(TBArticulo, "Seleccion un Articulo");
             }
             if (MUDCantidad.Text.Equals(string.Empty))
             {
                 EPErrorIcono.SetError(MUDCantidad, "Ingrese un Cantidad");
             }
             if (TBDescuento.Text.Equals(string.Empty))
             {
                 EPErrorIcono.SetError(TBPrecio_venta, "Ingrese un Descuento");
             }
             if (TBStockActual.Text.Equals(string.Empty))
             {
                 EPErrorIcono.SetError(TBStockActual, "Ingrese un Stock Inicial");
             }
         }
         else
         {
             bool registrar = true;
             foreach (DataRow row in DtDetalles.Rows)
             {
                 if (Convert.ToInt32(row["idDetalle_ingreso"]) == IdArticulo)
                 {
                     registrar = false;
                     MensajeError("Ya se Encuentra el Articulo en el Detalle");
                 }
             }
             if (registrar && Convert.ToInt32(MUDCantidad.Value) <= Convert.ToInt32(TBStockActual.Text))
             {
                 decimal subTotal = Convert.ToDecimal(TBStockActual.Text) * Convert.ToDecimal(TBPrecio_venta.Text) - Convert.ToDecimal(TBDescuento.Text);
                 totalPagado        = totalPagado + subTotal;
                 LTotal_Pagado.Text = totalPagado.ToString("#0.00#");
                 //Agragar ese detalle al datalistadodetalles
                 DataRow row = DtDetalles.NewRow();
                 row["idDetalle_ingreso"] = IdArticulo;
                 row["Articulo"]          = TBArticulo.Text;
                 row["Cantidad"]          = Convert.ToInt32(MUDCantidad.Text);
                 row["precio_venta"]      = Convert.ToDecimal(TBPrecio_venta.Text);
                 row["Descuento"]         = Convert.ToDecimal(TBDescuento.Text);
                 row["SubTotal"]          = subTotal;
                 DtDetalles.Rows.Add(row);
                 DGVListados_detalles.Columns[0].Visible = false;
                 ClearDetalle();
             }
             else
             {
                 MensajeError("No Hay Stock suficiente");
             }
         }
     } catch (Exception ex)
     {
         MessageBox.Show(ex.Message + ex.StackTrace, "Excepcion", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
     }
 }
Example #4
0
        private void BGuardar_Click(object sender, EventArgs e)
        {
            try
            {
                string respuesta = string.Empty;

                if (TBNombre.Text == string.Empty || TBApellidos.Text == string.Empty || CBTipo_documento.SelectedItem == null || TBNum_documento.Text == string.Empty)
                {
                    MensajeError();
                    if (TBNombre.Text.Equals(string.Empty))
                    {
                        EPErrorIcono.SetError(TBNombre, "Ingrese un nombre");
                    }
                    if (TBApellidos.Text.Equals(string.Empty))
                    {
                        EPErrorIcono.SetError(TBApellidos, "Ingrese un apellido");
                    }
                    if (CBTipo_documento.SelectedItem == null)
                    {
                        EPErrorIcono.SetError(CBTipo_documento, "Seleccione un tipo de documento");
                    }
                    if (TBNum_documento.Text.Equals(string.Empty))
                    {
                        EPErrorIcono.SetError(TBNum_documento, "Ingrese un Numero de Documento");
                    }
                }
                else
                {
                    if (Nuevo())
                    {
                        respuesta = Negocio.Cliente.Insertar
                                        (System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase(TBNombre.Text.Trim().ToLower()),
                                        System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase(TBApellidos.Text.Trim().ToLower()),
                                        CBSexo.Text, DTPFecha_nacimiento.Value, CBTipo_documento.Text, TBNum_documento.Text.Trim(),
                                        TBDireccion.Text.Trim(), TBTelefono.Text.Trim(), TBEmail.Text.Trim().ToLower());
                    }
                    else
                    {
                        respuesta = Negocio.Cliente.Editar(System.Convert.ToInt32(IdCliente),
                                                           System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase(TBNombre.Text.Trim().ToLower()),
                                                           System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase(TBApellidos.Text.Trim().ToLower()),
                                                           CBSexo.Text, DTPFecha_nacimiento.Value, CBTipo_documento.Text, TBNum_documento.Text.Trim(),
                                                           TBDireccion.Text.Trim(), TBTelefono.Text.Trim(), TBEmail.Text.Trim().ToLower());
                    }
                    if (respuesta.Equals("Ok"))
                    {
                        if (isNuevo)
                        {
                            MensajeOK("Se Inserto de forma Correcta el registro");
                        }
                        else
                        {
                            MensajeOK("Se Actualizo de forma Correcta el registro");
                        }
                    }
                    else
                    {
                        MensajeError(respuesta);
                    }
                    Clear();
                    Mostrar();
                }
            } catch (Exception ex)
            {
                MessageBox.Show(ex.Message + ex.StackTrace, "Excepcion", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }