diff --git a/library/WsScore/Entreprise/v0.8/Service.php b/library/WsScore/Entreprise/v0.8/Service.php index 74e32df8..8625b742 100644 --- a/library/WsScore/Entreprise/v0.8/Service.php +++ b/library/WsScore/Entreprise/v0.8/Service.php @@ -4672,7 +4672,7 @@ class Entreprise extends Scores_Ws_Server // RatiosEntrep $ratiosEntrep = new Ratios(); - if (substr($Rmont,0,1)=='N' || substr($Rmont,0,1)=='<' || substr($Rmont,0,1)=='>'){ + if (substr($Rmont,0,1)=='N' || substr($Rmont,0,1)=='<' || substr($Rmont,0,1)=='>') { $ratiosEntrep->id = 'r'.$Ridx; $ratiosEntrep->val = $Rmont; } else { @@ -4682,18 +4682,26 @@ class Entreprise extends Scores_Ws_Server $tabRatiosEntrep[] = $ratiosEntrep; if ( ( $tabBilan[$i]['CONSOLIDE']=='S' && isset($tabRatios[$i+1]) && ($tabBilan[$i+1]['CONSOLIDE']=='S' - || ($tabBilan[$i+1]['CONSOLIDE']=='N' && $tabBilan[$i+1]['DATE_CLOTURE']<>$tabBilan[$i]['DATE_CLOTURE']) ) ) - || ( $tabBilan[$i]['CONSOLIDE']=='N'&&isset($tabRatios[$i+1])&&($tabBilan[$i+1]['CONSOLIDE']=='N' - || ($tabBilan[$i+1]['CONSOLIDE']=='S'&&$tabBilan[$i+1]['DATE_CLOTURE']<>$tabBilan[$i]['DATE_CLOTURE'])) ) + || ($tabBilan[$i+1]['CONSOLIDE']=='N' && $tabBilan[$i+1]['DATE_CLOTURE']<>$tabBilan[$i]['DATE_CLOTURE'])) ) + || ( $tabBilan[$i]['CONSOLIDE']=='N' && isset($tabRatios[$i+1]) && ($tabBilan[$i+1]['CONSOLIDE']=='N' + || ($tabBilan[$i+1]['CONSOLIDE']=='S'&& $tabBilan[$i+1]['DATE_CLOTURE']<>$tabBilan[$i]['DATE_CLOTURE'])) ) ) { - $Rmont=(($R[$Ridx]-$tabRatios[$i+1][$Ridx])*100)/abs($tabRatios[$i+1][$Ridx]); + if ($tabRatios[$i+1][$Ridx] == 0) { + $Rmont = 'NS'; + } else { + $Rmont = (($R[$Ridx]-$tabRatios[$i+1][$Ridx])*100)/abs($tabRatios[$i+1][$Ridx]); + } } elseif ( ( $tabBilan[$i]['CONSOLIDE']=='S' && isset($tabRatios[$i+1]) && ($tabBilan[$i+2]['CONSOLIDE']=='S' || ($tabBilan[$i+2]['CONSOLIDE']=='N' && $tabBilan[$i+2]['DATE_CLOTURE']<>$tabBilan[$i]['DATE_CLOTURE'])) ) || ( $tabBilan[$i]['CONSOLIDE']=='N' && isset($tabRatios[$i+1]) && ($tabBilan[$i+2]['CONSOLIDE']=='N' || ($tabBilan[$i+2]['CONSOLIDE']=='S'&& $tabBilan[$i+2]['DATE_CLOTURE']<>$tabBilan[$i]['DATE_CLOTURE'])) ) ) { - $Rmont = (($R[$Ridx]-$tabRatios[$i+2][$Ridx])*100)/abs($tabRatios[$i+2][$Ridx]); + if ($tabRatios[$i+2][$Ridx] == 0) { + $Rmont = 'NS'; + } else { + $Rmont = (($R[$Ridx]-$tabRatios[$i+2][$Ridx])*100)/abs($tabRatios[$i+2][$Ridx]); + } } else { $Rmont = 'NS'; }