-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuser info3.php
208 lines (175 loc) · 4.54 KB
/
user info3.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
<?php
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "bank";
// Create connection
$conn = mysqli_connect($servername, $username, $password, $dbname);
// Check connection
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
$firstname=$_POST["fname"];
$sql = "SELECT fname, lname, loan,isdt,aadharno,email,ad,ph,ip,ir,pc,closingdate,closingbalance FROM MyGuest WHERE fname='$firstname'";
$result = mysqli_query($conn, $sql);
if (mysqli_num_rows($result) > 0) {
// output data of each row
while($row = mysqli_fetch_assoc($result)) {
//emi calculation ....
$myprincipal=$row["loan"];
$myclosingb=$row["closingbalance"];
$myinterest=($row["ir"]/12.00/100.0);
$myperiod=$row["ip"];
$top = pow((1+$myinterest),$myperiod);
$bottom = $top - 1;
$sp = $top / $bottom;
$emi = (($myprincipal * $myinterest) * $sp);
$repaymentamt=$emi*$myperiod;
$mynewinterest=$repaymentamt-$myprincipal;
$mymonthinterest=$mynewinterest/$myperiod;
$ddate=$row["isdt"];
$datetoday=date("Y-m-d");
$todaysdate=date('Y-m-d', strtotime($datetoday));
//$loanemi=$myprincipal*
//$myinterest=$myprincipal*
echo '
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="css/style.css">
<style>
table, th, td {
border: 5px solid black;
border-collapse: collapse;
}
th, td,tr {
padding: 5px;
text-align: center;
}
table{
width: 100%;
background-color: #4d3319;
}
tbody tr:hover {
background: #862d59;
}
</style>
</head>
<body>
<p><font size="25" color =#ffff80>Confirm your details</font></p>
<p id="demo"></p>
<script>
document.getElementById("demo").innerHTML = Date();
</script>
<table style="width:60%">
<tr>
<th>Firstname</th>
<th>'.$row["fname"].'</th>
</tr>
<tr>
<td>Last Name</td>
<td>'.$row["lname"].'</td>
</tr>
<tr>
<td>Aadhar Number</td>
<td>'.$row["aadharno"].'</td>
</tr>
<tr>
<td>Loan Amount:</td>
<td>Rs.'.$row["loan"].'</td>
</tr>
<tr>
<td>Issue Date</td>
<td>'.$row["isdt"].'</td>
</tr>
<tr>
<td>Loan Period(in terms of months)</td>
<td>'.$row["ip"].'</td>
</tr>
<tr>
<td>Interest Rate(per anum)</td>
<td>'.$row["ir"].'%</td>
</tr>
<tr>
<td>Rate of interest per Month</td>
<td>'.$myinterest.'</td>
</tr>
<tr>
<td>Email Id</td>
<td>'.$row["email"].'</td>
</tr>
<tr>
<td>Contact Number</td>
<td>'.$row["ph"].'</td>
</tr>
<tr>
<td>Address ....</td>
<td>'.$row["ad"].'</td>
</tr>
<tr>
<td>Pin Code</td>
<td>'.$row["pc"].'</td>
</tr>
</table>
<p><font size="25" color =#ffff80>Your Payment Details..</font></p>
<table style="width:60%">
<tr>
<th>CLOSING BALANCE</th>
<th>Rs.'.$row["closingbalance"].'</th>
</tr>
<tr>
<tr>
<td>Todays DATE</td>
<td>'.$todaysdate.'</td>
</tr>
<tr>
<td>Loan EMI</td>
<td>Rs.'.$emi.'</td>
</tr>
<tr>
<td>Tenure(in Months)</td>
<td>'.$row["ip"].'</td>
</tr>
<tr>
<td>Overall Interest</td>
<td>Rs.'.$mynewinterest.'</td>
</tr>
<tr>
<tr>
<td>payable Interest for this Month</td>
<td>Rs.'.$mymonthinterest.'</td>
</tr>
<tr>
<td>Total Repayment Amount</td>
<td>Rs.'.$repaymentamt.'</td>
</tr>
</table>
<form class="form-wrapper cf" name="lg" form action="updatetry.php" method="post">
<p><font color =#ff66b3 size= 5px >Enter Collected EMI Amount</a></font></p>
<input type="number" name ="amt" placeholder="Enter collected amount......" required>
<input type="hidden" name ="fname" value="'.$row["fname"].'" >
<input type="hidden" name ="closingdate" value="'.$todaysdate.'" >
<input type="hidden" name ="closingbalance" value="'.$row["closingbalance"].'" >
<input type="number" name ="camt" placeholder="Confirm your amount...." required>
<button type="submit">UPDATE</button>
</form>
</body>
</html>';
//$closingdate=date();
}
} else {
echo '<!DOCTYPE html>
<html >
<head>
<meta charset="UTF-8">
<title>OOPs</title>
<link rel="stylesheet" href="css/style.css">
<link rel="stylesheet" href="css/stylegood.css">
<p><font size="25" color =#ffff80>Sorry,the Name <font color=red> '.$firstname.'</font> not found on the database!</font></p>
</head>
<a class="button" href="index.html">HOME</a>
</body>
</html>';
}
mysqli_close($conn);
?>