Completed
Push — master ( da8ed0...bedd83 )
by Esteban De La Fuente
03:41
created
lib/Sii/Dte/PDF/Dte.php 2 patches
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
      */
@@ -331,7 +331,7 @@  discard block
 block discarded – undo
331 331
      * contínuo de 80mm
332 332
      * @param dte Arreglo con los datos del XML (tag Documento)
333 333
      * @param timbre String XML con el tag TED del DTE
334
-     * @param width Ancho del papel contínuo en mm (es parámetro porque se usa el mismo método para 75mm)
334
+     * @param width integer del papel contínuo en mm (es parámetro porque se usa el mismo método para 75mm)
335 335
      * @author Pablo Reyes (https://github.com/pabloxp)
336 336
      * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl)
337 337
      * @version 2021-01-08
@@ -489,10 +489,11 @@  discard block
 block discarded – undo
489 489
      *  - Dirección casa central del emisor
490 490
      *  - Dirección sucursales
491 491
      * @param emisor Arreglo con los datos del emisor (tag Emisor del XML)
492
-     * @param x Posición horizontal de inicio en el PDF
493
-     * @param y Posición vertical de inicio en el PDF
494
-     * @param w Ancho de la información del emisor
495
-     * @param w_img Ancho máximo de la imagen
492
+     * @param x integer horizontal de inicio en el PDF
493
+     * @param y integer vertical de inicio en el PDF
494
+     * @param w integer de la información del emisor
495
+     * @param w_img integer máximo de la imagen
496
+     * @param integer $font_size
496 497
      * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl)
497 498
      * @version 2021-01-08
498 499
      */
@@ -602,11 +603,13 @@  discard block
 block discarded – undo
602 603
      * @param rut RUT del emisor
603 604
      * @param tipo Código o glosa del tipo de documento
604 605
      * @param sucursal_sii Código o glosa de la sucursal del SII del Emisor
605
-     * @param x Posición horizontal de inicio en el PDF
606
-     * @param y Posición vertical de inicio en el PDF
607
-     * @param w Ancho de la información del emisor
606
+     * @param x integer horizontal de inicio en el PDF
607
+     * @param y integer vertical de inicio en el PDF
608
+     * @param w integer de la información del emisor
609
+     * @param integer $font_size
608 610
      * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl)
609 611
      * @version 2019-08-05
612
+     * @return integer
610 613
      */
611 614
     protected function agregarFolio($rut, $tipo, $folio, $sucursal_sii = null, $x = 130, $y = 15, $w = 70, $font_size = null, array $color = null)
612 615
     {
@@ -638,7 +641,7 @@  discard block
 block discarded – undo
638 641
      * Método que agrega los datos de la emisión del DTE que no son los dato del
639 642
      * receptor
640 643
      * @param IdDoc Información general del documento
641
-     * @param x Posición horizontal de inicio en el PDF
644
+     * @param x integer horizontal de inicio en el PDF
642 645
      * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl)
643 646
      * @version 2020-08-11
644 647
      */
@@ -726,7 +729,7 @@  discard block
 block discarded – undo
726 729
     /**
727 730
      * Método que agrega los datos del receptor
728 731
      * @param receptor Arreglo con los datos del receptor (tag Receptor del XML)
729
-     * @param x Posición horizontal de inicio en el PDF
732
+     * @param x integer horizontal de inicio en el PDF
730 733
      * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl)
731 734
      * @version 2019-10-06
732 735
      */
@@ -813,7 +816,7 @@  discard block
 block discarded – undo
813 816
      * Método que agrega los datos del traslado
814 817
      * @param IndTraslado
815 818
      * @param Transporte
816
-     * @param x Posición horizontal de inicio en el PDF
819
+     * @param x integer horizontal de inicio en el PDF
817 820
      * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl)
818 821
      * @version 2016-08-03
819 822
      */
@@ -893,7 +896,7 @@  discard block
 block discarded – undo
893 896
     /**
894 897
      * Método que agrega las referencias del documento
895 898
      * @param referencias Arreglo con las referencias del documento (tag Referencia del XML)
896
-     * @param x Posición horizontal de inicio en el PDF
899
+     * @param x integer horizontal de inicio en el PDF
897 900
      * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl)
898 901
      * @version 2017-09-25
899 902
      */
@@ -930,7 +933,7 @@  discard block
 block discarded – undo
930 933
     /**
931 934
      * Método que agrega el detalle del documento
932 935
      * @param detalle Arreglo con el detalle del documento (tag Detalle del XML)
933
-     * @param x Posición horizontal de inicio en el PDF
936
+     * @param x integer horizontal de inicio en el PDF
934 937
      * @param y Posición vertical de inicio en el PDF
935 938
      * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl)
936 939
      * @version 2020-08-28
@@ -1040,7 +1043,7 @@  discard block
 block discarded – undo
1040 1043
     /**
1041 1044
      * Método que agrega el detalle del documento
1042 1045
      * @param detalle Arreglo con el detalle del documento (tag Detalle del XML)
1043
-     * @param x Posición horizontal de inicio en el PDF
1046
+     * @param x integer horizontal de inicio en el PDF
1044 1047
      * @param y Posición vertical de inicio en el PDF
1045 1048
      * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl)
1046 1049
      * @author Pablo Reyes (https://github.com/pabloxp)
@@ -1100,7 +1103,7 @@  discard block
 block discarded – undo
1100 1103
      * Método que agrega el subtotal del DTE
1101 1104
      * @param detalle Arreglo con los detalles del documentos para poder
1102 1105
      * calcular subtotal
1103
-     * @param x Posición horizontal de inicio en el PDF
1106
+     * @param x integer horizontal de inicio en el PDF
1104 1107
      * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl)
1105 1108
      * @version 2016-08-17
1106 1109
      */
@@ -1126,7 +1129,7 @@  discard block
 block discarded – undo
1126 1129
     /**
1127 1130
      * Método que agrega los descuentos y/o recargos globales del documento
1128 1131
      * @param descuentosRecargos Arreglo con los descuentos y/o recargos del documento (tag DscRcgGlobal del XML)
1129
-     * @param x Posición horizontal de inicio en el PDF
1132
+     * @param x integer horizontal de inicio en el PDF
1130 1133
      * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl)
1131 1134
      * @version 2018-05-29
1132 1135
      */
@@ -1154,7 +1157,7 @@  discard block
 block discarded – undo
1154 1157
     /**
1155 1158
      * Método que agrega los pagos del documento
1156 1159
      * @param pagos Arreglo con los pagos del documento
1157
-     * @param x Posición horizontal de inicio en el PDF
1160
+     * @param x integer horizontal de inicio en el PDF
1158 1161
      * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl)
1159 1162
      * @version 2016-07-24
1160 1163
      */
@@ -1312,9 +1315,10 @@  discard block
 block discarded – undo
1312 1315
      *  - Se imprime en el tamaño mínimo: 2x5 cms
1313 1316
      *  - En el lado de abajo con margen izquierdo mínimo de 2 cms
1314 1317
      * @param timbre String con los datos del timbre
1315
-     * @param x Posición horizontal de inicio en el PDF
1316
-     * @param y Posición vertical de inicio en el PDF
1317
-     * @param w Ancho del timbre
1318
+     * @param x integer horizontal de inicio en el PDF
1319
+     * @param y integer vertical de inicio en el PDF
1320
+     * @param w integer del timbre
1321
+     * @param string $position
1318 1322
      * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl)
1319 1323
      * @version 2019-10-06
1320 1324
      */
@@ -1352,10 +1356,10 @@  discard block
 block discarded – undo
1352 1356
 
1353 1357
     /**
1354 1358
      * Método que agrega el acuse de rebido
1355
-     * @param x Posición horizontal de inicio en el PDF
1356
-     * @param y Posición vertical de inicio en el PDF
1357
-     * @param w Ancho del acuse de recibo
1358
-     * @param h Alto del acuse de recibo
1359
+     * @param x integer horizontal de inicio en el PDF
1360
+     * @param y integer vertical de inicio en el PDF
1361
+     * @param w integer del acuse de recibo
1362
+     * @param h integer del acuse de recibo
1359 1363
      * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl)
1360 1364
      * @version 2019-10-06
1361 1365
      */
@@ -1383,10 +1387,10 @@  discard block
 block discarded – undo
1383 1387
 
1384 1388
     /**
1385 1389
      * Método que agrega el acuse de rebido
1386
-     * @param x Posición horizontal de inicio en el PDF
1390
+     * @param x integer horizontal de inicio en el PDF
1387 1391
      * @param y Posición vertical de inicio en el PDF
1388
-     * @param w Ancho del acuse de recibo
1389
-     * @param h Alto del acuse de recibo
1392
+     * @param w integer del acuse de recibo
1393
+     * @param h integer del acuse de recibo
1390 1394
      * @author Pablo Reyes (https://github.com/pabloxp)
1391 1395
      * @version 2015-11-17
1392 1396
      */
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
             isset($dte['Encabezado']['Emisor']['CmnaOrigen']) ? $dte['Encabezado']['Emisor']['CmnaOrigen'] : 'Sin comuna', // siempre debería tener comuna
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,20 +553,20 @@  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
             $direccion = !empty($emisor['DirOrigen']) ? $emisor['DirOrigen'] : null;
562 562
             $comuna = !empty($emisor['CmnaOrigen']) ? $emisor['CmnaOrigen'] : null;
563 563
             $ciudad = !empty($emisor['CiudadOrigen']) ? $emisor['CiudadOrigen'] : \sasco\LibreDTE\Chile::getCiudad($comuna);
564
-            $this->MultiTexto($direccion.($comuna?(', '.$comuna):'').($ciudad?(', '.$ciudad):''), $x, $this->y, 'L', ($h_folio and $h_folio < $this->getY()) ? $w_all : $w);
564
+            $this->MultiTexto($direccion.($comuna ? (', '.$comuna) : '').($ciudad ? (', '.$ciudad) : ''), $x, $this->y, 'L', ($h_folio and $h_folio<$this->getY()) ? $w_all : $w);
565 565
             if (!empty($emisor['Sucursal'])) {
566
-                $this->MultiTexto('Sucursal: '.$emisor['Sucursal'], $x, $this->y, 'L', ($h_folio and $h_folio < $this->getY()) ? $w_all : $w);
566
+                $this->MultiTexto('Sucursal: '.$emisor['Sucursal'], $x, $this->y, 'L', ($h_folio and $h_folio<$this->getY()) ? $w_all : $w);
567 567
             }
568 568
             if (!empty($this->casa_matriz)) {
569
-                $this->MultiTexto('Casa matriz: '.$this->casa_matriz, $x, $this->y, 'L', ($h_folio and $h_folio < $this->getY()) ? $w_all : $w);
569
+                $this->MultiTexto('Casa matriz: '.$this->casa_matriz, $x, $this->y, 'L', ($h_folio and $h_folio<$this->getY()) ? $w_all : $w);
570 570
             }
571 571
             $contacto = [];
572 572
             if (!empty($emisor['Telefono'])) {
@@ -581,7 +581,7 @@  discard block
 block discarded – undo
581 581
                 $contacto[] = $emisor['CorreoEmisor'];
582 582
             }
583 583
             if ($contacto) {
584
-                $this->MultiTexto(implode(' / ', $contacto), $x, $this->y, 'L', ($h_folio and $h_folio < $this->getY()) ? $w_all : $w);
584
+                $this->MultiTexto(implode(' / ', $contacto), $x, $this->y, 'L', ($h_folio and $h_folio<$this->getY()) ? $w_all : $w);
585 585
             }
586 586
         }
587 587
         return $this->y;
@@ -611,12 +611,12 @@  discard block
 block discarded – undo
611 611
     protected function agregarFolio($rut, $tipo, $folio, $sucursal_sii = null, $x = 130, $y = 15, $w = 70, $font_size = null, array $color = null)
612 612
     {
613 613
         if ($color===null) {
614
-            $color = $tipo ? ($tipo==52 ? [0,172,140] : [255,0,0]) : [0,0,0];
614
+            $color = $tipo ? ($tipo==52 ? [0, 172, 140] : [255, 0, 0]) : [0, 0, 0];
615 615
         }
616 616
         $this->SetTextColorArray($color);
617 617
         // colocar rut emisor, glosa documento y folio
618 618
         list($rut, $dv) = explode('-', $rut);
619
-        $this->setFont ('', 'B', $font_size ? $font_size : 15);
619
+        $this->setFont('', 'B', $font_size ? $font_size : 15);
620 620
         $this->MultiTexto('R.U.T.: '.$this->num($rut).'-'.$dv, $x, $y+4, 'C', $w);
621 621
         $this->setFont('', 'B', $font_size ? $font_size : 12);
622 622
         $this->MultiTexto($this->getTipo($tipo, $folio), $x, null, 'C', $w);
@@ -629,7 +629,7 @@  discard block
 block discarded – undo
629 629
         if ($tipo) {
630 630
             $this->Texto('S.I.I. - '.\sasco\LibreDTE\Sii::getDireccionRegional($sucursal_sii), $x, $this->getY()+4, 'C', $w);
631 631
         }
632
-        $this->SetTextColorArray([0,0,0]);
632
+        $this->SetTextColorArray([0, 0, 0]);
633 633
         $this->Ln();
634 634
         return $this->y;
635 635
     }
@@ -743,10 +743,10 @@  discard block
 block discarded – undo
743 743
         }
744 744
         if (!empty($receptor['RznSocRecep'])) {
745 745
             $this->setFont('', 'B', null);
746
-            $this->Texto(in_array($this->dte, [39, 41]) ? 'Nombre' : ($x==10?'Razón social':'Razón soc.'), $x);
746
+            $this->Texto(in_array($this->dte, [39, 41]) ? 'Nombre' : ($x==10 ? 'Razón social' : 'Razón soc.'), $x);
747 747
             $this->Texto(':', $x+$offset);
748 748
             $this->setFont('', '', null);
749
-            $this->MultiTexto($receptor['RznSocRecep'], $x+$offset+2, null, '', $x==10?105:0);
749
+            $this->MultiTexto($receptor['RznSocRecep'], $x+$offset+2, null, '', $x==10 ? 105 : 0);
750 750
         }
751 751
         if (!empty($receptor['GiroRecep'])) {
752 752
             $this->setFont('', 'B', null);
@@ -763,7 +763,7 @@  discard block
 block discarded – undo
763 763
             $ciudad = !empty($receptor['CiudadRecep']) ? $receptor['CiudadRecep'] : (
764 764
                 !empty($receptor['CmnaRecep']) ? \sasco\LibreDTE\Chile::getCiudad($receptor['CmnaRecep']) : ''
765 765
             );
766
-            $this->MultiTexto($receptor['DirRecep'].(!empty($receptor['CmnaRecep'])?(', '.$receptor['CmnaRecep']):'').($ciudad?(', '.$ciudad):''), $x+$offset+2);
766
+            $this->MultiTexto($receptor['DirRecep'].(!empty($receptor['CmnaRecep']) ? (', '.$receptor['CmnaRecep']) : '').($ciudad ? (', '.$ciudad) : ''), $x+$offset+2);
767 767
         }
768 768
         if (!empty($receptor['Extranjero']['Nacionalidad'])) {
769 769
             $this->setFont('', 'B', null);
@@ -804,7 +804,7 @@  discard block
 block discarded – undo
804 804
             $this->Texto('Cód. recep.', $x);
805 805
             $this->Texto(':', $x+$offset);
806 806
             $this->setFont('', '', null);
807
-            $this->MultiTexto($receptor['CdgIntRecep'], $x+$offset+2, null, '', $x==10?105:0);
807
+            $this->MultiTexto($receptor['CdgIntRecep'], $x+$offset+2, null, '', $x==10 ? 105 : 0);
808 808
         }
809 809
         return $this->GetY();
810 810
     }
@@ -901,7 +901,7 @@  discard block
 block discarded – undo
901 901
     {
902 902
         if (!isset($referencias[0]))
903 903
             $referencias = [$referencias];
904
-        foreach($referencias as $r) {
904
+        foreach ($referencias as $r) {
905 905
             $texto = $r['NroLinRef'].' - ';
906 906
             if (!empty($r['TpoDocRef'])) {
907 907
                 $texto .= $this->getTipo($r['TpoDocRef']).' ';
@@ -962,7 +962,7 @@  discard block
 block discarded – undo
962 962
             // quitar columnas
963 963
             foreach ($item as $col => $valor) {
964 964
                 if ($col=='DscItem' and !empty($item['DscItem'])) {
965
-                    $item['NmbItem'] .= !$this->item_detalle_posicion ? ($html?'<br/>':"\n") : ': ';
965
+                    $item['NmbItem'] .= !$this->item_detalle_posicion ? ($html ? '<br/>' : "\n") : ': ';
966 966
                     $item['DscItem'] = $html ? str_replace("\n", '<br/>', $item['DscItem']) : str_replace(['<br/>', '<br>'], "\n", $item['DscItem']);
967 967
                     if ($html) {
968 968
                         $item['NmbItem'] .= '<span style="font-size:0.7em">'.$item['DscItem'].'</span>';
@@ -1011,7 +1011,7 @@  discard block
 block discarded – undo
1011 1011
             }
1012 1012
             $item = array_merge($item_default, $item);
1013 1013
             // si hay código de item se extrae su valor
1014
-            if (!empty($item['CdgItem']['VlrCodigo'])){
1014
+            if (!empty($item['CdgItem']['VlrCodigo'])) {
1015 1015
                 $item['CdgItem'] = $item['CdgItem']['VlrCodigo'];
1016 1016
             }
1017 1017
             // dar formato a números
@@ -1054,9 +1054,9 @@  discard block
 block discarded – undo
1054 1054
         $this->SetY($this->getY()+1);
1055 1055
         $p1x = $x;
1056 1056
         $p1y = $this->y;
1057
-        $p2x = $this->getPageWidth() - 2;
1058
-        $p2y = $p1y;  // Use same y for a straight line
1059
-        $style = array('width' => 0.2,'color' => array(0, 0, 0));
1057
+        $p2x = $this->getPageWidth()-2;
1058
+        $p2y = $p1y; // Use same y for a straight line
1059
+        $style = array('width' => 0.2, 'color' => array(0, 0, 0));
1060 1060
         $this->Line($p1x, $p1y, $p2x, $p2y, $style);
1061 1061
         $this->Texto($this->detalle_cols['NmbItem']['title'], $x+$offsets[0], $this->y, ucfirst($this->detalle_cols['NmbItem']['align'][0]), $this->detalle_cols['NmbItem']['width']);
1062 1062
         $this->Texto($this->detalle_cols['PrcItem']['title'], $x+$offsets[1], $this->y, ucfirst($this->detalle_cols['PrcItem']['align'][0]), $this->detalle_cols['PrcItem']['width']);
@@ -1068,7 +1068,7 @@  discard block
 block discarded – undo
1068 1068
         }
1069 1069
         // mostrar items
1070 1070
         $this->SetY($this->getY()+2);
1071
-        foreach($detalle as  &$d) {
1071
+        foreach ($detalle as  &$d) {
1072 1072
             // nombre y descripción del item
1073 1073
             $item = $d['NmbItem'];
1074 1074
             if ($this->papel_continuo_item_detalle and !empty($d['DscItem'])) {
@@ -1078,15 +1078,15 @@  discard block
 block discarded – undo
1078 1078
             // descuento
1079 1079
             if (!empty($d['DescuentoPct']) or !empty($d['DescuentoMonto'])) {
1080 1080
                 if (!empty($d['DescuentoPct'])) {
1081
-                    $descuento = number_format($d['DescuentoPct'],0,',','.').'%';
1081
+                    $descuento = number_format($d['DescuentoPct'], 0, ',', '.').'%';
1082 1082
                 } else {
1083
-                    $descuento = number_format($d['DescuentoMonto'],0,',','.');
1083
+                    $descuento = number_format($d['DescuentoMonto'], 0, ',', '.');
1084 1084
                 }
1085 1085
                 $this->Texto('Desc.: '.$descuento, $x+$offsets[0], $this->y, ucfirst($this->detalle_cols['NmbItem']['align'][0]), $this->detalle_cols['NmbItem']['width']);
1086 1086
             }
1087 1087
             // precio y cantidad
1088 1088
             if (isset($d['PrcItem'])) {
1089
-                $this->Texto(number_format($d['PrcItem'],0,',','.'), $x+$offsets[1], $this->y, ucfirst($this->detalle_cols['PrcItem']['align'][0]), $this->detalle_cols['PrcItem']['width']);
1089
+                $this->Texto(number_format($d['PrcItem'], 0, ',', '.'), $x+$offsets[1], $this->y, ucfirst($this->detalle_cols['PrcItem']['align'][0]), $this->detalle_cols['PrcItem']['width']);
1090 1090
             }
1091 1091
             if (isset($d['QtyItem'])) {
1092 1092
                 $this->Texto($this->num($d['QtyItem']), $x+$offsets[2], $this->y, ucfirst($this->detalle_cols['QtyItem']['align'][0]), $this->detalle_cols['QtyItem']['width']);
@@ -1109,7 +1109,7 @@  discard block
 block discarded – undo
1109 1109
         if (!isset($detalle[0])) {
1110 1110
             $detalle = [$detalle];
1111 1111
         }
1112
-        foreach($detalle as  &$d) {
1112
+        foreach ($detalle as  &$d) {
1113 1113
             if (!empty($d['MontoItem'])) {
1114 1114
                 $subtotal += $d['MontoItem'];
1115 1115
             }
@@ -1135,16 +1135,16 @@  discard block
 block discarded – undo
1135 1135
         if (!isset($descuentosRecargos[0])) {
1136 1136
             $descuentosRecargos = [$descuentosRecargos];
1137 1137
         }
1138
-        foreach($descuentosRecargos as $dr) {
1138
+        foreach ($descuentosRecargos as $dr) {
1139 1139
             $tipo = $dr['TpoMov']=='D' ? 'Descuento' : 'Recargo';
1140 1140
             if (!empty($dr['IndExeDR'])) {
1141 1141
                 $tipo .= ' EX';
1142 1142
             }
1143 1143
             $valor = $dr['TpoValor']=='%' ? $dr['ValorDR'].'%' : $this->num($dr['ValorDR']);
1144 1144
             if ($this->papelContinuo) {
1145
-                $this->Texto($tipo.' global: '.$valor.(!empty($dr['GlosaDR'])?(' ('.$dr['GlosaDR'].')'):''), $x);
1145
+                $this->Texto($tipo.' global: '.$valor.(!empty($dr['GlosaDR']) ? (' ('.$dr['GlosaDR'].')') : ''), $x);
1146 1146
             } else {
1147
-                $this->Texto($tipo.(!empty($dr['GlosaDR'])?(' ('.$dr['GlosaDR'].')'):'').':', 77, null, 'R', 100);
1147
+                $this->Texto($tipo.(!empty($dr['GlosaDR']) ? (' ('.$dr['GlosaDR'].')') : '').':', 77, null, 'R', 100);
1148 1148
                 $this->Texto($valor, 177, null, 'R', 22);
1149 1149
             }
1150 1150
             $this->Ln();
@@ -1164,8 +1164,8 @@  discard block
 block discarded – undo
1164 1164
             $pagos = [$pagos];
1165 1165
         $this->Texto('Pago(s) programado(s):', $x);
1166 1166
         $this->Ln();
1167
-        foreach($pagos as $p) {
1168
-            $this->Texto('  - '.$this->date($p['FchPago'], false).': $'.$this->num($p['MntPago']).'.-'.(!empty($p['GlosaPagos'])?(' ('.$p['GlosaPagos'].')'):''), $x);
1167
+        foreach ($pagos as $p) {
1168
+            $this->Texto('  - '.$this->date($p['FchPago'], false).': $'.$this->num($p['MntPago']).'.-'.(!empty($p['GlosaPagos']) ? (' ('.$p['GlosaPagos'].')') : ''), $x);
1169 1169
             $this->Ln();
1170 1170
         }
1171 1171
     }
@@ -1199,7 +1199,7 @@  discard block
 block discarded – undo
1199 1199
             'TpoMoneda' => 'Moneda',
1200 1200
             'MntNeto' => 'Neto $',
1201 1201
             'MntExe' => 'Exento $',
1202
-            'IVA' => 'IVA '.(!empty($totales['TasaIVA'])?(' ('.$totales['TasaIVA'].'%) '):'').'$',
1202
+            'IVA' => 'IVA '.(!empty($totales['TasaIVA']) ? (' ('.$totales['TasaIVA'].'%) ') : '').'$',
1203 1203
             'IVANoRet' => 'IVA no retenido $',
1204 1204
             'CredEC' => 'Desc. 65% IVA $',
1205 1205
             'MntTotal' => 'Total $',
@@ -1216,7 +1216,7 @@  discard block
 block discarded – undo
1216 1216
             if (!isset($ImptoReten[0])) {
1217 1217
                 $ImptoReten = [$ImptoReten];
1218 1218
             }
1219
-            foreach($ImptoReten as $i) {
1219
+            foreach ($ImptoReten as $i) {
1220 1220
                 $totales['ImptoReten_'.$i['TipoImp']] = $i['MontoImp'];
1221 1221
                 if (!empty($i['TasaImp'])) {
1222 1222
                     $glosas['ImptoReten_'.$i['TipoImp']] = \sasco\LibreDTE\Sii\ImpuestosAdicionales::getGlosa($i['TipoImp']).' ('.$i['TasaImp'].'%) $';
@@ -1329,9 +1329,9 @@  discard block
 block discarded – undo
1329 1329
                 'vpadding' => 0,
1330 1330
                 'module_width' => 1, // width of a single module in points
1331 1331
                 'module_height' => 1, // height of a single module in points
1332
-                'fgcolor' => [0,0,0],
1332
+                'fgcolor' => [0, 0, 0],
1333 1333
                 'bgcolor' => false, // [255,255,255]
1334
-                'position' => $position === null ? ($this->papelContinuo ? 'C' : 'S') : $position,
1334
+                'position' => $position===null ? ($this->papelContinuo ? 'C' : 'S') : $position,
1335 1335
             ];
1336 1336
             $ecl = version_compare(phpversion(), '7.0.0', '<') ? -1 : $this->ecl;
1337 1337
             $this->write2DBarcode($timbre, 'PDF417,,'.$ecl, $x_timbre, $y, $w, 0, $style, 'B');
@@ -1362,7 +1362,7 @@  discard block
 block discarded – undo
1362 1362
     protected function agregarAcuseRecibo($x = 83, $y = 190, $w = 60, $h = 40, $line = 25)
1363 1363
     {
1364 1364
         $y = (!$this->papelContinuo and !$this->timbre_pie) ? $this->x_fin_datos : $y;
1365
-        $this->SetTextColorArray([0,0,0]);
1365
+        $this->SetTextColorArray([0, 0, 0]);
1366 1366
         $this->Rect($x, $y, $w, $h, 'D', ['all' => ['width' => 0.1, 'color' => [0, 0, 0]]]);
1367 1367
         $this->setFont('', 'B', 10);
1368 1368
         $this->Texto('Acuse de recibo', $x, $y+1, 'C', $w);
@@ -1392,9 +1392,9 @@  discard block
 block discarded – undo
1392 1392
      */
1393 1393
     protected function agregarAcuseReciboContinuo($x = 3, $y = null, $w = 68, $h = 40)
1394 1394
     {
1395
-        $this->SetTextColorArray([0,0,0]);
1395
+        $this->SetTextColorArray([0, 0, 0]);
1396 1396
         $this->Rect($x, $y, $w, $h, 'D', ['all' => ['width' => 0.1, 'color' => [0, 0, 0]]]);
1397
-        $style = array('width' => 0.2,'color' => array(0, 0, 0));
1397
+        $style = array('width' => 0.2, 'color' => array(0, 0, 0));
1398 1398
         $this->Line($x, $y+22, $w+3, $y+22, $style);
1399 1399
         //$this->setFont('', 'B', 10);
1400 1400
         //$this->Texto('Acuse de recibo', $x, $y+1, 'C', $w);
@@ -1424,7 +1424,7 @@  discard block
 block discarded – undo
1424 1424
         $y = (!$this->papelContinuo and !$this->timbre_pie and $this->x_fin_datos<=$y) ? $this->x_fin_datos : $y;
1425 1425
         $y += 48;
1426 1426
         $this->setFont('', 'B', $font_size);
1427
-        $this->Texto('CEDIBLE'.($tipo==52?' CON SU FACTURA':''), null, $y, 'R');
1427
+        $this->Texto('CEDIBLE'.($tipo==52 ? ' CON SU FACTURA' : ''), null, $y, 'R');
1428 1428
     }
1429 1429
 
1430 1430
     /**
@@ -1435,7 +1435,7 @@  discard block
 block discarded – undo
1435 1435
     protected function agregarLeyendaDestinoContinuo($tipo)
1436 1436
     {
1437 1437
         $this->setFont('', 'B', 8);
1438
-        $this->Texto('CEDIBLE'.($tipo==52?' CON SU FACTURA':''), null, $this->y+6, 'R');
1438
+        $this->Texto('CEDIBLE'.($tipo==52 ? ' CON SU FACTURA' : ''), null, $this->y+6, 'R');
1439 1439
     }
1440 1440
 
1441 1441
 }
Please login to merge, or discard this patch.