-
Notifications
You must be signed in to change notification settings - Fork 0
/
month.php
233 lines (193 loc) · 5.8 KB
/
month.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
<?php
//session_start();
?>
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="css/bootstrap.min.css">
<script src="jquery/jquery.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<style>
body {margin:0;}
.navbar {
overflow: hidden;
background-color: #333;
position: fixed;
bottom: 0;
width: 100%;
}
.topbar {
overflow: hidden;
position: fixed;
bottom: 100;
width: 103%;
}
.navbar a {
float: left;
display: block;
color: #f2f2f2;
text-align: center;
padding: 4px 3px;
}
.navbar a:hover {
background: #ddd;
color: black;
}
.main {
padding: 16px;
margin-bottom: 30px;
height: 1500px;
}
/* Create two equal columns that floats next to each other */
.column {
float: left;
width: 100%;
padding-left: 15px;
text-align: center;
}
/* Clear floats after the columns */
.row:after {
content: "";
clear: both;
}
.row{
margin-right: 0px;
}
.block {
display: block;
width: 100%;
border: none;
background-color: #4CAF50;
color: white;
font-size: 16px;
cursor: pointer;
text-align: center;
font-weight: bold;
}
.myTable {
background-color: lemonchiffon;
border-collapse: collapse;
border: 1px solid DarkOrange;
border-radius: 13px;
border-spacing: 0;
}
.myTable th {
background-color: goldenrod;
color: white;
}
.myTable td,
.myTable th {
padding: 10px;
border-bottom: 1px solid DarkOrange;
padding: 10px;
text-align: center;
}
.myTable tr:nth-child(even){background-color: #fff7ab;}
.myTable tr:nth-last-child(1){background-color: #000000;
border-bottom: none;
}
.label {
color: white;
padding: 8px;
font-family: Arial;
border-radius: 4em;
}
.success {background-color: #4CAF50;} /* Green */
.info {background-color: #2196F3;} /* Blue */
.warning {background-color: #ff9800;} /* Orange */
.danger {background-color: #f44336;} /* Red */
.other {background-color: #e7e7e7; color: black;} /* Gray */
.newcol {background-color: #FFCCBC; color: black;} /* Gray */
</style>
<!--
.myTable {
background-color: lemonchiffon;
border-collapse: collapse;
border: 1px solid DarkOrange;
border-radius: 13px;
border-spacing: 0;
}
.myTable th {
background-color: goldenrod;
color: white;
}
.myTable td,
.myTable th {
padding: 10px;
border-bottom: 1px solid DarkOrange;
padding: 10px;
}
.myTable tr:nth-child(even){background-color: #fff7ab;}
.myTable tr:nth-last-child(1){background-color: #000000;
border-bottom: none;
}
-->
</head>
<body background="bluebg.jpg">
<div class="navbar">
<a href="index.php" style="font-size: 3vh;">SELF EXP</a>
<a href="dailyexp.php" style="font-size: 3vh;">Daily</a>
<a href="month.php" style="font-size: 3vh;">Monthly</a>
<a href="chart.php" style="font-size: 3vh;">Charts</a>
</div>
</body>
<?php
//session_start();
include('db.php');
echo ' <table style="width:80%; font-size:3vh;" align="center" class="myTable">
<tr style="align:center;">
<th><span class="label newcol" style="font-size:3vh;">Month</span></th>
<th><span class="label newcol" style="font-size:3vh;">Budget</span></th>
<th><span class="label newcol" style="font-size:3vh;">Expense</span></th>
<th><span class="label newcol" style="font-size:3vh;">Saved</span></th>
</tr>';
#SELECT SUM(exptable.amount),exptable.month,exptable.year FROM exptable GROUP By month
#SELECT SUM(budgettable.budgetToday),budgettable.month,budgettable.year FROM budgettable GROUP By budgettable.month
#SELECT SUM(exptable.amount),exptable.month,exptable.year,SUM(budgettable.budgetToday) FROM exptable,budgettable WHERE exptable.month=budgettable.month GROUP BY month
$sql="SELECT * FROM budgetsum INNER JOIN expsum WHERE budgetsum.month=expsum.month";
$result_set= mysqli_query($db,$sql);
$sumtoday=0;
$sumtotal=0;
$totsaved=0;
$totspent=0;
$totbud=0;
while ($row=mysqli_fetch_array($result_set))
{
$bud=$row['allBudget'];
$spent=$row['allExp'];
$saved=$bud-$spent;
$totbud=$totbud+$bud;
$totsaved=$totsaved+$saved;
$totspent=$totspent+$spent;
$monthno = $row['month'];
$monthname = date("F", mktime(0, 0, 0, $monthno, 10));
// echo "<tr><td>{$monthname}</td><td>{$row['SUM(budgetToday)']}</td><td>{$row['SUM(amount)']}</td>";
echo "<tr><td><a href='charts.php?month=".$monthno."'>".$monthname."</a></td><td>{$row['allBudget']}</td><td>{$row['allExp']}</td>";
//ehco '<a href='newcharts.php?date=".$ndate."'>".$newDate."</a>';
//echo '<tr><td>{$monthname}</td><td>{$row["SUM(budgetToday)"]}</td><td>{$row["SUM(amount)"]}</td>';
if($saved>=0)
{
echo "<td><span class='label success' style='font-size:3vh;'>{$saved}</span></td></tr>\n";
}else
{
echo "<td><span class='label danger' style='font-size:3vh;'>{$saved}</span></td></tr>\n";
}
$sumtotal=$sumtotal+$saved;
}
echo "<br><div style='text-align:center'><span class='label other' style='font-size:5vh;'><b>TOTAL SAVINGS :</span> ";
if($sumtotal>=0)
{
echo "<span class='label success' style='font-size:5vh;'>";
echo "",$sumtotal,"</span></tr><br><br>";
echo '<tr style="background-color: #00ff00;">';
}
else
{
echo "<span class='label danger' style='font-size:5vh;'>";
echo "",$sumtotal,"</span></tr>";
echo '<tr style="background-color: #ff0000;">';
}
//echo "",$sumtotal,"</font></h1></tr>";
echo '<td><b>Total</b></td><td><b>',$totbud,'</b></td><td><b>',$totspent,'</b></td><td><b>',$totsaved,'</b></td></tr></table>';
mysqli_query($db,$sql);
?>