@@ -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 2017-08-17 |
| 857 | 860 | */ |
@@ -884,7 +887,7 @@ discard block |
||
| 884 | 887 | /** |
| 885 | 888 | * Método que agrega el detalle del documento |
| 886 | 889 | * @param detalle Arreglo con el detalle del documento (tag Detalle del XML) |
| 887 | - * @param x Posición horizontal de inicio en el PDF |
|
| 890 | + * @param x integer horizontal de inicio en el PDF |
|
| 888 | 891 | * @param y Posición vertical de inicio en el PDF |
| 889 | 892 | * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl) |
| 890 | 893 | * @version 2016-08-05 |
@@ -951,7 +954,7 @@ discard block |
||
| 951 | 954 | /** |
| 952 | 955 | * Método que agrega el detalle del documento |
| 953 | 956 | * @param detalle Arreglo con el detalle del documento (tag Detalle del XML) |
| 954 | - * @param x Posición horizontal de inicio en el PDF |
|
| 957 | + * @param x integer horizontal de inicio en el PDF |
|
| 955 | 958 | * @param y Posición vertical de inicio en el PDF |
| 956 | 959 | * @author Pablo Reyes (https://github.com/pabloxp) |
| 957 | 960 | * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl) |
@@ -987,7 +990,7 @@ discard block |
||
| 987 | 990 | * Método que agrega el subtotal del DTE |
| 988 | 991 | * @param detalle Arreglo con los detalles del documentos para poder |
| 989 | 992 | * calcular subtotal |
| 990 | - * @param x Posición horizontal de inicio en el PDF |
|
| 993 | + * @param x integer horizontal de inicio en el PDF |
|
| 991 | 994 | * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl) |
| 992 | 995 | * @version 2016-08-17 |
| 993 | 996 | */ |
@@ -1013,7 +1016,7 @@ discard block |
||
| 1013 | 1016 | /** |
| 1014 | 1017 | * Método que agrega los descuentos y/o recargos globales del documento |
| 1015 | 1018 | * @param descuentosRecargos Arreglo con los descuentos y/o recargos del documento (tag DscRcgGlobal del XML) |
| 1016 | - * @param x Posición horizontal de inicio en el PDF |
|
| 1019 | + * @param x integer horizontal de inicio en el PDF |
|
| 1017 | 1020 | * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl) |
| 1018 | 1021 | * @version 2016-08-17 |
| 1019 | 1022 | */ |
@@ -1037,7 +1040,7 @@ discard block |
||
| 1037 | 1040 | /** |
| 1038 | 1041 | * Método que agrega los pagos del documento |
| 1039 | 1042 | * @param pagos Arreglo con los pagos del documento |
| 1040 | - * @param x Posición horizontal de inicio en el PDF |
|
| 1043 | + * @param x integer horizontal de inicio en el PDF |
|
| 1041 | 1044 | * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl) |
| 1042 | 1045 | * @version 2016-07-24 |
| 1043 | 1046 | */ |
@@ -1147,9 +1150,9 @@ discard block |
||
| 1147 | 1150 | * - Se imprime en el tamaño mínimo: 2x5 cms |
| 1148 | 1151 | * - En el lado de abajo con margen izquierdo mínimo de 2 cms |
| 1149 | 1152 | * @param timbre String con los datos del timbre |
| 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 timbre |
|
| 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 timbre |
|
| 1153 | 1156 | * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl) |
| 1154 | 1157 | * @version 2017-07-13 |
| 1155 | 1158 | */ |
@@ -1186,10 +1189,10 @@ discard block |
||
| 1186 | 1189 | |
| 1187 | 1190 | /** |
| 1188 | 1191 | * Método que agrega el acuse de rebido |
| 1189 | - * @param x Posición horizontal de inicio en el PDF |
|
| 1190 | - * @param y Posición vertical de inicio en el PDF |
|
| 1191 | - * @param w Ancho del acuse de recibo |
|
| 1192 | - * @param h Alto del acuse de recibo |
|
| 1192 | + * @param x integer horizontal de inicio en el PDF |
|
| 1193 | + * @param y integer vertical de inicio en el PDF |
|
| 1194 | + * @param w integer del acuse de recibo |
|
| 1195 | + * @param h integer del acuse de recibo |
|
| 1193 | 1196 | * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl) |
| 1194 | 1197 | * @version 2015-09-08 |
| 1195 | 1198 | */ |
@@ -1216,10 +1219,10 @@ discard block |
||
| 1216 | 1219 | |
| 1217 | 1220 | /** |
| 1218 | 1221 | * Método que agrega el acuse de rebido |
| 1219 | - * @param x Posición horizontal de inicio en el PDF |
|
| 1222 | + * @param x integer horizontal de inicio en el PDF |
|
| 1220 | 1223 | * @param y Posición vertical de inicio en el PDF |
| 1221 | - * @param w Ancho del acuse de recibo |
|
| 1222 | - * @param h Alto del acuse de recibo |
|
| 1224 | + * @param w integer del acuse de recibo |
|
| 1225 | + * @param h integer del acuse de recibo |
|
| 1223 | 1226 | * @author Pablo Reyes (https://github.com/pabloxp) |
| 1224 | 1227 | * @version 2015-11-17 |
| 1225 | 1228 | */ |
@@ -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'].' - '; |
| 864 | 864 | if (!empty($r['TpoDocRef'])) { |
| 865 | 865 | $texto .= $this->getTipo($r['TpoDocRef']).' '; |
@@ -962,9 +962,9 @@ discard block |
||
| 962 | 962 | $this->SetY($this->getY()+1); |
| 963 | 963 | $p1x = $x; |
| 964 | 964 | $p1y = $this->y; |
| 965 | - $p2x = $this->getPageWidth() - 2; |
|
| 966 | - $p2y = $p1y; // Use same y for a straight line |
|
| 967 | - $style = array('width' => 0.2,'color' => array(0, 0, 0)); |
|
| 965 | + $p2x = $this->getPageWidth()-2; |
|
| 966 | + $p2y = $p1y; // Use same y for a straight line |
|
| 967 | + $style = array('width' => 0.2, 'color' => array(0, 0, 0)); |
|
| 968 | 968 | $this->Line($p1x, $p1y, $p2x, $p2y, $style); |
| 969 | 969 | $this->Texto($this->detalle_cols['NmbItem']['title'], $x+1, $this->y, ucfirst($this->detalle_cols['NmbItem']['align'][0]), $this->detalle_cols['NmbItem']['width']); |
| 970 | 970 | $this->Texto($this->detalle_cols['PrcItem']['title'], $x+15, $this->y, ucfirst($this->detalle_cols['PrcItem']['align'][0]), $this->detalle_cols['PrcItem']['width']); |
@@ -974,9 +974,9 @@ discard block |
||
| 974 | 974 | if (!isset($detalle[0])) |
| 975 | 975 | $detalle = [$detalle]; |
| 976 | 976 | $this->SetY($this->getY()+2); |
| 977 | - foreach($detalle as &$d) { |
|
| 977 | + foreach ($detalle as &$d) { |
|
| 978 | 978 | $this->MultiTexto($d['NmbItem'], $x+1, $this->y+4, ucfirst($this->detalle_cols['NmbItem']['align'][0]), $this->detalle_cols['NmbItem']['width']); |
| 979 | - $this->Texto(number_format($d['PrcItem'],0,',','.'), $x+15, $this->y, ucfirst($this->detalle_cols['PrcItem']['align'][0]), $this->detalle_cols['PrcItem']['width']); |
|
| 979 | + $this->Texto(number_format($d['PrcItem'], 0, ',', '.'), $x+15, $this->y, ucfirst($this->detalle_cols['PrcItem']['align'][0]), $this->detalle_cols['PrcItem']['width']); |
|
| 980 | 980 | $this->Texto($this->num($d['QtyItem']), $x+35, $this->y, ucfirst($this->detalle_cols['QtyItem']['align'][0]), $this->detalle_cols['QtyItem']['width']); |
| 981 | 981 | $this->Texto($this->num($d['MontoItem']), $x+45, $this->y, ucfirst($this->detalle_cols['MontoItem']['align'][0]), $this->detalle_cols['MontoItem']['width']); |
| 982 | 982 | } |
@@ -996,7 +996,7 @@ discard block |
||
| 996 | 996 | if (!isset($detalle[0])) { |
| 997 | 997 | $detalle = [$detalle]; |
| 998 | 998 | } |
| 999 | - foreach($detalle as &$d) { |
|
| 999 | + foreach ($detalle as &$d) { |
|
| 1000 | 1000 | if (!empty($d['MontoItem'])) { |
| 1001 | 1001 | $subtotal += $d['MontoItem']; |
| 1002 | 1002 | } |
@@ -1021,13 +1021,13 @@ discard block |
||
| 1021 | 1021 | { |
| 1022 | 1022 | if (!isset($descuentosRecargos[0])) |
| 1023 | 1023 | $descuentosRecargos = [$descuentosRecargos]; |
| 1024 | - foreach($descuentosRecargos as $dr) { |
|
| 1024 | + foreach ($descuentosRecargos as $dr) { |
|
| 1025 | 1025 | $tipo = $dr['TpoMov']=='D' ? 'Descuento' : 'Recargo'; |
| 1026 | 1026 | $valor = $dr['TpoValor']=='%' ? $dr['ValorDR'].'%' : $this->num($dr['ValorDR']); |
| 1027 | 1027 | if ($this->papelContinuo) { |
| 1028 | - $this->Texto($tipo.' global: '.$valor.(!empty($dr['GlosaDR'])?(' ('.$dr['GlosaDR'].')'):''), $x); |
|
| 1028 | + $this->Texto($tipo.' global: '.$valor.(!empty($dr['GlosaDR']) ? (' ('.$dr['GlosaDR'].')') : ''), $x); |
|
| 1029 | 1029 | } else { |
| 1030 | - $this->Texto($tipo.(!empty($dr['GlosaDR'])?(' ('.$dr['GlosaDR'].')'):'').':', 77, null, 'R', 100); |
|
| 1030 | + $this->Texto($tipo.(!empty($dr['GlosaDR']) ? (' ('.$dr['GlosaDR'].')') : '').':', 77, null, 'R', 100); |
|
| 1031 | 1031 | $this->Texto($valor, 177, null, 'R', 22); |
| 1032 | 1032 | } |
| 1033 | 1033 | $this->Ln(); |
@@ -1047,8 +1047,8 @@ discard block |
||
| 1047 | 1047 | $pagos = [$pagos]; |
| 1048 | 1048 | $this->Texto('Pago(s) programado(s):', $x); |
| 1049 | 1049 | $this->Ln(); |
| 1050 | - foreach($pagos as $p) { |
|
| 1051 | - $this->Texto(' - '.$this->date($p['FchPago'], false).': $'.$this->num($p['MntPago']).'.-'.(!empty($p['GlosaPagos'])?(' ('.$p['GlosaPagos'].')'):''), $x); |
|
| 1050 | + foreach ($pagos as $p) { |
|
| 1051 | + $this->Texto(' - '.$this->date($p['FchPago'], false).': $'.$this->num($p['MntPago']).'.-'.(!empty($p['GlosaPagos']) ? (' ('.$p['GlosaPagos'].')') : ''), $x); |
|
| 1052 | 1052 | $this->Ln(); |
| 1053 | 1053 | } |
| 1054 | 1054 | } |
@@ -1098,7 +1098,7 @@ discard block |
||
| 1098 | 1098 | if (!isset($ImptoReten[0])) { |
| 1099 | 1099 | $ImptoReten = [$ImptoReten]; |
| 1100 | 1100 | } |
| 1101 | - foreach($ImptoReten as $i) { |
|
| 1101 | + foreach ($ImptoReten as $i) { |
|
| 1102 | 1102 | $totales['ImptoReten_'.$i['TipoImp']] = $i['MontoImp']; |
| 1103 | 1103 | if (!empty($i['TasaImp'])) { |
| 1104 | 1104 | $glosas['ImptoReten_'.$i['TipoImp']] = \sasco\LibreDTE\Sii\ImpuestosAdicionales::getGlosa($i['TipoImp']).' ('.$i['TasaImp'].'%) $'; |
@@ -1163,7 +1163,7 @@ discard block |
||
| 1163 | 1163 | 'vpadding' => 0, |
| 1164 | 1164 | 'module_width' => 1, // width of a single module in points |
| 1165 | 1165 | 'module_height' => 1, // height of a single module in points |
| 1166 | - 'fgcolor' => [0,0,0], |
|
| 1166 | + 'fgcolor' => [0, 0, 0], |
|
| 1167 | 1167 | 'bgcolor' => false, // [255,255,255] |
| 1168 | 1168 | 'position' => $this->papelContinuo ? 'C' : 'S', |
| 1169 | 1169 | ]; |
@@ -1195,7 +1195,7 @@ discard block |
||
| 1195 | 1195 | */ |
| 1196 | 1196 | private function agregarAcuseRecibo($x = 93, $y = 190, $w = 50, $h = 40) |
| 1197 | 1197 | { |
| 1198 | - $this->SetTextColorArray([0,0,0]); |
|
| 1198 | + $this->SetTextColorArray([0, 0, 0]); |
|
| 1199 | 1199 | $this->Rect($x, $y, $w, $h, 'D', ['all' => ['width' => 0.1, 'color' => [0, 0, 0]]]); |
| 1200 | 1200 | $this->setFont('', 'B', 10); |
| 1201 | 1201 | $this->Texto('Acuse de recibo', $x, $y+1, 'C', $w); |
@@ -1225,9 +1225,9 @@ discard block |
||
| 1225 | 1225 | */ |
| 1226 | 1226 | private function agregarAcuseReciboContinuo($x = 3, $y = null, $w = 68, $h = 40) |
| 1227 | 1227 | { |
| 1228 | - $this->SetTextColorArray([0,0,0]); |
|
| 1228 | + $this->SetTextColorArray([0, 0, 0]); |
|
| 1229 | 1229 | $this->Rect($x, $y, $w, $h, 'D', ['all' => ['width' => 0.1, 'color' => [0, 0, 0]]]); |
| 1230 | - $style = array('width' => 0.2,'color' => array(0, 0, 0)); |
|
| 1230 | + $style = array('width' => 0.2, 'color' => array(0, 0, 0)); |
|
| 1231 | 1231 | $this->Line($x, $y+22, $w+3, $y+22, $style); |
| 1232 | 1232 | //$this->setFont('', 'B', 10); |
| 1233 | 1233 | //$this->Texto('Acuse de recibo', $x, $y+1, 'C', $w); |
@@ -1255,7 +1255,7 @@ discard block |
||
| 1255 | 1255 | private function agregarLeyendaDestino($tipo, $y = 254, $font_size = 10) |
| 1256 | 1256 | { |
| 1257 | 1257 | $this->setFont('', 'B', $font_size); |
| 1258 | - $this->Texto('CEDIBLE'.($tipo==52?' CON SU FACTURA':''), null, $y, 'R'); |
|
| 1258 | + $this->Texto('CEDIBLE'.($tipo==52 ? ' CON SU FACTURA' : ''), null, $y, 'R'); |
|
| 1259 | 1259 | } |
| 1260 | 1260 | |
| 1261 | 1261 | /** |
@@ -1286,7 +1286,7 @@ discard block |
||
| 1286 | 1286 | $dias = ['Domingo', 'Lunes', 'Martes', 'Miércoles', 'Jueves', 'Viernes', 'Sábado']; |
| 1287 | 1287 | $meses = ['enero', 'febrero', 'marzo', 'abril', 'mayo', 'junio', 'julio', 'agosto', 'septiembre', 'octubre', 'noviembre', 'diciembre']; |
| 1288 | 1288 | $unixtime = strtotime($date); |
| 1289 | - $fecha = date(($mostrar_dia?'\D\I\A ':'').'j \d\e \M\E\S \d\e\l Y', $unixtime); |
|
| 1289 | + $fecha = date(($mostrar_dia ? '\D\I\A ' : '').'j \d\e \M\E\S \d\e\l Y', $unixtime); |
|
| 1290 | 1290 | $dia = $dias[date('w', $unixtime)]; |
| 1291 | 1291 | $mes = $meses[date('n', $unixtime)-1]; |
| 1292 | 1292 | 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,8 +880,9 @@ 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'].' - '; |
| 864 | 888 | if (!empty($r['TpoDocRef'])) { |
@@ -891,8 +915,9 @@ discard block |
||
| 891 | 915 | */ |
| 892 | 916 | private function agregarDetalle($detalle, $x = 10) |
| 893 | 917 | { |
| 894 | - if (!isset($detalle[0])) |
|
| 895 | - $detalle = [$detalle]; |
|
| 918 | + if (!isset($detalle[0])) { |
|
| 919 | + $detalle = [$detalle]; |
|
| 920 | + } |
|
| 896 | 921 | $this->setFont('', '', $this->detalle_fuente); |
| 897 | 922 | // titulos |
| 898 | 923 | $titulos = []; |
@@ -909,36 +934,42 @@ discard block |
||
| 909 | 934 | $item['NmbItem'] .= !$this->item_detalle_posicion ? '<br/>' : ': '; |
| 910 | 935 | $item['NmbItem'] .= '<span style="font-size:0.7em">'.$item['DscItem'].'</span>'; |
| 911 | 936 | } |
| 912 | - if (!in_array($col, $titulos_keys) or ($dte_exento and $col=='IndExe')) |
|
| 913 | - unset($item[$col]); |
|
| 937 | + if (!in_array($col, $titulos_keys) or ($dte_exento and $col=='IndExe')) { |
|
| 938 | + unset($item[$col]); |
|
| 939 | + } |
|
| 914 | 940 | } |
| 915 | 941 | // ajustes a IndExe |
| 916 | 942 | if (isset($item['IndExe'])) { |
| 917 | - if ($item['IndExe']==1) |
|
| 918 | - $item['IndExe'] = 'EX'; |
|
| 919 | - else if ($item['IndExe']==2) |
|
| 920 | - $item['IndExe'] = 'NF'; |
|
| 943 | + if ($item['IndExe']==1) { |
|
| 944 | + $item['IndExe'] = 'EX'; |
|
| 945 | + } else if ($item['IndExe']==2) { |
|
| 946 | + $item['IndExe'] = 'NF'; |
|
| 947 | + } |
|
| 921 | 948 | } |
| 922 | 949 | // agregar todas las columnas que se podrían imprimir en la tabla |
| 923 | 950 | $item_default = []; |
| 924 | - foreach ($this->detalle_cols as $key => $info) |
|
| 925 | - $item_default[$key] = false; |
|
| 951 | + foreach ($this->detalle_cols as $key => $info) { |
|
| 952 | + $item_default[$key] = false; |
|
| 953 | + } |
|
| 926 | 954 | $item = array_merge($item_default, $item); |
| 927 | 955 | // si hay código de item se extrae su valor |
| 928 | - if ($item['CdgItem']) |
|
| 929 | - $item['CdgItem'] = $item['CdgItem']['VlrCodigo']; |
|
| 956 | + if ($item['CdgItem']) { |
|
| 957 | + $item['CdgItem'] = $item['CdgItem']['VlrCodigo']; |
|
| 958 | + } |
|
| 930 | 959 | // dar formato a números |
| 931 | 960 | foreach (['QtyItem', 'PrcItem', 'DescuentoMonto', 'RecargoMonto', 'MontoItem'] as $col) { |
| 932 | - if ($item[$col]) |
|
| 933 | - $item[$col] = $this->num($item[$col]); |
|
| 961 | + if ($item[$col]) { |
|
| 962 | + $item[$col] = $this->num($item[$col]); |
|
| 963 | + } |
|
| 934 | 964 | } |
| 935 | 965 | } |
| 936 | 966 | // opciones |
| 937 | 967 | $options = ['align'=>[]]; |
| 938 | 968 | $i = 0; |
| 939 | 969 | foreach ($this->detalle_cols as $info) { |
| 940 | - if (isset($info['width'])) |
|
| 941 | - $options['width'][$i] = $info['width']; |
|
| 970 | + if (isset($info['width'])) { |
|
| 971 | + $options['width'][$i] = $info['width']; |
|
| 972 | + } |
|
| 942 | 973 | $options['align'][$i] = $info['align']; |
| 943 | 974 | $i++; |
| 944 | 975 | } |
@@ -971,8 +1002,9 @@ discard block |
||
| 971 | 1002 | $this->Texto($this->detalle_cols['QtyItem']['title'], $x+35, $this->y, ucfirst($this->detalle_cols['QtyItem']['align'][0]), $this->detalle_cols['QtyItem']['width']); |
| 972 | 1003 | $this->Texto($this->detalle_cols['MontoItem']['title'], $x+45, $this->y, ucfirst($this->detalle_cols['MontoItem']['align'][0]), $this->detalle_cols['MontoItem']['width']); |
| 973 | 1004 | $this->Line($p1x, $p1y+4, $p2x, $p2y+4, $style); |
| 974 | - if (!isset($detalle[0])) |
|
| 975 | - $detalle = [$detalle]; |
|
| 1005 | + if (!isset($detalle[0])) { |
|
| 1006 | + $detalle = [$detalle]; |
|
| 1007 | + } |
|
| 976 | 1008 | $this->SetY($this->getY()+2); |
| 977 | 1009 | foreach($detalle as &$d) { |
| 978 | 1010 | $this->MultiTexto($d['NmbItem'], $x+1, $this->y+4, ucfirst($this->detalle_cols['NmbItem']['align'][0]), $this->detalle_cols['NmbItem']['width']); |
@@ -1019,8 +1051,9 @@ discard block |
||
| 1019 | 1051 | */ |
| 1020 | 1052 | private function agregarDescuentosRecargos(array $descuentosRecargos, $x = 10) |
| 1021 | 1053 | { |
| 1022 | - if (!isset($descuentosRecargos[0])) |
|
| 1023 | - $descuentosRecargos = [$descuentosRecargos]; |
|
| 1054 | + if (!isset($descuentosRecargos[0])) { |
|
| 1055 | + $descuentosRecargos = [$descuentosRecargos]; |
|
| 1056 | + } |
|
| 1024 | 1057 | foreach($descuentosRecargos as $dr) { |
| 1025 | 1058 | $tipo = $dr['TpoMov']=='D' ? 'Descuento' : 'Recargo'; |
| 1026 | 1059 | $valor = $dr['TpoValor']=='%' ? $dr['ValorDR'].'%' : $this->num($dr['ValorDR']); |
@@ -1043,8 +1076,9 @@ discard block |
||
| 1043 | 1076 | */ |
| 1044 | 1077 | private function agregarPagos(array $pagos, $x = 10) |
| 1045 | 1078 | { |
| 1046 | - if (!isset($pagos[0])) |
|
| 1047 | - $pagos = [$pagos]; |
|
| 1079 | + if (!isset($pagos[0])) { |
|
| 1080 | + $pagos = [$pagos]; |
|
| 1081 | + } |
|
| 1048 | 1082 | $this->Texto('Pago(s) programado(s):', $x); |
| 1049 | 1083 | $this->Ln(); |
| 1050 | 1084 | foreach($pagos as $p) { |
@@ -1268,11 +1302,13 @@ discard block |
||
| 1268 | 1302 | */ |
| 1269 | 1303 | private function num($n) |
| 1270 | 1304 | { |
| 1271 | - if (!is_numeric($n)) |
|
| 1272 | - return $n; |
|
| 1305 | + if (!is_numeric($n)) { |
|
| 1306 | + return $n; |
|
| 1307 | + } |
|
| 1273 | 1308 | $broken_number = explode('.', (string)$n); |
| 1274 | - if (isset($broken_number[1])) |
|
| 1275 | - return number_format($broken_number[0], 0, ',', '.').','.$broken_number[1]; |
|
| 1309 | + if (isset($broken_number[1])) { |
|
| 1310 | + return number_format($broken_number[0], 0, ',', '.').','.$broken_number[1]; |
|
| 1311 | + } |
|
| 1276 | 1312 | return number_format($broken_number[0], 0, ',', '.'); |
| 1277 | 1313 | } |
| 1278 | 1314 | |