Beispiel #1
0
        private void btnSalvar_Click(object sender, EventArgs e)
        {
            try
            {
                Loja loja = (Loja)lojaBindingSource.Current;

                if (estado.Equals(EstadoFormulario.INSERIR))
                {
                    long codLoja = GerenciadorLoja.GetInstance().Inserir(loja);
                    codLojaTextBox.Text = codLoja.ToString();
                }
                else
                {
                    GerenciadorLoja.GetInstance().Atualizar(loja);
                }
                lojaBindingSource.EndEdit();
            }
            catch (DadosException de)
            {
                lojaBindingSource.CancelEdit();
                throw de;
            }
            finally
            {
                habilitaBotoes(true);
                btnBuscar.Focus();
            }
        }
Beispiel #2
0
 private void FrmLoja_Load(object sender, EventArgs e)
 {
     //GerenciadorSeguranca.getInstance().verificaPermissao(this, Global.LOJAS, Principal.Autenticacao.CodUsuario);
     pessoaBindingSource.DataSource = GerenciadorPessoa.GetInstance().ObterPorTipoPessoa(Pessoa.PESSOA_JURIDICA);
     lojaBindingSource.DataSource   = GerenciadorLoja.GetInstance().ObterTodos();
     habilitaBotoes(true);
 }
Beispiel #3
0
        private void FrmDAV_Load(object sender, EventArgs e)
        {
            // Obtém os produtos das saídas
            List <SaidaProdutoRelatorio> listaSaidaProdutoRelatorio = GerenciadorSaidaProduto.GetInstance(null).ObterPorSaidasRelatorio(listaCodSaidas);

            SaidaProdutoRelatorioBindingSource.DataSource = listaSaidaProdutoRelatorio;

            if (listaSaidaProdutoRelatorio.Count > 0)
            {
                // Obtém os demais dados para preenchimento do relatório
                long codCliente = listaSaidaProdutoRelatorio.ElementAtOrDefault(0).CodCliente;
                PessoaBindingSource.DataSource = GerenciadorPessoa.GetInstance().Obter(codCliente);

                Loja loja = GerenciadorLoja.GetInstance().Obter(Util.Global.LOJA_PADRAO).ElementAtOrDefault(0);
                PessoaLojaBindingSource.DataSource = GerenciadorPessoa.GetInstance().Obter(loja.CodPessoa);

                ReportParameterCollection parameterCollection = new ReportParameterCollection();
                parameterCollection.Add(new ReportParameter("TotalSaidas", total.ToString("N2")));
                parameterCollection.Add(new ReportParameter("Desconto", desconto.ToString("N2")));
                parameterCollection.Add(new ReportParameter("TotalPagar", totalPagar.ToString("N2")));
                this.reportViewer1.LocalReport.SetParameters(parameterCollection);

                this.reportViewer1.RefreshReport();
            }
        }
Beispiel #4
0
 private void FrmProdutoAjusteEstoque_Load(object sender, EventArgs e)
 {
     //GerenciadorSeguranca.getInstance().verificaPermissao(this, Global.GRUPOS_DE_PRODUTOS, Principal.Autenticacao.CodUsuario);
     lojaBindingSource.DataSource        = GerenciadorLoja.GetInstance().ObterTodos();
     produtoLojaBindingSource.DataSource = GerenciadorProdutoLoja.GetInstance(null).ObterPorProduto(ProdutoSelected.CodProduto);
     habilitaBotoes(true);
 }
Beispiel #5
0
 private void btnExcluir_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show("Confirma exclusão?", "Confirmar Exclusão", MessageBoxButtons.YesNo) == DialogResult.Yes)
     {
         GerenciadorLoja.GetInstance().Remover(int.Parse(codLojaTextBox.Text));
         lojaBindingSource.RemoveCurrent();
     }
     btnBuscar.Focus();
 }
        private void FrmSaidaDevolucaoConsumidor_Load(object sender, EventArgs e)
        {
            codSaidaTextBox.Text          = saida.CodSaida.ToString();
            saidaBindingSource.DataSource = GerenciadorSaida.GetInstance(null).Obter(saida.CodSaida);
            saida = (Saida)saidaBindingSource.Current;

            lojaBindingSourceOrigem.DataSource = GerenciadorLoja.GetInstance().ObterTodos();
            int codLoja = ((Loja)codPessoaComboBoxOrigem.SelectedItem).CodLoja;
        }
Beispiel #7
0
 private void fileSystemWatcherDeposito_Changed(object sender, FileSystemEventArgs e)
 {
     if (nomeComputador.ToUpper().Equals(SERVIDOR_NFE))
     {
         if (lojaDeposito == null)
         {
             lojaDeposito = GerenciadorLoja.GetInstance().Obter(2).ElementAtOrDefault(0);
         }
         GerenciadorNFe.GetInstance().RecuperarRetornosNfe(lojaDeposito);
     }
 }
Beispiel #8
0
        private void txtTexto_TextChanged(object sender, EventArgs e)
        {
            if ((cmbBusca.SelectedIndex == 1) && !txtTexto.Text.Equals(""))
            {
                lojaBindingSource.DataSource = GerenciadorLoja.GetInstance().Obter(int.Parse(txtTexto.Text));
            }

            else
            {
                lojaBindingSource.DataSource = GerenciadorLoja.GetInstance().ObterPorNome(txtTexto.Text);
            }
        }
        private void FrmRelProdutosRevenda_Load(object sender, EventArgs e)
        {
            ProdutoBindingSource.DataSource = GerenciadorProduto.GetInstance().ObterPorCodigoFabricante(codPessoa);
            Loja loja = GerenciadorLoja.GetInstance().Obter(Util.Global.LOJA_PADRAO).ElementAtOrDefault(0);

            PessoaBindingSource.DataSource = GerenciadorPessoa.GetInstance().Obter(loja.CodPessoa);

            string parametroLucro = (1 + lucro / 100).ToString();

            ReportParameter p1 = new ReportParameter("PorcentagemLucro", parametroLucro);

            this.reportViewer1.LocalReport.SetParameters(p1);
            this.reportViewer1.RefreshReport();
        }
Beispiel #10
0
 private void FrmPessoa_Load(object sender, EventArgs e)
 {
     Cursor.Current = Cursors.WaitCursor;
     GerenciadorSeguranca.getInstance().verificaPermissao(this, Global.PESSOAS, Principal.Autenticacao.CodUsuario);
     pessoaBindingSource.DataSource         = GerenciadorPessoa.GetInstance().ObterTodos();
     municipiosIBGEBindingSource.DataSource = GerenciadorMunicipio.GetInstance().ObterTodos();
     loja = GerenciadorLoja.GetInstance().Obter(Global.LOJA_PADRAO).ElementAtOrDefault(0);
     if (!codPessoaTextBox.Text.Trim().Equals(""))
     {
         contatosBindingSource.DataSource = GerenciadorPessoa.GetInstance().ObterContatos(long.Parse(codPessoaTextBox.Text));
     }
     habilitaBotoes(true);
     Cursor.Current = Cursors.Default;
 }
Beispiel #11
0
        private void FrmSaidaDevolucaoConsumidor_Load(object sender, EventArgs e)
        {
            codSaidaTextBox.Text          = saida.CodSaida.ToString();
            saidaBindingSource.DataSource = GerenciadorSaida.GetInstance(null).Obter(saida.CodSaida);
            saida = (Saida)saidaBindingSource.Current;

            lojaBindingSourceOrigem.DataSource = GerenciadorLoja.GetInstance().ObterTodos();
            pessoaBindingSource.DataSource     = GerenciadorPessoa.GetInstance().ObterTodos();

            codPessoaComboBoxOrigem.SelectedIndex     = 0;
            codPessoaConsumidorComboBox.SelectedIndex = 0;

            int codLoja = ((Loja)codPessoaComboBoxOrigem.SelectedItem).CodLoja;

            cupomFiscalBindingSource.DataSource = GerenciadorSolicitacaoDocumento.GetInstance().ObterDocumentosFiscais();
        }
Beispiel #12
0
        private void btnNovo_Click(object sender, EventArgs e)
        {
            Pessoa pessoa = (Pessoa)pessoaBindingSource.AddNew();

            pessoa.EhFabricante = false;
            pessoa.ImprimirCF   = false;
            pessoa.ImprimirDAV  = true;
            pessoa.Tipo         = Pessoa.PESSOA_JURIDICA;

            Loja loja = GerenciadorLoja.GetInstance().Obter(Global.LOJA_PADRAO).ElementAtOrDefault(0);

            pessoa.CodMunicipioIBGE = loja.CodMunicipioIBGE;

            nomeFantasiaTextBox.Focus();

            habilitaBotoes(false);
            estado = EstadoFormulario.INSERIR;
        }
Beispiel #13
0
        private void FrmSaidaDeposito_Load(object sender, EventArgs e)
        {
            codSaidaTextBox.Text          = saida.CodSaida.ToString();
            saidaBindingSource.DataSource = GerenciadorSaida.GetInstance(null).Obter(saida.CodSaida);
            saida = (Saida)saidaBindingSource.Current;
            List <Loja> listaLojas = GerenciadorLoja.GetInstance().ObterTodos();

            lojaBindingSourceDestino.DataSource = listaLojas;
            lojaBindingSourceOrigem.DataSource  = listaLojas;
            if (saida.TipoSaida.Equals(Saida.TIPO_PRE_REMESSA_DEPOSITO))
            {
                codPessoaComboBoxOrigem.SelectedIndex  = 0;
                codPessoaComboBoxDestino.SelectedIndex = 1;
            }
            else if (saida.TipoSaida.Equals(Saida.TIPO_PRE_RETORNO_DEPOSITO))
            {
                codPessoaComboBoxOrigem.SelectedIndex  = 1;
                codPessoaComboBoxDestino.SelectedIndex = 0;
            }
        }
Beispiel #14
0
        private void Principal_Load(object sender, EventArgs e)
        {
            //this.Visible = false;
            //Telas.FrmLogin frmFrmLogin = new Telas.FrmLogin();
            //frmFrmLogin.ShowDialog();
            //if (frmFrmLogin.Aturizado)
            //{
            //    autenticacao.CodUsuario = frmFrmLogin.CodUsuario;
            //    autenticacao.Login = frmFrmLogin.Login;
            //    this.Visible = true;
            //    frmFrmLogin.Dispose();
            //}
            //else
            //{
            //    Application.Exit();
            //}

            //MapearImpressorasSeriais();
            if (nomeComputador.ToUpper().Equals(SERVIDOR_NFE))
            {
                if (lojaMatriz == null)
                {
                    lojaMatriz = GerenciadorLoja.GetInstance().Obter(1).ElementAtOrDefault(0);
                }
                fileSystemWatcher.Path = lojaMatriz.PastaNfeRetorno;
                if (lojaDeposito == null)
                {
                    lojaDeposito = GerenciadorLoja.GetInstance().Obter(2).ElementAtOrDefault(0);
                }
                fileSystemWatcherDeposito.Path = lojaDeposito.PastaNfeRetorno;
            }

            autenticacao.CodUsuario = 1;
            autenticacao.Login      = "******";
            this.Visible            = true;
        }
Beispiel #15
0
        private void ExibirResultadoProcessamentoNFCe()
        {
            lblCartao.Text = "Solicitando Autorização... ";
            textNfe.Text   = "Favor aguardar.";
            Cursor.Current = Cursors.WaitCursor;
            contConsultas++;
            // recupera a último envio da nfe
            List <NfeControle> listaNfe = GerenciadorNFe.GetInstance().ObterPorSaida(codSaida).OrderBy(nfe => nfe.CodNfe).ToList();

            if (tipoNfe == DocumentoFiscal.TipoSolicitacao.NFE)
            {
                listaNfe = listaNfe.Where(nfe => nfe.Modelo.Equals(NfeControle.MODELO_NFE)).OrderBy(nfe => nfe.CodNfe).ToList();
            }
            else
            {
                listaNfe = listaNfe.Where(nfe => nfe.Modelo.Equals(NfeControle.MODELO_NFCE)).OrderBy(nfe => nfe.CodNfe).ToList();
            }

            //if (listaNfe.Count == 0)
            //{
            //    listaNfe = GerenciadorNFe.GetInstance().ObterPorSaida(codSaida).OrderBy(nfe => nfe.CodNfe).ToList();
            //}
            //else
            //{
            //    novaSolicitacao = true;
            //}
            nfeControle = listaNfe.LastOrDefault();


            if (nfeControle != null && !nfeControle.SituacaoNfe.Equals(NfeControle.SITUACAO_SOLICITADA))
            {
                Cursor.Current = Cursors.WaitCursor;
                bool modeloSolicitado = (nfeControle.Modelo.Equals(NfeControle.MODELO_NFE) && (tipoNfe == DocumentoFiscal.TipoSolicitacao.NFE)) ||
                                        (nfeControle.Modelo.Equals(NfeControle.MODELO_NFCE) && (tipoNfe == DocumentoFiscal.TipoSolicitacao.NFCE));
                if (nfeControle.SituacaoNfe.Equals(NfeControle.SITUACAO_AUTORIZADA) && modeloSolicitado)
                {
                    if (nfeControle.Modelo.Equals(NfeControle.MODELO_NFCE))
                    {
                        lblNffe.Text = "NFe CONSUMIDOR AUTORIZADA.";
                    }
                    else
                    {
                        lblNffe.Text = "NFe AUTORIZADA.";
                    }
                    lblNffe.ForeColor = Color.Green;
                    Cursor.Current    = Cursors.Default;
                    //this.Close();
                }
                if (nfeControle.SituacaoNfe.Equals(NfeControle.SITUACAO_CONTINGENCIA_OFFLINE) && modeloSolicitado)
                {
                    if (nfeControle.Modelo.Equals(NfeControle.MODELO_NFCE))
                    {
                        lblNffe.Text = "NFe CONSUMIDOR OFF-LINE";
                    }
                    else
                    {
                        lblNffe.Text = "NFe OFF-LINE";
                    }
                    lblNffe.ForeColor = Color.Blue;
                    Cursor.Current    = Cursors.Default;
                    //this.Close();
                }
                else if (nfeControle.SituacaoNfe.Equals(NfeControle.SITUACAO_REJEITADA))
                {
                    lblNffe.Text      = "NF REJEITADA";
                    textNfe.Text      = nfeControle.MensagemSitucaoProtocoloUso;
                    lblNffe.ForeColor = Color.Red;
                    Cursor.Current    = Cursors.Default;
                    btnCancelar.Focus();
                }
                else if (nfeControle.SituacaoNfe.Equals(NfeControle.SITUACAO_NAO_VALIDADA))
                {
                    lblNffe.Text = "NF NÃO VALIDADA.";
                    //textNfe.Text = "Favor verificar {0} (1) NCM ausentes nos produtos {0} (2) CNPJ/CPF ou IE do cliente incorretos. {0}";
                    lblNffe.ForeColor = Color.Red;
                    Cursor.Current    = Cursors.Default;
                    Loja loja = GerenciadorLoja.GetInstance().Obter(nfeControle.CodLoja).ElementAtOrDefault(0);
                    if (loja != null)
                    {
                        DirectoryInfo Dir        = new DirectoryInfo(loja.PastaNfeErro);
                        string        numeroLote = "";
                        if (Dir.Exists)
                        {
                            string     arquivoRetornoLote = nfeControle.Chave + "-nfe.err";
                            FileInfo[] files = Dir.GetFiles(arquivoRetornoLote, SearchOption.TopDirectoryOnly);
                            if (files.Length > 0)
                            {
                                StreamReader reader = new StreamReader(files[0].FullName);
                                textNfe.Text = reader.ReadToEnd();
                            }
                        }
                    }
                }

                btnCancelar.Enabled = true;
                if (nfeControle.SituacaoNfe.Equals(NfeControle.SITUACAO_AUTORIZADA) && modeloSolicitado)
                {
                    timerAtualizaNFCe.Enabled = false;

                    btnImprimir.Enabled = true;
                    btnImprimir.Focus();
                }
                else if (nfeControle.SituacaoNfe.Equals(NfeControle.SITUACAO_CONTINGENCIA_OFFLINE) && modeloSolicitado)
                {
                    timerAtualizaNFCe.Enabled = false;

                    btnImprimir.Enabled = true;
                    btnImprimir.Focus();
                }
                else if (!nfeControle.SituacaoNfe.Equals(NfeControle.SITUACAO_SOLICITADA) && (contConsultas > 5))
                {
                    timerAtualizaNFCe.Enabled = false;
                    btnCancelar.Focus();
                }
                else
                {
                    btnCancelar.Focus();
                }
            }
        }
Beispiel #16
0
 private void FrmLojaPesquisa_Load(object sender, EventArgs e)
 {
     lojaBindingSource.DataSource = GerenciadorLoja.GetInstance().ObterTodos();
     cmbBusca.SelectedIndex       = 0;
 }