Exemple #1
0
        private void BuscarFormaPag()
        {
            txValor.IsEnabled = false;
            txCod_fpg.Focus();

            PesquisarFormas_pag pg = new PesquisarFormas_pag();

            pg.ShowDialog();

            txCod_fpg.Text   = pg.Selecionado.Id.ToString();
            txForma_pag.Text = (pg.Selecionado.Id == 0
                ? "Não selecionado"
                : pg.Selecionado.Descricao);

            if (pg.Selecionado.Id > 0)
            {
                txValor.IsEnabled = true;
                txValor.Focus();
            }

            if (Itens_pagamento.FirstOrDefault(i => i.Forma_pagamento_id == pg.Selecionado.Id) != null)
            {
                txForma_pag.Text  = "Condição já informada.";
                txValor.IsEnabled = false;
            }
        }
Exemple #2
0
        private void Confirmar()
        {
            if (!btConfirmar.IsEnabled)
            {
                return;
            }

            decimal troco = decimal.Parse(lbTroco.Content.ToString().Replace("R$ ", string.Empty));

            Itens_pagamento.ForEach(i => IPdv.PainelVenda.EfetuarPagamento(i.Forma_pagamento_id, i.Valor));
            if (IPdv.PainelVenda.Encerrar(troco))
            {
                Pago = true;
                lbProgresso.Visibility = Visibility.Hidden;
                btNFCe.IsEnabled       = true;
                btImpressao.IsEnabled  = true;
                btEncerrar.IsEnabled   = true;
                btCancelar.IsEnabled   = false;
                btConfirmar.IsEnabled  = false;
            }
            else
            {
                MessageBox.Show("Ocorreu um problema ao efetuar o Movimento. \nAcione o suporte Doware.", "ERRO", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
Exemple #3
0
        private void RecalculaTotais()
        {
            txValorPago.Text     = "0,00";
            txTroco.Text         = "0,00";
            txValorFaltando.Text = "0,00";

            decimal valor_movimento = decimal.Parse(txValorMovimento.Text);
            decimal valor_pago      = Itens_pagamento.Sum(e => e.Valor);
            decimal falta_pagar     = (valor_movimento - valor_pago);

            if (valor_pago > valor_movimento)
            {
                txTroco.Text = (falta_pagar * (-1)).ToString("N2");
            }

            txValorPago.Text = valor_pago.ToString("N2");

            if (falta_pagar > 0)
            {
                txValorFaltando.Text = falta_pagar.ToString("N2");
            }
            else
            {
                txValorFaltando.Text = "0,00";
            }
        }
Exemple #4
0
        public void CancelaPagamento(int forma_pagamento_id)
        {
            Itens_pagamento item = Movimento.Itens_pagamento.FirstOrDefault(e => e.Forma_pagamento_id == forma_pagamento_id);

            if (item != null)
            {
                Movimento.Itens_pagamento.Remove(item);
            }
        }
Exemple #5
0
        public bool Save(Itens_pagamento ip)
        {
            try
            {
                ip.Id = db.NextId(e => e.Id);
                db.Save(ip);
                db.Commit();

                return(true);
            }
            catch (Exception ex)
            {
                return(false);
            }
        }
Exemple #6
0
        private void CarregarFormasPag()
        {
            List <KeyValuePair <Formas_pagamento, decimal> > list = controller.GetTotaisPorFormaPagamentoCaixaAtual();

            if (list.Count > 0)
            {
                list.ForEach(e => Itens_pagamento.Add(new ItemFpgFechamentoCaixa(e.Key, e.Value)));
            }

            if (Itens_pagamento.Count > 0)
            {
                Itens_pagamento.ForEach(item => sp_formas_pag.Children.Add(item));
                Itens_pagamento.First().txValor.Focus();
                Itens_pagamento.First().txValor.SelectAll();
            }
        }
Exemple #7
0
        public bool EfetuaPagamento(int forma_pagamento_id, decimal valor)
        {
            Itens_pagamento itemP = Movimento.Itens_pagamento
                                    .Where(e => e.Forma_pagamento_id == forma_pagamento_id).FirstOrDefault();

            if (itemP != null)
            {
                BStatus.Alert("Esta forma de pagamento ja foi informada");
                return(false);
            }

            Movimento.Itens_pagamento.Add(new Itens_pagamento()
            {
                Forma_pagamento_id = forma_pagamento_id,
                Valor = valor
            });

            BStatus.Success("Forma de pagamento registrada");
            return(true);
        }
Exemple #8
0
        private void txValor_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.Key == Key.Enter)
            {
                if (int.Parse(txCod_fpg.Text) == 0)
                {
                    return;
                }

                Itens_pagamento.Add(new Model.Itens_pagamento()
                {
                    Forma_pagamento_id = int.Parse(txCod_fpg.Text),
                    Formas_pagamento   = new Formas_pagamentoController().Find(int.Parse(txCod_fpg.Text)),
                    Valor = decimal.Parse(txValor.Text)
                });

                txCod_fpg.Text   = "0";
                txForma_pag.Text = string.Empty;
                txValor.Text     = "0,00";
                dataGrid.Items.Refresh();
                RecalculaTotais();
            }
        }
Exemple #9
0
        private void txValorPagar_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.Key == Key.Enter || e.Key == Key.Return)
            {
                if (Itens_pagamento.FirstOrDefault(i => i.Forma_pagamento_id == Fpg_Atual.Id) != null)
                {
                    Itens_pagamento.First(i => i.Forma_pagamento_id == Fpg_Atual.Id).Valor = decimal.Parse(txValorPagar.Text);
                }
                else
                {
                    Itens_pagamento.Add(new Model.Itens_pagamento()
                    {
                        Formas_pagamento   = Fpg_Atual,
                        Forma_pagamento_id = Fpg_Atual.Id,
                        Valor = decimal.Parse(txValorPagar.Text),
                    });
                }

                foreach (CardPagamento cp in sp_formas_pag.Children)
                {
                    if (cp.Atalho == AtalhoAtual)
                    {
                        cp.ValorPago += decimal.Parse(txValorPagar.Text);
                    }
                }

                decimal total_pago  = Itens_pagamento.Sum(i => i.Valor);
                decimal falta_pagar = (ValorTotal - total_pago);

                lbPago.Content = $"R$ {total_pago.ToString("N2")}";

                if (falta_pagar <= 0)
                {
                    lbFalta.Content = "R$ 0,00";
                    lbTroco.Content = $"R$ {(falta_pagar * (-1)).ToString("N2")}";
                }
                else
                {
                    lbFalta.Content = $"R$ {falta_pagar.ToString("N2")}";
                    lbTroco.Content = "R$ 0,00";
                }

                AtalhoAtual = 0;
                Fpg_Atual   = null;
                lbForma_pagamento.Content = "Pressione uma das teclas ao lado";
                txValorPagar.Text         = "0,00";
                txValorPagar.IsEnabled    = false;
                lbDicaEnter.Visibility    = Visibility.Hidden;

                btConfirmar.IsEnabled = (decimal.Parse(lbFalta.Content.ToString().Replace("R$ ", string.Empty)) == 0
                    ? true
                    : false);

                if (btConfirmar.IsEnabled)
                {
                    btConfirmar.Focus();
                }

                txValorPagar.Text = lbFalta.Content.ToString().Replace("R$ ", string.Empty);
            }
        }