getEspecieDocCodigo() public method

public getEspecieDocCodigo ( ) : mixed
return mixed
Esempio n. 1
0
 public function addBoleto(BoletoContract $boleto)
 {
     $this->iniciaDetalhe();
     $this->add(1, 1, '1');
     $this->add(2, 3, strlen(Util::onlyNumbers($this->getBeneficiario()->getDocumento())) == 14 ? '02' : '01');
     $this->add(4, 17, Util::formatCnab('9L', $this->getBeneficiario()->getDocumento(), 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, $this->getContaDv());
     $this->add(30, 33, Util::formatCnab('X', '', 4));
     $this->add(34, 37, '0000');
     $this->add(38, 62, Util::formatCnab('X', '', 25));
     // numero de controle
     $this->add(63, 70, Util::formatCnab('9', substr($boleto->getNossoNumero(), 0, -1), 8));
     $this->add(71, 83, Util::formatCnab('9', '0', 13, 2));
     $this->add(84, 86, Util::formatCnab('9', $this->getCarteiraNumero(), 3));
     $this->add(87, 107, Util::formatCnab('X', '', 21));
     $this->add(108, 108, 'I');
     $this->add(109, 110, '01');
     // REGISTRO
     if ($boleto->getStatus() == $boleto::STATUS_BAIXA) {
         $this->add(109, 110, '02');
         // BAIXA
     }
     if ($boleto->getStatus() == $boleto::STATUS_ALTERACAO) {
         $this->add(109, 110, '06');
         // ALTERAR VENCIMENTO
     }
     $this->add(111, 120, Util::formatCnab('X', $boleto->getNumeroDocumento(), 10));
     $this->add(121, 126, $boleto->getDataVencimento()->format('dmy'));
     $this->add(127, 139, Util::formatCnab('9', $boleto->getValor(), 13, 2));
     $this->add(140, 142, $this->getCodigoBanco());
     $this->add(143, 147, '00000');
     $this->add(148, 149, $boleto->getEspecieDocCodigo());
     $this->add(150, 150, $boleto->getAceite());
     $this->add(151, 156, $boleto->getDataDocumento()->format('dmy'));
     $this->add(157, 158, '00');
     $this->add(159, 160, '57');
     if ($boleto->getDiasProtesto() !== false) {
         $this->add(157, 158, '34');
     }
     $juros = 0;
     if ($boleto->getJuros() !== false) {
         $juros = Util::percent($boleto->getValor(), $boleto->getJuros()) / 30;
     }
     $this->add(161, 173, Util::formatCnab('9', $juros, 13, 2));
     $this->add(174, 179, '000000');
     $this->add(180, 192, Util::formatCnab('9', 0, 13, 2));
     $this->add(193, 205, Util::formatCnab('9', 0, 13, 2));
     $this->add(206, 218, Util::formatCnab('9', $boleto->getDescontosAbatimentos(), 13, 2));
     $this->add(219, 220, strlen(Util::onlyNumbers($boleto->getPagador()->getDocumento())) == 14 ? '02' : '01');
     $this->add(221, 234, Util::formatCnab('9L', $boleto->getPagador()->getDocumento(), 14));
     $this->add(235, 264, Util::formatCnab('X', $boleto->getPagador()->getNome(), 30));
     $this->add(265, 274, Util::formatCnab('X', '', 10));
     $this->add(275, 314, Util::formatCnab('X', $boleto->getPagador()->getEndereco(), 40));
     $this->add(315, 326, Util::formatCnab('X', $boleto->getPagador()->getBairro(), 12));
     $this->add(327, 334, Util::formatCnab('9L', $boleto->getPagador()->getCep(), 8));
     $this->add(335, 349, Util::formatCnab('X', $boleto->getPagador()->getCidade(), 15));
     $this->add(350, 351, Util::formatCnab('X', $boleto->getPagador()->getUf(), 2));
     $this->add(352, 381, Util::formatCnab('X', $boleto->getSacadorAvalista() ? $boleto->getSacadorAvalista()->getNome() : '', 30));
     $this->add(382, 385, Util::formatCnab('X', '', 4));
     $this->add(386, 391, $boleto->getDataVencimento()->copy()->addDays($boleto->getJurosApos(0))->format('dmy'));
     $this->add(392, 393, Util::formatCnab('9', $boleto->getDiasProtesto('0'), 2));
     $this->add(394, 394, '');
     $this->add(395, 400, Util::formatCnab('9', $this->iRegistros + 1, 6));
     return $this;
 }
Esempio n. 2
0
 public function addBoleto(BoletoContract $boleto)
 {
     $this->iniciaDetalhe();
     $this->total += $boleto->getValor();
     $this->add(1, 1, '1');
     $this->add(2, 3, strlen(Util::onlyNumbers($this->getBeneficiario()->getDocumento())) == 14 ? '02' : '01');
     $this->add(4, 17, Util::formatCnab('9L', $this->getBeneficiario()->getDocumento(), 14));
     $this->add(18, 37, Util::formatCnab('9', $this->getCodigoTransmissao(), 20));
     $this->add(38, 62, Util::formatCnab('X', $boleto->getNumero(), 25));
     // numero de controle
     $this->add(63, 70, Util::numberFormatGeral($boleto->getNumeroDocumento(), 7) . Util::modulo11($boleto->getNumeroDocumento()));
     $this->add(71, 76, '000000');
     $this->add(77, 77, '');
     $this->add(78, 78, $boleto->getMulta() > 0 ? '4' : '0');
     $this->add(79, 82, Util::formatCnab('9', $boleto->getMulta(), 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, $boleto->getDataVencimento()->copy()->addDays($boleto->getJurosApos())->format('dmy'));
     $this->add(108, 108, $this->getCarteiraNumero() > 200 ? '1' : '5');
     $this->add(109, 110, self::OCORRENCIA_REMESSA);
     // REGISTRO
     if ($boleto->getStatus() == $boleto::STATUS_BAIXA) {
         $this->add(109, 110, self::OCORRENCIA_PEDIDO_BAIXA);
         // BAIXA
     }
     if ($boleto->getStatus() == $boleto::STATUS_ALTERACAO) {
         $this->add(109, 110, self::OCORRENCIA_ALT_VENCIMENTO);
         // ALTERAR VENCIMENTO
     }
     $this->add(111, 120, Util::formatCnab('X', $boleto->getNumeroDocumento(), 10));
     $this->add(121, 126, $boleto->getDataVencimento()->format('dmy'));
     $this->add(127, 139, Util::formatCnab('9', $boleto->getValor(), 13, 2));
     $this->add(140, 142, $this->getCodigoBanco());
     $this->add(143, 147, '00000');
     $this->add(148, 149, $boleto->getEspecieDocCodigo());
     $this->add(150, 150, $boleto->getAceite());
     $this->add(151, 156, $boleto->getDataDocumento()->format('dmy'));
     $this->add(157, 158, self::INSTRUCAO_SEM);
     $this->add(159, 160, self::INSTRUCAO_SEM);
     if ($boleto->getDiasProtesto() > 0) {
         $this->add(157, 158, self::INSTRUCAO_PROTESTAR);
     }
     $juros = 0;
     if ($boleto->getJuros() > 0) {
         $juros = Util::percent($boleto->getValor(), $boleto->getJuros()) / 30;
     }
     $this->add(161, 173, Util::formatCnab('9', $juros, 13, 2));
     $this->add(174, 179, '000000');
     $this->add(180, 192, Util::formatCnab('9', 0, 13, 2));
     $this->add(193, 205, Util::formatCnab('9', 0, 13, 2));
     $this->add(206, 218, Util::formatCnab('9', $boleto->getDescontosAbatimentos(), 13, 2));
     $this->add(219, 220, strlen(Util::onlyNumbers($boleto->getPagador()->getDocumento())) == 14 ? '02' : '01');
     $this->add(221, 234, Util::formatCnab('9L', $boleto->getPagador()->getDocumento(), 14));
     $this->add(235, 274, Util::formatCnab('X', $boleto->getPagador()->getNome(), 40));
     $this->add(275, 314, Util::formatCnab('X', $boleto->getPagador()->getEndereco(), 40));
     $this->add(315, 326, Util::formatCnab('X', $boleto->getPagador()->getBairro(), 12));
     $this->add(327, 334, Util::formatCnab('9L', $boleto->getPagador()->getCep(), 8));
     $this->add(335, 349, Util::formatCnab('X', $boleto->getPagador()->getCidade(), 15));
     $this->add(350, 351, Util::formatCnab('X', $boleto->getPagador()->getUf(), 2));
     $this->add(352, 381, Util::formatCnab('X', $boleto->getSacadorAvalista() ? $boleto->getSacadorAvalista()->getNome() : '', 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', $boleto->getDiasProtesto('0'), 2));
     $this->add(394, 394, '');
     $this->add(395, 400, Util::formatCnab('9', $this->iRegistros + 1, 6));
     return $this;
 }
Esempio n. 3
0
 public function addBoleto(BoletoContract $boleto)
 {
     $this->iniciaDetalhe();
     $this->add(1, 1, '1');
     $this->add(2, 3, strlen(Util::onlyNumbers($this->getBeneficiario()->getDocumento())) == 14 ? '02' : '01');
     $this->add(4, 17, Util::formatCnab('9L', $this->getBeneficiario()->getDocumento(), 14));
     $this->add(18, 21, Util::formatCnab('9', $this->getAgencia(), 4));
     $this->add(22, 27, Util::formatCnab('9', $this->getCodigoCliente(), 6));
     $this->add(28, 28, '2');
     // ‘1’ = Banco Emite ‘2’ = Cliente Emite
     $this->add(29, 29, '0');
     // ‘0’ = Postagem pelo Beneficiário ‘1’ = Pagador via Correio ‘2’ = Beneficiário via Agência CAIXA ‘3’ = Pagador via e-mail
     $this->add(30, 31, '00');
     $this->add(32, 56, Util::formatCnab('X', $boleto->getNumero(), 25));
     // numero de controle
     $this->add(57, 73, Util::formatCnab('9', $boleto->getNossoNumero(), 17));
     $this->add(74, 76, '');
     $this->add(77, 106, '');
     $this->add(107, 108, Util::formatCnab('9', $this->getCarteiraNumero(), 2));
     $this->add(109, 110, self::OCORRENCIA_REMESSA);
     // REGISTRO
     if ($boleto->getStatus() == $boleto::STATUS_BAIXA) {
         $this->add(109, 110, self::OCORRENCIA_PEDIDO_BAIXA);
         // BAIXA
     }
     if ($boleto->getStatus() == $boleto::STATUS_ALTERACAO) {
         $this->add(109, 110, self::OCORRENCIA_ALT_VENCIMENTO);
         // ALTERAR VENCIMENTO
     }
     $this->add(111, 120, Util::formatCnab('X', $boleto->getNumeroDocumento(), 10));
     $this->add(121, 126, $boleto->getDataVencimento()->format('dmy'));
     $this->add(127, 139, Util::formatCnab('9', $boleto->getValor(), 13, 2));
     $this->add(140, 142, $this->getCodigoBanco());
     $this->add(143, 147, '00000');
     $this->add(148, 149, $boleto->getEspecieDocCodigo());
     $this->add(150, 150, $boleto->getAceite());
     $this->add(151, 156, $boleto->getDataDocumento()->format('dmy'));
     $this->add(157, 158, self::INSTRUCAO_SEM);
     $this->add(159, 160, self::INSTRUCAO_SEM);
     if ($boleto->getDiasProtesto() > 0) {
         $this->add(157, 158, self::INSTRUCAO_PROTESTAR_VENC_XX);
     }
     $juros = 0;
     if ($boleto->getJuros() > 0) {
         $juros = Util::percent($boleto->getValor(), $boleto->getJuros()) / 30;
     }
     $this->add(161, 173, Util::formatCnab('9', $juros, 13, 2));
     $this->add(174, 179, '000000');
     $this->add(180, 192, Util::formatCnab('9', 0, 13, 2));
     $this->add(193, 205, Util::formatCnab('9', 0, 13, 2));
     $this->add(206, 218, Util::formatCnab('9', $boleto->getDescontosAbatimentos(), 13, 2));
     $this->add(219, 220, strlen(Util::onlyNumbers($boleto->getPagador()->getDocumento())) == 14 ? '02' : '01');
     $this->add(221, 234, Util::formatCnab('9L', $boleto->getPagador()->getDocumento(), 14));
     $this->add(235, 274, Util::formatCnab('X', $boleto->getPagador()->getNome(), 40));
     $this->add(275, 314, Util::formatCnab('X', $boleto->getPagador()->getEndereco(), 40));
     $this->add(315, 326, '');
     $this->add(327, 334, Util::formatCnab('9L', $boleto->getPagador()->getCep(), 8));
     $this->add(335, 349, Util::formatCnab('X', $boleto->getPagador()->getCidade(), 15));
     $this->add(350, 351, Util::formatCnab('X', $boleto->getPagador()->getUf(), 2));
     $this->add(352, 357, $boleto->getDataVencimento()->copy()->addDays($boleto->getJurosApos())->format('dmy'));
     $this->add(358, 367, Util::formatCnab('9', Util::percent($boleto->getValor(), $boleto->getMulta()), 10, 2));
     $this->add(368, 389, Util::formatCnab('X', $boleto->getSacadorAvalista() ? $boleto->getSacadorAvalista()->getNome() : '', 22));
     $this->add(390, 391, '00');
     $this->add(392, 393, Util::formatCnab('9', $boleto->getDiasProtesto('0'), 2));
     $this->add(394, 394, Util::formatCnab('9', $boleto->getMoeda(), 1));
     $this->add(395, 400, Util::formatCnab('9', $this->iRegistros + 1, 6));
     return $this;
 }
Esempio n. 4
0
 public function addBoleto(BoletoContract $boleto)
 {
     $this->iniciaDetalhe();
     $beneficiario_id = '0' . Util::formatCnab('9', $this->getCarteiraNumero(), 3) . Util::formatCnab('9', $this->getAgencia(), 5) . Util::formatCnab('9', $this->getConta(), 7) . Util::formatCnab('9', $this->getContaDv(), 1);
     $this->add(1, 1, '1');
     $this->add(2, 6, '');
     $this->add(7, 7, '');
     $this->add(8, 12, '');
     $this->add(13, 19, '');
     $this->add(20, 20, '');
     $this->add(21, 37, Util::formatCnab('X', $beneficiario_id, 17));
     $this->add(38, 62, Util::formatCnab('X', $boleto->getNumero(), 25));
     // numero de controle
     $this->add(63, 65, $this->getCodigoBanco());
     $this->add(66, 66, $boleto->getMulta() > 0 ? '2' : '0');
     $this->add(67, 70, Util::formatCnab('9', $boleto->getMulta() > 0 ? $boleto->getMulta() : '0', 4, 2));
     $this->add(71, 81, Util::formatCnab('9', $boleto->getNossoNumero(), 11));
     $this->add(82, 82, Util::modulo11($boleto->getCarteira() . $boleto->getNossoNumero(), 2, 7, 0, 'P'));
     $this->add(83, 92, Util::formatCnab('9', 0, 10, 2));
     $this->add(93, 93, '2');
     // 1 = Banco emite e Processa o registro. 2 = Cliente emite e o Banco somente processa o registro
     $this->add(94, 94, '');
     // N= Não registra na cobrança. Diferente de N registra e emite Boleto.
     $this->add(95, 104, '');
     $this->add(105, 105, '');
     $this->add(106, 106, '2');
     // 1 = emite aviso, e assume o endereço do Pagador constante do Arquivo-Remessa; 2 = não emite aviso;
     $this->add(107, 108, '');
     $this->add(109, 110, self::OCORRENCIA_REMESSA);
     // REGISTRO
     if ($boleto->getStatus() == $boleto::STATUS_BAIXA) {
         $this->add(109, 110, self::OCORRENCIA_PEDIDO_BAIXA);
         // BAIXA
     }
     if ($boleto->getStatus() == $boleto::STATUS_ALTERACAO) {
         $this->add(109, 110, self::OCORRENCIA_ALT_VENCIMENTO);
         // ALTERAR VENCIMENTO
     }
     $this->add(111, 120, Util::formatCnab('X', $boleto->getNumeroDocumento(), 10));
     $this->add(121, 126, $boleto->getDataVencimento()->format('dmy'));
     $this->add(127, 139, Util::formatCnab('9', $boleto->getValor(), 13, 2));
     $this->add(140, 142, '');
     $this->add(143, 147, '00000');
     $this->add(148, 149, $boleto->getEspecieDocCodigo());
     $this->add(150, 150, 'N');
     $this->add(151, 156, $boleto->getDataDocumento()->format('dmy'));
     $this->add(157, 158, self::INSTRUCAO_SEM);
     $this->add(159, 160, self::INSTRUCAO_SEM);
     if ($boleto->getDiasProtesto() > 0) {
         $this->add(157, 158, self::INSTRUCAO_PROTESTAR_XX);
         $this->add(159, 160, Util::formatCnab('9', $boleto->getDiasProtesto(), 2));
     }
     $juros = 0;
     if ($boleto->getJuros() > 0) {
         $juros = Util::percent($boleto->getValor(), $boleto->getJuros()) / 30;
     }
     $this->add(161, 173, Util::formatCnab('9', $juros, 13, 2));
     $this->add(174, 179, '000000');
     $this->add(180, 192, Util::formatCnab('9', 0, 13, 2));
     $this->add(193, 205, Util::formatCnab('9', 0, 13, 2));
     $this->add(206, 218, Util::formatCnab('9', $boleto->getDescontosAbatimentos(), 13, 2));
     $this->add(219, 220, strlen(Util::onlyNumbers($boleto->getPagador()->getDocumento())) == 14 ? '02' : '01');
     $this->add(221, 234, Util::formatCnab('9L', $boleto->getPagador()->getDocumento(), 14));
     $this->add(235, 274, Util::formatCnab('X', $boleto->getPagador()->getNome(), 40));
     $this->add(275, 314, Util::formatCnab('X', $boleto->getPagador()->getEndereco(), 40));
     $this->add(315, 326, Util::formatCnab('X', $boleto->getPagador()->getBairro(), 12));
     $this->add(327, 334, Util::formatCnab('9L', $boleto->getPagador()->getCep(), 8));
     $this->add(335, 394, Util::formatCnab('X', $boleto->getSacadorAvalista() ? $boleto->getSacadorAvalista()->getNome() : '', 60));
     $this->add(395, 400, Util::formatCnab('9', $this->iRegistros + 1, 6));
     return $this;
 }
Esempio n. 5
0
 public function addBoleto(BoletoContract $boleto)
 {
     $this->iniciaDetalhe();
     $this->add(1, 1, 7);
     $this->add(2, 3, strlen(Util::onlyNumbers($this->getBeneficiario()->getDocumento())) == 14 ? '02' : '01');
     $this->add(4, 17, Util::formatCnab('9L', $this->getBeneficiario()->getDocumento(), 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()));
     $this->add(32, 38, Util::formatCnab('9', $this->getConvenio(), 7));
     $this->add(39, 63, Util::formatCnab('X', '', 25));
     // numero de controle
     $this->add(64, 80, $boleto->getNossoNumero());
     $this->add(81, 82, '00');
     $this->add(83, 84, '00');
     $this->add(85, 87, '');
     $this->add(88, 88, $boleto->getSacadorAvalista() ? 'A' : '');
     $this->add(89, 91, '');
     $this->add(92, 94, Util::formatCnab('9', $this->getVariacaoCarteira(), 3));
     $this->add(95, 95, '0');
     $this->add(96, 101, '000000');
     $this->add(102, 106, Util::formatCnab('X', '', 5));
     $this->add(107, 108, $this->getCarteiraNumero());
     $this->add(109, 110, '01');
     // REGISTRO
     if ($boleto->getStatus() == $boleto::STATUS_BAIXA) {
         $this->add(109, 110, '02');
         // BAIXA
     }
     if ($boleto->getStatus() == $boleto::STATUS_ALTERACAO) {
         $this->add(109, 110, '06');
         // ALTERAR VENCIMENTO
     }
     $this->add(111, 120, Util::formatCnab('X', $boleto->getNumeroDocumento(), 10));
     $this->add(121, 126, $boleto->getDataVencimento()->format('dmy'));
     $this->add(127, 139, Util::formatCnab('9', $boleto->getValor(), 13, 2));
     $this->add(140, 142, $this->getCodigoBanco());
     $this->add(143, 146, '0000');
     $this->add(147, 147, '');
     $this->add(148, 149, $boleto->getEspecieDocCodigo());
     $this->add(150, 150, $boleto->getAceite());
     $this->add(151, 156, $boleto->getDataDocumento()->format('dmy'));
     $this->add(157, 158, '00');
     $this->add(159, 160, '00');
     switch ($boleto->getDiasProtesto()) {
         case '03':
             //- 03 - Protestar no 3º dia útil após vencido
             $this->add(157, 158, '03');
             break;
         case '04':
             //- 04 - Protestar no 4º dia útil após vencido
             $this->add(157, 158, '04');
             break;
         case '05':
             //- 05 - Protestar no 5º dia útil após vencido
             $this->add(157, 158, '05');
             break;
         case '10':
             //- 10 - Protestar no 10º dia corrido após vencido
             $this->add(157, 158, '10');
             break;
         case '15':
             //- 15 - Protestar no 15º dia corrido após vencido
             $this->add(157, 158, '15');
             break;
         case '20':
             //- 20 - Protestar no 20º dia corrido após vencido
             $this->add(157, 158, '20');
             break;
         case '25':
             //- 25 - Protestar no 25º dia corrido após vencido
             $this->add(157, 158, '25');
             break;
         case '30':
             //- 30 - Protestar no 30º dia corrido após vencido
             $this->add(157, 158, '30');
             break;
         case '45':
             //- 45 - Protestar no 45º dia corrido após vencido
             $this->add(157, 158, '45');
             break;
     }
     $juros = 0;
     if ($boleto->getJuros() !== false) {
         $juros = Util::percent($boleto->getValor(), $boleto->getJuros()) / 30;
     }
     $this->add(161, 173, Util::formatCnab('9', $juros, 13, 2));
     $this->add(174, 179, '000000');
     $this->add(180, 192, Util::formatCnab('9', 0, 13, 2));
     $this->add(193, 205, Util::formatCnab('9', 0, 13, 2));
     $this->add(206, 218, Util::formatCnab('9', $boleto->getDescontosAbatimentos(), 13, 2));
     $this->add(219, 220, strlen(Util::onlyNumbers($boleto->getPagador()->getDocumento())) == 14 ? '02' : '01');
     $this->add(221, 234, Util::formatCnab('9L', $boleto->getPagador()->getDocumento(), 14));
     $this->add(235, 271, Util::formatCnab('X', $boleto->getPagador()->getNome(), 37));
     $this->add(272, 274, Util::formatCnab('N', '', 3));
     $this->add(275, 314, Util::formatCnab('X', $boleto->getPagador()->getEndereco(), 40));
     $this->add(315, 326, Util::formatCnab('X', $boleto->getPagador()->getBairro(), 12));
     $this->add(327, 334, Util::formatCnab('9L', $boleto->getPagador()->getCep(), 8));
     $this->add(335, 349, Util::formatCnab('X', $boleto->getPagador()->getCidade(), 15));
     $this->add(350, 351, Util::formatCnab('X', $boleto->getPagador()->getUf(), 2));
     $this->add(352, 391, Util::formatCnab('X', $boleto->getSacadorAvalista() ? $boleto->getSacadorAvalista()->getNome() : '', 40));
     $this->add(392, 393, '00');
     $this->add(394, 394, '');
     $this->add(395, 400, Util::formatCnab('N', $this->iRegistros + 1, 6));
     if ($boleto->getMulta() !== false) {
         $this->iniciaDetalhe();
         $this->add(1, 1, 5);
         $this->add(2, 3, 99);
         $this->add(4, 4, 2);
         $this->add(5, 10, $boleto->getDataVencimento()->copy()->addDays($boleto->getJurosApos(0))->format('dmy'));
         $this->add(11, 22, Util::formatCnab('9', $boleto->getMulta(), 7, 2));
         $this->add(23, 394, '');
         $this->add(23, 394, '');
         $this->add(395, 400, Util::formatCnab('N', $this->iRegistros + 1, 6));
     }
 }
Esempio n. 6
0
 public function addBoleto(BoletoContract $boleto)
 {
     $this->iniciaDetalhe();
     $this->add(1, 1, '1');
     $this->add(2, 3, strlen(Util::onlyNumbers($this->getBeneficiario()->getDocumento())) == 14 ? '02' : '01');
     $this->add(4, 17, Util::formatCnab('9L', $this->getBeneficiario()->getDocumento(), 14));
     $this->add(18, 18, 0);
     $this->add(19, 22, Util::formatCnab('9', $this->getAgencia(), 4));
     $this->add(23, 24, '55');
     $this->add(25, 28, Util::formatCnab('9L', $this->getAgencia(), 4));
     $this->add(29, 34, Util::formatCnab('9L', $this->getConta(), 6));
     $this->add(35, 35, Util::formatCnab('9L', $this->getContaDv(), 1));
     $this->add(36, 37, '');
     $this->add(38, 62, Util::formatCnab('X', $boleto->getNumero(), 25));
     // numero de controle
     $this->add(63, 73, Util::formatCnab('9', $boleto->getNossoNumero(), 11));
     $this->add(74, 79, '000000');
     $this->add(80, 90, Util::formatCnab('9', 0, 11, 2));
     $this->add(91, 96, '000000');
     $this->add(97, 107, Util::formatCnab('9', 0, 11, 2));
     $this->add(108, 108, $this->getCarteiraNumero());
     $this->add(109, 110, self::OCORRENCIA_REMESSA);
     // REGISTRO
     if ($boleto->getStatus() == $boleto::STATUS_BAIXA) {
         $this->add(109, 110, self::OCORRENCIA_PEDIDO_BAIXA);
         // BAIXA
     }
     if ($boleto->getStatus() == $boleto::STATUS_ALTERACAO) {
         $this->add(109, 110, self::OCORRENCIA_ALT_VENCIMENTO);
         // ALTERAR VENCIMENTO
     }
     $this->add(111, 120, Util::formatCnab('X', $boleto->getNumeroDocumento(), 10));
     $this->add(121, 126, $boleto->getDataVencimento()->format('dmy'));
     $this->add(127, 139, Util::formatCnab('9', $boleto->getValor(), 13, 2));
     $this->add(140, 142, $this->getCodigoBanco());
     $this->add(143, 147, '00000');
     $this->add(148, 149, $boleto->getEspecieDocCodigo());
     $this->add(150, 150, $boleto->getAceite());
     $this->add(151, 156, $boleto->getDataDocumento()->format('dmy'));
     $this->add(157, 158, self::INSTRUCAO_SEM);
     $this->add(159, 160, self::INSTRUCAO_SEM);
     if ($boleto->getDiasProtesto() > 0) {
         $this->add(157, 158, self::INSTRUCAO_PROTESTAR_XX_VENC_UTEIS);
     }
     if ($boleto->getMulta() > 0) {
         $this->add(159, 160, self::INSTRUCAO_MULTA_PERC_XX_APOS_VENC_UTEIS);
         $this->add(206, 211, '');
         $this->add(206, 215, Util::formatCnab('9', $boleto->getMulta(), 2, 2));
         $this->add(206, 218, Util::formatCnab('9', $boleto->getJurosApos(), 3));
     } else {
         $this->add(206, 218, Util::formatCnab('9', $boleto->getDescontosAbatimentos(), 13, 2));
     }
     $juros = 0;
     if ($boleto->getJuros() > 0) {
         $juros = Util::percent($boleto->getValor(), $boleto->getJuros()) / 30;
     }
     $this->add(161, 173, Util::formatCnab('9', $juros, 13, 2));
     $this->add(174, 179, '000000');
     $this->add(180, 192, Util::formatCnab('9', 0, 13, 2));
     $this->add(193, 205, Util::formatCnab('9', 0, 13, 2));
     $this->add(219, 220, strlen(Util::onlyNumbers($boleto->getPagador()->getDocumento())) == 14 ? '02' : '01');
     $this->add(221, 234, Util::formatCnab('9L', $boleto->getPagador()->getDocumento(), 14));
     $this->add(235, 274, Util::formatCnab('X', $boleto->getPagador()->getNome(), 40));
     $this->add(275, 312, Util::formatCnab('X', $boleto->getPagador()->getEndereco(), 38));
     $this->add(313, 314, '00');
     $this->add(315, 326, '');
     $this->add(327, 334, Util::formatCnab('9L', $boleto->getPagador()->getCep(), 8));
     $this->add(335, 349, Util::formatCnab('X', $boleto->getPagador()->getCidade(), 15));
     $this->add(350, 351, Util::formatCnab('X', $boleto->getPagador()->getUf(), 2));
     $this->add(352, 390, Util::formatCnab('X', $boleto->getSacadorAvalista() ? $boleto->getSacadorAvalista()->getNome() : '', 39));
     $this->add(391, 391, '');
     $this->add(392, 393, Util::formatCnab('9', $boleto->getDiasProtesto('  '), 2));
     $this->add(394, 394, $boleto->getMoeda());
     $this->add(395, 400, Util::formatCnab('9', $this->iRegistros + 1, 6));
 }
Esempio n. 7
0
 public function addBoleto(BoletoContract $boleto)
 {
     $this->iniciaDetalhe();
     $this->add(1, 1, 7);
     $this->add(2, 3, strlen(Util::onlyNumbers($this->getBeneficiario()->getDocumento())) == 14 ? '02' : '01');
     $this->add(4, 17, Util::formatCnab('9L', $this->getBeneficiario()->getDocumento(), 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()));
     $this->add(32, 38, Util::formatCnab('9', $this->getConvenio(), 7));
     $this->add(39, 63, Util::formatCnab('X', $boleto->getNumero(), 25));
     // numero de controle
     $this->add(64, 80, $boleto->getNossoNumero());
     $this->add(81, 82, '00');
     $this->add(83, 84, '00');
     $this->add(85, 87, '');
     $this->add(88, 88, $boleto->getSacadorAvalista() ? 'A' : '');
     $this->add(89, 91, '');
     $this->add(92, 94, Util::formatCnab('9', $this->getVariacaoCarteira(), 3));
     $this->add(95, 95, '0');
     $this->add(96, 101, '000000');
     $this->add(102, 106, '');
     $this->add(107, 108, $this->getCarteiraNumero());
     $this->add(109, 110, self::OCORRENCIA_REMESSA);
     // REGISTRO
     if ($boleto->getStatus() == $boleto::STATUS_BAIXA) {
         $this->add(109, 110, self::OCORRENCIA_PEDIDO_BAIXA);
         // BAIXA
     }
     if ($boleto->getStatus() == $boleto::STATUS_ALTERACAO) {
         $this->add(109, 110, self::OCORRENCIA_ALT_VENCIMENTO);
         // ALTERAR VENCIMENTO
     }
     $this->add(111, 120, Util::formatCnab('X', $boleto->getNumeroDocumento(), 10));
     $this->add(121, 126, $boleto->getDataVencimento()->format('dmy'));
     $this->add(127, 139, Util::formatCnab('9', $boleto->getValor(), 13, 2));
     $this->add(140, 142, $this->getCodigoBanco());
     $this->add(143, 146, '0000');
     $this->add(147, 147, '');
     $this->add(148, 149, $boleto->getEspecieDocCodigo());
     $this->add(150, 150, $boleto->getAceite());
     $this->add(151, 156, $boleto->getDataDocumento()->format('dmy'));
     $this->add(157, 158, self::INSTRUCAO_SEM);
     $this->add(159, 160, self::INSTRUCAO_SEM);
     $diasProtesto = '00';
     $const = sprintf('self::INSTRUCAO_PROTESTAR_VENC_%02s', $boleto->getDiasProtesto());
     if (defined($const)) {
         $this->add(157, 158, constant($const));
     } else {
         $this->add(157, 158, self::INSTRUCAO_PROTESTAR_VENC_XX);
         $diasProtesto = Util::formatCnab('9', $boleto->getDiasProtesto(), 2, 0);
     }
     $juros = 0;
     if ($boleto->getJuros() > 0) {
         $juros = Util::percent($boleto->getValor(), $boleto->getJuros()) / 30;
     }
     $this->add(161, 173, Util::formatCnab('9', $juros, 13, 2));
     $this->add(174, 179, '000000');
     $this->add(180, 192, Util::formatCnab('9', 0, 13, 2));
     $this->add(193, 205, Util::formatCnab('9', 0, 13, 2));
     $this->add(206, 218, Util::formatCnab('9', $boleto->getDescontosAbatimentos(), 13, 2));
     $this->add(219, 220, strlen(Util::onlyNumbers($boleto->getPagador()->getDocumento())) == 14 ? '02' : '01');
     $this->add(221, 234, Util::formatCnab('9L', $boleto->getPagador()->getDocumento(), 14));
     $this->add(235, 271, Util::formatCnab('X', $boleto->getPagador()->getNome(), 37));
     $this->add(272, 274, '');
     $this->add(275, 314, Util::formatCnab('X', $boleto->getPagador()->getEndereco(), 40));
     $this->add(315, 326, Util::formatCnab('X', $boleto->getPagador()->getBairro(), 12));
     $this->add(327, 334, Util::formatCnab('9L', $boleto->getPagador()->getCep(), 8));
     $this->add(335, 349, Util::formatCnab('X', $boleto->getPagador()->getCidade(), 15));
     $this->add(350, 351, Util::formatCnab('X', $boleto->getPagador()->getUf(), 2));
     $this->add(352, 391, Util::formatCnab('X', $boleto->getSacadorAvalista() ? $boleto->getSacadorAvalista()->getNome() : '', 40));
     $this->add(392, 393, $diasProtesto);
     $this->add(394, 394, '');
     $this->add(395, 400, Util::formatCnab('9', $this->iRegistros + 1, 6));
     if ($boleto->getMulta() > 0) {
         $this->iniciaDetalhe();
         $this->add(1, 1, 5);
         $this->add(2, 3, 99);
         $this->add(4, 4, 2);
         $this->add(5, 10, $boleto->getDataVencimento()->copy()->addDays($boleto->getJurosApos())->format('dmy'));
         $this->add(11, 22, Util::formatCnab('9', $boleto->getMulta(), 7, 2));
         $this->add(23, 394, '');
         $this->add(23, 394, '');
         $this->add(395, 400, Util::formatCnab('9', $this->iRegistros + 1, 6));
     }
 }
Esempio n. 8
0
 public function addBoleto(BoletoContract $boleto)
 {
     if (!$boleto->isComRegistro()) {
         return $this;
     }
     $this->iniciaDetalhe();
     $this->add(1, 1, '1');
     $this->add(2, 2, 'A');
     $this->add(3, 3, 'A');
     $this->add(4, 4, 'A');
     $this->add(5, 16, '');
     $this->add(17, 17, 'A');
     $this->add(18, 18, 'A');
     $this->add(19, 19, 'B');
     $this->add(20, 47, '');
     $this->add(48, 56, Util::formatCnab('9', $boleto->getNossoNumero(), 9));
     $this->add(57, 62, '');
     $this->add(63, 70, Carbon::now()->format('Ymd'));
     $this->add(71, 71, '');
     $this->add(72, 72, $boleto->getByte() == 1 ? 'S' : 'N');
     $this->add(73, 73, '');
     $this->add(74, 74, $boleto->getByte() == 1 ? 'A' : 'B');
     $this->add(75, 76, '');
     $this->add(77, 78, '');
     $this->add(79, 82, '');
     $this->add(83, 92, Util::formatCnab('9', 0, 10, 2));
     $this->add(93, 96, Util::formatCnab('9', $boleto->getMulta(), 4, 2));
     $this->add(97, 108, '');
     $this->add(109, 110, self::OCORRENCIA_REMESSA);
     // REGISTRO
     if ($boleto->getStatus() == $boleto::STATUS_BAIXA) {
         $this->add(109, 110, self::OCORRENCIA_BAIXA);
         // BAIXA
     }
     if ($boleto->getStatus() == $boleto::STATUS_ALTERACAO) {
         $this->add(109, 110, self::OCORRENCIA_ALT_VENCIMENTO);
         // ALTERAR VENCIMENTO
     }
     $this->add(111, 120, Util::formatCnab('X', $boleto->getNumeroDocumento(), 10));
     $this->add(121, 126, $boleto->getDataVencimento()->format('dmy'));
     $this->add(127, 139, Util::formatCnab('9', $boleto->getValor(), 13, 2));
     $this->add(140, 148, '');
     $this->add(149, 149, $boleto->getEspecieDocCodigo('A'));
     $this->add(150, 150, $boleto->getAceite());
     $this->add(151, 156, $boleto->getDataDocumento()->format('dmy'));
     $this->add(157, 158, self::INSTRUCAO_SEM);
     $this->add(159, 160, self::INSTRUCAO_SEM);
     if ($boleto->getDiasProtesto() > 0) {
         $this->add(157, 158, self::INSTRUCAO_PROTESTO);
         $this->add(159, 160, Util::formatCnab('9', $boleto->getDiasProtesto(), 2));
     }
     $this->add(161, 173, Util::formatCnab('9', $boleto->getJuros(), 13, 2));
     $this->add(174, 179, $boleto->getDataVencimento()->format('dmy'));
     $this->add(180, 192, Util::formatCnab('9', $boleto->getDescontosAbatimentos(), 13, 2));
     $this->add(193, 205, Util::formatCnab('9', 0, 13, 2));
     $this->add(206, 218, Util::formatCnab('9', $boleto->getDescontosAbatimentos(), 13, 2));
     $this->add(219, 220, strlen(Util::onlyNumbers($boleto->getPagador()->getDocumento())) == 14 ? '20' : '10');
     $this->add(221, 234, Util::formatCnab('9L', $boleto->getPagador()->getDocumento(), 14));
     $this->add(235, 274, Util::formatCnab('X', $boleto->getPagador()->getNome(), 40));
     $this->add(275, 314, Util::formatCnab('X', $boleto->getPagador()->getEndereco(), 40));
     $this->add(315, 319, '00000');
     $this->add(320, 325, '000000');
     $this->add(326, 326, ' ');
     $this->add(327, 334, Util::formatCnab('9L', $boleto->getPagador()->getCep(), 8));
     $this->add(335, 339, '00000');
     $this->add(340, 353, Util::formatCnab('9L', $boleto->getSacadorAvalista() ? $boleto->getSacadorAvalista()->getDocumento() : '', 14));
     $this->add(354, 394, Util::formatCnab('X', $boleto->getSacadorAvalista() ? $boleto->getSacadorAvalista()->getNome() : '', 41));
     $this->add(395, 400, Util::formatCnab('9', $this->iRegistros + 1, 6));
     if ($boleto->getByte() == 1) {
         $this->iniciaDetalhe();
         $this->add(1, 1, '2');
         $this->add(2, 12, '');
         $this->add(13, 21, Util::formatCnab('9', $boleto->getNossoNumero(), 9));
         $this->add(22, 101, Util::formatCnab('X', $boleto->getInstrucoes()[0], 80));
         $this->add(102, 181, Util::formatCnab('X', $boleto->getInstrucoes()[1], 80));
         $this->add(122, 261, Util::formatCnab('X', $boleto->getInstrucoes()[2], 80));
         $this->add(262, 341, Util::formatCnab('X', $boleto->getInstrucoes()[3], 80));
         $this->add(342, 351, Util::formatCnab('9', $boleto->getNumeroDocumento(), 10));
         $this->add(352, 394, '');
         $this->add(395, 400, Util::formatCnab('9', $this->iRegistros + 1, 6));
     }
     return $this;
 }