Esempio n. 1
0
 private void Confirma()
 {
     try
     {
         //  verifica se senha do operador esta correta
         EcfOperadorDTO Operador = EcfFuncionarioController.Usuario(LabelOperador.Text, editSenhaOperador.Text);
         if (Operador != null)
         {
             Sessao.Instance.StatusCaixa = Tipos.StatusCaixa.scAberto;
             PodeFechar = true;
             if (Sessao.Instance.Movimento.StatusMovimento == "T")
             {
                 Sessao.Instance.Movimento.StatusMovimento = "A";
                 EcfMovimentoController.GravaEcfMovimento(Sessao.Instance.Movimento);
             }
             this.Close();
         }
         else
         {
             MessageBox.Show("Operador: dados incorretos.", "Informação do Sistema", MessageBoxButtons.OK, MessageBoxIcon.Information);
             editSenhaOperador.Focus();
         }
     }
     catch (Exception eError)
     {
         Log.write(eError.ToString());
     }
 }
Esempio n. 2
0
 public void PopulaObjetosPrincipais()
 {
     try
     {
         XmlDocument ArquivoXML = new XmlDocument();
         ArquivoXML.Load(Application.StartupPath + "\\ArquivoAuxiliar.xml");
         PathIntegracao = ArquivoXML.GetElementsByTagName("remoteApp").Item(0).InnerText.Trim();
         ECFsAutorizados.Add(Biblioteca.Desencripta(ArquivoXML.GetElementsByTagName("serie1").Item(0).InnerText.Trim()));
         //
         R01                = R01Controller.ConsultaR01("Id=1");
         Filtro             = "StatusMovimento=" + Biblioteca.QuotedStr("A") + " or StatusMovimento=" + Biblioteca.QuotedStr("T");
         Movimento          = EcfMovimentoController.ConsultaEcfMovimento(Filtro);
         Configuracao       = EcfConfiguracaoController.ConsultaEcfConfiguracao("Id=1");
         ListaTipoPagamento = EcfTipoPagamentoController.ConsultaEcfTipoPagamentoLista("Id>0").ToList();
         ListaImpressora    = EcfImpressoraController.ConsultaEcfImpressoraLista("Id>0").ToList();
     }
     catch (Exception eError)
     {
         Log.write(eError.ToString());
     }
 }
Esempio n. 3
0
        private void Timer1_Tick(object sender, EventArgs e)
        {
            Barra.Maximum = 100;
            Barra.Value   = 5;

            Timer1.Enabled = false;

            MemoryStream StreamJson = new MemoryStream();

            if (Procedimento == "EXPORTA_VENDA")
            {
                Filtro = "Id = " + PAFUtil.RecuperarIdUltimaVenda();
                EcfVendaCabecalhoDTO Venda = VendaController.ConsultaEcfVendaCabecalho(Filtro);

                DataContractJsonSerializer SerializaJson = new DataContractJsonSerializer(typeof(EcfVendaCabecalhoDTO));
                SerializaJson.WriteObject(StreamJson, Venda);

                PathLocal  = Application.StartupPath + "\\Integracao\\VENDA_" + Sessao.Instance.Configuracao.EcfCaixa.Nome + "_" + DateTime.Now.ToString("yyyy-MM-dd") + ".txt";
                PathRemoto = Sessao.Instance.PathIntegracao + "VENDA_" + Sessao.Instance.Configuracao.EcfCaixa.Nome + "_" + DateTime.Now.ToString("yyyy-MM-dd") + ".txt";
            }
            if (Procedimento == "EXPORTA_MOVIMENTO")
            {
                Filtro = "Id = " + Sessao.Instance.Movimento.Id;
                EcfMovimentoDTO Movimento = EcfMovimentoController.ConsultaEcfMovimento(Filtro);

                DataContractJsonSerializer SerializaJson = new DataContractJsonSerializer(typeof(EcfMovimentoDTO));
                SerializaJson.WriteObject(StreamJson, Movimento);

                PathLocal  = Application.StartupPath + "\\Integracao\\MOVIMENTO_" + Sessao.Instance.Configuracao.EcfCaixa.Nome + "_" + DateTime.Now.ToString("yyyy-MM-dd") + ".txt";
                PathRemoto = Sessao.Instance.PathIntegracao + "MOVIMENTO_" + Sessao.Instance.Configuracao.EcfCaixa.Nome + "_" + DateTime.Now.ToString("yyyy-MM-dd") + ".txt";
            }
            if (Procedimento == "EXPORTA_R02")
            {
                R02DTO R02 = R02Controller.ConsultaR02(Filtro);

                DataContractJsonSerializer SerializaJson = new DataContractJsonSerializer(typeof(R02DTO));
                SerializaJson.WriteObject(StreamJson, R02);

                PathLocal  = Application.StartupPath + "\\Integracao\\R02_" + Sessao.Instance.Configuracao.EcfCaixa.Nome + "_" + DateTime.Now.ToString("yyyy-MM-dd") + ".txt";
                PathRemoto = Sessao.Instance.PathIntegracao + "R02_" + Sessao.Instance.Configuracao.EcfCaixa.Nome + "_" + DateTime.Now.ToString("yyyy-MM-dd") + ".txt";
            }
            if (Procedimento == "EXPORTA_R06")
            {
                R06DTO R06 = R06Controller.ConsultaR06(Filtro);

                DataContractJsonSerializer SerializaJson = new DataContractJsonSerializer(typeof(R06DTO));
                SerializaJson.WriteObject(StreamJson, R06);

                PathLocal  = Application.StartupPath + "\\Integracao\\R06_" + Sessao.Instance.Configuracao.EcfCaixa.Nome + "_" + DateTime.Now.ToString("yyyy-MM-dd") + ".txt";
                PathRemoto = Sessao.Instance.PathIntegracao + "R06_" + Sessao.Instance.Configuracao.EcfCaixa.Nome + "_" + DateTime.Now.ToString("yyyy-MM-dd") + ".txt";
            }
            if (Procedimento == "EXPORTA_SINTEGRA60M")
            {
                Sintegra60mDTO Sintegra60M = Sintegra60MController.ConsultaSintegra60M(Filtro);

                DataContractJsonSerializer SerializaJson = new DataContractJsonSerializer(typeof(Sintegra60mDTO));
                SerializaJson.WriteObject(StreamJson, Sintegra60M);

                PathLocal  = Application.StartupPath + "\\Integracao\\SINTEGRA60M_" + Sessao.Instance.Configuracao.EcfCaixa.Nome + "_" + DateTime.Now.ToString("yyyy-MM-dd") + ".txt";
                PathRemoto = Sessao.Instance.PathIntegracao + "SINTEGRA60M_" + Sessao.Instance.Configuracao.EcfCaixa.Nome + "_" + DateTime.Now.ToString("yyyy-MM-dd") + ".txt";
            }
            if (Procedimento == "EXPORTA_NF")
            {
                NotaFiscalCabecalhoDTO NotaFiscal = NotaFiscalController.ConsultaNotaFiscalCabecalho(Filtro);

                DataContractJsonSerializer SerializaJson = new DataContractJsonSerializer(typeof(NotaFiscalCabecalhoDTO));
                SerializaJson.WriteObject(StreamJson, NotaFiscal);

                PathLocal  = Application.StartupPath + "\\Integracao\\SINTEGRA60M_" + Sessao.Instance.Configuracao.EcfCaixa.Nome + "_" + DateTime.Now.ToString("yyyy-MM-dd") + ".txt";
                PathRemoto = Sessao.Instance.PathIntegracao + "SINTEGRA60M_" + Sessao.Instance.Configuracao.EcfCaixa.Nome + "_" + DateTime.Now.ToString("yyyy-MM-dd") + ".txt";
            }

            StreamReader LerStreamJson = new StreamReader(StreamJson);

            StreamJson.Position = 0;
            JsonString          = LerStreamJson.ReadToEnd();

            System.IO.File.WriteAllText(PathLocal, JsonString);
            File.Copy(PathLocal, PathRemoto, true);

            Barra.Value = 100;
            this.Close();
        }
        private void Confirma()
        {
            try
            {
                EcfOperadorDTO Operador = new EcfOperadorDTO();
                EcfOperadorDTO Gerente  = new EcfOperadorDTO();

                //  verifica se senha do operador esta correta
                Operador = EcfFuncionarioController.Usuario(LabelOperador.Text, editSenhaOperador.Text);
                if (Operador != null)
                {
                    //  verifica se senha do gerente esta correta
                    Gerente = EcfFuncionarioController.Usuario(editLoginGerente.Text, editSenhaGerente.Text);
                    if (Gerente != null)
                    {
                        if ((Gerente.EcfFuncionario.NivelAutorizacao == "G") || (Gerente.EcfFuncionario.NivelAutorizacao == "S"))
                        {
                            // encerra movimento
                            Sessao.Instance.Movimento.DataFechamento  = DataModule.ACBrECF.DataHora;
                            Sessao.Instance.Movimento.HoraFechamento  = DataModule.ACBrECF.DataHora.ToString("hh:mm:ss");
                            Sessao.Instance.Movimento.StatusMovimento = "F";

                            EcfMovimentoController.GravaEcfMovimento(Sessao.Instance.Movimento);

                            CargaPDV FCargaPDV = new CargaPDV();
                            CargaPDV.Procedimento = "EXPORTA_MOVIMENTO";
                            FCargaPDV.ShowDialog();

                            ImprimeFechamento();

                            MessageBox.Show("Movimento encerrado com sucesso.", "Informação do Sistema", MessageBoxButtons.OK, MessageBoxIcon.Information);

                            FechouMovimento = true;

                            botaoConfirma.DialogResult = DialogResult.OK;
                            this.DialogResult          = DialogResult.OK;
                            this.Close();
                        }
                        else
                        {
                            MessageBox.Show("Gerente ou Supervisor: nivel de acesso incorreto.", "Informação do Sistema", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            editLoginGerente.Focus();
                        }
                    }
                    else
                    {
                        MessageBox.Show("Gerente ou Supervisor: dados incorretos.", "Informação do Sistema", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        editLoginGerente.Focus();
                    }
                }
                else
                {
                    MessageBox.Show("Operador: dados incorretos.", "Informação do Sistema", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    editSenhaOperador.Focus();
                }
            }
            catch (Exception eError)
            {
                Log.write(eError.ToString());
            }
        }
Esempio n. 5
0
        public static void ReducaoZ()
        {
            string Estado;

            if (ImpressoraOK())
            {
                DateTime DataMovimento = DataModule.ACBrECF.DataMovimento;
                Estado = DataModule.ACBrECF.Estado.ToString();
                if (Estado != "RequerZ")
                {
                    try
                    {
                        if (Sessao.Instance.Movimento != null)
                        {
                            EncerraMovimento FEncerraMovimento = new EncerraMovimento();

                            if (FEncerraMovimento.ShowDialog() != DialogResult.OK)
                            {
                                MessageBox.Show("É Necessário Encerrar o Movimento Para Emitir a Redução Z!", "Informação do Sistema", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                return;
                            }
                            else
                            {
                                // Exercício - CancelaPreVendasPendentes(DataMovimento);
                            }
                            Sessao.Instance.StatusCaixa = Tipos.StatusCaixa.scSomenteConsulta;
                        }
                    }
                    catch (Exception eError)
                    {
                        Log.write(eError.ToString());
                    }
                }

                Caixa.LabelMensagens.Text = "Redução Z - Aguarde!";

                DataModule.ACBrECF.Desativar();
                DataModule.ACBrECF.Ativar();

                PAFUtil.GravarR02R03();

                DataModule.ACBrECF.ReducaoZ();

                Estado = DataModule.ACBrECF.Estado.ToString();

                if (Estado != "Bloqueada")
                {
                    try
                    {
                        if (Sessao.Instance.Movimento != null)
                        {
                            Sessao.Instance.Movimento.DataFechamento  = DataModule.ACBrECF.DataHora;
                            Sessao.Instance.Movimento.HoraFechamento  = DataModule.ACBrECF.DataHora.ToString("hh:mm:ss");
                            Sessao.Instance.Movimento.StatusMovimento = "F";

                            EcfMovimentoController.GravaEcfMovimento(Sessao.Instance.Movimento);

                            EncerraMovimento FEncerraMovimento = new EncerraMovimento();
                            FEncerraMovimento.ImprimeFechamento();

                            IniciaMovimento FIniciaMovimento = new IniciaMovimento();
                            FIniciaMovimento.ShowDialog();
                        }
                    }
                    catch (Exception eError)
                    {
                        Log.write(eError.ToString());
                    }
                }

                try
                {
                    LogssController.AtualizarQuantidades();
                    PAFUtil.GerarRegistrosPAF(DataMovimento, DataMovimento, "T", "", "", "", Biblioteca.DataParaTexto(DataMovimento));
                }
                catch (Exception eError)
                {
                    Log.write(eError.ToString());
                }

                if (!DataModule.ACBrECF.MFD)
                {
                    PrimeiraReducaoDoMes();
                }

                Caixa.LabelMensagens.Text = "Movimento do ECF Encerrado.";
            }
        }
        private void Confirma()
        {
            try
            {
                // verifica se senha e o nivel do operador estáo corretos
                EcfOperadorDTO Operador = EcfFuncionarioController.Usuario(editLoginOperador.Text, editSenhaOperador.Text);
                if (Operador != null)
                {
                    // verifica se senha do gerente esta correta
                    EcfOperadorDTO Gerente = EcfFuncionarioController.Usuario(editLoginGerente.Text, editSenhaGerente.Text);
                    if (Gerente != null)
                    {
                        // verifica nivel de acesso do gerente/supervisor
                        if ((Gerente.EcfFuncionario.NivelAutorizacao == "G") || (Gerente.EcfFuncionario.NivelAutorizacao == "S"))
                        {
                            if (ECFUtil.ImpressoraOK())
                            {
                                DataRow Registro = DTTurno.Rows[GridTurno.CurrentRow.Index];

                                // insere movimento
                                Sessao.Instance.Movimento                     = new EcfMovimentoDTO();
                                Sessao.Instance.Movimento.EcfTurno.Id         = Convert.ToInt32(Registro["ID"]);
                                Sessao.Instance.Movimento.EcfImpressora.Id    = Sessao.Instance.Configuracao.EcfImpressora.Id;
                                Sessao.Instance.Movimento.EcfEmpresa.Id       = Sessao.Instance.Configuracao.EcfEmpresa.Id;
                                Sessao.Instance.Movimento.EcfOperador.Id      = Operador.Id;
                                Sessao.Instance.Movimento.EcfCaixa.Id         = Sessao.Instance.Configuracao.EcfCaixa.Id;
                                Sessao.Instance.Movimento.IdGerenteSupervisor = Gerente.Id;
                                Sessao.Instance.Movimento.DataAbertura        = DataModule.ACBrECF.DataHora;
                                Sessao.Instance.Movimento.HoraAbertura        = DataModule.ACBrECF.DataHora.ToString("hh:mm:ss");
                                if (editValorSuprimento.Text != "")
                                {
                                    Sessao.Instance.Movimento.TotalSuprimento = Convert.ToDecimal(editValorSuprimento.Text);
                                }
                                Sessao.Instance.Movimento.StatusMovimento = "A";
                                Sessao.Instance.Movimento = EcfMovimentoController.GravaEcfMovimento(Sessao.Instance.Movimento);
                            }
                            else
                            {
                                MessageBox.Show("Não foi possivel abrir o movimento!.", "Informação do Sistema", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                Sessao.Instance.StatusCaixa = Tipos.StatusCaixa.scSomenteConsulta;
                                this.Close();
                            }

                            // insere suprimento
                            if (editValorSuprimento.Text != "")
                            {
                                try
                                {
                                    ECFUtil.Suprimento(Convert.ToDecimal(editValorSuprimento.Text), Sessao.Instance.Configuracao.DescricaoSuprimento);

                                    EcfSuprimentoDTO Suprimento = new EcfSuprimentoDTO();
                                    Suprimento.IdEcfMovimento = Sessao.Instance.Movimento.Id;
                                    Suprimento.DataSuprimento = DataModule.ACBrECF.DataHora;
                                    Suprimento.Valor          = Convert.ToDecimal(editValorSuprimento.Text);
                                    EcfSuprimentoController.GravaEcfSuprimento(Suprimento);

                                    Sessao.Instance.Movimento.TotalSuprimento = Sessao.Instance.Movimento.TotalSuprimento + Suprimento.Valor;
                                    EcfMovimentoController.GravaEcfMovimento(Sessao.Instance.Movimento);
                                }
                                catch (Exception eError)
                                {
                                    Log.write(eError.ToString());
                                }
                            }

                            if (Sessao.Instance.Movimento != null)
                            {
                                MessageBox.Show("Movimento aberto com sucesso.", "Informação do Sistema", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                Sessao.Instance.StatusCaixa = Tipos.StatusCaixa.scAberto;
                                ImprimeAbertura();
                            }
                            Application.DoEvents();
                            this.Close();
                        }
                        else
                        {
                            MessageBox.Show("Gerente ou Supervisor: nivel de acesso incorreto.", "Informação do Sistema", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            editLoginGerente.Focus();
                        }
                    }
                    else
                    {
                        MessageBox.Show("Gerente ou Supervisor: dados incorretos.", "Informação do Sistema", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        editLoginGerente.Focus();
                    }
                }
                else
                {
                    MessageBox.Show("Operador: dados incorretos.", "Informação do Sistema", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    editSenhaOperador.Focus();
                }
            }
            catch (Exception eError)
            {
                Log.write(eError.ToString());
            }
        }
Esempio n. 7
0
        private void listaMenuPrincipal_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Escape)
            {
                this.Close();
            }

            if (e.KeyCode == Keys.Enter)
            {
                //  chama submenu do supervisor
                if (listaMenuPrincipal.SelectedIndex == 0)
                {
                    LoginGerenteSupervisor FLoginGerenteSupervisor = new LoginGerenteSupervisor();
                    try
                    {
                        LoginGerenteSupervisor.GerenteOuSupervisor = "S";
                        if (FLoginGerenteSupervisor.ShowDialog() == DialogResult.OK)
                        {
                            if (LoginGerenteSupervisor.LoginOK)
                            {
                                SubMenuSupervisor FSubMenuSupervisor = new SubMenuSupervisor();
                                FSubMenuSupervisor.SetBounds(this.Left, this.Top + 198, 467, 212);
                                FSubMenuSupervisor.ShowDialog();
                            }
                            else
                            {
                                MessageBox.Show("Supervisor - dados incorretos.", "Informação do Sistema", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            }
                        }
                    }
                    finally
                    {
                    }
                }

                //  chama submenu do gerente
                if (listaMenuPrincipal.SelectedIndex == 1)
                {
                    LoginGerenteSupervisor FLoginGerenteSupervisor = new LoginGerenteSupervisor();
                    try
                    {
                        LoginGerenteSupervisor.GerenteOuSupervisor = "G";
                        if (FLoginGerenteSupervisor.ShowDialog() == DialogResult.OK)
                        {
                            if (LoginGerenteSupervisor.LoginOK)
                            {
                                FSubMenuGerente FSubMenuGerente = new FSubMenuGerente();
                                FSubMenuGerente.SetBounds(this.Left, this.Top + 198, 467, 212);
                                FSubMenuGerente.ShowDialog();
                            }
                            else
                            {
                                MessageBox.Show("Gerente - dados incorretos.", "Informação do Sistema", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            }
                        }
                    }
                    finally
                    {
                    }
                }

                //  saida temporaria
                if (listaMenuPrincipal.SelectedIndex == 2)
                {
                    if (Sessao.Instance.StatusCaixa == Tipos.StatusCaixa.scAberto)
                    {
                        if (MessageBox.Show("Deseja fechar o caixa temporariamente?", "Pergunta do Sistema", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                        {
                            Sessao.Instance.Movimento.StatusMovimento = "T";
                            EcfMovimentoController.GravaEcfMovimento(Sessao.Instance.Movimento);
                            MovimentoAberto FMovimentoAberto = new MovimentoAberto();
                            FMovimentoAberto.ShowDialog();
                        }
                    }
                    else
                    {
                        MessageBox.Show("Status do caixa não permite saida temporaria.", "Informação do Sistema", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }


                //  atualiza estoque
                if (listaMenuPrincipal.SelectedIndex == 3)
                {
                    if (MessageBox.Show("Deseja realizar o procedimento de atualização de estoque?", "Pergunta do Sistema", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        if (PAFUtil.AtualizarEstoque(true))
                        {
                            MessageBox.Show("Estoque Atualizado.", "Informação do Sistema", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                        else
                        {
                            MessageBox.Show("Problemas na Atualização do Estoque.", "Informação do Sistema", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                    }
                }
            }
        }