@@ -187,7 +187,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 2018-04-15 |
@@ -1001,7 +1004,7 @@ discard block |
||
1001 | 1004 | /** |
1002 | 1005 | * Método que agrega el detalle del documento |
1003 | 1006 | * @param detalle Arreglo con el detalle del documento (tag Detalle del XML) |
1004 | - * @param x Posición horizontal de inicio en el PDF |
|
1007 | + * @param x integer horizontal de inicio en el PDF |
|
1005 | 1008 | * @param y Posición vertical de inicio en el PDF |
1006 | 1009 | * @author Pablo Reyes (https://github.com/pabloxp) |
1007 | 1010 | * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl) |
@@ -1037,7 +1040,7 @@ discard block |
||
1037 | 1040 | * Método que agrega el subtotal del DTE |
1038 | 1041 | * @param detalle Arreglo con los detalles del documentos para poder |
1039 | 1042 | * calcular subtotal |
1040 | - * @param x Posición horizontal de inicio en el PDF |
|
1043 | + * @param x integer horizontal de inicio en el PDF |
|
1041 | 1044 | * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl) |
1042 | 1045 | * @version 2016-08-17 |
1043 | 1046 | */ |
@@ -1063,7 +1066,7 @@ discard block |
||
1063 | 1066 | /** |
1064 | 1067 | * Método que agrega los descuentos y/o recargos globales del documento |
1065 | 1068 | * @param descuentosRecargos Arreglo con los descuentos y/o recargos del documento (tag DscRcgGlobal del XML) |
1066 | - * @param x Posición horizontal de inicio en el PDF |
|
1069 | + * @param x integer horizontal de inicio en el PDF |
|
1067 | 1070 | * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl) |
1068 | 1071 | * @version 2018-04-15 |
1069 | 1072 | */ |
@@ -1090,7 +1093,7 @@ discard block |
||
1090 | 1093 | /** |
1091 | 1094 | * Método que agrega los pagos del documento |
1092 | 1095 | * @param pagos Arreglo con los pagos del documento |
1093 | - * @param x Posición horizontal de inicio en el PDF |
|
1096 | + * @param x integer horizontal de inicio en el PDF |
|
1094 | 1097 | * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl) |
1095 | 1098 | * @version 2016-07-24 |
1096 | 1099 | */ |
@@ -1239,9 +1242,9 @@ discard block |
||
1239 | 1242 | * - Se imprime en el tamaño mínimo: 2x5 cms |
1240 | 1243 | * - En el lado de abajo con margen izquierdo mínimo de 2 cms |
1241 | 1244 | * @param timbre String con los datos del timbre |
1242 | - * @param x Posición horizontal de inicio en el PDF |
|
1243 | - * @param y Posición vertical de inicio en el PDF |
|
1244 | - * @param w Ancho del timbre |
|
1245 | + * @param x integer horizontal de inicio en el PDF |
|
1246 | + * @param y integer vertical de inicio en el PDF |
|
1247 | + * @param w integer del timbre |
|
1245 | 1248 | * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl) |
1246 | 1249 | * @version 2018-04-12 |
1247 | 1250 | */ |
@@ -1279,10 +1282,10 @@ discard block |
||
1279 | 1282 | |
1280 | 1283 | /** |
1281 | 1284 | * Método que agrega el acuse de rebido |
1282 | - * @param x Posición horizontal de inicio en el PDF |
|
1283 | - * @param y Posición vertical de inicio en el PDF |
|
1284 | - * @param w Ancho del acuse de recibo |
|
1285 | - * @param h Alto del acuse de recibo |
|
1285 | + * @param x integer horizontal de inicio en el PDF |
|
1286 | + * @param y integer vertical de inicio en el PDF |
|
1287 | + * @param w integer del acuse de recibo |
|
1288 | + * @param h integer del acuse de recibo |
|
1286 | 1289 | * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl) |
1287 | 1290 | * @version 2018-04-13 |
1288 | 1291 | */ |
@@ -1310,10 +1313,10 @@ discard block |
||
1310 | 1313 | |
1311 | 1314 | /** |
1312 | 1315 | * Método que agrega el acuse de rebido |
1313 | - * @param x Posición horizontal de inicio en el PDF |
|
1316 | + * @param x integer horizontal de inicio en el PDF |
|
1314 | 1317 | * @param y Posición vertical de inicio en el PDF |
1315 | - * @param w Ancho del acuse de recibo |
|
1316 | - * @param h Alto del acuse de recibo |
|
1318 | + * @param w integer del acuse de recibo |
|
1319 | + * @param h integer del acuse de recibo |
|
1317 | 1320 | * @author Pablo Reyes (https://github.com/pabloxp) |
1318 | 1321 | * @version 2015-11-17 |
1319 | 1322 | */ |
@@ -181,7 +181,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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']).' '; |
@@ -952,7 +952,7 @@ discard block |
||
952 | 952 | // quitar columnas |
953 | 953 | foreach ($item as $col => $valor) { |
954 | 954 | if ($col=='DscItem' and !empty($item['DscItem'])) { |
955 | - $item['NmbItem'] .= !$this->item_detalle_posicion ? ($html?'<br/>':"\n") : ': '; |
|
955 | + $item['NmbItem'] .= !$this->item_detalle_posicion ? ($html ? '<br/>' : "\n") : ': '; |
|
956 | 956 | if ($html) { |
957 | 957 | $item['NmbItem'] .= '<span style="font-size:0.7em">'.$item['DscItem'].'</span>'; |
958 | 958 | } else { |
@@ -1012,9 +1012,9 @@ discard block |
||
1012 | 1012 | $this->SetY($this->getY()+1); |
1013 | 1013 | $p1x = $x; |
1014 | 1014 | $p1y = $this->y; |
1015 | - $p2x = $this->getPageWidth() - 2; |
|
1016 | - $p2y = $p1y; // Use same y for a straight line |
|
1017 | - $style = array('width' => 0.2,'color' => array(0, 0, 0)); |
|
1015 | + $p2x = $this->getPageWidth()-2; |
|
1016 | + $p2y = $p1y; // Use same y for a straight line |
|
1017 | + $style = array('width' => 0.2, 'color' => array(0, 0, 0)); |
|
1018 | 1018 | $this->Line($p1x, $p1y, $p2x, $p2y, $style); |
1019 | 1019 | $this->Texto($this->detalle_cols['NmbItem']['title'], $x+1, $this->y, ucfirst($this->detalle_cols['NmbItem']['align'][0]), $this->detalle_cols['NmbItem']['width']); |
1020 | 1020 | $this->Texto($this->detalle_cols['PrcItem']['title'], $x+15, $this->y, ucfirst($this->detalle_cols['PrcItem']['align'][0]), $this->detalle_cols['PrcItem']['width']); |
@@ -1024,9 +1024,9 @@ discard block |
||
1024 | 1024 | if (!isset($detalle[0])) |
1025 | 1025 | $detalle = [$detalle]; |
1026 | 1026 | $this->SetY($this->getY()+2); |
1027 | - foreach($detalle as &$d) { |
|
1027 | + foreach ($detalle as &$d) { |
|
1028 | 1028 | $this->MultiTexto($d['NmbItem'], $x+1, $this->y+4, ucfirst($this->detalle_cols['NmbItem']['align'][0]), $this->detalle_cols['NmbItem']['width']); |
1029 | - $this->Texto(number_format($d['PrcItem'],0,',','.'), $x+15, $this->y, ucfirst($this->detalle_cols['PrcItem']['align'][0]), $this->detalle_cols['PrcItem']['width']); |
|
1029 | + $this->Texto(number_format($d['PrcItem'], 0, ',', '.'), $x+15, $this->y, ucfirst($this->detalle_cols['PrcItem']['align'][0]), $this->detalle_cols['PrcItem']['width']); |
|
1030 | 1030 | $this->Texto($this->num($d['QtyItem']), $x+35, $this->y, ucfirst($this->detalle_cols['QtyItem']['align'][0]), $this->detalle_cols['QtyItem']['width']); |
1031 | 1031 | $this->Texto($this->num($d['MontoItem']), $x+45, $this->y, ucfirst($this->detalle_cols['MontoItem']['align'][0]), $this->detalle_cols['MontoItem']['width']); |
1032 | 1032 | } |
@@ -1046,7 +1046,7 @@ discard block |
||
1046 | 1046 | if (!isset($detalle[0])) { |
1047 | 1047 | $detalle = [$detalle]; |
1048 | 1048 | } |
1049 | - foreach($detalle as &$d) { |
|
1049 | + foreach ($detalle as &$d) { |
|
1050 | 1050 | if (!empty($d['MontoItem'])) { |
1051 | 1051 | $subtotal += $d['MontoItem']; |
1052 | 1052 | } |
@@ -1071,16 +1071,16 @@ discard block |
||
1071 | 1071 | { |
1072 | 1072 | if (!isset($descuentosRecargos[0])) |
1073 | 1073 | $descuentosRecargos = [$descuentosRecargos]; |
1074 | - foreach($descuentosRecargos as $dr) { |
|
1074 | + foreach ($descuentosRecargos as $dr) { |
|
1075 | 1075 | $tipo = $dr['TpoMov']=='D' ? 'Descuento' : 'Recargo'; |
1076 | 1076 | if ($dr['IndExeDR']) { |
1077 | 1077 | $tipo .= ' EX'; |
1078 | 1078 | } |
1079 | 1079 | $valor = $dr['TpoValor']=='%' ? $dr['ValorDR'].'%' : $this->num($dr['ValorDR']); |
1080 | 1080 | if ($this->papelContinuo) { |
1081 | - $this->Texto($tipo.' global: '.$valor.(!empty($dr['GlosaDR'])?(' ('.$dr['GlosaDR'].')'):''), $x); |
|
1081 | + $this->Texto($tipo.' global: '.$valor.(!empty($dr['GlosaDR']) ? (' ('.$dr['GlosaDR'].')') : ''), $x); |
|
1082 | 1082 | } else { |
1083 | - $this->Texto($tipo.(!empty($dr['GlosaDR'])?(' ('.$dr['GlosaDR'].')'):'').':', 77, null, 'R', 100); |
|
1083 | + $this->Texto($tipo.(!empty($dr['GlosaDR']) ? (' ('.$dr['GlosaDR'].')') : '').':', 77, null, 'R', 100); |
|
1084 | 1084 | $this->Texto($valor, 177, null, 'R', 22); |
1085 | 1085 | } |
1086 | 1086 | $this->Ln(); |
@@ -1100,8 +1100,8 @@ discard block |
||
1100 | 1100 | $pagos = [$pagos]; |
1101 | 1101 | $this->Texto('Pago(s) programado(s):', $x); |
1102 | 1102 | $this->Ln(); |
1103 | - foreach($pagos as $p) { |
|
1104 | - $this->Texto(' - '.$this->date($p['FchPago'], false).': $'.$this->num($p['MntPago']).'.-'.(!empty($p['GlosaPagos'])?(' ('.$p['GlosaPagos'].')'):''), $x); |
|
1103 | + foreach ($pagos as $p) { |
|
1104 | + $this->Texto(' - '.$this->date($p['FchPago'], false).': $'.$this->num($p['MntPago']).'.-'.(!empty($p['GlosaPagos']) ? (' ('.$p['GlosaPagos'].')') : ''), $x); |
|
1105 | 1105 | $this->Ln(); |
1106 | 1106 | } |
1107 | 1107 | } |
@@ -1152,7 +1152,7 @@ discard block |
||
1152 | 1152 | if (!isset($ImptoReten[0])) { |
1153 | 1153 | $ImptoReten = [$ImptoReten]; |
1154 | 1154 | } |
1155 | - foreach($ImptoReten as $i) { |
|
1155 | + foreach ($ImptoReten as $i) { |
|
1156 | 1156 | $totales['ImptoReten_'.$i['TipoImp']] = $i['MontoImp']; |
1157 | 1157 | if (!empty($i['TasaImp'])) { |
1158 | 1158 | $glosas['ImptoReten_'.$i['TipoImp']] = \sasco\LibreDTE\Sii\ImpuestosAdicionales::getGlosa($i['TipoImp']).' ('.$i['TasaImp'].'%) $'; |
@@ -1256,7 +1256,7 @@ discard block |
||
1256 | 1256 | 'vpadding' => 0, |
1257 | 1257 | 'module_width' => 1, // width of a single module in points |
1258 | 1258 | 'module_height' => 1, // height of a single module in points |
1259 | - 'fgcolor' => [0,0,0], |
|
1259 | + 'fgcolor' => [0, 0, 0], |
|
1260 | 1260 | 'bgcolor' => false, // [255,255,255] |
1261 | 1261 | 'position' => $this->papelContinuo ? 'C' : 'S', |
1262 | 1262 | ]; |
@@ -1289,7 +1289,7 @@ discard block |
||
1289 | 1289 | protected function agregarAcuseRecibo($x = 83, $y = 190, $w = 60, $h = 40) |
1290 | 1290 | { |
1291 | 1291 | $y = (!$this->papelContinuo and !$this->timbre_pie) ? $this->x_fin_datos : $y; |
1292 | - $this->SetTextColorArray([0,0,0]); |
|
1292 | + $this->SetTextColorArray([0, 0, 0]); |
|
1293 | 1293 | $this->Rect($x, $y, $w, $h, 'D', ['all' => ['width' => 0.1, 'color' => [0, 0, 0]]]); |
1294 | 1294 | $this->setFont('', 'B', 10); |
1295 | 1295 | $this->Texto('Acuse de recibo', $x, $y+1, 'C', $w); |
@@ -1319,9 +1319,9 @@ discard block |
||
1319 | 1319 | */ |
1320 | 1320 | protected function agregarAcuseReciboContinuo($x = 3, $y = null, $w = 68, $h = 40) |
1321 | 1321 | { |
1322 | - $this->SetTextColorArray([0,0,0]); |
|
1322 | + $this->SetTextColorArray([0, 0, 0]); |
|
1323 | 1323 | $this->Rect($x, $y, $w, $h, 'D', ['all' => ['width' => 0.1, 'color' => [0, 0, 0]]]); |
1324 | - $style = array('width' => 0.2,'color' => array(0, 0, 0)); |
|
1324 | + $style = array('width' => 0.2, 'color' => array(0, 0, 0)); |
|
1325 | 1325 | $this->Line($x, $y+22, $w+3, $y+22, $style); |
1326 | 1326 | //$this->setFont('', 'B', 10); |
1327 | 1327 | //$this->Texto('Acuse de recibo', $x, $y+1, 'C', $w); |
@@ -1351,7 +1351,7 @@ discard block |
||
1351 | 1351 | $y = (!$this->papelContinuo and !$this->timbre_pie) ? $this->x_fin_datos : $y; |
1352 | 1352 | $y += 64; |
1353 | 1353 | $this->setFont('', 'B', $font_size); |
1354 | - $this->Texto('CEDIBLE'.($tipo==52?' CON SU FACTURA':''), null, $y, 'R'); |
|
1354 | + $this->Texto('CEDIBLE'.($tipo==52 ? ' CON SU FACTURA' : ''), null, $y, 'R'); |
|
1355 | 1355 | } |
1356 | 1356 | |
1357 | 1357 | /** |
@@ -1362,7 +1362,7 @@ discard block |
||
1362 | 1362 | protected function agregarLeyendaDestinoContinuo($tipo) |
1363 | 1363 | { |
1364 | 1364 | $this->setFont('', 'B', 8); |
1365 | - $this->Texto('CEDIBLE'.($tipo==52?' CON SU FACTURA':''), null, $this->y+6, 'R'); |
|
1365 | + $this->Texto('CEDIBLE'.($tipo==52 ? ' CON SU FACTURA' : ''), null, $this->y+6, 'R'); |
|
1366 | 1366 | } |
1367 | 1367 | |
1368 | 1368 | /** |
@@ -1393,7 +1393,7 @@ discard block |
||
1393 | 1393 | $dias = ['Domingo', 'Lunes', 'Martes', 'Miércoles', 'Jueves', 'Viernes', 'Sábado']; |
1394 | 1394 | $meses = ['enero', 'febrero', 'marzo', 'abril', 'mayo', 'junio', 'julio', 'agosto', 'septiembre', 'octubre', 'noviembre', 'diciembre']; |
1395 | 1395 | $unixtime = strtotime($date); |
1396 | - $fecha = date(($mostrar_dia?'\D\I\A ':'').'j \d\e \M\E\S \d\e\l Y', $unixtime); |
|
1396 | + $fecha = date(($mostrar_dia ? '\D\I\A ' : '').'j \d\e \M\E\S \d\e\l Y', $unixtime); |
|
1397 | 1397 | $dia = $dias[date('w', $unixtime)]; |
1398 | 1398 | $mes = $meses[date('n', $unixtime)-1]; |
1399 | 1399 | return str_replace(array('DIA', 'MES'), array($dia, $mes), $fecha); |
@@ -567,10 +567,12 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
937 | 950 | */ |
938 | 951 | protected function agregarDetalle($detalle, $x = 10, $html = true) |
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 = []; |
@@ -959,36 +973,42 @@ discard block |
||
959 | 973 | $item['NmbItem'] .= $item['DscItem']; |
960 | 974 | } |
961 | 975 | } |
962 | - if (!in_array($col, $titulos_keys) or ($dte_exento and $col=='IndExe')) |
|
963 | - unset($item[$col]); |
|
976 | + if (!in_array($col, $titulos_keys) or ($dte_exento and $col=='IndExe')) { |
|
977 | + unset($item[$col]); |
|
978 | + } |
|
964 | 979 | } |
965 | 980 | // ajustes a IndExe |
966 | 981 | if (isset($item['IndExe'])) { |
967 | - if ($item['IndExe']==1) |
|
968 | - $item['IndExe'] = 'EX'; |
|
969 | - else if ($item['IndExe']==2) |
|
970 | - $item['IndExe'] = 'NF'; |
|
982 | + if ($item['IndExe']==1) { |
|
983 | + $item['IndExe'] = 'EX'; |
|
984 | + } else if ($item['IndExe']==2) { |
|
985 | + $item['IndExe'] = 'NF'; |
|
986 | + } |
|
971 | 987 | } |
972 | 988 | // agregar todas las columnas que se podrían imprimir en la tabla |
973 | 989 | $item_default = []; |
974 | - foreach ($this->detalle_cols as $key => $info) |
|
975 | - $item_default[$key] = false; |
|
990 | + foreach ($this->detalle_cols as $key => $info) { |
|
991 | + $item_default[$key] = false; |
|
992 | + } |
|
976 | 993 | $item = array_merge($item_default, $item); |
977 | 994 | // si hay código de item se extrae su valor |
978 | - if ($item['CdgItem']) |
|
979 | - $item['CdgItem'] = $item['CdgItem']['VlrCodigo']; |
|
995 | + if ($item['CdgItem']) { |
|
996 | + $item['CdgItem'] = $item['CdgItem']['VlrCodigo']; |
|
997 | + } |
|
980 | 998 | // dar formato a números |
981 | 999 | foreach (['QtyItem', 'PrcItem', 'DescuentoMonto', 'RecargoMonto', 'MontoItem'] as $col) { |
982 | - if ($item[$col]) |
|
983 | - $item[$col] = $this->num($item[$col]); |
|
1000 | + if ($item[$col]) { |
|
1001 | + $item[$col] = $this->num($item[$col]); |
|
1002 | + } |
|
984 | 1003 | } |
985 | 1004 | } |
986 | 1005 | // opciones |
987 | 1006 | $options = ['align'=>[]]; |
988 | 1007 | $i = 0; |
989 | 1008 | foreach ($this->detalle_cols as $info) { |
990 | - if (isset($info['width'])) |
|
991 | - $options['width'][$i] = $info['width']; |
|
1009 | + if (isset($info['width'])) { |
|
1010 | + $options['width'][$i] = $info['width']; |
|
1011 | + } |
|
992 | 1012 | $options['align'][$i] = $info['align']; |
993 | 1013 | $i++; |
994 | 1014 | } |
@@ -1021,8 +1041,9 @@ discard block |
||
1021 | 1041 | $this->Texto($this->detalle_cols['QtyItem']['title'], $x+35, $this->y, ucfirst($this->detalle_cols['QtyItem']['align'][0]), $this->detalle_cols['QtyItem']['width']); |
1022 | 1042 | $this->Texto($this->detalle_cols['MontoItem']['title'], $x+45, $this->y, ucfirst($this->detalle_cols['MontoItem']['align'][0]), $this->detalle_cols['MontoItem']['width']); |
1023 | 1043 | $this->Line($p1x, $p1y+4, $p2x, $p2y+4, $style); |
1024 | - if (!isset($detalle[0])) |
|
1025 | - $detalle = [$detalle]; |
|
1044 | + if (!isset($detalle[0])) { |
|
1045 | + $detalle = [$detalle]; |
|
1046 | + } |
|
1026 | 1047 | $this->SetY($this->getY()+2); |
1027 | 1048 | foreach($detalle as &$d) { |
1028 | 1049 | $this->MultiTexto($d['NmbItem'], $x+1, $this->y+4, ucfirst($this->detalle_cols['NmbItem']['align'][0]), $this->detalle_cols['NmbItem']['width']); |
@@ -1069,8 +1090,9 @@ discard block |
||
1069 | 1090 | */ |
1070 | 1091 | protected function agregarDescuentosRecargos(array $descuentosRecargos, $x = 10) |
1071 | 1092 | { |
1072 | - if (!isset($descuentosRecargos[0])) |
|
1073 | - $descuentosRecargos = [$descuentosRecargos]; |
|
1093 | + if (!isset($descuentosRecargos[0])) { |
|
1094 | + $descuentosRecargos = [$descuentosRecargos]; |
|
1095 | + } |
|
1074 | 1096 | foreach($descuentosRecargos as $dr) { |
1075 | 1097 | $tipo = $dr['TpoMov']=='D' ? 'Descuento' : 'Recargo'; |
1076 | 1098 | if ($dr['IndExeDR']) { |
@@ -1096,8 +1118,9 @@ discard block |
||
1096 | 1118 | */ |
1097 | 1119 | protected function agregarPagos(array $pagos, $x = 10) |
1098 | 1120 | { |
1099 | - if (!isset($pagos[0])) |
|
1100 | - $pagos = [$pagos]; |
|
1121 | + if (!isset($pagos[0])) { |
|
1122 | + $pagos = [$pagos]; |
|
1123 | + } |
|
1101 | 1124 | $this->Texto('Pago(s) programado(s):', $x); |
1102 | 1125 | $this->Ln(); |
1103 | 1126 | foreach($pagos as $p) { |
@@ -1375,11 +1398,13 @@ discard block |
||
1375 | 1398 | */ |
1376 | 1399 | protected function num($n) |
1377 | 1400 | { |
1378 | - if (!is_numeric($n)) |
|
1379 | - return $n; |
|
1401 | + if (!is_numeric($n)) { |
|
1402 | + return $n; |
|
1403 | + } |
|
1380 | 1404 | $broken_number = explode('.', (string)$n); |
1381 | - if (isset($broken_number[1])) |
|
1382 | - return number_format($broken_number[0], 0, ',', '.').','.$broken_number[1]; |
|
1405 | + if (isset($broken_number[1])) { |
|
1406 | + return number_format($broken_number[0], 0, ',', '.').','.$broken_number[1]; |
|
1407 | + } |
|
1383 | 1408 | return number_format($broken_number[0], 0, ',', '.'); |
1384 | 1409 | } |
1385 | 1410 |
@@ -24,7 +24,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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,13 +318,13 @@ discard block |
||
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 | $y = $this->GetY(); |
326 | 326 | // Color and font restoration |
327 | - $this->SetFillColor ( |
|
327 | + $this->SetFillColor( |
|
328 | 328 | $options['bodybackground'][0], |
329 | 329 | $options['bodybackground'][1], |
330 | 330 | $options['bodybackground'][2] |
@@ -349,7 +349,7 @@ discard block |
||
349 | 349 | $this->SetX($x); |
350 | 350 | $y_0 = $this->GetY(); |
351 | 351 | $y_s = []; |
352 | - foreach($headers as $i => $header) { |
|
352 | + foreach ($headers as $i => $header) { |
|
353 | 353 | $x_0 = $this->GetX(); |
354 | 354 | $this->SetXY($x_0, $y_0); |
355 | 355 | list($value1, $value2) = explode("\n", $row[$i]); |
@@ -357,28 +357,28 @@ discard block |
||
357 | 357 | if ($value2) { |
358 | 358 | $this->Ln(); |
359 | 359 | $this->SetX($x_0); |
360 | - $this->SetFont($this->defaultOptions['font']['family'], '', $options['fontsize']-2); |
|
360 | + $this->SetFont($this->defaultOptions['font']['family'], '', $options['fontsize']-2); |
|
361 | 361 | $y_2 = $this->MultiCell($options['width'][$i], $options['height'], $value2, '', $options['align'][$i], false, 0); |
362 | - $this->SetFont($this->defaultOptions['font']['family'], '', $options['fontsize']); |
|
363 | - $y_s[] = $y_1 + $y_2*0.9; |
|
362 | + $this->SetFont($this->defaultOptions['font']['family'], '', $options['fontsize']); |
|
363 | + $y_s[] = $y_1+$y_2 * 0.9; |
|
364 | 364 | } else { |
365 | 365 | $y_s[] = $y_1; |
366 | 366 | } |
367 | 367 | } |
368 | - $this->Ln(max($y_s)*5); |
|
368 | + $this->Ln(max($y_s) * 5); |
|
369 | 369 | // si se pasó a página siguiente se hace rollback y se crea nueva página con cabecera nuevamente en la tabla |
370 | - if($num_pages < $this->getNumPages()) { |
|
370 | + if ($num_pages<$this->getNumPages()) { |
|
371 | 371 | $this->rollbackTransaction(true); |
372 | 372 | $this->AddPage(); |
373 | 373 | $this->SetX($x); |
374 | - foreach($headers as $i => $header) { |
|
374 | + foreach ($headers as $i => $header) { |
|
375 | 375 | $this->Cell($options['width'][$i], $options['height'], $headers[$i], 1, 0, $options['align'][$i], 1); |
376 | 376 | } |
377 | 377 | $this->Ln(); |
378 | 378 | $this->SetX($x); |
379 | 379 | $y_0 = $this->GetY(); |
380 | 380 | $y_s = []; |
381 | - foreach($headers as $i => $header) { |
|
381 | + foreach ($headers as $i => $header) { |
|
382 | 382 | $x_0 = $this->GetX(); |
383 | 383 | $this->SetXY($x_0, $y_0); |
384 | 384 | list($value1, $value2) = explode("\n", $row[$i]); |
@@ -386,15 +386,15 @@ discard block |
||
386 | 386 | if ($value2) { |
387 | 387 | $this->Ln(); |
388 | 388 | $this->SetX($x_0); |
389 | - $this->SetFont($this->defaultOptions['font']['family'], '', $options['fontsize']-2); |
|
389 | + $this->SetFont($this->defaultOptions['font']['family'], '', $options['fontsize']-2); |
|
390 | 390 | $y_2 = $this->MultiCell($options['width'][$i], $options['height'], $value2, '', $options['align'][$i], false, 0); |
391 | - $this->SetFont($this->defaultOptions['font']['family'], '', $options['fontsize']); |
|
392 | - $y_s[] = $y_1 + $y_2*0.9; |
|
391 | + $this->SetFont($this->defaultOptions['font']['family'], '', $options['fontsize']); |
|
392 | + $y_s[] = $y_1+$y_2 * 0.9; |
|
393 | 393 | } else { |
394 | 394 | $y_s[] = $y_1; |
395 | 395 | } |
396 | 396 | } |
397 | - $this->Ln(max($y_s)*5); |
|
397 | + $this->Ln(max($y_s) * 5); |
|
398 | 398 | } else { |
399 | 399 | $this->commitTransaction(); |
400 | 400 | } |
@@ -423,7 +423,7 @@ discard block |
||
423 | 423 | * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]delaf.cl) |
424 | 424 | * @version 2014-09-20 |
425 | 425 | */ |
426 | - public function Texto($txt, $x=null, $y=null, $align='', $w=0, $link='', $border=0, $fill=false) |
|
426 | + public function Texto($txt, $x = null, $y = null, $align = '', $w = 0, $link = '', $border = 0, $fill = false) |
|
427 | 427 | { |
428 | 428 | if ($x==null) $x = $this->GetX(); |
429 | 429 | if ($y==null) $y = $this->GetY(); |
@@ -444,7 +444,7 @@ discard block |
||
444 | 444 | * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]delaf.cl) |
445 | 445 | * @version 2014-09-20 |
446 | 446 | */ |
447 | - public function MultiTexto($txt, $x=null, $y=null, $align='', $w=0, $border=0, $fill=false) |
|
447 | + public function MultiTexto($txt, $x = null, $y = null, $align = '', $w = 0, $border = 0, $fill = false) |
|
448 | 448 | { |
449 | 449 | if ($x==null) $x = $this->GetX(); |
450 | 450 | if ($y==null) $y = $this->GetY(); |