@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | $this->envio_masivo = !(($this->filter_request('envio_masivo') === 'false')); |
| 60 | 60 | $this->tipo_accion = $tipo_documento; |
| 61 | 61 | $this->verificarCantidadFacturas(); |
| 62 | - $this->archivo = $tipo_documento.'_'.\date('dmYhis') . '.pdf'; |
|
| 62 | + $this->archivo = $tipo_documento.'_'.\date('dmYhis').'.pdf'; |
|
| 63 | 63 | if ($this->cliente_residente && $info_accion) { |
| 64 | 64 | switch ($info_accion) { |
| 65 | 65 | case 'imprimir': |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | unset($lista_facturas[0]); |
| 130 | 130 | $this->contador_facturas = count($lista_facturas); |
| 131 | 131 | $this->facturas = implode(',', $lista_facturas); |
| 132 | - } else { |
|
| 132 | + }else { |
|
| 133 | 133 | $this->contador_facturas = 0; |
| 134 | 134 | $this->facturas = ''; |
| 135 | 135 | } |
@@ -172,9 +172,9 @@ discard block |
||
| 172 | 172 | { |
| 173 | 173 | $this->documento = new residentes_pdf('letter', 'portrait'); |
| 174 | 174 | $this->documento->cliente_residente = $this->cliente_residente; |
| 175 | - $this->documento->pdf->addInfo('Title', 'Pagos Residente ' . |
|
| 175 | + $this->documento->pdf->addInfo('Title', 'Pagos Residente '. |
|
| 176 | 176 | $this->cliente_residente->codcliente); |
| 177 | - $this->documento->pdf->addInfo('Subject', 'Pagos del Residente ' . |
|
| 177 | + $this->documento->pdf->addInfo('Subject', 'Pagos del Residente '. |
|
| 178 | 178 | $this->cliente_residente->codcliente); |
| 179 | 179 | $this->documento->pdf->addInfo('Author', $this->empresa->nombre); |
| 180 | 180 | $this->documento->pdf->ezSetMargins(10, 10, 10, 10); |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | public function crearFacturaDetallada() |
| 185 | 185 | { |
| 186 | 186 | $customerInfo = (array) $this->cliente_residente; |
| 187 | - $customerInfo['direccion'] = trim($this->cliente_residente->inmueble->codigo_externo()) . ' numero ' |
|
| 187 | + $customerInfo['direccion'] = trim($this->cliente_residente->inmueble->codigo_externo()).' numero ' |
|
| 188 | 188 | . $this->cliente_residente->inmueble->numero; |
| 189 | 189 | $datosFactura = $this->datosFactura(); |
| 190 | 190 | $datosEmpresa = (array) $this->empresa; |
@@ -197,13 +197,13 @@ discard block |
||
| 197 | 197 | if ($this->filter_request('info_accion') === 'enviar') { |
| 198 | 198 | $this->documento->Output( |
| 199 | 199 | 'F', |
| 200 | - 'tmp/' . FS_TMP_NAME . 'enviar/' . $this->archivo, |
|
| 200 | + 'tmp/'.FS_TMP_NAME.'enviar/'.$this->archivo, |
|
| 201 | 201 | true |
| 202 | 202 | ); |
| 203 | - } else { |
|
| 203 | + }else { |
|
| 204 | 204 | $this->documento->Output( |
| 205 | 205 | 'I', |
| 206 | - 'factura_' .$datosFactura[0]['numero2']. '_' . \date('dmYhis') . '.pdf' |
|
| 206 | + 'factura_'.$datosFactura[0]['numero2'].'_'.\date('dmYhis').'.pdf' |
|
| 207 | 207 | ); |
| 208 | 208 | } |
| 209 | 209 | } |
@@ -252,7 +252,7 @@ discard block |
||
| 252 | 252 | } |
| 253 | 253 | $this->documento->set_y(80); |
| 254 | 254 | if ($this->empresa->pie_factura) { |
| 255 | - $this->documento->pdf->addText(20, 40, 8, fs_fix_html('<b>Generado por:</b> ' . |
|
| 255 | + $this->documento->pdf->addText(20, 40, 8, fs_fix_html('<b>Generado por:</b> '. |
|
| 256 | 256 | $this->user->get_agente_fullname()), 0); |
| 257 | 257 | $this->documento->pdf->addText( |
| 258 | 258 | 10, |
@@ -263,9 +263,9 @@ discard block |
||
| 263 | 263 | } |
| 264 | 264 | |
| 265 | 265 | if ($this->filter_request('info_accion') == 'enviar') { |
| 266 | - $this->documento->save('tmp/' . FS_TMP_NAME . 'enviar/' . $this->archivo); |
|
| 267 | - } else { |
|
| 268 | - $this->documento->show('documento_cobros_' . \date('dmYhis') . '.pdf'); |
|
| 266 | + $this->documento->save('tmp/'.FS_TMP_NAME.'enviar/'.$this->archivo); |
|
| 267 | + }else { |
|
| 268 | + $this->documento->show('documento_cobros_'.\date('dmYhis').'.pdf'); |
|
| 269 | 269 | } |
| 270 | 270 | } |
| 271 | 271 | |
@@ -286,15 +286,15 @@ discard block |
||
| 286 | 286 | $mail->addAddress($email, $this->cliente_residente->informacion->nombre); |
| 287 | 287 | |
| 288 | 288 | $elSubject = ($tipo_documento === 'informacion_cobros') |
| 289 | - ? ': Su Estado de cuenta al '. \date('d-m-Y') |
|
| 290 | - : ': Su factura ' . $this->factura->codigo . ' ' . $this->factura->numero2; |
|
| 289 | + ? ': Su Estado de cuenta al '.\date('d-m-Y') |
|
| 290 | + : ': Su factura '.$this->factura->codigo.' '.$this->factura->numero2; |
|
| 291 | 291 | |
| 292 | - $mail->Subject = fs_fix_html($this->empresa->nombre) . $elSubject; |
|
| 292 | + $mail->Subject = fs_fix_html($this->empresa->nombre).$elSubject; |
|
| 293 | 293 | $mail->AltBody = ($tipo_documento === 'informacion_cobros') |
| 294 | 294 | ? strip_tags($_POST['mensaje']) |
| 295 | 295 | : plantilla_email( |
| 296 | 296 | 'factura', |
| 297 | - $this->factura->codigo . ' ' . $this->factura->numero2, |
|
| 297 | + $this->factura->codigo.' '.$this->factura->numero2, |
|
| 298 | 298 | $this->empresa->email_config['mail_firma'] |
| 299 | 299 | ); |
| 300 | 300 | if (trim($this->filter_request('email_copia')) !== '') { |
@@ -303,7 +303,7 @@ discard block |
||
| 303 | 303 | trim($this->filter_request('email_copia')), |
| 304 | 304 | $this->cliente_residente->informacion->nombre |
| 305 | 305 | ); |
| 306 | - } else { |
|
| 306 | + }else { |
|
| 307 | 307 | $mail->addCC( |
| 308 | 308 | trim($this->filter_request('email_copia')), |
| 309 | 309 | $this->cliente_residente->informacion->nombre |
@@ -312,7 +312,7 @@ discard block |
||
| 312 | 312 | } |
| 313 | 313 | $mail->msgHTML(nl2br($mail->AltBody)); |
| 314 | 314 | $mail->isHTML(true); |
| 315 | - $mail->addAttachment('tmp/' . FS_TMP_NAME . 'enviar/' . $this->archivo); |
|
| 315 | + $mail->addAttachment('tmp/'.FS_TMP_NAME.'enviar/'.$this->archivo); |
|
| 316 | 316 | |
| 317 | 317 | if (is_uploaded_file($_FILES['adjunto']['tmp_name'])) { |
| 318 | 318 | $mail->aºddAttachment($_FILES['adjunto']['tmp_name'], $_FILES['adjunto']['name']); |
@@ -323,11 +323,11 @@ discard block |
||
| 323 | 323 | |
| 324 | 324 | $this->empresa->save_mail($mail); |
| 325 | 325 | $done = true; |
| 326 | - } else { |
|
| 327 | - $this->new_error_msg("Error al enviar el email: " . $mail->ErrorInfo); |
|
| 326 | + }else { |
|
| 327 | + $this->new_error_msg("Error al enviar el email: ".$mail->ErrorInfo); |
|
| 328 | 328 | } |
| 329 | 329 | |
| 330 | - unlink('tmp/' . FS_TMP_NAME . 'enviar/' . $this->archivo); |
|
| 330 | + unlink('tmp/'.FS_TMP_NAME.'enviar/'.$this->archivo); |
|
| 331 | 331 | |
| 332 | 332 | // $mail = $this->empresa->new_mail(); |
| 333 | 333 | // $mail->FromName = $this->user->get_agente_fullname(); |
@@ -370,7 +370,7 @@ discard block |
||
| 370 | 370 | // } |
| 371 | 371 | // |
| 372 | 372 | // unlink('tmp/' . FS_TMP_NAME . 'enviar/' . $this->archivo); |
| 373 | - } else { |
|
| 373 | + }else { |
|
| 374 | 374 | $this->new_error_msg('Imposible generar el PDF.'); |
| 375 | 375 | } |
| 376 | 376 | } |
@@ -386,8 +386,8 @@ discard block |
||
| 386 | 386 | $this->envio_masivo = false; |
| 387 | 387 | $this->existe_tesoreria(); |
| 388 | 388 | $this->cliente_residente = false; |
| 389 | - if (!file_exists('tmp/' . FS_TMP_NAME . 'enviar') && |
|
| 390 | - !mkdir($concurrentDirectory = 'tmp/' . FS_TMP_NAME . 'enviar') && |
|
| 389 | + if (!file_exists('tmp/'.FS_TMP_NAME.'enviar') && |
|
| 390 | + !mkdir($concurrentDirectory = 'tmp/'.FS_TMP_NAME.'enviar') && |
|
| 391 | 391 | !is_dir($concurrentDirectory)) { |
| 392 | 392 | throw new \RuntimeException(sprintf('Directory "%s" was not created', $concurrentDirectory)); |
| 393 | 393 | } |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | |
| 94 | 94 | public function init() |
| 95 | 95 | { |
| 96 | - $this->allow_delete = ($this->user->admin)?TRUE:$this->user->allow_delete_on(__CLASS__); |
|
| 96 | + $this->allow_delete = ($this->user->admin) ?TRUE:$this->user->allow_delete_on(__CLASS__); |
|
| 97 | 97 | $this->edificaciones_tipo = new residentes_edificaciones_tipo(); |
| 98 | 98 | $this->edificaciones_mapa = new residentes_edificaciones_mapa(); |
| 99 | 99 | $this->edificaciones = new residentes_edificaciones(); |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | return 'index.php?page='.__CLASS__.'&interior='.$interior; |
| 143 | 143 | } elseif ($inmuebles) { |
| 144 | 144 | return 'index.php?page='.__CLASS__.'&inmuebles='.$inmuebles; |
| 145 | - } else { |
|
| 145 | + }else { |
|
| 146 | 146 | return 'index.php?page='.__CLASS__; |
| 147 | 147 | } |
| 148 | 148 | } |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | $edificacion->codcliente = ''; |
| 163 | 163 | $edificacion->fecha_disponibilidad = null; |
| 164 | 164 | $edificacion->fecha_ocupacion = null; |
| 165 | - try{ |
|
| 165 | + try { |
|
| 166 | 166 | $edificacion->save(); |
| 167 | 167 | $this->new_message('Inmueble desocupado exitosamente.'); |
| 168 | 168 | } catch (Exception $ex) { |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | $this->new_error_msg('Esta edificacion tiene un residente, '. |
| 181 | 181 | 'primero debe quitar al residente para proceder '. |
| 182 | 182 | 'a eliminar esta edificacion.'); |
| 183 | - } else { |
|
| 183 | + }else { |
|
| 184 | 184 | try { |
| 185 | 185 | $edificacion->delete(); |
| 186 | 186 | $this->new_message('Edificación eliminada correctamente.'); |
@@ -211,15 +211,15 @@ discard block |
||
| 211 | 211 | public function buscar_padre($id, &$codigo, &$unir = false) |
| 212 | 212 | { |
| 213 | 213 | $dato = $this->edificaciones_mapa->get($id); |
| 214 | - $codigo[] = ($unir)?'"'.$dato->id_tipo.'":"'.$dato->codigo_edificacion.'"':$dato->codigo_edificacion; |
|
| 214 | + $codigo[] = ($unir) ? '"'.$dato->id_tipo.'":"'.$dato->codigo_edificacion.'"' : $dato->codigo_edificacion; |
|
| 215 | 215 | if ($dato->padre_id === 0) { |
| 216 | 216 | return $codigo; |
| 217 | - } else { |
|
| 217 | + }else { |
|
| 218 | 218 | $this->buscar_padre($dato->padre_id, $codigo, $unir); |
| 219 | 219 | } |
| 220 | 220 | } |
| 221 | 221 | |
| 222 | - public function crear_codigo($id,$unir = false) |
|
| 222 | + public function crear_codigo($id, $unir = false) |
|
| 223 | 223 | { |
| 224 | 224 | $codigo = array(); |
| 225 | 225 | $this->buscar_padre($id, $codigo, $unir); |
@@ -229,7 +229,7 @@ discard block |
||
| 229 | 229 | array_unshift($lista, $linea); |
| 230 | 230 | } |
| 231 | 231 | $codigo = $lista; |
| 232 | - } else { |
|
| 232 | + }else { |
|
| 233 | 233 | rsort($codigo); |
| 234 | 234 | } |
| 235 | 235 | return $codigo; |
@@ -241,16 +241,16 @@ discard block |
||
| 241 | 241 | $final_p = \filter_input(INPUT_POST, 'final'); |
| 242 | 242 | $cantidad = \filter_input(INPUT_POST, 'cantidad'); |
| 243 | 243 | $incremento = \filter_input(INPUT_POST, 'incremento'); |
| 244 | - $final=(!empty($final_p))?$final_p:$inicio; |
|
| 244 | + $final = (!empty($final_p)) ? $final_p : $inicio; |
|
| 245 | 245 | $inmuebles = 0; |
| 246 | 246 | $error = 0; |
| 247 | 247 | $linea = 0; |
| 248 | 248 | if ($inicio === $final) { |
| 249 | 249 | $this->inmueble($inicio, $inmuebles, $error); |
| 250 | - } else { |
|
| 251 | - for ($i = $inicio; $i<=($final); $i++) { |
|
| 252 | - if ($linea === $cantidad and $cantidad!=0) { |
|
| 253 | - $i = ($i-$cantidad)+$incremento; |
|
| 250 | + }else { |
|
| 251 | + for ($i = $inicio; $i <= ($final); $i++) { |
|
| 252 | + if ($linea === $cantidad and $cantidad != 0) { |
|
| 253 | + $i = ($i - $cantidad) + $incremento; |
|
| 254 | 254 | $linea = 0; |
| 255 | 255 | } |
| 256 | 256 | $this->inmueble($i, $inmuebles, $error); |
@@ -275,7 +275,7 @@ discard block |
||
| 275 | 275 | $ubicacion = ""; |
| 276 | 276 | $codcliente = ""; |
| 277 | 277 | $ocupado = false; |
| 278 | - $item = (is_int($inicio))?str_pad($inicio, 3, "0", STR_PAD_LEFT):$inicio; |
|
| 278 | + $item = (is_int($inicio)) ?str_pad($inicio, 3, "0", STR_PAD_LEFT) : $inicio; |
|
| 279 | 279 | $edif0 = new residentes_edificaciones(); |
| 280 | 280 | $edif0->id = \filter_input(INPUT_POST, 'id'); |
| 281 | 281 | $edif0->id_edificacion = \filter_input(INPUT_POST, 'id_edificacion'); |
@@ -284,7 +284,7 @@ discard block |
||
| 284 | 284 | $edif0->numero = $item; |
| 285 | 285 | $edif0->ubicacion = trim($ubicacion); |
| 286 | 286 | $edif0->codcliente = trim($codcliente); |
| 287 | - $edif0->ocupado = (bool)$ocupado; |
|
| 287 | + $edif0->ocupado = (bool) $ocupado; |
|
| 288 | 288 | try { |
| 289 | 289 | $edif0->save(); |
| 290 | 290 | $inmuebles++; |
@@ -312,13 +312,13 @@ discard block |
||
| 312 | 312 | $iddireccion, |
| 313 | 313 | $descripcion_direccion |
| 314 | 314 | ); |
| 315 | - $inmueble->fecha_ocupacion = ($fecha_ocupacion)?\date('Y-m-d', strtotime($fecha_ocupacion)):null; |
|
| 315 | + $inmueble->fecha_ocupacion = ($fecha_ocupacion) ?\date('Y-m-d', strtotime($fecha_ocupacion)) : null; |
|
| 316 | 316 | $inmueble->fecha_disponibilidad = ($fecha_disponibilidad) |
| 317 | 317 | ?\date('Y-m-d', strtotime($fecha_disponibilidad)) |
| 318 | 318 | :null; |
| 319 | 319 | if ($inmueble->save()) { |
| 320 | 320 | $this->new_message('Residente agregado exitosamente.'); |
| 321 | - } else { |
|
| 321 | + }else { |
|
| 322 | 322 | $this->new_error_msg('No se pudo agregar al residente confirme el '. |
| 323 | 323 | 'nombre del residente y las fechs de ocupación y disponibilidad'); |
| 324 | 324 | } |
@@ -330,7 +330,7 @@ discard block |
||
| 330 | 330 | $inmueble->fecha_disponibilidad = ''; |
| 331 | 331 | if ($inmueble->save()) { |
| 332 | 332 | $this->new_message('Residente removido exitosamente.'); |
| 333 | - } else { |
|
| 333 | + }else { |
|
| 334 | 334 | $this->new_error_msg('No se pudo remover al residente'); |
| 335 | 335 | } |
| 336 | 336 | } |
@@ -345,13 +345,13 @@ discard block |
||
| 345 | 345 | $campo = "campo_".$i->id; |
| 346 | 346 | $linea = filter_input(INPUT_POST, $campo); |
| 347 | 347 | $precodigo .= $linea; |
| 348 | - $precodigo_interno[$i->id]=$linea; |
|
| 348 | + $precodigo_interno[$i->id] = $linea; |
|
| 349 | 349 | } |
| 350 | 350 | $codigo_p = filter_input(INPUT_POST, 'codigo'); |
| 351 | 351 | $codigo_interno_p = filter_input(INPUT_POST, 'codigo_interno'); |
| 352 | - $codigo = ($codigo_p)?$codigo_p:$precodigo; |
|
| 352 | + $codigo = ($codigo_p) ? $codigo_p : $precodigo; |
|
| 353 | 353 | $codigo_interno = ($codigo_interno_p) |
| 354 | - ?$codigo_interno_p |
|
| 354 | + ? $codigo_interno_p |
|
| 355 | 355 | : \json_encode($precodigo_interno, JSON_THROW_ON_ERROR); |
| 356 | 356 | $numero = filter_input(INPUT_POST, 'numero_edificacion'); |
| 357 | 357 | $ubicacion = filter_input(INPUT_POST, 'ubicacion'); |
@@ -368,10 +368,10 @@ discard block |
||
| 368 | 368 | $this->new_error_msg('Ocurrió un error al querer eliminar la Edificación. '. |
| 369 | 369 | $exc->getTraceAsString()); |
| 370 | 370 | } |
| 371 | - } else { |
|
| 371 | + }else { |
|
| 372 | 372 | $this->new_error_msg('¡No se puede eliminar una edificación que está ocupada!'); |
| 373 | 373 | } |
| 374 | - } else { |
|
| 374 | + }else { |
|
| 375 | 375 | $edif0 = new FacturaScripts\model\residentes_edificaciones(); |
| 376 | 376 | $edif0->id = $id; |
| 377 | 377 | $edif0->codigo = $codigo; |
@@ -379,7 +379,7 @@ discard block |
||
| 379 | 379 | $edif0->numero = trim($numero); |
| 380 | 380 | $edif0->ubicacion = trim($ubicacion); |
| 381 | 381 | $edif0->codcliente = trim($codcliente); |
| 382 | - $edif0->ocupado = ($ocupado)?"TRUE":"FALSE"; |
|
| 382 | + $edif0->ocupado = ($ocupado) ? "TRUE" : "FALSE"; |
|
| 383 | 383 | try { |
| 384 | 384 | $edif0->save(); |
| 385 | 385 | $this->new_message('¡Edificación guardada exitosamente!'); |
@@ -406,11 +406,11 @@ discard block |
||
| 406 | 406 | $this->new_error_msg('Ocurrió un error al querer eliminar el tipo de edificación. '. |
| 407 | 407 | $e->getTraceAsString()); |
| 408 | 408 | } |
| 409 | - } else { |
|
| 409 | + }else { |
|
| 410 | 410 | $this->new_error_msg('No se puede eliminar un Tipo de edificación que es padre de otros '. |
| 411 | 411 | 'tipos de edificación.'); |
| 412 | 412 | } |
| 413 | - } else { |
|
| 413 | + }else { |
|
| 414 | 414 | $tipo0 = new residentes_edificaciones_tipo(); |
| 415 | 415 | $tipo0->id = $id; |
| 416 | 416 | $tipo0->descripcion = ucfirst(strtolower(trim(htmlspecialchars($descripcion)))); |
@@ -455,12 +455,12 @@ discard block |
||
| 455 | 455 | $id = \filter_input(INPUT_POST, 'id'); |
| 456 | 456 | $codigo_padre = \filter_input(INPUT_POST, 'codigo_padre'); |
| 457 | 457 | $padre_id = \filter_input(INPUT_POST, 'padre_id'); |
| 458 | - $final=(!empty($final_p))?$final_p:$inicio; |
|
| 458 | + $final = (!empty($final_p)) ? $final_p : $inicio; |
|
| 459 | 459 | $inmuebles = 0; |
| 460 | 460 | $error = 0; |
| 461 | 461 | $linea = 0; |
| 462 | 462 | foreach (range($inicio, $final) as $item) { |
| 463 | - $item = (is_int($item))?str_pad($item, 3, "0", STR_PAD_LEFT):$item; |
|
| 463 | + $item = (is_int($item)) ?str_pad($item, 3, "0", STR_PAD_LEFT) : $item; |
|
| 464 | 464 | $punto = new residentes_edificaciones_mapa(); |
| 465 | 465 | $punto->id = $id; |
| 466 | 466 | $punto->id_tipo = $objeto->id; |
@@ -471,7 +471,7 @@ discard block |
||
| 471 | 471 | $punto->numero = ''; |
| 472 | 472 | if ($punto->save()) { |
| 473 | 473 | $inmuebles++; |
| 474 | - } else { |
|
| 474 | + }else { |
|
| 475 | 475 | $error++; |
| 476 | 476 | } |
| 477 | 477 | $linea++; |
@@ -535,7 +535,7 @@ discard block |
||
| 535 | 535 | foreach ($extensiones as $ext) { |
| 536 | 536 | $fsext0 = new fs_extension($ext); |
| 537 | 537 | if (!$fsext0->delete()) { |
| 538 | - $this->new_error_msg('Imposible eliminar los datos de la extensión ' . $ext['name'] . '.'); |
|
| 538 | + $this->new_error_msg('Imposible eliminar los datos de la extensión '.$ext['name'].'.'); |
|
| 539 | 539 | } |
| 540 | 540 | } |
| 541 | 541 | |
@@ -572,7 +572,7 @@ discard block |
||
| 572 | 572 | foreach ($extensiones2 as $ext) { |
| 573 | 573 | $fsext0 = new fs_extension($ext); |
| 574 | 574 | if (!$fsext0->save()) { |
| 575 | - $this->new_error_msg('Imposible guardar los datos de la extensión ' . $ext['name'] . '.'); |
|
| 575 | + $this->new_error_msg('Imposible guardar los datos de la extensión '.$ext['name'].'.'); |
|
| 576 | 576 | } |
| 577 | 577 | } |
| 578 | 578 | } |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | |
| 50 | 50 | $accion_p = \filter_input(INPUT_POST, 'accion'); |
| 51 | 51 | $accion_g = \filter_input(INPUT_GET, 'accion'); |
| 52 | - $accion = ($accion_p)?:$accion_g; |
|
| 52 | + $accion = ($accion_p) ?: $accion_g; |
|
| 53 | 53 | if ($accion === 'agregar_base') { |
| 54 | 54 | $this->agregar($this->padre); |
| 55 | 55 | } elseif ($accion === 'agregar_hijo') { |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | if ($estructura->tiene_hijos()) { |
| 63 | 63 | $this->new_error_msg('Esta estructura tiene edificaciones internas, '. |
| 64 | 64 | 'primero debe eliminarlas para eliminar esta.'); |
| 65 | - } else { |
|
| 65 | + }else { |
|
| 66 | 66 | try { |
| 67 | 67 | $estructura->delete(); |
| 68 | 68 | $this->new_message('Edificación eliminada correctamente.'); |
@@ -95,14 +95,14 @@ discard block |
||
| 95 | 95 | { |
| 96 | 96 | $inicio = \filter_input(INPUT_POST, 'inicio'); |
| 97 | 97 | $final_p = \filter_input(INPUT_POST, 'final'); |
| 98 | - $final=(!empty($final_p))?$final_p:$inicio; |
|
| 98 | + $final = (!empty($final_p)) ? $final_p : $inicio; |
|
| 99 | 99 | $inmuebles = 0; |
| 100 | 100 | $error = 0; |
| 101 | 101 | $linea = 0; |
| 102 | 102 | if ($inicio === $final) { |
| 103 | 103 | $this->edificacion($inicio, $inmuebles, $error, $objeto); |
| 104 | 104 | $linea++; |
| 105 | - } else { |
|
| 105 | + }else { |
|
| 106 | 106 | foreach (range($inicio, $final) as $item) { |
| 107 | 107 | $this->edificacion($item, $inmuebles, $error, $objeto); |
| 108 | 108 | $linea++; |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | $id = \filter_input(INPUT_POST, 'id'); |
| 120 | 120 | $codigo_padre = \filter_input(INPUT_POST, 'codigo_padre'); |
| 121 | 121 | $padre_id = \filter_input(INPUT_POST, 'padre_id'); |
| 122 | - $item = (is_int($i))?str_pad($i, 3, "0", STR_PAD_LEFT):$i; |
|
| 122 | + $item = (is_int($i)) ?str_pad($i, 3, "0", STR_PAD_LEFT) : $i; |
|
| 123 | 123 | $punto = new residentes_edificaciones_mapa(); |
| 124 | 124 | $punto->id = $id; |
| 125 | 125 | $punto->id_tipo = $objeto->id; |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | $punto->numero = ''; |
| 131 | 131 | if ($punto->save()) { |
| 132 | 132 | $inmuebles++; |
| 133 | - } else { |
|
| 133 | + }else { |
|
| 134 | 134 | $error++; |
| 135 | 135 | } |
| 136 | 136 | } |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | $this->nueva_factura(); |
| 83 | 83 | } |
| 84 | 84 | $this->informacionResidente(); |
| 85 | - } else { |
|
| 85 | + }else { |
|
| 86 | 86 | $this->new_error_msg('Residente no encontrado.'); |
| 87 | 87 | } |
| 88 | 88 | } |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | |
| 98 | 98 | public function informacionResidente() |
| 99 | 99 | { |
| 100 | - $this->page->title = 'Residente ' . $this->residente->nombre; |
|
| 100 | + $this->page->title = 'Residente '.$this->residente->nombre; |
|
| 101 | 101 | $factura = new factura_cliente(); |
| 102 | 102 | $facts = $factura->all_from_cliente($this->residente->codcliente); |
| 103 | 103 | $this->facturas = array(); |
@@ -107,10 +107,10 @@ discard block |
||
| 107 | 107 | $fac->referencias = ""; |
| 108 | 108 | foreach ($fac->get_lineas() as $linea) { |
| 109 | 109 | if ($linea->referencia) { |
| 110 | - $fac->referencias .= $linea->referencia . " "; |
|
| 110 | + $fac->referencias .= $linea->referencia." "; |
|
| 111 | 111 | $this->validarArticulos($articulos_cobrados, $fac, $linea); |
| 112 | - } else { |
|
| 113 | - $fac->referencias .= $linea->descripcion . " "; |
|
| 112 | + }else { |
|
| 113 | + $fac->referencias .= $linea->descripcion." "; |
|
| 114 | 114 | } |
| 115 | 115 | } |
| 116 | 116 | $this->facturas[] = $fac; |
@@ -171,10 +171,10 @@ discard block |
||
| 171 | 171 | $this->lineasLibresFactura($factura, 'otro2'); |
| 172 | 172 | |
| 173 | 173 | $this->totalFactura($factura); |
| 174 | - } else { |
|
| 174 | + }else { |
|
| 175 | 175 | $this->new_error_msg('Imposible guardar la factura.'); |
| 176 | 176 | } |
| 177 | - } else { |
|
| 177 | + }else { |
|
| 178 | 178 | $this->new_error_msg('Cliente no encontrado.'); |
| 179 | 179 | } |
| 180 | 180 | } |
@@ -239,15 +239,15 @@ discard block |
||
| 239 | 239 | $art0 = new articulo(); |
| 240 | 240 | $lineas = \filter_input(INPUT_POST, 'numlineas'); |
| 241 | 241 | for ($x = 0; $x < $lineas; $x++) { |
| 242 | - $referencia = \filter_input(INPUT_POST, 'referencia_' . $x); |
|
| 243 | - $importe = \filter_input(INPUT_POST, 'importe_' . $x); |
|
| 244 | - $impuesto = \filter_input(INPUT_POST, 'impuesto_' . $x); |
|
| 242 | + $referencia = \filter_input(INPUT_POST, 'referencia_'.$x); |
|
| 243 | + $importe = \filter_input(INPUT_POST, 'importe_'.$x); |
|
| 244 | + $impuesto = \filter_input(INPUT_POST, 'impuesto_'.$x); |
|
| 245 | 245 | $art = $art0->get($referencia); |
| 246 | - if ((float)$importe) { |
|
| 246 | + if ((float) $importe) { |
|
| 247 | 247 | $linea = new linea_factura_cliente(); |
| 248 | 248 | $linea->idfactura = $factura->idfactura; |
| 249 | 249 | $linea->referencia = $referencia; |
| 250 | - $linea->descripcion = ($art) ? $art->descripcion : $referencia . ' Articulo libre'; |
|
| 250 | + $linea->descripcion = ($art) ? $art->descripcion : $referencia.' Articulo libre'; |
|
| 251 | 251 | $linea->cantidad = 1; |
| 252 | 252 | $imp = $this->impuesto->get($impuesto); |
| 253 | 253 | if ($imp) { |
@@ -278,7 +278,7 @@ discard block |
||
| 278 | 278 | $linea->codimpuesto = $imp->codimpuesto; |
| 279 | 279 | $linea->iva = $imp->iva; |
| 280 | 280 | $linea->pvpsindto = $linea->pvptotal = $linea->pvpunitario = |
| 281 | - (100 * (float)\filter_input(INPUT_POST, $linea_nombre)) / (100 + $imp->iva); |
|
| 281 | + (100 * (float) \filter_input(INPUT_POST, $linea_nombre)) / (100 + $imp->iva); |
|
| 282 | 282 | |
| 283 | 283 | $articulo = (\filter_input(INPUT_POST, 'ref_'.$linea_nombre)) |
| 284 | 284 | ? $art0->get(\filter_input(INPUT_POST, 'ref_'.$linea_nombre)) |
@@ -304,19 +304,19 @@ discard block |
||
| 304 | 304 | $factura->totalrecargo = round($factura->totalrecargo, FS_NF0); |
| 305 | 305 | $factura->total = $factura->neto + $factura->totaliva - $factura->totalirpf + $factura->totalrecargo; |
| 306 | 306 | |
| 307 | - if (abs((float)(\filter_input(INPUT_POST, 'total_importe')) - $factura->total) > .01) { |
|
| 308 | - $this->new_error_msg("El total difiere entre la vista y el controlador (" . |
|
| 309 | - \filter_input(INPUT_POST, 'total_importe') . |
|
| 310 | - " frente a " . $factura->total . "). Debes informar del error."); |
|
| 307 | + if (abs((float) (\filter_input(INPUT_POST, 'total_importe')) - $factura->total) > .01) { |
|
| 308 | + $this->new_error_msg("El total difiere entre la vista y el controlador (". |
|
| 309 | + \filter_input(INPUT_POST, 'total_importe'). |
|
| 310 | + " frente a ".$factura->total."). Debes informar del error."); |
|
| 311 | 311 | $factura->delete(); |
| 312 | 312 | } elseif ($factura->save()) { |
| 313 | 313 | $this->generar_asiento($factura); |
| 314 | 314 | /// Función de ejecución de tareas post guardado correcto de la factura |
| 315 | 315 | fs_documento_post_save($factura); |
| 316 | - $this->new_message("<a href='" . $factura->url() . "'>Factura</a> guardada correctamente."); |
|
| 317 | - $this->new_change('Factura Cliente ' . $factura->codigo, $factura->url(), true); |
|
| 318 | - } else { |
|
| 319 | - $this->new_error_msg("¡Imposible actualizar la <a href='" . $factura->url() . "'>Factura</a>!"); |
|
| 316 | + $this->new_message("<a href='".$factura->url()."'>Factura</a> guardada correctamente."); |
|
| 317 | + $this->new_change('Factura Cliente '.$factura->codigo, $factura->url(), true); |
|
| 318 | + }else { |
|
| 319 | + $this->new_error_msg("¡Imposible actualizar la <a href='".$factura->url()."'>Factura</a>!"); |
|
| 320 | 320 | } |
| 321 | 321 | } |
| 322 | 322 | |
@@ -329,7 +329,7 @@ discard block |
||
| 329 | 329 | if ($this->empresa->contintegrada) { |
| 330 | 330 | $asiento_factura = new asiento_factura(); |
| 331 | 331 | $asiento_factura->generar_asiento_venta($factura); |
| 332 | - } else { |
|
| 332 | + }else { |
|
| 333 | 333 | /// de todas formas forzamos la generación de las líneas de iva |
| 334 | 334 | $factura->get_lineas_iva(); |
| 335 | 335 | } |
@@ -141,9 +141,9 @@ |
||
| 141 | 141 | $lista = array(); |
| 142 | 142 | if ($data) { |
| 143 | 143 | foreach ($data as $d) { |
| 144 | - $item = new residentes_facturacion_programada_edificaciones($d); |
|
| 145 | - $this->infoAdicional($item); |
|
| 146 | - $lista[] = $item; |
|
| 144 | + $item = new residentes_facturacion_programada_edificaciones($d); |
|
| 145 | + $this->infoAdicional($item); |
|
| 146 | + $lista[] = $item; |
|
| 147 | 147 | } |
| 148 | 148 | return $lista; |
| 149 | 149 | } |
@@ -36,15 +36,15 @@ discard block |
||
| 36 | 36 | public $procesado; |
| 37 | 37 | |
| 38 | 38 | public function __construct($t = FALSE) { |
| 39 | - parent::__construct('residentes_fact_prog_edificaciones','plugins/residentes'); |
|
| 40 | - if($t){ |
|
| 39 | + parent::__construct('residentes_fact_prog_edificaciones', 'plugins/residentes'); |
|
| 40 | + if ($t) { |
|
| 41 | 41 | $this->id = $t['id']; |
| 42 | 42 | $this->idprogramacion = $t['idprogramacion']; |
| 43 | 43 | $this->id_edificacion = $t['id_edificacion']; |
| 44 | 44 | $this->codcliente = $t['codcliente']; |
| 45 | 45 | $this->idfactura = $t['idfactura']; |
| 46 | 46 | $this->procesado = $this->str2bool($t['procesado']); |
| 47 | - }else{ |
|
| 47 | + }else { |
|
| 48 | 48 | $this->id = null; |
| 49 | 49 | $this->idprogramacion = null; |
| 50 | 50 | $this->id_edificacion = null; |
@@ -54,13 +54,13 @@ discard block |
||
| 54 | 54 | } |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | - public function install(){ |
|
| 57 | + public function install() { |
|
| 58 | 58 | return ""; |
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | public function exists() |
| 62 | 62 | { |
| 63 | - if(is_null($this->id)) { |
|
| 63 | + if (is_null($this->id)) { |
|
| 64 | 64 | return false; |
| 65 | 65 | } |
| 66 | 66 | return true; |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | |
| 69 | 69 | public function save() |
| 70 | 70 | { |
| 71 | - if($this->exists()){ |
|
| 71 | + if ($this->exists()) { |
|
| 72 | 72 | $sql = "UPDATE ".$this->table_name." SET ". |
| 73 | 73 | "idfactura = ".$this->intval($this->idfactura).", ". |
| 74 | 74 | "codcliente = ".$this->var2str($this->codcliente).", ". |
@@ -78,16 +78,16 @@ discard block |
||
| 78 | 78 | "WHERE id = ".$this->intval($this->id).";"; |
| 79 | 79 | $data = $this->db->exec($sql); |
| 80 | 80 | return $data; |
| 81 | - } else { |
|
| 81 | + }else { |
|
| 82 | 82 | $sql = "INSERT INTO ".$this->table_name. |
| 83 | 83 | " (idprogramacion, id_edificacion, codcliente, procesado) VALUES (". |
| 84 | 84 | $this->intval($this->idprogramacion).", ". |
| 85 | 85 | $this->intval($this->id_edificacion).", ". |
| 86 | 86 | $this->var2str($this->codcliente).", ". |
| 87 | 87 | $this->var2str($this->procesado).");"; |
| 88 | - if($this->db->exec($sql)){ |
|
| 88 | + if ($this->db->exec($sql)) { |
|
| 89 | 89 | return true; |
| 90 | - }else{ |
|
| 90 | + }else { |
|
| 91 | 91 | return false; |
| 92 | 92 | } |
| 93 | 93 | } |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | $sql = "select * from ".$this->table_name." WHERE id = ".$this->intval($id); |
| 100 | 100 | $this->new_advice($sql); |
| 101 | 101 | $data = $this->db->select($sql); |
| 102 | - if($data) { |
|
| 102 | + if ($data) { |
|
| 103 | 103 | return new residentes_facturacion_programada_edificaciones($data[0]); |
| 104 | 104 | } |
| 105 | 105 | return false; |
@@ -110,8 +110,8 @@ discard block |
||
| 110 | 110 | $sql = "select * from ".$this->table_name." WHERE idprogramacion = ".$this->intval($idProg)." ORDER BY id"; |
| 111 | 111 | $data = $this->db->select($sql); |
| 112 | 112 | $lista = array(); |
| 113 | - if($data) { |
|
| 114 | - foreach($data as $d) { |
|
| 113 | + if ($data) { |
|
| 114 | + foreach ($data as $d) { |
|
| 115 | 115 | $lista[] = new residentes_facturacion_programada_edificaciones($d); |
| 116 | 116 | } |
| 117 | 117 | return $lista; |
@@ -125,8 +125,8 @@ discard block |
||
| 125 | 125 | " AND procesado = FALSE ORDER BY id"; |
| 126 | 126 | $data = $this->db->select($sql); |
| 127 | 127 | $lista = array(); |
| 128 | - if($data) { |
|
| 129 | - foreach($data as $d) { |
|
| 128 | + if ($data) { |
|
| 129 | + foreach ($data as $d) { |
|
| 130 | 130 | $lista[] = new residentes_facturacion_programada_edificaciones($d); |
| 131 | 131 | } |
| 132 | 132 | return $lista; |
@@ -203,11 +203,11 @@ discard block |
||
| 203 | 203 | public function getFacturasPorEnviar(int $idProgramacion, int $limit = 0) |
| 204 | 204 | { |
| 205 | 205 | $sql = "SELECT t1.*, t2.femail FROM ".$this->table_name." as t1, facturascli as t2 ". |
| 206 | - "WHERE idprogramacion = ".$this->intval($idProgramacion) . |
|
| 207 | - " AND t2.femail = ".$this->str2bool("FALSE") . |
|
| 206 | + "WHERE idprogramacion = ".$this->intval($idProgramacion). |
|
| 207 | + " AND t2.femail = ".$this->str2bool("FALSE"). |
|
| 208 | 208 | " AND t1.idfactura = t2.idfactura " |
| 209 | - ." AND "."estado = ".$this->var2str($status)." ORDER BY id, idfactura" . |
|
| 210 | - " LIMIT " . $limit; |
|
| 209 | + ." AND "."estado = ".$this->var2str($status)." ORDER BY id, idfactura". |
|
| 210 | + " LIMIT ".$limit; |
|
| 211 | 211 | $data = $this->db->select($sql); |
| 212 | 212 | $lista = array(); |
| 213 | 213 | if ($data) { |