| @@ -37,8 +37,8 @@ discard block | ||
| 37 | 37 | public $importe; | 
| 38 | 38 | |
| 39 | 39 |      public function __construct($t = FALSE) { | 
| 40 | -        parent::__construct('residentes_fact_prog_conceptos','plugins/residentes'); | |
| 41 | -        if($t){ | |
| 40 | +        parent::__construct('residentes_fact_prog_conceptos', 'plugins/residentes'); | |
| 41 | +        if ($t) { | |
| 42 | 42 | $this->id = $t['id']; | 
| 43 | 43 | $this->idprogramacion = $t['idprogramacion']; | 
| 44 | 44 | $this->referencia = $t['referencia']; | 
| @@ -46,7 +46,7 @@ discard block | ||
| 46 | 46 | $this->cantidad = floatval($t['cantidad']); | 
| 47 | 47 | $this->codimpuesto = $t['codimpuesto']; | 
| 48 | 48 | $this->importe = floatval($t['importe']); | 
| 49 | -        }else{ | |
| 49 | +        }else { | |
| 50 | 50 | $this->id = null; | 
| 51 | 51 | $this->idprogramacion = null; | 
| 52 | 52 | $this->referencia = ''; | 
| @@ -57,13 +57,13 @@ discard block | ||
| 57 | 57 | } | 
| 58 | 58 | } | 
| 59 | 59 | |
| 60 | -    public function install(){ | |
| 60 | +    public function install() { | |
| 61 | 61 | return ""; | 
| 62 | 62 | } | 
| 63 | 63 | |
| 64 | 64 | public function exists() | 
| 65 | 65 |      { | 
| 66 | -        if(is_null($this->id)) { | |
| 66 | +        if (is_null($this->id)) { | |
| 67 | 67 | return false; | 
| 68 | 68 | } | 
| 69 | 69 | return true; | 
| @@ -71,7 +71,7 @@ discard block | ||
| 71 | 71 | |
| 72 | 72 | public function save() | 
| 73 | 73 |      { | 
| 74 | -        if($this->exists()){ | |
| 74 | +        if ($this->exists()) { | |
| 75 | 75 | $sql = "UPDATE ".$this->table_name." SET ". | 
| 76 | 76 | "referencia = ".$this->var2str($this->referencia).", ". | 
| 77 | 77 | "pvp = ".$this->var2str($this->pvp).", ". | 
| @@ -81,7 +81,7 @@ discard block | ||
| 81 | 81 | "WHERE id = ".$this->intval($this->id).";"; | 
| 82 | 82 | $data = $this->db->exec($sql); | 
| 83 | 83 | return $data; | 
| 84 | -        }else{ | |
| 84 | +        }else { | |
| 85 | 85 | $sql = "INSERT INTO ".$this->table_name. | 
| 86 | 86 |              " (idprogramacion, referencia, pvp, cantidad, codimpuesto, importe) VALUES (". | 
| 87 | 87 | $this->intval($this->idprogramacion).", ". | 
| @@ -91,9 +91,9 @@ discard block | ||
| 91 | 91 | $this->var2str($this->codimpuesto).", ". | 
| 92 | 92 | $this->var2str($this->importe).");"; | 
| 93 | 93 | |
| 94 | -            if($this->db->exec($sql)){ | |
| 94 | +            if ($this->db->exec($sql)) { | |
| 95 | 95 | return true; | 
| 96 | -            }else{ | |
| 96 | +            }else { | |
| 97 | 97 | return false; | 
| 98 | 98 | } | 
| 99 | 99 | } | 
| @@ -104,7 +104,7 @@ discard block | ||
| 104 | 104 |      { | 
| 105 | 105 | $sql = "select * from ".$this->table_name." WHERE id = ".$this->intval($id); | 
| 106 | 106 | $data = $this->db->select($sql); | 
| 107 | -        if($data) { | |
| 107 | +        if ($data) { | |
| 108 | 108 | return new residentes_facturacion_programada_conceptos($data[0]); | 
| 109 | 109 | } | 
| 110 | 110 | return false; | 
| @@ -115,8 +115,8 @@ discard block | ||
| 115 | 115 | $sql = "select * from ".$this->table_name." WHERE idprogramacion = ".$this->intval($idProg)." ORDER BY id"; | 
| 116 | 116 | $data = $this->db->select($sql); | 
| 117 | 117 | $lista = array(); | 
| 118 | -        if($data) { | |
| 119 | -            foreach($data as $d) { | |
| 118 | +        if ($data) { | |
| 119 | +            foreach ($data as $d) { | |
| 120 | 120 | $lista[] = new residentes_facturacion_programada_conceptos($d); | 
| 121 | 121 | } | 
| 122 | 122 | return $lista; | 
| @@ -129,8 +129,8 @@ discard block | ||
| 129 | 129 | $sql = "select * from ".$this->table_name." WHERE fecha_envio = ".$this->var2str($date)." ORDER BY fecha_envio, hora_envio"; | 
| 130 | 130 | $data = $this->db->select($sql); | 
| 131 | 131 | $lista = array(); | 
| 132 | -        if($data) { | |
| 133 | -            foreach($data as $d) { | |
| 132 | +        if ($data) { | |
| 133 | +            foreach ($data as $d) { | |
| 134 | 134 | $lista[] = new residentes_facturacion_programada_conceptos($d); | 
| 135 | 135 | } | 
| 136 | 136 | return $lista; | 
| @@ -144,8 +144,8 @@ discard block | ||
| 144 | 144 | ." AND "."estado = ".$this->var2str($status)." ORDER BY fecha_envio, hora_envio"; | 
| 145 | 145 | $data = $this->db->select($sql); | 
| 146 | 146 | $lista = array(); | 
| 147 | -        if($data) { | |
| 148 | -            foreach($data as $d) { | |
| 147 | +        if ($data) { | |
| 148 | +            foreach ($data as $d) { | |
| 149 | 149 | $lista[] = new residentes_facturacion_programada_conceptos($d); | 
| 150 | 150 | } | 
| 151 | 151 | return $lista; | 
| @@ -158,8 +158,8 @@ discard block | ||
| 158 | 158 | $sql = "select * from ".$this->table_name." ORDER BY fecha_envio, hora_envio"; | 
| 159 | 159 | $data = $this->db->select($sql); | 
| 160 | 160 | $lista = array(); | 
| 161 | -        if($data) { | |
| 162 | -            foreach($data as $d) { | |
| 161 | +        if ($data) { | |
| 162 | +            foreach ($data as $d) { | |
| 163 | 163 | $lista[] = new residentes_facturacion_programada_conceptos($d); | 
| 164 | 164 | } | 
| 165 | 165 | return $lista; | 
| @@ -171,7 +171,7 @@ discard block | ||
| 171 | 171 |      { | 
| 172 | 172 | $sql = "DELETE from ".$this->table_name." WHERE id = ".$this->intval($this->id); | 
| 173 | 173 | $data = $this->db->exec($sql); | 
| 174 | -        if($data) { | |
| 174 | +        if ($data) { | |
| 175 | 175 | return true; | 
| 176 | 176 | } | 
| 177 | 177 | return false; | 
| @@ -22,7 +22,7 @@ | ||
| 22 | 22 | * | 
| 23 | 23 | * @author Joe Nilson <joenilson at gmail.com> | 
| 24 | 24 | */ | 
| 25 | -class residentes_edificaciones extends FacturaScripts\model\residentes_edificaciones{ | |
| 25 | +class residentes_edificaciones extends FacturaScripts\model\residentes_edificaciones { | |
| 26 | 26 | /** | 
| 27 | 27 | * @todo Clases específicas para este plugin | 
| 28 | 28 | */ | 
| @@ -75,10 +75,10 @@ discard block | ||
| 75 | 75 | $inq->fecha_ocupacion = null; | 
| 76 | 76 |                  if ($inq->save()) { | 
| 77 | 77 |                      $this->new_message('Inquilino removido correctamente.'); | 
| 78 | -                } else { | |
| 78 | +                }else { | |
| 79 | 79 |                      $this->new_error_msg('Error al remover el inquilino.'); | 
| 80 | 80 | } | 
| 81 | -            } else { | |
| 81 | +            }else { | |
| 82 | 82 |                  $this->new_error_msg('Inquilino no encontrado.'); | 
| 83 | 83 | } | 
| 84 | 84 | } | 
| @@ -188,22 +188,22 @@ discard block | ||
| 188 | 188 | public function buscar_residentes($param) | 
| 189 | 189 |      { | 
| 190 | 190 |          if (is_numeric($param)) { | 
| 191 | - $where = "(r.codcliente LIKE '%" . $param . "%'" | |
| 192 | - . " OR c.cifnif LIKE '%" . $param . "%'" | |
| 193 | - . " OR c.telefono1 LIKE '" . $param . "%'" | |
| 194 | - . " OR c.telefono2 LIKE '" . $param . "%'" | |
| 195 | - . " OR ca_telefono LIKE '" . $param . "%'" | |
| 196 | - . " OR r.observaciones LIKE '%" . $param . "%')"; | |
| 197 | -        } else { | |
| 191 | + $where = "(r.codcliente LIKE '%".$param."%'" | |
| 192 | + . " OR c.cifnif LIKE '%".$param."%'" | |
| 193 | + . " OR c.telefono1 LIKE '".$param."%'" | |
| 194 | + . " OR c.telefono2 LIKE '".$param."%'" | |
| 195 | + . " OR ca_telefono LIKE '".$param."%'" | |
| 196 | + . " OR r.observaciones LIKE '%".$param."%')"; | |
| 197 | +        }else { | |
| 198 | 198 |              $buscar = str_replace(' ', '%', $param); | 
| 199 | - $where = "(lower(nombre) LIKE '%" . $buscar . "%'" | |
| 200 | - . " OR lower(razonsocial) LIKE '%" . $buscar . "%'" | |
| 201 | - . " OR lower(ca_apellidos) LIKE '%" . $buscar . "%'" | |
| 202 | - . " OR lower(ca_nombres) LIKE '%" . $buscar . "%'" | |
| 203 | - . " OR lower(cifnif) LIKE '%" . $buscar . "%'" | |
| 204 | - . " OR lower(observaciones) LIKE '%" . $buscar . "%'" | |
| 205 | - . " OR lower(ca_email) LIKE '%" . $buscar . "%'" | |
| 206 | - . " OR lower(email) LIKE '%" . $buscar . "%')"; | |
| 199 | + $where = "(lower(nombre) LIKE '%".$buscar."%'" | |
| 200 | + . " OR lower(razonsocial) LIKE '%".$buscar."%'" | |
| 201 | + . " OR lower(ca_apellidos) LIKE '%".$buscar."%'" | |
| 202 | + . " OR lower(ca_nombres) LIKE '%".$buscar."%'" | |
| 203 | + . " OR lower(cifnif) LIKE '%".$buscar."%'" | |
| 204 | + . " OR lower(observaciones) LIKE '%".$buscar."%'" | |
| 205 | + . " OR lower(ca_email) LIKE '%".$buscar."%'" | |
| 206 | + . " OR lower(email) LIKE '%".$buscar."%')"; | |
| 207 | 207 | } | 
| 208 | 208 | return $where; | 
| 209 | 209 | } | 
| @@ -211,14 +211,14 @@ discard block | ||
| 211 | 211 | public function buscar_inmuebles($param) | 
| 212 | 212 |      { | 
| 213 | 213 |          if (is_numeric($param)) { | 
| 214 | - $where = " r.codigo LIKE '%" . $param . "%'" | |
| 215 | - . " OR r.numero LIKE '%" . $param . "%'" | |
| 216 | - . " OR CONCAT(r.codigo, r.numero) LIKE '%" . $param . "%'"; | |
| 217 | -        } else { | |
| 214 | + $where = " r.codigo LIKE '%".$param."%'" | |
| 215 | + . " OR r.numero LIKE '%".$param."%'" | |
| 216 | + . " OR CONCAT(r.codigo, r.numero) LIKE '%".$param."%'"; | |
| 217 | +        }else { | |
| 218 | 218 |              $buscar = str_replace(' ', '%', $param); | 
| 219 | - $where = " lower(r.codigo) LIKE '%" . $buscar . "%'" | |
| 220 | - . " OR lower(r.numero) LIKE '%" . $buscar . "%'" | |
| 221 | - . " OR CONCAT(lower(r.codigo), r.numero) LIKE '%" . $param . "%'"; | |
| 219 | + $where = " lower(r.codigo) LIKE '%".$buscar."%'" | |
| 220 | + . " OR lower(r.numero) LIKE '%".$buscar."%'" | |
| 221 | + . " OR CONCAT(lower(r.codigo), r.numero) LIKE '%".$param."%'"; | |
| 222 | 222 | } | 
| 223 | 223 | return $where; | 
| 224 | 224 | } | 
| @@ -226,19 +226,19 @@ discard block | ||
| 226 | 226 | public function buscar_vehiculos($param) | 
| 227 | 227 |      { | 
| 228 | 228 |          if (is_numeric($param)) { | 
| 229 | - $where = "(r.codcliente LIKE '%" . $param . "%'" | |
| 230 | - . " OR vehiculo_placa LIKE '%" . $param . "%'" | |
| 231 | - . " OR CAST(idvehiculo AS CHAR) LIKE '" . $param . "%'" | |
| 232 | - . " OR telefono2 LIKE '" . $param . "%'" | |
| 233 | - . " OR observaciones LIKE '%" . $param . "%')"; | |
| 234 | -        } else { | |
| 229 | + $where = "(r.codcliente LIKE '%".$param."%'" | |
| 230 | + . " OR vehiculo_placa LIKE '%".$param."%'" | |
| 231 | + . " OR CAST(idvehiculo AS CHAR) LIKE '".$param."%'" | |
| 232 | + . " OR telefono2 LIKE '".$param."%'" | |
| 233 | + . " OR observaciones LIKE '%".$param."%')"; | |
| 234 | +        }else { | |
| 235 | 235 |              $buscar = str_replace(' ', '%', $param); | 
| 236 | - $where = "(lower(vehiculo_marca) LIKE '%" . $buscar . "%'" | |
| 237 | - . " OR lower(vehiculo_modelo) LIKE '%" . $buscar . "%'" | |
| 238 | - . " OR lower(vehiculo_color) LIKE '%" . $buscar . "%'" | |
| 239 | - . " OR lower(vehiculo_placa) LIKE '%" . $buscar . "%'" | |
| 240 | - . " OR lower(vehiculo_tipo) LIKE '%" . $buscar . "%'" | |
| 241 | - . " OR lower(codigo_tarjeta) LIKE '%" . $buscar . "%')"; | |
| 236 | + $where = "(lower(vehiculo_marca) LIKE '%".$buscar."%'" | |
| 237 | + . " OR lower(vehiculo_modelo) LIKE '%".$buscar."%'" | |
| 238 | + . " OR lower(vehiculo_color) LIKE '%".$buscar."%'" | |
| 239 | + . " OR lower(vehiculo_placa) LIKE '%".$buscar."%'" | |
| 240 | + . " OR lower(vehiculo_tipo) LIKE '%".$buscar."%'" | |
| 241 | + . " OR lower(codigo_tarjeta) LIKE '%".$buscar."%')"; | |
| 242 | 242 | } | 
| 243 | 243 | return $where; | 
| 244 | 244 | } | 
| @@ -257,13 +257,13 @@ discard block | ||
| 257 | 257 | $inmueble->ocupado = true; | 
| 258 | 258 | $inmueble->codcliente = $codcliente; | 
| 259 | 259 | $inmueble->iddireccion = $this->actualizar_direccion_residente($codcliente, $iddireccion, $nueva_direccion); | 
| 260 | -            $inmueble->fecha_ocupacion = ($fecha_ocupacion)?\date('Y-m-d', strtotime($fecha_ocupacion)):null; | |
| 260 | +            $inmueble->fecha_ocupacion = ($fecha_ocupacion) ?\date('Y-m-d', strtotime($fecha_ocupacion)) : null; | |
| 261 | 261 | $inmueble->fecha_disponibilidad = ($fecha_disponibilidad) | 
| 262 | 262 |                  ?\date('Y-m-d', strtotime($fecha_disponibilidad)) | 
| 263 | 263 | :null; | 
| 264 | 264 |              if ($inmueble->save()) { | 
| 265 | 265 |                  $this->new_message('Residente agregado exitosamente.'); | 
| 266 | -            } else { | |
| 266 | +            }else { | |
| 267 | 267 |                  $this->new_error_msg('No se pudo agregar al residente confirme el nombre '. | 
| 268 | 268 | 'del residente y las fechs de ocupación y disponibilidad'); | 
| 269 | 269 | } | 
| @@ -275,7 +275,7 @@ discard block | ||
| 275 | 275 | $inmueble->fecha_disponibilidad = ''; | 
| 276 | 276 |              if ($inmueble->save()) { | 
| 277 | 277 |                  $this->new_message('Residente removido exitosamente.'); | 
| 278 | -            } else { | |
| 278 | +            }else { | |
| 279 | 279 |                  $this->new_error_msg('No se pudo remover al residente'); | 
| 280 | 280 | } | 
| 281 | 281 | } | 
| @@ -310,7 +310,7 @@ discard block | ||
| 310 | 310 | 'nombre' => $cli->nombre, | 
| 311 | 311 | 'asignado' => true); | 
| 312 | 312 | } | 
| 313 | -            } else { | |
| 313 | +            }else { | |
| 314 | 314 |                  $json[$cli->codcliente] = array('value' => $cli->nombre, | 
| 315 | 315 | 'data' => $cli->codcliente, | 
| 316 | 316 | 'nombre' => $cli->nombre, | 
| @@ -367,13 +367,13 @@ discard block | ||
| 367 | 367 | |
| 368 | 368 | public function paginas() | 
| 369 | 369 |      { | 
| 370 | - $url = $this->url() . "&query=" . $this->query | |
| 371 | - . "&query_r=" . $this->query_r | |
| 372 | - . "&query_v=" . $this->query_v | |
| 373 | - . "&query_i=" . $this->query_i | |
| 374 | - . "&orden=" . $this->order | |
| 375 | - . "&deudores=" . $this->deudores | |
| 376 | - . "&disponibles=" . $this->disponibles; | |
| 370 | + $url = $this->url()."&query=".$this->query | |
| 371 | + . "&query_r=".$this->query_r | |
| 372 | + . "&query_v=".$this->query_v | |
| 373 | + . "&query_i=".$this->query_i | |
| 374 | + . "&orden=".$this->order | |
| 375 | + . "&deudores=".$this->deudores | |
| 376 | + . "&disponibles=".$this->disponibles; | |
| 377 | 377 | |
| 378 | 378 | $paginas = array(); | 
| 379 | 379 | $i = 0; | 
| @@ -383,7 +383,7 @@ discard block | ||
| 383 | 383 | /// añadimos todas la página | 
| 384 | 384 |          while ($num < $this->total_resultados) { | 
| 385 | 385 | $paginas[$i] = array( | 
| 386 | - 'url' => $url . "&offset=" . ($i * FS_ITEM_LIMIT), | |
| 386 | + 'url' => $url."&offset=".($i * FS_ITEM_LIMIT), | |
| 387 | 387 | 'num' => $i + 1, | 
| 388 | 388 | 'actual' => ($num === $this->offset) | 
| 389 | 389 | ); | 
| @@ -398,20 +398,20 @@ discard block | ||
| 398 | 398 | |
| 399 | 399 | /// ahora descartamos | 
| 400 | 400 |          foreach ($paginas as $j => $value) { | 
| 401 | - $enmedio = (int)($i / 2); | |
| 401 | + $enmedio = (int) ($i / 2); | |
| 402 | 402 | |
| 403 | 403 | /** | 
| 404 | 404 | * descartamos todo excepto la primera, la última, la de enmedio, | 
| 405 | 405 | * la actual, las 5 anteriores y las 5 siguientes | 
| 406 | 406 | */ | 
| 407 | -            if (($j>1 && $j<$actual-5 && $j !== $enmedio) || ($j > $actual + 5 && $j < $i - 1 && $j !== $enmedio)) { | |
| 407 | +            if (($j > 1 && $j < $actual - 5 && $j !== $enmedio) || ($j > $actual + 5 && $j < $i - 1 && $j !== $enmedio)) { | |
| 408 | 408 | unset($paginas[$j]); | 
| 409 | 409 | } | 
| 410 | 410 | } | 
| 411 | 411 | |
| 412 | 412 |          if (count($paginas) > 1) { | 
| 413 | 413 | return $paginas; | 
| 414 | -        } else { | |
| 414 | +        }else { | |
| 415 | 415 | return array(); | 
| 416 | 416 | } | 
| 417 | 417 | } | 
| @@ -103,31 +103,31 @@ discard block | ||
| 103 | 103 | $ca_parentesco_obs = $this->clean_text(\filter_input(INPUT_POST, 'ca_parentesco_obs')); | 
| 104 | 104 | $vehiculos = \filter_input(INPUT_POST, 'vehiculos'); | 
| 105 | 105 | $cliinfo = new residentes_informacion(); | 
| 106 | - $cliinfo->codcliente=$codcliente; | |
| 107 | - $cliinfo->codigo=$codigo; | |
| 108 | - $cliinfo->ocupantes=$ocupantes; | |
| 109 | - $cliinfo->ocupantes5anos=$ocupantes5anos; | |
| 110 | - $cliinfo->ocupantes12anos=$ocupantes12anos; | |
| 111 | - $cliinfo->ocupantes18anos=$ocupantes18anos; | |
| 112 | - $cliinfo->ocupantes30anos=$ocupantes30anos; | |
| 113 | - $cliinfo->ocupantes50anos=$ocupantes50anos; | |
| 114 | - $cliinfo->ocupantes70anos=$ocupantes70anos; | |
| 115 | - $cliinfo->ocupantes71anos=$ocupantes71anos; | |
| 116 | - $cliinfo->informacion_discapacidad= $informacion_discapacidad; | |
| 117 | - $cliinfo->propietario= (bool)$propietario; | |
| 118 | - $cliinfo->profesion= $profesion; | |
| 119 | - $cliinfo->ocupacion= $ocupacion; | |
| 120 | - $cliinfo->ca_nombres= $ca_nombres; | |
| 121 | - $cliinfo->ca_apellidos= $ca_apellidos; | |
| 122 | - $cliinfo->ca_telefono= $ca_telefono; | |
| 123 | - $cliinfo->ca_email= $ca_email; | |
| 124 | - $cliinfo->ca_propietario= (bool)$ca_propietario; | |
| 125 | - $cliinfo->ca_parentesco= $ca_parentesco; | |
| 126 | - $cliinfo->ca_parentesco_obs= $ca_parentesco_obs; | |
| 127 | - $cliinfo->vehiculos= $vehiculos; | |
| 106 | + $cliinfo->codcliente = $codcliente; | |
| 107 | + $cliinfo->codigo = $codigo; | |
| 108 | + $cliinfo->ocupantes = $ocupantes; | |
| 109 | + $cliinfo->ocupantes5anos = $ocupantes5anos; | |
| 110 | + $cliinfo->ocupantes12anos = $ocupantes12anos; | |
| 111 | + $cliinfo->ocupantes18anos = $ocupantes18anos; | |
| 112 | + $cliinfo->ocupantes30anos = $ocupantes30anos; | |
| 113 | + $cliinfo->ocupantes50anos = $ocupantes50anos; | |
| 114 | + $cliinfo->ocupantes70anos = $ocupantes70anos; | |
| 115 | + $cliinfo->ocupantes71anos = $ocupantes71anos; | |
| 116 | + $cliinfo->informacion_discapacidad = $informacion_discapacidad; | |
| 117 | + $cliinfo->propietario = (bool) $propietario; | |
| 118 | + $cliinfo->profesion = $profesion; | |
| 119 | + $cliinfo->ocupacion = $ocupacion; | |
| 120 | + $cliinfo->ca_nombres = $ca_nombres; | |
| 121 | + $cliinfo->ca_apellidos = $ca_apellidos; | |
| 122 | + $cliinfo->ca_telefono = $ca_telefono; | |
| 123 | + $cliinfo->ca_email = $ca_email; | |
| 124 | + $cliinfo->ca_propietario = (bool) $ca_propietario; | |
| 125 | + $cliinfo->ca_parentesco = $ca_parentesco; | |
| 126 | + $cliinfo->ca_parentesco_obs = $ca_parentesco_obs; | |
| 127 | + $cliinfo->vehiculos = $vehiculos; | |
| 128 | 128 |              if ($cliinfo->save()) { | 
| 129 | 129 |                  $this->new_message('¡Información actualizada correctamente!'); | 
| 130 | -            } else { | |
| 130 | +            }else { | |
| 131 | 131 |                  $this->new_error_msg('Ocurrió un error al actualizar la información por favor revise los ". | 
| 132 | 132 | "datos ingresados e intente nuevamente.'); | 
| 133 | 133 | } | 
| @@ -162,7 +162,7 @@ discard block | ||
| 162 | 162 |          foreach ($extensiones as $ext) { | 
| 163 | 163 | $fsext0 = new fs_extension($ext); | 
| 164 | 164 |              if (!$fsext0->save()) { | 
| 165 | -                $this->new_error_msg('Imposible guardar los datos de la extensión ' . $ext['name'] . '.'); | |
| 165 | +                $this->new_error_msg('Imposible guardar los datos de la extensión '.$ext['name'].'.'); | |
| 166 | 166 | } | 
| 167 | 167 | } | 
| 168 | 168 | } | 
| @@ -56,7 +56,7 @@ discard block | ||
| 56 | 56 |              if (isset($i['deudas'])) { | 
| 57 | 57 | $this->deudas = floatval($i['deudas']); | 
| 58 | 58 | } | 
| 59 | -        } else { | |
| 59 | +        }else { | |
| 60 | 60 | $this->id = null; | 
| 61 | 61 | $this->codcliente = null; | 
| 62 | 62 |              $this->fechaalta = Date('d-m-Y'); | 
| @@ -89,8 +89,8 @@ discard block | ||
| 89 | 89 | return '-'; | 
| 90 | 90 |          } elseif (strlen($this->observaciones) < 60) { | 
| 91 | 91 | return $this->observaciones; | 
| 92 | -        } else { | |
| 93 | - return substr($this->observaciones, 0, 60) . '...'; | |
| 92 | +        }else { | |
| 93 | + return substr($this->observaciones, 0, 60).'...'; | |
| 94 | 94 | } | 
| 95 | 95 | } | 
| 96 | 96 | |
| @@ -99,16 +99,16 @@ discard block | ||
| 99 | 99 |          $data = $this->db->select("SELECT * FROM residentes WHERE id = ".$this->var2str($id).";"); | 
| 100 | 100 |          if ($data) { | 
| 101 | 101 | return new residente($data[0]); | 
| 102 | -        } else { | |
| 102 | +        }else { | |
| 103 | 103 | return false; | 
| 104 | 104 | } | 
| 105 | 105 | } | 
| 106 | 106 | |
| 107 | 107 | public function exists() | 
| 108 | 108 |      { | 
| 109 | -        if(is_null($this->id)) { | |
| 109 | +        if (is_null($this->id)) { | |
| 110 | 110 | return false; | 
| 111 | -        } else { | |
| 111 | +        }else { | |
| 112 | 112 |              return $this->db->select("SELECT * FROM residentes WHERE id = ".$this->var2str($this->id).";"); | 
| 113 | 113 | } | 
| 114 | 114 | } | 
| @@ -125,9 +125,9 @@ discard block | ||
| 125 | 125 | deudas = ".$this->var2str($this->deudas)." WHERE id = ".$this->var2str($this->id).";"; | 
| 126 | 126 | |
| 127 | 127 | return $this->db->exec($sql); | 
| 128 | -        } else { | |
| 128 | +        }else { | |
| 129 | 129 | $sql = "INSERT INTO residentes (codcliente,nombre,fechaalta,piso,bloque,mensualidad,agua,gas,". | 
| 130 | -            "observaciones,fechaagua,fechagas,deudas) " . "VALUES (".$this->var2str($this->codcliente).",". | |
| 130 | +            "observaciones,fechaagua,fechagas,deudas) "."VALUES (".$this->var2str($this->codcliente).",". | |
| 131 | 131 | $this->var2str($this->nombre).",".$this->var2str($this->fechaalta)."," | 
| 132 | 132 | .$this->var2str($this->piso).",".$this->var2str($this->bloque).",".$this->var2str($this->mensualidad)."," | 
| 133 | 133 | .$this->var2str($this->agua).",".$this->var2str($this->gas).",".$this->var2str($this->observaciones)."," | 
| @@ -136,7 +136,7 @@ discard block | ||
| 136 | 136 |              if ($this->db->exec($sql)) { | 
| 137 | 137 | $this->id = $this->db->lastval(); | 
| 138 | 138 | return true; | 
| 139 | -            } else { | |
| 139 | +            }else { | |
| 140 | 140 | return false; | 
| 141 | 141 | } | 
| 142 | 142 | } | 
| @@ -58,7 +58,7 @@ discard block | ||
| 58 | 58 |          if ($logo) { | 
| 59 | 59 | $type = pathinfo($logo, PATHINFO_EXTENSION); | 
| 60 | 60 | $data = file_get_contents($logo); | 
| 61 | - $this->factura_logo_uri = 'data:image/' . $type . ';base64,' . base64_encode($data); | |
| 61 | + $this->factura_logo_uri = 'data:image/'.$type.';base64,'.base64_encode($data); | |
| 62 | 62 | } | 
| 63 | 63 | |
| 64 | 64 |          if ($this->id) { | 
| @@ -71,13 +71,13 @@ discard block | ||
| 71 | 71 | $fac = new factura_cliente(); | 
| 72 | 72 | $this->factura = $fac->get($this->id); | 
| 73 | 73 | //Agregamos la cantidad de lineas multiplicadas por 4 | 
| 74 | - $this->sizeFactura+= count($this->factura->get_lineas())*8; | |
| 74 | + $this->sizeFactura += count($this->factura->get_lineas()) * 8; | |
| 75 | 75 | //Agregamos la linea de separación del total | 
| 76 | - $this->sizeFactura+=4; | |
| 76 | + $this->sizeFactura += 4; | |
| 77 | 77 | //Agregamos las 3 lineas de Neto, FS_IVA y Total | 
| 78 | - $this->sizeFactura+=12; | |
| 78 | + $this->sizeFactura += 12; | |
| 79 | 79 | //Agregamos un espacio de 4 lineas aprox | 
| 80 | - $this->sizeFactura+=20; | |
| 80 | + $this->sizeFactura += 20; | |
| 81 | 81 | $cli = new cliente(); | 
| 82 | 82 | $this->cliente = $cli->get($this->factura->codcliente); | 
| 83 | 83 | $facturas = $fac->all_from_cliente($this->factura->codcliente); | 
| @@ -89,12 +89,12 @@ discard block | ||
| 89 | 89 | 'fecha'=>$f->fecha, | 
| 90 | 90 | 'monto'=>$f->total | 
| 91 | 91 | ); | 
| 92 | - $this->sizeFactura+=4; | |
| 92 | + $this->sizeFactura += 4; | |
| 93 | 93 | $this->total_facturas_pendientes += $f->total; | 
| 94 | 94 | } | 
| 95 | 95 | } | 
| 96 | 96 | } | 
| 97 | - $this->sizeFactura+=20; | |
| 97 | + $this->sizeFactura += 20; | |
| 98 | 98 | } | 
| 99 | 99 | |
| 100 | 100 | public function url() | 
| @@ -120,8 +120,8 @@ discard block | ||
| 120 | 120 | 'page_from' => __CLASS__, | 
| 121 | 121 | 'page_to' => __CLASS__, | 
| 122 | 122 | 'type' => 'head', | 
| 123 | - 'text' => '<script src="' . | |
| 124 | - FS_PATH . | |
| 123 | + 'text' => '<script src="'. | |
| 124 | + FS_PATH. | |
| 125 | 125 | 'plugins/residentes/view/js/jspdf.min.js" type="text/javascript"></script>', | 
| 126 | 126 | 'params' => '' | 
| 127 | 127 | ), | 
| @@ -130,9 +130,9 @@ discard block | ||
| 130 | 130 | 'page_from' => __CLASS__, | 
| 131 | 131 | 'page_to' => __CLASS__, | 
| 132 | 132 | 'type' => 'head', | 
| 133 | - 'text' => '<script src="' . | |
| 134 | - FS_PATH . | |
| 135 | - 'plugins/residentes/view/js/jsPDF/plugins/split_text_to_size.min.js" ' . | |
| 133 | + 'text' => '<script src="'. | |
| 134 | + FS_PATH. | |
| 135 | + 'plugins/residentes/view/js/jsPDF/plugins/split_text_to_size.min.js" '. | |
| 136 | 136 | 'type="text/javascript"></script>', | 
| 137 | 137 | 'params' => '' | 
| 138 | 138 | ), | 
| @@ -68,14 +68,14 @@ discard block | ||
| 68 | 68 |              if ($accion === 'agregar') { | 
| 69 | 69 |                  if ($vehiculo->save()) { | 
| 70 | 70 |                      $this->new_message('Vehiculo agregado exitosamente'); | 
| 71 | -                } else { | |
| 71 | +                }else { | |
| 72 | 72 |                      $this->new_error_msg('No se pudieron agregar los datos del vehiculo, revise la información e ". | 
| 73 | 73 | "intentelo nuevamente.'); | 
| 74 | 74 | } | 
| 75 | 75 |              } elseif ($accion === 'eliminar') { | 
| 76 | 76 |                  if ($vehiculo->delete()) { | 
| 77 | 77 |                      $this->new_message('Vehiculo eliminado exitosamente'); | 
| 78 | -                } else { | |
| 78 | +                }else { | |
| 79 | 79 |                      $this->new_error_msg('No se pudieron eliminar los datos del vehiculo, revise la información e ". | 
| 80 | 80 | "intentelo nuevamente.'); | 
| 81 | 81 | } | 
| @@ -110,7 +110,7 @@ discard block | ||
| 110 | 110 |          foreach ($extensiones as $ext) { | 
| 111 | 111 | $fsext0 = new fs_extension($ext); | 
| 112 | 112 |              if (!$fsext0->save()) { | 
| 113 | -                $this->new_error_msg('Imposible guardar los datos de la extensión ' . $ext['name'] . '.'); | |
| 113 | +                $this->new_error_msg('Imposible guardar los datos de la extensión '.$ext['name'].'.'); | |
| 114 | 114 | } | 
| 115 | 115 | } | 
| 116 | 116 | } | 
| @@ -22,7 +22,7 @@ discard block | ||
| 22 | 22 | * | 
| 23 | 23 | * @author Joe Nilson <joenilson at gmail.com> | 
| 24 | 24 | */ | 
| 25 | -class residentes_ayudas extends \fs_model{ | |
| 25 | +class residentes_ayudas extends \fs_model { | |
| 26 | 26 | /** | 
| 27 | 27 | * El codigo de la ayuda ya sea para parentesco u ocupacion | 
| 28 | 28 | * @var string | 
| @@ -39,19 +39,19 @@ discard block | ||
| 39 | 39 | */ | 
| 40 | 40 | public $descripcion; | 
| 41 | 41 |      public function __construct($t = FALSE) { | 
| 42 | -        parent::__construct('residentes_ayudas','plugins/residentes'); | |
| 43 | -        if($t){ | |
| 42 | +        parent::__construct('residentes_ayudas', 'plugins/residentes'); | |
| 43 | +        if ($t) { | |
| 44 | 44 | $this->codigo = $t['codigo']; | 
| 45 | 45 | $this->tipo = $t['tipo']; | 
| 46 | 46 | $this->descripcion = $t['descripcion']; | 
| 47 | -        }else{ | |
| 47 | +        }else { | |
| 48 | 48 | $this->codigo = null; | 
| 49 | 49 | $this->tipo = null; | 
| 50 | 50 | $this->descripcion = null; | 
| 51 | 51 | } | 
| 52 | 52 | } | 
| 53 | 53 | |
| 54 | -    public function install(){ | |
| 54 | +    public function install() { | |
| 55 | 55 | return "insert into residentes_ayudas (codigo,tipo, descripcion) VALUES ". | 
| 56 | 56 |              "('EMPPUB','OCUPACION','Empleado Publico'),". | 
| 57 | 57 |              "('EMPRI','OCUPACION','Empleado Privado'),". | 
| @@ -65,66 +65,66 @@ discard block | ||
| 65 | 65 |              "('HIJO','PARENTESCO','HermanHijo (a)');"; | 
| 66 | 66 | } | 
| 67 | 67 | |
| 68 | -    public function all(){ | |
| 68 | +    public function all() { | |
| 69 | 69 | $sql = "SELECT * FROM ".$this->table_name." ORDER BY tipo,codigo"; | 
| 70 | 70 | $data = $this->db->select($sql); | 
| 71 | -        if($data){ | |
| 71 | +        if ($data) { | |
| 72 | 72 | $lista = array(); | 
| 73 | -            foreach($data as $d){ | |
| 73 | +            foreach ($data as $d) { | |
| 74 | 74 | $lista[] = new residentes_ayudas($d); | 
| 75 | 75 | } | 
| 76 | 76 | return $lista; | 
| 77 | -        }else{ | |
| 77 | +        }else { | |
| 78 | 78 | return false; | 
| 79 | 79 | } | 
| 80 | 80 | } | 
| 81 | 81 | |
| 82 | -    public function all_tipo($tipo){ | |
| 82 | +    public function all_tipo($tipo) { | |
| 83 | 83 | $sql = "SELECT * FROM ".$this->table_name." WHERE tipo = ".$this->var2str($tipo)." ORDER BY codigo"; | 
| 84 | 84 | $data = $this->db->select($sql); | 
| 85 | -        if($data){ | |
| 85 | +        if ($data) { | |
| 86 | 86 | $lista = array(); | 
| 87 | -            foreach($data as $d){ | |
| 87 | +            foreach ($data as $d) { | |
| 88 | 88 | $lista[] = new residentes_ayudas($d); | 
| 89 | 89 | } | 
| 90 | 90 | return $lista; | 
| 91 | -        }else{ | |
| 91 | +        }else { | |
| 92 | 92 | return false; | 
| 93 | 93 | } | 
| 94 | 94 | } | 
| 95 | 95 | |
| 96 | -    public function get($codigo,$tipo){ | |
| 96 | +    public function get($codigo, $tipo) { | |
| 97 | 97 | $sql = "SELECT * FROM ".$this->table_name." WHERE codigo = ".$this->var2str($codigo)." AND tipo = ".$this->var2str($tipo).";"; | 
| 98 | 98 | $data = $this->db->select($sql); | 
| 99 | -        if($data){ | |
| 99 | +        if ($data) { | |
| 100 | 100 | return new residentes_ayudas($data[0]); | 
| 101 | -        }else{ | |
| 101 | +        }else { | |
| 102 | 102 | return false; | 
| 103 | 103 | } | 
| 104 | 104 | } | 
| 105 | 105 | |
| 106 | 106 |      public function exists() { | 
| 107 | -        if(is_null($this->codigo)){ | |
| 107 | +        if (is_null($this->codigo)) { | |
| 108 | 108 | return false; | 
| 109 | -        }else{ | |
| 110 | - return $this->get($this->codigo,$this->tipo); | |
| 109 | +        }else { | |
| 110 | + return $this->get($this->codigo, $this->tipo); | |
| 111 | 111 | } | 
| 112 | 112 | } | 
| 113 | 113 | |
| 114 | 114 |      public function save() { | 
| 115 | -        if($this->exists()){ | |
| 115 | +        if ($this->exists()) { | |
| 116 | 116 | $sql = "UPDATE ".$this->table_name." SET ". | 
| 117 | 117 | "descripcion = ".$this->var2str($this->descripcion)." ". | 
| 118 | 118 | "WHERE codigo = ".$this->var2str($this->codigo)." AND tipo = ".$this->var2str($this->tipo).";"; | 
| 119 | 119 | return $this->db->exec($sql); | 
| 120 | -        }else{ | |
| 120 | +        }else { | |
| 121 | 121 |              $sql = "INSERT INTO ".$this->table_name." (codigo, tipo, descripcion) VALUES (". | 
| 122 | 122 | $this->var2str($this->codigo).", ". | 
| 123 | 123 | $this->var2str($this->tipo).", ". | 
| 124 | 124 | $this->var2str($this->descripcion).");"; | 
| 125 | -            if($this->db->exec($sql)){ | |
| 125 | +            if ($this->db->exec($sql)) { | |
| 126 | 126 | return $this->db->lastval(); | 
| 127 | -            }else{ | |
| 127 | +            }else { | |
| 128 | 128 | return false; | 
| 129 | 129 | } | 
| 130 | 130 | } | 
| @@ -58,7 +58,7 @@ discard block | ||
| 58 | 58 |          if ($logo) { | 
| 59 | 59 | $type = pathinfo($logo, PATHINFO_EXTENSION); | 
| 60 | 60 | $data = file_get_contents($logo); | 
| 61 | - $this->factura_logo_uri = 'data:image/' . $type . ';base64,' . base64_encode($data); | |
| 61 | + $this->factura_logo_uri = 'data:image/'.$type.';base64,'.base64_encode($data); | |
| 62 | 62 | } | 
| 63 | 63 | |
| 64 | 64 |          if ($this->id) { | 
| @@ -71,13 +71,13 @@ discard block | ||
| 71 | 71 | $fac = new factura_cliente(); | 
| 72 | 72 | $this->factura = $fac->get($this->id); | 
| 73 | 73 | //Agregamos la cantidad de lineas multiplicadas por 4 | 
| 74 | - $this->sizeFactura+= count($this->factura->get_lineas())*8; | |
| 74 | + $this->sizeFactura += count($this->factura->get_lineas()) * 8; | |
| 75 | 75 | //Agregamos la linea de separación del total | 
| 76 | - $this->sizeFactura+=4; | |
| 76 | + $this->sizeFactura += 4; | |
| 77 | 77 | //Agregamos las 3 lineas de Neto, FS_IVA y Total | 
| 78 | - $this->sizeFactura+=12; | |
| 78 | + $this->sizeFactura += 12; | |
| 79 | 79 | //Agregamos un espacio de 4 lineas aprox | 
| 80 | - $this->sizeFactura+=20; | |
| 80 | + $this->sizeFactura += 20; | |
| 81 | 81 | $cli = new cliente(); | 
| 82 | 82 | $this->cliente = $cli->get($this->factura->codcliente); | 
| 83 | 83 | $facturas = $fac->all_from_cliente($this->factura->codcliente); | 
| @@ -89,12 +89,12 @@ discard block | ||
| 89 | 89 | 'fecha'=>$f->fecha, | 
| 90 | 90 | 'monto'=>$f->total | 
| 91 | 91 | ); | 
| 92 | - $this->sizeFactura+=4; | |
| 92 | + $this->sizeFactura += 4; | |
| 93 | 93 | $this->total_facturas_pendientes += $f->total; | 
| 94 | 94 | } | 
| 95 | 95 | } | 
| 96 | 96 | } | 
| 97 | - $this->sizeFactura+=20; | |
| 97 | + $this->sizeFactura += 20; | |
| 98 | 98 | } | 
| 99 | 99 | |
| 100 | 100 | public function url() | 
| @@ -120,8 +120,8 @@ discard block | ||
| 120 | 120 | 'page_from' => __CLASS__, | 
| 121 | 121 | 'page_to' => __CLASS__, | 
| 122 | 122 | 'type' => 'head', | 
| 123 | - 'text' => '<script src="' . | |
| 124 | - FS_PATH . | |
| 123 | + 'text' => '<script src="'. | |
| 124 | + FS_PATH. | |
| 125 | 125 | 'plugins/residentes/view/js/jspdf.min.js" type="text/javascript"></script>', | 
| 126 | 126 | 'params' => '' | 
| 127 | 127 | ), | 
| @@ -130,9 +130,9 @@ discard block | ||
| 130 | 130 | 'page_from' => __CLASS__, | 
| 131 | 131 | 'page_to' => __CLASS__, | 
| 132 | 132 | 'type' => 'head', | 
| 133 | - 'text' => '<script src="' . | |
| 134 | - FS_PATH . | |
| 135 | - 'plugins/residentes/view/js/jsPDF/plugins/split_text_to_size.min.js" ' . | |
| 133 | + 'text' => '<script src="'. | |
| 134 | + FS_PATH. | |
| 135 | + 'plugins/residentes/view/js/jsPDF/plugins/split_text_to_size.min.js" '. | |
| 136 | 136 | 'type="text/javascript"></script>', | 
| 137 | 137 | 'params' => '' | 
| 138 | 138 | ), |