Skip to content

Commit

Permalink
diversas correções enviadas
Browse files Browse the repository at this point in the history
  • Loading branch information
eduardokum committed Mar 16, 2021
1 parent 797b99f commit 82e1a7d
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 42 deletions.
2 changes: 1 addition & 1 deletion exemplos/sicredi_retorno.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
require 'autoload.php';

$retorno = \Eduardokum\LaravelBoleto\Cnab\Retorno\Factory::make(__DIR__ . DIRECTORY_SEPARATOR . 'arquivos' . DIRECTORY_SEPARATOR . 'itau.ret');
$retorno = \Eduardokum\LaravelBoleto\Cnab\Retorno\Factory::make(__DIR__ . DIRECTORY_SEPARATOR . 'arquivos' . DIRECTORY_SEPARATOR . 'sicredi.ret');
$retorno->processar();

echo $retorno->getBancoNome();
Expand Down
43 changes: 10 additions & 33 deletions src/Boleto/Banco/Bradesco.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,39 +45,16 @@ class Bradesco extends AbstractBoleto implements BoletoContract
* @var string
*/
protected $especiesCodigo240 = [
'CH' => '01', // Cheque
'DM' => '02', // Duplicata Mercantil
'DMI' => '03', // Duplicata Mercantil p/ Indicação
'DS' => '04', // Duplicata de Serviço
'DSI' => '05', // Duplicata de Serviço p/ Indicação
'DR' => '06', // Duplicata Rural
'LC' => '07', // Letra de Câmbio
'NCC' => '08', // Nota de Crédito Comercial
'NCE' => '09', // Nota de Crédito a Exportação
'NCI' => '10', // Nota de Crédito Industrial
'NCR' => '11', // Nota de Crédito Rural
'NP' => '12', // Nota Promissória
'NPR' => '13', // Nota Promissória Rural
'TM' => '14', // Triplicata Mercantil
'TS' => '15', // Triplicata de Serviço
'NS' => '16', // Nota de Seguro
'RC' => '17', // Recibo
'FAT' => '18', // Fatura
'ND' => '19', // Nota de Débito
'AP' => '20', // Apólice de Seguro
'ME' => '21', // Mensalidade Escolar
'PC' => '22', // Parcela de Consórcio
'NF' => '23', // Nota Fiscal
'DD' => '24', // Documento de Dívida
'CPR' => '25', // Cédula de Produto Rural
'WAR' => '26', // Warrant
'DAE' => '27', // Dívida Ativa do Estado
'DAM' => '28', // Dívida Ativa do Município
'DAU' => '29', // Dívida Ativa da União
'EC' => '30', // Encargos condominiais
'CC' => '31', // Cartão de Crédito
'BDP' => '32', // Boleto de Proposta
'O' => '99', // Outros
'DM' => '01', //Duplicata
'NP' => '02', //Nota Promissória
'NS' => '03', //Nota de Seguro
'CS' => '04', //Cobrança Seriada
'RC' => '05', //Recibo
'LC' => '10', //Letras de Câmbio
'ND' => '11', //Nota de Débito
'DS' => '12', //Duplicata de Serv.
'BP' => '30', //Boleto de Proposta
'O' => '99', //Outros,
];
/**
* Espécie do documento, coódigo para remessa
Expand Down
18 changes: 11 additions & 7 deletions src/Cnab/Remessa/Cnab240/Banco/Caixa.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,8 @@ protected function segmentoP(BoletoContract $boleto)
}
$this->add(18, 22, Util::formatCnab('9', $this->getAgencia(), 5));
$this->add(23, 23, CalculoDV::cefAgencia($this->getAgencia()));
$this->add(24, 29, Util::formatCnab('9', $this->getCodigoCliente(), 6));
$this->add(30, 37, '00000000');
$this->add(24, 30, Util::formatCnab('9', $this->getCodigoCliente(), 7));
$this->add(31, 37, '0000000');
$this->add(38, 39, '00');
$this->add(40, 57, Util::formatCnab('9', $boleto->getNossoNumero(), 18));
$this->add(58, 58, '1'); //'1' = Cobrança Simples
Expand Down Expand Up @@ -290,8 +290,8 @@ protected function header()
$this->add(33, 52, Util::formatCnab('9', 0, 20));
$this->add(53, 57, Util::formatCnab('9', $this->getAgencia(), 5));
$this->add(58, 58, CalculoDV::cefAgencia($this->getAgencia()));
$this->add(59, 64, Util::formatCnab('9', $this->getCodigoCliente(), 6));
$this->add(65, 72, '00000000');
$this->add(59, 65, Util::formatCnab('9', $this->getCodigoCliente(), 7));
$this->add(66, 72, '0000000');
$this->add(73, 102, Util::formatCnab('X', $this->getBeneficiario()->getNome(), 30));
$this->add(103, 132, Util::formatCnab('X', 'CAIXA ECONOMICA FEDERAL', 30));
$this->add(133, 142, '');
Expand Down Expand Up @@ -329,11 +329,15 @@ protected function headerLote()
$this->add(17, 17, '');
$this->add(18, 18, strlen(Util::onlyNumbers($this->getBeneficiario()->getDocumento())) == 14 ? 2 : 1);
$this->add(19, 33, Util::formatCnab('9', Util::onlyNumbers($this->getBeneficiario()->getDocumento()), 15));
$this->add(34, 39, Util::formatCnab('9', Util::onlyNumbers($this->getCodigoCliente()), 6));
$this->add(40, 53, Util::formatCnab('9', 0, 14));
$this->add(34, 40, Util::formatCnab('9', Util::onlyNumbers($this->getCodigoCliente()), 7));
$this->add(41, 53, Util::formatCnab('9', 0, 13));
$this->add(54, 58, Util::formatCnab('9', $this->getAgencia(), 5));
$this->add(59, 59, CalculoDV::cefAgencia($this->getAgencia()));
$this->add(60, 65, Util::formatCnab('9', Util::onlyNumbers($this->getCodigoCliente()), 6));
if(strlen($this->getCodigoCliente()) == 7) {
$this->add(60, 65, '000000');
} else {
$this->add(60, 65, Util::formatCnab('9', Util::onlyNumbers($this->getCodigoCliente()), 6));
}
$this->add(66, 72, '0000000');
$this->add(73, 73, '0');
$this->add(74, 103, Util::formatCnab('X', $this->getBeneficiario()->getNome(), 30));
Expand Down
2 changes: 1 addition & 1 deletion src/Cnab/Remessa/Cnab400/Banco/Bb.php
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ public function addBoleto(BoletoContract $boleto)
$this->add(157, 158, $boleto->getStatus() == $boleto::STATUS_BAIXA ? self::INSTRUCAO_BAIXAR : self::INSTRUCAO_SEM);
$this->add(159, 160, self::INSTRUCAO_SEM);
$diasProtesto = '00';
$const = sprintf('self::INSTRUCAO_PROTESTAR_VENC_%02s', $boleto->getDiasProtesto());
$const = $boleto->getDiasProtesto() > 0 ? sprintf('self::INSTRUCAO_PROTESTAR_VENC_%02s', $boleto->getDiasProtesto()) : 'self::INSTRUCAO_NAO_PROTESTAR';
if ($boleto->getStatus() != $boleto::STATUS_BAIXA) {
if (defined($const)) {
$this->add(157, 158, constant($const));
Expand Down

0 comments on commit 82e1a7d

Please sign in to comment.