public RemessaCnab400 GerarRemessa(HeaderRemessaCnab400 header, List<Boleto> boletos, List<DetalheRemessaCnab400> detalhes, TrailerRemessaCnab400 trailer) { //var contadorSequencialRegistro = 1; var objReturn = new RemessaCnab400(); objReturn.RegistrosDetalhe = new List<DetalheRemessaCnab400>(); objReturn.Header = header; foreach (var detalhe in detalhes) { objReturn.RegistrosDetalhe.Add(detalhe); //objReturn.AdicionarBoleto(boletoAddRemessa, contadorSequencialRegistro); //contadorSequencialRegistro++; } objReturn.Trailer = trailer; return objReturn; }
public string EscreverTrailer(TrailerRemessaCnab400 infoTrailer) { if (infoTrailer== null) throw new Exception("Os dados não foram informados na geração do TRAILER."); if (infoTrailer.NumeroSequencialRegistro == 0) throw new Exception("Sequencial do registro não foi informado na geração do TRAILER."); var trailer = new string(' ', 400); try { trailer = trailer.PreencherValorNaLinha(1, 1, "9"); trailer = trailer.PreencherValorNaLinha(2, 394, string.Empty.PadRight(393, ' ')); trailer = trailer.PreencherValorNaLinha(395, 400, infoTrailer.NumeroSequencialRegistro.ToString().PadLeft(6, '0')); return trailer; } catch (Exception e) { throw new Exception(string.Format("<BoletoBr>{0}Falha na geração do TRAILER do arquivo de REMESSA.", Environment.NewLine), e); } }
public string EscreverTrailer(TrailerRemessaCnab400 infoTrailer) { var trailer = new string(' ', 400); try { trailer = trailer.PreencherValorNaLinha(1, 1, "9"); trailer = trailer.PreencherValorNaLinha(2, 394, string.Empty.PadRight(393, ' ')); // Contagem total de linhas do arquivo no formato '000000' - 6 dígitos trailer = trailer.PreencherValorNaLinha(395, 400, infoTrailer.NumeroSequencialRegistro.ToString().PadLeft(6, '0')); return trailer; } catch (Exception e) { throw new Exception(string.Format("<BoletoBr>{0}Falha na geração do TRAILER do arquivo de REMESSA.", Environment.NewLine), e); } }
public string EscreverTrailer(TrailerRemessaCnab400 infoTrailer) { var trailer = new string(' ', 400); try { trailer = trailer.PreencherValorNaLinha(1, 1, "9"); trailer = trailer.PreencherValorNaLinha(2, 7, infoTrailer.TotalLinhasArquivo.ToString().PadLeft(6, '0')); trailer = trailer.PreencherValorNaLinha(8, 20, infoTrailer.ValorTotalTitulos.ToString("f").Replace(",", "").PadLeft(13, '0') /*Valor total dos títulos*/); trailer = trailer.PreencherValorNaLinha(21, 394, string.Empty.PadRight(374, '0')); trailer = trailer.PreencherValorNaLinha(395, 400, infoTrailer.NumeroSequencialRegistro.ToString().PadLeft(6, '0')); return trailer; } catch (Exception e) { throw new Exception(string.Format("<BoletoBr>{0}Falha na geração do TRAILER do arquivo de REMESSA.", Environment.NewLine), e); } }