-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrentadded.php
More file actions
209 lines (149 loc) · 3.46 KB
/
rentadded.php
File metadata and controls
209 lines (149 loc) · 3.46 KB
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
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="css/bootstrap.min.css">
<link rel="stylesheet" href="css/font-awesome.min.css">
<title>Rent Added Error</title>
<style type="text/css">
@font-face{
font-family: 'Varela Round', sans-serif;
src: url(VarelaRound-Regular.ttf);
}
body {
background: #222222;
}
h4
{
margin-top: 100px;
text-align: center;
color: white;
}
.panel
{
margin-top: 160px;
border-radius: 2px;
}
.panel_add
{
margin-top: 10px;
border-radius: 2px;
}
.text-center
{
margin-top: 0px;
margin-bottom: 0px;
}
.fa
{
font-size: 58px;
color: red;
}
.btn
{
margin-top: 0px;
font-weight: bold;
}
.data
{
color: brown;
font-weight: bold;
}
hr
{
width: 100%;
border: 0.5px solid grey;
}
.cl
{
margin-top: 40px;
}
.remain
{
color: white;
font-weight: bold;
margin-top: 160px;
text-align: center;
}
</style>
</head>
<body>
<?php
session_start();
$name=$_SESSION['name'];
$user=implode($name);
date_default_timezone_set('Asia/Kolkata');
$today = date('d-M-y');
$month = date('M');
$year = date('Y');
if(!empty($_POST))
{
if(isset($_POST['entry']))
{
include("./database/db_connection.php");
$renter=mysqli_real_escape_string($con,$_POST["renter"]);
$rent=mysqli_real_escape_string($con,$_POST["rentamount"]);
$que=mysqli_query($con,"SELECT SUM(Amount) AS total_rent FROM `roomrent` WHERE Month='$month' AND Year=$year AND Name='$renter'");
$row=mysqli_fetch_assoc($que);
$total_rent=$row['total_rent'];
$que2=mysqli_query($con,"SELECT Amount FROM `roomrent_once` WHERE Name='$renter' AND Month='$month' AND Year=$year");
$row2=mysqli_fetch_assoc($que2);
$allocated_rent=$row2['Amount'];
$entire_amount=$total_rent+$rent;
$remaining_amount=$allocated_rent-$total_rent;
if($remaining_amount==0)
{
?>
<div class="container">
<!-- <p class="remain"><?php echo "$renter gave the full rent amount of Rs. $allocated_rent for this month";?></p> -->
<div class="panel">
<div class="panel-body">
<div class="text-center">
<i class="fa fa-ban" aria-hidden="true"></i>
<p class="data"><?php echo "$renter gave the full rent amount of Rs. $allocated_rent for this month";?></p>
</div></div></div></div>
<div class="text-center">
<div class="cl">
<a href="roomrent.php" style="text-decoration: none">Go to Room Rent</a>
</div>
</div>
<?php
}
else if ($entire_amount>$allocated_rent)
{
# code...
?>
<div class="container">
<p class="remain">Balance Rent Amount for <?php echo"$renter : Rs.$remaining_amount"; ?></p>
<div class="panel panel_add">
<div class="panel-body">
<div class="text-center">
<i class="fa fa-ban" aria-hidden="true"></i>
<p class="data">You are entering more than the rent amount</p>
</div></div></div></div>
<div class="text-center">
<button class="btn btn-error" onclick="location.href='givenby.php'">Modify Rent Amount</button>
<div class="cl">
<a href="roomrent.php" style="text-decoration: none">Go to Room Rent</a>
</div>
</div>
<?php
}
else
{
$sql="INSERT INTO `roomrent` (`Date`, `Month`, `Year`, `Name`, `Amount`, `Addedby` ) VALUES ('$today', '$month', '$year', '$renter', '$rent', '$user')";
if($con->Query($sql)===TRUE)
{
header("location:rentadded_success.php");
}
else
{
echo "Error".$sql."<br>".$con->error;
}
}
}
}
?>
</body>
</html>