-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathasset.php
More file actions
79 lines (71 loc) · 2.48 KB
/
Copy pathasset.php
File metadata and controls
79 lines (71 loc) · 2.48 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
<?php
echo "<html>";
echo "<head>";
echo "<title>AutoNet\\ Asset</title>";
echo "</head>";
echo "<body bgcolor=#009999 lang=EN-US style='tab-interval:.5in'>";
echo "<P fontsize=15 align=center> AutoNet\\ Asset </p>";
echo "<br>";
echo "<br>";
$gotvar=$_GET['type'];
//echo $gotvar;
if ($gotvar=='sum') summary();
if ($gotvar=='full') full();
function summary(){
echo "<BR><BR><table border=1 align = center>";
echo "<tr>";
echo "<td>Name</td><td>Part Number</td><td>Qty</td><td>Category</td><td>Vendor</td>";
echo "</tr>";
$host="127.0.0.1";
$user="root";
$password="rezasql";
# Connect to MySQL server
$conn = mysql_connect($host,$user,$password)
or die(mysql_error());
# Select the database
mysql_select_db("", $conn)
or die(mysql_error());
# Send SQL query
$sql="select name,item,sum(qty) as qty,category,vendor from asset group by 1,2 order by 5,4,2";
// echo "<R> $sql<BR>";
$result = mysql_query($sql)
or die(mysql_error());
while ($row=mysql_fetch_assoc($result)){
echo "<tr><td>".$row['name']."</td><td>".$row['item']."</td><td>".$row['qty']."</td><td>".$row['category']."</td><td>".$row['vendor']."</td></tr>";
}
echo "</table>";
}
function full(){
echo "<BR><BR><table border=1 align = center>";
echo "<tr>";
echo "<td>Name</td><td>Part Number</td><td>SR-NO</td><td>Qty</td><td>Category</td><td>Vendor</td><td>Installed?</td><td>Location</td><td>Delivered Date</td>";
echo "</tr>";
$host="127.0.0.1";
$user="root";
$password="rezasql";
# Connect to MySQL server
$conn = mysql_connect($host,$user,$password)
or die(mysql_error());
# Select the database
mysql_select_db("", $conn)
or die(mysql_error());
# Send SQL query
$sql="select name,item,srno,qty,category,vendor,location,delivered_date as dt from asset order by 5,6,2";
// echo "<R> $sql<BR>";
$result = mysql_query($sql)
or die(mysql_error());
while ($row=mysql_fetch_assoc($result)){
$srno=$row['srno'];
$loc=$row['location'];
if ($srno=='') $srno='N/A';
if ($loc=='wearhouse') $installed='NO';
if ($loc!='wearhouse') $installed='YES';
echo "<tr><td>".$row['name']."</td><td>".$row['item']."</td><td>".$srno."</td><td>";
echo $row['qty']."</td><td>".$row['category']."</td><td>".$row['vendor']."</td><td>";
echo $installed."</td><td>".$loc."</td><td>".$row['dt']."</td></tr>";
}
echo "</table>";
}
echo "</body>";
echo "</html>";
?>