This repository was archived by the owner on Jul 5, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsearch.php
More file actions
166 lines (157 loc) · 5.49 KB
/
search.php
File metadata and controls
166 lines (157 loc) · 5.49 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
<?php
;include ('tpl\header.tpl.php')
;include ('functions\workingdays.php')
;include ('functions\functions.php')
?>
<?php
//Define si es TK u OL
if(isset($_GET['TK'])){
$tk = $_GET['TK'];
// echo "Agarro TK";
$fromsearch = "Tickets";
$ticketfieldsearch = "mnTicketNumber";
}
if(isset($_GET['OL'])){
$tk = $_GET['OL'];
// echo "Agarro OL";
$fromsearch = "TicketsOL";
$ticketfieldsearch = "mnOLTicket";
}
//Query primera tabla
if(($con=odbc_connect("PTTO","",""))=== false ) //Database connect.
die("connection error"); //Database connect.
$sql="SELECT TOP 1 * from $fromsearch where $ticketfieldsearch like ('%".$tk."%') ORDER BY $ticketfieldsearch DESC, mnTicketLineNumber DESC" ; //Sql query.
if(($result=odbc_exec($con,$sql))=== false ) //Run query and validate.
die("Query error." .odbc_errormsg($sql)); //Run query and validate.
echo"<div class=\"container\"><h1>Details<small></small></h1></div>";
//CABECERAS
//Caso busqueda de TK
if(isset($_GET['TK'])){
echo "<div class=\"container\">
<table class=\"table primary table-striped table-bordered table-hover\">
<tr>
<th>Ticket Number</th>
<th>Team</th>
<th>Status</th>
<th>Tk created</th>
<th>Requestor</th>
<th>Description</th>
<th>Analyst</th>
</tr>";
//Caso busqueda de Unnasigned
}else{
echo "<div class=\"container\">
<table class=\"table primary table-striped table-bordered table-hover\">
<tr>
<th>Team</th>
<th>Time created</th>
<th>Requestor</th>
<th>Description</th>
<th>Time Delayed</th>
</tr>";
}
//Cuerpos
while($row = odbc_fetch_array($result))
{
//Caso de TK
if(isset($_GET['TK'])){
echo "<tr>
<td>TK".str_pad($row['mnTicketNumber'], 8, "0", STR_PAD_LEFT)."</td>
<td>".$row['szTeam']."</td>
<td>".$row['szStatus']."</td>
<td class=\"text-nowrap\">".$row['gdCreationDate']."</td>
<td >".$row['szRequestor']."</td>
<td>".$row['szDescription']."</td>
<td class=\"text-nowrap\">".$row['szResponsible']."</td>
</tr>";
//Caso de OL
}else{
$open = $row['gdReceived'];
$TimePassed = number_of_working_days($open , datetimenow());
echo "<tr>
<td>".$row['szTeam']."</td>
<td class=\"text-nowrap\">".$open."</td>
<td >".$row['szFROM']."</td>
<td>".$row['szSubject']."</td>
<td class=\"text-nowrap\">$TimePassed WD</td>
</tr>";
}
}
echo "</table> </div>";
odbc_free_result($result);
odbc_close($con);
// //Query Segunda tabla
// if(($con=odbc_connect("PTTO","",""))=== false ) //Database connect.
// die("connection error"); //Database connect.
// $sql="SELECT * from $fromsearch where $ticketfieldsearch = ".$tk.";"; //Sql query.
// if(($result=odbc_exec($con,$sql))=== false ) //Run query and validate.
// die("Query error." .odbc_errormsg($sql)); //Run query and validate.
// echo"<div class=\"container\">
// <h1>History<small></small></h1>
// </div>";
// //Cabeceras
// //Caso busqueda TK
// if(isset($_GET['TK'])){
// echo "<div class=\"container\">
// <table class=\"table primary table-striped table-bordered table-hover\">
// <tr>
// <th>Ticket Number</th>
// <th>N°</th>
// <th>Team</th>
// <th>Status</th>
// <th>Tk created</th>
// <th>Requestor</th>
// <th>Description</th>
// <th>Analyst</th>
// </tr>";
// //Caso busqueda unnnasigned
// }else{
// echo "<div class=\"container\">
// <table class=\"table primary table-striped table-bordered table-hover\">
// <tr>
// <th>N°</th>
// <th>Team</th>
// <th>Time created</th>
// <th>Requestor</th>
// <th>Description</th>
// <th>Time Delayed</th>
// </tr>";
// }
// while($row = odbc_fetch_array($result))
// {
// //Cuerpo
// //Caso TK
// if(isset($_GET['TK'])){
// echo "<tr>
// <td>TK" .$row['mnTicketNumber']."</td>
// <td>" .$row['mnTicketLineNumber']."</td>
// <td>".$row['szTeam']."</td>
// <td>".$row['szStatus']."</td>
// <td class=\"text-nowrap\">".$row['gdCreationDate']."</td>
// <td >".$row['szRequestor']."</td>
// <td>".$row['szDescription']."</td>
// <td class=\"text-nowrap\">".$row['szResponsible']."</td>
// </tr>";
// }
// //Caso OL
// else{
// $open = $row['gdReceived'];
// $TimePassed = number_of_working_days($open , datetimenow());
// echo "<tr>
// <td>" .$row['mnTicketLineNumber']."</td>
// <td>".$row['szTeam']."</td>
// <td class=\"text-nowrap\">".$row['gdReceived']."</td>
// <td >".$row['szFROM']."</td>
// <td>".$row['szSubject']."</td>
// <td class=\"text-nowrap\">$TimePassed WD</td>
// </tr>";
// }
// }
// echo "</table> </div>";
// odbc_free_result($result);
// odbc_close($con);
?>
</body>
<?php
;include ('tpl\footer.tpl.php')
?>