private void Inicializar()
        {
            InitializeComponent();
            FormFormat formFormat = new FormFormat(this);

            formFormat.formatar();

            gridFormaPagamentoColecao = new GridFormaPagamentoColecao();

            formaPagamentoColecao = vendaNegocios.ConsultarFormaPagamento();
            textBoxForma.Text     = string.Format("{0:000}", formaPagamentoColecao[0].formpagid);
            labelValorForma.Text  = formaPagamentoColecao[0].formpagdescricao;

            bandeira = vendaNegocios.ConsultarBandeira();
            comboBoxBandeira.DisplayMember = "descricao";
            comboBoxBandeira.ValueMember   = "cod";
            comboBoxBandeira.DataSource    = bandeira;
            comboBoxBandeira.SelectedItem  = "CAIXA LOJA";

            pagtipo = vendaNegocios.ConsultarPagamentoTipo();
            comboBoxTipo.DisplayMember = "descricao";
            comboBoxTipo.ValueMember   = "cod";
            comboBoxTipo.DataSource    = pagtipo;

            textBoxForma.LostFocus += new EventHandler(textBoxForma_LostFocus);
        }
Esempio n. 2
0
        public FormaPagamentoColecao ConsultarPorFilial(int IDFilial)
        {
            try
            {
                conexao.LimparParametros();
                conexao.AdicionarParametros("@IDFILIAL", IDFilial);

                DataTable dataTable = conexao.ExecutarConsulta(CommandType.StoredProcedure, "uspFormaPagamentoConsultarPorFilial");

                FormaPagamentoColecao pagamentoColecao = new FormaPagamentoColecao();

                foreach (DataRow dataRow in dataTable.Rows)
                {
                    FormaPagamento pagamento = new FormaPagamento();
                    pagamento.Descricao   = Convert.ToString(dataRow["Descricao"]);
                    pagamento.IDFilial    = Convert.ToInt32(dataRow["IDFilial"]);
                    pagamento.IDPagamento = Convert.ToInt32(dataRow["IDPagamento"]);
                    pagamento.IDStatus    = Convert.ToInt32(dataRow["IDStatus"]);

                    pagamentoColecao.Add(pagamento);
                }

                return(pagamentoColecao);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
        private FormaPagamentoColecao PreencherTabelaFormaPagamento(DataTable table)
        {
            FormaPagamentoColecao formaPagamentoColecao = new FormaPagamentoColecao();

            foreach (DataRow row in table.Rows)
            {
                FormaPagamentoInfo formaPagamentoInfo = new FormaPagamentoInfo
                {
                    formpagdescricao = Convert.ToString(row["formpagdescricao"]),
                    formpagid        = Convert.ToInt32(row["formpagid"])
                };

                formaPagamentoColecao.Add(formaPagamentoInfo);
            }

            return(formaPagamentoColecao);
        }
Esempio n. 4
0
        private void btnFinalizarPedido_Click(object sender, EventArgs e)
        {
            try
            {
                if ((pedidoItens != null && pedidoItens.Count > 0) && (btnFinalizarPedido.Text == "   Finalizar Pedido    F5"))
                {
                    btnSelecionarCliente.Enabled = false;
                    btnProcurarProduto.Enabled   = false;
                    txtQuantidade.Enabled        = false;
                    btnMais.Enabled          = false;
                    btnMenos.Enabled         = false;
                    btnOk.Enabled            = false;
                    txtDescontoItem.Text     = "0";
                    txtDescontoItem.Enabled  = false;
                    grbListaProdutos.Enabled = false;
                    txtDesconto.Enabled      = true;
                    txtDesconto.Focus();
                    btnFinalizarVenda.Enabled = true;
                    contadorDescontoFinal     = 0;
                    txtproduto.Text           = "";
                    //Adiciona as formas de pagamento no combobox
                    try
                    {
                        cbbFormaPagamento.Enabled = true;
                        FormaPagamentoColecao pagamentoColecao = new FormaPagamentoColecao();
                        FormaPagamentoNegocio pagamentoNegocio = new FormaPagamentoNegocio();

                        pagamentoColecao = pagamentoNegocio.ConsultarPorFilial(ControleSistema.getFilialLogada().IDFilial);

                        cbbFormaPagamento.DataSource    = pagamentoColecao;
                        cbbFormaPagamento.DisplayMember = "Descricao";
                        cbbFormaPagamento.ValueMember   = "IDPagamento";
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show("Erro ao receber lista de formas de pagamento. Detalhes: " + ex.Message);
                    }

                    //txtQuantidade.Clear();
                    btnFinalizarPedido.Text = "   Alterar Pedido    F5";
                }
                else if ((pedidoItens != null && pedidoItens.Count > 0) && (btnFinalizarPedido.Text == "   Alterar Pedido    F5"))
                {
                    btnSelecionarCliente.Enabled = true;
                    btnProcurarProduto.Enabled   = true;
                    txtQuantidade.Enabled        = true;
                    btnMais.Enabled          = true;
                    btnMenos.Enabled         = true;
                    btnOk.Enabled            = true;
                    txtDescontoItem.Enabled  = true;
                    grbListaProdutos.Enabled = true;
                    txtDesconto.Text         = "0";
                    txtDesconto.Enabled      = false;
                    btnProcurarProduto.Focus();
                    btnFinalizarVenda.Enabled = false;
                    //txtQuantidade.Text = "1";
                    btnFinalizarPedido.Text = "   Finalizar Pedido    F5";
                }
                else
                {
                    MessageBox.Show("Não é possível finalizar o pedido sem itens. Adicione itens a lista de compras para finalizar o pedido.");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Erro ao finalizar pedido. Detalhes: " + ex.Message);
            }
        }