@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | /** |
| 189 | 189 | * Método que asigna la ubicación del logo de la empresa |
| 190 | 190 | * @param logo URI del logo (puede ser local o en una URL) |
| 191 | - * @param posicion Posición respecto a datos del emisor (=0 izq, =1 arriba) |
|
| 191 | + * @param posicion integer respecto a datos del emisor (=0 izq, =1 arriba) |
|
| 192 | 192 | * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl) |
| 193 | 193 | * @version 2016-08-04 |
| 194 | 194 | */ |
@@ -378,7 +378,7 @@ discard block |
||
| 378 | 378 | * contínuo |
| 379 | 379 | * @param dte Arreglo con los datos del XML (tag Documento) |
| 380 | 380 | * @param timbre String XML con el tag TED del DTE |
| 381 | - * @param width Ancho del papel contínuo en mm |
|
| 381 | + * @param width boolean del papel contínuo en mm |
|
| 382 | 382 | * @author Pablo Reyes (https://github.com/pabloxp) |
| 383 | 383 | * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl) |
| 384 | 384 | * @version 2017-10-24 |
@@ -537,10 +537,11 @@ discard block |
||
| 537 | 537 | * - Dirección casa central del emisor |
| 538 | 538 | * - Dirección sucursales |
| 539 | 539 | * @param emisor Arreglo con los datos del emisor (tag Emisor del XML) |
| 540 | - * @param x Posición horizontal de inicio en el PDF |
|
| 541 | - * @param y Posición vertical de inicio en el PDF |
|
| 542 | - * @param w Ancho de la información del emisor |
|
| 543 | - * @param w_img Ancho máximo de la imagen |
|
| 540 | + * @param x integer horizontal de inicio en el PDF |
|
| 541 | + * @param y integer vertical de inicio en el PDF |
|
| 542 | + * @param w integer de la información del emisor |
|
| 543 | + * @param w_img integer máximo de la imagen |
|
| 544 | + * @param integer $font_size |
|
| 544 | 545 | * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl) |
| 545 | 546 | * @version 2018-06-15 |
| 546 | 547 | */ |
@@ -614,11 +615,13 @@ discard block |
||
| 614 | 615 | * @param rut RUT del emisor |
| 615 | 616 | * @param tipo Código o glosa del tipo de documento |
| 616 | 617 | * @param sucursal_sii Código o glosa de la sucursal del SII del Emisor |
| 617 | - * @param x Posición horizontal de inicio en el PDF |
|
| 618 | - * @param y Posición vertical de inicio en el PDF |
|
| 619 | - * @param w Ancho de la información del emisor |
|
| 618 | + * @param x integer horizontal de inicio en el PDF |
|
| 619 | + * @param y integer vertical de inicio en el PDF |
|
| 620 | + * @param w integer de la información del emisor |
|
| 621 | + * @param integer $font_size |
|
| 620 | 622 | * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl) |
| 621 | 623 | * @version 2016-12-02 |
| 624 | + * @return integer |
|
| 622 | 625 | */ |
| 623 | 626 | protected function agregarFolio($rut, $tipo, $folio, $sucursal_sii = null, $x = 130, $y = 15, $w = 70, $font_size = null, array $color = null) |
| 624 | 627 | { |
@@ -665,7 +668,7 @@ discard block |
||
| 665 | 668 | * Método que agrega los datos de la emisión del DTE que no son los dato del |
| 666 | 669 | * receptor |
| 667 | 670 | * @param IdDoc Información general del documento |
| 668 | - * @param x Posición horizontal de inicio en el PDF |
|
| 671 | + * @param x integer horizontal de inicio en el PDF |
|
| 669 | 672 | * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl) |
| 670 | 673 | * @version 2017-06-15 |
| 671 | 674 | */ |
@@ -753,7 +756,7 @@ discard block |
||
| 753 | 756 | /** |
| 754 | 757 | * Método que agrega los datos del receptor |
| 755 | 758 | * @param receptor Arreglo con los datos del receptor (tag Receptor del XML) |
| 756 | - * @param x Posición horizontal de inicio en el PDF |
|
| 759 | + * @param x integer horizontal de inicio en el PDF |
|
| 757 | 760 | * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl) |
| 758 | 761 | * @version 2017-06-15 |
| 759 | 762 | */ |
@@ -840,7 +843,7 @@ discard block |
||
| 840 | 843 | * Método que agrega los datos del traslado |
| 841 | 844 | * @param IndTraslado |
| 842 | 845 | * @param Transporte |
| 843 | - * @param x Posición horizontal de inicio en el PDF |
|
| 846 | + * @param x integer horizontal de inicio en el PDF |
|
| 844 | 847 | * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl) |
| 845 | 848 | * @version 2016-08-03 |
| 846 | 849 | */ |
@@ -911,7 +914,7 @@ discard block |
||
| 911 | 914 | /** |
| 912 | 915 | * Método que agrega las referencias del documento |
| 913 | 916 | * @param referencias Arreglo con las referencias del documento (tag Referencia del XML) |
| 914 | - * @param x Posición horizontal de inicio en el PDF |
|
| 917 | + * @param x integer horizontal de inicio en el PDF |
|
| 915 | 918 | * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl) |
| 916 | 919 | * @version 2017-09-25 |
| 917 | 920 | */ |
@@ -948,7 +951,7 @@ discard block |
||
| 948 | 951 | /** |
| 949 | 952 | * Método que agrega el detalle del documento |
| 950 | 953 | * @param detalle Arreglo con el detalle del documento (tag Detalle del XML) |
| 951 | - * @param x Posición horizontal de inicio en el PDF |
|
| 954 | + * @param x integer horizontal de inicio en el PDF |
|
| 952 | 955 | * @param y Posición vertical de inicio en el PDF |
| 953 | 956 | * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl) |
| 954 | 957 | * @version 2018-04-15 |
@@ -1019,7 +1022,7 @@ discard block |
||
| 1019 | 1022 | /** |
| 1020 | 1023 | * Método que agrega el detalle del documento |
| 1021 | 1024 | * @param detalle Arreglo con el detalle del documento (tag Detalle del XML) |
| 1022 | - * @param x Posición horizontal de inicio en el PDF |
|
| 1025 | + * @param x integer horizontal de inicio en el PDF |
|
| 1023 | 1026 | * @param y Posición vertical de inicio en el PDF |
| 1024 | 1027 | * @author Pablo Reyes (https://github.com/pabloxp) |
| 1025 | 1028 | * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl) |
@@ -1055,7 +1058,7 @@ discard block |
||
| 1055 | 1058 | * Método que agrega el subtotal del DTE |
| 1056 | 1059 | * @param detalle Arreglo con los detalles del documentos para poder |
| 1057 | 1060 | * calcular subtotal |
| 1058 | - * @param x Posición horizontal de inicio en el PDF |
|
| 1061 | + * @param x integer horizontal de inicio en el PDF |
|
| 1059 | 1062 | * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl) |
| 1060 | 1063 | * @version 2016-08-17 |
| 1061 | 1064 | */ |
@@ -1081,7 +1084,7 @@ discard block |
||
| 1081 | 1084 | /** |
| 1082 | 1085 | * Método que agrega los descuentos y/o recargos globales del documento |
| 1083 | 1086 | * @param descuentosRecargos Arreglo con los descuentos y/o recargos del documento (tag DscRcgGlobal del XML) |
| 1084 | - * @param x Posición horizontal de inicio en el PDF |
|
| 1087 | + * @param x integer horizontal de inicio en el PDF |
|
| 1085 | 1088 | * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl) |
| 1086 | 1089 | * @version 2018-05-29 |
| 1087 | 1090 | */ |
@@ -1109,7 +1112,7 @@ discard block |
||
| 1109 | 1112 | /** |
| 1110 | 1113 | * Método que agrega los pagos del documento |
| 1111 | 1114 | * @param pagos Arreglo con los pagos del documento |
| 1112 | - * @param x Posición horizontal de inicio en el PDF |
|
| 1115 | + * @param x integer horizontal de inicio en el PDF |
|
| 1113 | 1116 | * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl) |
| 1114 | 1117 | * @version 2016-07-24 |
| 1115 | 1118 | */ |
@@ -1267,9 +1270,9 @@ discard block |
||
| 1267 | 1270 | * - Se imprime en el tamaño mínimo: 2x5 cms |
| 1268 | 1271 | * - En el lado de abajo con margen izquierdo mínimo de 2 cms |
| 1269 | 1272 | * @param timbre String con los datos del timbre |
| 1270 | - * @param x Posición horizontal de inicio en el PDF |
|
| 1271 | - * @param y Posición vertical de inicio en el PDF |
|
| 1272 | - * @param w Ancho del timbre |
|
| 1273 | + * @param x integer horizontal de inicio en el PDF |
|
| 1274 | + * @param y integer vertical de inicio en el PDF |
|
| 1275 | + * @param w integer del timbre |
|
| 1273 | 1276 | * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl) |
| 1274 | 1277 | * @version 2018-04-12 |
| 1275 | 1278 | */ |
@@ -1307,10 +1310,10 @@ discard block |
||
| 1307 | 1310 | |
| 1308 | 1311 | /** |
| 1309 | 1312 | * Método que agrega el acuse de rebido |
| 1310 | - * @param x Posición horizontal de inicio en el PDF |
|
| 1311 | - * @param y Posición vertical de inicio en el PDF |
|
| 1312 | - * @param w Ancho del acuse de recibo |
|
| 1313 | - * @param h Alto del acuse de recibo |
|
| 1313 | + * @param x integer horizontal de inicio en el PDF |
|
| 1314 | + * @param y integer vertical de inicio en el PDF |
|
| 1315 | + * @param w integer del acuse de recibo |
|
| 1316 | + * @param h integer del acuse de recibo |
|
| 1314 | 1317 | * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl) |
| 1315 | 1318 | * @version 2018-04-13 |
| 1316 | 1319 | */ |
@@ -1338,10 +1341,10 @@ discard block |
||
| 1338 | 1341 | |
| 1339 | 1342 | /** |
| 1340 | 1343 | * Método que agrega el acuse de rebido |
| 1341 | - * @param x Posición horizontal de inicio en el PDF |
|
| 1344 | + * @param x integer horizontal de inicio en el PDF |
|
| 1342 | 1345 | * @param y Posición vertical de inicio en el PDF |
| 1343 | - * @param w Ancho del acuse de recibo |
|
| 1344 | - * @param h Alto del acuse de recibo |
|
| 1346 | + * @param w integer del acuse de recibo |
|
| 1347 | + * @param h integer del acuse de recibo |
|
| 1345 | 1348 | * @author Pablo Reyes (https://github.com/pabloxp) |
| 1346 | 1349 | * @version 2015-11-17 |
| 1347 | 1350 | */ |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | { |
| 183 | 183 | parent::__construct(); |
| 184 | 184 | $this->SetTitle('Documento Tributario Electrónico (DTE) de Chile by LibreDTE'); |
| 185 | - $this->papelContinuo = $papelContinuo === true ? 80 : $papelContinuo; |
|
| 185 | + $this->papelContinuo = $papelContinuo===true ? 80 : $papelContinuo; |
|
| 186 | 186 | } |
| 187 | 187 | |
| 188 | 188 | /** |
@@ -338,7 +338,7 @@ discard block |
||
| 338 | 338 | $this->setY(max($y)); |
| 339 | 339 | $this->Ln(); |
| 340 | 340 | $y = []; |
| 341 | - $y[] = $this->agregarDatosEmision($dte['Encabezado']['IdDoc'], !empty($dte['Encabezado']['Emisor']['CdgVendedor'])?$dte['Encabezado']['Emisor']['CdgVendedor']:null); |
|
| 341 | + $y[] = $this->agregarDatosEmision($dte['Encabezado']['IdDoc'], !empty($dte['Encabezado']['Emisor']['CdgVendedor']) ? $dte['Encabezado']['Emisor']['CdgVendedor'] : null); |
|
| 342 | 342 | $y[] = $this->agregarReceptor($dte['Encabezado']); |
| 343 | 343 | $this->setY(max($y)); |
| 344 | 344 | $this->agregarTraslado( |
@@ -398,15 +398,15 @@ discard block |
||
| 398 | 398 | $dte['Encabezado']['IdDoc']['TipoDTE'], |
| 399 | 399 | $dte['Encabezado']['IdDoc']['Folio'], |
| 400 | 400 | $dte['Encabezado']['Emisor']['CmnaOrigen'], |
| 401 | - $x_start, $y_start, $width-($x_start*4), 10, |
|
| 402 | - [0,0,0] |
|
| 401 | + $x_start, $y_start, $width-($x_start * 4), 10, |
|
| 402 | + [0, 0, 0] |
|
| 403 | 403 | ); |
| 404 | - $y = $this->agregarEmisor($dte['Encabezado']['Emisor'], $x_start, $y+2, $width-($x_start*45), 8, 9, [0,0,0]); |
|
| 404 | + $y = $this->agregarEmisor($dte['Encabezado']['Emisor'], $x_start, $y+2, $width-($x_start * 45), 8, 9, [0, 0, 0]); |
|
| 405 | 405 | // datos del documento |
| 406 | 406 | $this->SetY($y); |
| 407 | 407 | $this->Ln(); |
| 408 | 408 | $this->setFont('', '', 8); |
| 409 | - $this->agregarDatosEmision($dte['Encabezado']['IdDoc'], !empty($dte['Encabezado']['Emisor']['CdgVendedor'])?$dte['Encabezado']['Emisor']['CdgVendedor']:null, $x_start, $offset, false); |
|
| 409 | + $this->agregarDatosEmision($dte['Encabezado']['IdDoc'], !empty($dte['Encabezado']['Emisor']['CdgVendedor']) ? $dte['Encabezado']['Emisor']['CdgVendedor'] : null, $x_start, $offset, false); |
|
| 410 | 410 | $this->agregarReceptor($dte['Encabezado'], $x_start, $offset); |
| 411 | 411 | $this->agregarTraslado( |
| 412 | 412 | !empty($dte['Encabezado']['IdDoc']['IndTraslado']) ? $dte['Encabezado']['IdDoc']['IndTraslado'] : null, |
@@ -459,7 +459,7 @@ discard block |
||
| 459 | 459 | $this->AddPage('P', [$height ? $height : $this->papel_continuo_alto, $width]); |
| 460 | 460 | $x = 1; |
| 461 | 461 | $y = 5; |
| 462 | - $this->SetXY($x,$y); |
|
| 462 | + $this->SetXY($x, $y); |
|
| 463 | 463 | // agregar datos del documento |
| 464 | 464 | $this->setFont('', '', 8); |
| 465 | 465 | $this->MultiTexto(!empty($dte['Encabezado']['Emisor']['RznSoc']) ? $dte['Encabezado']['Emisor']['RznSoc'] : $dte['Encabezado']['Emisor']['RznSocEmisor'], $x, null, '', $width-2); |
@@ -552,13 +552,13 @@ discard block |
||
| 552 | 552 | $this->logo['uri'], |
| 553 | 553 | $x, |
| 554 | 554 | $y, |
| 555 | - !$this->logo['posicion']?$w_img:null, $this->logo['posicion']?($w_img/2):null, |
|
| 555 | + !$this->logo['posicion'] ? $w_img : null, $this->logo['posicion'] ? ($w_img / 2) : null, |
|
| 556 | 556 | 'PNG', |
| 557 | - (isset($emisor['url'])?$emisor['url']:''), |
|
| 557 | + (isset($emisor['url']) ? $emisor['url'] : ''), |
|
| 558 | 558 | 'T' |
| 559 | 559 | ); |
| 560 | 560 | if ($this->logo['posicion']) { |
| 561 | - $this->SetY($this->y + ($w_img/2)); |
|
| 561 | + $this->SetY($this->y+($w_img / 2)); |
|
| 562 | 562 | $w += 40; |
| 563 | 563 | } else { |
| 564 | 564 | $x = $this->x+3; |
@@ -569,14 +569,14 @@ discard block |
||
| 569 | 569 | } |
| 570 | 570 | // agregar datos del emisor |
| 571 | 571 | $this->setFont('', 'B', $font_size ? $font_size : 14); |
| 572 | - $this->SetTextColorArray($color===null?[32, 92, 144]:$color); |
|
| 572 | + $this->SetTextColorArray($color===null ? [32, 92, 144] : $color); |
|
| 573 | 573 | $this->MultiTexto(!empty($emisor['RznSoc']) ? $emisor['RznSoc'] : $emisor['RznSocEmisor'], $x, $this->y+2, 'L', $w); |
| 574 | 574 | $this->setFont('', 'B', $font_size ? $font_size : 9); |
| 575 | - $this->SetTextColorArray([0,0,0]); |
|
| 575 | + $this->SetTextColorArray([0, 0, 0]); |
|
| 576 | 576 | $this->MultiTexto(!empty($emisor['GiroEmis']) ? $emisor['GiroEmis'] : $emisor['GiroEmisor'], $x, $this->y, 'L', $w); |
| 577 | 577 | $comuna = !empty($emisor['CmnaOrigen']) ? $emisor['CmnaOrigen'] : null; |
| 578 | 578 | $ciudad = !empty($emisor['CiudadOrigen']) ? $emisor['CiudadOrigen'] : \sasco\LibreDTE\Chile::getCiudad($comuna); |
| 579 | - $this->MultiTexto($emisor['DirOrigen'].($comuna?(', '.$comuna):'').($ciudad?(', '.$ciudad):''), $x, $this->y, 'L', $w); |
|
| 579 | + $this->MultiTexto($emisor['DirOrigen'].($comuna ? (', '.$comuna) : '').($ciudad ? (', '.$ciudad) : ''), $x, $this->y, 'L', $w); |
|
| 580 | 580 | if (!empty($emisor['Sucursal'])) { |
| 581 | 581 | $this->MultiTexto('Sucursal: '.$emisor['Sucursal'], $x, $this->y, 'L', $w); |
| 582 | 582 | } |
@@ -623,12 +623,12 @@ discard block |
||
| 623 | 623 | protected function agregarFolio($rut, $tipo, $folio, $sucursal_sii = null, $x = 130, $y = 15, $w = 70, $font_size = null, array $color = null) |
| 624 | 624 | { |
| 625 | 625 | if ($color===null) { |
| 626 | - $color = $tipo ? ($tipo==52 ? [0,172,140] : [255,0,0]) : [0,0,0]; |
|
| 626 | + $color = $tipo ? ($tipo==52 ? [0, 172, 140] : [255, 0, 0]) : [0, 0, 0]; |
|
| 627 | 627 | } |
| 628 | 628 | $this->SetTextColorArray($color); |
| 629 | 629 | // colocar rut emisor, glosa documento y folio |
| 630 | 630 | list($rut, $dv) = explode('-', $rut); |
| 631 | - $this->setFont ('', 'B', $font_size ? $font_size : 15); |
|
| 631 | + $this->setFont('', 'B', $font_size ? $font_size : 15); |
|
| 632 | 632 | $this->MultiTexto('R.U.T.: '.$this->num($rut).'-'.$dv, $x, $y+4, 'C', $w); |
| 633 | 633 | $this->setFont('', 'B', $font_size ? $font_size : 12); |
| 634 | 634 | $this->MultiTexto($this->getTipo($tipo), $x, null, 'C', $w); |
@@ -641,7 +641,7 @@ discard block |
||
| 641 | 641 | if ($tipo) { |
| 642 | 642 | $this->Texto('S.I.I. - '.\sasco\LibreDTE\Sii::getDireccionRegional($sucursal_sii), $x, $this->getY()+4, 'C', $w); |
| 643 | 643 | } |
| 644 | - $this->SetTextColorArray([0,0,0]); |
|
| 644 | + $this->SetTextColorArray([0, 0, 0]); |
|
| 645 | 645 | $this->Ln(); |
| 646 | 646 | return $this->y; |
| 647 | 647 | } |
@@ -773,7 +773,7 @@ discard block |
||
| 773 | 773 | $this->Texto('Señor(es)', $x); |
| 774 | 774 | $this->Texto(':', $x+$offset); |
| 775 | 775 | $this->setFont('', '', null); |
| 776 | - $this->MultiTexto($receptor['RznSocRecep'], $x+$offset+2, null, '', $x==10?105:0); |
|
| 776 | + $this->MultiTexto($receptor['RznSocRecep'], $x+$offset+2, null, '', $x==10 ? 105 : 0); |
|
| 777 | 777 | } |
| 778 | 778 | if (!empty($receptor['GiroRecep'])) { |
| 779 | 779 | $this->setFont('', 'B', null); |
@@ -790,7 +790,7 @@ discard block |
||
| 790 | 790 | $ciudad = !empty($receptor['CiudadRecep']) ? $receptor['CiudadRecep'] : ( |
| 791 | 791 | !empty($receptor['CmnaRecep']) ? \sasco\LibreDTE\Chile::getCiudad($receptor['CmnaRecep']) : '' |
| 792 | 792 | ); |
| 793 | - $this->MultiTexto($receptor['DirRecep'].(!empty($receptor['CmnaRecep'])?(', '.$receptor['CmnaRecep']):'').($ciudad?(', '.$ciudad):''), $x+$offset+2); |
|
| 793 | + $this->MultiTexto($receptor['DirRecep'].(!empty($receptor['CmnaRecep']) ? (', '.$receptor['CmnaRecep']) : '').($ciudad ? (', '.$ciudad) : ''), $x+$offset+2); |
|
| 794 | 794 | } |
| 795 | 795 | if (!empty($receptor['Extranjero']['Nacionalidad'])) { |
| 796 | 796 | $this->setFont('', 'B', null); |
@@ -831,7 +831,7 @@ discard block |
||
| 831 | 831 | $this->Texto('Cód. recep.', $x); |
| 832 | 832 | $this->Texto(':', $x+$offset); |
| 833 | 833 | $this->setFont('', '', null); |
| 834 | - $this->MultiTexto($receptor['CdgIntRecep'], $x+$offset+2, null, '', $x==10?105:0); |
|
| 834 | + $this->MultiTexto($receptor['CdgIntRecep'], $x+$offset+2, null, '', $x==10 ? 105 : 0); |
|
| 835 | 835 | } |
| 836 | 836 | return $this->GetY(); |
| 837 | 837 | } |
@@ -919,7 +919,7 @@ discard block |
||
| 919 | 919 | { |
| 920 | 920 | if (!isset($referencias[0])) |
| 921 | 921 | $referencias = [$referencias]; |
| 922 | - foreach($referencias as $r) { |
|
| 922 | + foreach ($referencias as $r) { |
|
| 923 | 923 | $texto = $r['NroLinRef'].' - '; |
| 924 | 924 | if (!empty($r['TpoDocRef'])) { |
| 925 | 925 | $texto .= $this->getTipo($r['TpoDocRef']).' '; |
@@ -970,7 +970,7 @@ discard block |
||
| 970 | 970 | // quitar columnas |
| 971 | 971 | foreach ($item as $col => $valor) { |
| 972 | 972 | if ($col=='DscItem' and !empty($item['DscItem'])) { |
| 973 | - $item['NmbItem'] .= !$this->item_detalle_posicion ? ($html?'<br/>':"\n") : ': '; |
|
| 973 | + $item['NmbItem'] .= !$this->item_detalle_posicion ? ($html ? '<br/>' : "\n") : ': '; |
|
| 974 | 974 | if ($html) { |
| 975 | 975 | $item['NmbItem'] .= '<span style="font-size:0.7em">'.$item['DscItem'].'</span>'; |
| 976 | 976 | } else { |
@@ -1030,9 +1030,9 @@ discard block |
||
| 1030 | 1030 | $this->SetY($this->getY()+1); |
| 1031 | 1031 | $p1x = $x; |
| 1032 | 1032 | $p1y = $this->y; |
| 1033 | - $p2x = $this->getPageWidth() - 2; |
|
| 1034 | - $p2y = $p1y; // Use same y for a straight line |
|
| 1035 | - $style = array('width' => 0.2,'color' => array(0, 0, 0)); |
|
| 1033 | + $p2x = $this->getPageWidth()-2; |
|
| 1034 | + $p2y = $p1y; // Use same y for a straight line |
|
| 1035 | + $style = array('width' => 0.2, 'color' => array(0, 0, 0)); |
|
| 1036 | 1036 | $this->Line($p1x, $p1y, $p2x, $p2y, $style); |
| 1037 | 1037 | $this->Texto($this->detalle_cols['NmbItem']['title'], $x+1, $this->y, ucfirst($this->detalle_cols['NmbItem']['align'][0]), $this->detalle_cols['NmbItem']['width']); |
| 1038 | 1038 | $this->Texto($this->detalle_cols['PrcItem']['title'], $x+15, $this->y, ucfirst($this->detalle_cols['PrcItem']['align'][0]), $this->detalle_cols['PrcItem']['width']); |
@@ -1042,9 +1042,9 @@ discard block |
||
| 1042 | 1042 | if (!isset($detalle[0])) |
| 1043 | 1043 | $detalle = [$detalle]; |
| 1044 | 1044 | $this->SetY($this->getY()+2); |
| 1045 | - foreach($detalle as &$d) { |
|
| 1045 | + foreach ($detalle as &$d) { |
|
| 1046 | 1046 | $this->MultiTexto($d['NmbItem'], $x+1, $this->y+4, ucfirst($this->detalle_cols['NmbItem']['align'][0]), $this->detalle_cols['NmbItem']['width']); |
| 1047 | - $this->Texto(number_format($d['PrcItem'],0,',','.'), $x+15, $this->y, ucfirst($this->detalle_cols['PrcItem']['align'][0]), $this->detalle_cols['PrcItem']['width']); |
|
| 1047 | + $this->Texto(number_format($d['PrcItem'], 0, ',', '.'), $x+15, $this->y, ucfirst($this->detalle_cols['PrcItem']['align'][0]), $this->detalle_cols['PrcItem']['width']); |
|
| 1048 | 1048 | $this->Texto($this->num($d['QtyItem']), $x+35, $this->y, ucfirst($this->detalle_cols['QtyItem']['align'][0]), $this->detalle_cols['QtyItem']['width']); |
| 1049 | 1049 | $this->Texto($this->num($d['MontoItem']), $x+45, $this->y, ucfirst($this->detalle_cols['MontoItem']['align'][0]), $this->detalle_cols['MontoItem']['width']); |
| 1050 | 1050 | } |
@@ -1064,7 +1064,7 @@ discard block |
||
| 1064 | 1064 | if (!isset($detalle[0])) { |
| 1065 | 1065 | $detalle = [$detalle]; |
| 1066 | 1066 | } |
| 1067 | - foreach($detalle as &$d) { |
|
| 1067 | + foreach ($detalle as &$d) { |
|
| 1068 | 1068 | if (!empty($d['MontoItem'])) { |
| 1069 | 1069 | $subtotal += $d['MontoItem']; |
| 1070 | 1070 | } |
@@ -1090,16 +1090,16 @@ discard block |
||
| 1090 | 1090 | if (!isset($descuentosRecargos[0])) { |
| 1091 | 1091 | $descuentosRecargos = [$descuentosRecargos]; |
| 1092 | 1092 | } |
| 1093 | - foreach($descuentosRecargos as $dr) { |
|
| 1093 | + foreach ($descuentosRecargos as $dr) { |
|
| 1094 | 1094 | $tipo = $dr['TpoMov']=='D' ? 'Descuento' : 'Recargo'; |
| 1095 | 1095 | if (!empty($dr['IndExeDR'])) { |
| 1096 | 1096 | $tipo .= ' EX'; |
| 1097 | 1097 | } |
| 1098 | 1098 | $valor = $dr['TpoValor']=='%' ? $dr['ValorDR'].'%' : $this->num($dr['ValorDR']); |
| 1099 | 1099 | if ($this->papelContinuo) { |
| 1100 | - $this->Texto($tipo.' global: '.$valor.(!empty($dr['GlosaDR'])?(' ('.$dr['GlosaDR'].')'):''), $x); |
|
| 1100 | + $this->Texto($tipo.' global: '.$valor.(!empty($dr['GlosaDR']) ? (' ('.$dr['GlosaDR'].')') : ''), $x); |
|
| 1101 | 1101 | } else { |
| 1102 | - $this->Texto($tipo.(!empty($dr['GlosaDR'])?(' ('.$dr['GlosaDR'].')'):'').':', 77, null, 'R', 100); |
|
| 1102 | + $this->Texto($tipo.(!empty($dr['GlosaDR']) ? (' ('.$dr['GlosaDR'].')') : '').':', 77, null, 'R', 100); |
|
| 1103 | 1103 | $this->Texto($valor, 177, null, 'R', 22); |
| 1104 | 1104 | } |
| 1105 | 1105 | $this->Ln(); |
@@ -1119,8 +1119,8 @@ discard block |
||
| 1119 | 1119 | $pagos = [$pagos]; |
| 1120 | 1120 | $this->Texto('Pago(s) programado(s):', $x); |
| 1121 | 1121 | $this->Ln(); |
| 1122 | - foreach($pagos as $p) { |
|
| 1123 | - $this->Texto(' - '.$this->date($p['FchPago'], false).': $'.$this->num($p['MntPago']).'.-'.(!empty($p['GlosaPagos'])?(' ('.$p['GlosaPagos'].')'):''), $x); |
|
| 1122 | + foreach ($pagos as $p) { |
|
| 1123 | + $this->Texto(' - '.$this->date($p['FchPago'], false).': $'.$this->num($p['MntPago']).'.-'.(!empty($p['GlosaPagos']) ? (' ('.$p['GlosaPagos'].')') : ''), $x); |
|
| 1124 | 1124 | $this->Ln(); |
| 1125 | 1125 | } |
| 1126 | 1126 | } |
@@ -1171,7 +1171,7 @@ discard block |
||
| 1171 | 1171 | if (!isset($ImptoReten[0])) { |
| 1172 | 1172 | $ImptoReten = [$ImptoReten]; |
| 1173 | 1173 | } |
| 1174 | - foreach($ImptoReten as $i) { |
|
| 1174 | + foreach ($ImptoReten as $i) { |
|
| 1175 | 1175 | $totales['ImptoReten_'.$i['TipoImp']] = $i['MontoImp']; |
| 1176 | 1176 | if (!empty($i['TasaImp'])) { |
| 1177 | 1177 | $glosas['ImptoReten_'.$i['TipoImp']] = \sasco\LibreDTE\Sii\ImpuestosAdicionales::getGlosa($i['TipoImp']).' ('.$i['TasaImp'].'%) $'; |
@@ -1284,7 +1284,7 @@ discard block |
||
| 1284 | 1284 | 'vpadding' => 0, |
| 1285 | 1285 | 'module_width' => 1, // width of a single module in points |
| 1286 | 1286 | 'module_height' => 1, // height of a single module in points |
| 1287 | - 'fgcolor' => [0,0,0], |
|
| 1287 | + 'fgcolor' => [0, 0, 0], |
|
| 1288 | 1288 | 'bgcolor' => false, // [255,255,255] |
| 1289 | 1289 | 'position' => $this->papelContinuo ? 'C' : 'S', |
| 1290 | 1290 | ]; |
@@ -1317,7 +1317,7 @@ discard block |
||
| 1317 | 1317 | protected function agregarAcuseRecibo($x = 83, $y = 190, $w = 60, $h = 40) |
| 1318 | 1318 | { |
| 1319 | 1319 | $y = (!$this->papelContinuo and !$this->timbre_pie) ? $this->x_fin_datos : $y; |
| 1320 | - $this->SetTextColorArray([0,0,0]); |
|
| 1320 | + $this->SetTextColorArray([0, 0, 0]); |
|
| 1321 | 1321 | $this->Rect($x, $y, $w, $h, 'D', ['all' => ['width' => 0.1, 'color' => [0, 0, 0]]]); |
| 1322 | 1322 | $this->setFont('', 'B', 10); |
| 1323 | 1323 | $this->Texto('Acuse de recibo', $x, $y+1, 'C', $w); |
@@ -1347,9 +1347,9 @@ discard block |
||
| 1347 | 1347 | */ |
| 1348 | 1348 | protected function agregarAcuseReciboContinuo($x = 3, $y = null, $w = 68, $h = 40) |
| 1349 | 1349 | { |
| 1350 | - $this->SetTextColorArray([0,0,0]); |
|
| 1350 | + $this->SetTextColorArray([0, 0, 0]); |
|
| 1351 | 1351 | $this->Rect($x, $y, $w, $h, 'D', ['all' => ['width' => 0.1, 'color' => [0, 0, 0]]]); |
| 1352 | - $style = array('width' => 0.2,'color' => array(0, 0, 0)); |
|
| 1352 | + $style = array('width' => 0.2, 'color' => array(0, 0, 0)); |
|
| 1353 | 1353 | $this->Line($x, $y+22, $w+3, $y+22, $style); |
| 1354 | 1354 | //$this->setFont('', 'B', 10); |
| 1355 | 1355 | //$this->Texto('Acuse de recibo', $x, $y+1, 'C', $w); |
@@ -1379,7 +1379,7 @@ discard block |
||
| 1379 | 1379 | $y = (!$this->papelContinuo and !$this->timbre_pie and $this->x_fin_datos<=$y) ? $this->x_fin_datos : $y; |
| 1380 | 1380 | $y += 48; |
| 1381 | 1381 | $this->setFont('', 'B', $font_size); |
| 1382 | - $this->Texto('CEDIBLE'.($tipo==52?' CON SU FACTURA':''), null, $y, 'R'); |
|
| 1382 | + $this->Texto('CEDIBLE'.($tipo==52 ? ' CON SU FACTURA' : ''), null, $y, 'R'); |
|
| 1383 | 1383 | } |
| 1384 | 1384 | |
| 1385 | 1385 | /** |
@@ -1390,7 +1390,7 @@ discard block |
||
| 1390 | 1390 | protected function agregarLeyendaDestinoContinuo($tipo) |
| 1391 | 1391 | { |
| 1392 | 1392 | $this->setFont('', 'B', 8); |
| 1393 | - $this->Texto('CEDIBLE'.($tipo==52?' CON SU FACTURA':''), null, $this->y+6, 'R'); |
|
| 1393 | + $this->Texto('CEDIBLE'.($tipo==52 ? ' CON SU FACTURA' : ''), null, $this->y+6, 'R'); |
|
| 1394 | 1394 | } |
| 1395 | 1395 | |
| 1396 | 1396 | /** |
@@ -1421,7 +1421,7 @@ discard block |
||
| 1421 | 1421 | $dias = ['Domingo', 'Lunes', 'Martes', 'Miércoles', 'Jueves', 'Viernes', 'Sábado']; |
| 1422 | 1422 | $meses = ['enero', 'febrero', 'marzo', 'abril', 'mayo', 'junio', 'julio', 'agosto', 'septiembre', 'octubre', 'noviembre', 'diciembre']; |
| 1423 | 1423 | $unixtime = strtotime($date); |
| 1424 | - $fecha = date(($mostrar_dia?'\D\I\A ':'').'j \d\e \M\E\S \d\e\l Y', $unixtime); |
|
| 1424 | + $fecha = date(($mostrar_dia ? '\D\I\A ' : '').'j \d\e \M\E\S \d\e\l Y', $unixtime); |
|
| 1425 | 1425 | $dia = $dias[date('w', $unixtime)]; |
| 1426 | 1426 | $mes = $meses[date('n', $unixtime)-1]; |
| 1427 | 1427 | return str_replace(array('DIA', 'MES'), array($dia, $mes), $fecha); |
@@ -585,10 +585,12 @@ discard block |
||
| 585 | 585 | } |
| 586 | 586 | $contacto = []; |
| 587 | 587 | if (!empty($emisor['Telefono'])) { |
| 588 | - if (!is_array($emisor['Telefono'])) |
|
| 589 | - $emisor['Telefono'] = [$emisor['Telefono']]; |
|
| 590 | - foreach ($emisor['Telefono'] as $t) |
|
| 591 | - $contacto[] = $t; |
|
| 588 | + if (!is_array($emisor['Telefono'])) { |
|
| 589 | + $emisor['Telefono'] = [$emisor['Telefono']]; |
|
| 590 | + } |
|
| 591 | + foreach ($emisor['Telefono'] as $t) { |
|
| 592 | + $contacto[] = $t; |
|
| 593 | + } |
|
| 592 | 594 | } |
| 593 | 595 | if (!empty($emisor['CorreoEmisor'])) { |
| 594 | 596 | $contacto[] = $emisor['CorreoEmisor']; |
@@ -807,10 +809,12 @@ discard block |
||
| 807 | 809 | $this->MultiTexto($receptor['Extranjero']['NumId'], $x+$offset+2); |
| 808 | 810 | } |
| 809 | 811 | $contacto = []; |
| 810 | - if (!empty($receptor['Contacto'])) |
|
| 811 | - $contacto[] = $receptor['Contacto']; |
|
| 812 | - if (!empty($receptor['CorreoRecep'])) |
|
| 813 | - $contacto[] = $receptor['CorreoRecep']; |
|
| 812 | + if (!empty($receptor['Contacto'])) { |
|
| 813 | + $contacto[] = $receptor['Contacto']; |
|
| 814 | + } |
|
| 815 | + if (!empty($receptor['CorreoRecep'])) { |
|
| 816 | + $contacto[] = $receptor['CorreoRecep']; |
|
| 817 | + } |
|
| 814 | 818 | if (!empty($contacto)) { |
| 815 | 819 | $this->setFont('', 'B', null); |
| 816 | 820 | $this->Texto('Contacto', $x); |
@@ -860,15 +864,19 @@ discard block |
||
| 860 | 864 | if (!empty($Transporte['DirDest']) and !empty($Transporte['CmnaDest'])) { |
| 861 | 865 | $transporte .= 'a '.$Transporte['DirDest'].', '.$Transporte['CmnaDest']; |
| 862 | 866 | } |
| 863 | - if (!empty($Transporte['RUTTrans'])) |
|
| 864 | - $transporte .= ' por '.$Transporte['RUTTrans']; |
|
| 865 | - if (!empty($Transporte['Patente'])) |
|
| 866 | - $transporte .= ' en vehículo '.$Transporte['Patente']; |
|
| 867 | + if (!empty($Transporte['RUTTrans'])) { |
|
| 868 | + $transporte .= ' por '.$Transporte['RUTTrans']; |
|
| 869 | + } |
|
| 870 | + if (!empty($Transporte['Patente'])) { |
|
| 871 | + $transporte .= ' en vehículo '.$Transporte['Patente']; |
|
| 872 | + } |
|
| 867 | 873 | if (isset($Transporte['Chofer']) and is_array($Transporte['Chofer'])) { |
| 868 | - if (!empty($Transporte['Chofer']['NombreChofer'])) |
|
| 869 | - $transporte .= ' con chofer '.$Transporte['Chofer']['NombreChofer']; |
|
| 870 | - if (!empty($Transporte['Chofer']['RUTChofer'])) |
|
| 871 | - $transporte .= ' ('.$Transporte['Chofer']['RUTChofer'].')'; |
|
| 874 | + if (!empty($Transporte['Chofer']['NombreChofer'])) { |
|
| 875 | + $transporte .= ' con chofer '.$Transporte['Chofer']['NombreChofer']; |
|
| 876 | + } |
|
| 877 | + if (!empty($Transporte['Chofer']['RUTChofer'])) { |
|
| 878 | + $transporte .= ' ('.$Transporte['Chofer']['RUTChofer'].')'; |
|
| 879 | + } |
|
| 872 | 880 | } |
| 873 | 881 | if ($transporte) { |
| 874 | 882 | $this->setFont('', 'B', null); |
@@ -882,8 +890,9 @@ discard block |
||
| 882 | 890 | if (!empty($Transporte['Aduana']) and is_array($Transporte['Aduana'])) { |
| 883 | 891 | $col = 0; |
| 884 | 892 | foreach ($Transporte['Aduana'] as $tag => $codigo) { |
| 885 | - if ($codigo===false) |
|
| 886 | - continue; |
|
| 893 | + if ($codigo===false) { |
|
| 894 | + continue; |
|
| 895 | + } |
|
| 887 | 896 | $glosa = \sasco\LibreDTE\Sii\Aduana::getGlosa($tag); |
| 888 | 897 | $valor = \sasco\LibreDTE\Sii\Aduana::getValor($tag, $codigo); |
| 889 | 898 | if ($glosa!==false and $valor!==false) { |
@@ -896,15 +905,18 @@ discard block |
||
| 896 | 905 | $this->Texto(':', $x+$offset+$col); |
| 897 | 906 | $this->setFont('', '', null); |
| 898 | 907 | $this->Texto($valor, $x+$offset+2+$col); |
| 899 | - if ($tag=='TipoBultos') |
|
| 900 | - $col = abs($col-110); |
|
| 901 | - if ($col) |
|
| 902 | - $this->Ln(); |
|
| 908 | + if ($tag=='TipoBultos') { |
|
| 909 | + $col = abs($col-110); |
|
| 910 | + } |
|
| 911 | + if ($col) { |
|
| 912 | + $this->Ln(); |
|
| 913 | + } |
|
| 903 | 914 | $col = abs($col-110); |
| 904 | 915 | } |
| 905 | 916 | } |
| 906 | - if ($col) |
|
| 907 | - $this->Ln(); |
|
| 917 | + if ($col) { |
|
| 918 | + $this->Ln(); |
|
| 919 | + } |
|
| 908 | 920 | } |
| 909 | 921 | } |
| 910 | 922 | |
@@ -917,8 +929,9 @@ discard block |
||
| 917 | 929 | */ |
| 918 | 930 | protected function agregarReferencia($referencias, $x = 10, $offset = 22) |
| 919 | 931 | { |
| 920 | - if (!isset($referencias[0])) |
|
| 921 | - $referencias = [$referencias]; |
|
| 932 | + if (!isset($referencias[0])) { |
|
| 933 | + $referencias = [$referencias]; |
|
| 934 | + } |
|
| 922 | 935 | foreach($referencias as $r) { |
| 923 | 936 | $texto = $r['NroLinRef'].' - '; |
| 924 | 937 | if (!empty($r['TpoDocRef'])) { |
@@ -955,8 +968,9 @@ discard block |
||
| 955 | 968 | */ |
| 956 | 969 | protected function agregarDetalle($detalle, $x = 10, $html = true) |
| 957 | 970 | { |
| 958 | - if (!isset($detalle[0])) |
|
| 959 | - $detalle = [$detalle]; |
|
| 971 | + if (!isset($detalle[0])) { |
|
| 972 | + $detalle = [$detalle]; |
|
| 973 | + } |
|
| 960 | 974 | $this->setFont('', '', $this->detalle_fuente); |
| 961 | 975 | // titulos |
| 962 | 976 | $titulos = []; |
@@ -977,36 +991,42 @@ discard block |
||
| 977 | 991 | $item['NmbItem'] .= $item['DscItem']; |
| 978 | 992 | } |
| 979 | 993 | } |
| 980 | - if (!in_array($col, $titulos_keys) or ($dte_exento and $col=='IndExe')) |
|
| 981 | - unset($item[$col]); |
|
| 994 | + if (!in_array($col, $titulos_keys) or ($dte_exento and $col=='IndExe')) { |
|
| 995 | + unset($item[$col]); |
|
| 996 | + } |
|
| 982 | 997 | } |
| 983 | 998 | // ajustes a IndExe |
| 984 | 999 | if (isset($item['IndExe'])) { |
| 985 | - if ($item['IndExe']==1) |
|
| 986 | - $item['IndExe'] = 'EX'; |
|
| 987 | - else if ($item['IndExe']==2) |
|
| 988 | - $item['IndExe'] = 'NF'; |
|
| 1000 | + if ($item['IndExe']==1) { |
|
| 1001 | + $item['IndExe'] = 'EX'; |
|
| 1002 | + } else if ($item['IndExe']==2) { |
|
| 1003 | + $item['IndExe'] = 'NF'; |
|
| 1004 | + } |
|
| 989 | 1005 | } |
| 990 | 1006 | // agregar todas las columnas que se podrían imprimir en la tabla |
| 991 | 1007 | $item_default = []; |
| 992 | - foreach ($this->detalle_cols as $key => $info) |
|
| 993 | - $item_default[$key] = false; |
|
| 1008 | + foreach ($this->detalle_cols as $key => $info) { |
|
| 1009 | + $item_default[$key] = false; |
|
| 1010 | + } |
|
| 994 | 1011 | $item = array_merge($item_default, $item); |
| 995 | 1012 | // si hay código de item se extrae su valor |
| 996 | - if ($item['CdgItem']) |
|
| 997 | - $item['CdgItem'] = $item['CdgItem']['VlrCodigo']; |
|
| 1013 | + if ($item['CdgItem']) { |
|
| 1014 | + $item['CdgItem'] = $item['CdgItem']['VlrCodigo']; |
|
| 1015 | + } |
|
| 998 | 1016 | // dar formato a números |
| 999 | 1017 | foreach (['QtyItem', 'PrcItem', 'DescuentoMonto', 'RecargoMonto', 'MontoItem'] as $col) { |
| 1000 | - if ($item[$col]) |
|
| 1001 | - $item[$col] = $this->num($item[$col]); |
|
| 1018 | + if ($item[$col]) { |
|
| 1019 | + $item[$col] = $this->num($item[$col]); |
|
| 1020 | + } |
|
| 1002 | 1021 | } |
| 1003 | 1022 | } |
| 1004 | 1023 | // opciones |
| 1005 | 1024 | $options = ['align'=>[]]; |
| 1006 | 1025 | $i = 0; |
| 1007 | 1026 | foreach ($this->detalle_cols as $info) { |
| 1008 | - if (isset($info['width'])) |
|
| 1009 | - $options['width'][$i] = $info['width']; |
|
| 1027 | + if (isset($info['width'])) { |
|
| 1028 | + $options['width'][$i] = $info['width']; |
|
| 1029 | + } |
|
| 1010 | 1030 | $options['align'][$i] = $info['align']; |
| 1011 | 1031 | $i++; |
| 1012 | 1032 | } |
@@ -1039,8 +1059,9 @@ discard block |
||
| 1039 | 1059 | $this->Texto($this->detalle_cols['QtyItem']['title'], $x+35, $this->y, ucfirst($this->detalle_cols['QtyItem']['align'][0]), $this->detalle_cols['QtyItem']['width']); |
| 1040 | 1060 | $this->Texto($this->detalle_cols['MontoItem']['title'], $x+45, $this->y, ucfirst($this->detalle_cols['MontoItem']['align'][0]), $this->detalle_cols['MontoItem']['width']); |
| 1041 | 1061 | $this->Line($p1x, $p1y+4, $p2x, $p2y+4, $style); |
| 1042 | - if (!isset($detalle[0])) |
|
| 1043 | - $detalle = [$detalle]; |
|
| 1062 | + if (!isset($detalle[0])) { |
|
| 1063 | + $detalle = [$detalle]; |
|
| 1064 | + } |
|
| 1044 | 1065 | $this->SetY($this->getY()+2); |
| 1045 | 1066 | foreach($detalle as &$d) { |
| 1046 | 1067 | $this->MultiTexto($d['NmbItem'], $x+1, $this->y+4, ucfirst($this->detalle_cols['NmbItem']['align'][0]), $this->detalle_cols['NmbItem']['width']); |
@@ -1115,8 +1136,9 @@ discard block |
||
| 1115 | 1136 | */ |
| 1116 | 1137 | protected function agregarPagos(array $pagos, $x = 10) |
| 1117 | 1138 | { |
| 1118 | - if (!isset($pagos[0])) |
|
| 1119 | - $pagos = [$pagos]; |
|
| 1139 | + if (!isset($pagos[0])) { |
|
| 1140 | + $pagos = [$pagos]; |
|
| 1141 | + } |
|
| 1120 | 1142 | $this->Texto('Pago(s) programado(s):', $x); |
| 1121 | 1143 | $this->Ln(); |
| 1122 | 1144 | foreach($pagos as $p) { |
@@ -1403,11 +1425,13 @@ discard block |
||
| 1403 | 1425 | */ |
| 1404 | 1426 | protected function num($n) |
| 1405 | 1427 | { |
| 1406 | - if (!is_numeric($n)) |
|
| 1407 | - return $n; |
|
| 1428 | + if (!is_numeric($n)) { |
|
| 1429 | + return $n; |
|
| 1430 | + } |
|
| 1408 | 1431 | $broken_number = explode('.', (string)$n); |
| 1409 | - if (isset($broken_number[1])) |
|
| 1410 | - return number_format($broken_number[0], 0, ',', '.').','.$broken_number[1]; |
|
| 1432 | + if (isset($broken_number[1])) { |
|
| 1433 | + return number_format($broken_number[0], 0, ',', '.').','.$broken_number[1]; |
|
| 1434 | + } |
|
| 1411 | 1435 | return number_format($broken_number[0], 0, ',', '.'); |
| 1412 | 1436 | } |
| 1413 | 1437 | |
@@ -63,11 +63,11 @@ discard block |
||
| 63 | 63 | // validar firma del SII sobre los folios |
| 64 | 64 | $firma = $this->getFirma(); |
| 65 | 65 | $idk = $this->getIDK(); |
| 66 | - if ($firma === false || $idk === false) { |
|
| 66 | + if ($firma===false || $idk===false) { |
|
| 67 | 67 | return false; |
| 68 | 68 | } |
| 69 | 69 | $pub_key = \sasco\LibreDTE\Sii::cert($idk); |
| 70 | - if ($pub_key === false || openssl_verify($this->xml->getFlattened('/AUTORIZACION/CAF/DA'), base64_decode($firma), $pub_key)!==1) { |
|
| 70 | + if ($pub_key===false || openssl_verify($this->xml->getFlattened('/AUTORIZACION/CAF/DA'), base64_decode($firma), $pub_key)!==1) { |
|
| 71 | 71 | \sasco\LibreDTE\Log::write( |
| 72 | 72 | \sasco\LibreDTE\Estado::FOLIOS_ERROR_FIRMA, |
| 73 | 73 | \sasco\LibreDTE\Estado::get(\sasco\LibreDTE\Estado::FOLIOS_ERROR_FIRMA) |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | ); |
| 99 | 99 | return false; |
| 100 | 100 | } |
| 101 | - return $plain === $plain_firmado; |
|
| 101 | + return $plain===$plain_firmado; |
|
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | /** |
@@ -261,7 +261,7 @@ discard block |
||
| 261 | 261 | public function getCertificacion() |
| 262 | 262 | { |
| 263 | 263 | $idk = $this->getIDK(); |
| 264 | - return $idk ? $idk === 100 : null; |
|
| 264 | + return $idk ? $idk===100 : null; |
|
| 265 | 265 | } |
| 266 | 266 | |
| 267 | 267 | /** |
@@ -276,11 +276,11 @@ discard block |
||
| 276 | 276 | return true; |
| 277 | 277 | } |
| 278 | 278 | $fecha_autorizacion = $this->getFechaAutorizacion(); |
| 279 | - $vigencia = $fecha_autorizacion >= '2018-07-01' ? 6 : 18; |
|
| 279 | + $vigencia = $fecha_autorizacion>='2018-07-01' ? 6 : 18; |
|
| 280 | 280 | $d1 = new \DateTime($fecha_autorizacion); |
| 281 | 281 | $d2 = new \DateTime(date('Y-m-d')); |
| 282 | - $meses = $d1->diff($d2)->m + ($d1->diff($d2)->y*12); |
|
| 283 | - return $meses <= $vigencia; |
|
| 282 | + $meses = $d1->diff($d2)->m+($d1->diff($d2)->y * 12); |
|
| 283 | + return $meses<=$vigencia; |
|
| 284 | 284 | } |
| 285 | 285 | |
| 286 | 286 | /** |