From 5a6e319860e7374d1ea9052c21e229b44300714b Mon Sep 17 00:00:00 2001 From: Michael RICOIS Date: Thu, 8 Jan 2015 14:14:20 +0000 Subject: [PATCH] =?UTF-8?q?Indiscore=20:=20Affectation=20des=20ann=C3=A9es?= =?UTF-8?q?=20uniquement=20si=20il=20y=20a=20des=20bilans?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/Metier/scores/classMScores.php | 106 ++++++++++++------------- 1 file changed, 53 insertions(+), 53 deletions(-) diff --git a/library/Metier/scores/classMScores.php b/library/Metier/scores/classMScores.php index 77e03d58..d6f97d37 100644 --- a/library/Metier/scores/classMScores.php +++ b/library/Metier/scores/classMScores.php @@ -946,6 +946,58 @@ function calculIndiScore($siren, $nic=0, $accesDist=false, $cycleClient=2, $mail } } + // Elements provenant des bilans + $EFFBILAN=$tabBilan[0]['YP']; + $nm=$nbMoisBilCumul=$tabBilan[0]['DUREE_MOIS']; + $nmp=$tabBilan[0]['DUREE_MOIS_PRE']; + + $BILANDATE=$tabBilan[0]['DATE_CLOTURE']; + $BILANDATEp=$tabBilan[0]['DATE_CLOTURE_PRE']; + if ($BILANDATEp==0) $BILANDATEp=$tabBilan[1]['DATE_CLOTURE']; + + $BILAN=$BILANp=$BILANp2=$BILANp3=$BILANp4=0; + $BILANANNEE=substr($BILANDATE,0,4)*1; + $BILANANNEEp=substr($BILANDATEp,0,4)*1; + if ($BILANANNEEp>0) { + $BILANp=1; + $nbMoisBilDate=$classWdate->nbMoisEntre($BILANDATEp, $BILANDATE); + $nbMoisBilCumul+=$nmp; + } + + $BILANDATEp2 = $tabBilan[2]['DATE_CLOTURE']; + $BILANANNEEp2 = substr($BILANDATEp2,0,4)*1; + $nmp2=$tabBilan[2]['DUREE_MOIS']; + if ($BILANANNEEp2>0) { + $BILANp2=1; + $nbMoisBilDate=$classWdate->nbMoisEntre($BILANDATEp2, $BILANDATE); + $nbMoisBilCumul+=$nmp2; + } + + $BILANDATEp3 = $tabBilan[3]['DATE_CLOTURE']; + $BILANANNEEp3=substr($BILANDATEp3,0,4)*1; + $nmp3=$tabBilan[3]['DUREE_MOIS']; + if ($BILANANNEEp3>0) { + $BILANp3=1; + $nbMoisBilDate=$classWdate->nbMoisEntre($BILANDATEp3, $BILANDATE); + $nbMoisBilCumul+=$nmp3; + } + + $BILANDATEp4 =$tabBilan[4]['DATE_CLOTURE']; + $BILANANNEEp4=substr($BILANDATEp4,0,4)*1; + $nmp4=$tabBilan[4]['DUREE_MOIS']; + if ($BILANANNEEp4>0) { + $BILANp4=1; + $nbMoisBilDate=$classWdate->nbMoisEntre($BILANDATEp4, $BILANDATE); + //$nbMoisBilCumul+=$nmp4; + } + + // Liste des années de bilans ultérieurs + $BILANANNEE1=$BILANANNEE+1; + $BILANANNEE2=$BILANANNEE+2; + $BILANANNEE3=$BILANANNEE+3; + $BILANANNEE4=$BILANANNEE+4; + $BILANANNEE5=$BILANANNEE+5; + /** * Calcul des ratios */ @@ -1137,59 +1189,7 @@ function calculIndiScore($siren, $nic=0, $accesDist=false, $cycleClient=2, $mail $tabRegX=array_reverse($tabRegX); $timer['regression']=microtime(true); - - // Elements provenant des bilans - $EFFBILAN=$tabBilan[0]['YP']; - $nm=$nbMoisBilCumul=$tabBilan[0]['DUREE_MOIS']; - $nmp=$tabBilan[0]['DUREE_MOIS_PRE']; - - $BILANDATE=$tabBilan[0]['DATE_CLOTURE']; - $BILANDATEp=$tabBilan[0]['DATE_CLOTURE_PRE']; - if ($BILANDATEp==0) $BILANDATEp=$tabBilan[1]['DATE_CLOTURE']; - - $BILAN=$BILANp=$BILANp2=$BILANp3=$BILANp4=0; - $BILANANNEE=substr($BILANDATE,0,4)*1; - $BILANANNEEp=substr($BILANDATEp,0,4)*1; - if ($BILANANNEEp>0) { - $BILANp=1; - $nbMoisBilDate=$classWdate->nbMoisEntre($BILANDATEp, $BILANDATE); - $nbMoisBilCumul+=$nmp; - } - - $BILANDATEp2 = $tabBilan[2]['DATE_CLOTURE']; - $BILANANNEEp2 = substr($BILANDATEp2,0,4)*1; - $nmp2=$tabBilan[2]['DUREE_MOIS']; - if ($BILANANNEEp2>0) { - $BILANp2=1; - $nbMoisBilDate=$classWdate->nbMoisEntre($BILANDATEp2, $BILANDATE); - $nbMoisBilCumul+=$nmp2; - } - - $BILANDATEp3 = $tabBilan[3]['DATE_CLOTURE']; - $BILANANNEEp3=substr($BILANDATEp3,0,4)*1; - $nmp3=$tabBilan[3]['DUREE_MOIS']; - if ($BILANANNEEp3>0) { - $BILANp3=1; - $nbMoisBilDate=$classWdate->nbMoisEntre($BILANDATEp3, $BILANDATE); - $nbMoisBilCumul+=$nmp3; - } - - $BILANDATEp4 =$tabBilan[4]['DATE_CLOTURE']; - $BILANANNEEp4=substr($BILANDATEp4,0,4)*1; - $nmp4=$tabBilan[4]['DUREE_MOIS']; - if ($BILANANNEEp4>0) { - $BILANp4=1; - $nbMoisBilDate=$classWdate->nbMoisEntre($BILANDATEp4, $BILANDATE); - //$nbMoisBilCumul+=$nmp4; - } - - // Liste des années de bilans ultérieurs - $BILANANNEE1=$BILANANNEE+1; - $BILANANNEE2=$BILANANNEE+2; - $BILANANNEE3=$BILANANNEE+3; - $BILANANNEE4=$BILANANNEE+4; - $BILANANNEE5=$BILANANNEE+5; - + /** Détection fine de l'état de fermeture éventuel à l'INSEE **/ $tabTmp = $iDb->select('insee.insee_even', 'insEVE, insDATEVE', "insSIREN=$siren AND insEVE IN ('400','410','420','425','MPF','MNP') ORDER BY insDATEVE DESC",