-
Notifications
You must be signed in to change notification settings - Fork 0
/
tabla.php
90 lines (79 loc) · 2.37 KB
/
tabla.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
<!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.0">
<link rel="stylesheet" href="./styles/styleAmortizationTable.css">
<!--
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.2/dist/css/bootstrap.min.css"
rel="stylesheet" integrity="sha384-Zenh87qX5JnK2Jl0vWa8Ck2rdkQ2Bzep5IDxbcnCeuOxjzrPF/et3URy9Bv1WTRi"
crossorigin="anonymous">
-->
<link rel="stylesheet" href="./styles/styleHeaderUL.css">
<title>Tabla de amortización</title>
</head>
<body>
<!-- -->
<header class="header">
<div class="container-head logo-nav-container">
<a class="logo">DREAMBUCKS</a>
<div class="menu-icon">Regresar</div>
<nav class="navigation">
<ul>
<li><a href="Logout.php">Cerrar Sesion</a></li>
<li><a href="user.php">Volver a mis prestamos</a></li>
</ul>
</nav>
</div>
</header>
</body>
</html>
<?php
$connect = mysqli_connect("localhost", "root", "", "dreambucks");
$id = $_GET['id']; // el id del prestamo
$consult = "SELECT * FROM loans WHERE id_L='$id'";
$result = mysqli_query($connect, $consult);
while ($row = mysqli_fetch_row($result)){
?>
<?php
$quantify = $row[3];
$lapses = $row[6];
?>
<?php
}
$inte = .015;
$b = 1 + $inte;
$quota = $quantify * ((pow($b,$lapses) * $inte) / (pow($b,$lapses)-1)); //formula para conseguir la cuota de pago mensual
$total = $quota *$lapses;
$intereses = 0;
$abono = 0;
$quota1 = 0;
?>
<table class="amortization">
<thead class="info">
<th>Periodo</th>
<th>Cuota</th>
<th>Intereses</th>
<th>Abono</th>
<th>Saldo</th>
</thead>
<?php
for($i=0; $i<=$lapses;$i++ ){
?>
<tr>
<td> <?php echo $i ?> </td>
<td> <?php echo round($quota1) ?> </td>
<td> <?php echo round($intereses) ?> </td>
<td> <?php echo round($abono) ?> </td>
<td> <?php echo round($quantify) +0?> </td>
</tr>
<?php
$intereses = $quantify * $inte;
$abono = $quota - $intereses;
$quantify = $quantify - $abono;
$quota1 = $quota;
?>
<?php
}
?> </table> <br><br><br>