示例#1
0
        private void MenuFiscal(object sender, EventArgs e)
        {
            if (UserPermission.SetControl(homeMenuFiscal, pictureBox12, "all_fiscal"))
            {
                return;
            }

            homeMenuFiscal.BackColor = Color.FromArgb(26, 32, 44);
            homeMenuFiscal.ForeColor = Color.WhiteSmoke;
            pictureBox6.BackColor    = Color.FromArgb(26, 32, 44);
            OpenForm.ShowInPanel <TelaFiscalInicial>(panelFormularios);

            homeMenuInicio.BackColor     = Color.FromArgb(46, 55, 72);
            homeMenuProducts.BackColor   = Color.FromArgb(46, 55, 72);
            homeMenuComercial.BackColor  = Color.FromArgb(46, 55, 72);
            homeMenuFinanceiro.BackColor = Color.FromArgb(46, 55, 72);
            homeMenuSettings.BackColor   = Color.FromArgb(46, 55, 72);
            pictureBox2.BackColor        = Color.FromArgb(46, 55, 72);
            pictureBox3.BackColor        = Color.FromArgb(46, 55, 72);
            pictureBox4.BackColor        = Color.FromArgb(46, 55, 72);
            pictureBox5.BackColor        = Color.FromArgb(46, 55, 72);
            pictureBox7.BackColor        = Color.FromArgb(46, 55, 72);

            panel3.Refresh();

            pageClicked = "homeMenuFiscal";
        }
示例#2
0
        private void Eventos()
        {
            btnAddItem.Click += (s, e) =>
            {
                var form = new AddItemMesa();
                form.ShowDialog();
            };

            Clientes.Click += (s, e) =>
            {
                if (UserPermission.SetControl(Clientes, pictureBox11, "com_clientes"))
                {
                    return;
                }

                Home.pessoaPage = "Clientes";
                OpenForm.Show <Clientes>(this);
            };

            btnEntregadores.Click += (s, e) =>
            {
                Home.pessoaPage = "Entregadores";
                OpenForm.Show <Clientes>(this);
            };

            Pedidos.Click += (s, e) =>
            {
                if (UserPermission.SetControl(Pedidos, pictureBox5, "com_novavenda"))
                {
                    return;
                }

                Home.pedidoPage = "Balcao";
                AddPedidos.Id   = 0;
                AddPedidos.PDV  = false;
                var novoPedido = new AddPedidos();
                novoPedido.ShowDialog();
            };

            btnDelivery.Click += (s, e) =>
            {
                Home.pedidoPage = "Delivery";
                AddPedidos.Id   = 0;
                AddPedidos.PDV  = false;
                var novoPedido = new AddPedidos();
                novoPedido.ShowDialog();
            };

            VendasRel.Click += (s, e) =>
            {
                Home.pedidoPage = "Food";
                OpenForm.Show <Pedidos>(this);
            };

            btnCadastrarMesa.Click += (s, e) => { OpenForm.Show <Mesas>(this); };

            Mesas.Click += (s, e) => { OpenForm.Show <Comercial.Mesas>(this); };
        }
示例#3
0
        private void MenuInicio(object sender, EventArgs e)
        {
            if (UserPermission.SetControl(homeMenuInicio, pictureBox13, "tela_inicial"))
            {
                return;
            }

            StartInicio();
        }
示例#4
0
        private void Eventos()
        {
            novaNFE.Click += (s, e) =>
            {
                if (UserPermission.SetControl(novaNFE, pictureBox6, "fiscal_novanfe"))
                {
                    return;
                }

                Nota.disableCampos = false;
                Nota.Id            = 0;
                var nota = new Nota();
                nota.ShowDialog();
            };

            nfe.Click += (s, e) =>
            {
                if (UserPermission.SetControl(nfe, pictureBox7, "fiscal_nfe"))
                {
                    return;
                }

                Home.pedidoPage = "Notas";
                OpenForm.Show <Pedido>(this);
            };

            naturezaOP.Click += (s, e) =>
            {
                if (UserPermission.SetControl(naturezaOP, pictureBox5, "fiscal_natop"))
                {
                    return;
                }

                OpenForm.Show <Natureza>(this);
            };

            clientes.Click += (s, e) =>
            {
                if (UserPermission.SetControl(clientes, pictureBox11, "fiscal_clientes"))
                {
                    return;
                }

                Home.pessoaPage = "Clientes";
                OpenForm.Show <Clientes>(this);
            };

            fornecedores.Click += (s, e) =>
            {
                if (UserPermission.SetControl(fornecedores, pictureBox2, "fiscal_fornecedores"))
                {
                    return;
                }

                Home.pessoaPage = "Fornecedores";
                OpenForm.Show <Clientes>(this);
            };

            transportadoras.Click += (s, e) =>
            {
                if (UserPermission.SetControl(transportadoras, pictureBox3, "fiscal_transportadoras"))
                {
                    return;
                }

                Home.pessoaPage = "Transportadoras";
                OpenForm.Show <Clientes>(this);
            };

            impostos.Click += (s, e) =>
            {
                if (UserPermission.SetControl(impostos, pictureBox4, "fiscal_impostos"))
                {
                    return;
                }

                OpenForm.Show <Impostos>(this);
            };

            InutilizarNFE.Click += (s, e) =>
            {
                if (UserPermission.SetControl(InutilizarNFE, pictureBox9, "fiscal_inutilizar"))
                {
                    return;
                }

                OpenForm.Show <InutilizarNotas>(this);
            };

            AlterarNFE.Click += (s, e) =>
            {
                if (UserPermission.SetControl(AlterarNFE, pictureBox10, "fiscal_alterar"))
                {
                    return;
                }

                AlertOptions.Message("", "Para alterar o últ. n° da NF-e acesse nossa área do Cliente online.",
                                     AlertBig.AlertType.info, AlertBig.AlertBtn.OK);
            };

            EnviarXml.Click += (s, e) =>
            {
                if (UserPermission.SetControl(EnviarXml, pictureBox12, "fiscal_enviar"))
                {
                    return;
                }

                Alert.Message("Ação não permitida", "Função não disponível", Alert.AlertType.warning);
            };

            CFE.Click += (s, e) =>
            {
                if (UserPermission.SetControl(CFE, pictureBox8, "fiscal_cfe"))
                {
                    return;
                }

                Home.pedidoPage = "Cupons";
                OpenForm.Show <Pedido>(this);
            };
        }
示例#5
0
        private void Eventos()
        {
            Shown += async(s, e) =>
            {
                if (!UserPermission.SetControl(homeMenuInicio, pictureBox13, "tela_inicial", false))
                {
                    StartInicio();
                }

                // Pega versão
                version.Text = $@"Versão {IniFile.Read("Version", "APP")}";
                // Pega nome do usuario
                label1.Text =
                    $@"Olá, {Validation.FirstCharToUpper(Settings.Default.user_name)} {Validation.FirstCharToUpper(Settings.Default.user_lastname)}";

                // Atualiza menu Comercial -> Alimentação
                if (IniFile.Read("Alimentacao", "Comercial") == "True")
                {
                    homeMenuComercial.Text = @"            Alimentação";
                    pictureBox4.Image      = Resources.waiter;
                }

                // Starta ações em segundo plano
                backWork.RunWorkerAsync();

                # region ###########  Menu expansivo

                MenuExpansive = IniFile.Read("MENU_EXPANSIVE", "LAYOUT") != "false";
                if (!MenuExpansive)
                {
                    panel3.Width      = 241;
                    btnShowMenu.Image = Resources.seta1;
                    version.Visible   = true;
                    MenuExpansive     = false;
                    IniFile.Write("MENU_EXPANSIVE", "false", "LAYOUT");
                }
                else
                {
                    panel3.Width      = 47;
                    btnShowMenu.Image = Resources.seta2;
                    version.Visible   = false;
                    MenuExpansive     = true;
                    IniFile.Write("MENU_EXPANSIVE", "true", "LAYOUT");
                }

                #endregion

                #region ###########  Dados do plano

                if (string.IsNullOrEmpty(Settings.Default.user_plan_id))
                {
                    plano.Text       = @"Contrate um Plano";
                    btnPlano.Text    = @"Contratar Plano";
                    recorrencia.Text = @"Contrate um Plano";
                    fatura.Visible   = false;
                    label3.Visible   = false;
                }
                else
                {
                    plano.Text       = Validation.FirstCharToUpper(Settings.Default.user_plan_id);
                    recorrencia.Text = Validation.FirstCharToUpper(Settings.Default.user_plan_recorrencia);
                    fatura.Text      = Settings.Default.user_plan_fatura;
                }

                if (Settings.Default.user_plan_status == 1)
                {
                    label6.Visible    = false;
                    trialdias.Visible = false;
                }
                else
                {
                    trialdias.Text = $@"{Settings.Default.user_plan_trial} dias";
                }

                #endregion

                #region ###########  Menu developer

                if (IniFile.Read("dev", "DEV") == "true")
                {
                    developer.Visible = true;
                }

                #endregion

                ToolHelp.Show("Sistema de sincronização em andamento.", syncOn, ToolHelp.ToolTipIcon.Info,
                              "Sincronização!");
                timer1.Start();

                // Janela de sincronização
                await Task.Delay(5000);

                if (Support.CheckForInternetConnection())
                {
                    var f = new Sync();
                    f.Show();
                    f.Hide();
                }
            };
示例#6
0
        private void Eventos()
        {
            Clientes.Click += (s, e) =>
            {
                if (UserPermission.SetControl(Clientes, pictureBox1, "fin_clientes"))
                {
                    return;
                }

                Home.pessoaPage = "Clientes";
                OpenForm.Show <Clientes>(this);
            };

            Receitas.Click += (s, e) =>
            {
                if (UserPermission.SetControl(Receitas, pictureBox11, "fin_receitas"))
                {
                    return;
                }

                Home.CategoriaPage = "Receitas";
                OpenForm.Show <Categorias>(this);
            };

            Despesas.Click += (s, e) =>
            {
                if (UserPermission.SetControl(Despesas, pictureBox13, "fin_despesas"))
                {
                    return;
                }

                Home.CategoriaPage = "Despesas";
                OpenForm.Show <Categorias>(this);
            };

            fornecedores.Click += (s, e) =>
            {
                if (UserPermission.SetControl(fornecedores, pictureBox3, "fin_fornecedores"))
                {
                    return;
                }

                Home.pessoaPage = "Fornecedores";
                OpenForm.Show <Clientes>(this);
            };

            aReceber.Click += (s, e) =>
            {
                if (UserPermission.SetControl(aReceber, pictureBox9, "fin_recebimentos"))
                {
                    return;
                }

                Home.financeiroPage = "Receber";
                OpenForm.Show <Titulos>(this);
            };

            aPagar.Click += (s, e) =>
            {
                if (UserPermission.SetControl(aPagar, pictureBox10, "fin_pagamentos"))
                {
                    return;
                }

                Home.financeiroPage = "Pagar";
                OpenForm.Show <Titulos>(this);
            };

            novoRecebimento.Click += (s, e) =>
            {
                if (UserPermission.SetControl(novoRecebimento, pictureBox4, "fin_novorecebimento"))
                {
                    return;
                }

                EditarTitulo.IdTitulo = 0;
                Home.financeiroPage   = "Receber";
                OpenForm.Show <EditarTitulo>(this);
            };

            novoPagamento.Click += (s, e) =>
            {
                if (UserPermission.SetControl(novoPagamento, pictureBox5, "fin_novopag"))
                {
                    return;
                }

                EditarTitulo.IdTitulo = 0;
                Home.financeiroPage   = "Pagar";
                OpenForm.Show <EditarTitulo>(this);
            };

            AbrirCaixa.Click += (s, e) =>
            {
                if (UserPermission.SetControl(AbrirCaixa, pictureBox6, "fin_abrircaixa"))
                {
                    return;
                }

                if (Home.idCaixa == 0)
                {
                    var f = new AbrirCaixa();
                    f.ShowDialog();
                }
                else
                {
                    Alert.Message("Oopps!", "Já existe um caixa aberto.", Alert.AlertType.warning);
                }
            };

            Caixa.Click += (s, e) =>
            {
                if (UserPermission.SetControl(Caixa, pictureBox12, "fin_caixa"))
                {
                    return;
                }

                OpenForm.Show <Caixa>(this);
            };

            EntradaSaidaCaixa.Click += (s, e) =>
            {
                if (UserPermission.SetControl(EntradaSaidaCaixa, pictureBox7, "fin_entradasaidacaixa"))
                {
                    return;
                }

                if (Home.idCaixa == 0)
                {
                    Alert.Message("Oopps!", "Você não possui um caixa aberto.", Alert.AlertType.warning);
                    return;
                }

                AddCaixaMov.idCaixa = Home.idCaixa;
                AddCaixaMov.idMov   = 0;
                var f = new AddCaixaMov();
                f.ShowDialog();
            };

            FecharCaixa.Click += (s, e) =>
            {
                if (UserPermission.SetControl(FecharCaixa, pictureBox8, "fin_fecharcaixa"))
                {
                    return;
                }

                if (Home.idCaixa == 0)
                {
                    Alert.Message("Oopps!", "Você não possui um caixa aberto.", Alert.AlertType.warning);
                    return;
                }

                Financeiro.FecharCaixa.idCaixa = Home.idCaixa;
                var f = new FecharCaixa();
                if (f.ShowDialog() == DialogResult.OK)
                {
                    Alert.Message("Pronto!", "Caixa fechado com sucesso.", Alert.AlertType.success);
                }
            };

            btnTaxas.Click += (s, e) => { OpenForm.Show <Taxas>(this); };
        }
示例#7
0
        private void Eventos()
        {
            OS.Click += (s, e) =>
            {
                //if (UserPermission.SetControl(Clientes, pictureBox11, "com_clientes"))
                //    return;

                AddOs.Id = 0;
                OpenForm.Show <AddOs>(this);
            };

            OSRel.Click += (s, e) =>
            {
                //if (UserPermission.SetControl(Pedidos, pictureBox5, "com_novavenda"))
                //    return;

                Home.pedidoPage = "Ordens de Servico";
                OpenForm.Show <Pedido>(this);
            };

            btnPdv.Click += (s, e) =>
            {
                Home.pedidoPage = "Vendas";
                AddPedidos.Id   = 0;
                AddPedidos.PDV  = true;
                var novoPedido = new AddPedidos();
                novoPedido.ShowDialog();
            };

            Clientes.Click += (s, e) =>
            {
                if (UserPermission.SetControl(Clientes, pictureBox11, "com_clientes"))
                {
                    return;
                }

                Home.pessoaPage = "Clientes";
                OpenForm.Show <Clientes>(this);
            };

            Pedidos.Click += (s, e) =>
            {
                if (UserPermission.SetControl(Pedidos, pictureBox5, "com_novavenda"))
                {
                    return;
                }

                Home.pedidoPage = "Vendas";
                AddPedidos.Id   = 0;
                AddPedidos.PDV  = false;
                var novoPedido = new AddPedidos();
                novoPedido.ShowDialog();
            };

            Orcamentos.Click += (s, e) =>
            {
                if (UserPermission.SetControl(Orcamentos, pictureBox3, "com_novoorcamento"))
                {
                    return;
                }

                Home.pedidoPage = "Orçamentos";
                AddPedidos.Id   = 0;
                var novoPedido = new AddPedidos();
                novoPedido.ShowDialog();
            };

            Consignacoes.Click += (s, e) =>
            {
                if (UserPermission.SetControl(Consignacoes, pictureBox4, "com_novaconsig"))
                {
                    return;
                }

                Home.pedidoPage = "Consignações";
                AddPedidos.Id   = 0;
                var novoPedido = new AddPedidos();
                novoPedido.ShowDialog();
            };

            Devolucoes.Click += (s, e) =>
            {
                if (UserPermission.SetControl(Devolucoes, pictureBox6, "com_novadevo"))
                {
                    return;
                }

                Home.pedidoPage = "Devoluções";
                AddPedidos.Id   = 0;
                var novoPedido = new AddPedidos();
                novoPedido.ShowDialog();
            };

            VendasRel.Click += (s, e) =>
            {
                if (UserPermission.SetControl(VendasRel, pictureBox12, "com_vendas"))
                {
                    return;
                }

                Home.pedidoPage = "Vendas";
                OpenForm.Show <Pedido>(this);
            };

            ProdutosVendidos.Click += (s, e) =>
            {
                if (UserPermission.SetControl(ProdutosVendidos, pictureBox13, "com_pdtvendidos"))
                {
                    return;
                }

                Home.pedidoPage = "Vendas";
                OpenForm.Show <ProdutosVendidos>(this);
                //Reports.ProdutosVendidos ProdVendidos = new Reports.ProdutosVendidos();
                //ProdVendidos.ShowDialog();
            };

            ConsignacoesRel.Click += (s, e) =>
            {
                if (UserPermission.SetControl(ConsignacoesRel, pictureBox9, "com_consig"))
                {
                    return;
                }

                Home.pedidoPage = "Consignações";
                OpenForm.Show <Pedido>(this);
            };

            ProdutosConsignados.Click += (s, e) =>
            {
                //if (UserPermission.SetControl(ProdutosConsignados, pictureBox10, "com_pdtconsignados"))
                //    return;

                //Home.pedidoPage = "Consignações";
                //Reports.ProdutosVendidos ProdVendidos = new Reports.ProdutosVendidos();
                //ProdVendidos.ShowDialog();
            };

            DevolucoesRel.Click += (s, e) =>
            {
                if (UserPermission.SetControl(DevolucoesRel, pictureBox15, "com_devolucoes"))
                {
                    return;
                }

                Home.pedidoPage = "Devoluções";
                OpenForm.Show <Pedido>(this);
            };

            OrcamentosRel.Click += (s, e) =>
            {
                if (UserPermission.SetControl(OrcamentosRel, pictureBox7, "com_orcamentos"))
                {
                    return;
                }

                Home.pedidoPage = "Orçamentos";
                OpenForm.Show <Pedido>(this);
            };

            ProdutosOrcados.Click += (s, e) =>
            {
                //if (UserPermission.SetControl(ProdutosOrcados, pictureBox8, "com_pdtorcados"))
                //    return;

                //Home.pedidoPage = "Orçamentos";
                //Reports.ProdutosVendidos ProdVendidos = new Reports.ProdutosVendidos();
                //ProdVendidos.ShowDialog();
            };

            Comissoes.Click += (s, e) =>
            {
                if (UserPermission.SetControl(Comissoes, pictureBox14, "com_comissoes"))
                {
                    return;
                }

                var usuarios = new Usuarios().FindByUserId(Settings.Default.user_id).FirstOrDefault <Usuarios>();
                if (usuarios.Sub_user == 0)
                {
                    OpenForm.Show <Comissão>(this);
                }
                else
                {
                    DetalhesComissao.idUser = Settings.Default.user_id;
                    OpenForm.Show <DetalhesComissao>(this);
                }
            };
        }
示例#8
0
        private void Eventos()
        {
            Produtos.Click += (s, e) =>
            {
                if (UserPermission.SetControl(Produtos, pictureBox9, "pdt_pdt"))
                {
                    return;
                }

                OpenForm.Show <Produtos.Produtos>(this);
            };

            Servicos.Click += (s, e) =>
            {
                //if (UserPermission.SetControl(Produtos, pictureBox9, "pdt_pdt"))
                //    return;

                OpenForm.Show <Servicos>(this);
            };

            Etiquetas.Click += (s, e) =>
            {
                if (UserPermission.SetControl(Etiquetas, pictureBox2, "pdt_etiquetas"))
                {
                    return;
                }

                OpenForm.Show <Etiquetas>(this);
            };

            Categorias.Click += (s, e) =>
            {
                if (UserPermission.SetControl(Categorias, pictureBox1, "pdt_cats"))
                {
                    return;
                }

                Home.CategoriaPage = "Produtos";
                OpenForm.Show <Categorias>(this);
            };

            Impostos.Click += (s, e) =>
            {
                if (UserPermission.SetControl(Impostos, pictureBox3, "pdt_impostos"))
                {
                    return;
                }

                OpenForm.Show <Impostos>(this);
            };

            fornecedores.Click += (s, e) =>
            {
                if (UserPermission.SetControl(fornecedores, pictureBox5, "pdt_fornecedores"))
                {
                    return;
                }

                Home.pessoaPage = "Fornecedores";
                OpenForm.Show <Clientes>(this);
            };

            transportadoras.Click += (s, e) =>
            {
                if (UserPermission.SetControl(transportadoras, pictureBox6, "pdt_transportadoras"))
                {
                    return;
                }

                Home.pessoaPage = "Transportadoras";
                OpenForm.Show <Clientes>(this);
            };

            ReajusteProduto.Click += (s, e) =>
            {
                if (UserPermission.SetControl(ReajusteProduto, pictureBox7, "pdt_reajuste"))
                {
                    return;
                }

                OpenForm.Show <ReajusteDeProduto>(this);
            };

            btnCombo.Click += (s, e) =>
            {
                OpenForm.Show <ComboProdutos>(this);
            };

            Compras.Click += (s, e) =>
            {
                if (UserPermission.SetControl(Compras, pictureBox8, "pdt_novacompra"))
                {
                    return;
                }

                Home.pedidoPage = "Compras";
                OpenForm.Show <Pedido>(this);
            };

            btnRemessas.Click += (s, e) =>
            {
                Home.pedidoPage = "Remessas";
                OpenForm.Show <Pedido>(this);
            };

            btnRemessa.Click += (s, e) =>
            {
                Home.pedidoPage = "Remessas";
                AddPedidos.Id   = 0;
                var novoPedido = new AddPedidos();
                novoPedido.ShowDialog();
            };

            HistoricoEntradaSaida.Click += (s, e) =>
            {
                if (UserPermission.SetControl(HistoricoEntradaSaida, pictureBox11, "pdt_entradassaidas"))
                {
                    return;
                }

                OpenForm.Show <EstoqueEntradaSaida>(this);
            };

            Estoque.Click += (s, e) =>
            {
                if (UserPermission.SetControl(Estoque, pictureBox12, "pdt_inventario"))
                {
                    return;
                }

                OpenForm.Show <Inventario>(this);
            };

            CompraNova.Click += (s, e) =>
            {
                if (UserPermission.SetControl(Compras, pictureBox13, "pdt_compras"))
                {
                    return;
                }

                Home.pedidoPage = "Compras";
                AddPedidos.Id   = 0;
                var novoPedido = new AddPedidos();
                novoPedido.ShowDialog();
            };

            importarNfe.Click += (s, e) =>
            {
                if (UserPermission.SetControl(importarNfe, pictureBox14, "pdt_importarnfe"))
                {
                    return;
                }

                var f = new ImportarNfe();
                f.ShowDialog();
            };

            btnAdicionais.Click += (s, e) => { OpenForm.Show <Adicional>(this); };

            btnVariation.Click += (s, e) => OpenForm.Show <Variacoes>(this);
        }
示例#9
0
        /// <summary>
        ///     Eventos do form
        /// </summary>
        public void Eventos()
        {
            Load += (s, e) =>
            {
                PayVerify = true;

                if (AddPedidos.PDV)
                {
                    // btn NF-e
                    btnNfe.Visible      = false;
                    button21.Visible    = false;
                    pictureBox6.Visible = false;
                }
            };

            Shown += (s, e) =>
            {
                Resolution.SetScreenMaximized(this);

                AddPedidos.BtnFinalizado = false;
                TelaReceber.Visible      = false;

                switch (Home.pedidoPage)
                {
                case "Orçamentos":
                    label13.Text = $@"Dados do Orçamento: {idPedido}";
                    label10.Text = @"Siga as etapas abaixo para criar um orçamento!";
                    break;

                case "Consignações":
                    label13.Text = $@"Dados da Consignação: {idPedido}";
                    label10.Text = @"Siga as etapas abaixo para criar uma consignãção!";
                    break;

                case "Devoluções":
                    label13.Text = $@"Dados da Devolução: {idPedido}";
                    label10.Text = @"Siga as etapas abaixo para criar uma devolução!";
                    break;

                case "Compras":
                    label13.Text = $@"Dados da Compra: {idPedido}";
                    label10.Text = @"Siga as etapas abaixo para adicionar uma compra!";

                    label15.Text = @"Á Pagar";
                    label1.Text  = @"Pagamentos";
                    //enviarEmail.Visible = false;
                    btnNfe.Visible    = false;
                    button21.Visible  = false;
                    btnCFeSat.Visible = false;
                    button22.Visible  = false;
                    break;

                default:
                    label13.Text = $@"Dados da Venda: {idPedido}";
                    label10.Text = @"Siga as etapas abaixo para adicionar uma venda!";
                    break;
                }

                if (HideFinalizar)
                {
                    btnCFeSat.Visible = false;
                    button22.Visible  = false;

                    btnNfe.Visible   = false;
                    button21.Visible = false;

                    btnConcluir.Visible = false;
                    button19.Visible    = false;

                    //btnImprimir.Left = 835;
                    //button20.Left = 830;
                    btnImprimir.Visible = false;
                    button20.Visible    = false;
                }

                if (IniFile.Read("Alimentacao", "Comercial") == "True")
                {
                    btnDividir.Visible = true;
                }

                mtxt.Visible  = false;
                mtxt2.Visible = false;

                GridListaFormaPgtos.Controls.Add(mtxt);
                GridListaFormaPgtos.Controls.Add(mtxt2);

                AtualizarDados();

                AddPedidos.BtnFinalizado = false;

                Dinheiro.Focus();
                Dinheiro.Select();

                var taxasSource = new ArrayList();
                var dataTaxa    = new Taxas().FindAll(new[] { "id", "nome" }).WhereFalse("excluir").Get <Taxas>();
                taxasSource.Add(new { Id = 0, Nome = "SELECIONE" });
                if (dataTaxa.Any())
                {
                    foreach (var item in dataTaxa)
                    {
                        taxasSource.Add(new { item.Id, item.Nome });
                    }
                }

                taxas.DataSource    = taxasSource;
                taxas.DisplayMember = "Nome";
                taxas.ValueMember   = "Id";
            };

            FormClosing += (s, e) =>
            {
                if (AddPedidos.BtnFinalizado)
                {
                    Application.OpenForms["AddPedidos"]?.Close();
                }
            };

            KeyDown                     += KeyDowns;
            Dinheiro.KeyDown            += KeyDowns;
            Cheque.KeyDown              += KeyDowns;
            Debito.KeyDown              += KeyDowns;
            Credito.KeyDown             += KeyDowns;
            Crediario.KeyDown           += KeyDowns;
            Boleto.KeyDown              += KeyDowns;
            Desconto.KeyDown            += KeyDowns;
            Acrescimo.KeyDown           += KeyDowns;
            GridListaFormaPgtos.KeyDown += KeyDowns;

            btnCFeSat.KeyDown += (s, e) =>
            {
                if (UserPermission.SetControl(btnCFeSat, pictureBox1, "fiscal_emissaocfe"))
                {
                    return;
                }

                KeyDowns(s, e);
            };

            btnNfe.KeyDown += (s, e) =>
            {
                if (!Support.CheckForInternetConnection())
                {
                    Alert.Message("Opps", "Você está sem conexão com a internet.", Alert.AlertType.warning);
                    return;
                }

                if (UserPermission.SetControl(btnNfe, pictureBox6, "fiscal_emissaonfe"))
                {
                    return;
                }

                KeyDowns(s, e);
            };

            btnImprimir.KeyDown += KeyDowns;
            btnConcluir.KeyDown += KeyDowns;
            btnSalvar.KeyDown   += KeyDowns;
            btnCancelar.KeyDown += KeyDowns;
            valor.KeyDown       += KeyDowns;
            parcelas.KeyDown    += KeyDowns;
            iniciar.KeyDown     += KeyDowns;

            btnImprimir.Click += (s, e) => { new Controller.Pedido().Imprimir(idPedido); };

            Debito.Click    += (s, e) => JanelasRecebimento("Cartão de Débito");
            Credito.Click   += (s, e) => JanelasRecebimento("Cartão de Crédito");
            Dinheiro.Click  += (s, e) => JanelasRecebimento("Dinheiro");
            Boleto.Click    += (s, e) => JanelasRecebimento("Boleto");
            Crediario.Click += (s, e) => JanelasRecebimento("Crediário");
            Cheque.Click    += (s, e) => JanelasRecebimento("Cheque");

            Desconto.Click  += (s, e) => JanelaDesconto();
            Acrescimo.Click += (s, e) => JanelaAcrescimo();
            Devolucao.Click += (s, e) => JanelaDevolucao();

            btnSalvar.Click   += (s, e) => BSalvar();
            btnCancelar.Click += (s, e) =>
            {
                PayVerify           = true;
                TelaReceber.Visible = false;
            };

            btnClose.Click += (s, e) =>
            {
                if (_controllerTitulo.GetLancados(idPedido) > 0)
                {
                    var text    = Home.pedidoPage == "Compras" ? "pagamentos" : "recebimentos";
                    var message = AlertOptions.Message("Atenção",
                                                       $"Os {text} lançados serão apagados,\n deseja continuar?", AlertBig.AlertType.warning,
                                                       AlertBig.AlertBtn.YesNo);
                    if (message)
                    {
                        foreach (DataGridViewRow row in GridListaFormaPgtos.Rows)
                        {
                            if (Convert.ToString(row.Cells[0].Value) != "")
                            {
                                _mTitulo.Remove(Validation.ConvertToInt32(row.Cells[0].Value), "ID", false);
                            }
                        }

                        AtualizarDados();

                        _mPedido        = _mPedido.FindById(idPedido).FirstOrDefault <Model.Pedido>();
                        _mPedido.status = 2;
                        _mPedido.Save(_mPedido);

                        Close();
                    }
                    else
                    {
                        return;
                    }
                }

                AddPedidos.BtnVoltar = true;
                Close();
            };

            btnDividir.Click += (s, e) =>
            {
                var itens = new ArrayList();
                if (PayVerify)
                {
                    var dataItens = _mPedidoItens.FindAll().Where("pedido", idPedido).WhereFalse("excluir")
                                    .Get <PedidoItem>();
                    if (dataItens.Any())
                    {
                        foreach (var item in dataItens)
                        {
                            itens.Add(new
                            {
                                item.Id,
                                item.Item,
                                item.xProd,
                                item.CEan,
                                item.CProd,
                                item.Quantidade,
                                item.Total
                            });
                        }
                    }

                    PedidoModalDividirConta.Itens = itens;
                }

                var form = new PedidoModalDividirConta {
                    TopMost = true
                };
                if (form.ShowDialog() == DialogResult.OK)
                {
                    valor.Text = Validation.FormatPrice(PedidoModalDividirConta.ValorDividido);
                }
            };

            btnConcluir.Click += (s, e) => { Concluir(); };

            iniciar.KeyPress += Masks.MaskBirthday;
            iniciar.KeyPress += Masks.MaskBirthday;
            valor.KeyPress   += (s, e) => Masks.MaskDouble(s, e);

            valor.TextChanged += (s, e) =>
            {
                var txt = (TextBox)s;
                Masks.MaskPrice(ref txt);
            };

            mtxt2.TextChanged += (s, e) =>
            {
                var txt = (TextBox)s;
                Masks.MaskPrice(ref txt);
            };

            GridListaFormaPgtos.CellDoubleClick += (s, e) =>
            {
                if (GridListaFormaPgtos.Columns[e.ColumnIndex].Name == "colExcluir")
                {
                    if (Convert.ToString(GridListaFormaPgtos.CurrentRow.Cells[4].Value) != "")
                    {
                        var id = Validation.ConvertToInt32(GridListaFormaPgtos.CurrentRow.Cells[0].Value);
                        _mTitulo.Remove(id);
                        AtualizarDados();
                    }
                }
            };

            GridListaFormaPgtos.CellBeginEdit += (s, e) =>
            {
                if (e.ColumnIndex == 2)
                {
                    //-----mtxt

                    mtxt.Mask = @"##/##/####";

                    var rec = GridListaFormaPgtos.GetCellDisplayRectangle(e.ColumnIndex, e.RowIndex, true);
                    mtxt.Location = rec.Location;
                    mtxt.Size     = rec.Size;
                    mtxt.Text     = "";

                    if (GridListaFormaPgtos[e.ColumnIndex, e.RowIndex].Value != null)
                    {
                        mtxt.Text = GridListaFormaPgtos[e.ColumnIndex, e.RowIndex].Value.ToString();
                    }

                    mtxt.Visible = true;
                }

                if (e.ColumnIndex == 3)
                {
                    //-----mtxt2

                    var rec = GridListaFormaPgtos.GetCellDisplayRectangle(e.ColumnIndex, e.RowIndex, true);
                    mtxt2.Location = rec.Location;
                    mtxt2.Size     = rec.Size;
                    mtxt2.Text     = "";

                    if (GridListaFormaPgtos[e.ColumnIndex, e.RowIndex].Value != null)
                    {
                        mtxt2.Text = GridListaFormaPgtos[e.ColumnIndex, e.RowIndex].Value.ToString();
                    }

                    mtxt2.Visible = true;
                }
            };

            GridListaFormaPgtos.CellEndEdit += (s, e) =>
            {
                if (mtxt.Visible)
                {
                    GridListaFormaPgtos.CurrentCell.Value = mtxt.Text;
                    mtxt.Visible = false;
                }

                if (mtxt2.Visible)
                {
                    GridListaFormaPgtos.CurrentCell.Value = mtxt2.Text;
                    mtxt2.Visible = false;
                }

                var ID = Validation.ConvertToInt32(GridListaFormaPgtos.Rows[e.RowIndex].Cells["colID"].Value);
                if (ID == 0)
                {
                    return;
                }

                var titulo = new Model.Titulo().FindById(ID).FirstOrDefault <Model.Titulo>();

                if (titulo == null)
                {
                    return;
                }

                DateTime parsed;
                if (DateTime.TryParse(GridListaFormaPgtos.Rows[e.RowIndex].Cells["Column1"].Value.ToString(),
                                      out parsed))
                {
                    titulo.Vencimento =
                        Validation.ConvertDateToSql(GridListaFormaPgtos.Rows[e.RowIndex].Cells["Column1"].Value);
                }
                else
                {
                    GridListaFormaPgtos.Rows[e.RowIndex].Cells["Column1"].Value =
                        Validation.ConvertDateToForm(titulo.Vencimento);
                }

                titulo.Total    = Validation.ConvertToDouble(GridListaFormaPgtos.Rows[e.RowIndex].Cells["Column3"].Value);
                titulo.Recebido =
                    Validation.ConvertToDouble(GridListaFormaPgtos.Rows[e.RowIndex].Cells["Column3"].Value);

                if (titulo.Save(titulo, false))
                {
                    //_controllerTitulo.GetDataTableTitulos(GridListaFormaPgtos, IdPedido);
                    Alert.Message("Pronto!", "Recebimento atualizado com sucesso.", Alert.AlertType.success);
                    AtualizarDados(false);
                }
                else
                {
                    Alert.Message("Opsss!", "Algo deu errado ao atualizar o recebimento.", Alert.AlertType.error);
                }
            };

            GridListaFormaPgtos.Scroll += (s, e) =>
            {
                if (mtxt.Visible)
                {
                    var rec = GridListaFormaPgtos.GetCellDisplayRectangle(GridListaFormaPgtos.CurrentCell.ColumnIndex,
                                                                          GridListaFormaPgtos.CurrentCell.RowIndex, true);
                    mtxt.Location = rec.Location;
                }

                if (mtxt2.Visible)
                {
                    var rec = GridListaFormaPgtos.GetCellDisplayRectangle(GridListaFormaPgtos.CurrentCell.ColumnIndex,
                                                                          GridListaFormaPgtos.CurrentCell.RowIndex, true);
                    mtxt2.Location = rec.Location;
                }
            };

            btnClearRecebimentos.Click += (s, e) =>
            {
                foreach (DataGridViewRow row in GridListaFormaPgtos.Rows)
                {
                    if (Convert.ToString(row.Cells[0].Value) != "")
                    {
                        _mTitulo.Remove(Validation.ConvertToInt32(row.Cells[0].Value), "ID", false);
                    }
                }

                AtualizarDados();

                _mPedido        = _mPedido.FindById(idPedido).FirstOrDefault <Model.Pedido>();
                _mPedido.status = 2;
                _mPedido.Save(_mPedido);
            };

            btnNfe.Click += (s, e) =>
            {
                if (!Support.CheckForInternetConnection())
                {
                    Alert.Message("Opps", "Você está sem conexão com a internet.", Alert.AlertType.warning);
                    return;
                }

                if (UserPermission.SetControl(btnNfe, pictureBox6, "fiscal_emissaonfe"))
                {
                    return;
                }

                Nfe();
            };

            btnCFeSat.Click += (s, e) =>
            {
                if (UserPermission.SetControl(btnCFeSat, pictureBox1, "fiscal_emissaocfe"))
                {
                    return;
                }

                Cfe();
            };
        }