-
Notifications
You must be signed in to change notification settings - Fork 1
/
khalek_status.php
200 lines (146 loc) · 5.23 KB
/
khalek_status.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
<?php
ob_start();
session_start();
if($_SESSION['name']!='snchousebd')
{
header('location: login.php');
}
?>
<?php include_once('header.php'); ?>
<?php include_once('sidebar.php'); ?>
<!-- Main content -->
<section class="content">
<?php include_once('header_shop.php'); ?>
<!-- Main row -->
<div class="row">
<!-- Left col -->
<section class="col-lg-4 connectedSortable">
<section class="panel" style="padding-left:25px;">
<!-- Custom tabs (Charts with tabs)-->
<?php
$statement2 =$db->prepare("SELECT sum(loan_take) as total_loan ,sum(loan) as remaining_loan FROM tbl_khalek");
$statement2->execute(array());
$result2 = $statement2->fetch();
?>
<h4><?php echo "Total Loan Taken : ".$result2['total_loan']; ?> </h4>
<h4><?php echo "Total Remaining Loan : ".$result2['remaining_loan']; ?> </h4>
</section>
</section>
</div>
<div class="row">
<!-- Left col -->
<section class="col-lg-12 connectedSortable">
<!-- Custom tabs (Charts with tabs)-->
<section class="panel">
<div class="panel-body bio-graph-info">
<form method="POST" >
<div class="form-group">
<h3>Cost Management For :</h3>
<select class="form-control" name="product">
<option value="All">From The Begining</option>
<option value="7">Last Week</option>
<option value="30">Last Month</option>
<option value="180">Last 6 Months</option>
<option value="365">Last 1 Year</option>
</select><br>
<input class="btn btn-info" style="float:right;" type="submit" value="Select"/>
</div>
</form>
</div>
</section>
<!--------- page start-->
<?php include_once("config.php");?>
<?php
if(isset($_POST['product']))
{
$value=$_POST['product'];
}
else
{
$value="All";
}
?>
<div class="panel panel-default">
<div class="panel-heading">List of Products <?php
if($value==7)
{
echo " For Last Week";
}else if($value==30)
{
echo " For Last Month";
}else if($value==180)
{
echo " For Last 6 Months";
} else if($value==365)
{
echo " For Last Last Year";
}
else
{
echo "From The Begining";
}
?>
</div>
<!-- /.box-header -->
<div class="panel-body">
<div class="table-responsive">
<table class="table table-striped table-bordered table-hover" id="dataTables-example" >
<thead>
<tr>
<th>Date</th>
<th>Shop Cost</th>
<th>Bank Cost</th>
<th>Salary Cost</th>
<th>Payment To Company</th>
<th>Loan Taken</th>
<th>Remaining Loan</th>
<th>Total Balance</th>
</tr>
</thead>
<tbody style="text-align:center">
<?php
if($value!="All")
{
$statement =$db->prepare("SELECT * FROM tbl_khalek where date>DATE_SUB(CURDATE(), INTERVAL ? DAY)");
$statement->execute(array($value));
}
else
{
$statement =$db->prepare("SELECT * FROM tbl_khalek");
$statement->execute(array());
}
$result = $statement->fetchAll(PDO::FETCH_ASSOC);
foreach ($result as $row) {
?>
<tr>
<td><?php echo $row['date']; ?></td>
<td><?php echo $row['total_cost']; ?></td>
<td><?php echo $row['bank_cost']; ?></td>
<td><?php echo $row['salary_cost']; ?></td>
<td><?php echo $row['payment_company']; ?></td>
<td><?php echo $row['loan_take']; ?></td>
<td><?php echo $row['loan']; ?></td>
<td><?php echo $row['balance']; ?></td>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
<!-- /.box-body -->
</div>
<!-- /.box -->
</div>
<!-- /.col -->
</div>
</div>
</section>
</div>
<!-- /.row (main row) -->
</section>
<!-- /.content -->
</div>
<!-- /.content-wrapper -->
<!-- /.control-sidebar -->
<?php include_once('footer.php'); ?>