-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathConQueryCe.php
More file actions
197 lines (161 loc) · 11.6 KB
/
ConQueryCe.php
File metadata and controls
197 lines (161 loc) · 11.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
<!--Este PHP es encargado de controlar los Query que esten en estado cerrados ya sea los primeros 50 ,100,200 o todos los tiket que esten cerrados-->
<!--evalua una bùsqueda segùn el criterio que se le asigne a la caja de texto bùsqueda-->
<?php
$VarFilas=0;
// Desiciòn para cuando se presione el botòn de buscar
if(isset($_POST['btnbuscar']))
{ //Variable que guarda la informaciòn de la caja de texto a buscar
$Varnombre = $_POST['input_2'];
// Query requerido para la bùsqueda por la caja de texto para los ticket cerrados
$query="SELECT ot.number,ot.created,os.name, concat_ws(' ',osf.firstname,osf.lastname)as nombre,od.dept_name,oli.value,oht.topic,ots.state,otp.priority_desc
FROM ost_ticket ot
left join ost_user os on ot.user_id=os.id
left join ost_staff osf on ot.staff_id=osf.staff_id
left join ost_department od on ot.dept_id=od.dept_id
left join ost_ticket__cdata otd on ot.ticket_id=otd.ticket_id
left join ost_list_items oli on otd.departamento=oli.id
left join ost_help_topic oht on ot.topic_id=oht.topic_id
left join ost_ticket_status ots on ot.status_id= ots.id
left join ost_ticket_priority otp on otd.priority=otp.priority_id
where ots.state ='closed' and (ot.number like '%$Varnombre%' or os.name like '%$Varnombre%' or concat_ws(' ',osf.firstname,osf.lastname)like '%$Varnombre%' or od.dept_name like '%$Varnombre%' or oli.value like '%$Varnombre%' or oht.topic like '%$Varnombre%' or otp.priority_desc like '%$Varnombre%')
order by ot.created desc";
$resultado=mysqli_query($conexion, $query);//variable resultada para almacenar el arreglo de la informacion tomando encuenta la conexion de la DB y el query requerido
foreach ($resultado as $clave => $key)
{
$VarFilas++;
}
if ($resultado->num_rows>=1)
{ echo "<strong>Busqueda por:</strong>"; echo $Varnombre; echo "<strong>\n\nNº de Tickets:</strong>"; echo $VarFilas;
require_once("LlenarTabla.php");//Llama al php de la tabla para que se muestre en pantalla
}
else
{
$query="SELECT ot.number,ot.created,os.name,concat_ws(' ',osf.firstname,osf.lastname)as nombre,od.dept_name,oli.value,oht.topic,ots.state,otp.priority_desc
FROM ost_ticket ot
left join ost_user os on ot.user_id=os.id
left join ost_staff osf on ot.staff_id=osf.staff_id
left join ost_department od on ot.dept_id=od.dept_id
left join ost_ticket__cdata otd on ot.ticket_id=otd.ticket_id
left join ost_list_items oli on otd.departamento = oli.id
left join ost_help_topic oht on ot.topic_id=oht.topic_id
left join ost_ticket_status ots on ot.status_id= ots.id
left join ost_ticket_priority otp on otd.priority=otp.priority_id
where ots.state='closed'
order by ot.created desc LIMIT 50";
$resultado=mysqli_query($conexion, $query);//variable resultada para almacenar el arreglo de la informacion tomando encuenta la conexion de la DB y el query requerido
echo "<strong>Numero de Tickets:</strong>";echo"50"; echo "\n\n<strong>,de:</strong>\n\n";
$queryT="SELECT ot.number FROM ost_ticket ot ";
$resultadoT=mysqli_query($conexion, $queryT);
foreach ($resultadoT as $clave => $key)
{
$VarFilas++;
}
echo $VarFilas;
require_once("LlenarTabla.php");//Llama al php de la tabla para que se muestre en pantalla
require_once("MsgError.php"); //Llama al php de error de coincidencias
}
}
elseif(isset($_POST['btnAceptar']))
{//Valor del combobox que se encuentra en utilidades para generar consulta
$VarConsulta = $_POST['NivelCon'];
if($VarConsulta == 1)
{ //Query para el llenado de la tabla con los primeros 100 registros de ticket cerrado
$query="SELECT ot.number,ot.created,os.name, concat_ws(' ',osf.firstname,osf.lastname)as nombre,od.dept_name,oli.value,oht.topic,ots.state,otp.priority_desc
FROM ost_ticket ot
left join ost_user os on ot.user_id=os.id
left join ost_staff osf on ot.staff_id=osf.staff_id
left join ost_department od on ot.dept_id=od.dept_id
left join ost_ticket__cdata otd on ot.ticket_id=otd.ticket_id
left join ost_list_items oli on otd.departamento = oli.id
left join ost_help_topic oht on ot.topic_id=oht.topic_id
left join ost_ticket_status ots on ot.status_id= ots.id
left join ost_ticket_priority otp on otd.priority=otp.priority_id
where ots.state='closed'
order by ot.created desc LIMIT 100";
$resultado=mysqli_query($conexion, $query);//variable resultada para almacenar el arreglo de la informacion tomando encuenta la conexion de la DB y el query requerido
echo "<strong>Numero de Tickets:</strong>";echo"100"; echo "\n\n<strong>,de:</strong>\n\n";
$queryT="SELECT ot.number FROM ost_ticket ot ";
$resultadoT=mysqli_query($conexion, $queryT);
foreach ($resultadoT as $clave => $key)
{
$VarFilas++;
}
echo $VarFilas;
require_once("LlenarTabla.php");//Llama al php de la tabla para que se muestre en pantalla
}
elseif($VarConsulta == 2)
{ //Query para el llenado de la tabla con los primeros 200 registros de ticket cerrado
$query="SELECT ot.number,ot.created,os.name, concat_ws(' ',osf.firstname,osf.lastname)as nombre,od.dept_name,oli.value,oht.topic,ots.state,otp.priority_desc
FROM ost_ticket ot
left join ost_user os on ot.user_id=os.id
left join ost_staff osf on ot.staff_id=osf.staff_id
left join ost_department od on ot.dept_id=od.dept_id
left join ost_ticket__cdata otd on ot.ticket_id=otd.ticket_id
left join ost_list_items oli on otd.departamento = oli.id
left join ost_help_topic oht on ot.topic_id=oht.topic_id
left join ost_ticket_status ots on ot.status_id= ots.id
left join ost_ticket_priority otp on otd.priority=otp.priority_id
where ots.state='closed'
order by ot.created desc LIMIT 200";
$resultado=mysqli_query($conexion, $query);//variable resultada para almacenar el arreglo de la informacion tomando encuenta la conexion de la DB y el query requerido
echo "<strong>Numero de Tickets:</strong>";echo"200"; echo "\n\n<strong>,de:</strong>\n\n";
$queryT="SELECT ot.number FROM ost_ticket ot ";
$resultadoT=mysqli_query($conexion, $queryT);
foreach ($resultadoT as $clave => $key)
{
$VarFilas++;
}
echo $VarFilas;
require_once("LlenarTabla.php");//Llama al php de la tabla para que se muestre en pantalla
}
elseif($VarConsulta == 0)
{ //Query para el llenado de la tabla con todos los registros de ticket cerrados
$query="SELECT ot.number,ot.created,os.name, concat_ws(' ',osf.firstname,osf.lastname)as nombre,od.dept_name,oli.value,oht.topic,ots.state,otp.priority_desc
FROM ost_ticket ot
left join ost_user os on ot.user_id=os.id
left join ost_staff osf on ot.staff_id=osf.staff_id
left join ost_department od on ot.dept_id=od.dept_id
left join ost_ticket__cdata otd on ot.ticket_id=otd.ticket_id
left join ost_list_items oli on otd.departamento = oli.id
left join ost_help_topic oht on ot.topic_id=oht.topic_id
left join ost_ticket_status ots on ot.status_id= ots.id
left join ost_ticket_priority otp on otd.priority=otp.priority_id
where ots.state='closed'
order by ot.created desc";
$resultado=mysqli_query($conexion, $query);//variable resultada para almacenar el arreglo de la informacion tomando encuenta la conexion de la DB y el query requerido
$queryT="SELECT ot.number FROM ost_ticket ot ";
$resultadoT=mysqli_query($conexion, $queryT);
foreach ($resultadoT as $clave => $key)
{
$VarFilas++;
}
echo "<strong>Numero de Tickets:</strong>";echo$VarFilas; echo "\n\n<strong>,de:</strong>\n\n";echo$VarFilas;
require_once("LlenarTabla.php");//Llama al php de la tabla para que se muestre en pantalla
}
}
else
{ //Query para el llenado de la tabla con los primeros 50 registros
$query="SELECT ot.number,ot.created,os.name,concat_ws(' ',osf.firstname,osf.lastname)as nombre,od.dept_name,oli.value,oht.topic,ots.state,otp.priority_desc
FROM ost_ticket ot
left join ost_user os on ot.user_id=os.id
left join ost_staff osf on ot.staff_id=osf.staff_id
left join ost_department od on ot.dept_id=od.dept_id
left join ost_ticket__cdata otd on ot.ticket_id=otd.ticket_id
left join ost_list_items oli on otd.departamento=oli.id
left join ost_help_topic oht on ot.topic_id=oht.topic_id
left join ost_ticket_status ots on ot.status_id= ots.id
left join ost_ticket_priority otp on otd.priority=otp.priority_id
where ots.state='closed'
order by ot.created desc LIMIT 50";
$resultado=mysqli_query($conexion, $query);//variable resultada para almacenar el arreglo de la informacion tomando encuenta la conexion de la DB y el query requerido
echo "<strong>Numero de Tickets:</strong>";echo"50"; echo "\n\n<strong>,de:</strong>\n\n";
$queryT="SELECT ot.number FROM ost_ticket ot ";
$resultadoT=mysqli_query($conexion, $queryT);
foreach ($resultadoT as $clave => $key)
{
$VarFilas++;
}
echo $VarFilas;
require_once("LlenarTabla.php");//Llama al php de la tabla para que se muestre en pantalla
}
?>