Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 17 additions & 3 deletions NFe.Danfe.Base/NFCe/NFCe.frx
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,26 @@ namespace FastReport
if(Report.GetDataSource("NFCe.NFe.infNFe.pag.detPag").RowCount != 0 && Report.GetColumnValue("NFCe.NFe.infNFe.pag.detPag.tPag") != null)
txtDescDetPagto.Text = ((FormaPagamento)Report.GetColumnValue("NFCe.NFe.infNFe.pag.detPag.tPag")).Descricao();
}

private string formatTxtCnpj(string cnpj){
if (string.IsNullOrEmpty(cnpj) || cnpj.Length != 14)
return cnpj;

return cnpj.Insert(2, ".").Insert(6, ".").Insert(10, "/").Insert(15, "-");
}

private string formatTxtCpf(string cpf){
if (string.IsNullOrEmpty(cpf) || cpf.Length != 11)
return cpf;

return cpf.Insert(3, ".").Insert(7, ".").Insert(11, "-");
}

private void txtEmitCnpj_BeforePrint(object sender, EventArgs e)
{
var cnpj = (string)Report.GetColumnValue("NFCe.NFe.infNFe.emit.CNPJ");
if (!string.IsNullOrEmpty(cnpj))
txtEmitCnpj.Text = "CNPJ: " + String.Format(@"{0:00\.000\.000\/0000\-00}", long.Parse(cnpj));
txtEmitCnpj.Text = "CNPJ: " + formatTxtCnpj(cnpj);
}

private void memChaveNfe_BeforePrint(object sender, EventArgs e)
Expand Down Expand Up @@ -91,8 +105,8 @@ namespace FastReport
var cnpj = (String)Report.GetColumnValue("NFCe.NFe.infNFe.dest.CNPJ");
var cpf = (String)Report.GetColumnValue("NFCe.NFe.infNFe.dest.CPF");
var idEstrangeiro = (String)Report.GetColumnValue("NFCe.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(cnpj)) documentoDest = "CNPJ: " + formatTxtCnpj(cnpj) + " ";
if ( !String.IsNullOrEmpty(cpf)) documentoDest = "CPF: " + formatTxtCpf(cpf) + " ";
if ( !String.IsNullOrEmpty(idEstrangeiro)) documentoDest = "Id. Estrangeiro: " + idEstrangeiro + " ";
return documentoDest;
}
Expand Down
Loading