private void Fecha() { CaixaBLL bll = new CaixaBLL(); Caixa cx = bll.GetCaixaAberto(); cx = bll.Find(cx.Id); cx.DataFechamento = DateTime.Now; SalvaTxt(cx); MovimentoCaixa mc = new MovimentoCaixa(); mc.CaixaId = cx.Id; mc.Valor = decimal.Parse(txValorFinal.Text.Replace("R$", "")); mc.Obs = "Fechamento do caixa"; mc.FormaPagamento = (int)FormaPagamento.DINHEIRO; mc.Tipo = (int)TipoMovCaixa.Saida; MovimentoCaixaBLL mcBll = new MovimentoCaixaBLL(); mcBll.Save(mc); cx = bll.Find(cx.Id); cx.DataFechamento = DateTime.Now; cx.Aberto = false; bll.Save(cx); }
private void btConfirmar_Click(object sender, RoutedEventArgs e) { Caixa cx = new CaixaBLL().GetCaixaAberto(); MovimentoCaixa mc = new MovimentoCaixa(); mc.ServicoId = ServicoId; mc.CaixaId = cx.Id; mc.FormaPagamento = (int)comboBox.SelectedValue; mc.Valor = decimal.Parse(txValorAdiantamento.Text); mc.Tipo = (int)TipoMovCaixa.Entrada; mc.Obs = $"Adiantamento de pagamento do serviço N° {ServicoId}"; if (mc.FormaPagamento == -1) { MessageBox.Show("Selecione uma forma de pagamento", "Atenção", MessageBoxButton.OK, MessageBoxImage.Warning); return; } MovimentoCaixaBLL bll = new MovimentoCaixaBLL(); bll.Save(mc); if (FecharServico) { ServicoBLL servBLL = new ServicoBLL(); var serv = servBLL.Find(ServicoId); serv.Finalizado = true; servBLL.Save(serv); List <MaterialServico> materiaisServ = serv.MaterialServico.ToList(); foreach (MaterialServico m in materiaisServ) { MaterialBLL matBll = new MaterialBLL(); var material = matBll.Find(m.MaterialId); material.Estoque -= m.Quantidade; matBll.Save(material); } } Confirmado = true; Close(); }
private void button_Click(object sender, RoutedEventArgs e) { CaixaBLL bll = new CaixaBLL(); Caixa cx = bll.GetCaixaAberto(); MovimentoCaixa mc = new MovimentoCaixa(); mc.CaixaId = cx.Id; mc.Obs = txDescricao.Text; mc.Tipo = (int)TipoMovCaixa.Saida; mc.Valor = decimal.Parse(txValor.Text); mc.FormaPagamento = (int)FormaPagamento.DINHEIRO; MovimentoCaixaBLL mcBll = new MovimentoCaixaBLL(); mcBll.Save(mc); Close(); }