@@ -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 | } |
@@ -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) { |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | * @author Joe Nilson <joenilson at gmail.com> |
25 | 25 | * @version 1 |
26 | 26 | */ |
27 | -class residentes_informacion extends \fs_model{ |
|
27 | +class residentes_informacion extends \fs_model { |
|
28 | 28 | /** |
29 | 29 | * Codigo del cliente |
30 | 30 | * @var string |
@@ -142,60 +142,60 @@ discard block |
||
142 | 142 | { |
143 | 143 | parent::__construct('residentes_informacion', 'plugins/residentes'); |
144 | 144 | if ($t) { |
145 | - $this->codcliente=$t['codcliente']; |
|
146 | - $this->codigo=$t['codigo']; |
|
147 | - $this->ocupantes=$t['ocupantes']; |
|
148 | - $this->ocupantes5anos=$t['ocupantes5anos']; |
|
149 | - $this->ocupantes12anos=$t['ocupantes12anos']; |
|
150 | - $this->ocupantes18anos=$t['ocupantes18anos']; |
|
151 | - $this->ocupantes30anos=$t['ocupantes30anos']; |
|
152 | - $this->ocupantes50anos=$t['ocupantes50anos']; |
|
153 | - $this->ocupantes70anos=$t['ocupantes70anos']; |
|
154 | - $this->ocupantes71anos=$t['ocupantes71anos']; |
|
155 | - $this->informacion_discapacidad=$t['informacion_discapacidad']; |
|
156 | - $this->propietario=$this->str2bool($t['propietario']); |
|
157 | - $this->profesion=$t['profesion']; |
|
158 | - $this->ocupacion=$t['ocupacion']; |
|
159 | - $this->ca_nombres=$t['ca_nombres']; |
|
160 | - $this->ca_apellidos=$t['ca_apellidos']; |
|
161 | - $this->ca_telefono=$t['ca_telefono']; |
|
162 | - $this->ca_email=$t['ca_email']; |
|
163 | - $this->ca_propietario=$this->str2bool($t['ca_propietario']); |
|
164 | - $this->ca_parentesco=$t['ca_parentesco']; |
|
165 | - $this->ca_parentesco_obs=$t['ca_parentesco_obs']; |
|
166 | - $this->vehiculos=$t['vehiculos']; |
|
167 | - } else { |
|
168 | - $this->codcliente=NULL; |
|
169 | - $this->codigo=NULL; |
|
170 | - $this->ocupantes=NULL; |
|
171 | - $this->ocupantes5anos=NULL; |
|
172 | - $this->ocupantes12anos=NULL; |
|
173 | - $this->ocupantes18anos=NULL; |
|
174 | - $this->ocupantes30anos=NULL; |
|
175 | - $this->ocupantes50anos=NULL; |
|
176 | - $this->ocupantes70anos=NULL; |
|
177 | - $this->ocupantes71anos=NULL; |
|
178 | - $this->informacion_discapacidad=NULL; |
|
179 | - $this->propietario='FALSE'; |
|
180 | - $this->profesion=NULL; |
|
181 | - $this->ocupacion=NULL; |
|
182 | - $this->ca_nombres=NULL; |
|
183 | - $this->ca_apellidos=NULL; |
|
184 | - $this->ca_telefono=NULL; |
|
185 | - $this->ca_email=NULL; |
|
186 | - $this->ca_propietario='FALSE'; |
|
187 | - $this->ca_parentesco=NULL; |
|
188 | - $this->ca_parentesco_obs=''; |
|
189 | - $this->vehiculos=0; |
|
145 | + $this->codcliente = $t['codcliente']; |
|
146 | + $this->codigo = $t['codigo']; |
|
147 | + $this->ocupantes = $t['ocupantes']; |
|
148 | + $this->ocupantes5anos = $t['ocupantes5anos']; |
|
149 | + $this->ocupantes12anos = $t['ocupantes12anos']; |
|
150 | + $this->ocupantes18anos = $t['ocupantes18anos']; |
|
151 | + $this->ocupantes30anos = $t['ocupantes30anos']; |
|
152 | + $this->ocupantes50anos = $t['ocupantes50anos']; |
|
153 | + $this->ocupantes70anos = $t['ocupantes70anos']; |
|
154 | + $this->ocupantes71anos = $t['ocupantes71anos']; |
|
155 | + $this->informacion_discapacidad = $t['informacion_discapacidad']; |
|
156 | + $this->propietario = $this->str2bool($t['propietario']); |
|
157 | + $this->profesion = $t['profesion']; |
|
158 | + $this->ocupacion = $t['ocupacion']; |
|
159 | + $this->ca_nombres = $t['ca_nombres']; |
|
160 | + $this->ca_apellidos = $t['ca_apellidos']; |
|
161 | + $this->ca_telefono = $t['ca_telefono']; |
|
162 | + $this->ca_email = $t['ca_email']; |
|
163 | + $this->ca_propietario = $this->str2bool($t['ca_propietario']); |
|
164 | + $this->ca_parentesco = $t['ca_parentesco']; |
|
165 | + $this->ca_parentesco_obs = $t['ca_parentesco_obs']; |
|
166 | + $this->vehiculos = $t['vehiculos']; |
|
167 | + }else { |
|
168 | + $this->codcliente = NULL; |
|
169 | + $this->codigo = NULL; |
|
170 | + $this->ocupantes = NULL; |
|
171 | + $this->ocupantes5anos = NULL; |
|
172 | + $this->ocupantes12anos = NULL; |
|
173 | + $this->ocupantes18anos = NULL; |
|
174 | + $this->ocupantes30anos = NULL; |
|
175 | + $this->ocupantes50anos = NULL; |
|
176 | + $this->ocupantes70anos = NULL; |
|
177 | + $this->ocupantes71anos = NULL; |
|
178 | + $this->informacion_discapacidad = NULL; |
|
179 | + $this->propietario = 'FALSE'; |
|
180 | + $this->profesion = NULL; |
|
181 | + $this->ocupacion = NULL; |
|
182 | + $this->ca_nombres = NULL; |
|
183 | + $this->ca_apellidos = NULL; |
|
184 | + $this->ca_telefono = NULL; |
|
185 | + $this->ca_email = NULL; |
|
186 | + $this->ca_propietario = 'FALSE'; |
|
187 | + $this->ca_parentesco = NULL; |
|
188 | + $this->ca_parentesco_obs = ''; |
|
189 | + $this->vehiculos = 0; |
|
190 | 190 | } |
191 | 191 | $this->cliente = new cliente(); |
192 | 192 | } |
193 | 193 | |
194 | - public function install(){ |
|
194 | + public function install() { |
|
195 | 195 | return ""; |
196 | 196 | } |
197 | 197 | |
198 | - public function info_adicional($i){ |
|
198 | + public function info_adicional($i) { |
|
199 | 199 | $data = $this->cliente->get($i->codcliente); |
200 | 200 | $i->nombre = $data->nombre; |
201 | 201 | $i->telefono1 = $data->telefono1; |
@@ -205,17 +205,17 @@ discard block |
||
205 | 205 | return $i; |
206 | 206 | } |
207 | 207 | |
208 | - public function all(){ |
|
208 | + public function all() { |
|
209 | 209 | $sql = "SELECT * FROM ".$this->table_name." ORDER BY codcliente"; |
210 | 210 | $data = $this->db->select($sql); |
211 | - if($data){ |
|
211 | + if ($data) { |
|
212 | 212 | $lista = array(); |
213 | - foreach($data as $d){ |
|
213 | + foreach ($data as $d) { |
|
214 | 214 | $item = new residentes_informacion($d); |
215 | 215 | $lista[] = $item->info_adicional($item); |
216 | 216 | } |
217 | 217 | return $lista; |
218 | - }else{ |
|
218 | + }else { |
|
219 | 219 | return false; |
220 | 220 | } |
221 | 221 | } |
@@ -227,14 +227,14 @@ discard block |
||
227 | 227 | * @param integer $padre_tipo |
228 | 228 | * @return \FacturaScripts\model\residentes_informacion|boolean |
229 | 229 | */ |
230 | - public function get($codcliente){ |
|
230 | + public function get($codcliente) { |
|
231 | 231 | $sql = "SELECT * FROM ".$this->table_name. |
232 | 232 | " WHERE codcliente = ".$this->var2str($codcliente).";"; |
233 | 233 | $data = $this->db->select($sql); |
234 | - if($data){ |
|
234 | + if ($data) { |
|
235 | 235 | $item = new residentes_informacion($data[0]); |
236 | 236 | return $item->info_adicional($item); |
237 | - }else{ |
|
237 | + }else { |
|
238 | 238 | return false; |
239 | 239 | } |
240 | 240 | } |
@@ -245,32 +245,32 @@ discard block |
||
245 | 245 | * @param string $value |
246 | 246 | * @return boolean|\FacturaScripts\model\residentes_informacion |
247 | 247 | */ |
248 | - public function get_by_field($field,$value){ |
|
249 | - $query = (is_string($value))?$this->var2str($value):$this->intval($value); |
|
248 | + public function get_by_field($field, $value) { |
|
249 | + $query = (is_string($value)) ? $this->var2str($value) : $this->intval($value); |
|
250 | 250 | $sql = "SELECT * FROM ".$this->table_name." WHERE ".strtoupper(trim($field))." = ".$query.";"; |
251 | 251 | $data = $this->db->select($sql); |
252 | - if($data){ |
|
252 | + if ($data) { |
|
253 | 253 | $lista = array(); |
254 | - foreach($data as $d){ |
|
254 | + foreach ($data as $d) { |
|
255 | 255 | $item = new residentes_informacion($d); |
256 | 256 | $lista[] = $item->info_adicional($item); |
257 | 257 | } |
258 | 258 | return $lista; |
259 | - }else{ |
|
259 | + }else { |
|
260 | 260 | return false; |
261 | 261 | } |
262 | 262 | } |
263 | 263 | |
264 | 264 | public function exists() { |
265 | - if(!$this->get($this->codcliente)){ |
|
265 | + if (!$this->get($this->codcliente)) { |
|
266 | 266 | return false; |
267 | - }else{ |
|
267 | + }else { |
|
268 | 268 | return $this->get($this->codcliente); |
269 | 269 | } |
270 | 270 | } |
271 | 271 | |
272 | 272 | public function save() { |
273 | - if($this->exists()){ |
|
273 | + if ($this->exists()) { |
|
274 | 274 | $sql = "UPDATE ".$this->table_name." SET ". |
275 | 275 | "codigo = ".$this->var2str($this->codigo).", ". |
276 | 276 | "ocupantes = ".$this->intval($this->ocupantes).", ". |
@@ -295,7 +295,7 @@ discard block |
||
295 | 295 | "vehiculos = ".$this->intval($this->vehiculos)." ". |
296 | 296 | "WHERE codcliente = ".$this->var2str($this->codcliente).";"; |
297 | 297 | return $this->db->exec($sql); |
298 | - }else{ |
|
298 | + }else { |
|
299 | 299 | $sql = "INSERT INTO ".$this->table_name." (codcliente, codigo, ocupantes, ocupantes5anos, ocupantes12anos, ocupantes18anos, ocupantes30anos, ocupantes50anos, ocupantes70anos, ocupantes71anos, informacion_discapacidad, propietario, profesion, ocupacion, ca_nombres, ca_apellidos, ca_telefono, ca_email, ca_propietario, ca_parentesco, ca_parentesco_obs, vehiculos) VALUES (". |
300 | 300 | $this->var2str($this->codcliente).", ". |
301 | 301 | $this->var2str($this->codigo).", ". |
@@ -319,9 +319,9 @@ discard block |
||
319 | 319 | $this->var2str($this->ca_parentesco).", ". |
320 | 320 | $this->var2str($this->ca_parentesco_obs).", ". |
321 | 321 | $this->intval($this->vehiculos).");"; |
322 | - if($this->db->exec($sql)){ |
|
322 | + if ($this->db->exec($sql)) { |
|
323 | 323 | return true; |
324 | - }else{ |
|
324 | + }else { |
|
325 | 325 | return false; |
326 | 326 | } |
327 | 327 | } |
@@ -335,14 +335,14 @@ discard block |
||
335 | 335 | $clilist = array(); |
336 | 336 | $query = mb_strtolower($this->no_html($busqueda), 'UTF8'); |
337 | 337 | |
338 | - $consulta = "SELECT * FROM " . $this->table_name . " WHERE "; |
|
338 | + $consulta = "SELECT * FROM ".$this->table_name." WHERE "; |
|
339 | 339 | if (is_numeric($query)) { |
340 | - $consulta .= "(ca_telefono LIKE '%" . $query . "%' OR codigo LIKE '%" . $query . "%')"; |
|
341 | - } else { |
|
340 | + $consulta .= "(ca_telefono LIKE '%".$query."%' OR codigo LIKE '%".$query."%')"; |
|
341 | + }else { |
|
342 | 342 | $buscar = str_replace(' ', '%', $query); |
343 | - $consulta .= "(lower(ca_nombres) LIKE '%" . $buscar . "%' OR lower(ca_apellidos) LIKE '%" . $buscar . "%'" |
|
344 | - . " OR lower(ocupacion) LIKE '%" . $buscar . "%' OR lower(profesion) LIKE '%" . $buscar . "%'" |
|
345 | - . " OR lower(ca_email) LIKE '%" . $buscar . "%')"; |
|
343 | + $consulta .= "(lower(ca_nombres) LIKE '%".$buscar."%' OR lower(ca_apellidos) LIKE '%".$buscar."%'" |
|
344 | + . " OR lower(ocupacion) LIKE '%".$buscar."%' OR lower(profesion) LIKE '%".$buscar."%'" |
|
345 | + . " OR lower(ca_email) LIKE '%".$buscar."%')"; |
|
346 | 346 | } |
347 | 347 | $consulta .= " ORDER BY codcliente ASC"; |
348 | 348 |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | * |
23 | 23 | * @author Joe Nilson <joenilson at gmail.com> |
24 | 24 | */ |
25 | -class residentes_edificaciones_tipo extends \fs_model{ |
|
25 | +class residentes_edificaciones_tipo extends \fs_model { |
|
26 | 26 | /** |
27 | 27 | * El Id del tipo de edificacion |
28 | 28 | * @var integer serial |
@@ -39,19 +39,19 @@ discard block |
||
39 | 39 | */ |
40 | 40 | public $padre; |
41 | 41 | public function __construct($t = FALSE) { |
42 | - parent::__construct('residentes_edificaciones_tipo','plugins/residentes'); |
|
43 | - if($t){ |
|
42 | + parent::__construct('residentes_edificaciones_tipo', 'plugins/residentes'); |
|
43 | + if ($t) { |
|
44 | 44 | $this->id = $t['id']; |
45 | 45 | $this->descripcion = $t['descripcion']; |
46 | 46 | $this->padre = $t['padre']; |
47 | - }else{ |
|
47 | + }else { |
|
48 | 48 | $this->id = null; |
49 | 49 | $this->descripcion = null; |
50 | 50 | $this->padre = null; |
51 | 51 | } |
52 | 52 | } |
53 | 53 | |
54 | - public function install(){ |
|
54 | + public function install() { |
|
55 | 55 | return "insert into residentes_edificaciones_tipo (descripcion) VALUES ('Bloque');"; |
56 | 56 | } |
57 | 57 | |
@@ -65,17 +65,17 @@ discard block |
||
65 | 65 | $lista[] = new residentes_edificaciones_tipo($d); |
66 | 66 | } |
67 | 67 | return $lista; |
68 | - } else { |
|
68 | + }else { |
|
69 | 69 | return false; |
70 | 70 | } |
71 | 71 | } |
72 | 72 | |
73 | - public function get($id){ |
|
73 | + public function get($id) { |
|
74 | 74 | $sql = "SELECT * FROM ".$this->table_name." WHERE id = ".$this->intval($id).";"; |
75 | 75 | $data = $this->db->select($sql); |
76 | - if($data){ |
|
76 | + if ($data) { |
|
77 | 77 | return new residentes_edificaciones_tipo($data[0]); |
78 | - }else{ |
|
78 | + }else { |
|
79 | 79 | return false; |
80 | 80 | } |
81 | 81 | } |
@@ -86,43 +86,43 @@ discard block |
||
86 | 86 | * @param string|integer $value |
87 | 87 | * @return boolean|\FacturaScripts\model\residentes_edificaciones_tipo |
88 | 88 | */ |
89 | - public function get_by_field($field,$value){ |
|
90 | - $query = (is_string($value))?$this->var2str($value):$this->intval($value); |
|
89 | + public function get_by_field($field, $value) { |
|
90 | + $query = (is_string($value)) ? $this->var2str($value) : $this->intval($value); |
|
91 | 91 | $sql = "SELECT * FROM ".$this->table_name." WHERE ".strtoupper(trim($field))." = ".$query.";"; |
92 | 92 | $data = $this->db->select($sql); |
93 | - if($data){ |
|
93 | + if ($data) { |
|
94 | 94 | $lista = array(); |
95 | - foreach($data as $d){ |
|
96 | - $lista[] = new residentes_edificaciones_tipo($d); |
|
95 | + foreach ($data as $d) { |
|
96 | + $lista[] = new residentes_edificaciones_tipo($d); |
|
97 | 97 | } |
98 | 98 | return $lista; |
99 | - }else{ |
|
99 | + }else { |
|
100 | 100 | return false; |
101 | 101 | } |
102 | 102 | } |
103 | 103 | |
104 | 104 | public function exists() { |
105 | - if(is_null($this->id)){ |
|
105 | + if (is_null($this->id)) { |
|
106 | 106 | return false; |
107 | - }else{ |
|
107 | + }else { |
|
108 | 108 | return $this->get($this->id); |
109 | 109 | } |
110 | 110 | } |
111 | 111 | |
112 | 112 | public function save() { |
113 | - if($this->exists()){ |
|
113 | + if ($this->exists()) { |
|
114 | 114 | $sql = "UPDATE ".$this->table_name." SET ". |
115 | 115 | "descripcion = ".$this->var2str($this->descripcion).", ". |
116 | 116 | "padre = ".$this->intval($this->padre)." ". |
117 | 117 | "WHERE id = ".$this->intval($this->id).";"; |
118 | 118 | return $this->db->exec($sql); |
119 | - }else{ |
|
119 | + }else { |
|
120 | 120 | $sql = "INSERT INTO ".$this->table_name." (descripcion, padre) VALUES (". |
121 | 121 | $this->var2str($this->descripcion).", ". |
122 | 122 | $this->intval($this->padre).");"; |
123 | - if($this->db->exec($sql)){ |
|
123 | + if ($this->db->exec($sql)) { |
|
124 | 124 | return $this->db->lastval(); |
125 | - }else{ |
|
125 | + }else { |
|
126 | 126 | return false; |
127 | 127 | } |
128 | 128 | } |
@@ -132,25 +132,25 @@ discard block |
||
132 | 132 | return $this->db->exec($sql); |
133 | 133 | } |
134 | 134 | |
135 | - public function jerarquia(){ |
|
135 | + public function jerarquia() { |
|
136 | 136 | $lista = $this->all(); |
137 | - return ($lista)?$this->estructura($lista):null; |
|
137 | + return ($lista) ? $this->estructura($lista) : null; |
|
138 | 138 | } |
139 | 139 | |
140 | - public function estructura($lista, $raiz = 0){ |
|
140 | + public function estructura($lista, $raiz = 0) { |
|
141 | 141 | $estructura = array(); |
142 | - foreach($lista as $key=>$item){ |
|
143 | - if($item->padre == $raiz){ |
|
142 | + foreach ($lista as $key=>$item) { |
|
143 | + if ($item->padre == $raiz) { |
|
144 | 144 | unset($lista[$key]); |
145 | - $estructura[]=array( |
|
145 | + $estructura[] = array( |
|
146 | 146 | 'id'=>$item->id, |
147 | 147 | 'text'=>$item->descripcion, |
148 | 148 | 'padre'=>$item->padre, |
149 | - 'nodes'=>$this->estructura($lista,$item->id) |
|
149 | + 'nodes'=>$this->estructura($lista, $item->id) |
|
150 | 150 | ); |
151 | 151 | } |
152 | 152 | } |
153 | - return empty($estructura)?null:$estructura; |
|
153 | + return empty($estructura) ?null:$estructura; |
|
154 | 154 | } |
155 | 155 | |
156 | 156 | /** |
@@ -159,10 +159,10 @@ discard block |
||
159 | 159 | public function datosInformacion() |
160 | 160 | { |
161 | 161 | //Cantidad de Edificaciones |
162 | - $sql_edificaciones = "SELECT ret.id,ret.descripcion, count(rme.id) as total " . |
|
163 | - "FROM ". $this->table_name ." as ret " . |
|
164 | - " join residentes_mapa_edificaciones as rme on (rme.id_tipo = ret.id) " . |
|
165 | - " group by ret.id,ret.descripcion " . |
|
162 | + $sql_edificaciones = "SELECT ret.id,ret.descripcion, count(rme.id) as total ". |
|
163 | + "FROM ".$this->table_name." as ret ". |
|
164 | + " join residentes_mapa_edificaciones as rme on (rme.id_tipo = ret.id) ". |
|
165 | + " group by ret.id,ret.descripcion ". |
|
166 | 166 | " order by ret.padre;"; |
167 | 167 | $data_edificaciones = $this->db->select($sql_edificaciones); |
168 | 168 | //cantidad de Inmuebles |
@@ -110,9 +110,9 @@ |
||
110 | 110 | $jobDisponible->fecha_modificacion = \date('Y-m-d H:i:s'); |
111 | 111 | $jobDisponible->save(); |
112 | 112 | $this->startJob($jobDisponible); |
113 | - } else { |
|
113 | + }else { |
|
114 | 114 | echo " ** No coincide la hora de proceso con la de ejecucion de cron se omite el proceso ". |
115 | - $this->ahora . " " . $this->horaActual . " ** \n"; |
|
115 | + $this->ahora." ".$this->horaActual." ** \n"; |
|
116 | 116 | $this->log->new_advice(' ** No coincide la hora de proceso con la de ejecucion de cron se omite el proceso ** '); |
117 | 117 | } |
118 | 118 | } |
@@ -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': |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | unset($lista_facturas[0]); |
126 | 126 | $this->contador_facturas = count($lista_facturas); |
127 | 127 | $this->facturas = implode(',', $lista_facturas); |
128 | - } else { |
|
128 | + }else { |
|
129 | 129 | $this->contador_facturas = 0; |
130 | 130 | $this->facturas = ''; |
131 | 131 | } |
@@ -229,8 +229,8 @@ discard block |
||
229 | 229 | $this->envio_masivo = false; |
230 | 230 | $this->existe_tesoreria(); |
231 | 231 | $this->cliente_residente = false; |
232 | - if (!file_exists('tmp/' . FS_TMP_NAME . 'enviar') && |
|
233 | - !mkdir($concurrentDirectory = 'tmp/' . FS_TMP_NAME . 'enviar') && |
|
232 | + if (!file_exists('tmp/'.FS_TMP_NAME.'enviar') && |
|
233 | + !mkdir($concurrentDirectory = 'tmp/'.FS_TMP_NAME.'enviar') && |
|
234 | 234 | !is_dir($concurrentDirectory)) { |
235 | 235 | throw new \RuntimeException(sprintf('Directory "%s" was not created', $concurrentDirectory)); |
236 | 236 | } |
@@ -41,9 +41,9 @@ discard block |
||
41 | 41 | public function crearEstadoCuenta($pendiente, $pagado) |
42 | 42 | { |
43 | 43 | $this->documento->cliente_residente = $this->cliente_residente; |
44 | - $this->documento->pdf->addInfo('Title', 'Pagos Residente ' . |
|
44 | + $this->documento->pdf->addInfo('Title', 'Pagos Residente '. |
|
45 | 45 | $this->cliente_residente->codcliente); |
46 | - $this->documento->pdf->addInfo('Subject', 'Pagos del Residente ' . |
|
46 | + $this->documento->pdf->addInfo('Subject', 'Pagos del Residente '. |
|
47 | 47 | $this->cliente_residente->codcliente); |
48 | 48 | $this->documento->pdf->addInfo('Author', $this->empresa->nombre); |
49 | 49 | $this->documento->pdf->ezSetMargins(10, 10, 10, 10); |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | } |
94 | 94 | $this->documento->set_y(80); |
95 | 95 | if ($this->empresa->pie_factura) { |
96 | - $this->documento->pdf->addText(20, 40, 8, fs_fix_html('<b>Generado por:</b> ' . |
|
96 | + $this->documento->pdf->addText(20, 40, 8, fs_fix_html('<b>Generado por:</b> '. |
|
97 | 97 | $this->user->get_agente_fullname()), 0); |
98 | 98 | $this->documento->pdf->addText( |
99 | 99 | 10, |
@@ -104,15 +104,15 @@ discard block |
||
104 | 104 | } |
105 | 105 | |
106 | 106 | if ($this->info_accion === 'enviar') { |
107 | - $this->documento->save('tmp/' . FS_TMP_NAME . 'enviar/' . $this->archivo); |
|
107 | + $this->documento->save('tmp/'.FS_TMP_NAME.'enviar/'.$this->archivo); |
|
108 | 108 | $this->emailHelper->accountStatusEmail( |
109 | 109 | $this->empresa, |
110 | 110 | $this->cliente_residente, |
111 | 111 | $this->user, |
112 | 112 | $this->archivo |
113 | 113 | ); |
114 | - } else { |
|
115 | - $this->documento->show('documento_cobros_' . \date('dmYhis') . '.pdf'); |
|
114 | + }else { |
|
115 | + $this->documento->show('documento_cobros_'.\date('dmYhis').'.pdf'); |
|
116 | 116 | } |
117 | 117 | } |
118 | 118 | } |
119 | 119 | \ No newline at end of file |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | public function conceptoFacturable($codcliente, $referencia) |
41 | 41 | { |
42 | 42 | $sql = "SELECT count(referencia) as facturado from lineasfacturascli where referencia = ". |
43 | - $this->var2str($referencia) . |
|
43 | + $this->var2str($referencia). |
|
44 | 44 | " AND idfactura IN (select idfactura from facturascli WHERE codcliente = ".$this->var2str($codcliente).");"; |
45 | 45 | $data = $this->db->select($sql); |
46 | 46 | if (!$data[0]['facturado']) { |
@@ -90,16 +90,16 @@ discard block |
||
90 | 90 | |
91 | 91 | $this->nuevoTotalFactura($factura, $residenteProg, $empresaTable); |
92 | 92 | if (!in_array($cliente_residente->email, [null, ''], true) && $jobDisponible->tipo_programacion === 'enviar') { |
93 | - $archivo = $factura->codigo . '_' . $factura->numero2 . '.pdf'; |
|
93 | + $archivo = $factura->codigo.'_'.$factura->numero2.'.pdf'; |
|
94 | 94 | $documento = new residentesFacturaDetallada('L', 'mm', 'A5', $jobDisponible->tipo_programacion, $archivo, 'cron'); |
95 | 95 | $documento->crearFactura($empresaTable, $factura, $cliente_residente); |
96 | 96 | } |
97 | 97 | ++$jobDisponible->facturas_generadas; |
98 | 98 | $jobDisponible->save(); |
99 | - } else { |
|
99 | + }else { |
|
100 | 100 | $this->log->new_error_msg('Imposible guardar la factura.'); |
101 | 101 | } |
102 | - } else { |
|
102 | + }else { |
|
103 | 103 | $this->log->new_error_msg('Cliente no encontrado.'); |
104 | 104 | } |
105 | 105 | } |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | $residenteProgramado->idfactura = $factura->idfactura; |
180 | 180 | $residenteProgramado->procesado = true; |
181 | 181 | $residenteProgramado->save(); |
182 | - } else { |
|
182 | + }else { |
|
183 | 183 | $factura->delete(); |
184 | 184 | } |
185 | 185 | } |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | if ($empresaTable->contintegrada) { |
236 | 236 | $asiento_factura = new asiento_factura(); |
237 | 237 | $asiento_factura->generar_asiento_venta($factura); |
238 | - } else { |
|
238 | + }else { |
|
239 | 239 | /// de todas formas forzamos la generación de las líneas de iva |
240 | 240 | $factura->get_lineas_iva(); |
241 | 241 | } |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | $this->vehiculo_placa = $t['vehiculo_placa']; |
81 | 81 | $this->vehiculo_tipo = $t['vehiculo_tipo']; |
82 | 82 | $this->codigo_tarjeta = $t['codigo_tarjeta']; |
83 | - } else { |
|
83 | + }else { |
|
84 | 84 | $this->idvehiculo = null; |
85 | 85 | $this->codcliente = null; |
86 | 86 | $this->vehiculo_marca = null; |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | $lista[] = (object) $d; |
163 | 163 | } |
164 | 164 | return [$lista, $data_total[0]['total']]; |
165 | - } else { |
|
165 | + }else { |
|
166 | 166 | return false; |
167 | 167 | } |
168 | 168 | } |
@@ -178,9 +178,9 @@ discard block |
||
178 | 178 | //$item = $this->info_adicional($item); |
179 | 179 | $lista[] = $item; |
180 | 180 | } |
181 | - ksort($lista, ); |
|
181 | + ksort($lista,); |
|
182 | 182 | return $lista; |
183 | - } else { |
|
183 | + }else { |
|
184 | 184 | return false; |
185 | 185 | } |
186 | 186 | } |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | if ($data) { |
194 | 194 | $item = new residentes_vehiculos($data[0]); |
195 | 195 | return $item; |
196 | - } else { |
|
196 | + }else { |
|
197 | 197 | return false; |
198 | 198 | } |
199 | 199 | } |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | */ |
207 | 207 | public function get_by_field($field, $value) |
208 | 208 | { |
209 | - $query = (is_string($value))?$this->var2str($value):$this->intval($value); |
|
209 | + $query = (is_string($value)) ? $this->var2str($value) : $this->intval($value); |
|
210 | 210 | $sql = "SELECT * FROM ".$this->table_name." WHERE ".strtoupper(trim($field))." = ".$query.";"; |
211 | 211 | $data = $this->db->select($sql); |
212 | 212 | if ($data) { |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | $lista[] = $item; |
218 | 218 | } |
219 | 219 | return $lista; |
220 | - } else { |
|
220 | + }else { |
|
221 | 221 | return false; |
222 | 222 | } |
223 | 223 | } |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | { |
227 | 227 | if (is_null($this->idvehiculo)) { |
228 | 228 | return false; |
229 | - } else { |
|
229 | + }else { |
|
230 | 230 | return $this->get($this->codcliente, $this->idvehiculo); |
231 | 231 | } |
232 | 232 | } |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | "WHERE idvehiculo = ".$this->intval($this->idvehiculo)." AND ". |
245 | 245 | "codcliente = ".$this->var2str($this->codcliente).";"; |
246 | 246 | return $this->db->exec($sql); |
247 | - } else { |
|
247 | + }else { |
|
248 | 248 | $sql = "INSERT INTO ".$this->table_name." (codcliente, vehiculo_marca, vehiculo_modelo, vehiculo_color, ". |
249 | 249 | "vehiculo_placa, vehiculo_tipo, codigo_tarjeta) VALUES (". |
250 | 250 | $this->var2str($this->codcliente).", ". |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | $this->var2str($this->codigo_tarjeta).");"; |
257 | 257 | if ($this->db->exec($sql)) { |
258 | 258 | return $this->db->lastval(); |
259 | - } else { |
|
259 | + }else { |
|
260 | 260 | return false; |
261 | 261 | } |
262 | 262 | } |
@@ -271,17 +271,17 @@ discard block |
||
271 | 271 | $clilist = array(); |
272 | 272 | $query = mb_strtolower($this->no_html($busqueda), 'UTF8'); |
273 | 273 | |
274 | - $consulta = "SELECT * FROM " . $this->table_name . " WHERE "; |
|
274 | + $consulta = "SELECT * FROM ".$this->table_name." WHERE "; |
|
275 | 275 | if (is_numeric($query)) { |
276 | - $consulta .= "(codigo_tarjeta LIKE '%" . $query . "%' OR CAST(idvehiculo as CHAR) = '%" . $query . "%')"; |
|
277 | - } else { |
|
276 | + $consulta .= "(codigo_tarjeta LIKE '%".$query."%' OR CAST(idvehiculo as CHAR) = '%".$query."%')"; |
|
277 | + }else { |
|
278 | 278 | $buscar = str_replace(' ', '%', $query); |
279 | - $consulta .= "(lower(codigo_tarjeta) LIKE '%" . $buscar . |
|
280 | - "%' OR lower(vehiculo_color) LIKE '%" . $buscar . "%'" . |
|
281 | - " OR lower(vehiculo_marca) LIKE '%" . $buscar . |
|
282 | - "%' OR lower(vehiculo_modelo) LIKE '%" . $buscar . "%'" . |
|
283 | - " OR lower(vehiculo_placa) LIKE '%" . $buscar . |
|
284 | - "%' OR lower(vehiculo_tipo) LIKE '%" . $buscar . "%')"; |
|
279 | + $consulta .= "(lower(codigo_tarjeta) LIKE '%".$buscar. |
|
280 | + "%' OR lower(vehiculo_color) LIKE '%".$buscar."%'". |
|
281 | + " OR lower(vehiculo_marca) LIKE '%".$buscar. |
|
282 | + "%' OR lower(vehiculo_modelo) LIKE '%".$buscar."%'". |
|
283 | + " OR lower(vehiculo_placa) LIKE '%".$buscar. |
|
284 | + "%' OR lower(vehiculo_tipo) LIKE '%".$buscar."%')"; |
|
285 | 285 | } |
286 | 286 | $consulta .= " ORDER BY codcliente ASC"; |
287 | 287 |