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
|
<?php
session_start();
require ('conx.php');
require ('config.php');
require ('session.php');
$client="12";
$trian=@$_GET['trian'];
$_SESSION['trian']=$trian;
if ($_SESSION['trian']>0){$sufftable=$suff_table.$trian.'_';}else{$sufftable=$suff_table;$trian=0;}
$derclient = mysql_query("SELECT * FROM `".$sufftable."dem_immo_plan` where idCLIENT='$client'");
$nbres=mysql_num_rows($derclient);
$nb_credits = $nbres + 5;
$larg = 100 / ($nb_credits + 5); // 5 étant le nombre de champs avant les durées (Nombanque/Montant/TauxCrédit/TauxASS/Mensualité ASS
// Je vais definir la taille moyenne pour chaque champ
?>
<style> .tail { width:<?php echo $larg;?>%; float:left; } </style>
<?php
while($Dcl = mysql_fetch_array($derclient, MYSQL_ASSOC))
{
$id=$Dcl['idPLAN'];
$plan_nombanque=$Dcl['plan_nombanque'];
$plan_montant=$Dcl['plan_montant'];
$plan_taux=$Dcl['plan_taux'];
$plan_duree=$Dcl['plan_duree'];
$plan_mens=$Dcl['plan_mens'];
$plan_ass_taux=$Dcl['plan_ass_taux'];
$plan_ass_mens=$Dcl['plan_ass_mens'];
}
$list_dur="0";
while($cl_dur = mysql_fetch_array($derclient, MYSQL_ASSOC))
{
$list_dur .=", ".$cl_dur['plan_duree'];
}
echo '$list_dur '.$list_dur.'<br>';
//
//.................................34mois .. 36mois .. 42mois .. 48mois
//Cofidis - 5000 - 6.5% - .........180 .....0..........0..........0....
//sofinco - 6000 - 7.5% - .........MI_1......MI_2.......190 ......0....
//LCL - 7000 - 5% .................MI_3......210 ......0..........0....
//CETELEM - 3000 - 3%..............MI_4......MI_5.......MI_6......90..
//Total ...........................tot_1.......tot_2........tot_3........tot_14..
//
function cmp($a, $b)
{
if ($a == $b) {
return 0;
}
return ($a < $b) ? -1 : 1;
}
echo '$list_dur '.$list_dur.'<br>';
$a = array($list_dur); // ICI je n'ai pas le resultat attendu
usort($a, "cmp");
foreach ($a as $key => $value) {echo "$key : $value<br>";}
echo '------------------------------------------------------<br>';
$tot_1= 180 + $MI_1 +$MI_3 + $MI_4;
$tot_2= 0 + $MI_2 + 210 + $MI_5;
$tot_3= 0 + 190 + 0 + $MI_6;
$tot_4= 0 + 0 + 0 + 90;
class TestObj
{
var $name;
function TestObj($name)
{
$this->name = $name;
}
static function cmp_obj($a, $b)
{
$al = strtolower($a->name);
$bl = strtolower($b->name);
if ($al == $bl) {
return 0;
}
return ($al > $bl) ? +1 : -1;
}
}
$a[] = new TestObj($text_0);
$a[] = new TestObj($text_1);
$a[] = new TestObj($text_2);
$a[] = new TestObj($text_3);
$a[] = new TestObj($text_4);
$a[] = new TestObj($text_5);
usort($a, array("TestObj", "cmp_obj"));
foreach ($a as $item) {
echo $item->name . "<br>";
}
?> |
Partager