From 07e23e319e72ccc92f967a8409d2fe728f5ba847 Mon Sep 17 00:00:00 2001 From: Valnei Batista Santos Filho Date: Thu, 20 Oct 2022 23:11:15 -0300 Subject: [PATCH] Implementacao de documento NFSe nativo em Html --- .../Class1.cs | 8 + .../Danfe/DanfeInfo.cs | 22 + .../Danfe/DanfeNFSeHtml.cs | 165 +++++ .../Danfe/Documento.cs | 14 + ...OpenAC.Net.NFSe.DANFSe.ReportNative.csproj | 29 + .../Properties/Resources.Designer.cs | 87 +++ .../Properties/Resources.resx | 124 ++++ .../Resources/nfse-template.html | 620 ++++++++++++++++++ .../Utils.cs | 69 ++ .../OpenAC.Net.NFSe.Test.csproj | 5 + src/OpenAC.Net.NFSe.Test/ReportTest.cs | 127 ++++ src/OpenAC.Net.NFSe.sln | 8 +- 12 files changed, 1277 insertions(+), 1 deletion(-) create mode 100644 src/OpenAC.Net.NFSe.DANFSe.ReportNative/Class1.cs create mode 100644 src/OpenAC.Net.NFSe.DANFSe.ReportNative/Danfe/DanfeInfo.cs create mode 100644 src/OpenAC.Net.NFSe.DANFSe.ReportNative/Danfe/DanfeNFSeHtml.cs create mode 100644 src/OpenAC.Net.NFSe.DANFSe.ReportNative/Danfe/Documento.cs create mode 100644 src/OpenAC.Net.NFSe.DANFSe.ReportNative/OpenAC.Net.NFSe.DANFSe.ReportNative.csproj create mode 100644 src/OpenAC.Net.NFSe.DANFSe.ReportNative/Properties/Resources.Designer.cs create mode 100644 src/OpenAC.Net.NFSe.DANFSe.ReportNative/Properties/Resources.resx create mode 100644 src/OpenAC.Net.NFSe.DANFSe.ReportNative/Resources/nfse-template.html create mode 100644 src/OpenAC.Net.NFSe.DANFSe.ReportNative/Utils.cs create mode 100644 src/OpenAC.Net.NFSe.Test/ReportTest.cs diff --git a/src/OpenAC.Net.NFSe.DANFSe.ReportNative/Class1.cs b/src/OpenAC.Net.NFSe.DANFSe.ReportNative/Class1.cs new file mode 100644 index 00000000..c0a15c19 --- /dev/null +++ b/src/OpenAC.Net.NFSe.DANFSe.ReportNative/Class1.cs @@ -0,0 +1,8 @@ +using System; + +namespace OpenAC.Net.NFSe.DANFSe.ReportNative +{ + public class Class1 + { + } +} diff --git a/src/OpenAC.Net.NFSe.DANFSe.ReportNative/Danfe/DanfeInfo.cs b/src/OpenAC.Net.NFSe.DANFSe.ReportNative/Danfe/DanfeInfo.cs new file mode 100644 index 00000000..86078f33 --- /dev/null +++ b/src/OpenAC.Net.NFSe.DANFSe.ReportNative/Danfe/DanfeInfo.cs @@ -0,0 +1,22 @@ +using OpenAC.Net.NFSe.Nota; + +namespace OpenAC.Net.NFSe.DANFSe.ReportNative.Danfe +{ + public class DanfeInfo + { + /// + /// Titulo do documento + /// + public string Titulo { get; set; } + /// + /// Nome da prefeitura + /// + public string NomePrefeitura { get; set; } + /// + /// Link da imagem da prefeitura + /// + public string LinkImagemLogo { get; set; } + + public NotaServico NotaServico { get; set; } + } +} diff --git a/src/OpenAC.Net.NFSe.DANFSe.ReportNative/Danfe/DanfeNFSeHtml.cs b/src/OpenAC.Net.NFSe.DANFSe.ReportNative/Danfe/DanfeNFSeHtml.cs new file mode 100644 index 00000000..1d7832db --- /dev/null +++ b/src/OpenAC.Net.NFSe.DANFSe.ReportNative/Danfe/DanfeNFSeHtml.cs @@ -0,0 +1,165 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text.RegularExpressions; +using OpenAC.Net.NFSe.DANFSe.ReportNative.Properties; + +namespace OpenAC.Net.NFSe.DANFSe.ReportNative.Danfe +{ + public sealed class DanfeNFSeHtml + { + private readonly DanfeInfo _danfeInfo; + + public DanfeNFSeHtml(DanfeInfo danfeInfo) + { + _danfeInfo = danfeInfo; + } + + /// + /// Obter DANFE NFSe em formato html + /// + /// + public Documento ObterDocHtml() + { + var html = Montar(); + return new Documento { Html = html }; + } + + /// + /// Salvar DANFE NFSe em formato html + /// + /// + /// + public void SalvarDocHtml(string caminho,string nomeArquivo) + { + var conteudo = ObterDocHtml(); + Utils.EscreverArquivo(caminho, nomeArquivo, conteudo.Html); + } + + /// + /// Montar cabeçalho da DANFE + /// + /// + private string Montar() + { + var list = new Dictionary(); + var nfse = _danfeInfo.NotaServico; + var nomePrefeitura = _danfeInfo.NomePrefeitura; + var titulo = _danfeInfo.Titulo; + var linkImg = _danfeInfo.LinkImagemLogo; + + #region Cabecalho + + list.Add("#ds_image", linkImg); + list.Add("#ds_title1#", nomePrefeitura); + list.Add("#ds_title2#", titulo); + list.Add("#nl_invoice#", nfse.IdentificacaoNFSe.Numero ); + list.Add("#dt_invoice_issue#", nfse.IdentificacaoNFSe.DataEmissao.ToString("G")); + list.Add("#ds_protocol#", nfse.IdentificacaoNFSe.Chave); + + #endregion + + #region Prestador + + + list.Add("#nl_company_cnpj_cpf#", nfse.Prestador.CpfCnpj); + list.Add("#ds_company_issuer_name#", nfse.Prestador.NomeFantasia); + list.Add("#ds_company_address#", nfse.Prestador.Endereco.Logradouro); + list.Add("#ds_company_neighborhood#", nfse.Prestador.Endereco.Complemento); + list.Add("#nu_company_cep#", nfse.Prestador.Endereco.Cep); + list.Add("#ds_company_city_name#", nfse.Prestador.Endereco.Municipio); + list.Add("#ds_company_im#", nfse.Prestador.InscricaoMunicipal); + list.Add("#ds_company_uf#", nfse.Prestador.Endereco.Uf); + + #endregion + + #region Tomador + + list.Add("#nl_client_cnpj_cpf#", nfse.Tomador.CpfCnpj); + list.Add("#ds_client_receiver_name#", nfse.Tomador.NomeFantasia); + list.Add("#ds_client_address#", nfse.Tomador.Endereco.Logradouro); + list.Add("#ds_client_neighborhood#", nfse.Tomador.Endereco.Complemento); + list.Add("#nu_client_cep#", nfse.Tomador.Endereco.Cep); + list.Add("#ds_client_city_name#", nfse.Tomador.Endereco.Municipio); + list.Add("#ds_client_uf#", nfse.Tomador.Endereco.Uf); + list.Add("#nl_client_im#", nfse.Tomador.InscricaoMunicipal); + list.Add("#ds_client_email#", nfse.Tomador.DadosContato.Email); + + #endregion + + + #region Descricao Servicos + + var descricao = nfse.Servico.Descricao; + var discriminacao = nfse.Servico.Discriminacao; + var descricao2 = $"{descricao}
{discriminacao}"; + list.Add("#services#", descricao2); + + + #endregion + + #region Valor Total + + list.Add("#orderTotal#", nfse.Servico.Valores.ValorServicos.ToString()); + + + #endregion + + #region Impostos + + list.Add("#cofins#", nfse.Servico.Valores.ValorCofins.ToString()); + list.Add("#csll#", nfse.Servico.Valores.ValorCsll.ToString()); + list.Add("#inss#", nfse.Servico.Valores.ValorInss.ToString()); + list.Add("#irpj#", nfse.Servico.Valores.ValorIr.ToString()); + list.Add("#pis#", nfse.Servico.Valores.ValorPis.ToString()); + list.Add("#totaldeducoes#", nfse.Servico.Valores.ValorDeducoes.ToString()); + list.Add("#basecalculo#", nfse.Servico.Valores.BaseCalculo.ToString()); + list.Add("#vl_issqn_aliq#", nfse.Servico.Valores.Aliquota.ToString()); + list.Add("#vl_issqn#", nfse.Servico.Valores.ValorIss.ToString()); + list.Add("#iisqnretido#", nfse.Servico.Valores.ValorIssRetido.ToString()); + list.Add("#serviceCode#", nfse.Servico.CodigoCnae.ToString()); + list.Add("#orderTotallIq#", nfse.Servico.Valores.ValorLiquidoNfse.ToString()); + list.Add("#outrasretencoes#", nfse.Servico.Valores.ValorOutrasRetencoes.ToString()); + + + + #endregion + + + #region Outras Informacoes + + list.Add("#ds_additional_information#", nfse.OutrasInformacoes); + + #endregion + + + return LerTemplateEsubstituirTags(Resources.nfse_template, list); + } + + /// + /// Substituir chave pelo valor + /// + /// + /// + /// + private string Substituir(string html, Dictionary replacesList) + { + foreach (var replaces in replacesList) + html = Regex.Replace(html, replaces.Key, replaces.Value ?? string.Empty, RegexOptions.IgnoreCase, new TimeSpan(0, 0, 5)); + return html; + } + + /// + /// Realizar a leitura de arquivo e substitui tags + /// + /// + /// + /// + private string LerTemplateEsubstituirTags(string nomeTemplate, Dictionary dictionaryReplace) + { + if (dictionaryReplace == null) return string.Empty; + return !dictionaryReplace.Any() ? string.Empty : Substituir(nomeTemplate, dictionaryReplace); + } + + } +} diff --git a/src/OpenAC.Net.NFSe.DANFSe.ReportNative/Danfe/Documento.cs b/src/OpenAC.Net.NFSe.DANFSe.ReportNative/Danfe/Documento.cs new file mode 100644 index 00000000..15baf3a4 --- /dev/null +++ b/src/OpenAC.Net.NFSe.DANFSe.ReportNative/Danfe/Documento.cs @@ -0,0 +1,14 @@ +namespace OpenAC.Net.NFSe.DANFSe.ReportNative.Danfe +{ + public sealed class Documento + { + #region Propriedades + + /// + /// Uma string Html contendo dados da DANFE + /// + public string Html { get; set; } + + #endregion + } +} diff --git a/src/OpenAC.Net.NFSe.DANFSe.ReportNative/OpenAC.Net.NFSe.DANFSe.ReportNative.csproj b/src/OpenAC.Net.NFSe.DANFSe.ReportNative/OpenAC.Net.NFSe.DANFSe.ReportNative.csproj new file mode 100644 index 00000000..a23b531e --- /dev/null +++ b/src/OpenAC.Net.NFSe.DANFSe.ReportNative/OpenAC.Net.NFSe.DANFSe.ReportNative.csproj @@ -0,0 +1,29 @@ + + + + netstandard2.0 + DSBR Brasil Team + Copyright © Projeto OpenAC .Net 2014 - 2022 + DSBR Brasil + + + + + + + + + True + True + Resources.resx + + + + + + ResXFileCodeGenerator + Resources.Designer.cs + + + + diff --git a/src/OpenAC.Net.NFSe.DANFSe.ReportNative/Properties/Resources.Designer.cs b/src/OpenAC.Net.NFSe.DANFSe.ReportNative/Properties/Resources.Designer.cs new file mode 100644 index 00000000..f5eec24c --- /dev/null +++ b/src/OpenAC.Net.NFSe.DANFSe.ReportNative/Properties/Resources.Designer.cs @@ -0,0 +1,87 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace OpenAC.Net.NFSe.DANFSe.ReportNative.Properties { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("OpenAC.Net.NFSe.DANFSe.ReportNative.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// + /// Looks up a localized string similar to + ///<html class="no-js" lang="pt-BR"> + ///<head> + /// <title></title> + /// <meta name="description" content=""> + /// <meta name="author" content=""> + /// <meta name="viewport" content="width=device-width,initial-scale=1"> + /// <meta http-equiv="X-UA-Compatible" content="IE=edge, chrome=1"> + /// <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> + /// <meta http-equiv="no-cache"> + /// + /// <style type="text/css" media="print"> + /// html, + /// body, + /// * { + /// margin: 0px!import [rest of string was truncated]";. + /// + internal static string nfse_template { + get { + return ResourceManager.GetString("nfse_template", resourceCulture); + } + } + } +} diff --git a/src/OpenAC.Net.NFSe.DANFSe.ReportNative/Properties/Resources.resx b/src/OpenAC.Net.NFSe.DANFSe.ReportNative/Properties/Resources.resx new file mode 100644 index 00000000..3bf6b398 --- /dev/null +++ b/src/OpenAC.Net.NFSe.DANFSe.ReportNative/Properties/Resources.resx @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + ..\Resources\nfse-template.html;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 + + \ No newline at end of file diff --git a/src/OpenAC.Net.NFSe.DANFSe.ReportNative/Resources/nfse-template.html b/src/OpenAC.Net.NFSe.DANFSe.ReportNative/Resources/nfse-template.html new file mode 100644 index 00000000..43e1576b --- /dev/null +++ b/src/OpenAC.Net.NFSe.DANFSe.ReportNative/Resources/nfse-template.html @@ -0,0 +1,620 @@ + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + +
+ + +

+ #ds_title1# +

+ +
 
+ +
+

#ds_title2#

+
+
+
Número da Nota
+
#nl_invoice#
+
+
+
+
Data e Hora de Emissão
+
#dt_invoice_issue#
+
+
+
+
Código de Verificação
+
#ds_protocol#
+
+
+ + + + + + + + +
+ PRESTADOR DE SERVIÇOS +
+ CNPJ/CPF: #nl_company_cnpj_cpf# +
+ Nome/Razão Social: #ds_company_issuer_name# +
+ Endereço: #ds_company_address#, + #ds_company_neighborhood# + CEP: #nu_company_cep# +
+ Município: #ds_company_city_name# +
+ Inscrição Municipal: #ds_company_im# +
+
+
+ UF: #ds_company_uf# +
+ +
+ + + + + + + + +
+ TOMADOR DE SERVIÇO +
+ Nome/Razão Social: #ds_client_receiver_name# +
+ CNPJ/CPF: #nl_client_cnpj_cpf# +
+ Endereço: #ds_client_address# + #ds_client_neighborhood# + CEP: #nu_client_cep# +
+ + Município: #ds_client_city_name#    + UF: #ds_client_uf# +
+ Inscrição Municipal: #nl_client_im# +
+
+
+ E-Mail: #ds_client_email# +
+
+ + + + + + + +
+ DISCRIMINAÇÃO DOS SERVIÇOS +
+ #services# +
+
+ VALOR TOTAL DA NOTA FISCAL = R$ #orderTotal# +
+ + + + + + + + +
+
+
COFINS (R$)
+
#cofins#
+
+
+
+
CSLL (R$)
+
#csll#
+
+
+
+
INSS (R$)
+
#inss#
+
+
+
+
IRPJ (R$)
+
#irpj#
+
+
+
+
PIS (R$)
+
#pis#
+
+
+
+ Código de Atividade: #serviceCode# +
+ + + + + + + + + +
+
+
Valor Total das Deduções (R$)
+
#totaldeducoes#
+
+
+
+
Base de Cálculo (R$)
+
#basecalculo#
+
+
+
+
Alíquota (%)
+
#vl_issqn_aliq#
+
+
+
+
Valor do ISS (R$)
+
#vl_issqn#
+
+
+
+
IISQN Retido (R$)
+
#iisqnretido#
+
+ +
+
+
Outras Retenções (R$)
+
#outrasretencoes#
+
+ +
+
+ VALOR LIQUIDO DA NOTA FISCAL = R$ #orderTotallIq# +
+ + + + + + + +
+ OUTRAS INFORMAÇÕES +
+ #ds_additional_information# +
+
+ + + + + + + +
+
+ + + \ No newline at end of file diff --git a/src/OpenAC.Net.NFSe.DANFSe.ReportNative/Utils.cs b/src/OpenAC.Net.NFSe.DANFSe.ReportNative/Utils.cs new file mode 100644 index 00000000..caf2feb2 --- /dev/null +++ b/src/OpenAC.Net.NFSe.DANFSe.ReportNative/Utils.cs @@ -0,0 +1,69 @@ +using System; +using System.IO; +using System.Text; + +namespace OpenAC.Net.NFSe.DANFSe.ReportNative +{ + internal static class Utils + { + + + /// + /// Escrever arquivo em modo stream, assincronamente + /// + /// Caminho do arquivo + /// Nome do arquivo + /// Conteudo + public static void EscreverArquivo(string caminho, string nomeArquivo, string conteudo) + { + if (caminho == null) + throw new ArgumentNullException(nameof(caminho), "O caminho do arquivo deve ser informado"); + if (nomeArquivo == null) + throw new ArgumentNullException(nameof(nomeArquivo), "O nome do arquivo deve ser informado"); + if (conteudo == null) + throw new ArgumentNullException(nameof(conteudo), "O conteúdo do arquivo deve ser informado"); + CriarPastaSeNaoExistir(caminho); + var encodedText = Encoding.UTF8.GetBytes(conteudo); + var c1 = Path.Combine(caminho, nomeArquivo); // Combina caminho do arquivo como nome do arquivo + using (var sourceStream = new FileStream(c1, FileMode.Append, FileAccess.Write, FileShare.None, 4096, true)) + { + sourceStream.Write(encodedText, 0, encodedText.Length); + sourceStream.Close(); + } + } + + /// + /// Criar pasta no caminho indicador + /// + /// caminho do arquivo + public static bool CriarPasta(string caminho) + { + // Tentar criar diretorio + Directory.CreateDirectory(caminho); + return true; + } + + /// + /// Criar pasta se não existir + /// + /// Caminho do arquivo + /// + public static void CriarPastaSeNaoExistir(string caminho) + { + if (!ExisteDiretorio(caminho)) CriarPasta(caminho); + } + + /// + /// Verificar se o diretorio existe + /// + /// caminho do arquivo + /// + public static bool ExisteDiretorio(string caminho) + { + // Determinar se o diretorio existe + if (Directory.Exists(caminho)) + return true; + return false; + } + } +} diff --git a/src/OpenAC.Net.NFSe.Test/OpenAC.Net.NFSe.Test.csproj b/src/OpenAC.Net.NFSe.Test/OpenAC.Net.NFSe.Test.csproj index 2117919e..ad9bf543 100644 --- a/src/OpenAC.Net.NFSe.Test/OpenAC.Net.NFSe.Test.csproj +++ b/src/OpenAC.Net.NFSe.Test/OpenAC.Net.NFSe.Test.csproj @@ -50,6 +50,7 @@ + @@ -62,6 +63,10 @@ + + {47066847-7FF1-47DD-8DDE-9BA8E47666FF} + OpenAC.Net.NFSe.DANFSe.ReportNative + {0ef298ca-a045-47e2-91ad-5c211e793c3b} ACBr.Net.NFSe diff --git a/src/OpenAC.Net.NFSe.Test/ReportTest.cs b/src/OpenAC.Net.NFSe.Test/ReportTest.cs new file mode 100644 index 00000000..57f9d95b --- /dev/null +++ b/src/OpenAC.Net.NFSe.Test/ReportTest.cs @@ -0,0 +1,127 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using OpenAC.Net.NFSe.DANFSe.ReportNative.Danfe; +using OpenAC.Net.NFSe.Nota; +using OpenAC.Net.NFSe.Test; +using Xunit; + +namespace OpenAC.Net.NFSe.Test +{ + public class ReportTest + { + [Fact] + public void GerarDanfeNFseEmFormatoHtml() + { + var openNFSe = SetupOpenNFSe.Abrasf; + + //adicionado rps + var nota = openNFSe.NotasServico.AddNew(); + + nota.RegimeEspecialTributacao = RegimeEspecialTributacao.SimplesNacional; + nota.NaturezaOperacao = NaturezaOperacao.ABRASF.TributacaoNoMunicipio; + nota.Situacao = SituacaoNFSeRps.Normal; + nota.IncentivadorCultural = NFSeSimNao.Nao; + + nota.Servico.Valores.Aliquota = 5; + nota.Servico.CodigoTributacaoMunicipio = "802"; + nota.Servico.ItemListaServico = "14.01"; + nota.Servico.Valores.ValorServicos = 29.91M; + nota.Servico.Valores.BaseCalculo = 29.91M; + nota.Servico.Valores.ValorIss = 1.49m; + nota.Servico.Descricao = @" + OGGI + Manutencao em marcha shimano acero + Lavagem completa + lubrificacao de conduites + Reparo suspensao completa + tyuntlgbyuuvytbgti + 002 + AAAAAAAAAAAAAAAA + Valor Total: 843,98 + OGGI + Manutencao em marcha shimano acero + Lavagem completa + lubrificacao de conduites + Reparo suspensao completa + tyuntlgbyuuvytbgti + 002 + AAAAAAAAAAAAAAAA + Valor Total: 843,98 + OGGI + Manutencao em marcha shimano acero + Lavagem completa + lubrificacao de conduites + Reparo suspensao completa + tyuntlgbyuuvytbgti + 002 + AAAAAAAAAAAAAAAA + Valor Total: 843,98 + OGGI + Manutencao em marcha shimano acero + Lavagem completa + lubrificacao de conduites + Reparo suspensao completa + tyuntlgbyuuvytbgti + 002 + AAAAAAAAAAAAAAAA + Valor Total: 843,98 + + "; + nota.Servico.Discriminacao = "Reparo de Bike"; + nota.Servico.CodigoCnae = "4763603"; + nota.Servico.Valores.ValorLiquidoNfse = 329.91M; + + nota.Tomador.Tipo = TipoTomador.Sigiss.PessoaFisica; + nota.Tomador.CpfCnpj = "94782024568"; + nota.Tomador.RazaoSocial = "Carlos"; + nota.Tomador.Endereco.Logradouro = "Rua principal"; + nota.Tomador.Endereco.Numero = "2"; + nota.Tomador.Endereco.Bairro = "Centro"; + nota.Tomador.Endereco.CodigoMunicipio = 2919207; + nota.Tomador.Endereco.Uf = "BA"; + nota.Tomador.Endereco.Cep = "40210245"; + nota.Tomador.DadosContato.Email = "a@a.com"; + + nota.IdentificacaoRps.Tipo = TipoRps.RPS; + nota.IdentificacaoRps.Numero = "3"; + nota.IdentificacaoRps.Serie = "A"; + nota.IdentificacaoNFSe.DataEmissao = DateTime.Now; + + nota.Prestador.CpfCnpj = "44818198000190"; + nota.Prestador.InscricaoMunicipal = "0010040441011"; + nota.Prestador.CpfCnpj = "44818198000190"; + nota.Prestador.NomeFantasia = "Nome Fantasia"; + + var danfeInfo = new DanfeInfo(); + danfeInfo.Titulo = "Recibo Provisório de Serviço - RPS"; + danfeInfo.NomePrefeitura = "Prefeitura de Lauro de Freitas"; + danfeInfo.NotaServico = nota; + + var doc = new DanfeNFSeHtml(danfeInfo); + doc.SalvarDocHtml("C:\\", "NFSe.htm"); + + } + + + /* + Dica para usar em sistemas Web + - Usar o componente encontrado no endereco: https://printjs.crabbly.com/ + - Recomendacao de uso em sistema web + //=========================================================================== + // Exibir modal para impressao de Danfe 55 + //=========================================================================== + function imprimirStringHtmlDanfeNFSeA4(strHtml, afterRefresh = false) { + const body = obterConteudoBody(strHtml); + const body2 = `${body}`; + const style = `.titulo { font-size:1.4em; } .tabela { border: 2px solid #000; border-spacing: 0px; margin: 0px 0px 0px 0px; white-space:nowrap; } .tabela tr td { border: 1px solid #000; } .tabela table tr td { border-style: none; border-width: 0px; } .cabecalho { line-height: normal; font-style: normal; font-weight: normal; font-variant: normal; font-size: 13px; font-family: 'Courier New'; margin: 0px 0px 0px 2px; line-height: 9px; } .tabela dl { border: 0px none #000; border-spacing: 0px; margin: 0px 0px 0px 0px; } .tabela dt { margin: 0px 5px; text-transform: uppercase; font: 13px 'Courier New'; color: #000; white-space: nowrap; } .tabela dd { margin: 0px 5px 1px; color: #369; line-height: normal; font-style: normal; font-variant: normal; font-size: 13px; font-family: "Courier New"; height: 14px; white-space: nowrap; } .sub-titulo { line-height: normal; font-style: normal; font-weight: bold; font-variant: normal; font-size: 13px; font-family: "Courier New"; margin: 0px 0px 0px 0px; white-space: pre-line; } .corpo { color: #369; line-height: normal; font-style: normal; font-weight: bold; font-variant: normal; font-size: 13px; font-family: "Courier New"; margin: 0px 0px 0px 0px; white-space: nowrap; letter-spacing: -1px; } .campo_titulo { white-space: break-spaces; line-height: normal; font-style: normal; font-weight: bold; font-variant: normal; font-size: 15px; font-family: 'Courier New'; margin: 0px 0px 0px 0px; white-space: nowrap; word-spacing: -1px; } .campo_valor { color: #369; line-height: normal; font-style: normal; font-weight: bold; font-variant: normal; font-size: 14px; font-family: "Courier New"; margin: 0px 0px 0px 0px; white-space: pre-line; display: inline-block; max-width: 780px; } ` + printJS({ style: style, printable: body2, type: 'raw-html' }); + + } + + */ + + } +} diff --git a/src/OpenAC.Net.NFSe.sln b/src/OpenAC.Net.NFSe.sln index 443d487e..2c3b69ac 100644 --- a/src/OpenAC.Net.NFSe.sln +++ b/src/OpenAC.Net.NFSe.sln @@ -7,12 +7,14 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenAC.Net.NFSe", "OpenAC.N EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenAC.Net.NFSe.Test", "OpenAC.Net.NFSe.Test\OpenAC.Net.NFSe.Test.csproj", "{CB70B488-3A8C-4119-A4F0-FFE467DBC7BA}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenAC.Net.NFSe.Demo", "OpenAC.Net.NFSe.Demo\OpenAC.Net.NFSe.Demo.csproj", "{507A1588-D006-445C-B729-3F1D3A5CE803}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenAC.Net.NFSe.Demo", "OpenAC.Net.NFSe.Demo\OpenAC.Net.NFSe.Demo.csproj", "{507A1588-D006-445C-B729-3F1D3A5CE803}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenAC.Net.NFSe.DANFSe.FastReport", "OpenAC.Net.NFSe.DANFSe.FastReport\OpenAC.Net.NFSe.DANFSe.FastReport.csproj", "{BA9DBAB3-31F1-4D98-AD4D-CD73CF0B6921}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenAC.Net.NFSe.DANFSe.FastReport.OpenSource", "OpenAC.Net.NFSe.DANFSe.FastReport.OpenSource\OpenAC.Net.NFSe.DANFSe.FastReport.OpenSource.csproj", "{F16DBEED-46EB-46B1-8264-711EDFADC099}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenAC.Net.NFSe.DANFSe.ReportNative", "OpenAC.Net.NFSe.DANFSe.ReportNative\OpenAC.Net.NFSe.DANFSe.ReportNative.csproj", "{47066847-7FF1-47DD-8DDE-9BA8E47666FF}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -39,6 +41,10 @@ Global {F16DBEED-46EB-46B1-8264-711EDFADC099}.Debug|Any CPU.Build.0 = Debug|Any CPU {F16DBEED-46EB-46B1-8264-711EDFADC099}.Release|Any CPU.ActiveCfg = Release|Any CPU {F16DBEED-46EB-46B1-8264-711EDFADC099}.Release|Any CPU.Build.0 = Release|Any CPU + {47066847-7FF1-47DD-8DDE-9BA8E47666FF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {47066847-7FF1-47DD-8DDE-9BA8E47666FF}.Debug|Any CPU.Build.0 = Debug|Any CPU + {47066847-7FF1-47DD-8DDE-9BA8E47666FF}.Release|Any CPU.ActiveCfg = Release|Any CPU + {47066847-7FF1-47DD-8DDE-9BA8E47666FF}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE