-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexpense.php
104 lines (103 loc) · 3.56 KB
/
expense.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
<?php
ob_start();
require("config.php");
include("sidebar.php");
?>
<?php
if (isset($_GET['update-success'])) {
?>
<div class="container" id="dispnone"><div class='card mb-2 col-sm-5 col-lg-4 mx-auto' style="background-color: #4CFF65; color: green; border-color: green;text-align: center;"><div class='card-body'>Expense Table Updated</div></div></div>
<?php } ?>
<?php if (isset($_GET['del-success'])) { ?>
<div class="container" id="dispnone"><div class='card mb-2 col-sm-5 col-lg-3 mx-auto' style="background-color: #4CFF65; color: green; border-color: green;text-align: center;"><div class='card-body'>Row Deleted</div></div></div>
<?php } ?>
<?php
if (isset($_GET['update-failed'])) {
?>
<div class="container" id="dispnone"><div class="card mb-2 col-sm-5 col-lg-3 mx-auto" style="background-color: #FFAAA1; color: red; border-color: red;text-align: center;"><div class="card-body">Update Failed</div></div></div>
<?php } ?>
<!-- right side content -->
<div class="container">
<div class="row mb-1 mx-0">
<div class="col-sm-3 col-md-4">
<h2>Expense:-</h2>
</div>
</div>
<div class="table-responsive">
<table class="table display" id="datatable">
<thead>
<tr>
<th>#</th>
<th>Full Name</th>
<th>Reason</th>
<th>Amount</th>
<th>Date</th>
<th>Operation</th>
</tr>
</thead>
<?php
$string = "SELECT * FROM `expense` WHERE D_flag=0";
$temp = $sql->query($string);
$i=1;
while ($demo = $temp->fetch_row()) {
?>
<tbody>
<tr>
<td><?php echo $i; ?></td>
<td><?php $str = "SELECT * FROM `admin` WHERE `Admin_ID`=$demo[3]";
$tmp = $sql->query($str);
if ($row = $tmp->fetch_row()) {
echo "$row[1] $row[2]";
} ?></td>
<td><?php echo "$demo[1]"; ?></td>
<td><?php echo "$demo[2]"; ?></td>
<td><?php echo "$demo[4]"; ?></td>
<td>
<a data-toggle="modal" data-target="#deletebtn<?php echo $demo[0]; ?>" title="delete"><i class="fas fa-trash-alt text-danger"></i></a>
 
<a href="edit.php?eid=<?php echo $demo[0]; ?>"><i class="fas fa-user-edit text-dark"></i></a>
<!--------------------------------------------------------------------------------->
<!-- Modal for delete-->
<div class="modal fade" id="deletebtn<?php echo $demo[0]; ?>" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content bg-dark text-light">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Delete Operation</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
Are you sure you want to delete Expense ?
</div>
<div class="modal-footer ">
<button type="button" class="btn btn-light" data-dismiss="modal">
Close
</button>
<a href="delete.php?eid=<?php echo $demo[0]; ?>"><button type="button" class="btn btn-danger">Delete
</button>
</a>
</div>
</div>
</div>
</div>
</td>
<!----------------------------------------------------------------------------------------->
</tr>
</tbody>
<?php
$i++;
} ?>
</table>
</div>
</div>
</div>
</div>
<script type="text/javascript">
$(document).ready(function(e){
$('#expense , #dexpense').toggleClass('active');
$('#datatable').DataTable();
});
</script>
</body>
</html>