diff --git a/exemplos/abc_remessa.php b/exemplos/abc_remessa.php index 9b716bac..ec951cae 100644 --- a/exemplos/abc_remessa.php +++ b/exemplos/abc_remessa.php @@ -38,7 +38,6 @@ 'operacao' => 1234567, 'agencia' => '0001', 'conta' => '7654321', - 'chaveNfe' => '35240826589893000146550010000263841557593869', ]); $remessa = new Eduardokum\LaravelBoleto\Cnab\Remessa\Cnab400\Banco\Abc([ diff --git a/src/Cnab/Remessa/Cnab400/Banco/Abc.php b/src/Cnab/Remessa/Cnab400/Banco/Abc.php index f87f4d0c..c70384c0 100644 --- a/src/Cnab/Remessa/Cnab400/Banco/Abc.php +++ b/src/Cnab/Remessa/Cnab400/Banco/Abc.php @@ -211,16 +211,20 @@ public function addBoleto(BoletoContract $boleto) $this->add(38, 81, Util::formatCnab('9', $nota1->getChave(), 44)); // Chave da nota 1 $nota2 = $boleto->getNotaFiscal(1); - $this->add(82, 96, Util::formatCnab('X', $nota2->getNumero(), 15)); // Numero da nota 2 - $this->add(97, 109, Util::formatCnab('9', $nota2->getValor(), 11, 2)); // valor da nota 2 - $this->add(110, 117, Util::formatCnab('9', $nota2->getData('dmY'), 8)); // data nota 2 - $this->add(118, 161, Util::formatCnab('9', $nota2->getChave(), 44)); // Chave da nota 2 + if ($nota2->getChave()) { + $this->add(82, 96, Util::formatCnab('X', $nota2->getNumero(), 15)); // Numero da nota 2 + $this->add(97, 109, Util::formatCnab('9', $nota2->getValor(), 11, 2)); // valor da nota 2 + $this->add(110, 117, Util::formatCnab('9', $nota2->getData('dmY'), 8)); // data nota 2 + $this->add(118, 161, Util::formatCnab('9', $nota2->getChave(), 44)); // Chave da nota 2 + } $nota3 = $boleto->getNotaFiscal(2); - $this->add(162, 176, Util::formatCnab('X', $nota3->getNumero(), 15)); // Numero da nota 3 - $this->add(177, 189, Util::formatCnab('9', $nota3->getValor(), 11, 2)); // valor da nota 3 - $this->add(190, 197, Util::formatCnab('9', $nota3->getData('dmY'), 8)); // data nota 3 - $this->add(198, 241, Util::formatCnab('9', $nota3->getChave(), 44)); // Chave da nota 3 + if ($nota3->getChave()) { + $this->add(162, 176, Util::formatCnab('X', $nota3->getNumero(), 15)); // Numero da nota 3 + $this->add(177, 189, Util::formatCnab('9', $nota3->getValor(), 11, 2)); // valor da nota 3 + $this->add(190, 197, Util::formatCnab('9', $nota3->getData('dmY'), 8)); // data nota 3 + $this->add(198, 241, Util::formatCnab('9', $nota3->getChave(), 44)); // Chave da nota 3 + } $this->add(395, 400, Util::formatCnab('9', $this->iRegistros + 1, 6)); }