Formattage resultat bdd

This commit is contained in:
Michael RICOIS 2015-08-04 14:36:29 +00:00
parent 327a1d386b
commit 5b0bb9a1c3

View File

@ -1461,9 +1461,9 @@ class MInsee
if ( substr($even['insSIRETASS'],0,9) == $siren ) {
switch ($even['insPRODPART']*1) {
case 2: $typeSiretAss='Loueur de fond'; break;
case 1: $typeSiretAss='Locataire du fond'; break;
case 3: $typeSiretAss='Client en delegation de personnel'; break;
case 1: $typeSiretAss='Loueur de fond'; break;
case 2: $typeSiretAss='Locataire du fond'; break;
case 3: $typeSiretAss='Prestataire de personnel'; break;
}
$dateEve=$even['insDATEVE'];
@ -1765,7 +1765,7 @@ class MInsee
$limit="LIMIT $deb, $nbRep";
$sqlInfo="e.id, e.source, e.source_id, e.triCode, e.autre_id, LPAD(e.siren, 9, 0) AS siren, LPAD(e.nic, 5, 0) AS nic, e.siege, ".
$sqlInfo="'Etab' as Loc, e.id, e.source, e.source_id, e.triCode, e.autre_id, LPAD(e.siren, 9, 0) AS siren, LPAD(e.nic, 5, 0) AS nic, e.siege, ".
"e.raisonSociale, e.enseigne, e.sigle, LPAD(e.adr_num,4,0) AS adr_num, e.adr_btq, e.adr_typeVoie, e.adr_libVoie, ".
"e.adr_comp, LPAD(e.adr_cp,5,0) AS adr_cp, e.adr_ville, e.adr_dep, LPAD(e.adr_com,3,0) AS adr_com, LPAD(e.tel,10,0) AS tel, LPAD(e.fax,10,0) AS fax, e.cj, e.ape_etab, e.ape_entrep, e.teff_etab, ".
"CONCAT(siren, nic) AS siret, e.actif, e.identite_pre, IF(e.siege=2,0.5,e.siege) AS triSiege";
@ -1859,6 +1859,7 @@ class MInsee
}
$tabRet[] = array(
'Localisation' => $etab['Loc'],
'id' => $etab['id'],
'Pertinence' => 100,
'Source' => $etab['source'],
@ -2635,7 +2636,7 @@ class MInsee
$tabInsee['ORIGINE']*1==1 ||
$tabInsee['ORIGINE']*1==9 ||
$tabInsee['ORIGINE']=='NR')
$tabInsee['ORIGINE']=2; // Transfert
$tabInsee['ORIGINE']=2; // Transfert
}
}
}
@ -3060,7 +3061,7 @@ class MInsee
if ($tabInsee['CIVILITE']==1) { $tabRet['dir1NomPrenom']='M. '; $tabRet['dir1Genre']='M'; }
elseif ($tabInsee['CIVILITE']==2) { $tabRet['dir1NomPrenom']='Mme '; $tabRet['dir1Genre']='F'; }
elseif ($tabRet['dir1Genre']<>'M' && $tabRet['dir1Genre']<>'F') $tabRet['dir1Genre']='';
$tabRet['dir1NomPrenom'].=$tabInsee['NOM'];
$tabRet['dir1NomPrenom'].=$tabInsee['NOM'];
}
if (intval($siren) > 0) {
@ -3277,7 +3278,6 @@ class MInsee
}
}
else {
/* Disable ?
$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.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 AND d.depart<>1 AND f.triCode IN ('ASS','COG','DID','DIR','GER','PCS','PDG','PRD','PRE','PRT','VIC') GROUP BY d.fonction, d.rs, d.nom, d.prenom ORDER BY d.dateEffet DESC", false, MYSQL_ASSOC);
@ -3296,7 +3296,6 @@ class MInsee
$k++;
}
}
*/
}
$timer['dirigeants']=microtime(true);
@ -3896,7 +3895,7 @@ class MInsee
{
$dirs=$this->iDb->select(
'jo.rncs_dirigeants',
'siren, raisonSociale, dirSiren, dirRS, civilite, nom, prenom, naissance_nom, naissance_date, naissance_lieu, fonction_code, fonction_lib, cinf, dateFin, flux, dateInsert',
'siren, raisonSociale, LPAD(dirSiren,9,0) AS dirSiren, dirRS, civilite, nom, prenom, naissance_nom, naissance_date, naissance_lieu, fonction_code, fonction_lib, cinf, dateFin, flux, dateInsert',
"siren=$siren AND actif%10=1", false, MYSQL_ASSOC);
foreach ($dirs as $k=>$dir) {
@ -3941,7 +3940,7 @@ class MInsee
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',
'd.num, d.dateEffet, d.Rubrique, d.fonction, LPAD(d.dirSiren,9,0) AS 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 AND d.fonction BETWEEN 300 AND 304 GROUP BY d.fonction, d.rs, d.nom, d.prenom ORDER BY d.dateEffet DESC, d.fonction DESC", false, MYSQL_ASSOC);
if (count($bodacc)>0) {
foreach ($bodacc as $k=>$ann) {
@ -3980,7 +3979,7 @@ class MInsee
if (count($tabRet)==0) {
$dirs=$this->iDb->select(
'jo.rncs_dirigeants',
'siren, raisonSociale, dirSiren, dirRS, civilite, nom, prenom, naissance_nom, naissance_date, naissance_lieu, fonction_code, fonction_lib, cinf, dateFin, flux, dateInsert, date(dateUpdate)*1 as dateUpdate',
'siren, raisonSociale, LPAD(dirSiren,9,0) AS dirSiren, dirRS, civilite, nom, prenom, naissance_nom, naissance_date, naissance_lieu, fonction_code, fonction_lib, cinf, dateFin, flux, dateInsert, date(dateUpdate)*1 as dateUpdate',
"siren=$siren AND actif%10=0 ORDER BY dateUpdate DESC", false, MYSQL_ASSOC);
$dateUpdatePre=$dirs[0]['dateUpdate'];
@ -3997,7 +3996,7 @@ class MInsee
$tabRet[] = array(
'Fonction' => $dir['fonction_code'],
'Titre' => $dir['fonction_lib'],
'Siren' => $dir['Siren'],
'Siren' => $dir['dirSiren'],
'Societe' => $dir['dirRS'],
'Civilite' => $dir['civilite'],
'Nom' => trim($dir['nom']),
@ -5981,19 +5980,20 @@ class MInsee
{
/** Elements provenant du Notice 80 hors identité **/
$tabTmp=$this->iDb->select('insee.insee_notices',
'insSIREN, insNIC, insL4_VOIE, insL6_POST, LPAD(insRPET,2,0) AS insRPET, insDEPCOMEN,
"LPAD(insSIREN,9,0) AS insSIREN, LPAD(insNIC,5,0) AS insNIC, insL4_VOIE, insL6_POST, LPAD(insRPET,2,0) AS insRPET, insDEPCOMEN,
LPAD(insRPEN,2,0) AS insRPEN, insARRONET, insCTONET, insTCD, LPAD(insZEMET,2,0) AS insZEMET, insDU,
insTU, insUU, insMMINTRET, insMMINTREN, insVMAJ, insVMAJ1, insVMAJ2, insVMAJ3, insRECME, insEAEANT,
insEAEAPET, insEAESEC1T, insEAESEC2T, insEAEANN, insEAEAPEN, insEAESEC1N, insEAESEC2N, insEAESEC3N,
insEAESEC4N, dateNotice',
insTU, LPAD(insUU,2,0) AS insUU, LPAD(insMMINTRET,2,0) AS insMMINTRET, LPAD(insMMINTREN,2,0) AS insMMINTREN, insVMAJ, insVMAJ1,
insVMAJ2, insVMAJ3, insRECME, insEAEANT, insEAEAPET, insEAESEC1T, insEAESEC2T, insEAEANN, insEAEAPEN, insEAESEC1N,
insEAESEC2N, insEAESEC3N, insEAESEC4N, dateNotice",
"insSIREN=$siren AND insNIC=$nic ORDER BY dateNotice DESC LIMIT 0,1", false, MYSQL_ASSOC);
if (count($tabTmp)==0)
$tabTmp=$this->iDb->select('insee.insee_even',
"insSIREN, insNIC, insL4_VOIE, insL6_POST, insRPET, insDEPCOMEN, insRPEN, insARRONET, insCTONET, insTCD,
insZEMET, insDU, insTU, insUU, insAMINTRET, insAMINTREN, insVMAJ, insVMAJ1, insVMAJ2, insVMAJ3,
'' AS insRECME, '' AS insEAEANT, '' AS insEAEAPET, '' AS insEAESEC1T, '' AS insEAESEC2T,
insESAANN AS insEAEANN, insESAPEN AS insEAEAPEN, insESASEC1N AS insEAESEC1N, insESASEC2N AS insEAESEC2N,
"LPAD(insSIREN,9,0) AS insSIREN, LPAD(insNIC,5,0) AS insNIC, insL4_VOIE, insL6_POST, LPAD(insRPET,2,0) AS insRPET, insDEPCOMEN,
LPAD(insRPEN,2,0) AS insRPEN, insARRONET, insCTONET, insTCD, LPAD(insZEMET,2,0) AS insZEMET, insDU,
insTU, LPAD(insUU,2,0) AS insUU, insAMINTRET, insAMINTREN, insVMAJ, insVMAJ1, insVMAJ2, insVMAJ3, '' AS insRECME,
'' AS insEAEANT, '' AS insEAEAPET, '' AS insEAESEC1T, '' AS insEAESEC2T, insESAANN AS insEAEANN,
insESAPEN AS insEAEAPEN, insESASEC1N AS insEAESEC1N, insESASEC2N AS insEAESEC2N,
insESASEC3N AS insEAESEC3N, insESASEC4N AS insEAESEC4N, dateInsert AS dateNotice",
"insSIREN=$siren AND insNIC=$nic ORDER BY dateInsert DESC LIMIT 0,1", false, MYSQL_ASSOC);