public void ObterDanfe() { var c1 = ObterConfiguracao(); var cabecalho = new CabecalhoNFCe("Empresa DSBR BRasil", "32806205000155", "155731233", "10", "Rua Itacimirim loja 22", "São Paulo", "SP", "40620500"); var dest = new DestinatarioNFCe("", "", ""); var pagamento = new PagamentoNFCe(120, 120, 120, 0.5, new List <FormPagNFCe> { new FormPagNFCe("Dinheiro", 120), new FormPagNFCe("Cartão Crédito", 23.56) }); var produtos = new List <ProdutoNFCe>(); for (var i = 0; i < 11; i++) { produtos.Add(new ProdutoNFCe(i.ToString(), $"Produto {i}", "UND", i, i * 2, i * 3)); } var impostos = new ImpostosNFCe(5, 6, 7); var infAdc = new InfAdicNFCe("Informação"); var urlConsulta = c1.ConfigServ.UrlsNFce.Homologacao.QrcodeConsulta; var corpo = new CorpoNFCe(false, "00000", Status.Autorizada, produtos, true, pagamento, impostos, infAdc, "1", DateTime.Now, urlConsulta, "29190417784038000103650980000000011000000014", dest); var urlQrcode = "http://hnfe.sefaz.ba.gov.br/servicos/nfce/modulos/geral/NFCEC_consulta_chave_acesso.aspx?p=29190517784038000103650980000000011000000026|2|2|1|b72d0c7a8a2d5bd267287215216be079669162a7"; var rodape = new RodapeNFCe("5512006230010", urlQrcode, "Emissor Fiscal DSBR Brasil - www.dsbrbrasil.com.br"); IDanfeHtml d1 = new DanfeNFCeHtml(TipoPapelNFCe.Mm80, cabecalho, corpo, rodape); var doc = d1.ObterDocHtml(); Utils.EscreverArquivo("D:\\", "NFce", doc.Html); }
public DanfeNFCeHtml(TipoPapelNFCe tipoPapel, CabecalhoNFCe cabecalho, CorpoNFCe corpo, RodapeNFCe rodape) { TipoPapel = tipoPapel; Cabecalho = cabecalho; Corpo = corpo; Rodape = rodape; }
/// <summary> /// Montar cabeçalho da DANFE /// </summary> /// <param name="cabecalho"></param> /// <returns></returns> private string MontarCabecalho(CabecalhoNFCe cabecalho) { var list = new Dictionary <string, string>(); var ender = $"{cabecalho.Endereco},{cabecalho.Numero} - {cabecalho.Cidade}," + $" {Cabecalho.Estado} CEP: {cabecalho.Cep}"; list.Add("#cssDadosEmissor#", TipoPapel == TipoPapelNFCe.Mm80 ? "width: 78%; height:80px; float: left;" : "width: 100%; height:80px; float: left; font-align: center;"); list.Add("#CompanyName#", cabecalho.NomeFantasia ?? string.Empty); list.Add("#CNPJ#", Utils.FormatarCnpj(cabecalho.Cnpj)); list.Add("#IE#", cabecalho.Ie); list.Add("#Address#", ender); return(LerTemplateEsubstituirTags(TemplateDanfeNFCe.Header, list)); }