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
| function loc_getSoldeActuel($NOLOC, $numBail)
{
include "../Include/cnx.inc.php";
$EI = substr($numBail,0,6);
$LOT = substr($numBail,6,4);
$ORDRE = substr($numBail,10,2);
$soldeAnterieur = loc_getSoldeAnterieur($NOLOC);
$debit ="";
$credit ="";
$strsql = "SELECT * FROM Bail LEFT OUTER JOIN comptaLoc ON bail.EI = comptaLoc.EI left outer join locataire on bail.noloc=locataire.noloc WHERE bail.noloc = '" . $NOLOC . "' and bail.EI = '" . $EI . "' and bail.LOT = '" . $LOT . "' and bail.ORDRE = '" . $ORDRE . "'";
$resGetSolde= execute($ConnCo, $strsql);
while(odbc_fetch_row($resGetSolde)){ // Boucle de calcul
if (champ($resGetSolde, "sens") == "DB" ){
$debit += champ($resGetSolde, "Montant");
}
if (champ($resGetSolde, "sens") == "CR" ){
$credit += champ($resGetSolde, "Montant");
}
} // Fin de la boucle de calcul
$total=$credit - $debit + $soldeAnterieur;
return $total;
} |
Partager