示例#1
0
        private void BtnActualizar_Click(object sender, EventArgs e)
        {
            try
            {
                string Rpta = "";
                if (txtId.Text == string.Empty || txtNombre.Text == string.Empty)
                {
                    this.MensajeError("Falta ingresa algunos datos, seran remarcados.");

                    Erroricono.SetError(txtNombre, "Ingrese un nombre");
                }
                else
                {
                    Rpta = NPersona.Actualizar(Convert.ToInt32(txtId.Text), "Cliente", this.NombreAnt, txtNombre.Text.Trim(), CboTipoDocumento.Text, txtNumDocumento.Text.Trim(), txtDireccion.Text.Trim(), txtTelefono.Text.Trim(), txtEmail.Text.Trim());
                    if (Rpta.Equals("OK"))
                    {
                        this.MensajeOK("Se actualizo de forma correcta el registro");
                        this.Limpiar();
                        this.Listar();
                    }
                    else
                    {
                        this.MensajeError(Rpta);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + ex.StackTrace);
            }
        }
示例#2
0
        private void BtnInsertar_Click(object sender, EventArgs e)
        {
            try
            {
                string Rpta = "";
                if (CboRol.Text == string.Empty || txtNombre.Text == string.Empty || txtEmail.Text == string.Empty || txtClave.Text == string.Empty)
                {
                    this.MensajeError("Falta ingresa algunos datos, seran remarcados.");
                    Erroricono.SetError(CboRol, "Seleccione un rol.");
                    Erroricono.SetError(txtNombre, "Ingrese un nombre");
                    Erroricono.SetError(txtEmail, "Ingrese un email.");
                    Erroricono.SetError(txtClave, "Ingrese una clave de acceso");
                }
                else
                {
                    Rpta = NUsuario.Insertar(Convert.ToInt32(CboRol.SelectedValue), txtNombre.Text.Trim(), CboTipoDocumento.Text, txtNumDocumento.Text.Trim(), txtDireccion.Text.Trim(), txtTelefono.Text.Trim(), txtEmail.Text.Trim(), txtClave.Text.Trim());
                    if (Rpta.Equals("OK"))
                    {
                        this.MensajeOK("Se inserto de forma correcta el registro");

                        this.Listar();
                    }
                    else
                    {
                        this.MensajeError(Rpta);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + ex.StackTrace);
            }
        }
示例#3
0
 private void BtnActualizar_Click(object sender, EventArgs e)
 {
     try
     {
         string Rpta = "";
         //Validamos que los campos necesarios esten llenos
         if (TxtNombre.Text == string.Empty || TxtId.Text == string.Empty)
         {
             this.MensajeError("Falta Ingresar Algunos Datos, Seran marcados.");
             Erroricono.SetError(TxtNombre, "Ingrese un nombre.");
         }
         //En caso de que no Ejecutamos el metodo Insertar
         else
         {
             //La Variable respuesta almacena los datos que deben ser actulizados,
             Rpta = NCategoria.Actualizar(Convert.ToInt32(TxtId.Text), this.NombreAnt, TxtNombre.Text.Trim(), TxtDescripcion.Text.Trim());
             if (Rpta.Equals("OK"))
             {
                 this.MensajeOK("Categoria Actualizada Exitosamente");
                 this.Limpiar();
                 this.Listar();
             }
             else
             {
                 this.MensajeError(Rpta);
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message + ex.StackTrace);
     }
 }
示例#4
0
        private void Limpiar()
        {
            txtBuscar.Clear();
            txtNombre.Clear();
            txtId.Clear();
            txtCodigo.Clear();
            panelCodigo.BackgroundImage = null;
            btnGuardarCodigo.Enabled    = true;
            txtPrecioVenta.Clear();
            txtStock.Clear();
            txtImagen.Clear();
            picImagen.Image = null;
            txtDescripcion.Clear();
            btnInsertar.Visible   = true;
            btnActualizar.Visible = false;
            Erroricono.Clear();



            DgvListado.Columns[0].Visible = false;// Para que la columna salga visible
            btnActivar.Visible            = false;
            btnDesactivar.Visible         = false;
            btnEliminar.Visible           = false;
            chkSeleccionar.Checked        = false;
        }
示例#5
0
 private void BtnInsertar_Click(object sender, EventArgs e)
 {
     try
     {
         string Rpta = "";
         if (txtIdProveedor.Text == string.Empty || txtImpuesto.Text == string.Empty || txtNumeroComprobante.Text == string.Empty || DtDetalle.Rows.Count == 0)
         {
             this.MensajeError("Falta ingresar algunos datos, serán remarcados.");
             Erroricono.SetError(txtIdProveedor, "Seleccione un proveedor.");
             Erroricono.SetError(txtImpuesto, "Ingrese un impuesto.");
             Erroricono.SetError(txtNumeroComprobante, "Ingrese el número del comprobante.");
             Erroricono.SetError(DgvDetalle, "Debe tener al menos un detalle.");
         }
         else
         {
             Rpta = NIngreso.Insertar(Convert.ToInt32(txtIdProveedor.Text), Varriables.IdUsuario, CboComprobante.Text, txtSerieComprobante.Text.Trim(), txtNumeroComprobante.Text.Trim(), Convert.ToDecimal(txtImpuesto.Text), Convert.ToDecimal(txtTotal.Text), DtDetalle);
             if (Rpta.Equals("OK"))
             {
                 this.MensajeOK("Se insertó de forma correcta el registro");
                 this.Limpiar();
                 this.Listar();
             }
             else
             {
                 this.MensajeError(Rpta);
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message + ex.StackTrace);
     }
 }
示例#6
0
 private void BtnInsertar_Click(object sender, EventArgs e)
 {
     try
     {
         string Rpta = "";
         if (txtNombre.Text == string.Empty)
         {
             this.MensajeError("Falta ingresa algunos datos, seran remarcados.");
             Erroricono.SetError(txtNombre, "Ingrese un nombre.");
         }
         else
         {
             Rpta = NCategoria.Insertar(txtNombre.Text.Trim(), txtDescripcion.Text.Trim());
             if (Rpta.Equals("OK"))
             {
                 this.MensajeOK("Se inserto de forma correcta el registro");
                 this.Limpiar();
                 this.Listar();
             }
             else
             {
                 this.MensajeError(Rpta);
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message + ex.StackTrace);
     }
 }
示例#7
0
        private void Btneliminar_Click(object sender, EventArgs e)
        {
            int Indice = 0;

            if (Chkeliminar.Checked)
            {
                if (Convert.ToBoolean(Datagridcliente.Rows[Indice].Cells[0].Value) != false)
                {
                    try
                    {
                        DialogResult Opcion;
                        Opcion = MessageBox.Show("Realmente Desea Eliminar los Registros", "Sistema de Ventas", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);

                        if (Opcion == DialogResult.OK)
                        {
                            string Codigo;
                            string Rpta = "";

                            foreach (DataGridViewRow row in Datagridcliente.Rows)
                            {
                                if (Convert.ToBoolean(row.Cells[0].Value))
                                {
                                    Codigo = Convert.ToString(row.Cells[1].Value);
                                    Rpta   = Ncliente.Eliminar(Convert.ToInt32(Codigo));

                                    if (Rpta.Equals("OK"))
                                    {
                                        this.MensajeOk("Se Eliminó Correctamente el registro");
                                    }
                                    else
                                    {
                                        this.MensajeError(Rpta);
                                    }
                                }
                            }
                            this.Mostrar();
                            this.Chkeliminar.Checked = false;
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message + ex.StackTrace);
                    }
                }
                else
                {
                    MensajeError("Debe Seleccionar un Cliente a Eliminar");
                    Erroricono.SetError(Datagridcliente, "Selecione un Cliente");
                }
            }
            else
            {
                MensajeError("Debe Seleccionar la Casilla");
                Erroricono.SetError(Chkeliminar, "Selecione la Casilla");
            }
        }
示例#8
0
 private void Btnagregar_Click(object sender, EventArgs e)
 {
     try
     {
         if (this.Txtidarticulo.Text == string.Empty || this.Txtcantidad.Text == string.Empty ||
             this.Txtdescuento.Text == string.Empty || this.Txtprecioventa.Text == string.Empty)
         {
             MensajeError("Falta ingresar algunos datos, serán remarcados");
             Erroricono.SetError(Txtidarticulo, "Ingrese un Valor");
             Erroricono.SetError(Txtcantidad, "Ingrese un Valor");
             Erroricono.SetError(Txtdescuento, "Ingrese un Valor");
             Erroricono.SetError(Txtprecioventa, "Ingrese un Valor");
         }
         else
         {
             bool registrar = true;
             foreach (DataRow row in dtDetalle.Rows)
             {
                 if (Convert.ToInt32(row["iddetalle_ingreso"]) == Convert.ToInt32(this.Txtidarticulo.Text))
                 {
                     registrar = false;
                     this.MensajeError("YA se encuentra el artículo en el detalle");
                 }
             }
             if (registrar && Convert.ToInt32(Txtcantidad.Text) <= Convert.ToInt32(Txtstockactual.Text))
             {
                 decimal subTotal = Convert.ToDecimal(this.Txtcantidad.Text) * Convert.ToDecimal(this.Txtprecioventa.Text) - Convert.ToDecimal(this.Txtdescuento.Text);
                 totalPagado += subTotal;
                 this.Lbltotalpagado.Text = totalPagado.ToString("#0.00#");
                 //Agregar ese detalle al datalistadoDetalle
                 DataRow row = this.dtDetalle.NewRow();
                 row["iddetalle_ingreso"] = Convert.ToInt32(this.Txtidarticulo.Text);
                 row["articulo"]          = this.Txtarticulo.Text;
                 row["cantidad"]          = Convert.ToInt32(this.Txtcantidad.Text);
                 row["precio_venta"]      = Convert.ToDecimal(this.Txtprecioventa.Text);
                 row["descuento"]         = Convert.ToDecimal(this.Txtdescuento.Text);
                 row["subtotal"]          = subTotal;
                 this.dtDetalle.Rows.Add(row);
                 this.limpiarDetalle();
             }
             else
             {
                 MensajeError("No hay Stock Suficiente");
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message + ex.StackTrace);
     }
 }
示例#9
0
 private void Btnagregar_Click(object sender, EventArgs e)
 {
     try
     {
         if (this.Txtidarticulo.Text == string.Empty || this.Txtstockinicial.Text == string.Empty ||
             this.Txtpreciocompra.Text == string.Empty || this.Txtprecioventa.Text == string.Empty)
         {
             MensajeError("Falta ingresar algunos datos, serán remarcados");
             Erroricono.SetError(Txtidarticulo, "Ingrese un Valor");
             Erroricono.SetError(Txtstockinicial, "Ingrese un Valor");
             Erroricono.SetError(Txtpreciocompra, "Ingrese un Valor");
             Erroricono.SetError(Txtprecioventa, "Ingrese un Valor");
         }
         else
         {
             bool registrar = true;
             foreach (DataRow row in DtDetalle.Rows)
             {
                 if (Convert.ToInt32(row["idarticulo"]) == Convert.ToInt32(this.Txtidarticulo.Text))
                 {
                     registrar = false;
                     this.MensajeError("YA se encuentra el artículo en el detalle");
                 }
             }
             if (registrar)
             {
                 decimal subTotal = Convert.ToDecimal(this.Txtstockinicial.Text) * Convert.ToDecimal(this.Txtpreciocompra.Text);
                 TotalPagado += subTotal;
                 this.Lbltotalpagado.Text = TotalPagado.ToString("#0.00#");
                 //Agregar ese detalle al datalistadoDetalle
                 DataRow row = this.DtDetalle.NewRow();
                 row["idarticulo"]         = Convert.ToInt32(this.Txtidarticulo.Text);
                 row["articulo"]           = this.Txtarticulo.Text;
                 row["precio_compra"]      = Convert.ToDecimal(this.Txtpreciocompra.Text);
                 row["precio_venta"]       = Convert.ToDecimal(this.Txtprecioventa.Text);
                 row["stock_inicial"]      = Convert.ToInt32(this.Txtstockinicial.Text);
                 row["fecha_ingreso"]      = Datetimefechaprod.Value;
                 row["fecha_modificacion"] = Datetimefechavenc.Value;
                 row["subtotal"]           = subTotal;
                 this.DtDetalle.Rows.Add(row);
                 this.LimpiarDetalle();
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message + ex.StackTrace);
     }
 }
示例#10
0
        //Este Metodo Limpia los campos
        private void Limpiar()
        {
            TxtBuscar.Clear();
            TxtNombre.Clear();
            TxtId.Clear();
            TxtDescripcion.Clear();
            BtnInsertar.Visible   = true;
            BtnActualizar.Visible = false;
            Erroricono.Clear();

            //Limpiar para seleccionar
            DgvListado.Columns[0].Visible = false;
            BtnActivar.Visible            = false;
            BtnDesactivar.Visible         = false;
            BtnEliminar.Visible           = false;
            ChkSeleccionar.Checked        = false;
        }
示例#11
0
        private void Btnguardar_Click(object sender, EventArgs e)
        {
            try
            {
                string rpta = "";
                if (this.Txtidcliente.Text == string.Empty || this.Txtserie.Text == string.Empty ||
                    this.Txtcorrelativo.Text == string.Empty || this.Txtigv.Text == string.Empty)
                {
                    MensajeError("Falta ingresar algunos datos, serán remarcados");
                    Erroricono.SetError(Txtidcliente, "Ingrese un Valor");
                    Erroricono.SetError(Txtserie, "Ingrese un Valor");
                    Erroricono.SetError(Txtcorrelativo, "Ingrese un Valor");
                    Erroricono.SetError(Txtigv, "Ingrese un Valor");
                }
                else
                {
                    if (this.IsNuevo)
                    {
                        rpta = Nventa.Insertar(Convert.ToInt32(this.Txtidcliente.Text), Idtrabajador,
                                               Datetimefecha.Value, Cmbcomprovante.Text, Txtserie.Text, Txtcorrelativo.Text,
                                               Convert.ToDecimal(Txtigv.Text), dtDetalle);
                    }
                    if (rpta.Equals("OK"))
                    {
                        if (this.IsNuevo)
                        {
                            this.MensajeOk("Se Insertó de forma correcta el registro");
                        }
                    }
                    else
                    {
                        this.MensajeError(rpta);
                    }

                    this.IsNuevo = false;
                    this.Botones();
                    this.Limpiar();
                    this.limpiarDetalle();
                    this.Mostrar();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + ex.StackTrace);
            }
        }
示例#12
0
        private void Limpiar()
        {
            txtBuscar.Clear();
            txtNombre.Clear();
            txtId.Clear();
            txtDescripcion.Clear();
            btnInsertar.Visible   = true;
            btnActualizar.Visible = false;
            Erroricono.Clear();



            DgvListado.Columns[0].Visible = false;// Para que la columna salga visible
            btnActivar.Visible            = false;
            btnDesactivar.Visible         = false;
            btnEliminar.Visible           = false;
            chkSeleccionar.Checked        = false;
        }
示例#13
0
 private void BtnActualizar_Click(object sender, EventArgs e)
 {
     try
     {
         string Rpta = "";
         //Validamos que los campos necesarios esten llenos
         if (TxtId.Text == string.Empty || CboCategoria.Text == string.Empty || TxtNombre.Text == string.Empty || TxtStock.Text == string.Empty || TxtPrecio_Venta.Text == string.Empty || TxtCodigo.Text == string.Empty || TxtDescripcion.Text == string.Empty)
         {
             this.MensajeError("Falta Ingresar Algunos Datos, Seran marcados.");
             Erroricono.SetError(CboCategoria, "Ingrese un Categoria.");
             Erroricono.SetError(TxtNombre, "Ingrese un Nombre.");
             Erroricono.SetError(TxtStock, "Ingrese un Stock.");
             Erroricono.SetError(TxtPrecio_Venta, "Ingrese un Precio de Venta.");
             Erroricono.SetError(TxtCodigo, "Ingrese un Codigo de Barras.");
             Erroricono.SetError(TxtDescripcion, "Ingrese una descripcion.");
         }
         //En caso de que no Ejecutamos el metodo Insertar
         else
         {
             Rpta = NArticulo.Actualizar(Convert.ToInt32(TxtId.Text), Convert.ToInt32(CboCategoria.SelectedValue), TxtCodigo.Text.Trim(), this.NombreAnt, TxtNombre.Text.Trim(), Convert.ToDecimal(TxtPrecio_Venta.Text.Trim()), Convert.ToInt32(TxtStock.Text.Trim()), TxtDescripcion.Text.Trim(), TxtImagen.Text.Trim());
             if (Rpta.Equals("OK"))
             {
                 this.MensajeOK("Se actualizo Correctamente");
                 if (TxtImagen.Text != string.Empty && this.RutaOrigen != string.Empty)
                 {
                     RutaDestino = this.Directorio + TxtImagen.Text;
                     File.Copy(this.RutaOrigen, RutaDestino);
                 }
                 this.Listar();
                 TabGeneral.SelectedIndex = 0;
             }
             else
             {
                 this.MensajeError(Rpta);
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message + ex.StackTrace);
     }
 }
示例#14
0
        private void Limpiar()
        {
            txtBuscar.Clear();
            txtId.Clear();
            txtCodigo.Clear();
            txtIdProveedor.Clear();
            txtNombreProveedor.Clear();
            txtSerieComprobante.Clear();
            txtNumeroComprobante.Clear();
            DtDetalle.Clear();
            txtSubTotal.Text      = "0.00";
            txtTotalImpuesto.Text = "0.00";
            txtTotal.Text         = "0.00";

            Erroricono.Clear();



            DgvListado.Columns[0].Visible = false;// Para que la columna salga visible
            BtnAnular.Visible             = false;
            ChkSeleccionar.Checked        = false;
        }
示例#15
0
        private void BtnActualizar_Click(object sender, EventArgs e)
        {
            try
            {
                string Rpta = "";
                if (txtId.Text == string.Empty || cboCategoria.Text == string.Empty || txtNombre.Text == string.Empty || txtPrecioVenta.Text == string.Empty || txtStock.Text == string.Empty)
                {
                    this.MensajeError("Falta ingresa algunos datos, seran remarcados.");
                    Erroricono.SetError(cboCategoria, "Seleccione una categoria.");
                    Erroricono.SetError(txtNombre, "Ingrese un nombre.");
                    Erroricono.SetError(txtPrecioVenta, "Ingrese un precio.");
                    Erroricono.SetError(txtStock, "Ingrese un stock inicial.");
                }
                else
                {
                    Rpta = NArticulo.Actualizar(Convert.ToInt32(txtId.Text), Convert.ToInt32(cboCategoria.SelectedValue), txtCodigo.Text.Trim(), this.NombreAnt, txtNombre.Text.Trim(), Convert.ToDecimal(txtPrecioVenta.Text), Convert.ToInt32(txtStock.Text), txtDescripcion.Text.Trim(), txtImagen.Text.Trim());
                    if (Rpta.Equals("OK"))
                    {
                        this.MensajeOK("Se Actualizo de forma correcta el registro");
                        if (txtImagen.Text != string.Empty && this.RutaOrigen != string.Empty)
                        {
                            this.RutaDestino = this.Directorio + txtImagen.Text;
                            File.Copy(this.RutaOrigen, this.RutaDestino);
                        }

                        this.Listar();
                        tabControl1.SelectedIndex = 0;
                    }
                    else
                    {
                        this.MensajeError(Rpta);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + ex.StackTrace);
            }
        }
示例#16
0
 //Boton para insertar registro
 private void BtnInsertar_Click(object sender, EventArgs e)
 {
     try
     {
         string Rpta = "";
         //Validamos que los campos necesarios esten llenos
         if (CboRol.Text == string.Empty || TxtNombre.Text == string.Empty || CboTipoDocumento.Text == string.Empty || TxtNumeroDocumento.Text == string.Empty || TxtTelefono.Text == string.Empty || TxtDireccion.Text == string.Empty || TxtDireccion.Text == string.Empty || TxtEmail.Text == string.Empty || TxtClave.Text == string.Empty)
         {
             this.MensajeError("Falta Ingresar Algunos Datos, Seran marcados.");
             Erroricono.SetError(CboRol, "Ingrese un Rol.");
             Erroricono.SetError(TxtNombre, "Ingrese un nombre.");
             Erroricono.SetError(CboTipoDocumento, "Ingrese un tipo de documento.");
             Erroricono.SetError(TxtNumeroDocumento, "Ingrese un numero de documento.");
             Erroricono.SetError(TxtTelefono, "Ingrese un numero de telefono.");
             Erroricono.SetError(TxtDireccion, "Ingrese una Direecion");
             Erroricono.SetError(TxtEmail, "Ingrese un Email");
             Erroricono.SetError(TxtClave, "Ingrese una Clave.");
         }
         //En caso de que no Ejecutamos el metodo Insertar
         else
         {
             Rpta = NUsuario.Insertar(Convert.ToInt32(CboRol.SelectedValue), TxtNombre.Text.Trim(), CboTipoDocumento.Text.Trim(), TxtNumeroDocumento.Text.Trim(), TxtDireccion.Text.Trim(), TxtTelefono.Text.Trim(), TxtEmail.Text.Trim(), TxtClave.Text.Trim());
             if (Rpta.Equals("OK"))
             {
                 this.MensajeOK("Usuario Creado Exitosamente");
                 this.Listar();
             }
             else
             {
                 this.MensajeError(Rpta);
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message + ex.StackTrace);
     }
 }
示例#17
0
        private void Btnguardar_Click(object sender, EventArgs e)
        {
            try
            {
                string Rpta = "";
                if (this.Txtnombre.Text == string.Empty || this.Txtapellidos.Text == string.Empty ||
                    this.Txtnumdocumento.Text == string.Empty ||
                    this.Txtdireccion.Text == string.Empty)
                {
                    MensajeError("Falta ingresar algunos datos, serán remarcados");
                    Erroricono.SetError(Txtnombre, "Ingrese un Valor");
                    Erroricono.SetError(Txtapellidos, "Ingrese un Valor");
                    Erroricono.SetError(Txtnumdocumento, "Ingrese un Valor");
                    Erroricono.SetError(Txtdireccion, "Ingrese un Valor");
                }
                else
                {
                    if (this.IsNuevo)
                    {
                        Rpta = Ncliente.Insertar(this.Txtnombre.Text.Trim().ToUpper(),
                                                 this.Txtapellidos.Text.Trim().ToUpper(),
                                                 this.Cmbsexo.Text, Dtfechanacimiento.Value, Cmbtipodocumento.Text,
                                                 Txtnumdocumento.Text, Txtdireccion.Text, Txttelefono.Text,
                                                 Txtemailcli.Text);
                    }
                    else
                    {
                        Rpta = Ncliente.Editar(Convert.ToInt32(this.Txtidcliente.Text),
                                               this.Txtnombre.Text.Trim().ToUpper(),
                                               this.Txtapellidos.Text.Trim().ToUpper(),
                                               this.Cmbsexo.Text, Dtfechanacimiento.Value, Cmbtipodocumento.Text,
                                               Txtnumdocumento.Text, Txtdireccion.Text, Txttelefono.Text,
                                               Txtemailcli.Text);
                    }

                    if (Rpta.Equals("OK"))
                    {
                        if (this.IsNuevo)
                        {
                            this.MensajeOk("Se Insertó de forma correcta el registro");
                        }
                        else
                        {
                            this.MensajeOk("Se Actualizó de forma correcta el registro");
                        }
                    }
                    else
                    {
                        this.MensajeError(Rpta);
                    }

                    this.IsNuevo  = false;
                    this.IsEditar = false;
                    this.Botones();
                    this.Limpiar();
                    this.Mostrar();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + ex.StackTrace);
            }
        }