Documentos de Académico
Documentos de Profesional
Documentos de Cultura
text-align: center;
background-color: #f5f5f5;
h1 {
color: #333;
margin: 20px 0;
#prestamoForm {
max-width: 400px;
margin: 0 auto;
padding: 60px;
background-color: #fff;
border-radius: 5px;
label {
font-weight: bold;
display: block;
margin-top: 10px;
input, select {
width: 100%;
padding: 10px;
margin: 5px 0;
border: 1px solid #ccc;
border-radius: 3px;
button {
background-color: #007bff;
color: #fff;
border: none;
margin-top: 10px;
border-radius: 3px;
cursor: pointer;
button:hover {
background-color: #0056b3;
#resultado {
margin-top: 20px;
font-weight: bold;
Conexión:
<?php
class Conexion {
private $cn=null;
function conecta(){
if($this->cn==null){
$this->cn= mysqli_connect("localhost","root","","bdpresta");
}
return $this->cn;
?>
Negocio :
<?php
include_once './Conexion.php';
class Negocio {
. " VALUES
('$Nombre_del_cliente','$Monto_del_prestamo','$Meses_de_prestamo','$Tipo_de_moneda' )"
;
die(mysqli_error($obj->conecta()));
function anula($Nro_de_prestamo) {
die(mysqli_error($obj->conecta()));
}
function listado() {//listado total
$sql = "select
Nro_de_prestamo,Nombre_del_cliente,Monto_del_prestamo,Meses_de_prestamo,Tipo_de_m
oneda from prestamos";
die(mysqli_error($obj->conecta()));
$vec = array();
$vec[] = $fila;
return $vec;
?>
Prestamos:
<?php
class Prestamos {
private $Nro_de_prestamo;
private $Nombre_del_cliente;
private $Monto_del_prestamo;
private $Meses_de_prestamo;
private $Tipo_de_moneda;
function __construct($Nro_de_prestamo,$Nombre_del_cliente,$Monto_del_prestamo,
$Meses_de_prestamo,$Tipo_de_moneda) {
$this->Nro_de_prestamo=$Nro_de_prestamo;
$this->Nombre_del_cliente=$Nombre_del_cliente;
$this->Monto_del_prestamo=$Monto_del_prestamo;
$this->Meses_de_prestamo=$Meses_de_prestamo;
$this->Tipo_de_moneda=$Tipo_de_moneda;
if ($this->Tipo_de_moneda == '1') {
} else {
$interes = $this->calcularInteres();
$saldo = $this->calcularSaldo();
PagAdic
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<?php
include_once './Negocio.php';
include_once './Conexion.php';
?>
<center>
<h2>Registro de Prestamos</h2>
<form method="post">
<tr><td>Nombre_del_cliente<td><input name="Nombre_del_cliente">
<tr><td>Monto_del_prestamo<td><input name="Monto_del_prestamo"
type="number" >
<tr><td>Meses_de_prestamo<td><input name="Meses_de_prestamo"
type="number" >
<td>Tipo de Moneda</td>
<td>
<select name="Tipo_de_moneda">
<option value="1">Dólar</option>
<option value="2">Soles</option>
</select>
</td>
</table>
</form>
</center>
<?php
if (isset($_REQUEST["envia"])) {
$obj->adicion($_REQUEST["Nombre_del_cliente"], $_REQUEST["Monto_del_prestamo"],
$_REQUEST["Meses_de_prestamo"], $_REQUEST["Tipo_de_moneda"]);
header("location:pagListado.php");
?>
</body>
</html>
pagBorra:
<?php
include_once './Negocio.php';
$obj=new Negocio();
$obj->anula($_REQUEST["code"]);
header("location:pagListado.php");
?>
pagListado
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Lista de Préstamos</title>
</head>
<body>
<center>
<h2>Lista de Préstamos</h2>
<tr>
<th>Code</th>
<th>Nombre</th>
<th>Monto</th>
<th>Moneda</th>
<th>Meses</th>
<th>Interés</th>
<th>Saldo</th>
<th>Cuota mensual</th>
<th>Anular</th>
</tr>
<?php
include_once './Negocio.php';
include_once './Prestamos.php';
$prestamos = $negocio->listado();
echo '<tr>';
$prestamo['Nro_de_prestamo'], $prestamo['Nombre_del_cliente'],
$prestamo['Monto_del_prestamo'], $prestamo['Meses_de_prestamo'],
$prestamo['Tipo_de_moneda']
);
$interes = $prestamoObj->calcularInteres();
$saldo = $prestamoObj->calcularSaldo();
$cuota = $prestamoObj->calcularCuota();
echo '</tr>';
?>
</table>
</center>
</body>
</html>