-
Notifications
You must be signed in to change notification settings - Fork 0
/
payments.php
168 lines (145 loc) · 6.23 KB
/
payments.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
<?php
require("session.php");
require "connect.php";
$sql = "SELECT
payment_id,
payment_date,
amount,
payment_type,
payment.description,
tenant.tenant_id,
tenant.name AS 'tenant_name',
owner.owner_id,
owner.name AS 'owner_name',
house.house_id,
house.house_no,
apartment.apartment_id,
apartment.name AS 'apartment_name'
FROM
payment
JOIN tenant ON tenant.tenant_id = payment.tenant_id
JOIN house ON house.house_id = payment.house_id
JOIN owner ON owner
.owner_id = payment.owner_id
JOIN apartment ON apartment.owner_id = payment.owner_id AND apartment.apartment_id = house.apartment_id
ORDER BY payment_id DESC;";
$result = mysqli_query($conn, $sql);
$payments = mysqli_fetch_all($result, MYSQLI_ASSOC);
?>
<?php include "header.php"; ?>
<div class="banner_blur">
<div class="flex-1 min-w-0 p-5">
<div class=" flex items-center ">
<div class=" bg-green-100 rounded-full p-3 text-green-600 mr-4">
<svg xmlns="http://www.w3.org/2000/svg" class="h-8 w-8" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 8h6m-5 0a3 3 0 110 6H9l3 3m-3-6h6m6 1a9 9 0 11-18 0 9 9 0 0118 0z" />
</svg>
</div>
<h1 class="text-4xl text-gray-900 sm:truncate">
Payments
</h1>
</div>
</div>
<div class="p-5">
<a href="/rms/payRent.php" class="btn primary">Pay Rent</a>
</div>
</div>
<div class="flex flex-col max-w-6xl m-5">
<div class="-my-2 overflow-x-auto sm:-mx-6 lg:-mx-8">
<div class="py-2 align-middle inline-block min-w-full sm:px-6 lg:px-8">
<div class="shadow overflow-hidden border-b border-gray-200 sm:rounded-lg">
<div class="px-4 py-5 sm:px-6 bg-gray-900 border-b">
<h3 class="text-xl leading-6 font-medium text-gray-300">
Payment History
</h3>
</div>
<table class="min-w-full divide-y divide-gray-200">
<thead class="bg-gray-50">
<tr>
<th scope="col" class="pl-6 pr-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
ID
</th>
<th scope="col" class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
Tenant
</th>
<th scope="col" class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
Type
</th>
<th scope="col" class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider ">
House
</th>
<th scope="col" class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
Owner
</th>
<th scope="col" class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider text-right">
Amount <span class="capitalize">(Rs.)</span>
</th>
<th scope="col" class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider ">
Date
</th>
<th scope="col" class="relative pl-4 pr-6 py-3">
<!-- <a href="/rms/addhouse.php" class="btn primary small">Add House</a> -->
</th>
</tr>
</thead>
<tbody class="bg-white divide-y divide-gray-200">
<?php foreach ($payments as $payment) { ?>
<tr>
<td class="pl-6 pr-4 py-4 ">
<div class="text-sm text-gray-500">
<?php echo htmlspecialchars($payment["payment_id"]) ?>
</div>
</td>
<td class="px-4 py-4 ">
<div class="max-w-xs w-28 break-words">
<a class="link" href="/rms/tenantDetails.php?id=<?php echo $payment["tenant_id"] ?>">
<?php echo htmlspecialchars($payment["tenant_name"]) ?>
</a>
</div>
</td>
<td class="px-4 py-4 ">
<div class="text-sm text-gray-500 lowercase break-words ">
<?php echo htmlspecialchars($payment["payment_type"]) ?>
</div>
</td>
<td class="px-4 py-4 ">
<div class="flex items-center ">
<div class="max-w-xs w-36 break-words">
<a class="link" href="/rms/houseDetails.php?id=<?php echo $payment["house_id"] ?>">
<?php echo htmlspecialchars($payment["house_no"]) ?>
</a>
<div class="text-sm text-gray-500 mt-1">
<?php echo htmlspecialchars($payment["apartment_name"]) ?>
</div>
</div>
</div>
</td>
<td class="px-4 py-4 ">
<div class="max-w-xs w-28 break-words">
<a class="link" href="/rms/ownerDetails.php?id=<?php echo $payment["owner_id"] ?>">
<?php echo htmlspecialchars($payment["owner_name"]) ?>
</a>
</div>
</td>
<td class="px-4 py-4 ">
<div class="text-base text-gray-900 text-right">
<?php echo number_format(htmlspecialchars($payment["amount"])); ?>
</div>
</td>
<td class="px-4 py-4 ">
<div class="text-sm text-gray-500 lowercase break-words w-20 ">
<?php echo htmlspecialchars($payment["payment_date"]) ?>
</div>
</td>
<td class="pl-4 pr-6 py-4 text-right text-sm font-medium">
<a href="invoicePreview.php?id=<?php echo $payment['payment_id']; ?>" class="text-indigo-600 hover:text-indigo-900">Invoice</a>
</td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
</div>
</div>
</div>
<?php include "footer.php"; ?>