Exemple #1
0
        private void btnCredito_Click(object sender, EventArgs e)
        {
            this.Enabled = false;
            FormCredito frm = new FormCredito(lblTotal.Text);

            frm.ShowDialog();
            this.Enabled = true;
            BusinesPagamento.CadastroPedidoPagamento(TiposPagamento.Crédito, int.Parse(lblIdPedido.Text), decimal.Parse(lblTotal.Text), decimal.Parse(lblTroco.Text));
            try
            {
                string rpta = BusinesPedido.FecharCompra(Convert.ToInt32(lblIdPedido.Text), StatusPedido.Fechado);
                lblIdPedido.Text           = "idpedido";
                txtPesquisaProduto.Enabled = false;
                lblCompraAberta.Text       = "Compra Finalizada... *F5 PARA ABRIR UMA NOVA COMPRA";
                DisableBtn();
                btnFechar.Enabled = true;
                lblTrocoT.Text    = "Troco:";
                if (rpta.Equals("OK"))
                {
                    lblPagamento.Text = TiposPagamento.Crédito.ToString();
                }
                else
                {
                    MessageBox.Show(rpta);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + ex.StackTrace);
            }
            CompraEmAndamento = true;
        }
Exemple #2
0
        private void btnDinheiro_Click(object sender, EventArgs e)
        {
            this.Enabled = false;
            FormDinheiro _frm = new FormDinheiro(lblTotal.Text);

            _frm.ShowDialog();
            this.Enabled = true;
            BusinesPagamento.CadastroPedidoPagamento(TiposPagamento.Dinheiro, int.Parse(lblIdPedido.Text), decimal.Parse(_frm.Recebido), decimal.Parse(_frm.Troco));
            lblTroco.Text = _frm.Troco;
            VerificarPagamentoPedido();
            this.txtValida.Text = _frm.ValidaFecharCompra;
            string idCliente = null;

            if (!string.IsNullOrEmpty(CpfNaNota))
            {
                idCliente = CacheCliente.IdCliente.ToString();
            }
            else
            {
                idCliente = "1";
            }
            if (txtValida.Text == "2")
            {
                try
                {
                    string rpta = BusinesPedido.FecharCompra(Convert.ToInt32(lblIdPedido.Text), StatusPedido.Fechado);
                    lblIdPedido.Text           = "idpedido";
                    txtPesquisaProduto.Enabled = false;
                    lblCompraAberta.Text       = "Compra Finalizada... *F5 PARA ABRIR UMA NOVA COMPRA";
                    DisableBtn();
                    btnFechar.Enabled = true;
                    lblTrocoT.Text    = "Troco:";
                    if (rpta.Equals("OK"))
                    {
                        lblPagamento.Text = TiposPagamento.Dinheiro.ToString();
                    }
                    else
                    {
                        MessageBox.Show(rpta);
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message + ex.StackTrace);
                }
                CompraEmAndamento = true;
            }
            if (txtValida.Text == "3")
            {
                // var novoTotal = decimal.Parse(lblTotal.Text) - decimal.Parse(lblrecebido.Text);
                lblTrocoT.Text     = "Falta:";
                lblTotalT.Text     = "Falta:";
                lblTotal.ForeColor = Color.FromArgb(102, 102, 102);

                // lblTotal.Text = novoTotal.ToString();
                CompraEmAndamento = false;
            }
            CpfNaNota = string.Empty;
        }
Exemple #3
0
 //verificar os pagamentos aplicados ao pedido
 public void VerificarPagamentoPedido()
 {
     if (lblIdPedido.Text != "idpedido")
     {
         DataTable dt = new DataTable();
         dt = BusinesPagamento.ListarPedidoPagamento(int.Parse(lblIdPedido.Text));
         var recebido = dt.AsEnumerable().Where(x => x.Field <int>("id_pedido") == int.Parse(lblIdPedido.Text)).Sum(x => x.Field <decimal>("valor_recebido"));
         lblrecebido.Text = recebido.ToString();
         var novoTotal = decimal.Parse(lblSubTotalCupom.Text) - recebido;
         lblTotal.Text = novoTotal.ToString();
     }
     if (lblTrocoT.Text == "Troco:" & lblTroco.Text != "0.00")
     {
         lblTotalT.Text     = "DEVOLVER TROCO:";
         lblTotal.Text      = lblTroco.Text;
         lblTotal.ForeColor = Color.Red;
     }
 }