@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | /** |
81 | 81 | * Método que asigna la ubicación del logo de la empresa |
82 | 82 | * @param logo URI del logo (puede ser local o en una URL) |
83 | - * @param posicion Posición respecto a datos del emisor (=0 izq, =1 arriba). Nota: parámetro válido sólo para formato hoja carta |
|
83 | + * @param posicion integer respecto a datos del emisor (=0 izq, =1 arriba). Nota: parámetro válido sólo para formato hoja carta |
|
84 | 84 | * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl) |
85 | 85 | * @version 2016-08-04 |
86 | 86 | */ |
@@ -331,7 +331,7 @@ discard block |
||
331 | 331 | * contínuo de 80mm |
332 | 332 | * @param dte Arreglo con los datos del XML (tag Documento) |
333 | 333 | * @param timbre String XML con el tag TED del DTE |
334 | - * @param width Ancho del papel contínuo en mm (es parámetro porque se usa el mismo método para 75mm) |
|
334 | + * @param width integer del papel contínuo en mm (es parámetro porque se usa el mismo método para 75mm) |
|
335 | 335 | * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl) |
336 | 336 | * @author Pablo Reyes (https://github.com/pabloxp) |
337 | 337 | * @version 2021-04-27 |
@@ -491,10 +491,11 @@ discard block |
||
491 | 491 | * - Dirección casa central del emisor |
492 | 492 | * - Dirección sucursales |
493 | 493 | * @param emisor Arreglo con los datos del emisor (tag Emisor del XML) |
494 | - * @param x Posición horizontal de inicio en el PDF |
|
495 | - * @param y Posición vertical de inicio en el PDF |
|
496 | - * @param w Ancho de la información del emisor |
|
497 | - * @param w_img Ancho máximo de la imagen |
|
494 | + * @param x integer horizontal de inicio en el PDF |
|
495 | + * @param y integer vertical de inicio en el PDF |
|
496 | + * @param w integer de la información del emisor |
|
497 | + * @param w_img integer máximo de la imagen |
|
498 | + * @param integer $font_size |
|
498 | 499 | * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl) |
499 | 500 | * @version 2021-01-08 |
500 | 501 | */ |
@@ -604,11 +605,13 @@ discard block |
||
604 | 605 | * @param rut RUT del emisor |
605 | 606 | * @param tipo Código o glosa del tipo de documento |
606 | 607 | * @param sucursal_sii Código o glosa de la sucursal del SII del Emisor |
607 | - * @param x Posición horizontal de inicio en el PDF |
|
608 | - * @param y Posición vertical de inicio en el PDF |
|
609 | - * @param w Ancho de la información del emisor |
|
608 | + * @param x integer horizontal de inicio en el PDF |
|
609 | + * @param y integer vertical de inicio en el PDF |
|
610 | + * @param w integer de la información del emisor |
|
611 | + * @param integer $font_size |
|
610 | 612 | * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl) |
611 | 613 | * @version 2019-08-05 |
614 | + * @return integer |
|
612 | 615 | */ |
613 | 616 | protected function agregarFolio($rut, $tipo, $folio, $sucursal_sii = null, $x = 130, $y = 15, $w = 70, $font_size = null, array $color = null) |
614 | 617 | { |
@@ -640,7 +643,7 @@ discard block |
||
640 | 643 | * Método que agrega los datos de la emisión del DTE que no son los dato del |
641 | 644 | * receptor |
642 | 645 | * @param IdDoc Información general del documento |
643 | - * @param x Posición horizontal de inicio en el PDF |
|
646 | + * @param x integer horizontal de inicio en el PDF |
|
644 | 647 | * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl) |
645 | 648 | * @version 2020-08-11 |
646 | 649 | */ |
@@ -728,7 +731,7 @@ discard block |
||
728 | 731 | /** |
729 | 732 | * Método que agrega los datos del receptor |
730 | 733 | * @param receptor Arreglo con los datos del receptor (tag Receptor del XML) |
731 | - * @param x Posición horizontal de inicio en el PDF |
|
734 | + * @param x integer horizontal de inicio en el PDF |
|
732 | 735 | * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl) |
733 | 736 | * @version 2019-10-06 |
734 | 737 | */ |
@@ -815,7 +818,7 @@ discard block |
||
815 | 818 | * Método que agrega los datos del traslado |
816 | 819 | * @param IndTraslado |
817 | 820 | * @param Transporte |
818 | - * @param x Posición horizontal de inicio en el PDF |
|
821 | + * @param x integer horizontal de inicio en el PDF |
|
819 | 822 | * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl) |
820 | 823 | * @version 2016-08-03 |
821 | 824 | */ |
@@ -895,7 +898,7 @@ discard block |
||
895 | 898 | /** |
896 | 899 | * Método que agrega las referencias del documento |
897 | 900 | * @param referencias Arreglo con las referencias del documento (tag Referencia del XML) |
898 | - * @param x Posición horizontal de inicio en el PDF |
|
901 | + * @param x integer horizontal de inicio en el PDF |
|
899 | 902 | * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl) |
900 | 903 | * @version 2017-09-25 |
901 | 904 | */ |
@@ -932,7 +935,7 @@ discard block |
||
932 | 935 | /** |
933 | 936 | * Método que agrega el detalle del documento |
934 | 937 | * @param detalle Arreglo con el detalle del documento (tag Detalle del XML) |
935 | - * @param x Posición horizontal de inicio en el PDF |
|
938 | + * @param x integer horizontal de inicio en el PDF |
|
936 | 939 | * @param y Posición vertical de inicio en el PDF |
937 | 940 | * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl) |
938 | 941 | * @version 2020-08-28 |
@@ -1042,7 +1045,7 @@ discard block |
||
1042 | 1045 | /** |
1043 | 1046 | * Método que agrega el detalle del documento |
1044 | 1047 | * @param detalle Arreglo con el detalle del documento (tag Detalle del XML) |
1045 | - * @param x Posición horizontal de inicio en el PDF |
|
1048 | + * @param x integer horizontal de inicio en el PDF |
|
1046 | 1049 | * @param y Posición vertical de inicio en el PDF |
1047 | 1050 | * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl) |
1048 | 1051 | * @author Pablo Reyes (https://github.com/pabloxp) |
@@ -1102,7 +1105,7 @@ discard block |
||
1102 | 1105 | * Método que agrega el subtotal del DTE |
1103 | 1106 | * @param detalle Arreglo con los detalles del documentos para poder |
1104 | 1107 | * calcular subtotal |
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 2021-04-27 |
1108 | 1111 | */ |
@@ -1129,7 +1132,7 @@ discard block |
||
1129 | 1132 | /** |
1130 | 1133 | * Método que agrega los descuentos y/o recargos globales del documento |
1131 | 1134 | * @param descuentosRecargos Arreglo con los descuentos y/o recargos del documento (tag DscRcgGlobal del XML) |
1132 | - * @param x Posición horizontal de inicio en el PDF |
|
1135 | + * @param x integer horizontal de inicio en el PDF |
|
1133 | 1136 | * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl) |
1134 | 1137 | * @version 2011-04-27 |
1135 | 1138 | */ |
@@ -1159,7 +1162,7 @@ discard block |
||
1159 | 1162 | /** |
1160 | 1163 | * Método que agrega los pagos del documento |
1161 | 1164 | * @param pagos Arreglo con los pagos del documento |
1162 | - * @param x Posición horizontal de inicio en el PDF |
|
1165 | + * @param x integer horizontal de inicio en el PDF |
|
1163 | 1166 | * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl) |
1164 | 1167 | * @version 2016-07-24 |
1165 | 1168 | */ |
@@ -1317,9 +1320,10 @@ discard block |
||
1317 | 1320 | * - Se imprime en el tamaño mínimo: 2x5 cms |
1318 | 1321 | * - En el lado de abajo con margen izquierdo mínimo de 2 cms |
1319 | 1322 | * @param timbre String con los datos del timbre |
1320 | - * @param x Posición horizontal de inicio en el PDF |
|
1321 | - * @param y Posición vertical de inicio en el PDF |
|
1322 | - * @param w Ancho del timbre |
|
1323 | + * @param x integer horizontal de inicio en el PDF |
|
1324 | + * @param y integer vertical de inicio en el PDF |
|
1325 | + * @param w integer del timbre |
|
1326 | + * @param string $position |
|
1323 | 1327 | * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl) |
1324 | 1328 | * @version 2019-10-06 |
1325 | 1329 | */ |
@@ -1357,10 +1361,10 @@ discard block |
||
1357 | 1361 | |
1358 | 1362 | /** |
1359 | 1363 | * Método que agrega el acuse de rebido |
1360 | - * @param x Posición horizontal de inicio en el PDF |
|
1361 | - * @param y Posición vertical de inicio en el PDF |
|
1362 | - * @param w Ancho del acuse de recibo |
|
1363 | - * @param h Alto del acuse de recibo |
|
1364 | + * @param x integer horizontal de inicio en el PDF |
|
1365 | + * @param y integer vertical de inicio en el PDF |
|
1366 | + * @param w integer del acuse de recibo |
|
1367 | + * @param h integer del acuse de recibo |
|
1364 | 1368 | * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl) |
1365 | 1369 | * @version 2019-10-06 |
1366 | 1370 | */ |
@@ -1388,10 +1392,10 @@ discard block |
||
1388 | 1392 | |
1389 | 1393 | /** |
1390 | 1394 | * Método que agrega el acuse de rebido |
1391 | - * @param x Posición horizontal de inicio en el PDF |
|
1395 | + * @param x integer horizontal de inicio en el PDF |
|
1392 | 1396 | * @param y Posición vertical de inicio en el PDF |
1393 | - * @param w Ancho del acuse de recibo |
|
1394 | - * @param h Alto del acuse de recibo |
|
1397 | + * @param w integer del acuse de recibo |
|
1398 | + * @param h integer del acuse de recibo |
|
1395 | 1399 | * @author Pablo Reyes (https://github.com/pabloxp) |
1396 | 1400 | * @version 2015-11-17 |
1397 | 1401 | */ |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | { |
75 | 75 | parent::__construct(); |
76 | 76 | $this->SetTitle('Documento Tributario Electrónico (DTE) de Chile by LibreDTE'); |
77 | - $this->papelContinuo = $papelContinuo === true ? 80 : $papelContinuo; |
|
77 | + $this->papelContinuo = $papelContinuo===true ? 80 : $papelContinuo; |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | /** |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | $this->Ln(); |
194 | 194 | // datos del documento |
195 | 195 | $y = []; |
196 | - $y[] = $this->agregarDatosEmision($dte['Encabezado']['IdDoc'], !empty($dte['Encabezado']['Emisor']['CdgVendedor'])?$dte['Encabezado']['Emisor']['CdgVendedor']:null); |
|
196 | + $y[] = $this->agregarDatosEmision($dte['Encabezado']['IdDoc'], !empty($dte['Encabezado']['Emisor']['CdgVendedor']) ? $dte['Encabezado']['Emisor']['CdgVendedor'] : null); |
|
197 | 197 | $y[] = $this->agregarReceptor($dte['Encabezado']); |
198 | 198 | $this->setY(max($y)); |
199 | 199 | $this->agregarTraslado( |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | $this->AddPage('P', [$height ? $height : $this->papel_continuo_alto, $width]); |
243 | 243 | $x = 1; |
244 | 244 | $y = 5; |
245 | - $this->SetXY($x,$y); |
|
245 | + $this->SetXY($x, $y); |
|
246 | 246 | // agregar datos del documento |
247 | 247 | $this->setFont('', '', 8); |
248 | 248 | $this->MultiTexto(!empty($dte['Encabezado']['Emisor']['RznSoc']) ? $dte['Encabezado']['Emisor']['RznSoc'] : $dte['Encabezado']['Emisor']['RznSocEmisor'], $x, null, '', $width-2); |
@@ -354,15 +354,15 @@ discard block |
||
354 | 354 | $dte['Encabezado']['IdDoc']['TipoDTE'], |
355 | 355 | $dte['Encabezado']['IdDoc']['Folio'], |
356 | 356 | isset($dte['Encabezado']['Emisor']['CmnaOrigen']) ? $dte['Encabezado']['Emisor']['CmnaOrigen'] : 'Sin comuna', // siempre debería tener comuna |
357 | - $x_start, $y_start, $width-($x_start*4), 10, |
|
358 | - [0,0,0] |
|
357 | + $x_start, $y_start, $width-($x_start * 4), 10, |
|
358 | + [0, 0, 0] |
|
359 | 359 | ); |
360 | - $y = $this->agregarEmisor($dte['Encabezado']['Emisor'], $x_start, $y+2, $width-($x_start*45), 8, 9, [0,0,0]); |
|
360 | + $y = $this->agregarEmisor($dte['Encabezado']['Emisor'], $x_start, $y+2, $width-($x_start * 45), 8, 9, [0, 0, 0]); |
|
361 | 361 | // datos del documento |
362 | 362 | $this->SetY($y); |
363 | 363 | $this->Ln(); |
364 | 364 | $this->setFont('', '', 8); |
365 | - $this->agregarDatosEmision($dte['Encabezado']['IdDoc'], !empty($dte['Encabezado']['Emisor']['CdgVendedor'])?$dte['Encabezado']['Emisor']['CdgVendedor']:null, $x_start, $offset, false); |
|
365 | + $this->agregarDatosEmision($dte['Encabezado']['IdDoc'], !empty($dte['Encabezado']['Emisor']['CdgVendedor']) ? $dte['Encabezado']['Emisor']['CdgVendedor'] : null, $x_start, $offset, false); |
|
366 | 366 | $this->agregarReceptor($dte['Encabezado'], $x_start, $offset); |
367 | 367 | $this->agregarTraslado( |
368 | 368 | !empty($dte['Encabezado']['IdDoc']['IndTraslado']) ? $dte['Encabezado']['IdDoc']['IndTraslado'] : null, |
@@ -433,14 +433,14 @@ discard block |
||
433 | 433 | 2, |
434 | 434 | 45, |
435 | 435 | 9, |
436 | - [0,0,0] |
|
436 | + [0, 0, 0] |
|
437 | 437 | ); |
438 | - $y[] = $this->agregarEmisor($dte['Encabezado']['Emisor'], 1, 2, 20, 30, 9, [0,0,0], $y[0]); |
|
438 | + $y[] = $this->agregarEmisor($dte['Encabezado']['Emisor'], 1, 2, 20, 30, 9, [0, 0, 0], $y[0]); |
|
439 | 439 | $this->SetY(max($y)); |
440 | 440 | $this->Ln(); |
441 | 441 | // datos del documento |
442 | 442 | $this->setFont('', '', 8); |
443 | - $this->agregarDatosEmision($dte['Encabezado']['IdDoc'], !empty($dte['Encabezado']['Emisor']['CdgVendedor'])?$dte['Encabezado']['Emisor']['CdgVendedor']:null, $x_start, $offset, false); |
|
443 | + $this->agregarDatosEmision($dte['Encabezado']['IdDoc'], !empty($dte['Encabezado']['Emisor']['CdgVendedor']) ? $dte['Encabezado']['Emisor']['CdgVendedor'] : null, $x_start, $offset, false); |
|
444 | 444 | $this->agregarReceptor($dte['Encabezado'], $x_start, $offset); |
445 | 445 | $this->agregarTraslado( |
446 | 446 | !empty($dte['Encabezado']['IdDoc']['IndTraslado']) ? $dte['Encabezado']['IdDoc']['IndTraslado'] : null, |
@@ -473,7 +473,7 @@ discard block |
||
473 | 473 | if ($this->cedible and !in_array($dte['Encabezado']['IdDoc']['TipoDTE'], $this->sinAcuseRecibo)) { |
474 | 474 | $this->agregarAcuseRecibo(63, $y+6, 45, 40, 15); |
475 | 475 | $this->setFont('', 'B', 8); |
476 | - $this->Texto('CEDIBLE'.($dte['Encabezado']['IdDoc']['TipoDTE']==52?' CON SU FACTURA':''), $x_start, $this->y+1, 'L'); |
|
476 | + $this->Texto('CEDIBLE'.($dte['Encabezado']['IdDoc']['TipoDTE']==52 ? ' CON SU FACTURA' : ''), $x_start, $this->y+1, 'L'); |
|
477 | 477 | } |
478 | 478 | // si el alto no se pasó, entonces es con autocálculo, se elimina esta página y se pasa el alto |
479 | 479 | // que se logró determinar para crear la página con el alto correcto |
@@ -504,16 +504,16 @@ discard block |
||
504 | 504 | // logo del documento |
505 | 505 | if (isset($this->logo)) { |
506 | 506 | // logo centrado (papel continuo) |
507 | - if (!empty($this->logo['posicion']) and $this->logo['posicion'] == 'C') { |
|
507 | + if (!empty($this->logo['posicion']) and $this->logo['posicion']=='C') { |
|
508 | 508 | $logo_w = null; |
509 | 509 | $logo_y = null; |
510 | 510 | $logo_position = 'C'; |
511 | 511 | $logo_next_pointer = 'N'; |
512 | 512 | } |
513 | 513 | // logo a la derecha (posicion=0) o arriba (posicion=1) |
514 | - else if (empty($this->logo['posicion']) or $this->logo['posicion'] == 1) { |
|
514 | + else if (empty($this->logo['posicion']) or $this->logo['posicion']==1) { |
|
515 | 515 | $logo_w = !$this->logo['posicion'] ? $w_img : null; |
516 | - $logo_y = $this->logo['posicion'] ? $w_img/2 : null; |
|
516 | + $logo_y = $this->logo['posicion'] ? $w_img / 2 : null; |
|
517 | 517 | $logo_position = ''; |
518 | 518 | $logo_next_pointer = 'T'; |
519 | 519 | } |
@@ -532,17 +532,17 @@ discard block |
||
532 | 532 | $logo_w, |
533 | 533 | $logo_y, |
534 | 534 | 'PNG', |
535 | - (isset($emisor['url'])?$emisor['url']:''), |
|
535 | + (isset($emisor['url']) ? $emisor['url'] : ''), |
|
536 | 536 | $logo_next_pointer, |
537 | 537 | 2, |
538 | 538 | 300, |
539 | 539 | $logo_position |
540 | 540 | ); |
541 | - if (!empty($this->logo['posicion']) and $this->logo['posicion'] == 'C') { |
|
541 | + if (!empty($this->logo['posicion']) and $this->logo['posicion']=='C') { |
|
542 | 542 | $w += 40; |
543 | 543 | } else { |
544 | 544 | if ($this->logo['posicion']) { |
545 | - $this->SetY($this->y + ($w_img/2)); |
|
545 | + $this->SetY($this->y+($w_img / 2)); |
|
546 | 546 | $w += 40; |
547 | 547 | } else { |
548 | 548 | $x = $this->x+3; |
@@ -555,20 +555,20 @@ discard block |
||
555 | 555 | // agregar datos del emisor |
556 | 556 | if ($agregarDatosEmisor) { |
557 | 557 | $this->setFont('', 'B', $font_size ? $font_size : 14); |
558 | - $this->SetTextColorArray($color===null?[32, 92, 144]:$color); |
|
559 | - $this->MultiTexto(!empty($emisor['RznSoc']) ? $emisor['RznSoc'] : $emisor['RznSocEmisor'], $x, $this->y+2, 'L', ($h_folio and $h_folio < $this->getY()) ? $w_all : $w); |
|
558 | + $this->SetTextColorArray($color===null ? [32, 92, 144] : $color); |
|
559 | + $this->MultiTexto(!empty($emisor['RznSoc']) ? $emisor['RznSoc'] : $emisor['RznSocEmisor'], $x, $this->y+2, 'L', ($h_folio and $h_folio<$this->getY()) ? $w_all : $w); |
|
560 | 560 | $this->setFont('', 'B', $font_size ? $font_size : 9); |
561 | - $this->SetTextColorArray([0,0,0]); |
|
562 | - $this->MultiTexto(!empty($emisor['GiroEmis']) ? $emisor['GiroEmis'] : $emisor['GiroEmisor'], $x, $this->y, 'L', ($h_folio and $h_folio < $this->getY()) ? $w_all : $w); |
|
561 | + $this->SetTextColorArray([0, 0, 0]); |
|
562 | + $this->MultiTexto(!empty($emisor['GiroEmis']) ? $emisor['GiroEmis'] : $emisor['GiroEmisor'], $x, $this->y, 'L', ($h_folio and $h_folio<$this->getY()) ? $w_all : $w); |
|
563 | 563 | $direccion = !empty($emisor['DirOrigen']) ? $emisor['DirOrigen'] : null; |
564 | 564 | $comuna = !empty($emisor['CmnaOrigen']) ? $emisor['CmnaOrigen'] : null; |
565 | 565 | $ciudad = !empty($emisor['CiudadOrigen']) ? $emisor['CiudadOrigen'] : \sasco\LibreDTE\Chile::getCiudad($comuna); |
566 | - $this->MultiTexto($direccion.($comuna?(', '.$comuna):'').($ciudad?(', '.$ciudad):''), $x, $this->y, 'L', ($h_folio and $h_folio < $this->getY()) ? $w_all : $w); |
|
566 | + $this->MultiTexto($direccion.($comuna ? (', '.$comuna) : '').($ciudad ? (', '.$ciudad) : ''), $x, $this->y, 'L', ($h_folio and $h_folio<$this->getY()) ? $w_all : $w); |
|
567 | 567 | if (!empty($emisor['Sucursal'])) { |
568 | - $this->MultiTexto('Sucursal: '.$emisor['Sucursal'], $x, $this->y, 'L', ($h_folio and $h_folio < $this->getY()) ? $w_all : $w); |
|
568 | + $this->MultiTexto('Sucursal: '.$emisor['Sucursal'], $x, $this->y, 'L', ($h_folio and $h_folio<$this->getY()) ? $w_all : $w); |
|
569 | 569 | } |
570 | 570 | if (!empty($this->casa_matriz)) { |
571 | - $this->MultiTexto('Casa matriz: '.$this->casa_matriz, $x, $this->y, 'L', ($h_folio and $h_folio < $this->getY()) ? $w_all : $w); |
|
571 | + $this->MultiTexto('Casa matriz: '.$this->casa_matriz, $x, $this->y, 'L', ($h_folio and $h_folio<$this->getY()) ? $w_all : $w); |
|
572 | 572 | } |
573 | 573 | $contacto = []; |
574 | 574 | if (!empty($emisor['Telefono'])) { |
@@ -583,7 +583,7 @@ discard block |
||
583 | 583 | $contacto[] = $emisor['CorreoEmisor']; |
584 | 584 | } |
585 | 585 | if ($contacto) { |
586 | - $this->MultiTexto(implode(' / ', $contacto), $x, $this->y, 'L', ($h_folio and $h_folio < $this->getY()) ? $w_all : $w); |
|
586 | + $this->MultiTexto(implode(' / ', $contacto), $x, $this->y, 'L', ($h_folio and $h_folio<$this->getY()) ? $w_all : $w); |
|
587 | 587 | } |
588 | 588 | } |
589 | 589 | return $this->y; |
@@ -613,12 +613,12 @@ discard block |
||
613 | 613 | protected function agregarFolio($rut, $tipo, $folio, $sucursal_sii = null, $x = 130, $y = 15, $w = 70, $font_size = null, array $color = null) |
614 | 614 | { |
615 | 615 | if ($color===null) { |
616 | - $color = $tipo ? ($tipo==52 ? [0,172,140] : [255,0,0]) : [0,0,0]; |
|
616 | + $color = $tipo ? ($tipo==52 ? [0, 172, 140] : [255, 0, 0]) : [0, 0, 0]; |
|
617 | 617 | } |
618 | 618 | $this->SetTextColorArray($color); |
619 | 619 | // colocar rut emisor, glosa documento y folio |
620 | 620 | list($rut, $dv) = explode('-', $rut); |
621 | - $this->setFont ('', 'B', $font_size ? $font_size : 15); |
|
621 | + $this->setFont('', 'B', $font_size ? $font_size : 15); |
|
622 | 622 | $this->MultiTexto('R.U.T.: '.$this->num($rut).'-'.$dv, $x, $y+4, 'C', $w); |
623 | 623 | $this->setFont('', 'B', $font_size ? $font_size : 12); |
624 | 624 | $this->MultiTexto($this->getTipo($tipo, $folio), $x, null, 'C', $w); |
@@ -631,7 +631,7 @@ discard block |
||
631 | 631 | if ($tipo) { |
632 | 632 | $this->Texto('S.I.I. - '.\sasco\LibreDTE\Sii::getDireccionRegional($sucursal_sii), $x, $this->getY()+4, 'C', $w); |
633 | 633 | } |
634 | - $this->SetTextColorArray([0,0,0]); |
|
634 | + $this->SetTextColorArray([0, 0, 0]); |
|
635 | 635 | $this->Ln(); |
636 | 636 | return $this->y; |
637 | 637 | } |
@@ -745,10 +745,10 @@ discard block |
||
745 | 745 | } |
746 | 746 | if (!empty($receptor['RznSocRecep'])) { |
747 | 747 | $this->setFont('', 'B', null); |
748 | - $this->Texto(in_array($this->dte, [39, 41]) ? 'Nombre' : ($x==10?'Razón social':'Razón soc.'), $x); |
|
748 | + $this->Texto(in_array($this->dte, [39, 41]) ? 'Nombre' : ($x==10 ? 'Razón social' : 'Razón soc.'), $x); |
|
749 | 749 | $this->Texto(':', $x+$offset); |
750 | 750 | $this->setFont('', '', null); |
751 | - $this->MultiTexto($receptor['RznSocRecep'], $x+$offset+2, null, '', $x==10?105:0); |
|
751 | + $this->MultiTexto($receptor['RznSocRecep'], $x+$offset+2, null, '', $x==10 ? 105 : 0); |
|
752 | 752 | } |
753 | 753 | if (!empty($receptor['GiroRecep'])) { |
754 | 754 | $this->setFont('', 'B', null); |
@@ -765,7 +765,7 @@ discard block |
||
765 | 765 | $ciudad = !empty($receptor['CiudadRecep']) ? $receptor['CiudadRecep'] : ( |
766 | 766 | !empty($receptor['CmnaRecep']) ? \sasco\LibreDTE\Chile::getCiudad($receptor['CmnaRecep']) : '' |
767 | 767 | ); |
768 | - $this->MultiTexto($receptor['DirRecep'].(!empty($receptor['CmnaRecep'])?(', '.$receptor['CmnaRecep']):'').($ciudad?(', '.$ciudad):''), $x+$offset+2); |
|
768 | + $this->MultiTexto($receptor['DirRecep'].(!empty($receptor['CmnaRecep']) ? (', '.$receptor['CmnaRecep']) : '').($ciudad ? (', '.$ciudad) : ''), $x+$offset+2); |
|
769 | 769 | } |
770 | 770 | if (!empty($receptor['Extranjero']['Nacionalidad'])) { |
771 | 771 | $this->setFont('', 'B', null); |
@@ -806,7 +806,7 @@ discard block |
||
806 | 806 | $this->Texto('Cód. recep.', $x); |
807 | 807 | $this->Texto(':', $x+$offset); |
808 | 808 | $this->setFont('', '', null); |
809 | - $this->MultiTexto($receptor['CdgIntRecep'], $x+$offset+2, null, '', $x==10?105:0); |
|
809 | + $this->MultiTexto($receptor['CdgIntRecep'], $x+$offset+2, null, '', $x==10 ? 105 : 0); |
|
810 | 810 | } |
811 | 811 | return $this->GetY(); |
812 | 812 | } |
@@ -903,7 +903,7 @@ discard block |
||
903 | 903 | { |
904 | 904 | if (!isset($referencias[0])) |
905 | 905 | $referencias = [$referencias]; |
906 | - foreach($referencias as $r) { |
|
906 | + foreach ($referencias as $r) { |
|
907 | 907 | $texto = $r['NroLinRef'].' - '; |
908 | 908 | if (!empty($r['TpoDocRef'])) { |
909 | 909 | $texto .= $this->getTipo($r['TpoDocRef']).' '; |
@@ -964,7 +964,7 @@ discard block |
||
964 | 964 | // quitar columnas |
965 | 965 | foreach ($item as $col => $valor) { |
966 | 966 | if ($col=='DscItem' and !empty($item['DscItem'])) { |
967 | - $item['NmbItem'] .= !$this->item_detalle_posicion ? ($html?'<br/>':"\n") : ': '; |
|
967 | + $item['NmbItem'] .= !$this->item_detalle_posicion ? ($html ? '<br/>' : "\n") : ': '; |
|
968 | 968 | $item['DscItem'] = $html ? str_replace("\n", '<br/>', $item['DscItem']) : str_replace(['<br/>', '<br>'], "\n", $item['DscItem']); |
969 | 969 | if ($html) { |
970 | 970 | $item['NmbItem'] .= '<span style="font-size:0.7em">'.$item['DscItem'].'</span>'; |
@@ -1013,7 +1013,7 @@ discard block |
||
1013 | 1013 | } |
1014 | 1014 | $item = array_merge($item_default, $item); |
1015 | 1015 | // si hay código de item se extrae su valor |
1016 | - if (!empty($item['CdgItem']['VlrCodigo'])){ |
|
1016 | + if (!empty($item['CdgItem']['VlrCodigo'])) { |
|
1017 | 1017 | $item['CdgItem'] = $item['CdgItem']['VlrCodigo']; |
1018 | 1018 | } |
1019 | 1019 | // dar formato a números |
@@ -1056,9 +1056,9 @@ discard block |
||
1056 | 1056 | $this->SetY($this->getY()+1); |
1057 | 1057 | $p1x = $x; |
1058 | 1058 | $p1y = $this->y; |
1059 | - $p2x = $this->getPageWidth() - 2; |
|
1060 | - $p2y = $p1y; // Use same y for a straight line |
|
1061 | - $style = array('width' => 0.2,'color' => array(0, 0, 0)); |
|
1059 | + $p2x = $this->getPageWidth()-2; |
|
1060 | + $p2y = $p1y; // Use same y for a straight line |
|
1061 | + $style = array('width' => 0.2, 'color' => array(0, 0, 0)); |
|
1062 | 1062 | $this->Line($p1x, $p1y, $p2x, $p2y, $style); |
1063 | 1063 | $this->Texto($this->detalle_cols['NmbItem']['title'], $x+$offsets[0], $this->y, ucfirst($this->detalle_cols['NmbItem']['align'][0]), $this->detalle_cols['NmbItem']['width']); |
1064 | 1064 | $this->Texto($this->detalle_cols['PrcItem']['title'], $x+$offsets[1], $this->y, ucfirst($this->detalle_cols['PrcItem']['align'][0]), $this->detalle_cols['PrcItem']['width']); |
@@ -1070,7 +1070,7 @@ discard block |
||
1070 | 1070 | } |
1071 | 1071 | // mostrar items |
1072 | 1072 | $this->SetY($this->getY()+2); |
1073 | - foreach($detalle as &$d) { |
|
1073 | + foreach ($detalle as &$d) { |
|
1074 | 1074 | // nombre y descripción del item |
1075 | 1075 | $item = $d['NmbItem']; |
1076 | 1076 | if ($this->papel_continuo_item_detalle and !empty($d['DscItem'])) { |
@@ -1080,15 +1080,15 @@ discard block |
||
1080 | 1080 | // descuento |
1081 | 1081 | if (!empty($d['DescuentoPct']) or !empty($d['DescuentoMonto'])) { |
1082 | 1082 | if (!empty($d['DescuentoPct'])) { |
1083 | - $descuento = number_format($d['DescuentoPct'],0,',','.').'%'; |
|
1083 | + $descuento = number_format($d['DescuentoPct'], 0, ',', '.').'%'; |
|
1084 | 1084 | } else { |
1085 | - $descuento = number_format($d['DescuentoMonto'],0,',','.'); |
|
1085 | + $descuento = number_format($d['DescuentoMonto'], 0, ',', '.'); |
|
1086 | 1086 | } |
1087 | 1087 | $this->Texto('Desc.: '.$descuento, $x+$offsets[0], $this->y, ucfirst($this->detalle_cols['NmbItem']['align'][0]), $this->detalle_cols['NmbItem']['width']); |
1088 | 1088 | } |
1089 | 1089 | // precio y cantidad |
1090 | 1090 | if (isset($d['PrcItem'])) { |
1091 | - $this->Texto(number_format($d['PrcItem'],0,',','.'), $x+$offsets[1], $this->y, ucfirst($this->detalle_cols['PrcItem']['align'][0]), $this->detalle_cols['PrcItem']['width']); |
|
1091 | + $this->Texto(number_format($d['PrcItem'], 0, ',', '.'), $x+$offsets[1], $this->y, ucfirst($this->detalle_cols['PrcItem']['align'][0]), $this->detalle_cols['PrcItem']['width']); |
|
1092 | 1092 | } |
1093 | 1093 | if (isset($d['QtyItem'])) { |
1094 | 1094 | $this->Texto($this->num($d['QtyItem']), $x+$offsets[2], $this->y, ucfirst($this->detalle_cols['QtyItem']['align'][0]), $this->detalle_cols['QtyItem']['width']); |
@@ -1111,7 +1111,7 @@ discard block |
||
1111 | 1111 | if (!isset($detalle[0])) { |
1112 | 1112 | $detalle = [$detalle]; |
1113 | 1113 | } |
1114 | - foreach($detalle as &$d) { |
|
1114 | + foreach ($detalle as &$d) { |
|
1115 | 1115 | if (!empty($d['MontoItem'])) { |
1116 | 1116 | $subtotal += $d['MontoItem']; |
1117 | 1117 | } |
@@ -1138,18 +1138,18 @@ discard block |
||
1138 | 1138 | if (!isset($descuentosRecargos[0])) { |
1139 | 1139 | $descuentosRecargos = [$descuentosRecargos]; |
1140 | 1140 | } |
1141 | - foreach($descuentosRecargos as $dr) { |
|
1141 | + foreach ($descuentosRecargos as $dr) { |
|
1142 | 1142 | $tipo = $dr['TpoMov']=='D' ? 'Descuento' : 'Recargo'; |
1143 | 1143 | if (!empty($dr['IndExeDR'])) { |
1144 | 1144 | $tipo .= ' EX'; |
1145 | 1145 | } |
1146 | 1146 | $valor = $dr['TpoValor']=='%' ? $dr['ValorDR'].'%' : $this->num($dr['ValorDR']); |
1147 | 1147 | if ($this->papelContinuo) { |
1148 | - $glosa = $tipo.' global'.(!empty($dr['GlosaDR'])?(' ('.$dr['GlosaDR'].')'):'').':'; |
|
1148 | + $glosa = $tipo.' global'.(!empty($dr['GlosaDR']) ? (' ('.$dr['GlosaDR'].')') : '').':'; |
|
1149 | 1149 | $this->Texto($glosa, $x, null, 'R', 30); |
1150 | 1150 | $this->Texto($valor, $x+$offset, null, 'R', 30); |
1151 | 1151 | } else { |
1152 | - $this->Texto($tipo.(!empty($dr['GlosaDR'])?(' ('.$dr['GlosaDR'].')'):'').':', 77, null, 'R', 100); |
|
1152 | + $this->Texto($tipo.(!empty($dr['GlosaDR']) ? (' ('.$dr['GlosaDR'].')') : '').':', 77, null, 'R', 100); |
|
1153 | 1153 | $this->Texto($valor, 177, null, 'R', 22); |
1154 | 1154 | } |
1155 | 1155 | $this->Ln(); |
@@ -1169,8 +1169,8 @@ discard block |
||
1169 | 1169 | $pagos = [$pagos]; |
1170 | 1170 | $this->Texto('Pago(s) programado(s):', $x); |
1171 | 1171 | $this->Ln(); |
1172 | - foreach($pagos as $p) { |
|
1173 | - $this->Texto(' - '.$this->date($p['FchPago'], false).': $'.$this->num($p['MntPago']).'.-'.(!empty($p['GlosaPagos'])?(' ('.$p['GlosaPagos'].')'):''), $x); |
|
1172 | + foreach ($pagos as $p) { |
|
1173 | + $this->Texto(' - '.$this->date($p['FchPago'], false).': $'.$this->num($p['MntPago']).'.-'.(!empty($p['GlosaPagos']) ? (' ('.$p['GlosaPagos'].')') : ''), $x); |
|
1174 | 1174 | $this->Ln(); |
1175 | 1175 | } |
1176 | 1176 | } |
@@ -1204,7 +1204,7 @@ discard block |
||
1204 | 1204 | 'TpoMoneda' => 'Moneda', |
1205 | 1205 | 'MntNeto' => 'Neto $', |
1206 | 1206 | 'MntExe' => 'Exento $', |
1207 | - 'IVA' => 'IVA '.(!empty($totales['TasaIVA'])?(' ('.$totales['TasaIVA'].'%) '):'').'$', |
|
1207 | + 'IVA' => 'IVA '.(!empty($totales['TasaIVA']) ? (' ('.$totales['TasaIVA'].'%) ') : '').'$', |
|
1208 | 1208 | 'IVANoRet' => 'IVA no retenido $', |
1209 | 1209 | 'CredEC' => 'Desc. 65% IVA $', |
1210 | 1210 | 'MntTotal' => 'Total $', |
@@ -1221,7 +1221,7 @@ discard block |
||
1221 | 1221 | if (!isset($ImptoReten[0])) { |
1222 | 1222 | $ImptoReten = [$ImptoReten]; |
1223 | 1223 | } |
1224 | - foreach($ImptoReten as $i) { |
|
1224 | + foreach ($ImptoReten as $i) { |
|
1225 | 1225 | $totales['ImptoReten_'.$i['TipoImp']] = $i['MontoImp']; |
1226 | 1226 | if (!empty($i['TasaImp'])) { |
1227 | 1227 | $glosas['ImptoReten_'.$i['TipoImp']] = \sasco\LibreDTE\Sii\ImpuestosAdicionales::getGlosa($i['TipoImp']).' ('.$i['TasaImp'].'%) $'; |
@@ -1334,9 +1334,9 @@ discard block |
||
1334 | 1334 | 'vpadding' => 0, |
1335 | 1335 | 'module_width' => 1, // width of a single module in points |
1336 | 1336 | 'module_height' => 1, // height of a single module in points |
1337 | - 'fgcolor' => [0,0,0], |
|
1337 | + 'fgcolor' => [0, 0, 0], |
|
1338 | 1338 | 'bgcolor' => false, // [255,255,255] |
1339 | - 'position' => $position === null ? ($this->papelContinuo ? 'C' : 'S') : $position, |
|
1339 | + 'position' => $position===null ? ($this->papelContinuo ? 'C' : 'S') : $position, |
|
1340 | 1340 | ]; |
1341 | 1341 | $ecl = version_compare(phpversion(), '7.0.0', '<') ? -1 : $this->ecl; |
1342 | 1342 | $this->write2DBarcode($timbre, 'PDF417,,'.$ecl, $x_timbre, $y, $w, 0, $style, 'B'); |
@@ -1367,7 +1367,7 @@ discard block |
||
1367 | 1367 | protected function agregarAcuseRecibo($x = 83, $y = 190, $w = 60, $h = 40, $line = 25) |
1368 | 1368 | { |
1369 | 1369 | $y = (!$this->papelContinuo and !$this->timbre_pie) ? $this->x_fin_datos : $y; |
1370 | - $this->SetTextColorArray([0,0,0]); |
|
1370 | + $this->SetTextColorArray([0, 0, 0]); |
|
1371 | 1371 | $this->Rect($x, $y, $w, $h, 'D', ['all' => ['width' => 0.1, 'color' => [0, 0, 0]]]); |
1372 | 1372 | $this->setFont('', 'B', 10); |
1373 | 1373 | $this->Texto('Acuse de recibo', $x, $y+1, 'C', $w); |
@@ -1397,9 +1397,9 @@ discard block |
||
1397 | 1397 | */ |
1398 | 1398 | protected function agregarAcuseReciboContinuo($x = 3, $y = null, $w = 68, $h = 40) |
1399 | 1399 | { |
1400 | - $this->SetTextColorArray([0,0,0]); |
|
1400 | + $this->SetTextColorArray([0, 0, 0]); |
|
1401 | 1401 | $this->Rect($x, $y, $w, $h, 'D', ['all' => ['width' => 0.1, 'color' => [0, 0, 0]]]); |
1402 | - $style = array('width' => 0.2,'color' => array(0, 0, 0)); |
|
1402 | + $style = array('width' => 0.2, 'color' => array(0, 0, 0)); |
|
1403 | 1403 | $this->Line($x, $y+22, $w+3, $y+22, $style); |
1404 | 1404 | //$this->setFont('', 'B', 10); |
1405 | 1405 | //$this->Texto('Acuse de recibo', $x, $y+1, 'C', $w); |
@@ -1429,7 +1429,7 @@ discard block |
||
1429 | 1429 | $y = (!$this->papelContinuo and !$this->timbre_pie and $this->x_fin_datos<=$y) ? $this->x_fin_datos : $y; |
1430 | 1430 | $y += 48; |
1431 | 1431 | $this->setFont('', 'B', $font_size); |
1432 | - $this->Texto('CEDIBLE'.($tipo==52?' CON SU FACTURA':''), null, $y, 'R'); |
|
1432 | + $this->Texto('CEDIBLE'.($tipo==52 ? ' CON SU FACTURA' : ''), null, $y, 'R'); |
|
1433 | 1433 | } |
1434 | 1434 | |
1435 | 1435 | /** |
@@ -1440,7 +1440,7 @@ discard block |
||
1440 | 1440 | protected function agregarLeyendaDestinoContinuo($tipo) |
1441 | 1441 | { |
1442 | 1442 | $this->setFont('', 'B', 8); |
1443 | - $this->Texto('CEDIBLE'.($tipo==52?' CON SU FACTURA':''), null, $this->y+6, 'R'); |
|
1443 | + $this->Texto('CEDIBLE'.($tipo==52 ? ' CON SU FACTURA' : ''), null, $this->y+6, 'R'); |
|
1444 | 1444 | } |
1445 | 1445 | |
1446 | 1446 | } |