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
|
<?php
if(isset($_POST['go']))
{function honoraires($p1,$p2,$p3,$p4,$t1,$t2,$t3,$type,$versement,$acompte)
{
if ($type=="d")
{
if($versement=="0" AND $acompte <= $p1)
{
$reste1=$acompte;
$pc=($t1/100);
$taux1=$pc+1;
$h1=(($reste1*$taux1)-$reste1);
$honoraires=$h1;
}
elseif(($versement)<=$p1 AND ($versement+$acompte)<=$p1)
{
$reste1=$acompte;
$pc=($t1/100);
$taux1=$pc+1;
$h1=(($reste1*$taux1)-$reste1);
$honoraires=$h1;
}
elseif($versement<=$p1 AND ($versement+$acompte)>=$p2 AND ($versement+$acompte)<=$p3)
{
$reste1=$p1-$versement;
$pc=($t1/100);
$taux1=$pc+1;
$h1=(($reste1*$taux1)-$reste1);
$reste2=$acompte-$reste1;
$pc2=($t2/100);
$taux2=$pc2+1;
$h2=(($reste2*$taux2)-$reste2);
$honoraires=($h1+$h2);
}
elseif($versement=="0" AND $acompte>=$p2 AND $acompte<=$p3)
{
$reste2=$acompte-$p1;
$reste1=$p1;
$pc=($t1/100);
$taux1=$pc+1;
$h1=(($reste1*$taux1)-$reste1);
$pc2=($t2/100);
$taux2=$pc2+1;
$h2=(($reste2*$taux2)-$reste2);
$honoraires=($h1+$h2);
}
elseif($versement<=$p3 AND $versement>=$p2 AND ($versement+$acompte)>=$p2 AND ($versement+$acompte)<=$p3)
{
$reste1=$acompte;
$pc=($t2/100);
$taux1=$pc+1;
$h1=(($reste1*$taux1)-$reste1);
$honoraires=$h1;
}
elseif($versement>=$p2 AND $versement<=$p3 AND ($versement+$acompte)>=$p4)
{
$reste1=$p4-$versement;
$pc=($t2/100);
$taux2=$pc+1;
$h2=(($reste1*$taux2)-$reste1);
$reste2=$acompte-$reste1;
$pc2=($t3/100);
$taux3=$pc2+1;
$h3=(($reste2*$taux3)-$reste2);
$honoraires=($h2+$h3);
}
elseif($versement=="0" AND $acompte>=$p4)
{
$reste1=$p1;
$reste2=$p3-$p2;
$pc=($t1/100);
$taux1=$pc+1;
$h1=(($reste1*$taux1)-$reste1);
$pc2=($t2/100);
$taux2=$pc2+1;
$h2=(($reste2*$taux2)-$reste2);
$reste3=($acompte-$reste1-$reste2);
$pc3=($t3/100);
$taux3=$pc3+1;
$h3=(($reste3*$taux3)-$reste3);
$honoraires=($h1+$h2+$h3);
}
elseif($versement>=$p4)
{
$reste3=$acompte;
$pc3=($t3/100);
$taux3=$pc3+1;
$h3=(($reste3*$taux3)-$reste3);
$honoraires=($h3);
}
if (!isset($h1)) { $h1="0" ; }
if (!isset($h2)) { $h2="0" ; }
if (!isset($h3)) { $h3="0" ; }
if (!isset($taux1)) { $taux1="0 %" ; }
if (!isset($taux2)) { $taux2="0 %" ; }
if (!isset($taux3)) { $taux3="0 %" ; }
$param =array($honoraires,$h1,$h2,$h3,$taux1,$taux2,$taux3);
return $param;
}
if ($type=="l")
{
$pc1=($t1/100);
$taux1=$pc1+1;
$honoraires=$acompte*$taux1;
}
if (!isset($h1)) { $h1=$honoraires ; }
if (!isset($h2)) { $h2="0" ; }
if (!isset($h3)) { $h3="0" ; }
if (!isset($taux1)) { $taux1="0 %" ; }
if (!isset($taux2)) { $taux2="0 %" ; }
if (!isset($taux3)) { $taux3="0 %" ; }
$param =array($honoraires,$h1,$h2,$h3,$taux1,$taux2,$taux3);
return $param;
}
}
//et après dans ta page
if (isset($_POST['go'])) {
$param = honoraires($p1,$p2,$p3,$p4,$t1,$t2,$t3,$type,$versement,$acompte);
if (isset($param[1])) { $h1 = $param[1] ;} else { $h1="0" ; }
if (isset($param[2])) { $h2 = $param[2] ;} else { $h2="0" ; }
if (isset($param[3])) { $h3 = $param[3] ;} else { $h3="0" ; }
if (isset($param[4])) { $taux1 = $param[4] ;} else { $taux1="0 %" ; }
if (isset($param[5])) { $taux2 = $param[5] ;} else { $taux2="0 %" ; }
if (isset($param[6])) { $taux3 = $param[6] ;} else { $taux3="0 %" ; }
if (isset($param[0])) { $honoraires = $param[0] ;} else { $honoraires="0" ; }
}
?> |
Partager