Example #1
0
        public void GeraArquivoCNAB400(IBanco banco, Cedente cedente, Boletos boletos, string numeroConvenio = null)
        {
            try
            {
                saveFileDialog.Filter = "Arquivos de Retorno (*.rem)|*.rem|Todos Arquivos (*.*)|*.*";
                if (saveFileDialog.ShowDialog() == DialogResult.OK)
                {
                    ArquivoRemessa arquivo = new ArquivoRemessa(TipoArquivo.CNAB400);

                    //Valida a Remessa Correspondentes antes de Gerar a mesma...
                    string vMsgRetorno = string.Empty;
                    bool vValouOK = arquivo.ValidarArquivoRemessa(cedente.Convenio.ToString(), banco, cedente, boletos, 1, out vMsgRetorno);
                    if (!vValouOK)
                    {
                        MessageBox.Show(String.Concat("Foram localizados inconsistências na validação da remessa!", Environment.NewLine, vMsgRetorno),
                                        "Teste",
                                        MessageBoxButtons.OK,
                                        MessageBoxIcon.Information);
                    }
                    else
                    {
                        arquivo.GerarArquivoRemessa(numeroConvenio != null ? numeroConvenio : "0", banco, cedente, boletos, saveFileDialog.OpenFile(), 1);

                        MessageBox.Show("Arquivo gerado com sucesso!", "Teste",
                                        MessageBoxButtons.OK,
                                        MessageBoxIcon.Information);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Example #2
0
        public void GeraDadosSicredi()
        {
            ContaBancaria conta = new ContaBancaria();

            conta.Agencia       = "051";
            conta.DigitoAgencia = "2";
            conta.Conta         = "13000";
            conta.DigitoConta   = "3";
            //
            Cedente c = new Cedente();

            c.ContaBancaria = conta;
            c.CPFCNPJ       = "00000000000000";
            c.Nome          = "Empresa de Atacado";
            //Na carteira 198 o código do Cedente é a conta bancária
            c.Codigo   = "12345";//No Banrisul, esse código está no manual como 12 caracteres, por eu(sidneiklein) isso tive que alterar o tipo de int para string;
            c.Convenio = 124522;
            //
            Boleto b = new Boleto();

            b.Cedente = c;
            //
            b.DataProcessamento = DateTime.Now;
            b.DataVencimento    = DateTime.Now.AddDays(15);
            b.ValorBoleto       = Convert.ToDecimal(2469.69);
            b.Carteira          = "1";
            b.VariacaoCarteira  = "02";
            b.NossoNumero       = string.Empty; //"92082835"; //** Para o "Remessa.TipoDocumento = "06", não poderá ter NossoNúmero Gerado!
            b.NumeroDocumento   = "1008073";
            //
            b.Sacado = new Sacado("000.000.000-00", "Fulano de Silva");
            b.Sacado.Endereco.End    = "SSS 154 Bloco J Casa 23";
            b.Sacado.Endereco.Bairro = "Testando";
            b.Sacado.Endereco.Cidade = "Testelândia";
            b.Sacado.Endereco.CEP    = "70000000";
            b.Sacado.Endereco.UF     = "RS";

            Instrucao_Sicredi item1 = new Instrucao_Sicredi(9, 5);

            b.Instrucoes.Add(item1);
            //b.Instrucoes.Add(item2);
            b.Banco = new Banco(748);

            //
            EspecieDocumento especiedocumento = new EspecieDocumento(748, "A");//(341, 1);

            b.EspecieDocumento = especiedocumento;


            #region Dados para Remessa:
            b.Remessa = new Remessa();
            b.Remessa.TipoDocumento = "A"; //A = 'A' - SICREDI com Registro
            #endregion

            //
            Boletos boletos = new Boletos();
            boletos.Add(b);

            GeraArquivoCNAB400(b.Banco, c, boletos);
        }
        private void fillBoleto(Boletos boleto, BoletoViewModel model)
        {
            boleto.IDCliente    = Convert.ToInt32(model.IDCliente);
            boleto.IDUsuario    = visitor.ID;
            boleto.NumeroBoleto = model.NumeroBoleto;
            if (model.Preco != null)
            {
                boleto.Preco = Convert.ToDouble(model.Preco.Value);
            }
            boleto.Status            = model.Status.Value;
            boleto.DataEmissao       = model.DataEmissao.Value;
            boleto.BoletosOrcamentos = new List <BoletosOrcamentos>();
            boleto.IDUsuario         = visitor.ID;

            if (model.Pedidos == null)
            {
                return;
            }

            foreach (var item in model.Pedidos)
            {
                boleto.BoletosOrcamentos.Add(new BoletosOrcamentos()
                {
                    IDOrcamento = item,
                    DataCriacao = DateTime.Now,
                    IDUsuario   = visitor.ID
                });
            }
        }
Example #4
0
        public FileResult GerarRemessa(string postedData)
        {
            var    js           = new JavaScriptSerializer();
            var    loteboletos  = js.Deserialize <List <LoteBoleto> >(postedData);
            var    random       = Path.GetRandomFileName().Substring(0, 5);
            Boleto boletoGerado = new Boleto();

            MemoryStream   strm           = new MemoryStream();
            ArquivoRemessa arquivoRemessa = new ArquivoRemessa(TipoArquivo.CNAB400);
            Boletos        boletos        = new Boletos();

            var convenio = new RepositorioModeloBoleto().BuscarPorId(loteboletos.First().ModeloBoletoId).Convenio;

            foreach (var boleto in loteboletos)
            {
                if (boleto.TituloId != null)
                {
                    boletoGerado = Util.GerarBoleto((int)boleto.TituloId, boleto.ModeloBoletoId);
                }
                else
                {
                    boletoGerado = Util.GerarBoleto((int)boleto.TituloRecorrenteId, boleto.Valor, boleto.DataVencimento, boleto.ModeloBoletoId);
                }
                boletos.Add(boletoGerado);
            }

            arquivoRemessa.GerarArquivoRemessa(convenio, boletoGerado.Banco, boletoGerado.Cedente, boletos, strm, 1);

            return(File(strm.ToArray(), "text/plain", "teste.txt"));
        }
        public ActionResult Create(BoletoViewModel model)
        {
            if (ModelState.IsValid)
            {
                model.NumeroBoleto = String.Concat(model.NumeroBoletoPart1,
                                                   model.NumeroBoletoPart2,
                                                   model.NumeroBoletoPart3,
                                                   model.NumeroBoletoPart4,
                                                   model.NumeroBoletoPart5,
                                                   model.NumeroBoletoPart6,
                                                   model.NumeroBoletoPart7,
                                                   model.NumeroBoletoPart8);

                if (BoletoService.getBoletos(model.NumeroBoleto).Count > 0)
                {
                    this.addMensagemErro("Boleto já existe");
                    return(View(model));
                }


                var boleto = new Boletos();
                fillBoleto(boleto, model);

                BoletoService.saveBoleto(boleto);
                this.addMensagemSucesso("Boleto criado com sucesso!");
            }
            else
            {
                model.ListaStatus = new List <SelectListItem>();
                model.ListaStatus.AddRange(EnumHelper.toSelectList(new StatusBoleto()));
                return(View(model));
            }
            return(RedirectToAction("Index", "Boleto"));
        }
        public override void GerarArquivoRemessa(string numeroConvenio, IBanco banco, Cedente cedente, Boletos boletos, Stream arquivo, int numeroArquivoRemessa)
        {
            try
            {
                int numeroRegistro = 2;
                string strline;

                StreamWriter incluiLinha = new StreamWriter(arquivo);
                strline = banco.GerarHeaderRemessa("0", cedente, TipoArquivo.CNAB400);
                incluiLinha.WriteLine(strline);

                foreach (Boleto boleto in boletos)
                {
                    boleto.Banco = banco;
                    strline = boleto.Banco.GerarDetalheRemessa(boleto, numeroRegistro, TipoArquivo.CNAB400);
                    incluiLinha.WriteLine(strline);
                    numeroRegistro++;
                }

                strline = banco.GerarTrailerRemessa(numeroRegistro, TipoArquivo.CNAB400);
                incluiLinha.WriteLine(strline);

                incluiLinha.Close();
            }
            catch (Exception ex)
            {
                throw new Exception("Erro ao gerar arquivo remessa.", ex);
            }
        }
Example #7
0
        public void Unicred_GerarRemessa()
        {
            var boletoBancario = GerarBoletoCarteira1();
            var remessa        = new ArquivoRemessa(TipoArquivo.CNAB240);
            var mem            = new MemoryStream();
            var boletos        = new Boletos();

            boletos.Add(boletoBancario.Boleto);
            remessa.GerarArquivoRemessa(boletoBancario.Cedente.Convenio.ToString(), new Banco(136), boletoBancario.Cedente, boletos, mem, 1);

            var arquivo              = Encoding.ASCII.GetString(mem.ToArray());
            var dataRemessa          = string.Format("{0}{1}{2}", DateTime.Today.Day.ToString("00"), DateTime.Today.Month.ToString("00"), DateTime.Today.ToString("yyyy"));
            var horaRemessa          = string.Format("{0}{1}00", DateTime.Now.Hour.ToString("00"), DateTime.Now.Minute.ToString("00"));
            var dataVencimento       = boletoBancario.Boleto.DataVencimento;
            var dataVencimentoStr    = string.Format("{0}{1}{2}", dataVencimento.Day.ToString("00"), dataVencimento.Month.ToString("00"), dataVencimento.ToString("yyyy"));
            var dataProcessamentoStr = string.Format("{0}{1}{2}", DateTime.Today.Day.ToString("00"), DateTime.Today.Month.ToString("00"), DateTime.Today.ToString("yyyy"));
            var arquivoTeste         = "13600000         235342670000170                    00001900000000000010EMPRESA MODELO S/A            UNICRED                                 1" + dataRemessa + horaRemessa + "00000108500000000                                                                  \r\n" +
                                       "13600011R01  044 2035342670000170                    00001900000000795020EMPRESA MODELO S/A                                                                                            00000001" + dataRemessa + "        00                               \r\n" +
                                       "1360001300001P 010000190000000795020000000000000        09    DOC 123        " + dataVencimentoStr + "000000000105000      N N" + dataProcessamentoStr + "5        000000000000000000000000000000000000000               000000000000000DOC 123                  000    090000000000 \r\n" +
                                       "1360001300002Q 012035342670000170JOSE DA SILVA                           AV. DAS ROSAS, 10                       JARDIM FLORIDO 86300000CORNELIO PROCOPPR1000000000000000                                                                       \r\n" +
                                       "13600015         0000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000                                                                                                                     \r\n" +
                                       "13699999         000001000006000000                                                                                                                                                                                                             \r\n";

            Assert.AreEqual(arquivoTeste, arquivo);
        }
Example #8
0
        public void GeraArquivoCNAB400(IBanco banco, Cedente cedente, Boletos boletos)
        {
            try
            {
                saveFileDialog.Filter = "Arquivos de Retorno (*.rem)|*.rem|Todos Arquivos (*.*)|*.*";
                if (saveFileDialog.ShowDialog() == DialogResult.OK)
                {
                    ArquivoRemessa arquivo = new ArquivoRemessa(TipoArquivo.CNAB400);

                    //Valida a Remessa Correspondentes antes de Gerar a mesma...
                    string vMsgRetorno = string.Empty;
                    bool vValouOK = arquivo.ValidarArquivoRemessa(cedente.Convenio.ToString(), banco, cedente, boletos, 1, out vMsgRetorno);
                    if (!vValouOK)
                    {
                        MessageBox.Show(String.Concat("Foram localizados inconsistências na validação da remessa!", Environment.NewLine, vMsgRetorno),
                                        "Teste",
                                        MessageBoxButtons.OK,
                                        MessageBoxIcon.Information);
                    }
                    else
                    {
                        arquivo.GerarArquivoRemessa("0", banco, cedente, boletos, saveFileDialog.OpenFile(), 1);

                        MessageBox.Show("Arquivo gerado com sucesso!", "Teste",
                                        MessageBoxButtons.OK,
                                        MessageBoxIcon.Information);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        public override void GerarArquivoRemessa(string numeroConvenio, IBanco banco, Cedente cedente, Boletos boletos, Stream arquivo, int numeroArquivoRemessa)
        {
            try
            {
                int numeroRegistro = 2;
                string strline;
                decimal vltitulostotal = 0;                 //Uso apenas no registro TRAILER do banco Santander - jsoda em 09/05/2012 - Add no registro TRAILER do banco Banrisul - sidneiklein em 08/08/2013

                StreamWriter incluiLinha = new StreamWriter(arquivo, Encoding.GetEncoding("ISO-8859-1"));
                strline = banco.GerarHeaderRemessa(numeroConvenio, cedente, TipoArquivo.CNAB400, numeroArquivoRemessa);
                incluiLinha.WriteLine(strline);

                foreach (Boleto boleto in boletos)
                {
                    boleto.Banco = banco;
                    strline = boleto.Banco.GerarDetalheRemessa(boleto, numeroRegistro, TipoArquivo.CNAB400);
                    incluiLinha.WriteLine(strline);
                    vltitulostotal += boleto.ValorBoleto;   //Uso apenas no registro TRAILER do banco Santander - jsoda em 09/05/2012 - Add no registro TRAILER do banco Banrisul - sidneiklein em 08/08/2013
                    numeroRegistro++;
                }

                strline = banco.GerarTrailerRemessa(numeroRegistro, TipoArquivo.CNAB400, cedente, vltitulostotal);

                incluiLinha.WriteLine(strline);

                incluiLinha.Close();
                incluiLinha.Dispose(); // Incluido por Luiz Ponce 07/07/2012.
                incluiLinha = null; // Incluido por Luiz Ponce 07/07/2012.
            }
            catch (Exception ex)
            {
                throw new Exception("Erro ao gerar arquivo remessa.", ex);
            }
        }
Example #10
0
        /// <summary>
        /// Gera o arquivo de remessa para o banco
        /// </summary>
        /// <param name="ilBB">Dictionary com os boletos bancários.</param>
        /// <param name="sFolderRemessa">Pasta de geração do arquivo.</param>
        /// <returns>true/false indicando se o arquivo foi gerado com sucesso.</returns>
        public bool Gerar_Arquivo_Remessa(Dictionary <int, BoletoBancario> ilBB, string sFolderRemessa, ref int iNumeroLote)
        {
            bool bRetorno = false;

            try
            {
                Boletos boletos = new Boletos();

                //-- Gera a list de Boletos para gerar o arquivo de remessa
                foreach (BoletoBancario bb in ilBB.Values)
                {
                    boletos.Add(bb.Boleto);
                }

                if (boletos.Count > 0)
                {
                    Cedente c = boletos[0].Cedente;
                    IBanco  b = boletos[0].Banco;

                    //-- Carrega o contador
                    CompSoft.compFrameWork.Funcoes func = new Funcoes();
                    iNumeroLote = Convert.ToInt32(func.Contador("NumeroContadorCNAB", false)); //-- Pega o número do contador.

                    if (!sFolderRemessa.EndsWith(@"\"))
                    {
                        sFolderRemessa += @"\";
                    }

                    string sFileRemessa = sFolderRemessa
                                          + "B"
                                          + b.Codigo.ToString().PadLeft(3, '0')
                                          + iNumeroLote.ToString().PadLeft(4, '0')
                                          + ".REM";

                    FileInfo fi = new FileInfo(sFileRemessa);

                    //-- Processo o arquivo de remessa
                    ArquivoRemessa ar = new ArquivoRemessa(TipoArquivo.CNAB400);
                    ar.GerarArquivoRemessa(c.Codigo.ToString() //-- Codigo Cedente
                                           , b                 //-- Interface do Banco
                                           , c                 //-- Classe do Cedente
                                           , boletos           //-- Classe com lista dos boletos
                                           , fi.OpenWrite()    //-- Arquivos texto
                                           , iNumeroLote);     //-- Contador

                    func.Contador("NumeroContadorCNAB", true); //-- Atualiza contador.

                    bRetorno = true;
                }
            }
            catch (Exception ex)
            {
                MsgBox.Show("ERRO AO GARAR ARQUIVO DE REMESSA\r\n\r\n" + ex.Message
                            , "Arquivo de Remessa"
                            , System.Windows.Forms.MessageBoxButtons.OK
                            , System.Windows.Forms.MessageBoxIcon.Error);
            }

            return(bRetorno);
        }
 public override bool ValidarArquivoRemessa(string numeroConvenio, IBanco banco, Cedente cedente, Boletos boletos, int numeroArquivoRemessa, out string mensagem)
 {
     try
     {
         bool vRetorno = true;
         string vMsg = string.Empty;
         //
         foreach (Boleto boleto in boletos)
         {
             string vMsgBol = string.Empty;
             bool vRetBol = boleto.Banco.ValidarRemessa(this.TipoArquivo, numeroConvenio, banco, cedente, boletos, numeroArquivoRemessa, out vMsgBol);
             if (!vRetBol && !String.IsNullOrEmpty(vMsgBol))
             {
                 vMsg += vMsgBol;
                 vRetorno = vRetBol;
             }
         }
         //
         mensagem = vMsg;
         return vRetorno;
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Example #12
0
        public void BancoSicredi_GerarRemessaCNAB400()
        {
            var boletos = Enumerable.Range(0, 3).Select(o => {
                var boleto = GerarBoleto();
                boleto.Boleto.Valida();
                return(boleto);
            });

            Boletos itensRemessa = new Boletos();

            itensRemessa.AddRange(boletos.Select(o => o.Boleto));

            var banco   = itensRemessa.First().Banco;
            var cedente = itensRemessa.First().Cedente;

            ArquivoRemessa arquivoRemessa = new ArquivoRemessa(TipoArquivo.CNAB400);

            arquivoRemessa.LinhaDeArquivoGerada += (object sender, LinhaDeArquivoGeradaArgs e) =>
            {
                Debug.WriteLine(e.Linha);
            };

            using (var stream = new MemoryStream())
            {
                arquivoRemessa.GerarArquivoRemessa("08111081111", banco, cedente, itensRemessa, stream, 1);
                var conteudo = Encoding.ASCII.GetString(stream.ToArray());
                Debug.WriteLine(conteudo);
            }
        }
Example #13
0
        public async Task <IActionResult> Edit(int id, [Bind("BoletosID,Nombre,Precio,Fecha,Reserva")] Boletos boletos)
        {
            if (id != boletos.BoletosID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(boletos);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!BoletosExists(boletos.BoletosID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(boletos));
        }
        public ActionResult Edit(BoletoViewModel model)
        {
            if (ModelState.IsValid)
            {
                Boletos boleto = BoletoService.getBoleto(model.IDBoleto);

                model.NumeroBoleto = String.Concat(model.NumeroBoletoPart1,
                                                   model.NumeroBoletoPart2,
                                                   model.NumeroBoletoPart3,
                                                   model.NumeroBoletoPart4,
                                                   model.NumeroBoletoPart5,
                                                   model.NumeroBoletoPart6,
                                                   model.NumeroBoletoPart7,
                                                   model.NumeroBoletoPart8);

                BoletoService.deleteBoletoOrcamentos(boleto.BoletosOrcamentos.ToList());

                fillBoleto(boleto, model);

                BoletoService.saveBoleto(boleto);
                this.addMensagemSucesso("Boleto salvo com sucesso");
            }
            else
            {
                return(View(model));
            }
            return(RedirectToAction("Index", "Boleto"));
        }
Example #15
0
        private MemoryStream GerarRemessa(Cedente cedente, Boleto boleto)
        {
            //Gerar Remessa
            Boletos boletos = new Boletos();

            boletos.Add(boleto);

            var objRemessa = new ArquivoRemessa(TipoArquivo.CNAB400);
            var memoryStr  = new MemoryStream();

            //numeroConvenio vem do Cedente
            objRemessa.GerarArquivoRemessa("09", new Banco(341), cedente, boletos, memoryStr, 1000);

            var filePath = "C:\\Remessa.rem";

            if (File.Exists(filePath))
            {
                File.Delete(filePath);
            }

            var fileStream = File.Create(filePath);

            memoryStr.CopyTo(fileStream);

            return(memoryStr);
        }
Example #16
0
        public void GeraDadosCaixa()
        {
            ContaBancaria conta = new ContaBancaria();

            conta.OperacaConta  = "OPE";
            conta.Agencia       = "345";
            conta.DigitoAgencia = "6";
            conta.Conta         = "87654321";
            conta.DigitoConta   = "0";
            //
            Cedente c = new Cedente();

            c.ContaBancaria = conta;
            c.CPFCNPJ       = "00.000.000/0000-00";
            c.Nome          = "Empresa de Atacado";
            //Na carteira 198 o código do Cedente é a conta bancária
            c.Codigo = String.Concat(conta.Agencia, conta.DigitoAgencia, conta.OperacaConta, conta.Conta, conta.DigitoConta); //Na Caixa, esse código está no manual como 16 caracteres AAAAOOOCCCCCCCCD;
            //
            Boleto b = new Boleto();

            b.Cedente = c;
            //
            b.DataProcessamento = DateTime.Now;
            b.DataVencimento    = DateTime.Now.AddDays(15);
            b.ValorBoleto       = Convert.ToDecimal(2469.69);
            b.Carteira          = "SR";
            b.NossoNumero       = "92082835";
            b.NumeroDocumento   = "1008073";
            EspecieDocumento ED = new EspecieDocumento(104);

            b.EspecieDocumento = ED;

            //
            b.Sacado                 = new Sacado("Fulano de Silva");
            b.Sacado.CPFCNPJ         = "000.000.000-00";
            b.Sacado.Endereco.End    = "SSS 154 Bloco J Casa 23";
            b.Sacado.Endereco.Bairro = "Testando";
            b.Sacado.Endereco.Cidade = "Testelândia";
            b.Sacado.Endereco.CEP    = "70000000";
            b.Sacado.Endereco.UF     = "RS";

            Instrucao_Caixa item1 = new Instrucao_Caixa(9, 5);

            b.Instrucoes.Add(item1);
            //b.Instrucoes.Add(item2);
            b.Banco = new Banco(104);

            #region Dados para Remessa:
            b.Remessa = new Remessa();
            b.Remessa.TipoDocumento    = "2"; // SIGCB - SEM REGISTRO
            b.Remessa.CodigoOcorrencia = string.Empty;
            #endregion

            //
            Boletos boletos = new Boletos();
            boletos.Add(b);

            GeraArquivoCNAB240(b.Banco, c, boletos);
        }
        private BoletoViewModel getViewModel(Boletos boleto, bool isIndex)
        {
            List <Orcamentos> orcamentos = null;
            var idOrcamentosRelacionados = new List <int>();
            var model = new BoletoViewModel()
            {
                IDBoleto          = boleto.IDBoleto,
                IDCliente         = boleto.IDCliente,
                NomeCliente       = boleto.Clientes.Nome,
                DataEmissao       = boleto.DataEmissao,
                NumeroBoleto      = boleto.NumeroBoleto,
                NumeroBoletoPart1 = getSequenceBoleto(boleto.NumeroBoleto, 1),
                NumeroBoletoPart2 = getSequenceBoleto(boleto.NumeroBoleto, 2),
                NumeroBoletoPart3 = getSequenceBoleto(boleto.NumeroBoleto, 3),
                NumeroBoletoPart4 = getSequenceBoleto(boleto.NumeroBoleto, 4),
                NumeroBoletoPart5 = getSequenceBoleto(boleto.NumeroBoleto, 5),
                NumeroBoletoPart6 = getSequenceBoleto(boleto.NumeroBoleto, 6),
                NumeroBoletoPart7 = getSequenceBoleto(boleto.NumeroBoleto, 7),
                NumeroBoletoPart8 = getSequenceBoleto(boleto.NumeroBoleto, 8),
                Preco             = Convert.ToDouble(boleto.Preco),
                Status            = boleto.Status,
                DescricaoStatus   = EnumHelper.getEnumDescription((StatusBoleto)boleto.Status)
            };


            model.ListaStatus = new List <SelectListItem>();
            model.ListaStatus.AddRange(EnumHelper.toSelectList(new StatusBoleto()));

            if (!isIndex)
            {
                //Obtem todos os pedidos aprovados do cliente em específico
                orcamentos = OrcamentoService.getPedidos(boleto.IDCliente, null);
                model.ListaPedidosAberto = orcamentos.Select(p => new OrcamentoBoletoViewModel(getViewModel(p))).ToList();

                //Obtem os orçamentos já relacionados em outros boletos
                boleto.BoletosOrcamentos.ForEach(c => idOrcamentosRelacionados.Add(c.IDBoletoOrcamento));
                var idOrcamentosNaoRelacionados =
                    orcamentos.Where(
                        c => c.BoletosOrcamentos.Count(d => !idOrcamentosRelacionados.Contains(d.IDBoletoOrcamento)) > 0).Select(e => e.IDOrcamento).ToList();

                //Checa os que estão relacionados ao boleto
                model.ListaPedidosAberto = model.ListaPedidosAberto.GroupJoin(boleto.BoletosOrcamentos,
                                                                              pedido => pedido.IDOrcamento,
                                                                              pedidoSelecionado => pedidoSelecionado.IDOrcamento,
                                                                              (pedido, pedidoSelecionado) =>
                                                                              pedidoSelecionado.Select(ps => new OrcamentoBoletoViewModel(pedido, true))
                                                                              .DefaultIfEmpty(new OrcamentoBoletoViewModel(pedido, false)))
                                           .SelectMany(pedidoSelecionado => pedidoSelecionado).ToList();


                //Retira os pedidos que estão relacionados a outros boletos
                model.ListaPedidosAberto.RemoveAll(
                    c => c.IDOrcamento != null && (!c.IsSelected && idOrcamentosNaoRelacionados.Contains(c.IDOrcamento.Value)));
            }


            return(model);
        }
        public void Bradesco_Carteira_09_ArquivoRemessa()
        {
            Cedente objCEDENTE = new Cedente(
                "12345678000155",
                "TESTE",
                "1111",
                "11234",
                "1"
                );

            objCEDENTE.Codigo   = "123456";
            objCEDENTE.Convenio = 9;

            //Inst�ncia de Boleto
            Boleto objBOLETO = new Boleto();

            //O nosso-numero deve ser de 11 posi��es
            objBOLETO.EspecieDocumento = new EspecieDocumento(237, "12");
            objBOLETO.DataVencimento   = DateTime.Now.AddDays(10);
            objBOLETO.ValorBoleto      = 90;
            objBOLETO.Carteira         = "09";
            objBOLETO.NossoNumero      = ("00000012345");
            objBOLETO.Cedente          = objCEDENTE;
            //O n� do documento deve ser de 10 posi��es
            objBOLETO.NumeroDocumento = "1234567890";
            objBOLETO.NumeroControle  = "100";
            //A data do documento � a data de emiss�o do boleto
            objBOLETO.DataDocumento = DateTime.Now;
            //A data de processamento � a data em que foi processado o documento, portanto � da data de emiss�o do boleto
            objBOLETO.DataProcessamento      = DateTime.Now;
            objBOLETO.Sacado                 = new Sacado("12345678000255", "TESTE SACADO");
            objBOLETO.Sacado.Endereco.End    = "END SACADO";
            objBOLETO.Sacado.Endereco.Bairro = "BAIRRO SACADO";
            objBOLETO.Sacado.Endereco.Cidade = "CIDADE SACADO";
            objBOLETO.Sacado.Endereco.CEP    = "CEP SACADO";
            objBOLETO.Sacado.Endereco.UF     = "RR";

            objBOLETO.PercMulta = 10;
            objBOLETO.JurosMora = 5;

            // nao precisa desta parte no boleto do brasdesco.

            /*objBOLETO.Remessa = new Remessa()
             * {
             *  Ambiente = Remessa.TipoAmbiemte.Producao,
             *  CodigoOcorrencia = "01",
             * };*/

            Boletos objBOLETOS = new Boletos();

            objBOLETOS.Add(objBOLETO);

            var mem        = new MemoryStream();
            var objREMESSA = new ArquivoRemessa(TipoArquivo.CNAB400);

            objREMESSA.GerarArquivoRemessa("09", new Banco(237), objCEDENTE, objBOLETOS, mem, 1000);
        }
 /// <summary>
 /// Gera o arquivo de remessa
 /// </summary>
 public virtual void GerarArquivoRemessa(string numeroConvenio, IBanco banco, Cedente cedente, Boletos boletos, Stream arquivo, int numeroArquivoRemessa)
 {
     _banco                = banco;
     _cedente              = cedente;
     _boletos              = boletos;
     _numeroConvenio       = numeroConvenio;
     _numeroArquivoRemessa = numeroArquivoRemessa;
     _arquivoRemessa.GerarArquivoRemessa(numeroConvenio, banco, cedente, boletos, arquivo, numeroArquivoRemessa);
 }
Example #20
0
        public async Task <IActionResult> Create([Bind("BoletosID,Nombre,Precio,Fecha,Reserva")] Boletos boletos)
        {
            if (ModelState.IsValid)
            {
                _context.Add(boletos);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(boletos));
        }
Example #21
0
        public GerarBoleto()
        {
            boletos = new Boletos();

            CedenteBoleto cedenteB = new CedenteBoleto();

            cedenteB.RecCedente();

            //Cabeçalho
            boletos.Banco = Banco.Instancia(Convert.ToInt32(cedenteB.Id_Banco));

            if (cedenteB.Operador_Conta == null || cedenteB.Operador_Conta == string.Empty || cedenteB.Operador_Conta == "")
            {
                cedenteB.Operador_Conta = string.Empty;
            }


            boletos.Banco.Cedente = new Cedente
            {
                CPFCNPJ       = cedenteB.CPFCNPJ,
                Nome          = cedenteB.Beneficiario,
                Observacoes   = string.Empty,
                ContaBancaria = new ContaBancaria
                {
                    Agencia                = cedenteB.Id_Agencia,
                    DigitoAgencia          = "",
                    OperacaoConta          = cedenteB.Operador_Conta,
                    Conta                  = cedenteB.Id_Conta,
                    DigitoConta            = cedenteB.Digito_Conta,
                    CarteiraPadrao         = cedenteB.carteira,
                    VariacaoCarteiraPadrao = "",
                    TipoCarteiraPadrao     = TipoCarteira.CarteiraCobrancaSimples,
                    TipoFormaCadastramento = TipoFormaCadastramento.ComRegistro,
                    TipoImpressaoBoleto    = TipoImpressaoBoleto.Empresa,
                    TipoDocumento          = TipoDocumento.Tradicional
                },
                Codigo            = "10",
                CodigoDV          = "0",
                CodigoTransmissao = string.Empty,
                Endereco          = new Boleto2Net.Endereco
                {
                    LogradouroEndereco    = cedenteB.logradouro,
                    LogradouroNumero      = cedenteB.logradouroNumero,
                    LogradouroComplemento = "",
                    Bairro = cedenteB.bairro,
                    Cidade = cedenteB.cidade,
                    UF     = cedenteB.uf,
                    CEP    = cedenteB.cep
                }
            };

            boletos.Banco.FormataCedente();
        }
Example #22
0
        public void GeraArquivoCNAB240(IBanco banco, Cedente cedente, Boletos boletos)
        {
            saveFileDialog.Filter = "Arquivos de Retorno (*.rem)|*.rem|Todos Arquivos (*.*)|*.*";
            if (saveFileDialog.ShowDialog() == DialogResult.OK)
            {
                ArquivoRemessa arquivo = new ArquivoRemessa(TipoArquivo.CNAB240);
                arquivo.GerarArquivoRemessa("1200303001417053", banco, cedente, boletos, saveFileDialog.OpenFile(), 1);

                MessageBox.Show("Arquivo gerado com sucesso!", "Teste",
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Information);
            }
        }
Example #23
0
        internal static Boletos GerarBoletos(Banco banco, int quantidadeBoletos)
        {
            var boletos = new Boletos
            {
                Banco = banco
            };

            for (int i = 1; i <= quantidadeBoletos; i++)
            {
                boletos.Add(GerarBoleto(banco, i));
            }
            return(boletos);
        }
        internal static Boletos GerarBoletos(Banco banco, int quantidadeBoletos, string aceite)
        {
            var boletos = new Boletos
            {
                Banco = banco
            };

            for (var i = 1; i <= quantidadeBoletos; i++)
            {
                boletos.Add(GerarBoleto(banco, i, aceite));
            }
            return(boletos);
        }
Example #25
0
        internal static Boletos GerarBoletos(IBanco banco, int quantidadeBoletos, string aceite, int NossoNumeroInicial)
        {
            var boletos = new Boletos
            {
                Banco = banco
            };

            for (var i = 1; i <= quantidadeBoletos; i++)
            {
                boletos.Add(GerarBoleto(banco, i, aceite, NossoNumeroInicial));
            }
            return(boletos);
        }
Example #26
0
        public void GeraArquivoCNAB240(IBanco banco, Cedente cedente, Boletos boletos)
        {
            saveFileDialog.Filter = "Arquivos de Retorno (*.rem)|*.rem|Todos Arquivos (*.*)|*.*";
            if (saveFileDialog.ShowDialog() == DialogResult.OK)
            {
                ArquivoRemessa arquivo = new ArquivoRemessa(TipoArquivo.CNAB240);
                arquivo.GerarArquivoRemessa("1200303001417053", banco, cedente, boletos, saveFileDialog.OpenFile(), 1);

                MessageBox.Show("Arquivo gerado com sucesso!", "Teste",
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Information);
            }
        }
        public override void GerarArquivoRemessa(string numeroConvenio, IBanco banco, Cedente cedente, Boletos boletos, Stream arquivo, int numeroArquivoRemessa)
        {
            try
            {
                int numeroRegistro = 2;
                string strline;
                decimal vltitulostotal = 0;                 //Uso apenas no registro TRAILER do banco Santander - jsoda em 09/05/2012 - Add no registro TRAILER do banco Banrisul - sidneiklein em 08/08/2013

                StreamWriter incluiLinha = new StreamWriter(arquivo, Encoding.GetEncoding("ISO-8859-1"));
                cedente.Carteira = boletos[0].Carteira;
                strline = banco.GerarHeaderRemessa(numeroConvenio, cedente, TipoArquivo.CNAB400, numeroArquivoRemessa);
                incluiLinha.WriteLine(strline);

                foreach (Boleto boleto in boletos)
                {
                    boleto.Banco = banco;
                    strline = boleto.Banco.GerarDetalheRemessa(boleto, numeroRegistro, TipoArquivo.CNAB400);
                    incluiLinha.WriteLine(strline);
                    vltitulostotal += boleto.ValorBoleto;   //Uso apenas no registro TRAILER do banco Santander - jsoda em 09/05/2012 - Add no registro TRAILER do banco Banrisul - sidneiklein em 08/08/2013
                    numeroRegistro++;

                    // 85 - CECRED
                    if (banco.Codigo == 85) {
                        if (boleto.PercMulta > 0 || boleto.ValorMulta > 0) {
                            Banco_Cecred _banco = new Banco_Cecred();
                            string linhaCECREDRegistroDetalhe5 = _banco.GerarRegistroDetalhe5(boleto, numeroRegistro, TipoArquivo.CNAB400);
                            incluiLinha.WriteLine(linhaCECREDRegistroDetalhe5);
                            numeroRegistro++;
                        }
                    }
                    if ((boleto.Instrucoes != null && boleto.Instrucoes.Count > 0) || (boleto.Sacado.Instrucoes != null && boleto.Sacado.Instrucoes.Count > 0))
                    {
                        strline = boleto.Banco.GerarMensagemVariavelRemessa(boleto, ref numeroRegistro, TipoArquivo.CNAB400);
                        if (!string.IsNullOrEmpty(strline) && !string.IsNullOrWhiteSpace(strline))
                            incluiLinha.WriteLine(strline);
                    }
                }

                strline = banco.GerarTrailerRemessa(numeroRegistro, TipoArquivo.CNAB400, cedente, vltitulostotal);

                incluiLinha.WriteLine(strline);

                incluiLinha.Close();
                incluiLinha.Dispose(); // Incluido por Luiz Ponce 07/07/2012.
                incluiLinha = null; // Incluido por Luiz Ponce 07/07/2012.
            }
            catch (Exception ex)
            {
                throw new Exception("Erro ao gerar arquivo remessa.", ex);
            }
        }
        public ActionResult Edit(int id)
        {
            Boletos boleto = BoletoService.getBoleto(id);

            if (boleto == null)
            {
                this.addMensagemErro("Boleto não encontrado");
                return(RedirectToAction("Index", "Boleto"));
            }
            else
            {
                return(View(getViewModel(boleto, false)));
            }
        }
Example #29
0
        public void GeraDadosBancoDoNordeste()
        {
            ContaBancaria conta = new ContaBancaria();

            conta.Agencia       = "21";
            conta.DigitoAgencia = "0";
            conta.Conta         = "12717";
            conta.DigitoConta   = "8";

            Cedente c = new Cedente();

            c.ContaBancaria = conta;
            c.CPFCNPJ       = "00.000.000/0000-00";
            c.Nome          = "Empresa de Atacado";

            Boleto b = new Boleto();

            b.Cedente = c;
            //
            b.DataProcessamento = DateTime.Now;
            b.DataVencimento    = DateTime.Now.AddDays(15);
            b.ValorBoleto       = Convert.ToDecimal(1);
            b.Carteira          = "4";
            b.NossoNumero       = "7777777";
            b.NumeroDocumento   = "2525";
            //
            b.Sacado = new Sacado("000.000.000-00", "Fulano de Silva");
            b.Sacado.Endereco.End    = "SSS 154 Bloco J Casa 23";
            b.Sacado.Endereco.Bairro = "Testando";
            b.Sacado.Endereco.Cidade = "Testelândia";
            b.Sacado.Endereco.CEP    = "70000000";
            b.Sacado.Endereco.UF     = "RS";

            b.Banco = new Banco(004);

            EspecieDocumento especiedocumento = new EspecieDocumento(004, "1");//Duplicata Mercantil

            b.EspecieDocumento = especiedocumento;

            #region Dados para Remessa:
            b.Remessa = new Remessa();
            b.Remessa.TipoDocumento = "A";
            #endregion


            Boletos boletos = new Boletos();
            boletos.Add(b);

            GeraArquivoCNAB400(b.Banco, c, boletos);
        }
Example #30
0
        /// <summary>
        /// Processa o Retorno
        /// </summary>
        /// <param name="cData">TXT de entrada</param>
        public override Layout Retorno(string cData)
        {
            Layout retorno = new Layout(typeof(CNAB240SegmentoTSantander), typeof(CNAB240SegmentoUSantander));

            retorno.onInvalidLine += Retorno_onInvalidLine;
            retorno.Conteudo       = cData;
            BoletoInfo blt = null;

            retorno.ForEachIReg(ireg =>
            {
                if (ireg.NameType == typeof(CNAB240SegmentoTSantander))
                {
                    if (blt != null)
                    {
                        Boletos.Add(blt);
                    }

                    // Para registros Tipo T cria o boleto
                    var reg = ireg as Reg <CNAB240SegmentoTSantander>;
                    blt     = new BoletoInfo()
                    {
                        NossoNumero    = reg[CNAB240SegmentoTSantander.NossoNumero].ToString(),
                        ValorDocumento = (double)reg[CNAB240SegmentoTSantander.ValorDocumento],
                        DataVencimento = (DateTime)reg[CNAB240SegmentoTSantander.DataVencimento]
                                         //                        ValorPago = (double)reg[CNAB240SegmentoTSantander.ValorDocumento]
                    };
                    blt.LinhaOrigem = reg.OriginalLine;
                }
                else if (ireg.NameType == typeof(CNAB240SegmentoUSantander))
                {
                    // registros de outros tipos busca na lista de boletos existentes uma instancia válida para atualizar os dados complementares
                    var reg            = ireg as Reg <CNAB240SegmentoUSantander>;
                    blt.ValorAcrescimo = (double)reg[CNAB240SegmentoUSantander.ValorAcrescimos];
                    blt.ValorDesconto  = (double)reg[CNAB240SegmentoUSantander.ValorDesconto];
                    blt.ValorDesconto2 = (double)reg[CNAB240SegmentoUSantander.ValorAbatimento];
                    blt.ValorIOF       = (double)reg[CNAB240SegmentoUSantander.ValorIOF];
                    blt.ValorPago      = (double)reg[CNAB240SegmentoUSantander.ValorPago];
                    blt.ValorLiquido   = (double)reg[CNAB240SegmentoUSantander.ValorLiquido];
                    blt.DataPagamento  = blt.DataProcessamento = (DateTime)reg[CNAB240SegmentoUSantander.DataOcorrencia];
                    blt.DataCredito    = (DateTime)reg[CNAB240SegmentoUSantander.DataCredito];
                    blt.DataTarifa     = (DateTime)reg[CNAB240SegmentoUSantander.DataTarifa];
                }
            });
            if (blt != null)
            {
                Boletos.Add(blt);
            }
            return(retorno);
        }
Example #31
0
        public ActionResult DarBaixaBoleto(int id)
        {
            Boletos boleto = BoletoService.getBoleto(id);

            if (boleto != null)
            {
                boleto.Status = Convert.ToInt16(StatusBoleto.Pago);
            }

            BoletoService.saveBoleto(boleto);

            this.addMensagemSucesso("Boleto baixado com sucesso");

            return(RedirectToAction("Index", "Home"));
        }
        public ActionResult Delete(int id)
        {
            Boletos boleto = BoletoService.getBoleto(id);

            if (boleto != null)
            {
                BoletoService.deleteBoleto(boleto);
                this.addMensagemSucesso("Boleto excluído com sucesso");
            }
            else
            {
                this.addMensagemErro("Boleto não encontrado");
            }

            return(RedirectToAction("Index", "Boleto"));
        }
Example #33
0
        public byte[] GerarArquivoRemessa(BoletosViewModel models)
        {
            var boletos          = new Boletos();
            var boletoViewModels = models.Boletos;

            boletos.AddRange(boletoViewModels.Select(Popula));
            if (models.CodigoBanco != null)
            {
                boletos.Banco = Banco.Instancia(models.CodigoBanco.Value);
            }
            using (var ms = new MemoryStream())
            {
                var remessa = new ArquivoRemessa(boletos.Banco, TipoArquivo.CNAB400, 1);
                remessa.GerarArquivoRemessa(boletos, ms);
                ms.Position = 0;
                using (var lerArquivo = new StreamReader(ms))
                {
                    var    sbRefazArquivo = new StringBuilder();
                    string strTexto;
                    int    conta;
                    while (lerArquivo.Peek() != -1)
                    {
                        strTexto = lerArquivo.ReadLine();
                        if (strTexto != null)
                        {
                            conta = strTexto.Length;
                            if (conta < 240)
                            {
                                conta = 240 - conta;
                                string strEspaco = null;
                                for (int I = 1; I <= conta; I++)
                                {
                                    strEspaco = strEspaco + " ";
                                }
                                sbRefazArquivo.AppendLine(strTexto + strEspaco);
                            }
                            else
                            {
                                sbRefazArquivo.AppendLine(strTexto);
                            }
                        }
                    }

                    return(sbRefazArquivo.ToString().ToBytes());
                }
            }
        }
Example #34
0
        /// <summary>
        /// Processa o Retorno
        /// </summary>
        /// <param name="cData">TXT de entrada</param>
        public override Layout Retorno(string cData)
        {
            Layout retorno = new Layout(typeof(CNAB240SegmentoTSicoob));

            retorno.onInvalidLine += Retorno_onInvalidLine;
            retorno.Conteudo       = cData;
            retorno.ForEach <CNAB240SegmentoTSicoob>(reg =>
                                                     Boletos.Add(new BoletoInfo()
            {
                NossoNumero    = reg[CNAB240SegmentoTSicoob.NossoNumero].ToString(),
                ValorDocumento = (double)reg[CNAB240SegmentoTSicoob.ValorDocumento],
                DataVencimento = (DateTime)reg[CNAB240SegmentoTSicoob.DataVencimento],
                ValorPago      = (double)reg[CNAB240SegmentoTSicoob.ValorDocumento],
            }, reg.OriginalLine)
                                                     );
            return(retorno);
        }
Example #35
0
        public void saveBoleto(Boletos boleto)
        {
            if (boleto.IDBoleto == 0)
            {
                boleto.DataCriacao = DateTime.Now;
                boleto             = MarteUpdatesContext.Boletos.Add(boleto);
                MarteUpdatesContext.SaveChanges();
            }
            else
            {
                boleto.DataModificacao = DateTime.Now;

                MarteUpdatesContext.Boletos.Attach(boleto);
                MarteUpdatesContext.Entry(boleto).State = EntityState.Modified;
                MarteUpdatesContext.SaveChanges();
            }
        }
Example #36
0
        /// <summary>
        /// Processa as informações baseado no conteudo de um arquivo CNAB
        /// </summary>
        /// <param name="cData">Conteudo do arquivo</param>
        public override Layout Retorno(string cData)
        {
            Layout retorno = new Layout(typeof(CNAB400Retorno7BB));

            retorno.onInvalidLine += Retorno_onInvalidLine;
            retorno.Conteudo       = cData;
            retorno.ForEach <CNAB400Retorno7BB>(reg =>
                                                Boletos.Add(new BoletoInfo()
            {
                NossoNumero     = (string)reg[CNAB400Retorno7BB.NossoNumero],
                NumeroDocumento = (string)reg[CNAB400Retorno7BB.NumeroDocumento],
                ValorDocumento  = (double)reg[CNAB400Retorno7BB.ValorDocumento],
                DataVencimento  = (DateTime)reg[CNAB400Retorno7BB.DataVencimento],
                DataPagamento   = (DateTime)reg[CNAB400Retorno7BB.DataPagamento]
            }, reg.OriginalLine)
                                                );
            return(retorno);
        }
Example #37
0
        public void GeraDadosSicredi()
        {
            ContaBancaria conta = new ContaBancaria();
            conta.Agencia = "051";
            conta.DigitoAgencia = "2";
            conta.Conta = "13000";
            conta.DigitoConta = "3";
            //
            Cedente c = new Cedente();
            c.ContaBancaria = conta;
            c.CPFCNPJ = "00000000000000";
            c.Nome = "Empresa de Atacado";
            //Na carteira 198 o código do Cedente é a conta bancária
            c.Codigo = "12345";//No Banrisul, esse código está no manual como 12 caracteres, por eu(sidneiklein) isso tive que alterar o tipo de int para string;
            c.Convenio = 124522;
            //
            Boleto b = new Boleto();
            b.Cedente = c;
            //
            b.DataProcessamento = DateTime.Now;
            b.DataVencimento = DateTime.Now.AddDays(15);
            b.ValorBoleto = Convert.ToDecimal(2469.69);
            b.Carteira = "1";
            b.VariacaoCarteira = "02";
            b.NossoNumero = string.Empty; //"92082835"; //** Para o "Remessa.TipoDocumento = "06", não poderá ter NossoNúmero Gerado!
            b.NumeroDocumento = "1008073";
            //
            b.Sacado = new Sacado("000.000.000-00", "Fulano de Silva");
            b.Sacado.Endereco.End = "SSS 154 Bloco J Casa 23";
            b.Sacado.Endereco.Bairro = "Testando";
            b.Sacado.Endereco.Cidade = "Testelândia";
            b.Sacado.Endereco.CEP = "70000000";
            b.Sacado.Endereco.UF = "RS";

            Instrucao_Sicredi item1 = new Instrucao_Sicredi(9, 5);
            b.Instrucoes.Add(item1);
            //b.Instrucoes.Add(item2);
            b.Banco = new Banco(748);

            //
            EspecieDocumento especiedocumento = new EspecieDocumento(748, "A");//(341, 1);
            b.EspecieDocumento = especiedocumento;


            #region Dados para Remessa:
            b.Remessa = new Remessa();
            b.Remessa.TipoDocumento = "A"; //A = 'A' - SICREDI com Registro
            #endregion

            //
            Boletos boletos = new Boletos();
            boletos.Add(b);

            GeraArquivoCNAB400(b.Banco, c, boletos);
        }
 /// <summary>
 /// Efetua as Validações dentro da classe Boleto, para garantir a geração da remessa
 /// </summary>
 public override bool ValidarRemessa(TipoArquivo tipoArquivo, string numeroConvenio, IBanco banco, Cedente cedente, Boletos boletos, int numeroArquivoRemessa, out string mensagem)
 {
     throw new NotImplementedException("Remessa não implementada!");
 }
 public bool ValidarRemessaCNAB400(string numeroConvenio, IBanco banco, Cedente cedente, Boletos boletos, int numeroArquivoRemessa, out string mensagem)
 {
     throw new NotImplementedException("Função não implementada.");
 }
Example #40
0
        /// <summary>
        /// Efetua as Validações dentro da classe Boleto, para garantir a geração da remessa
        /// </summary>
        public override bool ValidarRemessa(TipoArquivo tipoArquivo, string numeroConvenio, IBanco banco, Cedente cedente, Boletos boletos, int numeroArquivoRemessa, out string mensagem)
        {
            bool vRetorno = true;
            string vMsg = string.Empty;
            ////IMPLEMENTACAO PENDENTE...

            //validando endereços
            foreach (var boleto in boletos)
            {
                if (boleto.Sacado.Endereco != null && !string.IsNullOrEmpty(boleto.Sacado.Endereco.End) &&
                    !string.IsNullOrEmpty(boleto.Sacado.Endereco.Cidade) &&
                    !string.IsNullOrEmpty(boleto.Sacado.Endereco.UF) &&
                    !string.IsNullOrEmpty(boleto.Sacado.Endereco.CEP)) continue;

                vMsg = string.Format("Endereço do Pagador {0} no boleto {1} inválido", boleto.Sacado.Nome, boleto.NumeroDocumento);
                vRetorno = false;
                break;
            }

            mensagem = vMsg;
            return vRetorno;
        }
Example #41
0
        //
        public void GeraDadosItau()
        {
            DateTime vencimento = new DateTime(2007, 9, 10);

            Instrucao_Itau item1 = new Instrucao_Itau(9, 5);
            Instrucao_Itau item2 = new Instrucao_Itau(81, 10);
            Cedente c = new Cedente("00.000.000/0000-00", "Empresa de Atacado", "0542", "13000");
            //Na carteira 198 o código do Cedente é a conta bancária
            c.Codigo = "13000";

            Boleto b = new Boleto(vencimento, 1642, "198", "92082835", c);
            b.NumeroDocumento = "1008073";

            b.DataVencimento = Convert.ToDateTime("12-12-12");

            b.Sacado = new Sacado("000.000.000-00", "Fulano de Silva");
            b.Sacado.Endereco.End = "SSS 154 Bloco J Casa 23";
            b.Sacado.Endereco.Bairro = "Testando";
            b.Sacado.Endereco.Cidade = "Testelândia";
            b.Sacado.Endereco.CEP = "70000000";
            b.Sacado.Endereco.UF = "DF";

            item2.Descricao += item2.QuantidadeDias.ToString() + " dias corridos do vencimento.";
            b.Instrucoes.Add(item1);
            b.Instrucoes.Add(item2);
            b.Cedente.ContaBancaria.DigitoAgencia = "1";
            b.Cedente.ContaBancaria.DigitoAgencia = "2";

            b.Banco = new Banco(341);

            Boletos boletos = new Boletos();
            boletos.Add(b);

            Boleto b2 = new Boleto(vencimento, 1642, "198", "92082835", c);
            b2.NumeroDocumento = "1008073";

            b2.DataVencimento = Convert.ToDateTime("12-12-12");

            b2.Sacado = new Sacado("000.000.000-00", "Fulano de Silva");
            b2.Sacado.Endereco.End = "SSS 154 Bloco J Casa 23";
            b2.Sacado.Endereco.Bairro = "Testando";
            b2.Sacado.Endereco.Cidade = "Testelândia";
            b2.Sacado.Endereco.CEP = "70000000";
            b2.Sacado.Endereco.UF = "DF";

            item2.Descricao += item2.QuantidadeDias.ToString() + " dias corridos do vencimento.";
            b2.Instrucoes.Add(item1);
            b2.Instrucoes.Add(item2);
            b2.Cedente.ContaBancaria.DigitoAgencia = "1";
            b2.Cedente.ContaBancaria.DigitoAgencia = "2";

            b2.Banco = new Banco(341);

            boletos.Add(b2);

            GeraArquivoCNAB400(b2.Banco, c, boletos);
        }
Example #42
0
 public bool ValidarRemessaCNAB400(string numeroConvenio, IBanco banco, Cedente cedente, Boletos boletos, int numeroArquivoRemessa, out string mensagem)
 {
     bool vRetorno = true;
     string vMsg = string.Empty;
     //
     #region Pré Validações
     if (banco == null)
     {
         vMsg += String.Concat("Remessa: O Banco é Obrigatório!", Environment.NewLine);
         vRetorno = false;
     }
     if (cedente == null)
     {
         vMsg += String.Concat("Remessa: O Cedente/Beneficiário é Obrigatório!", Environment.NewLine);
         vRetorno = false;
     }
     if (boletos == null || boletos.Count.Equals(0))
     {
         vMsg += String.Concat("Remessa: Deverá existir ao menos 1 boleto para geração da remessa!", Environment.NewLine);
         vRetorno = false;
     }
     #endregion
     mensagem = vMsg;
     return vRetorno;
 }
Example #43
0
 /// <summary>
 /// Efetua as Validações dentro da classe Boleto, para garantir a geração da remessa
 /// </summary>
 public override bool ValidarRemessa(TipoArquivo tipoArquivo, string numeroConvenio, IBanco banco, Cedente cedente, Boletos boletos, int numeroArquivoRemessa, out string mensagem)
 {
     bool vRetorno = true;
     string vMsg = string.Empty;
     ////IMPLEMENTACAO PENDENTE...
     mensagem = vMsg;
     return vRetorno;
 }
Example #44
0
        public bool ValidarRemessaCNAB400(string numeroConvenio, IBanco banco, Cedente cedente, Boletos boletos, int numeroArquivoRemessa, out string mensagem)
        {
            bool vRetorno = true;
            string vMsg = string.Empty;
            //
            #region Pré Validações
            if (banco == null)
            {
                vMsg += String.Concat("Remessa: O Banco é Obrigatório!", Environment.NewLine);
                vRetorno = false;
            }
            if (cedente == null)
            {
                vMsg += String.Concat("Remessa: O Cedente/Beneficiário é Obrigatório!", Environment.NewLine);
                vRetorno = false;
            }
            if (boletos == null || boletos.Count.Equals(0))
            {
                vMsg += String.Concat("Remessa: Deverá existir ao menos 1 boleto para geração da remessa!", Environment.NewLine);
                vRetorno = false;
            }
            #endregion
            //
            foreach (Boleto boleto in boletos)
            {
                #region Validação de cada boleto
                if (boleto.Remessa == null)
                {
                    vMsg += String.Concat("Boleto: ", boleto.NumeroDocumento, "; Remessa: Informe as diretrizes de remessa!", Environment.NewLine);
                    vRetorno = false;
                }
                if (boleto.Sacado == null)
                {
                    vMsg += String.Concat("Boleto: ", boleto.NumeroDocumento, "; Sacado: Informe os dados do sacado!", Environment.NewLine);
                    vRetorno = false;
                }
                else
                {
                    if (boleto.Sacado.Nome == null)
                    {
                        vMsg += String.Concat("Boleto: ", boleto.NumeroDocumento, "; Nome: Informe o nome do sacado!", Environment.NewLine);
                        vRetorno = false;
                    }

                    if (boleto.Sacado.CPFCNPJ == null || boleto.Sacado.CPFCNPJ == "")
                    {
                        vMsg += String.Concat("Boleto: ", boleto.NumeroDocumento, "; CPF/CNPJ: Informe o CPF ou CNPJ do sacado!", Environment.NewLine);
                        vRetorno = false;
                    }

                    if (boleto.Sacado.Endereco == null)
                    {
                        vMsg += String.Concat("Boleto: ", boleto.NumeroDocumento, "; Endereço: Informe o endereço do sacado!", Environment.NewLine);
                        vRetorno = false;
                    }
                    else
                    {
                        if (boleto.Sacado.Endereco.End == null || boleto.Sacado.Endereco.End == "")
                        {
                            vMsg += String.Concat("Boleto: ", boleto.NumeroDocumento, "; Endereço: Informe o Endereço do sacado!", Environment.NewLine);
                            vRetorno = false;
                        }
                        if (boleto.Sacado.Endereco.Bairro == null || boleto.Sacado.Endereco.Bairro == "")
                        {
                            vMsg += String.Concat("Boleto: ", boleto.NumeroDocumento, "; Endereço: Informe o Bairro do sacado!", Environment.NewLine);
                            vRetorno = false;
                        }
                        if (boleto.Sacado.Endereco.CEP == null || boleto.Sacado.Endereco.CEP == "" || boleto.Sacado.Endereco.CEP == "00000000")
                        {
                            vMsg += String.Concat("Boleto: ", boleto.NumeroDocumento, "; Endereço: Informe o CEP do sacado!", Environment.NewLine);
                            vRetorno = false;
                        }
                        if (boleto.Sacado.Endereco.Cidade == null || boleto.Sacado.Endereco.Cidade == "")
                        {
                            vMsg += String.Concat("Boleto: ", boleto.NumeroDocumento, "; Endereço: Informe a cidade do sacado!", Environment.NewLine);
                            vRetorno = false;
                        }
                        if (boleto.Sacado.Endereco.UF == null || boleto.Sacado.Endereco.UF == "")
                        {
                            vMsg += String.Concat("Boleto: ", boleto.NumeroDocumento, "; Endereço: Informe a UF do sacado!", Environment.NewLine);
                            vRetorno = false;
                        }
                    }
                }

                #region OLD
                //else
                //{
                //    //#region Validações da Remessa que deverão estar preenchidas quando CAIXA
                //    //if (String.IsNullOrEmpty(boleto.Remessa.Ambiente))
                //    //{

                //    //    vMsg += String.Concat("Boleto: ", boleto.NumeroDocumento, "; Remessa: Informe o Tipo Documento!", Environment.NewLine);
                //    //    vRetorno = false;
                //    //}

                //    //#endregion
                //}
                #endregion OLD

                #endregion
            }
            //
            mensagem = vMsg;
            return vRetorno;
        }
Example #45
0
 public bool ValidarRemessaCNAB240(string numeroConvenio, IBanco banco, Cedente cedente, Boletos boletos, int numeroArquivoRemessa, out string mensagem)
 {
     string vMsg = string.Empty;
     mensagem = vMsg;
     return true;
     //throw new NotImplementedException("Função não implementada.");
 }
Example #46
0
        public bool ValidarRemessaCNAB400(string numeroConvenio, IBanco banco, Cedente cedente, Boletos boletos, int numeroArquivoRemessa, out string mensagem)
        {
            bool vRetorno = true;
            string vMsg = string.Empty;
            //
            #region Pré Validações
            if (banco == null)
            {
                vMsg += String.Concat("Remessa: O Banco é Obrigatório!", Environment.NewLine);
                vRetorno = false;
            }
            if (cedente == null)
            {
                vMsg += String.Concat("Remessa: O Cedente/Beneficiário é Obrigatório!", Environment.NewLine);
                vRetorno = false;
            }
            if (boletos == null || boletos.Count.Equals(0))
            {
                vMsg += String.Concat("Remessa: Deverá existir ao menos 1 boleto para geração da remessa!", Environment.NewLine);
                vRetorno = false;
            }
            #endregion
            //
            foreach (Boleto boleto in boletos)
            {
                #region Validação de cada boleto
                if (boleto.Remessa == null)
                {
                    vMsg += String.Concat("Boleto: ", boleto.NumeroDocumento, "; Remessa: Informe as diretrizes de remessa!", Environment.NewLine);
                    vRetorno = false;
                }
                else
                {
                    #region Validações da Remessa que deverão estar preenchidas quando BANRISUL
                    //Comentado porque ainda está fixado em 01
                    //if (String.IsNullOrEmpty(boleto.Remessa.CodigoOcorrencia))
                    //{
                    //    vMsg += String.Concat("Boleto: ", boleto.NumeroDocumento, "; Remessa: Informe o Código de Ocorrência!", Environment.NewLine);
                    //    vRetorno = false;
                    //}
                    if (String.IsNullOrEmpty(boleto.Remessa.TipoDocumento))
                    {
                        vMsg += String.Concat("Boleto: ", boleto.NumeroDocumento, "; Remessa: Informe o Tipo Documento!", Environment.NewLine);
                        vRetorno = false;
                    }
                    else if (boleto.Remessa.TipoDocumento.Equals("06") && !String.IsNullOrEmpty(boleto.NossoNumero))
                    {
                        //Para o "Remessa.TipoDocumento = "06", não poderá ter NossoNumero Gerado!
                        vMsg += String.Concat("Boleto: ", boleto.NumeroDocumento, "; Não pode existir NossoNumero para o Tipo Documento '06 - cobrança escritural'!", Environment.NewLine);
                        vRetorno = false;
                    }

                    //Para o Tipo
                    #endregion
                }
                #endregion
            }
            //
            mensagem = vMsg;
            return vRetorno;
        }
Example #47
0
 public override bool ValidarRemessa(TipoArquivo tipoArquivo, string numeroConvenio, IBanco banco, Cedente cedente, Boletos boletos, int numeroArquivoRemessa, out string mensagem)
 {
     try
     {
         return _IBanco.ValidarRemessa(tipoArquivo, numeroConvenio, _IBanco, cedente, boletos, numeroArquivoRemessa, out mensagem);
     }
     catch (Exception ex)
     {
         throw new Exception("Erro durante a validação do arquivo de REMESSA.", ex);
     }
 }
        public override void GerarArquivoRemessa(string numeroConvenio, IBanco banco, Cedente cedente, Boletos boletos, Stream arquivo, int numeroArquivoRemessa)
        {
            try
            {
                int numeroRegistro = 0;
                int numeroRegistroDetalhe = 1;
                string strline;
                StreamWriter incluiLinha = new StreamWriter(arquivo);
                if (banco.Codigo == 104)//quando é caixa verifica o modelo de leiatue que é está em boletos.remssa.tipodocumento
                    strline = banco.GerarHeaderRemessa(numeroConvenio, cedente, TipoArquivo.CNAB240, numeroArquivoRemessa, boletos[0]);
                else
                    strline = banco.GerarHeaderRemessa(numeroConvenio, cedente, TipoArquivo.CNAB240, numeroArquivoRemessa);

                numeroRegistro++;

                //
                incluiLinha.WriteLine(strline);
                OnLinhaGerada(null, strline, EnumTipodeLinha.HeaderDeArquivo);
                if (banco.Codigo == 104)//quando é caixa verifica o modelo de leiatue que é está em boletos.remssa.tipodocumento
                    strline = banco.GerarHeaderLoteRemessa(numeroConvenio, cedente, numeroArquivoRemessa, TipoArquivo.CNAB240, boletos[0]);
                else
                    strline = banco.GerarHeaderLoteRemessa(numeroConvenio, cedente, numeroArquivoRemessa, TipoArquivo.CNAB240);

                if (strline != "")
                {
                    incluiLinha.WriteLine(strline);
                    OnLinhaGerada(null, strline, EnumTipodeLinha.HeaderDeLote);
                    numeroRegistro++;
                }
                

                if (banco.Codigo == 341)
                {
                    #region se Banco Itau - 341
                    foreach (Boleto boleto in boletos)
                    {
                        boleto.Banco = banco;
                        strline = boleto.Banco.GerarDetalheRemessa(boleto, numeroRegistroDetalhe, TipoArquivo.CNAB240);
                        incluiLinha.WriteLine(strline);
                        OnLinhaGerada(boleto, strline, EnumTipodeLinha.DetalheSegmentoP);
                        numeroRegistro++;
                        numeroRegistroDetalhe++;
                    }

                    numeroRegistro--;
                    strline = banco.GerarTrailerLoteRemessa(numeroRegistro);
                    incluiLinha.WriteLine(strline);
                    OnLinhaGerada(null, strline, EnumTipodeLinha.TraillerDeLote);

                    numeroRegistro++;

                    strline = banco.GerarTrailerArquivoRemessa(numeroRegistro);
                    incluiLinha.WriteLine(strline);
                    OnLinhaGerada(null, strline, EnumTipodeLinha.TraillerDeArquivo);

                    incluiLinha.Close();
                    #endregion
                }
                else if (banco.Codigo == 104) // Só validar boleto.Remessa quando o banco for Caixa porque quando o banco for diferente de 104 a propriedade "Remessa" fica null
                {                    
                    #region se Banco Caixa - 104 e tipo de arquivo da remessa SIGCB
                    if ((boletos[0].Remessa.TipoDocumento.Equals("2")) || boletos[0].Remessa.TipoDocumento.Equals("1"))
                    {
                        foreach (Boleto boleto in boletos)
                        {
                            boleto.Banco = banco;
                            strline = boleto.Banco.GerarDetalheSegmentoPRemessa(boleto, numeroRegistroDetalhe, numeroConvenio, cedente);
                            incluiLinha.WriteLine(strline);
                            OnLinhaGerada(boleto, strline, EnumTipodeLinha.DetalheSegmentoP);
                            numeroRegistro++;
                            numeroRegistroDetalhe++;

                            strline = boleto.Banco.GerarDetalheSegmentoQRemessa(boleto, numeroRegistroDetalhe, boleto.Sacado);
                            incluiLinha.WriteLine(strline);
                            OnLinhaGerada(boleto, strline, EnumTipodeLinha.DetalheSegmentoQ);
                            numeroRegistro++;
                            numeroRegistroDetalhe++;
                            //segmento R não implementado...
                            //if (boleto.ValorMulta > 0)
                            //{
                            //    strline = boleto.Banco.GerarDetalheSegmentoRRemessa(boleto, numeroRegistroDetalhe, TipoArquivo.CNAB240);
                            //    incluiLinha.WriteLine(strline);
                            //    OnLinhaGerada(boleto, strline, EnumTipodeLinha.DetalheSegmentoR);
                            //    numeroRegistro++;
                            //    numeroRegistroDetalhe++;
                            //}
                        }

                        numeroRegistro--;
                        strline = banco.GerarTrailerLoteRemessa(numeroRegistro, boletos[0]);
                        incluiLinha.WriteLine(strline);
                        OnLinhaGerada(null, strline, EnumTipodeLinha.TraillerDeLote);

                        numeroRegistro++;
                        numeroRegistro++;

                        strline = banco.GerarTrailerArquivoRemessa(numeroRegistro, boletos[0]);
                        incluiLinha.WriteLine(strline);
                        OnLinhaGerada(null, strline, EnumTipodeLinha.TraillerDeArquivo);

                        incluiLinha.Close();
                    }
                    #endregion
                }
                else if (banco.Codigo == 33)
                {
                    #region se Banco Santander - 33
                    foreach (Boleto boleto in boletos)
                    {
                        boleto.Banco = banco;
                        boleto.Remessa.NumeroLote = numeroArquivoRemessa;

                        strline = boleto.Banco.GerarDetalheSegmentoPRemessa(boleto, numeroRegistroDetalhe, numeroConvenio);

                        incluiLinha.WriteLine(strline);
                        OnLinhaGerada(boleto, strline, EnumTipodeLinha.DetalheSegmentoP);
                        numeroRegistro++;
                        numeroRegistroDetalhe++;

                        strline = boleto.Banco.GerarDetalheSegmentoQRemessa(boleto, numeroRegistroDetalhe, TipoArquivo.CNAB240);
                        incluiLinha.WriteLine(strline);
                        OnLinhaGerada(boleto, strline, EnumTipodeLinha.DetalheSegmentoQ);
                        numeroRegistro++;
                        numeroRegistroDetalhe++;

                        if (boleto.ValorMulta > 0 || boleto.OutrosDescontos > 0 || boleto.PercMulta > 0)
                        {
                            strline = boleto.Banco.GerarDetalheSegmentoRRemessa(boleto, numeroRegistroDetalhe, TipoArquivo.CNAB240);
                            incluiLinha.WriteLine(strline);
                            OnLinhaGerada(boleto, strline, EnumTipodeLinha.DetalheSegmentoR);
                            numeroRegistro++;
                            numeroRegistroDetalhe++;
                        }

                        strline = boleto.Banco.GerarDetalheSegmentoSRemessa(boleto, numeroRegistroDetalhe, TipoArquivo.CNAB240);
                        incluiLinha.WriteLine(strline);
                        OnLinhaGerada(boleto, strline, EnumTipodeLinha.DetalheSegmentoS);
                        numeroRegistro++;
                        numeroRegistroDetalhe++;
                    }


                    numeroRegistro--;
                    strline = banco.GerarTrailerLoteRemessa(numeroRegistro);
                    incluiLinha.WriteLine(strline);
                    OnLinhaGerada(null, strline, EnumTipodeLinha.TraillerDeLote);

                    numeroRegistro++;
                    numeroRegistro++;

                    strline = banco.GerarTrailerArquivoRemessa(numeroRegistro);
                    incluiLinha.WriteLine(strline);
                    OnLinhaGerada(null, strline, EnumTipodeLinha.TraillerDeArquivo);

                    incluiLinha.Close();
                    #endregion
                }
                else if (banco.Codigo == 237) // bradesco
                {
                    decimal totalTitulos = 0;
                    foreach (Boleto boleto in boletos)
                    {
                        boleto.Banco = banco;
                        strline = boleto.Banco.GerarDetalheSegmentoARemessa(boleto, numeroRegistroDetalhe);
                        incluiLinha.WriteLine(strline);
                        OnLinhaGerada(boleto, strline, EnumTipodeLinha.DetalheSegmentoP);
                        numeroRegistro++;
                        numeroRegistroDetalhe++;

                        strline = boleto.Banco.GerarDetalheSegmentoBRemessa(boleto, numeroRegistroDetalhe);
                        incluiLinha.WriteLine(strline);
                        OnLinhaGerada(boleto, strline, EnumTipodeLinha.DetalheSegmentoP);
                        numeroRegistro++;
                        numeroRegistroDetalhe++;

                        totalTitulos += boleto.ValorBoleto;

                    }
                    numeroRegistro++;
                
                    strline = banco.GerarTrailerRemessaComDetalhes(numeroRegistro, boletos.Count,  TipoArquivo.CNAB240, cedente, totalTitulos);
                    incluiLinha.WriteLine(strline);
                    OnLinhaGerada(null, strline, EnumTipodeLinha.TraillerDeArquivo);

                    incluiLinha.Close();

                }
                else //para qualquer outro banco, gera CNAB240 com segmentos abaixo
                {
                    #region outros bancos
                    foreach (Boleto boleto in boletos)
                    {
                        boleto.Banco = banco;
                        strline = boleto.Banco.GerarDetalheSegmentoPRemessa(boleto, numeroRegistroDetalhe, numeroConvenio);
                        incluiLinha.WriteLine(strline);
                        OnLinhaGerada(boleto, strline, EnumTipodeLinha.DetalheSegmentoP);
                        numeroRegistro++;
                        numeroRegistroDetalhe++;

                        strline = boleto.Banco.GerarDetalheSegmentoQRemessa(boleto, numeroRegistroDetalhe, TipoArquivo.CNAB240);
                        incluiLinha.WriteLine(strline);
                        OnLinhaGerada(boleto, strline, EnumTipodeLinha.DetalheSegmentoQ);
                        numeroRegistro++;
                        numeroRegistroDetalhe++;

                        if (boleto.PercMulta > 0 || boleto.ValorMulta > 0)
                        {
                            strline = boleto.Banco.GerarDetalheSegmentoRRemessa(boleto, numeroRegistroDetalhe, TipoArquivo.CNAB240);
                            incluiLinha.WriteLine(strline);
                            OnLinhaGerada(boleto, strline, EnumTipodeLinha.DetalheSegmentoR);
                            numeroRegistro++;
                            numeroRegistroDetalhe++;
                        }
                    }


                    numeroRegistro--;
                    strline = banco.GerarTrailerLoteRemessa(numeroRegistro);
                    incluiLinha.WriteLine(strline);
                    OnLinhaGerada(null, strline, EnumTipodeLinha.TraillerDeLote);

                    numeroRegistro++;
                    numeroRegistro++;

                    strline = banco.GerarTrailerArquivoRemessa(numeroRegistro);
                    incluiLinha.WriteLine(strline);
                    OnLinhaGerada(null, strline, EnumTipodeLinha.TraillerDeArquivo);

                    incluiLinha.Close();
                    #endregion
                }

            }
            catch (Exception ex)
            {
                throw new Exception("Erro ao gerar arquivo remessa.", ex);
            }
        }
Example #49
0
        /// <summary>
        /// Efetua as Validações dentro da classe Boleto, para garantir a geração da remessa
        /// </summary>
        public override bool ValidarRemessa(TipoArquivo tipoArquivo, string numeroConvenio, IBanco banco, Cedente cedente, Boletos boletos, int numeroArquivoRemessa, out string mensagem)
        {
            bool vRetorno = true;
            string vMsg = string.Empty;
            ////IMPLEMENTACAO PENDENTE...

            cedente.ContaBancaria.DigitoConta = Mod10(cedente.ContaBancaria.Agencia + cedente.ContaBancaria.Conta).ToString();

            mensagem = vMsg;
            return vRetorno;
        }
Example #50
0
 public virtual bool ValidarRemessa(TipoArquivo tipoArquivo, string numeroConvenio, IBanco banco, Cedente cedente, Boletos boletos, int numeroArquivoRemessa, out string mensagem)
 {
     throw new NotImplementedException("Função não implementada na classe filha. Implemente na classe que está sendo criada.");
 }
Example #51
0
 public bool ValidarRemessaCNAB400(string numeroConvenio, IBanco banco, Cedente cedente, Boletos boletos, int numeroArquivoRemessa, out string mensagem)
 {
     bool vRetorno = true;
     string vMsg = string.Empty;
     //
     #region Pré Validações
     if (banco == null)
     {
         vMsg += String.Concat("Remessa: O Banco é Obrigatório!", Environment.NewLine);
         vRetorno = false;
     }
     if (cedente == null)
     {
         vMsg += String.Concat("Remessa: O Cedente/Beneficiário é Obrigatório!", Environment.NewLine);
         vRetorno = false;
     }
     if (boletos == null || boletos.Count.Equals(0))
     {
         vMsg += String.Concat("Remessa: Deverá existir ao menos 1 boleto para geração da remessa!", Environment.NewLine);
         vRetorno = false;
     }
     #endregion
     //
     foreach (Boleto boleto in boletos)
     {
         #region Validação de cada boleto
         if (boleto.Remessa == null)
         {
             vMsg += String.Concat("Boleto: ", boleto.NumeroDocumento, "; Remessa: Informe as diretrizes de remessa!", Environment.NewLine);
             vRetorno = false;
         }
         else
         {
             #region Validações da Remessa que deverão estar preenchidas quando BANCO DO BRASIL
             if (String.IsNullOrEmpty(boleto.Remessa.TipoDocumento))
             {
                 vMsg += String.Concat("Boleto: ", boleto.NumeroDocumento, "; Remessa: Informe o Tipo Documento!", Environment.NewLine);
                 vRetorno = false;
             }
             #endregion
         }
         #endregion
     }
     //
     mensagem = vMsg;
     return vRetorno;
 }
Example #52
0
        public void GeraDadosSantander()
        {
            Boletos boletos = new Boletos();

            DateTime vencimento = new DateTime(2003, 5, 15);

            Cedente c = new Cedente("00.000.000/0000-00", "Empresa de Atacado", "2269", "130000946");
            c.Codigo = "1795082";

            Boleto b = new Boleto(vencimento, 0.20m, "101", "566612457800", c);

            //NOSSO NÚMERO
            //############################################################################################################################
            //Número adotado e controlado pelo Cliente, para identificar o título de cobrança.
            //Informação utilizada pelos Bancos para referenciar a identificação do documento objeto de cobrança.
            //Poderá conter número da duplicata, no caso de cobrança de duplicatas, número de apólice, no caso de cobrança de seguros, etc.
            //Esse campo é devolvido no arquivo retorno.
            b.NumeroDocumento = "0282033";

            b.Sacado = new Sacado("000.000.000-00", "Fulano de Silva");
            b.Sacado.Endereco.End = "SSS 154 Bloco J Casa 23";
            b.Sacado.Endereco.Bairro = "Testando";
            b.Sacado.Endereco.Cidade = "Testelândia";
            b.Sacado.Endereco.CEP = "70000000";
            b.Sacado.Endereco.UF = "DF";

            //b.Instrucoes.Add("Não Receber após o vencimento");
            //b.Instrucoes.Add("Após o Vencimento pague somente no Bradesco");
            //b.Instrucoes.Add("Instrução 2");
            //b.Instrucoes.Add("Instrução 3");

            //Espécie Documento - [R] Recibo
            b.EspecieDocumento = new EspecieDocumento_Santander("17");

            boletos.Add(b);

            GeraArquivoCNAB240(new Banco(33), c, boletos);
        }
Example #53
0
        public void Bradesco_Carteira_09_ArquivoRemessa()
        {
            Cedente objCEDENTE = new Cedente(
               "12345678000155",
               "TESTE",
               "1111",
               "11234",
               "1"
               );
            objCEDENTE.Codigo = "123456";
            objCEDENTE.Convenio = 9;

            //Inst�ncia de Boleto
            Boleto objBOLETO = new Boleto();
            //O nosso-numero deve ser de 11 posi��es
            objBOLETO.EspecieDocumento = new EspecieDocumento(237,"12");
            objBOLETO.DataVencimento = DateTime.Now.AddDays(10);
            objBOLETO.ValorBoleto = 90;
            objBOLETO.Carteira ="09";
            objBOLETO.NossoNumero = ("00000012345");
            objBOLETO.Cedente = objCEDENTE;
            //O n� do documento deve ser de 10 posi��es
            objBOLETO.NumeroDocumento = "1234567890";
            //A data do documento � a data de emiss�o do boleto
            objBOLETO.DataDocumento = DateTime.Now;
            //A data de processamento � a data em que foi processado o documento, portanto � da data de emiss�o do boleto
            objBOLETO.DataProcessamento = DateTime.Now;
            objBOLETO.Sacado = new Sacado("12345678000255", "TESTE SACADO");
            objBOLETO.Sacado.Endereco.End = "END SACADO";
            objBOLETO.Sacado.Endereco.Bairro = "BAIRRO SACADO";
            objBOLETO.Sacado.Endereco.Cidade = "CIDADE SACADO";
            objBOLETO.Sacado.Endereco.CEP = "CEP SACADO";
            objBOLETO.Sacado.Endereco.UF = "RR";

            objBOLETO.PercMulta = 10;
            objBOLETO.JurosMora = 5;

            // nao precisa desta parte no boleto do brasdesco.
            /*objBOLETO.Remessa = new Remessa()
            {
                Ambiente = Remessa.TipoAmbiemte.Producao,
                CodigoOcorrencia = "01",
            };*/

            Boletos objBOLETOS = new Boletos();
            objBOLETOS.Add(objBOLETO);

            var mem = new MemoryStream();
            var objREMESSA = new ArquivoRemessa(TipoArquivo.CNAB400);
            objREMESSA.GerarArquivoRemessa("09", new Banco(237), objCEDENTE, objBOLETOS, mem, 1000);


        }
Example #54
0
        public void GeraDadosCaixa()
        {
            ContaBancaria conta = new ContaBancaria();
            conta.OperacaConta = "OPE";
            conta.Agencia = "345";
            conta.DigitoAgencia = "6";
            conta.Conta = "87654321";
            conta.DigitoConta = "0";
            //
            Cedente c = new Cedente();
            c.ContaBancaria = conta;
            c.CPFCNPJ = "00.000.000/0000-00";
            c.Nome = "Empresa de Atacado";
            //Na carteira 198 o código do Cedente é a conta bancária
            c.Codigo = String.Concat(conta.Agencia, conta.DigitoAgencia, conta.OperacaConta, conta.Conta, conta.DigitoConta); //Na Caixa, esse código está no manual como 16 caracteres AAAAOOOCCCCCCCCD;
            //
            Boleto b = new Boleto();
            b.Cedente = c;
            //
            b.DataProcessamento = DateTime.Now;
            b.DataVencimento = DateTime.Now.AddDays(15);
            b.ValorBoleto = Convert.ToDecimal(2469.69);
            b.Carteira = "SR";
            b.NossoNumero = "92082835";
            b.NumeroDocumento = "1008073";
            EspecieDocumento ED = new EspecieDocumento(104);
            b.EspecieDocumento = ED;

            //
            b.Sacado = new Sacado("Fulano de Silva");
            b.Sacado.CPFCNPJ = "000.000.000-00";
            b.Sacado.Endereco.End = "SSS 154 Bloco J Casa 23";
            b.Sacado.Endereco.Bairro = "Testando";
            b.Sacado.Endereco.Cidade = "Testelândia";
            b.Sacado.Endereco.CEP = "70000000";
            b.Sacado.Endereco.UF = "RS";

            Instrucao_Caixa item1 = new Instrucao_Caixa(9, 5);
            b.Instrucoes.Add(item1);
            //b.Instrucoes.Add(item2);
            b.Banco = new Banco(104);

            #region Dados para Remessa:
            b.Remessa = new Remessa();
            b.Remessa.TipoDocumento = "2"; // SIGCB - SEM REGISTRO
            b.Remessa.CodigoOcorrencia = string.Empty;
            #endregion

            //
            Boletos boletos = new Boletos();
            boletos.Add(b);

            GeraArquivoCNAB240(b.Banco, c, boletos);
        }
Example #55
0
 public bool ValidarRemessaCNAB240(string numeroConvenio, IBanco banco, Cedente cedente, Boletos boletos, int numeroArquivoRemessa, out string mensagem)
 {
     bool vRetorno = true;
     string vMsg = string.Empty;
     //
     #region Pré Validações
     if (banco == null)
     {
         vMsg += String.Concat("Remessa: O Banco é Obrigatório!", Environment.NewLine);
         vRetorno = false;
     }
     if (cedente == null)
     {
         vMsg += String.Concat("Remessa: O Cedente/Beneficiário é Obrigatório!", Environment.NewLine);
         vRetorno = false;
     }
     if (boletos == null || boletos.Count.Equals(0))
     {
         vMsg += String.Concat("Remessa: Deverá existir ao menos 1 boleto para geração da remessa!", Environment.NewLine);
         vRetorno = false;
     }
     #endregion
     //
     //validação de cada boleto
     foreach (Boleto boleto in boletos)
     {
         #region Validação de cada boleto
         if (boleto.Remessa == null)
         {
             vMsg += String.Concat("Boleto: ", boleto.NumeroDocumento, "; Remessa: Informe as diretrizes de remessa!", Environment.NewLine);
             vRetorno = false;
         }
         else if (boleto.Remessa.TipoDocumento.Equals("1") && String.IsNullOrEmpty(boleto.Sacado.Endereco.CEP)) //1 - SICGB - Com registro
         {
             //Para o "Remessa.TipoDocumento = "1", o CEP é Obrigatório!
             vMsg += String.Concat("Para o Tipo Documento [1 - SIGCB - COM REGISTRO], o CEP do SACADO é Obrigatório!", Environment.NewLine);
             vRetorno = false;
         }
         if (boleto.NossoNumero.Length > 15)
             boleto.NossoNumero = boleto.NossoNumero.Substring(0, 15);
         //if (!boleto.Remessa.TipoDocumento.Equals("2")) //2 - SIGCB - SEM REGISTRO
         //{
         //    //Para o "Remessa.TipoDocumento = "2", não poderá ter NossoNumero Gerado!
         //    vMsg += String.Concat("Tipo Documento de boleto não Implementado!", Environment.NewLine);
         //    vRetorno = false;
         //}
         #endregion
     }
     //
     mensagem = vMsg;
     return vRetorno;
 }
 /// <summary>
 /// Método que fará a verificação se a classe está devidamente implementada para a geração da Remessa
 /// </summary>
 /// <param name="numeroConvenio">Número do Convênio</param>
 /// <param name="banco">Banco</param>
 /// <param name="cedente">Dados do Cedente</param>
 /// <param name="boletos">Lista com Boletos para geração da remessa</param>
 /// <param name="numeroArquivoRemessa">Número do arquivo da remessa</param>
 /// <param name="mensagem">Mensagem</param>
 /// <returns></returns>
 public virtual bool ValidarArquivoRemessa(string numeroConvenio, IBanco banco, Cedente cedente, Boletos boletos, int numeroArquivoRemessa, out string mensagem)
 {
     try
     {
         return _arquivoRemessa.ValidarArquivoRemessa(numeroConvenio, banco, cedente, boletos, numeroArquivoRemessa, out mensagem);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
        public override void GerarArquivoRemessa(string numeroConvenio, IBanco banco, Cedente cedente, Boletos boletos, Stream arquivo, int numeroArquivoRemessa)
        {
            try
            {
                int numeroRegistro = 3;
                int numeroRegistroDetalhe = 1;
                string strline;
                    StreamWriter incluiLinha = new StreamWriter(arquivo);
                    if (banco.Codigo == 104)//quando é caixa verifica o modelo de leiatue que é está em boletos.remssa.tipodocumento
                    strline = banco.GerarHeaderRemessa(numeroConvenio, cedente, TipoArquivo.CNAB240, numeroArquivoRemessa, boletos[0]);
                else
                    strline = banco.GerarHeaderRemessa(numeroConvenio, cedente, TipoArquivo.CNAB240, numeroArquivoRemessa);
                //
                    incluiLinha.WriteLine(strline);
                    OnLinhaGerada(null, strline, EnumTipodeLinha.HeaderDeArquivo);
                    if (banco.Codigo == 104)//quando é caixa verifica o modelo de leiatue que é está em boletos.remssa.tipodocumento
                        strline = banco.GerarHeaderLoteRemessa(numeroConvenio, cedente, numeroArquivoRemessa, TipoArquivo.CNAB240, boletos[0]);
                    else
                        strline = banco.GerarHeaderLoteRemessa(numeroConvenio, cedente, numeroArquivoRemessa, TipoArquivo.CNAB240);

                    incluiLinha.WriteLine(strline);
                    OnLinhaGerada(null, strline, EnumTipodeLinha.HeaderDeLote);

                if (banco.Codigo == 341)
                {
                    #region se Banco Itau - 341
                    foreach (Boleto boleto in boletos)
                    {
                        boleto.Banco = banco;
                        strline = boleto.Banco.GerarDetalheRemessa(boleto, numeroRegistroDetalhe, TipoArquivo.CNAB240);
                        incluiLinha.WriteLine(strline);
                        OnLinhaGerada(boleto, strline, EnumTipodeLinha.DetalheSegmentoP);
                        numeroRegistro++;
                        numeroRegistroDetalhe++;
                    }

                    numeroRegistro--;
                    strline = banco.GerarTrailerLoteRemessa(numeroRegistro);
                    incluiLinha.WriteLine(strline);
                    OnLinhaGerada(null, strline, EnumTipodeLinha.TraillerDeLote);

                    numeroRegistro++;
                    numeroRegistro++;

                    strline = banco.GerarTrailerArquivoRemessa(numeroRegistro);
                    incluiLinha.WriteLine(strline);
                    OnLinhaGerada(null, strline, EnumTipodeLinha.TraillerDeArquivo);

                    incluiLinha.Close();
                    #endregion
                }
                else if (banco.Codigo == 104 && boletos[0].Remessa.TipoDocumento.Equals("2"))
                {
                    #region se Banco Caixa - 104 e tipo de arquivo da remessa SIGCB
                    foreach (Boleto boleto in boletos)
                    {
                        boleto.Banco = banco;
                        strline = boleto.Banco.GerarDetalheSegmentoPRemessa(boleto, numeroRegistroDetalhe, numeroConvenio, cedente);
                        incluiLinha.WriteLine(strline);
                        OnLinhaGerada(boleto, strline, EnumTipodeLinha.DetalheSegmentoP);
                        numeroRegistro++;
                        numeroRegistroDetalhe++;

                        strline = boleto.Banco.GerarDetalheSegmentoQRemessa(boleto, numeroRegistroDetalhe, boleto.Sacado);
                        incluiLinha.WriteLine(strline);
                        OnLinhaGerada(boleto, strline, EnumTipodeLinha.DetalheSegmentoQ);
                        numeroRegistro++;
                        numeroRegistroDetalhe++;
                        //segmento R não implementado...
                        //if (boleto.ValorMulta > 0)
                        //{
                        //    strline = boleto.Banco.GerarDetalheSegmentoRRemessa(boleto, numeroRegistroDetalhe, TipoArquivo.CNAB240);
                        //    incluiLinha.WriteLine(strline);
                        //    OnLinhaGerada(boleto, strline, EnumTipodeLinha.DetalheSegmentoR);
                        //    numeroRegistro++;
                        //    numeroRegistroDetalhe++;
                        //}
                    }

                    numeroRegistro--;
                    strline = banco.GerarTrailerLoteRemessa(numeroRegistro, boletos[0]);
                    incluiLinha.WriteLine(strline);
                    OnLinhaGerada(null, strline, EnumTipodeLinha.TraillerDeLote);

                    numeroRegistro++;
                    numeroRegistro++;

                    strline = banco.GerarTrailerArquivoRemessa(numeroRegistro, boletos[0]);
                    incluiLinha.WriteLine(strline);
                    OnLinhaGerada(null, strline, EnumTipodeLinha.TraillerDeArquivo);

                    incluiLinha.Close();

                    #endregion
                }
                else //para qualquer outro banco, gera CNAB240 com segmentos abaixo
                {
                    #region outros bancos
                    foreach (Boleto boleto in boletos)
                    {
                        boleto.Banco = banco;
                        strline = boleto.Banco.GerarDetalheSegmentoPRemessa(boleto, numeroRegistroDetalhe, numeroConvenio);
                        incluiLinha.WriteLine(strline);
                        OnLinhaGerada(boleto, strline, EnumTipodeLinha.DetalheSegmentoP);
                        numeroRegistro++;
                        numeroRegistroDetalhe++;

                        strline = boleto.Banco.GerarDetalheSegmentoQRemessa(boleto, numeroRegistroDetalhe, TipoArquivo.CNAB240);
                        incluiLinha.WriteLine(strline);
                        OnLinhaGerada(boleto, strline, EnumTipodeLinha.DetalheSegmentoQ);
                        numeroRegistro++;
                        numeroRegistroDetalhe++;

                        if (boleto.ValorMulta > 0)
                        {
                            strline = boleto.Banco.GerarDetalheSegmentoRRemessa(boleto, numeroRegistroDetalhe, TipoArquivo.CNAB240);
                            incluiLinha.WriteLine(strline);
                            OnLinhaGerada(boleto, strline, EnumTipodeLinha.DetalheSegmentoR);
                            numeroRegistro++;
                            numeroRegistroDetalhe++;
                        }
                    }

                    numeroRegistro--;
                    strline = banco.GerarTrailerLoteRemessa(numeroRegistro);
                    incluiLinha.WriteLine(strline);
                    OnLinhaGerada(null, strline, EnumTipodeLinha.TraillerDeLote);

                    numeroRegistro++;
                    numeroRegistro++;

                    strline = banco.GerarTrailerArquivoRemessa(numeroRegistro);
                    incluiLinha.WriteLine(strline);
                    OnLinhaGerada(null, strline, EnumTipodeLinha.TraillerDeArquivo);

                    incluiLinha.Close();
                    #endregion
                }

            }
            catch (Exception ex)
            {
                throw new Exception("Erro ao gerar arquivo remessa.", ex);
            }
        }
Example #58
0
 /// <summary>
 /// Efetua as Validações dentro da classe Boleto, para garantir a geração da remessa
 /// </summary>
 public override bool ValidarRemessa(TipoArquivo tipoArquivo, string numeroConvenio, IBanco banco, Cedente cedente, Boletos boletos, int numeroArquivoRemessa, out string mensagem)
 {
     bool vRetorno = true;
     string vMsg = string.Empty;
     //
     switch (tipoArquivo)
     {
         case TipoArquivo.CNAB240:
             //vRetorno = ValidarRemessaCNAB240(numeroConvenio, banco, cedente, boletos, numeroArquivoRemessa, out vMsg);
             break;
         case TipoArquivo.CNAB400:
             vRetorno = ValidarRemessaCNAB400(numeroConvenio, banco, cedente, boletos, numeroArquivoRemessa, out vMsg);
             break;
         case TipoArquivo.Outro:
             throw new Exception("Tipo de arquivo inexistente.");
     }
     //
     mensagem = vMsg;
     return vRetorno;
 }
Example #59
0
        public bool ValidarRemessaCNAB400(string numeroConvenio, IBanco banco, Cedente cedente, Boletos boletos, int numeroArquivoRemessa, out string mensagem)
        {
            bool vRetorno = true;
            string vMsg = string.Empty;
            //
            #region Pré Validações
            if (banco == null)
            {
                vMsg += String.Concat("Remessa: O Banco é Obrigatório!", Environment.NewLine);
                vRetorno = false;
            }
            if (cedente == null)
            {
                vMsg += String.Concat("Remessa: O Cedente/Beneficiário é Obrigatório!", Environment.NewLine);
                vRetorno = false;
            }
            if (boletos == null || boletos.Count.Equals(0))
            {
                vMsg += String.Concat("Remessa: Deverá existir ao menos 1 boleto para geração da remessa!", Environment.NewLine);
                vRetorno = false;
            }
            #endregion
            //
            foreach (Boleto boleto in boletos)
            {
                #region Validação de cada boleto
                if (boleto.Remessa == null)
                {
                    vMsg += String.Concat("Boleto: ", boleto.NumeroDocumento, "; Remessa: Informe as diretrizes de remessa!", Environment.NewLine);
                    vRetorno = false;
                }
                else
                {
                    #region Validações da Remessa que deverão estar preenchidas quando SICREDI
                    //Comentado porque ainda está fixado em 01
                    //if (String.IsNullOrEmpty(boleto.Remessa.CodigoOcorrencia))
                    //{
                    //    vMsg += String.Concat("Boleto: ", boleto.NumeroDocumento, "; Remessa: Informe o Código de Ocorrência!", Environment.NewLine);
                    //    vRetorno = false;
                    //}
                    if (String.IsNullOrEmpty(boleto.NumeroDocumento))
                    {
                        vMsg += String.Concat("Boleto: ", boleto.NumeroDocumento, "; Remessa: Informe um Número de Documento!", Environment.NewLine);
                        vRetorno = false;
                    }
                    else if (String.IsNullOrEmpty(boleto.Remessa.TipoDocumento))
                    {
                        // Para o Sicredi, defini o Tipo de Documento sendo:
                        //       A = 'A' - SICREDI com Registro
                        //      C1 = 'C' - SICREDI sem Registro Impressão Completa pelo Sicredi
                        //      C2 = 'C' - SICREDI sem Registro Pedido de bloquetos pré-impressos
                        // ** Isso porque são tratados 3 leiautes de escrita diferentes para o Detail da remessa;

                        vMsg += String.Concat("Boleto: ", boleto.NumeroDocumento, "; Remessa: Informe o Tipo Documento!", Environment.NewLine);
                        vRetorno = false;
                    }
                    else if (!boleto.Remessa.TipoDocumento.Equals("A") && !boleto.Remessa.TipoDocumento.Equals("C1") && !boleto.Remessa.TipoDocumento.Equals("C2"))
                    {
                        vMsg += String.Concat("Boleto: ", boleto.NumeroDocumento, "; Remessa: Tipo de Documento Inválido! Deverão ser: A = SICREDI com Registro; C1 = SICREDI sem Registro Impressão Completa pelo Sicredi;  C2 = SICREDI sem Registro Pedido de bloquetos pré-impressos", Environment.NewLine);
                        vRetorno = false;
                    }
                    //else if (boleto.Remessa.TipoDocumento.Equals("06") && !String.IsNullOrEmpty(boleto.NossoNumero))
                    //{
                    //    //Para o "Remessa.TipoDocumento = "06", não poderá ter NossoNumero Gerado!
                    //    vMsg += String.Concat("Boleto: ", boleto.NumeroDocumento, "; Não pode existir NossoNumero para o Tipo Documento '06 - cobrança escritural'!", Environment.NewLine);
                    //    vRetorno = false;
                    //}
                    else if (!boleto.EspecieDocumento.Codigo.Equals("A") && //A - Duplicata Mercantil por Indicação
                             !boleto.EspecieDocumento.Codigo.Equals("B") && //B - Duplicata Rural;
                             !boleto.EspecieDocumento.Codigo.Equals("C") && //C - Nota Promissória;
                             !boleto.EspecieDocumento.Codigo.Equals("D") && //D - Nota Promissória Rural;
                             !boleto.EspecieDocumento.Codigo.Equals("E") && //E - Nota de Seguros;
                             !boleto.EspecieDocumento.Codigo.Equals("F") && //G – Recibo;

                             !boleto.EspecieDocumento.Codigo.Equals("H") && //H - Letra de Câmbio;
                             !boleto.EspecieDocumento.Codigo.Equals("I") && //I - Nota de Débito;
                             !boleto.EspecieDocumento.Codigo.Equals("J") && //J - Duplicata de Serviço por Indicação;
                             !boleto.EspecieDocumento.Codigo.Equals("O") && //O – Boleto Proposta
                             !boleto.EspecieDocumento.Codigo.Equals("K") //K – Outros.
                            )
                    {
                        vMsg += String.Concat("Boleto: ", boleto.NumeroDocumento, "; Remessa: Informe o Código da EspécieDocumento! São Aceitas:{A,B,C,D,E,F,H,I,J,O,K}", Environment.NewLine);
                        vRetorno = false;
                    }
                    else if (!boleto.Sacado.CPFCNPJ.Length.Equals(11) && !boleto.Sacado.CPFCNPJ.Length.Equals(14))
                    {
                        vMsg += String.Concat("Boleto: ", boleto.NumeroDocumento, "; Remessa: Cpf/Cnpj diferente de 11/14 caracteres!", Environment.NewLine);
                        vRetorno = false;
                    }
                    else if (!boleto.NossoNumero.Length.Equals(8))
                    {
                        //sidnei.klein: Segundo definição recebida pelo Sicredi-RS, o Nosso Número sempre terá somente 8 caracteres sem o DV que está no boleto.DigitoNossoNumero
                        vMsg += String.Concat("Boleto: ", boleto.NumeroDocumento, "; Remessa: O Nosso Número diferente de 8 caracteres!", Environment.NewLine);
                        vRetorno = false;
                    }
                    #endregion
                }
                #endregion
            }
            //
            mensagem = vMsg;
            return vRetorno;
        }
 /// <summary>
 /// Gera o arquivo de remessa
 /// </summary>
 public virtual void GerarArquivoRemessa(string numeroConvenio, IBanco banco, Cedente cedente, Boletos boletos, Stream arquivo, int numeroArquivoRemessa)
 {
     _banco = banco;
     _cedente = cedente;
     _boletos = boletos;
     _numeroConvenio = numeroConvenio;
     _numeroArquivoRemessa = numeroArquivoRemessa;
     _arquivoRemessa.GerarArquivoRemessa(numeroConvenio, banco, cedente, boletos, arquivo, numeroArquivoRemessa);
 }