siren=$siren; } function __destruct() {} /** Adapter cette classe pour qu'elle utilise la classe MEuridile et la base Bilans Local **/ /** Liste des dirigeants actifs **/ function listeDirigeants() { $iDb2=new WDB('jo'); $ret=$iDb2->select( 'bilans', 'typeBilan, dateProvPartenaire, dateExercice, dateExercicePre, dureeExercice, dureeExercicePre, monnaieOrigine', "siren='$this->siren' ORDER BY dateExercice DESC"); $tabRet=array(); $iDb=new WDB('jo'); $ret2=$iDb->select( 'bodacc_detail', 'Bodacc_Date_Parution, dateEffet, typeEven', //Num_Annonce, RC, raisonSociale, FJ, adrSiegeNum, adrSiegeIndRep, adrSiegeTypVoie, adrSiegeLibVoie, adrSiegeComp1, adrSiegeComp2, codePostalSiege, villeSiege, Bodacc_Num "siren='$this->siren' AND Rubrique='comptes' ORDER BY dateEffet DESC"); $dateDerDepot=WDate::dateT('Y-m-d','Ymd',@$ret2[0]['dateEffet'])*1; $dateDerExercice=$ret[0]['dateExercice']*1; if ($dateDerDepot<>0) { $this->dernierExerciceDepose = WDate::dateT('Y-m-d','d/m/Y',@$ret2[0]['dateEffet']); $this->dernierExerciceDeposeLe = WDate::dateT('Y-m-d','d/m/Y',@$ret2[0]['Bodacc_Date_Parution']); } /* //echo date('Y/m/d - H:i:s') ." - Dernier depot le ". $ret2[0]['Bodacc_Date_Parution'] .", dernier en base = $dateDerExercice !
\n"; if ( $dateDerDepot>$dateDerExercice || ( $dateDerDepot==0 && $dateDerExercicelistBilans($this->siren); //} foreach ($ret as $i=>$bil) { $millesime=WDate::dateT('Ymd','d/m/Y',$bil['dateExercice']); $tabRet[$bil['typeBilan'].$millesime]=array( 'dateProvPartenaire'=>$bil['dateProvPartenaire'], 'dureeExercice' =>$bil['dureeExercice'], 'dateExercicePre' =>$bil['dateExercicePre'], 'dureeExercicePre' =>$bil['dureeExercicePre'], 'monnaie' =>$bil['monnaieOrigine'], 'source' =>1, ); } return $tabRet; } function getBilan($millesime='', $typeBilan='N', $refPart=0) { $millesime=WDate::dateT('d/m/Y','Ymd',$millesime); $iDb2=new WDB('insee'); $ret=$iDb2->select('bilans', 'dateProvPartenaire, dateExercice, dateExercicePre, dureeExercice, dureeExercicePre, monnaie, typeBilan, monnaieOrigine, unite, postes', "siren='$this->siren' AND typeBilan='$typeBilan' AND dateExercice='$millesime'", true); $bilan=$ret[0]; if (count($ret)==0) { $rncs=new MEuridile($this->siren); $tabBilan=$rncs->getBilan($refPart); if ($tabBilan) { $strPostes=''; foreach ($tabBilan['POSTES'] as $poste=>$valeur) $strPostes.="$poste=$valeur;"; $tabInsert=array( 'siren' =>$this->siren, 'dateProvPartenaire'=>$tabBilan['DATE_FRAICHE_BILAN'], 'dateExercice' =>WDate::dateT('d/m/Y','Ymd',$tabBilan['DATE_CLOTURE']), 'dateExercicePre' =>WDate::dateT('d/m/Y','Ymd',$tabBilan['DATE_CLOTURE_PRE']), 'dureeExercice' =>$tabBilan['DUREE_MOIS'], 'dureeExercicePre' =>$tabBilan['DUREE_MOIS_PRE'], 'monnaie' =>$tabBilan['MONNAIE'], 'typeBilan' =>$tabBilan['TYPE_BILAN'], 'monnaieOrigine' =>$tabBilan['MONNAIE_ORI'], 'unite' =>$tabBilan['MONNAIE_LIV_UNITE'], 'postes' =>$strPostes, 'partenaire' =>2, ); $iDb2->insert('bilans', $tabInsert); $ret=$iDb2->select('bilans', 'dateProvPartenaire, dateExercice, dateExercicePre, dureeExercice, dureeExercicePre, monnaie, typeBilan, monnaieOrigine, unite, postes', "siren='$this->siren' AND typeBilan='$typeBilan' AND dateExercice='$millesime'"); $bilan=$ret[0]; } } $tabBilan=array(); $tabBilan['SIREN'] = $this->siren; $tabBilan['DATE_FRAICHE_BILAN'] = $bilan['dateProvPartenaire']; // SSAAMMJJ $tabBilan['DATE_CLOTURE'] = $bilan['dateExercice']; // SSAAMMJJ $tabBilan['DATE_CLOTURE_PRE'] = $bilan['dateExercicePre']; // SSAAMMJJ $tabBilan['DUREE_MOIS'] = $bilan['dureeExercice']; $tabBilan['DUREE_MOIS_PRE'] = $bilan['dureeExercicePre']; $tabBilan['MONNAIE'] = $bilan['monnaie']; $tabBilan['CONSOLIDE'] = $bilan['typeBilan']; // C = Bilan consolidé $tabBilan['MONNAIE_ORI'] = $bilan['monnaieOrigine']; $tabBilan['MONNAIE_LIV_UNITE'] = $bilan['unite']; if ($bilan['monnaie']=='EUR') $monnaie='€'; else $monnaie=$bilan['monnaie']; switch (strtoupper($bilan['unite'])) { case 'K': $unite='K'; break; case 'U': case ' ': case '' : $unite=''; break; case 'M': $unite='M'; break; default: die('Unite Bilan ('. $bilan['unite'] .') non prise en charge !'); break; } $tabBilan['devise'] = /*$unite.*/$monnaie; $tabTmp=explode(';', $bilan['postes']); foreach ($tabTmp as $i=>$strTmp) { $tabTmp2=explode('=', $strTmp); if (isset($tabTmp2[1])) if ($unite=='K' && $tabTmp2[0]<>'YP' && $tabTmp2[0]<>'YP1') $tabBilan[$tabTmp2[0]]=$tabTmp2[1]*1000; elseif ($unite=='M' && $tabTmp2[0]<>'YP' && $tabTmp2[0]<>'YP1') $tabBilan[$tabTmp2[0]]=$tabTmp2[1]*1000000; else $tabBilan[$tabTmp2[0]]=$tabTmp2[1]; } return $tabBilan; } } ?>