Ejemplo n.º 1
0
        private void btSomaVendas_Click(object sender, EventArgs e)
        {
            dalPedido dalped    = new dalPedido();
            decimal   VendasDia = dalped.pedidosDia();

            MessageBox.Show(string.Format("Total de vendas do dia: R$ {0:N}.", VendasDia), "Vendas do dia");
        }
Ejemplo n.º 2
0
        private void btSaldoDia_Click(object sender, EventArgs e)
        {
            dalPedido dalped    = new dalPedido();
            decimal   VendasDia = dalped.pedidosDiaSemIngresso();

            MessageBox.Show(string.Format("Total de vendas do dia: R$ {0:N}.", VendasDia), "Vendas do dia", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
Ejemplo n.º 3
0
        private void achaClientePedido(int cod)
        {
            dalPedido pedido = new dalPedido();

            List <cliente> clientes = pedido.mostraClientePedido(cod);

            foreach (var c in clientes)
            {
                tbCodigo.Text          = c.idclientes.ToString();
                tbNome.Text            = c.nome;
                tbEndereco.Text        = c.endereco;
                tbNumero.Text          = c.numero;
                tbBairro.Text          = c.bairro;
                tbCep.Text             = c.cep;
                cbEstado.SelectedValue = c.uf;
                cbCidade.SelectedValue = c.cidade;
                tbCpfcnpj.Text         = c.cpf_cnpj;
                cbSexo.SelectedValue   = c.sexo;
                tbEmail.Text           = c.email;
                tbTelefone.Text        = c.telefone;

                if (c.status)
                {
                    rbAtivo.Checked = true;
                }
                else
                {
                    rbInativo.Checked = true;
                }
            }
        }
Ejemplo n.º 4
0
        private void formMostra_Load(object sender, EventArgs e)
        {
            dalPedido ped = new dalPedido();
            dalItensPedido itens = new dalItensPedido();

            dataGridView1.DataSource = ped.listaPedidos();
            dataGridView2.DataSource = itens.listaItensPedido();
        }
Ejemplo n.º 5
0
        private void carregaGrid(bool StatusPedido)
        {
            dgvPedido.Columns.Clear();
            dalPedido dalPed = new dalPedido();

            dgvPedido.DataSource = dalPed.listaPedido_StatusPedidoID(StatusPedido);
            formataGrid(StatusPedido);
        }
Ejemplo n.º 6
0
        private void mostraPedido(int cod)
        {
            dalPedido     ped    = new dalPedido();
            List <pedido> pedido = ped.listaPedidos(cod);

            btLimpar.Enabled = true;

            foreach (var p in pedido)
            {
                tbNome.Text = p.cliente.nome;

                //condicao controle de pagamento
                if (p.datapagamento == null)
                {
                    btPagamento.Enabled = true;
                    lbPagamento.Visible = true;
                    lbPagamento.Text    = "Não Efetuado";
                }
                else
                {
                    btPagamento.Enabled = false;
                    lbPagamento.Visible = true;
                    lbPagamento.Text    = "Efetuado";
                }

                //condicao controle de liberacao e entrega
                if (p.statuspedido == 1)
                {
                    lbStatus.Visible  = true;
                    lbStatus.Text     = "Em aberto";
                    btLiberar.Enabled = true;
                    btEntrega.Enabled = false;
                }
                else if (p.statuspedido == 2)
                {
                    lbStatus.Visible  = true;
                    lbStatus.Text     = "Liberado";
                    btLiberar.Enabled = false;
                    btEntrega.Enabled = true;
                }
                else if (p.statuspedido == 3)
                {
                    lbStatus.Visible  = true;
                    lbStatus.Text     = "Entregue";
                    btLiberar.Enabled = false;
                    btEntrega.Enabled = false;
                }
                else
                {
                    lbStatus.Visible    = true;
                    lbStatus.Text       = "Cancelado";
                    btLiberar.Enabled   = false;
                    btEntrega.Enabled   = false;
                    btPagamento.Enabled = false;
                }
            }
        }
Ejemplo n.º 7
0
 private void excluirPedido(int PedidoID)
 {
     if (DialogResult.Yes == MessageBox.Show("Tem certeza que deseja excluir o pedido?\n Pedido nº: " + PedidoID, "Excluir pedido", MessageBoxButtons.YesNo, MessageBoxIcon.Question))
     {
         dalPedido ped = new dalPedido();
         ped.deletaPedido(PedidoID);
         rbAberto.PerformClick();
         dalLogs.addLog(dalOperador.retornaOperador(Principal.OperadorID).Nome, "Excluiu o pedido nº " + PedidoID);
     }
 }
Ejemplo n.º 8
0
        private void btImprimir_Click(object sender, EventArgs e)
        {
            dalPedido         ped   = new dalPedido();
            repwImprimePedido abrir = new repwImprimePedido();

            if (tbNumeropedido.Enabled == false)
            {
                abrir.imprimePedidoBindingSource.DataSource = ped.sourceRelatorioPedido(Convert.ToInt32(tbNumeropedido.Text));
                abrir.Show();
            }
        }
Ejemplo n.º 9
0
        private void confirmaPagamento(int cod)
        {
            dalPedido pedido = new dalPedido();

            if (MessageBox.Show("Tem certeza que deseja confirmar o pagamento do pedido?", "Confirmar pagamento", MessageBoxButtons.YesNo) == DialogResult.Yes)
            {
                pedido.confirmarPagamento(cod);
                listItens.Clear();
                mostraPedido();
            }
        }
Ejemplo n.º 10
0
        private void confirmaEntrega(int cod)
        {
            dalPedido pedido = new dalPedido();

            if (MessageBox.Show("Tem certeza que deseja confirmar a entrega do pedido?", "Confirmar entrega", MessageBoxButtons.YesNo) == DialogResult.Yes)
            {
                pedido.confirmarEntrega(cod);
                listItens.Clear();
                mostraPedido();
            }
        }
Ejemplo n.º 11
0
        private void excluiPedido()
        {
            dalPedido      pedido      = new dalPedido();
            dalItensPedido itenspedido = new dalItensPedido();

            if (MessageBox.Show("Tem certeza que deseja excluir o pedido?", "Confirmar exclusão", MessageBoxButtons.YesNo) == DialogResult.Yes)
            {
                itenspedido.deletaItens(Convert.ToInt32(tbNumeropedido.Text));
                pedido.deletaPedido(Convert.ToInt32(tbNumeropedido.Text));
                resetCampos();
            }
        }
Ejemplo n.º 12
0
        private void populaGrid()
        {
            dalPedido dalPed = new dalPedido();

            dgvPedido.DataSource            = dalPed.listaPedidosSimples(id_pedido, tbPesquisa.Text);
            dgvPedido.Columns[0].HeaderText = "Núm. Pedido";
            dgvPedido.Columns[0].Width      = 100;
            dgvPedido.Columns[1].HeaderText = "Nome";
            dgvPedido.Columns[2].HeaderText = "Valor";
            dgvPedido.Columns[2].DefaultCellStyle.Format = "N";
            dgvPedido.Columns[2].Width = 120;
        }
Ejemplo n.º 13
0
        private void mostraDados(int PedidoID, string Cliente)
        {
            dalPedido dalPed = new dalPedido();
            Pedido    pedido = dalPed.selecionaPedido(PedidoID);

            tbNumPedido.Text = pedido.PedidoID.ToString();
            tbCliente.Text   = Cliente;

            tbValorTotal.Text = string.Format("{0:f}", pedido.ValorTotal);
            tbDesconto.Text   = string.Format("{0:f}", pedido.Desconto);
            tbValorFinal.Text = string.Format("{0:f}", pedido.ValorFinal);
        }
Ejemplo n.º 14
0
        private void atualizaPedido()
        {
            dalPedido      ped   = new dalPedido();
            dalItensPedido itens = new dalItensPedido();

            if (MessageBox.Show("Tem certeza que deseja atualizar o pedido?", "Confirmar atualização", MessageBoxButtons.YesNo) == DialogResult.Yes)
            {
                ped.atualizaPedido(new Pedidos(Convert.ToInt32(tbNumeropedido.Text), Convert.ToInt32(tbCodigo.Text), Convert.ToDecimal(tbValorTotalPedido.Text), DateTime.Today));
                itens.deletaItens(Convert.ToInt32(tbNumeropedido.Text));
                itens.insereItensPedido(listItens, Convert.ToInt32(tbNumeropedido.Text));
                listItens.Clear();
                resetCampos();
            }
        }
Ejemplo n.º 15
0
        private void formPedidoDetalhes_Activated(object sender, EventArgs e)
        {
            dalPedido ped    = new dalPedido();
            Pedido    pedido = ped.selecionaPedido(PedidoID);

            tbNome.Text      = pedido.Nome;
            cbViagem.Checked = pedido.Viagem;
            cbTaxa.Checked   = pedido.TaxaS;

            populaGridProduto(tbPesquisa.Text);
            populaGridPedProdutos();
            formataGridPedProdutos();
            calculaValorTotal();
            comboBoxProduto();
        }
Ejemplo n.º 16
0
        private void atualizaPedido()
        {
            dalPedido dalPed = new dalPedido();

            dalPed.atualizaPedidoPAG(new Pedido
            {
                PedidoID   = PedidoID,
                ValorTotal = Convert.ToDecimal(tbTotalPagar.Text),
                TaxaS      = cbTaxa.Checked,
                VlTaxaS    = Convert.ToDecimal(tbTaxa.Text)
            });

            VlTaxaS    = Convert.ToDecimal(tbTaxa.Text);
            ValorTotal = Convert.ToDecimal(tbTotalPagar.Text);
        }
Ejemplo n.º 17
0
        private void imprimePedido(int cod)
        {
            dalPedido         ped   = new dalPedido();
            repwImprimePedido abrir = new repwImprimePedido();

            abrir.imprimePedidoBindingSource.DataSource = ped.sourceRelatorioPedido(cod);

            if (abrir.imprimePedidoBindingSource.Count > 0)
            {
                abrir.Show();
            }
            else
            {
                MessageBox.Show("Pedido inexiste ou campos em branco", "ERRO");
            }
        }
Ejemplo n.º 18
0
        private void imprimePedido()
        {
            dalPedido ped = new dalPedido();

            repwPedidoSimples abrir = new repwPedidoSimples();

            if (dgvPesquisa.RowCount > 0)
            {
                abrir.pesqPedidoBindingSource.DataSource = dgvPesquisa.DataSource;
                abrir.Show();
            }
            else
            {
                MessageBox.Show("Não há dados para imprimir", "ERRO");
            }
        }
Ejemplo n.º 19
0
        private void imprimePedidoSimplesT(DateTime data1, DateTime data2, int status)
        {
            dalPedido         ped   = new dalPedido();
            repwPedidoPorData abrir = new repwPedidoPorData();

            abrir.pesqPedidoBindingSource.DataSource = ped.relatorioPedidoSimples(data1, data2, status);

            if (abrir.pesqPedidoBindingSource.Count > 0)
            {
                abrir.Show();
            }
            else
            {
                MessageBox.Show("Pedido inexiste ou campos em branco", "ERRO");
            }
        }
Ejemplo n.º 20
0
        private void atualizaPedido()
        {
            dalPedido dalPed = new dalPedido();

            dalPed.atualizaPedido(new Pedido
            {
                PedidoID   = PedidoID,
                Nome       = tbNome.Text,
                Data       = DateTime.Now,
                SubTotal   = Convert.ToDecimal(tbSubtotal.Text),
                ValorTotal = Convert.ToDecimal(tbTotal.Text),
                NumPessoas = (int)nupNumPessoa.Value,
                Viagem     = cbViagem.Checked,
                TaxaS      = cbTaxa.Checked,
                VlTaxaS    = Convert.ToDecimal(tbTaxa.Text)
            });
        }
Ejemplo n.º 21
0
        private void importarPedido(int id_pedido_importar)
        {
            dalPedido      dalPed  = new dalPedido();
            dalItensPedido dalIPed = new dalItensPedido();

            try
            {
                if (dalIPed.importaPedido(id_pedido, id_pedido_importar))
                {
                    dalPed.deletaPedido(id_pedido_importar);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Ejemplo n.º 22
0
        private void novoPedido()
        {
            dalPedido dalPed = new dalPedido();
            dalConfig conf   = new dalConfig();
            bool      taxa   = conf.retornaConfig("SERV") == "S" ? true : false;

            dalPed.inserePedido(new Pedido {
                Nome = tbNomePedido.Text, Data = DateTime.Now, SubTotal = 0, ValorTotal = 0, NumPessoas = 1, Viagem = false, Status = true, Troco = 0, ValorPago = 0, TaxaS = taxa, VlTaxaS = 0
            });
            dalLogs.addLog(dalOperador.retornaOperador(Principal.OperadorID).Nome, "Adicionou o pedido nº: " + dalPed.selecionaUltimoPedido().PedidoID);
            tbNomePedido.Text       = "";
            pedidoDetalhes          = new formPedidoDetalhes();
            pedidoDetalhes.PedidoID = dalPed.selecionaUltimoPedido().PedidoID;

            pedidoDetalhes.MdiParent = ActiveForm;
            pedidoDetalhes.Show();
            pedidoDetalhes.FormClosed += PedidoDetalhes_FormClosed;
        }
Ejemplo n.º 23
0
 private void cadastrarPedido()
 {
     try
     {
         dalPedido ped = new dalPedido();
         int       i   = ped.inserePedido(new Pedidos(Convert.ToInt32(tbCodigo.Text), Convert.ToDecimal(tbValorTotalPedido.Text), 1, DateTime.Today.Date, DateTime.Today.Date), listItens);
         listItens.Clear();
         resetCampos();
         if (MessageBox.Show("Pedido registrado com sucesso, deseja imprimir o pedido?", "Cadastro de pedido", MessageBoxButtons.YesNo) == DialogResult.Yes)
         {
             repwImprimePedido abrir = new repwImprimePedido();
             abrir.imprimePedidoBindingSource.DataSource = ped.sourceRelatorioPedido(i);
             abrir.Show();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("ERRO:" + ex.ToString(), "ERRO");
     }
 }
Ejemplo n.º 24
0
        private void cadPedido_Load(object sender, EventArgs e)
        {
            dalSexo   sexo   = new dalSexo();
            dalEstado estado = new dalEstado();
            dalCidade cidade = new dalCidade();
            dalPedido pedido = new dalPedido();

            //combobox sexo
            cbSexo.DataSource    = sexo.listaSexos();
            cbSexo.DisplayMember = "descricao";
            cbSexo.ValueMember   = "idsexos";

            //combobox estado
            cbEstado.DataSource    = estado.listaEstados();
            cbEstado.DisplayMember = "Sigla";
            cbEstado.ValueMember   = "EstadoId";

            //combobox cidade
            cbCidade.DataSource    = cidade.listaCidades();
            cbCidade.DisplayMember = "Nome";
            cbCidade.ValueMember   = "CidadeId";
        }
Ejemplo n.º 25
0
        private void reativarPedido()
        {
            try
            {
                dalLancamentosCaixa dalLC = new dalLancamentosCaixa();

                if (dalLC.excluirAtivarPedido(PedidoID))
                {
                    dalPedido dalPed = new dalPedido();
                    dalPed.ativaPedido(PedidoID);
                    dalLogs.addLog(dalOperador.retornaOperador(Principal.OperadorID).Nome, "Reativou o pedido nº: " + PedidoID);
                    Close();
                }
                else
                {
                    MessageBox.Show("Não foi possível reativar o pedido. Somente os pedidos com a data de hoje podem ser reativados.", "ERRO", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            catch (Exception)
            {
                MessageBox.Show("É necessário selecionar um pedido para reativar", "ERRO", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Ejemplo n.º 26
0
        private void CupomCAPRI(int PedidoID, decimal valorTotal, bool viagem, bool taxas, decimal vltaxa)
        {
            //41 Caracteres - Fonte: Lucida Console - Tamanho: 8
            int                padding = 41;
            dalPedido          dalPed  = new dalPedido();
            dalItensPedido     dalIPed = new dalItensPedido();
            dalEmpresa         emp     = new dalEmpresa();
            dalPedidoPagamento dalPP   = new dalPedidoPagamento();

            txtFormat      = new RichTextBox();
            txtFormat.Font = new Font("Lucida Console", 10);
            var     ItensCupom  = dalIPed.listaItensCupom(PedidoID);
            var     PedidoCupom = dalPed.PedidoImprimir(PedidoID);
            decimal Pagamento   = dalPP.PagamentoPedido(PedidoID);

            string linha      = "-----------------------------------------";
            string cabecalho  = string.Format("{0}", emp.retornaEmpresa().NomeFantasia);
            string cabecalho2 = string.Format("{0}, {1}", emp.retornaEmpresa().Endereco, emp.retornaEmpresa().Numero);
            string cabecalho3 = string.Format("{0}", emp.retornaEmpresa().Telefone1);
            string info       = string.Format("Pedido   No:   {0}", PedidoID);
            string infoD      = string.Format("{0:dd/MM/yy   HH:mm}", PedidoCupom.Data);
            string infoN      = string.Format("Nome/Mesa:   {0}", PedidoCupom.Nome);
            string cab_itens  = string.Format("{0,-41}\n{1,10}{2,10}{3,10}{4,11}", "PRODUTO", "QTD", "V.UNI", "DESC", "TOTAL");


            txtFormat.Text = cabecalho.PadBoth(padding) + "";
            txtFormat.AppendText("\r\n");
            txtFormat.AppendText(cabecalho2.PadBoth(padding));
            txtFormat.AppendText("\r\n");
            txtFormat.AppendText(cabecalho3.PadBoth(padding));
            txtFormat.AppendText("\r\n");
            txtFormat.AppendText(linha);
            txtFormat.AppendText("\r\n");
            txtFormat.AppendText(info + infoD.PadLeft(padding - info.Length));
            txtFormat.AppendText("\r\n");
            txtFormat.AppendText(linha);
            txtFormat.AppendText("\r\n");
            txtFormat.AppendText(infoN.PadBoth(padding));
            txtFormat.AppendText("\r\n");
            txtFormat.AppendText(linha);
            txtFormat.AppendText("\r\n");
            txtFormat.AppendText(cab_itens);
            txtFormat.AppendText("\r\n");

            foreach (var item in ItensCupom)
            {
                itens = string.Format("{0,-41}\n{1,10:f}{2,10:f}{3,10}{4,11:f}", item.produto, "x" + item.quantidade, item.valorUnit, item.desconto == 0 ? "" : string.Format("-{0:f}", item.desconto), item.valorTotal);
                txtFormat.AppendText(itens);
                txtFormat.AppendText("\r\n");
            }

            txtFormat.AppendText(linha);
            txtFormat.AppendText("\r\n");
            if (PedidoCupom.TaxaS)
            {
                txtFormat.AppendText(string.Format("{0,-31}{1,10:f}", "SUBTOTAL DO PEDIDO..........: ", valorTotal - vltaxa));
                txtFormat.AppendText("\r\n");
                txtFormat.AppendText(string.Format("{0,-31}{1,10:f}", "SERVICO (OPCIONAL)..........: ", vltaxa));
                txtFormat.AppendText("\r\n");
                txtFormat.AppendText("\r\n");
                txtFormat.AppendText(string.Format("{0,-31}{1,10:f}", "TOTAL DO PEDIDO+SERVICO.....: ", valorTotal));
                txtFormat.AppendText("\r\n");
                txtFormat.AppendText(string.Format("{0,-31}{1,10:f}", "TOTAL DO PEDIDO.............: ", valorTotal - vltaxa));
                if (Pagamento > 0)
                {
                    txtFormat.AppendText("\r\n");
                    txtFormat.AppendText("\r\n");
                    txtFormat.AppendText(string.Format("{0,-31}{1,10:f}", "VALOR PAGO..................: ", Pagamento));
                    txtFormat.AppendText("\r\n");
                    txtFormat.AppendText("\r\n");
                    txtFormat.AppendText(string.Format("{0,-31}{1,10:f}", "SALDO A PAGAR+SERVICO.......: ", (valorTotal - Pagamento) < 0 ? 0 : (valorTotal - Pagamento)));
                    txtFormat.AppendText("\r\n");
                    txtFormat.AppendText(string.Format("{0,-31}{1,10:f}", "SALDO A PAGAR...............: ", ((valorTotal - vltaxa) - Pagamento) < 0 ? 0 : (valorTotal - vltaxa) - Pagamento));
                }
            }
            else
            {
                txtFormat.AppendText(string.Format("{0,-31}{1,10:f}", "SUBTOTAL DO PEDIDO..........: ", valorTotal - vltaxa));
                txtFormat.AppendText("\r\n");
                txtFormat.AppendText("\r\n");
                txtFormat.AppendText(string.Format("{0,-31}{1,10:f}", "TOTAL DO PEDIDO.............: ", valorTotal - vltaxa));
                txtFormat.AppendText("\r\n");
                txtFormat.AppendText("\r\n");
                txtFormat.AppendText(string.Format("{0,-31}{1,10:f}", "VALOR PAGO..................: ", Pagamento));
                txtFormat.AppendText("\r\n");
                txtFormat.AppendText("\r\n");
                txtFormat.AppendText(string.Format("{0,-31}{1,10:f}", "SALDO A PAGAR...............: ", ((valorTotal - vltaxa) - Pagamento) < 0 ? 0 : (valorTotal - vltaxa) - Pagamento));
            }
            txtFormat.AppendText("\r\n");
            txtFormat.AppendText("\r\n");
            if (!PedidoCupom.Status)
            {
                txtFormat.AppendText("\r\n");
                if (PedidoCupom.Troco != 0)
                {
                    txtFormat.AppendText(string.Format("{0,-31}{1,10:f}", "TROCO.......................: ", PedidoCupom.Troco));
                    txtFormat.AppendText("\r\n");
                }
                else
                {
                    txtFormat.AppendText("\r\n");
                }
                txtFormat.AppendText(string.Format("{0,-41}\n{1,-41}", "FORMA DE PAGAMENTO:", PedidoCupom.FormaPagamento));
                txtFormat.AppendText("\r\n");
            }

            if (viagem)
            {
                string s = "PARA VIAGEM!";
                txtFormat.AppendText("\r\n");
                txtFormat.AppendText(s.PadBoth(padding));
                txtFormat.AppendText("\r\n");
            }
            else
            {
                txtFormat.AppendText("\r\n");
            }

            txtFormat.AppendText(linha);
            txtFormat.AppendText("\r\n");
            txtFormat.AppendText("Marketaco".PadBoth(padding));
        }
Ejemplo n.º 27
0
        private void Cupom(int PedidoID, decimal valorTotal, bool viagem, bool taxas, decimal vltaxa)
        {
            //41 Caracteres - Fonte: Lucida Console - Tamanho: 8
            int                padding = 41;
            dalPedido          dalPed  = new dalPedido();
            dalItensPedido     dalIPed = new dalItensPedido();
            dalEmpresa         emp     = new dalEmpresa();
            dalPedidoPagamento dalPP   = new dalPedidoPagamento();
            dalConfig          conf    = new dalConfig();

            txtFormat      = new RichTextBox();
            txtFormat.Font = new Font("Lucida Console", 8);
            var     ItensCupom  = dalIPed.listaItensCupom(PedidoID);
            var     PedidoCupom = dalPed.PedidoImprimir(PedidoID);
            decimal Pagamento   = dalPP.PagamentoPedido(PedidoID);

            string linha      = "-----------------------------------------";
            string cabecalho  = string.Format("{0}", emp.retornaEmpresa().NomeFantasia);
            string cabecalho2 = string.Format("{0}, {1}", emp.retornaEmpresa().Endereco, emp.retornaEmpresa().Numero);
            string cabecalho3 = string.Format("{0}", emp.retornaEmpresa().Telefone1);
            string info       = string.Format("Pedido No: {0}", PedidoID);
            string infoD      = string.Format("{0:dd/MM/yy HH:mm}", PedidoCupom.Data);
            string infoN      = string.Format("Nome/Mesa: {0}", PedidoCupom.Nome);
            string cab_itens  = string.Format("{0,-22}{1,5}{2,7}{3,7}", "ITEM", "QTD", "V.UNI", "TOTAL");

            txtFormat.Text = cabecalho.PadBoth(padding) + "\r\n";
            txtFormat.AppendText(cabecalho2.PadBoth(padding) + "\r\n");
            txtFormat.AppendText(cabecalho3.PadBoth(padding) + "\r\n");
            txtFormat.AppendText(linha + "\r\n");
            txtFormat.AppendText(info + infoD.PadLeft(padding - info.Length) + "\r\n");
            txtFormat.AppendText(linha + "\r\n");
            txtFormat.AppendText(cab_itens + "\r\n");



            //Itens
            foreach (var item in ItensCupom)
            {
                if (conf.ListaAppConfig("pula").Any(item.categoria.Contains))
                {
                    int inicio_selecao = txtFormat.Text.Length + 23;
                    int inicio_seleca2 = txtFormat.Text.Length;
                    itens = string.Format("{0,-22}{1,5:N}{2,7:N}{3,7:N}", item.produto, item.quantidade, item.valorUnit, item.valorTotal);
                    txtFormat.AppendText("\r\n" + itens + "\r\n");

                    txtFormat.Select(inicio_seleca2, padding);
                    txtFormat.SelectionFont = new Font(txtFormat.Font, FontStyle.Bold);

                    if (item.quantidade > 1)
                    {
                        txtFormat.Select(inicio_selecao, item.quantidade.ToString().Length + 4);
                        txtFormat.SelectionFont = new Font(txtFormat.Font, FontStyle.Bold | FontStyle.Underline);
                    }
                }
                else
                {
                    int inicio_selecao = txtFormat.Text.Length + 23;
                    itens = string.Format("{0,-22}{1,5:N}{2,7:N}{3,7:N}", item.produto, item.quantidade, item.valorUnit, item.valorTotal);
                    txtFormat.AppendText(itens + "\r\n");
                    if (item.quantidade > 1)
                    {
                        txtFormat.Select(inicio_selecao, item.quantidade.ToString().Length + 3);
                        txtFormat.SelectionFont = new Font(txtFormat.Font, FontStyle.Bold | FontStyle.Underline);
                    }
                }
            }

            txtFormat.AppendText(linha + "\r\n");
            if (!PedidoCupom.Status)
            {
                if (PedidoCupom.TaxaS)
                {
                    txtFormat.AppendText(string.Format("{0,-34}{1,7:f}", "SERVIÇO (OPCIONAL)..............: ", vltaxa) + "\r\n");
                }

                txtFormat.AppendText(string.Format("TOTAL DO PEDIDO.................: {0,7:f}".PadBoth(padding), PedidoCupom.ValorTotal) + "\r\n");
                txtFormat.AppendText(string.Format("VALOR PAGO......................: {0,7:f}".PadBoth(padding), PedidoCupom.VlPago) + "\r\n");
                txtFormat.AppendText(string.Format("TROCO...........................: {0,7:f}", PedidoCupom.Troco).PadBoth(padding) + "\r\n\r\n");
                txtFormat.AppendText(string.Format("{0,-41}\r\n{1,-41}", "FORMA DE PAGAMENTO:", PedidoCupom.FormaPagamento));
                txtFormat.AppendText("\r\n");
            }

            if (!string.IsNullOrEmpty(PedidoCupom.Nome))
            {
                int padleft = ((41 - infoN.Length) / 2) + 6;
                int length  = txtFormat.Text.Length + padleft;
                txtFormat.AppendText("\r\n" + infoN.PadBoth(padding) + "\r\n");

                txtFormat.Select(length, PedidoCupom.Nome.Length);
                txtFormat.SelectionFont = new Font(txtFormat.Font, FontStyle.Bold);
            }

            if (viagem)
            {
                string s        = "PARA VIAGEM!";
                int    padleft2 = ((41 - s.Length) / 2);
                int    length2  = txtFormat.Text.Length + padleft2;
                txtFormat.AppendText(s.PadBoth(padding) + "\r\n\r\n");

                txtFormat.Select(length2, s.Length);
                txtFormat.SelectionFont = new Font(txtFormat.Font, FontStyle.Bold);
            }
            else
            {
                txtFormat.AppendText("\r\n");
            }

            txtFormat.AppendText(linha + "\r\n");
            txtFormat.AppendText("Marketaco".PadBoth(padding));
        }
Ejemplo n.º 28
0
        private void mudaStatusPedido(int PedidoID, bool StatusPedido)
        {
            dalPedido ped = new dalPedido();

            ped.atualizaStatus(PedidoID, StatusPedido);
        }
Ejemplo n.º 29
0
        private void carregaConsulta()
        {
            dalPedido ped = new dalPedido();
            int       i   = Convert.ToInt32(cbPesq.SelectedValue);

            if (i == 1)
            {
                if ((tbPalavraChave.Text != "") && (tbPalavraChave.Text != null))
                {
                    dgvPesquisa.DataSource = ped.pesqPedidoCODIGO(Convert.ToInt32(tbPalavraChave.Text), Convert.ToInt32(cbStatus.SelectedValue));
                }
            }
            else if (i == 2)
            {
                if ((tbPalavraChave.Text != "") && (tbPalavraChave.Text != null))
                {
                    dgvPesquisa.DataSource = ped.pesqPedidoCODCLIENTE(Convert.ToInt32(tbPalavraChave.Text), Convert.ToInt32(cbStatus.SelectedValue));
                }
            }
            else if (i == 3)
            {
                dgvPesquisa.DataSource = ped.pesqPedidoCLIENTE(tbPalavraChave.Text, Convert.ToInt32(cbStatus.SelectedValue));
            }
            else if (i == 4)
            {
                dgvPesquisa.DataSource = ped.pesqPedidoDATA(dtData.Value.Date, Convert.ToInt32(cbStatus.SelectedValue));
            }
            else if (i == 5)
            {
                dgvPesquisa.DataSource = ped.pesqPedidoDATALIB(dtData.Value.Date, Convert.ToInt32(cbStatus.SelectedValue));
            }
            else if (i == 6)
            {
                dgvPesquisa.DataSource = ped.pesqPedidoDATAENTR(dtData.Value.Date, Convert.ToInt32(cbStatus.SelectedValue));
            }
            else if (i == 7)
            {
                dgvPesquisa.DataSource = ped.pesqPedidoDATAPAG(dtData.Value.Date, Convert.ToInt32(cbStatus.SelectedValue));
            }
            else if (i == 8)
            {
                if (rbPagTodos.Checked)
                {
                    dgvPesquisa.DataSource = ped.pesqPedidoPAGAMENTO(0);
                }
                else if (rbPagAberto.Checked)
                {
                    dgvPesquisa.DataSource = ped.pesqPedidoPAGAMENTO(1);
                }
                else if (rbPagEfetuado.Checked)
                {
                    dgvPesquisa.DataSource = ped.pesqPedidoPAGAMENTO(3);
                }
            }
            else if (i == 9)
            {
                dgvPesquisa.DataSource = ped.pesqPedidoSTATUS(Convert.ToInt32(cbStatus.SelectedValue));
            }

            if (dgvPesquisa.DataSource != null)
            {
                dgvPesquisa.Columns[0].HeaderText = "Código";
                dgvPesquisa.Columns[0].Width      = 70;
                dgvPesquisa.Columns[1].HeaderText = "Data registro";
                dgvPesquisa.Columns[2].HeaderText = "Nome cliente";
                dgvPesquisa.Columns[2].Width      = 275;
                dgvPesquisa.Columns[3].HeaderText = "Valor";
                dgvPesquisa.Columns[3].Width      = 150;
                dgvPesquisa.Columns[4].HeaderText = "Pagamento";
                dgvPesquisa.Columns[4].Width      = 95;
                dgvPesquisa.Columns[5].HeaderText = "Status";
                dgvPesquisa.Columns[5].Width      = 90;
            }
        }
Ejemplo n.º 30
0
        private void mostraPedido(int cod)
        {
            dalPedido     ped    = new dalPedido();
            List <pedido> pedido = ped.listaPedidos(cod);

            foreach (var p in pedido)
            {
                dtPedido.Value      = p.data.Value;
                dtAtualizacao.Value = p.datamodificacao.Value;
                if (p.statuspedido == 1)
                {
                    rbEmAberto.Checked = true;
                }
                else if (p.statuspedido == 2)
                {
                    rbLiberado.Checked      = true;
                    btAlterar.Enabled       = false;
                    btExcluir.Enabled       = false;
                    tbCodigo.Enabled        = false;
                    btProcurar.Enabled      = false;
                    btPesquisarProd.Enabled = false;
                    tbCodigoProd.Enabled    = false;
                    tbQuantidade.Enabled    = false;
                    tbValor.Enabled         = false;
                    btAdd.Enabled           = false;
                    btApagar.Enabled        = false;

                    lbLiberado.Visible = true;
                    dtLiberado.Value   = p.dataliberacao.Value;
                    dtLiberado.Visible = true;
                    MessageBox.Show("Pedido marcado como liberado, não será possivel alterar", "Aviso");
                }
                else if (p.statuspedido == 3)
                {
                    rbEntregue.Checked      = true;
                    btAlterar.Enabled       = false;
                    btExcluir.Enabled       = false;
                    tbCodigo.Enabled        = false;
                    btProcurar.Enabled      = false;
                    btPesquisarProd.Enabled = false;
                    tbCodigoProd.Enabled    = false;
                    tbQuantidade.Enabled    = false;
                    tbValor.Enabled         = false;
                    btAdd.Enabled           = false;
                    btApagar.Enabled        = false;

                    lbLiberado.Visible = true;
                    dtLiberado.Value   = p.dataliberacao.Value;
                    dtLiberado.Visible = true;

                    lbEntregue.Visible = true;
                    dtEntregue.Value   = p.dataentregue.Value;
                    dtEntregue.Visible = true;
                    MessageBox.Show("Pedido marcado como entregue, não será possivel alterar", "Aviso");
                }
                else if (p.statuspedido == 4)
                {
                    rbCancelado.Checked     = true;
                    btAlterar.Enabled       = false;
                    btExcluir.Enabled       = false;
                    tbCodigo.Enabled        = false;
                    btProcurar.Enabled      = false;
                    btPesquisarProd.Enabled = false;
                    tbCodigoProd.Enabled    = false;
                    tbQuantidade.Enabled    = false;
                    tbValor.Enabled         = false;
                    btAdd.Enabled           = false;
                    btApagar.Enabled        = false;
                    MessageBox.Show("Pedido cancelado, não será possivel alterar", "Aviso");
                }
            }
        }