-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathview_profit.php
More file actions
69 lines (58 loc) · 1.85 KB
/
view_profit.php
File metadata and controls
69 lines (58 loc) · 1.85 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
<?php
session_start();
if(!isset($_SESSION['IS_AUTHENTICATED']) || $_SESSION['IS_AUTHENTICATED']!=true){
header("location: login_modified.php");
exit();
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="tablecss.css">
<title>Sales</title>
</head>
<body style="background-color:#d8f3f8">
<center> <button onclick="window.print()">PRINT PROFIT DETAILS</button></center>
<?php require "menu.php" ?>
<br><br>
<center>
<h2 style="font-size:50px">Profit Details</h2>
</center>
<br><br>
<center>
<div>
<table class="styled-table">
<?php
$db=mysqli_connect('localhost','root','','test');
if(!$db){
die('Unable to select database');
}
$qry='SELECT transaction_id,amount,quantity*price*0.15 as profit,date FROM sales order by date desc';
$result=mysqli_query($db,$qry);
echo"<thead>
<tr>
<th>Transaction Id</th>
<th>Amount</th>
<th>Profit</th>
<th>Date</th>
</tr>
</thead>
<tbody>";
while($row=mysqli_fetch_assoc($result)){
echo"
<tr>
<td>".$row['transaction_id']."</td>
<td>".$row['amount']."</td>
<td>".$row['profit']."</td>
<td>".$row['date']."</td>
</tr>";
}
echo"</tbody>";
?>
</table>
</div>
</center>
</body>
</html>