-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathConIndividualDeptOrigen.php
More file actions
316 lines (200 loc) · 10.8 KB
/
ConIndividualDeptOrigen.php
File metadata and controls
316 lines (200 loc) · 10.8 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
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
<?php
error_reporting(0);
//Inicialización de las Variables
$VarExport=0;
$VarFilas=0;
//Asignación de la cookies del departamento de Detino de la Grafica
$VarExport = $_COOKIE["VarCookie"];
// Inicialización de las Variable
$VarExportFinalq=0;
$VarExportInicio=0;
$TotalFinalCerrado=0;
$TotalFinalAbierto=0;
$i=0;
$ii=0;
//Asigancion de las cookies de la Fecha de Búsqueda
$VarExportInicio = $_COOKIE["VarCookieInicio"];
$VarExportFinalq = $_COOKIE["VarCookieFinalq"];
?>
<?php
//if($VarExport!="" and $VarExportInicio!="" and $VarExportFinalq!="" )
if( $VarExportInicio!=0 and $VarExportFinalq!=0)
{
$queryq = "SELECT os.name as nombre,count(ot.ticket_id ) as TotalCerrado
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
where (ot.created BETWEEN '$VarExportInicio ' and ' $VarExportFinalq') and oli.extra='$VarExport' and ot.status_id='3' group by os.name order by nombre asc";
$resultadoq = mysqli_query( $conexion, $queryq );
foreach ($resultadoq as $clave => $keyq)
{
$TotalFinalCerrado+=$keyq['TotalCerrado'];
}
$queryqq = "SELECT os.name as nombress,count(ot.ticket_id ) as TotalAbierto
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
where (ot.created BETWEEN '$VarExportInicio ' and ' $VarExportFinalq') and oli.extra='$VarExport' and ot.status_id='1' group by os.name order by nombress asc";
$resultadoqq = mysqli_query( $conexion, $queryqq );
foreach ($resultadoqq as $clave => $keyqq)
{
$TotalFinalAbierto+=$keyqq['TotalAbierto'];
}
}else{
$queryq = "SELECT os.name as nombre,count(ot.ticket_id ) as TotalCerrado
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
where oli.extra='$VarExport' and ot.status_id='3' group by os.name order by nombre asc";
$resultadoq = mysqli_query( $conexion, $queryq );
foreach ($resultadoq as $clave => $keyq)
{
$TotalFinalCerrado+=$keyq['TotalCerrado'];
}
$query="SELECT id from ost_list_items where extra ='$VarExport'";
$resultado=mysqli_query($conexion, $query);
$VarIdDept=0;
foreach ($resultado as $clave => $key)
{
$VarIdDept= $key['id'];
}
$queryqq = "SELECT os.name as nombress,count(ot.ticket_id ) as TotalAbierto
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
where oli.extra='$VarExport' and ot.status_id='1' group by os.name order by nombress asc";
$resultadoqq = mysqli_query( $conexion, $queryqq );
foreach ($resultadoqq as $clave => $keyqq)
{
$TotalFinalAbierto+=$keyqq['TotalAbierto'];
}
}
?>
<div class="TodaslasTablas">
<table cellpadding=0 cellspacing=0 class="tabla" id="Exportar_a_Excel">
<td valign = TOP colspan="3">
<div class="TablaTotal">
</br></br>
<strong><center>Tabla de Resultados </center></strong>
<table border="1" cellspacing="0" cellpadding="2" align="center" >
<tr bgcolor='bbbbbb'>
<td ALIGN="CENTER">Cerrados</td>
<td ALIGN="CENTER">Abierto</td>
<td ALIGN="CENTER">Total</td>
</tr>
<tr>
<td ALIGN="CENTER"> <?php echo $TotalFinalCerrado;?></td>
<td ALIGN="CENTER"><?php echo $TotalFinalAbierto;?></td>
<td ALIGN="CENTER"><?php echo $TotalFinalCerrado+$TotalFinalAbierto;?></td>
</tr>
<tr>
</table>
<center> <strong><p>Mostrar los <?php echo $TotalFinalCerrado+$TotalFinalAbierto;?> Tickets <a href="http:DetallesDeptOrigen.php">aquí</a></p></strong></center>
</div>
</td>
<tr>
<td valign = TOP>
<div class="TablaIndividualCerrado">
<?php
echo "<strong><center>Tabla de Tickets Cerrados</center></strong>";
echo"<table border=1 cellspacing=0 cellpadding=2 align='center' >";// creacion de la tabla con los encabezados que se mostarar en el pantalla principal
echo "<tr align='center' bgcolor='bbbbbb' >
<td ALIGN=CENTER>Nº</td>
<td ALIGN=CENTER>Nombre del agente</td>
<td ALIGN=CENTER>Cerrado</td>
</tr>";
// ciclo de foreach que imprime el resultado en la pantalla web de cada uno de los resultados
foreach ($resultadoq as $clave => $keyq)
{
$i++;
?>
<script>
$(function(){
$(".onmouseout").click(function(e) {
e.preventDefault();
var NombreAgente = $(this).attr("NombreAgente");
document.cookie ='VarCookieNombreAgente='+NombreAgente+';';
//alert(NombreAgente);
window.open('DetallesAgenteOrigen.php','Detalles','width=1000, height=500')
});
});
</script>
<tr NombreAgente="<?php echo($keyq['nombre'])?>" class="onmouseout" <?php if ($i%2==0)
echo "bgcolor=#C4C7D6"; //si el resto de la división es 0 pongo un color
else
echo "bgcolor=#FDFDFD"; //si el resto de la división NO es 0 pongo otro color ?>>
<td ALIGN="CENTER"><?php echo($i)?></td>
<td ><a href=''><?php echo $keyq['nombre']?></a></td>
<td ALIGN="CENTER"><?php echo $keyq['TotalCerrado']?></td>
</tr>
<?php } ?>
</table>
<?php
?>
</div>
</td>
<td>
</td>
<td valign = TOP>
<div class="TablaIndividualAbierto">
<?php
//-------------------------------------------------------------------------------------------------------------------
echo "<strong><center>Tabla de Tickets Abierto </center></strong>";
echo"<table border=1 cellspacing=0 cellpadding=2 align='center' >";// creacion de la tabla con los encabezados que se mostarar en el pantalla principal
echo "<tr align='center' bgcolor='bbbbbb' >
<td ALIGN=CENTER>Nº</td>
<td ALIGN=CENTER>Nombre del agente</td>
<td ALIGN=CENTER>Abierto</td>
</tr>";
// ciclo de foreach que imprime el resultado en la pantalla web de cada uno de los resultados
foreach ($resultadoqq as $clave => $keyqq)
{
$ii++;
?>
<script>
$(function(){
$(".click").click(function(e) {
e.preventDefault();
var NombreAgentess = $(this).attr("NombreAgentess");
document.cookie ='VarCookieNombreAgentess='+NombreAgentess+';';
//alert(NombreAgentess);
window.open('DetallesAgentesAbiertoOrigen.php','nuevaVentanas','width=1000, height=500')
});
});
</script>
<tr NombreAgentess="<?php echo($keyqq['nombress'])?>" class="click" <?php if ($ii%2==0)
echo "bgcolor=#C4C7D6"; //si el resto de la división es 0 pongo un color
else
echo "bgcolor=#FDFDFD"; //si el resto de la división NO es 0 pongo otro color ?>>
<td ALIGN="CENTER"><?php echo($ii)?></td>
<td ><a href=''><?php echo $keyqq['nombress']?></a></td>
<td ALIGN="CENTER"><?php echo $keyqq['TotalAbierto']?></td>
</tr>
<?php } ?>
</table>
<?php
?>
</div>
</td>
</tr>