@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | /** |
80 | 80 | * Método que asigna la ubicación del logo de la empresa |
81 | 81 | * @param logo URI del logo (puede ser local o en una URL) |
82 | - * @param posicion Posición respecto a datos del emisor (=0 izq, =1 arriba). Nota: parámetro válido sólo para formato hoja carta |
|
82 | + * @param posicion integer respecto a datos del emisor (=0 izq, =1 arriba). Nota: parámetro válido sólo para formato hoja carta |
|
83 | 83 | * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl) |
84 | 84 | * @version 2016-08-04 |
85 | 85 | */ |
@@ -322,7 +322,7 @@ discard block |
||
322 | 322 | * contínuo de 80mm |
323 | 323 | * @param dte Arreglo con los datos del XML (tag Documento) |
324 | 324 | * @param timbre String XML con el tag TED del DTE |
325 | - * @param width Ancho del papel contínuo en mm (es parámetro porque se usa el mismo método para 75mm) |
|
325 | + * @param width integer del papel contínuo en mm (es parámetro porque se usa el mismo método para 75mm) |
|
326 | 326 | * @author Pablo Reyes (https://github.com/pabloxp) |
327 | 327 | * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl) |
328 | 328 | * @version 2019-10-06 |
@@ -480,10 +480,11 @@ discard block |
||
480 | 480 | * - Dirección casa central del emisor |
481 | 481 | * - Dirección sucursales |
482 | 482 | * @param emisor Arreglo con los datos del emisor (tag Emisor del XML) |
483 | - * @param x Posición horizontal de inicio en el PDF |
|
484 | - * @param y Posición vertical de inicio en el PDF |
|
485 | - * @param w Ancho de la información del emisor |
|
486 | - * @param w_img Ancho máximo de la imagen |
|
483 | + * @param x integer horizontal de inicio en el PDF |
|
484 | + * @param y integer vertical de inicio en el PDF |
|
485 | + * @param w integer de la información del emisor |
|
486 | + * @param w_img integer máximo de la imagen |
|
487 | + * @param integer $font_size |
|
487 | 488 | * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl) |
488 | 489 | * @version 2019-10-22 |
489 | 490 | */ |
@@ -576,11 +577,13 @@ discard block |
||
576 | 577 | * @param rut RUT del emisor |
577 | 578 | * @param tipo Código o glosa del tipo de documento |
578 | 579 | * @param sucursal_sii Código o glosa de la sucursal del SII del Emisor |
579 | - * @param x Posición horizontal de inicio en el PDF |
|
580 | - * @param y Posición vertical de inicio en el PDF |
|
581 | - * @param w Ancho de la información del emisor |
|
580 | + * @param x integer horizontal de inicio en el PDF |
|
581 | + * @param y integer vertical de inicio en el PDF |
|
582 | + * @param w integer de la información del emisor |
|
583 | + * @param integer $font_size |
|
582 | 584 | * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl) |
583 | 585 | * @version 2019-08-05 |
586 | + * @return integer |
|
584 | 587 | */ |
585 | 588 | protected function agregarFolio($rut, $tipo, $folio, $sucursal_sii = null, $x = 130, $y = 15, $w = 70, $font_size = null, array $color = null) |
586 | 589 | { |
@@ -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 2019-10-06 |
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 | */ |
@@ -867,7 +870,7 @@ discard block |
||
867 | 870 | /** |
868 | 871 | * Método que agrega las referencias del documento |
869 | 872 | * @param referencias Arreglo con las referencias del documento (tag Referencia del XML) |
870 | - * @param x Posición horizontal de inicio en el PDF |
|
873 | + * @param x integer horizontal de inicio en el PDF |
|
871 | 874 | * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl) |
872 | 875 | * @version 2017-09-25 |
873 | 876 | */ |
@@ -904,7 +907,7 @@ discard block |
||
904 | 907 | /** |
905 | 908 | * Método que agrega el detalle del documento |
906 | 909 | * @param detalle Arreglo con el detalle del documento (tag Detalle del XML) |
907 | - * @param x Posición horizontal de inicio en el PDF |
|
910 | + * @param x integer horizontal de inicio en el PDF |
|
908 | 911 | * @param y Posición vertical de inicio en el PDF |
909 | 912 | * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl) |
910 | 913 | * @version 2019-07-09 |
@@ -1004,7 +1007,7 @@ discard block |
||
1004 | 1007 | /** |
1005 | 1008 | * Método que agrega el detalle del documento |
1006 | 1009 | * @param detalle Arreglo con el detalle del documento (tag Detalle del XML) |
1007 | - * @param x Posición horizontal de inicio en el PDF |
|
1010 | + * @param x integer horizontal de inicio en el PDF |
|
1008 | 1011 | * @param y Posición vertical de inicio en el PDF |
1009 | 1012 | * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl) |
1010 | 1013 | * @author Pablo Reyes (https://github.com/pabloxp) |
@@ -1048,7 +1051,7 @@ discard block |
||
1048 | 1051 | * Método que agrega el subtotal del DTE |
1049 | 1052 | * @param detalle Arreglo con los detalles del documentos para poder |
1050 | 1053 | * calcular subtotal |
1051 | - * @param x Posición horizontal de inicio en el PDF |
|
1054 | + * @param x integer horizontal de inicio en el PDF |
|
1052 | 1055 | * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl) |
1053 | 1056 | * @version 2016-08-17 |
1054 | 1057 | */ |
@@ -1074,7 +1077,7 @@ discard block |
||
1074 | 1077 | /** |
1075 | 1078 | * Método que agrega los descuentos y/o recargos globales del documento |
1076 | 1079 | * @param descuentosRecargos Arreglo con los descuentos y/o recargos del documento (tag DscRcgGlobal del XML) |
1077 | - * @param x Posición horizontal de inicio en el PDF |
|
1080 | + * @param x integer horizontal de inicio en el PDF |
|
1078 | 1081 | * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl) |
1079 | 1082 | * @version 2018-05-29 |
1080 | 1083 | */ |
@@ -1102,7 +1105,7 @@ discard block |
||
1102 | 1105 | /** |
1103 | 1106 | * Método que agrega los pagos del documento |
1104 | 1107 | * @param pagos Arreglo con los pagos del documento |
1105 | - * @param x Posición horizontal de inicio en el PDF |
|
1108 | + * @param x integer horizontal de inicio en el PDF |
|
1106 | 1109 | * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl) |
1107 | 1110 | * @version 2016-07-24 |
1108 | 1111 | */ |
@@ -1260,9 +1263,10 @@ discard block |
||
1260 | 1263 | * - Se imprime en el tamaño mínimo: 2x5 cms |
1261 | 1264 | * - En el lado de abajo con margen izquierdo mínimo de 2 cms |
1262 | 1265 | * @param timbre String con los datos del timbre |
1263 | - * @param x Posición horizontal de inicio en el PDF |
|
1264 | - * @param y Posición vertical de inicio en el PDF |
|
1265 | - * @param w Ancho del timbre |
|
1266 | + * @param x integer horizontal de inicio en el PDF |
|
1267 | + * @param y integer vertical de inicio en el PDF |
|
1268 | + * @param w integer del timbre |
|
1269 | + * @param string $position |
|
1266 | 1270 | * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl) |
1267 | 1271 | * @version 2019-10-06 |
1268 | 1272 | */ |
@@ -1300,10 +1304,10 @@ discard block |
||
1300 | 1304 | |
1301 | 1305 | /** |
1302 | 1306 | * Método que agrega el acuse de rebido |
1303 | - * @param x Posición horizontal de inicio en el PDF |
|
1304 | - * @param y Posición vertical de inicio en el PDF |
|
1305 | - * @param w Ancho del acuse de recibo |
|
1306 | - * @param h Alto del acuse de recibo |
|
1307 | + * @param x integer horizontal de inicio en el PDF |
|
1308 | + * @param y integer vertical de inicio en el PDF |
|
1309 | + * @param w integer del acuse de recibo |
|
1310 | + * @param h integer del acuse de recibo |
|
1307 | 1311 | * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl) |
1308 | 1312 | * @version 2019-10-06 |
1309 | 1313 | */ |
@@ -1331,10 +1335,10 @@ discard block |
||
1331 | 1335 | |
1332 | 1336 | /** |
1333 | 1337 | * Método que agrega el acuse de rebido |
1334 | - * @param x Posición horizontal de inicio en el PDF |
|
1338 | + * @param x integer horizontal de inicio en el PDF |
|
1335 | 1339 | * @param y Posición vertical de inicio en el PDF |
1336 | - * @param w Ancho del acuse de recibo |
|
1337 | - * @param h Alto del acuse de recibo |
|
1340 | + * @param w integer del acuse de recibo |
|
1341 | + * @param h integer del acuse de recibo |
|
1338 | 1342 | * @author Pablo Reyes (https://github.com/pabloxp) |
1339 | 1343 | * @version 2015-11-17 |
1340 | 1344 | */ |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | { |
74 | 74 | parent::__construct(); |
75 | 75 | $this->SetTitle('Documento Tributario Electrónico (DTE) de Chile by LibreDTE'); |
76 | - $this->papelContinuo = $papelContinuo === true ? 80 : $papelContinuo; |
|
76 | + $this->papelContinuo = $papelContinuo===true ? 80 : $papelContinuo; |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | /** |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | $this->Ln(); |
183 | 183 | // datos del documento |
184 | 184 | $y = []; |
185 | - $y[] = $this->agregarDatosEmision($dte['Encabezado']['IdDoc'], !empty($dte['Encabezado']['Emisor']['CdgVendedor'])?$dte['Encabezado']['Emisor']['CdgVendedor']:null); |
|
185 | + $y[] = $this->agregarDatosEmision($dte['Encabezado']['IdDoc'], !empty($dte['Encabezado']['Emisor']['CdgVendedor']) ? $dte['Encabezado']['Emisor']['CdgVendedor'] : null); |
|
186 | 186 | $y[] = $this->agregarReceptor($dte['Encabezado']); |
187 | 187 | $this->setY(max($y)); |
188 | 188 | $this->agregarTraslado( |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | $this->AddPage('P', [$height ? $height : $this->papel_continuo_alto, $width]); |
232 | 232 | $x = 1; |
233 | 233 | $y = 5; |
234 | - $this->SetXY($x,$y); |
|
234 | + $this->SetXY($x, $y); |
|
235 | 235 | // agregar datos del documento |
236 | 236 | $this->setFont('', '', 8); |
237 | 237 | $this->MultiTexto(!empty($dte['Encabezado']['Emisor']['RznSoc']) ? $dte['Encabezado']['Emisor']['RznSoc'] : $dte['Encabezado']['Emisor']['RznSocEmisor'], $x, null, '', $width-2); |
@@ -345,15 +345,15 @@ discard block |
||
345 | 345 | $dte['Encabezado']['IdDoc']['TipoDTE'], |
346 | 346 | $dte['Encabezado']['IdDoc']['Folio'], |
347 | 347 | $dte['Encabezado']['Emisor']['CmnaOrigen'], |
348 | - $x_start, $y_start, $width-($x_start*4), 10, |
|
349 | - [0,0,0] |
|
348 | + $x_start, $y_start, $width-($x_start * 4), 10, |
|
349 | + [0, 0, 0] |
|
350 | 350 | ); |
351 | - $y = $this->agregarEmisor($dte['Encabezado']['Emisor'], $x_start, $y+2, $width-($x_start*45), 8, 9, [0,0,0]); |
|
351 | + $y = $this->agregarEmisor($dte['Encabezado']['Emisor'], $x_start, $y+2, $width-($x_start * 45), 8, 9, [0, 0, 0]); |
|
352 | 352 | // datos del documento |
353 | 353 | $this->SetY($y); |
354 | 354 | $this->Ln(); |
355 | 355 | $this->setFont('', '', 8); |
356 | - $this->agregarDatosEmision($dte['Encabezado']['IdDoc'], !empty($dte['Encabezado']['Emisor']['CdgVendedor'])?$dte['Encabezado']['Emisor']['CdgVendedor']:null, $x_start, $offset, false); |
|
356 | + $this->agregarDatosEmision($dte['Encabezado']['IdDoc'], !empty($dte['Encabezado']['Emisor']['CdgVendedor']) ? $dte['Encabezado']['Emisor']['CdgVendedor'] : null, $x_start, $offset, false); |
|
357 | 357 | $this->agregarReceptor($dte['Encabezado'], $x_start, $offset); |
358 | 358 | $this->agregarTraslado( |
359 | 359 | !empty($dte['Encabezado']['IdDoc']['IndTraslado']) ? $dte['Encabezado']['IdDoc']['IndTraslado'] : null, |
@@ -423,14 +423,14 @@ discard block |
||
423 | 423 | 2, |
424 | 424 | 45, |
425 | 425 | 9, |
426 | - [0,0,0] |
|
426 | + [0, 0, 0] |
|
427 | 427 | ); |
428 | - $y[] = $this->agregarEmisor($dte['Encabezado']['Emisor'], 1, 2, 20, 30, 9, [0,0,0], $y[0]); |
|
428 | + $y[] = $this->agregarEmisor($dte['Encabezado']['Emisor'], 1, 2, 20, 30, 9, [0, 0, 0], $y[0]); |
|
429 | 429 | $this->SetY(max($y)); |
430 | 430 | $this->Ln(); |
431 | 431 | // datos del documento |
432 | 432 | $this->setFont('', '', 8); |
433 | - $this->agregarDatosEmision($dte['Encabezado']['IdDoc'], !empty($dte['Encabezado']['Emisor']['CdgVendedor'])?$dte['Encabezado']['Emisor']['CdgVendedor']:null, $x_start, $offset, false); |
|
433 | + $this->agregarDatosEmision($dte['Encabezado']['IdDoc'], !empty($dte['Encabezado']['Emisor']['CdgVendedor']) ? $dte['Encabezado']['Emisor']['CdgVendedor'] : null, $x_start, $offset, false); |
|
434 | 434 | $this->agregarReceptor($dte['Encabezado'], $x_start, $offset); |
435 | 435 | $this->agregarTraslado( |
436 | 436 | !empty($dte['Encabezado']['IdDoc']['IndTraslado']) ? $dte['Encabezado']['IdDoc']['IndTraslado'] : null, |
@@ -462,7 +462,7 @@ discard block |
||
462 | 462 | if ($this->cedible and !in_array($dte['Encabezado']['IdDoc']['TipoDTE'], $this->sinAcuseRecibo)) { |
463 | 463 | $this->agregarAcuseRecibo(63, $y+6, 45, 40, 15); |
464 | 464 | $this->setFont('', 'B', 8); |
465 | - $this->Texto('CEDIBLE'.($dte['Encabezado']['IdDoc']['TipoDTE']==52?' CON SU FACTURA':''), $x_start, $this->y+1, 'L'); |
|
465 | + $this->Texto('CEDIBLE'.($dte['Encabezado']['IdDoc']['TipoDTE']==52 ? ' CON SU FACTURA' : ''), $x_start, $this->y+1, 'L'); |
|
466 | 466 | } |
467 | 467 | // si el alto no se pasó, entonces es con autocálculo, se elimina esta página y se pasa el alto |
468 | 468 | // que se logró determinar para crear la página con el alto correcto |
@@ -491,14 +491,14 @@ discard block |
||
491 | 491 | { |
492 | 492 | // logo del documento |
493 | 493 | if (isset($this->logo)) { |
494 | - if (!empty($this->logo['posicion']) and $this->logo['posicion'] == 'C') { |
|
494 | + if (!empty($this->logo['posicion']) and $this->logo['posicion']=='C') { |
|
495 | 495 | $logo_w = null; |
496 | 496 | $logo_y = null; |
497 | 497 | $logo_position = 'C'; |
498 | 498 | $logo_next_pointer = 'N'; |
499 | 499 | } else { |
500 | 500 | $logo_w = !$this->logo['posicion'] ? $w_img : null; |
501 | - $logo_y = $this->logo['posicion'] ? $w_img/2 : null; |
|
501 | + $logo_y = $this->logo['posicion'] ? $w_img / 2 : null; |
|
502 | 502 | $logo_position = ''; |
503 | 503 | $logo_next_pointer = 'T'; |
504 | 504 | } |
@@ -509,17 +509,17 @@ discard block |
||
509 | 509 | $logo_w, |
510 | 510 | $logo_y, |
511 | 511 | 'PNG', |
512 | - (isset($emisor['url'])?$emisor['url']:''), |
|
512 | + (isset($emisor['url']) ? $emisor['url'] : ''), |
|
513 | 513 | $logo_next_pointer, |
514 | 514 | 2, |
515 | 515 | 300, |
516 | 516 | $logo_position |
517 | 517 | ); |
518 | - if (!empty($this->logo['posicion']) and $this->logo['posicion'] == 'C') { |
|
518 | + if (!empty($this->logo['posicion']) and $this->logo['posicion']=='C') { |
|
519 | 519 | $w += 40; |
520 | 520 | } else { |
521 | 521 | if ($this->logo['posicion']) { |
522 | - $this->SetY($this->y + ($w_img/2)); |
|
522 | + $this->SetY($this->y+($w_img / 2)); |
|
523 | 523 | $w += 40; |
524 | 524 | } else { |
525 | 525 | $x = $this->x+3; |
@@ -531,19 +531,19 @@ discard block |
||
531 | 531 | } |
532 | 532 | // agregar datos del emisor |
533 | 533 | $this->setFont('', 'B', $font_size ? $font_size : 14); |
534 | - $this->SetTextColorArray($color===null?[32, 92, 144]:$color); |
|
535 | - $this->MultiTexto(!empty($emisor['RznSoc']) ? $emisor['RznSoc'] : $emisor['RznSocEmisor'], $x, $this->y+2, 'L', ($h_folio and $h_folio < $this->getY()) ? $w_all : $w); |
|
534 | + $this->SetTextColorArray($color===null ? [32, 92, 144] : $color); |
|
535 | + $this->MultiTexto(!empty($emisor['RznSoc']) ? $emisor['RznSoc'] : $emisor['RznSocEmisor'], $x, $this->y+2, 'L', ($h_folio and $h_folio<$this->getY()) ? $w_all : $w); |
|
536 | 536 | $this->setFont('', 'B', $font_size ? $font_size : 9); |
537 | - $this->SetTextColorArray([0,0,0]); |
|
538 | - $this->MultiTexto(!empty($emisor['GiroEmis']) ? $emisor['GiroEmis'] : $emisor['GiroEmisor'], $x, $this->y, 'L', ($h_folio and $h_folio < $this->getY()) ? $w_all : $w); |
|
537 | + $this->SetTextColorArray([0, 0, 0]); |
|
538 | + $this->MultiTexto(!empty($emisor['GiroEmis']) ? $emisor['GiroEmis'] : $emisor['GiroEmisor'], $x, $this->y, 'L', ($h_folio and $h_folio<$this->getY()) ? $w_all : $w); |
|
539 | 539 | $comuna = !empty($emisor['CmnaOrigen']) ? $emisor['CmnaOrigen'] : null; |
540 | 540 | $ciudad = !empty($emisor['CiudadOrigen']) ? $emisor['CiudadOrigen'] : \sasco\LibreDTE\Chile::getCiudad($comuna); |
541 | - $this->MultiTexto($emisor['DirOrigen'].($comuna?(', '.$comuna):'').($ciudad?(', '.$ciudad):''), $x, $this->y, 'L', ($h_folio and $h_folio < $this->getY()) ? $w_all : $w); |
|
541 | + $this->MultiTexto($emisor['DirOrigen'].($comuna ? (', '.$comuna) : '').($ciudad ? (', '.$ciudad) : ''), $x, $this->y, 'L', ($h_folio and $h_folio<$this->getY()) ? $w_all : $w); |
|
542 | 542 | if (!empty($emisor['Sucursal'])) { |
543 | - $this->MultiTexto('Sucursal: '.$emisor['Sucursal'], $x, $this->y, 'L', ($h_folio and $h_folio < $this->getY()) ? $w_all : $w); |
|
543 | + $this->MultiTexto('Sucursal: '.$emisor['Sucursal'], $x, $this->y, 'L', ($h_folio and $h_folio<$this->getY()) ? $w_all : $w); |
|
544 | 544 | } |
545 | 545 | if (!empty($this->casa_matriz)) { |
546 | - $this->MultiTexto('Casa matriz: '.$this->casa_matriz, $x, $this->y, 'L', ($h_folio and $h_folio < $this->getY()) ? $w_all : $w); |
|
546 | + $this->MultiTexto('Casa matriz: '.$this->casa_matriz, $x, $this->y, 'L', ($h_folio and $h_folio<$this->getY()) ? $w_all : $w); |
|
547 | 547 | } |
548 | 548 | $contacto = []; |
549 | 549 | if (!empty($emisor['Telefono'])) { |
@@ -556,7 +556,7 @@ discard block |
||
556 | 556 | $contacto[] = $emisor['CorreoEmisor']; |
557 | 557 | } |
558 | 558 | if ($contacto) { |
559 | - $this->MultiTexto(implode(' / ', $contacto), $x, $this->y, 'L', ($h_folio and $h_folio < $this->getY()) ? $w_all : $w); |
|
559 | + $this->MultiTexto(implode(' / ', $contacto), $x, $this->y, 'L', ($h_folio and $h_folio<$this->getY()) ? $w_all : $w); |
|
560 | 560 | } |
561 | 561 | return $this->y; |
562 | 562 | } |
@@ -585,12 +585,12 @@ discard block |
||
585 | 585 | protected function agregarFolio($rut, $tipo, $folio, $sucursal_sii = null, $x = 130, $y = 15, $w = 70, $font_size = null, array $color = null) |
586 | 586 | { |
587 | 587 | if ($color===null) { |
588 | - $color = $tipo ? ($tipo==52 ? [0,172,140] : [255,0,0]) : [0,0,0]; |
|
588 | + $color = $tipo ? ($tipo==52 ? [0, 172, 140] : [255, 0, 0]) : [0, 0, 0]; |
|
589 | 589 | } |
590 | 590 | $this->SetTextColorArray($color); |
591 | 591 | // colocar rut emisor, glosa documento y folio |
592 | 592 | list($rut, $dv) = explode('-', $rut); |
593 | - $this->setFont ('', 'B', $font_size ? $font_size : 15); |
|
593 | + $this->setFont('', 'B', $font_size ? $font_size : 15); |
|
594 | 594 | $this->MultiTexto('R.U.T.: '.$this->num($rut).'-'.$dv, $x, $y+4, 'C', $w); |
595 | 595 | $this->setFont('', 'B', $font_size ? $font_size : 12); |
596 | 596 | $this->MultiTexto($this->getTipo($tipo, $folio), $x, null, 'C', $w); |
@@ -603,7 +603,7 @@ discard block |
||
603 | 603 | if ($tipo) { |
604 | 604 | $this->Texto('S.I.I. - '.\sasco\LibreDTE\Sii::getDireccionRegional($sucursal_sii), $x, $this->getY()+4, 'C', $w); |
605 | 605 | } |
606 | - $this->SetTextColorArray([0,0,0]); |
|
606 | + $this->SetTextColorArray([0, 0, 0]); |
|
607 | 607 | $this->Ln(); |
608 | 608 | return $this->y; |
609 | 609 | } |
@@ -717,10 +717,10 @@ discard block |
||
717 | 717 | } |
718 | 718 | if (!empty($receptor['RznSocRecep'])) { |
719 | 719 | $this->setFont('', 'B', null); |
720 | - $this->Texto(in_array($this->dte, [39, 41]) ? 'Nombre' : ($x==10?'Razón social':'Razón soc.'), $x); |
|
720 | + $this->Texto(in_array($this->dte, [39, 41]) ? 'Nombre' : ($x==10 ? 'Razón social' : 'Razón soc.'), $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 | } |
@@ -875,7 +875,7 @@ discard block |
||
875 | 875 | { |
876 | 876 | if (!isset($referencias[0])) |
877 | 877 | $referencias = [$referencias]; |
878 | - foreach($referencias as $r) { |
|
878 | + foreach ($referencias as $r) { |
|
879 | 879 | $texto = $r['NroLinRef'].' - '; |
880 | 880 | if (!empty($r['TpoDocRef'])) { |
881 | 881 | $texto .= $this->getTipo($r['TpoDocRef']).' '; |
@@ -927,7 +927,7 @@ discard block |
||
927 | 927 | // quitar columnas |
928 | 928 | foreach ($item as $col => $valor) { |
929 | 929 | if ($col=='DscItem' and !empty($item['DscItem'])) { |
930 | - $item['NmbItem'] .= !$this->item_detalle_posicion ? ($html?'<br/>':"\n") : ': '; |
|
930 | + $item['NmbItem'] .= !$this->item_detalle_posicion ? ($html ? '<br/>' : "\n") : ': '; |
|
931 | 931 | if ($html) { |
932 | 932 | $item['NmbItem'] .= '<span style="font-size:0.7em">'.$item['DscItem'].'</span>'; |
933 | 933 | } else { |
@@ -975,7 +975,7 @@ discard block |
||
975 | 975 | } |
976 | 976 | $item = array_merge($item_default, $item); |
977 | 977 | // si hay código de item se extrae su valor |
978 | - if (!empty($item['CdgItem']['VlrCodigo'])){ |
|
978 | + if (!empty($item['CdgItem']['VlrCodigo'])) { |
|
979 | 979 | $item['CdgItem'] = $item['CdgItem']['VlrCodigo']; |
980 | 980 | } |
981 | 981 | // dar formato a números |
@@ -1018,9 +1018,9 @@ discard block |
||
1018 | 1018 | $this->SetY($this->getY()+1); |
1019 | 1019 | $p1x = $x; |
1020 | 1020 | $p1y = $this->y; |
1021 | - $p2x = $this->getPageWidth() - 2; |
|
1022 | - $p2y = $p1y; // Use same y for a straight line |
|
1023 | - $style = array('width' => 0.2,'color' => array(0, 0, 0)); |
|
1021 | + $p2x = $this->getPageWidth()-2; |
|
1022 | + $p2y = $p1y; // Use same y for a straight line |
|
1023 | + $style = array('width' => 0.2, 'color' => array(0, 0, 0)); |
|
1024 | 1024 | $this->Line($p1x, $p1y, $p2x, $p2y, $style); |
1025 | 1025 | $this->Texto($this->detalle_cols['NmbItem']['title'], $x+$offsets[0], $this->y, ucfirst($this->detalle_cols['NmbItem']['align'][0]), $this->detalle_cols['NmbItem']['width']); |
1026 | 1026 | $this->Texto($this->detalle_cols['PrcItem']['title'], $x+$offsets[1], $this->y, ucfirst($this->detalle_cols['PrcItem']['align'][0]), $this->detalle_cols['PrcItem']['width']); |
@@ -1031,13 +1031,13 @@ discard block |
||
1031 | 1031 | $detalle = [$detalle]; |
1032 | 1032 | } |
1033 | 1033 | $this->SetY($this->getY()+2); |
1034 | - foreach($detalle as &$d) { |
|
1034 | + foreach ($detalle as &$d) { |
|
1035 | 1035 | $item = $d['NmbItem']; |
1036 | 1036 | if ($descripcion and !empty($d['DscItem'])) { |
1037 | 1037 | $item .= ': '.$d['DscItem']; |
1038 | 1038 | } |
1039 | 1039 | $this->MultiTexto($item, $x+$offsets[0], $this->y+4, ucfirst($this->detalle_cols['NmbItem']['align'][0]), $this->detalle_cols['NmbItem']['width']); |
1040 | - $this->Texto(number_format($d['PrcItem'],0,',','.'), $x+$offsets[1], $this->y, ucfirst($this->detalle_cols['PrcItem']['align'][0]), $this->detalle_cols['PrcItem']['width']); |
|
1040 | + $this->Texto(number_format($d['PrcItem'], 0, ',', '.'), $x+$offsets[1], $this->y, ucfirst($this->detalle_cols['PrcItem']['align'][0]), $this->detalle_cols['PrcItem']['width']); |
|
1041 | 1041 | $this->Texto($this->num($d['QtyItem']), $x+$offsets[2], $this->y, ucfirst($this->detalle_cols['QtyItem']['align'][0]), $this->detalle_cols['QtyItem']['width']); |
1042 | 1042 | $this->Texto($this->num($d['MontoItem']), $x+$offsets[3], $this->y, ucfirst($this->detalle_cols['MontoItem']['align'][0]), $this->detalle_cols['MontoItem']['width']); |
1043 | 1043 | } |
@@ -1057,7 +1057,7 @@ discard block |
||
1057 | 1057 | if (!isset($detalle[0])) { |
1058 | 1058 | $detalle = [$detalle]; |
1059 | 1059 | } |
1060 | - foreach($detalle as &$d) { |
|
1060 | + foreach ($detalle as &$d) { |
|
1061 | 1061 | if (!empty($d['MontoItem'])) { |
1062 | 1062 | $subtotal += $d['MontoItem']; |
1063 | 1063 | } |
@@ -1083,16 +1083,16 @@ discard block |
||
1083 | 1083 | if (!isset($descuentosRecargos[0])) { |
1084 | 1084 | $descuentosRecargos = [$descuentosRecargos]; |
1085 | 1085 | } |
1086 | - foreach($descuentosRecargos as $dr) { |
|
1086 | + foreach ($descuentosRecargos as $dr) { |
|
1087 | 1087 | $tipo = $dr['TpoMov']=='D' ? 'Descuento' : 'Recargo'; |
1088 | 1088 | if (!empty($dr['IndExeDR'])) { |
1089 | 1089 | $tipo .= ' EX'; |
1090 | 1090 | } |
1091 | 1091 | $valor = $dr['TpoValor']=='%' ? $dr['ValorDR'].'%' : $this->num($dr['ValorDR']); |
1092 | 1092 | if ($this->papelContinuo) { |
1093 | - $this->Texto($tipo.' global: '.$valor.(!empty($dr['GlosaDR'])?(' ('.$dr['GlosaDR'].')'):''), $x); |
|
1093 | + $this->Texto($tipo.' global: '.$valor.(!empty($dr['GlosaDR']) ? (' ('.$dr['GlosaDR'].')') : ''), $x); |
|
1094 | 1094 | } else { |
1095 | - $this->Texto($tipo.(!empty($dr['GlosaDR'])?(' ('.$dr['GlosaDR'].')'):'').':', 77, null, 'R', 100); |
|
1095 | + $this->Texto($tipo.(!empty($dr['GlosaDR']) ? (' ('.$dr['GlosaDR'].')') : '').':', 77, null, 'R', 100); |
|
1096 | 1096 | $this->Texto($valor, 177, null, 'R', 22); |
1097 | 1097 | } |
1098 | 1098 | $this->Ln(); |
@@ -1112,8 +1112,8 @@ discard block |
||
1112 | 1112 | $pagos = [$pagos]; |
1113 | 1113 | $this->Texto('Pago(s) programado(s):', $x); |
1114 | 1114 | $this->Ln(); |
1115 | - foreach($pagos as $p) { |
|
1116 | - $this->Texto(' - '.$this->date($p['FchPago'], false).': $'.$this->num($p['MntPago']).'.-'.(!empty($p['GlosaPagos'])?(' ('.$p['GlosaPagos'].')'):''), $x); |
|
1115 | + foreach ($pagos as $p) { |
|
1116 | + $this->Texto(' - '.$this->date($p['FchPago'], false).': $'.$this->num($p['MntPago']).'.-'.(!empty($p['GlosaPagos']) ? (' ('.$p['GlosaPagos'].')') : ''), $x); |
|
1117 | 1117 | $this->Ln(); |
1118 | 1118 | } |
1119 | 1119 | } |
@@ -1164,7 +1164,7 @@ discard block |
||
1164 | 1164 | if (!isset($ImptoReten[0])) { |
1165 | 1165 | $ImptoReten = [$ImptoReten]; |
1166 | 1166 | } |
1167 | - foreach($ImptoReten as $i) { |
|
1167 | + foreach ($ImptoReten as $i) { |
|
1168 | 1168 | $totales['ImptoReten_'.$i['TipoImp']] = $i['MontoImp']; |
1169 | 1169 | if (!empty($i['TasaImp'])) { |
1170 | 1170 | $glosas['ImptoReten_'.$i['TipoImp']] = \sasco\LibreDTE\Sii\ImpuestosAdicionales::getGlosa($i['TipoImp']).' ('.$i['TasaImp'].'%) $'; |
@@ -1277,9 +1277,9 @@ discard block |
||
1277 | 1277 | 'vpadding' => 0, |
1278 | 1278 | 'module_width' => 1, // width of a single module in points |
1279 | 1279 | 'module_height' => 1, // height of a single module in points |
1280 | - 'fgcolor' => [0,0,0], |
|
1280 | + 'fgcolor' => [0, 0, 0], |
|
1281 | 1281 | 'bgcolor' => false, // [255,255,255] |
1282 | - 'position' => $position === null ? ($this->papelContinuo ? 'C' : 'S') : $position, |
|
1282 | + 'position' => $position===null ? ($this->papelContinuo ? 'C' : 'S') : $position, |
|
1283 | 1283 | ]; |
1284 | 1284 | $ecl = version_compare(phpversion(), '7.0.0', '<') ? -1 : $this->ecl; |
1285 | 1285 | $this->write2DBarcode($timbre, 'PDF417,,'.$ecl, $x_timbre, $y, $w, 0, $style, 'B'); |
@@ -1310,7 +1310,7 @@ discard block |
||
1310 | 1310 | protected function agregarAcuseRecibo($x = 83, $y = 190, $w = 60, $h = 40, $line = 25) |
1311 | 1311 | { |
1312 | 1312 | $y = (!$this->papelContinuo and !$this->timbre_pie) ? $this->x_fin_datos : $y; |
1313 | - $this->SetTextColorArray([0,0,0]); |
|
1313 | + $this->SetTextColorArray([0, 0, 0]); |
|
1314 | 1314 | $this->Rect($x, $y, $w, $h, 'D', ['all' => ['width' => 0.1, 'color' => [0, 0, 0]]]); |
1315 | 1315 | $this->setFont('', 'B', 10); |
1316 | 1316 | $this->Texto('Acuse de recibo', $x, $y+1, 'C', $w); |
@@ -1340,9 +1340,9 @@ discard block |
||
1340 | 1340 | */ |
1341 | 1341 | protected function agregarAcuseReciboContinuo($x = 3, $y = null, $w = 68, $h = 40) |
1342 | 1342 | { |
1343 | - $this->SetTextColorArray([0,0,0]); |
|
1343 | + $this->SetTextColorArray([0, 0, 0]); |
|
1344 | 1344 | $this->Rect($x, $y, $w, $h, 'D', ['all' => ['width' => 0.1, 'color' => [0, 0, 0]]]); |
1345 | - $style = array('width' => 0.2,'color' => array(0, 0, 0)); |
|
1345 | + $style = array('width' => 0.2, 'color' => array(0, 0, 0)); |
|
1346 | 1346 | $this->Line($x, $y+22, $w+3, $y+22, $style); |
1347 | 1347 | //$this->setFont('', 'B', 10); |
1348 | 1348 | //$this->Texto('Acuse de recibo', $x, $y+1, 'C', $w); |
@@ -1372,7 +1372,7 @@ discard block |
||
1372 | 1372 | $y = (!$this->papelContinuo and !$this->timbre_pie and $this->x_fin_datos<=$y) ? $this->x_fin_datos : $y; |
1373 | 1373 | $y += 48; |
1374 | 1374 | $this->setFont('', 'B', $font_size); |
1375 | - $this->Texto('CEDIBLE'.($tipo==52?' CON SU FACTURA':''), null, $y, 'R'); |
|
1375 | + $this->Texto('CEDIBLE'.($tipo==52 ? ' CON SU FACTURA' : ''), null, $y, 'R'); |
|
1376 | 1376 | } |
1377 | 1377 | |
1378 | 1378 | /** |
@@ -1383,7 +1383,7 @@ discard block |
||
1383 | 1383 | protected function agregarLeyendaDestinoContinuo($tipo) |
1384 | 1384 | { |
1385 | 1385 | $this->setFont('', 'B', 8); |
1386 | - $this->Texto('CEDIBLE'.($tipo==52?' CON SU FACTURA':''), null, $this->y+6, 'R'); |
|
1386 | + $this->Texto('CEDIBLE'.($tipo==52 ? ' CON SU FACTURA' : ''), null, $this->y+6, 'R'); |
|
1387 | 1387 | } |
1388 | 1388 | |
1389 | 1389 | } |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | { |
127 | 127 | $fecha = '9999-12-31'; |
128 | 128 | foreach ($this->detalles as &$d) { |
129 | - if ($d['FchDoc'] < $fecha) { |
|
129 | + if ($d['FchDoc']<$fecha) { |
|
130 | 130 | $fecha = $d['FchDoc']; |
131 | 131 | } |
132 | 132 | } |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | { |
144 | 144 | $fecha = '0000-01-01'; |
145 | 145 | foreach ($this->detalles as &$d) { |
146 | - if ($d['FchDoc'] > $fecha) { |
|
146 | + if ($d['FchDoc']>$fecha) { |
|
147 | 147 | $fecha = $d['FchDoc']; |
148 | 148 | } |
149 | 149 | } |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | // ajustes post agregar detalles |
203 | 203 | foreach ($Resumen as &$r) { |
204 | 204 | // obtener folios utilizados = emitidos + anulados |
205 | - $r['FoliosUtilizados'] = $r['FoliosEmitidos'] + $r['FoliosAnulados']; |
|
205 | + $r['FoliosUtilizados'] = $r['FoliosEmitidos']+$r['FoliosAnulados']; |
|
206 | 206 | $r['RangoUtilizados'] = $this->getRangos($RangoUtilizados[$r['TipoDocumento']]); |
207 | 207 | } |
208 | 208 | // completar con los resumenes que no se colocaron |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | $aux = []; |
235 | 235 | $inicial = $folios[0]; |
236 | 236 | $i = $inicial; |
237 | - foreach($folios as $f) { |
|
237 | + foreach ($folios as $f) { |
|
238 | 238 | if ($i!=$f) { |
239 | 239 | $inicial = $f; |
240 | 240 | $i = $inicial; |