@@ -52,8 +52,8 @@ discard block |
||
52 | 52 | * Método que genera nodos XML a partir de un arreglo |
53 | 53 | * @param data Arreglo con los datos que se usarán para generar XML |
54 | 54 | * @param namespace Arreglo con el espacio de nombres para el XML que se generará (URI y prefijo) |
55 | - * @param parent DOMElement padre para los elementos, o =null para que sea la raíz |
|
56 | - * @return Objeto \sasco\LibreDTE\XML |
|
55 | + * @param parent \DOMElement padre para los elementos, o =null para que sea la raíz |
|
56 | + * @return XML \sasco\LibreDTE\XML |
|
57 | 57 | * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl) |
58 | 58 | * @version 2017-10-22 |
59 | 59 | */ |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | /** |
154 | 154 | * Método para realizar consultas XPATH al documento XML |
155 | 155 | * @param expression Expresión XPath a ejecutar |
156 | - * @return DOMNodeList |
|
156 | + * @return \DOMNodeList |
|
157 | 157 | * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl) |
158 | 158 | * @version 2015-08-05 |
159 | 159 | */ |
@@ -283,7 +283,7 @@ discard block |
||
283 | 283 | * Método que cuenta los nodos con el mismo nombre hijos de un DOMElement |
284 | 284 | * No sirve usar: $dom->getElementsByTagName($tagName)->length ya que esto |
285 | 285 | * entrega todos los nodos con el nombre, sean hijos, nietos, etc. |
286 | - * @return Cantidad de nodos hijos con el mismo nombre en el DOMElement |
|
286 | + * @return integer de nodos hijos con el mismo nombre en el DOMElement |
|
287 | 287 | * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl) |
288 | 288 | * @version 2015-09-07 |
289 | 289 | */ |
@@ -324,7 +324,7 @@ discard block |
||
324 | 324 | |
325 | 325 | /** |
326 | 326 | * Método que entrega el nombre del archivo del schema del XML |
327 | - * @return Nombre del schema o bien =false si no se encontró |
|
327 | + * @return string del schema o bien =false si no se encontró |
|
328 | 328 | * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl) |
329 | 329 | * @version 2015-12-14 |
330 | 330 | */ |
@@ -366,6 +366,7 @@ discard block |
||
366 | 366 | * respeta el estándar y las requiere convertidas |
367 | 367 | * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl) |
368 | 368 | * @version 2017-01-20 |
369 | + * @param string $xml |
|
369 | 370 | */ |
370 | 371 | private function fixEntities($xml) |
371 | 372 | { |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | */ |
198 | 198 | private function utf2iso($string) |
199 | 199 | { |
200 | - return mb_detect_encoding($string, ['UTF-8', 'ISO-8859-1']) != 'ISO-8859-1' ? utf8_decode($string) : $string; |
|
200 | + return mb_detect_encoding($string, ['UTF-8', 'ISO-8859-1'])!='ISO-8859-1' ? utf8_decode($string) : $string; |
|
201 | 201 | } |
202 | 202 | |
203 | 203 | /** |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | } |
241 | 241 | // si existen nodos hijos se agregan |
242 | 242 | if ($dom->hasChildNodes()) { |
243 | - foreach($dom->childNodes as $child) { |
|
243 | + foreach ($dom->childNodes as $child) { |
|
244 | 244 | if ($child instanceof \DOMText) { |
245 | 245 | $textContent = trim($child->textContent); |
246 | 246 | if ($textContent!="") { |
@@ -372,7 +372,7 @@ discard block |
||
372 | 372 | $newXML = ''; |
373 | 373 | $n_letras = strlen($xml); |
374 | 374 | $convertir = false; |
375 | - for ($i=0; $i<$n_letras; ++$i) { |
|
375 | + for ($i = 0; $i<$n_letras; ++$i) { |
|
376 | 376 | if ($xml[$i]=='>') |
377 | 377 | $convertir = true; |
378 | 378 | if ($xml[$i]=='<') |
@@ -120,8 +120,9 @@ discard block |
||
120 | 120 | private function sanitize($txt) |
121 | 121 | { |
122 | 122 | // si no se paso un texto o bien es un número no se hace nada |
123 | - if (!$txt or is_numeric($txt)) |
|
124 | - return $txt; |
|
123 | + if (!$txt or is_numeric($txt)) { |
|
124 | + return $txt; |
|
125 | + } |
|
125 | 126 | // convertir "predefined entities" de XML |
126 | 127 | $txt = str_replace( |
127 | 128 | ['&', '&', '<', '<', '>', '>', '"', '"', ''', '''], |
@@ -174,8 +175,9 @@ discard block |
||
174 | 175 | { |
175 | 176 | if ($xpath) { |
176 | 177 | $node = $this->xpath($xpath)->item(0); |
177 | - if (!$node) |
|
178 | - return false; |
|
178 | + if (!$node) { |
|
179 | + return false; |
|
180 | + } |
|
179 | 181 | $xml = $this->utf2iso($node->C14N()); |
180 | 182 | $xml = $this->fixEntities($xml); |
181 | 183 | } else { |
@@ -250,8 +252,7 @@ discard block |
||
250 | 252 | $array[$dom->tagName]['@value'] = $textContent; |
251 | 253 | } |
252 | 254 | } |
253 | - } |
|
254 | - else if ($child instanceof \DOMElement) { |
|
255 | + } else if ($child instanceof \DOMElement) { |
|
255 | 256 | $nodos_gemelos = $this->countTwins($dom, $child->tagName); |
256 | 257 | // agregar nodo hijo directamente, ya que es el único nodo hijo con el mismo nombre de tag |
257 | 258 | if ($nodos_gemelos==1) { |
@@ -307,8 +308,9 @@ discard block |
||
307 | 308 | public function getErrors() |
308 | 309 | { |
309 | 310 | $errors = []; |
310 | - foreach (libxml_get_errors() as $e) |
|
311 | - $errors[] = $e->message; |
|
311 | + foreach (libxml_get_errors() as $e) { |
|
312 | + $errors[] = $e->message; |
|
313 | + } |
|
312 | 314 | return $errors; |
313 | 315 | } |
314 | 316 | |
@@ -331,8 +333,9 @@ discard block |
||
331 | 333 | public function getSchema() |
332 | 334 | { |
333 | 335 | $schemaLocation = $this->documentElement->getAttribute('xsi:schemaLocation'); |
334 | - if (!$schemaLocation or strpos($schemaLocation, ' ')===false) |
|
335 | - return false; |
|
336 | + if (!$schemaLocation or strpos($schemaLocation, ' ')===false) { |
|
337 | + return false; |
|
338 | + } |
|
336 | 339 | list($uri, $xsd) = explode(' ', $schemaLocation); |
337 | 340 | return $xsd; |
338 | 341 | } |
@@ -373,10 +376,12 @@ discard block |
||
373 | 376 | $n_letras = strlen($xml); |
374 | 377 | $convertir = false; |
375 | 378 | for ($i=0; $i<$n_letras; ++$i) { |
376 | - if ($xml[$i]=='>') |
|
377 | - $convertir = true; |
|
378 | - if ($xml[$i]=='<') |
|
379 | - $convertir = false; |
|
379 | + if ($xml[$i]=='>') { |
|
380 | + $convertir = true; |
|
381 | + } |
|
382 | + if ($xml[$i]=='<') { |
|
383 | + $convertir = false; |
|
384 | + } |
|
380 | 385 | if ($convertir) { |
381 | 386 | $l = $xml[$i]=='\'' ? ''' : ($xml[$i]=='"' ? '"' : $xml[$i]); |
382 | 387 | } else { |
@@ -852,8 +852,7 @@ |
||
852 | 852 | $valor = $codigo['CantBultos'].' '.$valor; |
853 | 853 | if (!empty($codigo['IdContainer'])) { |
854 | 854 | $valor .= ' ('.$codigo['IdContainer'].' / '.$codigo['Sello'].' / '.$codigo['EmisorSello'].')'; |
855 | - } |
|
856 | - else if (!empty($codigo['Marcas'])) { |
|
855 | + } else if (!empty($codigo['Marcas'])) { |
|
857 | 856 | $valor .= ' ('.$codigo['Marcas'].')'; |
858 | 857 | } |
859 | 858 | } else { |
@@ -63,8 +63,8 @@ discard block |
||
63 | 63 | ]; ///< Tipos de transacciones o caracterizaciones/clasificaciones de las compras |
64 | 64 | |
65 | 65 | public static $estados_ok = [ |
66 | - 7, // Evento registrado previamente |
|
67 | - 8, // Pasados 8 días después de la recepción no es posible registrar reclamos o eventos |
|
66 | + 7, // Evento registrado previamente |
|
67 | + 8, // Pasados 8 días después de la recepción no es posible registrar reclamos o eventos |
|
68 | 68 | 27, // No se puede registrar un evento (acuse de recibo, reclamo o aceptación de contenido) de un DTE pagado al contado o gratuito |
69 | 69 | ]; ///< Código de estado de respuesta de la asignación de estado que son considerados como OK |
70 | 70 | |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | \sasco\LibreDTE\Log::write(\sasco\LibreDTE\Estado::REQUEST_ERROR_SOAP, \sasco\LibreDTE\Estado::get(\sasco\LibreDTE\Estado::REQUEST_ERROR_SOAP, $msg)); |
243 | 243 | return false; |
244 | 244 | } |
245 | - for ($i=0; $i<$retry; $i++) { |
|
245 | + for ($i = 0; $i<$retry; $i++) { |
|
246 | 246 | try { |
247 | 247 | $body = call_user_func_array([$soap, $request], $args); |
248 | 248 | break; |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | |
78 | 78 | /** |
79 | 79 | * Constructor, obtiene el token de la sesión y lo guarda |
80 | - * @param Firma Objeto con la firma electrónica |
|
80 | + * @param Firma \sasco\LibreDTE\FirmaElectronica con la firma electrónica |
|
81 | 81 | * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl) |
82 | 82 | * @version 2017-08-28 |
83 | 83 | */ |
@@ -119,6 +119,8 @@ discard block |
||
119 | 119 | * Método que entrega los eventos asociados a un DTE |
120 | 120 | * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl) |
121 | 121 | * @version 2017-08-28 |
122 | + * @param string $dte |
|
123 | + * @param string $folio |
|
122 | 124 | */ |
123 | 125 | public function listarEventosHistDoc($rut, $dv, $dte, $folio) |
124 | 126 | { |
@@ -206,10 +208,10 @@ discard block |
||
206 | 208 | |
207 | 209 | /** |
208 | 210 | * Método para realizar una solicitud al servicio web del SII |
209 | - * @param request Nombre de la función que se ejecutará en el servicio web |
|
211 | + * @param request string de la función que se ejecutará en el servicio web |
|
210 | 212 | * @param args Argumentos que se pasarán al servicio web |
211 | - * @param retry Intentos que se realizarán como máximo para obtener respuesta |
|
212 | - * @return Objeto o String con la respuesta (depende servicio web) |
|
213 | + * @param retry integer que se realizarán como máximo para obtener respuesta |
|
214 | + * @return string o String con la respuesta (depende servicio web) |
|
213 | 215 | * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl) |
214 | 216 | * @version 2020-02-12 |
215 | 217 | */ |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | { |
127 | 127 | $fecha = '9999-12-31'; |
128 | 128 | foreach ($this->detalles as &$d) { |
129 | - if ($d['FchDoc'] < $fecha) { |
|
129 | + if ($d['FchDoc']<$fecha) { |
|
130 | 130 | $fecha = $d['FchDoc']; |
131 | 131 | } |
132 | 132 | } |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | { |
144 | 144 | $fecha = '0000-01-01'; |
145 | 145 | foreach ($this->detalles as &$d) { |
146 | - if ($d['FchDoc'] > $fecha) { |
|
146 | + if ($d['FchDoc']>$fecha) { |
|
147 | 147 | $fecha = $d['FchDoc']; |
148 | 148 | } |
149 | 149 | } |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | // ajustes post agregar detalles |
203 | 203 | foreach ($Resumen as &$r) { |
204 | 204 | // obtener folios utilizados = emitidos + anulados |
205 | - $r['FoliosUtilizados'] = $r['FoliosEmitidos'] + $r['FoliosAnulados']; |
|
205 | + $r['FoliosUtilizados'] = $r['FoliosEmitidos']+$r['FoliosAnulados']; |
|
206 | 206 | $r['RangoUtilizados'] = $this->getRangos($RangoUtilizados[$r['TipoDocumento']]); |
207 | 207 | } |
208 | 208 | // completar con los resumenes que no se colocaron |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | $aux = []; |
235 | 235 | $inicial = $folios[0]; |
236 | 236 | $i = $inicial; |
237 | - foreach($folios as $f) { |
|
237 | + foreach ($folios as $f) { |
|
238 | 238 | if ($i!=$f) { |
239 | 239 | $inicial = $f; |
240 | 240 | $i = $inicial; |
@@ -770,10 +770,12 @@ discard block |
||
770 | 770 | $this->MultiTexto($receptor['Extranjero']['NumId'], $x+$offset+2); |
771 | 771 | } |
772 | 772 | $contacto = []; |
773 | - if (!empty($receptor['Contacto'])) |
|
774 | - $contacto[] = $receptor['Contacto']; |
|
775 | - if (!empty($receptor['CorreoRecep'])) |
|
776 | - $contacto[] = $receptor['CorreoRecep']; |
|
773 | + if (!empty($receptor['Contacto'])) { |
|
774 | + $contacto[] = $receptor['Contacto']; |
|
775 | + } |
|
776 | + if (!empty($receptor['CorreoRecep'])) { |
|
777 | + $contacto[] = $receptor['CorreoRecep']; |
|
778 | + } |
|
777 | 779 | if (!empty($contacto)) { |
778 | 780 | $this->setFont('', 'B', null); |
779 | 781 | $this->Texto('Contacto', $x); |
@@ -823,10 +825,12 @@ discard block |
||
823 | 825 | if (!empty($Transporte['DirDest']) and !empty($Transporte['CmnaDest'])) { |
824 | 826 | $transporte .= 'a '.$Transporte['DirDest'].', '.$Transporte['CmnaDest']; |
825 | 827 | } |
826 | - if (!empty($Transporte['RUTTrans'])) |
|
827 | - $transporte .= ' por '.$Transporte['RUTTrans']; |
|
828 | - if (!empty($Transporte['Patente'])) |
|
829 | - $transporte .= ' en vehículo '.$Transporte['Patente']; |
|
828 | + if (!empty($Transporte['RUTTrans'])) { |
|
829 | + $transporte .= ' por '.$Transporte['RUTTrans']; |
|
830 | + } |
|
831 | + if (!empty($Transporte['Patente'])) { |
|
832 | + $transporte .= ' en vehículo '.$Transporte['Patente']; |
|
833 | + } |
|
830 | 834 | if (isset($Transporte['Chofer']) and is_array($Transporte['Chofer'])) { |
831 | 835 | if (!empty($Transporte['Chofer']['NombreChofer'])) { |
832 | 836 | $transporte .= ' con chofer '.$Transporte['Chofer']['NombreChofer']; |
@@ -889,8 +893,9 @@ discard block |
||
889 | 893 | */ |
890 | 894 | protected function agregarReferencia($referencias, $x = 10, $offset = 22) |
891 | 895 | { |
892 | - if (!isset($referencias[0])) |
|
893 | - $referencias = [$referencias]; |
|
896 | + if (!isset($referencias[0])) { |
|
897 | + $referencias = [$referencias]; |
|
898 | + } |
|
894 | 899 | foreach($referencias as $r) { |
895 | 900 | $texto = $r['NroLinRef'].' - '; |
896 | 901 | if (!empty($r['TpoDocRef'])) { |
@@ -1124,8 +1129,9 @@ discard block |
||
1124 | 1129 | */ |
1125 | 1130 | protected function agregarPagos(array $pagos, $x = 10) |
1126 | 1131 | { |
1127 | - if (!isset($pagos[0])) |
|
1128 | - $pagos = [$pagos]; |
|
1132 | + if (!isset($pagos[0])) { |
|
1133 | + $pagos = [$pagos]; |
|
1134 | + } |
|
1129 | 1135 | $this->Texto('Pago(s) programado(s):', $x); |
1130 | 1136 | $this->Ln(); |
1131 | 1137 | foreach($pagos as $p) { |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | /** |
81 | 81 | * Método que asigna la ubicación del logo de la empresa |
82 | 82 | * @param logo URI del logo (puede ser local o en una URL) |
83 | - * @param posicion Posición respecto a datos del emisor (=0 izq, =1 arriba). Nota: parámetro válido sólo para formato hoja carta |
|
83 | + * @param posicion integer respecto a datos del emisor (=0 izq, =1 arriba). Nota: parámetro válido sólo para formato hoja carta |
|
84 | 84 | * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl) |
85 | 85 | * @version 2016-08-04 |
86 | 86 | */ |
@@ -333,7 +333,7 @@ discard block |
||
333 | 333 | * contínuo de 80mm |
334 | 334 | * @param dte Arreglo con los datos del XML (tag Documento) |
335 | 335 | * @param timbre String XML con el tag TED del DTE |
336 | - * @param width Ancho del papel contínuo en mm (es parámetro porque se usa el mismo método para 75mm) |
|
336 | + * @param width integer del papel contínuo en mm (es parámetro porque se usa el mismo método para 75mm) |
|
337 | 337 | * @author Pablo Reyes (https://github.com/pabloxp) |
338 | 338 | * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl) |
339 | 339 | * @version 2020-03-11 |
@@ -491,10 +491,11 @@ discard block |
||
491 | 491 | * - Dirección casa central del emisor |
492 | 492 | * - Dirección sucursales |
493 | 493 | * @param emisor Arreglo con los datos del emisor (tag Emisor del XML) |
494 | - * @param x Posición horizontal de inicio en el PDF |
|
495 | - * @param y Posición vertical de inicio en el PDF |
|
496 | - * @param w Ancho de la información del emisor |
|
497 | - * @param w_img Ancho máximo de la imagen |
|
494 | + * @param x integer horizontal de inicio en el PDF |
|
495 | + * @param y integer vertical de inicio en el PDF |
|
496 | + * @param w integer de la información del emisor |
|
497 | + * @param w_img integer máximo de la imagen |
|
498 | + * @param integer $font_size |
|
498 | 499 | * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl) |
499 | 500 | * @version 2019-11-22 |
500 | 501 | */ |
@@ -603,11 +604,13 @@ discard block |
||
603 | 604 | * @param rut RUT del emisor |
604 | 605 | * @param tipo Código o glosa del tipo de documento |
605 | 606 | * @param sucursal_sii Código o glosa de la sucursal del SII del Emisor |
606 | - * @param x Posición horizontal de inicio en el PDF |
|
607 | - * @param y Posición vertical de inicio en el PDF |
|
608 | - * @param w Ancho de la información del emisor |
|
607 | + * @param x integer horizontal de inicio en el PDF |
|
608 | + * @param y integer vertical de inicio en el PDF |
|
609 | + * @param w integer de la información del emisor |
|
610 | + * @param integer $font_size |
|
609 | 611 | * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl) |
610 | 612 | * @version 2019-08-05 |
613 | + * @return integer |
|
611 | 614 | */ |
612 | 615 | protected function agregarFolio($rut, $tipo, $folio, $sucursal_sii = null, $x = 130, $y = 15, $w = 70, $font_size = null, array $color = null) |
613 | 616 | { |
@@ -639,7 +642,7 @@ discard block |
||
639 | 642 | * Método que agrega los datos de la emisión del DTE que no son los dato del |
640 | 643 | * receptor |
641 | 644 | * @param IdDoc Información general del documento |
642 | - * @param x Posición horizontal de inicio en el PDF |
|
645 | + * @param x integer horizontal de inicio en el PDF |
|
643 | 646 | * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl) |
644 | 647 | * @version 2020-08-11 |
645 | 648 | */ |
@@ -727,7 +730,7 @@ discard block |
||
727 | 730 | /** |
728 | 731 | * Método que agrega los datos del receptor |
729 | 732 | * @param receptor Arreglo con los datos del receptor (tag Receptor del XML) |
730 | - * @param x Posición horizontal de inicio en el PDF |
|
733 | + * @param x integer horizontal de inicio en el PDF |
|
731 | 734 | * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl) |
732 | 735 | * @version 2019-10-06 |
733 | 736 | */ |
@@ -814,7 +817,7 @@ discard block |
||
814 | 817 | * Método que agrega los datos del traslado |
815 | 818 | * @param IndTraslado |
816 | 819 | * @param Transporte |
817 | - * @param x Posición horizontal de inicio en el PDF |
|
820 | + * @param x integer horizontal de inicio en el PDF |
|
818 | 821 | * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl) |
819 | 822 | * @version 2016-08-03 |
820 | 823 | */ |
@@ -894,7 +897,7 @@ discard block |
||
894 | 897 | /** |
895 | 898 | * Método que agrega las referencias del documento |
896 | 899 | * @param referencias Arreglo con las referencias del documento (tag Referencia del XML) |
897 | - * @param x Posición horizontal de inicio en el PDF |
|
900 | + * @param x integer horizontal de inicio en el PDF |
|
898 | 901 | * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl) |
899 | 902 | * @version 2017-09-25 |
900 | 903 | */ |
@@ -931,7 +934,7 @@ discard block |
||
931 | 934 | /** |
932 | 935 | * Método que agrega el detalle del documento |
933 | 936 | * @param detalle Arreglo con el detalle del documento (tag Detalle del XML) |
934 | - * @param x Posición horizontal de inicio en el PDF |
|
937 | + * @param x integer horizontal de inicio en el PDF |
|
935 | 938 | * @param y Posición vertical de inicio en el PDF |
936 | 939 | * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl) |
937 | 940 | * @version 2020-08-28 |
@@ -1041,7 +1044,7 @@ discard block |
||
1041 | 1044 | /** |
1042 | 1045 | * Método que agrega el detalle del documento |
1043 | 1046 | * @param detalle Arreglo con el detalle del documento (tag Detalle del XML) |
1044 | - * @param x Posición horizontal de inicio en el PDF |
|
1047 | + * @param x integer horizontal de inicio en el PDF |
|
1045 | 1048 | * @param y Posición vertical de inicio en el PDF |
1046 | 1049 | * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl) |
1047 | 1050 | * @author Pablo Reyes (https://github.com/pabloxp) |
@@ -1097,7 +1100,7 @@ discard block |
||
1097 | 1100 | * Método que agrega el subtotal del DTE |
1098 | 1101 | * @param detalle Arreglo con los detalles del documentos para poder |
1099 | 1102 | * calcular subtotal |
1100 | - * @param x Posición horizontal de inicio en el PDF |
|
1103 | + * @param x integer horizontal de inicio en el PDF |
|
1101 | 1104 | * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl) |
1102 | 1105 | * @version 2016-08-17 |
1103 | 1106 | */ |
@@ -1123,7 +1126,7 @@ discard block |
||
1123 | 1126 | /** |
1124 | 1127 | * Método que agrega los descuentos y/o recargos globales del documento |
1125 | 1128 | * @param descuentosRecargos Arreglo con los descuentos y/o recargos del documento (tag DscRcgGlobal del XML) |
1126 | - * @param x Posición horizontal de inicio en el PDF |
|
1129 | + * @param x integer horizontal de inicio en el PDF |
|
1127 | 1130 | * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl) |
1128 | 1131 | * @version 2018-05-29 |
1129 | 1132 | */ |
@@ -1151,7 +1154,7 @@ discard block |
||
1151 | 1154 | /** |
1152 | 1155 | * Método que agrega los pagos del documento |
1153 | 1156 | * @param pagos Arreglo con los pagos del documento |
1154 | - * @param x Posición horizontal de inicio en el PDF |
|
1157 | + * @param x integer horizontal de inicio en el PDF |
|
1155 | 1158 | * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl) |
1156 | 1159 | * @version 2016-07-24 |
1157 | 1160 | */ |
@@ -1309,9 +1312,10 @@ discard block |
||
1309 | 1312 | * - Se imprime en el tamaño mínimo: 2x5 cms |
1310 | 1313 | * - En el lado de abajo con margen izquierdo mínimo de 2 cms |
1311 | 1314 | * @param timbre String con los datos del timbre |
1312 | - * @param x Posición horizontal de inicio en el PDF |
|
1313 | - * @param y Posición vertical de inicio en el PDF |
|
1314 | - * @param w Ancho del timbre |
|
1315 | + * @param x integer horizontal de inicio en el PDF |
|
1316 | + * @param y integer vertical de inicio en el PDF |
|
1317 | + * @param w integer del timbre |
|
1318 | + * @param string $position |
|
1315 | 1319 | * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl) |
1316 | 1320 | * @version 2019-10-06 |
1317 | 1321 | */ |
@@ -1349,10 +1353,10 @@ discard block |
||
1349 | 1353 | |
1350 | 1354 | /** |
1351 | 1355 | * Método que agrega el acuse de rebido |
1352 | - * @param x Posición horizontal de inicio en el PDF |
|
1353 | - * @param y Posición vertical de inicio en el PDF |
|
1354 | - * @param w Ancho del acuse de recibo |
|
1355 | - * @param h Alto del acuse de recibo |
|
1356 | + * @param x integer horizontal de inicio en el PDF |
|
1357 | + * @param y integer vertical de inicio en el PDF |
|
1358 | + * @param w integer del acuse de recibo |
|
1359 | + * @param h integer del acuse de recibo |
|
1356 | 1360 | * @author Esteban De La Fuente Rubio, DeLaF (esteban[at]sasco.cl) |
1357 | 1361 | * @version 2019-10-06 |
1358 | 1362 | */ |
@@ -1380,10 +1384,10 @@ discard block |
||
1380 | 1384 | |
1381 | 1385 | /** |
1382 | 1386 | * Método que agrega el acuse de rebido |
1383 | - * @param x Posición horizontal de inicio en el PDF |
|
1387 | + * @param x integer horizontal de inicio en el PDF |
|
1384 | 1388 | * @param y Posición vertical de inicio en el PDF |
1385 | - * @param w Ancho del acuse de recibo |
|
1386 | - * @param h Alto del acuse de recibo |
|
1389 | + * @param w integer del acuse de recibo |
|
1390 | + * @param h integer del acuse de recibo |
|
1387 | 1391 | * @author Pablo Reyes (https://github.com/pabloxp) |
1388 | 1392 | * @version 2015-11-17 |
1389 | 1393 | */ |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | { |
75 | 75 | parent::__construct(); |
76 | 76 | $this->SetTitle('Documento Tributario Electrónico (DTE) de Chile by LibreDTE'); |
77 | - $this->papelContinuo = $papelContinuo === true ? 80 : $papelContinuo; |
|
77 | + $this->papelContinuo = $papelContinuo===true ? 80 : $papelContinuo; |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | /** |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | $this->Ln(); |
194 | 194 | // datos del documento |
195 | 195 | $y = []; |
196 | - $y[] = $this->agregarDatosEmision($dte['Encabezado']['IdDoc'], !empty($dte['Encabezado']['Emisor']['CdgVendedor'])?$dte['Encabezado']['Emisor']['CdgVendedor']:null); |
|
196 | + $y[] = $this->agregarDatosEmision($dte['Encabezado']['IdDoc'], !empty($dte['Encabezado']['Emisor']['CdgVendedor']) ? $dte['Encabezado']['Emisor']['CdgVendedor'] : null); |
|
197 | 197 | $y[] = $this->agregarReceptor($dte['Encabezado']); |
198 | 198 | $this->setY(max($y)); |
199 | 199 | $this->agregarTraslado( |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | $this->AddPage('P', [$height ? $height : $this->papel_continuo_alto, $width]); |
243 | 243 | $x = 1; |
244 | 244 | $y = 5; |
245 | - $this->SetXY($x,$y); |
|
245 | + $this->SetXY($x, $y); |
|
246 | 246 | // agregar datos del documento |
247 | 247 | $this->setFont('', '', 8); |
248 | 248 | $this->MultiTexto(!empty($dte['Encabezado']['Emisor']['RznSoc']) ? $dte['Encabezado']['Emisor']['RznSoc'] : $dte['Encabezado']['Emisor']['RznSocEmisor'], $x, null, '', $width-2); |
@@ -356,15 +356,15 @@ discard block |
||
356 | 356 | $dte['Encabezado']['IdDoc']['TipoDTE'], |
357 | 357 | $dte['Encabezado']['IdDoc']['Folio'], |
358 | 358 | $dte['Encabezado']['Emisor']['CmnaOrigen'], |
359 | - $x_start, $y_start, $width-($x_start*4), 10, |
|
360 | - [0,0,0] |
|
359 | + $x_start, $y_start, $width-($x_start * 4), 10, |
|
360 | + [0, 0, 0] |
|
361 | 361 | ); |
362 | - $y = $this->agregarEmisor($dte['Encabezado']['Emisor'], $x_start, $y+2, $width-($x_start*45), 8, 9, [0,0,0]); |
|
362 | + $y = $this->agregarEmisor($dte['Encabezado']['Emisor'], $x_start, $y+2, $width-($x_start * 45), 8, 9, [0, 0, 0]); |
|
363 | 363 | // datos del documento |
364 | 364 | $this->SetY($y); |
365 | 365 | $this->Ln(); |
366 | 366 | $this->setFont('', '', 8); |
367 | - $this->agregarDatosEmision($dte['Encabezado']['IdDoc'], !empty($dte['Encabezado']['Emisor']['CdgVendedor'])?$dte['Encabezado']['Emisor']['CdgVendedor']:null, $x_start, $offset, false); |
|
367 | + $this->agregarDatosEmision($dte['Encabezado']['IdDoc'], !empty($dte['Encabezado']['Emisor']['CdgVendedor']) ? $dte['Encabezado']['Emisor']['CdgVendedor'] : null, $x_start, $offset, false); |
|
368 | 368 | $this->agregarReceptor($dte['Encabezado'], $x_start, $offset); |
369 | 369 | $this->agregarTraslado( |
370 | 370 | !empty($dte['Encabezado']['IdDoc']['IndTraslado']) ? $dte['Encabezado']['IdDoc']['IndTraslado'] : null, |
@@ -434,14 +434,14 @@ discard block |
||
434 | 434 | 2, |
435 | 435 | 45, |
436 | 436 | 9, |
437 | - [0,0,0] |
|
437 | + [0, 0, 0] |
|
438 | 438 | ); |
439 | - $y[] = $this->agregarEmisor($dte['Encabezado']['Emisor'], 1, 2, 20, 30, 9, [0,0,0], $y[0]); |
|
439 | + $y[] = $this->agregarEmisor($dte['Encabezado']['Emisor'], 1, 2, 20, 30, 9, [0, 0, 0], $y[0]); |
|
440 | 440 | $this->SetY(max($y)); |
441 | 441 | $this->Ln(); |
442 | 442 | // datos del documento |
443 | 443 | $this->setFont('', '', 8); |
444 | - $this->agregarDatosEmision($dte['Encabezado']['IdDoc'], !empty($dte['Encabezado']['Emisor']['CdgVendedor'])?$dte['Encabezado']['Emisor']['CdgVendedor']:null, $x_start, $offset, false); |
|
444 | + $this->agregarDatosEmision($dte['Encabezado']['IdDoc'], !empty($dte['Encabezado']['Emisor']['CdgVendedor']) ? $dte['Encabezado']['Emisor']['CdgVendedor'] : null, $x_start, $offset, false); |
|
445 | 445 | $this->agregarReceptor($dte['Encabezado'], $x_start, $offset); |
446 | 446 | $this->agregarTraslado( |
447 | 447 | !empty($dte['Encabezado']['IdDoc']['IndTraslado']) ? $dte['Encabezado']['IdDoc']['IndTraslado'] : null, |
@@ -473,7 +473,7 @@ discard block |
||
473 | 473 | if ($this->cedible and !in_array($dte['Encabezado']['IdDoc']['TipoDTE'], $this->sinAcuseRecibo)) { |
474 | 474 | $this->agregarAcuseRecibo(63, $y+6, 45, 40, 15); |
475 | 475 | $this->setFont('', 'B', 8); |
476 | - $this->Texto('CEDIBLE'.($dte['Encabezado']['IdDoc']['TipoDTE']==52?' CON SU FACTURA':''), $x_start, $this->y+1, 'L'); |
|
476 | + $this->Texto('CEDIBLE'.($dte['Encabezado']['IdDoc']['TipoDTE']==52 ? ' CON SU FACTURA' : ''), $x_start, $this->y+1, 'L'); |
|
477 | 477 | } |
478 | 478 | // si el alto no se pasó, entonces es con autocálculo, se elimina esta página y se pasa el alto |
479 | 479 | // que se logró determinar para crear la página con el alto correcto |
@@ -504,16 +504,16 @@ discard block |
||
504 | 504 | // logo del documento |
505 | 505 | if (isset($this->logo)) { |
506 | 506 | // logo centrado (papel continuo) |
507 | - if (!empty($this->logo['posicion']) and $this->logo['posicion'] == 'C') { |
|
507 | + if (!empty($this->logo['posicion']) and $this->logo['posicion']=='C') { |
|
508 | 508 | $logo_w = null; |
509 | 509 | $logo_y = null; |
510 | 510 | $logo_position = 'C'; |
511 | 511 | $logo_next_pointer = 'N'; |
512 | 512 | } |
513 | 513 | // logo a la derecha (posicion=0) o arriba (posicion=1) |
514 | - else if (empty($this->logo['posicion']) or $this->logo['posicion'] == 1) { |
|
514 | + else if (empty($this->logo['posicion']) or $this->logo['posicion']==1) { |
|
515 | 515 | $logo_w = !$this->logo['posicion'] ? $w_img : null; |
516 | - $logo_y = $this->logo['posicion'] ? $w_img/2 : null; |
|
516 | + $logo_y = $this->logo['posicion'] ? $w_img / 2 : null; |
|
517 | 517 | $logo_position = ''; |
518 | 518 | $logo_next_pointer = 'T'; |
519 | 519 | } |
@@ -532,17 +532,17 @@ discard block |
||
532 | 532 | $logo_w, |
533 | 533 | $logo_y, |
534 | 534 | 'PNG', |
535 | - (isset($emisor['url'])?$emisor['url']:''), |
|
535 | + (isset($emisor['url']) ? $emisor['url'] : ''), |
|
536 | 536 | $logo_next_pointer, |
537 | 537 | 2, |
538 | 538 | 300, |
539 | 539 | $logo_position |
540 | 540 | ); |
541 | - if (!empty($this->logo['posicion']) and $this->logo['posicion'] == 'C') { |
|
541 | + if (!empty($this->logo['posicion']) and $this->logo['posicion']=='C') { |
|
542 | 542 | $w += 40; |
543 | 543 | } else { |
544 | 544 | if ($this->logo['posicion']) { |
545 | - $this->SetY($this->y + ($w_img/2)); |
|
545 | + $this->SetY($this->y+($w_img / 2)); |
|
546 | 546 | $w += 40; |
547 | 547 | } else { |
548 | 548 | $x = $this->x+3; |
@@ -555,19 +555,19 @@ discard block |
||
555 | 555 | // agregar datos del emisor |
556 | 556 | if ($agregarDatosEmisor) { |
557 | 557 | $this->setFont('', 'B', $font_size ? $font_size : 14); |
558 | - $this->SetTextColorArray($color===null?[32, 92, 144]:$color); |
|
559 | - $this->MultiTexto(!empty($emisor['RznSoc']) ? $emisor['RznSoc'] : $emisor['RznSocEmisor'], $x, $this->y+2, 'L', ($h_folio and $h_folio < $this->getY()) ? $w_all : $w); |
|
558 | + $this->SetTextColorArray($color===null ? [32, 92, 144] : $color); |
|
559 | + $this->MultiTexto(!empty($emisor['RznSoc']) ? $emisor['RznSoc'] : $emisor['RznSocEmisor'], $x, $this->y+2, 'L', ($h_folio and $h_folio<$this->getY()) ? $w_all : $w); |
|
560 | 560 | $this->setFont('', 'B', $font_size ? $font_size : 9); |
561 | - $this->SetTextColorArray([0,0,0]); |
|
562 | - $this->MultiTexto(!empty($emisor['GiroEmis']) ? $emisor['GiroEmis'] : $emisor['GiroEmisor'], $x, $this->y, 'L', ($h_folio and $h_folio < $this->getY()) ? $w_all : $w); |
|
561 | + $this->SetTextColorArray([0, 0, 0]); |
|
562 | + $this->MultiTexto(!empty($emisor['GiroEmis']) ? $emisor['GiroEmis'] : $emisor['GiroEmisor'], $x, $this->y, 'L', ($h_folio and $h_folio<$this->getY()) ? $w_all : $w); |
|
563 | 563 | $comuna = !empty($emisor['CmnaOrigen']) ? $emisor['CmnaOrigen'] : null; |
564 | 564 | $ciudad = !empty($emisor['CiudadOrigen']) ? $emisor['CiudadOrigen'] : \sasco\LibreDTE\Chile::getCiudad($comuna); |
565 | - $this->MultiTexto($emisor['DirOrigen'].($comuna?(', '.$comuna):'').($ciudad?(', '.$ciudad):''), $x, $this->y, 'L', ($h_folio and $h_folio < $this->getY()) ? $w_all : $w); |
|
565 | + $this->MultiTexto($emisor['DirOrigen'].($comuna ? (', '.$comuna) : '').($ciudad ? (', '.$ciudad) : ''), $x, $this->y, 'L', ($h_folio and $h_folio<$this->getY()) ? $w_all : $w); |
|
566 | 566 | if (!empty($emisor['Sucursal'])) { |
567 | - $this->MultiTexto('Sucursal: '.$emisor['Sucursal'], $x, $this->y, 'L', ($h_folio and $h_folio < $this->getY()) ? $w_all : $w); |
|
567 | + $this->MultiTexto('Sucursal: '.$emisor['Sucursal'], $x, $this->y, 'L', ($h_folio and $h_folio<$this->getY()) ? $w_all : $w); |
|
568 | 568 | } |
569 | 569 | if (!empty($this->casa_matriz)) { |
570 | - $this->MultiTexto('Casa matriz: '.$this->casa_matriz, $x, $this->y, 'L', ($h_folio and $h_folio < $this->getY()) ? $w_all : $w); |
|
570 | + $this->MultiTexto('Casa matriz: '.$this->casa_matriz, $x, $this->y, 'L', ($h_folio and $h_folio<$this->getY()) ? $w_all : $w); |
|
571 | 571 | } |
572 | 572 | $contacto = []; |
573 | 573 | if (!empty($emisor['Telefono'])) { |
@@ -582,7 +582,7 @@ discard block |
||
582 | 582 | $contacto[] = $emisor['CorreoEmisor']; |
583 | 583 | } |
584 | 584 | if ($contacto) { |
585 | - $this->MultiTexto(implode(' / ', $contacto), $x, $this->y, 'L', ($h_folio and $h_folio < $this->getY()) ? $w_all : $w); |
|
585 | + $this->MultiTexto(implode(' / ', $contacto), $x, $this->y, 'L', ($h_folio and $h_folio<$this->getY()) ? $w_all : $w); |
|
586 | 586 | } |
587 | 587 | } |
588 | 588 | return $this->y; |
@@ -612,12 +612,12 @@ discard block |
||
612 | 612 | protected function agregarFolio($rut, $tipo, $folio, $sucursal_sii = null, $x = 130, $y = 15, $w = 70, $font_size = null, array $color = null) |
613 | 613 | { |
614 | 614 | if ($color===null) { |
615 | - $color = $tipo ? ($tipo==52 ? [0,172,140] : [255,0,0]) : [0,0,0]; |
|
615 | + $color = $tipo ? ($tipo==52 ? [0, 172, 140] : [255, 0, 0]) : [0, 0, 0]; |
|
616 | 616 | } |
617 | 617 | $this->SetTextColorArray($color); |
618 | 618 | // colocar rut emisor, glosa documento y folio |
619 | 619 | list($rut, $dv) = explode('-', $rut); |
620 | - $this->setFont ('', 'B', $font_size ? $font_size : 15); |
|
620 | + $this->setFont('', 'B', $font_size ? $font_size : 15); |
|
621 | 621 | $this->MultiTexto('R.U.T.: '.$this->num($rut).'-'.$dv, $x, $y+4, 'C', $w); |
622 | 622 | $this->setFont('', 'B', $font_size ? $font_size : 12); |
623 | 623 | $this->MultiTexto($this->getTipo($tipo, $folio), $x, null, 'C', $w); |
@@ -630,7 +630,7 @@ discard block |
||
630 | 630 | if ($tipo) { |
631 | 631 | $this->Texto('S.I.I. - '.\sasco\LibreDTE\Sii::getDireccionRegional($sucursal_sii), $x, $this->getY()+4, 'C', $w); |
632 | 632 | } |
633 | - $this->SetTextColorArray([0,0,0]); |
|
633 | + $this->SetTextColorArray([0, 0, 0]); |
|
634 | 634 | $this->Ln(); |
635 | 635 | return $this->y; |
636 | 636 | } |
@@ -744,10 +744,10 @@ discard block |
||
744 | 744 | } |
745 | 745 | if (!empty($receptor['RznSocRecep'])) { |
746 | 746 | $this->setFont('', 'B', null); |
747 | - $this->Texto(in_array($this->dte, [39, 41]) ? 'Nombre' : ($x==10?'Razón social':'Razón soc.'), $x); |
|
747 | + $this->Texto(in_array($this->dte, [39, 41]) ? 'Nombre' : ($x==10 ? 'Razón social' : 'Razón soc.'), $x); |
|
748 | 748 | $this->Texto(':', $x+$offset); |
749 | 749 | $this->setFont('', '', null); |
750 | - $this->MultiTexto($receptor['RznSocRecep'], $x+$offset+2, null, '', $x==10?105:0); |
|
750 | + $this->MultiTexto($receptor['RznSocRecep'], $x+$offset+2, null, '', $x==10 ? 105 : 0); |
|
751 | 751 | } |
752 | 752 | if (!empty($receptor['GiroRecep'])) { |
753 | 753 | $this->setFont('', 'B', null); |
@@ -764,7 +764,7 @@ discard block |
||
764 | 764 | $ciudad = !empty($receptor['CiudadRecep']) ? $receptor['CiudadRecep'] : ( |
765 | 765 | !empty($receptor['CmnaRecep']) ? \sasco\LibreDTE\Chile::getCiudad($receptor['CmnaRecep']) : '' |
766 | 766 | ); |
767 | - $this->MultiTexto($receptor['DirRecep'].(!empty($receptor['CmnaRecep'])?(', '.$receptor['CmnaRecep']):'').($ciudad?(', '.$ciudad):''), $x+$offset+2); |
|
767 | + $this->MultiTexto($receptor['DirRecep'].(!empty($receptor['CmnaRecep']) ? (', '.$receptor['CmnaRecep']) : '').($ciudad ? (', '.$ciudad) : ''), $x+$offset+2); |
|
768 | 768 | } |
769 | 769 | if (!empty($receptor['Extranjero']['Nacionalidad'])) { |
770 | 770 | $this->setFont('', 'B', null); |
@@ -805,7 +805,7 @@ discard block |
||
805 | 805 | $this->Texto('Cód. recep.', $x); |
806 | 806 | $this->Texto(':', $x+$offset); |
807 | 807 | $this->setFont('', '', null); |
808 | - $this->MultiTexto($receptor['CdgIntRecep'], $x+$offset+2, null, '', $x==10?105:0); |
|
808 | + $this->MultiTexto($receptor['CdgIntRecep'], $x+$offset+2, null, '', $x==10 ? 105 : 0); |
|
809 | 809 | } |
810 | 810 | return $this->GetY(); |
811 | 811 | } |
@@ -902,7 +902,7 @@ discard block |
||
902 | 902 | { |
903 | 903 | if (!isset($referencias[0])) |
904 | 904 | $referencias = [$referencias]; |
905 | - foreach($referencias as $r) { |
|
905 | + foreach ($referencias as $r) { |
|
906 | 906 | $texto = $r['NroLinRef'].' - '; |
907 | 907 | if (!empty($r['TpoDocRef'])) { |
908 | 908 | $texto .= $this->getTipo($r['TpoDocRef']).' '; |
@@ -963,7 +963,7 @@ discard block |
||
963 | 963 | // quitar columnas |
964 | 964 | foreach ($item as $col => $valor) { |
965 | 965 | if ($col=='DscItem' and !empty($item['DscItem'])) { |
966 | - $item['NmbItem'] .= !$this->item_detalle_posicion ? ($html?'<br/>':"\n") : ': '; |
|
966 | + $item['NmbItem'] .= !$this->item_detalle_posicion ? ($html ? '<br/>' : "\n") : ': '; |
|
967 | 967 | $item['DscItem'] = $html ? str_replace("\n", '<br/>', $item['DscItem']) : str_replace(['<br/>', '<br>'], "\n", $item['DscItem']); |
968 | 968 | if ($html) { |
969 | 969 | $item['NmbItem'] .= '<span style="font-size:0.7em">'.$item['DscItem'].'</span>'; |
@@ -1012,7 +1012,7 @@ discard block |
||
1012 | 1012 | } |
1013 | 1013 | $item = array_merge($item_default, $item); |
1014 | 1014 | // si hay código de item se extrae su valor |
1015 | - if (!empty($item['CdgItem']['VlrCodigo'])){ |
|
1015 | + if (!empty($item['CdgItem']['VlrCodigo'])) { |
|
1016 | 1016 | $item['CdgItem'] = $item['CdgItem']['VlrCodigo']; |
1017 | 1017 | } |
1018 | 1018 | // dar formato a números |
@@ -1055,9 +1055,9 @@ discard block |
||
1055 | 1055 | $this->SetY($this->getY()+1); |
1056 | 1056 | $p1x = $x; |
1057 | 1057 | $p1y = $this->y; |
1058 | - $p2x = $this->getPageWidth() - 2; |
|
1059 | - $p2y = $p1y; // Use same y for a straight line |
|
1060 | - $style = array('width' => 0.2,'color' => array(0, 0, 0)); |
|
1058 | + $p2x = $this->getPageWidth()-2; |
|
1059 | + $p2y = $p1y; // Use same y for a straight line |
|
1060 | + $style = array('width' => 0.2, 'color' => array(0, 0, 0)); |
|
1061 | 1061 | $this->Line($p1x, $p1y, $p2x, $p2y, $style); |
1062 | 1062 | $this->Texto($this->detalle_cols['NmbItem']['title'], $x+$offsets[0], $this->y, ucfirst($this->detalle_cols['NmbItem']['align'][0]), $this->detalle_cols['NmbItem']['width']); |
1063 | 1063 | $this->Texto($this->detalle_cols['PrcItem']['title'], $x+$offsets[1], $this->y, ucfirst($this->detalle_cols['PrcItem']['align'][0]), $this->detalle_cols['PrcItem']['width']); |
@@ -1069,7 +1069,7 @@ discard block |
||
1069 | 1069 | } |
1070 | 1070 | // mostrar items |
1071 | 1071 | $this->SetY($this->getY()+2); |
1072 | - foreach($detalle as &$d) { |
|
1072 | + foreach ($detalle as &$d) { |
|
1073 | 1073 | // nombre y descripción del item |
1074 | 1074 | $item = $d['NmbItem']; |
1075 | 1075 | if ($this->papel_continuo_item_detalle and !empty($d['DscItem'])) { |
@@ -1079,14 +1079,14 @@ discard block |
||
1079 | 1079 | // descuento |
1080 | 1080 | if (!empty($d['DescuentoPct']) or !empty($d['DescuentoMonto'])) { |
1081 | 1081 | if (!empty($d['DescuentoPct'])) { |
1082 | - $descuento = number_format($d['DescuentoPct'],0,',','.').'%'; |
|
1082 | + $descuento = number_format($d['DescuentoPct'], 0, ',', '.').'%'; |
|
1083 | 1083 | } else { |
1084 | - $descuento = number_format($d['DescuentoMonto'],0,',','.'); |
|
1084 | + $descuento = number_format($d['DescuentoMonto'], 0, ',', '.'); |
|
1085 | 1085 | } |
1086 | 1086 | $this->Texto('Desc.: '.$descuento, $x+$offsets[0], $this->y, ucfirst($this->detalle_cols['NmbItem']['align'][0]), $this->detalle_cols['NmbItem']['width']); |
1087 | 1087 | } |
1088 | 1088 | // precio y cantidad |
1089 | - $this->Texto(number_format($d['PrcItem'],0,',','.'), $x+$offsets[1], $this->y, ucfirst($this->detalle_cols['PrcItem']['align'][0]), $this->detalle_cols['PrcItem']['width']); |
|
1089 | + $this->Texto(number_format($d['PrcItem'], 0, ',', '.'), $x+$offsets[1], $this->y, ucfirst($this->detalle_cols['PrcItem']['align'][0]), $this->detalle_cols['PrcItem']['width']); |
|
1090 | 1090 | $this->Texto($this->num($d['QtyItem']), $x+$offsets[2], $this->y, ucfirst($this->detalle_cols['QtyItem']['align'][0]), $this->detalle_cols['QtyItem']['width']); |
1091 | 1091 | $this->Texto($this->num($d['MontoItem']), $x+$offsets[3], $this->y, ucfirst($this->detalle_cols['MontoItem']['align'][0]), $this->detalle_cols['MontoItem']['width']); |
1092 | 1092 | } |
@@ -1106,7 +1106,7 @@ discard block |
||
1106 | 1106 | if (!isset($detalle[0])) { |
1107 | 1107 | $detalle = [$detalle]; |
1108 | 1108 | } |
1109 | - foreach($detalle as &$d) { |
|
1109 | + foreach ($detalle as &$d) { |
|
1110 | 1110 | if (!empty($d['MontoItem'])) { |
1111 | 1111 | $subtotal += $d['MontoItem']; |
1112 | 1112 | } |
@@ -1132,16 +1132,16 @@ discard block |
||
1132 | 1132 | if (!isset($descuentosRecargos[0])) { |
1133 | 1133 | $descuentosRecargos = [$descuentosRecargos]; |
1134 | 1134 | } |
1135 | - foreach($descuentosRecargos as $dr) { |
|
1135 | + foreach ($descuentosRecargos as $dr) { |
|
1136 | 1136 | $tipo = $dr['TpoMov']=='D' ? 'Descuento' : 'Recargo'; |
1137 | 1137 | if (!empty($dr['IndExeDR'])) { |
1138 | 1138 | $tipo .= ' EX'; |
1139 | 1139 | } |
1140 | 1140 | $valor = $dr['TpoValor']=='%' ? $dr['ValorDR'].'%' : $this->num($dr['ValorDR']); |
1141 | 1141 | if ($this->papelContinuo) { |
1142 | - $this->Texto($tipo.' global: '.$valor.(!empty($dr['GlosaDR'])?(' ('.$dr['GlosaDR'].')'):''), $x); |
|
1142 | + $this->Texto($tipo.' global: '.$valor.(!empty($dr['GlosaDR']) ? (' ('.$dr['GlosaDR'].')') : ''), $x); |
|
1143 | 1143 | } else { |
1144 | - $this->Texto($tipo.(!empty($dr['GlosaDR'])?(' ('.$dr['GlosaDR'].')'):'').':', 77, null, 'R', 100); |
|
1144 | + $this->Texto($tipo.(!empty($dr['GlosaDR']) ? (' ('.$dr['GlosaDR'].')') : '').':', 77, null, 'R', 100); |
|
1145 | 1145 | $this->Texto($valor, 177, null, 'R', 22); |
1146 | 1146 | } |
1147 | 1147 | $this->Ln(); |
@@ -1161,8 +1161,8 @@ discard block |
||
1161 | 1161 | $pagos = [$pagos]; |
1162 | 1162 | $this->Texto('Pago(s) programado(s):', $x); |
1163 | 1163 | $this->Ln(); |
1164 | - foreach($pagos as $p) { |
|
1165 | - $this->Texto(' - '.$this->date($p['FchPago'], false).': $'.$this->num($p['MntPago']).'.-'.(!empty($p['GlosaPagos'])?(' ('.$p['GlosaPagos'].')'):''), $x); |
|
1164 | + foreach ($pagos as $p) { |
|
1165 | + $this->Texto(' - '.$this->date($p['FchPago'], false).': $'.$this->num($p['MntPago']).'.-'.(!empty($p['GlosaPagos']) ? (' ('.$p['GlosaPagos'].')') : ''), $x); |
|
1166 | 1166 | $this->Ln(); |
1167 | 1167 | } |
1168 | 1168 | } |
@@ -1213,7 +1213,7 @@ discard block |
||
1213 | 1213 | if (!isset($ImptoReten[0])) { |
1214 | 1214 | $ImptoReten = [$ImptoReten]; |
1215 | 1215 | } |
1216 | - foreach($ImptoReten as $i) { |
|
1216 | + foreach ($ImptoReten as $i) { |
|
1217 | 1217 | $totales['ImptoReten_'.$i['TipoImp']] = $i['MontoImp']; |
1218 | 1218 | if (!empty($i['TasaImp'])) { |
1219 | 1219 | $glosas['ImptoReten_'.$i['TipoImp']] = \sasco\LibreDTE\Sii\ImpuestosAdicionales::getGlosa($i['TipoImp']).' ('.$i['TasaImp'].'%) $'; |
@@ -1326,9 +1326,9 @@ discard block |
||
1326 | 1326 | 'vpadding' => 0, |
1327 | 1327 | 'module_width' => 1, // width of a single module in points |
1328 | 1328 | 'module_height' => 1, // height of a single module in points |
1329 | - 'fgcolor' => [0,0,0], |
|
1329 | + 'fgcolor' => [0, 0, 0], |
|
1330 | 1330 | 'bgcolor' => false, // [255,255,255] |
1331 | - 'position' => $position === null ? ($this->papelContinuo ? 'C' : 'S') : $position, |
|
1331 | + 'position' => $position===null ? ($this->papelContinuo ? 'C' : 'S') : $position, |
|
1332 | 1332 | ]; |
1333 | 1333 | $ecl = version_compare(phpversion(), '7.0.0', '<') ? -1 : $this->ecl; |
1334 | 1334 | $this->write2DBarcode($timbre, 'PDF417,,'.$ecl, $x_timbre, $y, $w, 0, $style, 'B'); |
@@ -1359,7 +1359,7 @@ discard block |
||
1359 | 1359 | protected function agregarAcuseRecibo($x = 83, $y = 190, $w = 60, $h = 40, $line = 25) |
1360 | 1360 | { |
1361 | 1361 | $y = (!$this->papelContinuo and !$this->timbre_pie) ? $this->x_fin_datos : $y; |
1362 | - $this->SetTextColorArray([0,0,0]); |
|
1362 | + $this->SetTextColorArray([0, 0, 0]); |
|
1363 | 1363 | $this->Rect($x, $y, $w, $h, 'D', ['all' => ['width' => 0.1, 'color' => [0, 0, 0]]]); |
1364 | 1364 | $this->setFont('', 'B', 10); |
1365 | 1365 | $this->Texto('Acuse de recibo', $x, $y+1, 'C', $w); |
@@ -1389,9 +1389,9 @@ discard block |
||
1389 | 1389 | */ |
1390 | 1390 | protected function agregarAcuseReciboContinuo($x = 3, $y = null, $w = 68, $h = 40) |
1391 | 1391 | { |
1392 | - $this->SetTextColorArray([0,0,0]); |
|
1392 | + $this->SetTextColorArray([0, 0, 0]); |
|
1393 | 1393 | $this->Rect($x, $y, $w, $h, 'D', ['all' => ['width' => 0.1, 'color' => [0, 0, 0]]]); |
1394 | - $style = array('width' => 0.2,'color' => array(0, 0, 0)); |
|
1394 | + $style = array('width' => 0.2, 'color' => array(0, 0, 0)); |
|
1395 | 1395 | $this->Line($x, $y+22, $w+3, $y+22, $style); |
1396 | 1396 | //$this->setFont('', 'B', 10); |
1397 | 1397 | //$this->Texto('Acuse de recibo', $x, $y+1, 'C', $w); |
@@ -1421,7 +1421,7 @@ discard block |
||
1421 | 1421 | $y = (!$this->papelContinuo and !$this->timbre_pie and $this->x_fin_datos<=$y) ? $this->x_fin_datos : $y; |
1422 | 1422 | $y += 48; |
1423 | 1423 | $this->setFont('', 'B', $font_size); |
1424 | - $this->Texto('CEDIBLE'.($tipo==52?' CON SU FACTURA':''), null, $y, 'R'); |
|
1424 | + $this->Texto('CEDIBLE'.($tipo==52 ? ' CON SU FACTURA' : ''), null, $y, 'R'); |
|
1425 | 1425 | } |
1426 | 1426 | |
1427 | 1427 | /** |
@@ -1432,7 +1432,7 @@ discard block |
||
1432 | 1432 | protected function agregarLeyendaDestinoContinuo($tipo) |
1433 | 1433 | { |
1434 | 1434 | $this->setFont('', 'B', 8); |
1435 | - $this->Texto('CEDIBLE'.($tipo==52?' CON SU FACTURA':''), null, $this->y+6, 'R'); |
|
1435 | + $this->Texto('CEDIBLE'.($tipo==52 ? ' CON SU FACTURA' : ''), null, $this->y+6, 'R'); |
|
1436 | 1436 | } |
1437 | 1437 | |
1438 | 1438 | } |
@@ -58,7 +58,7 @@ |
||
58 | 58 | return false; |
59 | 59 | } |
60 | 60 | // si no se debe enviar no continuar |
61 | - if ($retry === 0) { |
|
61 | + if ($retry===0) { |
|
62 | 62 | return false; |
63 | 63 | } |
64 | 64 | // solicitar token |