@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | /** |
176 | 176 | * Método que asigna la ubicación del logo de la empresa |
177 | 177 | * @param logo URI del logo (puede ser local o en una URL) |
178 | - * @param posicion Posición respecto a datos del emisor (=0 izq, =1 arriba) |
|
178 | + * @param posicion integer respecto a datos del emisor (=0 izq, =1 arriba) |
|
179 | 179 | * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl) |
180 | 180 | * @version 2016-08-04 |
181 | 181 | */ |
@@ -337,7 +337,7 @@ discard block |
||
337 | 337 | * contínuo |
338 | 338 | * @param dte Arreglo con los datos del XML (tag Documento) |
339 | 339 | * @param timbre String XML con el tag TED del DTE |
340 | - * @param width Ancho del papel contínuo en mm |
|
340 | + * @param width boolean del papel contínuo en mm |
|
341 | 341 | * @author Pablo Reyes (https://github.com/pabloxp) |
342 | 342 | * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl) |
343 | 343 | * @version 2017-09-02 |
@@ -489,10 +489,11 @@ discard block |
||
489 | 489 | * - Dirección casa central del emisor |
490 | 490 | * - Dirección sucursales |
491 | 491 | * @param emisor Arreglo con los datos del emisor (tag Emisor del XML) |
492 | - * @param x Posición horizontal de inicio en el PDF |
|
493 | - * @param y Posición vertical de inicio en el PDF |
|
494 | - * @param w Ancho de la información del emisor |
|
495 | - * @param w_img Ancho máximo de la imagen |
|
492 | + * @param x integer horizontal de inicio en el PDF |
|
493 | + * @param y integer vertical de inicio en el PDF |
|
494 | + * @param w integer de la información del emisor |
|
495 | + * @param w_img integer máximo de la imagen |
|
496 | + * @param integer $font_size |
|
496 | 497 | * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl) |
497 | 498 | * @version 2016-12-02 |
498 | 499 | */ |
@@ -562,11 +563,13 @@ discard block |
||
562 | 563 | * @param rut RUT del emisor |
563 | 564 | * @param tipo Código o glosa del tipo de documento |
564 | 565 | * @param sucursal_sii Código o glosa de la sucursal del SII del Emisor |
565 | - * @param x Posición horizontal de inicio en el PDF |
|
566 | - * @param y Posición vertical de inicio en el PDF |
|
567 | - * @param w Ancho de la información del emisor |
|
566 | + * @param x integer horizontal de inicio en el PDF |
|
567 | + * @param y integer vertical de inicio en el PDF |
|
568 | + * @param w integer de la información del emisor |
|
569 | + * @param integer $font_size |
|
568 | 570 | * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl) |
569 | 571 | * @version 2016-12-02 |
572 | + * @return integer |
|
570 | 573 | */ |
571 | 574 | private function agregarFolio($rut, $tipo, $folio, $sucursal_sii = null, $x = 130, $y = 15, $w = 70, $font_size = null, array $color = null) |
572 | 575 | { |
@@ -612,7 +615,7 @@ discard block |
||
612 | 615 | * Método que agrega los datos de la emisión del DTE que no son los dato del |
613 | 616 | * receptor |
614 | 617 | * @param IdDoc Información general del documento |
615 | - * @param x Posición horizontal de inicio en el PDF |
|
618 | + * @param x integer horizontal de inicio en el PDF |
|
616 | 619 | * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl) |
617 | 620 | * @version 2017-06-15 |
618 | 621 | */ |
@@ -700,7 +703,7 @@ discard block |
||
700 | 703 | /** |
701 | 704 | * Método que agrega los datos del receptor |
702 | 705 | * @param receptor Arreglo con los datos del receptor (tag Receptor del XML) |
703 | - * @param x Posición horizontal de inicio en el PDF |
|
706 | + * @param x integer horizontal de inicio en el PDF |
|
704 | 707 | * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl) |
705 | 708 | * @version 2017-06-15 |
706 | 709 | */ |
@@ -787,7 +790,7 @@ discard block |
||
787 | 790 | * Método que agrega los datos del traslado |
788 | 791 | * @param IndTraslado |
789 | 792 | * @param Transporte |
790 | - * @param x Posición horizontal de inicio en el PDF |
|
793 | + * @param x integer horizontal de inicio en el PDF |
|
791 | 794 | * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl) |
792 | 795 | * @version 2016-08-03 |
793 | 796 | */ |
@@ -858,7 +861,7 @@ discard block |
||
858 | 861 | /** |
859 | 862 | * Método que agrega las referencias del documento |
860 | 863 | * @param referencias Arreglo con las referencias del documento (tag Referencia del XML) |
861 | - * @param x Posición horizontal de inicio en el PDF |
|
864 | + * @param x integer horizontal de inicio en el PDF |
|
862 | 865 | * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl) |
863 | 866 | * @version 2017-08-17 |
864 | 867 | */ |
@@ -891,7 +894,7 @@ discard block |
||
891 | 894 | /** |
892 | 895 | * Método que agrega el detalle del documento |
893 | 896 | * @param detalle Arreglo con el detalle del documento (tag Detalle del XML) |
894 | - * @param x Posición horizontal de inicio en el PDF |
|
897 | + * @param x integer horizontal de inicio en el PDF |
|
895 | 898 | * @param y Posición vertical de inicio en el PDF |
896 | 899 | * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl) |
897 | 900 | * @version 2016-08-05 |
@@ -958,7 +961,7 @@ discard block |
||
958 | 961 | /** |
959 | 962 | * Método que agrega el detalle del documento |
960 | 963 | * @param detalle Arreglo con el detalle del documento (tag Detalle del XML) |
961 | - * @param x Posición horizontal de inicio en el PDF |
|
964 | + * @param x integer horizontal de inicio en el PDF |
|
962 | 965 | * @param y Posición vertical de inicio en el PDF |
963 | 966 | * @author Pablo Reyes (https://github.com/pabloxp) |
964 | 967 | * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl) |
@@ -994,7 +997,7 @@ discard block |
||
994 | 997 | * Método que agrega el subtotal del DTE |
995 | 998 | * @param detalle Arreglo con los detalles del documentos para poder |
996 | 999 | * calcular subtotal |
997 | - * @param x Posición horizontal de inicio en el PDF |
|
1000 | + * @param x integer horizontal de inicio en el PDF |
|
998 | 1001 | * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl) |
999 | 1002 | * @version 2016-08-17 |
1000 | 1003 | */ |
@@ -1020,7 +1023,7 @@ discard block |
||
1020 | 1023 | /** |
1021 | 1024 | * Método que agrega los descuentos y/o recargos globales del documento |
1022 | 1025 | * @param descuentosRecargos Arreglo con los descuentos y/o recargos del documento (tag DscRcgGlobal del XML) |
1023 | - * @param x Posición horizontal de inicio en el PDF |
|
1026 | + * @param x integer horizontal de inicio en el PDF |
|
1024 | 1027 | * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl) |
1025 | 1028 | * @version 2016-08-17 |
1026 | 1029 | */ |
@@ -1044,7 +1047,7 @@ discard block |
||
1044 | 1047 | /** |
1045 | 1048 | * Método que agrega los pagos del documento |
1046 | 1049 | * @param pagos Arreglo con los pagos del documento |
1047 | - * @param x Posición horizontal de inicio en el PDF |
|
1050 | + * @param x integer horizontal de inicio en el PDF |
|
1048 | 1051 | * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl) |
1049 | 1052 | * @version 2016-07-24 |
1050 | 1053 | */ |
@@ -1154,9 +1157,9 @@ discard block |
||
1154 | 1157 | * - Se imprime en el tamaño mínimo: 2x5 cms |
1155 | 1158 | * - En el lado de abajo con margen izquierdo mínimo de 2 cms |
1156 | 1159 | * @param timbre String con los datos del timbre |
1157 | - * @param x Posición horizontal de inicio en el PDF |
|
1158 | - * @param y Posición vertical de inicio en el PDF |
|
1159 | - * @param w Ancho del timbre |
|
1160 | + * @param x integer horizontal de inicio en el PDF |
|
1161 | + * @param y integer vertical de inicio en el PDF |
|
1162 | + * @param w integer del timbre |
|
1160 | 1163 | * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl) |
1161 | 1164 | * @version 2017-07-13 |
1162 | 1165 | */ |
@@ -1193,10 +1196,10 @@ discard block |
||
1193 | 1196 | |
1194 | 1197 | /** |
1195 | 1198 | * Método que agrega el acuse de rebido |
1196 | - * @param x Posición horizontal de inicio en el PDF |
|
1197 | - * @param y Posición vertical de inicio en el PDF |
|
1198 | - * @param w Ancho del acuse de recibo |
|
1199 | - * @param h Alto del acuse de recibo |
|
1199 | + * @param x integer horizontal de inicio en el PDF |
|
1200 | + * @param y integer vertical de inicio en el PDF |
|
1201 | + * @param w integer del acuse de recibo |
|
1202 | + * @param h integer del acuse de recibo |
|
1200 | 1203 | * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl) |
1201 | 1204 | * @version 2015-09-08 |
1202 | 1205 | */ |
@@ -1223,10 +1226,10 @@ discard block |
||
1223 | 1226 | |
1224 | 1227 | /** |
1225 | 1228 | * Método que agrega el acuse de rebido |
1226 | - * @param x Posición horizontal de inicio en el PDF |
|
1229 | + * @param x integer horizontal de inicio en el PDF |
|
1227 | 1230 | * @param y Posición vertical de inicio en el PDF |
1228 | - * @param w Ancho del acuse de recibo |
|
1229 | - * @param h Alto del acuse de recibo |
|
1231 | + * @param w integer del acuse de recibo |
|
1232 | + * @param h integer del acuse de recibo |
|
1230 | 1233 | * @author Pablo Reyes (https://github.com/pabloxp) |
1231 | 1234 | * @version 2015-11-17 |
1232 | 1235 | */ |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | { |
170 | 170 | parent::__construct(); |
171 | 171 | $this->SetTitle('Documento Tributario Electrónico (DTE) de Chile by LibreDTE'); |
172 | - $this->papelContinuo = $papelContinuo === true ? 80 : $papelContinuo; |
|
172 | + $this->papelContinuo = $papelContinuo===true ? 80 : $papelContinuo; |
|
173 | 173 | } |
174 | 174 | |
175 | 175 | /** |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | $this->setY(max($y)); |
305 | 305 | $this->Ln(); |
306 | 306 | $y = []; |
307 | - $y[] = $this->agregarDatosEmision($dte['Encabezado']['IdDoc'], !empty($dte['Encabezado']['Emisor']['CdgVendedor'])?$dte['Encabezado']['Emisor']['CdgVendedor']:null); |
|
307 | + $y[] = $this->agregarDatosEmision($dte['Encabezado']['IdDoc'], !empty($dte['Encabezado']['Emisor']['CdgVendedor']) ? $dte['Encabezado']['Emisor']['CdgVendedor'] : null); |
|
308 | 308 | $y[] = $this->agregarReceptor($dte['Encabezado']); |
309 | 309 | $this->setY(max($y)); |
310 | 310 | $this->agregarTraslado( |
@@ -357,15 +357,15 @@ discard block |
||
357 | 357 | $dte['Encabezado']['IdDoc']['TipoDTE'], |
358 | 358 | $dte['Encabezado']['IdDoc']['Folio'], |
359 | 359 | $dte['Encabezado']['Emisor']['CmnaOrigen'], |
360 | - $x_start, $y_start, $width-($x_start*4), 10, |
|
361 | - [0,0,0] |
|
360 | + $x_start, $y_start, $width-($x_start * 4), 10, |
|
361 | + [0, 0, 0] |
|
362 | 362 | ); |
363 | - $y = $this->agregarEmisor($dte['Encabezado']['Emisor'], $x_start, $y+2, 40, 8, 9, [0,0,0]); |
|
363 | + $y = $this->agregarEmisor($dte['Encabezado']['Emisor'], $x_start, $y+2, 40, 8, 9, [0, 0, 0]); |
|
364 | 364 | // datos del documento |
365 | 365 | $this->SetY($y); |
366 | 366 | $this->Ln(); |
367 | 367 | $this->setFont('', '', 8); |
368 | - $this->agregarDatosEmision($dte['Encabezado']['IdDoc'], !empty($dte['Encabezado']['Emisor']['CdgVendedor'])?$dte['Encabezado']['Emisor']['CdgVendedor']:null, $x_start, $offset, false); |
|
368 | + $this->agregarDatosEmision($dte['Encabezado']['IdDoc'], !empty($dte['Encabezado']['Emisor']['CdgVendedor']) ? $dte['Encabezado']['Emisor']['CdgVendedor'] : null, $x_start, $offset, false); |
|
369 | 369 | $this->agregarReceptor($dte['Encabezado'], $x_start, $offset); |
370 | 370 | $this->agregarTraslado( |
371 | 371 | !empty($dte['Encabezado']['IdDoc']['IndTraslado']) ? $dte['Encabezado']['IdDoc']['IndTraslado'] : null, |
@@ -418,7 +418,7 @@ discard block |
||
418 | 418 | $this->AddPage('P', [$height ? $height : $this->papel_continuo_alto, $width]); |
419 | 419 | $x = 1; |
420 | 420 | $y = 5; |
421 | - $this->SetXY($x,$y); |
|
421 | + $this->SetXY($x, $y); |
|
422 | 422 | // agregar datos del documento |
423 | 423 | $this->setFont('', '', 8); |
424 | 424 | $this->MultiTexto(!empty($dte['Encabezado']['Emisor']['RznSoc']) ? $dte['Encabezado']['Emisor']['RznSoc'] : $dte['Encabezado']['Emisor']['RznSocEmisor'], $x, null, '', $width-2); |
@@ -504,13 +504,13 @@ discard block |
||
504 | 504 | $this->logo['uri'], |
505 | 505 | $x, |
506 | 506 | $y, |
507 | - !$this->logo['posicion']?$w_img:null, $this->logo['posicion']?($w_img/2):null, |
|
507 | + !$this->logo['posicion'] ? $w_img : null, $this->logo['posicion'] ? ($w_img / 2) : null, |
|
508 | 508 | 'PNG', |
509 | - (isset($emisor['url'])?$emisor['url']:''), |
|
509 | + (isset($emisor['url']) ? $emisor['url'] : ''), |
|
510 | 510 | 'T' |
511 | 511 | ); |
512 | 512 | if ($this->logo['posicion']) { |
513 | - $this->SetY($this->y + ($w_img/2)); |
|
513 | + $this->SetY($this->y+($w_img / 2)); |
|
514 | 514 | $w += 40; |
515 | 515 | } else { |
516 | 516 | $x = $this->x+3; |
@@ -521,13 +521,13 @@ discard block |
||
521 | 521 | } |
522 | 522 | // agregar datos del emisor |
523 | 523 | $this->setFont('', 'B', $font_size ? $font_size : 14); |
524 | - $this->SetTextColorArray($color===null?[32, 92, 144]:$color); |
|
524 | + $this->SetTextColorArray($color===null ? [32, 92, 144] : $color); |
|
525 | 525 | $this->MultiTexto(!empty($emisor['RznSoc']) ? $emisor['RznSoc'] : $emisor['RznSocEmisor'], $x, $this->y+2, 'L', $w); |
526 | 526 | $this->setFont('', 'B', $font_size ? $font_size : 9); |
527 | - $this->SetTextColorArray([0,0,0]); |
|
527 | + $this->SetTextColorArray([0, 0, 0]); |
|
528 | 528 | $this->MultiTexto(!empty($emisor['GiroEmis']) ? $emisor['GiroEmis'] : $emisor['GiroEmisor'], $x, $this->y, 'L', $w); |
529 | 529 | $ciudad = !empty($emisor['CiudadOrigen']) ? $emisor['CiudadOrigen'] : \sasco\LibreDTE\Chile::getCiudad($emisor['CmnaOrigen']); |
530 | - $this->MultiTexto($emisor['DirOrigen'].', '.$emisor['CmnaOrigen'].($ciudad?(', '.$ciudad):''), $x, $this->y, 'L', $w); |
|
530 | + $this->MultiTexto($emisor['DirOrigen'].', '.$emisor['CmnaOrigen'].($ciudad ? (', '.$ciudad) : ''), $x, $this->y, 'L', $w); |
|
531 | 531 | if (!empty($emisor['Sucursal'])) { |
532 | 532 | $this->MultiTexto('Sucursal: '.$emisor['Sucursal'], $x, $this->y, 'L', $w); |
533 | 533 | } |
@@ -571,12 +571,12 @@ discard block |
||
571 | 571 | private function agregarFolio($rut, $tipo, $folio, $sucursal_sii = null, $x = 130, $y = 15, $w = 70, $font_size = null, array $color = null) |
572 | 572 | { |
573 | 573 | if ($color===null) { |
574 | - $color = $tipo ? ($tipo==52 ? [0,172,140] : [255,0,0]) : [0,0,0]; |
|
574 | + $color = $tipo ? ($tipo==52 ? [0, 172, 140] : [255, 0, 0]) : [0, 0, 0]; |
|
575 | 575 | } |
576 | 576 | $this->SetTextColorArray($color); |
577 | 577 | // colocar rut emisor, glosa documento y folio |
578 | 578 | list($rut, $dv) = explode('-', $rut); |
579 | - $this->setFont ('', 'B', $font_size ? $font_size : 15); |
|
579 | + $this->setFont('', 'B', $font_size ? $font_size : 15); |
|
580 | 580 | $this->MultiTexto('R.U.T.: '.$this->num($rut).'-'.$dv, $x, $y+4, 'C', $w); |
581 | 581 | $this->setFont('', 'B', $font_size ? $font_size : 12); |
582 | 582 | $this->MultiTexto($this->getTipo($tipo), $x, null, 'C', $w); |
@@ -589,7 +589,7 @@ discard block |
||
589 | 589 | if ($tipo) { |
590 | 590 | $this->Texto('S.I.I. - '.\sasco\LibreDTE\Sii::getDireccionRegional($sucursal_sii), $x, $this->getY()+4, 'C', $w); |
591 | 591 | } |
592 | - $this->SetTextColorArray([0,0,0]); |
|
592 | + $this->SetTextColorArray([0, 0, 0]); |
|
593 | 593 | $this->Ln(); |
594 | 594 | return $this->y; |
595 | 595 | } |
@@ -720,7 +720,7 @@ discard block |
||
720 | 720 | $this->Texto('Señor(es)', $x); |
721 | 721 | $this->Texto(':', $x+$offset); |
722 | 722 | $this->setFont('', '', null); |
723 | - $this->MultiTexto($receptor['RznSocRecep'], $x+$offset+2, null, '', $x==10?105:0); |
|
723 | + $this->MultiTexto($receptor['RznSocRecep'], $x+$offset+2, null, '', $x==10 ? 105 : 0); |
|
724 | 724 | } |
725 | 725 | if (!empty($receptor['GiroRecep'])) { |
726 | 726 | $this->setFont('', 'B', null); |
@@ -737,7 +737,7 @@ discard block |
||
737 | 737 | $ciudad = !empty($receptor['CiudadRecep']) ? $receptor['CiudadRecep'] : ( |
738 | 738 | !empty($receptor['CmnaRecep']) ? \sasco\LibreDTE\Chile::getCiudad($receptor['CmnaRecep']) : '' |
739 | 739 | ); |
740 | - $this->MultiTexto($receptor['DirRecep'].(!empty($receptor['CmnaRecep'])?(', '.$receptor['CmnaRecep']):'').($ciudad?(', '.$ciudad):''), $x+$offset+2); |
|
740 | + $this->MultiTexto($receptor['DirRecep'].(!empty($receptor['CmnaRecep']) ? (', '.$receptor['CmnaRecep']) : '').($ciudad ? (', '.$ciudad) : ''), $x+$offset+2); |
|
741 | 741 | } |
742 | 742 | if (!empty($receptor['Extranjero']['Nacionalidad'])) { |
743 | 743 | $this->setFont('', 'B', null); |
@@ -778,7 +778,7 @@ discard block |
||
778 | 778 | $this->Texto('Cód. recep.', $x); |
779 | 779 | $this->Texto(':', $x+$offset); |
780 | 780 | $this->setFont('', '', null); |
781 | - $this->MultiTexto($receptor['CdgIntRecep'], $x+$offset+2, null, '', $x==10?105:0); |
|
781 | + $this->MultiTexto($receptor['CdgIntRecep'], $x+$offset+2, null, '', $x==10 ? 105 : 0); |
|
782 | 782 | } |
783 | 783 | return $this->GetY(); |
784 | 784 | } |
@@ -866,7 +866,7 @@ discard block |
||
866 | 866 | { |
867 | 867 | if (!isset($referencias[0])) |
868 | 868 | $referencias = [$referencias]; |
869 | - foreach($referencias as $r) { |
|
869 | + foreach ($referencias as $r) { |
|
870 | 870 | $texto = $r['NroLinRef'].' - '; |
871 | 871 | if (!empty($r['TpoDocRef'])) { |
872 | 872 | $texto .= $this->getTipo($r['TpoDocRef']).' '; |
@@ -969,9 +969,9 @@ discard block |
||
969 | 969 | $this->SetY($this->getY()+1); |
970 | 970 | $p1x = $x; |
971 | 971 | $p1y = $this->y; |
972 | - $p2x = $this->getPageWidth() - 2; |
|
973 | - $p2y = $p1y; // Use same y for a straight line |
|
974 | - $style = array('width' => 0.2,'color' => array(0, 0, 0)); |
|
972 | + $p2x = $this->getPageWidth()-2; |
|
973 | + $p2y = $p1y; // Use same y for a straight line |
|
974 | + $style = array('width' => 0.2, 'color' => array(0, 0, 0)); |
|
975 | 975 | $this->Line($p1x, $p1y, $p2x, $p2y, $style); |
976 | 976 | $this->Texto($this->detalle_cols['NmbItem']['title'], $x+1, $this->y, ucfirst($this->detalle_cols['NmbItem']['align'][0]), $this->detalle_cols['NmbItem']['width']); |
977 | 977 | $this->Texto($this->detalle_cols['PrcItem']['title'], $x+15, $this->y, ucfirst($this->detalle_cols['PrcItem']['align'][0]), $this->detalle_cols['PrcItem']['width']); |
@@ -981,9 +981,9 @@ discard block |
||
981 | 981 | if (!isset($detalle[0])) |
982 | 982 | $detalle = [$detalle]; |
983 | 983 | $this->SetY($this->getY()+2); |
984 | - foreach($detalle as &$d) { |
|
984 | + foreach ($detalle as &$d) { |
|
985 | 985 | $this->MultiTexto($d['NmbItem'], $x+1, $this->y+4, ucfirst($this->detalle_cols['NmbItem']['align'][0]), $this->detalle_cols['NmbItem']['width']); |
986 | - $this->Texto(number_format($d['PrcItem'],0,',','.'), $x+15, $this->y, ucfirst($this->detalle_cols['PrcItem']['align'][0]), $this->detalle_cols['PrcItem']['width']); |
|
986 | + $this->Texto(number_format($d['PrcItem'], 0, ',', '.'), $x+15, $this->y, ucfirst($this->detalle_cols['PrcItem']['align'][0]), $this->detalle_cols['PrcItem']['width']); |
|
987 | 987 | $this->Texto($this->num($d['QtyItem']), $x+35, $this->y, ucfirst($this->detalle_cols['QtyItem']['align'][0]), $this->detalle_cols['QtyItem']['width']); |
988 | 988 | $this->Texto($this->num($d['MontoItem']), $x+45, $this->y, ucfirst($this->detalle_cols['MontoItem']['align'][0]), $this->detalle_cols['MontoItem']['width']); |
989 | 989 | } |
@@ -1003,7 +1003,7 @@ discard block |
||
1003 | 1003 | if (!isset($detalle[0])) { |
1004 | 1004 | $detalle = [$detalle]; |
1005 | 1005 | } |
1006 | - foreach($detalle as &$d) { |
|
1006 | + foreach ($detalle as &$d) { |
|
1007 | 1007 | if (!empty($d['MontoItem'])) { |
1008 | 1008 | $subtotal += $d['MontoItem']; |
1009 | 1009 | } |
@@ -1028,13 +1028,13 @@ discard block |
||
1028 | 1028 | { |
1029 | 1029 | if (!isset($descuentosRecargos[0])) |
1030 | 1030 | $descuentosRecargos = [$descuentosRecargos]; |
1031 | - foreach($descuentosRecargos as $dr) { |
|
1031 | + foreach ($descuentosRecargos as $dr) { |
|
1032 | 1032 | $tipo = $dr['TpoMov']=='D' ? 'Descuento' : 'Recargo'; |
1033 | 1033 | $valor = $dr['TpoValor']=='%' ? $dr['ValorDR'].'%' : $this->num($dr['ValorDR']); |
1034 | 1034 | if ($this->papelContinuo) { |
1035 | - $this->Texto($tipo.' global: '.$valor.(!empty($dr['GlosaDR'])?(' ('.$dr['GlosaDR'].')'):''), $x); |
|
1035 | + $this->Texto($tipo.' global: '.$valor.(!empty($dr['GlosaDR']) ? (' ('.$dr['GlosaDR'].')') : ''), $x); |
|
1036 | 1036 | } else { |
1037 | - $this->Texto($tipo.(!empty($dr['GlosaDR'])?(' ('.$dr['GlosaDR'].')'):'').':', 77, null, 'R', 100); |
|
1037 | + $this->Texto($tipo.(!empty($dr['GlosaDR']) ? (' ('.$dr['GlosaDR'].')') : '').':', 77, null, 'R', 100); |
|
1038 | 1038 | $this->Texto($valor, 177, null, 'R', 22); |
1039 | 1039 | } |
1040 | 1040 | $this->Ln(); |
@@ -1054,8 +1054,8 @@ discard block |
||
1054 | 1054 | $pagos = [$pagos]; |
1055 | 1055 | $this->Texto('Pago(s) programado(s):', $x); |
1056 | 1056 | $this->Ln(); |
1057 | - foreach($pagos as $p) { |
|
1058 | - $this->Texto(' - '.$this->date($p['FchPago'], false).': $'.$this->num($p['MntPago']).'.-'.(!empty($p['GlosaPagos'])?(' ('.$p['GlosaPagos'].')'):''), $x); |
|
1057 | + foreach ($pagos as $p) { |
|
1058 | + $this->Texto(' - '.$this->date($p['FchPago'], false).': $'.$this->num($p['MntPago']).'.-'.(!empty($p['GlosaPagos']) ? (' ('.$p['GlosaPagos'].')') : ''), $x); |
|
1059 | 1059 | $this->Ln(); |
1060 | 1060 | } |
1061 | 1061 | } |
@@ -1105,7 +1105,7 @@ discard block |
||
1105 | 1105 | if (!isset($ImptoReten[0])) { |
1106 | 1106 | $ImptoReten = [$ImptoReten]; |
1107 | 1107 | } |
1108 | - foreach($ImptoReten as $i) { |
|
1108 | + foreach ($ImptoReten as $i) { |
|
1109 | 1109 | $totales['ImptoReten_'.$i['TipoImp']] = $i['MontoImp']; |
1110 | 1110 | if (!empty($i['TasaImp'])) { |
1111 | 1111 | $glosas['ImptoReten_'.$i['TipoImp']] = \sasco\LibreDTE\Sii\ImpuestosAdicionales::getGlosa($i['TipoImp']).' ('.$i['TasaImp'].'%) $'; |
@@ -1170,7 +1170,7 @@ discard block |
||
1170 | 1170 | 'vpadding' => 0, |
1171 | 1171 | 'module_width' => 1, // width of a single module in points |
1172 | 1172 | 'module_height' => 1, // height of a single module in points |
1173 | - 'fgcolor' => [0,0,0], |
|
1173 | + 'fgcolor' => [0, 0, 0], |
|
1174 | 1174 | 'bgcolor' => false, // [255,255,255] |
1175 | 1175 | 'position' => $this->papelContinuo ? 'C' : 'S', |
1176 | 1176 | ]; |
@@ -1202,7 +1202,7 @@ discard block |
||
1202 | 1202 | */ |
1203 | 1203 | private function agregarAcuseRecibo($x = 93, $y = 190, $w = 50, $h = 40) |
1204 | 1204 | { |
1205 | - $this->SetTextColorArray([0,0,0]); |
|
1205 | + $this->SetTextColorArray([0, 0, 0]); |
|
1206 | 1206 | $this->Rect($x, $y, $w, $h, 'D', ['all' => ['width' => 0.1, 'color' => [0, 0, 0]]]); |
1207 | 1207 | $this->setFont('', 'B', 10); |
1208 | 1208 | $this->Texto('Acuse de recibo', $x, $y+1, 'C', $w); |
@@ -1232,9 +1232,9 @@ discard block |
||
1232 | 1232 | */ |
1233 | 1233 | private function agregarAcuseReciboContinuo($x = 3, $y = null, $w = 68, $h = 40) |
1234 | 1234 | { |
1235 | - $this->SetTextColorArray([0,0,0]); |
|
1235 | + $this->SetTextColorArray([0, 0, 0]); |
|
1236 | 1236 | $this->Rect($x, $y, $w, $h, 'D', ['all' => ['width' => 0.1, 'color' => [0, 0, 0]]]); |
1237 | - $style = array('width' => 0.2,'color' => array(0, 0, 0)); |
|
1237 | + $style = array('width' => 0.2, 'color' => array(0, 0, 0)); |
|
1238 | 1238 | $this->Line($x, $y+22, $w+3, $y+22, $style); |
1239 | 1239 | //$this->setFont('', 'B', 10); |
1240 | 1240 | //$this->Texto('Acuse de recibo', $x, $y+1, 'C', $w); |
@@ -1262,7 +1262,7 @@ discard block |
||
1262 | 1262 | private function agregarLeyendaDestino($tipo, $y = 254, $font_size = 10) |
1263 | 1263 | { |
1264 | 1264 | $this->setFont('', 'B', $font_size); |
1265 | - $this->Texto('CEDIBLE'.($tipo==52?' CON SU FACTURA':''), null, $y, 'R'); |
|
1265 | + $this->Texto('CEDIBLE'.($tipo==52 ? ' CON SU FACTURA' : ''), null, $y, 'R'); |
|
1266 | 1266 | } |
1267 | 1267 | |
1268 | 1268 | /** |
@@ -1293,7 +1293,7 @@ discard block |
||
1293 | 1293 | $dias = ['Domingo', 'Lunes', 'Martes', 'Miércoles', 'Jueves', 'Viernes', 'Sábado']; |
1294 | 1294 | $meses = ['enero', 'febrero', 'marzo', 'abril', 'mayo', 'junio', 'julio', 'agosto', 'septiembre', 'octubre', 'noviembre', 'diciembre']; |
1295 | 1295 | $unixtime = strtotime($date); |
1296 | - $fecha = date(($mostrar_dia?'\D\I\A ':'').'j \d\e \M\E\S \d\e\l Y', $unixtime); |
|
1296 | + $fecha = date(($mostrar_dia ? '\D\I\A ' : '').'j \d\e \M\E\S \d\e\l Y', $unixtime); |
|
1297 | 1297 | $dia = $dias[date('w', $unixtime)]; |
1298 | 1298 | $mes = $meses[date('n', $unixtime)-1]; |
1299 | 1299 | return str_replace(array('DIA', 'MES'), array($dia, $mes), $fecha); |
@@ -311,15 +311,17 @@ discard block |
||
311 | 311 | !empty($dte['Encabezado']['IdDoc']['IndTraslado']) ? $dte['Encabezado']['IdDoc']['IndTraslado'] : null, |
312 | 312 | !empty($dte['Encabezado']['Transporte']) ? $dte['Encabezado']['Transporte'] : null |
313 | 313 | ); |
314 | - if (!empty($dte['Referencia'])) |
|
315 | - $this->agregarReferencia($dte['Referencia']); |
|
314 | + if (!empty($dte['Referencia'])) { |
|
315 | + $this->agregarReferencia($dte['Referencia']); |
|
316 | + } |
|
316 | 317 | $this->agregarDetalle($dte['Detalle']); |
317 | 318 | if (!empty($dte['DscRcgGlobal'])) { |
318 | 319 | $this->agregarSubTotal($dte['Detalle']); |
319 | 320 | $this->agregarDescuentosRecargos($dte['DscRcgGlobal']); |
320 | 321 | } |
321 | - if (!empty($dte['Encabezado']['IdDoc']['MntPagos'])) |
|
322 | - $this->agregarPagos($dte['Encabezado']['IdDoc']['MntPagos']); |
|
322 | + if (!empty($dte['Encabezado']['IdDoc']['MntPagos'])) { |
|
323 | + $this->agregarPagos($dte['Encabezado']['IdDoc']['MntPagos']); |
|
324 | + } |
|
323 | 325 | $this->agregarTotales($dte['Encabezado']['Totales']); |
324 | 326 | // agregar observaciones |
325 | 327 | $this->agregarObservacion($dte['Encabezado']['IdDoc']); |
@@ -533,10 +535,12 @@ discard block |
||
533 | 535 | } |
534 | 536 | $contacto = []; |
535 | 537 | if (!empty($emisor['Telefono'])) { |
536 | - if (!is_array($emisor['Telefono'])) |
|
537 | - $emisor['Telefono'] = [$emisor['Telefono']]; |
|
538 | - foreach ($emisor['Telefono'] as $t) |
|
539 | - $contacto[] = $t; |
|
538 | + if (!is_array($emisor['Telefono'])) { |
|
539 | + $emisor['Telefono'] = [$emisor['Telefono']]; |
|
540 | + } |
|
541 | + foreach ($emisor['Telefono'] as $t) { |
|
542 | + $contacto[] = $t; |
|
543 | + } |
|
540 | 544 | } |
541 | 545 | if (!empty($emisor['CorreoEmisor'])) { |
542 | 546 | $contacto[] = $emisor['CorreoEmisor']; |
@@ -603,8 +607,9 @@ discard block |
||
603 | 607 | */ |
604 | 608 | private function getTipo($tipo) |
605 | 609 | { |
606 | - if (!is_numeric($tipo) and !isset($this->tipos[$tipo])) |
|
607 | - return $tipo; |
|
610 | + if (!is_numeric($tipo) and !isset($this->tipos[$tipo])) { |
|
611 | + return $tipo; |
|
612 | + } |
|
608 | 613 | return isset($this->tipos[$tipo]) ? strtoupper($this->tipos[$tipo]) : 'Documento '.$tipo; |
609 | 614 | } |
610 | 615 | |
@@ -754,10 +759,12 @@ discard block |
||
754 | 759 | $this->MultiTexto($receptor['Extranjero']['NumId'], $x+$offset+2); |
755 | 760 | } |
756 | 761 | $contacto = []; |
757 | - if (!empty($receptor['Contacto'])) |
|
758 | - $contacto[] = $receptor['Contacto']; |
|
759 | - if (!empty($receptor['CorreoRecep'])) |
|
760 | - $contacto[] = $receptor['CorreoRecep']; |
|
762 | + if (!empty($receptor['Contacto'])) { |
|
763 | + $contacto[] = $receptor['Contacto']; |
|
764 | + } |
|
765 | + if (!empty($receptor['CorreoRecep'])) { |
|
766 | + $contacto[] = $receptor['CorreoRecep']; |
|
767 | + } |
|
761 | 768 | if (!empty($contacto)) { |
762 | 769 | $this->setFont('', 'B', null); |
763 | 770 | $this->Texto('Contacto', $x); |
@@ -807,15 +814,19 @@ discard block |
||
807 | 814 | if (!empty($Transporte['DirDest']) and !empty($Transporte['CmnaDest'])) { |
808 | 815 | $transporte .= 'a '.$Transporte['DirDest'].', '.$Transporte['CmnaDest']; |
809 | 816 | } |
810 | - if (!empty($Transporte['RUTTrans'])) |
|
811 | - $transporte .= ' por '.$Transporte['RUTTrans']; |
|
812 | - if (!empty($Transporte['Patente'])) |
|
813 | - $transporte .= ' en vehículo '.$Transporte['Patente']; |
|
817 | + if (!empty($Transporte['RUTTrans'])) { |
|
818 | + $transporte .= ' por '.$Transporte['RUTTrans']; |
|
819 | + } |
|
820 | + if (!empty($Transporte['Patente'])) { |
|
821 | + $transporte .= ' en vehículo '.$Transporte['Patente']; |
|
822 | + } |
|
814 | 823 | if (isset($Transporte['Chofer']) and is_array($Transporte['Chofer'])) { |
815 | - if (!empty($Transporte['Chofer']['NombreChofer'])) |
|
816 | - $transporte .= ' con chofer '.$Transporte['Chofer']['NombreChofer']; |
|
817 | - if (!empty($Transporte['Chofer']['RUTChofer'])) |
|
818 | - $transporte .= ' ('.$Transporte['Chofer']['RUTChofer'].')'; |
|
824 | + if (!empty($Transporte['Chofer']['NombreChofer'])) { |
|
825 | + $transporte .= ' con chofer '.$Transporte['Chofer']['NombreChofer']; |
|
826 | + } |
|
827 | + if (!empty($Transporte['Chofer']['RUTChofer'])) { |
|
828 | + $transporte .= ' ('.$Transporte['Chofer']['RUTChofer'].')'; |
|
829 | + } |
|
819 | 830 | } |
820 | 831 | if ($transporte) { |
821 | 832 | $this->setFont('', 'B', null); |
@@ -829,8 +840,9 @@ discard block |
||
829 | 840 | if (!empty($Transporte['Aduana']) and is_array($Transporte['Aduana'])) { |
830 | 841 | $col = 0; |
831 | 842 | foreach ($Transporte['Aduana'] as $tag => $codigo) { |
832 | - if ($codigo===false) |
|
833 | - continue; |
|
843 | + if ($codigo===false) { |
|
844 | + continue; |
|
845 | + } |
|
834 | 846 | $glosa = \sasco\LibreDTE\Sii\Aduana::getGlosa($tag); |
835 | 847 | $valor = \sasco\LibreDTE\Sii\Aduana::getValor($tag, $codigo); |
836 | 848 | if ($glosa!==false and $valor!==false) { |
@@ -843,15 +855,18 @@ discard block |
||
843 | 855 | $this->Texto(':', $x+$offset+$col); |
844 | 856 | $this->setFont('', '', null); |
845 | 857 | $this->Texto($valor, $x+$offset+2+$col); |
846 | - if ($tag=='TipoBultos') |
|
847 | - $col = abs($col-110); |
|
848 | - if ($col) |
|
849 | - $this->Ln(); |
|
858 | + if ($tag=='TipoBultos') { |
|
859 | + $col = abs($col-110); |
|
860 | + } |
|
861 | + if ($col) { |
|
862 | + $this->Ln(); |
|
863 | + } |
|
850 | 864 | $col = abs($col-110); |
851 | 865 | } |
852 | 866 | } |
853 | - if ($col) |
|
854 | - $this->Ln(); |
|
867 | + if ($col) { |
|
868 | + $this->Ln(); |
|
869 | + } |
|
855 | 870 | } |
856 | 871 | } |
857 | 872 | |
@@ -864,8 +879,9 @@ discard block |
||
864 | 879 | */ |
865 | 880 | private function agregarReferencia($referencias, $x = 10, $offset = 22) |
866 | 881 | { |
867 | - if (!isset($referencias[0])) |
|
868 | - $referencias = [$referencias]; |
|
882 | + if (!isset($referencias[0])) { |
|
883 | + $referencias = [$referencias]; |
|
884 | + } |
|
869 | 885 | foreach($referencias as $r) { |
870 | 886 | $texto = $r['NroLinRef'].' - '; |
871 | 887 | if (!empty($r['TpoDocRef'])) { |
@@ -898,8 +914,9 @@ discard block |
||
898 | 914 | */ |
899 | 915 | private function agregarDetalle($detalle, $x = 10) |
900 | 916 | { |
901 | - if (!isset($detalle[0])) |
|
902 | - $detalle = [$detalle]; |
|
917 | + if (!isset($detalle[0])) { |
|
918 | + $detalle = [$detalle]; |
|
919 | + } |
|
903 | 920 | $this->setFont('', '', $this->detalle_fuente); |
904 | 921 | // titulos |
905 | 922 | $titulos = []; |
@@ -916,36 +933,42 @@ discard block |
||
916 | 933 | $item['NmbItem'] .= !$this->item_detalle_posicion ? '<br/>' : ': '; |
917 | 934 | $item['NmbItem'] .= '<span style="font-size:0.7em">'.$item['DscItem'].'</span>'; |
918 | 935 | } |
919 | - if (!in_array($col, $titulos_keys) or ($dte_exento and $col=='IndExe')) |
|
920 | - unset($item[$col]); |
|
936 | + if (!in_array($col, $titulos_keys) or ($dte_exento and $col=='IndExe')) { |
|
937 | + unset($item[$col]); |
|
938 | + } |
|
921 | 939 | } |
922 | 940 | // ajustes a IndExe |
923 | 941 | if (isset($item['IndExe'])) { |
924 | - if ($item['IndExe']==1) |
|
925 | - $item['IndExe'] = 'EX'; |
|
926 | - else if ($item['IndExe']==2) |
|
927 | - $item['IndExe'] = 'NF'; |
|
942 | + if ($item['IndExe']==1) { |
|
943 | + $item['IndExe'] = 'EX'; |
|
944 | + } else if ($item['IndExe']==2) { |
|
945 | + $item['IndExe'] = 'NF'; |
|
946 | + } |
|
928 | 947 | } |
929 | 948 | // agregar todas las columnas que se podrían imprimir en la tabla |
930 | 949 | $item_default = []; |
931 | - foreach ($this->detalle_cols as $key => $info) |
|
932 | - $item_default[$key] = false; |
|
950 | + foreach ($this->detalle_cols as $key => $info) { |
|
951 | + $item_default[$key] = false; |
|
952 | + } |
|
933 | 953 | $item = array_merge($item_default, $item); |
934 | 954 | // si hay código de item se extrae su valor |
935 | - if ($item['CdgItem']) |
|
936 | - $item['CdgItem'] = $item['CdgItem']['VlrCodigo']; |
|
955 | + if ($item['CdgItem']) { |
|
956 | + $item['CdgItem'] = $item['CdgItem']['VlrCodigo']; |
|
957 | + } |
|
937 | 958 | // dar formato a números |
938 | 959 | foreach (['QtyItem', 'PrcItem', 'DescuentoMonto', 'RecargoMonto', 'MontoItem'] as $col) { |
939 | - if ($item[$col]) |
|
940 | - $item[$col] = $this->num($item[$col]); |
|
960 | + if ($item[$col]) { |
|
961 | + $item[$col] = $this->num($item[$col]); |
|
962 | + } |
|
941 | 963 | } |
942 | 964 | } |
943 | 965 | // opciones |
944 | 966 | $options = ['align'=>[]]; |
945 | 967 | $i = 0; |
946 | 968 | foreach ($this->detalle_cols as $info) { |
947 | - if (isset($info['width'])) |
|
948 | - $options['width'][$i] = $info['width']; |
|
969 | + if (isset($info['width'])) { |
|
970 | + $options['width'][$i] = $info['width']; |
|
971 | + } |
|
949 | 972 | $options['align'][$i] = $info['align']; |
950 | 973 | $i++; |
951 | 974 | } |
@@ -978,8 +1001,9 @@ discard block |
||
978 | 1001 | $this->Texto($this->detalle_cols['QtyItem']['title'], $x+35, $this->y, ucfirst($this->detalle_cols['QtyItem']['align'][0]), $this->detalle_cols['QtyItem']['width']); |
979 | 1002 | $this->Texto($this->detalle_cols['MontoItem']['title'], $x+45, $this->y, ucfirst($this->detalle_cols['MontoItem']['align'][0]), $this->detalle_cols['MontoItem']['width']); |
980 | 1003 | $this->Line($p1x, $p1y+4, $p2x, $p2y+4, $style); |
981 | - if (!isset($detalle[0])) |
|
982 | - $detalle = [$detalle]; |
|
1004 | + if (!isset($detalle[0])) { |
|
1005 | + $detalle = [$detalle]; |
|
1006 | + } |
|
983 | 1007 | $this->SetY($this->getY()+2); |
984 | 1008 | foreach($detalle as &$d) { |
985 | 1009 | $this->MultiTexto($d['NmbItem'], $x+1, $this->y+4, ucfirst($this->detalle_cols['NmbItem']['align'][0]), $this->detalle_cols['NmbItem']['width']); |
@@ -1026,8 +1050,9 @@ discard block |
||
1026 | 1050 | */ |
1027 | 1051 | private function agregarDescuentosRecargos(array $descuentosRecargos, $x = 10) |
1028 | 1052 | { |
1029 | - if (!isset($descuentosRecargos[0])) |
|
1030 | - $descuentosRecargos = [$descuentosRecargos]; |
|
1053 | + if (!isset($descuentosRecargos[0])) { |
|
1054 | + $descuentosRecargos = [$descuentosRecargos]; |
|
1055 | + } |
|
1031 | 1056 | foreach($descuentosRecargos as $dr) { |
1032 | 1057 | $tipo = $dr['TpoMov']=='D' ? 'Descuento' : 'Recargo'; |
1033 | 1058 | $valor = $dr['TpoValor']=='%' ? $dr['ValorDR'].'%' : $this->num($dr['ValorDR']); |
@@ -1050,8 +1075,9 @@ discard block |
||
1050 | 1075 | */ |
1051 | 1076 | private function agregarPagos(array $pagos, $x = 10) |
1052 | 1077 | { |
1053 | - if (!isset($pagos[0])) |
|
1054 | - $pagos = [$pagos]; |
|
1078 | + if (!isset($pagos[0])) { |
|
1079 | + $pagos = [$pagos]; |
|
1080 | + } |
|
1055 | 1081 | $this->Texto('Pago(s) programado(s):', $x); |
1056 | 1082 | $this->Ln(); |
1057 | 1083 | foreach($pagos as $p) { |
@@ -1275,11 +1301,13 @@ discard block |
||
1275 | 1301 | */ |
1276 | 1302 | private function num($n) |
1277 | 1303 | { |
1278 | - if (!is_numeric($n)) |
|
1279 | - return $n; |
|
1304 | + if (!is_numeric($n)) { |
|
1305 | + return $n; |
|
1306 | + } |
|
1280 | 1307 | $broken_number = explode('.', (string)$n); |
1281 | - if (isset($broken_number[1])) |
|
1282 | - return number_format($broken_number[0], 0, ',', '.').','.$broken_number[1]; |
|
1308 | + if (isset($broken_number[1])) { |
|
1309 | + return number_format($broken_number[0], 0, ',', '.').','.$broken_number[1]; |
|
1310 | + } |
|
1283 | 1311 | return number_format($broken_number[0], 0, ',', '.'); |
1284 | 1312 | } |
1285 | 1313 |