Completed
Push — master ( 4dae1d...9bdb13 )
by Esteban De La Fuente
02:27
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
      */
@@ -596,11 +597,13 @@  discard block
 block discarded – undo
596 597
      * @param rut RUT del emisor
597 598
      * @param tipo Código o glosa del tipo de documento
598 599
      * @param sucursal_sii Código o glosa de la sucursal del SII del Emisor
599
-     * @param x Posición horizontal de inicio en el PDF
600
-     * @param y Posición vertical de inicio en el PDF
601
-     * @param w Ancho de la información del emisor
600
+     * @param x integer horizontal de inicio en el PDF
601
+     * @param y integer vertical de inicio en el PDF
602
+     * @param w integer de la información del emisor
603
+     * @param integer $font_size
602 604
      * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl)
603 605
      * @version 2016-12-02
606
+     * @return integer
604 607
      */
605 608
     protected function agregarFolio($rut, $tipo, $folio, $sucursal_sii = null, $x = 130, $y = 15, $w = 70, $font_size = null, array $color = null)
606 609
     {
@@ -647,7 +650,7 @@  discard block
 block discarded – undo
647 650
      * Método que agrega los datos de la emisión del DTE que no son los dato del
648 651
      * receptor
649 652
      * @param IdDoc Información general del documento
650
-     * @param x Posición horizontal de inicio en el PDF
653
+     * @param x integer horizontal de inicio en el PDF
651 654
      * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl)
652 655
      * @version 2017-06-15
653 656
      */
@@ -735,7 +738,7 @@  discard block
 block discarded – undo
735 738
     /**
736 739
      * Método que agrega los datos del receptor
737 740
      * @param receptor Arreglo con los datos del receptor (tag Receptor del XML)
738
-     * @param x Posición horizontal de inicio en el PDF
741
+     * @param x integer horizontal de inicio en el PDF
739 742
      * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl)
740 743
      * @version 2017-06-15
741 744
      */
@@ -822,7 +825,7 @@  discard block
 block discarded – undo
822 825
      * Método que agrega los datos del traslado
823 826
      * @param IndTraslado
824 827
      * @param Transporte
825
-     * @param x Posición horizontal de inicio en el PDF
828
+     * @param x integer horizontal de inicio en el PDF
826 829
      * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl)
827 830
      * @version 2016-08-03
828 831
      */
@@ -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 2016-08-05
@@ -997,7 +1000,7 @@  discard block
 block discarded – undo
997 1000
     /**
998 1001
      * Método que agrega el detalle del documento
999 1002
      * @param detalle Arreglo con el detalle del documento (tag Detalle del XML)
1000
-     * @param x Posición horizontal de inicio en el PDF
1003
+     * @param x integer horizontal de inicio en el PDF
1001 1004
      * @param y Posición vertical de inicio en el PDF
1002 1005
      * @author Pablo Reyes (https://github.com/pabloxp)
1003 1006
      * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl)
@@ -1033,7 +1036,7 @@  discard block
 block discarded – undo
1033 1036
      * Método que agrega el subtotal del DTE
1034 1037
      * @param detalle Arreglo con los detalles del documentos para poder
1035 1038
      * calcular subtotal
1036
-     * @param x Posición horizontal de inicio en el PDF
1039
+     * @param x integer horizontal de inicio en el PDF
1037 1040
      * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl)
1038 1041
      * @version 2016-08-17
1039 1042
      */
@@ -1059,7 +1062,7 @@  discard block
 block discarded – undo
1059 1062
     /**
1060 1063
      * Método que agrega los descuentos y/o recargos globales del documento
1061 1064
      * @param descuentosRecargos Arreglo con los descuentos y/o recargos del documento (tag DscRcgGlobal del XML)
1062
-     * @param x Posición horizontal de inicio en el PDF
1065
+     * @param x integer horizontal de inicio en el PDF
1063 1066
      * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl)
1064 1067
      * @version 2018-04-15
1065 1068
      */
@@ -1086,7 +1089,7 @@  discard block
 block discarded – undo
1086 1089
     /**
1087 1090
      * Método que agrega los pagos del documento
1088 1091
      * @param pagos Arreglo con los pagos del documento
1089
-     * @param x Posición horizontal de inicio en el PDF
1092
+     * @param x integer horizontal de inicio en el PDF
1090 1093
      * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl)
1091 1094
      * @version 2016-07-24
1092 1095
      */
@@ -1235,9 +1238,9 @@  discard block
 block discarded – undo
1235 1238
      *  - Se imprime en el tamaño mínimo: 2x5 cms
1236 1239
      *  - En el lado de abajo con margen izquierdo mínimo de 2 cms
1237 1240
      * @param timbre String con los datos del timbre
1238
-     * @param x Posición horizontal de inicio en el PDF
1239
-     * @param y Posición vertical de inicio en el PDF
1240
-     * @param w Ancho del timbre
1241
+     * @param x integer horizontal de inicio en el PDF
1242
+     * @param y integer vertical de inicio en el PDF
1243
+     * @param w integer del timbre
1241 1244
      * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl)
1242 1245
      * @version 2018-04-12
1243 1246
      */
@@ -1275,10 +1278,10 @@  discard block
 block discarded – undo
1275 1278
 
1276 1279
     /**
1277 1280
      * Método que agrega el acuse de rebido
1278
-     * @param x Posición horizontal de inicio en el PDF
1279
-     * @param y Posición vertical de inicio en el PDF
1280
-     * @param w Ancho del acuse de recibo
1281
-     * @param h Alto del acuse de recibo
1281
+     * @param x integer horizontal de inicio en el PDF
1282
+     * @param y integer vertical de inicio en el PDF
1283
+     * @param w integer del acuse de recibo
1284
+     * @param h integer del acuse de recibo
1282 1285
      * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl)
1283 1286
      * @version 2018-04-13
1284 1287
      */
@@ -1306,10 +1309,10 @@  discard block
 block discarded – undo
1306 1309
 
1307 1310
     /**
1308 1311
      * Método que agrega el acuse de rebido
1309
-     * @param x Posición horizontal de inicio en el PDF
1312
+     * @param x integer horizontal de inicio en el PDF
1310 1313
      * @param y Posición vertical de inicio en el PDF
1311
-     * @param w Ancho del acuse de recibo
1312
-     * @param h Alto del acuse de recibo
1314
+     * @param w integer del acuse de recibo
1315
+     * @param h integer del acuse de recibo
1313 1316
      * @author Pablo Reyes (https://github.com/pabloxp)
1314 1317
      * @version 2015-11-17
1315 1318
      */
Please login to merge, or discard this patch.
Spacing   +39 added lines, -39 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,13 +537,13 @@  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
-                (isset($emisor['url'])?$emisor['url']:''),
542
+                (isset($emisor['url']) ? $emisor['url'] : ''),
543 543
                 'T'
544 544
             );
545 545
             if ($this->logo['posicion']) {
546
-                $this->SetY($this->y + ($w_img/2));
546
+                $this->SetY($this->y+($w_img / 2));
547 547
                 $w += 40;
548 548
             } else {
549 549
                 $x = $this->x+3;
@@ -554,14 +554,14 @@  discard block
 block discarded – undo
554 554
         }
555 555
         // agregar datos del emisor
556 556
         $this->setFont('', 'B', $font_size ? $font_size : 14);
557
-        $this->SetTextColorArray($color===null?[32, 92, 144]:$color);
557
+        $this->SetTextColorArray($color===null ? [32, 92, 144] : $color);
558 558
         $this->MultiTexto(!empty($emisor['RznSoc']) ? $emisor['RznSoc'] : $emisor['RznSocEmisor'], $x, $this->y+2, 'L', $w);
559 559
         $this->setFont('', 'B', $font_size ? $font_size : 9);
560
-        $this->SetTextColorArray([0,0,0]);
560
+        $this->SetTextColorArray([0, 0, 0]);
561 561
         $this->MultiTexto(!empty($emisor['GiroEmis']) ? $emisor['GiroEmis'] : $emisor['GiroEmisor'], $x, $this->y, 'L', $w);
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($emisor['DirOrigen'].($comuna?(', '.$comuna):'').($ciudad?(', '.$ciudad):''), $x, $this->y, 'L', $w);
564
+        $this->MultiTexto($emisor['DirOrigen'].($comuna ? (', '.$comuna) : '').($ciudad ? (', '.$ciudad) : ''), $x, $this->y, 'L', $w);
565 565
         if (!empty($emisor['Sucursal'])) {
566 566
             $this->MultiTexto('Sucursal: '.$emisor['Sucursal'], $x, $this->y, 'L', $w);
567 567
         }
@@ -605,12 +605,12 @@  discard block
 block discarded – undo
605 605
     protected function agregarFolio($rut, $tipo, $folio, $sucursal_sii = null, $x = 130, $y = 15, $w = 70, $font_size = null, array $color = null)
606 606
     {
607 607
         if ($color===null) {
608
-            $color = $tipo ? ($tipo==52 ? [0,172,140] : [255,0,0]) : [0,0,0];
608
+            $color = $tipo ? ($tipo==52 ? [0, 172, 140] : [255, 0, 0]) : [0, 0, 0];
609 609
         }
610 610
         $this->SetTextColorArray($color);
611 611
         // colocar rut emisor, glosa documento y folio
612 612
         list($rut, $dv) = explode('-', $rut);
613
-        $this->setFont ('', 'B', $font_size ? $font_size : 15);
613
+        $this->setFont('', 'B', $font_size ? $font_size : 15);
614 614
         $this->MultiTexto('R.U.T.: '.$this->num($rut).'-'.$dv, $x, $y+4, 'C', $w);
615 615
         $this->setFont('', 'B', $font_size ? $font_size : 12);
616 616
         $this->MultiTexto($this->getTipo($tipo), $x, null, 'C', $w);
@@ -623,7 +623,7 @@  discard block
 block discarded – undo
623 623
         if ($tipo) {
624 624
             $this->Texto('S.I.I. - '.\sasco\LibreDTE\Sii::getDireccionRegional($sucursal_sii), $x, $this->getY()+4, 'C', $w);
625 625
         }
626
-        $this->SetTextColorArray([0,0,0]);
626
+        $this->SetTextColorArray([0, 0, 0]);
627 627
         $this->Ln();
628 628
         return $this->y;
629 629
     }
@@ -755,7 +755,7 @@  discard block
 block discarded – undo
755 755
             $this->Texto('Señor(es)', $x);
756 756
             $this->Texto(':', $x+$offset);
757 757
             $this->setFont('', '', null);
758
-            $this->MultiTexto($receptor['RznSocRecep'], $x+$offset+2, null, '', $x==10?105:0);
758
+            $this->MultiTexto($receptor['RznSocRecep'], $x+$offset+2, null, '', $x==10 ? 105 : 0);
759 759
         }
760 760
         if (!empty($receptor['GiroRecep'])) {
761 761
             $this->setFont('', 'B', null);
@@ -772,7 +772,7 @@  discard block
 block discarded – undo
772 772
             $ciudad = !empty($receptor['CiudadRecep']) ? $receptor['CiudadRecep'] : (
773 773
                 !empty($receptor['CmnaRecep']) ? \sasco\LibreDTE\Chile::getCiudad($receptor['CmnaRecep']) : ''
774 774
             );
775
-            $this->MultiTexto($receptor['DirRecep'].(!empty($receptor['CmnaRecep'])?(', '.$receptor['CmnaRecep']):'').($ciudad?(', '.$ciudad):''), $x+$offset+2);
775
+            $this->MultiTexto($receptor['DirRecep'].(!empty($receptor['CmnaRecep']) ? (', '.$receptor['CmnaRecep']) : '').($ciudad ? (', '.$ciudad) : ''), $x+$offset+2);
776 776
         }
777 777
         if (!empty($receptor['Extranjero']['Nacionalidad'])) {
778 778
             $this->setFont('', 'B', null);
@@ -813,7 +813,7 @@  discard block
 block discarded – undo
813 813
             $this->Texto('Cód. recep.', $x);
814 814
             $this->Texto(':', $x+$offset);
815 815
             $this->setFont('', '', null);
816
-            $this->MultiTexto($receptor['CdgIntRecep'], $x+$offset+2, null, '', $x==10?105:0);
816
+            $this->MultiTexto($receptor['CdgIntRecep'], $x+$offset+2, null, '', $x==10 ? 105 : 0);
817 817
         }
818 818
         return $this->GetY();
819 819
     }
@@ -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']).' ';
@@ -1008,9 +1008,9 @@  discard block
 block discarded – undo
1008 1008
         $this->SetY($this->getY()+1);
1009 1009
         $p1x = $x;
1010 1010
         $p1y = $this->y;
1011
-        $p2x = $this->getPageWidth() - 2;
1012
-        $p2y = $p1y;  // Use same y for a straight line
1013
-        $style = array('width' => 0.2,'color' => array(0, 0, 0));
1011
+        $p2x = $this->getPageWidth()-2;
1012
+        $p2y = $p1y; // Use same y for a straight line
1013
+        $style = array('width' => 0.2, 'color' => array(0, 0, 0));
1014 1014
         $this->Line($p1x, $p1y, $p2x, $p2y, $style);
1015 1015
         $this->Texto($this->detalle_cols['NmbItem']['title'], $x+1, $this->y, ucfirst($this->detalle_cols['NmbItem']['align'][0]), $this->detalle_cols['NmbItem']['width']);
1016 1016
         $this->Texto($this->detalle_cols['PrcItem']['title'], $x+15, $this->y, ucfirst($this->detalle_cols['PrcItem']['align'][0]), $this->detalle_cols['PrcItem']['width']);
@@ -1020,9 +1020,9 @@  discard block
 block discarded – undo
1020 1020
         if (!isset($detalle[0]))
1021 1021
             $detalle = [$detalle];
1022 1022
         $this->SetY($this->getY()+2);
1023
-        foreach($detalle as  &$d) {
1023
+        foreach ($detalle as  &$d) {
1024 1024
             $this->MultiTexto($d['NmbItem'], $x+1, $this->y+4, ucfirst($this->detalle_cols['NmbItem']['align'][0]), $this->detalle_cols['NmbItem']['width']);
1025
-            $this->Texto(number_format($d['PrcItem'],0,',','.'), $x+15, $this->y, ucfirst($this->detalle_cols['PrcItem']['align'][0]), $this->detalle_cols['PrcItem']['width']);
1025
+            $this->Texto(number_format($d['PrcItem'], 0, ',', '.'), $x+15, $this->y, ucfirst($this->detalle_cols['PrcItem']['align'][0]), $this->detalle_cols['PrcItem']['width']);
1026 1026
             $this->Texto($this->num($d['QtyItem']), $x+35, $this->y, ucfirst($this->detalle_cols['QtyItem']['align'][0]), $this->detalle_cols['QtyItem']['width']);
1027 1027
             $this->Texto($this->num($d['MontoItem']), $x+45, $this->y, ucfirst($this->detalle_cols['MontoItem']['align'][0]), $this->detalle_cols['MontoItem']['width']);
1028 1028
         }
@@ -1042,7 +1042,7 @@  discard block
 block discarded – undo
1042 1042
         if (!isset($detalle[0])) {
1043 1043
             $detalle = [$detalle];
1044 1044
         }
1045
-        foreach($detalle as  &$d) {
1045
+        foreach ($detalle as  &$d) {
1046 1046
             if (!empty($d['MontoItem'])) {
1047 1047
                 $subtotal += $d['MontoItem'];
1048 1048
             }
@@ -1067,16 +1067,16 @@  discard block
 block discarded – undo
1067 1067
     {
1068 1068
         if (!isset($descuentosRecargos[0]))
1069 1069
             $descuentosRecargos = [$descuentosRecargos];
1070
-        foreach($descuentosRecargos as $dr) {
1070
+        foreach ($descuentosRecargos as $dr) {
1071 1071
             $tipo = $dr['TpoMov']=='D' ? 'Descuento' : 'Recargo';
1072 1072
             if ($dr['IndExeDR']) {
1073 1073
                 $tipo .= ' EX';
1074 1074
             }
1075 1075
             $valor = $dr['TpoValor']=='%' ? $dr['ValorDR'].'%' : $this->num($dr['ValorDR']);
1076 1076
             if ($this->papelContinuo) {
1077
-                $this->Texto($tipo.' global: '.$valor.(!empty($dr['GlosaDR'])?(' ('.$dr['GlosaDR'].')'):''), $x);
1077
+                $this->Texto($tipo.' global: '.$valor.(!empty($dr['GlosaDR']) ? (' ('.$dr['GlosaDR'].')') : ''), $x);
1078 1078
             } else {
1079
-                $this->Texto($tipo.(!empty($dr['GlosaDR'])?(' ('.$dr['GlosaDR'].')'):'').':', 77, null, 'R', 100);
1079
+                $this->Texto($tipo.(!empty($dr['GlosaDR']) ? (' ('.$dr['GlosaDR'].')') : '').':', 77, null, 'R', 100);
1080 1080
                 $this->Texto($valor, 177, null, 'R', 22);
1081 1081
             }
1082 1082
             $this->Ln();
@@ -1096,8 +1096,8 @@  discard block
 block discarded – undo
1096 1096
             $pagos = [$pagos];
1097 1097
         $this->Texto('Pago(s) programado(s):', $x);
1098 1098
         $this->Ln();
1099
-        foreach($pagos as $p) {
1100
-            $this->Texto('  - '.$this->date($p['FchPago'], false).': $'.$this->num($p['MntPago']).'.-'.(!empty($p['GlosaPagos'])?(' ('.$p['GlosaPagos'].')'):''), $x);
1099
+        foreach ($pagos as $p) {
1100
+            $this->Texto('  - '.$this->date($p['FchPago'], false).': $'.$this->num($p['MntPago']).'.-'.(!empty($p['GlosaPagos']) ? (' ('.$p['GlosaPagos'].')') : ''), $x);
1101 1101
             $this->Ln();
1102 1102
         }
1103 1103
     }
@@ -1148,7 +1148,7 @@  discard block
 block discarded – undo
1148 1148
             if (!isset($ImptoReten[0])) {
1149 1149
                 $ImptoReten = [$ImptoReten];
1150 1150
             }
1151
-            foreach($ImptoReten as $i) {
1151
+            foreach ($ImptoReten as $i) {
1152 1152
                 $totales['ImptoReten_'.$i['TipoImp']] = $i['MontoImp'];
1153 1153
                 if (!empty($i['TasaImp'])) {
1154 1154
                     $glosas['ImptoReten_'.$i['TipoImp']] = \sasco\LibreDTE\Sii\ImpuestosAdicionales::getGlosa($i['TipoImp']).' ('.$i['TasaImp'].'%) $';
@@ -1252,7 +1252,7 @@  discard block
 block discarded – undo
1252 1252
                 'vpadding' => 0,
1253 1253
                 'module_width' => 1, // width of a single module in points
1254 1254
                 'module_height' => 1, // height of a single module in points
1255
-                'fgcolor' => [0,0,0],
1255
+                'fgcolor' => [0, 0, 0],
1256 1256
                 'bgcolor' => false, // [255,255,255]
1257 1257
                 'position' => $this->papelContinuo ? 'C' : 'S',
1258 1258
             ];
@@ -1285,7 +1285,7 @@  discard block
 block discarded – undo
1285 1285
     protected function agregarAcuseRecibo($x = 83, $y = 190, $w = 60, $h = 40)
1286 1286
     {
1287 1287
         $y = (!$this->papelContinuo and !$this->timbre_pie) ? $this->x_fin_datos : $y;
1288
-        $this->SetTextColorArray([0,0,0]);
1288
+        $this->SetTextColorArray([0, 0, 0]);
1289 1289
         $this->Rect($x, $y, $w, $h, 'D', ['all' => ['width' => 0.1, 'color' => [0, 0, 0]]]);
1290 1290
         $this->setFont('', 'B', 10);
1291 1291
         $this->Texto('Acuse de recibo', $x, $y+1, 'C', $w);
@@ -1315,9 +1315,9 @@  discard block
 block discarded – undo
1315 1315
      */
1316 1316
     protected function agregarAcuseReciboContinuo($x = 3, $y = null, $w = 68, $h = 40)
1317 1317
     {
1318
-        $this->SetTextColorArray([0,0,0]);
1318
+        $this->SetTextColorArray([0, 0, 0]);
1319 1319
         $this->Rect($x, $y, $w, $h, 'D', ['all' => ['width' => 0.1, 'color' => [0, 0, 0]]]);
1320
-        $style = array('width' => 0.2,'color' => array(0, 0, 0));
1320
+        $style = array('width' => 0.2, 'color' => array(0, 0, 0));
1321 1321
         $this->Line($x, $y+22, $w+3, $y+22, $style);
1322 1322
         //$this->setFont('', 'B', 10);
1323 1323
         //$this->Texto('Acuse de recibo', $x, $y+1, 'C', $w);
@@ -1347,7 +1347,7 @@  discard block
 block discarded – undo
1347 1347
         $y = (!$this->papelContinuo and !$this->timbre_pie) ? $this->x_fin_datos : $y;
1348 1348
         $y += 64;
1349 1349
         $this->setFont('', 'B', $font_size);
1350
-        $this->Texto('CEDIBLE'.($tipo==52?' CON SU FACTURA':''), null, $y, 'R');
1350
+        $this->Texto('CEDIBLE'.($tipo==52 ? ' CON SU FACTURA' : ''), null, $y, 'R');
1351 1351
     }
1352 1352
 
1353 1353
     /**
@@ -1358,7 +1358,7 @@  discard block
 block discarded – undo
1358 1358
     protected function agregarLeyendaDestinoContinuo($tipo)
1359 1359
     {
1360 1360
         $this->setFont('', 'B', 8);
1361
-        $this->Texto('CEDIBLE'.($tipo==52?' CON SU FACTURA':''), null, $this->y+6, 'R');
1361
+        $this->Texto('CEDIBLE'.($tipo==52 ? ' CON SU FACTURA' : ''), null, $this->y+6, 'R');
1362 1362
     }
1363 1363
 
1364 1364
     /**
@@ -1389,7 +1389,7 @@  discard block
 block discarded – undo
1389 1389
         $dias = ['Domingo', 'Lunes', 'Martes', 'Miércoles', 'Jueves', 'Viernes', 'Sábado'];
1390 1390
         $meses = ['enero', 'febrero', 'marzo', 'abril', 'mayo', 'junio', 'julio', 'agosto', 'septiembre', 'octubre', 'noviembre', 'diciembre'];
1391 1391
         $unixtime = strtotime($date);
1392
-        $fecha = date(($mostrar_dia?'\D\I\A ':'').'j \d\e \M\E\S \d\e\l Y', $unixtime);
1392
+        $fecha = date(($mostrar_dia ? '\D\I\A ' : '').'j \d\e \M\E\S \d\e\l Y', $unixtime);
1393 1393
         $dia = $dias[date('w', $unixtime)];
1394 1394
         $mes = $meses[date('n', $unixtime)-1];
1395 1395
         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
@@ -567,10 +567,12 @@  discard block
 block discarded – undo
567 567
         }
568 568
         $contacto = [];
569 569
         if (!empty($emisor['Telefono'])) {
570
-            if (!is_array($emisor['Telefono']))
571
-                $emisor['Telefono'] = [$emisor['Telefono']];
572
-            foreach ($emisor['Telefono'] as $t)
573
-                $contacto[] = $t;
570
+            if (!is_array($emisor['Telefono'])) {
571
+                            $emisor['Telefono'] = [$emisor['Telefono']];
572
+            }
573
+            foreach ($emisor['Telefono'] as $t) {
574
+                            $contacto[] = $t;
575
+            }
574 576
         }
575 577
         if (!empty($emisor['CorreoEmisor'])) {
576 578
             $contacto[] = $emisor['CorreoEmisor'];
@@ -789,10 +791,12 @@  discard block
 block discarded – undo
789 791
             $this->MultiTexto($receptor['Extranjero']['NumId'], $x+$offset+2);
790 792
         }
791 793
         $contacto = [];
792
-        if (!empty($receptor['Contacto']))
793
-            $contacto[] = $receptor['Contacto'];
794
-        if (!empty($receptor['CorreoRecep']))
795
-            $contacto[] = $receptor['CorreoRecep'];
794
+        if (!empty($receptor['Contacto'])) {
795
+                    $contacto[] = $receptor['Contacto'];
796
+        }
797
+        if (!empty($receptor['CorreoRecep'])) {
798
+                    $contacto[] = $receptor['CorreoRecep'];
799
+        }
796 800
         if (!empty($contacto)) {
797 801
             $this->setFont('', 'B', null);
798 802
             $this->Texto('Contacto', $x);
@@ -842,15 +846,19 @@  discard block
 block discarded – undo
842 846
             if (!empty($Transporte['DirDest']) and !empty($Transporte['CmnaDest'])) {
843 847
                 $transporte .= 'a '.$Transporte['DirDest'].', '.$Transporte['CmnaDest'];
844 848
             }
845
-            if (!empty($Transporte['RUTTrans']))
846
-                $transporte .= ' por '.$Transporte['RUTTrans'];
847
-            if (!empty($Transporte['Patente']))
848
-                $transporte .= ' en vehículo '.$Transporte['Patente'];
849
+            if (!empty($Transporte['RUTTrans'])) {
850
+                            $transporte .= ' por '.$Transporte['RUTTrans'];
851
+            }
852
+            if (!empty($Transporte['Patente'])) {
853
+                            $transporte .= ' en vehículo '.$Transporte['Patente'];
854
+            }
849 855
             if (isset($Transporte['Chofer']) and is_array($Transporte['Chofer'])) {
850
-                if (!empty($Transporte['Chofer']['NombreChofer']))
851
-                    $transporte .= ' con chofer '.$Transporte['Chofer']['NombreChofer'];
852
-                if (!empty($Transporte['Chofer']['RUTChofer']))
853
-                    $transporte .= ' ('.$Transporte['Chofer']['RUTChofer'].')';
856
+                if (!empty($Transporte['Chofer']['NombreChofer'])) {
857
+                                    $transporte .= ' con chofer '.$Transporte['Chofer']['NombreChofer'];
858
+                }
859
+                if (!empty($Transporte['Chofer']['RUTChofer'])) {
860
+                                    $transporte .= ' ('.$Transporte['Chofer']['RUTChofer'].')';
861
+                }
854 862
             }
855 863
             if ($transporte) {
856 864
                 $this->setFont('', 'B', null);
@@ -864,8 +872,9 @@  discard block
 block discarded – undo
864 872
         if (!empty($Transporte['Aduana']) and is_array($Transporte['Aduana'])) {
865 873
             $col = 0;
866 874
             foreach ($Transporte['Aduana'] as $tag => $codigo) {
867
-                if ($codigo===false)
868
-                    continue;
875
+                if ($codigo===false) {
876
+                                    continue;
877
+                }
869 878
                 $glosa = \sasco\LibreDTE\Sii\Aduana::getGlosa($tag);
870 879
                 $valor = \sasco\LibreDTE\Sii\Aduana::getValor($tag, $codigo);
871 880
                 if ($glosa!==false and $valor!==false) {
@@ -878,15 +887,18 @@  discard block
 block discarded – undo
878 887
                     $this->Texto(':', $x+$offset+$col);
879 888
                     $this->setFont('', '', null);
880 889
                     $this->Texto($valor, $x+$offset+2+$col);
881
-                    if ($tag=='TipoBultos')
882
-                        $col = abs($col-110);
883
-                    if ($col)
884
-                        $this->Ln();
890
+                    if ($tag=='TipoBultos') {
891
+                                            $col = abs($col-110);
892
+                    }
893
+                    if ($col) {
894
+                                            $this->Ln();
895
+                    }
885 896
                     $col = abs($col-110);
886 897
                 }
887 898
             }
888
-            if ($col)
889
-                $this->Ln();
899
+            if ($col) {
900
+                            $this->Ln();
901
+            }
890 902
         }
891 903
     }
892 904
 
@@ -899,8 +911,9 @@  discard block
 block discarded – undo
899 911
      */
900 912
     protected function agregarReferencia($referencias, $x = 10, $offset = 22)
901 913
     {
902
-        if (!isset($referencias[0]))
903
-            $referencias = [$referencias];
914
+        if (!isset($referencias[0])) {
915
+                    $referencias = [$referencias];
916
+        }
904 917
         foreach($referencias as $r) {
905 918
             $texto = $r['NroLinRef'].' - ';
906 919
             if (!empty($r['TpoDocRef'])) {
@@ -937,8 +950,9 @@  discard block
 block discarded – undo
937 950
      */
938 951
     protected function agregarDetalle($detalle, $x = 10)
939 952
     {
940
-        if (!isset($detalle[0]))
941
-            $detalle = [$detalle];
953
+        if (!isset($detalle[0])) {
954
+                    $detalle = [$detalle];
955
+        }
942 956
         $this->setFont('', '', $this->detalle_fuente);
943 957
         // titulos
944 958
         $titulos = [];
@@ -955,36 +969,42 @@  discard block
 block discarded – undo
955 969
                     $item['NmbItem'] .= !$this->item_detalle_posicion ? '<br/>' : ': ';
956 970
                     $item['NmbItem'] .= '<span style="font-size:0.7em">'.$item['DscItem'].'</span>';
957 971
                 }
958
-                if (!in_array($col, $titulos_keys) or ($dte_exento and $col=='IndExe'))
959
-                    unset($item[$col]);
972
+                if (!in_array($col, $titulos_keys) or ($dte_exento and $col=='IndExe')) {
973
+                                    unset($item[$col]);
974
+                }
960 975
             }
961 976
             // ajustes a IndExe
962 977
             if (isset($item['IndExe'])) {
963
-                if ($item['IndExe']==1)
964
-                    $item['IndExe'] = 'EX';
965
-                else if ($item['IndExe']==2)
966
-                    $item['IndExe'] = 'NF';
978
+                if ($item['IndExe']==1) {
979
+                                    $item['IndExe'] = 'EX';
980
+                } else if ($item['IndExe']==2) {
981
+                                    $item['IndExe'] = 'NF';
982
+                }
967 983
             }
968 984
             // agregar todas las columnas que se podrían imprimir en la tabla
969 985
             $item_default = [];
970
-            foreach ($this->detalle_cols as $key => $info)
971
-                $item_default[$key] = false;
986
+            foreach ($this->detalle_cols as $key => $info) {
987
+                            $item_default[$key] = false;
988
+            }
972 989
             $item = array_merge($item_default, $item);
973 990
             // si hay código de item se extrae su valor
974
-            if ($item['CdgItem'])
975
-                $item['CdgItem'] = $item['CdgItem']['VlrCodigo'];
991
+            if ($item['CdgItem']) {
992
+                            $item['CdgItem'] = $item['CdgItem']['VlrCodigo'];
993
+            }
976 994
             // dar formato a números
977 995
             foreach (['QtyItem', 'PrcItem', 'DescuentoMonto', 'RecargoMonto', 'MontoItem'] as $col) {
978
-                if ($item[$col])
979
-                    $item[$col] = $this->num($item[$col]);
996
+                if ($item[$col]) {
997
+                                    $item[$col] = $this->num($item[$col]);
998
+                }
980 999
             }
981 1000
         }
982 1001
         // opciones
983 1002
         $options = ['align'=>[]];
984 1003
         $i = 0;
985 1004
         foreach ($this->detalle_cols as $info) {
986
-            if (isset($info['width']))
987
-                $options['width'][$i] = $info['width'];
1005
+            if (isset($info['width'])) {
1006
+                            $options['width'][$i] = $info['width'];
1007
+            }
988 1008
             $options['align'][$i] = $info['align'];
989 1009
             $i++;
990 1010
         }
@@ -1017,8 +1037,9 @@  discard block
 block discarded – undo
1017 1037
         $this->Texto($this->detalle_cols['QtyItem']['title'], $x+35, $this->y, ucfirst($this->detalle_cols['QtyItem']['align'][0]), $this->detalle_cols['QtyItem']['width']);
1018 1038
         $this->Texto($this->detalle_cols['MontoItem']['title'], $x+45, $this->y, ucfirst($this->detalle_cols['MontoItem']['align'][0]), $this->detalle_cols['MontoItem']['width']);
1019 1039
         $this->Line($p1x, $p1y+4, $p2x, $p2y+4, $style);
1020
-        if (!isset($detalle[0]))
1021
-            $detalle = [$detalle];
1040
+        if (!isset($detalle[0])) {
1041
+                    $detalle = [$detalle];
1042
+        }
1022 1043
         $this->SetY($this->getY()+2);
1023 1044
         foreach($detalle as  &$d) {
1024 1045
             $this->MultiTexto($d['NmbItem'], $x+1, $this->y+4, ucfirst($this->detalle_cols['NmbItem']['align'][0]), $this->detalle_cols['NmbItem']['width']);
@@ -1065,8 +1086,9 @@  discard block
 block discarded – undo
1065 1086
      */
1066 1087
     protected function agregarDescuentosRecargos(array $descuentosRecargos, $x = 10)
1067 1088
     {
1068
-        if (!isset($descuentosRecargos[0]))
1069
-            $descuentosRecargos = [$descuentosRecargos];
1089
+        if (!isset($descuentosRecargos[0])) {
1090
+                    $descuentosRecargos = [$descuentosRecargos];
1091
+        }
1070 1092
         foreach($descuentosRecargos as $dr) {
1071 1093
             $tipo = $dr['TpoMov']=='D' ? 'Descuento' : 'Recargo';
1072 1094
             if ($dr['IndExeDR']) {
@@ -1092,8 +1114,9 @@  discard block
 block discarded – undo
1092 1114
      */
1093 1115
     protected function agregarPagos(array $pagos, $x = 10)
1094 1116
     {
1095
-        if (!isset($pagos[0]))
1096
-            $pagos = [$pagos];
1117
+        if (!isset($pagos[0])) {
1118
+                    $pagos = [$pagos];
1119
+        }
1097 1120
         $this->Texto('Pago(s) programado(s):', $x);
1098 1121
         $this->Ln();
1099 1122
         foreach($pagos as $p) {
@@ -1371,11 +1394,13 @@  discard block
 block discarded – undo
1371 1394
      */
1372 1395
     protected function num($n)
1373 1396
     {
1374
-        if (!is_numeric($n))
1375
-            return $n;
1397
+        if (!is_numeric($n)) {
1398
+                    return $n;
1399
+        }
1376 1400
         $broken_number = explode('.', (string)$n);
1377
-        if (isset($broken_number[1]))
1378
-            return number_format($broken_number[0], 0, ',', '.').','.$broken_number[1];
1401
+        if (isset($broken_number[1])) {
1402
+                    return number_format($broken_number[0], 0, ',', '.').','.$broken_number[1];
1403
+        }
1379 1404
         return number_format($broken_number[0], 0, ',', '.');
1380 1405
     }
1381 1406
 
Please login to merge, or discard this patch.
lib/PDF.php 2 patches
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 namespace sasco\LibreDTE;
25 25
 
26 26
 // Directorio para imágenes (no se asume nada)
27
-define ('K_PATH_IMAGES', '');
27
+define('K_PATH_IMAGES', '');
28 28
 
29 29
 /**
30 30
  * Clase para generar PDFs
@@ -151,13 +151,13 @@  discard block
 block discarded – undo
151 151
     {
152 152
         $widths = [];
153 153
         if (is_int($cells)) {
154
-            $width = floor($total/$cells);
155
-            for ($i=0; $i<$cells; ++$i) {
154
+            $width = floor($total / $cells);
155
+            for ($i = 0; $i<$cells; ++$i) {
156 156
                 $widths[] = $width;
157 157
             }
158 158
         }
159
-        else if (is_array($cells)){
160
-            $width = floor($total/count($cells));
159
+        else if (is_array($cells)) {
160
+            $width = floor($total / count($cells));
161 161
             foreach ($cells as $i) {
162 162
                 $widths[$i] = $width;
163 163
             }
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
                 $suma += $val;
208 208
             }
209 209
             if ($key_0!==null) {
210
-                $options['width'][$key_0] = 190 - $suma;
210
+                $options['width'][$key_0] = 190-$suma;
211 211
             }
212 212
         }
213 213
         if (isset($options['align']))
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
         $a = (isset($options['align']) and is_array($options['align'])) ? $options['align'] : [];
243 243
         $buffer = '<table style="border:1px solid #333">';
244 244
         // Definir títulos de columnas
245
-        $thead = isset($options['width']) and is_array($options['width']) and count($options['width']) == count($headers);
245
+        $thead = isset($options['width']) and is_array($options['width']) and count($options['width'])==count($headers);
246 246
         if ($thead)
247 247
             $buffer .= '<thead>';
248 248
         $buffer .= '<tr>';
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
             $options['bordercolor'][2]
303 303
         );
304 304
         $this->SetLineWidth($options['borderwidth']);
305
-        $this->SetFont($this->defaultOptions['font']['family'], 'B',  $options['fontsize']);
305
+        $this->SetFont($this->defaultOptions['font']['family'], 'B', $options['fontsize']);
306 306
         // corregir indices
307 307
         $headers_keys = array_keys($headers);
308 308
         if (is_array($options['width'])) {
@@ -318,12 +318,12 @@  discard block
 block discarded – undo
318 318
         }
319 319
         // Header
320 320
         $x = $this->GetX();
321
-        foreach($headers as $i => $header) {
321
+        foreach ($headers as $i => $header) {
322 322
             $this->Cell($options['width'][$i], $options['height'], $headers[$i], 1, 0, $options['align'][$i], 1);
323 323
         }
324 324
         $this->Ln();
325 325
         // Color and font restoration
326
-        $this->SetFillColor (
326
+        $this->SetFillColor(
327 327
             $options['bodybackground'][0],
328 328
             $options['bodybackground'][1],
329 329
             $options['bodybackground'][2]
@@ -346,20 +346,20 @@  discard block
 block discarded – undo
346 346
             $num_pages = $this->getNumPages();
347 347
             $this->startTransaction();
348 348
             $this->SetX($x);
349
-            foreach($headers as $i => $header) {
349
+            foreach ($headers as $i => $header) {
350 350
                 $this->Cell($options['width'][$i], $options['height'], $row[$i], 'LR', 0, $options['align'][$i], $fill);
351 351
             }
352 352
             $this->Ln();
353
-            if($num_pages < $this->getNumPages()) {
353
+            if ($num_pages<$this->getNumPages()) {
354 354
                 $this->rollbackTransaction(true);
355 355
                 $this->AddPage();
356 356
                 $this->SetX($x);
357
-                foreach($headers as $i => $header) {
357
+                foreach ($headers as $i => $header) {
358 358
                     $this->Cell($options['width'][$i], $options['height'], $headers[$i], 1, 0, $options['align'][$i], 1);
359 359
                 }
360 360
                 $this->Ln();
361 361
                 $this->SetX($x);
362
-                foreach($headers as $i => $header) {
362
+                foreach ($headers as $i => $header) {
363 363
                     $this->Cell($options['width'][$i], $options['height'], $row[$i], 'LR', 0, $options['align'][$i], $fill);
364 364
                 }
365 365
                 $this->Ln();
@@ -395,7 +395,7 @@  discard block
 block discarded – undo
395 395
      * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]delaf.cl)
396 396
      * @version 2014-09-20
397 397
      */
398
-    public function Texto($txt, $x=null, $y=null, $align='', $w=0, $link='', $border=0, $fill=false)
398
+    public function Texto($txt, $x = null, $y = null, $align = '', $w = 0, $link = '', $border = 0, $fill = false)
399 399
     {
400 400
         if ($x==null) $x = $this->GetX();
401 401
         if ($y==null) $y = $this->GetY();
@@ -416,7 +416,7 @@  discard block
 block discarded – undo
416 416
      * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]delaf.cl)
417 417
      * @version 2014-09-20
418 418
      */
419
-    public function MultiTexto($txt, $x=null, $y=null, $align='', $w=0, $border=0, $fill=false)
419
+    public function MultiTexto($txt, $x = null, $y = null, $align = '', $w = 0, $border = 0, $fill = false)
420 420
     {
421 421
         if ($x==null) $x = $this->GetX();
422 422
         if ($y==null) $y = $this->GetY();
Please login to merge, or discard this patch.
Braces   +52 added lines, -32 removed lines patch added patch discarded remove patch
@@ -101,13 +101,16 @@  discard block
 block discarded – undo
101 101
             $this->Line(0, $this->getY()-1, 290, $this->getY()-2, $style);
102 102
             $this->SetFont('', 'B', 6);
103 103
             if (empty($this->papelContinuo)) {
104
-                if (!empty($this->footer['left']))
105
-                    $this->Texto($this->footer['left']);
106
-                if (!empty($this->footer['right']))
107
-                    $this->Texto($this->footer['right'], null, null, 'R');
104
+                if (!empty($this->footer['left'])) {
105
+                                    $this->Texto($this->footer['left']);
106
+                }
107
+                if (!empty($this->footer['right'])) {
108
+                                    $this->Texto($this->footer['right'], null, null, 'R');
109
+                }
108 110
             } else {
109
-                if (!empty($this->footer['left']))
110
-                    $this->Texto($this->footer['left'], null, null, 'C');
111
+                if (!empty($this->footer['left'])) {
112
+                                    $this->Texto($this->footer['left'], null, null, 'C');
113
+                }
111 114
                 if (!empty($this->footer['right'])) {
112 115
                     $this->Ln();
113 116
                     $this->Texto($this->footer['right'], null, null, 'C');
@@ -133,8 +136,9 @@  discard block
 block discarded – undo
133 136
                 ];
134 137
             }
135 138
             // si no es arreglo se convierte en uno
136
-            if (!is_array($footer))
137
-                $footer = ['left'=>$footer];
139
+            if (!is_array($footer)) {
140
+                            $footer = ['left'=>$footer];
141
+            }
138 142
             // asignar footer
139 143
             $this->footer = array_merge(['left'=>'', 'right'=>''], $footer);
140 144
         } else {
@@ -155,8 +159,7 @@  discard block
 block discarded – undo
155 159
             for ($i=0; $i<$cells; ++$i) {
156 160
                 $widths[] = $width;
157 161
             }
158
-        }
159
-        else if (is_array($cells)){
162
+        } else if (is_array($cells)){
160 163
             $width = floor($total/count($cells));
161 164
             foreach ($cells as $i) {
162 165
                 $widths[$i] = $width;
@@ -177,8 +180,9 @@  discard block
 block discarded – undo
177 180
         foreach ($data as $row) {
178 181
             foreach ($row as $col => $value) {
179 182
                 if (empty($value)) {
180
-                    if (!array_key_exists($col, $cols_empty))
181
-                        $cols_empty[$col] = 0;
183
+                    if (!array_key_exists($col, $cols_empty)) {
184
+                                            $cols_empty[$col] = 0;
185
+                    }
182 186
                     $cols_empty[$col]++;
183 187
                 }
184 188
             }
@@ -191,10 +195,12 @@  discard block
 block discarded – undo
191 195
                 foreach ($data as &$row) {
192 196
                     unset($row[$col]);
193 197
                 }
194
-                if (isset($options['width']))
195
-                    unset($options['width'][$titles_keys[$col]]);
196
-                if (isset($options['align']))
197
-                    unset($options['align'][$titles_keys[$col]]);
198
+                if (isset($options['width'])) {
199
+                                    unset($options['width'][$titles_keys[$col]]);
200
+                }
201
+                if (isset($options['align'])) {
202
+                                    unset($options['align'][$titles_keys[$col]]);
203
+                }
198 204
             }
199 205
         }
200 206
         if (isset($options['width'])) {
@@ -202,16 +208,18 @@  discard block
 block discarded – undo
202 208
             $key_0 = null;
203 209
             $suma = 0;
204 210
             foreach ($options['width'] as $key => $val) {
205
-                if ($val===0)
206
-                    $key_0 = $key;
211
+                if ($val===0) {
212
+                                    $key_0 = $key;
213
+                }
207 214
                 $suma += $val;
208 215
             }
209 216
             if ($key_0!==null) {
210 217
                 $options['width'][$key_0] = 190 - $suma;
211 218
             }
212 219
         }
213
-        if (isset($options['align']))
214
-            $options['align'] = array_slice($options['align'], 0);
220
+        if (isset($options['align'])) {
221
+                    $options['align'] = array_slice($options['align'], 0);
222
+        }
215 223
         $this->addTable($titles, $data, $options, $html);
216 224
     }
217 225
 
@@ -243,8 +251,9 @@  discard block
 block discarded – undo
243 251
         $buffer = '<table style="border:1px solid #333">';
244 252
         // Definir títulos de columnas
245 253
         $thead = isset($options['width']) and is_array($options['width']) and count($options['width']) == count($headers);
246
-        if ($thead)
247
-            $buffer .= '<thead>';
254
+        if ($thead) {
255
+                    $buffer .= '<thead>';
256
+        }
248 257
         $buffer .= '<tr>';
249 258
         $i = 0;
250 259
         foreach ($headers as &$col) {
@@ -254,11 +263,13 @@  discard block
 block discarded – undo
254 263
             $i++;
255 264
         }
256 265
         $buffer .= '</tr>';
257
-        if ($thead)
258
-            $buffer .= '</thead>';
266
+        if ($thead) {
267
+                    $buffer .= '</thead>';
268
+        }
259 269
         // Definir datos de la tabla
260
-        if ($thead)
261
-            $buffer .= '<tbody>';
270
+        if ($thead) {
271
+                    $buffer .= '<tbody>';
272
+        }
262 273
         foreach ($data as &$row) {
263 274
             $buffer .= '<tr>';
264 275
             $i = 0;
@@ -270,8 +281,9 @@  discard block
 block discarded – undo
270 281
             }
271 282
             $buffer .= '</tr>';
272 283
         }
273
-        if ($thead)
274
-            $buffer .= '</tbody>';
284
+        if ($thead) {
285
+                    $buffer .= '</tbody>';
286
+        }
275 287
         // Finalizar tabla
276 288
         $buffer .= '</table>';
277 289
         // generar tabla en HTML
@@ -397,8 +409,12 @@  discard block
 block discarded – undo
397 409
      */
398 410
     public function Texto($txt, $x=null, $y=null, $align='', $w=0, $link='', $border=0, $fill=false)
399 411
     {
400
-        if ($x==null) $x = $this->GetX();
401
-        if ($y==null) $y = $this->GetY();
412
+        if ($x==null) {
413
+            $x = $this->GetX();
414
+        }
415
+        if ($y==null) {
416
+            $y = $this->GetY();
417
+        }
402 418
         $textrendermode = $this->textrendermode;
403 419
         $textstrokewidth = $this->textstrokewidth;
404 420
         $this->setTextRenderingMode(0, true, false);
@@ -418,8 +434,12 @@  discard block
 block discarded – undo
418 434
      */
419 435
     public function MultiTexto($txt, $x=null, $y=null, $align='', $w=0, $border=0, $fill=false)
420 436
     {
421
-        if ($x==null) $x = $this->GetX();
422
-        if ($y==null) $y = $this->GetY();
437
+        if ($x==null) {
438
+            $x = $this->GetX();
439
+        }
440
+        if ($y==null) {
441
+            $y = $this->GetY();
442
+        }
423 443
         $textrendermode = $this->textrendermode;
424 444
         $textstrokewidth = $this->textstrokewidth;
425 445
         $this->setTextRenderingMode(0, true, false);
Please login to merge, or discard this patch.