Completed
Push — master ( 223ada...4e5c26 )
by Esteban De La Fuente
02:01
created
lib/Sii/Aduana.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -852,8 +852,7 @@
 block discarded – undo
852 852
             $valor = $codigo['CantBultos'].' '.$valor;
853 853
             if (!empty($codigo['IdContainer'])) {
854 854
                 $valor .= ' ('.$codigo['IdContainer'].' / '.$codigo['Sello'].' / '.$codigo['EmisorSello'].')';
855
-            }
856
-            else if (!empty($codigo['Marcas'])) {
855
+            } else if (!empty($codigo['Marcas'])) {
857 856
                 $valor .= ' ('.$codigo['Marcas'].')';
858 857
             }
859 858
         } else {
Please login to merge, or discard this patch.
lib/Sii/ConsumoFolio.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
     {
127 127
         $fecha = '9999-12-31';
128 128
         foreach ($this->detalles as &$d) {
129
-            if ($d['FchDoc'] < $fecha) {
129
+            if ($d['FchDoc']<$fecha) {
130 130
                 $fecha = $d['FchDoc'];
131 131
             }
132 132
         }
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
     {
144 144
         $fecha = '0000-01-01';
145 145
         foreach ($this->detalles as &$d) {
146
-            if ($d['FchDoc'] > $fecha) {
146
+            if ($d['FchDoc']>$fecha) {
147 147
                 $fecha = $d['FchDoc'];
148 148
             }
149 149
         }
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
         // ajustes post agregar detalles
203 203
         foreach ($Resumen as &$r) {
204 204
             // obtener folios utilizados = emitidos + anulados
205
-            $r['FoliosUtilizados'] = $r['FoliosEmitidos'] + $r['FoliosAnulados'];
205
+            $r['FoliosUtilizados'] = $r['FoliosEmitidos']+$r['FoliosAnulados'];
206 206
             $r['RangoUtilizados'] = $this->getRangos($RangoUtilizados[$r['TipoDocumento']]);
207 207
         }
208 208
         // completar con los resumenes que no se colocaron
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
         $aux = [];
235 235
         $inicial = $folios[0];
236 236
         $i = $inicial;
237
-        foreach($folios as $f) {
237
+        foreach ($folios as $f) {
238 238
             if ($i!=$f) {
239 239
                 $inicial = $f;
240 240
                 $i = $inicial;
Please login to merge, or discard this patch.
lib/Sii/Dte/PDF/Dte.php 3 patches
Braces   +18 added lines, -12 removed lines patch added patch discarded remove patch
@@ -770,10 +770,12 @@  discard block
 block discarded – undo
770 770
             $this->MultiTexto($receptor['Extranjero']['NumId'], $x+$offset+2);
771 771
         }
772 772
         $contacto = [];
773
-        if (!empty($receptor['Contacto']))
774
-            $contacto[] = $receptor['Contacto'];
775
-        if (!empty($receptor['CorreoRecep']))
776
-            $contacto[] = $receptor['CorreoRecep'];
773
+        if (!empty($receptor['Contacto'])) {
774
+                    $contacto[] = $receptor['Contacto'];
775
+        }
776
+        if (!empty($receptor['CorreoRecep'])) {
777
+                    $contacto[] = $receptor['CorreoRecep'];
778
+        }
777 779
         if (!empty($contacto)) {
778 780
             $this->setFont('', 'B', null);
779 781
             $this->Texto('Contacto', $x);
@@ -823,10 +825,12 @@  discard block
 block discarded – undo
823 825
             if (!empty($Transporte['DirDest']) and !empty($Transporte['CmnaDest'])) {
824 826
                 $transporte .= 'a '.$Transporte['DirDest'].', '.$Transporte['CmnaDest'];
825 827
             }
826
-            if (!empty($Transporte['RUTTrans']))
827
-                $transporte .= ' por '.$Transporte['RUTTrans'];
828
-            if (!empty($Transporte['Patente']))
829
-                $transporte .= ' en vehículo '.$Transporte['Patente'];
828
+            if (!empty($Transporte['RUTTrans'])) {
829
+                            $transporte .= ' por '.$Transporte['RUTTrans'];
830
+            }
831
+            if (!empty($Transporte['Patente'])) {
832
+                            $transporte .= ' en vehículo '.$Transporte['Patente'];
833
+            }
830 834
             if (isset($Transporte['Chofer']) and is_array($Transporte['Chofer'])) {
831 835
                 if (!empty($Transporte['Chofer']['NombreChofer'])) {
832 836
                     $transporte .= ' con chofer '.$Transporte['Chofer']['NombreChofer'];
@@ -889,8 +893,9 @@  discard block
 block discarded – undo
889 893
      */
890 894
     protected function agregarReferencia($referencias, $x = 10, $offset = 22)
891 895
     {
892
-        if (!isset($referencias[0]))
893
-            $referencias = [$referencias];
896
+        if (!isset($referencias[0])) {
897
+                    $referencias = [$referencias];
898
+        }
894 899
         foreach($referencias as $r) {
895 900
             $texto = $r['NroLinRef'].' - ';
896 901
             if (!empty($r['TpoDocRef'])) {
@@ -1124,8 +1129,9 @@  discard block
 block discarded – undo
1124 1129
      */
1125 1130
     protected function agregarPagos(array $pagos, $x = 10)
1126 1131
     {
1127
-        if (!isset($pagos[0]))
1128
-            $pagos = [$pagos];
1132
+        if (!isset($pagos[0])) {
1133
+                    $pagos = [$pagos];
1134
+        }
1129 1135
         $this->Texto('Pago(s) programado(s):', $x);
1130 1136
         $this->Ln();
1131 1137
         foreach($pagos as $p) {
Please login to merge, or discard this patch.
Doc Comments   +32 added lines, -28 removed lines patch added patch discarded remove patch
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
     /**
81 81
      * Método que asigna la ubicación del logo de la empresa
82 82
      * @param logo URI del logo (puede ser local o en una URL)
83
-     * @param posicion Posición respecto a datos del emisor (=0 izq, =1 arriba). Nota: parámetro válido sólo para formato hoja carta
83
+     * @param posicion integer respecto a datos del emisor (=0 izq, =1 arriba). Nota: parámetro válido sólo para formato hoja carta
84 84
      * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl)
85 85
      * @version 2016-08-04
86 86
      */
@@ -333,7 +333,7 @@  discard block
 block discarded – undo
333 333
      * contínuo de 80mm
334 334
      * @param dte Arreglo con los datos del XML (tag Documento)
335 335
      * @param timbre String XML con el tag TED del DTE
336
-     * @param width Ancho del papel contínuo en mm (es parámetro porque se usa el mismo método para 75mm)
336
+     * @param width integer del papel contínuo en mm (es parámetro porque se usa el mismo método para 75mm)
337 337
      * @author Pablo Reyes (https://github.com/pabloxp)
338 338
      * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl)
339 339
      * @version 2020-03-11
@@ -491,10 +491,11 @@  discard block
 block discarded – undo
491 491
      *  - Dirección casa central del emisor
492 492
      *  - Dirección sucursales
493 493
      * @param emisor Arreglo con los datos del emisor (tag Emisor del XML)
494
-     * @param x Posición horizontal de inicio en el PDF
495
-     * @param y Posición vertical de inicio en el PDF
496
-     * @param w Ancho de la información del emisor
497
-     * @param w_img Ancho máximo de la imagen
494
+     * @param x integer horizontal de inicio en el PDF
495
+     * @param y integer vertical de inicio en el PDF
496
+     * @param w integer de la información del emisor
497
+     * @param w_img integer máximo de la imagen
498
+     * @param integer $font_size
498 499
      * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl)
499 500
      * @version 2019-11-22
500 501
      */
@@ -603,11 +604,13 @@  discard block
 block discarded – undo
603 604
      * @param rut RUT del emisor
604 605
      * @param tipo Código o glosa del tipo de documento
605 606
      * @param sucursal_sii Código o glosa de la sucursal del SII del Emisor
606
-     * @param x Posición horizontal de inicio en el PDF
607
-     * @param y Posición vertical de inicio en el PDF
608
-     * @param w Ancho de la información del emisor
607
+     * @param x integer horizontal de inicio en el PDF
608
+     * @param y integer vertical de inicio en el PDF
609
+     * @param w integer de la información del emisor
610
+     * @param integer $font_size
609 611
      * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl)
610 612
      * @version 2019-08-05
613
+     * @return integer
611 614
      */
612 615
     protected function agregarFolio($rut, $tipo, $folio, $sucursal_sii = null, $x = 130, $y = 15, $w = 70, $font_size = null, array $color = null)
613 616
     {
@@ -639,7 +642,7 @@  discard block
 block discarded – undo
639 642
      * Método que agrega los datos de la emisión del DTE que no son los dato del
640 643
      * receptor
641 644
      * @param IdDoc Información general del documento
642
-     * @param x Posición horizontal de inicio en el PDF
645
+     * @param x integer horizontal de inicio en el PDF
643 646
      * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl)
644 647
      * @version 2020-08-11
645 648
      */
@@ -727,7 +730,7 @@  discard block
 block discarded – undo
727 730
     /**
728 731
      * Método que agrega los datos del receptor
729 732
      * @param receptor Arreglo con los datos del receptor (tag Receptor del XML)
730
-     * @param x Posición horizontal de inicio en el PDF
733
+     * @param x integer horizontal de inicio en el PDF
731 734
      * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl)
732 735
      * @version 2019-10-06
733 736
      */
@@ -814,7 +817,7 @@  discard block
 block discarded – undo
814 817
      * Método que agrega los datos del traslado
815 818
      * @param IndTraslado
816 819
      * @param Transporte
817
-     * @param x Posición horizontal de inicio en el PDF
820
+     * @param x integer horizontal de inicio en el PDF
818 821
      * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl)
819 822
      * @version 2016-08-03
820 823
      */
@@ -894,7 +897,7 @@  discard block
 block discarded – undo
894 897
     /**
895 898
      * Método que agrega las referencias del documento
896 899
      * @param referencias Arreglo con las referencias del documento (tag Referencia del XML)
897
-     * @param x Posición horizontal de inicio en el PDF
900
+     * @param x integer horizontal de inicio en el PDF
898 901
      * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl)
899 902
      * @version 2017-09-25
900 903
      */
@@ -931,7 +934,7 @@  discard block
 block discarded – undo
931 934
     /**
932 935
      * Método que agrega el detalle del documento
933 936
      * @param detalle Arreglo con el detalle del documento (tag Detalle del XML)
934
-     * @param x Posición horizontal de inicio en el PDF
937
+     * @param x integer horizontal de inicio en el PDF
935 938
      * @param y Posición vertical de inicio en el PDF
936 939
      * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl)
937 940
      * @version 2020-08-28
@@ -1041,7 +1044,7 @@  discard block
 block discarded – undo
1041 1044
     /**
1042 1045
      * Método que agrega el detalle del documento
1043 1046
      * @param detalle Arreglo con el detalle del documento (tag Detalle del XML)
1044
-     * @param x Posición horizontal de inicio en el PDF
1047
+     * @param x integer horizontal de inicio en el PDF
1045 1048
      * @param y Posición vertical de inicio en el PDF
1046 1049
      * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl)
1047 1050
      * @author Pablo Reyes (https://github.com/pabloxp)
@@ -1097,7 +1100,7 @@  discard block
 block discarded – undo
1097 1100
      * Método que agrega el subtotal del DTE
1098 1101
      * @param detalle Arreglo con los detalles del documentos para poder
1099 1102
      * calcular subtotal
1100
-     * @param x Posición horizontal de inicio en el PDF
1103
+     * @param x integer horizontal de inicio en el PDF
1101 1104
      * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl)
1102 1105
      * @version 2016-08-17
1103 1106
      */
@@ -1123,7 +1126,7 @@  discard block
 block discarded – undo
1123 1126
     /**
1124 1127
      * Método que agrega los descuentos y/o recargos globales del documento
1125 1128
      * @param descuentosRecargos Arreglo con los descuentos y/o recargos del documento (tag DscRcgGlobal del XML)
1126
-     * @param x Posición horizontal de inicio en el PDF
1129
+     * @param x integer horizontal de inicio en el PDF
1127 1130
      * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl)
1128 1131
      * @version 2018-05-29
1129 1132
      */
@@ -1151,7 +1154,7 @@  discard block
 block discarded – undo
1151 1154
     /**
1152 1155
      * Método que agrega los pagos del documento
1153 1156
      * @param pagos Arreglo con los pagos del documento
1154
-     * @param x Posición horizontal de inicio en el PDF
1157
+     * @param x integer horizontal de inicio en el PDF
1155 1158
      * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl)
1156 1159
      * @version 2016-07-24
1157 1160
      */
@@ -1309,9 +1312,10 @@  discard block
 block discarded – undo
1309 1312
      *  - Se imprime en el tamaño mínimo: 2x5 cms
1310 1313
      *  - En el lado de abajo con margen izquierdo mínimo de 2 cms
1311 1314
      * @param timbre String con los datos del timbre
1312
-     * @param x Posición horizontal de inicio en el PDF
1313
-     * @param y Posición vertical de inicio en el PDF
1314
-     * @param w Ancho del timbre
1315
+     * @param x integer horizontal de inicio en el PDF
1316
+     * @param y integer vertical de inicio en el PDF
1317
+     * @param w integer del timbre
1318
+     * @param string $position
1315 1319
      * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl)
1316 1320
      * @version 2019-10-06
1317 1321
      */
@@ -1349,10 +1353,10 @@  discard block
 block discarded – undo
1349 1353
 
1350 1354
     /**
1351 1355
      * Método que agrega el acuse de rebido
1352
-     * @param x Posición horizontal de inicio en el PDF
1353
-     * @param y Posición vertical de inicio en el PDF
1354
-     * @param w Ancho del acuse de recibo
1355
-     * @param h Alto del acuse de recibo
1356
+     * @param x integer horizontal de inicio en el PDF
1357
+     * @param y integer vertical de inicio en el PDF
1358
+     * @param w integer del acuse de recibo
1359
+     * @param h integer del acuse de recibo
1356 1360
      * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl)
1357 1361
      * @version 2019-10-06
1358 1362
      */
@@ -1380,10 +1384,10 @@  discard block
 block discarded – undo
1380 1384
 
1381 1385
     /**
1382 1386
      * Método que agrega el acuse de rebido
1383
-     * @param x Posición horizontal de inicio en el PDF
1387
+     * @param x integer horizontal de inicio en el PDF
1384 1388
      * @param y Posición vertical de inicio en el PDF
1385
-     * @param w Ancho del acuse de recibo
1386
-     * @param h Alto del acuse de recibo
1389
+     * @param w integer del acuse de recibo
1390
+     * @param h integer del acuse de recibo
1387 1391
      * @author Pablo Reyes (https://github.com/pabloxp)
1388 1392
      * @version 2015-11-17
1389 1393
      */
Please login to merge, or discard this patch.
Spacing   +57 added lines, -57 removed lines patch added patch discarded remove patch
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
     {
75 75
         parent::__construct();
76 76
         $this->SetTitle('Documento Tributario Electrónico (DTE) de Chile by LibreDTE');
77
-        $this->papelContinuo = $papelContinuo === true ? 80 : $papelContinuo;
77
+        $this->papelContinuo = $papelContinuo===true ? 80 : $papelContinuo;
78 78
     }
79 79
 
80 80
     /**
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
         $this->Ln();
194 194
         // datos del documento
195 195
         $y = [];
196
-        $y[] = $this->agregarDatosEmision($dte['Encabezado']['IdDoc'], !empty($dte['Encabezado']['Emisor']['CdgVendedor'])?$dte['Encabezado']['Emisor']['CdgVendedor']:null);
196
+        $y[] = $this->agregarDatosEmision($dte['Encabezado']['IdDoc'], !empty($dte['Encabezado']['Emisor']['CdgVendedor']) ? $dte['Encabezado']['Emisor']['CdgVendedor'] : null);
197 197
         $y[] = $this->agregarReceptor($dte['Encabezado']);
198 198
         $this->setY(max($y));
199 199
         $this->agregarTraslado(
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
         $this->AddPage('P', [$height ? $height : $this->papel_continuo_alto, $width]);
243 243
         $x = 1;
244 244
         $y = 5;
245
-        $this->SetXY($x,$y);
245
+        $this->SetXY($x, $y);
246 246
         // agregar datos del documento
247 247
         $this->setFont('', '', 8);
248 248
         $this->MultiTexto(!empty($dte['Encabezado']['Emisor']['RznSoc']) ? $dte['Encabezado']['Emisor']['RznSoc'] : $dte['Encabezado']['Emisor']['RznSocEmisor'], $x, null, '', $width-2);
@@ -354,15 +354,15 @@  discard block
 block discarded – undo
354 354
             $dte['Encabezado']['IdDoc']['TipoDTE'],
355 355
             $dte['Encabezado']['IdDoc']['Folio'],
356 356
             $dte['Encabezado']['Emisor']['CmnaOrigen'],
357
-            $x_start, $y_start, $width-($x_start*4), 10,
358
-            [0,0,0]
357
+            $x_start, $y_start, $width-($x_start * 4), 10,
358
+            [0, 0, 0]
359 359
         );
360
-        $y = $this->agregarEmisor($dte['Encabezado']['Emisor'], $x_start, $y+2, $width-($x_start*45), 8, 9, [0,0,0]);
360
+        $y = $this->agregarEmisor($dte['Encabezado']['Emisor'], $x_start, $y+2, $width-($x_start * 45), 8, 9, [0, 0, 0]);
361 361
         // datos del documento
362 362
         $this->SetY($y);
363 363
         $this->Ln();
364 364
         $this->setFont('', '', 8);
365
-        $this->agregarDatosEmision($dte['Encabezado']['IdDoc'], !empty($dte['Encabezado']['Emisor']['CdgVendedor'])?$dte['Encabezado']['Emisor']['CdgVendedor']:null, $x_start, $offset, false);
365
+        $this->agregarDatosEmision($dte['Encabezado']['IdDoc'], !empty($dte['Encabezado']['Emisor']['CdgVendedor']) ? $dte['Encabezado']['Emisor']['CdgVendedor'] : null, $x_start, $offset, false);
366 366
         $this->agregarReceptor($dte['Encabezado'], $x_start, $offset);
367 367
         $this->agregarTraslado(
368 368
             !empty($dte['Encabezado']['IdDoc']['IndTraslado']) ? $dte['Encabezado']['IdDoc']['IndTraslado'] : null,
@@ -432,14 +432,14 @@  discard block
 block discarded – undo
432 432
             2,
433 433
             45,
434 434
             9,
435
-            [0,0,0]
435
+            [0, 0, 0]
436 436
         );
437
-        $y[] = $this->agregarEmisor($dte['Encabezado']['Emisor'], 1, 2, 20, 30, 9, [0,0,0], $y[0]);
437
+        $y[] = $this->agregarEmisor($dte['Encabezado']['Emisor'], 1, 2, 20, 30, 9, [0, 0, 0], $y[0]);
438 438
         $this->SetY(max($y));
439 439
         $this->Ln();
440 440
         // datos del documento
441 441
         $this->setFont('', '', 8);
442
-        $this->agregarDatosEmision($dte['Encabezado']['IdDoc'], !empty($dte['Encabezado']['Emisor']['CdgVendedor'])?$dte['Encabezado']['Emisor']['CdgVendedor']:null, $x_start, $offset, false);
442
+        $this->agregarDatosEmision($dte['Encabezado']['IdDoc'], !empty($dte['Encabezado']['Emisor']['CdgVendedor']) ? $dte['Encabezado']['Emisor']['CdgVendedor'] : null, $x_start, $offset, false);
443 443
         $this->agregarReceptor($dte['Encabezado'], $x_start, $offset);
444 444
         $this->agregarTraslado(
445 445
             !empty($dte['Encabezado']['IdDoc']['IndTraslado']) ? $dte['Encabezado']['IdDoc']['IndTraslado'] : null,
@@ -471,7 +471,7 @@  discard block
 block discarded – undo
471 471
         if ($this->cedible and !in_array($dte['Encabezado']['IdDoc']['TipoDTE'], $this->sinAcuseRecibo)) {
472 472
             $this->agregarAcuseRecibo(63, $y+6, 45, 40, 15);
473 473
             $this->setFont('', 'B', 8);
474
-            $this->Texto('CEDIBLE'.($dte['Encabezado']['IdDoc']['TipoDTE']==52?' CON SU FACTURA':''), $x_start, $this->y+1, 'L');
474
+            $this->Texto('CEDIBLE'.($dte['Encabezado']['IdDoc']['TipoDTE']==52 ? ' CON SU FACTURA' : ''), $x_start, $this->y+1, 'L');
475 475
         }
476 476
         // si el alto no se pasó, entonces es con autocálculo, se elimina esta página y se pasa el alto
477 477
         // que se logró determinar para crear la página con el alto correcto
@@ -502,16 +502,16 @@  discard block
 block discarded – undo
502 502
         // logo del documento
503 503
         if (isset($this->logo)) {
504 504
             // logo centrado (papel continuo)
505
-            if (!empty($this->logo['posicion']) and $this->logo['posicion'] == 'C') {
505
+            if (!empty($this->logo['posicion']) and $this->logo['posicion']=='C') {
506 506
                 $logo_w = null;
507 507
                 $logo_y = null;
508 508
                 $logo_position = 'C';
509 509
                 $logo_next_pointer = 'N';
510 510
             }
511 511
             // logo a la derecha (posicion=0) o arriba (posicion=1)
512
-            else if (empty($this->logo['posicion']) or $this->logo['posicion'] == 1) {
512
+            else if (empty($this->logo['posicion']) or $this->logo['posicion']==1) {
513 513
                 $logo_w = !$this->logo['posicion'] ? $w_img : null;
514
-                $logo_y = $this->logo['posicion'] ? $w_img/2 : null;
514
+                $logo_y = $this->logo['posicion'] ? $w_img / 2 : null;
515 515
                 $logo_position = '';
516 516
                 $logo_next_pointer = 'T';
517 517
             }
@@ -530,17 +530,17 @@  discard block
 block discarded – undo
530 530
                 $logo_w,
531 531
                 $logo_y,
532 532
                 'PNG',
533
-                (isset($emisor['url'])?$emisor['url']:''),
533
+                (isset($emisor['url']) ? $emisor['url'] : ''),
534 534
                 $logo_next_pointer,
535 535
                 2,
536 536
                 300,
537 537
                 $logo_position
538 538
             );
539
-            if (!empty($this->logo['posicion']) and $this->logo['posicion'] == 'C') {
539
+            if (!empty($this->logo['posicion']) and $this->logo['posicion']=='C') {
540 540
                 $w += 40;
541 541
             } else {
542 542
                 if ($this->logo['posicion']) {
543
-                    $this->SetY($this->y + ($w_img/2));
543
+                    $this->SetY($this->y+($w_img / 2));
544 544
                     $w += 40;
545 545
                 } else {
546 546
                     $x = $this->x+3;
@@ -553,19 +553,19 @@  discard block
 block discarded – undo
553 553
         // agregar datos del emisor
554 554
         if ($agregarDatosEmisor) {
555 555
             $this->setFont('', 'B', $font_size ? $font_size : 14);
556
-            $this->SetTextColorArray($color===null?[32, 92, 144]:$color);
557
-            $this->MultiTexto(!empty($emisor['RznSoc']) ? $emisor['RznSoc'] : $emisor['RznSocEmisor'], $x, $this->y+2, 'L', ($h_folio and $h_folio < $this->getY()) ? $w_all : $w);
556
+            $this->SetTextColorArray($color===null ? [32, 92, 144] : $color);
557
+            $this->MultiTexto(!empty($emisor['RznSoc']) ? $emisor['RznSoc'] : $emisor['RznSocEmisor'], $x, $this->y+2, 'L', ($h_folio and $h_folio<$this->getY()) ? $w_all : $w);
558 558
             $this->setFont('', 'B', $font_size ? $font_size : 9);
559
-            $this->SetTextColorArray([0,0,0]);
560
-            $this->MultiTexto(!empty($emisor['GiroEmis']) ? $emisor['GiroEmis'] : $emisor['GiroEmisor'], $x, $this->y, 'L', ($h_folio and $h_folio < $this->getY()) ? $w_all : $w);
559
+            $this->SetTextColorArray([0, 0, 0]);
560
+            $this->MultiTexto(!empty($emisor['GiroEmis']) ? $emisor['GiroEmis'] : $emisor['GiroEmisor'], $x, $this->y, 'L', ($h_folio and $h_folio<$this->getY()) ? $w_all : $w);
561 561
             $comuna = !empty($emisor['CmnaOrigen']) ? $emisor['CmnaOrigen'] : null;
562 562
             $ciudad = !empty($emisor['CiudadOrigen']) ? $emisor['CiudadOrigen'] : \sasco\LibreDTE\Chile::getCiudad($comuna);
563
-            $this->MultiTexto($emisor['DirOrigen'].($comuna?(', '.$comuna):'').($ciudad?(', '.$ciudad):''), $x, $this->y, 'L', ($h_folio and $h_folio < $this->getY()) ? $w_all : $w);
563
+            $this->MultiTexto($emisor['DirOrigen'].($comuna ? (', '.$comuna) : '').($ciudad ? (', '.$ciudad) : ''), $x, $this->y, 'L', ($h_folio and $h_folio<$this->getY()) ? $w_all : $w);
564 564
             if (!empty($emisor['Sucursal'])) {
565
-                $this->MultiTexto('Sucursal: '.$emisor['Sucursal'], $x, $this->y, 'L', ($h_folio and $h_folio < $this->getY()) ? $w_all : $w);
565
+                $this->MultiTexto('Sucursal: '.$emisor['Sucursal'], $x, $this->y, 'L', ($h_folio and $h_folio<$this->getY()) ? $w_all : $w);
566 566
             }
567 567
             if (!empty($this->casa_matriz)) {
568
-                $this->MultiTexto('Casa matriz: '.$this->casa_matriz, $x, $this->y, 'L', ($h_folio and $h_folio < $this->getY()) ? $w_all : $w);
568
+                $this->MultiTexto('Casa matriz: '.$this->casa_matriz, $x, $this->y, 'L', ($h_folio and $h_folio<$this->getY()) ? $w_all : $w);
569 569
             }
570 570
             $contacto = [];
571 571
             if (!empty($emisor['Telefono'])) {
@@ -580,7 +580,7 @@  discard block
 block discarded – undo
580 580
                 $contacto[] = $emisor['CorreoEmisor'];
581 581
             }
582 582
             if ($contacto) {
583
-                $this->MultiTexto(implode(' / ', $contacto), $x, $this->y, 'L', ($h_folio and $h_folio < $this->getY()) ? $w_all : $w);
583
+                $this->MultiTexto(implode(' / ', $contacto), $x, $this->y, 'L', ($h_folio and $h_folio<$this->getY()) ? $w_all : $w);
584 584
             }
585 585
         }
586 586
         return $this->y;
@@ -610,12 +610,12 @@  discard block
 block discarded – undo
610 610
     protected function agregarFolio($rut, $tipo, $folio, $sucursal_sii = null, $x = 130, $y = 15, $w = 70, $font_size = null, array $color = null)
611 611
     {
612 612
         if ($color===null) {
613
-            $color = $tipo ? ($tipo==52 ? [0,172,140] : [255,0,0]) : [0,0,0];
613
+            $color = $tipo ? ($tipo==52 ? [0, 172, 140] : [255, 0, 0]) : [0, 0, 0];
614 614
         }
615 615
         $this->SetTextColorArray($color);
616 616
         // colocar rut emisor, glosa documento y folio
617 617
         list($rut, $dv) = explode('-', $rut);
618
-        $this->setFont ('', 'B', $font_size ? $font_size : 15);
618
+        $this->setFont('', 'B', $font_size ? $font_size : 15);
619 619
         $this->MultiTexto('R.U.T.: '.$this->num($rut).'-'.$dv, $x, $y+4, 'C', $w);
620 620
         $this->setFont('', 'B', $font_size ? $font_size : 12);
621 621
         $this->MultiTexto($this->getTipo($tipo, $folio), $x, null, 'C', $w);
@@ -628,7 +628,7 @@  discard block
 block discarded – undo
628 628
         if ($tipo) {
629 629
             $this->Texto('S.I.I. - '.\sasco\LibreDTE\Sii::getDireccionRegional($sucursal_sii), $x, $this->getY()+4, 'C', $w);
630 630
         }
631
-        $this->SetTextColorArray([0,0,0]);
631
+        $this->SetTextColorArray([0, 0, 0]);
632 632
         $this->Ln();
633 633
         return $this->y;
634 634
     }
@@ -742,10 +742,10 @@  discard block
 block discarded – undo
742 742
         }
743 743
         if (!empty($receptor['RznSocRecep'])) {
744 744
             $this->setFont('', 'B', null);
745
-            $this->Texto(in_array($this->dte, [39, 41]) ? 'Nombre' : ($x==10?'Razón social':'Razón soc.'), $x);
745
+            $this->Texto(in_array($this->dte, [39, 41]) ? 'Nombre' : ($x==10 ? 'Razón social' : 'Razón soc.'), $x);
746 746
             $this->Texto(':', $x+$offset);
747 747
             $this->setFont('', '', null);
748
-            $this->MultiTexto($receptor['RznSocRecep'], $x+$offset+2, null, '', $x==10?105:0);
748
+            $this->MultiTexto($receptor['RznSocRecep'], $x+$offset+2, null, '', $x==10 ? 105 : 0);
749 749
         }
750 750
         if (!empty($receptor['GiroRecep'])) {
751 751
             $this->setFont('', 'B', null);
@@ -762,7 +762,7 @@  discard block
 block discarded – undo
762 762
             $ciudad = !empty($receptor['CiudadRecep']) ? $receptor['CiudadRecep'] : (
763 763
                 !empty($receptor['CmnaRecep']) ? \sasco\LibreDTE\Chile::getCiudad($receptor['CmnaRecep']) : ''
764 764
             );
765
-            $this->MultiTexto($receptor['DirRecep'].(!empty($receptor['CmnaRecep'])?(', '.$receptor['CmnaRecep']):'').($ciudad?(', '.$ciudad):''), $x+$offset+2);
765
+            $this->MultiTexto($receptor['DirRecep'].(!empty($receptor['CmnaRecep']) ? (', '.$receptor['CmnaRecep']) : '').($ciudad ? (', '.$ciudad) : ''), $x+$offset+2);
766 766
         }
767 767
         if (!empty($receptor['Extranjero']['Nacionalidad'])) {
768 768
             $this->setFont('', 'B', null);
@@ -803,7 +803,7 @@  discard block
 block discarded – undo
803 803
             $this->Texto('Cód. recep.', $x);
804 804
             $this->Texto(':', $x+$offset);
805 805
             $this->setFont('', '', null);
806
-            $this->MultiTexto($receptor['CdgIntRecep'], $x+$offset+2, null, '', $x==10?105:0);
806
+            $this->MultiTexto($receptor['CdgIntRecep'], $x+$offset+2, null, '', $x==10 ? 105 : 0);
807 807
         }
808 808
         return $this->GetY();
809 809
     }
@@ -900,7 +900,7 @@  discard block
 block discarded – undo
900 900
     {
901 901
         if (!isset($referencias[0]))
902 902
             $referencias = [$referencias];
903
-        foreach($referencias as $r) {
903
+        foreach ($referencias as $r) {
904 904
             $texto = $r['NroLinRef'].' - ';
905 905
             if (!empty($r['TpoDocRef'])) {
906 906
                 $texto .= $this->getTipo($r['TpoDocRef']).' ';
@@ -961,7 +961,7 @@  discard block
 block discarded – undo
961 961
             // quitar columnas
962 962
             foreach ($item as $col => $valor) {
963 963
                 if ($col=='DscItem' and !empty($item['DscItem'])) {
964
-                    $item['NmbItem'] .= !$this->item_detalle_posicion ? ($html?'<br/>':"\n") : ': ';
964
+                    $item['NmbItem'] .= !$this->item_detalle_posicion ? ($html ? '<br/>' : "\n") : ': ';
965 965
                     $item['DscItem'] = $html ? str_replace("\n", '<br/>', $item['DscItem']) : str_replace(['<br/>', '<br>'], "\n", $item['DscItem']);
966 966
                     if ($html) {
967 967
                         $item['NmbItem'] .= '<span style="font-size:0.7em">'.$item['DscItem'].'</span>';
@@ -1010,7 +1010,7 @@  discard block
 block discarded – undo
1010 1010
             }
1011 1011
             $item = array_merge($item_default, $item);
1012 1012
             // si hay código de item se extrae su valor
1013
-            if (!empty($item['CdgItem']['VlrCodigo'])){
1013
+            if (!empty($item['CdgItem']['VlrCodigo'])) {
1014 1014
                 $item['CdgItem'] = $item['CdgItem']['VlrCodigo'];
1015 1015
             }
1016 1016
             // dar formato a números
@@ -1053,9 +1053,9 @@  discard block
 block discarded – undo
1053 1053
         $this->SetY($this->getY()+1);
1054 1054
         $p1x = $x;
1055 1055
         $p1y = $this->y;
1056
-        $p2x = $this->getPageWidth() - 2;
1057
-        $p2y = $p1y;  // Use same y for a straight line
1058
-        $style = array('width' => 0.2,'color' => array(0, 0, 0));
1056
+        $p2x = $this->getPageWidth()-2;
1057
+        $p2y = $p1y; // Use same y for a straight line
1058
+        $style = array('width' => 0.2, 'color' => array(0, 0, 0));
1059 1059
         $this->Line($p1x, $p1y, $p2x, $p2y, $style);
1060 1060
         $this->Texto($this->detalle_cols['NmbItem']['title'], $x+$offsets[0], $this->y, ucfirst($this->detalle_cols['NmbItem']['align'][0]), $this->detalle_cols['NmbItem']['width']);
1061 1061
         $this->Texto($this->detalle_cols['PrcItem']['title'], $x+$offsets[1], $this->y, ucfirst($this->detalle_cols['PrcItem']['align'][0]), $this->detalle_cols['PrcItem']['width']);
@@ -1067,7 +1067,7 @@  discard block
 block discarded – undo
1067 1067
         }
1068 1068
         // mostrar items
1069 1069
         $this->SetY($this->getY()+2);
1070
-        foreach($detalle as  &$d) {
1070
+        foreach ($detalle as  &$d) {
1071 1071
             // nombre y descripción del item
1072 1072
             $item = $d['NmbItem'];
1073 1073
             if ($this->papel_continuo_item_detalle and !empty($d['DscItem'])) {
@@ -1077,14 +1077,14 @@  discard block
 block discarded – undo
1077 1077
             // descuento
1078 1078
             if (!empty($d['DescuentoPct']) or !empty($d['DescuentoMonto'])) {
1079 1079
                 if (!empty($d['DescuentoPct'])) {
1080
-                    $descuento = number_format($d['DescuentoPct'],0,',','.').'%';
1080
+                    $descuento = number_format($d['DescuentoPct'], 0, ',', '.').'%';
1081 1081
                 } else {
1082
-                    $descuento = number_format($d['DescuentoMonto'],0,',','.');
1082
+                    $descuento = number_format($d['DescuentoMonto'], 0, ',', '.');
1083 1083
                 }
1084 1084
                 $this->Texto('Desc.: '.$descuento, $x+$offsets[0], $this->y, ucfirst($this->detalle_cols['NmbItem']['align'][0]), $this->detalle_cols['NmbItem']['width']);
1085 1085
             }
1086 1086
             // precio y cantidad
1087
-            $this->Texto(number_format($d['PrcItem'],0,',','.'), $x+$offsets[1], $this->y, ucfirst($this->detalle_cols['PrcItem']['align'][0]), $this->detalle_cols['PrcItem']['width']);
1087
+            $this->Texto(number_format($d['PrcItem'], 0, ',', '.'), $x+$offsets[1], $this->y, ucfirst($this->detalle_cols['PrcItem']['align'][0]), $this->detalle_cols['PrcItem']['width']);
1088 1088
             $this->Texto($this->num($d['QtyItem']), $x+$offsets[2], $this->y, ucfirst($this->detalle_cols['QtyItem']['align'][0]), $this->detalle_cols['QtyItem']['width']);
1089 1089
             $this->Texto($this->num($d['MontoItem']), $x+$offsets[3], $this->y, ucfirst($this->detalle_cols['MontoItem']['align'][0]), $this->detalle_cols['MontoItem']['width']);
1090 1090
         }
@@ -1104,7 +1104,7 @@  discard block
 block discarded – undo
1104 1104
         if (!isset($detalle[0])) {
1105 1105
             $detalle = [$detalle];
1106 1106
         }
1107
-        foreach($detalle as  &$d) {
1107
+        foreach ($detalle as  &$d) {
1108 1108
             if (!empty($d['MontoItem'])) {
1109 1109
                 $subtotal += $d['MontoItem'];
1110 1110
             }
@@ -1130,16 +1130,16 @@  discard block
 block discarded – undo
1130 1130
         if (!isset($descuentosRecargos[0])) {
1131 1131
             $descuentosRecargos = [$descuentosRecargos];
1132 1132
         }
1133
-        foreach($descuentosRecargos as $dr) {
1133
+        foreach ($descuentosRecargos as $dr) {
1134 1134
             $tipo = $dr['TpoMov']=='D' ? 'Descuento' : 'Recargo';
1135 1135
             if (!empty($dr['IndExeDR'])) {
1136 1136
                 $tipo .= ' EX';
1137 1137
             }
1138 1138
             $valor = $dr['TpoValor']=='%' ? $dr['ValorDR'].'%' : $this->num($dr['ValorDR']);
1139 1139
             if ($this->papelContinuo) {
1140
-                $this->Texto($tipo.' global: '.$valor.(!empty($dr['GlosaDR'])?(' ('.$dr['GlosaDR'].')'):''), $x);
1140
+                $this->Texto($tipo.' global: '.$valor.(!empty($dr['GlosaDR']) ? (' ('.$dr['GlosaDR'].')') : ''), $x);
1141 1141
             } else {
1142
-                $this->Texto($tipo.(!empty($dr['GlosaDR'])?(' ('.$dr['GlosaDR'].')'):'').':', 77, null, 'R', 100);
1142
+                $this->Texto($tipo.(!empty($dr['GlosaDR']) ? (' ('.$dr['GlosaDR'].')') : '').':', 77, null, 'R', 100);
1143 1143
                 $this->Texto($valor, 177, null, 'R', 22);
1144 1144
             }
1145 1145
             $this->Ln();
@@ -1159,8 +1159,8 @@  discard block
 block discarded – undo
1159 1159
             $pagos = [$pagos];
1160 1160
         $this->Texto('Pago(s) programado(s):', $x);
1161 1161
         $this->Ln();
1162
-        foreach($pagos as $p) {
1163
-            $this->Texto('  - '.$this->date($p['FchPago'], false).': $'.$this->num($p['MntPago']).'.-'.(!empty($p['GlosaPagos'])?(' ('.$p['GlosaPagos'].')'):''), $x);
1162
+        foreach ($pagos as $p) {
1163
+            $this->Texto('  - '.$this->date($p['FchPago'], false).': $'.$this->num($p['MntPago']).'.-'.(!empty($p['GlosaPagos']) ? (' ('.$p['GlosaPagos'].')') : ''), $x);
1164 1164
             $this->Ln();
1165 1165
         }
1166 1166
     }
@@ -1194,7 +1194,7 @@  discard block
 block discarded – undo
1194 1194
             'TpoMoneda' => 'Moneda',
1195 1195
             'MntNeto' => 'Neto $',
1196 1196
             'MntExe' => 'Exento $',
1197
-            'IVA' => 'IVA '.(!empty($totales['TasaIVA'])?(' ('.$totales['TasaIVA'].'%) '):'').'$',
1197
+            'IVA' => 'IVA '.(!empty($totales['TasaIVA']) ? (' ('.$totales['TasaIVA'].'%) ') : '').'$',
1198 1198
             'IVANoRet' => 'IVA no retenido $',
1199 1199
             'CredEC' => 'Desc. 65% IVA $',
1200 1200
             'MntTotal' => 'Total $',
@@ -1211,7 +1211,7 @@  discard block
 block discarded – undo
1211 1211
             if (!isset($ImptoReten[0])) {
1212 1212
                 $ImptoReten = [$ImptoReten];
1213 1213
             }
1214
-            foreach($ImptoReten as $i) {
1214
+            foreach ($ImptoReten as $i) {
1215 1215
                 $totales['ImptoReten_'.$i['TipoImp']] = $i['MontoImp'];
1216 1216
                 if (!empty($i['TasaImp'])) {
1217 1217
                     $glosas['ImptoReten_'.$i['TipoImp']] = \sasco\LibreDTE\Sii\ImpuestosAdicionales::getGlosa($i['TipoImp']).' ('.$i['TasaImp'].'%) $';
@@ -1324,9 +1324,9 @@  discard block
 block discarded – undo
1324 1324
                 'vpadding' => 0,
1325 1325
                 'module_width' => 1, // width of a single module in points
1326 1326
                 'module_height' => 1, // height of a single module in points
1327
-                'fgcolor' => [0,0,0],
1327
+                'fgcolor' => [0, 0, 0],
1328 1328
                 'bgcolor' => false, // [255,255,255]
1329
-                'position' => $position === null ? ($this->papelContinuo ? 'C' : 'S') : $position,
1329
+                'position' => $position===null ? ($this->papelContinuo ? 'C' : 'S') : $position,
1330 1330
             ];
1331 1331
             $ecl = version_compare(phpversion(), '7.0.0', '<') ? -1 : $this->ecl;
1332 1332
             $this->write2DBarcode($timbre, 'PDF417,,'.$ecl, $x_timbre, $y, $w, 0, $style, 'B');
@@ -1357,7 +1357,7 @@  discard block
 block discarded – undo
1357 1357
     protected function agregarAcuseRecibo($x = 83, $y = 190, $w = 60, $h = 40, $line = 25)
1358 1358
     {
1359 1359
         $y = (!$this->papelContinuo and !$this->timbre_pie) ? $this->x_fin_datos : $y;
1360
-        $this->SetTextColorArray([0,0,0]);
1360
+        $this->SetTextColorArray([0, 0, 0]);
1361 1361
         $this->Rect($x, $y, $w, $h, 'D', ['all' => ['width' => 0.1, 'color' => [0, 0, 0]]]);
1362 1362
         $this->setFont('', 'B', 10);
1363 1363
         $this->Texto('Acuse de recibo', $x, $y+1, 'C', $w);
@@ -1387,9 +1387,9 @@  discard block
 block discarded – undo
1387 1387
      */
1388 1388
     protected function agregarAcuseReciboContinuo($x = 3, $y = null, $w = 68, $h = 40)
1389 1389
     {
1390
-        $this->SetTextColorArray([0,0,0]);
1390
+        $this->SetTextColorArray([0, 0, 0]);
1391 1391
         $this->Rect($x, $y, $w, $h, 'D', ['all' => ['width' => 0.1, 'color' => [0, 0, 0]]]);
1392
-        $style = array('width' => 0.2,'color' => array(0, 0, 0));
1392
+        $style = array('width' => 0.2, 'color' => array(0, 0, 0));
1393 1393
         $this->Line($x, $y+22, $w+3, $y+22, $style);
1394 1394
         //$this->setFont('', 'B', 10);
1395 1395
         //$this->Texto('Acuse de recibo', $x, $y+1, 'C', $w);
@@ -1419,7 +1419,7 @@  discard block
 block discarded – undo
1419 1419
         $y = (!$this->papelContinuo and !$this->timbre_pie and $this->x_fin_datos<=$y) ? $this->x_fin_datos : $y;
1420 1420
         $y += 48;
1421 1421
         $this->setFont('', 'B', $font_size);
1422
-        $this->Texto('CEDIBLE'.($tipo==52?' CON SU FACTURA':''), null, $y, 'R');
1422
+        $this->Texto('CEDIBLE'.($tipo==52 ? ' CON SU FACTURA' : ''), null, $y, 'R');
1423 1423
     }
1424 1424
 
1425 1425
     /**
@@ -1430,7 +1430,7 @@  discard block
 block discarded – undo
1430 1430
     protected function agregarLeyendaDestinoContinuo($tipo)
1431 1431
     {
1432 1432
         $this->setFont('', 'B', 8);
1433
-        $this->Texto('CEDIBLE'.($tipo==52?' CON SU FACTURA':''), null, $this->y+6, 'R');
1433
+        $this->Texto('CEDIBLE'.($tipo==52 ? ' CON SU FACTURA' : ''), null, $this->y+6, 'R');
1434 1434
     }
1435 1435
 
1436 1436
 }
Please login to merge, or discard this patch.
lib/Sii/Base/Envio.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@
 block discarded – undo
58 58
             return false;
59 59
         }
60 60
         // si no se debe enviar no continuar
61
-        if ($retry === 0) {
61
+        if ($retry===0) {
62 62
             return false;
63 63
         }
64 64
         // solicitar token
Please login to merge, or discard this patch.
lib/Sii/RegistroCompraVenta.php 2 patches
Doc Comments   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 
78 78
     /**
79 79
      * Constructor, obtiene el token de la sesión y lo guarda
80
-     * @param Firma Objeto con la firma electrónica
80
+     * @param Firma \sasco\LibreDTE\FirmaElectronica con la firma electrónica
81 81
      * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl)
82 82
      * @version 2017-08-28
83 83
      */
@@ -119,6 +119,8 @@  discard block
 block discarded – undo
119 119
      * Método que entrega los eventos asociados a un DTE
120 120
      * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl)
121 121
      * @version 2017-08-28
122
+     * @param string $dte
123
+     * @param string $folio
122 124
      */
123 125
     public function listarEventosHistDoc($rut, $dv, $dte, $folio)
124 126
     {
@@ -206,10 +208,10 @@  discard block
 block discarded – undo
206 208
 
207 209
     /**
208 210
      * Método para realizar una solicitud al servicio web del SII
209
-     * @param request Nombre de la función que se ejecutará en el servicio web
211
+     * @param request string de la función que se ejecutará en el servicio web
210 212
      * @param args Argumentos que se pasarán al servicio web
211
-     * @param retry Intentos que se realizarán como máximo para obtener respuesta
212
-     * @return Objeto o String con la respuesta (depende servicio web)
213
+     * @param retry integer que se realizarán como máximo para obtener respuesta
214
+     * @return string o String con la respuesta (depende servicio web)
213 215
      * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl)
214 216
      * @version 2020-02-12
215 217
      */
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -71,8 +71,8 @@  discard block
 block discarded – undo
71 71
     ]; ///< Tipos de transacciones o caracterizaciones/clasificaciones de las compras
72 72
 
73 73
     public static $estados_ok = [
74
-        7,  // Evento registrado previamente
75
-        8,  // Pasados 8 días después de la recepción no es posible registrar reclamos o eventos
74
+        7, // Evento registrado previamente
75
+        8, // Pasados 8 días después de la recepción no es posible registrar reclamos o eventos
76 76
         27, // No se puede registrar un evento (acuse de recibo, reclamo o aceptación de contenido) de un DTE pagado al contado o gratuito
77 77
     ]; ///< Código de estado de respuesta de la asignación de estado que son considerados como OK
78 78
 
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
             return false;
252 252
         }
253 253
         // hacer consultas al SII
254
-        for ($i=0; $i<$retry; $i++) {
254
+        for ($i = 0; $i<$retry; $i++) {
255 255
             try {
256 256
                 $body = call_user_func_array([$soap, $request], $args);
257 257
                 break;
Please login to merge, or discard this patch.
lib/Sii/Dte.php 3 patches
Doc Comments   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
 
238 238
     /**
239 239
      * Método que entrega el tipo de DTE
240
-     * @return Tipo de dte, ej: 33 (factura electrónica)
240
+     * @return string de dte, ej: 33 (factura electrónica)
241 241
      * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl)
242 242
      * @version 2015-09-02
243 243
      */
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
 
249 249
     /**
250 250
      * Método que entrega el folio del DTE
251
-     * @return Folio del DTE
251
+     * @return string del DTE
252 252
      * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl)
253 253
      * @version 2015-09-02
254 254
      */
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
 
260 260
     /**
261 261
      * Método que entrega rut del emisor del DTE
262
-     * @return RUT del emiro
262
+     * @return string del emiro
263 263
      * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl)
264 264
      * @version 2015-09-07
265 265
      */
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
 
276 276
     /**
277 277
      * Método que entrega rut del receptor del DTE
278
-     * @return RUT del emiro
278
+     * @return string del emiro
279 279
      * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl)
280 280
      * @version 2015-09-07
281 281
      */
@@ -291,7 +291,7 @@  discard block
 block discarded – undo
291 291
 
292 292
     /**
293 293
      * Método que entrega fecha de emisión del DTE
294
-     * @return Fecha de emisión en formato AAAA-MM-DD
294
+     * @return string de emisión en formato AAAA-MM-DD
295 295
      * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl)
296 296
      * @version 2015-09-07
297 297
      */
@@ -400,7 +400,7 @@  discard block
 block discarded – undo
400 400
 
401 401
     /**
402 402
      * Método que realiza el timbrado del DTE
403
-     * @param Folios Objeto de los Folios con los que se desea timbrar
403
+     * @param Folios Folios de los Folios con los que se desea timbrar
404 404
      * @return =true si se pudo timbrar o =false en caso de error
405 405
      * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl)
406 406
      * @version 2016-09-01
@@ -486,7 +486,7 @@  discard block
 block discarded – undo
486 486
 
487 487
     /**
488 488
      * Método que realiza la firma del DTE
489
-     * @param Firma objeto que representa la Firma Electrónca
489
+     * @param Firma \sasco\LibreDTE\FirmaElectronica que representa la Firma Electrónca
490 490
      * @return =true si el DTE pudo ser fimado o =false si no se pudo firmar
491 491
      * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl)
492 492
      * @version 2017-10-22
@@ -509,7 +509,7 @@  discard block
 block discarded – undo
509 509
 
510 510
     /**
511 511
      * Método que entrega el DTE en XML
512
-     * @return XML con el DTE (podría: con o sin timbre y con o sin firma)
512
+     * @return string con el DTE (podría: con o sin timbre y con o sin firma)
513 513
      * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl)
514 514
      * @version 2015-08-20
515 515
      */
@@ -1764,7 +1764,7 @@  discard block
 block discarded – undo
1764 1764
      *  - Firma del DTE
1765 1765
      *  - RUT del emisor (si se pasó uno para comparar)
1766 1766
      *  - RUT del receptor (si se pasó uno para comparar)
1767
-     * @return Código del estado de la validación
1767
+     * @return integer del estado de la validación
1768 1768
      * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl)
1769 1769
      * @version 2019-07-03
1770 1770
      */
@@ -1877,7 +1877,7 @@  discard block
 block discarded – undo
1877 1877
 
1878 1878
     /**
1879 1879
      * Método que obtiene el estado del DTE
1880
-     * @param Firma objeto que representa la Firma Electrónca
1880
+     * @param Firma \sasco\LibreDTE\FirmaElectronica que representa la Firma Electrónca
1881 1881
      * @return Arreglo con el estado del DTE
1882 1882
      * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl)
1883 1883
      * @version 2015-10-24
@@ -1921,7 +1921,7 @@  discard block
 block discarded – undo
1921 1921
 
1922 1922
     /**
1923 1923
      * Método que obtiene el estado avanzado del DTE
1924
-     * @param Firma objeto que representa la Firma Electrónca
1924
+     * @param Firma \sasco\LibreDTE\FirmaElectronica que representa la Firma Electrónca
1925 1925
      * @return Arreglo con el estado del DTE
1926 1926
      * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl)
1927 1927
      * @version 2016-08-05
Please login to merge, or discard this patch.
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
                 ]
140 140
             ]);
141 141
             $parent = $this->xml->getElementsByTagName($this->tipo_general)->item(0);
142
-            $this->xml->generate($datos + ['TED' => null], null, $parent);
142
+            $this->xml->generate($datos+['TED' => null], null, $parent);
143 143
             $this->datos = $datos;
144 144
             if ($normalizar and !$this->verificarDatos()) {
145 145
                 return false;
@@ -382,7 +382,7 @@  discard block
 block discarded – undo
382 382
         $xml->documentElement->removeAttributeNS('http://www.w3.org/2001/XMLSchema-instance', 'xsi');
383 383
         $xml->documentElement->removeAttributeNS('http://www.sii.cl/SiiDte', '');
384 384
         $TED = $xml->getFlattened('/');
385
-        return mb_detect_encoding($TED, ['UTF-8', 'ISO-8859-1']) != 'ISO-8859-1' ? utf8_decode($TED) : $TED;
385
+        return mb_detect_encoding($TED, ['UTF-8', 'ISO-8859-1'])!='ISO-8859-1' ? utf8_decode($TED) : $TED;
386 386
     }
387 387
 
388 388
     /**
@@ -395,7 +395,7 @@  discard block
 block discarded – undo
395 395
     {
396 396
         $datos = $this->getDatos();
397 397
         $idk = !empty($datos['TED']['DD']['CAF']['DA']['IDK']) ? (int)$datos['TED']['DD']['CAF']['DA']['IDK'] : null;
398
-        return $idk ? $idk === 100 : null;
398
+        return $idk ? $idk===100 : null;
399 399
     }
400 400
 
401 401
     /**
@@ -532,7 +532,7 @@  discard block
 block discarded – undo
532 532
     {
533 533
         $this->getDatos();
534 534
         // generar resumen
535
-        $resumen =  [
535
+        $resumen = [
536 536
             'TpoDoc' => (int)$this->datos['Encabezado']['IdDoc']['TipoDTE'],
537 537
             'NroDoc' => (int)$this->datos['Encabezado']['IdDoc']['Folio'],
538 538
             'TasaImp' => 0,
@@ -577,10 +577,10 @@  discard block
 block discarded – undo
577 577
      */
578 578
     private function calcularNetoIVA($total, $tasa = null)
579 579
     {
580
-        if ($tasa === 0 or $tasa === false) {
580
+        if ($tasa===0 or $tasa===false) {
581 581
             return [0, 0];
582 582
         }
583
-        if ($tasa === null) {
583
+        if ($tasa===null) {
584 584
             $tasa = \sasco\LibreDTE\Sii::getIVA();
585 585
         }
586 586
         // WARNING: el IVA obtenido puede no ser el NETO*(TASA/100)
@@ -588,8 +588,8 @@  discard block
 block discarded – undo
588 588
         // entre el total y el neto, ya que hay casos de borde como:
589 589
         //  - BRUTO:   680 => NETO:   571 e IVA:   108 => TOTAL:   679
590 590
         //  - BRUTO: 86710 => NETO: 72866 e IVA: 13845 => TOTAL: 86711
591
-        $neto = round($total / (1+($tasa/100)));
592
-        $iva = $total - $neto;
591
+        $neto = round($total / (1+($tasa / 100)));
592
+        $iva = $total-$neto;
593 593
         return [$neto, $iva];
594 594
     }
595 595
 
@@ -1436,12 +1436,12 @@  discard block
 block discarded – undo
1436 1436
                     );
1437 1437
                     // aplicar descuento
1438 1438
                     if ($d['DescuentoPct']) {
1439
-                        $d['DescuentoMonto'] = round($d['MontoItem'] * (float)$d['DescuentoPct']/100);
1439
+                        $d['DescuentoMonto'] = round($d['MontoItem'] * (float)$d['DescuentoPct'] / 100);
1440 1440
                     }
1441 1441
                     $d['MontoItem'] -= $d['DescuentoMonto'];
1442 1442
                     // aplicar recargo
1443 1443
                     if ($d['RecargoPct']) {
1444
-                        $d['RecargoMonto'] = round($d['MontoItem'] * (float)$d['RecargoPct']/100);
1444
+                        $d['RecargoMonto'] = round($d['MontoItem'] * (float)$d['RecargoPct'] / 100);
1445 1445
                     }
1446 1446
                     $d['MontoItem'] += $d['RecargoMonto'];
1447 1447
                     // aproximar monto del item
@@ -1527,7 +1527,7 @@  discard block
 block discarded – undo
1527 1527
                 }
1528 1528
                 $valor =
1529 1529
                     $dr['TpoValor']=='%'
1530
-                    ? $this->round(($dr['ValorDR']/100)*$datos['Encabezado']['Totales'][$monto], $datos['Encabezado']['Totales']['TpoMoneda'])
1530
+                    ? $this->round(($dr['ValorDR'] / 100) * $datos['Encabezado']['Totales'][$monto], $datos['Encabezado']['Totales']['TpoMoneda'])
1531 1531
                     : $dr['ValorDR']
1532 1532
                 ;
1533 1533
                 // aplicar descuento
@@ -1600,7 +1600,7 @@  discard block
 block discarded – undo
1600 1600
             // si el monto no existe se asigna
1601 1601
             if ($datos['Encabezado']['Totales']['ImptoReten'][$i]['MontoImp']===null) {
1602 1602
                 $datos['Encabezado']['Totales']['ImptoReten'][$i]['MontoImp'] = round(
1603
-                    $neto * $datos['Encabezado']['Totales']['ImptoReten'][$i]['TasaImp']/100
1603
+                    $neto * $datos['Encabezado']['Totales']['ImptoReten'][$i]['TasaImp'] / 100
1604 1604
                 );
1605 1605
             }
1606 1606
         }
@@ -1608,7 +1608,7 @@  discard block
 block discarded – undo
1608 1608
         if (isset($datos['Encabezado']['Totales']['ImptoReten']) and is_array($datos['Encabezado']['Totales']['ImptoReten'])) {
1609 1609
             $codigos = array_keys($montos);
1610 1610
             $n_impuestos = count($datos['Encabezado']['Totales']['ImptoReten']);
1611
-            for ($i=0; $i<$n_impuestos; $i++) {
1611
+            for ($i = 0; $i<$n_impuestos; $i++) {
1612 1612
                 if (!in_array($datos['Encabezado']['Totales']['ImptoReten'][$i]['TipoImp'], $codigos)) {
1613 1613
                     unset($datos['Encabezado']['Totales']['ImptoReten'][$i]);
1614 1614
                 }
@@ -1633,7 +1633,7 @@  discard block
 block discarded – undo
1633 1633
         // valor IndMntNeto = 2 indica que los montosde las líneas on netos en cuyo caso no aplica el cálculo
1634 1634
         // de neto e iva a partir del total y deberá venir informado de otra forma (aun no definido)
1635 1635
         if ($this->esBoleta() and (empty($datos['Encabezado']['IdDoc']['IndMntNeto']) or $datos['Encabezado']['IdDoc']['IndMntNeto']!=2)) {
1636
-            $total = (int)$datos['Encabezado']['Totales']['MntTotal'] - (int)$datos['Encabezado']['Totales']['MntExe'];
1636
+            $total = (int)$datos['Encabezado']['Totales']['MntTotal']-(int)$datos['Encabezado']['Totales']['MntExe'];
1637 1637
             if ($total and (empty($datos['Encabezado']['Totales']['MntNeto']) or empty($datos['Encabezado']['Totales']['IVA']))) {
1638 1638
                 list($datos['Encabezado']['Totales']['MntNeto'], $datos['Encabezado']['Totales']['IVA']) = $this->calcularNetoIVA($total);
1639 1639
             }
@@ -1648,7 +1648,7 @@  discard block
 block discarded – undo
1648 1648
             } else {
1649 1649
                 if (empty($datos['Encabezado']['Totales']['IVA']) and !empty($datos['Encabezado']['Totales']['TasaIVA'])) {
1650 1650
                     $datos['Encabezado']['Totales']['IVA'] = round(
1651
-                        $datos['Encabezado']['Totales']['MntNeto']*($datos['Encabezado']['Totales']['TasaIVA']/100)
1651
+                        $datos['Encabezado']['Totales']['MntNeto'] * ($datos['Encabezado']['Totales']['TasaIVA'] / 100)
1652 1652
                     );
1653 1653
                 }
1654 1654
             }
@@ -1674,7 +1674,7 @@  discard block
 block discarded – undo
1674 1674
                 if (ImpuestosAdicionales::getTipo($ImptoReten['TipoImp'])=='R') {
1675 1675
                     $datos['Encabezado']['Totales']['MntTotal'] -= $ImptoReten['MontoImp'];
1676 1676
                     if ($ImptoReten['MontoImp']!=$datos['Encabezado']['Totales']['IVA']) {
1677
-                        $datos['Encabezado']['Totales']['IVANoRet'] = $datos['Encabezado']['Totales']['IVA'] - $ImptoReten['MontoImp'];
1677
+                        $datos['Encabezado']['Totales']['IVANoRet'] = $datos['Encabezado']['Totales']['IVA']-$ImptoReten['MontoImp'];
1678 1678
                     }
1679 1679
                 }
1680 1680
                 // si es adicional se suma al total
@@ -1832,7 +1832,7 @@  discard block
 block discarded – undo
1832 1832
         $SignatureValue = trim(str_replace(["\n", ' ', "\t"], '', $Signature->getElementsByTagName('SignatureValue')->item(0)->nodeValue));
1833 1833
         $X509Certificate = trim(str_replace(["\n", ' ', "\t"], '', $Signature->getElementsByTagName('X509Certificate')->item(0)->nodeValue));
1834 1834
         $X509Certificate = '-----BEGIN CERTIFICATE-----'."\n".wordwrap($X509Certificate, 64, "\n", true)."\n".'-----END CERTIFICATE----- ';
1835
-        $valid = openssl_verify($SignedInfo->C14N(), base64_decode($SignatureValue), $X509Certificate) === 1 ? true : false;
1835
+        $valid = openssl_verify($SignedInfo->C14N(), base64_decode($SignatureValue), $X509Certificate)===1 ? true : false;
1836 1836
         return $valid;
1837 1837
         //return $valid and $DigestValue===base64_encode(sha1($Documento->C14N(), true));
1838 1838
     }
Please login to merge, or discard this patch.
Braces   +62 added lines, -42 removed lines patch added patch discarded remove patch
@@ -57,10 +57,11 @@  discard block
 block discarded – undo
57 57
      */
58 58
     public function __construct($datos, $normalizar = true)
59 59
     {
60
-        if (is_array($datos))
61
-            $this->setDatos($datos, $normalizar);
62
-        else if (is_string($datos))
63
-            $this->loadXML($datos);
60
+        if (is_array($datos)) {
61
+                    $this->setDatos($datos, $normalizar);
62
+        } else if (is_string($datos)) {
63
+                    $this->loadXML($datos);
64
+        }
64 65
         $this->timestamp = date('Y-m-d\TH:i:s');
65 66
     }
66 67
 
@@ -121,8 +122,9 @@  discard block
 block discarded – undo
121 122
             if ($normalizar) {
122 123
                 $this->normalizar($datos);
123 124
                 $method = 'normalizar_'.$this->tipo;
124
-                if (method_exists($this, $method))
125
-                    $this->$method($datos);
125
+                if (method_exists($this, $method)) {
126
+                                    $this->$method($datos);
127
+                }
126 128
                 $this->normalizar_final($datos);
127 129
             }
128 130
             $this->tipo_general = $this->getTipoGeneral($this->tipo);
@@ -199,8 +201,9 @@  discard block
 block discarded – undo
199 201
      */
200 202
     public function getJSON()
201 203
     {
202
-        if (!$this->getDatos())
203
-            return false;
204
+        if (!$this->getDatos()) {
205
+                    return false;
206
+        }
204 207
         return json_encode($this->datos, JSON_PRETTY_PRINT);
205 208
     }
206 209
 
@@ -225,9 +228,10 @@  discard block
 block discarded – undo
225 228
      */
226 229
     private function getTipoGeneral($dte)
227 230
     {
228
-        foreach ($this->tipos as $tipo => $codigos)
229
-            if (in_array($dte, $codigos))
231
+        foreach ($this->tipos as $tipo => $codigos) {
232
+                    if (in_array($dte, $codigos))
230 233
                 return $tipo;
234
+        }
231 235
         \sasco\LibreDTE\Log::write(
232 236
             \sasco\LibreDTE\Estado::DTE_ERROR_TIPO,
233 237
             \sasco\LibreDTE\Estado::get(\sasco\LibreDTE\Estado::DTE_ERROR_TIPO, $dte)
@@ -266,10 +270,12 @@  discard block
 block discarded – undo
266 270
     public function getEmisor()
267 271
     {
268 272
         $nodo = $this->xml->xpath('/DTE/'.$this->tipo_general.'/Encabezado/Emisor/RUTEmisor')->item(0);
269
-        if ($nodo)
270
-            return $nodo->nodeValue;
271
-        if (!$this->getDatos())
272
-            return false;
273
+        if ($nodo) {
274
+                    return $nodo->nodeValue;
275
+        }
276
+        if (!$this->getDatos()) {
277
+                    return false;
278
+        }
273 279
         return $this->datos['Encabezado']['Emisor']['RUTEmisor'];
274 280
     }
275 281
 
@@ -282,10 +288,12 @@  discard block
 block discarded – undo
282 288
     public function getReceptor()
283 289
     {
284 290
         $nodo = $this->xml->xpath('/DTE/'.$this->tipo_general.'/Encabezado/Receptor/RUTRecep')->item(0);
285
-        if ($nodo)
286
-            return $nodo->nodeValue;
287
-        if (!$this->getDatos())
288
-            return false;
291
+        if ($nodo) {
292
+                    return $nodo->nodeValue;
293
+        }
294
+        if (!$this->getDatos()) {
295
+                    return false;
296
+        }
289 297
         return $this->datos['Encabezado']['Receptor']['RUTRecep'];
290 298
     }
291 299
 
@@ -298,10 +306,12 @@  discard block
 block discarded – undo
298 306
     public function getFechaEmision()
299 307
     {
300 308
         $nodo = $this->xml->xpath('/DTE/'.$this->tipo_general.'/Encabezado/IdDoc/FchEmis')->item(0);
301
-        if ($nodo)
302
-            return $nodo->nodeValue;
303
-        if (!$this->getDatos())
304
-            return false;
309
+        if ($nodo) {
310
+                    return $nodo->nodeValue;
311
+        }
312
+        if (!$this->getDatos()) {
313
+                    return false;
314
+        }
305 315
         return $this->datos['Encabezado']['IdDoc']['FchEmis'];
306 316
     }
307 317
 
@@ -314,10 +324,12 @@  discard block
 block discarded – undo
314 324
     public function getMontoTotal()
315 325
     {
316 326
         $nodo = $this->xml->xpath('/DTE/'.$this->tipo_general.'/Encabezado/Totales/MntTotal')->item(0);
317
-        if ($nodo)
318
-            return $nodo->nodeValue;
319
-        if (!$this->getDatos())
320
-            return false;
327
+        if ($nodo) {
328
+                    return $nodo->nodeValue;
329
+        }
330
+        if (!$this->getDatos()) {
331
+                    return false;
332
+        }
321 333
         return $this->datos['Encabezado']['Totales']['MntTotal'];
322 334
     }
323 335
 
@@ -330,10 +342,12 @@  discard block
 block discarded – undo
330 342
     public function getMoneda()
331 343
     {
332 344
         $nodo = $this->xml->xpath('/DTE/'.$this->tipo_general.'/Encabezado/Totales/TpoMoneda')->item(0);
333
-        if ($nodo)
334
-            return $nodo->nodeValue;
335
-        if (!$this->getDatos())
336
-            return false;
345
+        if ($nodo) {
346
+                    return $nodo->nodeValue;
347
+        }
348
+        if (!$this->getDatos()) {
349
+                    return false;
350
+        }
337 351
         return $this->datos['Encabezado']['Totales']['TpoMoneda'];
338 352
     }
339 353
 
@@ -376,8 +390,9 @@  discard block
 block discarded – undo
376 390
             return false;*/
377 391
         $xml = new \sasco\LibreDTE\XML();
378 392
         $TED = $this->xml->getElementsByTagName('TED')->item(0);
379
-        if (!$TED)
380
-            return '<TED/>';
393
+        if (!$TED) {
394
+                    return '<TED/>';
395
+        }
381 396
         $xml->loadXML($TED->C14N());
382 397
         $xml->documentElement->removeAttributeNS('http://www.w3.org/2001/XMLSchema-instance', 'xsi');
383 398
         $xml->documentElement->removeAttributeNS('http://www.sii.cl/SiiDte', '');
@@ -698,8 +713,9 @@  discard block
 block discarded – undo
698 713
         }
699 714
         // si existe descuento o recargo global se normalizan
700 715
         if (!empty($datos['DscRcgGlobal'])) {
701
-            if (!isset($datos['DscRcgGlobal'][0]))
702
-                $datos['DscRcgGlobal'] = [$datos['DscRcgGlobal']];
716
+            if (!isset($datos['DscRcgGlobal'][0])) {
717
+                            $datos['DscRcgGlobal'] = [$datos['DscRcgGlobal']];
718
+            }
703 719
             $NroLinDR = 1;
704 720
             foreach ($datos['DscRcgGlobal'] as &$dr) {
705 721
                 $dr = array_merge([
@@ -1364,8 +1380,9 @@  discard block
 block discarded – undo
1364 1380
      */
1365 1381
     private function normalizar_detalle(array &$datos)
1366 1382
     {
1367
-        if (!isset($datos['Detalle'][0]))
1368
-            $datos['Detalle'] = [$datos['Detalle']];
1383
+        if (!isset($datos['Detalle'][0])) {
1384
+                    $datos['Detalle'] = [$datos['Detalle']];
1385
+        }
1369 1386
         $item = 1;
1370 1387
         foreach ($datos['Detalle'] as &$d) {
1371 1388
             $d = array_merge([
@@ -1427,8 +1444,9 @@  discard block
 block discarded – undo
1427 1444
                 ];
1428 1445
             }
1429 1446
             if ($d['PrcItem']) {
1430
-                if (!$d['QtyItem'])
1431
-                    $d['QtyItem'] = 1;
1447
+                if (!$d['QtyItem']) {
1448
+                                    $d['QtyItem'] = 1;
1449
+                }
1432 1450
                 if (empty($d['MontoItem'])) {
1433 1451
                     $d['MontoItem'] = $this->round(
1434 1452
                         (float)$d['QtyItem'] * (float)$d['PrcItem'],
@@ -1494,8 +1512,9 @@  discard block
 block discarded – undo
1494 1512
     private function normalizar_aplicar_descuentos_recargos(array &$datos)
1495 1513
     {
1496 1514
         if (!empty($datos['DscRcgGlobal'])) {
1497
-            if (!isset($datos['DscRcgGlobal'][0]))
1498
-                $datos['DscRcgGlobal'] = [$datos['DscRcgGlobal']];
1515
+            if (!isset($datos['DscRcgGlobal'][0])) {
1516
+                            $datos['DscRcgGlobal'] = [$datos['DscRcgGlobal']];
1517
+            }
1499 1518
             foreach ($datos['DscRcgGlobal'] as &$dr) {
1500 1519
                 $dr = array_merge([
1501 1520
                     'NroLinDR' => false,
@@ -1562,8 +1581,9 @@  discard block
 block discarded – undo
1562 1581
         $montos = [];
1563 1582
         foreach ($datos['Detalle'] as &$d) {
1564 1583
             if (!empty($d['CodImpAdic'])) {
1565
-                if (!isset($montos[$d['CodImpAdic']]))
1566
-                    $montos[$d['CodImpAdic']] = 0;
1584
+                if (!isset($montos[$d['CodImpAdic']])) {
1585
+                                    $montos[$d['CodImpAdic']] = 0;
1586
+                }
1567 1587
                 $montos[$d['CodImpAdic']] += $d['MontoItem'];
1568 1588
             }
1569 1589
         }
Please login to merge, or discard this patch.