예제 #1
0
        public GeracaoCNABContaPagarViewModel GerarBoletosBancariosHtml(List <ContasAPagar> listaContaPagar, int usuarioId, GeracaoCNABContaPagarViewModel filtro)
        {
            var listaBoletoBancario = new List <BoletoBancario>();
            var listaBoletos        = new Boletos();

            var contaFinanceira = _contaFinanceiraServico.BuscarPorId(filtro.ContaFinanceira.Id);

            foreach (var item in listaContaPagar)
            {
                if ((item.FormaPagamento == FormaPagamento.Boleto || item.FormaPagamento == FormaPagamento.BoletoConcessionaria) && string.IsNullOrEmpty(item.CodigoDeBarras))
                {
                    throw new BusinessRuleException($"O Boleto de Id [" + item.Id + "], não possuí código de barras!");
                }

                var boleto         = ImprimirBoletoBancario(item, contaFinanceira);
                var boletoBancario = new BoletoBancario()
                {
                    CodigoBanco           = Convert.ToInt16(contaFinanceira.Banco.CodigoBanco),
                    Boleto                = boleto,
                    MostrarCodigoCarteira = true
                };

                boletoBancario.MostrarComprovanteEntrega = false;
                boletoBancario.FormatoCarne = true;
                boletoBancario.GeraImagemCodigoBarras(boleto);

                listaBoletos.Add(boleto);
                listaBoletoBancario.Add(boletoBancario);

                item.PossueCnab = true;
                _contaPagarServico.Workflow(item, new Usuario {
                    Id = usuarioId
                });
            }

            var objCedente = new Cedente(
                contaFinanceira.Cnpj,
                contaFinanceira.Descricao,
                contaFinanceira.Agencia,
                contaFinanceira.Conta,
                contaFinanceira.DigitoConta
                )
            {
                CodigoTransmissao = $"{contaFinanceira.Agencia}0{contaFinanceira.ConvenioPagamento.Truncate(7).PadLeft(7, '0')}0{contaFinanceira.Conta.Truncate(7).PadLeft(7, '0')}",
                Convenio          = Convert.ToInt64(contaFinanceira.ConvenioPagamento),
                ContaBancaria     = new ContaBancaria(contaFinanceira.Agencia, contaFinanceira.DigitoAgencia ?? string.Empty, contaFinanceira.Conta, contaFinanceira.DigitoConta),
                Nome = contaFinanceira.Empresa?.RazaoSocial
            };

            var aqvRemessa = new ArquivoRemessa(PagamentoNet.TipoArquivo.CNAB240);
            var banco      = new PagamentoNet.Banco(Convert.ToInt32(contaFinanceira.Banco.CodigoBanco));

            using (var mem = new MemoryStream())
            {
                if (listaBoletos.Any())
                {
                    aqvRemessa.GerarArquivoRemessa(contaFinanceira.ConvenioPagamento, banco, objCedente, listaBoletos, mem, Convert.ToInt32(contaFinanceira.CodigoTransmissao));
                }

                return(new GeracaoCNABContaPagarViewModel
                {
                    BoletosHtml = new List <string>(),
                    ArquivoRemessaMemoryStream = mem
                });
            }
        }
예제 #2
0
        public GeracaoCNABLancamentoCobrancaViewModel GerarBoletosBancariosHtml(List <LancamentoCobranca> lancamentos, DateTime?dtVencimento, TipoValor tipoValorJuros, decimal?juros, TipoValor tipoValorMulta, decimal?multa, TipoOcorrenciaCNAB tipoOcorrenciaCNAB)
        {
            var geracaoCnab = new GeracaoCNABLancamentoCobrancaViewModel();

            using (TransactionScope scope = new TransactionScope())
            {
                var listaBoletoBancario = new List <BoletoBancario>();
                var listaBoletos        = new Boletos();

                var contaFinanceiraLancamento = lancamentos?.FirstOrDefault()?.ContaFinanceira ?? new ContaFinanceira();

                var contaFinanceira = _contaFinanceiraServico.BuscarPorId(contaFinanceiraLancamento.Id);
                var listaParametroBoletoBancario = _parametroBoletoBancarioServico.Buscar()?.ToList() ?? new List <ParametroBoletoBancario>();

                foreach (var item in lancamentos)
                {
                    if (item.Cliente.Pessoa.Enderecos == null || !item.Cliente.Pessoa.Enderecos.Any())
                    {
                        throw new BusinessRuleException($"O cadastro de [{item.Cliente.Pessoa.Nome}], não possui Endereço. É necessário esta informação para prosseguir!");
                    }

                    var boleto = ImprimirBoletoBancario(item, contaFinanceira, dtVencimento, tipoValorJuros, juros, tipoValorMulta, multa, listaParametroBoletoBancario, tipoOcorrenciaCNAB);

                    var boletoBancario = new BoletoBancario()
                    {
                        CodigoBanco           = Convert.ToInt16(contaFinanceira.Banco.CodigoBanco),
                        Boleto                = boleto,
                        MostrarCodigoCarteira = true,
                        TextoAbaixoDoBoleto   = $"UNIDADE: {item.Unidade.Nome} - {item.Unidade?.Endereco?.Logradouro}" +
                                                $"<br/>REF: {(item.DataCompetencia == null ? item.DataVencimento.ToString("yyyyMM") : item.DataCompetencia.Value.ToString("yyyyMM"))}" +
                                                $"{(item.TipoServico == TipoServico.Mensalista ? $"<br/>CONTRATO: {item.NumerosContratos}" : string.Empty)}"
                    };

                    boletoBancario.Boleto.Valida();
                    boletoBancario.MostrarComprovanteEntrega = false;
                    boletoBancario.FormatoCarne = true;
                    boletoBancario.GeraImagemCodigoBarras(boleto);

                    listaBoletos.Add(boleto);
                    listaBoletoBancario.Add(boletoBancario);

                    item.PossueCnab = true;
                    item.StatusLancamentoCobranca = StatusLancamentoCobranca.EmAberto;
                }

                var objCedente = new Cedente(
                    contaFinanceira.Cpf,
                    contaFinanceira.Descricao,
                    contaFinanceira.Agencia,
                    contaFinanceira.Conta,
                    contaFinanceira.DigitoConta
                    )
                {
                    CodigoTransmissao = $"{contaFinanceira.Agencia}0{contaFinanceira.Convenio.Truncate(7).PadLeft(7, '0')}0{contaFinanceira.Conta.Truncate(7).PadLeft(7, '0')}",
                    Convenio          = Convert.ToInt64(contaFinanceira.Convenio),
                    ContaBancaria     = new ContaBancaria(contaFinanceira.Agencia, contaFinanceira.DigitoAgencia ?? string.Empty, contaFinanceira.Conta, contaFinanceira.DigitoConta),
                    Nome = contaFinanceira.Empresa?.RazaoSocial
                };


                var aqvRemessa = new ArquivoRemessa(BoletoNet.TipoArquivo.CNAB400);
                var banco      = new BoletoNet.Banco(Convert.ToInt32(contaFinanceira.Banco.CodigoBanco));

                using (var mem = new MemoryStream())
                {
                    if (listaBoletos.Any())
                    {
                        aqvRemessa.GerarArquivoRemessa(contaFinanceira.Convenio, banco, objCedente, listaBoletos, mem, Convert.ToInt32(contaFinanceira.CodigoTransmissao));
                    }

                    var pdfBytes = new BoletoBancario().MontaBytesListaBoletosPDF(listaBoletoBancario, "Boletos Gerados", null, "Boletos Gerados");

                    geracaoCnab = new GeracaoCNABLancamentoCobrancaViewModel
                    {
                        BoletosHtml = listaBoletoBancario?.Select(x => x.MontaHtmlEmbedded())?.ToList() ?? new List <string>(),
                        ArquivoRemessaMemoryStream = mem,
                        DadosPDF = pdfBytes
                    };
                }
            }

            _lancamentoCobrancaServico.UpdateDetalhesCNAB(lancamentos);

            return(geracaoCnab);
        }
예제 #3
0
        public void Gera_Boleto_PDF(DateTime dt1, DateTime dt2)
        {
            dt2 = dt2.AddDays(1);

            List <BOLETOS_CLIENTE> IDS_CLIENTE = new List <BOLETOS_CLIENTE>();

            var query = (from linha in ctx.TB_FINANCEIROs
                         where NUMEROS_FINANCEIRO.Contains(linha.NUMERO_FINANCEIRO)
                         select linha).ToList();

            foreach (var item in query.OrderBy(_ => _.CODIGO_CLIENTE))
            {
                if (!IDS_CLIENTE.Where(_ => _.ID_CLIENTE == item.CODIGO_CLIENTE).Any())
                {
                    if (item.TB_CLIENTE == null)
                    {
                        throw new Exception("T&iacute;tulo n&ordm; [" + item.NUMERO_FINANCEIRO.ToString() +
                                            "] est&aacute; sem cliente definido");
                    }

                    IDS_CLIENTE.Add(new BOLETOS_CLIENTE()
                    {
                        ID_CLIENTE            = item.CODIGO_CLIENTE.Value,
                        NOME_FANTASIA_CLIENTE = string.IsNullOrEmpty(item.TB_CLIENTE.NOMEFANTASIA_CLIENTE) ? "" : item.TB_CLIENTE.NOMEFANTASIA_CLIENTE.Trim(),
                        NOTAS_FISCAIS         = new List <string>(),
                        LINKS_BOLETO          = new List <string>(),
                        VENCIMENTOS           = new List <DateTime>()
                    });
                }

                string vencimento      = ApoioXML.TrataData2(item.DATA_VENCIMENTO);
                string valorBoleto     = item.VALOR_TOTAL.Value.ToString();
                string numeroDocumento = item.NUMERO_NF_SAIDA.ToString(); //"B20005446";

                item.NOSSO_NUMERO_BANCARIO = buscaNossoNumeroBancario();

                //cedente
                String cedente_codigo            = CONTA_CORRENTE.Replace("-", "");
                String cedente_nossoNumeroBoleto = item.NOSSO_NUMERO_BANCARIO.Trim();
                String cedente_cpfCnpj           = emitente.CNPJ_EMITENTE.Trim();
                String cedente_nome    = emitente.NOME_EMITENTE.Trim();
                String cedente_agencia = AGENCIA;
                String cedente_conta   = CONTA_CORRENTE.LastIndexOf("-") > -1 ? CONTA_CORRENTE.Substring(0, CONTA_CORRENTE.LastIndexOf("-")) :
                                         CONTA_CORRENTE;
                String cedente_digitoConta = CONTA_CORRENTE.LastIndexOf("-") > -1 ? CONTA_CORRENTE.Substring(CONTA_CORRENTE.LastIndexOf("-") + 1) :
                                             "";

                if (item.TB_CLIENTE == null)
                {
                    throw new Exception("O t&iacute;tulo de numero [" + item.NUMERO_FINANCEIRO.ToString() + "] est&aacute; sem cliente definido");
                }

                //sacado
                String sacado_cpfCnpj  = item.TB_CLIENTE.CNPJ_CLIENTE.Trim();
                String sacado_nome     = item.TB_CLIENTE.NOME_CLIENTE.Trim();
                String sacado_endereco = item.TB_CLIENTE.ENDERECO_FATURA.Trim();
                String sacado_bairro   = item.TB_CLIENTE.BAIRRO_FATURA.Trim();
                String sacado_cidade   = item.TB_CLIENTE.TB_MUNICIPIO.NOME_MUNICIPIO.Trim();
                String sacado_cep      = item.TB_CLIENTE.CEP_FATURA.Trim();
                String sacado_uf       = item.TB_CLIENTE.TB_MUNICIPIO.TB_UF.SIGLA_UF;

                Cedente cedente = new Cedente(cedente_cpfCnpj,
                                              cedente_nome,
                                              cedente_agencia,
                                              cedente_conta,
                                              cedente_digitoConta);

                cedente.Codigo = Convert.ToInt32(cedente_codigo);
                //cedente.Nome = emitente.NOME_EMITENTE.Trim();
                //cedente.CPFCNPJ = emitente.CNPJ_EMITENTE.Trim();

                //cedente.Endereco = new Endereco();

                //cedente.Endereco.End = string.Concat(emitente.ENDERECO_EMITENTE.Trim(), " ",
                //     emitente.NUMERO_END_EMITENTE.Trim(), " ",
                //     string.IsNullOrEmpty(emitente.COMPLEMENTO_END_EMITENTE) ? "" : emitente.COMPLEMENTO_END_EMITENTE.Trim()).Trim();

                //cedente.Endereco.Bairro = emitente.BAIRRO_EMITENTE.Trim();
                //cedente.Endereco.CEP = emitente.CEP_EMITENTE.Trim();
                //cedente.Endereco.Cidade = emitente.TB_MUNICIPIO.NOME_MUNICIPIO.Trim();
                //cedente.Endereco.UF = emitente.TB_MUNICIPIO.TB_UF.SIGLA_UF;

                Boleto boleto = new Boleto(item.DATA_VENCIMENTO.Value,
                                           item.VALOR_TOTAL.Value,
                                           CARTEIRA,
                                           cedente_nossoNumeroBoleto,
                                           cedente);

                boleto.NumeroDocumento = numeroDocumento;

                Sacado sacado = new Sacado(sacado_cpfCnpj, sacado_nome);
                boleto.Sacado = sacado;
                boleto.Sacado.Endereco.End    = sacado_endereco;
                boleto.Sacado.Endereco.Bairro = sacado_bairro;
                boleto.Sacado.Endereco.Cidade = sacado_cidade;
                boleto.Sacado.Endereco.CEP    = sacado_cep;
                boleto.Sacado.Endereco.UF     = sacado_uf;

                Instrucao_Itau instrucao = new Instrucao_Itau();
                instrucao.Descricao = "APOS O VENCIMENTO COBRAR MULTA DE R$ 2,00";

                boleto.Instrucoes.Add(instrucao);
                EspecieDocumento_Itau especie = new EspecieDocumento_Itau("1");
                boleto.EspecieDocumento  = especie;
                boleto.DataProcessamento = DateTime.Today;
                boleto.DataDocumento     = DateTime.Today;
                boleto.ValorBoleto       = item.VALOR_TOTAL.Value;
                boleto.NumeroDocumento   = item.NUMERO_NF_SAIDA.ToString().PadLeft(10, '0');

                BoletoBancario boleto_bancario = new BoletoBancario();
                boleto_bancario.CodigoBanco           = (short)NUMERO_BANCO;
                boleto_bancario.Boleto                = boleto;
                boleto_bancario.MostrarCodigoCarteira = true;

                // AG. 0189
                // CC 47562-7
                // WILLIAM DA SILVA CARDOZO
                // CPF 286.248.538-18

                boleto_bancario.Boleto.Valida();

                boleto_bancario.MostrarComprovanteEntrega = true;

                Image codigoBarras = boleto_bancario.GeraImagemCodigoBarras(boleto);

                codigoBarras.Save(Path.Combine(ConfigurationManager.AppSettings["PASTA_BOLETO_ITAU"],
                                               "codigoBarras" + item.NUMERO_FINANCEIRO.ToString() + ".jpg"), System.Drawing.Imaging.ImageFormat.Jpeg);

                string url = string.Concat(ApoioXML.urlBase(), "/Boletos/Itau/");

                string arquivo_Boleto = Path.Combine(ConfigurationManager.AppSettings["PASTA_BOLETO_ITAU"],
                                                     "boleto_" + item.NUMERO_FINANCEIRO.ToString() + ".htm");

                string htmlBoleto = boleto_bancario.MontaHtml(arquivo_Boleto);
                htmlBoleto = htmlBoleto.Replace(ConfigurationManager.AppSettings["PASTA_BOLETO_ITAU"], "");

                string htmlCodigoBarras = htmlBoleto.Substring(htmlBoleto.IndexOf(@"<td class=""EcdBar Al pL10"">"));
                htmlCodigoBarras = htmlCodigoBarras.Substring(0, htmlCodigoBarras.IndexOf("</td>"));
                htmlCodigoBarras = htmlCodigoBarras.Substring(htmlCodigoBarras.IndexOf("<img src=") + 1);
                htmlCodigoBarras = htmlCodigoBarras.Substring(0, htmlCodigoBarras.LastIndexOf(" ") - 1);

                htmlBoleto = htmlBoleto.Replace(htmlCodigoBarras,
                                                string.Concat(@"img src=""", Path.Combine(ApoioXML.urlBase() + "/Boletos/Itau/",
                                                                                          "codigoBarras" + item.NUMERO_FINANCEIRO.ToString() + ".jpg"), @""" alt='Código de Barras'"));

                using (TextWriter tw = new StreamWriter(arquivo_Boleto, false, Encoding.UTF8))
                {
                    tw.Write(htmlBoleto);
                    tw.Close();
                }

                IDS_CLIENTE[IDS_CLIENTE.Count - 1].NOTAS_FISCAIS.Add(item.NUMERO_NF_SAIDA.Value.ToString());
                IDS_CLIENTE[IDS_CLIENTE.Count - 1].LINKS_BOLETO.Add(url + "boleto_" + item.NUMERO_FINANCEIRO.ToString() + ".htm");
                IDS_CLIENTE[IDS_CLIENTE.Count - 1].VENCIMENTOS.Add(item.DATA_VENCIMENTO.Value);
            }

            ctx.SubmitChanges();

            for (int i = 0; i < IDS_CLIENTE.Count(); i++)
            {
                using (Doran_ERP_Servicos_Email.PopMail mail = new Doran_ERP_Servicos_Email.PopMail(ID_USUARIO, ID_CONTA_EMAIL))
                {
                    string FROM_ADDRESS = (from linha in ctx.TB_EMAIL_CONTAs
                                           where linha.ID_CONTA_EMAIL == ID_CONTA_EMAIL
                                           select linha.CONTA_EMAIL).First().Trim();

                    var NOME_CONTATO = from linha in ctx.TB_CLIENTE_CONTATOs
                                       where linha.ID_CLIENTE == IDS_CLIENTE[i].ID_CLIENTE
                                       select linha.NOME_CONTATO_CLIENTE;

                    var EMAIL_CLIENTE = from linha in ctx.TB_CLIENTE_CONTATOs
                                        where linha.ID_CLIENTE == IDS_CLIENTE[i].ID_CLIENTE
                                        select linha.EMAIL_CONTATO_CLIENTE;

                    var ASSINATURA = (from linha in ctx.TB_EMAIL_CONTAs
                                      where linha.ID_CONTA_EMAIL == ID_CONTA_EMAIL
                                      select linha.ASSINATURA).First().Trim();

                    if (!NOME_CONTATO.Any())
                    {
                        throw new Exception("N&atilde;o h&aacute; contato cadastrado para este cliente");
                    }

                    Dictionary <string, object> dados = new Dictionary <string, object>();

                    dados.Add("ID_MESSAGE", 0);
                    dados.Add("ID_CONTA_EMAIL", ID_CONTA_EMAIL);
                    dados.Add("FROM_ADDRESS", FROM_ADDRESS);
                    dados.Add("PRIORITY", 1);
                    dados.Add("SUBJECT", string.Concat("Boleto de cobrança - ", emitente.NOME_FANTASIA_EMITENTE.Trim()));

                    string mensagem = string.Concat(DateTime.Now.Hour >= 0 && DateTime.Now.Hour < 12 ?
                                                    "<span style='font-family: tahoma; font-size: 9pt;'>Bom dia " :
                                                    DateTime.Now.Hour >= 12 && DateTime.Now.Hour < 19 ?
                                                    "<span style='font-family: tahoma; font-size: 9pt;'>Boa tarde " :
                                                    "<span style='font-family: tahoma; font-size: 9pt;'>Boa noite ", NOME_CONTATO.First().Trim(), "<br /><br />",
                                                    "Segue abaixo o(s) link(s) para voc&ecirc; acessar os boletos de cobrança referente a(s) nota(s) fiscal(is) ",
                                                    "<b>[", string.Join(", ", IDS_CLIENTE[i].NOTAS_FISCAIS.ToArray()), "]</b><br /><br />");

                    for (int n = 0; n < IDS_CLIENTE[i].LINKS_BOLETO.Count; n++)
                    {
                        mensagem += string.Concat("<a href='", IDS_CLIENTE[i].LINKS_BOLETO[n], "' target='_blank'>Boleto com vencimento para ",
                                                  ApoioXML.TrataData2(IDS_CLIENTE[i].VENCIMENTOS[n]), "</a><br />");
                    }

                    using (Doran_Relatorio_Entregas_do_Cliente ec = new classes.Doran_Relatorio_Entregas_do_Cliente(IDS_CLIENTE[i].NOME_FANTASIA_CLIENTE, dt1, dt2, ID_EMPRESA))
                    {
                        relatorio_De_Servicos_Do_Cliente = ec.MontaRelatorio();
                    }

                    mensagem += "<br /><br />Segue tamb&eacute;m, o relat&oacute;rio dos seus servi&ccedil;os referente a esta cobran&ccedil;a<br /><br />";

                    mensagem += "<a href='" + relatorio_De_Servicos_Do_Cliente + "'>Relat&oacute;rio dos servi&ccedil;os</a><br />";

                    mensagem += "<br />Obrigado, <br /></span>" + ASSINATURA;

                    dados.Add("BODY", mensagem);
                    dados.Add("RAW_BODY", mensagem);
                    dados.Add("NUMERO_CRM", 0);

                    List <string> TOs = new List <string>();
                    TOs.Add(EMAIL_CLIENTE.First().Trim());

                    List <string> CCs         = new List <string>();
                    List <string> BCCs        = new List <string>();
                    List <string> Attachments = new List <string>();

                    mail.Salva_Mensagem_como_Rascunho(dados, TOs, CCs, BCCs, Attachments);
                }
            }
        }
예제 #4
0
        public string BoletoImprimir() // List<BoletoBancario> boletos
        {
            var boletos = new List <BoletoBancario>();

            var vencimento = new DateTime(2016, 07, 16);

            var cedente = new Cedente("00.000.000/0000-00", "Empresa Teste", "0131", "7", "00045110", "X")
            {
                Codigo   = "1220950",
                Convenio = 1234567
            };

            var boleto = new Boleto(vencimento, Convert.ToDecimal(1.99), "17", "10028528", cedente);

            boleto.Sacado = new Sacado("000.000.000-00", "Nome do cliente ");
            boleto.Sacado.Endereco.End    = "Endereco do cliente";
            boleto.Sacado.Endereco.Bairro = "Bairro do cliente";
            boleto.Sacado.Endereco.Cidade = "Cidade do cliente";
            boleto.Sacado.Endereco.CEP    = "00000000";
            boleto.Sacado.Endereco.UF     = "UF";

            // instrucoes do boleto
            Instrucao_Caixa item;

            item = new Instrucao_Caixa((int)10, Convert.ToDecimal(0.40));
            boleto.Instrucoes.Add(item);

            // documento
            boleto.NumeroDocumento = "10028528"; // nosso número

            EspecieDocumento_BancoBrasil espDocBB = new EspecieDocumento_BancoBrasil();

            boleto.EspecieDocumento = new EspecieDocumento_BancoBrasil(
                espDocBB.getCodigoEspecieByEnum(EnumEspecieDocumento_BancoBrasil.Outros));

            boleto.DataProcessamento = DateTime.Now;
            boleto.DataDocumento     = DateTime.Now;

            var boletoBancario = new BoletoBancario();

            boletoBancario.CodigoBanco = 1;
            //boletoBancario.CodigoBanco = 104; // CEF
            //boletoBancario.CodigoBanco = 33; // SANTANDER
            boletoBancario.Boleto = boleto;

            boletoBancario.GeraImagemCodigoBarras(boleto);

            boletoBancario.MostrarComprovanteEntrega = true;

            boletoBancario.Boleto.Valida();

            boletos.Add(boletoBancario);

            var _arquivo = string.Empty;
            var html     = new StringBuilder();

            _arquivo = "C:/Users/correa/Documents/text.html";


            foreach (var o in boletos)
            {
                html.Append(o.MontaHtmlEmbedded());
                html.Append("</br></br></br></br></br></br></br></br>");
            }

            using (var f = new FileStream(_arquivo, FileMode.Create))
            {
                StreamWriter w = new StreamWriter(f, System.Text.Encoding.UTF8);
                //w.Write(html.ToString());
                w.Write(html.ToString());
            }

            html = html
                   //.Replace(Request.ServerVariables["APPL_PHYSICAL_PATH"], "\\") // convertendo o caminho absoluto para relativo
                   //.Replace(System.IO.Path.GetTempPath(), Url.Action("Temporario", "Faturas") + "/?filename=") // convertendo o caminho temporário em relativo
                   //.Replace(".w666{width:666px}", ".w666{width:21cm}")
                   //.Replace("<body>", "<body style=\"height:29cm\">")
                   //.Replace("</html>", "<a length=\"0\" href=\"/Faturas/PrintBoleto?Fatura=subsFatura\" >Exportar PDF</a></html>")
                   .Replace("</html>", "<a length=\"0\" href=\"#\" onclick=\"window.print();\">Imprimir</a></html>")
                   //.Replace("subsFatura", Fatura.Replace("/", "%2F"))
                   //.Replace("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">", "")
                   //.Replace("Imprimir em impressora jato de tinta (ink jet) ou laser em qualidade normal. (Não use modo econômico).<br>Utilize folha A4 (210 x 297 mm) ou Carta (216 x 279 mm) - Corte na linha indicada<br>","")
                   //.Replace("&nbsp;","")
            ;

            //var pg = MvcHtmlString.Create(html.ToString());
            return(html.ToString());
            //return pg.ToHtmlString();
        }