-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuser_account_report.php
133 lines (107 loc) · 2.79 KB
/
user_account_report.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
<?php
if(!isset($_SESSION)){
session_start(); // starting session for checking username
}
if(is_null($_SESSION['username']))
{
header("location:index.php"); // Redirect to login.php page
}
?>
<?php
include"user_header.php";
?>
<div class="page-content">
<div class="row">
<div class="col-lg-12">
<div class="well">
<h2>Users Account Report</h2>
<form action="" class="form-inline">
<td> From<input type="date" name /></td>
<td> TO<input type="date" name /></td>
<td><input type="submit" class="btn btn-success"/></td>
</form>
</div>
</div>
</div>
</div>
<div class="page-content">
<div class="row">
<div class="col-lg-12">
<div class="well">
<table>
<tr>
<th>sl no</th>
<th>Product code</th>
<th>Product name</th>
<th>selling price</th>
<th>total amount</th>
</tr>
<?php
require_once('connection.php');
$i=0;
$user = $_SESSION['username'] ;
$result = "SELECT * FROM `confirm-sell` WHERE `user` = '$user' order by `user` ASC";
$query = mysql_query($result) or die (mysql_error());
while ($row = mysql_fetch_array($query))
{
$i++;
?>
<tr>
<td><?php echo $i ; ?></td>
<td><?php echo $row['Pro_code']; ?></td>
<td><?php echo $row['pro_name']; ?></td>
<td><?php echo $row['selling_price']; ?></td>
<td><?php echo $row['total_amount']; ?></td>
</tr>
<?php
}
?>
</table>
</div>
</div>
</div>
</div>
<div class="page-content">
<div class="row">
<div class="col-lg-12">
<div class="well">
<table>
<?php
require_once('connection.php');
$result_amount = "SELECT sum(`profit_amount`) as total_val FROM `products`";
$query_amount = mysql_query($result_amount) or die (mysql_error());
$result_query = mysql_query("SELECT sum(`selling_price`) as total_val FROM `products`");
$result_qer = mysql_query("SELECT sum(`total_cost`) as total_val FROM `products`");
while ($count3 = mysql_fetch_assoc($result_qer) ) {
$sum3 =$count3['total_val'];
}
while ($count2 = mysql_fetch_assoc($result_query) ) {
$sum2 =$count2['total_val'];
}
while ($count = mysql_fetch_assoc($query_amount) ) {
$sum = $count['total_val'];
}
?>
<tr>
<td>total purchasing cost:</td>
<td><?php echo $sum3; ?></td> </br>
<td>total selling cost:</td>
<td><?php echo $sum2; ?></td> </br>
<td>total profit amount:</td>
<td><?php echo $sum; ?></td> </br>
</tr>
</table>
</div>
</div>
</div>
</div>