Пример #1
0
        public tcIdentificacaoRps BuscatcIdentificacaoRps(FbConnection Conn, string sNfseq)
        {
            try
            {
                StringBuilder sQuery = new StringBuilder();
                sQuery.Append("select nf.cd_notafis, coalesce(nf.cd_serie,'00001')cd_serie from nf ");
                sQuery.Append("where nf.cd_nfseq = '" + sNfseq + "' and ");
                sQuery.Append("nf.cd_empresa = '" + belStatic.codEmpresaNFe + "'");
                
                FbCommand Comand = new FbCommand(sQuery.ToString(), Conn);
                Comand.ExecuteNonQuery();
                FbDataReader dr = Comand.ExecuteReader();
                dr.Read();

                objtcIdentificacaoRps = new tcIdentificacaoRps();
                objtcIdentificacaoRps.Nfseq = sNfseq;
                objtcIdentificacaoRps.Numero = dr["cd_notafis"].ToString();
                objtcIdentificacaoRps.Serie = dr["cd_serie"].ToString();
                objtcIdentificacaoRps.Tipo = 1; //Tratar;
                
                return objtcIdentificacaoRps;

            }
            catch (Exception ex)
            {
                throw;
            }
        }
Пример #2
0
        public tcIdentificacaoRps BuscatcIdentificacaoRps(string sNotaFis)
        {
            belConnection cx = new belConnection();
            Globais objGlobais = new Globais();
            try
            {
                StringBuilder sQuery = new StringBuilder();
                sQuery.Append("select nf.cd_nfseq, nf.cd_notafis, coalesce(nf.cd_serie,'00001')cd_serie from nf ");
                sQuery.Append("where nf.cd_notafis = '" + sNotaFis + "' and ");
                sQuery.Append("nf.cd_empresa = '" + belStatic.codEmpresaNFe + "'");
                sQuery.Append(" and coalesce(nf.st_nf_prod,'S') = 'N'");
                sQuery.Append(" and nf.cd_gruponf = '" + objGlobais.LeRegConfig("GrupoServico") + "'");

                FbCommand Comand = new FbCommand(sQuery.ToString(), cx.get_Conexao());
                cx.Open_Conexao();
                Comand.ExecuteNonQuery();
                FbDataReader dr = Comand.ExecuteReader();
                dr.Read();

                tcIdentificacaoRps objtcIdentificacaoRps = new tcIdentificacaoRps();
                objtcIdentificacaoRps.Nfseq = dr["cd_nfseq"].ToString();
                objtcIdentificacaoRps.Numero = dr["cd_notafis"].ToString();
                objtcIdentificacaoRps.Serie = dr["cd_serie"].ToString();

                return objtcIdentificacaoRps;

            }
            catch (Exception)
            {
                throw new Exception("O Grupo de faturamento da nota " + sNotaFis + " deve ser igual ao Grupo de faturamento parametrizado no Config.");
            }
            finally { cx.Close_Conexao(); }
        }
Пример #3
0
        private void AlteraDuplicataNumNFse(tcIdentificacaoRps objIdentRps, string sNotaFis)
        {
            Globais objGlobais = new Globais();
            belConnection cx = new belConnection();

            try
            {
                StringBuilder sQuery = new StringBuilder();
                sQuery.Append("UPDATE dupnotar SET dupnotar.cd_notafis = '" + sNotaFis + "' ");
                sQuery.Append("where dupnotar.cd_empresa = '" + belStatic.codEmpresaNFe + "' ");
                sQuery.Append("and dupnotar.cd_nfseq = '" + objIdentRps.Nfseq + "' ");
                sQuery.Append("and dupnotar.cd_gruponf = '" + objGlobais.LeRegConfig("GrupoServico") + "'");

                FbCommand cmd = new FbCommand(sQuery.ToString(), cx.get_Conexao());
                cx.Open_Conexao();
                cmd.ExecuteNonQuery();

            }
            catch (Exception)
            {
                throw;
            }
            finally
            { cx.Close_Conexao(); }
        }