Exemplo n.º 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;
        }
Exemplo n.º 2
0
        private void btnDinheiro_Click(object sender, EventArgs e)
        {
            this.Enabled = false;
            FormDinheiro _frm = new FormDinheiro(lblTotal.Text);

            _frm.ShowDialog();
            this.Enabled = true;
            Busines.Pagamento.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;
        }
Exemplo n.º 3
0
        private void btnFiado_Click(object sender, EventArgs e)
        {
            FormFiado _frm = new FormFiado(lblTotal.Text, lblIdPedido.Text);

            _frm.ShowDialog();
            this.txtValida.Text = _frm.Valor;
            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";
                    lblRecebidoT.Text          = "Cliente:";
                    lblrecebido.Text           = _frm.NomeCliente;
                    lblTrocoT.Text             = "CPF:";
                    lblTroco.Text = _frm.CpfCliente;
                    DisableBtn();
                    btnFechar.Enabled = true;
                    if (rpta.Equals("OK"))
                    {
                        lblPagamento.Text = TiposPagamento.Fiado.ToString();
                    }
                    else
                    {
                        MessageBox.Show(rpta);
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message + ex.StackTrace);
                }
            }
            CompraEmAndamento = true;
            //implementa a divisao do pagamento fiado tambem
            //if (txtValida.Text == "3")
            //{
            //    var novoTotal = decimal.Parse(lblTotal.Text) - decimal.Parse(lblrecebido.Text);
            //    lblTrocoT.Text = "Falta:";

            //    lblTotal.Text = novoTotal.ToString();
            //    CompraEmAndamento = false;
            //    Busines.Pagamento.BusinesPagamento.PedidoPagamento(TiposPagamento.Dinheiro, int.Parse(lblIdPedido.Text), decimal.Parse(lblrecebido.Text));
            //}
        }