Indiscore : Affectation des années uniquement si il y a des bilans

This commit is contained in:
Michael RICOIS 2015-01-08 14:14:20 +00:00
parent 7e6315fb0f
commit 5a6e319860

View File

@ -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",