@@ -66,4 +66,4 @@ |
||
| 66 | 66 | |
| 67 | 67 | // si hubo errores mostrar |
| 68 | 68 | foreach (\sasco\LibreDTE\Log::readAll() as $error) |
| 69 | - echo $error,"\n"; |
|
| 69 | + echo $error, "\n"; |
|
@@ -98,5 +98,6 @@ |
||
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | // si hubo errores mostrar |
| 101 | -foreach (\sasco\LibreDTE\Log::readAll() as $error) |
|
| 101 | +foreach (\sasco\LibreDTE\Log::readAll() as $error) { |
|
| 102 | 102 | echo $error,"\n"; |
| 103 | +} |
|
@@ -66,4 +66,4 @@ |
||
| 66 | 66 | |
| 67 | 67 | // si hubo errores mostrar |
| 68 | 68 | foreach (\sasco\LibreDTE\Log::readAll() as $error) |
| 69 | - echo $error,"\n"; |
|
| 69 | + echo $error, "\n"; |
|
@@ -65,5 +65,6 @@ |
||
| 65 | 65 | var_dump($track_id); |
| 66 | 66 | |
| 67 | 67 | // si hubo errores mostrar |
| 68 | -foreach (\sasco\LibreDTE\Log::readAll() as $error) |
|
| 68 | +foreach (\sasco\LibreDTE\Log::readAll() as $error) { |
|
| 69 | 69 | echo $error,"\n"; |
| 70 | +} |
|
@@ -66,4 +66,4 @@ |
||
| 66 | 66 | |
| 67 | 67 | // si hubo errores mostrar |
| 68 | 68 | foreach (\sasco\LibreDTE\Log::readAll() as $error) |
| 69 | - echo $error,"\n"; |
|
| 69 | + echo $error, "\n"; |
|
@@ -98,5 +98,6 @@ |
||
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | // si hubo errores mostrar |
| 101 | -foreach (\sasco\LibreDTE\Log::readAll() as $error) |
|
| 101 | +foreach (\sasco\LibreDTE\Log::readAll() as $error) { |
|
| 102 | 102 | echo $error,"\n"; |
| 103 | +} |
|
@@ -66,4 +66,4 @@ |
||
| 66 | 66 | |
| 67 | 67 | // si hubo errores mostrar |
| 68 | 68 | foreach (\sasco\LibreDTE\Log::readAll() as $error) |
| 69 | - echo $error,"\n"; |
|
| 69 | + echo $error, "\n"; |
|
@@ -65,5 +65,6 @@ |
||
| 65 | 65 | var_dump($track_id); |
| 66 | 66 | |
| 67 | 67 | // si hubo errores mostrar |
| 68 | -foreach (\sasco\LibreDTE\Log::readAll() as $error) |
|
| 68 | +foreach (\sasco\LibreDTE\Log::readAll() as $error) { |
|
| 69 | 69 | echo $error,"\n"; |
| 70 | +} |
|
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | /** |
| 175 | 175 | * Método que asigna la ubicación del logo de la empresa |
| 176 | 176 | * @param logo URI del logo (puede ser local o en una URL) |
| 177 | - * @param posicion Posición respecto a datos del emisor (=0 izq, =1 arriba) |
|
| 177 | + * @param posicion integer respecto a datos del emisor (=0 izq, =1 arriba) |
|
| 178 | 178 | * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl) |
| 179 | 179 | * @version 2016-08-04 |
| 180 | 180 | */ |
@@ -336,7 +336,7 @@ discard block |
||
| 336 | 336 | * contínuo |
| 337 | 337 | * @param dte Arreglo con los datos del XML (tag Documento) |
| 338 | 338 | * @param timbre String XML con el tag TED del DTE |
| 339 | - * @param width Ancho del papel contínuo en mm |
|
| 339 | + * @param width boolean del papel contínuo en mm |
|
| 340 | 340 | * @author Pablo Reyes (https://github.com/pabloxp) |
| 341 | 341 | * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl) |
| 342 | 342 | * @version 2017-06-15 |
@@ -482,10 +482,11 @@ discard block |
||
| 482 | 482 | * - Dirección casa central del emisor |
| 483 | 483 | * - Dirección sucursales |
| 484 | 484 | * @param emisor Arreglo con los datos del emisor (tag Emisor del XML) |
| 485 | - * @param x Posición horizontal de inicio en el PDF |
|
| 486 | - * @param y Posición vertical de inicio en el PDF |
|
| 487 | - * @param w Ancho de la información del emisor |
|
| 488 | - * @param w_img Ancho máximo de la imagen |
|
| 485 | + * @param x integer horizontal de inicio en el PDF |
|
| 486 | + * @param y integer vertical de inicio en el PDF |
|
| 487 | + * @param w integer de la información del emisor |
|
| 488 | + * @param w_img integer máximo de la imagen |
|
| 489 | + * @param integer $font_size |
|
| 489 | 490 | * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl) |
| 490 | 491 | * @version 2016-12-02 |
| 491 | 492 | */ |
@@ -555,11 +556,13 @@ discard block |
||
| 555 | 556 | * @param rut RUT del emisor |
| 556 | 557 | * @param tipo Código o glosa del tipo de documento |
| 557 | 558 | * @param sucursal_sii Código o glosa de la sucursal del SII del Emisor |
| 558 | - * @param x Posición horizontal de inicio en el PDF |
|
| 559 | - * @param y Posición vertical de inicio en el PDF |
|
| 560 | - * @param w Ancho de la información del emisor |
|
| 559 | + * @param x integer horizontal de inicio en el PDF |
|
| 560 | + * @param y integer vertical de inicio en el PDF |
|
| 561 | + * @param w integer de la información del emisor |
|
| 562 | + * @param integer $font_size |
|
| 561 | 563 | * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl) |
| 562 | 564 | * @version 2016-12-02 |
| 565 | + * @return integer |
|
| 563 | 566 | */ |
| 564 | 567 | private function agregarFolio($rut, $tipo, $folio, $sucursal_sii = null, $x = 130, $y = 15, $w = 70, $font_size = null, array $color = null) |
| 565 | 568 | { |
@@ -605,7 +608,7 @@ discard block |
||
| 605 | 608 | * Método que agrega los datos de la emisión del DTE que no son los dato del |
| 606 | 609 | * receptor |
| 607 | 610 | * @param IdDoc Información general del documento |
| 608 | - * @param x Posición horizontal de inicio en el PDF |
|
| 611 | + * @param x integer horizontal de inicio en el PDF |
|
| 609 | 612 | * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl) |
| 610 | 613 | * @version 2017-06-15 |
| 611 | 614 | */ |
@@ -693,7 +696,7 @@ discard block |
||
| 693 | 696 | /** |
| 694 | 697 | * Método que agrega los datos del receptor |
| 695 | 698 | * @param receptor Arreglo con los datos del receptor (tag Receptor del XML) |
| 696 | - * @param x Posición horizontal de inicio en el PDF |
|
| 699 | + * @param x integer horizontal de inicio en el PDF |
|
| 697 | 700 | * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl) |
| 698 | 701 | * @version 2017-06-15 |
| 699 | 702 | */ |
@@ -780,7 +783,7 @@ discard block |
||
| 780 | 783 | * Método que agrega los datos del traslado |
| 781 | 784 | * @param IndTraslado |
| 782 | 785 | * @param Transporte |
| 783 | - * @param x Posición horizontal de inicio en el PDF |
|
| 786 | + * @param x integer horizontal de inicio en el PDF |
|
| 784 | 787 | * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl) |
| 785 | 788 | * @version 2016-08-03 |
| 786 | 789 | */ |
@@ -851,7 +854,7 @@ discard block |
||
| 851 | 854 | /** |
| 852 | 855 | * Método que agrega las referencias del documento |
| 853 | 856 | * @param referencias Arreglo con las referencias del documento (tag Referencia del XML) |
| 854 | - * @param x Posición horizontal de inicio en el PDF |
|
| 857 | + * @param x integer horizontal de inicio en el PDF |
|
| 855 | 858 | * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl) |
| 856 | 859 | * @version 2016-08-03 |
| 857 | 860 | */ |
@@ -874,7 +877,7 @@ discard block |
||
| 874 | 877 | /** |
| 875 | 878 | * Método que agrega el detalle del documento |
| 876 | 879 | * @param detalle Arreglo con el detalle del documento (tag Detalle del XML) |
| 877 | - * @param x Posición horizontal de inicio en el PDF |
|
| 880 | + * @param x integer horizontal de inicio en el PDF |
|
| 878 | 881 | * @param y Posición vertical de inicio en el PDF |
| 879 | 882 | * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl) |
| 880 | 883 | * @version 2016-08-05 |
@@ -941,7 +944,7 @@ discard block |
||
| 941 | 944 | /** |
| 942 | 945 | * Método que agrega el detalle del documento |
| 943 | 946 | * @param detalle Arreglo con el detalle del documento (tag Detalle del XML) |
| 944 | - * @param x Posición horizontal de inicio en el PDF |
|
| 947 | + * @param x integer horizontal de inicio en el PDF |
|
| 945 | 948 | * @param y Posición vertical de inicio en el PDF |
| 946 | 949 | * @author Pablo Reyes (https://github.com/pabloxp) |
| 947 | 950 | * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl) |
@@ -977,7 +980,7 @@ discard block |
||
| 977 | 980 | * Método que agrega el subtotal del DTE |
| 978 | 981 | * @param detalle Arreglo con los detalles del documentos para poder |
| 979 | 982 | * calcular subtotal |
| 980 | - * @param x Posición horizontal de inicio en el PDF |
|
| 983 | + * @param x integer horizontal de inicio en el PDF |
|
| 981 | 984 | * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl) |
| 982 | 985 | * @version 2016-08-17 |
| 983 | 986 | */ |
@@ -1003,7 +1006,7 @@ discard block |
||
| 1003 | 1006 | /** |
| 1004 | 1007 | * Método que agrega los descuentos y/o recargos globales del documento |
| 1005 | 1008 | * @param descuentosRecargos Arreglo con los descuentos y/o recargos del documento (tag DscRcgGlobal del XML) |
| 1006 | - * @param x Posición horizontal de inicio en el PDF |
|
| 1009 | + * @param x integer horizontal de inicio en el PDF |
|
| 1007 | 1010 | * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl) |
| 1008 | 1011 | * @version 2016-08-17 |
| 1009 | 1012 | */ |
@@ -1027,7 +1030,7 @@ discard block |
||
| 1027 | 1030 | /** |
| 1028 | 1031 | * Método que agrega los pagos del documento |
| 1029 | 1032 | * @param pagos Arreglo con los pagos del documento |
| 1030 | - * @param x Posición horizontal de inicio en el PDF |
|
| 1033 | + * @param x integer horizontal de inicio en el PDF |
|
| 1031 | 1034 | * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl) |
| 1032 | 1035 | * @version 2016-07-24 |
| 1033 | 1036 | */ |
@@ -1137,9 +1140,9 @@ discard block |
||
| 1137 | 1140 | * - Se imprime en el tamaño mínimo: 2x5 cms |
| 1138 | 1141 | * - En el lado de abajo con margen izquierdo mínimo de 2 cms |
| 1139 | 1142 | * @param timbre String con los datos del timbre |
| 1140 | - * @param x Posición horizontal de inicio en el PDF |
|
| 1141 | - * @param y Posición vertical de inicio en el PDF |
|
| 1142 | - * @param w Ancho del timbre |
|
| 1143 | + * @param x integer horizontal de inicio en el PDF |
|
| 1144 | + * @param y integer vertical de inicio en el PDF |
|
| 1145 | + * @param w integer del timbre |
|
| 1143 | 1146 | * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl) |
| 1144 | 1147 | * @version 2017-07-13 |
| 1145 | 1148 | */ |
@@ -1176,10 +1179,10 @@ discard block |
||
| 1176 | 1179 | |
| 1177 | 1180 | /** |
| 1178 | 1181 | * Método que agrega el acuse de rebido |
| 1179 | - * @param x Posición horizontal de inicio en el PDF |
|
| 1180 | - * @param y Posición vertical de inicio en el PDF |
|
| 1181 | - * @param w Ancho del acuse de recibo |
|
| 1182 | - * @param h Alto del acuse de recibo |
|
| 1182 | + * @param x integer horizontal de inicio en el PDF |
|
| 1183 | + * @param y integer vertical de inicio en el PDF |
|
| 1184 | + * @param w integer del acuse de recibo |
|
| 1185 | + * @param h integer del acuse de recibo |
|
| 1183 | 1186 | * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl) |
| 1184 | 1187 | * @version 2015-09-08 |
| 1185 | 1188 | */ |
@@ -1206,10 +1209,10 @@ discard block |
||
| 1206 | 1209 | |
| 1207 | 1210 | /** |
| 1208 | 1211 | * Método que agrega el acuse de rebido |
| 1209 | - * @param x Posición horizontal de inicio en el PDF |
|
| 1212 | + * @param x integer horizontal de inicio en el PDF |
|
| 1210 | 1213 | * @param y Posición vertical de inicio en el PDF |
| 1211 | - * @param w Ancho del acuse de recibo |
|
| 1212 | - * @param h Alto del acuse de recibo |
|
| 1214 | + * @param w integer del acuse de recibo |
|
| 1215 | + * @param h integer del acuse de recibo |
|
| 1213 | 1216 | * @author Pablo Reyes (https://github.com/pabloxp) |
| 1214 | 1217 | * @version 2015-11-17 |
| 1215 | 1218 | */ |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | { |
| 169 | 169 | parent::__construct(); |
| 170 | 170 | $this->SetTitle('Documento Tributario Electrónico (DTE) de Chile by LibreDTE'); |
| 171 | - $this->papelContinuo = $papelContinuo === true ? 80 : $papelContinuo; |
|
| 171 | + $this->papelContinuo = $papelContinuo===true ? 80 : $papelContinuo; |
|
| 172 | 172 | } |
| 173 | 173 | |
| 174 | 174 | /** |
@@ -303,7 +303,7 @@ discard block |
||
| 303 | 303 | $this->setY(max($y)); |
| 304 | 304 | $this->Ln(); |
| 305 | 305 | $y = []; |
| 306 | - $y[] = $this->agregarDatosEmision($dte['Encabezado']['IdDoc'], !empty($dte['Encabezado']['Emisor']['CdgVendedor'])?$dte['Encabezado']['Emisor']['CdgVendedor']:null); |
|
| 306 | + $y[] = $this->agregarDatosEmision($dte['Encabezado']['IdDoc'], !empty($dte['Encabezado']['Emisor']['CdgVendedor']) ? $dte['Encabezado']['Emisor']['CdgVendedor'] : null); |
|
| 307 | 307 | $y[] = $this->agregarReceptor($dte['Encabezado']); |
| 308 | 308 | $this->setY(max($y)); |
| 309 | 309 | $this->agregarTraslado( |
@@ -350,7 +350,7 @@ discard block |
||
| 350 | 350 | // determinar alto de la página y agregarla |
| 351 | 351 | $height = 145; |
| 352 | 352 | $n_detalle = count($dte['Detalle']); |
| 353 | - if ($n_detalle>1) $height += $n_detalle*20; |
|
| 353 | + if ($n_detalle>1) $height += $n_detalle * 20; |
|
| 354 | 354 | if ($this->cedible) $height += 50; |
| 355 | 355 | $this->AddPage('P', [$height, $width]); |
| 356 | 356 | // agregar cabecera del documento |
@@ -359,15 +359,15 @@ discard block |
||
| 359 | 359 | $dte['Encabezado']['IdDoc']['TipoDTE'], |
| 360 | 360 | $dte['Encabezado']['IdDoc']['Folio'], |
| 361 | 361 | $dte['Encabezado']['Emisor']['CmnaOrigen'], |
| 362 | - $x_start, $y_start, $width-($x_start*4), 10, |
|
| 363 | - [0,0,0] |
|
| 362 | + $x_start, $y_start, $width-($x_start * 4), 10, |
|
| 363 | + [0, 0, 0] |
|
| 364 | 364 | ); |
| 365 | - $y = $this->agregarEmisor($dte['Encabezado']['Emisor'], $x_start, $y+2, 40, 8, 9, [0,0,0]); |
|
| 365 | + $y = $this->agregarEmisor($dte['Encabezado']['Emisor'], $x_start, $y+2, 40, 8, 9, [0, 0, 0]); |
|
| 366 | 366 | // datos del documento |
| 367 | 367 | $this->SetY($y); |
| 368 | 368 | $this->Ln(); |
| 369 | 369 | $this->setFont('', '', 8); |
| 370 | - $this->agregarDatosEmision($dte['Encabezado']['IdDoc'], !empty($dte['Encabezado']['Emisor']['CdgVendedor'])?$dte['Encabezado']['Emisor']['CdgVendedor']:null, $x_start, $offset, false); |
|
| 370 | + $this->agregarDatosEmision($dte['Encabezado']['IdDoc'], !empty($dte['Encabezado']['Emisor']['CdgVendedor']) ? $dte['Encabezado']['Emisor']['CdgVendedor'] : null, $x_start, $offset, false); |
|
| 371 | 371 | $this->agregarReceptor($dte['Encabezado'], $x_start, $offset); |
| 372 | 372 | $this->agregarTraslado( |
| 373 | 373 | !empty($dte['Encabezado']['IdDoc']['IndTraslado']) ? $dte['Encabezado']['IdDoc']['IndTraslado'] : null, |
@@ -417,7 +417,7 @@ discard block |
||
| 417 | 417 | $this->AddPage('P', [$height, $width]); |
| 418 | 418 | $x = 1; |
| 419 | 419 | $y = 5; |
| 420 | - $this->SetXY($x,$y); |
|
| 420 | + $this->SetXY($x, $y); |
|
| 421 | 421 | // agregar datos del documento |
| 422 | 422 | $this->setFont('', '', 8); |
| 423 | 423 | $this->MultiTexto(!empty($dte['Encabezado']['Emisor']['RznSoc']) ? $dte['Encabezado']['Emisor']['RznSoc'] : $dte['Encabezado']['Emisor']['RznSocEmisor'], $x, null, '', $width-2); |
@@ -497,13 +497,13 @@ discard block |
||
| 497 | 497 | $this->logo['uri'], |
| 498 | 498 | $x, |
| 499 | 499 | $y, |
| 500 | - !$this->logo['posicion']?$w_img:null, $this->logo['posicion']?($w_img/2):null, |
|
| 500 | + !$this->logo['posicion'] ? $w_img : null, $this->logo['posicion'] ? ($w_img / 2) : null, |
|
| 501 | 501 | 'PNG', |
| 502 | - (isset($emisor['url'])?$emisor['url']:''), |
|
| 502 | + (isset($emisor['url']) ? $emisor['url'] : ''), |
|
| 503 | 503 | 'T' |
| 504 | 504 | ); |
| 505 | 505 | if ($this->logo['posicion']) { |
| 506 | - $this->SetY($this->y + ($w_img/2)); |
|
| 506 | + $this->SetY($this->y+($w_img / 2)); |
|
| 507 | 507 | $w += 40; |
| 508 | 508 | } else { |
| 509 | 509 | $x = $this->x+3; |
@@ -514,13 +514,13 @@ discard block |
||
| 514 | 514 | } |
| 515 | 515 | // agregar datos del emisor |
| 516 | 516 | $this->setFont('', 'B', $font_size ? $font_size : 14); |
| 517 | - $this->SetTextColorArray($color===null?[32, 92, 144]:$color); |
|
| 517 | + $this->SetTextColorArray($color===null ? [32, 92, 144] : $color); |
|
| 518 | 518 | $this->MultiTexto(!empty($emisor['RznSoc']) ? $emisor['RznSoc'] : $emisor['RznSocEmisor'], $x, $this->y+2, 'L', $w); |
| 519 | 519 | $this->setFont('', 'B', $font_size ? $font_size : 9); |
| 520 | - $this->SetTextColorArray([0,0,0]); |
|
| 520 | + $this->SetTextColorArray([0, 0, 0]); |
|
| 521 | 521 | $this->MultiTexto(!empty($emisor['GiroEmis']) ? $emisor['GiroEmis'] : $emisor['GiroEmisor'], $x, $this->y, 'L', $w); |
| 522 | 522 | $ciudad = !empty($emisor['CiudadOrigen']) ? $emisor['CiudadOrigen'] : \sasco\LibreDTE\Chile::getCiudad($emisor['CmnaOrigen']); |
| 523 | - $this->MultiTexto($emisor['DirOrigen'].', '.$emisor['CmnaOrigen'].($ciudad?(', '.$ciudad):''), $x, $this->y, 'L', $w); |
|
| 523 | + $this->MultiTexto($emisor['DirOrigen'].', '.$emisor['CmnaOrigen'].($ciudad ? (', '.$ciudad) : ''), $x, $this->y, 'L', $w); |
|
| 524 | 524 | if (!empty($emisor['Sucursal'])) { |
| 525 | 525 | $this->MultiTexto('Sucursal: '.$emisor['Sucursal'], $x, $this->y, 'L', $w); |
| 526 | 526 | } |
@@ -564,12 +564,12 @@ discard block |
||
| 564 | 564 | private function agregarFolio($rut, $tipo, $folio, $sucursal_sii = null, $x = 130, $y = 15, $w = 70, $font_size = null, array $color = null) |
| 565 | 565 | { |
| 566 | 566 | if ($color===null) { |
| 567 | - $color = $tipo ? ($tipo==52 ? [0,172,140] : [255,0,0]) : [0,0,0]; |
|
| 567 | + $color = $tipo ? ($tipo==52 ? [0, 172, 140] : [255, 0, 0]) : [0, 0, 0]; |
|
| 568 | 568 | } |
| 569 | 569 | $this->SetTextColorArray($color); |
| 570 | 570 | // colocar rut emisor, glosa documento y folio |
| 571 | 571 | list($rut, $dv) = explode('-', $rut); |
| 572 | - $this->setFont ('', 'B', $font_size ? $font_size : 15); |
|
| 572 | + $this->setFont('', 'B', $font_size ? $font_size : 15); |
|
| 573 | 573 | $this->MultiTexto('R.U.T.: '.$this->num($rut).'-'.$dv, $x, $y+4, 'C', $w); |
| 574 | 574 | $this->setFont('', 'B', $font_size ? $font_size : 12); |
| 575 | 575 | $this->MultiTexto($this->getTipo($tipo), $x, null, 'C', $w); |
@@ -582,7 +582,7 @@ discard block |
||
| 582 | 582 | if ($tipo) { |
| 583 | 583 | $this->Texto('S.I.I. - '.\sasco\LibreDTE\Sii::getDireccionRegional($sucursal_sii), $x, $this->getY()+4, 'C', $w); |
| 584 | 584 | } |
| 585 | - $this->SetTextColorArray([0,0,0]); |
|
| 585 | + $this->SetTextColorArray([0, 0, 0]); |
|
| 586 | 586 | $this->Ln(); |
| 587 | 587 | return $this->y; |
| 588 | 588 | } |
@@ -713,7 +713,7 @@ discard block |
||
| 713 | 713 | $this->Texto('Señor(es)', $x); |
| 714 | 714 | $this->Texto(':', $x+$offset); |
| 715 | 715 | $this->setFont('', '', null); |
| 716 | - $this->MultiTexto($receptor['RznSocRecep'], $x+$offset+2, null, '', $x==10?105:0); |
|
| 716 | + $this->MultiTexto($receptor['RznSocRecep'], $x+$offset+2, null, '', $x==10 ? 105 : 0); |
|
| 717 | 717 | } |
| 718 | 718 | if (!empty($receptor['GiroRecep'])) { |
| 719 | 719 | $this->setFont('', 'B', null); |
@@ -730,7 +730,7 @@ discard block |
||
| 730 | 730 | $ciudad = !empty($receptor['CiudadRecep']) ? $receptor['CiudadRecep'] : ( |
| 731 | 731 | !empty($receptor['CmnaRecep']) ? \sasco\LibreDTE\Chile::getCiudad($receptor['CmnaRecep']) : '' |
| 732 | 732 | ); |
| 733 | - $this->MultiTexto($receptor['DirRecep'].(!empty($receptor['CmnaRecep'])?(', '.$receptor['CmnaRecep']):'').($ciudad?(', '.$ciudad):''), $x+$offset+2); |
|
| 733 | + $this->MultiTexto($receptor['DirRecep'].(!empty($receptor['CmnaRecep']) ? (', '.$receptor['CmnaRecep']) : '').($ciudad ? (', '.$ciudad) : ''), $x+$offset+2); |
|
| 734 | 734 | } |
| 735 | 735 | if (!empty($receptor['Extranjero']['Nacionalidad'])) { |
| 736 | 736 | $this->setFont('', 'B', null); |
@@ -771,7 +771,7 @@ discard block |
||
| 771 | 771 | $this->Texto('Cód. recep.', $x); |
| 772 | 772 | $this->Texto(':', $x+$offset); |
| 773 | 773 | $this->setFont('', '', null); |
| 774 | - $this->MultiTexto($receptor['CdgIntRecep'], $x+$offset+2, null, '', $x==10?105:0); |
|
| 774 | + $this->MultiTexto($receptor['CdgIntRecep'], $x+$offset+2, null, '', $x==10 ? 105 : 0); |
|
| 775 | 775 | } |
| 776 | 776 | return $this->GetY(); |
| 777 | 777 | } |
@@ -859,7 +859,7 @@ discard block |
||
| 859 | 859 | { |
| 860 | 860 | if (!isset($referencias[0])) |
| 861 | 861 | $referencias = [$referencias]; |
| 862 | - foreach($referencias as $r) { |
|
| 862 | + foreach ($referencias as $r) { |
|
| 863 | 863 | $texto = $r['NroLinRef'].' - '.$this->getTipo($r['TpoDocRef']).' N° '.$r['FolioRef'].' del '.$r['FchRef']; |
| 864 | 864 | if (isset($r['RazonRef']) and $r['RazonRef']!==false) |
| 865 | 865 | $texto = $texto.': '.$r['RazonRef']; |
@@ -952,9 +952,9 @@ discard block |
||
| 952 | 952 | $this->SetY($this->getY()+1); |
| 953 | 953 | $p1x = $x; |
| 954 | 954 | $p1y = $this->y; |
| 955 | - $p2x = $this->getPageWidth() - 2; |
|
| 956 | - $p2y = $p1y; // Use same y for a straight line |
|
| 957 | - $style = array('width' => 0.2,'color' => array(0, 0, 0)); |
|
| 955 | + $p2x = $this->getPageWidth()-2; |
|
| 956 | + $p2y = $p1y; // Use same y for a straight line |
|
| 957 | + $style = array('width' => 0.2, 'color' => array(0, 0, 0)); |
|
| 958 | 958 | $this->Line($p1x, $p1y, $p2x, $p2y, $style); |
| 959 | 959 | $this->Texto($this->detalle_cols['NmbItem']['title'], $x+1, $this->y, ucfirst($this->detalle_cols['NmbItem']['align'][0]), $this->detalle_cols['NmbItem']['width']); |
| 960 | 960 | $this->Texto($this->detalle_cols['PrcItem']['title'], $x+15, $this->y, ucfirst($this->detalle_cols['PrcItem']['align'][0]), $this->detalle_cols['PrcItem']['width']); |
@@ -964,9 +964,9 @@ discard block |
||
| 964 | 964 | if (!isset($detalle[0])) |
| 965 | 965 | $detalle = [$detalle]; |
| 966 | 966 | $this->SetY($this->getY()+2); |
| 967 | - foreach($detalle as &$d) { |
|
| 967 | + foreach ($detalle as &$d) { |
|
| 968 | 968 | $this->MultiTexto($d['NmbItem'], $x+1, $this->y+4, ucfirst($this->detalle_cols['NmbItem']['align'][0]), $this->detalle_cols['NmbItem']['width']); |
| 969 | - $this->Texto(number_format($d['PrcItem'],0,',','.'), $x+15, $this->y, ucfirst($this->detalle_cols['PrcItem']['align'][0]), $this->detalle_cols['PrcItem']['width']); |
|
| 969 | + $this->Texto(number_format($d['PrcItem'], 0, ',', '.'), $x+15, $this->y, ucfirst($this->detalle_cols['PrcItem']['align'][0]), $this->detalle_cols['PrcItem']['width']); |
|
| 970 | 970 | $this->Texto($this->num($d['QtyItem']), $x+35, $this->y, ucfirst($this->detalle_cols['QtyItem']['align'][0]), $this->detalle_cols['QtyItem']['width']); |
| 971 | 971 | $this->Texto($this->num($d['MontoItem']), $x+45, $this->y, ucfirst($this->detalle_cols['MontoItem']['align'][0]), $this->detalle_cols['MontoItem']['width']); |
| 972 | 972 | } |
@@ -986,7 +986,7 @@ discard block |
||
| 986 | 986 | if (!isset($detalle[0])) { |
| 987 | 987 | $detalle = [$detalle]; |
| 988 | 988 | } |
| 989 | - foreach($detalle as &$d) { |
|
| 989 | + foreach ($detalle as &$d) { |
|
| 990 | 990 | if (!empty($d['MontoItem'])) { |
| 991 | 991 | $subtotal += $d['MontoItem']; |
| 992 | 992 | } |
@@ -1011,13 +1011,13 @@ discard block |
||
| 1011 | 1011 | { |
| 1012 | 1012 | if (!isset($descuentosRecargos[0])) |
| 1013 | 1013 | $descuentosRecargos = [$descuentosRecargos]; |
| 1014 | - foreach($descuentosRecargos as $dr) { |
|
| 1014 | + foreach ($descuentosRecargos as $dr) { |
|
| 1015 | 1015 | $tipo = $dr['TpoMov']=='D' ? 'Descuento' : 'Recargo'; |
| 1016 | 1016 | $valor = $dr['TpoValor']=='%' ? $dr['ValorDR'].'%' : $this->num($dr['ValorDR']); |
| 1017 | 1017 | if ($this->papelContinuo) { |
| 1018 | - $this->Texto($tipo.' global: '.$valor.(!empty($dr['GlosaDR'])?(' ('.$dr['GlosaDR'].')'):''), $x); |
|
| 1018 | + $this->Texto($tipo.' global: '.$valor.(!empty($dr['GlosaDR']) ? (' ('.$dr['GlosaDR'].')') : ''), $x); |
|
| 1019 | 1019 | } else { |
| 1020 | - $this->Texto($tipo.(!empty($dr['GlosaDR'])?(' ('.$dr['GlosaDR'].')'):'').':', 77, null, 'R', 100); |
|
| 1020 | + $this->Texto($tipo.(!empty($dr['GlosaDR']) ? (' ('.$dr['GlosaDR'].')') : '').':', 77, null, 'R', 100); |
|
| 1021 | 1021 | $this->Texto($valor, 177, null, 'R', 22); |
| 1022 | 1022 | } |
| 1023 | 1023 | $this->Ln(); |
@@ -1037,8 +1037,8 @@ discard block |
||
| 1037 | 1037 | $pagos = [$pagos]; |
| 1038 | 1038 | $this->Texto('Pago(s) programado(s):', $x); |
| 1039 | 1039 | $this->Ln(); |
| 1040 | - foreach($pagos as $p) { |
|
| 1041 | - $this->Texto(' - '.$this->date($p['FchPago'], false).': $'.$this->num($p['MntPago']).'.-'.(!empty($p['GlosaPagos'])?(' ('.$p['GlosaPagos'].')'):''), $x); |
|
| 1040 | + foreach ($pagos as $p) { |
|
| 1041 | + $this->Texto(' - '.$this->date($p['FchPago'], false).': $'.$this->num($p['MntPago']).'.-'.(!empty($p['GlosaPagos']) ? (' ('.$p['GlosaPagos'].')') : ''), $x); |
|
| 1042 | 1042 | $this->Ln(); |
| 1043 | 1043 | } |
| 1044 | 1044 | } |
@@ -1088,7 +1088,7 @@ discard block |
||
| 1088 | 1088 | if (!isset($ImptoReten[0])) { |
| 1089 | 1089 | $ImptoReten = [$ImptoReten]; |
| 1090 | 1090 | } |
| 1091 | - foreach($ImptoReten as $i) { |
|
| 1091 | + foreach ($ImptoReten as $i) { |
|
| 1092 | 1092 | $totales['ImptoReten_'.$i['TipoImp']] = $i['MontoImp']; |
| 1093 | 1093 | if (!empty($i['TasaImp'])) { |
| 1094 | 1094 | $glosas['ImptoReten_'.$i['TipoImp']] = \sasco\LibreDTE\Sii\ImpuestosAdicionales::getGlosa($i['TipoImp']).' ('.$i['TasaImp'].'%) $'; |
@@ -1153,7 +1153,7 @@ discard block |
||
| 1153 | 1153 | 'vpadding' => 0, |
| 1154 | 1154 | 'module_width' => 1, // width of a single module in points |
| 1155 | 1155 | 'module_height' => 1, // height of a single module in points |
| 1156 | - 'fgcolor' => [0,0,0], |
|
| 1156 | + 'fgcolor' => [0, 0, 0], |
|
| 1157 | 1157 | 'bgcolor' => false, // [255,255,255] |
| 1158 | 1158 | 'position' => $this->papelContinuo ? 'C' : 'S', |
| 1159 | 1159 | ]; |
@@ -1185,7 +1185,7 @@ discard block |
||
| 1185 | 1185 | */ |
| 1186 | 1186 | private function agregarAcuseRecibo($x = 93, $y = 190, $w = 50, $h = 40) |
| 1187 | 1187 | { |
| 1188 | - $this->SetTextColorArray([0,0,0]); |
|
| 1188 | + $this->SetTextColorArray([0, 0, 0]); |
|
| 1189 | 1189 | $this->Rect($x, $y, $w, $h, 'D', ['all' => ['width' => 0.1, 'color' => [0, 0, 0]]]); |
| 1190 | 1190 | $this->setFont('', 'B', 10); |
| 1191 | 1191 | $this->Texto('Acuse de recibo', $x, $y+1, 'C', $w); |
@@ -1215,9 +1215,9 @@ discard block |
||
| 1215 | 1215 | */ |
| 1216 | 1216 | private function agregarAcuseReciboContinuo($x = 3, $y = null, $w = 68, $h = 40) |
| 1217 | 1217 | { |
| 1218 | - $this->SetTextColorArray([0,0,0]); |
|
| 1218 | + $this->SetTextColorArray([0, 0, 0]); |
|
| 1219 | 1219 | $this->Rect($x, $y, $w, $h, 'D', ['all' => ['width' => 0.1, 'color' => [0, 0, 0]]]); |
| 1220 | - $style = array('width' => 0.2,'color' => array(0, 0, 0)); |
|
| 1220 | + $style = array('width' => 0.2, 'color' => array(0, 0, 0)); |
|
| 1221 | 1221 | $this->Line($x, $y+22, $w+3, $y+22, $style); |
| 1222 | 1222 | //$this->setFont('', 'B', 10); |
| 1223 | 1223 | //$this->Texto('Acuse de recibo', $x, $y+1, 'C', $w); |
@@ -1245,7 +1245,7 @@ discard block |
||
| 1245 | 1245 | private function agregarLeyendaDestino($tipo, $y = 254, $font_size = 10) |
| 1246 | 1246 | { |
| 1247 | 1247 | $this->setFont('', 'B', $font_size); |
| 1248 | - $this->Texto('CEDIBLE'.($tipo==52?' CON SU FACTURA':''), null, $y, 'R'); |
|
| 1248 | + $this->Texto('CEDIBLE'.($tipo==52 ? ' CON SU FACTURA' : ''), null, $y, 'R'); |
|
| 1249 | 1249 | } |
| 1250 | 1250 | |
| 1251 | 1251 | /** |
@@ -1276,7 +1276,7 @@ discard block |
||
| 1276 | 1276 | $dias = ['Domingo', 'Lunes', 'Martes', 'Miércoles', 'Jueves', 'Viernes', 'Sábado']; |
| 1277 | 1277 | $meses = ['enero', 'febrero', 'marzo', 'abril', 'mayo', 'junio', 'julio', 'agosto', 'septiembre', 'octubre', 'noviembre', 'diciembre']; |
| 1278 | 1278 | $unixtime = strtotime($date); |
| 1279 | - $fecha = date(($mostrar_dia?'\D\I\A ':'').'j \d\e \M\E\S \d\e\l Y', $unixtime); |
|
| 1279 | + $fecha = date(($mostrar_dia ? '\D\I\A ' : '').'j \d\e \M\E\S \d\e\l Y', $unixtime); |
|
| 1280 | 1280 | $dia = $dias[date('w', $unixtime)]; |
| 1281 | 1281 | $mes = $meses[date('n', $unixtime)-1]; |
| 1282 | 1282 | return str_replace(array('DIA', 'MES'), array($dia, $mes), $fecha); |
@@ -310,15 +310,17 @@ discard block |
||
| 310 | 310 | !empty($dte['Encabezado']['IdDoc']['IndTraslado']) ? $dte['Encabezado']['IdDoc']['IndTraslado'] : null, |
| 311 | 311 | !empty($dte['Encabezado']['Transporte']) ? $dte['Encabezado']['Transporte'] : null |
| 312 | 312 | ); |
| 313 | - if (!empty($dte['Referencia'])) |
|
| 314 | - $this->agregarReferencia($dte['Referencia']); |
|
| 313 | + if (!empty($dte['Referencia'])) { |
|
| 314 | + $this->agregarReferencia($dte['Referencia']); |
|
| 315 | + } |
|
| 315 | 316 | $this->agregarDetalle($dte['Detalle']); |
| 316 | 317 | if (!empty($dte['DscRcgGlobal'])) { |
| 317 | 318 | $this->agregarSubTotal($dte['Detalle']); |
| 318 | 319 | $this->agregarDescuentosRecargos($dte['DscRcgGlobal']); |
| 319 | 320 | } |
| 320 | - if (!empty($dte['Encabezado']['IdDoc']['MntPagos'])) |
|
| 321 | - $this->agregarPagos($dte['Encabezado']['IdDoc']['MntPagos']); |
|
| 321 | + if (!empty($dte['Encabezado']['IdDoc']['MntPagos'])) { |
|
| 322 | + $this->agregarPagos($dte['Encabezado']['IdDoc']['MntPagos']); |
|
| 323 | + } |
|
| 322 | 324 | $this->agregarTotales($dte['Encabezado']['Totales']); |
| 323 | 325 | // agregar observaciones |
| 324 | 326 | $this->agregarObservacion($dte['Encabezado']['IdDoc']); |
@@ -350,8 +352,12 @@ discard block |
||
| 350 | 352 | // determinar alto de la página y agregarla |
| 351 | 353 | $height = 145; |
| 352 | 354 | $n_detalle = count($dte['Detalle']); |
| 353 | - if ($n_detalle>1) $height += $n_detalle*20; |
|
| 354 | - if ($this->cedible) $height += 50; |
|
| 355 | + if ($n_detalle>1) { |
|
| 356 | + $height += $n_detalle*20; |
|
| 357 | + } |
|
| 358 | + if ($this->cedible) { |
|
| 359 | + $height += 50; |
|
| 360 | + } |
|
| 355 | 361 | $this->AddPage('P', [$height, $width]); |
| 356 | 362 | // agregar cabecera del documento |
| 357 | 363 | $y = $this->agregarFolio( |
@@ -412,8 +418,12 @@ discard block |
||
| 412 | 418 | { |
| 413 | 419 | // determinar alto de la página y agregarla |
| 414 | 420 | $height = 100; |
| 415 | - if ($this->cedible) $height += 50; |
|
| 416 | - if ($dte['Encabezado']['Receptor']['RUTRecep']!='66666666-6') $height += 40; |
|
| 421 | + if ($this->cedible) { |
|
| 422 | + $height += 50; |
|
| 423 | + } |
|
| 424 | + if ($dte['Encabezado']['Receptor']['RUTRecep']!='66666666-6') { |
|
| 425 | + $height += 40; |
|
| 426 | + } |
|
| 417 | 427 | $this->AddPage('P', [$height, $width]); |
| 418 | 428 | $x = 1; |
| 419 | 429 | $y = 5; |
@@ -526,10 +536,12 @@ discard block |
||
| 526 | 536 | } |
| 527 | 537 | $contacto = []; |
| 528 | 538 | if (!empty($emisor['Telefono'])) { |
| 529 | - if (!is_array($emisor['Telefono'])) |
|
| 530 | - $emisor['Telefono'] = [$emisor['Telefono']]; |
|
| 531 | - foreach ($emisor['Telefono'] as $t) |
|
| 532 | - $contacto[] = $t; |
|
| 539 | + if (!is_array($emisor['Telefono'])) { |
|
| 540 | + $emisor['Telefono'] = [$emisor['Telefono']]; |
|
| 541 | + } |
|
| 542 | + foreach ($emisor['Telefono'] as $t) { |
|
| 543 | + $contacto[] = $t; |
|
| 544 | + } |
|
| 533 | 545 | } |
| 534 | 546 | if (!empty($emisor['CorreoEmisor'])) { |
| 535 | 547 | $contacto[] = $emisor['CorreoEmisor']; |
@@ -596,8 +608,9 @@ discard block |
||
| 596 | 608 | */ |
| 597 | 609 | private function getTipo($tipo) |
| 598 | 610 | { |
| 599 | - if (!is_numeric($tipo) and !isset($this->tipos[$tipo])) |
|
| 600 | - return $tipo; |
|
| 611 | + if (!is_numeric($tipo) and !isset($this->tipos[$tipo])) { |
|
| 612 | + return $tipo; |
|
| 613 | + } |
|
| 601 | 614 | return isset($this->tipos[$tipo]) ? strtoupper($this->tipos[$tipo]) : 'Documento '.$tipo; |
| 602 | 615 | } |
| 603 | 616 | |
@@ -747,10 +760,12 @@ discard block |
||
| 747 | 760 | $this->MultiTexto($receptor['Extranjero']['NumId'], $x+$offset+2); |
| 748 | 761 | } |
| 749 | 762 | $contacto = []; |
| 750 | - if (!empty($receptor['Contacto'])) |
|
| 751 | - $contacto[] = $receptor['Contacto']; |
|
| 752 | - if (!empty($receptor['CorreoRecep'])) |
|
| 753 | - $contacto[] = $receptor['CorreoRecep']; |
|
| 763 | + if (!empty($receptor['Contacto'])) { |
|
| 764 | + $contacto[] = $receptor['Contacto']; |
|
| 765 | + } |
|
| 766 | + if (!empty($receptor['CorreoRecep'])) { |
|
| 767 | + $contacto[] = $receptor['CorreoRecep']; |
|
| 768 | + } |
|
| 754 | 769 | if (!empty($contacto)) { |
| 755 | 770 | $this->setFont('', 'B', null); |
| 756 | 771 | $this->Texto('Contacto', $x); |
@@ -800,15 +815,19 @@ discard block |
||
| 800 | 815 | if (!empty($Transporte['DirDest']) and !empty($Transporte['CmnaDest'])) { |
| 801 | 816 | $transporte .= 'a '.$Transporte['DirDest'].', '.$Transporte['CmnaDest']; |
| 802 | 817 | } |
| 803 | - if (!empty($Transporte['RUTTrans'])) |
|
| 804 | - $transporte .= ' por '.$Transporte['RUTTrans']; |
|
| 805 | - if (!empty($Transporte['Patente'])) |
|
| 806 | - $transporte .= ' en vehículo '.$Transporte['Patente']; |
|
| 818 | + if (!empty($Transporte['RUTTrans'])) { |
|
| 819 | + $transporte .= ' por '.$Transporte['RUTTrans']; |
|
| 820 | + } |
|
| 821 | + if (!empty($Transporte['Patente'])) { |
|
| 822 | + $transporte .= ' en vehículo '.$Transporte['Patente']; |
|
| 823 | + } |
|
| 807 | 824 | if (isset($Transporte['Chofer']) and is_array($Transporte['Chofer'])) { |
| 808 | - if (!empty($Transporte['Chofer']['NombreChofer'])) |
|
| 809 | - $transporte .= ' con chofer '.$Transporte['Chofer']['NombreChofer']; |
|
| 810 | - if (!empty($Transporte['Chofer']['RUTChofer'])) |
|
| 811 | - $transporte .= ' ('.$Transporte['Chofer']['RUTChofer'].')'; |
|
| 825 | + if (!empty($Transporte['Chofer']['NombreChofer'])) { |
|
| 826 | + $transporte .= ' con chofer '.$Transporte['Chofer']['NombreChofer']; |
|
| 827 | + } |
|
| 828 | + if (!empty($Transporte['Chofer']['RUTChofer'])) { |
|
| 829 | + $transporte .= ' ('.$Transporte['Chofer']['RUTChofer'].')'; |
|
| 830 | + } |
|
| 812 | 831 | } |
| 813 | 832 | if ($transporte) { |
| 814 | 833 | $this->setFont('', 'B', null); |
@@ -822,8 +841,9 @@ discard block |
||
| 822 | 841 | if (!empty($Transporte['Aduana']) and is_array($Transporte['Aduana'])) { |
| 823 | 842 | $col = 0; |
| 824 | 843 | foreach ($Transporte['Aduana'] as $tag => $codigo) { |
| 825 | - if ($codigo===false) |
|
| 826 | - continue; |
|
| 844 | + if ($codigo===false) { |
|
| 845 | + continue; |
|
| 846 | + } |
|
| 827 | 847 | $glosa = \sasco\LibreDTE\Sii\Aduana::getGlosa($tag); |
| 828 | 848 | $valor = \sasco\LibreDTE\Sii\Aduana::getValor($tag, $codigo); |
| 829 | 849 | if ($glosa!==false and $valor!==false) { |
@@ -836,15 +856,18 @@ discard block |
||
| 836 | 856 | $this->Texto(':', $x+$offset+$col); |
| 837 | 857 | $this->setFont('', '', null); |
| 838 | 858 | $this->Texto($valor, $x+$offset+2+$col); |
| 839 | - if ($tag=='TipoBultos') |
|
| 840 | - $col = abs($col-110); |
|
| 841 | - if ($col) |
|
| 842 | - $this->Ln(); |
|
| 859 | + if ($tag=='TipoBultos') { |
|
| 860 | + $col = abs($col-110); |
|
| 861 | + } |
|
| 862 | + if ($col) { |
|
| 863 | + $this->Ln(); |
|
| 864 | + } |
|
| 843 | 865 | $col = abs($col-110); |
| 844 | 866 | } |
| 845 | 867 | } |
| 846 | - if ($col) |
|
| 847 | - $this->Ln(); |
|
| 868 | + if ($col) { |
|
| 869 | + $this->Ln(); |
|
| 870 | + } |
|
| 848 | 871 | } |
| 849 | 872 | } |
| 850 | 873 | |
@@ -857,12 +880,14 @@ discard block |
||
| 857 | 880 | */ |
| 858 | 881 | private function agregarReferencia($referencias, $x = 10, $offset = 22) |
| 859 | 882 | { |
| 860 | - if (!isset($referencias[0])) |
|
| 861 | - $referencias = [$referencias]; |
|
| 883 | + if (!isset($referencias[0])) { |
|
| 884 | + $referencias = [$referencias]; |
|
| 885 | + } |
|
| 862 | 886 | foreach($referencias as $r) { |
| 863 | 887 | $texto = $r['NroLinRef'].' - '.$this->getTipo($r['TpoDocRef']).' N° '.$r['FolioRef'].' del '.$r['FchRef']; |
| 864 | - if (isset($r['RazonRef']) and $r['RazonRef']!==false) |
|
| 865 | - $texto = $texto.': '.$r['RazonRef']; |
|
| 888 | + if (isset($r['RazonRef']) and $r['RazonRef']!==false) { |
|
| 889 | + $texto = $texto.': '.$r['RazonRef']; |
|
| 890 | + } |
|
| 866 | 891 | $this->setFont('', 'B', null); |
| 867 | 892 | $this->Texto('Referencia', $x); |
| 868 | 893 | $this->Texto(':', $x+$offset); |
@@ -881,8 +906,9 @@ discard block |
||
| 881 | 906 | */ |
| 882 | 907 | private function agregarDetalle($detalle, $x = 10) |
| 883 | 908 | { |
| 884 | - if (!isset($detalle[0])) |
|
| 885 | - $detalle = [$detalle]; |
|
| 909 | + if (!isset($detalle[0])) { |
|
| 910 | + $detalle = [$detalle]; |
|
| 911 | + } |
|
| 886 | 912 | $this->setFont('', '', $this->detalle_fuente); |
| 887 | 913 | // titulos |
| 888 | 914 | $titulos = []; |
@@ -899,36 +925,42 @@ discard block |
||
| 899 | 925 | $item['NmbItem'] .= !$this->item_detalle_posicion ? '<br/>' : ': '; |
| 900 | 926 | $item['NmbItem'] .= '<span style="font-size:0.7em">'.$item['DscItem'].'</span>'; |
| 901 | 927 | } |
| 902 | - if (!in_array($col, $titulos_keys) or ($dte_exento and $col=='IndExe')) |
|
| 903 | - unset($item[$col]); |
|
| 928 | + if (!in_array($col, $titulos_keys) or ($dte_exento and $col=='IndExe')) { |
|
| 929 | + unset($item[$col]); |
|
| 930 | + } |
|
| 904 | 931 | } |
| 905 | 932 | // ajustes a IndExe |
| 906 | 933 | if (isset($item['IndExe'])) { |
| 907 | - if ($item['IndExe']==1) |
|
| 908 | - $item['IndExe'] = 'EX'; |
|
| 909 | - else if ($item['IndExe']==2) |
|
| 910 | - $item['IndExe'] = 'NF'; |
|
| 934 | + if ($item['IndExe']==1) { |
|
| 935 | + $item['IndExe'] = 'EX'; |
|
| 936 | + } else if ($item['IndExe']==2) { |
|
| 937 | + $item['IndExe'] = 'NF'; |
|
| 938 | + } |
|
| 911 | 939 | } |
| 912 | 940 | // agregar todas las columnas que se podrían imprimir en la tabla |
| 913 | 941 | $item_default = []; |
| 914 | - foreach ($this->detalle_cols as $key => $info) |
|
| 915 | - $item_default[$key] = false; |
|
| 942 | + foreach ($this->detalle_cols as $key => $info) { |
|
| 943 | + $item_default[$key] = false; |
|
| 944 | + } |
|
| 916 | 945 | $item = array_merge($item_default, $item); |
| 917 | 946 | // si hay código de item se extrae su valor |
| 918 | - if ($item['CdgItem']) |
|
| 919 | - $item['CdgItem'] = $item['CdgItem']['VlrCodigo']; |
|
| 947 | + if ($item['CdgItem']) { |
|
| 948 | + $item['CdgItem'] = $item['CdgItem']['VlrCodigo']; |
|
| 949 | + } |
|
| 920 | 950 | // dar formato a números |
| 921 | 951 | foreach (['QtyItem', 'PrcItem', 'DescuentoMonto', 'RecargoMonto', 'MontoItem'] as $col) { |
| 922 | - if ($item[$col]) |
|
| 923 | - $item[$col] = $this->num($item[$col]); |
|
| 952 | + if ($item[$col]) { |
|
| 953 | + $item[$col] = $this->num($item[$col]); |
|
| 954 | + } |
|
| 924 | 955 | } |
| 925 | 956 | } |
| 926 | 957 | // opciones |
| 927 | 958 | $options = ['align'=>[]]; |
| 928 | 959 | $i = 0; |
| 929 | 960 | foreach ($this->detalle_cols as $info) { |
| 930 | - if (isset($info['width'])) |
|
| 931 | - $options['width'][$i] = $info['width']; |
|
| 961 | + if (isset($info['width'])) { |
|
| 962 | + $options['width'][$i] = $info['width']; |
|
| 963 | + } |
|
| 932 | 964 | $options['align'][$i] = $info['align']; |
| 933 | 965 | $i++; |
| 934 | 966 | } |
@@ -961,8 +993,9 @@ discard block |
||
| 961 | 993 | $this->Texto($this->detalle_cols['QtyItem']['title'], $x+35, $this->y, ucfirst($this->detalle_cols['QtyItem']['align'][0]), $this->detalle_cols['QtyItem']['width']); |
| 962 | 994 | $this->Texto($this->detalle_cols['MontoItem']['title'], $x+45, $this->y, ucfirst($this->detalle_cols['MontoItem']['align'][0]), $this->detalle_cols['MontoItem']['width']); |
| 963 | 995 | $this->Line($p1x, $p1y+4, $p2x, $p2y+4, $style); |
| 964 | - if (!isset($detalle[0])) |
|
| 965 | - $detalle = [$detalle]; |
|
| 996 | + if (!isset($detalle[0])) { |
|
| 997 | + $detalle = [$detalle]; |
|
| 998 | + } |
|
| 966 | 999 | $this->SetY($this->getY()+2); |
| 967 | 1000 | foreach($detalle as &$d) { |
| 968 | 1001 | $this->MultiTexto($d['NmbItem'], $x+1, $this->y+4, ucfirst($this->detalle_cols['NmbItem']['align'][0]), $this->detalle_cols['NmbItem']['width']); |
@@ -1009,8 +1042,9 @@ discard block |
||
| 1009 | 1042 | */ |
| 1010 | 1043 | private function agregarDescuentosRecargos(array $descuentosRecargos, $x = 10) |
| 1011 | 1044 | { |
| 1012 | - if (!isset($descuentosRecargos[0])) |
|
| 1013 | - $descuentosRecargos = [$descuentosRecargos]; |
|
| 1045 | + if (!isset($descuentosRecargos[0])) { |
|
| 1046 | + $descuentosRecargos = [$descuentosRecargos]; |
|
| 1047 | + } |
|
| 1014 | 1048 | foreach($descuentosRecargos as $dr) { |
| 1015 | 1049 | $tipo = $dr['TpoMov']=='D' ? 'Descuento' : 'Recargo'; |
| 1016 | 1050 | $valor = $dr['TpoValor']=='%' ? $dr['ValorDR'].'%' : $this->num($dr['ValorDR']); |
@@ -1033,8 +1067,9 @@ discard block |
||
| 1033 | 1067 | */ |
| 1034 | 1068 | private function agregarPagos(array $pagos, $x = 10) |
| 1035 | 1069 | { |
| 1036 | - if (!isset($pagos[0])) |
|
| 1037 | - $pagos = [$pagos]; |
|
| 1070 | + if (!isset($pagos[0])) { |
|
| 1071 | + $pagos = [$pagos]; |
|
| 1072 | + } |
|
| 1038 | 1073 | $this->Texto('Pago(s) programado(s):', $x); |
| 1039 | 1074 | $this->Ln(); |
| 1040 | 1075 | foreach($pagos as $p) { |
@@ -1258,11 +1293,13 @@ discard block |
||
| 1258 | 1293 | */ |
| 1259 | 1294 | private function num($n) |
| 1260 | 1295 | { |
| 1261 | - if (!is_numeric($n)) |
|
| 1262 | - return $n; |
|
| 1296 | + if (!is_numeric($n)) { |
|
| 1297 | + return $n; |
|
| 1298 | + } |
|
| 1263 | 1299 | $broken_number = explode('.', (string)$n); |
| 1264 | - if (isset($broken_number[1])) |
|
| 1265 | - return number_format($broken_number[0], 0, ',', '.').','.$broken_number[1]; |
|
| 1300 | + if (isset($broken_number[1])) { |
|
| 1301 | + return number_format($broken_number[0], 0, ',', '.').','.$broken_number[1]; |
|
| 1302 | + } |
|
| 1266 | 1303 | return number_format($broken_number[0], 0, ',', '.'); |
| 1267 | 1304 | } |
| 1268 | 1305 | |