private void ValidarVenda()
 {
     try
     {
         decimal valorPago = ValorPago.ValorPagoPeloCliente(txtValorPago);
         if (valorPago >= GetValorPorParcela())
         {
             txtTroco.Text = Troco.GerarTroco(valorPago, GetValorPorParcela());
             MostrarBotao();
         }
         else
         {
             LimparTxt(new List <TextBox>()
             {
                 txtTroco
             });
             EsconderBotao();
         }
     }
     catch (CustomException erro)
     {
         DialogMessage.MessageFullComButtonOkIconeDeInformacao(erro.Message, "Aviso");
     }
     catch (Exception erro)
     {
         SaveErroInTxt.RecordInTxt(erro, this.GetType().Name);
         DialogMessage.MessageComButtonOkIconeErro(erro.Message, "Erro");
     }
 }
示例#2
0
 private void txtValorPago_TextChanged(object sender, EventArgs e)
 {
     try
     {
         if (cbbTipoDePagamento.Text == EnumTipoPagamento.Dinheiro.ToString())
         {
             decimal valorPago      = ValorPago.ValorPagoPeloCliente(txtValorPago);
             decimal valorDaComanda = GetValorNaComanda();
             if (ltvProdutos.Items.Count > 0 && valorPago >= valorDaComanda)
             {
                 txtTroco.Text = Troco.GerarTroco(valorPago, valorDaComanda);
                 EsconderOuMostrarButtonVenda(Mostrar);
             }
             else
             {
                 LimparTxt(new List <TextBox>()
                 {
                     txtTroco
                 });
                 EsconderOuMostrarButtonVenda(Esconder);
             }
         }
     }
     catch (CustomException erro)
     {
         DialogMessage.MessageFullComButtonOkIconeDeInformacao(erro.Message, "Aviso");
     }
     catch (Exception erro)
     {
         DialogMessage.MessageComButtonOkIconeErro(erro.Message, "Erro");
     }
 }
示例#3
0
        private void cbbTipoDePagamento_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                LimparTxt(new List <TextBox>()
                {
                    txtValorPago, txtTroco
                });
                switch (cbbTipoDePagamento.Text)
                {
                case "Dinheiro":
                    MostrarGpb();
                    if (VerificarSeExisteItensNoListView() > 0)
                    {
                        decimal valorPago      = ValorPago.ValorPagoPeloCliente(txtValorPago);
                        decimal valorDaComanda = GetValorNaComanda();
                        if (valorPago >= valorDaComanda)
                        {
                            EsconderOuMostrarButtonVenda(Mostrar);
                            this.FocoNoBotao(btnConcluirVenda);
                        }
                        else
                        {
                            EsconderOuMostrarButtonVenda(Esconder);
                        }
                    }
                    FocarNoTxt(txtValorPago);
                    break;

                case "Cartão":
                    EsconderGpb();
                    HabilitarBotaoVenda();
                    MostrarBotaoVendaSeExisteItensNaComanda();
                    break;

                case "Creditar":
                    MostrarBotaoVendaSeExisteItensNaComanda();
                    HabilitarBotaoVenda();
                    EsconderGpb();
                    break;
                }
            }
            catch (CustomException erro)
            {
                DialogMessage.MessageFullComButtonOkIconeDeInformacao(erro.Message, "Aviso");
            }
            catch (Exception erro)
            {
                DialogMessage.MessageComButtonOkIconeErro(erro.Message, "Erro");
            }
        }
 private void txt_ValorPago_Leave(object sender, EventArgs e)
 {
     try
     {
         if (txt_ValorPago.Text != "")
         {
             ValorPago          = decimal.Parse(txt_ValorPago.Text.Trim());
             troco              = ValorPago - decimal.Parse(txt_ValorDesconto.Text);
             txt_Troco.Text     = troco.ToString();
             txt_ValorPago.Text = ValorPago.ToString();
             txt_ValorPago.Text = Convert.ToDouble(txt_ValorPago.Text.Trim()).ToString("0.00");
             if (txt_ValorDesconto.Text != "0,00")
             {
                 txt_Troco.Text = (decimal.Parse(txt_ValorPago.Text) - decimal.Parse(txt_ValorDesconto.Text)).ToString();
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Caixa Fácil", MessageBoxButtons.OK, MessageBoxIcon.Error);
         txt_ValorPago.Clear();
     }
 }