-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconsultaTarea.php
440 lines (382 loc) · 17 KB
/
consultaTarea.php
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
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
<?php
require "inc/funciones.inc";
$id = $_REQUEST['id'];
$conn=conectar_bd();
$tsql = "SELECT *
FROM INV_TBTAREAS
LEFT JOIN INV_VIEW_DATOS_TODO ON INV_VIEW_DATOS_TODO.ID_TAREA = INV_TBTAREAS.ID
WHERE ID = '$id'";
$resultado = sqlsrv_query($conn, $tsql);
if( $resultado === false ) {
die( print_r( sqlsrv_errors(), true));
} else {
$registro = sqlsrv_fetch_array($resultado);
}
sqlsrv_free_stmt($resultado);
$tsql = "SELECT *
FROM INV_TBTAREAS
LEFT JOIN INV_VIEW_DATOS_TODO ON INV_VIEW_DATOS_TODO.ID_TAREA = INV_TBTAREAS.ID";
if ($registro['REF_ASOCIADA'] != '') {
if ($registro['INCIDENCIA'] != '') {
$tsql = $tsql." WHERE (INV_TBTAREAS.REF_ASOCIADA = '".$registro['REF_ASOCIADA']."' OR INCIDENCIA = '".$registro['INCIDENCIA']."')
AND INV_TBTAREAS.ID <> '$id'
ORDER BY INV_TBTAREAS.FECHA_REGISTRO, INV_TBTAREAS.FECHA_INICIO, INV_TBTAREAS.FECHA_RESOL";
} else {
$tsql = $tsql." WHERE INV_TBTAREAS.REF_ASOCIADA = '".$registro['REF_ASOCIADA']."'
AND INV_TBTAREAS.ID <> '$id'
ORDER BY INV_TBTAREAS.FECHA_REGISTRO, INV_TBTAREAS.FECHA_INICIO, INV_TBTAREAS.FECHA_RESOL";
}
} else {
if ($registro['INCIDENCIA'] != '') {
$tsql = $tsql." WHERE INCIDENCIA = '".$registro['INCIDENCIA']."'
AND INV_TBTAREAS.ID <> '$id'
ORDER BY INV_TBTAREAS.FECHA_REGISTRO, INV_TBTAREAS.FECHA_INICIO, INV_TBTAREAS.FECHA_RESOL";
} else {
$tsql = $tsql." WHERE INV_TBTAREAS.ID <> '$id'
ORDER BY INV_TBTAREAS.FECHA_REGISTRO, INV_TBTAREAS.FECHA_INICIO, INV_TBTAREAS.FECHA_RESOL";
}
}
$resultado = sqlsrv_query($conn, $tsql);
if( $resultado === false ) {
die( print_r( sqlsrv_errors(), true));
}
//CTOS DE LA TAREA
$tsql = "SELECT INV_CTOS.NUMERO
FROM INV_TBTAREAS
INNER JOIN INV_TBTAREAS_CTO ON INV_TBTAREAS_CTO.ID = INV_TBTAREAS.id
INNER JOIN INV_CTOS ON INV_CTOS.COD_CTO = INV_TBTAREAS_CTO.COD_CTO
WHERE INV_TBTAREAS.ID = '$id'";
$ctosTarea = sqlsrv_query($conn, $tsql);
if( $resultado === false ) {
die( print_r( sqlsrv_errors(), true));
}
//crear array de gescales bloqueados para asisgnarselos a cada tarea en su linea
$tsql_gescales="SELECT INV_tbGESCALES.GESCAL AS GESCAL
FROM INV_tbBloqueos_Gescales
INNER JOIN INV_tbGESCALES ON INV_tbGESCALES.COD_GESCAL = INV_tbBloqueos_Gescales.COD_GESCAL
WHERE INV_tbBloqueos_Gescales.ID = '$id'";
$stmt_gescales = sqlsrv_query( $conn, $tsql_gescales);
$array_gescales = array();
while($row_gescal = sqlsrv_fetch_array($stmt_gescales)){
$array_gescales[] = $row_gescal;
}
//crear array de gescales desbloqueados para asisgnarselos a cada tarea en su linea
$tsql_gescales="SELECT INV_tbGESCALES.GESCAL AS GESCAL
FROM INV_tbDesbloqueos_Gescales
INNER JOIN INV_tbGESCALES ON INV_tbGESCALES.COD_GESCAL = INV_tbDesbloqueos_Gescales.COD_GESCAL
WHERE INV_tbDesbloqueos_Gescales.ID = '$id'";
$stmt_gescales = sqlsrv_query( $conn, $tsql_gescales);
while($row_gescal = sqlsrv_fetch_array($stmt_gescales)){
$array_gescales[] = $row_gescal;
}
?>
<!DOCTYPE html>
<html lang="es">
<head>
<!-- start: Meta -->
<meta charset="utf-8">
<title>Consulta detalle Tarea</title>
<meta name="description" content=">Consulta detalle Tarea">
<meta name="author" content="Eurocontrol">
<meta name="keyword" content="">
<!-- end: Meta -->
<!-- start: Mobile Specific -->
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- end: Mobile Specific -->
<!-- start: CSS -->
<link id="bootstrap-style" href="css/bootstrap.min.css" rel="stylesheet">
<link href="css/bootstrap-responsive.min.css" rel="stylesheet">
<link id="base-style" href="css/style.css" rel="stylesheet">
<link id="base-style-responsive" href="css/style-responsive.css" rel="stylesheet">
<link href='http://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800&subset=latin,cyrillic-ext,latin-ext' rel='stylesheet' type='text/css'>
<!-- end: CSS -->
<link href="css/bootstrapValidator.min.css" rel="stylesheet"></link>
<link href="css/inventario.css" rel="stylesheet">
<!-- The HTML5 shim, for IE6-8 support of HTML5 elements -->
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<link id="ie-style" href="css/ie.css" rel="stylesheet">
<![endif]-->
<!--[if IE 9]>
<link id="ie9style" href="css/ie9.css" rel="stylesheet">
<![endif]-->
<!-- start: Favicon -->
<link rel="shortcut icon" href="img/favicon.ico">
<!-- end: Favicon -->
</head>
<body>
<form method="post" action="consultaTarea.php" role="form">
<div class="modal-body-large">
<fieldset>
<!--DETALLE TAREA-->
<div class="row-fluid yellow">
<div class="control-group form-group span2">
<div class="controls" style="padding-left:5px;">
<strong>REGION: </strong><input readonly="true" type="text" class="form-control input uneditable-input" name="REGION" value="<?php echo $registro['REGION'];?>">
</div>
</div>
<div class="control-group form-group span2">
<div class="controls">
<strong>PROVINCIA: </strong><input readonly="true" type="text" class="form-control input uneditable-input" name="PROVINCIA" value="<?php echo $registro['PROVINCIA'];?>">
</div>
</div>
<div class="control-group form-group span2">
<div class="controls">
<strong>CABECERA: </strong><input readonly="true" type="text" class="form-control input uneditable-input" name="CABECERA" value="<?php echo $registro['CABECERA'];?>">
</div>
</div>
<div class="control-group form-group span2">
<div class="controls">
<strong>ARBOL: </strong><input readonly="true" type="text" class="form-control input uneditable-input" name="ARBOL" value="<?php echo $registro['ARBOL'];?>">
</div>
</div>
<div class="control-group form-group span2">
<div class="controls">
<strong>ID_ACTUACION: </strong><input readonly="true" type="text" class="form-control input uneditable-input" name="ID_ACTUACION" value="<?php echo $registro['ID_ACTUACION'];?>">
</div>
</div>
<div class="control-group form-group span2">
<div class="controls">
<strong>EEMM: </strong><input readonly="true" type="text" class="form-control input uneditable-input" name="REGION" value="<?php echo $registro['EEMM'];?>">
</div>
</div>
</div>
<div style="padding-left:5px;">
<div class="row-fluid">
<div class="span2" ontablet="span4" ondesktop="span2">
<div class="control-group form-group">
<div class="controls">
<strong>ID: </strong><br><input readonly="true" type="text" class="form-control input uneditable-input" name="ID" value="<?php echo $id;?>">
</div>
</div>
<div class="control-group form-group">
<div class="controls">
<strong>ID_GD: </strong><input readonly="true" type="text" class="form-control input uneditable-input" name="ID_GD" value="<?php echo $registro['ID_GD'];?>">
</div>
</div>
<div class="control-group form-group">
<div class="controls">
<strong>REF: </strong><br><input readonly="true" type="text" class="form-control input uneditable-input" name="REF" value="<?php echo $registro['REF'];?>">
</div>
</div>
<div class="control-group form-group">
<div class="controls">
<strong>REF. ASOCIADA: </strong><input readonly="true" type="text" class="form-control input uneditable-input" name="REF_ASOCIADA" value="<?php echo $registro['REF_ASOCIADA'];?>">
</div>
</div>
<div class="control-group form-group">
<div class="controls">
<strong>ESTADO: </strong><input readonly="true" type="text" class="form-control input uneditable-input" name="ESTADO" value="<?php echo $registro['ESTADO'];?>">
</div>
</div>
</div>
<div class="span2" ontablet="span4" ondesktop="span2">
<div class="control-group form-group">
<div class="controls">
<strong>PRIORIDAD: </strong><input readonly="true" type="text" class="form-control input uneditable-input" name="PRIORIDAD" value="<?php echo $registro['PRIORIDAD'];?>">
</div>
</div>
<div class="control-group form-group">
<div class="controls">
<strong>ACTIVIDAD: </strong><input readonly="true" type="text" class="form-control input uneditable-input" name="ACTIVIDAD" value="<?php echo $registro['Actividad'];?>">
</div>
</div>
<div class="control-group form-group">
<div class="controls">
<strong>SUBACTIVIDAD: </strong><input readonly="true" type="text" class="form-control input uneditable-input" name="SUBACTIVIDAD" value="<?php echo $registro['SUBACTIVIDAD'];?>">
</div>
</div>
<div class="control-group form-group">
<div class="controls">
<strong>TICKET REMEDY: </strong><input readonly="true" type="text" class="form-control input uneditable-input" name="INCIDENCIA" value="<?php echo $registro['INCIDENCIA'];?>">
</div>
</div>
<div class="control-group form-group">
<div class="controls">
<strong>ID_TIPO_ENTRADA: </strong><input readonly="true" type="text" class="form-control input uneditable-input" name="ID_TIPO_ENTRADA" value="<?php echo $registro['ID_TIPO_ENTRADA'];?>">
</div>
</div>
</div>
<div class="span2" ontablet="span4" ondesktop="span2">
<div class="control-group form-group">
<div class="controls">
<strong>FECHA_INICIO: </strong><input readonly="true" type="text" class="form-control input uneditable-input" name="FECHA_INICIO" value="<?php echo date_format($registro['FECHA_INICIO'], 'Y-m-d H:i:s'); ?>">
</div>
</div>
<div class="control-group form-group">
<div class="controls">
<strong>FECHA_RESOL: </strong><input readonly="true" type="text" class="form-control input uneditable-input" name="FECHA_RESOL" value="<?php echo date_format($registro['FECHA_RESOL'], 'Y-m-d H:i:s'); ?>">
</div>
</div>
<div class="control-group form-group">
<div class="controls">
<strong>FECHA_REGISTRO: </strong><input readonly="true" type="text" class="form-control input uneditable-input" name="FECHA_REGISTRO" value="<?php echo date_format($registro['FECHA_REGISTRO'], 'Y-m-d H:i:s'); ?>">
</div>
</div>
<div class="control-group form-group">
<div class="controls">
<strong>TICKET_OCEANE: </strong><input readonly="true" type="text" class="form-control input uneditable-input" name="TICKET_OCEANE" value="<?php echo $registro['TICKET_OCEANE'];?>">
</div>
</div>
<div class="control-group form-group">
<div class="controls">
<strong>ID_MAPEO: </strong><input readonly="true" type="text" class="form-control input uneditable-input" name="ID_MAPEO" value="<?php echo $registro['ID_MAPEO'];?>">
</div>
</div>
</div>
<div class="span2" ontablet="span4" ondesktop="span2">
<div class="control-group form-group">
<div class="controls">
<strong>USUORIGEN: </strong><input readonly="true" type="text" class="form-control input uneditable-input" name="USUORIGEN" value="<?php echo $registro['USUORIGEN'];?>">
</div>
</div>
<div class="control-group form-group">
<div class="controls">
<strong>GRUPO: </strong><input readonly="true" type="text" class="form-control input uneditable-input" name="GRUPO" value="<?php echo $registro['GRUPO'];?>">
</div>
</div>
<div class="control-group form-group">
<div class="controls">
<strong>GRUPO_ESCALADO: </strong><input readonly="true" type="text" class="form-control input uneditable-input" name="GRUPO_ESCALADO" value="<?php echo $registro['GRUPO_ESCALADO'];?>">
</div>
</div>
<div class="control-group form-group">
<div class="controls">
<strong>TP: </strong><br><input readonly="true" type="text" class="form-control input uneditable-input" name="TP" value="<?php echo $registro['TP'];?>">
</div>
</div>
<div class="control-group form-group">
<div class="controls">
<strong>TIPO_INCIDENCIA: </strong><br><input readonly="true" type="text" class="form-control input uneditable-input" name="TP" value="<?php echo $registro['TIPO_INCIDENCIA'];?>">
</div>
</div>
</div>
<div class="span2" ontablet="span4" ondesktop="span2">
<div class="control-group form-group">
<div class="controls ctos">
<strong>CTOS: </strong><br>
<?php
$rows = sqlsrv_has_rows($ctosTarea );
if ($rows === true){
while ($cto = sqlsrv_fetch_array($ctosTarea)){
echo '<input readonly="true" type="text" class="form-control input uneditable-input" value="'.$cto['NUMERO'].'">';
}
}
?>
</div>
</div>
</div>
<div class="span2" ontablet="span4" ondesktop="span2">
<div class="control-group form-group">
<div class="controls gescales">
<strong>GESCALES: </strong><br>
<?php
foreach($array_gescales as $key=>$data) {
echo '<input readonly="true" type="text" class="form-control input uneditable-input" value="'.$data['GESCAL'].'">';
}
?>
</div>
</div>
</div>
<div class="row-fluid">
<div class="control-group form-group span11">
<div class="controls">
<strong>COMENTARIOS: </strong><textarea readonly="true" class="form-control" name="COMENTARIOS"><?php echo $registro['COMENTARIOS'];?></textarea>
</div>
</div>
</div>
<div class="row-fluid">
<div class="control-group form-group span11">
<div class="controls">
<strong>COMENTARIOS2: </strong><textarea readonly="true" type="text" class="form-control" name="COMENTARIOS2"><?php echo $registro['COMENTARIOS2'];?></textarea>
</div>
</div>
</div>
</div>
</fieldset>
<!--FIN DETALLE-->
<!--LISTADO DE TAREAS ASOCIADAS-->
<div class="row-fluid asociadas">
<div class="box span12">
<div class="box-header" data-original-title>
<h2><i class="halflings-icon user"></i><span class="break"></span>Listado Tareas Asociadas</h2>
</div>
<div class="box-content">
<table class="table table-striped table-bordered bootstrap-datatable datatable">
<thead>
<tr>
<th>ID_TAREA</th>
<th>REMEDY</th>
<th>REFERENCIA</th>
<th>OCEAN</th>
<th>ACTIVIDAD</th>
<th>SUBACTIVIDAD</th>
<th>SOLICITANTE</th>
<th>TÉCNICO</th>
<th>F.REGIS.</th>
<th>F.INIC.</th>
<th>F.RESOL.</th>
<th>ESTADO</th>
<th>P</th>
</tr>
</thead>
<tbody>
<?php while ($lineaAsoc = sqlsrv_fetch_array($resultado)){ ?>
<td class="center"><?php echo $lineaAsoc['ID_TAREA']; ?></td>
<td class="center"><?php echo $lineaAsoc['REMEDY']; ?></td>
<td class="center"><?php echo $lineaAsoc['REF_TBTAREA']; ?></td>
<td class="center"><?php echo $lineaAsoc['OCEANE_TBTAREA']; ?></td>
<td class="center"><?php echo $lineaAsoc['Actividad']; ?></td>
<td class="center"><?php echo $lineaAsoc['SUBACTIVIDAD']; ?></td>
<td class="center"><?php echo $lineaAsoc['USUORIGEN']; ?></td>
<td class="center"><?php echo $lineaAsoc['TECNICO']; ?></td>
<td class="center"><?php echo date_format($lineaAsoc['FECHA_REGISTRO'], 'Y-m-d H:i:s'); ?></td>
<td class="center"><?php echo date_format($lineaAsoc['FECHA_INICIO'], 'Y-m-d H:i:s'); ?></td>
<td class="center"><?php echo date_format($lineaAsoc['FECHA_RESOL'], 'Y-m-d H:i:s'); ?></td>
<td class="center"><?php echo $lineaAsoc['ESTADO']; ?></td>
<td class="center"><?php echo $lineaAsoc['PRIORIDAD']; ?></td>
<td class="center">
<INPUT TYPE="submit" class="btn btn-success btn-mini" value="Consultar" onclick = "this.form.action = 'consultaTarea.php?id=<?php echo $lineaAsoc['ID_TAREA']; ?>'">
</td>
</a>
</tr>
<?php }
sqlsrv_free_stmt($resultado);
sqlsrv_close($conn);
?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Cerrar</button>
</div>
</form>
</body>
</html>
<!--maiteben: ejecuta la consulta sobre la ventana modal en la que está actualmente -->
<script type="text/JavaScript">
$('form').submit(function (event) {
event.preventDefault();
var $form = $(this);
$.ajax({
url: this.action,
type: this.method,
contentType: this.enctype,
data: $(this).serialize(),
success: function (result) {
if (result.success) {
$('#viewModalT').modal('hide');
//Refresh
location.reload();
} else {
$('.ct').html(result);
bindForm();
}
}
});
});
</script>