private void buttonPesquisarProduto_Click(object sender, EventArgs e) { formPesquisaProduto produto = new formPesquisaProduto(this, false); produto.ShowDialog(); produto.Dispose(); textPecaDesconto.Valor = 00; textPecaQuantidade.Text = "1"; this.itemAtual = null; }
private void oRCAMENTO_ITEMDataGridView_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { int indice = oRCAMENTO_ITEMDataGridView.CurrentRow.Index; itemAtual = (dsFROGIOS.ORCAMENTO_ITEMRow)dsFROGIOS.ORCAMENTO_ITEM.Rows[indice]; dsFROGIOS.PRODUTO.Clear(); dsFROGIOS.PRODUTORow produto = dsFROGIOS.PRODUTO.NewPRODUTORow(); produto.PRODUTO_CODIGO = itemAtual.ORCAMENTO_ITEM_PRODUTO; produto.PRODUTO_PRECO_VENDA = itemAtual.ORCAMENTO_ITEM_VALOR; produto.PRODUTO_DESCRICAO = itemAtual.ORCAMENTO_ITEM_DESCRICAO; dsFROGIOS.PRODUTO.AddPRODUTORow(produto); textPecaDesconto.Valor = itemAtual.ORCAMENTO_ITEM_DESCONTO; textPecaQuantidade.Text = itemAtual.ORCAMENTO_ITEM_QUANTIDADE.ToString(); }
private void buttonLancarProduto_Click(object sender, EventArgs e) { if (dsFROGIOS.PRODUTO.Rows.Count != 0) { dsFROGIOS.ORCAMENTO_ITEMRow item = (itemAtual != null) ? itemAtual : dsFROGIOS.ORCAMENTO_ITEM.NewORCAMENTO_ITEMRow(); dsFROGIOS.PRODUTORow produto = (dsFROGIOS.PRODUTORow)dsFROGIOS.PRODUTO.Rows[0]; item.ORCAMENTO_ITEM_PRODUTO = produto.PRODUTO_CODIGO; item.ORCAMENTO_ITEM_VALOR = produto.PRODUTO_PRECO_VENDA; //produto.PRODUTO_PRECO_VENDA; item.ORCAMENTO_ITEM_DESCRICAO = produto.PRODUTO_DESCRICAO; item.ORCAMENTO_ITEM_DESCONTO = textPecaDesconto.Valor; item.ORCAMENTO_ITEM_QUANTIDADE = converterParaShort(textPecaQuantidade.Text); //Calculo do total double valor = (item.ORCAMENTO_ITEM_VALOR * item.ORCAMENTO_ITEM_QUANTIDADE), desconto = item.ORCAMENTO_ITEM_DESCONTO, total; if (desconto != 0 && desconto < valor) { total = valor - desconto; } else { total = valor; } item.ORCAMENTO_ITEM_TOTAL = total; if (itemAtual == null) { dsFROGIOS.ORCAMENTO_ITEM.Rows.Add(item.ItemArray); } itemAtual = null; dsFROGIOS.PRODUTO.Clear(); textPecaDesconto.Text = null; textPecaQuantidade.Text = null; } }