private void ConcluirVenda(VendaInfo final) { foreach (ItemVendaInfo item in colecaoItemVenda) { if (Form1.Unidade.uniassistencia == EnumAssistencia.Assistencia) { //dar baixa no estoque ProdutoInfo produtoInfo = produtoNegocios.ConsultarProdutosId(item.Id); if (vendaEnum == EnumVenda.Taxa) //inserir taxa na tabela { ServicoTaxa = new ServicoOrcamentoInfo(); ServicoTaxa.servicoorcamentoidprod = item.Id; ServicoTaxa.servicoorcamentoquant = item.Quant; ServicoTaxa.servicoorcamentovalordesc = item.ValorDesc; ServicoTaxa.servicoorcamentovalorunit = item.ValorUnit; ServicoTaxa.servicoorcamentotaxaativo = true; } if (produtoInfo.proControleEstoque == true) { negocioEstoque = new EstoqueNegocios(Form1.Empresa.empconexao, Form1.Unidade.uniassistencia); produtoInfo = new ProdutoInfo(); produtoInfo = negocioEstoque.ConsultarEstoqueIdProdutoUnid(item.Id, Form1.Unidade.uniid); produtoInfo.prodestoquequant -= item.Quant; if (negocioEstoque.UpdateEstoqueId(produtoInfo) == 0) { FormMessage.ShowMessegeWarning("Falha ao salvar os itens!"); return; } MovEstoqueInfo movEstoqueInfo = new MovEstoqueInfo { movestoqueidproduto = item.Id, movestoqueidtipomovimento = final.venidtipoentrada, movestoquequant = item.Quant, movestoquevalor = item.ValorDesc }; if (!negocioEstoque.InsertMovEstoque(movEstoqueInfo)) { FormMessage.ShowMessegeWarning("Falha ao salvar os itens!"); return; } } } } BloquearVenda(); }
private bool AbrirVenda(EnumVenda enumVenda) { string OsTexto = string.Empty; OsTexto = "OS: " + string.Format("{0:000000}", infoServ.serid); FormVenda formVenda = new FormVenda(vendaInfo, colecaoDetalhes, OsTexto, enumVenda); formVenda.ShowDialog(this); formVenda.Dispose(); if (formVenda.DialogResult == DialogResult.Yes) { servicoOrcamento = formVenda.ServicoTaxa; VendaConcluida(enumVenda); FormMessage.ShowMessegeInfo("Venda realizada com sucesso."); return(true); } else { return(false); } }
private void SalvarOrcamento() { negocioServ.DeleteServOrcamento(infoServ.serid); foreach (GridPedidoInfo pedido in gridPedidoColecao) { if (pedido.valorDesc > 0) { ServicoOrcamentoInfo orc = new ServicoOrcamentoInfo { servicoorcamentoidprod = pedido.cod, servicoorcamentoidserv = infoServ.serid, servicoorcamentoquant = pedido.quant, servicoorcamentovalordesc = pedido.valorDesc, servicoorcamentovalorunit = pedido.valorUnit }; negocioServ.InsertServicoOrcamento(orc); } } Form1.encerrarThread = true; }