-
Notifications
You must be signed in to change notification settings - Fork 0
/
rep.php
187 lines (173 loc) · 6.46 KB
/
rep.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
<?php
include 'header.php';
include 'conn.php';
if (isset($_SESSION['id'])) {
?>
<div style="margin-left: 800px;">
<h2 style="margin-left: 50px;">Date Wise</h2><br>
<form action="" method="post">
<label for="s_date">STARTING DATE:</label>
<input type="date" id="s_date" name="s_date" required><br> <br>
<label for="e_date">ENDING DATE :</label>
<input type="date" id="e_date" style="margin-left: 7px;" name="e_date" required><br><br>
<input type="submit" style="margin-left: 150px;" name="confirm" value="submit"><br>
</form>
</div>
<!-- <hr> -->
<div style="margin-left: 400px; margin-top:-200px;">
<h2 style="margin-left: 50px;">Head Wise</h2><br>
<form action="" method="post">
<label for="head master">HEAD: </label>
<?php
echo "<select name='head'>";
echo "<option>Select</option>";
$sql = "SELECT * FROM head_master";
$head = mysqli_query($conn, $sql);
foreach ($head as $value) {
echo "<option value='" . $value['id'] . "'>" . $value['head'] . "</option>" . "<br />";
}
echo "</select>";
?>
<br><br>
<input type="submit" style="margin-left: 50px; margin-top:25px;" name="submit" value="submit"><br>
</form>
</div>
<?php
if (isset($_POST['confirm'])) {
// if($_POST['s_date'] && $_POST['e_date']){
$s_date = $_POST['s_date'];
$e_date = $_POST['e_date'];
$query = "select * from incexp where date between '$s_date' and '$e_date' order by date desc";
$result = mysqli_query($conn, $query);
?>
<div class="container"><br>
<h1 class="text-info text-center">Date Wise Report</h1>
<table class="table table-striped table-bordered text-center table-hover">
<tr class="table-dark">
<th> Sr No.</th>
<th> Head</th>
<th> Date</th>
<th>Income Amount</th>
<th>Expediture Amount</th>
<th>less amount</th>
</tr>
<?php
$sr = 1;
$itotal = 0;
$etotal = 0;
while ($data = mysqli_fetch_array($result)) {
?>
<tr>
<td>
<?php echo $sr ?>
</td>
<td>
<?php echo $data['head'] ?>
</td>
<td>
<?php echo $data['date'] ?>
</td>
<td>
<?php
if ($data['I'] == 'I') {
echo $data['amount'];
$itotal += $data['amount'];
}
else{
echo "_";
} ?>
</td>
<td>
<?php
if ($data['I'] == 'E') {
echo $data['amount'];
$etotal += $data['amount'];
} else{
echo "_";
}?>
</td>
</tr>
<?php
$sr++;
}
?>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td align="center"><?php echo "I Total: ", $itotal; ?></td>
<td align="center"><?php echo "E Total: ", $etotal; ?></td>
<td align="center"><?php echo $total = $itotal - $etotal; ?></td>
</tr>
</table>
<?php
}
if (isset($_POST['submit'])) {
$head = $_POST['head'];
$query = "select * from incexp where id = '$head' order by date desc";
$result = mysqli_query($conn, $query);
?>
<div class="container"><br>
<h1 class="text-info text-center">head wise </h1>
<table class="table table-striped table-bordered text-center table-hover">
<tr class="table-dark">
<th> Sr No.</th>
<!-- <th> Head</th> -->
<th> Date</th>
<th>Income Amount</th>
<th>Expediture Amount</th>
<th>less amount</th>
</tr>
<?php
$sr = 1;
$itotal = 0;
$etotal = 0;
while ($data = mysqli_fetch_array($result)) {
?>
<tr>
<td>
<?php echo $sr ?>
</td>
<td>
<?php echo $data['date'] ?>
</td>
<td>
<?php
if ($data['I'] == 'I') {
echo $data['amount'];
$itotal += $data['amount'];
}
else{
echo "_";
}?>
</td>
<td>
<?php
if ($data['I'] == 'E') {
echo $data['amount'];
$etotal += $data['amount'];
}
else{
echo "_";
}?>
</td>
</tr>
<?php
$sr++;
}
?>
<tr>
<!-- <td> </td> -->
<td> </td>
<td> </td>
<td align="center"><?php echo "I Total: ", $itotal; ?></td>
<td align="center"><?php echo "E Total: ", $etotal; ?></td>
<td align="center"><?php echo $total = $itotal - $etotal; ?></td>
</tr>
</table>
<?php
}
exit();
} else {
header('location:index.php');
} ?>