Example #1
0
 public function addDetalhe(Detalhe $detalhe)
 {
     $this->iniciaDetalhe();
     if ($this->getCarteira('11') == '11') {
         $nossoNumero = Util::formatCnab('9', $detalhe->getNumero(), 10);
         $nossoNumero .= Util::modulo11($detalhe->getNumero());
     } else {
         if ($this->getCarteira('11') == '12') {
             $nossoNumero = '9' . Util::formatCnab('9', $detalhe->getNumero(), 9);
             $nossoNumero = $nossoNumero . Util::modulo11($nossoNumero);
         } else {
             throw new \Exception("cateira '{$this->getCarteira('11')}' inválida, somente 11 e 12 são válidas");
         }
     }
     $this->add(1, 1, '1');
     $this->add(2, 3, '02');
     $this->add(4, 17, Util::formatCnab('9L', $this->getCedenteDocumento(), 14));
     $this->add(18, 33, Util::formatCnab('9', $this->getCedenteCodigo(), 16));
     $this->add(34, 35, Util::formatCnab('X', '', 2));
     $this->add(36, 37, '00');
     $this->add(38, 62, Util::formatCnab('X', $detalhe->getNumeroControleString(), 25));
     $this->add(63, 73, Util::formatCnab('9', $nossoNumero, 11));
     $this->add(74, 76, Util::formatCnab('X', '', 3));
     $this->add(77, 106, Util::formatCnab('X', '', 30));
     $this->add(107, 108, Util::formatCnab('9', $this->getCarteira('11'), 2));
     $this->add(109, 110, '01');
     $this->add(111, 120, Util::formatCnab('X', $detalhe->getNumeroDocumento(), 10));
     $this->add(121, 126, Util::formatCnab('D', $detalhe->getDataVencimento(), 6));
     $this->add(127, 139, Util::formatCnab('9', $detalhe->getValor(), 13, 2));
     $this->add(140, 142, self::COD_BANCO_CEF);
     $this->add(143, 147, '00000');
     $this->add(148, 149, $detalhe->getEspecie('01'));
     $this->add(150, 150, $detalhe->getAceite('N'));
     $this->add(151, 156, Util::formatCnab('D', $detalhe->getDataDocumento(), 6));
     $this->add(157, 158, $detalhe->getInstrucao1('00'));
     $this->add(159, 160, $detalhe->getInstrucao2('00'));
     $this->add(161, 173, Util::formatCnab('9', $detalhe->getValorMora(), 13, 2));
     $this->add(174, 179, Util::formatCnab('D', $detalhe->getDataLimiteDesconto(), 6));
     $this->add(180, 192, Util::formatCnab('9', $detalhe->getValorDesconto(), 13, 2));
     $this->add(193, 205, Util::formatCnab('9', $detalhe->getvalorIOF(), 13, 2));
     $this->add(206, 218, Util::formatCnab('9', $detalhe->getValorAbatimento(), 13, 2));
     $this->add(219, 220, Util::formatCnab('9', $detalhe->getSacadoTipoDocumento(), 2));
     $this->add(221, 234, Util::formatCnab('9L', $detalhe->getSacadoDocumento(), 14));
     $this->add(235, 274, Util::formatCnab('X', $detalhe->getSacadoNome(), 30));
     $this->add(275, 314, Util::formatCnab('X', $detalhe->getSacadoEndereco(), 40));
     $this->add(315, 326, Util::formatCnab('X', $detalhe->getSacadoBairro(), 12));
     $this->add(327, 334, Util::formatCnab('L', $detalhe->getSacadoCEP(), 8));
     $this->add(335, 349, Util::formatCnab('A', $detalhe->getSacadoCidade(), 15));
     $this->add(350, 351, Util::formatCnab('A', $detalhe->getSacadoEstado(), 2));
     $this->add(352, 357, Util::formatCnab('D', $detalhe->getDataVencimento(), 6));
     $this->add(358, 367, Util::formatCnab('9', $detalhe->getValorMulta(Util::percent($detalhe->getValor(), $detalhe->getTaxaMulta())), 10, 2));
     $this->add(368, 389, Util::formatCnab('X', $detalhe->getSacadorAvalista(), 22));
     $this->add(390, 391, '00');
     $this->add(392, 393, Util::formatCnab('9', $detalhe->getDiasProtesto(), 2));
     $this->add(394, 394, Util::formatCnab('9', $detalhe->getTipoMoeda('9'), 1));
     $this->add(395, 400, Util::formatCnab('9', $this->iRegistros + 1, 6));
     return $this;
 }
 public function addDetalhe(Detalhe $detalhe)
 {
     $this->iniciaDetalhe();
     $this->total += $detalhe->getValor();
     if (in_array('06', $detalhe->getInstrucoes())) {
         $detalhe->diasProtesto = '00';
     }
     $this->add(1, 1, '1');
     $this->add(2, 3, '02');
     $this->add(4, 17, Util::formatCnab('9L', $this->getCedenteDocumento(), 14));
     $this->add(18, 37, Util::formatCnab('9', $this->getCodigoTransmissao(), 20));
     $this->add(38, 62, Util::formatCnab('X', $detalhe->getNumeroControleString(), 25));
     $this->add(63, 69, Util::formatCnab('9', $detalhe->getNumero(), 7));
     $this->add(70, 70, Util::modulo11($detalhe->getNumero()));
     $this->add(71, 76, Util::formatCnab('D', $detalhe->getDataLimiteDesconto(), 6));
     $this->add(77, 77, '');
     $this->add(78, 78, $detalhe->getTaxaMulta() ? '4' : '0');
     $this->add(79, 82, Util::formatCnab('9', $detalhe->getTaxaMulta(), 4, 2));
     $this->add(83, 84, '00');
     $this->add(85, 97, Util::formatCnab('9', 0, 13, 2));
     $this->add(98, 101, '');
     $this->add(102, 107, Util::formatCnab('9', $detalhe->getDataMulta(), 6));
     $this->add(108, 108, $this->getCarteira('1'));
     $this->add(109, 110, '01');
     $this->add(111, 120, Util::formatCnab('X', $detalhe->getNumeroDocumento(), 10));
     $this->add(121, 126, Util::formatCnab('D', $detalhe->getDataVencimento(), 6));
     $this->add(127, 139, Util::formatCnab('9', $detalhe->getValor(), 13, 2));
     $this->add(140, 142, self::COD_BANCO_SANTANDER);
     $this->add(143, 147, '00000');
     $this->add(148, 149, $detalhe->getEspecie('01'));
     $this->add(150, 150, $detalhe->getAceite('N'));
     $this->add(151, 156, Util::formatCnab('D', $detalhe->getDataDocumento(), 6));
     $this->add(157, 158, $detalhe->getInstrucao1('00'));
     $this->add(159, 160, $detalhe->getInstrucao2('00'));
     $this->add(161, 173, Util::formatCnab('9', $detalhe->getValorMora(), 13, 2));
     $this->add(174, 179, Util::formatCnab('D', $detalhe->getDataLimiteDesconto(), 6));
     $this->add(180, 192, Util::formatCnab('9', $detalhe->getValorDesconto(), 13, 2));
     $this->add(193, 205, Util::formatCnab('9', $detalhe->getvalorIOF(), 13, 2));
     $this->add(206, 218, Util::formatCnab('9', $detalhe->getValorAbatimento(), 13, 2));
     $this->add(219, 220, Util::formatCnab('9L', $detalhe->getSacadoTipoDocumento(), 2));
     $this->add(221, 234, Util::formatCnab('9L', $detalhe->getSacadoDocumento(), 14));
     $this->add(235, 274, Util::formatCnab('X', $detalhe->getSacadoNome(), 40));
     $this->add(275, 314, Util::formatCnab('X', $detalhe->getSacadoEndereco(), 40));
     $this->add(315, 326, Util::formatCnab('X', $detalhe->getSacadoBairro(), 12));
     $this->add(327, 334, Util::formatCnab('9L', $detalhe->getSacadoCEP(), 8));
     $this->add(335, 349, Util::formatCnab('X', $detalhe->getSacadoCidade(), 15));
     $this->add(350, 351, Util::formatCnab('X', $detalhe->getSacadoEstado(), 2));
     $this->add(352, 381, Util::formatCnab('X', $detalhe->getSacadorAvalista(), 30));
     $this->add(382, 382, '');
     $this->add(383, 383, 'I');
     $this->add(384, 385, substr($this->getConta(), -2));
     $this->add(386, 391, '');
     $this->add(392, 393, Util::formatCnab('9', $detalhe->getDiasProtesto(), 2));
     $this->add(394, 394, '');
     $this->add(395, 400, Util::formatCnab('N', $this->iRegistros + 1, 6));
     return $this;
 }
Example #3
0
 public function addDetalhe(Detalhe $detalhe)
 {
     $this->iniciaDetalhe();
     $this->add(1, 1, '1');
     $this->add(2, 3, '02');
     $this->add(4, 17, Util::formatCnab('L', $this->getCedenteDocumento(), 14));
     $this->add(18, 21, Util::formatCnab('9', $this->getAgencia(), 4));
     $this->add(22, 23, '00');
     $this->add(24, 28, Util::formatCnab('9', $this->getConta(), 5));
     $this->add(29, 29, Util::modulo10($this->getAgencia() . $this->getConta()));
     $this->add(30, 33, '');
     $this->add(34, 37, '0000');
     $this->add(38, 62, Util::formatCnab('X', $detalhe->getNumeroControleString(), 25));
     $this->add(63, 70, Util::formatCnab('9', $detalhe->getNumero(), 8));
     $this->add(71, 83, Util::formatCnab('9', '0', 13, 2));
     $this->add(84, 86, Util::formatCnab('9', $this->getCarteira('109'), 3));
     $this->add(87, 107, '');
     $this->add(108, 108, 'I');
     $this->add(109, 110, '01');
     $this->add(111, 120, Util::formatCnab('X', $detalhe->getNumeroDocumento(), 10));
     $this->add(121, 126, Util::formatCnab('d', $detalhe->getDataVencimento(), 6));
     $this->add(127, 139, Util::formatCnab('9', $detalhe->getValor(), 13, 2));
     $this->add(140, 142, 341);
     $this->add(143, 147, '00000');
     $this->add(148, 149, $detalhe->getEspecie('01'));
     $this->add(150, 150, $detalhe->getAceite('N'));
     $this->add(151, 156, Util::formatCnab('D', $detalhe->getDataDocumento(), 6));
     $this->add(157, 158, $detalhe->getInstrucao1('00'));
     $this->add(159, 160, $detalhe->getInstrucao2('00'));
     $this->add(161, 173, Util::formatCnab('9', $detalhe->getValorMora(), 13, 2));
     $this->add(174, 179, Util::formatCnab('D', $detalhe->getDataLimiteDesconto(), 6));
     $this->add(180, 192, Util::formatCnab('9', $detalhe->getValorDesconto(), 13, 2));
     $this->add(193, 205, Util::formatCnab('9', $detalhe->getvalorIOF(), 13, 2));
     $this->add(206, 218, Util::formatCnab('9', $detalhe->getValorAbatimento(), 13, 2));
     $this->add(219, 220, Util::formatCnab('9L', $detalhe->getSacadoTipoDocumento(), 2));
     $this->add(221, 234, Util::formatCnab('L', $detalhe->getSacadoDocumento(), 14));
     $this->add(235, 264, Util::formatCnab('X', $detalhe->getSacadoNome(), 30));
     $this->add(265, 274, '');
     $this->add(275, 314, Util::formatCnab('X', $detalhe->getSacadoEndereco(), 40));
     $this->add(315, 326, Util::formatCnab('X', $detalhe->getSacadoBairro(), 12));
     $this->add(327, 334, Util::formatCnab('L', $detalhe->getSacadoCEP(), 8));
     $this->add(335, 349, Util::formatCnab('A', $detalhe->getSacadoCidade(), 15));
     $this->add(350, 351, Util::formatCnab('A', $detalhe->getSacadoEstado(), 2));
     $this->add(352, 381, Util::formatCnab('A', $detalhe->getSacadorAvalista(), 30));
     $this->add(382, 385, '');
     $this->add(386, 391, Util::formatCnab('D', $detalhe->getDataVencimento(), 6));
     $this->add(392, 393, Util::formatCnab('9', $detalhe->getDiasProtesto(), 2));
     $this->add(394, 394, '');
     $this->add(395, 400, Util::formatCnab('9', $this->iRegistros + 1, 6));
     return $this;
 }
Example #4
0
 public function addDetalhe(Detalhe $detalhe)
 {
     $this->iniciaDetalhe();
     $idempresa = '0';
     $idempresa .= Util::formatCnab('N', $this->getCarteira('21'), 3);
     $idempresa .= Util::formatCnab('N', $this->getAcencia(), 5);
     $idempresa .= Util::formatCnab('N', $this->getConta(), 7);
     $idempresa .= Util::modulo11($this->getConta());
     $dvNossoNumero = Util::modulo11(Util::formatCnab('N', $this->getCarteira('21'), 2) . Util::formatCnab('N', $detalhe->getNumero(), 11), 7, 0, 'P');
     $dvNossoNumero = $detalhe->getNumero() > 0 ? $dvNossoNumero : 0;
     $this->add(1, 1, '1');
     if ($this->debitoAutomatico) {
         /**
          *
          * 002 a 020 - Identificação do Débito Automático em C/C
          * Somente deverão ser preenchidos, caso o cliente Cedente esteja previamente cadastrado
          * para operar com a modalidade de débito automático em Conta do cliente pagador (Sacado),
          * cujos campos correspondentes a essas posições são:
          * - posição 002 a 006 = no da Agência a ser debitada, ou seja, do Sacado
          * - posição 007 a 007 = dígito da Agência a ser debitada
          * - posição 008 a 012 = razão da Conta  - Ex. 07050
          * - posição 013 a 019 = no da Conta Corrente do Sacado
          * - posição 020 a 020 = dígito da Conta Corrente do Sacado
          *
          */
         $this->add(2, 6, Util::formatCnab('N', $this->getAgencia(), 5));
         $this->add(7, 7, Util::modulo11($this->getAgencia()));
         $this->add(8, 12, Util::formatCnab('N', $this->getContaRazao(), 5));
         $this->add(13, 19, Util::formatCnab('N', $this->getConta(), 7));
         $this->add(20, 20, Util::modulo11($this->getConta()));
     } else {
         $this->add(2, 6, Util::formatCnab('A', '', 5));
         $this->add(7, 7, '');
         $this->add(8, 12, Util::formatCnab('A', '', 5));
         $this->add(13, 19, Util::formatCnab('A', '', 7));
         $this->add(20, 20, '');
     }
     if ($detalhe->getTaxaMulta()) {
         $tipoMulta = 2;
         $multa = $detalhe->getTaxaMulta();
     } elseif ($detalhe->getValorMulta()) {
         $tipoMulta = 0;
         $multa = $detalhe->getValorMulta();
     } else {
         $tipoMulta = ' ';
         $multa = 0;
     }
     $this->add(21, 37, Util::formatCnab('A', $idempresa, 17));
     $this->add(38, 62, Util::formatCnab('A', $detalhe->getNumeroControleString(), 25));
     $this->add(63, 65, self::COD_BANCO_BRADESCO);
     $this->add(66, 66, $tipoMulta);
     $this->add(67, 70, Util::formatCnab('N', $multa, 4, 2));
     $this->add(71, 81, Util::formatCnab('N', $detalhe->getNumero(), 11));
     $this->add(82, 82, $dvNossoNumero);
     $this->add(83, 92, Util::formatCnab('N', $detalhe->getValorDesconto(), 10, 2));
     $this->add(93, 93, $detalhe->getNumero() > 0 ? '2' : '1');
     $this->add(94, 94, $detalhe->getNumero() > 0 ? 'N' : ' ');
     $this->add(95, 104, '');
     $this->add(105, 105, 'R');
     $this->add(106, 106, '2');
     $this->add(107, 108, '');
     $this->add(109, 110, Util::formatCnab('N', $detalhe->getOcorrencia(), 2));
     $this->add(111, 120, Util::formatCnab('A', $detalhe->getNumeroDocumento(), 10));
     $this->add(121, 126, Util::formatCnab('D', $detalhe->getDataVencimento(), 6));
     $this->add(127, 139, Util::formatCnab('N', $detalhe->getValor(), 13, 2));
     $this->add(140, 142, Util::formatCnab('A', '', 3));
     $this->add(143, 147, Util::formatCnab('A', '', 5));
     $this->add(148, 149, $detalhe->getEspecie('01'));
     $this->add(150, 150, $detalhe->getAceite('N'));
     $this->add(151, 156, Util::formatCnab('D', $detalhe->getDataDocumento(), 6));
     $this->add(157, 158, $detalhe->getInstrucao1('00'));
     $this->add(159, 160, $detalhe->getInstrucao2('00'));
     $this->add(161, 173, Util::formatCnab('N', $detalhe->getValorMora(), 13, 2));
     $this->add(174, 179, Util::formatCnab('D', $detalhe->getDataLimiteDesconto(), 6));
     $this->add(180, 192, Util::formatCnab('N', $detalhe->getValorDesconto(), 13, 2));
     $this->add(193, 205, Util::formatCnab('N', $detalhe->getvalorIOF(), 13, 2));
     $this->add(206, 218, Util::formatCnab('N', $detalhe->getValorAbatimento(), 13, 2));
     $this->add(219, 220, Util::formatCnab('NL', $detalhe->getSacadoTipoDocumento(), 2));
     $this->add(221, 234, Util::formatCnab('L', $detalhe->getSacadoDocumento(), 14));
     $this->add(235, 274, Util::formatCnab('A', $detalhe->getSacadoNome(), 40));
     $this->add(275, 314, Util::formatCnab('A', $detalhe->getSacadoEndereco(), 40));
     $this->add(315, 326, '');
     $this->add(327, 331, substr($detalhe->getSacadoCEP(), 0, 5));
     $this->add(332, 334, substr($detalhe->getSacadoCEP(), -3));
     $this->add(335, 394, Util::formatCnab('A', $detalhe->getSacadorAvalista(), 60));
     $this->add(395, 400, Util::formatCnab('N', $this->iRegistros + 1, 6));
     return $this;
 }
Example #5
0
 public function addDetalhe(Detalhe $detalhe)
 {
     $this->iniciaDetalhe();
     $convenio6 = strlen($this->getConvenio()) < 7 ? true : false;
     if ($convenio6) {
         $prefixoTitulo = 'AI';
         if (in_array($this->getCarteira('17'), ['11', '31', '51'])) {
             $nossoNumero = Util::formatCnab('9', 0, 11);
             if ($this->getCarteira('17') != '11') {
                 $prefixoTitulo = 'SD';
             }
         } else {
             $nossoNumero = Util::formatCnab('9', $this->getConvenio(), 6) . Util::formatCnab('9', $detalhe->getNumero(), 5);
         }
         if ($this->getCarteira('17') == '12') {
             $prefixoTitulo .= 'U';
         }
     } else {
         if (in_array($this->getCarteira('17'), ['11', '31', '51'])) {
             $nossoNumero = Util::formatCnab('9', 0, 17);
         } else {
             $nossoNumero = Util::formatCnab('9', $this->getConvenio(), 7) . Util::formatCnab('9', $detalhe->getNumero(), 10);
         }
     }
     if (!in_array('06', [$detalhe->getInstrucao1(), $detalhe->getInstrucao2()])) {
         $detalhe->diasProtesto = '00';
     }
     $idArquivo = $convenio6 ? 1 : 7;
     $this->add(1, 1, $idArquivo);
     $this->add(2, 3, '02');
     $this->add(4, 17, Util::formatCnab('L', $this->cedenteDocumento, 14));
     $this->add(18, 21, Util::formatCnab('9', $this->getAgencia(), 4));
     $this->add(22, 22, Util::modulo11($this->getAgencia()));
     $this->add(23, 30, Util::formatCnab('9', $this->getConta(), 8));
     $this->add(31, 31, Util::modulo11($this->getConta()));
     if ($convenio6) {
         $this->add(32, 37, Util::formatCnab('9', $this->getConvenio(), 6));
         $this->add(38, 62, Util::formatCnab('X', $detalhe->getNumeroControleString(), 25));
         $this->add(63, 73, $nossoNumero);
         $this->add(64, 74, Util::modulo11($nossoNumero));
         $this->add(75, 76, '00');
         $this->add(77, 78, '00');
         $this->add(79, 81, '');
         $this->add(82, 82, $detalhe->getSacadorAvalista() ? 'A' : '');
         $this->add(83, 85, Util::formatCnab('X', $prefixoTitulo, 3));
         $this->add(86, 88, Util::formatCnab('9', $this->carteiraVariacao, 3));
         $this->add(89, 89, '0');
         $this->add(90, 94, '00000');
         $this->add(95, 95, '0');
     } else {
         $this->add(32, 38, Util::formatCnab('9', $this->getConvenio(), 7));
         $this->add(39, 63, Util::formatCnab('X', $detalhe->getNumeroControleString(), 25));
         $this->add(64, 80, $nossoNumero);
         $this->add(81, 82, '00');
         $this->add(83, 84, '00');
         $this->add(85, 87, '');
         $this->add(88, 88, $detalhe->getSacadorAvalista() ? 'A' : '');
         $this->add(89, 91, '');
         $this->add(92, 94, Util::formatCnab('9', $this->carteiraVariacao, 3));
         $this->add(95, 95, '0');
     }
     $this->add(96, 101, '000000');
     $this->add(102, 106, Util::formatCnab('X', $detalhe->getTipoCobrancaBB(), 5));
     $this->add(107, 108, $this->getCarteira('17'));
     $this->add(109, 110, Util::formatCnab('N', $detalhe->getOcorrencia(), 2));
     $this->add(111, 120, Util::formatCnab('X', $detalhe->getNumeroDocumento(), 10));
     $this->add(121, 126, Util::formatCnab('D', $detalhe->getDataVencimento(), 6));
     $this->add(127, 139, Util::formatCnab('9', $detalhe->getValor(), 13, 2));
     $this->add(140, 142, self::COD_BANCO_BB);
     $this->add(143, 146, '0000');
     $this->add(147, 147, '');
     $this->add(148, 149, $detalhe->getEspecie('01'));
     $this->add(150, 150, $detalhe->getAceite('N'));
     $this->add(151, 156, Util::formatCnab('D', $detalhe->getDataDocumento(), 6));
     $this->add(157, 158, Util::formatCnab('9', $detalhe->getInstrucao1('00'), 2));
     $this->add(159, 160, Util::formatCnab('9', $detalhe->getInstrucao2('00'), 2));
     $this->add(161, 173, Util::formatCnab('9', $detalhe->getValorMora(), 13, 2));
     $this->add(174, 179, Util::formatCnab('9', $detalhe->getDataLimiteDesconto('0'), 6));
     $this->add(180, 192, Util::formatCnab('9', $detalhe->getValorDesconto(), 13, 2));
     $this->add(193, 205, Util::formatCnab('9', $detalhe->getvalorIOF(), 13, 2));
     $this->add(206, 218, Util::formatCnab('9', $detalhe->getValorAbatimento(), 13, 2));
     $this->add(219, 220, Util::formatCnab('9', $detalhe->getSacadoTipoDocumento(), 2));
     $this->add(221, 234, Util::formatCnab('9', $detalhe->getSacadoDocumento(), 14));
     $this->add(235, 271, Util::formatCnab('X', $detalhe->getSacadoNome(), 37));
     $this->add(272, 274, '');
     if ($convenio6) {
         $this->add(275, 326, Util::formatCnab('X', $detalhe->getSacadoEndereco(), 52));
     } else {
         $this->add(275, 311, Util::formatCnab('X', $detalhe->getSacadoEndereco(), 37));
         $this->add(312, 326, '');
     }
     $this->add(327, 334, Util::formatCnab('9', $detalhe->getSacadoCEP(), 8));
     $this->add(335, 349, Util::formatCnab('X', $detalhe->getSacadoCidade(), 15));
     $this->add(350, 351, Util::formatCnab('X', $detalhe->getSacadoEstado(), 2));
     $this->add(352, 391, Util::formatCnab('X', $detalhe->getSacadorAvalista(), 40));
     $this->add(392, 393, Util::formatCnab('9', $detalhe->getDiasProtesto(), 2));
     $this->add(394, 394, '');
     $this->add(395, 400, Util::formatCnab('N', $this->iRegistros + 1, 6));
 }
Example #6
0
 public function addDetalhe(Detalhe $detalhe)
 {
     $this->iniciaDetalhe();
     $nossoNumero = Util::formatCnab('N', $this->getRange(), 5) . Util::formatCnab('N', $detalhe->getNumero(), 5);
     $nossoNumero = $nossoNumero . Util::modulo11($nossoNumero, 7);
     if ($detalhe->getEspecie('01') == '09') {
         $nossoNumero = 0;
     }
     $this->add(1, 1, '1');
     $this->add(2, 3, '02');
     $this->add(4, 17, Util::formatCnab('NL', $this->getCedenteDocumento(), 14));
     $this->add(18, 18, 0);
     $this->add(19, 22, Util::formatCnab('N', $this->getAgencia(), 4));
     $this->add(23, 24, '55');
     $this->add(25, 28, Util::formatCnab('NL', $this->getAgencia(), 4));
     $this->add(29, 35, Util::formatCnab('NL', $this->getConta(), 7));
     $this->add(36, 37, '');
     $this->add(38, 62, Util::formatCnab('X', $detalhe->getNumeroControleString(), 25));
     $this->add(63, 73, Util::formatCnab('N', $nossoNumero, 11));
     $this->add(74, 79, '000000');
     $this->add(80, 90, Util::formatCnab('N', 0, 11, 2));
     $this->add(91, 96, '000000');
     $this->add(97, 107, Util::formatCnab('N', 0, 11, 2));
     $this->add(108, 108, $this->getCarteira('1'));
     $this->add(109, 110, '01');
     $this->add(111, 120, Util::formatCnab('X', $detalhe->getNumeroDocumento(), 10));
     $this->add(121, 126, Util::formatCnab('D', $detalhe->getDataVencimento(), 6));
     $this->add(127, 139, Util::formatCnab('N', $detalhe->getValor(), 13, 2));
     $this->add(140, 142, self::COD_BANCO_HSBC);
     $this->add(143, 147, Util::formatCnab('N', "0", 5));
     $this->add(148, 149, $detalhe->getEspecie('01'));
     $this->add(150, 150, $detalhe->getAceite('N'));
     $this->add(151, 156, Util::formatCnab('D', $detalhe->getDataDocumento(), 6));
     $this->add(157, 158, $detalhe->getInstrucao1('00'));
     $this->add(159, 160, $detalhe->getInstrucao2('00'));
     $this->add(161, 173, Util::formatCnab('N', $detalhe->getValorMora(), 13, 2));
     $this->add(174, 179, Util::formatCnab('D', $detalhe->getDataLimiteDesconto(), 6));
     $this->add(180, 192, Util::formatCnab('N', $detalhe->getValorDesconto(), 13, 2));
     $this->add(193, 205, Util::formatCnab('N', $detalhe->getvalorIOF(), 13, 2));
     $this->add(206, 218, Util::formatCnab('N', $detalhe->getValorAbatimento(), 13, 2));
     $this->add(219, 220, Util::formatCnab('NL', $detalhe->getSacadoTipoDocumento(), 2));
     $this->add(221, 234, Util::formatCnab('L', $detalhe->getSacadoDocumento(), 14));
     $this->add(235, 274, Util::formatCnab('A', $detalhe->getSacadoNome(), 40));
     $this->add(275, 312, Util::formatCnab('A', $detalhe->getSacadoEndereco(), 38));
     $this->add(313, 314, Util::formatCnab('N', $detalhe->getNaoReceberDias(), 2));
     $this->add(315, 326, Util::formatCnab('A', $detalhe->getSacadoBairro(), 12));
     $this->add(327, 331, substr($detalhe->getSacadoCEP(), 0, 5));
     $this->add(332, 334, substr($detalhe->getSacadoCEP(), -3));
     $this->add(335, 349, Util::formatCnab('A', $detalhe->getSacadoCidade(), 15));
     $this->add(350, 351, Util::formatCnab('A', $detalhe->getSacadoEstado(), 2));
     $this->add(352, 390, Util::formatCnab('A', $detalhe->getSacadorAvalista(), 39));
     $this->add(391, 391, '');
     $this->add(392, 393, Util::formatCnab('N', $detalhe->getDiasProtesto(), 2));
     $this->add(394, 394, $detalhe->getTipoMoeda('9'));
     $this->add(395, 400, Util::formatCnab('N', $this->iRegistros + 1, 6));
     if (in_array('15', $detalhe->getInstrucoes()) || in_array('16', $detalhe->getInstrucoes()) || in_array('29', $detalhe->getInstrucoes())) {
         if (in_array('29', $detalhe->getInstrucoes())) {
             $detalhe->taxaMulta = 0;
         }
         if (empty($detalhe->getDataMulta()) || empty($detalhe->getTaxaMulta())) {
             throw new \Exception('Campos ausentes {dataMulta|taxaMulta}');
         }
         $string = Util::formatCnab('D', $detalhe->getDataMulta(), 6) . Util::formatCnab('N', $detalhe->getTaxaMulta(), 4, 2) . '000';
         $this->add(206, 218, Util::formatCnab('A', $string, 13, 0, 0));
     }
     if (in_array('19', $detalhe->getInstrucoes()) || in_array('22', $detalhe->getInstrucoes()) || in_array('24', $detalhe->getInstrucoes())) {
         if (in_array('24', $detalhe->getInstrucoes())) {
             $detalhe->xDiasMulta = 0;
         }
         if (empty($detalhe->getXDiasMulta()) || empty($detalhe->getValorMulta())) {
             throw new \Exception('Campos ausentes {xDiasMulta|valorMulta}');
         }
         $string = Util::formatCnab('N', $detalhe->getValorMulta(), 10, 2) . Util::formatCnab('N', $detalhe->getXDiasMulta(), 3);
         $this->add(206, 218, Util::formatCnab('A', $string, 13, 0, 0));
     }
     if (in_array('73', $detalhe->getInstrucoes()) || in_array('74', $detalhe->getInstrucoes())) {
         if (empty($detalhe->getTaxaMulta()) || empty($detalhe->getXDiasMulta())) {
             throw new \Exception('Campos ausentes {taxaMulta|xDiasMulta}');
         }
         $string = Util::formatCnab('A', '', 6) . Util::formatCnab('N', $detalhe->getTaxaMulta(), 4, 2) . Util::formatCnab('N', $detalhe->getXDiasMulta(), 3);
         $this->add(206, 218, Util::formatCnab('A', $string, 13, 0, 0));
     }
 }