Esempio n. 1
0
        private void txtCodigoB_Enter(object sender, EventArgs e)
        {
            if (txtCodigoB.Text != "")
            {
                ProdutoTableAdapter taProduto = new ProdutoTableAdapter();

                DataTable dtProduto;
                dtProduto = taProduto.PesquisaCodBarra(Convert.ToInt64(txtCodigoB.Text));

                if (dtProduto.Rows.Count == 0)
                {
                    MessageBox.Show("Produto não encontrado. Verifique se o mesmo foi cadastrado ou digitado corretamente.");
                }
                else
                {
                    txtCodPro.Text          = dtProduto.Rows[0]["Cod_Produto"].ToString();
                    txtDesc.Text            = dtProduto.Rows[0]["Descricao_Produto"].ToString();
                    txtQuantidadeEstoq.Text = dtProduto.Rows[0]["Quantidade_Produto"].ToString();
                    txtPrecounid.Text       = dtProduto.Rows[0]["Preco_Produto"].ToString();
                    decimal     preco = Convert.ToDecimal(txtPrecounid.Text);
                    CultureInfo ci    = new CultureInfo("pt-BR");
                    txtPreco.Text = preco.ToString("C2", ci);
                    txtMarca.Text = dtProduto.Rows[0]["Marca_Produto"].ToString();
                }
            }
        }
Esempio n. 2
0
        private void button3_Click(object sender, EventArgs e)
        {
            try
            {
                string qtdCancelada = dgvPedido.CurrentRow.Cells[3].Value.ToString();
                txtCancelado.Text = qtdCancelada;
                string codPro = dgvPedido.CurrentRow.Cells[0].Value.ToString();
                txtCodBarra2.Text = codPro;
                dgvPedido.Rows.Remove(dgvPedido.CurrentRow);
                decimal total = 0;
                int     i     = 0;
                for (i = 0; i < dgvPedido.Rows.Count; i++)
                {
                    total = total + Convert.ToDecimal(dgvPedido.Rows[i].Cells["Total"].Value);
                }
                txtVtotal.Text = "R$" + (total).ToString();
                ProdutoTableAdapter taProduto = new ProdutoTableAdapter();
                DataTable           dt;
                dt = taProduto.PesquisaCodBarra(Convert.ToInt64(txtCodBarra2.Text));
                txtQuantestoq.Text = dt.Rows[0]["Quantidade_Produto"].ToString();
                int voltestoq = Convert.ToInt32(txtQuantestoq.Text) + Convert.ToInt32(txtCancelado.Text);
                taProduto.RetornarEstoque(voltestoq, Convert.ToInt64(txtCodBarra2.Text));

                CultureInfo ci         = new CultureInfo("pt-BR");
                decimal     valorTotal = 0;
                foreach (DataGridViewRow col in dgvPedido.Rows)
                {
                    valorTotal = valorTotal + Convert.ToDecimal(col.Cells[4].Value);
                }

                //decimal valorall = Convert.ToDecimal(txtValorall.Text);
                txtValorfin2.Text = valorTotal.ToString();
                txtValorall.Text  = valorTotal.ToString("C2", ci);
                txtTotalFin.Text  = valorTotal.ToString("C2", ci);
                ItemPedidoTableAdapter taitem = new ItemPedidoTableAdapter();
                taitem.DeleteQuery(int.Parse(txtNumPedido.Text));


                txtCodigoB.Focus();
                txtQuantComp.Text       = "";
                txtPreco.Text           = "";
                txtDesc.Text            = "";
                txtCodigoB.Text         = "";
                txtQuantidadeEstoq.Text = "";
                txtVtotal.Text          = "";
            }
            catch
            {
                MessageBox.Show("Favor selecionar uma linha para ser cancelada.");
            }
        }
Esempio n. 3
0
        private void btnPesquisar_Click(object sender, EventArgs e)
        {
            ProdutoTableAdapter taProd = new ProdutoTableAdapter();
            DataTable           dt;

            dt = taProd.PesquisaCodBarra(Convert.ToInt64(txtCodB.Text));
            if (dt.Rows.Count == 0)
            {
                MessageBox.Show("Produto não encontrado!");
            }
            else
            {
                string nome, marca;

                nome          = dt.Rows[0]["Descricao_Produto"].ToString();
                marca         = dt.Rows[0]["Marca_Produto"].ToString();
                txtDesc.Text  = nome + " ," + marca;
                txtValor.Text = dt.Rows[0]["Preco_Produto"].ToString();
            }
        }