Ejemplo n.º 1
0
        private void SalvarPedido()
        {
            if (!VendaAberta)
            {
                return;
            }
            if (!btCliente.IsEnabled)
            {
                return;
            }
            if (!btSalvarPedido.IsEnabled)
            {
                return;
            }

            if (!PainelVenda.ClienteInformado)
            {
                ShowPesquisaCliente();
                if (!PainelVenda.ClienteInformado)
                {
                    return;
                }
            }

            int pedido = PainelVenda.TransformarEmPedido();

            ResetUI();
        }
Ejemplo n.º 2
0
        private void ShowPesquisaCliente()
        {
            if (!VendaAberta)
            {
                return;
            }
            if (!btCliente.IsEnabled)
            {
                return;
            }

            BuscaClientePdv bc = new BuscaClientePdv();

            bc.ShowDialog();

            if (bc.Selecionado.Id == 0)
            {
                return;
            }

            lbNomeCliente.Content = bc.Selecionado.Nome;
            lbCpf.Content         = bc.Selecionado.Cpf;

            PainelVenda.InformaCliente(bc.Selecionado.Id);
        }
Ejemplo n.º 3
0
 private void Instance_ItemRemovido(Estoque estoque)
 {
     if (VendaAberta)
     {
         PainelVenda.DecrementaItem(estoque);
     }
 }
Ejemplo n.º 4
0
        private void ShowPagamento()
        {
            if (!btPagamento.IsEnabled)
            {
                return;
            }

            PagamentosPDV pagamentos = new PagamentosPDV(Atalhos_pagamentos, PainelVenda.GetValorParcial(), this);

            pagamentos.ShowDialog();

            if (pagamentos.Pago)
            {
                VendaAberta = false;
                ResetUI();
                PainelVenda = null;
            }
        }
Ejemplo n.º 5
0
        public void VendeItem(Estoque estoqueParam = null)
        {
            Estoque estoque = estoqueParam;

            if (estoque == null)
            {
                estoque = new ProdutosController().Get(txProduto.Text);
            }
            if (estoque == null)
            {
                return;
            }
            if (string.IsNullOrEmpty(txQuant.Text))
            {
                txQuant.Text = "1";
            }

            if (estoqueParam == null)
            {
                if (estoque.Produtos.Controla_grade && estoque.Grade_id != txProduto.Text)
                {
                    SelecionarGrade sg = new SelecionarGrade(estoque.Produtos);
                    sg.ShowDialog();

                    if (sg.Selecionado.Id == 0)
                    {
                        return;
                    }

                    estoque = sg.Selecionado;
                }
            }

            if (!VendaAberta)
            {
                PainelVenda = new PainelItensVenda();
                VendaAberta = true;
                PainelVenda = new PainelItensVenda();
                PainelVenda.AbreVenda(Tipo_movimento_id_venda.Id);
                GridContainer.Children.Clear();
                GridContainer.Children.Add(PainelVenda.CurrentUserControl);
                btPagamento.IsEnabled    = true;
                btCliente.IsEnabled      = true;
                btSalvarPedido.IsEnabled = true;
            }

            decimal quant = decimal.Parse(txQuant.Text);

            Itens_movimento itemMov = new Itens_movimento();

            itemMov.Produtos    = estoque.Produtos;
            itemMov.Produto_id  = itemMov.Produtos.Id;
            itemMov.Valor_unit  = estoque.Produtos.Valor_unit;
            itemMov.Unidades    = estoque.Produtos.Unidades;
            itemMov.Unidade_id  = estoque.Produtos.Unidade_id;
            itemMov.Quant       = quant;
            itemMov.Valor_final = (estoque.Produtos.Valor_unit * quant);
            itemMov.Cfop        = (Operacao_atual == Tipo_operacao_atual.VENDA
                ? Tipo_movimento_id_venda.Cfop
                : Tipo_movimento_id_devolucao.Cfop);
            itemMov.Lote     = estoque.Lote;
            itemMov.Sublote  = estoque.Sublote;
            itemMov.Grade_id = estoque.Grade_id;

            PainelVenda.VendeItem(itemMov);
            txProduto.Text = string.Empty;
            txQuant.Text   = "1";
            txProduto.Focus();
            txQuant.IsEnabled = false;
            lbQuant.Content   = "Quantidade";
        }