@@ -140,8 +140,8 @@ protected function segmentoP(BoletoContract $boleto)
140
140
}
141
141
$ this ->add (18 , 22 , Util::formatCnab ('9 ' , $ this ->getAgencia (), 5 ));
142
142
$ this ->add (23 , 23 , CalculoDV::cefAgencia ($ this ->getAgencia ()));
143
- $ this ->add (24 , 29 , Util::formatCnab ('9 ' , $ this ->getCodigoCliente (), 6 ));
144
- $ this ->add (30 , 37 , '00000000 ' );
143
+ $ this ->add (24 , 30 , Util::formatCnab ('9 ' , $ this ->getCodigoCliente (), 7 ));
144
+ $ this ->add (31 , 37 , '0000000 ' );
145
145
$ this ->add (38 , 39 , '00 ' );
146
146
$ this ->add (40 , 57 , Util::formatCnab ('9 ' , $ boleto ->getNossoNumero (), 18 ));
147
147
$ this ->add (58 , 58 , '1 ' ); //'1' = Cobrança Simples
@@ -290,8 +290,8 @@ protected function header()
290
290
$ this ->add (33 , 52 , Util::formatCnab ('9 ' , 0 , 20 ));
291
291
$ this ->add (53 , 57 , Util::formatCnab ('9 ' , $ this ->getAgencia (), 5 ));
292
292
$ this ->add (58 , 58 , CalculoDV::cefAgencia ($ this ->getAgencia ()));
293
- $ this ->add (59 , 64 , Util::formatCnab ('9 ' , $ this ->getCodigoCliente (), 6 ));
294
- $ this ->add (65 , 72 , '00000000 ' );
293
+ $ this ->add (59 , 65 , Util::formatCnab ('9 ' , $ this ->getCodigoCliente (), 7 ));
294
+ $ this ->add (66 , 72 , '0000000 ' );
295
295
$ this ->add (73 , 102 , Util::formatCnab ('X ' , $ this ->getBeneficiario ()->getNome (), 30 ));
296
296
$ this ->add (103 , 132 , Util::formatCnab ('X ' , 'CAIXA ECONOMICA FEDERAL ' , 30 ));
297
297
$ this ->add (133 , 142 , '' );
@@ -329,11 +329,15 @@ protected function headerLote()
329
329
$ this ->add (17 , 17 , '' );
330
330
$ this ->add (18 , 18 , strlen (Util::onlyNumbers ($ this ->getBeneficiario ()->getDocumento ())) == 14 ? 2 : 1 );
331
331
$ this ->add (19 , 33 , Util::formatCnab ('9 ' , Util::onlyNumbers ($ this ->getBeneficiario ()->getDocumento ()), 15 ));
332
- $ this ->add (34 , 39 , Util::formatCnab ('9 ' , Util::onlyNumbers ($ this ->getCodigoCliente ()), 6 ));
333
- $ this ->add (40 , 53 , Util::formatCnab ('9 ' , 0 , 14 ));
332
+ $ this ->add (34 , 40 , Util::formatCnab ('9 ' , Util::onlyNumbers ($ this ->getCodigoCliente ()), 7 ));
333
+ $ this ->add (41 , 53 , Util::formatCnab ('9 ' , 0 , 13 ));
334
334
$ this ->add (54 , 58 , Util::formatCnab ('9 ' , $ this ->getAgencia (), 5 ));
335
335
$ this ->add (59 , 59 , CalculoDV::cefAgencia ($ this ->getAgencia ()));
336
- $ this ->add (60 , 65 , Util::formatCnab ('9 ' , Util::onlyNumbers ($ this ->getCodigoCliente ()), 6 ));
336
+ if (strlen ($ this ->getCodigoCliente ()) == 7 ) {
337
+ $ this ->add (60 , 65 , '000000 ' );
338
+ } else {
339
+ $ this ->add (60 , 65 , Util::formatCnab ('9 ' , Util::onlyNumbers ($ this ->getCodigoCliente ()), 6 ));
340
+ }
337
341
$ this ->add (66 , 72 , '0000000 ' );
338
342
$ this ->add (73 , 73 , '0 ' );
339
343
$ this ->add (74 , 103 , Util::formatCnab ('X ' , $ this ->getBeneficiario ()->getNome (), 30 ));
0 commit comments