-
Notifications
You must be signed in to change notification settings - Fork 0
/
payment.php
217 lines (199 loc) · 8.29 KB
/
payment.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
<?php
session_start();
include 'includes/dbConnection.php';
if (!$_SESSION["user_name_loggedIn_admin"]) {
$_SESSION["expired_session"] = "Your session has been expired, relog in!";
header("Location: index.php");
}
$sql = 'SELECT pay_id FROM payment';
$query = mysqli_query($con, $sql);
if (!$query) {
die('SQL Error:' . mysqli_error($con));
}
$row = mysqli_fetch_array($query);
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="description" content="">
<meta name="author" content="">
<title>AX GYM</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="css/style.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script src="js/scripts.js"></script>
<!-- Page level plugin CSS-->
<link href="vendor/datatables/dataTables.bootstrap4.css" rel="stylesheet">
<?php include 'globalExternals/components.php'; ?>
</head>
<body id="page-top" class="fixed-nav">
<?php include 'navigations/NavigationBar.php'; ?>
<div id="wrapper">
<div id="content-wrapper">
<div class="container-fluid">
<section class="content">
<br>
<div class="col-md-12 box box-default">
<div class="box-header">
<section class="content-header">
<h1>
<i class="fa fa-money"></i>
Payments
</h1>
</section>
</div>
<hr>
<div class="container" id="member-registration-container">
<button type="button" class="btn btn-info" data-toggle="modal" data-target="#myModal"> <i class="fas fa-plus" style="color: white;"></i> Payment</button>
<a href="invoice-print.php" target="_blank"> <button type="button" class="btn btn-info"><i class="fas fa-file-download" style="color: white;"></i> Print Invoice</button> </a>
<a href="invoice.php" target="_blank"> <button type="button" class="btn btn-info"><i class="fas fa-list" style="color: white;"></i> Preview</button> </a>
<br> <br> <br>
<!-- Table with query to fill it -->
<?php $sql = 'SELECT pay_id,mop_name,sub_id,pay_amount,pay_date FROM payment';
$query = mysqli_query($con, $sql);
if (!$query) {
die('SQL Error:' . mysqli_error($con));
}
?>
<!-- DataTables Example -->
<div class="card mb-3">
<div class="card-header"><i class="fas fa-table"></i> Payment List</div>
<div class="card-body">
<div class="table-responsive">
<table class="table table-bordered" id="dataTable" width="100%" cellspacing="0">
<thead>
<tr>
<!-- Table Column Header -->
<th class="sorting_desc">Invoice Number</th>
<th class="sorting_desc">Methode of Payment</th>
<th class="sorting_desc">Payment Amount</th>
<th class="sorting_desc">Payment Date</th>
<th class="sorting_desc">Action</th>
</tr>
</thead>
<?php while ($row = mysqli_fetch_array($query)) { ?>
<tr>
<td><?php echo $row['pay_id']; ?></td>
<td><?php echo $row['mop_name']; ?></td>
<td><?php echo $row['pay_amount']; ?></td>
<td><?php echo $row['pay_date']; ?></td>
<td>
<a href="" style="color:blue;"><i class="fas fa-pen"></i></a>
<a href="payment.php?idd=<?php echo $row['pay_id']; ?>" onclick="return confirm('Are you sure ?')" style="color:red;"><i class="fas fa-remove"></i></a>
</td>
</tr>
<?php
} ?>
</table>
</div>
</div>
<!-- Delete Query -->
<?php
if (isset($_GET['idd'])) {
$idd = $_GET['idd'];
$sql = "Delete from payment where pay_id='" . $idd . "'";
if ($idd != '') {
$query = mysqli_query($con, $sql);
//header("Refresh:0; url=payment.php");
}
}
?>
</div>
<!-- session for add payment button -->
<?php if (isset($_SESSION["success"])) { ?>
<div class="alert alert-success">
<strong>Success! </strong> <?php echo $_SESSION["success"];
session_unset(); ?>
</div>
<?php
} ?>
<?php if (isset($_SESSION["error"])) { ?>
<div class="alert alert-danger">
<strong>Alert! </strong> <?php echo $_SESSION["error"];
session_unset(); ?>
</div>
<?php
} ?>
<!-- ADD payment -->
<div class="modal fade" id="myModal">
<div class="modal-dialog">
<div class="modal-content">
<div class="card card-register">
<div class="card-header">Add Payment</div>
<div class="card-body">
<form method="post" action="includes/phpScripts.php">
<div class="form-group">
<div class="col-md-9">
<label>Invoice #</label>
<input type="text" name="txtPayment-id" placeholder="Invoice Number" disabled="disabled" value="<?php echo $row['pay_id'] + "1"; ?>" class="form-control" required="required"> </div>
</div>
<br><br><br>
<div class="form-group">
<div class="col-md-6">
<label>Method Of Payment</label>
<select class="form-control" id="cbxMethodPayment" name="cbxMethodeOfPayment">
<option disabled="disabled" selected="selected">Methode Of Payment</option>
<option value="Cash">Cash</option>
<option value="MasterCard">Master Card</option>
<option value="VisaCard">Visa Card</option>
<option value="Check">Check</option>
<option value="Amex">Amex</option>
</select>
</div>
<div class="form-group">
<div class="col-md-6">
<label>Package</label>
<select class="form-control" id="cbxPackages" name="cbxPackages" style="height:40px;">
<option disabled="disabled" selected="selected">Select Package</option>
<option value="single">Single Session</option>
<option value="10 Sessions">10 Sessions</option>
<option value="20 Sessions">20 Sessions</option>
<option value="30 Sessions">30 Sessions</option>
<option value="Double 30 Sessions">Double 30 Sessions</option>
</select>
</div>
</div>
<br><br>
<div class="form-group">
<div class="col-md-6">
<label>Total Amount</label>
<input type="text" name="txtAmount" disabled="disabled" id="txtTotalAmount" value="50000" placeholder="Total Amount" class="form-control" required="required">
</div>
</div>
<div class="form-group">
<div class="col-md-6">
<label>Paid Amount</label>
<input type="text" name="txtPaid" onchange="totalAmount()" id="txtPaid" placeholder="Paid" class="form-control" required="required">
</div>
</div>
<div class="form-group">
<div class="col-md-6">
<label>Remaining Amount</label>
<input type="text" name="txtRemain" disabled="disabled" id="txtRemain" placeholder="Remain" class="form-control" required="required">
</div>
</div>
<div class="form-group">
<div class="col-md-6">
<label>Payment Date</label>
<input type="date" name="pDate" placeholder="Payment Date" class="form-control" required="required">
</div>
</div>
<div class="modal-footer">
<button class="btn btn-md btn-primary" name="btnRegisterMember" class="modalButton" type="submit">
Add payment</button>
<button type="button" class="btn btn-danger" data-dismiss="modal">Close</button>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>