Ejemplo n.º 1
0
 private void btnguardar_Click(object sender, EventArgs e)
 {
     dbgLista.Enabled = true;
     if (txtNomCat.Text == "" || cmbUbicacion.Text == "" || txtdescripcion.Text == "")
     {
         SYSCON.MensajeValidacion(this.groupBox2);
     }
     else
     {
         if (MessageBox.Show("¿Estas seguro de agregar?", "advertencia",
                             MessageBoxButtons.YesNo,
                             MessageBoxIcon.Question,
                             MessageBoxDefaultButton.Button1) == DialogResult.Yes)
         {
             try
             {
                 SqlDataAdapter da = new SqlDataAdapter("Sp_InsertarCategoria '" + txtNomCat.Text.ToUpper() + "','" + txtdescripcion.Text.ToUpper() + "','" + Convert.ToInt32(cmbUbicacion.SelectedValue) + "'", SYSCON.cadconex);
                 DataTable      dt = new DataTable();
                 da.Fill(dt);
                 da.Dispose();
                 cargartabla();
             }
             catch
             {
                 MessageBox.Show("Error, no se inserto registro");
             }
         }
     }
 }
Ejemplo n.º 2
0
        private void btnsalir_Click(object sender, EventArgs e)
        {
            if (txtnombre.Text == "" || nudstockmin.Value == 0 || txtmarca.Text == "" || cmbcategoria.Text == "" || cmbsubcategoria.Text == "" || cmbunidadmedida.Text == "")
            {
                SYSCON.MensajeValidacion(this.groupBox2);
            }

            else
            {
                if (MessageBox.Show("¿Estas seguro de actualizar?", "advertencia",
                                    MessageBoxButtons.YesNo,
                                    MessageBoxIcon.Question,
                                    MessageBoxDefaultButton.Button1) == DialogResult.Yes)
                {
                    try
                    {
                        SqlDataAdapter da = new SqlDataAdapter("Sp_ActualizarProducto '" + txtcodigo.Text + "','" + txtnombre.Text + "','" + Convert.ToDouble(nudpreciov.Value) + "','" + Convert.ToInt32(cmbcategoria.SelectedValue) + "','" + txtmarca.Text.ToUpper() + "','" + Convert.ToInt32(nudstockactual.Value) + "','" + Convert.ToInt32(cmbunidadmedida.SelectedValue) + "','" + Convert.ToInt32(cmbsubcategoria.SelectedValue) + "','" + Convert.ToInt32(nudstockmin.Value) + "','" + Convert.ToDouble(nudprecioc.Value) + "'", SYSCON.cadconex);
                        DataTable      dt = new DataTable();
                        da.Fill(dt);
                        da.Dispose();
                        cargartabla();
                    }
                    catch
                    {
                        MessageBox.Show("Error, no se actualizó registro");
                    }
                }
            }
        }
Ejemplo n.º 3
0
 private void btnsalir_Click(object sender, EventArgs e)
 {
     if (txtdescripcion.Text == "")
     {
         SYSCON.MensajeValidacion(this.groupBox2);
         txtdescripcion.Focus();
     }
     else
     {
         if (MessageBox.Show("¿Estas seguro de actualizar?", "advertencia",
                             MessageBoxButtons.YesNo,
                             MessageBoxIcon.Question,
                             MessageBoxDefaultButton.Button1) == DialogResult.Yes)
         {
             try
             {
                 SqlDataAdapter da = new SqlDataAdapter("Sp_ActualizarUbicacion '" + txtdescripcion.Text.ToUpper() + "','" + txtcodigo.Text + "'", SYSCON.cadconex);
                 DataTable      dt = new DataTable();
                 da.Fill(dt);
                 cargartabla();
                 da.Dispose();
             }
             catch
             {
                 MessageBox.Show("Error, no se actualizó registro");
             }
         }
     }
 }
Ejemplo n.º 4
0
        private void btnAgregar_Click(object sender, EventArgs e)
        {
            if (txtmotivo.Text == "" || cmbtipodoc.Text == "" || txtNumeroDoc.Text == "" || txtpersonal.Text == "" || nudpreciov.Text == "" || nudprecioc.Text == "" || txtproducto.Text == "" || nudCantidad.Value == 0)
            {
                SYSCON.MensajeValidacion(this.groupBox2);
            }
            else
            {
                if (MessageBox.Show("¿Seguro de agregar nuevo item al detalle?", "Consulta", MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    controlar = 0;
                    for (int i = 0; i <= dataGridView1.RowCount - 1; i++)
                    {
                        int idpro;
                        idpro = Convert.ToInt32(dataGridView1.Rows[i].Cells[0].Value);

                        if (Convert.ToInt32(txtcproducto.Text) == idpro)
                        {
                            dataGridView1.Rows[i].Cells[2].Value = Convert.ToInt32(nudCantidad.Value) + Convert.ToInt32(dataGridView1.Rows[i].Cells[2].Value);

                            SYSCON.limpiar(this.groupBox5);
                            controlar++;
                        }
                    }


                    if (controlar == 0)
                    {
                        dataGridView1.Rows.Add(txtcproducto.Text, txtproducto.Text, nudCantidad.Value, nudprecioc.Text, nudpreciov.Text, dtpFechaVenc.Value.ToString("MM-dd-yyyy"));

                        SYSCON.limpiar(this.groupBox5);
                    }
                }
            }
        }
Ejemplo n.º 5
0
        private void btnRegistrarP_Click(object sender, EventArgs e)
        {
            dataGridView1.Enabled = true;
            bool estado = true;

            if (txtNom.Text == "" || txtApeMat.Text == "" || txtCel.Text == "" || txtContra.Text == "" || txtNumDoc.Text == "" || cmbCargo.Text == "")
            {
                SYSCON.MensajeValidacion(this.groupBox2);
            }
            else if (txtNom.Text == "" || txtApeMat.Text == "" || txtCel.Text == "" || txtContra.Text == "" || txtNumDoc.TextLength < 8 || cmbCargo.Text == "")
            {
                txtNumDoc.Select();
                MessageBox.Show("El DNI  debe tener como minimo 8 digitos");
            }
            else if (txtCel.TextLength < 9)
            {
                MessageBox.Show("El número deben ser 9 digitos");
                txtCel.Select();
            }
            else if (txtNom.TextLength < 3 || txtApePat.TextLength < 3 || txtApeMat.TextLength < 3)
            {
                MessageBox.Show("El ingreso minimo Nombres y Apellidos es de 3 digitos ");
                txtNom.Select();
            }

            else if (txtContra.TextLength < 7)
            {
                MessageBox.Show("La contraseña debe tener com minimo 7 digitos");
                txtContra.Select();
            }

            else if (ComprobarFormatoEmail(txtemail.Text) == false)
            {
                MessageBox.Show("El Email Ingresado no se encuentra en el Formato Correcto", txtemail.Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
            }


            else
            {
                if (MessageBox.Show("¿Estas seguro de agregar?", "Advertencia",
                                    MessageBoxButtons.YesNo,
                                    MessageBoxIcon.Question,
                                    MessageBoxDefaultButton.Button1) == DialogResult.Yes)
                {
                    try
                    {
                        SqlDataAdapter da = new SqlDataAdapter("Sp_InsertarPersonal '" + txtNom.Text.ToUpper() + "','" + txtApePat.Text.ToUpper() + "','" + txtApeMat.Text.ToUpper() + "','" + txtDirec.Text.ToUpper() + "','" + txtCel.Text.ToUpper() + "','" + cmbCargo.Text.ToUpper() + "','" + DesEncriptar(txtContra.Text) + "','" + dtpFechaNac.Value.ToString("MM/dd/yyyy") + "','" + cmbTipoDoc.Text.ToUpper() + "','" + txtNumDoc.Text.ToUpper() + "','" + estado + "','" + txtemail.Text + "'", SYSCON.cadconex);
                        DataTable      dt = new DataTable();
                        da.Fill(dt);
                        cargartabla();
                        da.Dispose();
                    }
                    catch
                    {
                        MessageBox.Show("Error, no se inserto registro");
                    }
                }
            }
        }
Ejemplo n.º 6
0
        private void btnAgregar_Click_1(object sender, EventArgs e)
        {
            //string repetido = txtCProducto.Text;
            actualstock();

            if (cmbtipodoc.Text == "" || txtNumeroDoc.Text == "" || cmbProveedor.Text == "" || txtpersonal.Text == "" || nudpreciov.Text == "" || nudprecioc.Text == "" || txtLote.Text == "" || cmbCategoria.Text == "" || cmbSubCategoria.Text == "" || cmbProducto.Text == "" || nudCantidad.Value == 0)
            {
                SYSCON.MensajeValidacion(this.groupBox2);
            }
            else
            {
                if (MessageBox.Show("¿Seguro de agregar nuevo item al detalle?", "Consulta", MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    //if (txtCProducto.Text == repetido) {

                    //    MessageBox.Show("No puede ingresar el mismo producto");

                    //}
                    //else {
                    //repetido = txtCProducto.Text;

                    //dgvEProducto.Rows.Add(txtCProducto.Text, cmbProducto.Text, nudCantidad.Value, nudprecioc.Value,nudpreciov.Value, txtLote.Text, dtpFechaVenc.Value.ToString("MM-dd-yyyy") );
                    //    SYSCON.limpiar(this.groupBox4);
                    //    SYSCON.limpiar(this.groupBox5);
                    //}


                    controlar = 0;
                    for (int i = 0; i <= dgvEProducto.RowCount - 1; i++)
                    {
                        int idpro;
                        idpro = Convert.ToInt32(dgvEProducto.Rows[i].Cells[0].Value);

                        if (Convert.ToInt32(txtCProducto.Text) == idpro)
                        {
                            dgvEProducto.Rows[i].Cells[2].Value = Convert.ToInt32(nudCantidad.Value) + Convert.ToInt32(dgvEProducto.Rows[i].Cells[2].Value);
                            SYSCON.limpiar(this.groupBox4);
                            SYSCON.limpiar(this.groupBox5);
                            controlar++;
                            checkBox1.Checked  = false;
                            dtpFechaVenc.Value = DateTime.Now;
                        }
                    }


                    if (controlar == 0)
                    {
                        dgvEProducto.Rows.Add(txtCProducto.Text, cmbProducto.Text, nudCantidad.Value, nudprecioc.Text, nudpreciov.Text, txtLote.Text.ToUpper(), dtpFechaVenc.Value.ToString("MM-dd-yyyy"), estadofecha);
                        SYSCON.limpiar(this.groupBox4);
                        SYSCON.limpiar(this.groupBox5);
                        checkBox1.Checked  = false;
                        dtpFechaVenc.Value = DateTime.Now;
                    }
                }
            }
        }
Ejemplo n.º 7
0
        private void btnRegistrar_Click_1(object sender, EventArgs e)
        {
            dataGridView1.Enabled = true;

            if (txtRsocial.Text == "" || txtRUC.Text == "" || txtTele.Text == "" || txtDirec.Text == "")
            {
                SYSCON.MensajeValidacion(this.groupBox2);
            }
            else if (txtRsocial.TextLength < 3)
            {
                MessageBox.Show("La razón social tiene que tener como minimo 3 digitos");
                txtRUC.Select();
            }
            else if (txtRUC.TextLength < 11 && txtTele.TextLength < 9)
            {
                MessageBox.Show("Corregir RUC y celular");
                txtRUC.Select();
            }
            else if (txtRUC.TextLength < 11)
            {
                MessageBox.Show("El RUC debe tener 11 digitos");
                txtRUC.Select();
            }

            else if (txtTele.TextLength < 9)
            {
                MessageBox.Show("El celular debe tener 9 digitos");
                txtTele.Select();
            }

            else
            {
                if (MessageBox.Show("¿Estas seguro de agregar?", "advertencia",
                                    MessageBoxButtons.YesNo,
                                    MessageBoxIcon.Question,
                                    MessageBoxDefaultButton.Button1) == DialogResult.Yes)
                {
                    try
                    {
                        SqlDataAdapter da = new SqlDataAdapter("Sp_InsertarProveedor '" + txtRsocial.Text.ToUpper() + "','" + txtTele.Text.ToUpper() + "','" + txtDirec.Text.ToUpper() + "','" + txtRUC.Text.ToUpper() + "'", SYSCON.cadconex);
                        DataTable      dt = new DataTable();
                        da.Fill(dt); da.Dispose();
                        cargartabla();
                    }
                    catch
                    {
                        MessageBox.Show("Error, no se inserto registro");
                    }
                }
            }
        }
Ejemplo n.º 8
0
        private void btnactualizar_Click(object sender, EventArgs e)
        {
            if (txtnombre.Text == "")
            {
                SYSCON.MensajeValidacion(this.groupBox2);
                txtnombre.Focus();
            }

            else if (cmbcategoria.Text == "")
            {
                SYSCON.MensajeValidacion(this.groupBox2);
                cmbcategoria.Focus();
            }
            else
            {
                if (MessageBox.Show("¿Estas seguro de actualizar?", "advertencia",
                                    MessageBoxButtons.YesNo,
                                    MessageBoxIcon.Question,
                                    MessageBoxDefaultButton.Button1) == DialogResult.Yes)
                {
                    try
                    {
                        SqlDataAdapter da = new SqlDataAdapter("Sp_ActualizarSubCategoria '" + txtcodigo.Text.ToUpper() + "','" + txtnombre.Text.ToUpper() + "','" + Convert.ToInt32(cmbcategoria.SelectedValue) + "'", SYSCON.cadconex);
                        DataTable      dt = new DataTable();
                        da.Fill(dt);
                        da.Dispose();
                        cargartabla();
                        rellenacombo();
                    }
                    catch
                    {
                        MessageBox.Show("Error, no se inserto registro");
                    }
                }
            }
        }
Ejemplo n.º 9
0
        private void cmdagrega_Click(object sender, EventArgs e)
        {
            try
            {
                if (cmbtipodoc.Text == "" || txtdocumento.Text == "" || txtpersonal.Text == "" || txtpreciov.Text == "" || cmbcategoria.Text == "" || cmbsubcategoria.Text == "" || cmbproducto.Text == "" || nudcantidad.Value == 0)
                {
                    SYSCON.MensajeValidacion(this.groupBox2);
                }

                else
                {
                    if (Convert.ToInt32(txtstock.Text) > nudcantidad.Value)
                    {
                        if (MessageBox.Show("¿Seguro de agregar nuevo item al detalle?", "Consulta", MessageBoxButtons.YesNo) == DialogResult.Yes)
                        {
                            //cant = Convert.ToInt32(nudcantidad.Value);
                            controlar  = 0;
                            controlars = 0;
                            for (int i = 0; i <= dgv1.RowCount - 1; i++)
                            {
                                int idpro;
                                idpro = Convert.ToInt32(dgv1.Rows[i].Cells[0].Value);

                                if (Convert.ToInt32(txtIdProducto.Text) == idpro)
                                {
                                    cant = cant + Convert.ToInt32(nudcantidad.Value);
                                    if (cant < Convert.ToInt32(txtstock.Text))
                                    {
                                        dgv1.Rows[i].Cells[2].Value = Convert.ToInt32(nudcantidad.Value) + Convert.ToInt32(dgv1.Rows[i].Cells[2].Value);

                                        controlar++;
                                        controlars++;
                                        //MessageBox.Show("" + cant);
                                    }
                                    else
                                    {
                                        MessageBox.Show("SUPERA EL STOCK");
                                        controlars++;
                                        cant = Convert.ToInt32(dgv1.Rows[i].Cells[2].Value);
                                    }
                                }
                            }



                            if (Convert.ToInt32(txtstock.Text) > Convert.ToInt32(nudcantidad.Value) && controlar == 0 && controlars == 0)
                            {
                                cant = Convert.ToInt32(nudcantidad.Value);
                                dgv1.Rows.Add(txtIdProducto.Text, cmbproducto.Text, nudcantidad.Value, txtprecio.Text, txtpreciov.Text, Convert.ToDouble(nudcantidad.Value) * Convert.ToDouble(txtpreciov.Text));
                                nudcantidad.Value = 0;
                                SYSCON.limpiar(this.groupBox5);
                                SYSCON.limpiar(this.groupBox6);
                            }
                        }
                    }

                    else
                    {
                        MessageBox.Show("La cantidad de productos supera el stock actual");
                    }
                }
            }
            catch
            {
            }
        }