-
Notifications
You must be signed in to change notification settings - Fork 0
/
paylevy.php
230 lines (197 loc) · 8.51 KB
/
paylevy.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
<?php
require 'includes/conn.php';
if (!isset($_SESSION['admin'])) {
header('Location:index.php');
}
$msg = "";
if (isset($_GET['name'])) {
$names = mysqli_real_escape_string($con, $_GET['name']);
$getlevy = mysqli_query($con, "SELECT * FROM levy WHERE name = '".$names."' AND paid = false");
$getlevy2 = mysqli_query($con, "SELECT * FROM levy WHERE name = '".$names."' AND paid = false");
if (mysqli_num_rows($getlevy)) {
while($gt = mysqli_fetch_assoc($getlevy2)){
$amount = $gt['amount'];
}
} else {
$msg = "No Members are owing this debt";
}
} else {
header("Location:index.php");
}
if (isset($_GET['status'])) {
$status = mysqli_real_escape_string($con, $_GET['status']);
} else {
header("Location:index.php");
}
if (isset($_POST['submit'])) {
$members = $_POST['member'];
$date = date('d/m/Y');
foreach ($members as $member) {
$getmem = mysqli_query($con, "SELECT * FROM members WHERE id = '".$member."'");
while ($a = mysqli_fetch_assoc($getmem)) {
$fname = $a['fname'];
$sname = $a['sname'];
$by = $fname." ".$sname;
$recno = mysqli_real_escape_string($con, $_POST[$a['id']]);
}
$pay = mysqli_query($con, "UPDATE levy SET paid = true WHERE member_id = '".$member."' AND name = '".$names."'");
$indate = mysqli_query($con, "UPDATE levy SET `date` = '".$date."' WHERE member_id = '".$member."' AND name = '".$names."'");
$inrec = mysqli_query($con, "UPDATE levy SET recipt_no = '".$recno."' WHERE member_id = '".$member."'");
$inlog = mysqli_query($con, "INSERT INTO bank_log VALUES('', 'Paid Levy', '".$date."')");
}
header("Location:viewlevy.php?name=$names&paid=FALSE");
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="">
<meta name="author" content="">
<?php
require 'includes/header.php';
?>
<title>IPU - Pay levy</title>
<!-- Custom fonts for this template-->
</head>
<body id="page-top">
<!-- Page Wrapper -->
<div id="wrapper">
<!-- Sidebar -->
<?php
require 'includes/sidebar.php';
?>
<!-- End of Sidebar -->
<!-- Content Wrapper -->
<div id="content-wrapper" class="d-flex flex-column">
<!-- Main Content -->
<div id="content">
<!-- Topbar -->
<?php
require 'includes/topbar.php';
?>
<!-- Begin Page Content -->
<div class="container-fluid">
<!-- Page Heading -->
<h1 class="h3 mb-4 text-gray-800">Ichida Progress Union | Payment of <?php echo $names?></h1>
<!-- /.container-fluid -->
<form action="paylevy.php?name=<?php echo $names?>&status=FALSE" method="post" style="width:100%;">
<div class="card shadow mb-4">
<div class="card-header py-3">
<h6 class="m-0 font-weight-bold text-primary">Select Paying Members</h6></div>
<div class="card-body">
<div class="table-responsive">
<?php
$i = 1;
echo "<table class='table table-bordered' id='dataTable' width='100%' cellspacing='0'>
<thead>
<tr>
<th>#</th>
<th>Membership Number</th>
<th>Name</th>
<th>Group</th>
<th>Receipt Number</th>
</tr>
</thead>
<tfoot>
<tr>
<th>#</th>
<th>Membership Number</th>
<th>Name</th>
<th>Group</th>
<th>Receipt Number</th>
</tr>
</tfoot>
<tbody>";
while ($a = mysqli_fetch_assoc($getlevy)) {
$memid = $a['member_id'];
$getname = mysqli_query($con, "SELECT * FROM members WHERE id = '".$memid."'");
while ($b = mysqli_fetch_assoc($getname)) {
$bfname = $b['fname'];
$bsname = $b['sname'];
$boname = $b['oname'];
$phone = $b['phone'];
$gn = $b['group_no'];
$mn = $b['mem_number'];
$getgroup = mysqli_query($con, "SELECT * FROM groups WHERE id = '".$gn."'");
while ($gotg = mysqli_fetch_assoc($getgroup)) {
$gname = $gotg['name'];
echo "<tr>
<td><label class='checkbox'>
<input type='checkbox' name='member[]' onchange='showRecipt($memid)' value='".$memid."'> </label></td>
<td>".$mn."</td>
<td>
".$bfname." ".$boname." ".$bsname."
<br>
</td>
<td>".$gname."</td>
<td><input style='display:none;' class='form-control animated fadeIn' name='".$memid."' id='".$memid."' type='text' placeholder='Enter recipt number'></td>
</tr>";
}
}
$i++;
}
echo "</tbody>
</table>";
?>
<br>
<?php
echo $msg;
?>
<div class="column text-center">
<input type="submit" name="submit" value="Pay" class="btn btn-success"> <a href="viewlevy.php?name=<?php echo $name?>&paid=<?php echo $status?>" class="btn btn-danger">Cancel</a>
</div>
</form>
</div>
</div></div>
</div>
</div>
<!-- End of Main Content -->
<!-- Footer -->
<footer class="sticky-footer bg-white">
<div class="container my-auto">
<div class="copyright text-center my-auto">
<span>Copyright © IPU 2019</span>
</div>
</div>
</footer>
<!-- End of Footer -->
</div>
<!-- End of Content Wrapper -->
</div>
<!-- End of Page Wrapper -->
<!-- Scroll to Top Button-->
<a class="scroll-to-top rounded" href="#page-top">
<i class="fas fa-angle-up"></i>
</a>
<?php
require 'includes/logoutmodal.php';
?>
<!-- Bootstrap core JavaScript-->
<?php
require 'includes/scriptstables.php';
?>
</body>
<script>
function showbtn() {
var btn = document.getElementById("cat");
var show = document.getElementById("show")
if (btn.value == "none") {
show.style.display = 'none';
}else{
show.style.display = "block";
}
}
function showRecipt(inid, bfname){
var inid = inid;
var input = document.getElementById(inid);
if (input.style.display === "none") {
input.style.display = "block";
}else{
input.style.display = "none";
}
}
</script>
</html>