Completed
Push — master ( fb3624...2ea3ee )
by Esteban De La Fuente
41s
created
examples/011-set_pruebas_factura_exenta.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -66,4 +66,4 @@
 block discarded – undo
66 66
 
67 67
 // si hubo errores mostrar
68 68
 foreach (\sasco\LibreDTE\Log::readAll() as $error)
69
-    echo $error,"\n";
69
+    echo $error, "\n";
Please login to merge, or discard this patch.
Braces   +10 added lines, -6 removed lines patch added patch discarded remove patch
@@ -411,17 +411,20 @@  discard block
 block discarded – undo
411 411
 // Objetos de Firma, Folios y EnvioDTE
412 412
 $Firma = new \sasco\LibreDTE\FirmaElectronica($config['firma']);
413 413
 $Folios = [];
414
-foreach ($folios as $tipo => $cantidad)
414
+foreach ($folios as $tipo => $cantidad) {
415 415
     $Folios[$tipo] = new \sasco\LibreDTE\Sii\Folios(file_get_contents('xml/folios/'.$tipo.'.xml'));
416
+}
416 417
 $EnvioDTE = new \sasco\LibreDTE\Sii\EnvioDte();
417 418
 
418 419
 // generar cada DTE, timbrar, firmar y agregar al sobre de EnvioDTE
419 420
 foreach ($set_pruebas as $documento) {
420 421
     $DTE = new \sasco\LibreDTE\Sii\Dte($documento);
421
-    if (!$DTE->timbrar($Folios[$DTE->getTipo()]))
422
-        break;
423
-    if (!$DTE->firmar($Firma))
424
-        break;
422
+    if (!$DTE->timbrar($Folios[$DTE->getTipo()])) {
423
+            break;
424
+    }
425
+    if (!$DTE->firmar($Firma)) {
426
+            break;
427
+    }
425 428
     $EnvioDTE->agregar($DTE);
426 429
 }
427 430
 
@@ -433,5 +436,6 @@  discard block
 block discarded – undo
433 436
 var_dump($track_id);
434 437
 
435 438
 // si hubo errores mostrar
436
-foreach (\sasco\LibreDTE\Log::readAll() as $error)
439
+foreach (\sasco\LibreDTE\Log::readAll() as $error) {
437 440
     echo $error,"\n";
441
+}
Please login to merge, or discard this patch.
examples/015-etapa_intercambio_RecepcionDTE.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -66,4 +66,4 @@
 block discarded – undo
66 66
 
67 67
 // si hubo errores mostrar
68 68
 foreach (\sasco\LibreDTE\Log::readAll() as $error)
69
-    echo $error,"\n";
69
+    echo $error, "\n";
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -98,5 +98,6 @@
 block discarded – undo
98 98
 }
99 99
 
100 100
 // si hubo errores mostrar
101
-foreach (\sasco\LibreDTE\Log::readAll() as $error)
101
+foreach (\sasco\LibreDTE\Log::readAll() as $error) {
102 102
     echo $error,"\n";
103
+}
Please login to merge, or discard this patch.
examples/017-etapa_intercambio_ResultadoDTE.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -66,4 +66,4 @@
 block discarded – undo
66 66
 
67 67
 // si hubo errores mostrar
68 68
 foreach (\sasco\LibreDTE\Log::readAll() as $error)
69
-    echo $error,"\n";
69
+    echo $error, "\n";
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -98,5 +98,6 @@
 block discarded – undo
98 98
 }
99 99
 
100 100
 // si hubo errores mostrar
101
-foreach (\sasco\LibreDTE\Log::readAll() as $error)
101
+foreach (\sasco\LibreDTE\Log::readAll() as $error) {
102 102
     echo $error,"\n";
103
+}
Please login to merge, or discard this patch.
examples/012-set_pruebas_ventas.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -66,4 +66,4 @@
 block discarded – undo
66 66
 
67 67
 // si hubo errores mostrar
68 68
 foreach (\sasco\LibreDTE\Log::readAll() as $error)
69
-    echo $error,"\n";
69
+    echo $error, "\n";
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -65,5 +65,6 @@
 block discarded – undo
65 65
 var_dump($track_id);
66 66
 
67 67
 // si hubo errores mostrar
68
-foreach (\sasco\LibreDTE\Log::readAll() as $error)
68
+foreach (\sasco\LibreDTE\Log::readAll() as $error) {
69 69
     echo $error,"\n";
70
+}
Please login to merge, or discard this patch.
examples/031-libro_boleta.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -66,4 +66,4 @@
 block discarded – undo
66 66
 
67 67
 // si hubo errores mostrar
68 68
 foreach (\sasco\LibreDTE\Log::readAll() as $error)
69
-    echo $error,"\n";
69
+    echo $error, "\n";
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -98,5 +98,6 @@
 block discarded – undo
98 98
 }
99 99
 
100 100
 // si hubo errores mostrar
101
-foreach (\sasco\LibreDTE\Log::readAll() as $error)
101
+foreach (\sasco\LibreDTE\Log::readAll() as $error) {
102 102
     echo $error,"\n";
103
+}
Please login to merge, or discard this patch.
examples/022-libro_ventas_csv.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -66,4 +66,4 @@
 block discarded – undo
66 66
 
67 67
 // si hubo errores mostrar
68 68
 foreach (\sasco\LibreDTE\Log::readAll() as $error)
69
-    echo $error,"\n";
69
+    echo $error, "\n";
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -65,5 +65,6 @@
 block discarded – undo
65 65
 var_dump($track_id);
66 66
 
67 67
 // si hubo errores mostrar
68
-foreach (\sasco\LibreDTE\Log::readAll() as $error)
68
+foreach (\sasco\LibreDTE\Log::readAll() as $error) {
69 69
     echo $error,"\n";
70
+}
Please login to merge, or discard this patch.
lib/Sii/LibroCompraVenta.php 2 patches
Braces   +27 added lines, -18 removed lines patch added patch discarded remove patch
@@ -102,10 +102,12 @@  discard block
 block discarded – undo
102 102
      */
103 103
     public function agregar(array $detalle, $normalizar = true)
104 104
     {
105
-        if ($normalizar)
106
-            $this->normalizarDetalle($detalle);
107
-        if (!$detalle['TpoDoc'])
108
-            return false;
105
+        if ($normalizar) {
106
+                    $this->normalizarDetalle($detalle);
107
+        }
108
+        if (!$detalle['TpoDoc']) {
109
+                    return false;
110
+        }
109 111
         $this->detalles[] = $detalle;
110 112
         return true;
111 113
     }
@@ -183,8 +185,9 @@  discard block
 block discarded – undo
183 185
         }
184 186
         // calcular valores que no se hayan entregado
185 187
         if (isset($detalle['FctProp'])) {
186
-            if ($detalle['IVAUsoComun']===false)
187
-                $detalle['IVAUsoComun'] = round($detalle['MntNeto'] * ($detalle['TasaImp']/100));
188
+            if ($detalle['IVAUsoComun']===false) {
189
+                            $detalle['IVAUsoComun'] = round($detalle['MntNeto'] * ($detalle['TasaImp']/100));
190
+            }
188 191
         } else if (!$detalle['MntIVA'] and !is_array($detalle['IVANoRec']) and $detalle['TasaImp'] and $detalle['MntNeto']) {
189 192
             $detalle['MntIVA'] = round($detalle['MntNeto'] * ($detalle['TasaImp']/100));
190 193
         }
@@ -194,8 +197,9 @@  discard block
 block discarded – undo
194 197
         }
195 198
         // normalizar IVA no recuperable
196 199
         if (!empty($detalle['IVANoRec'])) {
197
-            if (!isset($detalle['IVANoRec'][0]))
198
-                $detalle['IVANoRec'] = [$detalle['IVANoRec']];
200
+            if (!isset($detalle['IVANoRec'][0])) {
201
+                            $detalle['IVANoRec'] = [$detalle['IVANoRec']];
202
+            }
199 203
             // si son múltiples iva no recuperable se arma arreglo real
200 204
             if (strpos($detalle['IVANoRec'][0]['CodIVANoRec'], ',')) {
201 205
                 $CodIVANoRec = explode(',', $detalle['IVANoRec'][0]['CodIVANoRec']);
@@ -212,8 +216,9 @@  discard block
 block discarded – undo
212 216
         }
213 217
         // normalizar otros impuestos
214 218
         if (!empty($detalle['OtrosImp'])) {
215
-            if (!isset($detalle['OtrosImp'][0]))
216
-                $detalle['OtrosImp'] = [$detalle['OtrosImp']];
219
+            if (!isset($detalle['OtrosImp'][0])) {
220
+                            $detalle['OtrosImp'] = [$detalle['OtrosImp']];
221
+            }
217 222
             // si son múltiples impuestos se arma arreglo real
218 223
             if (strpos($detalle['OtrosImp'][0]['CodImp'], ',')) {
219 224
                 $CodImp = explode(',', $detalle['OtrosImp'][0]['CodImp']);
@@ -531,8 +536,9 @@  discard block
 block discarded – undo
531 536
             'TipoEnvio' => 'TOTAL',
532 537
             'FolioNotificacion' => false,
533 538
         ], $caratula);
534
-        if ($this->caratula['TipoEnvio']=='ESPECIAL')
535
-            $this->caratula['FolioNotificacion'] = null;
539
+        if ($this->caratula['TipoEnvio']=='ESPECIAL') {
540
+                    $this->caratula['FolioNotificacion'] = null;
541
+        }
536 542
         $this->id = 'LibreDTE_LIBRO_'.$this->caratula['TipoOperacion'].'_'.str_replace('-', '', $this->caratula['RutEmisorLibro']).'_'.str_replace('-', '', $this->caratula['PeriodoTributario']).'_'.date('U');
537 543
     }
538 544
 
@@ -546,8 +552,9 @@  discard block
 block discarded – undo
546 552
     public function generar($incluirDetalle = true)
547 553
     {
548 554
         // si ya se había generado se entrega directamente
549
-        if ($this->xml_data)
550
-            return $this->xml_data;
555
+        if ($this->xml_data) {
556
+                    return $this->xml_data;
557
+        }
551 558
         // generar totales de DTE y sus montos
552 559
         $TotalesPeriodo = $this->getResumen();
553 560
         $ResumenPeriodo = $TotalesPeriodo ? ['TotalesPeriodo'=>$TotalesPeriodo] : false;
@@ -712,8 +719,9 @@  discard block
 block discarded – undo
712 719
         $manual = [];
713 720
         if (isset($this->toArray()['LibroCompraVenta']['EnvioLibro']['ResumenPeriodo']['TotalesPeriodo'])) {
714 721
             $totales = $this->toArray()['LibroCompraVenta']['EnvioLibro']['ResumenPeriodo']['TotalesPeriodo'];
715
-            if (!isset($totales[0]))
716
-                $totales = [$totales];
722
+            if (!isset($totales[0])) {
723
+                            $totales = [$totales];
724
+            }
717 725
             foreach ($totales as $total) {
718 726
                 if (isset($total['TpoDoc']) and in_array($total['TpoDoc'], [35, 38, 48])) {
719 727
                     $manual[$total['TpoDoc']] = array_merge($this->total_default, $total);
@@ -733,8 +741,9 @@  discard block
 block discarded – undo
733 741
         $manual = [];
734 742
         if (isset($this->toArray()['LibroCompraVenta']['EnvioLibro']['ResumenPeriodo']['TotalesPeriodo'])) {
735 743
             $totales = $this->toArray()['LibroCompraVenta']['EnvioLibro']['ResumenPeriodo']['TotalesPeriodo'];
736
-            if (!isset($totales[0]))
737
-                $totales = [$totales];
744
+            if (!isset($totales[0])) {
745
+                            $totales = [$totales];
746
+            }
738 747
             foreach ($totales as $total) {
739 748
                 if (in_array($total['TpoDoc'], [39, 41])) {
740 749
                     $manual[$total['TpoDoc']] = array_merge($this->total_default, $total);
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -184,9 +184,9 @@  discard block
 block discarded – undo
184 184
         // calcular valores que no se hayan entregado
185 185
         if (isset($detalle['FctProp'])) {
186 186
             if ($detalle['IVAUsoComun']===false)
187
-                $detalle['IVAUsoComun'] = round($detalle['MntNeto'] * ($detalle['TasaImp']/100));
187
+                $detalle['IVAUsoComun'] = round($detalle['MntNeto'] * ($detalle['TasaImp'] / 100));
188 188
         } else if (!$detalle['MntIVA'] and !is_array($detalle['IVANoRec']) and $detalle['TasaImp'] and $detalle['MntNeto']) {
189
-            $detalle['MntIVA'] = round($detalle['MntNeto'] * ($detalle['TasaImp']/100));
189
+            $detalle['MntIVA'] = round($detalle['MntNeto'] * ($detalle['TasaImp'] / 100));
190 190
         }
191 191
         // si el monto total es 0 pero no se asigno neto ni exento se coloca
192 192
         if ($detalle['MntExe']===false and $detalle['MntNeto']===false and $detalle['MntTotal']===0) {
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
                 $MntIVANoRec = explode(',', $detalle['IVANoRec'][0]['MntIVANoRec']);
209 209
                 $detalle['IVANoRec'] = [];
210 210
                 $n_inr = count($CodIVANoRec);
211
-                for ($i=0; $i<$n_inr; $i++) {
211
+                for ($i = 0; $i<$n_inr; $i++) {
212 212
                     $detalle['IVANoRec'][] = [
213 213
                         'CodIVANoRec' => $CodIVANoRec[$i],
214 214
                         'MntIVANoRec' => $MntIVANoRec[$i],
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
                 $MntImp = explode(',', $detalle['OtrosImp'][0]['MntImp']);
228 228
                 $detalle['OtrosImp'] = [];
229 229
                 $n_impuestos = count($CodImp);
230
-                for ($i=0; $i<$n_impuestos; $i++) {
230
+                for ($i = 0; $i<$n_impuestos; $i++) {
231 231
                     $detalle['OtrosImp'][] = [
232 232
                         'CodImp' => $CodImp[$i],
233 233
                         'TasaImp' => !empty($TasaImp[$i]) ? $TasaImp[$i] : false,
@@ -239,20 +239,20 @@  discard block
 block discarded – undo
239 239
             $retenido = ImpuestosAdicionales::getRetenido($detalle['OtrosImp']);
240 240
             if ($retenido) {
241 241
                 // si el iva retenido es total
242
-                if ($retenido == $detalle['MntIVA']) {
242
+                if ($retenido==$detalle['MntIVA']) {
243 243
                     $detalle['IVARetTotal'] = $retenido;
244 244
                 }
245 245
                 // si el iva retenido es parcial
246 246
                 else {
247 247
                     $detalle['IVARetParcial'] = $retenido;
248
-                    $detalle['IVANoRetenido'] = $detalle['MntIVA'] - $retenido;
248
+                    $detalle['IVANoRetenido'] = $detalle['MntIVA']-$retenido;
249 249
                 }
250 250
             }
251 251
         }
252 252
         // calcular monto total si no se especificó
253 253
         if ($detalle['MntTotal']===false) {
254 254
             // calcular monto total inicial
255
-            $detalle['MntTotal'] = (int)$detalle['MntExe'] + (int)$detalle['MntNeto'] + (int)$detalle['MntIVA'];
255
+            $detalle['MntTotal'] = (int)$detalle['MntExe']+(int)$detalle['MntNeto']+(int)$detalle['MntIVA'];
256 256
             // agregar iva no recuperable al monto total
257 257
             if (!empty($detalle['IVANoRec'])) {
258 258
                 foreach ($detalle['IVANoRec'] as $IVANoRec) {
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
                 }
273 273
             }
274 274
             // agregar otro montos e impuestos al total
275
-            $detalle['MntTotal'] += (int)$detalle['MntSinCred'] + (int)$detalle['TabPuros'] + (int)$detalle['TabCigarrillos'] + (int)$detalle['TabElaborado'] + (int)$detalle['ImpVehiculo'];
275
+            $detalle['MntTotal'] += (int)$detalle['MntSinCred']+(int)$detalle['TabPuros']+(int)$detalle['TabCigarrillos']+(int)$detalle['TabElaborado']+(int)$detalle['ImpVehiculo'];
276 276
         }
277 277
         // si no hay no hay monto neto, no se crean campos para IVA
278 278
         if ($detalle['MntNeto']===false) {
@@ -333,7 +333,7 @@  discard block
 block discarded – undo
333 333
         $data = \sasco\LibreDTE\CSV::read($archivo);
334 334
         $n_data = count($data);
335 335
         $detalles = [];
336
-        for ($i=1; $i<$n_data; $i++) {
336
+        for ($i = 1; $i<$n_data; $i++) {
337 337
             // detalle genérico
338 338
             $detalle = [
339 339
                 'TpoDoc' => $data[$i][0],
@@ -368,7 +368,7 @@  discard block
 block discarded – undo
368 368
             if (!empty($data[$i][11])) {
369 369
                 $detalle['IVANoRec'] = [
370 370
                     'CodIVANoRec' => $data[$i][11],
371
-                    'MntIVANoRec' => !empty($data[$i][12]) ? $data[$i][12] : round((int)$detalle['MntNeto'] * ((float)$detalle['TasaImp']/100)),
371
+                    'MntIVANoRec' => !empty($data[$i][12]) ? $data[$i][12] : round((int)$detalle['MntNeto'] * ((float)$detalle['TasaImp'] / 100)),
372 372
                 ];
373 373
             }
374 374
             // agregar código y monto de otros impuestos
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
                 $detalle['OtrosImp'] = [
377 377
                     'CodImp' => $data[$i][14],
378 378
                     'TasaImp' => !empty($data[$i][15]) ? $data[$i][15] : 0,
379
-                    'MntImp' => !empty($data[$i][16]) ? $data[$i][16] : round($detalle['MntNeto'] * ($data[$i][15]/100)),
379
+                    'MntImp' => !empty($data[$i][16]) ? $data[$i][16] : round($detalle['MntNeto'] * ($data[$i][15] / 100)),
380 380
                 ];
381 381
             }
382 382
             // si hay monto total se agrega
@@ -451,7 +451,7 @@  discard block
 block discarded – undo
451 451
         $data = \sasco\LibreDTE\CSV::read($archivo);
452 452
         $n_data = count($data);
453 453
         $detalles = [];
454
-        for ($i=1; $i<$n_data; $i++) {
454
+        for ($i = 1; $i<$n_data; $i++) {
455 455
             // detalle genérico
456 456
             $detalle = [
457 457
                 'TpoDoc' => $data[$i][0],
@@ -490,7 +490,7 @@  discard block
 block discarded – undo
490 490
                 $detalle['OtrosImp'] = [
491 491
                     'CodImp' => $data[$i][11],
492 492
                     'TasaImp' => !empty($data[$i][12]) ? $data[$i][12] : false,
493
-                    'MntImp' => !empty($data[$i][13]) ? $data[$i][13] : round($detalle['MntNeto'] * ($data[$i][12]/100)),
493
+                    'MntImp' => !empty($data[$i][13]) ? $data[$i][13] : round($detalle['MntNeto'] * ($data[$i][12] / 100)),
494 494
                 ];
495 495
             }
496 496
             // agregar datos extranjeros
@@ -655,8 +655,8 @@  discard block
 block discarded – undo
655 655
             // si hay IVA de uso común se contabiliza
656 656
             if (!empty($d['FctProp'])) {
657 657
                 $totales[$d['TpoDoc']]['TotIVAUsoComun'] += $d['IVAUsoComun'];
658
-                $totales[$d['TpoDoc']]['FctProp'] = $d['FctProp']/100;
659
-                $totales[$d['TpoDoc']]['TotCredIVAUsoComun'] += round($d['IVAUsoComun'] * ($d['FctProp']/100));
658
+                $totales[$d['TpoDoc']]['FctProp'] = $d['FctProp'] / 100;
659
+                $totales[$d['TpoDoc']]['TotCredIVAUsoComun'] += round($d['IVAUsoComun'] * ($d['FctProp'] / 100));
660 660
                 unset($d['FctProp']); // se quita el factor de proporcionalidad del detalle ya que no es parte del XML
661 661
             }
662 662
             // contabilizar IVA fuera de plazo
Please login to merge, or discard this patch.
lib/Sii/Dte/PDF/LibroCompraVenta.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -138,7 +138,7 @@
 block discarded – undo
138 138
                 ];
139 139
                 // agregar otros impuestos adicionales
140 140
                 if ($n_OtrosImp>1) {
141
-                    for ($i=1; $i<$n_OtrosImp; $i++) {
141
+                    for ($i = 1; $i<$n_OtrosImp; $i++) {
142 142
                         $detalle[] = [
143 143
                             '',
144 144
                             '',
Please login to merge, or discard this patch.
Braces   +10 added lines, -7 removed lines patch added patch discarded remove patch
@@ -57,8 +57,9 @@  discard block
 block discarded – undo
57 57
     {
58 58
         $this->startPageGroup();
59 59
         $this->AddPage();
60
-        if (isset($libro['LibroCompraVenta']))
61
-            $libro = $libro['LibroCompraVenta'];
60
+        if (isset($libro['LibroCompraVenta'])) {
61
+                    $libro = $libro['LibroCompraVenta'];
62
+        }
62 63
         // título del libro
63 64
         $this->SetFont('helvetica', 'B', 16);
64 65
         $this->Texto('Libro de '.ucfirst(strtolower($libro['EnvioLibro']['Caratula']['TipoOperacion'])), null, null, 'C');
@@ -109,8 +110,7 @@  discard block
 block discarded – undo
109 110
                     $total_resumen['TotIVARetTotal'] += !empty($total['TotIVARetTotal']) ? $total['TotIVARetTotal'] : 0;
110 111
                     $total_resumen['TotIVANoRetenido'] += !empty($total['TotIVANoRetenido']) ? $total['TotIVANoRetenido'] : 0;
111 112
                     $total_resumen['TotMntTotal'] += $total['TotMntTotal'];
112
-                }
113
-                else if (in_array($total['TpoDoc'], $this->dte_tipo_operacion['resta'])) {
113
+                } else if (in_array($total['TpoDoc'], $this->dte_tipo_operacion['resta'])) {
114 114
                     $total_resumen['TotMntExe'] -= !empty($total['TotMntExe']) ? $total['TotMntExe'] : 0;
115 115
                     $total_resumen['TotMntNeto'] -= !empty($total['TotMntNeto']) ? $total['TotMntNeto'] : 0;
116 116
                     $total_resumen['TotMntIVA'] -= !empty($total['TotMntIVA']) ? $total['TotMntIVA'] : 0;
@@ -171,10 +171,13 @@  discard block
 block discarded – undo
171 171
             foreach ($libro['EnvioLibro']['Detalle'] as $d) {
172 172
                 // impuesto adicional
173 173
                 if (!empty($d['OtrosImp'])) {
174
-                    if (!isset($d['OtrosImp'][0]))
175
-                        $d['OtrosImp'] = [$d['OtrosImp']];
174
+                    if (!isset($d['OtrosImp'][0])) {
175
+                                            $d['OtrosImp'] = [$d['OtrosImp']];
176
+                    }
176 177
                     $n_OtrosImp = count($d['OtrosImp']);
177
-                } else $n_OtrosImp = 0;
178
+                } else {
179
+                    $n_OtrosImp = 0;
180
+                }
178 181
                 // se agrega detalle
179 182
                 $detalle[] = [
180 183
                     $d['TpoDoc'],
Please login to merge, or discard this patch.
examples/018-generar_pdf.php 1 patch
Braces   +7 added lines, -4 removed lines patch added patch discarded remove patch
@@ -52,15 +52,18 @@
 block discarded – undo
52 52
 
53 53
 // directorio temporal para guardar los PDF
54 54
 $dir = sys_get_temp_dir().'/dte_'.$Caratula['RutEmisor'].'_'.$Caratula['RutReceptor'].'_'.str_replace(['-', ':', 'T'], '', $Caratula['TmstFirmaEnv']);
55
-if (is_dir($dir))
55
+if (is_dir($dir)) {
56 56
     \sasco\LibreDTE\File::rmdir($dir);
57
-if (!mkdir($dir))
57
+}
58
+if (!mkdir($dir)) {
58 59
     die('No fue posible crear directorio temporal para DTEs');
60
+}
59 61
 
60 62
 // procesar cada DTEs e ir agregándolo al PDF
61 63
 foreach ($Documentos as $DTE) {
62
-    if (!$DTE->getDatos())
63
-        die('No se pudieron obtener los datos del DTE');
64
+    if (!$DTE->getDatos()) {
65
+            die('No se pudieron obtener los datos del DTE');
66
+    }
64 67
     $pdf = new \sasco\LibreDTE\Sii\Dte\PDF\Dte(false); // =false hoja carta, =true papel contínuo (false por defecto si no se pasa)
65 68
     $pdf->setFooterText();
66 69
     $pdf->setLogo('/home/delaf/www/localhost/dev/pages/sasco/website/webroot/img/logo_mini.png'); // debe ser PNG!
Please login to merge, or discard this patch.