示例#1
0
 //Agregar materia prima
 private void BtnPDF_Click(object sender, EventArgs e)
 {
     if (materia == null)
     {
         materia                       = new MateriaPrima();
         materia.Owner                 = this;
         materia.FormClosed           += materia_FormClosed;
         materia.SaveEdit.Visible      = false;
         materia.ID.Visible            = false;
         materia.mat.Visible           = false;
         materia.dateTimePicker1.Value = DateTime.Today;
         materia.Show();
     }
     else
     {
         materia.Activate();
     }
 }
示例#2
0
        //editar materia prima

        private void btnEditar_Click(object sender, EventArgs e)
        {
            MateriaPrima mat = new MateriaPrima();

            mat.btnGuardar.Visible        = false;
            mat.SaveEdit.Visible          = true;
            mat.txtCantiAdquirida.Enabled = false;
            mat.mat.Visible = false;


            if (dataGridView1.SelectedRows.Count > 0)
            {
                mat.txtUniMedAduana.Text = string.Empty;
                mat.txtUniMedida.Text    = string.Empty;

                mat.ID.Text        = dataGridView1.CurrentRow.Cells["Id"].Value.ToString();
                mat.txtNombre.Text = dataGridView1.CurrentRow.Cells["name"].Value.ToString();

                mat.dateTimePicker1.Value = Convert.ToDateTime(dataGridView1.CurrentRow.Cells["date"].Value.ToString());

                mat.txtUniMedAduana.Text   = dataGridView1.CurrentRow.Cells["customsUnitOfMeasure"].Value.ToString();
                mat.txtUniMedida.Text      = dataGridView1.CurrentRow.Cells["unitOfMeasure"].Value.ToString();
                mat.txtDescripcion.Text    = dataGridView1.CurrentRow.Cells["description"].Value.ToString();
                mat.txtSat.Text            = dataGridView1.CurrentRow.Cells["SAT"].Value.ToString();
                mat.txtFraccion.Text       = dataGridView1.CurrentRow.Cells["arrancel"].Value.ToString();
                mat.txtEstado.Text         = dataGridView1.CurrentRow.Cells["status"].Value.ToString();
                mat.txtCantiAdquirida.Text = dataGridView1.CurrentRow.Cells["amountPurchased"].Value.ToString();
                mat.txtCanAduana.Text      = dataGridView1.CurrentRow.Cells["customsAmount"].Value.ToString();
                mat.txtPrecio.Text         = dataGridView1.CurrentRow.Cells["price"].Value.ToString();


                byte[]       img = (byte[])dataGridView1.CurrentRow.Cells["photo"].Value;
                MemoryStream ms  = new MemoryStream(img);
                mat.FotoProduc.Image = Image.FromStream(ms, true, true);
                mat.ID.Visible       = false;
                mat.ShowDialog();
            }
            else
            {
                MessageBox.Show("Seleccione una fila por favor");
            }
        }
示例#3
0
        private void txtUniMedida_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (txtTipo.Enabled == true)
            {
                txtName.Items.Clear();
                const string message = "¿El producto de compra ya está dado de alta en el inventario?";
                const string captiom = "Advertencia";
                if (txtTipo.Text.Equals("Materia Prima"))
                {
                    var result = MessageBox.Show(message, captiom, MessageBoxButtons.YesNo, MessageBoxIcon.Information);
                    if (result == DialogResult.Yes)
                    {
                        MessageBox.Show("Favor de seleccionar el producto existente", captiom, MessageBoxButtons.OK, MessageBoxIcon.Information);
                        SqlCommand j = new SqlCommand("select name from rawMaterials", connection);
                        connection.Open();
                        SqlDataReader r = j.ExecuteReader();
                        while (r.Read())
                        {
                            txtName.Items.Add(r["name"].ToString());
                        }
                        connection.Close();
                    }
                    else
                    {
                        MateriaPrima m = new MateriaPrima();
                        this.Close();
                        m.Show();
                    }
                }

                else if (txtTipo.Text.Equals("Producto Terminado"))
                {
                    var result2 = MessageBox.Show(message, captiom, MessageBoxButtons.YesNo, MessageBoxIcon.Information);
                    if (result2 == DialogResult.Yes)
                    {
                        MessageBox.Show("Favor de seleccionar el producto existente", captiom, MessageBoxButtons.OK, MessageBoxIcon.Information);
                        SqlCommand g = new SqlCommand("select name from FinishedProducts", connection);
                        connection.Open();
                        SqlDataReader y = g.ExecuteReader();
                        while (y.Read())
                        {
                            txtName.Items.Add(y["name"].ToString());
                        }
                        connection.Close();
                    }
                    else
                    {
                        ProductoExistente prod = new ProductoExistente();
                        this.Close();
                        prod.Show();
                    }
                }
                else if (txtTipo.Text.Equals("Insumo"))
                {
                    var result3 = MessageBox.Show(message, captiom, MessageBoxButtons.YesNo, MessageBoxIcon.Information);
                    if (result3 == DialogResult.Yes)
                    {
                        MessageBox.Show("Favor de seleccionar el producto existente", captiom, MessageBoxButtons.OK, MessageBoxIcon.Information);
                        SqlCommand k = new SqlCommand("select name from inputs", connection);
                        connection.Open();
                        SqlDataReader z = k.ExecuteReader();
                        while (z.Read())
                        {
                            txtName.Items.Add(z["name"].ToString());
                        }
                        connection.Close();
                    }
                    else
                    {
                        Insumos ins = new Insumos();
                        this.Close();
                        ins.Show();
                    }
                }
            }
        }