private void FillCaixa() { CaixaBLL bll = new CaixaBLL(); decimal saldoInicial = 0; decimal totalDinheiro = 0; decimal totalCartao = 0; decimal totalFormasPg = 0; decimal totalRetirada = 0; if (bll.CaixaAberto()) { Caixa cx = bll.GetCaixaAberto(); saldoInicial = cx.GetSaldoInicial(); totalDinheiro = cx.GetTotalFormaPg(FormaPagamento.DINHEIRO); totalCartao = cx.GetTotalFormaPg(FormaPagamento.CARTAO); totalFormasPg = (totalDinheiro + totalCartao); totalRetirada = cx.GetTotalRetirada(); btRetidadaCaixa.Visibility = Visibility.Visible; } else { btRetidadaCaixa.Visibility = Visibility.Hidden; } lbSaldoInicial.Content = $"R$ {saldoInicial.ToString("N2")}"; lbTotalDinheiro.Content = $"R$ {totalDinheiro.ToString("N2")}"; lbTotalCartao.Content = $"R$ {totalCartao.ToString("N2")}"; lbTotalEntradas.Content = $"R$ {totalFormasPg.ToString("N2")}"; lbTotalGeralDinheiro.Content = $"R$ {(saldoInicial + totalDinheiro - totalRetirada).ToString("N2")}"; lbTotalGeralTudo.Content = $"R$ {(saldoInicial + totalDinheiro + totalCartao - totalRetirada).ToString("N2")}"; lbTotalRetirada.Content = $"R$ {totalRetirada.ToString("N2")}"; }
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 FillCaixa() { CaixaBLL bll = new CaixaBLL(); if (bll.CaixaAberto()) { Caixa cx = bll.GetCaixaAberto(); decimal saldoInicial = cx.GetSaldoInicial(); decimal totalDinheiro = cx.GetTotalFormaPg(FormaPagamento.DINHEIRO); decimal totalCartao = cx.GetTotalFormaPg(FormaPagamento.CARTAO); decimal totalFormasPg = (totalDinheiro + totalCartao); decimal totalRetirada = cx.GetTotalRetirada(); txSaldoDinheiro.Text = $"R$ {(saldoInicial + totalDinheiro).ToString("N2")}"; txValorFinal.Text = $"R$ {(saldoInicial + totalDinheiro + totalCartao - totalRetirada).ToString("N2")}"; } }
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(); }