From 7e7769749446f7f5e760dda7e94931456bfa9d03 Mon Sep 17 00:00:00 2001 From: adriano_g3 Date: Mon, 10 Aug 2026 12:04:50 -0300 Subject: [PATCH] =?UTF-8?q?Corre=C3=A7=C3=A3o=20na=20Visualiza=C3=A7=C3=A3?= =?UTF-8?q?o=20do=20Logo=20da=20Danfe=20Simplificada=20do=20Tipo=202?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- NFe.Danfe.AppTeste.Fast/MainWindow.xaml.cs | 16 +- NFe.Danfe.Base/NFe/NFeSimplificadoTipo2.frx | 1239 ++++++++++--------- Shared.NFe.Danfe/DanfeSharedHelper.cs | 2 +- 3 files changed, 631 insertions(+), 626 deletions(-) diff --git a/NFe.Danfe.AppTeste.Fast/MainWindow.xaml.cs b/NFe.Danfe.AppTeste.Fast/MainWindow.xaml.cs index 0c255607..0686c83f 100644 --- a/NFe.Danfe.AppTeste.Fast/MainWindow.xaml.cs +++ b/NFe.Danfe.AppTeste.Fast/MainWindow.xaml.cs @@ -160,9 +160,9 @@ private void BtnNfeDanfeA4_Click(object sender, RoutedEventArgs e) desenvolvedor: "NOME DA SOFTWARE HOUSE", arquivoRelatorio: string.Empty); - //danfe.Visualizar(); + danfe.Visualizar(); //danfe.Imprimir(); - danfe.ExibirDesign(); + //danfe.ExibirDesign(); //danfe.ExportarPdf(@"d:\teste.pdf"); #endregion Abre a visualização do relatório para impressão @@ -312,9 +312,9 @@ private void BtnNFeSimplificado_Click(object sender, RoutedEventArgs e) desenvolvedor: "NOME DA SOFTWARE HOUSE", arquivoRelatorio: string.Empty); - //danfe.Visualizar(); + danfe.Visualizar(); //danfe.Imprimir(); - danfe.ExibirDesign(); + //danfe.ExibirDesign(); //danfe.ExportarPdf(@"d:\teste.pdf"); #endregion Abre a visualização do relatório para impressão @@ -381,14 +381,14 @@ private void BtnNFeSimplificadoTipo2_Click(object sender, RoutedEventArgs e) ImprimirUnidQtdeValor = _configuracoes.ConfiguracaoDanfeNfe.ImprimirUnidQtdeValor, ExibirTotalTributos = _configuracoes.ConfiguracaoDanfeNfe.ExibirTotalTributos }, - "", - "", + _configuracoes.CIdToken, + _configuracoes.Csc, desenvolvedor: "NOME DA SOFTWARE HOUSE", arquivoRelatorio: string.Empty); - //danfe.Visualizar(); + danfe.Visualizar(); //danfe.Imprimir(); - danfe.ExibirDesign(); + //danfe.ExibirDesign(); //danfe.ExportarPdf(@"d:\teste.pdf"); #endregion Abre a visualização do relatório para impressão diff --git a/NFe.Danfe.Base/NFe/NFeSimplificadoTipo2.frx b/NFe.Danfe.Base/NFe/NFeSimplificadoTipo2.frx index 18da3f48..09d644b9 100644 --- a/NFe.Danfe.Base/NFe/NFeSimplificadoTipo2.frx +++ b/NFe.Danfe.Base/NFe/NFeSimplificadoTipo2.frx @@ -1,512 +1,517 @@  - - - using System; - using System.Collections; - using System.Collections.Generic; - using System.ComponentModel; - using System.Windows.Forms; - using System.Drawing; - using System.Data; - using FastReport; - using FastReport.Data; - using FastReport.Dialog; - using FastReport.Barcode; - using FastReport.Table; - using FastReport.Utils; - using NFe.Classes.Informacoes.Pagamento; - using NFe.Utils; - using DFe.Utils; - using NFe.Classes.Informacoes.Destinatario; - using NFe.Classes.Informacoes.Identificacao.Tipos; - using DFe.Classes.Flags; - using NFe.Danfe.Base; - using DFe.Classes.Entidades; - using NFe.Classes.Protocolo; + + using System; +using System.IO; +using System.Collections; +using System.Collections.Generic; +using System.ComponentModel; +using System.Windows.Forms; +using System.Drawing; +using System.Data; +using System.Text.RegularExpressions; +using FastReport; +using FastReport.Data; +using FastReport.Dialog; +using FastReport.Barcode; +using FastReport.Table; +using FastReport.Utils; +using NFe.Classes.Informacoes.Pagamento; +using NFe.Utils; +using DFe.Utils; +using NFe.Classes.Informacoes.Destinatario; +using NFe.Classes.Informacoes.Identificacao.Tipos; +using DFe.Classes.Flags; +using NFe.Danfe.Base; +using DFe.Classes.Entidades; +using NFe.Classes.Protocolo; - namespace FastReport - { - public class ReportScript - { - - private void txtDescPagto_BeforePrint(object sender, EventArgs e) - { - if(Report.GetColumnValue("NFe.NFe.infNFe.pag.tPag") != null) - txtDescPagto.Text = ((FormaPagamento)Report.GetColumnValue("NFe.NFe.infNFe.pag.tPag")).Descricao(); - } - - private void txtDescDetPagto_BeforePrint(object sender, EventArgs e) - { - if(Report.GetDataSource("NFe.NFe.infNFe.pag.detPag").RowCount != 0 && Report.GetColumnValue("NFe.NFe.infNFe.pag.detPag.tPag") != null) - txtDescDetPagto.Text = ((FormaPagamento)Report.GetColumnValue("NFe.NFe.infNFe.pag.detPag.tPag")).Descricao(); - - double tamanho1 = (4.2 / 2.54) * 96; - double tamanho2 = (1.2 / 2.54) * 96; - double tamanho3 = (3.2 / 2.54) * 96; - double tamanho4 = (0.2 / 2.54) * 96; - if(txtDescDetPagto.Text == "Outros") - { - txtDescDetPagto.Width = (float)tamanho2; - txtDescDetMeioPagto.Left = (float)tamanho2; - txtDescDetMeioPagto.Width = (float)tamanho3; - } - else - { - txtDescDetPagto.Width = (float)tamanho1; - txtDescDetMeioPagto.Left = (float)tamanho1; - txtDescDetMeioPagto.Width = (float)tamanho4; - } - } - - private void txtEmitCnpj_BeforePrint(object sender, EventArgs e) - { - var cnpj = (string)Report.GetColumnValue("NFe.NFe.infNFe.emit.CNPJ"); - if (!string.IsNullOrEmpty(cnpj)) - txtEmitCnpj.Text = "CNPJ: " + String.Format(@"{0:00\.000\.000\/0000\-00}", long.Parse(cnpj)); - /* - var ie = (string)Report.GetColumnValue("NFe.NFe.infNFe.emit.IE"); - if (!string.IsNullOrEmpty(ie)) - txtEmitCnpj.Text = txtEmitCnpj.Text + " - IE: " + ie; - */ - } - - private void memChaveNfe_BeforePrint(object sender, EventArgs e) - { - var chave = Substring( ((String)Report.GetColumnValue("NFe.NFe.infNFe.Id")), 3); - if (!string.IsNullOrEmpty(chave) & chave.Length == 44) - { - var chaveFormatada = ""; - for (int i = 0; i < chave.Length; i += 4) - chaveFormatada = chaveFormatada + chave.Substring(i, 4) + " "; - memChaveNfe.Text = chaveFormatada; - } - } - - private void Destinatario_BeforePrint(object sender, EventArgs e) - { - TrataCamposDestinatario(); - dbDestinatario.Visible = ((NfeSimplificadoTipo2LayoutQrCode) Report.GetParameterValue("NfeSimplificadoTipo2LayoutQrCode") == NfeSimplificadoTipo2LayoutQrCode.Abaixo); - } - - private void TrataCamposDestinatario(){ - if ( ((dest)Report.GetColumnValue("NFe.NFe.infNFe.dest")) == null ) //Destinatário não informado - { - txtConsumidor.Text = "CONSUMIDOR NÃO IDENTIFICADO"; - txtConsumidor2.Text = txtConsumidor.Text; - txtDestEndereco.Text = ""; - txtDestEndereco2.Text = txtDestEndereco.Text; - txtDestNome.Text = ""; - txtDestNome2.Text = txtDestNome.Text; - } - else - { - txtDestNome.Text = ObterDocumentoDest() + ((String)Report.GetColumnValue("NFe.NFe.infNFe.dest.xNome")); - txtDestNome2.Text = txtDestNome.Text; - } - //Endereço do destinatário é opcional para NFe - txtDestEndereco.Visible = ((enderDest)Report.GetColumnValue("NFe.NFe.infNFe.dest.enderDest")) != null; - txtDestEndereco2.Visible = txtDestEndereco.Visible; - } - - private string ObterDocumentoDest(){ - var documentoDest = ""; - var cnpj = (String)Report.GetColumnValue("NFe.NFe.infNFe.dest.CNPJ"); - var cpf = (String)Report.GetColumnValue("NFe.NFe.infNFe.dest.CPF"); - var idEstrangeiro = (String)Report.GetColumnValue("NFe.NFe.infNFe.dest.idEstrangeiro"); - if ( !String.IsNullOrEmpty(cnpj)) documentoDest = "CNPJ: " + String.Format(@"{0:00\.000\.000\/0000\-00}", long.Parse(cnpj)) + " "; - if ( !String.IsNullOrEmpty(cpf)) documentoDest = "CPF: " + String.Format(@"{0:000\.000\.000\-00}", long.Parse(cpf)) + " "; - if ( !String.IsNullOrEmpty(idEstrangeiro)) documentoDest = "Id. Estrangeiro: " + idEstrangeiro + " "; - return documentoDest; - } - - private void dbProdutosUmaLinha_BeforePrint(object sender, EventArgs e) - { - //Conforme Manual de Padrões Padrões Técnicos do DANFE-NFC-e e QR Code, página 8. "No caso de emissão em contingência, é obrigatória a impressão do Detalhe da Venda e do DANFE NFC-e" - if ( ((TipoEmissao)Report.GetColumnValue("NFe.NFe.infNFe.ide.tpEmis")) == TipoEmissao.teNormal ) - dbProdutosUmaLinha.Visible = ((NfeSimplificadoTipo2DetalheVendaNormal)((Int32)Report.GetParameterValue("NfeSimplificadoTipo2DetalheVendaNormal"))) == NfeSimplificadoTipo2DetalheVendaNormal.UmaLinha; - else - dbProdutosUmaLinha.Visible = ((NfeSimplificadoTipo2DetalheVendaContigencia)((Int32)Report.GetParameterValue("NfeSimplificadoTipo2DetalheVendaContigencia"))) == NfeSimplificadoTipo2DetalheVendaContigencia.UmaLinha; - - //Mostrar/Ocultar desconto concedido no item - txtProdutoUmaLinhaValorUnit.Text = "[NFe.NFe.infNFe.det.prod.vUnCom]"; - txtProdutoUmaLinhaValorTotal.Text = "[NFe.NFe.infNFe.det.prod.vProd]"; - dbProdutosUmaLinha.Border.Lines = BorderLines.None; //BorderLines.Bottom; - var imprimeDesconto = dbProdutosUmaLinha.Visible & ((Boolean)Report.GetParameterValue("NfeSimplificadoTipo2ImprimeDescontoItem")) & - ((Nullable<Decimal>)Report.GetColumnValue("NFe.NFe.infNFe.det.prod.vDesc")) > 0; - cbDescontoItemUmaLinha.Visible = imprimeDesconto; - if (imprimeDesconto) - dbProdutosUmaLinha.Border.Lines = BorderLines.None; - } - - private void ghbProdutosDuasLinhas_BeforePrint(object sender, EventArgs e) - { - //Conforme Manual de Padrões Padrões Técnicos do DANFE-NFC-e e QR Code, página 8. "No caso de emissão em contingência, é obrigatória a impressão do Detalhe da Venda e do DANFE NFC-e" - if ( ((TipoEmissao)Report.GetColumnValue("NFe.NFe.infNFe.ide.tpEmis")) == TipoEmissao.teNormal ) - ghbProdutosDuasLinhas.Visible = ((NfeSimplificadoTipo2DetalheVendaNormal)((Int32)Report.GetParameterValue("NfeSimplificadoTipo2DetalheVendaNormal"))) == NfeSimplificadoTipo2DetalheVendaNormal.DuasLinhas; - else - ghbProdutosDuasLinhas.Visible = ((NfeSimplificadoTipo2DetalheVendaContigencia)((Int32)Report.GetParameterValue("NfeSimplificadoTipo2DetalheVendaContigencia"))) == NfeSimplificadoTipo2DetalheVendaContigencia.DuasLinhas; - } - - private void dbProdutosDuasLinhas_BeforePrint(object sender, EventArgs e) - { - //Conforme Manual de Padrões Padrões Técnicos do DANFE-NFC-e e QR Code, página 8. "No caso de emissão em contingência, é obrigatória a impressão do Detalhe da Venda e do DANFE NFC-e" - if ( ((TipoEmissao)Report.GetColumnValue("NFe.NFe.infNFe.ide.tpEmis")) == TipoEmissao.teNormal ) - dbProdutosDuasLinhas.Visible = ((NfeSimplificadoTipo2DetalheVendaNormal)((Int32)Report.GetParameterValue("NfeSimplificadoTipo2DetalheVendaNormal"))) == NfeSimplificadoTipo2DetalheVendaNormal.DuasLinhas; - else - dbProdutosDuasLinhas.Visible = ((NfeSimplificadoTipo2DetalheVendaContigencia)((Int32)Report.GetParameterValue("NfeSimplificadoTipo2DetalheVendaContigencia"))) == NfeSimplificadoTipo2DetalheVendaContigencia.DuasLinhas; - - //Mostrar/Ocultar desconto concedido no item - txtProdutoDuasLinhasValorUnit.Text = "[NFe.NFe.infNFe.det.prod.vUnCom]"; - txtProdutoDuasLinhasValorTotal.Text = "[NFe.NFe.infNFe.det.prod.vProd]"; - dbProdutosDuasLinhas.Border.Lines = BorderLines.Bottom; - var imprimeDesconto = dbProdutosDuasLinhas.Visible & ((Boolean)Report.GetParameterValue("NfeSimplificadoTipo2ImprimeDescontoItem")) & - ((Nullable<Decimal>)Report.GetColumnValue("NFe.NFe.infNFe.det.prod.vDesc")) > 0; - cbDescontoItemDuasLinhas.Visible = imprimeDesconto; - if (imprimeDesconto) - dbProdutosDuasLinhas.Border.Lines = BorderLines.None; - //Se possuir desconto, e estiver configurado para não exibi-lo, exibe os valores líquidos nos campos abaixo: - if (((Nullable<Decimal>)Report.GetColumnValue("NFe.NFe.infNFe.det.prod.vDesc")) > 0 & !imprimeDesconto) - { - txtProdutoDuasLinhasValorUnit.Text = "[([NFe.NFe.infNFe.det.prod.vProd] - [NFe.NFe.infNFe.det.prod.vDesc]) / [NFe.NFe.infNFe.det.prod.qCom]]"; - txtProdutoDuasLinhasValorTotal.Text = "[[NFe.NFe.infNFe.det.prod.vProd] - [NFe.NFe.infNFe.det.prod.vDesc]]"; - } - } - - private void ghbProdutosUmaLinha_BeforePrint(object sender, EventArgs e) - { - //Conforme Manual de Padrões Padrões Técnicos do DANFE-NFC-e e QR Code, página 8. "No caso de emissão em contingência, é obrigatória a impressão do Detalhe da Venda e do DANFE NFC-e" - if ( ((TipoEmissao)Report.GetColumnValue("NFe.NFe.infNFe.ide.tpEmis")) == TipoEmissao.teNormal ) - ghbProdutosUmaLinha.Visible = ((NfeSimplificadoTipo2DetalheVendaNormal)((Int32)Report.GetParameterValue("NfeSimplificadoTipo2DetalheVendaNormal"))) == NfeSimplificadoTipo2DetalheVendaNormal.UmaLinha; - else - ghbProdutosUmaLinha.Visible = ((NfeSimplificadoTipo2DetalheVendaContigencia)((Int32)Report.GetParameterValue("NfeSimplificadoTipo2DetalheVendaContigencia"))) == NfeSimplificadoTipo2DetalheVendaContigencia.UmaLinha; - } - - //private void rtbTitulo_BeforePrint(object sender, EventArgs e) - //{ - // rtbTitulo.Visible = (poEmitLogo.Image != null); - //} - - private void memMsgFiscal_BeforePrint(object sender, EventArgs e) - { - //Conforme Manual de Padrões Padrões Técnicos do DANFE-NFC-e e QR Code, página 8 - string msgHomologacao = ""; - string msgContigencia = ""; - if ( ((TipoAmbiente)Report.GetColumnValue("NFe.NFe.infNFe.ide.tpAmb")) == TipoAmbiente.Homologacao ) - msgHomologacao = "EMITIDA EM AMBIENTE DE HOMOLOGAÇÃO – SEM VALOR FISCAL" + Environment.NewLine; - if ( ((TipoEmissao)Report.GetColumnValue("NFe.NFe.infNFe.ide.tpEmis")) != TipoEmissao.teNormal ) - msgContigencia = "EMITIDA EM CONTINGÊNCIA" + Environment.NewLine; - - memMsgFiscal.Text = msgHomologacao + msgContigencia + memMsgFiscal.Text; - } - - private void txtObs_BeforePrint(object sender, EventArgs e) - { - txtObs.Text = ((String)Report.GetColumnValue("NFe.NFe.infNFe.infAdic.infCpl")).Replace(";", Environment.NewLine); - } - - private void PgNfeSimplificadoTipo2_StartPage(object sender, EventArgs e) - { - phbCancelado.Visible = ((Boolean)Report.GetParameterValue("NfeSimplificadoTipo2Cancelado")); - - if (!Engine.FinalPass) - return; - if ( (NfeSimplificadoTipo2ModoImpressao) ((Int32)Report.GetParameterValue("NfeSimplificadoTipo2ModoImpressao")) != NfeSimplificadoTipo2ModoImpressao.UnicaPagina) - return; - - PgNfeSimplificadoTipo2.PaperHeight = - (//rtbTituloHeight + - phbEmitenteHeight + - ((Boolean)Report.GetParameterValue("NfeSimplificadoTipo2Cancelado") ? phbCancelado.Height : 0)+ - ghbProdutosUmaLinhaHeight + - dbProdutosUmaLinhaHeight + - ghbProdutosDuasLinhasHeight + - dbProdutosDuasLinhasHeight + - gfbProdutosHeight + - dbPagamentoHeight + - dbDetPagamentoHeight + - dbTributosHeight + - dbObservacaoHeight + - dbInfoFiscalHeight + - dbNumeroSerieDhHeight + - dbConsultaHeight + - dbDestinatarioHeight + - dbQrCodeNormalHeight + - dbQrCodeLateralHeight + - dbProtocoloHeigth - ) / - Units.Millimeters + PgNfeSimplificadoTipo2.TopMargin + PgNfeSimplificadoTipo2.BottomMargin; - - } - - float dbProdutosUmaLinhaHeight; - private void dbProdutosUmaLinha_AfterPrint(object sender, EventArgs e) - { - dbProdutosUmaLinhaHeight += (dbProdutosUmaLinha.Visible ? dbProdutosUmaLinha.Height : 0) + (cbDescontoItemUmaLinha.Visible ? cbDescontoItemUmaLinha.Height : 0); - } - - float dbProdutosDuasLinhasHeight; - private void dbProdutosDuasLinhas_AfterPrint(object sender, EventArgs e) - { - dbProdutosDuasLinhasHeight += (dbProdutosDuasLinhas.Visible ?dbProdutosDuasLinhas.Height : 0) + (cbDescontoItemDuasLinhas.Visible ? cbDescontoItemDuasLinhas.Height : 0); - } - - float dbInfoFiscalHeight; - private void dbInfoFiscal_AfterPrint(object sender, EventArgs e) - { - dbInfoFiscalHeight = (dbInfoFiscal.Visible ? dbInfoFiscal.Height : 0); - } - - float dbNumeroSerieDhHeight; - private void dbNumeroSerieDh_AfterPrint(object sender, EventArgs e) - { - dbNumeroSerieDhHeight = (dbNumeroSerieDh.Visible ? dbNumeroSerieDh.Height : 0); - } - - float dbConsultaHeight; - private void dbConsulta_AfterPrint(object sender, EventArgs e) - { - dbConsultaHeight = (dbConsulta.Visible ? dbConsulta.Height : 0); - } - - //float rtbTituloHeight; - //private void rtbTitulo_AfterPrint(object sender, EventArgs e) - //{ - // rtbTituloHeight = (rtbTitulo.Visible ? rtbTitulo.Height : 0); - //} - - float phbEmitenteHeight; - private void phbEmitente_AfterPrint(object sender, EventArgs e) - { - phbEmitenteHeight = (phbEmitente.Visible ? phbEmitente.Height : 0); - } - - float ghbProdutosUmaLinhaHeight; - private void ghbProdutosUmaLinha_AfterPrint(object sender, EventArgs e) - { - ghbProdutosUmaLinhaHeight = (ghbProdutosUmaLinha.Visible ? ghbProdutosUmaLinha.Height : 0); - } - - float ghbProdutosDuasLinhasHeight; - private void ghbProdutosDuasLinhas_AfterPrint(object sender, EventArgs e) - { - ghbProdutosDuasLinhasHeight = (ghbProdutosDuasLinhas.Visible ? ghbProdutosDuasLinhas.Height : 0); - } - - float gfbProdutosHeight; - private void gfbProdutos_AfterPrint(object sender, EventArgs e) - { - gfbProdutosHeight = (gfbProdutos.Visible ? gfbProdutos.Height : 0); - } - - float dbPagamentoHeight; - private void dbPagamento_AfterPrint(object sender, EventArgs e) - { - dbPagamentoHeight = (dbPagamento.Visible ? dbPagamento.Height : 0); - } - - float dbDetPagamentoHeight; - private void dbDetPagamento_AfterPrint(object sender, EventArgs e) - { - dbDetPagamentoHeight = (dbDetPagamento.Visible ? dbDetPagamento.Height : 0); - } - - float dbTributosHeight; - private void dbTributos_AfterPrint(object sender, EventArgs e) - { - dbTributosHeight = (dbTributos.Visible ? dbTributos.Height : 0); - } - - float dbObservacaoHeight; - private void dbObservacao_AfterPrint(object sender, EventArgs e) - { - dbObservacaoHeight = (dbObservacao.Visible ? dbObservacao.Height : 0); - } - - float dbDestinatarioHeight; - private void dbDestinatario_AfterPrint(object sender, EventArgs e) - { - dbDestinatarioHeight = (dbDestinatario.Visible ? dbDestinatario.Height : 0); - } - - float dbQrCodeNormalHeight; - private void dbQrCode_AfterPrint(object sender, EventArgs e) - { - dbQrCodeNormalHeight = (dbQrCodeNormal.Visible ? dbQrCodeNormal.Height : 0); - } - - private void cbDesconto_BeforePrint(object sender, EventArgs e) - { - cbDesconto.Visible = (((Decimal)Report.GetColumnValue("NFe.NFe.infNFe.total.ICMSTot.vDesc")) > 0) || - (((Decimal)Report.GetColumnValue("NFe.NFe.infNFe.total.ICMSTot.vFrete")) > 0) || - (((Decimal)Report.GetColumnValue("NFe.NFe.infNFe.total.IBSCBSTot.gCBS.vCBS")) > 0) || - (((Decimal)Report.GetColumnValue("NFe.NFe.infNFe.total.IBSCBSTot.gIBS.vIBS")) > 0) || - (((Decimal)Report.GetColumnValue("NFe.NFe.infNFe.total.ISTot.vIS")) > 0); - - float vTop = 0; - if (((Decimal)Report.GetColumnValue("NFe.NFe.infNFe.total.ICMSTot.vDesc")) == 0) - { - Text43.Visible = false; - Text44.Visible = false; - } - else - vTop = vTop + Text44.Height; - - if (((Decimal)Report.GetColumnValue("NFe.NFe.infNFe.total.ICMSTot.vFrete")) == 0) - { - Text52.Visible = false; - Text54.Visible = false; - } - else - vTop = vTop + Text54.Height; - - if (Report.GetColumnValue("NFe.NFe.infNFe.total.IBSCBSTot.gCBS.vCBS") != null) - { - Text53.Top = vTop; - Text55.Top = vTop; - vTop = vTop + Text53.Height; - } - if (Report.GetColumnValue("NFe.NFe.infNFe.total.IBSCBSTot.gIBS.vIBS") != null) - { - Text57.Top = vTop; - Text58.Top = vTop; - vTop = vTop + Text58.Height; - } - if (((Nullable<Decimal>)Report.GetColumnValue("NFe.NFe.infNFe.total.ISTot.vIS") ?? 0m) > 0) - { - Text59.Top = vTop; - Text60.Top = vTop; - vTop = vTop + Text60.Height; - } - else - { - Text59.Visible = false; - Text60.Visible = false; - } - Text45.Top = vTop; - Text46.Top = vTop; - cbDesconto.Height = vTop + Text46.Height; - } - - private void txtTotal_BeforePrint(object sender, EventArgs e) - { - var vServ = ((Nullable<Decimal>)Report.GetColumnValue("NFe.NFe.infNFe.total.ISSQNtot.vServ")) == null ? 0 : ((Nullable<Decimal>)Report.GetColumnValue("NFe.NFe.infNFe.total.ISSQNtot.vServ")); - txtTotal.Text = (((Decimal)Report.GetColumnValue("NFe.NFe.infNFe.total.ICMSTot.vProd")) + vServ).ToString(); - } - - private void dbPagamento_BeforePrint(object sender, EventArgs e) - { - dbPagamento.Visible = Report.GetColumnValue("NFe.NFe.infNFe.pag.tPag") != null; - } - - private void dbDetPagamento_BeforePrint(object sender, EventArgs e) - { - dbDetPagamento.Visible = Report.GetDataSource("NFe.NFe.infNFe.pag.detPag").RowCount != 0 && Report.GetColumnValue("NFe.NFe.infNFe.pag.detPag.tPag") != null; - } - - private void dbTroco_BeforePrint(object sender, EventArgs e) - { - dbTroco.Visible = Report.GetColumnValue("NFe.NFe.infNFe.pag.vTroco") != null; - } - - private void dbQrCodeLateral_BeforePrint(object sender, EventArgs e) - { - TrataCamposDestinatario(); - dbQrCodeLateral.Visible = ((NfeSimplificadoTipo2LayoutQrCode) Report.GetParameterValue("NfeSimplificadoTipo2LayoutQrCode") == NfeSimplificadoTipo2LayoutQrCode.Lateral); - } - - float dbQrCodeLateralHeight; - private void dbQrCodeLateral_AfterPrint(object sender, EventArgs e) - { - dbQrCodeLateralHeight = (dbQrCodeLateral.Visible ? dbQrCodeLateral.Height : 0); - } - - float dbProtocoloHeigth; - private void dbProtocolo_AfterPrint(object sender, EventArgs e) - { - dbProtocoloHeigth = (dbProtocolo.Visible ? dbProtocolo.Height : 0); - } - - private void dbQrCodeNormal_BeforePrint(object sender, EventArgs e) - { - dbQrCodeNormal.Visible = ((NfeSimplificadoTipo2LayoutQrCode) Report.GetParameterValue("NfeSimplificadoTipo2LayoutQrCode") == NfeSimplificadoTipo2LayoutQrCode.Abaixo); - } - - private void dbProtocolo_BeforePrint(object sender, EventArgs e) - { - dbProtocolo.Visible = ((protNFe)Report.GetColumnValue("NFe.protNFe")) != null; - } - - private void dbNumeroSerieDh_BeforePrint(object sender, EventArgs e) - { - dbNumeroSerieDh.Visible = ((NfeSimplificadoTipo2LayoutQrCode) Report.GetParameterValue("NfeSimplificadoTipo2LayoutQrCode") == NfeSimplificadoTipo2LayoutQrCode.Abaixo); - } - } - } - +namespace FastReport +{ + public class ReportScript + { + public Image ObterLogo() + { + byte[] logomarca = Report.GetParameterValue("Logo") as byte[]; + + if (logomarca == null) return null; + + using(var ms = new MemoryStream(logomarca)) + { + var image = Image.FromStream(ms); + return image; + } + } + + private void txtDescPagto_BeforePrint(object sender, EventArgs e) + { + if(Report.GetColumnValue("NFe.NFe.infNFe.pag.tPag") != null) + txtDescPagto.Text = ((FormaPagamento)Report.GetColumnValue("NFe.NFe.infNFe.pag.tPag")).Descricao(); + } + + private void txtDescDetPagto_BeforePrint(object sender, EventArgs e) + { + if(Report.GetDataSource("NFe.NFe.infNFe.pag.detPag").RowCount != 0 && Report.GetColumnValue("NFe.NFe.infNFe.pag.detPag.tPag") != null) + txtDescDetPagto.Text = ((FormaPagamento)Report.GetColumnValue("NFe.NFe.infNFe.pag.detPag.tPag")).Descricao(); + + double tamanho1 = (4.2 / 2.54) * 96; + double tamanho2 = (1.2 / 2.54) * 96; + double tamanho3 = (3.2 / 2.54) * 96; + double tamanho4 = (0.2 / 2.54) * 96; + if(txtDescDetPagto.Text == "Outros") + { + txtDescDetPagto.Width = (float)tamanho2; + txtDescDetMeioPagto.Left = (float)tamanho2; + txtDescDetMeioPagto.Width = (float)tamanho3; + } + else + { + txtDescDetPagto.Width = (float)tamanho1; + txtDescDetMeioPagto.Left = (float)tamanho1; + txtDescDetMeioPagto.Width = (float)tamanho4; + } + } + + private void txtEmitCnpj_BeforePrint(object sender, EventArgs e) + { + var cnpj = (string)Report.GetColumnValue("NFe.NFe.infNFe.emit.CNPJ"); + if (!string.IsNullOrEmpty(cnpj)) + txtEmitCnpj.Text = "CNPJ: " + String.Format(@"{0:00\.000\.000\/0000\-00}", long.Parse(cnpj)); + /* + var ie = (string)Report.GetColumnValue("NFe.NFe.infNFe.emit.IE"); + if (!string.IsNullOrEmpty(ie)) + txtEmitCnpj.Text = txtEmitCnpj.Text + " - IE: " + ie; + */ + } + + private void memChaveNfe_BeforePrint(object sender, EventArgs e) + { + var chave = Substring( ((String)Report.GetColumnValue("NFe.NFe.infNFe.Id")), 3); + if (!string.IsNullOrEmpty(chave) & chave.Length == 44) + { + var chaveFormatada = ""; + for (int i = 0; i < chave.Length; i += 4) + chaveFormatada = chaveFormatada + chave.Substring(i, 4) + " "; + memChaveNfe.Text = chaveFormatada; + } + } + + private void Destinatario_BeforePrint(object sender, EventArgs e) + { + TrataCamposDestinatario(); + dbDestinatario.Visible = ((NfeSimplificadoTipo2LayoutQrCode) Report.GetParameterValue("NfeSimplificadoTipo2LayoutQrCode") == NfeSimplificadoTipo2LayoutQrCode.Abaixo); + } + + private void TrataCamposDestinatario(){ + if ( ((dest)Report.GetColumnValue("NFe.NFe.infNFe.dest")) == null ) //Destinatário não informado + { + txtConsumidor.Text = "CONSUMIDOR NÃO IDENTIFICADO"; + txtConsumidor2.Text = txtConsumidor.Text; + txtDestEndereco.Text = ""; + txtDestEndereco2.Text = txtDestEndereco.Text; + txtDestNome.Text = ""; + txtDestNome2.Text = txtDestNome.Text; + } + else + { + txtDestNome.Text = ObterDocumentoDest() + ((String)Report.GetColumnValue("NFe.NFe.infNFe.dest.xNome")); + txtDestNome2.Text = txtDestNome.Text; + } + //Endereço do destinatário é opcional para NFe + txtDestEndereco.Visible = ((enderDest)Report.GetColumnValue("NFe.NFe.infNFe.dest.enderDest")) != null; + txtDestEndereco2.Visible = txtDestEndereco.Visible; + } + + private string ObterDocumentoDest(){ + var documentoDest = ""; + var cnpj = (String)Report.GetColumnValue("NFe.NFe.infNFe.dest.CNPJ"); + var cpf = (String)Report.GetColumnValue("NFe.NFe.infNFe.dest.CPF"); + var idEstrangeiro = (String)Report.GetColumnValue("NFe.NFe.infNFe.dest.idEstrangeiro"); + if ( !String.IsNullOrEmpty(cnpj)) documentoDest = "CNPJ: " + String.Format(@"{0:00\.000\.000\/0000\-00}", long.Parse(cnpj)) + " "; + if ( !String.IsNullOrEmpty(cpf)) documentoDest = "CPF: " + String.Format(@"{0:000\.000\.000\-00}", long.Parse(cpf)) + " "; + if ( !String.IsNullOrEmpty(idEstrangeiro)) documentoDest = "Id. Estrangeiro: " + idEstrangeiro + " "; + return documentoDest; + } + + private void dbProdutosUmaLinha_BeforePrint(object sender, EventArgs e) + { + //Conforme Manual de Padrões Padrões Técnicos do DANFE-NFC-e e QR Code, página 8. "No caso de emissão em contingência, é obrigatória a impressão do Detalhe da Venda e do DANFE NFC-e" + if ( ((TipoEmissao)Report.GetColumnValue("NFe.NFe.infNFe.ide.tpEmis")) == TipoEmissao.teNormal ) + dbProdutosUmaLinha.Visible = ((NfeSimplificadoTipo2DetalheVendaNormal)((Int32)Report.GetParameterValue("NfeSimplificadoTipo2DetalheVendaNormal"))) == NfeSimplificadoTipo2DetalheVendaNormal.UmaLinha; + else + dbProdutosUmaLinha.Visible = ((NfeSimplificadoTipo2DetalheVendaContigencia)((Int32)Report.GetParameterValue("NfeSimplificadoTipo2DetalheVendaContigencia"))) == NfeSimplificadoTipo2DetalheVendaContigencia.UmaLinha; + + //Mostrar/Ocultar desconto concedido no item + txtProdutoUmaLinhaValorUnit.Text = "[NFe.NFe.infNFe.det.prod.vUnCom]"; + txtProdutoUmaLinhaValorTotal.Text = "[NFe.NFe.infNFe.det.prod.vProd]"; + dbProdutosUmaLinha.Border.Lines = BorderLines.None; //BorderLines.Bottom; + var imprimeDesconto = dbProdutosUmaLinha.Visible & ((Boolean)Report.GetParameterValue("NfeSimplificadoTipo2ImprimeDescontoItem")) & + ((Nullable<Decimal>)Report.GetColumnValue("NFe.NFe.infNFe.det.prod.vDesc")) > 0; + cbDescontoItemUmaLinha.Visible = imprimeDesconto; + if (imprimeDesconto) + dbProdutosUmaLinha.Border.Lines = BorderLines.None; + } + + private void ghbProdutosDuasLinhas_BeforePrint(object sender, EventArgs e) + { + //Conforme Manual de Padrões Padrões Técnicos do DANFE-NFC-e e QR Code, página 8. "No caso de emissão em contingência, é obrigatória a impressão do Detalhe da Venda e do DANFE NFC-e" + if ( ((TipoEmissao)Report.GetColumnValue("NFe.NFe.infNFe.ide.tpEmis")) == TipoEmissao.teNormal ) + ghbProdutosDuasLinhas.Visible = ((NfeSimplificadoTipo2DetalheVendaNormal)((Int32)Report.GetParameterValue("NfeSimplificadoTipo2DetalheVendaNormal"))) == NfeSimplificadoTipo2DetalheVendaNormal.DuasLinhas; + else + ghbProdutosDuasLinhas.Visible = ((NfeSimplificadoTipo2DetalheVendaContigencia)((Int32)Report.GetParameterValue("NfeSimplificadoTipo2DetalheVendaContigencia"))) == NfeSimplificadoTipo2DetalheVendaContigencia.DuasLinhas; + } + + private void dbProdutosDuasLinhas_BeforePrint(object sender, EventArgs e) + { + //Conforme Manual de Padrões Padrões Técnicos do DANFE-NFC-e e QR Code, página 8. "No caso de emissão em contingência, é obrigatória a impressão do Detalhe da Venda e do DANFE NFC-e" + if ( ((TipoEmissao)Report.GetColumnValue("NFe.NFe.infNFe.ide.tpEmis")) == TipoEmissao.teNormal ) + dbProdutosDuasLinhas.Visible = ((NfeSimplificadoTipo2DetalheVendaNormal)((Int32)Report.GetParameterValue("NfeSimplificadoTipo2DetalheVendaNormal"))) == NfeSimplificadoTipo2DetalheVendaNormal.DuasLinhas; + else + dbProdutosDuasLinhas.Visible = ((NfeSimplificadoTipo2DetalheVendaContigencia)((Int32)Report.GetParameterValue("NfeSimplificadoTipo2DetalheVendaContigencia"))) == NfeSimplificadoTipo2DetalheVendaContigencia.DuasLinhas; + + //Mostrar/Ocultar desconto concedido no item + txtProdutoDuasLinhasValorUnit.Text = "[NFe.NFe.infNFe.det.prod.vUnCom]"; + txtProdutoDuasLinhasValorTotal.Text = "[NFe.NFe.infNFe.det.prod.vProd]"; + dbProdutosDuasLinhas.Border.Lines = BorderLines.Bottom; + var imprimeDesconto = dbProdutosDuasLinhas.Visible & ((Boolean)Report.GetParameterValue("NfeSimplificadoTipo2ImprimeDescontoItem")) & + ((Nullable<Decimal>)Report.GetColumnValue("NFe.NFe.infNFe.det.prod.vDesc")) > 0; + cbDescontoItemDuasLinhas.Visible = imprimeDesconto; + if (imprimeDesconto) + dbProdutosDuasLinhas.Border.Lines = BorderLines.None; + //Se possuir desconto, e estiver configurado para não exibi-lo, exibe os valores líquidos nos campos abaixo: + if (((Nullable<Decimal>)Report.GetColumnValue("NFe.NFe.infNFe.det.prod.vDesc")) > 0 & !imprimeDesconto) + { + txtProdutoDuasLinhasValorUnit.Text = "[([NFe.NFe.infNFe.det.prod.vProd] - [NFe.NFe.infNFe.det.prod.vDesc]) / [NFe.NFe.infNFe.det.prod.qCom]]"; + txtProdutoDuasLinhasValorTotal.Text = "[[NFe.NFe.infNFe.det.prod.vProd] - [NFe.NFe.infNFe.det.prod.vDesc]]"; + } + } + + private void ghbProdutosUmaLinha_BeforePrint(object sender, EventArgs e) + { + //Conforme Manual de Padrões Padrões Técnicos do DANFE-NFC-e e QR Code, página 8. "No caso de emissão em contingência, é obrigatória a impressão do Detalhe da Venda e do DANFE NFC-e" + if ( ((TipoEmissao)Report.GetColumnValue("NFe.NFe.infNFe.ide.tpEmis")) == TipoEmissao.teNormal ) + ghbProdutosUmaLinha.Visible = ((NfeSimplificadoTipo2DetalheVendaNormal)((Int32)Report.GetParameterValue("NfeSimplificadoTipo2DetalheVendaNormal"))) == NfeSimplificadoTipo2DetalheVendaNormal.UmaLinha; + else + ghbProdutosUmaLinha.Visible = ((NfeSimplificadoTipo2DetalheVendaContigencia)((Int32)Report.GetParameterValue("NfeSimplificadoTipo2DetalheVendaContigencia"))) == NfeSimplificadoTipo2DetalheVendaContigencia.UmaLinha; + } + + private void memMsgFiscal_BeforePrint(object sender, EventArgs e) + { + //Conforme Manual de Padrões Padrões Técnicos do DANFE-NFC-e e QR Code, página 8 + string msgHomologacao = ""; + string msgContigencia = ""; + if ( ((TipoAmbiente)Report.GetColumnValue("NFe.NFe.infNFe.ide.tpAmb")) == TipoAmbiente.Homologacao ) + msgHomologacao = "EMITIDA EM AMBIENTE DE HOMOLOGAÇÃO – SEM VALOR FISCAL" + Environment.NewLine; + if ( ((TipoEmissao)Report.GetColumnValue("NFe.NFe.infNFe.ide.tpEmis")) != TipoEmissao.teNormal ) + msgContigencia = "EMITIDA EM CONTINGÊNCIA" + Environment.NewLine; + + memMsgFiscal.Text = msgHomologacao + msgContigencia + memMsgFiscal.Text; + } + + private void txtObs_BeforePrint(object sender, EventArgs e) + { + txtObs.Text = ((String)Report.GetColumnValue("NFe.NFe.infNFe.infAdic.infCpl")).Replace(";", Environment.NewLine); + } + + private void PgNfeSimplificadoTipo2_StartPage(object sender, EventArgs e) + { + phbCancelado.Visible = ((Boolean)Report.GetParameterValue("NfeSimplificadoTipo2Cancelado")); + + if (!Engine.FinalPass) + return; + if ( (NfeSimplificadoTipo2ModoImpressao) ((Int32)Report.GetParameterValue("NfeSimplificadoTipo2ModoImpressao")) != NfeSimplificadoTipo2ModoImpressao.UnicaPagina) + return; + + PgNfeSimplificadoTipo2.PaperHeight = + (//rtbTituloHeight + + phbEmitenteHeight + + ((Boolean)Report.GetParameterValue("NfeSimplificadoTipo2Cancelado") ? phbCancelado.Height : 0)+ + ghbProdutosUmaLinhaHeight + + dbProdutosUmaLinhaHeight + + ghbProdutosDuasLinhasHeight + + dbProdutosDuasLinhasHeight + + gfbProdutosHeight + + dbPagamentoHeight + + dbDetPagamentoHeight + + dbTributosHeight + + dbObservacaoHeight + + dbInfoFiscalHeight + + dbNumeroSerieDhHeight + + dbConsultaHeight + + dbDestinatarioHeight + + dbQrCodeNormalHeight + + dbQrCodeLateralHeight + + dbProtocoloHeigth + ) / + Units.Millimeters + PgNfeSimplificadoTipo2.TopMargin + PgNfeSimplificadoTipo2.BottomMargin; + } + + float dbProdutosUmaLinhaHeight; + private void dbProdutosUmaLinha_AfterPrint(object sender, EventArgs e) + { + dbProdutosUmaLinhaHeight += (dbProdutosUmaLinha.Visible ? dbProdutosUmaLinha.Height : 0) + (cbDescontoItemUmaLinha.Visible ? cbDescontoItemUmaLinha.Height : 0); + } + + float dbProdutosDuasLinhasHeight; + private void dbProdutosDuasLinhas_AfterPrint(object sender, EventArgs e) + { + dbProdutosDuasLinhasHeight += (dbProdutosDuasLinhas.Visible ?dbProdutosDuasLinhas.Height : 0) + (cbDescontoItemDuasLinhas.Visible ? cbDescontoItemDuasLinhas.Height : 0); + } + + float dbInfoFiscalHeight; + private void dbInfoFiscal_AfterPrint(object sender, EventArgs e) + { + dbInfoFiscalHeight = (dbInfoFiscal.Visible ? dbInfoFiscal.Height : 0); + } + + float dbNumeroSerieDhHeight; + private void dbNumeroSerieDh_AfterPrint(object sender, EventArgs e) + { + dbNumeroSerieDhHeight = (dbNumeroSerieDh.Visible ? dbNumeroSerieDh.Height : 0); + } + + float dbConsultaHeight; + private void dbConsulta_AfterPrint(object sender, EventArgs e) + { + dbConsultaHeight = (dbConsulta.Visible ? dbConsulta.Height : 0); + } + + float phbEmitenteHeight; + private void phbEmitente_AfterPrint(object sender, EventArgs e) + { + phbEmitenteHeight = (phbEmitente.Visible ? phbEmitente.Height : 0); + } + + float ghbProdutosUmaLinhaHeight; + private void ghbProdutosUmaLinha_AfterPrint(object sender, EventArgs e) + { + ghbProdutosUmaLinhaHeight = (ghbProdutosUmaLinha.Visible ? ghbProdutosUmaLinha.Height : 0); + } + + float ghbProdutosDuasLinhasHeight; + private void ghbProdutosDuasLinhas_AfterPrint(object sender, EventArgs e) + { + ghbProdutosDuasLinhasHeight = (ghbProdutosDuasLinhas.Visible ? ghbProdutosDuasLinhas.Height : 0); + } + + float gfbProdutosHeight; + private void gfbProdutos_AfterPrint(object sender, EventArgs e) + { + gfbProdutosHeight = (gfbProdutos.Visible ? gfbProdutos.Height : 0); + } + + float dbPagamentoHeight; + private void dbPagamento_AfterPrint(object sender, EventArgs e) + { + dbPagamentoHeight = (dbPagamento.Visible ? dbPagamento.Height : 0); + } + + float dbDetPagamentoHeight; + private void dbDetPagamento_AfterPrint(object sender, EventArgs e) + { + dbDetPagamentoHeight = (dbDetPagamento.Visible ? dbDetPagamento.Height : 0); + } + + float dbTributosHeight; + private void dbTributos_AfterPrint(object sender, EventArgs e) + { + dbTributosHeight = (dbTributos.Visible ? dbTributos.Height : 0); + } + + float dbObservacaoHeight; + private void dbObservacao_AfterPrint(object sender, EventArgs e) + { + dbObservacaoHeight = (dbObservacao.Visible ? dbObservacao.Height : 0); + } + + float dbDestinatarioHeight; + private void dbDestinatario_AfterPrint(object sender, EventArgs e) + { + dbDestinatarioHeight = (dbDestinatario.Visible ? dbDestinatario.Height : 0); + } + + float dbQrCodeNormalHeight; + private void dbQrCode_AfterPrint(object sender, EventArgs e) + { + dbQrCodeNormalHeight = (dbQrCodeNormal.Visible ? dbQrCodeNormal.Height : 0); + } + + private void cbDesconto_BeforePrint(object sender, EventArgs e) + { + cbDesconto.Visible = (((Decimal)Report.GetColumnValue("NFe.NFe.infNFe.total.ICMSTot.vDesc")) > 0) || + (((Decimal)Report.GetColumnValue("NFe.NFe.infNFe.total.ICMSTot.vFrete")) > 0) || + (((Decimal)Report.GetColumnValue("NFe.NFe.infNFe.total.IBSCBSTot.gCBS.vCBS")) > 0) || + (((Decimal)Report.GetColumnValue("NFe.NFe.infNFe.total.IBSCBSTot.gIBS.vIBS")) > 0) || + (((Decimal)Report.GetColumnValue("NFe.NFe.infNFe.total.ISTot.vIS")) > 0); + + float vTop = 0; + if (((Decimal)Report.GetColumnValue("NFe.NFe.infNFe.total.ICMSTot.vDesc")) == 0) + { + Text43.Visible = false; + Text44.Visible = false; + } + else + vTop = vTop + Text44.Height; + + if (((Decimal)Report.GetColumnValue("NFe.NFe.infNFe.total.ICMSTot.vFrete")) == 0) + { + Text52.Visible = false; + Text54.Visible = false; + } + else + vTop = vTop + Text54.Height; + + if (Report.GetColumnValue("NFe.NFe.infNFe.total.IBSCBSTot.gCBS.vCBS") != null) + { + Text53.Top = vTop; + Text55.Top = vTop; + vTop = vTop + Text53.Height; + } + if (Report.GetColumnValue("NFe.NFe.infNFe.total.IBSCBSTot.gIBS.vIBS") != null) + { + Text57.Top = vTop; + Text58.Top = vTop; + vTop = vTop + Text58.Height; + } + if (((Nullable<Decimal>)Report.GetColumnValue("NFe.NFe.infNFe.total.ISTot.vIS") ?? 0m) > 0) + { + Text59.Top = vTop; + Text60.Top = vTop; + vTop = vTop + Text60.Height; + } + else + { + Text59.Visible = false; + Text60.Visible = false; + } + Text45.Top = vTop; + Text46.Top = vTop; + cbDesconto.Height = vTop + Text46.Height; + } + + private void txtTotal_BeforePrint(object sender, EventArgs e) + { + var vServ = ((Nullable<Decimal>)Report.GetColumnValue("NFe.NFe.infNFe.total.ISSQNtot.vServ")) == null ? 0 : ((Nullable<Decimal>)Report.GetColumnValue("NFe.NFe.infNFe.total.ISSQNtot.vServ")); + txtTotal.Text = (((Decimal)Report.GetColumnValue("NFe.NFe.infNFe.total.ICMSTot.vProd")) + vServ).ToString(); + } + + private void dbPagamento_BeforePrint(object sender, EventArgs e) + { + dbPagamento.Visible = Report.GetColumnValue("NFe.NFe.infNFe.pag.tPag") != null; + } + + private void dbDetPagamento_BeforePrint(object sender, EventArgs e) + { + dbDetPagamento.Visible = Report.GetDataSource("NFe.NFe.infNFe.pag.detPag").RowCount != 0 && Report.GetColumnValue("NFe.NFe.infNFe.pag.detPag.tPag") != null; + } + + private void dbTroco_BeforePrint(object sender, EventArgs e) + { + dbTroco.Visible = Report.GetColumnValue("NFe.NFe.infNFe.pag.vTroco") != null; + } + + private void dbQrCodeLateral_BeforePrint(object sender, EventArgs e) + { + TrataCamposDestinatario(); + dbQrCodeLateral.Visible = ((NfeSimplificadoTipo2LayoutQrCode) Report.GetParameterValue("NfeSimplificadoTipo2LayoutQrCode") == NfeSimplificadoTipo2LayoutQrCode.Lateral); + } + + float dbQrCodeLateralHeight; + private void dbQrCodeLateral_AfterPrint(object sender, EventArgs e) + { + dbQrCodeLateralHeight = (dbQrCodeLateral.Visible ? dbQrCodeLateral.Height : 0); + } + + float dbProtocoloHeigth; + private void dbProtocolo_AfterPrint(object sender, EventArgs e) + { + dbProtocoloHeigth = (dbProtocolo.Visible ? dbProtocolo.Height : 0); + } + + private void dbQrCodeNormal_BeforePrint(object sender, EventArgs e) + { + dbQrCodeNormal.Visible = ((NfeSimplificadoTipo2LayoutQrCode) Report.GetParameterValue("NfeSimplificadoTipo2LayoutQrCode") == NfeSimplificadoTipo2LayoutQrCode.Abaixo); + } + + private void dbProtocolo_BeforePrint(object sender, EventArgs e) + { + dbProtocolo.Visible = ((protNFe)Report.GetColumnValue("NFe.protNFe")) != null; + } + + private void dbNumeroSerieDh_BeforePrint(object sender, EventArgs e) + { + dbNumeroSerieDh.Visible = ((NfeSimplificadoTipo2LayoutQrCode) Report.GetParameterValue("NfeSimplificadoTipo2LayoutQrCode") == NfeSimplificadoTipo2LayoutQrCode.Abaixo); + } + + private void phbEmitente_BeforePrint(object sender, EventArgs e) + { + poEmitLogo.Image = ObterLogo(); + } + } +} - + - - + + - - + + - - + + - - + + - - + + - - - - - + + + + + - + - + - - - - + + + + - + - + - + @@ -517,9 +522,9 @@ - + - + @@ -532,12 +537,12 @@ - + - + @@ -550,13 +555,13 @@ - + - + @@ -576,7 +581,7 @@ - + @@ -596,13 +601,13 @@ - + - + - + @@ -624,33 +629,33 @@ - + - + - - + + - + - + - - + + - + - + - - - - - + + + + + @@ -660,13 +665,13 @@ - + - + @@ -676,15 +681,15 @@ - + - - - + + + @@ -692,17 +697,17 @@ - + - + - - - + + + @@ -710,15 +715,15 @@ - + - + - + @@ -733,26 +738,26 @@ - - + + - - - + + + - + - + - + - + - - + + @@ -787,7 +792,7 @@ - + @@ -799,9 +804,9 @@ - + - + @@ -810,18 +815,18 @@ - + - - + + - + - + @@ -829,7 +834,7 @@ - + @@ -837,7 +842,7 @@ - + @@ -845,16 +850,16 @@ - + - - - + + + @@ -863,7 +868,7 @@ - + @@ -871,50 +876,50 @@ - + - - + + - - + + - + - - + + - + - + - + - - + + - + - + - + - + @@ -926,28 +931,28 @@ - + - - - + + + - + - + - + - - + + @@ -955,41 +960,41 @@ - - - + + + - - - + + + - + - + - + - + - - + + - + - + - + - + @@ -997,26 +1002,26 @@ - - - + + + - + - + - + - + - - + + @@ -1028,12 +1033,12 @@ - - + + - + - + @@ -1049,7 +1054,7 @@ - + @@ -1060,8 +1065,8 @@ - - + + @@ -1076,12 +1081,12 @@ - + - + - + @@ -1090,7 +1095,7 @@ - + @@ -1101,7 +1106,7 @@ - + @@ -1111,7 +1116,7 @@ - + @@ -1120,7 +1125,7 @@ - + @@ -1131,7 +1136,7 @@ - + @@ -1140,12 +1145,12 @@ - + - + @@ -1158,56 +1163,56 @@ - + - + - + - + - + - + - + - + - + - + - + - + @@ -1215,14 +1220,14 @@ - + - - + + - + diff --git a/Shared.NFe.Danfe/DanfeSharedHelper.cs b/Shared.NFe.Danfe/DanfeSharedHelper.cs index 62ca50cd..64e05f02 100644 --- a/Shared.NFe.Danfe/DanfeSharedHelper.cs +++ b/Shared.NFe.Danfe/DanfeSharedHelper.cs @@ -343,7 +343,7 @@ public static Report GenerateDanfeFrNfeSimplificadoTipo2Report(nfeProc proc, Con } } - ((TextObject)relatorio.FindObject("txtUrl")).Text = string.IsNullOrEmpty(proc.NFe.infNFeSupl.urlChave) ? proc.NFe.infNFeSupl.ObterUrlConsulta(proc.NFe, configuracao.VersaoQrCode) : proc.NFe.infNFeSupl.urlChave; + ((TextObject)relatorio.FindObject("txtUrl")).Text = string.IsNullOrEmpty(proc.NFe.infNFeSupl?.urlChave) ? proc.NFe.infNFeSupl.ObterUrlConsulta(proc.NFe, configuracao.VersaoQrCode) : proc.NFe.infNFeSupl.urlChave; ((BarcodeObject)relatorio.FindObject("bcoQrCode")).Text = proc.NFe.infNFeSupl == null ? proc.NFe.infNFeSupl.ObterUrlQrCode(proc.NFe, configuracao.VersaoQrCode, cIdToken, csc) : proc.NFe.infNFeSupl.qrCode; ((BarcodeObject)relatorio.FindObject("bcoQrCodeLateral")).Text = proc.NFe.infNFeSupl == null ? proc.NFe.infNFeSupl.ObterUrlQrCode(proc.NFe, configuracao.VersaoQrCode, cIdToken, csc) : proc.NFe.infNFeSupl.qrCode;