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
|
<?php
$mensualite=1010.44;
$t=4;
$cap1=4000;
$taux=5/100;
$REI1=$cap1*$taux/12;
$REC1=$mensualite-$REI1;
$SCRD2=$cap1-($mensualite-$REI1);
$REI2=$SCRD2*$taux/12;
$REC2=$mensualite-$REI2;
$REC2=$mensualite-$REI2;
$SCRD3=$SCRD2-($mensualite-$REI2);
$REI3=$SCRD3*$taux/12;
$REC3=$mensualite-$REI3;
$SCRD4=$SCRD3-($mensualite-$REI3);
$REI4=$SCRD4*$taux/12;
$REC4=$mensualite-$REI4;
$REI5=$SCRD5*$taux/12;
$REC5=$mensualite-$REI5;
$SCRE1=$t*$mensualite;
$SCRE2=$SCRE1-$mensualite;
$SCRE3=$SCRE2-$mensualite;
$SCRE4=$SCRE3-$mensualite;
$SCRE5=$SCRE4-$mensualite;
$SCRE6=$SCRE5-$mensualite;
$data= array(
array('N°Echeance' => 'Ech1', 'SoldeCreance' => $SCRE1, 'SCRD' => $cap1,'REC'=>$mensualite-$REI1,'RembEnInterets' => $REI1),
array('N°Echeance' => 'Ech2', 'SoldeCreance' => $SCRE2, 'SCRD' => $SCRD2,'REC'=>$mensualite-$REI2,'RembEnInterets' => $REI2),
array('N°Echeance' => 'Ech3', 'SoldeCreance' => $SCRE3, 'SCRD' => $SCRD3,'REC'=>$mensualite-$REI3,'RembEnInterets' => $REI3),
array('N°Echeance' => 'Ech4', 'SoldeCreance' => $SCRE4, 'SCRD' => $SCRD4
,'REC'=>$mensualite-$REI4,'RembEnInterets' => $REI4),
array('N°Echeance' => 'Ech5', 'SoldeCreance' => $SCRE5, 'SCRD' => $SCRD5,'REC'=>$mensualite-$REI5,'RembEnInterets' => $REI5),
array('N°Echeance' => 'Ech6', 'SoldeCreance' => $SCRE6, 'SCRD' => $SCRD6,'REC'=>$mensualite-$REI6,'RembEnInterets' => $REI6),
);
//Données provenant de calcul préalables
//Numérotation
$i=0;
do
{
$num[]=$i+1;
//echo $e, "<br/>";
$i++;
}
while($i<=$t);
// Données provenant du formulaire
$_POST['date'] = '2011-11-27';
$current = strtotime($_POST['date']);
//$t=4;
$month_span = $t-1;
$dates = array();
do {
$dates[] = date('d/m/y', $current) . '<br />';
} while (($current = strtotime('+1 month', $current)) && $month_span--);
//Mensualité (voir calcul)
$mensualite= array();
$mensualite=1010.44;// par exemple mais voir calcul réel
for ($i=1; $i <=$t; $i++)
{
$mens[]=$mensualite;
}
$c_data = count($data);
for ($i = 0; $i < $c_data; $i++) {
$data[$i]['date'] = $dates[$i];
$data[$i]['$num']= $num[$i];
$data[$i]['$mens']= $mens[$i];
}
?>
<!-- Mise en forme du tableau HTML -->
<table>
<thead>
<tr>
<th>N°Ech</th>
<th>N°</th>
<th>Date</th>
<th>SoldeCapRestantDû</th>
<th>SoldeCreance</th>
<th>RembEnCap</th>
<th>RembEnInterets</th>
<th>A payer</th>
</tr>
</thead>
<tfoot>
</tfoot>
<tbody>
<?php foreach ($data as $r) : ?>
<tr>
<td><?php echo $r['N°Echeance']?></td>
<td><?php echo $r['$num']?></td>
<td><?php echo $r['date']?></td>
<td><?php echo $r['SCRD']?></td>
<td><?php echo $r['SoldeCreance']?></td>
<td><?php echo $r['REC']?></td>
<td><?php echo $r['RembEnInterets']?></td>
<td><?php echo $r['$mens']?></td>
</tr>
<?php endforeach ?>
</tbody>
</table> |
Partager