Maj script test
This commit is contained in:
commit
e91835db68
@ -2415,6 +2415,7 @@ class MInsee
|
||||
$sql = $db->select()
|
||||
->from('rncs_modifs', array('valeur'), 'jo')
|
||||
->where('champs = ?', 'capitalMontant')
|
||||
->where('siren = ? ', $siren)
|
||||
->where('flux < ?', $date)
|
||||
->order('flux DESC')->limit(1);
|
||||
$result = $db->fetchRow($sql, null, Zend_Db::FETCH_OBJ);
|
||||
@ -2424,6 +2425,7 @@ class MInsee
|
||||
}
|
||||
|
||||
// --- Situation Juridique
|
||||
$identite['SituationJuridique'] = '';
|
||||
$tabProcol = $this->getAnnoncesLegales($siren, 0, 'P', false);
|
||||
if ( count($tabProcol) > 0 ) {
|
||||
$tabDates = array();
|
||||
@ -2448,9 +2450,9 @@ class MInsee
|
||||
$identite['SituationJuridique'] = 'P';
|
||||
}
|
||||
} elseif (count($this->getAnnoncesLegales($siren, 0, 'A', false)) > 0) {
|
||||
$tabRet['SituationJuridique'] = 'A';
|
||||
$identite['SituationJuridique'] = 'A';
|
||||
} elseif (count($this->getAnnoncesLegales($siren, 0, 'D', false)) > 0) {
|
||||
$tabRet['SituationJuridique'] = 'D';
|
||||
$identite['SituationJuridique'] = 'D';
|
||||
}
|
||||
// Fin Situation Juridique
|
||||
|
||||
@ -3973,17 +3975,15 @@ class MInsee
|
||||
* @param boolean $histo
|
||||
* @return array
|
||||
*/
|
||||
function getDirigeants($siren, $histo = true)
|
||||
public function getDirigeants($siren, $histo = true)
|
||||
{
|
||||
$siren=$siren*1;
|
||||
$tabRet=array();
|
||||
|
||||
$siren = intval($siren);
|
||||
$tabRet = array();
|
||||
$classWDate = new WDate();
|
||||
|
||||
if ($histo)
|
||||
{
|
||||
$bodacc=$this->iDb->select(
|
||||
'jo.bodacc_dirigeants d, jo.bodacc_detail b, jo.bodacc_fonctions f',
|
||||
if ($histo) {
|
||||
|
||||
$bodacc = $this->iDb->select('jo.bodacc_dirigeants d, jo.bodacc_detail b, jo.bodacc_fonctions f',
|
||||
'd.num, d.dateEffet, d.Rubrique, d.fonction, d.dirSiren, d.rs, d.nom, d.prenom, d.nomUsage, d.depart, d.dateInsert, f.libelle',
|
||||
"b.SIREN=$siren AND b.id=d.id AND b.typeEven NOT BETWEEN 5000 AND 5700 AND b.typeEven NOT BETWEEN 2700 AND 2900 AND d.fonction=f.codeFct GROUP BY d.fonction, d.rs, d.nom, d.prenom ORDER BY d.dateInsert DESC, d.dateEffet DESC, d.fonction DESC", true, MYSQL_ASSOC);
|
||||
if (count($bodacc)>0) {
|
||||
@ -4006,18 +4006,14 @@ class MInsee
|
||||
}
|
||||
}
|
||||
|
||||
$bodaccHisto=$this->iDb->select(
|
||||
'historiques.entrep e, historiques.texte x',
|
||||
$bodaccHisto = $this->iDb->select('historiques.entrep e, historiques.texte x',
|
||||
'e.ANBASE, e.NOBOD, e.CODTRI, e.JAL, e.DATE, e.CODEVE, e.SSCODE, e.DEPT, e.NOANN, e.ROLE, e.SIREN, e.E1GSIR, e.E1GNIC, x.annonceNum, x.annonceTxt',
|
||||
"e.E1GSIR=$siren AND e.ANBASE=x.annonceNum AND e.DATE BETWEEN 19890101 AND 20050101 AND x.annonceTxt LIKE '%Administration%' GROUP BY e.ANBASE ORDER BY e.DATE DESC", true, MYSQL_ASSOC);
|
||||
"e.E1GSIR=$siren AND e.ANBASE=x.annonceNum AND e.DATE BETWEEN 19960101 AND 20050101 AND x.annonceTxt LIKE '%Administration%' GROUP BY e.ANBASE ORDER BY e.DATE DESC", true, MYSQL_ASSOC);
|
||||
if (count($bodaccHisto)>0) {
|
||||
foreach ($bodaccHisto as $ann) {
|
||||
|
||||
if ($ann['DATE']<19960101 && $ann['E1GSIR']<>$ann['SIREN']) continue;
|
||||
|
||||
if ( ($ann['CODEVE']<20) ||
|
||||
($ann['CODEVE']>=30 && $ann['CODEVE']<42) ||
|
||||
($ann['CODEVE']>=51 && $ann['CODEVE']<80) ) {
|
||||
($ann['CODEVE']>=30 && $ann['CODEVE']<42) || ($ann['CODEVE']>=51 && $ann['CODEVE']<80) ) {
|
||||
if (preg_match('/Administration(?:.|)\:(.*)(?:Adresse.*|Commentaires?|Activit(?:e|é)|Etablissement principal|Date d\'effet|Date.de.d.but d.activit.)(?:.|)\:/Uisu', $ann['annonceTxt'], $matches)) {
|
||||
$iDir=0;
|
||||
$tabAdministration = $this->iBodacc->getDirigeants($matches[1]);
|
||||
@ -4195,7 +4191,6 @@ class MInsee
|
||||
}
|
||||
|
||||
if (count($tabRet)==0) {
|
||||
|
||||
if ($tabIdentite['FJ']*1>1000 && $tabIdentite['FJ']*1<2000) {
|
||||
$tabTmp=explode(' ', $tabIdentite['Nom']);
|
||||
$nom=$prenom='';
|
||||
@ -4215,17 +4210,17 @@ class MInsee
|
||||
$tabTmp=@$tabTmp[0];
|
||||
|
||||
$tabRet[] = array(
|
||||
'Titre' =>'Personne physique',
|
||||
'Societe' =>'',//utf8_encode($dir['Societe']),
|
||||
'Civilite' =>$civilite,
|
||||
'Nom' =>trim($nom),
|
||||
'Prenom' =>trim($prenom),
|
||||
'NomUsage' =>'',
|
||||
'NaissDate' =>$classWDate->dateT('Ymd', 'd/m/Y', $tabTmp['DIR_DATEN']),// 07/09/1961
|
||||
'NaissVille' =>$tabTmp['DIR_LIEUN'], // LE RUSSEY//,
|
||||
'NaissDepPays' =>'', // 25
|
||||
'Ancien' =>0,
|
||||
'DateFct' =>$tabIdentite['DateCrea'],//$tabIdentite['DateImma'],
|
||||
'Titre' => 'Personne physique',
|
||||
'Societe' => '',
|
||||
'Civilite' => $civilite,
|
||||
'Nom' => trim($nom),
|
||||
'Prenom' => trim($prenom),
|
||||
'NomUsage' => '',
|
||||
'NaissDate' => $classWDate->dateT('Ymd', 'd/m/Y', $tabTmp['DIR_DATEN']),// 07/09/1961
|
||||
'NaissVille' => $tabTmp['DIR_LIEUN'], // LE RUSSEY//,
|
||||
'NaissDepPays' => '', // 25
|
||||
'Ancien' => 0,
|
||||
'DateFct' => $tabIdentite['DateCrea'],//$tabIdentite['DateImma'],
|
||||
);
|
||||
$this->iDb->insert('jo.rncs_dirigeants', array(
|
||||
'siren' => $siren,
|
||||
@ -5351,7 +5346,6 @@ class MInsee
|
||||
$sqlHistoWhere = "e.E1GSIR=$siren";
|
||||
$sqlHistoWhere.= $sqlHistoRubrique;
|
||||
$sqlHistoWhere.= " AND e.ANBASE=x.annonceNum AND e.DATE BETWEEN 19890101 AND 20041231";
|
||||
/*$sqlHistoWhere.= " AND e.E1GSIR=e.SIREN";*/
|
||||
$sqlHistoWhere.= " GROUP BY e.ANBASE ORDER BY e.DATE DESC";
|
||||
$sqlHisto = $this->getAnnoncesLegalesHisto()." WHERE ".$sqlHistoWhere;
|
||||
}
|
||||
@ -5380,7 +5374,7 @@ class MInsee
|
||||
}
|
||||
// Gestion des événements à date
|
||||
if ($this->companyEvenDateStop != null ) {
|
||||
$sql.= ") results WHERE unionDate<'".$this->companyEvenDateStop."' ORDER BY unionDate DESC";
|
||||
$sql.= ") results WHERE unionDate < '".$this->companyEvenDateStop."' ORDER BY unionDate DESC";
|
||||
} else {
|
||||
$sql.= ") results ORDER BY unionDate DESC";
|
||||
}
|
||||
|
@ -1215,8 +1215,6 @@ function calculIndiScore($siren, $nic=0, $accesDist=false, $cycleClient=2, $mail
|
||||
$timer['ratiosecteur']=microtime(true);
|
||||
}
|
||||
|
||||
|
||||
|
||||
$timer['regression']=microtime(true);
|
||||
|
||||
/** Détection fine de l'état de fermeture éventuel à l'INSEE **/
|
||||
@ -2494,15 +2492,6 @@ function calculIndiScore($siren, $nic=0, $accesDist=false, $cycleClient=2, $mail
|
||||
}
|
||||
}
|
||||
|
||||
/** Grand Groupe **/
|
||||
$tabTmp=$iDb->select('jo.surveillances_site', 'count(*) as nb',
|
||||
"login IN ('dgfipb', 'dgfipc', 'dgfipifu1', 'dgfipifu10', 'dgfipifu11', 'dgfipifu12', 'dgfipifu13', 'dgfipifu14', 'dgfipifu2', 'dgfipifu3', 'dgfipifu4', 'dgfipifu5', 'dgfipifu6', 'dgfipifu7', 'dgfipifu8', 'dgfipifu9') AND siren=$siren AND dateSuppr=0",
|
||||
INDISCORE_DEBUG, MYSQL_ASSOC);
|
||||
$timer['GrandGroupe'] = microtime(true);
|
||||
$tabTmp=$tabTmp[0];
|
||||
if ($tabTmp['nb']>0) $GRANDGROUPE=true;
|
||||
else $GRANDGROUPE=false;
|
||||
|
||||
/** Affichage des informations de paiement dans le score **/
|
||||
$COTEOK_MMAA=$IMPAYE_MMAA=$PRIVILEGES_MMAA=$RISQUEGROUPE_MMAA='';
|
||||
$DEFAUT_MMAA=$LCASSUR_MMAA=$RISQUEIMPAYE_MMAA=$CSFACTO_MMAA='';
|
||||
@ -3020,6 +3009,15 @@ function calculIndiScore($siren, $nic=0, $accesDist=false, $cycleClient=2, $mail
|
||||
//Si NIVEAU avec generation des commentaires
|
||||
if ($genereComment)
|
||||
{
|
||||
// --- Grand Groupe
|
||||
$tabTmp=$iDb->select('jo.surveillances_site', 'count(*) as nb',
|
||||
"login IN ('dgfipb', 'dgfipc', 'dgfipifu1', 'dgfipifu10', 'dgfipifu11', 'dgfipifu12', 'dgfipifu13', 'dgfipifu14', 'dgfipifu2', 'dgfipifu3', 'dgfipifu4', 'dgfipifu5', 'dgfipifu6', 'dgfipifu7', 'dgfipifu8', 'dgfipifu9') AND siren=$siren AND dateSuppr=0",
|
||||
INDISCORE_DEBUG, MYSQL_ASSOC);
|
||||
$timer['GrandGroupe'] = microtime(true);
|
||||
$tabTmp=$tabTmp[0];
|
||||
if ($tabTmp['nb']>0) $GRANDGROUPE=true;
|
||||
else $GRANDGROUPE=false;
|
||||
|
||||
// NBNIC
|
||||
$tabTmp = $iDb->select('jo.etablissements', 'MAX(NIC) as NBNIC', "SIREN=$SIREN", INDISCORE_DEBUG, MYSQL_ASSOC);
|
||||
$NBNIC = $tabTmp[0]['NBNIC'];
|
||||
|
@ -27,6 +27,12 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
|
||||
*/
|
||||
protected $companyAnnonces;
|
||||
|
||||
/**
|
||||
* Liste des bilans
|
||||
* @var array
|
||||
*/
|
||||
protected $companyBilans;
|
||||
|
||||
/**
|
||||
* Date de fin de recherche des événements AAAAMMJJ
|
||||
* Envoyer cette date à toutes les méthodes
|
||||
@ -75,6 +81,8 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
|
||||
|
||||
public function injectIdentite(){}
|
||||
|
||||
public function injectBilans(){}
|
||||
|
||||
/**
|
||||
* Return the history of previous stored IndiScores on the companies
|
||||
* @param string $siren
|
||||
@ -758,7 +766,7 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
|
||||
$this->tabFormulesRatios = array();
|
||||
foreach ($tabFormules as $tmpFormule) {
|
||||
$this->tabFormulesRatios[$tmpFormule['id']] = $tmpFormule;
|
||||
$tabRatiosInfos[$tmpFormule['id']]=array('unite' => $tmpFormule['unite']);
|
||||
$tabRatiosInfos[$tmpFormule['id']] = array('unite' => $tmpFormule['unite']);
|
||||
}
|
||||
|
||||
$tabRatiosSecteurs = $tabRatios2 = $tabRatiosEvol = array();
|
||||
@ -767,15 +775,15 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
|
||||
$this->SIREN = $siren;
|
||||
$this->SIRET = $tabIdentite['SiretSiege'];
|
||||
|
||||
$this->ANNEE = date('Y')*1;
|
||||
$this->ANNEEp3 = $this->ANNEE-3;
|
||||
$this->ANNEEp2 = $this->ANNEE-2;
|
||||
$this->ANNEEp = $this->ANNEE-1;
|
||||
$this->ANNEE1 = $this->ANNEE+1;
|
||||
$this->ANNEE2 = $this->ANNEE+2;
|
||||
$this->ANNEE3 = $this->ANNEE+3;
|
||||
$this->ANNEE4 = $this->ANNEE+4;
|
||||
$this->ANNEE5 = $this->ANNEE+5;
|
||||
$this->ANNEE = date('Y')*1;
|
||||
$this->ANNEEp3 = $this->ANNEE-3;
|
||||
$this->ANNEEp2 = $this->ANNEE-2;
|
||||
$this->ANNEEp = $this->ANNEE-1;
|
||||
$this->ANNEE1 = $this->ANNEE+1;
|
||||
$this->ANNEE2 = $this->ANNEE+2;
|
||||
$this->ANNEE3 = $this->ANNEE+3;
|
||||
$this->ANNEE4 = $this->ANNEE+4;
|
||||
$this->ANNEE5 = $this->ANNEE+5;
|
||||
|
||||
$this->JOUR_DATE = date('Y-m-d');
|
||||
$this->JOUR_HEURE = date('H:i');
|
||||
@ -822,13 +830,13 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
|
||||
// Elements provenant du Notice 80 hors identité
|
||||
$tabIden80 = $iInsee->getInfosNotice($siren, $NIC);
|
||||
$timer['getInfosNotice'] = microtime(true);
|
||||
$this->RECME=$tabIden80['insRECME'];
|
||||
$this->ZEMET=$tabIden80['insZEMET'];
|
||||
$this->RPET=$tabIden80['insRPET'];
|
||||
$this->RPEN=$tabIden80['insRPEN'];
|
||||
$this->DateNotice80=$tabIden80['dateNotice'];
|
||||
$depcomen=$tabIden80['insDEPCOMEN']*1;
|
||||
$this->TU=$tabIden80['insTU'];
|
||||
$this->RECME = $tabIden80['insRECME'];
|
||||
$this->ZEMET = $tabIden80['insZEMET'];
|
||||
$this->RPET = $tabIden80['insRPET'];
|
||||
$this->RPEN = $tabIden80['insRPEN'];
|
||||
$this->DateNotice80 = $tabIden80['dateNotice'];
|
||||
$depcomen = $tabIden80['insDEPCOMEN']*1;
|
||||
$this->TU = $tabIden80['insTU'];
|
||||
|
||||
/**
|
||||
* Différences INSEE/RNCS
|
||||
@ -844,13 +852,13 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
|
||||
elseif (strlen($this->APEENT)==4) $this->APE4 = $this->APEENT;
|
||||
else $this->APE5 = $this->APE4 = '';
|
||||
|
||||
$this->DIMMAT=$tabIdentiteRncs['dateImma'];
|
||||
$this->DIMMAT_AA=substr($tabIdentiteRncs['dateImma'],0,4);
|
||||
$this->DIMMAT = $tabIdentiteRncs['dateImma'];
|
||||
$this->DIMMAT_AA = substr($tabIdentiteRncs['dateImma'],0,4);
|
||||
|
||||
$this->FJURINSEE=$tabIdentite['FJ']*1;
|
||||
$this->FJURINSEE1=substr($this->FJURINSEE,0,1)*1;
|
||||
$this->FJURINSEE = $tabIdentite['FJ']*1;
|
||||
$this->FJURINSEE1 = substr($this->FJURINSEE,0,1)*1;
|
||||
if ($this->FJURINSEE1==0) $this->FJURINSEE1=substr($this->FJURINSEE,0,1)*1;
|
||||
$this->FJURINSEE2=substr($this->FJURINSEE,0,2)*1;
|
||||
$this->FJURINSEE2 = substr($this->FJURINSEE,0,2)*1;
|
||||
if ($this->FJURINSEE2==0) $this->FJURINSEE2=$this->FJURINSEE;
|
||||
|
||||
$this->FJURRNCS=$tabIdentiteRncs['cj']*1;
|
||||
@ -864,34 +872,34 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
|
||||
if ($tabIdentite['Source']*1<>2) $this->PRESENTINSEE=false;
|
||||
else $this->PRESENTINSEE=true;
|
||||
|
||||
$this->NOMEN=trim(strtr($tabIdentite['Nom'],array('*'=>' ','/'=>' ')));
|
||||
$this->ENSEIGNE=$tabIdentite['Enseigne'];
|
||||
$this->ENTREP_ALT=$tabIdentite['GeoAlt']; // Altitude de l'établissement
|
||||
$this->ACTIVNAT=$tabIdentite['NatureActivite'];
|
||||
$this->AUXILT=$tabIdentite['Auxiliaire'];
|
||||
$this->ORIGINE=$tabIdentite['OrigineCreation'];
|
||||
$this->ACTISURF=$tabIdentite['ACTISURF'];
|
||||
$this->EXPLEN=$tabIdentite['EXPLEN'];
|
||||
$this->EXPLET=$tabIdentite['EXPLET'];
|
||||
$this->LIEUACT=$tabIdentite['LIEUACT'];
|
||||
$this->MODEN=$tabIdentite['MODEN'];
|
||||
$this->MONOACT=$tabIdentite['MONOACT'];
|
||||
$this->MONOREG=$tabIdentite['MONOREG'];
|
||||
$this->PRODPART=$tabIdentite['PRODPART'];
|
||||
$this->NOMEN = trim(strtr($tabIdentite['Nom'],array('*'=>' ','/'=>' ')));
|
||||
$this->ENSEIGNE = $tabIdentite['Enseigne'];
|
||||
$this->ENTREP_ALT = $tabIdentite['GeoAlt']; // Altitude de l'établissement
|
||||
$this->ACTIVNAT = $tabIdentite['NatureActivite'];
|
||||
$this->AUXILT = $tabIdentite['Auxiliaire'];
|
||||
$this->ORIGINE = $tabIdentite['OrigineCreation'];
|
||||
$this->ACTISURF = $tabIdentite['ACTISURF'];
|
||||
$this->EXPLEN = $tabIdentite['EXPLEN'];
|
||||
$this->EXPLET = $tabIdentite['EXPLET'];
|
||||
$this->LIEUACT = $tabIdentite['LIEUACT'];
|
||||
$this->MODEN = $tabIdentite['MODEN'];
|
||||
$this->MONOACT = $tabIdentite['MONOACT'];
|
||||
$this->MONOREG = $tabIdentite['MONOREG'];
|
||||
$this->PRODPART = $tabIdentite['PRODPART'];
|
||||
|
||||
// Saisonnalité de l'activité
|
||||
if ($tabIdentite['Saisonnalite']==1) $this->SAISONAT='S';
|
||||
else $this->SAISONAT='P';
|
||||
$this->CAPITAL=$tabIdentite['Capital'];
|
||||
$this->CAPITAL_NBACTION=$tabIdentite['CapitalNbActions'];
|
||||
$this->CAPITAL_MTACTION=$tabIdentite['CapitalMtActions'];
|
||||
$this->CAPITAL = $tabIdentite['Capital'];
|
||||
$this->CAPITAL_NBACTION = $tabIdentite['CapitalNbActions'];
|
||||
$this->CAPITAL_MTACTION = $tabIdentite['CapitalMtActions'];
|
||||
if ($this->CAPITAL>0) {
|
||||
switch ($tabIdentite['CapitalType']) {
|
||||
case 'V': $this->CAPITAL_TYPE='variable'; break;
|
||||
case 'S': $this->CAPITAL_TYPE='fixe'; break;
|
||||
default: $this->CAPITAL_TYPE=''; break;
|
||||
case 'V': $this->CAPITAL_TYPE = 'variable'; break;
|
||||
case 'S': $this->CAPITAL_TYPE = 'fixe'; break;
|
||||
default: $this->CAPITAL_TYPE = ''; break;
|
||||
}
|
||||
} else $this->CAPITAL_TYPE='';
|
||||
} else $this->CAPITAL_TYPE = '';
|
||||
|
||||
$this->TCAEXP=$tabIdentite['TrancheCAexp'];
|
||||
|
||||
@ -918,9 +926,9 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
|
||||
else {
|
||||
$dateCrea=0;
|
||||
}
|
||||
$this->DCREN=$dateCrea;
|
||||
$this->DCREN_AA=substr($dateCrea,0,4);
|
||||
$this->AGE=$classWdate->nbMoisEntre($dateCrea, date('Ymd'));
|
||||
$this->DCREN = $dateCrea;
|
||||
$this->DCREN_AA = substr($dateCrea,0,4);
|
||||
$this->AGE = $classWdate->nbMoisEntre($dateCrea, date('Ymd'));
|
||||
|
||||
// --- Liste des bilans
|
||||
$tabBilan = $tabBil = $this->tabRegX = array();
|
||||
@ -1108,10 +1116,7 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
|
||||
|
||||
$this->CABILAN=$this->R[6];
|
||||
|
||||
/**
|
||||
* Tableau des ratios secteurs
|
||||
* Requete BDD
|
||||
*/
|
||||
// Ratios Secteur en fonction des dernières années de bilans
|
||||
$this->MARCHE=$this->MARCHEp=$this->MARCHEVOL=$this->MARCHEPART=$this->MARCHEPARTp=$this->MARCHEPARTEVOL='';
|
||||
$this->MARCHESAL=$this->MARCHESALp=$this->MARCHENBENT=$this->MARCHENBENTp='';
|
||||
$tabRatiosSecteurs=$Rtot=array();
|
||||
@ -1268,14 +1273,14 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
|
||||
$this->ANNONCELJ=$this->ANNONCERJ=$this->ANNONCESV=$this->ANNONCEPUB=0;
|
||||
|
||||
$this->ANNONCEFUS=0;
|
||||
$this->FUSIONPROJET=''; // Présence d'un projet de fusion, libellé du projet
|
||||
$this->FUSIONPROJET=''; // Présence d'un projet de fusion, libellé du projet
|
||||
$this->FUSIONPROJET_SIREN=''; // Siren concerné par le projet de fusion
|
||||
$this->FUSIONPROJET_DATE=''; // Date du projet de fusion
|
||||
$this->NOMFUSION='';
|
||||
$this->CAPITAL_PRE=''; // Montant du capital Précédent
|
||||
$this->CAPITAL_PRE=''; // Montant du capital Précédent
|
||||
|
||||
$this->ANNONCEHOM=0; // Nombre d'annonces d'homologation
|
||||
$this->ANNONCEHOMDATE=''; // Date de la dernière parution d'annonces d'homologation
|
||||
$this->ANNONCEHOMDATE=''; // Date de la dernière parution d'annonces d'homologation
|
||||
|
||||
$this->ANNONCEPLAN=$this->ANNONCEPLANMODIFDATE=$this->ANNONCEPLANDATE=$this->PLAN=$this->PLANMODIF=$this->ANNONCEPC='';
|
||||
$this->ANNONCEPC_OBS=false;
|
||||
@ -1311,7 +1316,7 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
|
||||
|
||||
// Annonces de dépôt des comptes
|
||||
$tabDepotCpt = $iInsee->annoncesFilter($companyAnnonces, 'C');
|
||||
$nbDepotCpt=count($tabDepotCpt);
|
||||
$nbDepotCpt = count($tabDepotCpt);
|
||||
$nbMoisMax=0;
|
||||
$this->ANNONCEBODCMANQDATE = false;
|
||||
$this->ANNONCEBODCREGUL = true;
|
||||
@ -1331,10 +1336,10 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
|
||||
$this->ANNONCEDER=implode(', ', $tabTmp);
|
||||
$this->ANNONCEDERDATE=$depot['DateParution'];
|
||||
switch(substr($depot['BodaccCode'],0,1)) {
|
||||
case 'B': $this->ANNONCEDERSOURCE='BODACC'; break;// INPI, Publication Régionale
|
||||
case 'P': $this->ANNONCEDERSOURCE='RNCS'; break;
|
||||
case 'G': $this->ANNONCEDERSOURCE='GREFFE DU TRIBUNAL'; break;
|
||||
default: $this->ANNONCEDERSOURCE='JOURNAL REGIONAL'; break;
|
||||
case 'B': $this->ANNONCEDERSOURCE='BODACC'; break;// INPI, Publication Régionale
|
||||
case 'P': $this->ANNONCEDERSOURCE='RNCS'; break;
|
||||
case 'G': $this->ANNONCEDERSOURCE='GREFFE DU TRIBUNAL'; break;
|
||||
default: $this->ANNONCEDERSOURCE='JOURNAL REGIONAL'; break;
|
||||
}
|
||||
$this->ANNONCEDERTEXTE=$depot['texteAnnonce'];// INPI, Publication Régionale
|
||||
|
||||
@ -1504,7 +1509,7 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
|
||||
|
||||
// Annonces BODACC Fusion/Absorptions
|
||||
/**
|
||||
* 2700 Fusion/Absorption (entitée absorbante)
|
||||
* 2700 Fusion/Absorption (entitée absorbante)
|
||||
* 2701 Fusion/Absorption (Entitée absorbante. Entité absorbée inconnue)
|
||||
* 2702 Fusion/Absorption (Entitée absorbante. Entité absorbée mal SIRENEE)
|
||||
* 2703 Fusion/Absorption (Entitée absorbante. Entité absorbée non SIRENEE)
|
||||
@ -1637,7 +1642,7 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
|
||||
}
|
||||
|
||||
// Annonces BODACC Poursuite de l'activité malgré la perte de plus de la moitié du capital social
|
||||
$tabDepotCpt = $iInsee->annoncesFilter($this->CompanyAnnonces, array(2314,2319));
|
||||
$tabDepotCpt = $iInsee->annoncesFilter($companyAnnonces, array(2314,2319));
|
||||
if (is_array($tabDepotCpt) && count($tabDepotCpt)>0){
|
||||
foreach ($tabDepotCpt as $iDep=>$depot) {
|
||||
$this->ANNONCEPOURSDATE= $this->ANNONCEDISSONONDATE= $depot['DateParution'];
|
||||
@ -1902,19 +1907,19 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
|
||||
|
||||
if ($naf=='741J' || $naf=='6420Z' || // Activités des sociétés holding
|
||||
$this->R[302]>0 || $this->R[303]>0 || $this->R[304]>0 // Holding déclaré au Bilan
|
||||
) $this->HOLDING=true;
|
||||
else $this->HOLDING=false;
|
||||
) $this->HOLDING=true;
|
||||
else $this->HOLDING=false;
|
||||
// Présence d'au moins un bilan
|
||||
if ($this->NBBILAN>0) $this->BILAN=true;
|
||||
else $this->BILAN=false;
|
||||
if ($this->NBBILAN>0) $this->BILAN=true;
|
||||
else $this->BILAN=false;
|
||||
// Département du siège de l'entreprise
|
||||
if ($depcomen==0) $depcomen=$tabIdentite['CP']*1;
|
||||
if ($depcomen==0) $depcomen=$tabIdentite['CP']*1;
|
||||
|
||||
if ($depcomen>99000) $this->DEPSIE=$depcomen;
|
||||
elseif ($depcomen>96000) $this->DEPSIE=substr($depcomen,0,3);
|
||||
elseif ($depcomen<10000) $this->DEPSIE=substr($depcomen,0,1);
|
||||
else $this->DEPSIE=substr($depcomen,0,2);
|
||||
$this->DEPSIE_DE=$iInsee->getDepartement($this->DEPSIE,true);
|
||||
if ($depcomen>99000) $this->DEPSIE=$depcomen;
|
||||
elseif ($depcomen>96000) $this->DEPSIE=substr($depcomen,0,3);
|
||||
elseif ($depcomen<10000) $this->DEPSIE=substr($depcomen,0,1);
|
||||
else $this->DEPSIE=substr($depcomen,0,2);
|
||||
$this->DEPSIE_DE = $iInsee->getDepartement($this->DEPSIE,true);
|
||||
|
||||
/**
|
||||
* Solvabilité
|
||||
@ -1934,17 +1939,17 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
|
||||
$this->RECME,
|
||||
$iDb
|
||||
);
|
||||
$noteStructure=$isolv->getSolvabilite();
|
||||
$timer['solv']=microtime(true);
|
||||
$noteStructure = $isolv->getSolvabilite();
|
||||
$timer['solv'] = microtime(true);
|
||||
|
||||
$tabStructure['activite']= $isolv->getPtActivite();
|
||||
$tabStructure['naf4']= $isolv->getNaf4($naf);
|
||||
$tabStructure['age']= $isolv->getPtAge(date('Y'));
|
||||
$tabStructure['capital']= $isolv->getPtCapital();
|
||||
$tabStructure['effectif']= $isolv->getPtEffectif();
|
||||
$tabStructure['fj']= $isolv->getPtFormeJuridique();
|
||||
$tabStructure['localite']= $isolv->getPtGeographie();
|
||||
$tabStructure['singulier']= $isolv->getPtSingularite();
|
||||
$tabStructure['activite'] = $isolv->getPtActivite();
|
||||
$tabStructure['naf4'] = $isolv->getNaf4($naf);
|
||||
$tabStructure['age'] = $isolv->getPtAge(date('Y'));
|
||||
$tabStructure['capital'] = $isolv->getPtCapital();
|
||||
$tabStructure['effectif'] = $isolv->getPtEffectif();
|
||||
$tabStructure['fj'] = $isolv->getPtFormeJuridique();
|
||||
$tabStructure['localite'] = $isolv->getPtGeographie();
|
||||
$tabStructure['singulier'] = $isolv->getPtSingularite();
|
||||
|
||||
// Le dépôt des comptes annuel est facultatif ?
|
||||
if ($isolv->doitPublier($fj, $naf)) {
|
||||
@ -1991,7 +1996,7 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
|
||||
|
||||
$lienM = new MLiens2($siren, 'siren');
|
||||
|
||||
//Actionnaire
|
||||
// Actionnaire
|
||||
$tabA = $lienM->getActionnaires(null, true);
|
||||
if (count($tabA)>0) {
|
||||
foreach ($tabA as $i=>$lien)
|
||||
@ -2030,7 +2035,7 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
|
||||
}
|
||||
$timer['actionnaires']=microtime(true);
|
||||
|
||||
//Participation
|
||||
// Participation
|
||||
$this->NBFILLE=0;
|
||||
$this->NICFILLE=$this->SIRENFILLE=$this->SIRETFILLE=$this->NOMFILLE='';
|
||||
$tabP=$lienM->getParticipations(null, true);
|
||||
@ -2070,7 +2075,7 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
|
||||
elseif ($this->CAPITAL < 2000000) $this->NOTECAP20=13;
|
||||
elseif ($this->CAPITAL < 5000000) $this->NOTECAP20=15;
|
||||
elseif ($this->CAPITAL < 10000000) $this->NOTECAP20=17;
|
||||
else $this->NOTECAP20=19;
|
||||
else $this->NOTECAP20=19;
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -2355,8 +2360,7 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
|
||||
$this->DIR_NB=$this->NBDIRLIENS=$this->NBDIRSCI=$this->NBDIRSCIADR=0;
|
||||
//@sendMail('production@scores-decisions.com', 'ylenaour@scores-decisions.com', "Indiscore sur $siren : Dirigeants", print_r($dirs, true));
|
||||
if (count($dirs) > 0 ) {
|
||||
foreach ($dirs as $nb => $dir)
|
||||
{
|
||||
foreach ($dirs as $nb => $dir) {
|
||||
if ($dir['Ancien']==0 && preg_match('/G.rant|Personne|Pr.sident|Directeur|Repr.sentant/Uisu', $dir['Titre'])) {
|
||||
$this->DIR_NB++;
|
||||
if ($this->DIR_NB==1) {
|
||||
@ -2371,7 +2375,7 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
|
||||
$this->DIR2_TYPE='PP';
|
||||
}
|
||||
|
||||
$activeRechercheDir = true;
|
||||
$activeRechercheDir = false;
|
||||
if ($activeRechercheDir){
|
||||
$tabDir = $iInsee->rechercheDir($dir['Nom'], $dir['Prenom'], '', $dir['NaissDate'], '', 0, 200, 200);
|
||||
$tabDir = $tabDir['reponses'];
|
||||
@ -2460,45 +2464,36 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
|
||||
}
|
||||
$timer['traitementDirigeants'] = microtime(true);
|
||||
|
||||
/** On vérifie s'il y a un cuteoff
|
||||
* @todo Attention, si modif après dateInsert/dateUpdate (procol, impayé, etc...) ne plus
|
||||
* prendre en compte le cuteoff
|
||||
*
|
||||
**/
|
||||
// --- Cut Off
|
||||
$this->ENQUETE='';
|
||||
$tabTmp=$iDb->select('jo.scores_cutoff', 'encours, scoreSolv, scoreDir, scoreConf, DATE(dateInsert)*1 AS dateInsert, DATE(dateUpdate)*1 AS dateUpdate', "siren=$siren", $this->debug, MYSQL_ASSOC);
|
||||
$timer['scores_cutoff'] = microtime(true);
|
||||
if (isset($tabTmp[0]['encours'])) {
|
||||
if($tabTmp[0]['dateUpdate']>$tabTmp[0]['dateInsert']) {
|
||||
$dateMaj=$tabTmp[0]['dateUpdate'];
|
||||
} else {
|
||||
$dateMaj=$tabTmp[0]['dateInsert'];
|
||||
}
|
||||
if ($classWdate->nbMoisEntre($dateMaj, date('Ymd'))<=$this->ENQUETELIM) {
|
||||
$encoursForce=$tabTmp[0]['encours'];
|
||||
if ($tabTmp[0]['scoreConf']<>null) $this->SCORECONF=$tabTmp[0]['scoreConf'];
|
||||
if ($this->SCORECONF>$this->ENQUETEMAXI) $this->SCORECONF=$this->ENQUETEMAXI;
|
||||
if ($tabTmp[0]['scoreDir'] <>null) $this->SCOREDIRI=$tabTmp[0]['scoreDir'];
|
||||
if ($this->SCOREDIRI>$this->ENQUETEMAXI) $this->SCOREDIRI=$this->ENQUETEMAXI;
|
||||
if ($tabTmp[0]['scoreSolv']<>null) $this->ENQUETE=$noteSolvabilite=$tabTmp[0]['scoreSolv'];
|
||||
if ($this->ENQUETE>$this->ENQUETEMAXI) $this->ENQUETE=$this->ENQUETEMAXI;
|
||||
// Permet de supprimer la prise en compte de la procol
|
||||
if ($this->ENQUETE>0) {
|
||||
$tabIdentite['SituationJuridique']=$this->ANNONCEPC='';
|
||||
$this->ANNONCELJ=$this->ANNONCERJ=$this->ANNONCESV=$this->PLANMODIF=$this->PLAN=$this->ANNONCEPC_OBS=$this->ELIMINE=false;
|
||||
if ($this->companyEvenDateStop === null) {
|
||||
$tabTmp = $iDb->select('jo.scores_cutoff',
|
||||
'encours, scoreSolv, scoreDir, scoreConf, DATE(dateInsert)*1 AS dateInsert, DATE(dateUpdate)*1 AS dateUpdate',
|
||||
"siren=$siren", $this->debug, MYSQL_ASSOC);
|
||||
$timer['scores_cutoff'] = microtime(true);
|
||||
if (isset($tabTmp[0]['encours'])) {
|
||||
if($tabTmp[0]['dateUpdate']>$tabTmp[0]['dateInsert']) {
|
||||
$dateMaj=$tabTmp[0]['dateUpdate'];
|
||||
} else {
|
||||
$dateMaj=$tabTmp[0]['dateInsert'];
|
||||
}
|
||||
if ($classWdate->nbMoisEntre($dateMaj, date('Ymd'))<=$this->ENQUETELIM) {
|
||||
$encoursForce=$tabTmp[0]['encours'];
|
||||
if ($tabTmp[0]['scoreConf']<>null) $this->SCORECONF=$tabTmp[0]['scoreConf'];
|
||||
if ($this->SCORECONF>$this->ENQUETEMAXI) $this->SCORECONF=$this->ENQUETEMAXI;
|
||||
if ($tabTmp[0]['scoreDir'] <>null) $this->SCOREDIRI=$tabTmp[0]['scoreDir'];
|
||||
if ($this->SCOREDIRI>$this->ENQUETEMAXI) $this->SCOREDIRI=$this->ENQUETEMAXI;
|
||||
if ($tabTmp[0]['scoreSolv']<>null) $this->ENQUETE=$noteSolvabilite=$tabTmp[0]['scoreSolv'];
|
||||
if ($this->ENQUETE>$this->ENQUETEMAXI) $this->ENQUETE=$this->ENQUETEMAXI;
|
||||
// Permet de supprimer la prise en compte de la procol
|
||||
if ($this->ENQUETE>0) {
|
||||
$tabIdentite['SituationJuridique']=$this->ANNONCEPC='';
|
||||
$this->ANNONCELJ=$this->ANNONCERJ=$this->ANNONCESV=$this->PLANMODIF=$this->PLAN=$this->ANNONCEPC_OBS=$this->ELIMINE=false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Grand Groupe **/
|
||||
$tabTmp=$iDb->select('jo.surveillances_site', 'count(*) as nb',
|
||||
"login IN ('dgfipb', 'dgfipc', 'dgfipifu1', 'dgfipifu10', 'dgfipifu11', 'dgfipifu12', 'dgfipifu13', 'dgfipifu14', 'dgfipifu2', 'dgfipifu3', 'dgfipifu4', 'dgfipifu5', 'dgfipifu6', 'dgfipifu7', 'dgfipifu8', 'dgfipifu9') AND siren=$siren AND dateSuppr=0",
|
||||
$this->debug, MYSQL_ASSOC);
|
||||
$timer['GrandGroupe'] = microtime(true);
|
||||
$tabTmp=$tabTmp[0];
|
||||
if ($tabTmp['nb']>0) $this->GRANDGROUPE=true;
|
||||
else $this->GRANDGROUPE=false;
|
||||
|
||||
/** Affichage des informations de paiement dans le score **/
|
||||
$this->COTEOK_MMAA=$this->IMPAYE_MMAA=$this->PRIVILEGES_MMAA=$this->RISQUEGROUPE_MMAA='';
|
||||
$this->DEFAUT_MMAA=$this->LCASSUR_MMAA=$this->RISQUEIMPAYE_MMAA=$this->CSFACTO_MMAA='';
|
||||
@ -2682,110 +2677,92 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
|
||||
|
||||
if ($this->DEFAUT) {
|
||||
if (($this->NBBILAN==0 || $this->BILANVIEUX) && $this->CAPITAL<750000) $noteSolvMax=41;
|
||||
elseif (($this->NBBILAN==0 || $this->BILANVIEUX) && $this->CAPITAL<1500000) $noteSolvMax=48;
|
||||
elseif (($this->NBBILAN==0 || $this->BILANVIEUX)) $noteSolvMax=51;
|
||||
else $noteSolvMax=54;
|
||||
elseif (($this->NBBILAN==0 || $this->BILANVIEUX) && $this->CAPITAL<1500000)$noteSolvMax=48;
|
||||
elseif (($this->NBBILAN==0 || $this->BILANVIEUX)) $noteSolvMax=51;
|
||||
else $noteSolvMax=54;
|
||||
}
|
||||
if ($this->RISQUEGROUPE) {
|
||||
if ($this->RJMERE) $noteSolvMax=39;
|
||||
elseif ($this->RJFILLE) $noteSolvMax=49;
|
||||
else $noteSolvMax=56;
|
||||
if ($this->RJMERE) $noteSolvMax=39;
|
||||
elseif ($this->RJFILLE)$noteSolvMax=49;
|
||||
else $noteSolvMax=56;
|
||||
}
|
||||
|
||||
//ICI//
|
||||
//$noteSolvabilite
|
||||
|
||||
if ($tabIdentite['SituationJuridique']=='PL') {
|
||||
$this->SCOREDIRI-=20;
|
||||
$this->SCORECONF+=10;
|
||||
if (($this->NBBILAN==0 || $this->BILANVIEUX) && $this->CAPITAL<750000) $noteSolvMax=39;
|
||||
elseif (($this->NBBILAN==0 || $this->BILANVIEUX) && $this->CAPITAL<1500000) $noteSolvMax=41;
|
||||
elseif (($this->NBBILAN==0 || $this->BILANVIEUX)) $noteSolvMax=48;
|
||||
else $noteSolvMax=51;
|
||||
if (($this->NBBILAN==0 || $this->BILANVIEUX) && $this->CAPITAL<750000) $noteSolvMax=39;
|
||||
elseif (($this->NBBILAN==0 || $this->BILANVIEUX) && $this->CAPITAL<1500000) $noteSolvMax=41;
|
||||
elseif (($this->NBBILAN==0 || $this->BILANVIEUX)) $noteSolvMax=48;
|
||||
else $noteSolvMax=51;
|
||||
}
|
||||
|
||||
if ($noteSolvabilite>$noteSolvMax) $noteSolvabilite=$noteSolvMax;
|
||||
$timer['privileges']=microtime(true);
|
||||
|
||||
/**/
|
||||
$MODIFDERDATE=$MODIFINSEEDATE;
|
||||
// Rcs
|
||||
if ($MODIFRNCSDATE>$MODIFDERDATE) $MODIFDERDATE=$MODIFRNCSDATE;
|
||||
// Annonces
|
||||
if ($ANNONCEDERDATE>$MODIFDERDATE) $MODIFDERDATE=$ANNONCEDERDATE;
|
||||
// Bilans
|
||||
/** @todo if ($MODIFBILDATE>$MODIFDERDATE) $MODIFDERDATE=$MODIFBILDATE;**/
|
||||
// Paiements
|
||||
if ($this->MODIFPAIDATE>$this->MODIFDERDATE) $this->MODIFDERDATE=$this->MODIFPAIDATE;
|
||||
|
||||
/** Commentaire Dirigeance **/
|
||||
if ($this->SCOREDIRI>=70)
|
||||
$analyseDir='L\'étude de la dirigeance ne relève aucun problème.';
|
||||
elseif ($this->SCOREDIRI>=40)
|
||||
$analyseDir='L\'étude de la dirigeance retient notre attention.';
|
||||
elseif ($this->SCOREDIRI>0)
|
||||
$analyseDir='L\'étude de la dirigeance attire toute notre attention.';
|
||||
else {
|
||||
$analyseDir='L\'étude de la dirigeance révèle des anomalies.';
|
||||
// --- Commentaire Dirigeance
|
||||
if ($this->SCOREDIRI>=70) {
|
||||
$analyseDir="L'étude de la dirigeance ne relève aucun problème.";
|
||||
} elseif ($this->SCOREDIRI>=40) {
|
||||
$analyseDir="L'étude de la dirigeance retient notre attention.";
|
||||
} elseif ($this->SCOREDIRI>0) {
|
||||
$analyseDir="L'étude de la dirigeance attire toute notre attention.";
|
||||
} else {
|
||||
$analyseDir="L'étude de la dirigeance révèle des anomalies.";
|
||||
$this->SCOREDIRI=0;
|
||||
}
|
||||
|
||||
/** Commentaire Conformité **/
|
||||
if ($tabIdentite['SituationJuridique']=='P'){
|
||||
$noteSolvabilite=$this->SCORECONF=$this->SCOREDIRI=0;
|
||||
$analyseConf='L\'entreprise est en procédure collective';
|
||||
} elseif ($tabIdentite['SituationJuridique']=='D'){
|
||||
$noteSolvabilite=$this->SCORECONF=$this->SCOREDIRI=0;
|
||||
$analyseConf='L\'entreprise est dissoute';
|
||||
} elseif ($tabIdentite['Actif']==0){
|
||||
$noteSolvabilite=$this->SCORECONF=$this->SCOREDIRI=0;
|
||||
$analyseConf='L\'entreprise n\'est pas en activité';
|
||||
} elseif ($this->SCORECONF>=70)
|
||||
$analyseConf='L\'analyse de la conformité est correcte.';
|
||||
elseif ($this->SCORECONF>=40)
|
||||
$analyseConf='L\'analyse de la conformité est acceptable.';
|
||||
elseif ($this->SCORECONF>0)
|
||||
$analyseConf='L\'analyse de la conformité est sensible.';
|
||||
else {
|
||||
$analyseConf='L\'analyse de la conformité est très sensible.';
|
||||
$this->SCORECONF=0;
|
||||
// --- Commentaire Conformité
|
||||
if ($tabIdentite['SituationJuridique']=='P') {
|
||||
$noteSolvabilite = $this->SCORECONF = $this->SCOREDIRI = 0;
|
||||
$analyseConf = "L'entreprise est en procédure collective";
|
||||
} elseif ($tabIdentite['SituationJuridique']=='D') {
|
||||
$noteSolvabilite = $this->SCORECONF = $this->SCOREDIRI = 0;
|
||||
$analyseConf = "L'entreprise est dissoute";
|
||||
} elseif ($tabIdentite['Actif']==0) {
|
||||
$noteSolvabilite = $this->SCORECONF = $this->SCOREDIRI = 0;
|
||||
$analyseConf = "L'entreprise n'est pas en activité";
|
||||
} elseif ($this->SCORECONF>=70) {
|
||||
$analyseConf = "L'analyse de la conformité est correcte.";
|
||||
} elseif ($this->SCORECONF>=40) {
|
||||
$analyseConf = "L'analyse de la conformité est acceptable.";
|
||||
} elseif ($this->SCORECONF>0) {
|
||||
$analyseConf = "L'analyse de la conformité est sensible.";
|
||||
} else {
|
||||
$analyseConf = "L'analyse de la conformité est très sensible.";
|
||||
$this->SCORECONF = 0;
|
||||
}
|
||||
|
||||
/** Commentaire Solvabilité **/
|
||||
// --- Commentaire Solvabilité
|
||||
if ($noteFin>0) $noteSolv=($noteStructure+$noteFin)/2;
|
||||
else $noteSolv=($noteStructure+$noteFin)/5;
|
||||
if ($noteSolv>=15) $analyseSolv='Excellente';
|
||||
elseif ($noteSolv>=12) $analyseSolv='Bonne';
|
||||
elseif ($noteSolv>=10) $analyseSolv='Correcte';
|
||||
elseif ($noteSolv>=8) $analyseSolv='Moyenne';
|
||||
elseif ($noteSolv>=6) $analyseSolv='Délicate';
|
||||
else $analyseSolv='Inquiétante';
|
||||
if ($noteSolvabilite>=40 && $analyseSolv=='Inquiétante') $analyseSolv='Correcte';
|
||||
if ($noteSolv>=15) $analyseSolv = 'Excellente';
|
||||
elseif ($noteSolv>=12) $analyseSolv = 'Bonne';
|
||||
elseif ($noteSolv>=10) $analyseSolv = 'Correcte';
|
||||
elseif ($noteSolv>=8) $analyseSolv = 'Moyenne';
|
||||
elseif ($noteSolv>=6) $analyseSolv = 'Délicate';
|
||||
else $analyseSolv = 'Inquiétante';
|
||||
if ($noteSolvabilite>=40 && $analyseSolv=='Inquiétante') $analyseSolv = 'Correcte';
|
||||
|
||||
/** CA Moyen par salarié pour un secteur donné
|
||||
**/
|
||||
/*$tabTmp=$iDb->select('jo.ratios_secteurs', 'id, naf5, annee, SUM(montant), SUM(nombre), SUM(montant)/SUM(nombre) AS moyenne', "naf5='$naf' AND id=267 AND ANNEE>(SELECT MAX(annee) FROM ratios_secteurs WHERE naf5='$naf' AND id=267)-2 GROUP BY id, naf5", true, MYSQL_ASSOC);
|
||||
$caSecteur=round($tabTmp[0]['moyenne']*1000);
|
||||
// Encours moyen secteur * nb salariés
|
||||
if ($this->EFFECTIF>0) $this->CAESTIME=$caSecteur*$this->EFFECTIF;
|
||||
else $this->CAESTIME=$caSecteur;
|
||||
*/
|
||||
/** CA Moyen par salarié pour un secteur donné **/
|
||||
$this->CAESTIME = $iInsee->getCAnafEffectif($naf, $this->EFFECTIF);
|
||||
|
||||
if ($this->CABILAN>0) $this->CABIOUES=$this->CABILAN;
|
||||
else $this->CABIOUES=$this->CAESTIME;
|
||||
|
||||
// L'encours de départ est à 10% du capital
|
||||
$encoursIni=$tabIdentite['Capital']/10;
|
||||
$encoursIni = $tabIdentite['Capital']/10;
|
||||
// Ou à l'encours ini CS car pas d'informations négatives
|
||||
if ($encoursCS>$encoursIni) $encoursIni=$encoursCS;
|
||||
|
||||
$this->ENCOURS=$encoursIni;
|
||||
$encoursEstime=0;
|
||||
$this->ENCOURS = $encoursIni;
|
||||
$encoursEstime = 0;
|
||||
$timer['camoyen']=microtime(true);
|
||||
|
||||
// L'encours de trésorerie prend 1/6è de 1/12è de la Trésorerie
|
||||
if ($this->R[63]>0) $encoursTR=$this->R[63]/72;
|
||||
if ($this->R[63]>0) $encoursTR = $this->R[63]/72;
|
||||
|
||||
if ($noteSolvabilite>=40) {
|
||||
if ($this->HOLDING) {
|
||||
@ -2812,11 +2789,11 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
|
||||
}
|
||||
|
||||
// Plafond des encours en fonction de la note / 100
|
||||
if ($noteSolvabilite> 65) $plafond=500000;
|
||||
elseif ($noteSolvabilite> 60) $plafond=350000;
|
||||
elseif ($noteSolvabilite> 55) $plafond=250000;
|
||||
elseif ($noteSolvabilite>=50) $plafond=150000;
|
||||
elseif ($noteSolvabilite>=45) $plafond=30000;
|
||||
if ($noteSolvabilite > 65) $plafond=500000;
|
||||
elseif ($noteSolvabilite > 60) $plafond=350000;
|
||||
elseif ($noteSolvabilite > 55) $plafond=250000;
|
||||
elseif ($noteSolvabilite >= 50) $plafond=150000;
|
||||
elseif ($noteSolvabilite >= 45) $plafond=30000;
|
||||
else $plafond=15000;
|
||||
|
||||
if ($this->ENCOURS>$plafond) $this->ENCOURS=$plafond;
|
||||
@ -2958,8 +2935,7 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
|
||||
}
|
||||
if ($tendance=='') $tendance='Stable';
|
||||
|
||||
/** Avis à 3 ans
|
||||
**/
|
||||
/** Avis à 3 ans **/
|
||||
if ($noteSolvabilite>=50) {
|
||||
if ($valeurCCF>2160) $this->AVIS3ANS=true;
|
||||
elseif($valeurCCF>0 && $valeurCCF<2160) $this->AVIS3ANS=false;
|
||||
@ -3007,9 +2983,18 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
|
||||
|
||||
$timer['encours']=microtime(true);
|
||||
|
||||
//Si NIVEAU avec generation des commentaires
|
||||
// --- Si NIVEAU avec generation des commentaires
|
||||
if ($genereComment)
|
||||
{
|
||||
// --- Grand Groupe
|
||||
$tabTmp=$iDb->select('jo.surveillances_site', 'count(*) as nb',
|
||||
"login IN ('dgfipb', 'dgfipc', 'dgfipifu1', 'dgfipifu10', 'dgfipifu11', 'dgfipifu12', 'dgfipifu13', 'dgfipifu14', 'dgfipifu2', 'dgfipifu3', 'dgfipifu4', 'dgfipifu5', 'dgfipifu6', 'dgfipifu7', 'dgfipifu8', 'dgfipifu9') AND siren=$siren AND dateSuppr=0",
|
||||
$this->debug, MYSQL_ASSOC);
|
||||
$timer['GrandGroupe'] = microtime(true);
|
||||
$tabTmp=$tabTmp[0];
|
||||
if ($tabTmp['nb']>0) $this->GRANDGROUPE = true;
|
||||
else $this->GRANDGROUPE = false;
|
||||
|
||||
// NBNIC
|
||||
$tabTmp = $iDb->select('jo.etablissements', 'MAX(NIC) as NBNIC', "SIREN=$this->SIREN", $this->debug, MYSQL_ASSOC);
|
||||
$this->NBNIC = $tabTmp[0]['NBNIC'];
|
||||
@ -3699,9 +3684,9 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
|
||||
$actif=0;
|
||||
}
|
||||
|
||||
//Libellé Information de paiemet - Procédure collective
|
||||
// Libellé Information de paiemet - Procédure collective
|
||||
if ($libInfoPaiement<>'' && $tabIdentite['SituationJuridique']=='P') {
|
||||
$libInfoPaiement='En procédure collective';
|
||||
$libInfoPaiement = 'En procédure collective';
|
||||
}
|
||||
|
||||
//Retour
|
||||
@ -3812,8 +3797,8 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
|
||||
'tabVariables' => array('CA_Y'=>$this->Yaff),
|
||||
);
|
||||
|
||||
$indiScore = $tabRet['Indiscore']*1;
|
||||
$this->ENCOURS = round($tabRet['encours']);
|
||||
$indiScore = $tabRet['Indiscore']*1;
|
||||
$this->ENCOURS = round($tabRet['encours']);
|
||||
|
||||
/** Historisation du score **/
|
||||
$tabTmp = $iDb->select('jo.scores_surveillance s',
|
||||
@ -3965,5 +3950,28 @@ class SdMetier_Scoring_Base extends SdMetier_Scoring_Vars
|
||||
|
||||
return $tabRet;
|
||||
}
|
||||
|
||||
/**
|
||||
* Calcul des éléments SCORE - EVALUATION
|
||||
* Paramètres en ENTREE
|
||||
* - Identite
|
||||
* - Annonces Legales
|
||||
* - Bilans
|
||||
*
|
||||
* Paramètres en SORTIE
|
||||
* - Définir une structure de données
|
||||
*
|
||||
*
|
||||
*/
|
||||
public function calcul()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function comment(){}
|
||||
|
||||
|
||||
protected function save(){}
|
||||
|
||||
}
|
||||
?>
|
@ -1,111 +0,0 @@
|
||||
<?php
|
||||
|
||||
require_once 'Metier/partenaires/classMPrivileges.php';
|
||||
require_once 'Metier/partenaires/classMMarques.php';
|
||||
require_once 'Metier/partenaires/classMLiens2.php';
|
||||
require_once 'Metier/scores/classMRegression.php';
|
||||
require_once 'Metier/scores/classMSolvabilite.php';
|
||||
require_once 'Metier/scores/classMRatios.php';
|
||||
|
||||
/**
|
||||
* Injection SdMetier_Scoring_Vars
|
||||
*
|
||||
* $this->getVars(name)
|
||||
* $this->setVars(name)
|
||||
* $this->operation(name)
|
||||
*
|
||||
* Les variables doivents être déclarées public pour un accès direct $this->Vars->{var name}
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Injection SdMetier_Scoring_Formule_{version}
|
||||
* Auto-generated class avec
|
||||
* - appel à vars
|
||||
* - appel à operation
|
||||
*
|
||||
* function calc => effectue les opérations de calcul
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Injection SdMetier_Scoring_Comment_{version}
|
||||
* Doit récupérer le contexte de toutes les variables pour générer les commentaires
|
||||
* - Récupération des données d'initialisation
|
||||
* - Récupération du contexte de calcul
|
||||
* - Récupération de Vars
|
||||
* - Formattage
|
||||
*/
|
||||
|
||||
class SdMetier_Scoring_Calcul
|
||||
{
|
||||
|
||||
protected $Vars = null;
|
||||
protected $Formule = null;
|
||||
protected $Comment = null;
|
||||
|
||||
protected $version = '414';
|
||||
protected $niveau = '2';
|
||||
protected $debug = false;
|
||||
protected $db = null;
|
||||
|
||||
public function __construct($siren, $type = 'score', $sourceModif = 'jour')
|
||||
{
|
||||
// --- Commence par une initialisation des variables dans le dictionnaire
|
||||
$this->Vars = new SdMetier_Scoring_Vars();
|
||||
}
|
||||
|
||||
public function setDebug($debug = false)
|
||||
{
|
||||
$this->debug = $debug;
|
||||
}
|
||||
|
||||
public function setDb($db)
|
||||
{
|
||||
$this->db = $db;
|
||||
}
|
||||
|
||||
public function getVars()
|
||||
{
|
||||
return $this->Vars;
|
||||
}
|
||||
|
||||
public function setFormule(SdMetier_Scoring_Formule_Interface $formule)
|
||||
{
|
||||
$this->Formule = $formule;
|
||||
}
|
||||
|
||||
public function setComment(SdMetier_Scoring_Comment_Interface $comment)
|
||||
{
|
||||
$this->Comment = $comment;
|
||||
}
|
||||
|
||||
|
||||
public function exec($comment = false)
|
||||
{
|
||||
// --- Execution des calculs du score
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// --- Commentaires activés
|
||||
if ( $comment === true ) {
|
||||
|
||||
// --- Chargement si nécessaires des commentaires
|
||||
if ( $this->Comment === null ) {
|
||||
|
||||
}
|
||||
|
||||
// --- Chargement si nécessaire des formules
|
||||
if ( $this->Formule === null ) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -8,13 +8,13 @@ $dateStopIn = '2015-10-01';
|
||||
'341762573',
|
||||
);*/
|
||||
|
||||
$options = getopt("f:");
|
||||
$file = basename($options['f'], '.csv');
|
||||
|
||||
$companies = array();
|
||||
$row = 1;
|
||||
if (($handle = fopen("liste-01.csv", "r")) !== false) {
|
||||
if (($handle = fopen(__DIR__.'/'.$file.'.csv', "r")) !== false) {
|
||||
while (($data = fgetcsv($handle, 0, ",")) !== false) {
|
||||
if ($row == 1) {
|
||||
continue;
|
||||
}
|
||||
$row++;
|
||||
$companies[] = $data[0];
|
||||
}
|
||||
@ -49,7 +49,7 @@ require_once 'Metier/partenaires/classMBanques.php';
|
||||
require_once 'Metier/insee/classMInsee.php';
|
||||
|
||||
|
||||
$fp = fopen('retour-'.date('YmdHis').'.csv', 'w');
|
||||
$fp = fopen($file.'-'.date('YmdHis').'.csv', 'w');
|
||||
$delimiter = ',';
|
||||
$fileHeader = array(
|
||||
'siren',
|
||||
@ -66,6 +66,7 @@ $fileHeader = array(
|
||||
);
|
||||
fputcsv($fp, $fileHeader, $delimiter, '"');
|
||||
|
||||
$cpt = 1;
|
||||
foreach ($companies as $item)
|
||||
{
|
||||
// --- Date de création de l'entreprise
|
||||
@ -83,7 +84,7 @@ foreach ($companies as $item)
|
||||
}
|
||||
|
||||
// DateImma
|
||||
if ($dateCreaEn === null) {
|
||||
if ($dateCreaEnSet === null) {
|
||||
$sql = $db->select()->from('rncs_entrep', array('dateImma'), 'jo')
|
||||
->where('siren=?', $item)->limit(1);
|
||||
$result = $db->fetchRow($sql, null, Zend_Db::FETCH_OBJ);
|
||||
@ -146,6 +147,7 @@ foreach ($companies as $item)
|
||||
// date +1
|
||||
$dateCalcul->addMonth(1);
|
||||
}
|
||||
$cpt++;
|
||||
}
|
||||
|
||||
fclose($fp);
|
@ -2,14 +2,14 @@
|
||||
<?php
|
||||
// --- Define path to application directory
|
||||
defined('APPLICATION_PATH')
|
||||
|| define('APPLICATION_PATH', realpath(__DIR__ . '/../../application'));
|
||||
|| define('APPLICATION_PATH', realpath(__DIR__ . '/../application'));
|
||||
|
||||
// --- Define application environment
|
||||
defined('APPLICATION_ENV')
|
||||
|| define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production'));
|
||||
|
||||
// --- Composer autoload
|
||||
require_once realpath(__DIR__ . '/../../vendor/autoload.php');
|
||||
require_once realpath(__DIR__ . '/../vendor/autoload.php');
|
||||
|
||||
// --- Create application, bootstrap, and run
|
||||
$application = new Zend_Application(APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini');
|
||||
|
Loading…
Reference in New Issue
Block a user