コード例 #1
0
        private void butEans_Click(object sender, EventArgs e)
        {
            FormCadCodBarras barcode = new FormCadCodBarras();

            barcode.IdProduto         = Convert.ToInt32(tbCodigoProduto.Text);
            barcode.gpbCodBarras.Text = tbDescProduto.Text;
            barcode.MdiParent         = this.ParentForm;
            barcode.Show();
        }
コード例 #2
0
 private void FormCadProdutos_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.F6)
     {
         if (btnConsultaGeral.Enabled)
         {
             LimparCampos();
             OrganizaBotoes();
             butAlterar.Enabled = false;
             FormGridProdutos grid = new FormGridProdutos(this, "produtos");
             grid.MdiParent = this.ParentForm;
             grid.Show();
         }
         else if (tbCodigoFornecedor.Focused == true || tbNomeFornecedor.Focused == true)
         {
             tbCodigoFornecedor.Clear();
             tbNomeFornecedor.Clear();
             FormGridFornecedores grid = new FormGridFornecedores(this, "produtos");
             grid.MdiParent = this.ParentForm;
             grid.Show();
         }
     }
     else if (e.KeyCode == Keys.F2)
     {
         if (tbCodigoFornecedor.Focused == true || tbNomeFornecedor.Focused == true)
         {
             FormCadFornecedores cadForn = new FormCadFornecedores((FormPrincipal)this.MdiParent);
             cadForn.MdiParent = this.ParentForm;
             cadForn.Show();
         }
     }
     else if (e.KeyCode == Keys.F7)
     {
         if (tbCodigoProduto.Text.Length > 0 && tbDescProduto.Text.Length > 0)
         {
             FormCadCodBarras barcode = new FormCadCodBarras();
             barcode.IdProduto         = Convert.ToInt32(tbCodigoProduto.Text);
             barcode.gpbCodBarras.Text = tbDescProduto.Text;
             barcode.MdiParent         = this.ParentForm;
             barcode.Show();
         }
     }
     else if (e.KeyCode == Keys.Enter)
     {
         if (e.Shift)
         {
             e.SuppressKeyPress = true;
             SendKeys.Send("+{TAB}");
         }
         else
         {
             e.SuppressKeyPress = true;
             SendKeys.Send("{TAB}");
         }
     }
 }
コード例 #3
0
        private void dataGridView1_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                DataGridViewRow linhaAtual = dataGridView1.CurrentRow;
                int             i          = linhaAtual.Index;
                if (prod != null)
                {
                    prod.tbCodigoProduto.Text = dataGridView1.Rows[i].Cells[0].Value.ToString();
                    //prod.tbEan13.Text = dataGridView1.Rows[i].Cells[1].Value.ToString();
                    prod.tbDescProduto.Text      = dataGridView1.Rows[i].Cells[1].Value.ToString();
                    prod.req_nomeprod            = true;
                    prod.cbxSituacao.Text        = dataGridView1.Rows[i].Cells[2].Value.ToString();
                    prod.tbDescResumida.Text     = dataGridView1.Rows[i].Cells[3].Value.ToString();
                    prod.tbMarcaProduto.Text     = dataGridView1.Rows[i].Cells[4].Value.ToString();
                    prod.cbxEmb.Text             = dataGridView1.Rows[i].Cells[5].Value.ToString();
                    prod.tbUnidade.Text          = dataGridView1.Rows[i].Cells[6].Value.ToString();
                    prod.tbPrecoVenda.Text       = dataGridView1.Rows[i].Cells[7].Value.ToString();
                    prod.tbMargemLucro.Text      = dataGridView1.Rows[i].Cells[8].Value.ToString();
                    prod.tbEstoqueMinimo.Text    = dataGridView1.Rows[i].Cells[9].Value.ToString();
                    prod.tbEstoqueAtual.Text     = dataGridView1.Rows[i].Cells[10].Value.ToString();
                    prod.tbCodigoFornecedor.Text = dataGridView1.Rows[i].Cells[11].Value.ToString();
                    prod.req_idforn = true;
                    //Preenche campo fornecedor
                    //-------------------------------------------------------------------------
                    Fornecedor forn = new Fornecedor();
                    forn.IdFornecedor = Convert.ToInt32(prod.tbCodigoFornecedor.Text);
                    forn.LocalizaFornecedor();
                    prod.tbNomeFornecedor.Text = forn.RazaoSocial;
                    //Preenche campo EAN13
                    //-------------------------------------------------------------------------
                    Produtos pr = new Produtos();
                    pr.LocalizaEan(dataGridView1.Rows[i].Cells[0].Value.ToString());
                    prod.tbEan13.Text = pr.Ean;

                    prod.tbPrecoCusto.Text     = dataGridView1.Rows[i].Cells[12].Value.ToString();
                    prod.lblEstadoEstoque.Text = dataGridView1.Rows[i].Cells[13].Value.ToString();
                    prod.CalcularMargemReal();
                    prod.CalcularPrecoSugerido();

                    prod.butAlterar.Enabled = true;
                    prod.butExcluir.Enabled = true;
                    prod.butEans.Enabled    = true;
                    prod.butNovo.Focus();
                }
                else if (ajuste != null)
                {
                    ajuste.tbCodigo.Text     = dataGridView1.Rows[i].Cells[0].Value.ToString();
                    ajuste.lblDescricao.Text = dataGridView1.Rows[i].Cells[1].Value.ToString();
                    ajuste.butSalvar.Enabled = true;
                    ajuste.tbQtde.Focus();
                }
                else if (frmven != null)
                {
                    frmven.txtCodProduto.Text = dataGridView1.Rows[i].Cells[0].Value.ToString();
                    frmven.HabiDesaCamposItem(true);
                    frmven.txtQtdeProduto.Focus();
                }
                else if (frmven2 != null)
                {
                    frmven2.txtCodProduto.Text = dataGridView1.Rows[i].Cells[0].Value.ToString();
                    frmven2.txtCodProduto.Focus();
                    frmven2.txtQtdeProduto.Focus();
                }

                this.Dispose();
            }
            else if (e.KeyCode == Keys.Escape)
            {
                radDescricao.Checked = true;
                txtPesquisa.Clear();
                txtPesquisa.Focus();
                this.CancelButton = butSair;
            }
            else if (e.KeyCode == Keys.F7)
            {
                DataGridViewRow  linhaAtual = dataGridView1.CurrentRow;
                int              i          = linhaAtual.Index;
                FormCadCodBarras barcode    = new FormCadCodBarras();
                barcode.IdProduto         = Convert.ToInt32(dataGridView1.Rows[i].Cells[0].Value);
                barcode.gpbCodBarras.Text = dataGridView1.Rows[i].Cells[1].Value.ToString();
                barcode.MdiParent         = this.ParentForm;
                barcode.Show();
            }
        }