コード例 #1
0
        protected override XElement WriteTomadorRps(NotaFiscal nota)
        {
            if (nota.Tomador.CpfCnpj.IsEmpty())
            {
                return(null);
            }

            var tomador = new XElement("TomadorServico");

            var idTomador = new XElement("IdentificacaoTomador");

            tomador.Add(idTomador);

            var cpfCnpjTomador = new XElement("CpfCnpj");

            idTomador.Add(cpfCnpjTomador);

            cpfCnpjTomador.AddChild(AdicionarTagCNPJCPF("", "Cpf", "Cnpj", nota.Tomador.CpfCnpj));

            idTomador.AddChild(AdicionarTag(TipoCampo.Str, "", "InscricaoMunicipal", 1, 150, Ocorrencia.NaoObrigatoria, nota.Tomador.InscricaoMunicipal));

            tomador.AddChild(AdicionarTag(TipoCampo.Str, "", "NifTomador", 1, 150, Ocorrencia.NaoObrigatoria, nota.Tomador.DocTomadorEstrangeiro));
            tomador.AddChild(AdicionarTag(TipoCampo.Str, "", "RazaoSocial", 1, 150, Ocorrencia.Obrigatoria, nota.Tomador.RazaoSocial));

            if (nota.Tomador.EnderecoExterior.CodigoPais > 0)
            {
                var enderecoExt = new XElement("EnderecoExterior");
                tomador.Add(enderecoExt);

                enderecoExt.AddChild(AdicionarTag(TipoCampo.Int, "", "CodigoPais", 8, 8, Ocorrencia.Obrigatoria, nota.Tomador.EnderecoExterior.CodigoPais));
                enderecoExt.AddChild(AdicionarTag(TipoCampo.Str, "", "EnderecoCompletoExterior", 8, 8, Ocorrencia.Obrigatoria, nota.Tomador.EnderecoExterior.EnderecoCompleto));
            }
            else
            {
                var endereco = new XElement("Endereco");
                tomador.Add(endereco);

                endereco.AddChild(AdicionarTag(TipoCampo.Str, "", "Endereco", 1, 125, Ocorrencia.Obrigatoria, nota.Tomador.Endereco.Logradouro));
                endereco.AddChild(AdicionarTag(TipoCampo.Str, "", "Numero", 1, 10, Ocorrencia.Obrigatoria, nota.Tomador.Endereco.Numero));
                endereco.AddChild(AdicionarTag(TipoCampo.Str, "", "Complemento", 1, 60, Ocorrencia.NaoObrigatoria, nota.Tomador.Endereco.Complemento));
                endereco.AddChild(AdicionarTag(TipoCampo.Str, "", "Bairro", 1, 60, Ocorrencia.Obrigatoria, nota.Tomador.Endereco.Bairro));
                endereco.AddChild(AdicionarTag(TipoCampo.Int, "", "CodigoMunicipio", 7, 7, Ocorrencia.Obrigatoria, nota.Tomador.Endereco.CodigoMunicipio));
                endereco.AddChild(AdicionarTag(TipoCampo.Str, "", "Uf", 2, 2, Ocorrencia.Obrigatoria, nota.Tomador.Endereco.Uf));
                endereco.AddChild(AdicionarTag(TipoCampo.StrNumber, "", "Cep", 8, 8, Ocorrencia.Obrigatoria, nota.Tomador.Endereco.Cep));
            }

            if (nota.Prestador.DadosContato.Email.IsEmpty() && nota.Prestador.DadosContato.Telefone.IsEmpty())
            {
                return(tomador);
            }

            var contato = new XElement("Contato");

            tomador.Add(contato);

            contato.AddChild(AdicionarTag(TipoCampo.Str, "", "Telefone", 8, 8, Ocorrencia.NaoObrigatoria, nota.Prestador.DadosContato.Telefone));
            contato.AddChild(AdicionarTag(TipoCampo.Str, "", "Email", 8, 8, Ocorrencia.NaoObrigatoria, nota.Prestador.DadosContato.Email));

            return(tomador);
        }
コード例 #2
0
        protected override XElement WritePrestador(NotaFiscal nota)
        {
            var prestador = new XElement("PrestadorServico");

            prestador.AddChild(AdicionarTag(TipoCampo.Str, "", "RazaoSocial", 1, 150, Ocorrencia.Obrigatoria, nota.Prestador.RazaoSocial));
            prestador.AddChild(AdicionarTag(TipoCampo.Str, "", "NomeFantasia", 1, 60, Ocorrencia.NaoObrigatoria, nota.Prestador.NomeFantasia));

            var endereco = new XElement("Endereco");

            prestador.Add(endereco);

            endereco.AddChild(AdicionarTag(TipoCampo.Str, "", "Endereco", 1, 125, Ocorrencia.Obrigatoria, nota.Prestador.Endereco.Logradouro));
            endereco.AddChild(AdicionarTag(TipoCampo.Str, "", "Numero", 1, 10, Ocorrencia.Obrigatoria, nota.Prestador.Endereco.Numero));
            endereco.AddChild(AdicionarTag(TipoCampo.Str, "", "Complemento", 1, 60, Ocorrencia.NaoObrigatoria, nota.Prestador.Endereco.Complemento));
            endereco.AddChild(AdicionarTag(TipoCampo.Str, "", "Bairro", 1, 60, Ocorrencia.Obrigatoria, nota.Prestador.Endereco.Bairro));
            endereco.AddChild(AdicionarTag(TipoCampo.Int, "", "CodigoMunicipio", 7, 7, Ocorrencia.Obrigatoria, nota.Prestador.Endereco.CodigoMunicipio));
            endereco.AddChild(AdicionarTag(TipoCampo.Str, "", "Uf", 2, 2, Ocorrencia.Obrigatoria, nota.Prestador.Endereco.Uf));
            endereco.AddChild(AdicionarTag(TipoCampo.StrNumber, "", "Cep", 8, 8, Ocorrencia.Obrigatoria, nota.Prestador.Endereco.Cep));

            if (nota.Prestador.DadosContato.Email.IsEmpty() && nota.Prestador.DadosContato.Telefone.IsEmpty())
            {
                return(prestador);
            }

            var contato = new XElement("Contato");

            prestador.Add(contato);

            contato.AddChild(AdicionarTag(TipoCampo.Str, "", "Telefone", 8, 8, Ocorrencia.NaoObrigatoria, nota.Prestador.DadosContato.Telefone));
            contato.AddChild(AdicionarTag(TipoCampo.Str, "", "Email", 8, 8, Ocorrencia.NaoObrigatoria, nota.Prestador.DadosContato.Email));

            return(prestador);
        }
コード例 #3
0
        protected virtual XElement GenerateConstrucaoCivilRps(NotaFiscal nota)
        {
            var construcao = new XElement("ConstrucaoCivil");

            construcao.AddChild(AdicionarTag(TipoCampo.Str, "", "CodigoObra", 1, 15, Ocorrencia.NaoObrigatoria, nota.ConstrucaoCivil.CodigoObra));
            construcao.AddChild(AdicionarTag(TipoCampo.Str, "", "Art", 1, 15, Ocorrencia.Obrigatoria, nota.ConstrucaoCivil.ArtObra));

            return(construcao);
        }
コード例 #4
0
        protected override XElement WriteTomadorRps(NotaServico nota)
        {
            if (nota.Tomador.CpfCnpj.IsEmpty())
            {
                return(null);
            }

            var tomador = new XElement("Tomador");

            var ideTomador = new XElement("IdentificacaoTomador");

            tomador.Add(ideTomador);

            var cpfCnpjTomador = new XElement("CpfCnpj");

            ideTomador.Add(cpfCnpjTomador);

            cpfCnpjTomador.AddChild(AdicionarTagCNPJCPF("", "Cpf", "Cnpj", nota.Tomador.CpfCnpj));

            ideTomador.AddChild(AdicionarTag(TipoCampo.Str, "", "InscricaoMunicipal", 1, 15, Ocorrencia.NaoObrigatoria, nota.Tomador.InscricaoMunicipal));

            tomador.AddChild(AdicionarTag(TipoCampo.Str, "", "RazaoSocial", 1, 115, Ocorrencia.NaoObrigatoria, nota.Tomador.RazaoSocial));

            if (!nota.Tomador.Endereco.Logradouro.IsEmpty() ||
                !nota.Tomador.Endereco.Numero.IsEmpty() ||
                !nota.Tomador.Endereco.Complemento.IsEmpty() ||
                !nota.Tomador.Endereco.Bairro.IsEmpty() ||
                nota.Tomador.Endereco.CodigoMunicipio > 0 ||
                !nota.Tomador.Endereco.Uf.IsEmpty() ||
                nota.Tomador.Endereco.CodigoPais > 0 ||
                !nota.Tomador.Endereco.Cep.IsEmpty())
            {
                var endereco = new XElement("Endereco");
                tomador.Add(endereco);

                endereco.AddChild(AdicionarTag(TipoCampo.Str, "", "Endereco", 1, 125, Ocorrencia.NaoObrigatoria, nota.Tomador.Endereco.Logradouro));
                endereco.AddChild(AdicionarTag(TipoCampo.Str, "", "Numero", 1, 10, Ocorrencia.NaoObrigatoria, nota.Tomador.Endereco.Numero));
                endereco.AddChild(AdicionarTag(TipoCampo.Str, "", "Complemento", 1, 60, Ocorrencia.NaoObrigatoria, nota.Tomador.Endereco.Complemento));
                endereco.AddChild(AdicionarTag(TipoCampo.Str, "", "Bairro", 1, 60, Ocorrencia.NaoObrigatoria, nota.Tomador.Endereco.Bairro));
                endereco.AddChild(AdicionarTag(TipoCampo.Int, "", "CodigoMunicipio", 7, 7, Ocorrencia.MaiorQueZero, CorrelacaoCidadeGoianiaXCodigoIBGE.GetCodigoCidadeFromCodigoIBGE(nota.Tomador.Endereco.CodigoMunicipio.ToString())));
                endereco.AddChild(AdicionarTag(TipoCampo.Str, "", "Uf", 2, 2, Ocorrencia.NaoObrigatoria, nota.Tomador.Endereco.Uf));
                endereco.AddChild(AdicionarTag(TipoCampo.Int, "", "CodigoPais", 4, 4, Ocorrencia.MaiorQueZero, nota.Tomador.Endereco.CodigoPais));
                endereco.AddChild(AdicionarTag(TipoCampo.StrNumber, "", "Cep", 8, 8, Ocorrencia.NaoObrigatoria, nota.Tomador.Endereco.Cep));
            }

            if (!nota.Tomador.DadosContato.Telefone.IsEmpty() ||
                !nota.Tomador.DadosContato.Email.IsEmpty())
            {
                var contato = new XElement("Contato");
                tomador.Add(contato);

                contato.AddChild(AdicionarTag(TipoCampo.StrNumber, "", "Telefone", 1, 11, Ocorrencia.NaoObrigatoria, nota.Tomador.DadosContato.DDD + nota.Tomador.DadosContato.Telefone));
                contato.AddChild(AdicionarTag(TipoCampo.Str, "", "Email", 1, 80, Ocorrencia.NaoObrigatoria, nota.Tomador.DadosContato.Email));
            }

            return(tomador);
        }
コード例 #5
0
        protected virtual XElement GetOrgaoGerador(NotaFiscal nota)
        {
            var orgao = new XElement("OrgaoGerador");

            orgao.AddChild(AdicionarTag(TipoCampo.Int, "", "CodigoMunicipio", 1, 20, Ocorrencia.Obrigatoria, nota.OrgaoGerador.CodigoMunicipio));
            orgao.AddChild(AdicionarTag(TipoCampo.Str, "", "Uf", 2, 2, Ocorrencia.Obrigatoria, nota.OrgaoGerador.Uf));

            return(orgao);
        }
コード例 #6
0
        public override string WriteXmlRps(NotaServico nota, bool identado = true, bool showDeclaration = true)
        {
            valoresTipo30 = new List <decimal>();

            var xmlDoc = new XDocument(new XDeclaration("1.0", "UTF-8", null));

            var sdt = new XElement("SDTRPS");

            xmlDoc.AddChild(sdt);

            var tipoTrib = 1;

            if (nota.RegimeEspecialTributacao == RegimeEspecialTributacao.SimplesNacional)
            {
                tipoTrib = 4;
            }

            switch (nota.TipoTributacao)
            {
            case TipoTributacao.Isenta:
                tipoTrib = 2;
                break;

            case TipoTributacao.Suspensa:
                tipoTrib = 3;
                break;

            case TipoTributacao.TributavelFixo:
                tipoTrib = 5;
                break;
            }

            sdt.AddChild(AdicionarTag(TipoCampo.Int, "", "Ano", 0, 0, Ocorrencia.Obrigatoria, nota.Competencia.Year));
            sdt.AddChild(AdicionarTag(TipoCampo.Int, "", "Mes", 0, 0, Ocorrencia.Obrigatoria, nota.Competencia.Month.ZeroFill(2)));
            sdt.AddChild(AdicionarTag(TipoCampo.Str, "", "CPFCNPJ", 0, 0, Ocorrencia.Obrigatoria, nota.Prestador.CpfCnpj.ZeroFill(14)));
            sdt.AddChild(AdicionarTag(TipoCampo.Str, "", "DTIni", 0, 0, Ocorrencia.Obrigatoria, nota.Competencia.ToString("01/MM/yyyy")));
            sdt.AddChild(AdicionarTag(TipoCampo.Str, "", "DTFin", 0, 0, Ocorrencia.Obrigatoria, DateTime.Parse(nota.Competencia.AddMonths(1).ToString("01/MM/yyyy")).AddDays(-1).ToString("dd/MM/yyyy")));
            sdt.AddChild(AdicionarTag(TipoCampo.Int, "", "TipoTrib", 0, 0, Ocorrencia.Obrigatoria, tipoTrib));
            sdt.AddChild(AdicionarTag(TipoCampo.Str, "", "DtAdeSN", 0, 0, Ocorrencia.Obrigatoria, nota.DataOptanteSimplesNacional == DateTime.MinValue || tipoTrib != 4 ? "" : nota.DataOptanteSimplesNacional.ToString("dd/MM/yyyy")));
            sdt.AddChild(AdicionarTag(TipoCampo.Str, "", "AlqIssSN_IP", 0, 0, Ocorrencia.Obrigatoria, tipoTrib != 4 ? "" :  nota.Servico.Valores.Aliquota.ToString("##0.00")));
            sdt.AddChild(AdicionarTag(TipoCampo.Str, "", "Versao", 0, 0, Ocorrencia.Obrigatoria, "2.00"));

            sdt.Add(WriteREG20(nota));

            if (
                nota.Servico.Valores.ValorCofins > 0 ||
                nota.Servico.Valores.ValorCsll > 0 ||
                nota.Servico.Valores.ValorInss > 0 ||
                nota.Servico.Valores.ValorIr > 0 ||
                nota.Servico.Valores.IssRetido == SituacaoTributaria.Retencao ||
                nota.Servico.Valores.ValorPis > 0
                )
            {
                sdt.Add(WriteREG30(nota));
            }

            sdt.Add(WriteREG90(nota));

            return(xmlDoc.AsString(identado, showDeclaration));
        }
コード例 #7
0
        protected virtual XElement GenerateValoresNFse(NotaFiscal nota)
        {
            var valores = new XElement("ValoresNfse");

            valores.AddChild(AdicionarTag(TipoCampo.De2, "", "BaseCalculo", 1, 15, Ocorrencia.Obrigatoria, nota.Servico.Valores.BaseCalculo));
            valores.AddChild(AdicionarTag(TipoCampo.De2, "", "Aliquota", 1, 15, Ocorrencia.MaiorQueZero, nota.Servico.Valores.Aliquota));
            valores.AddChild(AdicionarTag(TipoCampo.De2, "", "ValorIss", 1, 15, Ocorrencia.MaiorQueZero, nota.Servico.Valores.ValorIss));
            valores.AddChild(AdicionarTag(TipoCampo.De2, "", "ValorLiquidoNfse", 1, 15, Ocorrencia.MaiorQueZero, nota.Servico.Valores.ValorLiquidoNfse));

            return(valores);
        }
コード例 #8
0
        protected override XElement WriteTomadorRps(NotaServico nota)
        {
            var tomador = new XElement("Tomador");

            var ideTomador = new XElement("IdentificacaoTomador");

            tomador.Add(ideTomador);

            var cpfCnpjTomador = new XElement("CpfCnpj");

            ideTomador.Add(cpfCnpjTomador);

            if (!string.IsNullOrEmpty(nota.Tomador.CpfCnpj)) // Existem NFS-e que é possível ser emitida sem tomador
            {
                cpfCnpjTomador.AddChild(AdicionarTagCNPJCPF("", "Cpf", "Cnpj", nota.Tomador.CpfCnpj));

                ideTomador.AddChild(AdicionarTag(TipoCampo.Str, "", "InscricaoMunicipal", 1, 15, Ocorrencia.NaoObrigatoria, nota.Tomador.InscricaoMunicipal));

                tomador.AddChild(AdicionarTag(TipoCampo.Str, "", "RazaoSocial", 1, 115, Ocorrencia.NaoObrigatoria, nota.Tomador.RazaoSocial));

                if (!nota.Tomador.Endereco.Logradouro.IsEmpty() || !nota.Tomador.Endereco.Numero.IsEmpty() ||
                    !nota.Tomador.Endereco.Complemento.IsEmpty() || !nota.Tomador.Endereco.Bairro.IsEmpty() ||
                    nota.Tomador.Endereco.CodigoMunicipio > 0 || !nota.Tomador.Endereco.Uf.IsEmpty() ||
                    !nota.Tomador.Endereco.Cep.IsEmpty())
                {
                    var endereco = new XElement("Endereco");
                    tomador.Add(endereco);

                    endereco.AddChild(AdicionarTag(TipoCampo.Str, "", "Endereco", 1, 125, Ocorrencia.NaoObrigatoria, nota.Tomador.Endereco.Logradouro));
                    endereco.AddChild(AdicionarTag(TipoCampo.Str, "", "Numero", 1, 10, Ocorrencia.NaoObrigatoria, nota.Tomador.Endereco.Numero));
                    endereco.AddChild(AdicionarTag(TipoCampo.Str, "", "Complemento", 1, 60, Ocorrencia.NaoObrigatoria, nota.Tomador.Endereco.Complemento));
                    endereco.AddChild(AdicionarTag(TipoCampo.Str, "", "Bairro", 1, 60, Ocorrencia.NaoObrigatoria, nota.Tomador.Endereco.Bairro));
                    endereco.AddChild(AdicionarTag(TipoCampo.Int, "", "Cidade", 7, 7, Ocorrencia.MaiorQueZero, nota.Tomador.Endereco.CodigoMunicipio));
                    endereco.AddChild(AdicionarTag(TipoCampo.Str, "", "Estado", 2, 2, Ocorrencia.NaoObrigatoria, nota.Tomador.Endereco.Uf));
                    endereco.AddChild(AdicionarTag(TipoCampo.StrNumber, "", "Cep", 8, 8, Ocorrencia.NaoObrigatoria, nota.Tomador.Endereco.Cep));
                }

                if (!nota.Tomador.DadosContato.DDD.IsEmpty() || !nota.Tomador.DadosContato.Telefone.IsEmpty() ||
                    !nota.Tomador.DadosContato.Email.IsEmpty())
                {
                    var contato = new XElement("Contato");
                    tomador.Add(contato);

                    contato.AddChild(AdicionarTag(TipoCampo.StrNumber, "", "Telefone", 1, 11, Ocorrencia.NaoObrigatoria, nota.Tomador.DadosContato.DDD + nota.Tomador.DadosContato.Telefone));
                    contato.AddChild(AdicionarTag(TipoCampo.Str, "", "Email", 1, 80, Ocorrencia.NaoObrigatoria, nota.Tomador.DadosContato.Email));
                }
            }
            else
            {
                cpfCnpjTomador.AddChild(AdicionarTagCNPJCPF("", "Cpf", "Cnpj", "00000000000"));
            }

            return(tomador);
        }
コード例 #9
0
        public override string GetXmlNFSe(NotaFiscal nota, bool identado = true, bool showDeclaration = true)
        {
            var xmlDoc   = new XDocument(new XDeclaration("1.0", "UTF-8", null));
            var compNfse = new XElement("CompNfse");

            compNfse.AddChild(GenerateNFSe(nota));
            compNfse.AddChild(GenerateNFSeCancelamento(nota));
            compNfse.AddChild(GenerateNFSeSubstituicao(nota));

            xmlDoc.AddChild(compNfse);
            return(xmlDoc.AsString(identado, showDeclaration));
        }
コード例 #10
0
        protected override XElement WriteRpsRps(NotaServico nota)
        {
            var rps = new XElement("Rps");

            rps.Add(WriteIdentificacaoRps(nota));

            rps.AddChild(AdicionarTag(TipoCampo.DatHor, "", "DataEmissao", 10, 10, Ocorrencia.Obrigatoria, nota.IdentificacaoRps.DataEmissao));
            rps.AddChild(AdicionarTag(TipoCampo.Int, "", "Status", 1, 1, Ocorrencia.Obrigatoria, (int)nota.Situacao + 1));

            rps.AddChild(WriteSubstituidoRps(nota));

            return(rps);
        }
コード例 #11
0
        protected virtual XElement GetInfoNFSe(NotaFiscal nota)
        {
            var infNfse = new XElement("InfNfse", new XAttribute("Id", $"{nota.IdentificacaoNFSe.Numero.OnlyNumbers()}"));

            infNfse.AddChild(AdicionarTag(TipoCampo.StrNumber, "", "Numero", 1, 15, Ocorrencia.Obrigatoria, nota.IdentificacaoNFSe.Numero));
            infNfse.AddChild(AdicionarTag(TipoCampo.Str, "", "CodigoVerificacao", 1, 5, Ocorrencia.Obrigatoria, nota.IdentificacaoNFSe.Chave));
            infNfse.AddChild(AdicionarTag(TipoCampo.DatHor, "", "DataEmissao", 1, 1, Ocorrencia.Obrigatoria, nota.IdentificacaoNFSe.DataEmissao));

            infNfse.AddChild(AdicionarTag(TipoCampo.Str, "", "NfseSubstituida", 1, 15, Ocorrencia.NaoObrigatoria, nota.RpsSubstituido.NumeroNfse));
            infNfse.AddChild(AdicionarTag(TipoCampo.Str, "", "OutrasInformacoes", 1, 255, Ocorrencia.NaoObrigatoria, nota.OutrasInformacoes));

            return(infNfse);
        }
コード例 #12
0
        protected override XElement WriteConstrucaoCivilRps(NotaServico nota)
        {
            if (nota.ConstrucaoCivil.CodigoObra.IsEmpty())
            {
                return(null);
            }

            var construcao = new XElement("ContrucaoCivil");

            construcao.AddChild(AdicionarTag(TipoCampo.Str, "", "CodigoObra", 1, 15, Ocorrencia.NaoObrigatoria, nota.ConstrucaoCivil.CodigoObra));
            construcao.AddChild(AdicionarTag(TipoCampo.Str, "", "Art", 1, 15, Ocorrencia.Obrigatoria, nota.ConstrucaoCivil.ArtObra));

            return(construcao);
        }
コード例 #13
0
        protected override XElement WriteServicosRps(NotaServico nota)
        {
            var servico = new XElement("Servico");

            servico.Add(WriteValoresRps(nota));

            servico.AddChild(AdicionarTag(TipoCampo.Str, "", "CodigoTributacaoMunicipio", 1, 20, Ocorrencia.NaoObrigatoria, nota.Servico.CodigoTributacaoMunicipio));
            servico.AddChild(AdicionarTag(TipoCampo.Str, "", "Discriminacao", 1, 2000, Ocorrencia.Obrigatoria, nota.Servico.Discriminacao));
            servico.AddChild(AdicionarTag(TipoCampo.Str, "", "CodigoMunicipio", 1, 20, Ocorrencia.Obrigatoria, CorrelacaoCidadeGoianiaXCodigoIBGE.GetCodigoCidadeFromCodigoIBGE(nota.Servico.CodigoMunicipio.ToString())));
            servico.AddChild(AdicionarTag(TipoCampo.Int, "", "CodigoPais", 4, 4, Ocorrencia.MaiorQueZero, nota.Servico.CodigoPais));
            servico.AddChild(AdicionarTag(TipoCampo.Str, "", "NumeroProcesso", 1, 30, Ocorrencia.NaoObrigatoria, nota.Servico.NumeroProcesso));

            return(servico);
        }
コード例 #14
0
        protected override XElement WriteServicosRps(NotaServico nota)
        {
            var servico = new XElement("Servico");

            servico.Add(WriteValoresRps(nota));

            servico.AddChild(AdicionarTag(TipoCampo.Int, "", "IssRetido", 1, 1, Ocorrencia.Obrigatoria, nota.Servico.Valores.IssRetido == SituacaoTributaria.Retencao ? 1 : 2));

            if (nota.Servico.ResponsavelRetencao.HasValue)
            {
                servico.AddChild(AdicionarTag(TipoCampo.Int, "", "ResponsavelRetencao", 1, 1, Ocorrencia.NaoObrigatoria, (int)nota.Servico.ResponsavelRetencao + 1));
            }

            if (Configuracoes.WebServices.Ambiente == DFe.Core.Common.DFeTipoAmbiente.Homologacao)
            {
                servico.AddChild(AdicionarTag(TipoCampo.Str, "", "ItemListaServico", 1, 5, Ocorrencia.Obrigatoria, "01.00"));
            }
            else
            {
                servico.AddChild(AdicionarTag(TipoCampo.Str, "", "ItemListaServico", 1, 5, Ocorrencia.Obrigatoria, nota.Servico.ItemListaServico));
            }
            servico.AddChild(AdicionarTag(TipoCampo.Str, "", "CodigoCnae", 1, 7, Ocorrencia.NaoObrigatoria, nota.Servico.CodigoCnae));
            //servico.AddChild(AdicionarTag(TipoCampo.Str, "", "CodigoTributacaoMunicipio", 1, 20, Ocorrencia.NaoObrigatoria, nota.Servico.CodigoTributacaoMunicipio));
            servico.AddChild(AdicionarTag(TipoCampo.Str, "", "Discriminacao", 1, 2000, Ocorrencia.Obrigatoria, nota.Servico.Discriminacao));
            servico.AddChild(AdicionarTag(TipoCampo.Str, "", "CodigoMunicipio", 1, 20, Ocorrencia.Obrigatoria, nota.Servico.CodigoMunicipio));
            //servico.AddChild(AdicionarTag(TipoCampo.Int, "", "CodigoPais", 4, 4, Ocorrencia.MaiorQueZero, nota.Servico.CodigoPais));
            servico.AddChild(AdicionarTag(TipoCampo.Int, "", "ExigibilidadeISS", 1, 1, Ocorrencia.Obrigatoria, (int)nota.Servico.ExigibilidadeIss + 1));
            //servico.AddChild(AdicionarTag(TipoCampo.Int, "", "MunicipioIncidencia", 7, 7, Ocorrencia.MaiorQueZero, nota.Servico.MunicipioIncidencia));
            //servico.AddChild(AdicionarTag(TipoCampo.Str, "", "NumeroProcesso", 1, 30, Ocorrencia.NaoObrigatoria, nota.Servico.NumeroProcesso));

            return(servico);
        }
コード例 #15
0
        protected virtual XElement GetEnderecoPrestador(NotaFiscal nota)
        {
            if (!nota.Prestador.Endereco.Logradouro.IsEmpty() ||
                !nota.Prestador.Endereco.Numero.IsEmpty() ||
                !nota.Prestador.Endereco.Complemento.IsEmpty() ||
                !nota.Prestador.Endereco.Bairro.IsEmpty() ||
                nota.Prestador.Endereco.CodigoMunicipio > 0 ||
                !nota.Prestador.Endereco.Uf.IsEmpty() ||
                nota.Prestador.Endereco.CodigoPais > 0 ||
                !nota.Prestador.Endereco.Cep.IsEmpty())
            {
                var endereco = new XElement("EnderecoPrestadorServico");

                endereco.AddChild(AdicionarTag(TipoCampo.Str, "", "Endereco", 1, 125, Ocorrencia.NaoObrigatoria, nota.Prestador.Endereco.Logradouro));
                endereco.AddChild(AdicionarTag(TipoCampo.Str, "", "Numero", 1, 10, Ocorrencia.NaoObrigatoria, nota.Prestador.Endereco.Numero));
                endereco.AddChild(AdicionarTag(TipoCampo.Str, "", "Complemento", 1, 60, Ocorrencia.NaoObrigatoria, nota.Prestador.Endereco.Complemento));
                endereco.AddChild(AdicionarTag(TipoCampo.Str, "", "Bairro", 1, 60, Ocorrencia.NaoObrigatoria, nota.Prestador.Endereco.Bairro));
                endereco.AddChild(AdicionarTag(TipoCampo.Int, "", "CodigoMunicipio", 7, 7, Ocorrencia.MaiorQueZero, nota.Prestador.Endereco.CodigoMunicipio));
                endereco.AddChild(AdicionarTag(TipoCampo.Str, "", "Uf", 2, 2, Ocorrencia.NaoObrigatoria, nota.Prestador.Endereco.Uf));
                endereco.AddChild(AdicionarTag(TipoCampo.Int, "", "CodigoPais", 4, 4, Ocorrencia.MaiorQueZero, nota.Prestador.Endereco.CodigoPais));
                endereco.AddChild(AdicionarTag(TipoCampo.StrNumber, "", "Cep", 8, 8, Ocorrencia.NaoObrigatoria, nota.Prestador.Endereco.Cep));

                return(endereco);
            }

            return(null);
        }
コード例 #16
0
        protected override XElement WriteRps(NotaServico nota)
        {
            var rootRps = new XElement("rps");

            var infServico = new XElement("InfDeclaracaoPrestacaoServico", new XAttribute("Id", $"R{nota.IdentificacaoRps.Numero.OnlyNumbers()}"));

            rootRps.Add(infServico);

            infServico.Add(WriteRpsRps(nota));

            if (nota.Competencia.ToString("yyyyMMdd") == "00010101")
            {
                infServico.AddChild(AdicionarTag(TipoCampo.Dat, "", "Competencia", 10, 10, Ocorrencia.Obrigatoria, nota.IdentificacaoRps.DataEmissao));
            }
            else
            {
                infServico.AddChild(AdicionarTag(TipoCampo.Dat, "", "Competencia", 10, 10, Ocorrencia.Obrigatoria, nota.Competencia));
            }

            infServico.AddChild(WriteServicosRps(nota));
            infServico.AddChild(WritePrestadorRps(nota));
            infServico.AddChild(WriteTomadorRps(nota));
            infServico.AddChild(WriteIntermediarioRps(nota));
            infServico.AddChild(WriteConstrucaoCivilRps(nota));

            string regimeEspecialTributacao;
            string optanteSimplesNacional;

            if (nota.RegimeEspecialTributacao == RegimeEspecialTributacao.SimplesNacional)
            {
                regimeEspecialTributacao = "6";
                optanteSimplesNacional   = "1";
            }
            else
            {
                regimeEspecialTributacao = ((int)nota.RegimeEspecialTributacao).ToString();
                optanteSimplesNacional   = "2";
            }

            if (nota.RegimeEspecialTributacao != RegimeEspecialTributacao.Nenhum)
            {
                infServico.AddChild(AdicionarTag(TipoCampo.Int, "", "RegimeEspecialTributacao", 1, 1, Ocorrencia.NaoObrigatoria, regimeEspecialTributacao));
            }

            infServico.AddChild(AdicionarTag(TipoCampo.Int, "", "OptanteSimplesNacional", 1, 1, Ocorrencia.Obrigatoria, optanteSimplesNacional));
            infServico.AddChild(AdicionarTag(TipoCampo.Int, "", "IncentivoFiscal", 1, 1, Ocorrencia.Obrigatoria, nota.IncentivadorCultural == NFSeSimNao.Sim ? 1 : 2));

            return(rootRps);
        }
コード例 #17
0
        protected virtual XElement GenerateNFSe(NotaFiscal nota)
        {
            var nfse = new XElement("Nfse", new XAttribute("versao", "2.00"));

            var infNfse = GetInfoNFSe(nota);

            nfse.AddChild(infNfse);

            var valores = GenerateValoresNFse(nota);

            infNfse.AddChild(valores);

            infNfse.AddChild(AdicionarTag(TipoCampo.De2, "", "ValorCredito", 1, 15, Ocorrencia.MaiorQueZero, nota.ValorCredito));

            var endereco = GetEnderecoPrestador(nota);

            infNfse.AddChild(endereco);

            var orgao = GetOrgaoGerador(nota);

            infNfse.AddChild(orgao);

            var declaracao = GenerateDeclaracaoServicoNFSe(nota);

            infNfse.AddChild(declaracao);

            return(nfse);
        }
コード例 #18
0
        public override XElement BuildUrlElement(IPublishedContent node, string culture)
        {
            if (_contentMap.TryGetValue(node.Id, out IEnumerable <int> imageIds) == false)
            {
                return(null);
            }

            using (var context = _contextFactory.EnsureUmbracoContext())
            {
                var images = imageIds
                             .Select(context.UmbracoContext.Media.GetById)
                             .Where(x => x != null)
                             .Where(x => _config.MediaTypes.InvariantContains(x.ContentType.Alias));

                if (images.Any() == false)
                {
                    return(null);
                }

                var urlElement = new XElement(Namespace + "url");

                urlElement.AddChild("loc", node.Url(culture: culture, mode: UrlMode.Absolute));

                foreach (var image in images)
                {
                    urlElement.Add(BuildMetaElement(image, culture));
                }

                return(urlElement);
            }
        }
コード例 #19
0
        protected virtual XElement GenerateNFSeSubstituicao(NotaFiscal nota)
        {
            if (nota.RpsSubstituido.NFSeSubstituidora.IsEmpty())
            {
                return(null);
            }

            var substituidora = new XElement("NfseSubstituicao", new XAttribute("Versão", "2.00"));
            var subNFSe       = new XElement("SubstituicaoNfse", new XAttribute("Id", nota.RpsSubstituido.Id));

            substituidora.AddChild(subNFSe);

            subNFSe.AddChild(AdicionarTag(TipoCampo.Int, "", "NfseSubstituidora", 1, 15, Ocorrencia.Obrigatoria, nota.RpsSubstituido.NFSeSubstituidora));
            subNFSe.AddChild(WriteSignature(nota.RpsSubstituido.Signature));

            return(substituidora);
        }
コード例 #20
0
        protected override XElement WritePrestador(NotaServico nota)
        {
            var prestador = new XElement("PrestadorServico");

            prestador.AddChild(AdicionarTag(TipoCampo.Str, "", "RazaoSocial", 1, 150, Ocorrencia.Obrigatoria, nota.Prestador.RazaoSocial));
            prestador.AddChild(AdicionarTag(TipoCampo.Str, "", "NomeFantasia", 1, 60, Ocorrencia.NaoObrigatoria, nota.Prestador.NomeFantasia));

            var indPrestador = new XElement("IdentificacaoPrestador");

            prestador.AddChild(indPrestador);

            var cpfCNPJ = new XElement("CpfCnpj");

            indPrestador.AddChild(cpfCNPJ);

            cpfCNPJ.AddChild(AdicionarTagCNPJCPF("", "Cpf", "Cnpj", nota.Prestador.CpfCnpj));
            indPrestador.AddChild(AdicionarTag(TipoCampo.Str, "", "InscricaoMunicipal", 1, 15, Ocorrencia.NaoObrigatoria, nota.Prestador.InscricaoMunicipal));

            var endereco = new XElement("Endereco");

            prestador.AddChild(endereco);

            endereco.AddChild(AdicionarTag(TipoCampo.Str, "", "Endereco", 1, 125, Ocorrencia.NaoObrigatoria, nota.Prestador.Endereco.Logradouro));
            endereco.AddChild(AdicionarTag(TipoCampo.Str, "", "Numero", 1, 10, Ocorrencia.NaoObrigatoria, nota.Prestador.Endereco.Numero));
            endereco.AddChild(AdicionarTag(TipoCampo.Str, "", "Complemento", 1, 60, Ocorrencia.NaoObrigatoria, nota.Prestador.Endereco.Complemento));
            endereco.AddChild(AdicionarTag(TipoCampo.Str, "", "Bairro", 1, 60, Ocorrencia.NaoObrigatoria, nota.Prestador.Endereco.Bairro));
            endereco.AddChild(AdicionarTag(TipoCampo.Int, "", "CodigoMunicipio", 7, 7, Ocorrencia.MaiorQueZero, nota.Prestador.Endereco.CodigoMunicipio));
            endereco.AddChild(AdicionarTag(TipoCampo.Str, "", "Uf", 2, 2, Ocorrencia.NaoObrigatoria, nota.Prestador.Endereco.Uf));
            endereco.AddChild(AdicionarTag(TipoCampo.Int, "", "CodigoPais", 4, 4, Ocorrencia.MaiorQueZero, nota.Prestador.Endereco.CodigoPais));
            endereco.AddChild(AdicionarTag(TipoCampo.StrNumber, "", "Cep", 8, 8, Ocorrencia.NaoObrigatoria, nota.Prestador.Endereco.Cep));

            if (!nota.Prestador.DadosContato.Telefone.IsEmpty() ||
                !nota.Prestador.DadosContato.Email.IsEmpty())
            {
                var contato = new XElement("contato");
                prestador.AddChild(contato);

                contato.AddChild(AdicionarTag(TipoCampo.Str, "", "Telefone", 1, 20, Ocorrencia.NaoObrigatoria, nota.Prestador.DadosContato.Telefone));
                contato.AddChild(AdicionarTag(TipoCampo.Str, "", "Email", 1, 80, Ocorrencia.NaoObrigatoria, nota.Prestador.DadosContato.Email));
            }

            return(prestador);
        }
コード例 #21
0
        public override XElement BuildMetaElement(IPublishedContent node, string culture)
        {
            var newsElement = new XElement(_xmlns + "news");

            var title = node.Value <string>(_config.Fields.Title, culture)
                        ?? node.Name(culture);

            if (string.IsNullOrWhiteSpace(title) == false)
            {
                newsElement.AddChild("title", title);
            }

            var cultureInfo = new CultureInfo(culture);

            newsElement.AddChild("publication", x => x
                                 .AddChild("name", _config.PublicationName)
                                 .AddChild("language", cultureInfo.TwoLetterISOLanguageName)
                                 );

            var publicationDate = node.Value <DateTime?>(_config.Fields.Date, culture)
                                  ?? node.CreateDate;

            if (publicationDate > DateTime.MinValue)
            {
                newsElement.AddChild("publication_date", publicationDate.ToString("yyyy-MM-dd hh:mm:ss"));
            }

            var genres = node.Value <IEnumerable <string> >(_config.Fields.Genres, culture);

            if (genres != null && genres.Any() == true)
            {
                newsElement.AddChild("genres", string.Join(",", genres));
            }

            var keywords = node.Value <IEnumerable <string> >(_config.Fields.Keywords, culture);

            if (keywords != null && keywords.Any() == true)
            {
                newsElement.AddChild("keywords", string.Join(",", keywords));
            }

            return(newsElement);
        }
コード例 #22
0
        protected override XElement WriteRps(NotaServico nota)
        {
            var rootRps = new XElement("Rps");

            var infServico = new XElement("InfDeclaracaoPrestacaoServico");

            rootRps.Add(infServico);

            infServico.Add(WriteRpsRps(nota));

            infServico.AddChild(WriteServicosRps(nota));
            infServico.AddChild(WritePrestadorRps(nota));
            infServico.AddChild(WriteTomadorRps(nota));
            infServico.AddChild(WriteIntermediarioRps(nota));
            infServico.AddChild(WriteConstrucaoCivilRps(nota));

            var regimeEspecialTributacao = nota.RegimeEspecialTributacao == RegimeEspecialTributacao.SimplesNacional ? "6" :
                                           ((int)nota.RegimeEspecialTributacao).ToString();

            if (nota.RegimeEspecialTributacao != RegimeEspecialTributacao.Nenhum)
            {
                infServico.AddChild(AdicionarTag(TipoCampo.Int, "", "RegimeEspecialTributacao", 1, 1, Ocorrencia.NaoObrigatoria, regimeEspecialTributacao));
            }

            return(rootRps);
        }
コード例 #23
0
        protected override XElement WriteInfoRPS(NotaFiscal nota)
        {
            var incentivadorCultural = nota.IncentivadorCultural == NFSeSimNao.Sim ? 1 : 2;

            string regimeEspecialTributacao;
            string optanteSimplesNacional;

            if (nota.RegimeEspecialTributacao == RegimeEspecialTributacao.SimplesNacional)
            {
                regimeEspecialTributacao = "";
                optanteSimplesNacional   = "1";
            }
            else
            {
                var regime = (int)nota.RegimeEspecialTributacao;
                regimeEspecialTributacao = regime == 0 ? string.Empty : regime.ToString();
                optanteSimplesNacional   = "2";
            }

            var situacao = nota.Situacao == SituacaoNFSeRps.Normal ? "1" : "2";

            var infoRps = new XElement("InfRps", new XAttribute("Id", $"R{nota.IdentificacaoRps.Numero}"));

            infoRps.Add(WriteIdentificacao(nota));
            infoRps.AddChild(AdicionarTag(TipoCampo.DatHor, "", "DataEmissao", 20, 20, Ocorrencia.Obrigatoria, nota.IdentificacaoRps.DataEmissao));
            infoRps.AddChild(AdicionarTag(TipoCampo.Int, "", "NaturezaOperacao", 1, 1, Ocorrencia.Obrigatoria, nota.NaturezaOperacao));
            infoRps.AddChild(AdicionarTag(TipoCampo.Int, "", "RegimeEspecialTributacao", 1, 1, Ocorrencia.NaoObrigatoria, regimeEspecialTributacao));
            infoRps.AddChild(AdicionarTag(TipoCampo.Int, "", "OptanteSimplesNacional", 1, 1, Ocorrencia.Obrigatoria, optanteSimplesNacional));
            infoRps.AddChild(AdicionarTag(TipoCampo.Int, "", "IncentivadorCultural", 1, 1, Ocorrencia.Obrigatoria, incentivadorCultural));
            infoRps.AddChild(AdicionarTag(TipoCampo.Int, "", "Status", 1, 1, Ocorrencia.Obrigatoria, situacao));

            return(infoRps);
        }
コード例 #24
0
        protected override XElement WritePrestadorRps(NotaServico nota)
        {
            var prestador = new XElement("Prestador");

            var cpfCnpjPrestador = new XElement("CpfCnpj");

            prestador.Add(cpfCnpjPrestador);

            cpfCnpjPrestador.AddChild(AdicionarTagCNPJCPF("", "Cpf", "Cnpj", nota.Prestador.CpfCnpj));
            prestador.AddChild(AdicionarTag(TipoCampo.Str, "", "InscricaoMunicipal", 1, 15, Ocorrencia.NaoObrigatoria, nota.Prestador.InscricaoMunicipal));

            return(prestador);
        }
コード例 #25
0
        public static XObject[] SerializeChild(ICollection values, DFeCollectionAttribute tag, DFeItemAttribute[] itemTags, SerializerOptions options)
        {
            var arrayElement = new XElement(tag.Name);

            foreach (var value in values)
            {
                var itemTag      = itemTags.SingleOrDefault(x => x.Tipo == value.GetType());
                var childElement = ObjectSerializer.Serialize(value, value.GetType(), itemTag?.Name, options);
                arrayElement.AddChild(childElement);
            }

            return(new XObject[] { arrayElement });
        }
コード例 #26
0
        protected virtual XElement GenerateNFSeCancelamento(NotaFiscal nota)
        {
            if (nota.Situacao != SituacaoNFSeRps.Cancelado)
            {
                return(null);
            }

            var cancelamento = new XElement("NfseCancelamento", new XAttribute("Versão", "2.00"));

            var cancConfirmacao = new XElement("Confirmacao", new XAttribute("Id", nota.Cancelamento.Id));

            cancelamento.AddChild(cancConfirmacao);

            var cancPedido = new XElement("Pedido");

            cancConfirmacao.AddChild(cancPedido);

            var cancInfPedido = new XElement("InfPedidoCancelamento", new XAttribute("Id", nota.Cancelamento.Id));

            cancPedido.AddChild(cancInfPedido);

            var cancIdNfSe = new XElement("IdentificacaoNfse");

            cancInfPedido.AddChild(cancIdNfSe);

            cancIdNfSe.AddChild(AdicionarTag(TipoCampo.StrNumber, "", "Numero", 1, 15, Ocorrencia.Obrigatoria, nota.Cancelamento.Pedido.IdentificacaoNFSe.Numero));
            cancIdNfSe.AddChild(AdicionarTagCNPJCPF("", "Cpf", "Cnpj", nota.Prestador.CpfCnpj.ZeroFill(14)));
            cancIdNfSe.AddChild(AdicionarTag(TipoCampo.StrNumber, "", "InscricaoMunicipal", 1, 15, Ocorrencia.Obrigatoria, nota.Prestador.InscricaoMunicipal));
            cancIdNfSe.AddChild(AdicionarTag(TipoCampo.StrNumber, "", "CodigoMunicipio", 1, 7, Ocorrencia.Obrigatoria, nota.Prestador.Endereco.CodigoMunicipio));

            cancInfPedido.AddChild(AdicionarTag(TipoCampo.StrNumber, "", "CodigoCancelamento", 1, 4, Ocorrencia.Obrigatoria, nota.Cancelamento.Pedido.CodigoCancelamento));

            cancPedido.AddChild(WriteSignature(nota.Cancelamento.Pedido.Signature));

            cancConfirmacao.AddChild(AdicionarTag(TipoCampo.DatHor, "", "DataHora", 20, 20, Ocorrencia.Obrigatoria, nota.Cancelamento.DataHora));

            return(cancelamento);
        }
コード例 #27
0
        public static XObject[] SerializeChild(ICollection values, DFeCollectionAttribute tag, DFeItemAttribute[] itemTags, SerializerOptions options)
        {
            var arrayElement = new XElement(tag.Name);

            foreach (var value in values)
            {
                var itemTag = itemTags.SingleOrDefault(x => x.Tipo == value.GetType());
                Guard.Against <VipException>(itemTag == null, $"Item {value.GetType().Name} não presente na lista de itens.");

                XElement childElement;
                if (itemTag != null && itemTag.IsValue)
                {
                    var properties = value.GetType().GetProperties()
                                     .Where(x => !x.ShouldIgnoreProperty() && x.ShouldSerializeProperty(value))
                                     .OrderBy(x => x.GetAttribute <DFeBaseAttribute>()?.Ordem ?? 0).ToArray();

                    Guard.Against <VipException>(!properties.All(x => x.HasAttribute <DFeItemValueAttribute>() || x.HasAttribute <DFeAttributeAttribute>()),
                                                 $"Item {value.GetType().Name} é do tipo [ItemValue] e so pode ter atributo do tipo [DFeAttributeAttribute] ou [DFeItemValueAttribute].");

                    Guard.Against <VipException>(properties.Count(x => x.HasAttribute <DFeItemValueAttribute>()) != 1,
                                                 $"Item {value.GetType().Name} é do tipo [ItemValue] e não tem presente o atributo [DFeItemValueAttribute] ou possui mais de um atributo.");

                    var valueProp = properties.SingleOrDefault(x => x.HasAttribute <DFeItemValueAttribute>());
                    var valueAtt  = valueProp.GetAttribute <DFeItemValueAttribute>();

                    XNamespace aw = itemTag.Namespace ?? string.Empty;
                    childElement = new XElement(aw + itemTag.Name);

                    var childValue = valueProp.GetValueOrIndex(value);
                    var estaVazio  = childValue == null || childValue.ToString().IsNullOrEmpty();
                    childElement.Value = PrimitiveSerializer.ProcessValue(ref estaVazio, valueAtt.Tipo, valueProp,
                                                                          valueAtt.Ocorrencia, valueAtt.Min, valueProp, value);

                    foreach (var property in properties.Where(x => x.HasAttribute <DFeAttributeAttribute>()))
                    {
                        var attTag = property.GetAttribute <DFeAttributeAttribute>();
                        var att    = (XAttribute)PrimitiveSerializer.Serialize(attTag, value, property, options);
                        childElement.AddAttribute(att);
                    }
                }
                else
                {
                    childElement = ObjectSerializer.Serialize(value, value.GetType(), itemTag?.Name, itemTag?.Namespace, options);
                }

                arrayElement.AddChild(childElement);
            }

            return(new XObject[] { arrayElement });
        }
コード例 #28
0
 public static void AddChilds(this XElement element, params XObject[] childs)
 {
     foreach (var child in childs)
     {
         if (child is XElement childElement)
         {
             element.AddChild(childElement);
         }
         else
         {
             element.AddAttribute((XAttribute)child);
         }
     }
 }
コード例 #29
0
        public override XElement BuildMetaElement(IPublishedContent node, string culture)
        {
            var imageElement = new XElement(_xmlns + "image");

            imageElement.AddChild("loc", node.Url(mode: UrlMode.Absolute));

            var title = node.Value <string>(_config.Fields.Title);

            if (string.IsNullOrWhiteSpace(title) == false)
            {
                imageElement.AddChild("title", title);
            }

            var caption = node.Value <string>(_config.Fields.Caption);

            if (string.IsNullOrWhiteSpace(caption) == false)
            {
                imageElement.AddChild("caption", caption);
            }

            var geoLocation = node.Value <string>(_config.Fields.GeoLocation);

            if (string.IsNullOrWhiteSpace(geoLocation) == false)
            {
                imageElement.AddChild("geo_location", geoLocation);
            }

            var license = node.Value <string>(_config.Fields.License);

            if (string.IsNullOrWhiteSpace(license) == false)
            {
                imageElement.AddChild("license", license);
            }

            return(imageElement);
        }
コード例 #30
0
        protected override XElement WriteIntermediarioRps(NotaServico nota)
        {
            if (nota.Intermediario.CpfCnpj.IsEmpty())
            {
                return(null);
            }

            var intermediario    = new XElement("Intermediario");
            var ideIntermediario = new XElement("IdentificacaoIntermediario");

            intermediario.Add(ideIntermediario);

            var cpfCnpj = new XElement("CpfCnpj");

            ideIntermediario.Add(cpfCnpj);

            cpfCnpj.AddChild(AdicionarTagCNPJCPF("", "Cpf", "Cnpj", nota.Intermediario.CpfCnpj));

            ideIntermediario.AddChild(AdicionarTag(TipoCampo.Str, "", "InscricaoMunicipal", 1, 15, Ocorrencia.NaoObrigatoria, nota.Intermediario.InscricaoMunicipal));
            intermediario.AddChild(AdicionarTag(TipoCampo.Str, "", "RazaoSocial", 1, 115, Ocorrencia.NaoObrigatoria, nota.Intermediario.RazaoSocial));
            intermediario.AddChild(AdicionarTag(TipoCampo.Str, "", "CodigoMunicipio", 1, 115, Ocorrencia.NaoObrigatoria, nota.Intermediario.CodigoMunicipio));

            return(intermediario);
        }