@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | /** |
78 | 78 | * Método que asigna la ubicación del logo de la empresa |
79 | 79 | * @param logo URI del logo (puede ser local o en una URL) |
80 | - * @param posicion Posición respecto a datos del emisor (=0 izq, =1 arriba) |
|
80 | + * @param posicion integer respecto a datos del emisor (=0 izq, =1 arriba) |
|
81 | 81 | * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl) |
82 | 82 | * @version 2016-08-04 |
83 | 83 | */ |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | * contínuo |
222 | 222 | * @param dte Arreglo con los datos del XML (tag Documento) |
223 | 223 | * @param timbre String XML con el tag TED del DTE |
224 | - * @param width Ancho del papel contínuo en mm |
|
224 | + * @param width boolean del papel contínuo en mm |
|
225 | 225 | * @author Pablo Reyes (https://github.com/pabloxp) |
226 | 226 | * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl) |
227 | 227 | * @version 2017-10-24 |
@@ -383,10 +383,11 @@ discard block |
||
383 | 383 | * - Dirección casa central del emisor |
384 | 384 | * - Dirección sucursales |
385 | 385 | * @param emisor Arreglo con los datos del emisor (tag Emisor del XML) |
386 | - * @param x Posición horizontal de inicio en el PDF |
|
387 | - * @param y Posición vertical de inicio en el PDF |
|
388 | - * @param w Ancho de la información del emisor |
|
389 | - * @param w_img Ancho máximo de la imagen |
|
386 | + * @param x integer horizontal de inicio en el PDF |
|
387 | + * @param y integer vertical de inicio en el PDF |
|
388 | + * @param w integer de la información del emisor |
|
389 | + * @param w_img integer máximo de la imagen |
|
390 | + * @param integer $font_size |
|
390 | 391 | * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl) |
391 | 392 | * @version 2018-06-15 |
392 | 393 | */ |
@@ -460,11 +461,13 @@ discard block |
||
460 | 461 | * @param rut RUT del emisor |
461 | 462 | * @param tipo Código o glosa del tipo de documento |
462 | 463 | * @param sucursal_sii Código o glosa de la sucursal del SII del Emisor |
463 | - * @param x Posición horizontal de inicio en el PDF |
|
464 | - * @param y Posición vertical de inicio en el PDF |
|
465 | - * @param w Ancho de la información del emisor |
|
464 | + * @param x integer horizontal de inicio en el PDF |
|
465 | + * @param y integer vertical de inicio en el PDF |
|
466 | + * @param w integer de la información del emisor |
|
467 | + * @param integer $font_size |
|
466 | 468 | * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl) |
467 | 469 | * @version 2016-12-02 |
470 | + * @return integer |
|
468 | 471 | */ |
469 | 472 | protected function agregarFolio($rut, $tipo, $folio, $sucursal_sii = null, $x = 130, $y = 15, $w = 70, $font_size = null, array $color = null) |
470 | 473 | { |
@@ -496,7 +499,7 @@ discard block |
||
496 | 499 | * Método que agrega los datos de la emisión del DTE que no son los dato del |
497 | 500 | * receptor |
498 | 501 | * @param IdDoc Información general del documento |
499 | - * @param x Posición horizontal de inicio en el PDF |
|
502 | + * @param x integer horizontal de inicio en el PDF |
|
500 | 503 | * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl) |
501 | 504 | * @version 2017-06-15 |
502 | 505 | */ |
@@ -584,7 +587,7 @@ discard block |
||
584 | 587 | /** |
585 | 588 | * Método que agrega los datos del receptor |
586 | 589 | * @param receptor Arreglo con los datos del receptor (tag Receptor del XML) |
587 | - * @param x Posición horizontal de inicio en el PDF |
|
590 | + * @param x integer horizontal de inicio en el PDF |
|
588 | 591 | * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl) |
589 | 592 | * @version 2019-02-13 |
590 | 593 | */ |
@@ -671,7 +674,7 @@ discard block |
||
671 | 674 | * Método que agrega los datos del traslado |
672 | 675 | * @param IndTraslado |
673 | 676 | * @param Transporte |
674 | - * @param x Posición horizontal de inicio en el PDF |
|
677 | + * @param x integer horizontal de inicio en el PDF |
|
675 | 678 | * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl) |
676 | 679 | * @version 2016-08-03 |
677 | 680 | */ |
@@ -742,7 +745,7 @@ discard block |
||
742 | 745 | /** |
743 | 746 | * Método que agrega las referencias del documento |
744 | 747 | * @param referencias Arreglo con las referencias del documento (tag Referencia del XML) |
745 | - * @param x Posición horizontal de inicio en el PDF |
|
748 | + * @param x integer horizontal de inicio en el PDF |
|
746 | 749 | * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl) |
747 | 750 | * @version 2017-09-25 |
748 | 751 | */ |
@@ -779,7 +782,7 @@ discard block |
||
779 | 782 | /** |
780 | 783 | * Método que agrega el detalle del documento |
781 | 784 | * @param detalle Arreglo con el detalle del documento (tag Detalle del XML) |
782 | - * @param x Posición horizontal de inicio en el PDF |
|
785 | + * @param x integer horizontal de inicio en el PDF |
|
783 | 786 | * @param y Posición vertical de inicio en el PDF |
784 | 787 | * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl) |
785 | 788 | * @version 2018-11-04 |
@@ -859,7 +862,7 @@ discard block |
||
859 | 862 | /** |
860 | 863 | * Método que agrega el detalle del documento |
861 | 864 | * @param detalle Arreglo con el detalle del documento (tag Detalle del XML) |
862 | - * @param x Posición horizontal de inicio en el PDF |
|
865 | + * @param x integer horizontal de inicio en el PDF |
|
863 | 866 | * @param y Posición vertical de inicio en el PDF |
864 | 867 | * @author Pablo Reyes (https://github.com/pabloxp) |
865 | 868 | * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl) |
@@ -895,7 +898,7 @@ discard block |
||
895 | 898 | * Método que agrega el subtotal del DTE |
896 | 899 | * @param detalle Arreglo con los detalles del documentos para poder |
897 | 900 | * calcular subtotal |
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 2016-08-17 |
901 | 904 | */ |
@@ -921,7 +924,7 @@ discard block |
||
921 | 924 | /** |
922 | 925 | * Método que agrega los descuentos y/o recargos globales del documento |
923 | 926 | * @param descuentosRecargos Arreglo con los descuentos y/o recargos del documento (tag DscRcgGlobal del XML) |
924 | - * @param x Posición horizontal de inicio en el PDF |
|
927 | + * @param x integer horizontal de inicio en el PDF |
|
925 | 928 | * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl) |
926 | 929 | * @version 2018-05-29 |
927 | 930 | */ |
@@ -949,7 +952,7 @@ discard block |
||
949 | 952 | /** |
950 | 953 | * Método que agrega los pagos del documento |
951 | 954 | * @param pagos Arreglo con los pagos del documento |
952 | - * @param x Posición horizontal de inicio en el PDF |
|
955 | + * @param x integer horizontal de inicio en el PDF |
|
953 | 956 | * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl) |
954 | 957 | * @version 2016-07-24 |
955 | 958 | */ |
@@ -1107,9 +1110,9 @@ discard block |
||
1107 | 1110 | * - Se imprime en el tamaño mínimo: 2x5 cms |
1108 | 1111 | * - En el lado de abajo con margen izquierdo mínimo de 2 cms |
1109 | 1112 | * @param timbre String con los datos del timbre |
1110 | - * @param x Posición horizontal de inicio en el PDF |
|
1111 | - * @param y Posición vertical de inicio en el PDF |
|
1112 | - * @param w Ancho del timbre |
|
1113 | + * @param x integer horizontal de inicio en el PDF |
|
1114 | + * @param y integer vertical de inicio en el PDF |
|
1115 | + * @param w integer del timbre |
|
1113 | 1116 | * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl) |
1114 | 1117 | * @version 2018-04-12 |
1115 | 1118 | */ |
@@ -1147,10 +1150,10 @@ discard block |
||
1147 | 1150 | |
1148 | 1151 | /** |
1149 | 1152 | * Método que agrega el acuse de rebido |
1150 | - * @param x Posición horizontal de inicio en el PDF |
|
1151 | - * @param y Posición vertical de inicio en el PDF |
|
1152 | - * @param w Ancho del acuse de recibo |
|
1153 | - * @param h Alto del acuse de recibo |
|
1153 | + * @param x integer horizontal de inicio en el PDF |
|
1154 | + * @param y integer vertical de inicio en el PDF |
|
1155 | + * @param w integer del acuse de recibo |
|
1156 | + * @param h integer del acuse de recibo |
|
1154 | 1157 | * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl) |
1155 | 1158 | * @version 2018-04-13 |
1156 | 1159 | */ |
@@ -1178,10 +1181,10 @@ discard block |
||
1178 | 1181 | |
1179 | 1182 | /** |
1180 | 1183 | * Método que agrega el acuse de rebido |
1181 | - * @param x Posición horizontal de inicio en el PDF |
|
1184 | + * @param x integer horizontal de inicio en el PDF |
|
1182 | 1185 | * @param y Posición vertical de inicio en el PDF |
1183 | - * @param w Ancho del acuse de recibo |
|
1184 | - * @param h Alto del acuse de recibo |
|
1186 | + * @param w integer del acuse de recibo |
|
1187 | + * @param h integer del acuse de recibo |
|
1185 | 1188 | * @author Pablo Reyes (https://github.com/pabloxp) |
1186 | 1189 | * @version 2015-11-17 |
1187 | 1190 | */ |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | { |
72 | 72 | parent::__construct(); |
73 | 73 | $this->SetTitle('Documento Tributario Electrónico (DTE) de Chile by LibreDTE'); |
74 | - $this->papelContinuo = $papelContinuo === true ? 80 : $papelContinuo; |
|
74 | + $this->papelContinuo = $papelContinuo===true ? 80 : $papelContinuo; |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | /** |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | $this->setY(max($y)); |
182 | 182 | $this->Ln(); |
183 | 183 | $y = []; |
184 | - $y[] = $this->agregarDatosEmision($dte['Encabezado']['IdDoc'], !empty($dte['Encabezado']['Emisor']['CdgVendedor'])?$dte['Encabezado']['Emisor']['CdgVendedor']:null); |
|
184 | + $y[] = $this->agregarDatosEmision($dte['Encabezado']['IdDoc'], !empty($dte['Encabezado']['Emisor']['CdgVendedor']) ? $dte['Encabezado']['Emisor']['CdgVendedor'] : null); |
|
185 | 185 | $y[] = $this->agregarReceptor($dte['Encabezado']); |
186 | 186 | $this->setY(max($y)); |
187 | 187 | $this->agregarTraslado( |
@@ -241,15 +241,15 @@ discard block |
||
241 | 241 | $dte['Encabezado']['IdDoc']['TipoDTE'], |
242 | 242 | $dte['Encabezado']['IdDoc']['Folio'], |
243 | 243 | $dte['Encabezado']['Emisor']['CmnaOrigen'], |
244 | - $x_start, $y_start, $width-($x_start*4), 10, |
|
245 | - [0,0,0] |
|
244 | + $x_start, $y_start, $width-($x_start * 4), 10, |
|
245 | + [0, 0, 0] |
|
246 | 246 | ); |
247 | - $y = $this->agregarEmisor($dte['Encabezado']['Emisor'], $x_start, $y+2, $width-($x_start*45), 8, 9, [0,0,0]); |
|
247 | + $y = $this->agregarEmisor($dte['Encabezado']['Emisor'], $x_start, $y+2, $width-($x_start * 45), 8, 9, [0, 0, 0]); |
|
248 | 248 | // datos del documento |
249 | 249 | $this->SetY($y); |
250 | 250 | $this->Ln(); |
251 | 251 | $this->setFont('', '', 8); |
252 | - $this->agregarDatosEmision($dte['Encabezado']['IdDoc'], !empty($dte['Encabezado']['Emisor']['CdgVendedor'])?$dte['Encabezado']['Emisor']['CdgVendedor']:null, $x_start, $offset, false); |
|
252 | + $this->agregarDatosEmision($dte['Encabezado']['IdDoc'], !empty($dte['Encabezado']['Emisor']['CdgVendedor']) ? $dte['Encabezado']['Emisor']['CdgVendedor'] : null, $x_start, $offset, false); |
|
253 | 253 | $this->agregarReceptor($dte['Encabezado'], $x_start, $offset); |
254 | 254 | $this->agregarTraslado( |
255 | 255 | !empty($dte['Encabezado']['IdDoc']['IndTraslado']) ? $dte['Encabezado']['IdDoc']['IndTraslado'] : null, |
@@ -302,7 +302,7 @@ discard block |
||
302 | 302 | $this->AddPage('P', [$height ? $height : $this->papel_continuo_alto, $width]); |
303 | 303 | $x = 1; |
304 | 304 | $y = 5; |
305 | - $this->SetXY($x,$y); |
|
305 | + $this->SetXY($x, $y); |
|
306 | 306 | // agregar datos del documento |
307 | 307 | $this->setFont('', '', 8); |
308 | 308 | $this->MultiTexto(!empty($dte['Encabezado']['Emisor']['RznSoc']) ? $dte['Encabezado']['Emisor']['RznSoc'] : $dte['Encabezado']['Emisor']['RznSocEmisor'], $x, null, '', $width-2); |
@@ -398,13 +398,13 @@ discard block |
||
398 | 398 | $this->logo['uri'], |
399 | 399 | $x, |
400 | 400 | $y, |
401 | - !$this->logo['posicion']?$w_img:null, $this->logo['posicion']?($w_img/2):null, |
|
401 | + !$this->logo['posicion'] ? $w_img : null, $this->logo['posicion'] ? ($w_img / 2) : null, |
|
402 | 402 | 'PNG', |
403 | - (isset($emisor['url'])?$emisor['url']:''), |
|
403 | + (isset($emisor['url']) ? $emisor['url'] : ''), |
|
404 | 404 | 'T' |
405 | 405 | ); |
406 | 406 | if ($this->logo['posicion']) { |
407 | - $this->SetY($this->y + ($w_img/2)); |
|
407 | + $this->SetY($this->y+($w_img / 2)); |
|
408 | 408 | $w += 40; |
409 | 409 | } else { |
410 | 410 | $x = $this->x+3; |
@@ -415,14 +415,14 @@ discard block |
||
415 | 415 | } |
416 | 416 | // agregar datos del emisor |
417 | 417 | $this->setFont('', 'B', $font_size ? $font_size : 14); |
418 | - $this->SetTextColorArray($color===null?[32, 92, 144]:$color); |
|
418 | + $this->SetTextColorArray($color===null ? [32, 92, 144] : $color); |
|
419 | 419 | $this->MultiTexto(!empty($emisor['RznSoc']) ? $emisor['RznSoc'] : $emisor['RznSocEmisor'], $x, $this->y+2, 'L', $w); |
420 | 420 | $this->setFont('', 'B', $font_size ? $font_size : 9); |
421 | - $this->SetTextColorArray([0,0,0]); |
|
421 | + $this->SetTextColorArray([0, 0, 0]); |
|
422 | 422 | $this->MultiTexto(!empty($emisor['GiroEmis']) ? $emisor['GiroEmis'] : $emisor['GiroEmisor'], $x, $this->y, 'L', $w); |
423 | 423 | $comuna = !empty($emisor['CmnaOrigen']) ? $emisor['CmnaOrigen'] : null; |
424 | 424 | $ciudad = !empty($emisor['CiudadOrigen']) ? $emisor['CiudadOrigen'] : \sasco\LibreDTE\Chile::getCiudad($comuna); |
425 | - $this->MultiTexto($emisor['DirOrigen'].($comuna?(', '.$comuna):'').($ciudad?(', '.$ciudad):''), $x, $this->y, 'L', $w); |
|
425 | + $this->MultiTexto($emisor['DirOrigen'].($comuna ? (', '.$comuna) : '').($ciudad ? (', '.$ciudad) : ''), $x, $this->y, 'L', $w); |
|
426 | 426 | if (!empty($emisor['Sucursal'])) { |
427 | 427 | $this->MultiTexto('Sucursal: '.$emisor['Sucursal'], $x, $this->y, 'L', $w); |
428 | 428 | } |
@@ -469,12 +469,12 @@ discard block |
||
469 | 469 | protected function agregarFolio($rut, $tipo, $folio, $sucursal_sii = null, $x = 130, $y = 15, $w = 70, $font_size = null, array $color = null) |
470 | 470 | { |
471 | 471 | if ($color===null) { |
472 | - $color = $tipo ? ($tipo==52 ? [0,172,140] : [255,0,0]) : [0,0,0]; |
|
472 | + $color = $tipo ? ($tipo==52 ? [0, 172, 140] : [255, 0, 0]) : [0, 0, 0]; |
|
473 | 473 | } |
474 | 474 | $this->SetTextColorArray($color); |
475 | 475 | // colocar rut emisor, glosa documento y folio |
476 | 476 | list($rut, $dv) = explode('-', $rut); |
477 | - $this->setFont ('', 'B', $font_size ? $font_size : 15); |
|
477 | + $this->setFont('', 'B', $font_size ? $font_size : 15); |
|
478 | 478 | $this->MultiTexto('R.U.T.: '.$this->num($rut).'-'.$dv, $x, $y+4, 'C', $w); |
479 | 479 | $this->setFont('', 'B', $font_size ? $font_size : 12); |
480 | 480 | $this->MultiTexto($this->getTipo($tipo), $x, null, 'C', $w); |
@@ -487,7 +487,7 @@ discard block |
||
487 | 487 | if ($tipo) { |
488 | 488 | $this->Texto('S.I.I. - '.\sasco\LibreDTE\Sii::getDireccionRegional($sucursal_sii), $x, $this->getY()+4, 'C', $w); |
489 | 489 | } |
490 | - $this->SetTextColorArray([0,0,0]); |
|
490 | + $this->SetTextColorArray([0, 0, 0]); |
|
491 | 491 | $this->Ln(); |
492 | 492 | return $this->y; |
493 | 493 | } |
@@ -604,7 +604,7 @@ discard block |
||
604 | 604 | $this->Texto(in_array($this->dte, [39, 41]) ? 'Nombre' : 'Razón social', $x); |
605 | 605 | $this->Texto(':', $x+$offset); |
606 | 606 | $this->setFont('', '', null); |
607 | - $this->MultiTexto($receptor['RznSocRecep'], $x+$offset+2, null, '', $x==10?105:0); |
|
607 | + $this->MultiTexto($receptor['RznSocRecep'], $x+$offset+2, null, '', $x==10 ? 105 : 0); |
|
608 | 608 | } |
609 | 609 | if (!empty($receptor['GiroRecep'])) { |
610 | 610 | $this->setFont('', 'B', null); |
@@ -621,7 +621,7 @@ discard block |
||
621 | 621 | $ciudad = !empty($receptor['CiudadRecep']) ? $receptor['CiudadRecep'] : ( |
622 | 622 | !empty($receptor['CmnaRecep']) ? \sasco\LibreDTE\Chile::getCiudad($receptor['CmnaRecep']) : '' |
623 | 623 | ); |
624 | - $this->MultiTexto($receptor['DirRecep'].(!empty($receptor['CmnaRecep'])?(', '.$receptor['CmnaRecep']):'').($ciudad?(', '.$ciudad):''), $x+$offset+2); |
|
624 | + $this->MultiTexto($receptor['DirRecep'].(!empty($receptor['CmnaRecep']) ? (', '.$receptor['CmnaRecep']) : '').($ciudad ? (', '.$ciudad) : ''), $x+$offset+2); |
|
625 | 625 | } |
626 | 626 | if (!empty($receptor['Extranjero']['Nacionalidad'])) { |
627 | 627 | $this->setFont('', 'B', null); |
@@ -662,7 +662,7 @@ discard block |
||
662 | 662 | $this->Texto('Cód. recep.', $x); |
663 | 663 | $this->Texto(':', $x+$offset); |
664 | 664 | $this->setFont('', '', null); |
665 | - $this->MultiTexto($receptor['CdgIntRecep'], $x+$offset+2, null, '', $x==10?105:0); |
|
665 | + $this->MultiTexto($receptor['CdgIntRecep'], $x+$offset+2, null, '', $x==10 ? 105 : 0); |
|
666 | 666 | } |
667 | 667 | return $this->GetY(); |
668 | 668 | } |
@@ -750,7 +750,7 @@ discard block |
||
750 | 750 | { |
751 | 751 | if (!isset($referencias[0])) |
752 | 752 | $referencias = [$referencias]; |
753 | - foreach($referencias as $r) { |
|
753 | + foreach ($referencias as $r) { |
|
754 | 754 | $texto = $r['NroLinRef'].' - '; |
755 | 755 | if (!empty($r['TpoDocRef'])) { |
756 | 756 | $texto .= $this->getTipo($r['TpoDocRef']).' '; |
@@ -801,7 +801,7 @@ discard block |
||
801 | 801 | // quitar columnas |
802 | 802 | foreach ($item as $col => $valor) { |
803 | 803 | if ($col=='DscItem' and !empty($item['DscItem'])) { |
804 | - $item['NmbItem'] .= !$this->item_detalle_posicion ? ($html?'<br/>':"\n") : ': '; |
|
804 | + $item['NmbItem'] .= !$this->item_detalle_posicion ? ($html ? '<br/>' : "\n") : ': '; |
|
805 | 805 | if ($html) { |
806 | 806 | $item['NmbItem'] .= '<span style="font-size:0.7em">'.$item['DscItem'].'</span>'; |
807 | 807 | } else { |
@@ -831,7 +831,7 @@ discard block |
||
831 | 831 | $item_default[$key] = false; |
832 | 832 | $item = array_merge($item_default, $item); |
833 | 833 | // si hay código de item se extrae su valor |
834 | - if (!empty($item['CdgItem']['VlrCodigo'])){ |
|
834 | + if (!empty($item['CdgItem']['VlrCodigo'])) { |
|
835 | 835 | $item['CdgItem'] = $item['CdgItem']['VlrCodigo']; |
836 | 836 | } |
837 | 837 | // dar formato a números |
@@ -870,9 +870,9 @@ discard block |
||
870 | 870 | $this->SetY($this->getY()+1); |
871 | 871 | $p1x = $x; |
872 | 872 | $p1y = $this->y; |
873 | - $p2x = $this->getPageWidth() - 2; |
|
874 | - $p2y = $p1y; // Use same y for a straight line |
|
875 | - $style = array('width' => 0.2,'color' => array(0, 0, 0)); |
|
873 | + $p2x = $this->getPageWidth()-2; |
|
874 | + $p2y = $p1y; // Use same y for a straight line |
|
875 | + $style = array('width' => 0.2, 'color' => array(0, 0, 0)); |
|
876 | 876 | $this->Line($p1x, $p1y, $p2x, $p2y, $style); |
877 | 877 | $this->Texto($this->detalle_cols['NmbItem']['title'], $x+1, $this->y, ucfirst($this->detalle_cols['NmbItem']['align'][0]), $this->detalle_cols['NmbItem']['width']); |
878 | 878 | $this->Texto($this->detalle_cols['PrcItem']['title'], $x+15, $this->y, ucfirst($this->detalle_cols['PrcItem']['align'][0]), $this->detalle_cols['PrcItem']['width']); |
@@ -882,9 +882,9 @@ discard block |
||
882 | 882 | if (!isset($detalle[0])) |
883 | 883 | $detalle = [$detalle]; |
884 | 884 | $this->SetY($this->getY()+2); |
885 | - foreach($detalle as &$d) { |
|
885 | + foreach ($detalle as &$d) { |
|
886 | 886 | $this->MultiTexto($d['NmbItem'], $x+1, $this->y+4, ucfirst($this->detalle_cols['NmbItem']['align'][0]), $this->detalle_cols['NmbItem']['width']); |
887 | - $this->Texto(number_format($d['PrcItem'],0,',','.'), $x+15, $this->y, ucfirst($this->detalle_cols['PrcItem']['align'][0]), $this->detalle_cols['PrcItem']['width']); |
|
887 | + $this->Texto(number_format($d['PrcItem'], 0, ',', '.'), $x+15, $this->y, ucfirst($this->detalle_cols['PrcItem']['align'][0]), $this->detalle_cols['PrcItem']['width']); |
|
888 | 888 | $this->Texto($this->num($d['QtyItem']), $x+35, $this->y, ucfirst($this->detalle_cols['QtyItem']['align'][0]), $this->detalle_cols['QtyItem']['width']); |
889 | 889 | $this->Texto($this->num($d['MontoItem']), $x+45, $this->y, ucfirst($this->detalle_cols['MontoItem']['align'][0]), $this->detalle_cols['MontoItem']['width']); |
890 | 890 | } |
@@ -904,7 +904,7 @@ discard block |
||
904 | 904 | if (!isset($detalle[0])) { |
905 | 905 | $detalle = [$detalle]; |
906 | 906 | } |
907 | - foreach($detalle as &$d) { |
|
907 | + foreach ($detalle as &$d) { |
|
908 | 908 | if (!empty($d['MontoItem'])) { |
909 | 909 | $subtotal += $d['MontoItem']; |
910 | 910 | } |
@@ -930,16 +930,16 @@ discard block |
||
930 | 930 | if (!isset($descuentosRecargos[0])) { |
931 | 931 | $descuentosRecargos = [$descuentosRecargos]; |
932 | 932 | } |
933 | - foreach($descuentosRecargos as $dr) { |
|
933 | + foreach ($descuentosRecargos as $dr) { |
|
934 | 934 | $tipo = $dr['TpoMov']=='D' ? 'Descuento' : 'Recargo'; |
935 | 935 | if (!empty($dr['IndExeDR'])) { |
936 | 936 | $tipo .= ' EX'; |
937 | 937 | } |
938 | 938 | $valor = $dr['TpoValor']=='%' ? $dr['ValorDR'].'%' : $this->num($dr['ValorDR']); |
939 | 939 | if ($this->papelContinuo) { |
940 | - $this->Texto($tipo.' global: '.$valor.(!empty($dr['GlosaDR'])?(' ('.$dr['GlosaDR'].')'):''), $x); |
|
940 | + $this->Texto($tipo.' global: '.$valor.(!empty($dr['GlosaDR']) ? (' ('.$dr['GlosaDR'].')') : ''), $x); |
|
941 | 941 | } else { |
942 | - $this->Texto($tipo.(!empty($dr['GlosaDR'])?(' ('.$dr['GlosaDR'].')'):'').':', 77, null, 'R', 100); |
|
942 | + $this->Texto($tipo.(!empty($dr['GlosaDR']) ? (' ('.$dr['GlosaDR'].')') : '').':', 77, null, 'R', 100); |
|
943 | 943 | $this->Texto($valor, 177, null, 'R', 22); |
944 | 944 | } |
945 | 945 | $this->Ln(); |
@@ -959,8 +959,8 @@ discard block |
||
959 | 959 | $pagos = [$pagos]; |
960 | 960 | $this->Texto('Pago(s) programado(s):', $x); |
961 | 961 | $this->Ln(); |
962 | - foreach($pagos as $p) { |
|
963 | - $this->Texto(' - '.$this->date($p['FchPago'], false).': $'.$this->num($p['MntPago']).'.-'.(!empty($p['GlosaPagos'])?(' ('.$p['GlosaPagos'].')'):''), $x); |
|
962 | + foreach ($pagos as $p) { |
|
963 | + $this->Texto(' - '.$this->date($p['FchPago'], false).': $'.$this->num($p['MntPago']).'.-'.(!empty($p['GlosaPagos']) ? (' ('.$p['GlosaPagos'].')') : ''), $x); |
|
964 | 964 | $this->Ln(); |
965 | 965 | } |
966 | 966 | } |
@@ -1011,7 +1011,7 @@ discard block |
||
1011 | 1011 | if (!isset($ImptoReten[0])) { |
1012 | 1012 | $ImptoReten = [$ImptoReten]; |
1013 | 1013 | } |
1014 | - foreach($ImptoReten as $i) { |
|
1014 | + foreach ($ImptoReten as $i) { |
|
1015 | 1015 | $totales['ImptoReten_'.$i['TipoImp']] = $i['MontoImp']; |
1016 | 1016 | if (!empty($i['TasaImp'])) { |
1017 | 1017 | $glosas['ImptoReten_'.$i['TipoImp']] = \sasco\LibreDTE\Sii\ImpuestosAdicionales::getGlosa($i['TipoImp']).' ('.$i['TasaImp'].'%) $'; |
@@ -1124,7 +1124,7 @@ discard block |
||
1124 | 1124 | 'vpadding' => 0, |
1125 | 1125 | 'module_width' => 1, // width of a single module in points |
1126 | 1126 | 'module_height' => 1, // height of a single module in points |
1127 | - 'fgcolor' => [0,0,0], |
|
1127 | + 'fgcolor' => [0, 0, 0], |
|
1128 | 1128 | 'bgcolor' => false, // [255,255,255] |
1129 | 1129 | 'position' => $this->papelContinuo ? 'C' : 'S', |
1130 | 1130 | ]; |
@@ -1157,7 +1157,7 @@ discard block |
||
1157 | 1157 | protected function agregarAcuseRecibo($x = 83, $y = 190, $w = 60, $h = 40) |
1158 | 1158 | { |
1159 | 1159 | $y = (!$this->papelContinuo and !$this->timbre_pie) ? $this->x_fin_datos : $y; |
1160 | - $this->SetTextColorArray([0,0,0]); |
|
1160 | + $this->SetTextColorArray([0, 0, 0]); |
|
1161 | 1161 | $this->Rect($x, $y, $w, $h, 'D', ['all' => ['width' => 0.1, 'color' => [0, 0, 0]]]); |
1162 | 1162 | $this->setFont('', 'B', 10); |
1163 | 1163 | $this->Texto('Acuse de recibo', $x, $y+1, 'C', $w); |
@@ -1187,9 +1187,9 @@ discard block |
||
1187 | 1187 | */ |
1188 | 1188 | protected function agregarAcuseReciboContinuo($x = 3, $y = null, $w = 68, $h = 40) |
1189 | 1189 | { |
1190 | - $this->SetTextColorArray([0,0,0]); |
|
1190 | + $this->SetTextColorArray([0, 0, 0]); |
|
1191 | 1191 | $this->Rect($x, $y, $w, $h, 'D', ['all' => ['width' => 0.1, 'color' => [0, 0, 0]]]); |
1192 | - $style = array('width' => 0.2,'color' => array(0, 0, 0)); |
|
1192 | + $style = array('width' => 0.2, 'color' => array(0, 0, 0)); |
|
1193 | 1193 | $this->Line($x, $y+22, $w+3, $y+22, $style); |
1194 | 1194 | //$this->setFont('', 'B', 10); |
1195 | 1195 | //$this->Texto('Acuse de recibo', $x, $y+1, 'C', $w); |
@@ -1219,7 +1219,7 @@ discard block |
||
1219 | 1219 | $y = (!$this->papelContinuo and !$this->timbre_pie and $this->x_fin_datos<=$y) ? $this->x_fin_datos : $y; |
1220 | 1220 | $y += 48; |
1221 | 1221 | $this->setFont('', 'B', $font_size); |
1222 | - $this->Texto('CEDIBLE'.($tipo==52?' CON SU FACTURA':''), null, $y, 'R'); |
|
1222 | + $this->Texto('CEDIBLE'.($tipo==52 ? ' CON SU FACTURA' : ''), null, $y, 'R'); |
|
1223 | 1223 | } |
1224 | 1224 | |
1225 | 1225 | /** |
@@ -1230,7 +1230,7 @@ discard block |
||
1230 | 1230 | protected function agregarLeyendaDestinoContinuo($tipo) |
1231 | 1231 | { |
1232 | 1232 | $this->setFont('', 'B', 8); |
1233 | - $this->Texto('CEDIBLE'.($tipo==52?' CON SU FACTURA':''), null, $this->y+6, 'R'); |
|
1233 | + $this->Texto('CEDIBLE'.($tipo==52 ? ' CON SU FACTURA' : ''), null, $this->y+6, 'R'); |
|
1234 | 1234 | } |
1235 | 1235 | |
1236 | 1236 | } |
@@ -431,10 +431,12 @@ discard block |
||
431 | 431 | } |
432 | 432 | $contacto = []; |
433 | 433 | if (!empty($emisor['Telefono'])) { |
434 | - if (!is_array($emisor['Telefono'])) |
|
435 | - $emisor['Telefono'] = [$emisor['Telefono']]; |
|
436 | - foreach ($emisor['Telefono'] as $t) |
|
437 | - $contacto[] = $t; |
|
434 | + if (!is_array($emisor['Telefono'])) { |
|
435 | + $emisor['Telefono'] = [$emisor['Telefono']]; |
|
436 | + } |
|
437 | + foreach ($emisor['Telefono'] as $t) { |
|
438 | + $contacto[] = $t; |
|
439 | + } |
|
438 | 440 | } |
439 | 441 | if (!empty($emisor['CorreoEmisor'])) { |
440 | 442 | $contacto[] = $emisor['CorreoEmisor']; |
@@ -638,10 +640,12 @@ discard block |
||
638 | 640 | $this->MultiTexto($receptor['Extranjero']['NumId'], $x+$offset+2); |
639 | 641 | } |
640 | 642 | $contacto = []; |
641 | - if (!empty($receptor['Contacto'])) |
|
642 | - $contacto[] = $receptor['Contacto']; |
|
643 | - if (!empty($receptor['CorreoRecep'])) |
|
644 | - $contacto[] = $receptor['CorreoRecep']; |
|
643 | + if (!empty($receptor['Contacto'])) { |
|
644 | + $contacto[] = $receptor['Contacto']; |
|
645 | + } |
|
646 | + if (!empty($receptor['CorreoRecep'])) { |
|
647 | + $contacto[] = $receptor['CorreoRecep']; |
|
648 | + } |
|
645 | 649 | if (!empty($contacto)) { |
646 | 650 | $this->setFont('', 'B', null); |
647 | 651 | $this->Texto('Contacto', $x); |
@@ -691,15 +695,19 @@ discard block |
||
691 | 695 | if (!empty($Transporte['DirDest']) and !empty($Transporte['CmnaDest'])) { |
692 | 696 | $transporte .= 'a '.$Transporte['DirDest'].', '.$Transporte['CmnaDest']; |
693 | 697 | } |
694 | - if (!empty($Transporte['RUTTrans'])) |
|
695 | - $transporte .= ' por '.$Transporte['RUTTrans']; |
|
696 | - if (!empty($Transporte['Patente'])) |
|
697 | - $transporte .= ' en vehículo '.$Transporte['Patente']; |
|
698 | + if (!empty($Transporte['RUTTrans'])) { |
|
699 | + $transporte .= ' por '.$Transporte['RUTTrans']; |
|
700 | + } |
|
701 | + if (!empty($Transporte['Patente'])) { |
|
702 | + $transporte .= ' en vehículo '.$Transporte['Patente']; |
|
703 | + } |
|
698 | 704 | if (isset($Transporte['Chofer']) and is_array($Transporte['Chofer'])) { |
699 | - if (!empty($Transporte['Chofer']['NombreChofer'])) |
|
700 | - $transporte .= ' con chofer '.$Transporte['Chofer']['NombreChofer']; |
|
701 | - if (!empty($Transporte['Chofer']['RUTChofer'])) |
|
702 | - $transporte .= ' ('.$Transporte['Chofer']['RUTChofer'].')'; |
|
705 | + if (!empty($Transporte['Chofer']['NombreChofer'])) { |
|
706 | + $transporte .= ' con chofer '.$Transporte['Chofer']['NombreChofer']; |
|
707 | + } |
|
708 | + if (!empty($Transporte['Chofer']['RUTChofer'])) { |
|
709 | + $transporte .= ' ('.$Transporte['Chofer']['RUTChofer'].')'; |
|
710 | + } |
|
703 | 711 | } |
704 | 712 | if ($transporte) { |
705 | 713 | $this->setFont('', 'B', null); |
@@ -713,8 +721,9 @@ discard block |
||
713 | 721 | if (!empty($Transporte['Aduana']) and is_array($Transporte['Aduana'])) { |
714 | 722 | $col = 0; |
715 | 723 | foreach ($Transporte['Aduana'] as $tag => $codigo) { |
716 | - if ($codigo===false) |
|
717 | - continue; |
|
724 | + if ($codigo===false) { |
|
725 | + continue; |
|
726 | + } |
|
718 | 727 | $glosa = \sasco\LibreDTE\Sii\Aduana::getGlosa($tag); |
719 | 728 | $valor = \sasco\LibreDTE\Sii\Aduana::getValor($tag, $codigo); |
720 | 729 | if ($glosa!==false and $valor!==false) { |
@@ -727,15 +736,18 @@ discard block |
||
727 | 736 | $this->Texto(':', $x+$offset+$col); |
728 | 737 | $this->setFont('', '', null); |
729 | 738 | $this->Texto($valor, $x+$offset+2+$col); |
730 | - if ($tag=='TipoBultos') |
|
731 | - $col = abs($col-110); |
|
732 | - if ($col) |
|
733 | - $this->Ln(); |
|
739 | + if ($tag=='TipoBultos') { |
|
740 | + $col = abs($col-110); |
|
741 | + } |
|
742 | + if ($col) { |
|
743 | + $this->Ln(); |
|
744 | + } |
|
734 | 745 | $col = abs($col-110); |
735 | 746 | } |
736 | 747 | } |
737 | - if ($col) |
|
738 | - $this->Ln(); |
|
748 | + if ($col) { |
|
749 | + $this->Ln(); |
|
750 | + } |
|
739 | 751 | } |
740 | 752 | } |
741 | 753 | |
@@ -748,8 +760,9 @@ discard block |
||
748 | 760 | */ |
749 | 761 | protected function agregarReferencia($referencias, $x = 10, $offset = 22) |
750 | 762 | { |
751 | - if (!isset($referencias[0])) |
|
752 | - $referencias = [$referencias]; |
|
763 | + if (!isset($referencias[0])) { |
|
764 | + $referencias = [$referencias]; |
|
765 | + } |
|
753 | 766 | foreach($referencias as $r) { |
754 | 767 | $texto = $r['NroLinRef'].' - '; |
755 | 768 | if (!empty($r['TpoDocRef'])) { |
@@ -786,8 +799,9 @@ discard block |
||
786 | 799 | */ |
787 | 800 | protected function agregarDetalle($detalle, $x = 10, $html = true) |
788 | 801 | { |
789 | - if (!isset($detalle[0])) |
|
790 | - $detalle = [$detalle]; |
|
802 | + if (!isset($detalle[0])) { |
|
803 | + $detalle = [$detalle]; |
|
804 | + } |
|
791 | 805 | $this->setFont('', '', $this->detalle_fuente); |
792 | 806 | // titulos |
793 | 807 | $titulos = []; |
@@ -820,15 +834,17 @@ discard block |
||
820 | 834 | } |
821 | 835 | // ajustes a IndExe |
822 | 836 | if (isset($item['IndExe'])) { |
823 | - if ($item['IndExe']==1) |
|
824 | - $item['IndExe'] = 'EX'; |
|
825 | - else if ($item['IndExe']==2) |
|
826 | - $item['IndExe'] = 'NF'; |
|
837 | + if ($item['IndExe']==1) { |
|
838 | + $item['IndExe'] = 'EX'; |
|
839 | + } else if ($item['IndExe']==2) { |
|
840 | + $item['IndExe'] = 'NF'; |
|
841 | + } |
|
827 | 842 | } |
828 | 843 | // agregar todas las columnas que se podrían imprimir en la tabla |
829 | 844 | $item_default = []; |
830 | - foreach ($this->detalle_cols as $key => $info) |
|
831 | - $item_default[$key] = false; |
|
845 | + foreach ($this->detalle_cols as $key => $info) { |
|
846 | + $item_default[$key] = false; |
|
847 | + } |
|
832 | 848 | $item = array_merge($item_default, $item); |
833 | 849 | // si hay código de item se extrae su valor |
834 | 850 | if (!empty($item['CdgItem']['VlrCodigo'])){ |
@@ -845,8 +861,9 @@ discard block |
||
845 | 861 | $options = ['align'=>[]]; |
846 | 862 | $i = 0; |
847 | 863 | foreach ($this->detalle_cols as $info) { |
848 | - if (isset($info['width'])) |
|
849 | - $options['width'][$i] = $info['width']; |
|
864 | + if (isset($info['width'])) { |
|
865 | + $options['width'][$i] = $info['width']; |
|
866 | + } |
|
850 | 867 | $options['align'][$i] = $info['align']; |
851 | 868 | $i++; |
852 | 869 | } |
@@ -879,8 +896,9 @@ discard block |
||
879 | 896 | $this->Texto($this->detalle_cols['QtyItem']['title'], $x+35, $this->y, ucfirst($this->detalle_cols['QtyItem']['align'][0]), $this->detalle_cols['QtyItem']['width']); |
880 | 897 | $this->Texto($this->detalle_cols['MontoItem']['title'], $x+45, $this->y, ucfirst($this->detalle_cols['MontoItem']['align'][0]), $this->detalle_cols['MontoItem']['width']); |
881 | 898 | $this->Line($p1x, $p1y+4, $p2x, $p2y+4, $style); |
882 | - if (!isset($detalle[0])) |
|
883 | - $detalle = [$detalle]; |
|
899 | + if (!isset($detalle[0])) { |
|
900 | + $detalle = [$detalle]; |
|
901 | + } |
|
884 | 902 | $this->SetY($this->getY()+2); |
885 | 903 | foreach($detalle as &$d) { |
886 | 904 | $this->MultiTexto($d['NmbItem'], $x+1, $this->y+4, ucfirst($this->detalle_cols['NmbItem']['align'][0]), $this->detalle_cols['NmbItem']['width']); |
@@ -955,8 +973,9 @@ discard block |
||
955 | 973 | */ |
956 | 974 | protected function agregarPagos(array $pagos, $x = 10) |
957 | 975 | { |
958 | - if (!isset($pagos[0])) |
|
959 | - $pagos = [$pagos]; |
|
976 | + if (!isset($pagos[0])) { |
|
977 | + $pagos = [$pagos]; |
|
978 | + } |
|
960 | 979 | $this->Texto('Pago(s) programado(s):', $x); |
961 | 980 | $this->Ln(); |
962 | 981 | foreach($pagos as $p) { |
@@ -168,8 +168,9 @@ discard block |
||
168 | 168 | */ |
169 | 169 | public function getName() |
170 | 170 | { |
171 | - if (isset($this->data['subject']['CN'])) |
|
172 | - return $this->data['subject']['CN']; |
|
171 | + if (isset($this->data['subject']['CN'])) { |
|
172 | + return $this->data['subject']['CN']; |
|
173 | + } |
|
173 | 174 | return $this->error('No fue posible obtener el Name (subject.CN) de la firma'); |
174 | 175 | } |
175 | 176 | |
@@ -353,8 +354,9 @@ discard block |
||
353 | 354 | */ |
354 | 355 | public function verify($data, $signature, $pub_key = null, $signature_alg = OPENSSL_ALGO_SHA1) |
355 | 356 | { |
356 | - if ($pub_key === null) |
|
357 | - $pub_key = $this->certs['cert']; |
|
357 | + if ($pub_key === null) { |
|
358 | + $pub_key = $this->certs['cert']; |
|
359 | + } |
|
358 | 360 | $pub_key = $this->normalizeCert($pub_key); |
359 | 361 | return openssl_verify($data, base64_decode($signature), $pub_key, $signature_alg) == 1 ? true : false; |
360 | 362 | } |
@@ -453,8 +455,9 @@ discard block |
||
453 | 455 | // calcular SignatureValue |
454 | 456 | $SignedInfo = $doc->saveHTML($Signature->getElementsByTagName('SignedInfo')->item(0)); |
455 | 457 | $firma = $this->sign($SignedInfo); |
456 | - if (!$firma) |
|
457 | - return false; |
|
458 | + if (!$firma) { |
|
459 | + return false; |
|
460 | + } |
|
458 | 461 | $signature = wordwrap($firma, $this->config['wordwrap'], "\n", true); |
459 | 462 | // reemplazar valores en la firma de |
460 | 463 | $Signature->getElementsByTagName('SignatureValue')->item(0)->nodeValue = $signature; |
@@ -486,8 +489,9 @@ discard block |
||
486 | 489 | $signature = $Signature->getElementsByTagName('SignatureValue')->item(0)->nodeValue; |
487 | 490 | $pub_key = $Signature->getElementsByTagName('X509Certificate')->item(0)->nodeValue; |
488 | 491 | // verificar firma |
489 | - if (!$this->verify($signed_info, $signature, $pub_key)) |
|
490 | - return false; |
|
492 | + if (!$this->verify($signed_info, $signature, $pub_key)) { |
|
493 | + return false; |
|
494 | + } |
|
491 | 495 | // verificar digest |
492 | 496 | $digest_original = $Signature->getElementsByTagName('DigestValue')->item(0)->nodeValue; |
493 | 497 | if ($tag) { |