@@ -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 |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | |
23 | 23 | class residentesFacturaDetallada |
24 | 24 | { |
25 | - public $archivo ; |
|
25 | + public $archivo; |
|
26 | 26 | public $document; |
27 | 27 | public $emailHelper; |
28 | 28 | public $output; |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | private $residentesController; |
32 | 32 | public function __construct($orientation = 'L', $um = 'mm', $size = 'A5', $output = 'enviar', $archivo = 'doc.pdf', $user = 'cron') |
33 | 33 | { |
34 | - $this->archivo = ($archivo) ?: \date('dmYHis') . ".pdf"; |
|
34 | + $this->archivo = ($archivo) ?: \date('dmYHis').".pdf"; |
|
35 | 35 | $this->output = $output; |
36 | 36 | $this->user = $user; |
37 | 37 | $this->log = new fs_core_log(); |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | $datosFactura = $this->invoiceData($companyInformation, $invoice); |
51 | 51 | $datosEmpresa = (array) $companyInformation; |
52 | 52 | $customerInfo = (array) $customer; |
53 | - $customerInfo['direccion'] = trim($customer->inmueble->codigo_externo()) . " numero " . $customer->inmueble->numero; |
|
53 | + $customerInfo['direccion'] = trim($customer->inmueble->codigo_externo())." numero ".$customer->inmueble->numero; |
|
54 | 54 | $this->document->createDocument($datosEmpresa, $datosFactura[0], $datosFactura[1], $customerInfo); |
55 | 55 | $this->residentesController->cliente_residente = $customer; |
56 | 56 | $pendiente = $this->residentesController->pagosFactura(false); |
@@ -58,14 +58,14 @@ discard block |
||
58 | 58 | if ($this->output === 'enviar') { |
59 | 59 | $this->document->Output( |
60 | 60 | 'F', |
61 | - 'tmp/' . FS_TMP_NAME . 'enviar/' . $this->archivo, |
|
61 | + 'tmp/'.FS_TMP_NAME.'enviar/'.$this->archivo, |
|
62 | 62 | true |
63 | 63 | ); |
64 | 64 | $this->emailHelper->invoiceEmail($companyInformation, $invoice, $customer, $this->user, $this->archivo); |
65 | - } else { |
|
65 | + }else { |
|
66 | 66 | $this->document->Output( |
67 | 67 | 'I', |
68 | - 'factura_' .$datosFactura[0]['numero2']. '_' . \date('dmYhis') . '.pdf' |
|
68 | + 'factura_'.$datosFactura[0]['numero2'].'_'.\date('dmYhis').'.pdf' |
|
69 | 69 | ); |
70 | 70 | } |
71 | 71 | } |
@@ -36,27 +36,27 @@ discard block |
||
36 | 36 | $email = $customer->email; |
37 | 37 | $this->log->new_message('Enviando factura a: '.$email); |
38 | 38 | $mail->addAddress($email, $customer->nombre); |
39 | - $elSubject = ' - Su Factura ' . $invoice->codigo . ' ' . $invoice->numero2; |
|
40 | - $mail->Subject = fs_fix_html($companyInformation->nombre) . $elSubject; |
|
39 | + $elSubject = ' - Su Factura '.$invoice->codigo.' '.$invoice->numero2; |
|
40 | + $mail->Subject = fs_fix_html($companyInformation->nombre).$elSubject; |
|
41 | 41 | $mail->AltBody = plantilla_email( |
42 | 42 | 'factura', |
43 | - $invoice->codigo . ' ' . $invoice->numero2, |
|
43 | + $invoice->codigo.' '.$invoice->numero2, |
|
44 | 44 | $companyInformation->email_config['mail_firma'] |
45 | 45 | ); |
46 | 46 | $this->emailAdditionalInfo($mail, $customer); |
47 | 47 | $mail->msgHTML(nl2br($mail->AltBody)); |
48 | 48 | $mail->isHTML(true); |
49 | - $mail->addAttachment('tmp/' . FS_TMP_NAME . 'enviar/' . $archivo); |
|
49 | + $mail->addAttachment('tmp/'.FS_TMP_NAME.'enviar/'.$archivo); |
|
50 | 50 | $this->emailAdditionalAttachments($mail); |
51 | 51 | if ($companyInformation->mail_connect($mail) && $mail->send()) { |
52 | - $invoice->femail = \date('d-m-Y');; |
|
52 | + $invoice->femail = \date('d-m-Y'); ; |
|
53 | 53 | $invoice->save(); |
54 | 54 | $companyInformation->save_mail($mail); |
55 | - } else { |
|
56 | - $this->log->new_error("Error al enviar el email: " . $mail->ErrorInfo); |
|
55 | + }else { |
|
56 | + $this->log->new_error("Error al enviar el email: ".$mail->ErrorInfo); |
|
57 | 57 | } |
58 | - unlink('tmp/' . FS_TMP_NAME . 'enviar/' . $archivo); |
|
59 | - } else { |
|
58 | + unlink('tmp/'.FS_TMP_NAME.'enviar/'.$archivo); |
|
59 | + }else { |
|
60 | 60 | $this->log->new_error('Imposible generar el PDF.'); |
61 | 61 | } |
62 | 62 | } |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | trim($this->rc->filter_request('email_copia')), |
70 | 70 | $customer->nombre |
71 | 71 | ); |
72 | - } else { |
|
72 | + }else { |
|
73 | 73 | $mail->addCC( |
74 | 74 | trim($this->rc->filter_request('email_copia')), |
75 | 75 | $customer->nombre |
@@ -94,19 +94,19 @@ discard block |
||
94 | 94 | : $customer->email; |
95 | 95 | $this->log->new_message('Enviando Estado de cuenta a: '.$email); |
96 | 96 | $mail->addAddress($email, $customer->nombre); |
97 | - $elSubject = ': Su Estado de cuenta al '. \date('d-m-Y'); |
|
98 | - $mail->Subject = fs_fix_html($empresa->nombre) . $elSubject; |
|
97 | + $elSubject = ': Su Estado de cuenta al '.\date('d-m-Y'); |
|
98 | + $mail->Subject = fs_fix_html($empresa->nombre).$elSubject; |
|
99 | 99 | $mail->AltBody = strip_tags($_POST['mensaje']); |
100 | 100 | $this->emailAdditionalAttachments($mail); |
101 | 101 | $mail->msgHTML(nl2br($mail->AltBody)); |
102 | 102 | $mail->isHTML(true); |
103 | - $mail->addAttachment('tmp/' . FS_TMP_NAME . 'enviar/' . $archivo); |
|
103 | + $mail->addAttachment('tmp/'.FS_TMP_NAME.'enviar/'.$archivo); |
|
104 | 104 | $this->emailAdditionalAttachments($mail); |
105 | 105 | if ($empresa->mail_connect($mail) && $mail->send()) { |
106 | 106 | $empresa->save_mail($mail); |
107 | - } else { |
|
108 | - $this->log->new_error("Error al enviar el email: " . $mail->ErrorInfo); |
|
107 | + }else { |
|
108 | + $this->log->new_error("Error al enviar el email: ".$mail->ErrorInfo); |
|
109 | 109 | } |
110 | - unlink('tmp/' . FS_TMP_NAME . 'enviar/' . $archivo); |
|
110 | + unlink('tmp/'.FS_TMP_NAME.'enviar/'.$archivo); |
|
111 | 111 | } |
112 | 112 | } |
113 | 113 | \ 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 | } |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | $this->estado = $t['estado']; |
63 | 63 | $this->fecha_creacion = $t['fecha_creacion']; |
64 | 64 | $this->fecha_modificacion = $t['fecha_modificacion']; |
65 | - } else { |
|
65 | + }else { |
|
66 | 66 | $this->id = null; |
67 | 67 | $this->descripcion = ''; |
68 | 68 | $this->tipo_programacion = 'generar'; |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | "WHERE id = ".$this->intval($this->id).";"; |
114 | 114 | $data = $this->db->exec($sql); |
115 | 115 | return $data; |
116 | - } else { |
|
116 | + }else { |
|
117 | 117 | $sql = "INSERT INTO ".$this->table_name. |
118 | 118 | " (descripcion, tipo_programacion, forma_pago, formato_factura, fecha_envio, hora_envio, residentes_facturar, ". |
119 | 119 | "facturas_generadas, usuario_creacion, fecha_creacion, estado) VALUES (". |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | $this->var2str($this->estado).");"; |
131 | 131 | if ($this->db->exec($sql)) { |
132 | 132 | return $this->db->lastval(); |
133 | - } else { |
|
133 | + }else { |
|
134 | 134 | return false; |
135 | 135 | } |
136 | 136 | } |
@@ -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 |
@@ -62,10 +62,10 @@ discard block |
||
62 | 62 | $inq->fecha_ocupacion = null; |
63 | 63 | if ($inq->save()) { |
64 | 64 | $this->new_message('Inquilino removido correctamente.'); |
65 | - } else { |
|
65 | + }else { |
|
66 | 66 | $this->new_error_msg('Error al remover el inquilino.'); |
67 | 67 | } |
68 | - } else { |
|
68 | + }else { |
|
69 | 69 | $this->new_error_msg('Inquilino no encontrado.'); |
70 | 70 | } |
71 | 71 | } |
@@ -167,22 +167,22 @@ discard block |
||
167 | 167 | public function buscar_residentes($param) |
168 | 168 | { |
169 | 169 | if (is_numeric($param)) { |
170 | - $where = "(r.codcliente LIKE '%" . $param . "%'" |
|
171 | - . " OR c.cifnif LIKE '%" . $param . "%'" |
|
172 | - . " OR c.telefono1 LIKE '" . $param . "%'" |
|
173 | - . " OR c.telefono2 LIKE '" . $param . "%'" |
|
174 | - . " OR ca_telefono LIKE '" . $param . "%'" |
|
175 | - . " OR r.observaciones LIKE '%" . $param . "%')"; |
|
176 | - } else { |
|
170 | + $where = "(r.codcliente LIKE '%".$param."%'" |
|
171 | + . " OR c.cifnif LIKE '%".$param."%'" |
|
172 | + . " OR c.telefono1 LIKE '".$param."%'" |
|
173 | + . " OR c.telefono2 LIKE '".$param."%'" |
|
174 | + . " OR ca_telefono LIKE '".$param."%'" |
|
175 | + . " OR r.observaciones LIKE '%".$param."%')"; |
|
176 | + }else { |
|
177 | 177 | $buscar = str_replace(' ', '%', $param); |
178 | - $where = "(lower(nombre) LIKE '%" . $buscar . "%'" |
|
179 | - . " OR lower(razonsocial) LIKE '%" . $buscar . "%'" |
|
180 | - . " OR lower(ca_apellidos) LIKE '%" . $buscar . "%'" |
|
181 | - . " OR lower(ca_nombres) LIKE '%" . $buscar . "%'" |
|
182 | - . " OR lower(cifnif) LIKE '%" . $buscar . "%'" |
|
183 | - . " OR lower(observaciones) LIKE '%" . $buscar . "%'" |
|
184 | - . " OR lower(ca_email) LIKE '%" . $buscar . "%'" |
|
185 | - . " OR lower(email) LIKE '%" . $buscar . "%')"; |
|
178 | + $where = "(lower(nombre) LIKE '%".$buscar."%'" |
|
179 | + . " OR lower(razonsocial) LIKE '%".$buscar."%'" |
|
180 | + . " OR lower(ca_apellidos) LIKE '%".$buscar."%'" |
|
181 | + . " OR lower(ca_nombres) LIKE '%".$buscar."%'" |
|
182 | + . " OR lower(cifnif) LIKE '%".$buscar."%'" |
|
183 | + . " OR lower(observaciones) LIKE '%".$buscar."%'" |
|
184 | + . " OR lower(ca_email) LIKE '%".$buscar."%'" |
|
185 | + . " OR lower(email) LIKE '%".$buscar."%')"; |
|
186 | 186 | } |
187 | 187 | return $where; |
188 | 188 | } |
@@ -190,14 +190,14 @@ discard block |
||
190 | 190 | public function buscar_inmuebles($param) |
191 | 191 | { |
192 | 192 | if (is_numeric($param)) { |
193 | - $where = " r.codigo LIKE '%" . $param . "%'" |
|
194 | - . " OR r.numero LIKE '%" . $param . "%'" |
|
195 | - . " OR CONCAT(r.codigo, r.numero) LIKE '%" . $param . "%'"; |
|
196 | - } else { |
|
193 | + $where = " r.codigo LIKE '%".$param."%'" |
|
194 | + . " OR r.numero LIKE '%".$param."%'" |
|
195 | + . " OR CONCAT(r.codigo, r.numero) LIKE '%".$param."%'"; |
|
196 | + }else { |
|
197 | 197 | $buscar = str_replace(' ', '%', $param); |
198 | - $where = " lower(r.codigo) LIKE '%" . $buscar . "%'" |
|
199 | - . " OR lower(r.numero) LIKE '%" . $buscar . "%'" |
|
200 | - . " OR CONCAT(lower(r.codigo), r.numero) LIKE '%" . $param . "%'"; |
|
198 | + $where = " lower(r.codigo) LIKE '%".$buscar."%'" |
|
199 | + . " OR lower(r.numero) LIKE '%".$buscar."%'" |
|
200 | + . " OR CONCAT(lower(r.codigo), r.numero) LIKE '%".$param."%'"; |
|
201 | 201 | } |
202 | 202 | return $where; |
203 | 203 | } |
@@ -205,20 +205,20 @@ discard block |
||
205 | 205 | public function buscar_vehiculos($param) |
206 | 206 | { |
207 | 207 | if (is_numeric($param)) { |
208 | - $where = "(r.codcliente LIKE '%" . $param . "%'" |
|
209 | - . " OR vehiculo_placa LIKE '%" . $param . "%'" |
|
210 | - . " OR CAST(idvehiculo AS CHAR) LIKE '" . $param . "%'" |
|
211 | - . " OR telefono2 LIKE '" . $param . "%'" |
|
212 | - . " OR observaciones LIKE '%" . $param . "%'" |
|
213 | - . " OR codigo_tarjeta LIKE '%" . $param . "%')"; |
|
214 | - } else { |
|
208 | + $where = "(r.codcliente LIKE '%".$param."%'" |
|
209 | + . " OR vehiculo_placa LIKE '%".$param."%'" |
|
210 | + . " OR CAST(idvehiculo AS CHAR) LIKE '".$param."%'" |
|
211 | + . " OR telefono2 LIKE '".$param."%'" |
|
212 | + . " OR observaciones LIKE '%".$param."%'" |
|
213 | + . " OR codigo_tarjeta LIKE '%".$param."%')"; |
|
214 | + }else { |
|
215 | 215 | $buscar = str_replace(' ', '%', $param); |
216 | - $where = "(lower(vehiculo_marca) LIKE '%" . $buscar . "%'" |
|
217 | - . " OR lower(vehiculo_modelo) LIKE '%" . $buscar . "%'" |
|
218 | - . " OR lower(vehiculo_color) LIKE '%" . $buscar . "%'" |
|
219 | - . " OR lower(vehiculo_placa) LIKE '%" . $buscar . "%'" |
|
220 | - . " OR lower(vehiculo_tipo) LIKE '%" . $buscar . "%'" |
|
221 | - . " OR lower(codigo_tarjeta) LIKE '%" . $buscar . "%')"; |
|
216 | + $where = "(lower(vehiculo_marca) LIKE '%".$buscar."%'" |
|
217 | + . " OR lower(vehiculo_modelo) LIKE '%".$buscar."%'" |
|
218 | + . " OR lower(vehiculo_color) LIKE '%".$buscar."%'" |
|
219 | + . " OR lower(vehiculo_placa) LIKE '%".$buscar."%'" |
|
220 | + . " OR lower(vehiculo_tipo) LIKE '%".$buscar."%'" |
|
221 | + . " OR lower(codigo_tarjeta) LIKE '%".$buscar."%')"; |
|
222 | 222 | } |
223 | 223 | return $where; |
224 | 224 | } |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | 'nombre' => $cli->nombre, |
253 | 253 | 'asignado' => true); |
254 | 254 | } |
255 | - } else { |
|
255 | + }else { |
|
256 | 256 | $json[$cli->codcliente] = array('value' => $cli->nombre, |
257 | 257 | 'data' => $cli->codcliente, |
258 | 258 | 'nombre' => $cli->nombre, |
@@ -310,11 +310,11 @@ discard block |
||
310 | 310 | |
311 | 311 | public function paginas() |
312 | 312 | { |
313 | - $url = $this->url() . "&query=" . $this->query |
|
314 | - . "&query_r=" . $this->query_r |
|
315 | - . "&query_v=" . $this->query_v |
|
316 | - . "&query_i=" . $this->query_i |
|
317 | - . "&orden=" . $this->order; |
|
313 | + $url = $this->url()."&query=".$this->query |
|
314 | + . "&query_r=".$this->query_r |
|
315 | + . "&query_v=".$this->query_v |
|
316 | + . "&query_i=".$this->query_i |
|
317 | + . "&orden=".$this->order; |
|
318 | 318 | |
319 | 319 | $paginas = array(); |
320 | 320 | $i = 0; |
@@ -324,7 +324,7 @@ discard block |
||
324 | 324 | /// añadimos todas la página |
325 | 325 | while ($num < $this->total_resultados) { |
326 | 326 | $paginas[$i] = array( |
327 | - 'url' => $url . "&offset=" . ($i * FS_ITEM_LIMIT), |
|
327 | + 'url' => $url."&offset=".($i * FS_ITEM_LIMIT), |
|
328 | 328 | 'num' => $i + 1, |
329 | 329 | 'actual' => ($num === $this->offset) |
330 | 330 | ); |
@@ -339,13 +339,13 @@ discard block |
||
339 | 339 | |
340 | 340 | /// ahora descartamos |
341 | 341 | foreach ($paginas as $j => $value) { |
342 | - $enmedio = (int)($i / 2); |
|
342 | + $enmedio = (int) ($i / 2); |
|
343 | 343 | |
344 | 344 | /** |
345 | 345 | * descartamos todo excepto la primera, la última, la de enmedio, |
346 | 346 | * la actual, las 5 anteriores y las 5 siguientes |
347 | 347 | */ |
348 | - if (($j>1 && $j<$actual-5 && $j !== $enmedio) || ($j > $actual + 5 && $j < $i - 1 && $j !== $enmedio)) { |
|
348 | + if (($j > 1 && $j < $actual - 5 && $j !== $enmedio) || ($j > $actual + 5 && $j < $i - 1 && $j !== $enmedio)) { |
|
349 | 349 | unset($paginas[$j]); |
350 | 350 | } |
351 | 351 | } |