Completed
Push — master ( 03c145...62ce4c )
by Esteban De La Fuente
02:18
created
lib/Sii/PDF/Dte.php 3 patches
Doc Comments   +31 added lines, -28 removed lines patch added patch discarded remove patch
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
     /**
188 188
      * Método que asigna la ubicación del logo de la empresa
189 189
      * @param logo URI del logo (puede ser local o en una URL)
190
-     * @param posicion Posición respecto a datos del emisor (=0 izq, =1 arriba)
190
+     * @param posicion integer respecto a datos del emisor (=0 izq, =1 arriba)
191 191
      * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl)
192 192
      * @version 2016-08-04
193 193
      */
@@ -366,7 +366,7 @@  discard block
 block discarded – undo
366 366
      * contínuo
367 367
      * @param dte Arreglo con los datos del XML (tag Documento)
368 368
      * @param timbre String XML con el tag TED del DTE
369
-     * @param width Ancho del papel contínuo en mm
369
+     * @param width boolean del papel contínuo en mm
370 370
      * @author Pablo Reyes (https://github.com/pabloxp)
371 371
      * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl)
372 372
      * @version 2017-10-24
@@ -522,10 +522,11 @@  discard block
 block discarded – undo
522 522
      *  - Dirección casa central del emisor
523 523
      *  - Dirección sucursales
524 524
      * @param emisor Arreglo con los datos del emisor (tag Emisor del XML)
525
-     * @param x Posición horizontal de inicio en el PDF
526
-     * @param y Posición vertical de inicio en el PDF
527
-     * @param w Ancho de la información del emisor
528
-     * @param w_img Ancho máximo de la imagen
525
+     * @param x integer horizontal de inicio en el PDF
526
+     * @param y integer vertical de inicio en el PDF
527
+     * @param w integer de la información del emisor
528
+     * @param w_img integer máximo de la imagen
529
+     * @param integer $font_size
529 530
      * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl)
530 531
      * @version 2018-04-13
531 532
      */
@@ -594,11 +595,13 @@  discard block
 block discarded – undo
594 595
      * @param rut RUT del emisor
595 596
      * @param tipo Código o glosa del tipo de documento
596 597
      * @param sucursal_sii Código o glosa de la sucursal del SII del Emisor
597
-     * @param x Posición horizontal de inicio en el PDF
598
-     * @param y Posición vertical de inicio en el PDF
599
-     * @param w Ancho de la información del emisor
598
+     * @param x integer horizontal de inicio en el PDF
599
+     * @param y integer vertical de inicio en el PDF
600
+     * @param w integer de la información del emisor
601
+     * @param integer $font_size
600 602
      * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl)
601 603
      * @version 2016-12-02
604
+     * @return integer
602 605
      */
603 606
     protected function agregarFolio($rut, $tipo, $folio, $sucursal_sii = null, $x = 130, $y = 15, $w = 70, $font_size = null, array $color = null)
604 607
     {
@@ -645,7 +648,7 @@  discard block
 block discarded – undo
645 648
      * Método que agrega los datos de la emisión del DTE que no son los dato del
646 649
      * receptor
647 650
      * @param IdDoc Información general del documento
648
-     * @param x Posición horizontal de inicio en el PDF
651
+     * @param x integer horizontal de inicio en el PDF
649 652
      * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl)
650 653
      * @version 2017-06-15
651 654
      */
@@ -733,7 +736,7 @@  discard block
 block discarded – undo
733 736
     /**
734 737
      * Método que agrega los datos del receptor
735 738
      * @param receptor Arreglo con los datos del receptor (tag Receptor del XML)
736
-     * @param x Posición horizontal de inicio en el PDF
739
+     * @param x integer horizontal de inicio en el PDF
737 740
      * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl)
738 741
      * @version 2017-06-15
739 742
      */
@@ -820,7 +823,7 @@  discard block
 block discarded – undo
820 823
      * Método que agrega los datos del traslado
821 824
      * @param IndTraslado
822 825
      * @param Transporte
823
-     * @param x Posición horizontal de inicio en el PDF
826
+     * @param x integer horizontal de inicio en el PDF
824 827
      * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl)
825 828
      * @version 2016-08-03
826 829
      */
@@ -891,7 +894,7 @@  discard block
 block discarded – undo
891 894
     /**
892 895
      * Método que agrega las referencias del documento
893 896
      * @param referencias Arreglo con las referencias del documento (tag Referencia del XML)
894
-     * @param x Posición horizontal de inicio en el PDF
897
+     * @param x integer horizontal de inicio en el PDF
895 898
      * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl)
896 899
      * @version 2017-09-25
897 900
      */
@@ -928,7 +931,7 @@  discard block
 block discarded – undo
928 931
     /**
929 932
      * Método que agrega el detalle del documento
930 933
      * @param detalle Arreglo con el detalle del documento (tag Detalle del XML)
931
-     * @param x Posición horizontal de inicio en el PDF
934
+     * @param x integer horizontal de inicio en el PDF
932 935
      * @param y Posición vertical de inicio en el PDF
933 936
      * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl)
934 937
      * @version 2016-08-05
@@ -995,7 +998,7 @@  discard block
 block discarded – undo
995 998
     /**
996 999
      * Método que agrega el detalle del documento
997 1000
      * @param detalle Arreglo con el detalle del documento (tag Detalle del XML)
998
-     * @param x Posición horizontal de inicio en el PDF
1001
+     * @param x integer horizontal de inicio en el PDF
999 1002
      * @param y Posición vertical de inicio en el PDF
1000 1003
      * @author Pablo Reyes (https://github.com/pabloxp)
1001 1004
      * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl)
@@ -1031,7 +1034,7 @@  discard block
 block discarded – undo
1031 1034
      * Método que agrega el subtotal del DTE
1032 1035
      * @param detalle Arreglo con los detalles del documentos para poder
1033 1036
      * calcular subtotal
1034
-     * @param x Posición horizontal de inicio en el PDF
1037
+     * @param x integer horizontal de inicio en el PDF
1035 1038
      * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl)
1036 1039
      * @version 2016-08-17
1037 1040
      */
@@ -1057,7 +1060,7 @@  discard block
 block discarded – undo
1057 1060
     /**
1058 1061
      * Método que agrega los descuentos y/o recargos globales del documento
1059 1062
      * @param descuentosRecargos Arreglo con los descuentos y/o recargos del documento (tag DscRcgGlobal del XML)
1060
-     * @param x Posición horizontal de inicio en el PDF
1063
+     * @param x integer horizontal de inicio en el PDF
1061 1064
      * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl)
1062 1065
      * @version 2016-08-17
1063 1066
      */
@@ -1081,7 +1084,7 @@  discard block
 block discarded – undo
1081 1084
     /**
1082 1085
      * Método que agrega los pagos del documento
1083 1086
      * @param pagos Arreglo con los pagos del documento
1084
-     * @param x Posición horizontal de inicio en el PDF
1087
+     * @param x integer horizontal de inicio en el PDF
1085 1088
      * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl)
1086 1089
      * @version 2016-07-24
1087 1090
      */
@@ -1230,9 +1233,9 @@  discard block
 block discarded – undo
1230 1233
      *  - Se imprime en el tamaño mínimo: 2x5 cms
1231 1234
      *  - En el lado de abajo con margen izquierdo mínimo de 2 cms
1232 1235
      * @param timbre String con los datos del timbre
1233
-     * @param x Posición horizontal de inicio en el PDF
1234
-     * @param y Posición vertical de inicio en el PDF
1235
-     * @param w Ancho del timbre
1236
+     * @param x integer horizontal de inicio en el PDF
1237
+     * @param y integer vertical de inicio en el PDF
1238
+     * @param w integer del timbre
1236 1239
      * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl)
1237 1240
      * @version 2018-04-12
1238 1241
      */
@@ -1270,10 +1273,10 @@  discard block
 block discarded – undo
1270 1273
 
1271 1274
     /**
1272 1275
      * Método que agrega el acuse de rebido
1273
-     * @param x Posición horizontal de inicio en el PDF
1274
-     * @param y Posición vertical de inicio en el PDF
1275
-     * @param w Ancho del acuse de recibo
1276
-     * @param h Alto del acuse de recibo
1276
+     * @param x integer horizontal de inicio en el PDF
1277
+     * @param y integer vertical de inicio en el PDF
1278
+     * @param w integer del acuse de recibo
1279
+     * @param h integer del acuse de recibo
1277 1280
      * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl)
1278 1281
      * @version 2018-04-13
1279 1282
      */
@@ -1301,10 +1304,10 @@  discard block
 block discarded – undo
1301 1304
 
1302 1305
     /**
1303 1306
      * Método que agrega el acuse de rebido
1304
-     * @param x Posición horizontal de inicio en el PDF
1307
+     * @param x integer horizontal de inicio en el PDF
1305 1308
      * @param y Posición vertical de inicio en el PDF
1306
-     * @param w Ancho del acuse de recibo
1307
-     * @param h Alto del acuse de recibo
1309
+     * @param w integer del acuse de recibo
1310
+     * @param h integer del acuse de recibo
1308 1311
      * @author Pablo Reyes (https://github.com/pabloxp)
1309 1312
      * @version 2015-11-17
1310 1313
      */
Please login to merge, or discard this patch.
Spacing   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
     {
182 182
         parent::__construct();
183 183
         $this->SetTitle('Documento Tributario Electrónico (DTE) de Chile by LibreDTE');
184
-        $this->papelContinuo = $papelContinuo === true ? 80 : $papelContinuo;
184
+        $this->papelContinuo = $papelContinuo===true ? 80 : $papelContinuo;
185 185
     }
186 186
 
187 187
     /**
@@ -326,7 +326,7 @@  discard block
 block discarded – undo
326 326
         $this->setY(max($y));
327 327
         $this->Ln();
328 328
         $y = [];
329
-        $y[] = $this->agregarDatosEmision($dte['Encabezado']['IdDoc'], !empty($dte['Encabezado']['Emisor']['CdgVendedor'])?$dte['Encabezado']['Emisor']['CdgVendedor']:null);
329
+        $y[] = $this->agregarDatosEmision($dte['Encabezado']['IdDoc'], !empty($dte['Encabezado']['Emisor']['CdgVendedor']) ? $dte['Encabezado']['Emisor']['CdgVendedor'] : null);
330 330
         $y[] = $this->agregarReceptor($dte['Encabezado']);
331 331
         $this->setY(max($y));
332 332
         $this->agregarTraslado(
@@ -386,15 +386,15 @@  discard block
 block discarded – undo
386 386
             $dte['Encabezado']['IdDoc']['TipoDTE'],
387 387
             $dte['Encabezado']['IdDoc']['Folio'],
388 388
             $dte['Encabezado']['Emisor']['CmnaOrigen'],
389
-            $x_start, $y_start, $width-($x_start*4), 10,
390
-            [0,0,0]
389
+            $x_start, $y_start, $width-($x_start * 4), 10,
390
+            [0, 0, 0]
391 391
         );
392
-        $y = $this->agregarEmisor($dte['Encabezado']['Emisor'], $x_start, $y+2, $width-($x_start*4), 8, 9, [0,0,0]);
392
+        $y = $this->agregarEmisor($dte['Encabezado']['Emisor'], $x_start, $y+2, $width-($x_start * 4), 8, 9, [0, 0, 0]);
393 393
         // datos del documento
394 394
         $this->SetY($y);
395 395
         $this->Ln();
396 396
         $this->setFont('', '', 8);
397
-        $this->agregarDatosEmision($dte['Encabezado']['IdDoc'], !empty($dte['Encabezado']['Emisor']['CdgVendedor'])?$dte['Encabezado']['Emisor']['CdgVendedor']:null, $x_start, $offset, false);
397
+        $this->agregarDatosEmision($dte['Encabezado']['IdDoc'], !empty($dte['Encabezado']['Emisor']['CdgVendedor']) ? $dte['Encabezado']['Emisor']['CdgVendedor'] : null, $x_start, $offset, false);
398 398
         $this->agregarReceptor($dte['Encabezado'], $x_start, $offset);
399 399
         $this->agregarTraslado(
400 400
             !empty($dte['Encabezado']['IdDoc']['IndTraslado']) ? $dte['Encabezado']['IdDoc']['IndTraslado'] : null,
@@ -447,7 +447,7 @@  discard block
 block discarded – undo
447 447
         $this->AddPage('P', [$height ? $height : $this->papel_continuo_alto, $width]);
448 448
         $x = 1;
449 449
         $y = 5;
450
-        $this->SetXY($x,$y);
450
+        $this->SetXY($x, $y);
451 451
         // agregar datos del documento
452 452
         $this->setFont('', '', 8);
453 453
         $this->MultiTexto(!empty($dte['Encabezado']['Emisor']['RznSoc']) ? $dte['Encabezado']['Emisor']['RznSoc'] : $dte['Encabezado']['Emisor']['RznSocEmisor'], $x, null, '', $width-2);
@@ -537,11 +537,11 @@  discard block
 block discarded – undo
537 537
                 $this->logo['uri'],
538 538
                 $x,
539 539
                 $y,
540
-                !$this->logo['posicion']?$w_img:null, $this->logo['posicion']?($w_img/2):null,
540
+                !$this->logo['posicion'] ? $w_img : null, $this->logo['posicion'] ? ($w_img / 2) : null,
541 541
                 'PNG'
542 542
             );
543 543
             if ($this->logo['posicion']) {
544
-                $this->SetY($this->y + ($w_img/2));
544
+                $this->SetY($this->y+($w_img / 2));
545 545
                 $w += 40;
546 546
             } else {
547 547
                 $x = $this->x+3;
@@ -552,14 +552,14 @@  discard block
 block discarded – undo
552 552
         }
553 553
         // agregar datos del emisor
554 554
         $this->setFont('', 'B', $font_size ? $font_size : 14);
555
-        $this->SetTextColorArray($color===null?[32, 92, 144]:$color);
555
+        $this->SetTextColorArray($color===null ? [32, 92, 144] : $color);
556 556
         $this->MultiTexto(!empty($emisor['RznSoc']) ? $emisor['RznSoc'] : $emisor['RznSocEmisor'], $x, $this->y+2, 'L', $w);
557 557
         $this->setFont('', 'B', $font_size ? $font_size : 9);
558
-        $this->SetTextColorArray([0,0,0]);
558
+        $this->SetTextColorArray([0, 0, 0]);
559 559
         $this->MultiTexto(!empty($emisor['GiroEmis']) ? $emisor['GiroEmis'] : $emisor['GiroEmisor'], $x, $this->y, 'L', $w);
560 560
         $comuna = !empty($emisor['CmnaOrigen']) ? $emisor['CmnaOrigen'] : null;
561 561
         $ciudad = !empty($emisor['CiudadOrigen']) ? $emisor['CiudadOrigen'] : \sasco\LibreDTE\Chile::getCiudad($comuna);
562
-        $this->MultiTexto($emisor['DirOrigen'].($comuna?(', '.$comuna):'').($ciudad?(', '.$ciudad):''), $x, $this->y, 'L', $w);
562
+        $this->MultiTexto($emisor['DirOrigen'].($comuna ? (', '.$comuna) : '').($ciudad ? (', '.$ciudad) : ''), $x, $this->y, 'L', $w);
563 563
         if (!empty($emisor['Sucursal'])) {
564 564
             $this->MultiTexto('Sucursal: '.$emisor['Sucursal'], $x, $this->y, 'L', $w);
565 565
         }
@@ -603,12 +603,12 @@  discard block
 block discarded – undo
603 603
     protected function agregarFolio($rut, $tipo, $folio, $sucursal_sii = null, $x = 130, $y = 15, $w = 70, $font_size = null, array $color = null)
604 604
     {
605 605
         if ($color===null) {
606
-            $color = $tipo ? ($tipo==52 ? [0,172,140] : [255,0,0]) : [0,0,0];
606
+            $color = $tipo ? ($tipo==52 ? [0, 172, 140] : [255, 0, 0]) : [0, 0, 0];
607 607
         }
608 608
         $this->SetTextColorArray($color);
609 609
         // colocar rut emisor, glosa documento y folio
610 610
         list($rut, $dv) = explode('-', $rut);
611
-        $this->setFont ('', 'B', $font_size ? $font_size : 15);
611
+        $this->setFont('', 'B', $font_size ? $font_size : 15);
612 612
         $this->MultiTexto('R.U.T.: '.$this->num($rut).'-'.$dv, $x, $y+4, 'C', $w);
613 613
         $this->setFont('', 'B', $font_size ? $font_size : 12);
614 614
         $this->MultiTexto($this->getTipo($tipo), $x, null, 'C', $w);
@@ -621,7 +621,7 @@  discard block
 block discarded – undo
621 621
         if ($tipo) {
622 622
             $this->Texto('S.I.I. - '.\sasco\LibreDTE\Sii::getDireccionRegional($sucursal_sii), $x, $this->getY()+4, 'C', $w);
623 623
         }
624
-        $this->SetTextColorArray([0,0,0]);
624
+        $this->SetTextColorArray([0, 0, 0]);
625 625
         $this->Ln();
626 626
         return $this->y;
627 627
     }
@@ -753,7 +753,7 @@  discard block
 block discarded – undo
753 753
             $this->Texto('Señor(es)', $x);
754 754
             $this->Texto(':', $x+$offset);
755 755
             $this->setFont('', '', null);
756
-            $this->MultiTexto($receptor['RznSocRecep'], $x+$offset+2, null, '', $x==10?105:0);
756
+            $this->MultiTexto($receptor['RznSocRecep'], $x+$offset+2, null, '', $x==10 ? 105 : 0);
757 757
         }
758 758
         if (!empty($receptor['GiroRecep'])) {
759 759
             $this->setFont('', 'B', null);
@@ -770,7 +770,7 @@  discard block
 block discarded – undo
770 770
             $ciudad = !empty($receptor['CiudadRecep']) ? $receptor['CiudadRecep'] : (
771 771
                 !empty($receptor['CmnaRecep']) ? \sasco\LibreDTE\Chile::getCiudad($receptor['CmnaRecep']) : ''
772 772
             );
773
-            $this->MultiTexto($receptor['DirRecep'].(!empty($receptor['CmnaRecep'])?(', '.$receptor['CmnaRecep']):'').($ciudad?(', '.$ciudad):''), $x+$offset+2);
773
+            $this->MultiTexto($receptor['DirRecep'].(!empty($receptor['CmnaRecep']) ? (', '.$receptor['CmnaRecep']) : '').($ciudad ? (', '.$ciudad) : ''), $x+$offset+2);
774 774
         }
775 775
         if (!empty($receptor['Extranjero']['Nacionalidad'])) {
776 776
             $this->setFont('', 'B', null);
@@ -811,7 +811,7 @@  discard block
 block discarded – undo
811 811
             $this->Texto('Cód. recep.', $x);
812 812
             $this->Texto(':', $x+$offset);
813 813
             $this->setFont('', '', null);
814
-            $this->MultiTexto($receptor['CdgIntRecep'], $x+$offset+2, null, '', $x==10?105:0);
814
+            $this->MultiTexto($receptor['CdgIntRecep'], $x+$offset+2, null, '', $x==10 ? 105 : 0);
815 815
         }
816 816
         return $this->GetY();
817 817
     }
@@ -899,7 +899,7 @@  discard block
 block discarded – undo
899 899
     {
900 900
         if (!isset($referencias[0]))
901 901
             $referencias = [$referencias];
902
-        foreach($referencias as $r) {
902
+        foreach ($referencias as $r) {
903 903
             $texto = $r['NroLinRef'].' - ';
904 904
             if (!empty($r['TpoDocRef'])) {
905 905
                 $texto .= $this->getTipo($r['TpoDocRef']).' ';
@@ -1006,9 +1006,9 @@  discard block
 block discarded – undo
1006 1006
         $this->SetY($this->getY()+1);
1007 1007
         $p1x = $x;
1008 1008
         $p1y = $this->y;
1009
-        $p2x = $this->getPageWidth() - 2;
1010
-        $p2y = $p1y;  // Use same y for a straight line
1011
-        $style = array('width' => 0.2,'color' => array(0, 0, 0));
1009
+        $p2x = $this->getPageWidth()-2;
1010
+        $p2y = $p1y; // Use same y for a straight line
1011
+        $style = array('width' => 0.2, 'color' => array(0, 0, 0));
1012 1012
         $this->Line($p1x, $p1y, $p2x, $p2y, $style);
1013 1013
         $this->Texto($this->detalle_cols['NmbItem']['title'], $x+1, $this->y, ucfirst($this->detalle_cols['NmbItem']['align'][0]), $this->detalle_cols['NmbItem']['width']);
1014 1014
         $this->Texto($this->detalle_cols['PrcItem']['title'], $x+15, $this->y, ucfirst($this->detalle_cols['PrcItem']['align'][0]), $this->detalle_cols['PrcItem']['width']);
@@ -1018,9 +1018,9 @@  discard block
 block discarded – undo
1018 1018
         if (!isset($detalle[0]))
1019 1019
             $detalle = [$detalle];
1020 1020
         $this->SetY($this->getY()+2);
1021
-        foreach($detalle as  &$d) {
1021
+        foreach ($detalle as  &$d) {
1022 1022
             $this->MultiTexto($d['NmbItem'], $x+1, $this->y+4, ucfirst($this->detalle_cols['NmbItem']['align'][0]), $this->detalle_cols['NmbItem']['width']);
1023
-            $this->Texto(number_format($d['PrcItem'],0,',','.'), $x+15, $this->y, ucfirst($this->detalle_cols['PrcItem']['align'][0]), $this->detalle_cols['PrcItem']['width']);
1023
+            $this->Texto(number_format($d['PrcItem'], 0, ',', '.'), $x+15, $this->y, ucfirst($this->detalle_cols['PrcItem']['align'][0]), $this->detalle_cols['PrcItem']['width']);
1024 1024
             $this->Texto($this->num($d['QtyItem']), $x+35, $this->y, ucfirst($this->detalle_cols['QtyItem']['align'][0]), $this->detalle_cols['QtyItem']['width']);
1025 1025
             $this->Texto($this->num($d['MontoItem']), $x+45, $this->y, ucfirst($this->detalle_cols['MontoItem']['align'][0]), $this->detalle_cols['MontoItem']['width']);
1026 1026
         }
@@ -1040,7 +1040,7 @@  discard block
 block discarded – undo
1040 1040
         if (!isset($detalle[0])) {
1041 1041
             $detalle = [$detalle];
1042 1042
         }
1043
-        foreach($detalle as  &$d) {
1043
+        foreach ($detalle as  &$d) {
1044 1044
             if (!empty($d['MontoItem'])) {
1045 1045
                 $subtotal += $d['MontoItem'];
1046 1046
             }
@@ -1065,13 +1065,13 @@  discard block
 block discarded – undo
1065 1065
     {
1066 1066
         if (!isset($descuentosRecargos[0]))
1067 1067
             $descuentosRecargos = [$descuentosRecargos];
1068
-        foreach($descuentosRecargos as $dr) {
1068
+        foreach ($descuentosRecargos as $dr) {
1069 1069
             $tipo = $dr['TpoMov']=='D' ? 'Descuento' : 'Recargo';
1070 1070
             $valor = $dr['TpoValor']=='%' ? $dr['ValorDR'].'%' : $this->num($dr['ValorDR']);
1071 1071
             if ($this->papelContinuo) {
1072
-                $this->Texto($tipo.' global: '.$valor.(!empty($dr['GlosaDR'])?(' ('.$dr['GlosaDR'].')'):''), $x);
1072
+                $this->Texto($tipo.' global: '.$valor.(!empty($dr['GlosaDR']) ? (' ('.$dr['GlosaDR'].')') : ''), $x);
1073 1073
             } else {
1074
-                $this->Texto($tipo.(!empty($dr['GlosaDR'])?(' ('.$dr['GlosaDR'].')'):'').':', 77, null, 'R', 100);
1074
+                $this->Texto($tipo.(!empty($dr['GlosaDR']) ? (' ('.$dr['GlosaDR'].')') : '').':', 77, null, 'R', 100);
1075 1075
                 $this->Texto($valor, 177, null, 'R', 22);
1076 1076
             }
1077 1077
             $this->Ln();
@@ -1091,8 +1091,8 @@  discard block
 block discarded – undo
1091 1091
             $pagos = [$pagos];
1092 1092
         $this->Texto('Pago(s) programado(s):', $x);
1093 1093
         $this->Ln();
1094
-        foreach($pagos as $p) {
1095
-            $this->Texto('  - '.$this->date($p['FchPago'], false).': $'.$this->num($p['MntPago']).'.-'.(!empty($p['GlosaPagos'])?(' ('.$p['GlosaPagos'].')'):''), $x);
1094
+        foreach ($pagos as $p) {
1095
+            $this->Texto('  - '.$this->date($p['FchPago'], false).': $'.$this->num($p['MntPago']).'.-'.(!empty($p['GlosaPagos']) ? (' ('.$p['GlosaPagos'].')') : ''), $x);
1096 1096
             $this->Ln();
1097 1097
         }
1098 1098
     }
@@ -1143,7 +1143,7 @@  discard block
 block discarded – undo
1143 1143
             if (!isset($ImptoReten[0])) {
1144 1144
                 $ImptoReten = [$ImptoReten];
1145 1145
             }
1146
-            foreach($ImptoReten as $i) {
1146
+            foreach ($ImptoReten as $i) {
1147 1147
                 $totales['ImptoReten_'.$i['TipoImp']] = $i['MontoImp'];
1148 1148
                 if (!empty($i['TasaImp'])) {
1149 1149
                     $glosas['ImptoReten_'.$i['TipoImp']] = \sasco\LibreDTE\Sii\ImpuestosAdicionales::getGlosa($i['TipoImp']).' ('.$i['TasaImp'].'%) $';
@@ -1247,7 +1247,7 @@  discard block
 block discarded – undo
1247 1247
                 'vpadding' => 0,
1248 1248
                 'module_width' => 1, // width of a single module in points
1249 1249
                 'module_height' => 1, // height of a single module in points
1250
-                'fgcolor' => [0,0,0],
1250
+                'fgcolor' => [0, 0, 0],
1251 1251
                 'bgcolor' => false, // [255,255,255]
1252 1252
                 'position' => $this->papelContinuo ? 'C' : 'S',
1253 1253
             ];
@@ -1280,7 +1280,7 @@  discard block
 block discarded – undo
1280 1280
     protected function agregarAcuseRecibo($x = 83, $y = 190, $w = 60, $h = 40)
1281 1281
     {
1282 1282
         $y = (!$this->papelContinuo and !$this->timbre_pie) ? $this->x_fin_datos : $y;
1283
-        $this->SetTextColorArray([0,0,0]);
1283
+        $this->SetTextColorArray([0, 0, 0]);
1284 1284
         $this->Rect($x, $y, $w, $h, 'D', ['all' => ['width' => 0.1, 'color' => [0, 0, 0]]]);
1285 1285
         $this->setFont('', 'B', 10);
1286 1286
         $this->Texto('Acuse de recibo', $x, $y+1, 'C', $w);
@@ -1310,9 +1310,9 @@  discard block
 block discarded – undo
1310 1310
      */
1311 1311
     protected function agregarAcuseReciboContinuo($x = 3, $y = null, $w = 68, $h = 40)
1312 1312
     {
1313
-        $this->SetTextColorArray([0,0,0]);
1313
+        $this->SetTextColorArray([0, 0, 0]);
1314 1314
         $this->Rect($x, $y, $w, $h, 'D', ['all' => ['width' => 0.1, 'color' => [0, 0, 0]]]);
1315
-        $style = array('width' => 0.2,'color' => array(0, 0, 0));
1315
+        $style = array('width' => 0.2, 'color' => array(0, 0, 0));
1316 1316
         $this->Line($x, $y+22, $w+3, $y+22, $style);
1317 1317
         //$this->setFont('', 'B', 10);
1318 1318
         //$this->Texto('Acuse de recibo', $x, $y+1, 'C', $w);
@@ -1342,7 +1342,7 @@  discard block
 block discarded – undo
1342 1342
         $y = (!$this->papelContinuo and !$this->timbre_pie) ? $this->x_fin_datos : $y;
1343 1343
         $y += 64;
1344 1344
         $this->setFont('', 'B', $font_size);
1345
-        $this->Texto('CEDIBLE'.($tipo==52?' CON SU FACTURA':''), null, $y, 'R');
1345
+        $this->Texto('CEDIBLE'.($tipo==52 ? ' CON SU FACTURA' : ''), null, $y, 'R');
1346 1346
     }
1347 1347
 
1348 1348
     /**
@@ -1353,7 +1353,7 @@  discard block
 block discarded – undo
1353 1353
     protected function agregarLeyendaDestinoContinuo($tipo)
1354 1354
     {
1355 1355
         $this->setFont('', 'B', 8);
1356
-        $this->Texto('CEDIBLE'.($tipo==52?' CON SU FACTURA':''), null, $this->y+6, 'R');
1356
+        $this->Texto('CEDIBLE'.($tipo==52 ? ' CON SU FACTURA' : ''), null, $this->y+6, 'R');
1357 1357
     }
1358 1358
 
1359 1359
     /**
@@ -1384,7 +1384,7 @@  discard block
 block discarded – undo
1384 1384
         $dias = ['Domingo', 'Lunes', 'Martes', 'Miércoles', 'Jueves', 'Viernes', 'Sábado'];
1385 1385
         $meses = ['enero', 'febrero', 'marzo', 'abril', 'mayo', 'junio', 'julio', 'agosto', 'septiembre', 'octubre', 'noviembre', 'diciembre'];
1386 1386
         $unixtime = strtotime($date);
1387
-        $fecha = date(($mostrar_dia?'\D\I\A ':'').'j \d\e \M\E\S \d\e\l Y', $unixtime);
1387
+        $fecha = date(($mostrar_dia ? '\D\I\A ' : '').'j \d\e \M\E\S \d\e\l Y', $unixtime);
1388 1388
         $dia = $dias[date('w', $unixtime)];
1389 1389
         $mes = $meses[date('n', $unixtime)-1];
1390 1390
         return str_replace(array('DIA', 'MES'), array($dia, $mes), $fecha);
Please login to merge, or discard this patch.
Braces   +77 added lines, -52 removed lines patch added patch discarded remove patch
@@ -565,10 +565,12 @@  discard block
 block discarded – undo
565 565
         }
566 566
         $contacto = [];
567 567
         if (!empty($emisor['Telefono'])) {
568
-            if (!is_array($emisor['Telefono']))
569
-                $emisor['Telefono'] = [$emisor['Telefono']];
570
-            foreach ($emisor['Telefono'] as $t)
571
-                $contacto[] = $t;
568
+            if (!is_array($emisor['Telefono'])) {
569
+                            $emisor['Telefono'] = [$emisor['Telefono']];
570
+            }
571
+            foreach ($emisor['Telefono'] as $t) {
572
+                            $contacto[] = $t;
573
+            }
572 574
         }
573 575
         if (!empty($emisor['CorreoEmisor'])) {
574 576
             $contacto[] = $emisor['CorreoEmisor'];
@@ -787,10 +789,12 @@  discard block
 block discarded – undo
787 789
             $this->MultiTexto($receptor['Extranjero']['NumId'], $x+$offset+2);
788 790
         }
789 791
         $contacto = [];
790
-        if (!empty($receptor['Contacto']))
791
-            $contacto[] = $receptor['Contacto'];
792
-        if (!empty($receptor['CorreoRecep']))
793
-            $contacto[] = $receptor['CorreoRecep'];
792
+        if (!empty($receptor['Contacto'])) {
793
+                    $contacto[] = $receptor['Contacto'];
794
+        }
795
+        if (!empty($receptor['CorreoRecep'])) {
796
+                    $contacto[] = $receptor['CorreoRecep'];
797
+        }
794 798
         if (!empty($contacto)) {
795 799
             $this->setFont('', 'B', null);
796 800
             $this->Texto('Contacto', $x);
@@ -840,15 +844,19 @@  discard block
 block discarded – undo
840 844
             if (!empty($Transporte['DirDest']) and !empty($Transporte['CmnaDest'])) {
841 845
                 $transporte .= 'a '.$Transporte['DirDest'].', '.$Transporte['CmnaDest'];
842 846
             }
843
-            if (!empty($Transporte['RUTTrans']))
844
-                $transporte .= ' por '.$Transporte['RUTTrans'];
845
-            if (!empty($Transporte['Patente']))
846
-                $transporte .= ' en vehículo '.$Transporte['Patente'];
847
+            if (!empty($Transporte['RUTTrans'])) {
848
+                            $transporte .= ' por '.$Transporte['RUTTrans'];
849
+            }
850
+            if (!empty($Transporte['Patente'])) {
851
+                            $transporte .= ' en vehículo '.$Transporte['Patente'];
852
+            }
847 853
             if (isset($Transporte['Chofer']) and is_array($Transporte['Chofer'])) {
848
-                if (!empty($Transporte['Chofer']['NombreChofer']))
849
-                    $transporte .= ' con chofer '.$Transporte['Chofer']['NombreChofer'];
850
-                if (!empty($Transporte['Chofer']['RUTChofer']))
851
-                    $transporte .= ' ('.$Transporte['Chofer']['RUTChofer'].')';
854
+                if (!empty($Transporte['Chofer']['NombreChofer'])) {
855
+                                    $transporte .= ' con chofer '.$Transporte['Chofer']['NombreChofer'];
856
+                }
857
+                if (!empty($Transporte['Chofer']['RUTChofer'])) {
858
+                                    $transporte .= ' ('.$Transporte['Chofer']['RUTChofer'].')';
859
+                }
852 860
             }
853 861
             if ($transporte) {
854 862
                 $this->setFont('', 'B', null);
@@ -862,8 +870,9 @@  discard block
 block discarded – undo
862 870
         if (!empty($Transporte['Aduana']) and is_array($Transporte['Aduana'])) {
863 871
             $col = 0;
864 872
             foreach ($Transporte['Aduana'] as $tag => $codigo) {
865
-                if ($codigo===false)
866
-                    continue;
873
+                if ($codigo===false) {
874
+                                    continue;
875
+                }
867 876
                 $glosa = \sasco\LibreDTE\Sii\Aduana::getGlosa($tag);
868 877
                 $valor = \sasco\LibreDTE\Sii\Aduana::getValor($tag, $codigo);
869 878
                 if ($glosa!==false and $valor!==false) {
@@ -876,15 +885,18 @@  discard block
 block discarded – undo
876 885
                     $this->Texto(':', $x+$offset+$col);
877 886
                     $this->setFont('', '', null);
878 887
                     $this->Texto($valor, $x+$offset+2+$col);
879
-                    if ($tag=='TipoBultos')
880
-                        $col = abs($col-110);
881
-                    if ($col)
882
-                        $this->Ln();
888
+                    if ($tag=='TipoBultos') {
889
+                                            $col = abs($col-110);
890
+                    }
891
+                    if ($col) {
892
+                                            $this->Ln();
893
+                    }
883 894
                     $col = abs($col-110);
884 895
                 }
885 896
             }
886
-            if ($col)
887
-                $this->Ln();
897
+            if ($col) {
898
+                            $this->Ln();
899
+            }
888 900
         }
889 901
     }
890 902
 
@@ -897,8 +909,9 @@  discard block
 block discarded – undo
897 909
      */
898 910
     protected function agregarReferencia($referencias, $x = 10, $offset = 22)
899 911
     {
900
-        if (!isset($referencias[0]))
901
-            $referencias = [$referencias];
912
+        if (!isset($referencias[0])) {
913
+                    $referencias = [$referencias];
914
+        }
902 915
         foreach($referencias as $r) {
903 916
             $texto = $r['NroLinRef'].' - ';
904 917
             if (!empty($r['TpoDocRef'])) {
@@ -935,8 +948,9 @@  discard block
 block discarded – undo
935 948
      */
936 949
     protected function agregarDetalle($detalle, $x = 10)
937 950
     {
938
-        if (!isset($detalle[0]))
939
-            $detalle = [$detalle];
951
+        if (!isset($detalle[0])) {
952
+                    $detalle = [$detalle];
953
+        }
940 954
         $this->setFont('', '', $this->detalle_fuente);
941 955
         // titulos
942 956
         $titulos = [];
@@ -953,36 +967,42 @@  discard block
 block discarded – undo
953 967
                     $item['NmbItem'] .= !$this->item_detalle_posicion ? '<br/>' : ': ';
954 968
                     $item['NmbItem'] .= '<span style="font-size:0.7em">'.$item['DscItem'].'</span>';
955 969
                 }
956
-                if (!in_array($col, $titulos_keys) or ($dte_exento and $col=='IndExe'))
957
-                    unset($item[$col]);
970
+                if (!in_array($col, $titulos_keys) or ($dte_exento and $col=='IndExe')) {
971
+                                    unset($item[$col]);
972
+                }
958 973
             }
959 974
             // ajustes a IndExe
960 975
             if (isset($item['IndExe'])) {
961
-                if ($item['IndExe']==1)
962
-                    $item['IndExe'] = 'EX';
963
-                else if ($item['IndExe']==2)
964
-                    $item['IndExe'] = 'NF';
976
+                if ($item['IndExe']==1) {
977
+                                    $item['IndExe'] = 'EX';
978
+                } else if ($item['IndExe']==2) {
979
+                                    $item['IndExe'] = 'NF';
980
+                }
965 981
             }
966 982
             // agregar todas las columnas que se podrían imprimir en la tabla
967 983
             $item_default = [];
968
-            foreach ($this->detalle_cols as $key => $info)
969
-                $item_default[$key] = false;
984
+            foreach ($this->detalle_cols as $key => $info) {
985
+                            $item_default[$key] = false;
986
+            }
970 987
             $item = array_merge($item_default, $item);
971 988
             // si hay código de item se extrae su valor
972
-            if ($item['CdgItem'])
973
-                $item['CdgItem'] = $item['CdgItem']['VlrCodigo'];
989
+            if ($item['CdgItem']) {
990
+                            $item['CdgItem'] = $item['CdgItem']['VlrCodigo'];
991
+            }
974 992
             // dar formato a números
975 993
             foreach (['QtyItem', 'PrcItem', 'DescuentoMonto', 'RecargoMonto', 'MontoItem'] as $col) {
976
-                if ($item[$col])
977
-                    $item[$col] = $this->num($item[$col]);
994
+                if ($item[$col]) {
995
+                                    $item[$col] = $this->num($item[$col]);
996
+                }
978 997
             }
979 998
         }
980 999
         // opciones
981 1000
         $options = ['align'=>[]];
982 1001
         $i = 0;
983 1002
         foreach ($this->detalle_cols as $info) {
984
-            if (isset($info['width']))
985
-                $options['width'][$i] = $info['width'];
1003
+            if (isset($info['width'])) {
1004
+                            $options['width'][$i] = $info['width'];
1005
+            }
986 1006
             $options['align'][$i] = $info['align'];
987 1007
             $i++;
988 1008
         }
@@ -1015,8 +1035,9 @@  discard block
 block discarded – undo
1015 1035
         $this->Texto($this->detalle_cols['QtyItem']['title'], $x+35, $this->y, ucfirst($this->detalle_cols['QtyItem']['align'][0]), $this->detalle_cols['QtyItem']['width']);
1016 1036
         $this->Texto($this->detalle_cols['MontoItem']['title'], $x+45, $this->y, ucfirst($this->detalle_cols['MontoItem']['align'][0]), $this->detalle_cols['MontoItem']['width']);
1017 1037
         $this->Line($p1x, $p1y+4, $p2x, $p2y+4, $style);
1018
-        if (!isset($detalle[0]))
1019
-            $detalle = [$detalle];
1038
+        if (!isset($detalle[0])) {
1039
+                    $detalle = [$detalle];
1040
+        }
1020 1041
         $this->SetY($this->getY()+2);
1021 1042
         foreach($detalle as  &$d) {
1022 1043
             $this->MultiTexto($d['NmbItem'], $x+1, $this->y+4, ucfirst($this->detalle_cols['NmbItem']['align'][0]), $this->detalle_cols['NmbItem']['width']);
@@ -1063,8 +1084,9 @@  discard block
 block discarded – undo
1063 1084
      */
1064 1085
     protected function agregarDescuentosRecargos(array $descuentosRecargos, $x = 10)
1065 1086
     {
1066
-        if (!isset($descuentosRecargos[0]))
1067
-            $descuentosRecargos = [$descuentosRecargos];
1087
+        if (!isset($descuentosRecargos[0])) {
1088
+                    $descuentosRecargos = [$descuentosRecargos];
1089
+        }
1068 1090
         foreach($descuentosRecargos as $dr) {
1069 1091
             $tipo = $dr['TpoMov']=='D' ? 'Descuento' : 'Recargo';
1070 1092
             $valor = $dr['TpoValor']=='%' ? $dr['ValorDR'].'%' : $this->num($dr['ValorDR']);
@@ -1087,8 +1109,9 @@  discard block
 block discarded – undo
1087 1109
      */
1088 1110
     protected function agregarPagos(array $pagos, $x = 10)
1089 1111
     {
1090
-        if (!isset($pagos[0]))
1091
-            $pagos = [$pagos];
1112
+        if (!isset($pagos[0])) {
1113
+                    $pagos = [$pagos];
1114
+        }
1092 1115
         $this->Texto('Pago(s) programado(s):', $x);
1093 1116
         $this->Ln();
1094 1117
         foreach($pagos as $p) {
@@ -1366,11 +1389,13 @@  discard block
 block discarded – undo
1366 1389
      */
1367 1390
     protected function num($n)
1368 1391
     {
1369
-        if (!is_numeric($n))
1370
-            return $n;
1392
+        if (!is_numeric($n)) {
1393
+                    return $n;
1394
+        }
1371 1395
         $broken_number = explode('.', (string)$n);
1372
-        if (isset($broken_number[1]))
1373
-            return number_format($broken_number[0], 0, ',', '.').','.$broken_number[1];
1396
+        if (isset($broken_number[1])) {
1397
+                    return number_format($broken_number[0], 0, ',', '.').','.$broken_number[1];
1398
+        }
1374 1399
         return number_format($broken_number[0], 0, ',', '.');
1375 1400
     }
1376 1401
 
Please login to merge, or discard this patch.