Suppression evitement des procols

This commit is contained in:
Michael RICOIS 2013-10-18 15:44:12 +00:00
parent fe1d8190aa
commit 420ef2ca76

View File

@ -76,13 +76,13 @@ $tabQueries = array(
/* Dirigeants */ /* Dirigeants */
'dirigeants' => "SELECT $strSelect, 'dirigeants' AS source FROM jo.scores_surveillance_tmp s, jo.rncs_dirigeants d WHERE d.siren>1000 AND s.siren = d.siren AND (d.dateInsert>s.dateUpdate OR d.dateUpdate>s.dateUpdate) AND (d.dateInsert>'2013-03-15 00:00:00' OR d.dateUpdate>'2013-03-15 00:00:00') AND s.procol NOT IN('P') GROUP BY siren", 'dirigeants' => "SELECT $strSelect, 'dirigeants' AS source FROM jo.scores_surveillance_tmp s, jo.rncs_dirigeants d WHERE d.siren>1000 AND s.siren = d.siren AND (d.dateInsert>s.dateUpdate OR d.dateUpdate>s.dateUpdate) AND (d.dateInsert>'2013-03-15 00:00:00' OR d.dateUpdate>'2013-03-15 00:00:00') AND s.procol NOT IN('P') GROUP BY siren",
/* Evenements INSEE */ /* Evenements INSEE */
'insee' => "SELECT $strSelect, 'insee' as source FROM jo.scores_surveillance_tmp s, insee.insee_even i WHERE i.insSIREN>1000 AND s.siren=i.insSIREN AND i.dateInsert>s.dateUpdate AND s.procol NOT IN('P') AND /*i.insEVE IN ('400','410','420','425') AND*/ i.insSIEGE=1 GROUP BY siren", 'insee' => "SELECT $strSelect, 'insee' as source FROM jo.scores_surveillance_tmp s, insee.insee_even i WHERE i.insSIREN>1000 AND s.siren=i.insSIREN AND i.dateInsert>s.dateUpdate /*AND s.procol NOT IN('P') AND i.insEVE IN ('400','410','420','425')*/ AND i.insSIEGE=1 GROUP BY siren",
/* Entreprises RNCS */ /* Entreprises RNCS */
//'rncs' => "SELECT $strSelect, 'rncs' as source FROM scores_surveillance_tmp s, rncs_entrep r WHERE s.siren>1000 AND s.siren=r.siren AND (r.dateInsert>s.dateUpdate OR r.dateUpdate>s.dateUpdate) /*AND (d.dateInsert>'2013-03-15 00:00:00' OR d.dateUpdate>'2013-03-15 00:00:00')*/ AND s.procol NOT IN('P') GROUP BY siren", //'rncs' => "SELECT $strSelect, 'rncs' as source FROM scores_surveillance_tmp s, rncs_entrep r WHERE s.siren>1000 AND s.siren=r.siren AND (r.dateInsert>s.dateUpdate OR r.dateUpdate>s.dateUpdate) /*AND (d.dateInsert>'2013-03-15 00:00:00' OR d.dateUpdate>'2013-03-15 00:00:00')*/ AND s.procol NOT IN('P') GROUP BY siren",
/* Bodacc */ /* Bodacc */
'bodacc' => "SELECT $strSelect, 'bodacc' as source FROM jo.scores_surveillance_tmp s, jo.bodacc_detail b WHERE b.siren>1000 AND s.siren=b.siren AND( b.dateInsert>s.dateUpdate OR b.dateUpdate>s.dateUpdate) AND s.procol NOT IN('P') AND b.Rubrique NOT IN('creations','comptes') GROUP BY siren", 'bodacc' => "SELECT $strSelect, 'bodacc' as source FROM jo.scores_surveillance_tmp s, jo.bodacc_detail b WHERE b.siren>1000 AND s.siren=b.siren AND( b.dateInsert>s.dateUpdate OR b.dateUpdate>s.dateUpdate) /*AND s.procol NOT IN('P')*/ AND b.Rubrique NOT IN('creations','comptes') GROUP BY siren",
/* Collecte */ /* Collecte */
'collecte' => "SELECT $strSelect, 'collecte' as source FROM jo.scores_surveillance_tmp s, jo.annonces b WHERE b.siren>1000 AND s.siren=b.siren AND b.dateInsert>s.dateUpdate AND s.procol NOT IN('P') /*AND b.typeEven NOT IN(3200)*/ GROUP BY siren", 'collecte' => "SELECT $strSelect, 'collecte' as source FROM jo.scores_surveillance_tmp s, jo.annonces b WHERE b.siren>1000 AND s.siren=b.siren AND b.dateInsert>s.dateUpdate /*AND s.procol NOT IN('P') AND b.typeEven NOT IN(3200)*/ GROUP BY siren",
/* Bilans en base */ /* Bilans en base */
'bilans1' => "SELECT $strSelect, 'bilans1' as source FROM jo.scores_surveillance_tmp s, jo.bilans b WHERE b.siren>1000 AND s.siren=b.siren AND b.dateInsert>s.dateUpdate AND (DATEDIFF(b.dateExercice,s.dateBilan)>1 OR DATEDIFF(b.dateExercice,s.dateBilan) IS NULL) AND s.procol NOT IN('P') GROUP BY siren", 'bilans1' => "SELECT $strSelect, 'bilans1' as source FROM jo.scores_surveillance_tmp s, jo.bilans b WHERE b.siren>1000 AND s.siren=b.siren AND b.dateInsert>s.dateUpdate AND (DATEDIFF(b.dateExercice,s.dateBilan)>1 OR DATEDIFF(b.dateExercice,s.dateBilan) IS NULL) AND s.procol NOT IN('P') GROUP BY siren",
/* Défaut divers Facto (D:Défaut, 24:Groupe en diff, 31:Cessation Annoncée, 50:Terrorisme)*/ /* Défaut divers Facto (D:Défaut, 24:Groupe en diff, 31:Cessation Annoncée, 50:Terrorisme)*/
@ -225,11 +225,11 @@ foreach ($tabQueries as $declencheur=>$query)
$sourceModif = $entrep['source']; $sourceModif = $entrep['source'];
$procol = $entrep['procol']; $procol = $entrep['procol'];
$nbModifs = ($entrep['nbModifs']*1)+1; $nbModifs = ($entrep['nbModifs']*1)+1;
if ($procol=='P') { /*if ($procol=='P') {
$nbScoresProcol++; $nbScoresProcol++;
if ($opts->verbose) echo date('Y/m/d - H:i:s') ." - Ligne $iRow/$nbRowsTot - Siren $siren : $indiScorePre / 100 ($encoursPre EUR) inchangé depuis $dateScore (Source=$sourceModif) car ProCol.".PHP_EOL; if ($opts->verbose) echo date('Y/m/d - H:i:s') ." - Ligne $iRow/$nbRowsTot - Siren $siren : $indiScorePre / 100 ($encoursPre EUR) inchangé depuis $dateScore (Source=$sourceModif) car ProCol.".PHP_EOL;
continue; continue;
} }*/
//echo date('Y/m/d - H:i:s') ." - Siren $siren : AVANT SCORE".PHP_EOL; //echo date('Y/m/d - H:i:s') ." - Siren $siren : AVANT SCORE".PHP_EOL;
$tabScore = calculIndiScore($siren, $nic, false, 0, false, 'scores', $declencheur); $tabScore = calculIndiScore($siren, $nic, false, 0, false, 'scores', $declencheur);
//echo date('Y/m/d - H:i:s') ." - Siren $siren : APRES SCORE".PHP_EOL; //echo date('Y/m/d - H:i:s') ." - Siren $siren : APRES SCORE".PHP_EOL;