Mise à jour classe Metier
This commit is contained in:
parent
26d69d03dd
commit
d481c4f5d4
@ -124,7 +124,11 @@ class Metier_Infogreffe
|
||||
public function __construct()
|
||||
{
|
||||
//Load configuration
|
||||
$c = Zend_Registry::get('config');
|
||||
if ( Zend_Registry::isRegistered('config') ){
|
||||
$c = Zend_Registry::get('config');
|
||||
} else {
|
||||
$c = new Zend_Config_Ini(APPLICATION_PATH . '/configs/application.ini', 'production');
|
||||
}
|
||||
$this->config = $c->profil->infogreffe;
|
||||
if ( null === $this->config ) {
|
||||
throw new Exception('Unable to load configuration file.');
|
||||
|
@ -7,6 +7,8 @@ require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'Infogreffe.php';
|
||||
class Metier_Infogreffe_Ac extends Metier_Infogreffe
|
||||
{
|
||||
|
||||
const INT = 1000;
|
||||
|
||||
/**
|
||||
* Db Adapter
|
||||
* @var Zend_Db_Adapter_Abstract
|
||||
@ -49,17 +51,24 @@ class Metier_Infogreffe_Ac extends Metier_Infogreffe
|
||||
//Requete WebService
|
||||
$actesXML = null;
|
||||
if ( $onlyDb === false ) {
|
||||
$actesM->update(array('actif' => 0), 'siren='.$this->siren);
|
||||
//Infogreffe webservice
|
||||
try {
|
||||
$xml = $this->callRequest();
|
||||
$requestOk = true;
|
||||
} catch( Exception $e ) {
|
||||
$requestOk = false;
|
||||
//file_put_contents('debug.log', $e->getMessage());
|
||||
//@todo : get error message
|
||||
//echo $e->getMessage();
|
||||
return array();
|
||||
}
|
||||
$actesXML = $this->formatList($xml);
|
||||
if ( $requestOk === true ) {
|
||||
try {
|
||||
$actesM->update(array('actif' => 0), 'siren='.$this->siren);
|
||||
} catch(Zend_Db_Exception $e) {
|
||||
|
||||
}
|
||||
$actesXML = $this->formatList($xml);
|
||||
}
|
||||
}
|
||||
|
||||
//Lecture de la base de données
|
||||
@ -104,6 +113,8 @@ class Metier_Infogreffe_Ac extends Metier_Infogreffe
|
||||
$item->ActeNumberOfPages = $row->nbpages_acte;
|
||||
$item->ActeType = $row->type_acte;
|
||||
$item->ActeTypeLabel = $row->type_acte_libelle;
|
||||
$item->ActeDecisionNature = $row->decision_nature;
|
||||
$item->ActeDecisionLabel = $row->decision_libelle;
|
||||
|
||||
$decisions = $row->decision_nature;
|
||||
if (!empty($row->decision_nature) && !empty($row->decision_libelle)) {
|
||||
@ -200,7 +211,7 @@ class Metier_Infogreffe_Ac extends Metier_Infogreffe
|
||||
|
||||
//Check if filename exist
|
||||
if ( !file_exists($this->config->storage->path . '/' . $filename) ) {
|
||||
throw new Exception('File not found');
|
||||
throw new Exception('File not found', self::INT);
|
||||
}
|
||||
|
||||
} elseif ( file_exists($this->config->storage->path . '/' . $filename) ) {
|
||||
|
@ -7,6 +7,8 @@ require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'Infogreffe.php';
|
||||
class Metier_Infogreffe_Bi extends Metier_Infogreffe
|
||||
{
|
||||
|
||||
const INT = 1000;
|
||||
|
||||
/**
|
||||
* Db Adapter
|
||||
* @var Zend_Db_Adapter_Abstract
|
||||
@ -56,18 +58,23 @@ class Metier_Infogreffe_Bi extends Metier_Infogreffe
|
||||
//Requete WebService
|
||||
$bilansXML = null;
|
||||
if ( $onlyDb === false ) {
|
||||
//Set All line state to 0
|
||||
try {
|
||||
$bilansM->update(array('actif' => 0), 'siren='.$this->siren);
|
||||
} catch(Zend_Db_Exception $e) {}
|
||||
//Infogreffe webservice
|
||||
try {
|
||||
$xml = $this->callRequest();
|
||||
$requestOk = true;
|
||||
} catch( Exception $e ) {
|
||||
$requestOk = false;
|
||||
//@todo : get error message
|
||||
return array();
|
||||
}
|
||||
$bilansXML = $this->formatList($xml);
|
||||
if ( $requestOk === true ) {
|
||||
//Set All line state to 0
|
||||
try {
|
||||
$bilansM->update(array('actif' => 0), 'siren='.$this->siren);
|
||||
} catch(Zend_Db_Exception $e) {
|
||||
|
||||
}
|
||||
$bilansXML = $this->formatList($xml);
|
||||
}
|
||||
}
|
||||
|
||||
//Lecture de la base de données
|
||||
@ -122,6 +129,11 @@ class Metier_Infogreffe_Bi extends Metier_Infogreffe
|
||||
$item->ModeDiffusion = '';
|
||||
}
|
||||
$item->DureeExercice = $row->duree_exercice;
|
||||
|
||||
/**
|
||||
* Following data are not as expected as the type and other data could change
|
||||
* Only num depot don't change.
|
||||
*/
|
||||
$item->SaisieDate = $row->saisie_date;
|
||||
$item->SaisieCode = $row->saisie_code;
|
||||
switch ( $row->saisie_code ) {
|
||||
@ -215,7 +227,7 @@ class Metier_Infogreffe_Bi extends Metier_Infogreffe
|
||||
|
||||
//Check if filename exist
|
||||
if ( !file_exists($this->config->storage->path . '/' . $filename) ) {
|
||||
throw new Exception('File not found');
|
||||
throw new Exception('File not found', self::INT);
|
||||
}
|
||||
|
||||
} elseif ( file_exists($this->config->storage->path . '/' . $filename) ) {
|
||||
|
@ -1 +1,167 @@
|
||||
<?php
|
||||
require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'Infogreffe.php';
|
||||
|
||||
/**
|
||||
* Infogreffe : Document Bilan
|
||||
*/
|
||||
class Metier_Infogreffe_St extends Metier_Infogreffe
|
||||
{
|
||||
|
||||
/**
|
||||
* Db Adapter
|
||||
* @var Zend_Db_Adapter_Abstract
|
||||
*/
|
||||
public $db;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param string $siren
|
||||
*/
|
||||
public function __construct($siren, $db = null)
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
//Set type
|
||||
$this->type_document = 'ST';
|
||||
|
||||
//Set Siren
|
||||
$this->siren = $siren;
|
||||
|
||||
//Get defaut database adapter
|
||||
if ($db === null) {
|
||||
$this->db = Zend_Db_Table_Abstract::getDefaultAdapter();
|
||||
} else {
|
||||
$this->db = $db;
|
||||
}
|
||||
}
|
||||
|
||||
public function getList()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function getCommandeT()
|
||||
{
|
||||
|
||||
$this->mode_diffusion = 'T';
|
||||
$this->reference_client = 'T'.date('YmdHis');
|
||||
|
||||
//Set the filename
|
||||
$filename = $this->getFilePath($type, $dateCloture) . '/' . $this->getFileName($type, $dateCloture);
|
||||
|
||||
try {
|
||||
$xml = $this->callRequest();
|
||||
} catch(Exception $e) {
|
||||
throw new Exception($e->getMessage(), $e->getCode());
|
||||
}
|
||||
|
||||
$item = $this->formatItem($xml);
|
||||
$url = $item['url_acces'];
|
||||
if ( empty($url) ) {
|
||||
throw new Exception('File url not given');
|
||||
}
|
||||
|
||||
if ( $orderId !== null ) {
|
||||
$commandeM = new Application_Model_Sdv1GreffeCommandesBi();
|
||||
$commandeM->update(array(
|
||||
'cmdUrl'=> $url,
|
||||
'dateCommande' => date('YmdHis'),
|
||||
), 'id='.$orderId);
|
||||
}
|
||||
|
||||
//Récupérer le fichier
|
||||
$getfile = $this->download($url, $filename);
|
||||
|
||||
//Analyser le fichier - Nombre de page et taille
|
||||
$infos = $this->pdfInfos($getfile);
|
||||
|
||||
//Enregistrer les infos du fichier dans la base de données
|
||||
if (false !== $infos) {
|
||||
$this->dbSetFile(basename($filename), $infos['size'], $infos['pages'], $infos['version']);
|
||||
} else {
|
||||
$this->dbSetFile(basename($filename));
|
||||
}
|
||||
|
||||
|
||||
return $filename;
|
||||
}
|
||||
|
||||
/**
|
||||
* Name of file
|
||||
* @param string $type
|
||||
* @param string $dateCloture
|
||||
* Format : AAAA-MM-JJ
|
||||
* @return string
|
||||
*/
|
||||
public function getFileName($type, $dateCloture)
|
||||
{
|
||||
if ($type=='') {
|
||||
$type = 'sociaux';
|
||||
}
|
||||
$date = substr($dateCloture,0,4).substr($dateCloture,5,2).substr($dateCloture,8,2);
|
||||
|
||||
return 'ST-' . $this->siren . '-' . $type . '-' . $date . '.pdf';
|
||||
}
|
||||
|
||||
/**
|
||||
* Path of file
|
||||
* @param string $type
|
||||
* @param string $dateCloture
|
||||
* Format : AAAA-MM-JJ
|
||||
* @return string
|
||||
*/
|
||||
public function getFilePath($type, $dateCloture)
|
||||
{
|
||||
if ($type=='') {
|
||||
$type = 'sociaux';
|
||||
}
|
||||
$dir = 'bilans' . '/' . $type . '/' . substr($dateCloture,0,4);
|
||||
if ( !file_exists( $this->config->storage->path . '/' . $dir ) ) {
|
||||
mkdir($this->config->storage->path . '/' . $dir, 0777, true);
|
||||
}
|
||||
return $dir;
|
||||
}
|
||||
|
||||
/**
|
||||
* Format XML to Array for a list of items
|
||||
* @param string $xml
|
||||
* @return array
|
||||
*/
|
||||
protected function formatList($xml)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Format XML to Array for one item
|
||||
* @param string $xml
|
||||
* @return array
|
||||
*/
|
||||
protected function formatItem($xml)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Update informations about an item in database
|
||||
* @param array $list
|
||||
* @return boolean
|
||||
*/
|
||||
protected function dbUpdateItem($list)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Set file informations in database
|
||||
* @param string $filename
|
||||
* @param int $size
|
||||
* @param int $numberOfPage
|
||||
* @param string $version
|
||||
* @return boolean
|
||||
*/
|
||||
public function dbSetFile($filename, $size = 0, $numberOfPage = '', $version = '')
|
||||
{
|
||||
|
||||
}
|
||||
}
|
@ -56,6 +56,13 @@ return array(
|
||||
'Version' => 18,
|
||||
'LienEtab' => 0,
|
||||
),
|
||||
'1115' => array(
|
||||
'libEven' => "Plan de Sauvegarde Financière Accélérée",
|
||||
'Bodacc_Code' => "BODA",
|
||||
'Rubrique' => "procol",
|
||||
'Version' => 18,
|
||||
'LienEtab' => 0,
|
||||
),
|
||||
'1119' => array(
|
||||
'libEven' => "Clôture de sauvegarde financière accélérée",
|
||||
'Bodacc_Code' => "BODA",
|
||||
@ -833,6 +840,13 @@ return array(
|
||||
'Version' => 17,
|
||||
'LienEtab' => 0,
|
||||
),
|
||||
'1640' => array(
|
||||
'libEven' => "Rétablissement Professionnel",
|
||||
'Bodacc_Code' => "BODA",
|
||||
'Rubrique' => "Procol",
|
||||
'Version' => 18,
|
||||
'LienEtab' => 0,
|
||||
),
|
||||
'1650' => array(
|
||||
'libEven' => "Rétablissement Personnel",
|
||||
'Bodacc_Code' => "BODA",
|
||||
@ -1744,7 +1758,7 @@ return array(
|
||||
'LienEtab' => 1,
|
||||
),
|
||||
'4500' => array(
|
||||
'libEven' => "Fonds acquis dans le cadre d'une PC",
|
||||
'libEven' => "Fonds acquis dans le cadre d'une Procédure collective",
|
||||
'Bodacc_Code' => "BODA",
|
||||
'Rubrique' => "creations",
|
||||
'Version' => 12,
|
||||
@ -2017,7 +2031,7 @@ return array(
|
||||
'LienEtab' => 1,
|
||||
),
|
||||
'5600' => array(
|
||||
'libEven' => "Entreprise « Précédent exploitant »",
|
||||
'libEven' => "Entreprise « Précédent exploitant »",
|
||||
'Bodacc_Code' => "BODA",
|
||||
'Rubrique' => "ventes",
|
||||
'Version' => 12,
|
||||
|
@ -524,6 +524,31 @@ class MInsee
|
||||
'i780'=>'Modification de l\'établissement',
|
||||
'i781'=>'Modification de l\'établissement suite à correction d\'erreur',
|
||||
'i795'=>'Personne radiée à sa demande de de la base SIRENE diffusion',
|
||||
// Nouveaux évènements Sirene4 de la quotidienne Insee (Syracuse)
|
||||
'iCE' =>'Création établissement',
|
||||
'iCS' =>'Création siège',
|
||||
'iCTE' =>'Création établissement (transfert)',
|
||||
'iCTS' =>'Création siège (transfert)',
|
||||
'iSU' =>'Cessation juridique',
|
||||
'iME' =>'Modification établissement',
|
||||
'iMS' =>'Modification siège',
|
||||
'iMTDE' =>'Modification établissement départ (transfert)',
|
||||
'iMTAE' =>'Modification établissement arrivée (transfert)',
|
||||
'iMTDS' =>'Modification siège départ (transfert)',
|
||||
'iMTAS' =>'Modification siège arrivée (transfert)',
|
||||
'iMU' =>'Modification entreprise',
|
||||
'iRE' =>'Réactivation établissement',
|
||||
'iRS' =>'Réactivation siège',
|
||||
'iSE' =>'Fermeture (ou désactivation) établissement',
|
||||
'iSS' =>'Fermeture (ou désactivation) siège',
|
||||
'iSTE' =>'Fermeture établissement (transfert)',
|
||||
'iSTS' =>'Fermeture siège (transfert)',
|
||||
'iRI' =>'Refus d\'immatriculation au RCS',
|
||||
'iCC' =>'Création par le calage',
|
||||
'iMC' =>'Modification par le calage',
|
||||
'iSC' =>'Suppression par le calage',
|
||||
'iI' =>'Entrée dans le champ de la diffusion commerciale',
|
||||
'iO' =>'Sortie du champ de la diffusion commerciale',
|
||||
);
|
||||
|
||||
private $tabTypEtab=array(
|
||||
@ -1439,7 +1464,7 @@ class MInsee
|
||||
$tabSupId = array();
|
||||
|
||||
//Recherche d'évènement pour lesquels le SIREN est ASSOCIE
|
||||
$result = $this->iDb->select('insee_even', 'id', "insSIREN!=$siren AND insSIRETASS BETWEEN $siretDeb AND $siretFin GROUP BY insSIREN, ROUND(insSIRETASS/100000) ORDER BY insDATEMAJ DESC",false, MYSQL_ASSOC);
|
||||
$result = $this->iDb->select('insee.insee_even', 'id', "insSIREN!=$siren AND insSIRETASS BETWEEN $siretDeb AND $siretFin GROUP BY insSIREN, ROUND(insSIRETASS/100000) ORDER BY insDATEMAJ DESC",false, MYSQL_ASSOC);
|
||||
if ( count($result)>0 ) {
|
||||
foreach ($result as $tmp) {
|
||||
$tabSupId[] = $tmp['id'];
|
||||
@ -1447,7 +1472,7 @@ class MInsee
|
||||
}
|
||||
|
||||
//Recherche d'évènement pour lesquels le SIREN est Prédécesseur ou Successeur
|
||||
$result = $this->iDb->select('insee_even', 'id', "insSIREN!=$siren AND insSIRETASS BETWEEN $siretDeb AND $siretFin GROUP BY insSIREN, ROUND(insSIRETPS/100000) ORDER BY insDATEMAJ DESC",false, MYSQL_ASSOC);
|
||||
$result = $this->iDb->select('insee.insee_even', 'id', "insSIREN!=$siren AND insSIRETASS BETWEEN $siretDeb AND $siretFin GROUP BY insSIREN, ROUND(insSIRETPS/100000) ORDER BY insDATEMAJ DESC",false, MYSQL_ASSOC);
|
||||
if ( count($result)>0 ) {
|
||||
foreach ($result as $tmp) {
|
||||
$tabSupId[] = $tmp['id'];
|
||||
@ -1658,7 +1683,7 @@ class MInsee
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
//Vérification du SIREN
|
||||
if ($nbTot==0 && $actif==-1) {
|
||||
|
||||
require_once 'Metier/sphinx/rechercheFonc.php';
|
||||
@ -1682,6 +1707,7 @@ class MInsee
|
||||
}
|
||||
}
|
||||
|
||||
//Affichage de la liste des établissements
|
||||
if ( count($listeEtab)>0 ) {
|
||||
foreach ($listeEtab as $etab) {
|
||||
$tel=sprintf('%010d', strtr($etab['tel'],array('-'=>'', '/'=>'','.'=>'',','=>'')));
|
||||
@ -2211,7 +2237,7 @@ class MInsee
|
||||
if ($siren>100) {
|
||||
$info = $this->iDb->select(
|
||||
'infos_entrep',
|
||||
'raisonSociale, isin, nscrl, tel, fax, web, mail, latitude, longitude, precis, dateCreation, dateFermeture, naf, naf_lib, ca, effectif, nbEtab, activite, LPAD(sirenDoublon,9,0), waldec',
|
||||
"raisonSociale, isin, nscrl, tel, fax, web, mail, latitude, longitude, precis, dateCreation, dateFermeture, naf, naf_lib, ca, effectif, nbEtab, activite, LPAD(sirenDoublon,9,'0') AS sirenDoublon, waldec",
|
||||
"siren=$siren", false, MYSQL_ASSOC);
|
||||
if ( count($info)>0 ) {
|
||||
$tab=$info[0];
|
||||
@ -2587,6 +2613,10 @@ class MInsee
|
||||
}
|
||||
}
|
||||
|
||||
if ($tabInsee['CIVILITE']==1) $dir1Genre='M';
|
||||
elseif ($tabInsee['CIVILITE']==2) $dir1Genre='F';
|
||||
else $dir1Genre='';
|
||||
|
||||
$tabRet = array(
|
||||
'id'=>$etab['id'],
|
||||
'Siret'=>$etab['siret'],
|
||||
@ -2677,6 +2707,7 @@ class MInsee
|
||||
|
||||
'dir1Titre'=>self::$tabFct[$tabInsee['DIR_FCT']],
|
||||
'dir1NomPrenom'=>preg_replace('/^EIRL\s/','',$tabInsee['DIR_IDEN']),
|
||||
'dir1Genre'=>$dir1Genre,
|
||||
'Rivoli'=>substr($tabInsee['CODEVOIE'],0,4).' '.substr($tabInsee['CODEVOIE'],-1),
|
||||
'InfosIris'=>$tabIris,
|
||||
'NatureActivite'=>$tabInsee['ACTIVNAT'], // Nature de l'activité
|
||||
@ -2895,16 +2926,20 @@ class MInsee
|
||||
$tabRet['dir1Titre']=self::$tabFct['PP'];
|
||||
|
||||
if ($tabInsee['CIVILITE']>0 && $tabRet['dir1NomPrenom']=='') {
|
||||
if ($tabInsee['CIVILITE']==1) $tabRet['dir1NomPrenom']='M. ';
|
||||
elseif ($tabInsee['CIVILITE']==2) $tabRet['dir1NomPrenom']='Mme ';
|
||||
if ($tabInsee['CIVILITE']==1) { $tabRet['dir1NomPrenom']='M. '; $tabRet['dir1Genre']='M'; }
|
||||
elseif ($tabInsee['CIVILITE']==2) { $tabRet['dir1NomPrenom']='Mme '; $tabRet['dir1Genre']='F'; }
|
||||
else $tabRet['dir1Genre']='';
|
||||
$tabRet['dir1NomPrenom'].=$tabInsee['NOM'];
|
||||
}
|
||||
|
||||
if ($tabInsee['CIVILITE']>0 && ($tabRet['dir1Nom']=='' || $tabRet['dir1Prenom'])) {
|
||||
$tmp=$this->iDb->select('insee.insee_even', 'dirNom, dirNomUsage, dirPrenom', "insSIREN=$siren ORDER BY insDATEVE DESC LIMIT 0,1", false, MYSQL_ASSOC);
|
||||
$tmp=$this->iDb->select('insee.insee_even', 'dirNom, dirNomUsage, dirPrenom, insCIVILITE', "insSIREN=$siren ORDER BY insDATEVE DESC LIMIT 0,1", false, MYSQL_ASSOC);
|
||||
$tabRet['dir1Nom']=@strtoupper($tmp[0]['dirNom']);
|
||||
$tabRet['dir1Prenom']=@ucwords(strtolower(@$tmp[0]['dirPrenom']));
|
||||
$tabRet['dir1NomUsage']=@strtoupper($tmp[0]['dirNomUsage']);
|
||||
if ($tmp[0]['insCIVILITE']==1) $tabRet['dir1Genre']='M';
|
||||
elseif ($tmp[0]['insCIVILITE']==2) $tabRet['dir1Genre']='F';
|
||||
else $tabRet['dir1Genre']='';
|
||||
unset($tmp);
|
||||
}
|
||||
|
||||
@ -3069,10 +3104,13 @@ class MInsee
|
||||
$tabRet['dir'.$k.'Code']=$ann['code'];
|
||||
$tabRet['dir'.$k.'Titre']=$ann['libelle'];
|
||||
if (trim($ann['naissance_nom'])<>'') {
|
||||
if ($ann['civilite']=='MME' || $ann['civilite']=='MLLE')
|
||||
if ($ann['civilite']=='MME' || $ann['civilite']=='MLLE') {
|
||||
$nomNaiss=' née '.trim($ann['naissance_nom']);
|
||||
elseif ($ann['civilite']=='M')
|
||||
$tabRet['dir'.$k.'Genre']='F';
|
||||
} elseif ($ann['civilite']=='M') {
|
||||
$nomNaiss=' né '.trim($ann['naissance_nom']);
|
||||
$tabRet['dir'.$k.'Genre']='M';
|
||||
}
|
||||
else
|
||||
$nomNaiss=' né(e) '.trim($ann['naissance_nom']);
|
||||
} else $nomNaiss='';
|
||||
@ -3084,10 +3122,15 @@ class MInsee
|
||||
$tabRet['dir'.$k.'NomPrenom']=$ann['nom'].' '.$ann['prenom'].$nomNaiss;
|
||||
$tabRet['dir'.$k.'Nom']=$ann['nom'];
|
||||
$tabRet['dir'.$k.'Prenom']=$ann['prenom'];
|
||||
if ($ann['civilite']=='M')
|
||||
$tabRet['dir'.$k.'Genre']='M';
|
||||
elseif ($ann['civilite']=='MME' || $ann['civilite']=='MLLE')
|
||||
$tabRet['dir'.$k.'Genre']='F';
|
||||
}
|
||||
$tabRet['dir'.$k.'DateFct']=$ann['dateEffet'];
|
||||
$tabRet['dir'.$k.'DateNaiss']=$ann['dateNaiss'];
|
||||
$tabRet['dir'.$k.'LieuNaiss']=$ann['lieuNaiss'];
|
||||
$tabRet['dir'.$k.'Genre']='';
|
||||
if ($k==2) break;
|
||||
$k++;
|
||||
}
|
||||
@ -3228,6 +3271,7 @@ class MInsee
|
||||
$tabRet['dir1NomUsage']=strtoupper($entrep['nomUsage']);
|
||||
$tabRet['dir1DateNaiss']=$entrep['dateNaiss'];
|
||||
$tabRet['dir1LieuNaiss']=$entrep['lieuNaiss'];
|
||||
$tabRet['dir1Genre']=$entrep['sexe'];
|
||||
}
|
||||
|
||||
if ($tabRet['DateMajRCS']=='') {
|
||||
@ -5121,7 +5165,7 @@ class MInsee
|
||||
|
||||
// On ne rafraichie que si demandé et
|
||||
// que la requête en base est trop ancienne et nscrl est vide ou tel ou web
|
||||
if ($refresh && $dateUpdate<$lastYear && ($idComp['nscrl']==0 || $idComp['tel']=='') ) {
|
||||
if (false && $refresh && $dateUpdate<$lastYear && ($idComp['nscrl']==0 || $idComp['tel']=='') ) {
|
||||
$timeout=20;
|
||||
// La mise à jour ne se fera pas si lastMAJ<365
|
||||
/*$strUpdate='AND (DATEDIFF(NOW(),dateUpdate)<365 OR (nscrl<>0 AND DATEDIFF(NOW(),dateUpdate)>0))';
|
||||
@ -5401,6 +5445,12 @@ class MInsee
|
||||
'CodeEven'=>$even,
|
||||
'LibEven'=>$this->iBodacc->getEvenement($even)
|
||||
);
|
||||
if ($even>=1000 && $even<2000) $rubriqueRet='procol';
|
||||
elseif ($even>=2000 && $even<3000) $rubriqueRet='mmd';
|
||||
elseif ($even>=3000 && $even<4000) $rubriqueRet='comptes';
|
||||
elseif ($even>=4000 && $even<5000) $rubriqueRet='creations';
|
||||
elseif ($even>=5000 && $even<6000) $rubriqueRet='ventes';
|
||||
elseif ($even>=6000 && $even<7000) $rubriqueRet='radiations';
|
||||
if ($even==2102 || $even==2100) $capital=true;
|
||||
}
|
||||
}
|
||||
@ -5468,7 +5518,7 @@ class MInsee
|
||||
'Departement'=>$dept,
|
||||
'Tribunal'=>$ann['triNom'],
|
||||
'TribunalSiret'=>$ann['triSiret'],
|
||||
'Rubrique'=>'procol',
|
||||
'Rubrique'=>$rubriqueRet,
|
||||
'typeAnnonce'=>'insertion',
|
||||
'dateEffet'=>$ann['dateCessationPaiement'],
|
||||
'dateJugement'=>$ann['dateJugement'],
|
||||
@ -5612,7 +5662,7 @@ class MInsee
|
||||
}
|
||||
$tabTmp=$this->iDb->select('tabAdrDom',
|
||||
'id, siren, nic, enActif, etActif, procol, nom, nom2, sigle, enseigne, adrNum, adrBtq, adrTypVoie, adrLibVoie, ville, cp, adrComp, adrDistSp, cj, apen, apet, nbEntrep, dateInsert, dateUpdate',
|
||||
"adrNum=$num AND adrBtq='$indRep' AND adrTypVoie LIKE '%$typeVoie%' AND adrLibVoie LIKE '%$libVoie%' AND cp=$cp $strAdrActive", false, MYSQL_ASSOC);
|
||||
"adrNum=$num AND adrBtq='$indRep' AND adrTypVoie LIKE '%$typeVoie%' AND adrLibVoie LIKE '%$libVoie%' AND cp=$cp $strAdrActive GROUP BY siren ORDER BY enActif DESC, nbEntrep DESC", false, MYSQL_ASSOC);
|
||||
if (count($tabTmp)>0) {
|
||||
/* sendMail('production@scores-decisions.com', 'ylenaour@scores-decisions.com', "Adresse de domiciliation", print_r($tabAdr,true).EOL.print_r($tabTmp, true).EOL.
|
||||
"num=$num=$adresseNum".EOL.
|
||||
@ -6170,63 +6220,74 @@ class MInsee
|
||||
**/
|
||||
public function getSiretAssoc($siren, $nic, $lien=0)
|
||||
{
|
||||
$tabRet=array();
|
||||
$tabRet=array();
|
||||
$ret=$this->iDb->select('insee.insee_even',
|
||||
'insSIREN, insNIC, insDATEVE, insEVE, insAPET700, insSIEGE, insLIBCOM, insL1_NOMEN, insL2_COMP, insL4_VOIE, insL3_CADR, insL5_DISP, insL6_POST, insCODPOS, insL7_ETRG, insDEPCOM, insCODEVOIE, insNICTRAN, insSIRETPS, insDATEMAJ, idFlux, insSIRETASS, insDESTINAT, insTYPETAB, insORIGINE, insTRAN, insNOMEN, insENSEIGNE, insNUMVOIE, insINDREP, insTYPVOIE, insLIBVOIE',
|
||||
"insSIREN=$siren AND insNIC<>$nic AND (insEVE IN ('510','520','530','540') OR insEVE LIKE 'T%') AND insDATEMAJ IN (
|
||||
SELECT insDATEMAJ FROM insee_even WHERE insSIREN=$siren AND insNIC=$nic AND (insEVE IN ('510','520','530','540') OR insEVE LIKE 'T%') )", false, MYSQL_ASSOC);
|
||||
foreach ($ret as $iRet=>$tabEve) {
|
||||
switch($tabEve['insTYPETAB']*1) {
|
||||
case 8:
|
||||
case 10:
|
||||
case 20:
|
||||
case 30:
|
||||
if ($lien==1) continue;
|
||||
$typeLien='pre';
|
||||
break;
|
||||
case 9:
|
||||
case 11:
|
||||
case 21:
|
||||
case 31:
|
||||
if ($lien==-1) continue;
|
||||
$typeLien='suc';
|
||||
break;
|
||||
default:
|
||||
switch($tabEve['insTRAN']) {
|
||||
case 'D': if ($lien==1) continue; $typeLien='pre'; break(2);
|
||||
case 'A': if ($lien==-1) continue; $typeLien='suc'; break(2);
|
||||
default : if ($lien<>0) continue; $typeLien='ind'; break;
|
||||
}
|
||||
}
|
||||
"insSIREN=$siren AND insNIC<>$nic AND (insEVE IN ('510','520','530','540', 'CTS','CTE','STS','STE','MTDS','MTDE','MTAS','MTAE') OR insEVE LIKE 'T%') AND insDATEMAJ IN (
|
||||
SELECT insDATEMAJ FROM insee.insee_even WHERE insSIREN=$siren AND insNIC=$nic AND (insEVE IN ('510','520','530','540', 'CTS','CTE','STS','STE','MTDS','MTDE','MTAS','MTAE') OR insEVE LIKE 'T%')
|
||||
)", false, MYSQL_ASSOC);
|
||||
|
||||
$adr1=$tabEve['insL1_NOMEN'];
|
||||
if ($adr1==NULL) $adr1=$tabEve['insNOMEN'];
|
||||
$adr2=$tabEve['insL2_COMP'];
|
||||
if ($adr2==NULL) $adr2=$tabEve['insENSEIGNE'];
|
||||
$adr4=$tabEve['insL4_VOIE'];
|
||||
if ($adr4==NULL) $adr4=preg_replace('/ +/',' ', $tabEve['insNUMVOIE'].' '.$tabEve['insINDREP'].' '.$tabEve['insTYPVOIE'].' '.$tabEve['insLIBVOIE']);
|
||||
if ( count($ret)>0 ) {
|
||||
foreach ($ret as $iRet=>$tabEve) {
|
||||
if ($tabEve['sirVersion']==4) {
|
||||
if ($tabEve['insEVE']=='CTE' || $tabEve['insEVE']=='CTS' || $tabEve['insEVE']=='MTAE' || $tabEve['insEVE']=='MTAS') $typeLien='suc';
|
||||
elseif ($tabEve['insEVE']=='STE' || $tabEve['insEVE']=='STS' || $tabEve['insEVE']=='MTDE' || $tabEve['insEVE']=='MTDS') $typeLien='pre';
|
||||
else $typeLien='ind';
|
||||
} else {
|
||||
switch($tabEve['insTYPETAB']*1) {
|
||||
case 8:
|
||||
case 10:
|
||||
case 20:
|
||||
case 30:
|
||||
if ($lien==1) continue;
|
||||
$typeLien='pre';
|
||||
break;
|
||||
case 9:
|
||||
case 11:
|
||||
case 21:
|
||||
case 31:
|
||||
if ($lien==-1) continue;
|
||||
$typeLien='suc';
|
||||
break;
|
||||
default:
|
||||
switch($tabEve['insTRAN']) {
|
||||
case 'D': if ($lien==1) continue; $typeLien='pre'; break(2);
|
||||
case 'A': if ($lien==-1) continue; $typeLien='suc'; break(2);
|
||||
default : if ($lien<>0) continue; $typeLien='ind'; break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$tabRet[$typeLien]=array('siren' => $tabEve['insSIREN'],
|
||||
'nic' => $tabEve['insNIC'],
|
||||
'apeEtab' => $tabEve['insAPET700'],
|
||||
'codeEve' => $tabEve['insEVE'],
|
||||
'dateEve' => $tabEve['insDATEVE'],
|
||||
'adrL1' => trim($adr1),
|
||||
'adrL2' => trim($adr2),
|
||||
'adrL3' => trim(prepareString($tabEve['insL3_CADR'])),
|
||||
'adrL4' => trim($adr4),
|
||||
'adrL5' => trim($tabEve['insL5_DISP']),
|
||||
'adrL6' => trim($tabEve['insL6_POST']),
|
||||
'adrL7' => trim($tabEve['insL7_ETRG']),
|
||||
'depCom' => $tabEve['insDEPCOM'],
|
||||
'rivoli' => $tabEve['insCODEVOIE'],
|
||||
'siege' => $tabEve['insSIEGE'],
|
||||
'destinat' => $tabEve['insDESTINAT'],
|
||||
'typEtab' => $tabEve['insTYPETAB'],
|
||||
'origine' => $tabEve['insORIGINE'],
|
||||
// insNICTRAN, insSIRETPS, insDATEMAJ, idFlux, insSIRETASS,
|
||||
);
|
||||
}
|
||||
$adr1=$tabEve['insL1_NOMEN'];
|
||||
if ($adr1==NULL) $adr1=$tabEve['insNOMEN'];
|
||||
$adr2=$tabEve['insL2_COMP'];
|
||||
if ($adr2==NULL) $adr2=$tabEve['insENSEIGNE'];
|
||||
$adr4=$tabEve['insL4_VOIE'];
|
||||
if ($adr4==NULL) $adr4=preg_replace('/ +/',' ', $tabEve['insNUMVOIE'].' '.$tabEve['insINDREP'].' '.$tabEve['insTYPVOIE'].' '.$tabEve['insLIBVOIE']);
|
||||
|
||||
$tabRet[$typeLien]=array(
|
||||
'siren' => $tabEve['insSIREN'],
|
||||
'nic' => $tabEve['insNIC'],
|
||||
'apeEtab' => $tabEve['insAPET700'],
|
||||
'codeEve' => $tabEve['insEVE'],
|
||||
'dateEve' => $tabEve['insDATEVE'],
|
||||
'adrL1' => trim($adr1),
|
||||
'adrL2' => trim($adr2),
|
||||
'adrL3' => trim(prepareString($tabEve['insL3_CADR'])),
|
||||
'adrL4' => trim($adr4),
|
||||
'adrL5' => trim($tabEve['insL5_DISP']),
|
||||
'adrL6' => trim($tabEve['insL6_POST']),
|
||||
'adrL7' => trim($tabEve['insL7_ETRG']),
|
||||
'depCom' => $tabEve['insDEPCOM'],
|
||||
'rivoli' => $tabEve['insCODEVOIE'],
|
||||
'siege' => $tabEve['insSIEGE'],
|
||||
'destinat' => $tabEve['insDESTINAT'],
|
||||
'typEtab' => $tabEve['insTYPETAB'],
|
||||
'origine' => $tabEve['insORIGINE'],
|
||||
// insNICTRAN, insSIRETPS, insDATEMAJ, idFlux, insSIRETASS,
|
||||
);
|
||||
}
|
||||
}
|
||||
return $tabRet;
|
||||
}
|
||||
|
||||
|
@ -390,8 +390,8 @@ class MBilans {
|
||||
'GV' => '280-294', //GP-GU
|
||||
'GV1' => 'N54-N56', //GP1-GU1
|
||||
|
||||
'GW' => '270+280+294', //GG+GH-GI+GV ???
|
||||
'GW1' => 'N53+N54+N56',
|
||||
'GW' => '270+280-294', //GG+GH-GI+GV ???
|
||||
'GW1' => 'N53+N54-N56',
|
||||
|
||||
'HD' => '290',
|
||||
'HD1' => 'N55',
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?
|
||||
<?php
|
||||
/*
|
||||
2. Concernant la date de fin de CS, devons nous comprendre les cas suivants de la sorte :
|
||||
A. 026 820 043 I 2009-10-31 La CS était valide jusq'au 31/10/2009... L'entreprise n'a plus de CS ? ou la CS est encore à prendre en compte ?
|
||||
@ -14,8 +14,8 @@ D. 067 200 329 I 2010-06-30 La CS est valide jusq'au 30/06/2010... Quid
|
||||
La cs paiement a une durée de 6 ou 12 mois pour les cas graves.
|
||||
La cs privilège a une durée de 27 mois ( sauf bien sur les cs manuelles qui sont à la convenance de l'analyste, en général 12 mois ).
|
||||
*/
|
||||
class MFacto {
|
||||
|
||||
class MFacto
|
||||
{
|
||||
public $risqueImpaye=false; // Y a t'il un risque d'impayé ?
|
||||
public $risqueImpayeMois=0;
|
||||
public $profilPayeur=0; // 0:N/D, 1:Excellent, 2=Bon, 3=Normal, 4=Lent, 5=Mauvais ou Défaut
|
||||
@ -64,122 +64,129 @@ class MFacto {
|
||||
'_T' =>array('risque'=>2,'type'=>'LC', 'libInt'=>'LC Quelconque', 'libExt'=>"Nombreuses demandes d'avis de crédit"),
|
||||
);
|
||||
|
||||
private $tabTranches=array( 0=>6,
|
||||
30=>36,
|
||||
60=>66,
|
||||
90=>96,
|
||||
120=>126,
|
||||
150=>156,
|
||||
180=>999);
|
||||
private $tabTranches=array(
|
||||
0=>6,
|
||||
30=>36,
|
||||
60=>66,
|
||||
90=>96,
|
||||
120=>126,
|
||||
150=>156,
|
||||
180=>999,
|
||||
);
|
||||
|
||||
private $tabMontants=array( 1=>500,
|
||||
2=>2000,
|
||||
10=>10000,
|
||||
20=>20000,
|
||||
50=>50000,
|
||||
100=>100000,
|
||||
200=>200000,
|
||||
999=>999999);
|
||||
private $tabMontants=array(
|
||||
1=>500,
|
||||
2=>2000,
|
||||
10=>10000,
|
||||
20=>20000,
|
||||
50=>50000,
|
||||
100=>100000,
|
||||
200=>200000,
|
||||
999=>999999
|
||||
);
|
||||
|
||||
// private $siren=0;
|
||||
// private $tabPaiements=array();
|
||||
|
||||
function __construct() {
|
||||
$this->iDb=new WDB('sdv1');
|
||||
function __construct()
|
||||
{
|
||||
$this->iDb = new WDB('sdv1');
|
||||
}
|
||||
|
||||
function __destruct() {
|
||||
public function setTypeFic($typeFic)
|
||||
{
|
||||
$this->typeFlux = $typeFic;
|
||||
}
|
||||
|
||||
public function setTypeFic($typeFic) {
|
||||
$this->typeFlux=$typeFic;
|
||||
}
|
||||
|
||||
public function readFic($a) {
|
||||
switch ($this->typeFlux) {
|
||||
case 0: // Acheteur
|
||||
$tab=array( 'NUMACH'=> trim(substr($a, 0, 6)),
|
||||
'SIRENE'=> trim(substr($a, 6, 9)),
|
||||
'RAISOC'=> trim(substr($a, 15, 35)),
|
||||
'NUMVOI'=> trim(substr($a, 50, 4)),
|
||||
'TYPVOI'=> trim(substr($a, 54, 3)),
|
||||
'LIBVOI'=> trim(substr($a, 57, 30)),
|
||||
'VILLE' => trim(substr($a, 87, 26)),
|
||||
'CODPOS'=> trim(substr($a,113, 5)),
|
||||
'FILLER'=> trim(substr($a,118, 2)));
|
||||
public function readFic($a)
|
||||
{
|
||||
switch ($this->typeFlux)
|
||||
{
|
||||
case 0: // Acheteur GESCDCLT - Line length (120 + CRLF = 122)
|
||||
$tab = array(
|
||||
'NUMACH'=> trim(substr($a, 0, 7)), // 0-7 | 7
|
||||
'SIRENE'=> trim(substr($a, 7, 9)), // 7-16 | 9
|
||||
'RAISOC'=> trim(substr($a, 16, 35)), // 16-51 | 35
|
||||
'NUMVOI'=> trim(substr($a, 51, 4)), // 51-55 | 4
|
||||
'TYPVOI'=> trim(substr($a, 55, 3)), // 55-58 | 3
|
||||
'LIBVOI'=> trim(substr($a, 58, 30)), // 58-88 | 30
|
||||
'VILLE'=> trim(substr($a, 88, 26)), // 88-114 | 26
|
||||
'CODPOS'=> trim(substr($a,114, 5)), // 114-119 | 5
|
||||
'FILLER'=> trim(substr($a,119, 2)), // 119-120 | 1
|
||||
);
|
||||
break;
|
||||
case 1: // CS
|
||||
/*$tab=array( 'DATMAJ1'=> WDate::dateT('ymd','Y-m-d', substr($a, 0, 6)),
|
||||
'NUMGFH'=> trim(substr($a, 6, 6)),
|
||||
'CSAVAN'=> trim(substr($a, 12, 2)),
|
||||
'CSAPRE'=> trim(substr($a, 14, 2)),
|
||||
'INDAUT'=> trim(substr($a, 16, 1)),
|
||||
'CODUTI'=> trim(substr($a, 17, 6)),
|
||||
'INIMAJ'=> trim(substr($a, 23, 3)),
|
||||
'ANAACH'=> trim(substr($a, 25, 2)),
|
||||
'ANAPOR'=> trim(substr($a, 27, 2)));*/
|
||||
$tab=array( 'siren' => trim(substr($a, 0, 9)),
|
||||
'cs' => trim(substr($a, 9, 2)),
|
||||
'dateFin'=> trim(substr($a, 11, 8)));
|
||||
case 1: // CS - GESDACH - Line Length (19 + CRLF = 21)
|
||||
$tab = array(
|
||||
'siren' => trim(substr($a, 0, 9)), // 0-9 | 9
|
||||
'cs' => trim(substr($a, 9, 2)), // 9-11 | 2
|
||||
'dateFin'=> trim(substr($a, 11, 8)), // 11-9 | 8
|
||||
);
|
||||
break;
|
||||
case 2: // Paiements
|
||||
$tab=array( 'NUMACH'=> trim(substr($a, 0, 6)),
|
||||
'DATPIE'=> substr($a, 6, 8),
|
||||
'DATECH'=> substr($a, 14, 8),
|
||||
'DATPAI'=> substr($a, 22, 8),
|
||||
'MNTPIE'=> trim(substr($a, 30, 13)),
|
||||
'MNTFRF'=> trim(substr($a, 43, 13)),
|
||||
'MNTLIT'=> trim(substr($a, 56, 13)),
|
||||
'CODDEV'=> trim(substr($a, 69, 3)));
|
||||
case 2: // Paiements - GESCDMVT - Line length (73 + CRLF = 75)
|
||||
$tab = array(
|
||||
'NUMACH'=> trim(substr($a, 0, 7)), // 0-7 | 7
|
||||
'DATPIE'=> substr($a, 7, 8), // 7-15 | 8
|
||||
'DATECH'=> substr($a, 15, 8), // 15-23 | 8
|
||||
'DATPAI'=> substr($a, 23, 8), // 23-31 | 8
|
||||
'MNTPIE'=> trim(substr($a, 31, 13)), // 31-44 | 13
|
||||
'MNTFRF'=> trim(substr($a, 44, 13)), // 44-57 | 13
|
||||
'MNTLIT'=> trim(substr($a, 57, 13)), // 57-70 | 13
|
||||
'CODDEV'=> trim(substr($a, 70, 3)), // 70-73 | 3
|
||||
);
|
||||
break;
|
||||
}
|
||||
return $tab;
|
||||
}
|
||||
|
||||
|
||||
public function getCoteSpeciale($siren) {
|
||||
$ret=$this->iDb->select( 'ge_cs2',
|
||||
'siren, cs, dateFin, dateInsert, dateConf',
|
||||
"siren=$siren AND (dateSuppr=0 OR dateConf>dateSuppr) AND (dateFin=0 OR dateFin>NOW()) AND cs NOT IN (20,22,27,33,34) ORDER BY dateConf DESC, dateInsert DESC", false, MYSQL_ASSOC);
|
||||
public function getCoteSpeciale($siren)
|
||||
{
|
||||
$ret=$this->iDb->select(
|
||||
'ge_cs2',
|
||||
'siren, cs, dateFin, dateInsert, dateConf',
|
||||
"siren=$siren AND (dateSuppr=0 OR dateConf>dateSuppr) AND (dateFin=0 OR dateFin>NOW()) AND cs NOT IN (20,22,27,33,34) ORDER BY dateConf DESC, dateInsert DESC", false, MYSQL_ASSOC);
|
||||
$tabRet=array();
|
||||
foreach ($ret as $i=>$tabCS) {
|
||||
foreach ($ret as $i=>$tabCS)
|
||||
{
|
||||
$dateEven=$tabCS['dateConf'];
|
||||
if ($dateEven=='0000-00-00') $dateEven=$tabCS['dateInsert'];
|
||||
$tabRet[]=array('DateEven' => $dateEven,
|
||||
'DateFin' => $tabCS['dateFin'],
|
||||
'CoteCS' => $tabCS['cs'],
|
||||
// 'CoteCSpre' => $tabCS['CSAVAN'],
|
||||
'LibCS' => $this->tabInfoCS['_'.$tabCS['cs']]['libExt'],
|
||||
// 'LibCSpre' => $this->tabInfoCS[$tabCS['CSAVAN']*1]['libExt'],
|
||||
'NivRisque' => $this->tabInfoCS['_'.$tabCS['cs']]['risque'],
|
||||
//'NivRisquePre' => $this->tabInfoCS[$tabCS['CSAVAN']*1]['risque'],
|
||||
'CodeRisque' => $this->tabInfoCS['_'.$tabCS['cs']]['type'],
|
||||
);
|
||||
if ($dateEven=='0000-00-00') {
|
||||
$dateEven=$tabCS['dateInsert'];
|
||||
}
|
||||
$tabRet[]=array(
|
||||
'DateEven' => $dateEven,
|
||||
'DateFin' => $tabCS['dateFin'],
|
||||
'CoteCS' => $tabCS['cs'],
|
||||
//'CoteCSpre' => $tabCS['CSAVAN'],
|
||||
'LibCS' => $this->tabInfoCS['_'.$tabCS['cs']]['libExt'],
|
||||
//'LibCSpre' => $this->tabInfoCS[$tabCS['CSAVAN']*1]['libExt'],
|
||||
'NivRisque' => $this->tabInfoCS['_'.$tabCS['cs']]['risque'],
|
||||
//'NivRisquePre' => $this->tabInfoCS[$tabCS['CSAVAN']*1]['risque'],
|
||||
'CodeRisque' => $this->tabInfoCS['_'.$tabCS['cs']]['type'],
|
||||
);
|
||||
}
|
||||
return $tabRet;
|
||||
}
|
||||
|
||||
public function getCoteSpecialeOld($siren) {
|
||||
public function getCoteSpecialeOld($siren)
|
||||
{
|
||||
$ret=$this->iDb->select( 'ge_cs c LEFT JOIN ge_acheteurs a ON a.NUMACH=c.NUMGFH',
|
||||
'DATMAJ1, NUMGFH, CSAVAN, CSAPRE, SIRENE',
|
||||
"a.SIRENE=$siren ORDER BY a.SIRENE ASC, c.DATMAJ1 DESC", false, MYSQL_ASSOC);
|
||||
$tabRet=array();
|
||||
foreach ($ret as $i=>$tabCS) {
|
||||
$tabRet[]=array('DateEven' => $tabCS['DATMAJ1'],
|
||||
'CoteCS' => $tabCS['CSAPRE'],
|
||||
'CoteCSpre' => $tabCS['CSAVAN'],
|
||||
'LibCS' => $this->tabInfoCS[$tabCS['CSAPRE']*1]['libExt'],
|
||||
'LibCSpre' => $this->tabInfoCS[$tabCS['CSAVAN']*1]['libExt'],
|
||||
'NivRisque' => $this->tabInfoCS[$tabCS['CSAPRE']*1]['risque'],
|
||||
'NivRisquePre' => $this->tabInfoCS[$tabCS['CSAVAN']*1]['risque'],
|
||||
'CodeRisque' => $this->tabInfoCS[$tabCS['CSAPRE']*1]['type'],
|
||||
);
|
||||
$tabRet[]=array(
|
||||
'DateEven' => $tabCS['DATMAJ1'],
|
||||
'CoteCS' => $tabCS['CSAPRE'],
|
||||
'CoteCSpre' => $tabCS['CSAVAN'],
|
||||
'LibCS' => $this->tabInfoCS[$tabCS['CSAPRE']*1]['libExt'],
|
||||
'LibCSpre' => $this->tabInfoCS[$tabCS['CSAVAN']*1]['libExt'],
|
||||
'NivRisque' => $this->tabInfoCS[$tabCS['CSAPRE']*1]['risque'],
|
||||
'NivRisquePre' => $this->tabInfoCS[$tabCS['CSAVAN']*1]['risque'],
|
||||
'CodeRisque' => $this->tabInfoCS[$tabCS['CSAPRE']*1]['type'],
|
||||
);
|
||||
}
|
||||
return $tabRet;
|
||||
}
|
||||
|
||||
public function getPaiements($siren, $echelle='mois') {
|
||||
|
||||
public function getPaiements($siren, $echelle='mois')
|
||||
{
|
||||
if ($echelle=='jour')
|
||||
$strGroupBy="GROUP BY p.DATPIE ";
|
||||
elseif ($echelle=='' || $echelle=='mois')
|
||||
@ -200,7 +207,8 @@ class MFacto {
|
||||
p.CODDEV, a.SIRENE, a.RAISOC, a.CODPOS, a.VILLE",
|
||||
"a.SIRENE=$siren AND DATEDIFF(NOW(),p.DATECH)<736 AND p.DATECH<NOW() $strGroupBy ORDER BY p.DATPIE DESC", false, MYSQL_ASSOC);
|
||||
$tabRet=array();
|
||||
foreach ($ret as $i=>$tabPai) {
|
||||
foreach ($ret as $i=>$tabPai)
|
||||
{
|
||||
$nbJoursMoyen=$tabPai['nbJourRetard']-$tabPai['nbJourPaiement'];
|
||||
if ($nbJoursMoyen<6) $tranche=0;
|
||||
elseif ($nbJoursMoyen<36) $tranche=30;
|
||||
@ -210,20 +218,21 @@ class MFacto {
|
||||
elseif ($nbJoursMoyen<156) $tranche=150;
|
||||
else $tranche=180;
|
||||
|
||||
$tabRet[]=array('trimestre' => $tabPai['trimestre'],
|
||||
'mois' => $tabPai['mois'],
|
||||
'nbPieces' => $tabPai['nbPieces'],
|
||||
'nbJourRetard' => $tabPai['nbJourRetard'],
|
||||
'nbJourPaiement'=> $tabPai['nbJourPaiement'],
|
||||
'nbJourMoyen' => $nbJoursMoyen,
|
||||
'nbJourMoyen2' => $tabPai['nbJourMoyens'],
|
||||
'tranchePaiement'=>$tranche,
|
||||
'tranchePaie90' =>$tabPai['nbJours'],
|
||||
'mtPieces' => $tabPai['mtPieces'],
|
||||
'mtPaiements' => $tabPai['mtPaiements'],
|
||||
'mtLitiges' => $tabPai['mtLitiges'],
|
||||
'devise' => $tabPai['CODDEV'],
|
||||
);
|
||||
$tabRet[]=array(
|
||||
'trimestre' => $tabPai['trimestre'],
|
||||
'mois' => $tabPai['mois'],
|
||||
'nbPieces' => $tabPai['nbPieces'],
|
||||
'nbJourRetard' => $tabPai['nbJourRetard'],
|
||||
'nbJourPaiement'=> $tabPai['nbJourPaiement'],
|
||||
'nbJourMoyen' => $nbJoursMoyen,
|
||||
'nbJourMoyen2' => $tabPai['nbJourMoyens'],
|
||||
'tranchePaiement'=>$tranche,
|
||||
'tranchePaie90' =>$tabPai['nbJours'],
|
||||
'mtPieces' => $tabPai['mtPieces'],
|
||||
'mtPaiements' => $tabPai['mtPaiements'],
|
||||
'mtLitiges' => $tabPai['mtLitiges'],
|
||||
'devise' => $tabPai['CODDEV'],
|
||||
);
|
||||
}
|
||||
//$this->tabPaiements=$tabRet;
|
||||
/*@sendMail('production@scores-decisions.com', 'ylenaour@scores-decisions.com', "Indiscore sur $siren : Paiements", "SELECT p.NUMACH, DATE_FORMAT(p.DATPIE, '%Y-%m') AS mois,
|
||||
@ -241,7 +250,8 @@ class MFacto {
|
||||
return $tabRet;
|
||||
}
|
||||
|
||||
public function getProfilPayeur($siren) {
|
||||
public function getProfilPayeur($siren)
|
||||
{
|
||||
if ($siren<1000) return '';
|
||||
$libProfil='';
|
||||
/*if ($this->siren==$siren)
|
||||
@ -326,7 +336,8 @@ class MFacto {
|
||||
return $libProfil;
|
||||
}
|
||||
|
||||
public function getTabPaiements($siren) {
|
||||
public function getTabPaiements($siren)
|
||||
{
|
||||
if ($siren<1000) return false;
|
||||
|
||||
$tabNbr=array(); // Tableau de travail du nombre de factures par trimestre et par tranches de délais de paiements
|
||||
@ -336,11 +347,12 @@ class MFacto {
|
||||
$tabMtAn2=array(); // Tableau retour du nombre de factures par montant et par tranches de délais de paiements
|
||||
|
||||
$tabPaie=$this->getPaiements($siren, 'jour');
|
||||
foreach ($tabPaie as $i=>$tabPai) {
|
||||
foreach ($tabPaie as $i=>$tabPai)
|
||||
{
|
||||
@$tabNbr[$tabPai['trimestre']]['d='.$tabPai['tranchePaiement']]+=$tabPai['nbPieces'];
|
||||
@$tabNbr[$tabPai['trimestre']]['all']+=$tabPai['nbPieces'];
|
||||
$mt=$tabPai['mtPieces']/$tabPai['nbPieces'];
|
||||
// echo "$i\t".$tabPai['trimestre']." (".$tabPai['tranchePaiement']." j)\t$mt=".$tabPai['mtPieces'].'/'.$tabPai['nbPieces'].EOL;
|
||||
//echo "$i\t".$tabPai['trimestre']." (".$tabPai['tranchePaiement']." j)\t$mt=".$tabPai['mtPieces'].'/'.$tabPai['nbPieces'].EOL;
|
||||
if ($mt<500) { @$tabMtAn[1]['d='.$tabPai['tranchePaiement']]++; @$tabMtAn[1]['all']++; }
|
||||
elseif ($mt<2000) { @$tabMtAn[2]['d='.$tabPai['tranchePaiement']]++; @$tabMtAn[2]['all']++; }
|
||||
elseif ($mt<10000) { @$tabMtAn[10]['d='.$tabPai['tranchePaiement']]++; @$tabMtAn[10]['all']++; }
|
||||
@ -353,12 +365,14 @@ class MFacto {
|
||||
}
|
||||
|
||||
// Recalcul des délais par Trimestre
|
||||
foreach ($tabNbr as $trim=>$tabTranche) {
|
||||
foreach ($tabNbr as $trim=>$tabTranche)
|
||||
{
|
||||
ksort($tabTranche);
|
||||
// Initialisation des tranches à 0
|
||||
foreach ($this->tabTranches as $tranche=>$vide)
|
||||
$tabNbr2[$trim]['nb']=$tabNbr2[$trim]['d='.$tranche]=0;
|
||||
foreach ($tabTranche as $tranche=>$mt3) {
|
||||
foreach ($tabTranche as $tranche=>$mt3)
|
||||
{
|
||||
$tranche=str_replace('d=','',$tranche);
|
||||
if ($tranche=='all') $tabNbr2[$trim]['nb']=$mt3;
|
||||
else $tabNbr2[$trim]['d='.$tranche]=round(($mt3/$tabNbr2[$trim]['nb'])*100,1);
|
||||
@ -366,16 +380,19 @@ class MFacto {
|
||||
}
|
||||
|
||||
// Initialisation des tranches à 0 par Montants
|
||||
foreach ($this->tabMontants as $mt=>$vide) {
|
||||
foreach ($this->tabMontants as $mt=>$vide)
|
||||
{
|
||||
$tabMtAn2['_'.$mt]['nb']=0;
|
||||
foreach ($this->tabTranches as $tranche=>$vide)
|
||||
$tabMtAn2['_'.$mt]['d='.$tranche]=0;
|
||||
}
|
||||
// Recalcul des délais par Montants
|
||||
ksort($tabMtAn);
|
||||
foreach ($tabMtAn as $mt=>$tabTranche) {
|
||||
foreach ($tabMtAn as $mt=>$tabTranche)
|
||||
{
|
||||
ksort($tabTranche);
|
||||
foreach ($tabTranche as $tranche=>$mt2) {
|
||||
foreach ($tabTranche as $tranche=>$mt2)
|
||||
{
|
||||
$tranche=str_replace('d=','',$tranche);
|
||||
if ($tranche=='all') $tabMtAn2['_'.$mt]['nb']=$mt2;
|
||||
else $tabMtAn2['_'.$mt]['d='.$tranche]=round(($mt2/$tabMtAn2['_'.$mt]['nb'])*100,1);
|
||||
@ -383,17 +400,19 @@ class MFacto {
|
||||
}
|
||||
|
||||
//@sendMail('production@scores-decisions.com', 'ylenaour@scores-decisions.com', "Indiscore sur $siren : Tableaux des Paiements", 'Paiements par montants :'.EOL.print_r($tabMtAn2, true).EOL.EOL.'Paiements par trimestres :'.EOL.print_r($tabNbr2, true).EOL.print_r($tabNbr, true).EOL.print_r($tabMtAn, true).EOL);
|
||||
return array('parMont'=>$tabMtAn2,
|
||||
'parTrim'=>$tabNbr2);
|
||||
}
|
||||
|
||||
public function getLibInfoCS($cs) {
|
||||
return array( 'CoteCS' => $cs,
|
||||
'LibCS' => $this->tabInfoCS["_$cs"]['libExt'],
|
||||
'NivRisque' => $this->tabInfoCS["_$cs"]['risque'],
|
||||
'CodeRisque' => $this->tabInfoCS["_$cs"]['type'],
|
||||
return array(
|
||||
'parMont'=>$tabMtAn2,
|
||||
'parTrim'=>$tabNbr2
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
public function getLibInfoCS($cs)
|
||||
{
|
||||
return array(
|
||||
'CoteCS' => $cs,
|
||||
'LibCS' => $this->tabInfoCS["_$cs"]['libExt'],
|
||||
'NivRisque' => $this->tabInfoCS["_$cs"]['risque'],
|
||||
'CodeRisque' => $this->tabInfoCS["_$cs"]['type'],
|
||||
);
|
||||
}
|
||||
}
|
@ -63,7 +63,7 @@ class MLiens2
|
||||
if ( $type == 'siren' ) {
|
||||
$this->siren = $id;
|
||||
$refM = new Application_Model_JoLiensRef();
|
||||
$sql = $refM->select()->where('siren=?', $id);
|
||||
$sql = $refM->select()->where('siren=?', $id)->where('dateSuppr=0');
|
||||
$result = $refM->fetchRow($sql);
|
||||
if ( $result !== null ) {
|
||||
$this->idRef = $result->id;
|
||||
@ -207,7 +207,7 @@ class MLiens2
|
||||
try {
|
||||
$directionsM = new Application_Model_JoRncsDirigeants();
|
||||
$sql = $directionsM->select()->from($directionsM, array(
|
||||
'siren','raisonSociale', 'dirSiren', 'dirRS', 'civilite', 'nom',
|
||||
'LPAD(siren, 9, 000000000) AS siren','raisonSociale', 'dirSiren', 'dirRS', 'civilite', 'nom',
|
||||
'prenom', 'naissance_date', 'naissance_lieu', 'fonction_code', 'fonction_lib'
|
||||
))->where("typeDir IN ('PM', 'PP')")->where('dirSiren=?', $siren);
|
||||
|
||||
|
@ -522,7 +522,7 @@ class MMap {
|
||||
private $apiKeyY='klII0gzV34Ho2TCsN3XiXeh4No033AifxMeDXfFXj8TDCXO3WAtOLj9c74VsV45HcII-';
|
||||
private $apiKeyC='ae5216123e414fcd84b8ca9a0f43a68c';
|
||||
|
||||
function __construct($accesDist=true, $db = null)
|
||||
public function __construct($accesDist=true, $db = null)
|
||||
{
|
||||
if ( $db === null ) {
|
||||
$this->iDb = new WDB();
|
||||
@ -532,22 +532,22 @@ class MMap {
|
||||
$this->accesDist=$accesDist;
|
||||
}
|
||||
|
||||
/*
|
||||
http://platform.beta.mapquest.com/geocoding/v1/address?key=YOUR_KEY_HERE&location=Lancaster,PA&callback=renderGeocode
|
||||
http://platform.beta.mapquest.com/geocoding/v1/address?key=YOUR_KEY_HERE&callback=renderOptions&inFormat=kvp&outFormat=json&location=77 rue lost al lann, 29000 quimper,france
|
||||
/*
|
||||
http://platform.beta.mapquest.com/geocoding/v1/address?key=YOUR_KEY_HERE&location=Lancaster,PA&callback=renderGeocode
|
||||
http://platform.beta.mapquest.com/geocoding/v1/address?key=YOUR_KEY_HERE&callback=renderOptions&inFormat=kvp&outFormat=json&location=77 rue lost al lann, 29000 quimper,france
|
||||
|
||||
Client ID: 83955
|
||||
Email Address: buzuk77@aim.com
|
||||
Registry Password: tU2cA4qV
|
||||
Forums User Name:
|
||||
JS/AS3 Key: Fmjtd%7Clu61nuuzlu%2Cr0%3Do5-5a1sd
|
||||
*/
|
||||
Client ID: 83955
|
||||
Email Address: buzuk77@aim.com
|
||||
Registry Password: tU2cA4qV
|
||||
Forums User Name:
|
||||
JS/AS3 Key: Fmjtd%7Clu61nuuzlu%2Cr0%3Do5-5a1sd
|
||||
*/
|
||||
|
||||
/*
|
||||
GeoCodingHandler.ashx?addr=
|
||||
<wsdl:import namespace="http://dev.virtualearth.net/webservices/v1/imagery/contracts" location="http://dev.virtualearth.net/webservices/v1/metadata/imageryservice/imageryservice1.wsdl" />
|
||||
API keybing = 56D6CBA671C986D3EA11B1B48F97507BE9B46999
|
||||
*/
|
||||
/*
|
||||
GeoCodingHandler.ashx?addr=
|
||||
<wsdl:import namespace="http://dev.virtualearth.net/webservices/v1/imagery/contracts" location="http://dev.virtualearth.net/webservices/v1/metadata/imageryservice/imageryservice1.wsdl" />
|
||||
API keybing = 56D6CBA671C986D3EA11B1B48F97507BE9B46999
|
||||
*/
|
||||
public function geoCodeAdrCpVilleM($adresse,$cp,$ville,$pays='')
|
||||
{
|
||||
if ($pays=='') $pays='France';
|
||||
@ -594,16 +594,16 @@ API keybing = 56D6CBA671C986D3EA11B1B48F97507BE9B46999
|
||||
|
||||
|
||||
/*
|
||||
0 Unknown location. (Since 2.59)
|
||||
1 Country level accuracy. (Since 2.59)
|
||||
2 Region (state, province, prefecture, etc.) level accuracy. (Since 2.59)
|
||||
3 Sub-region (county, municipality, etc.) level accuracy. (Since 2.59)
|
||||
4 Town (city, village) level accuracy. (Since 2.59)
|
||||
5 Post code (zip code) level accuracy. (Since 2.59)
|
||||
6 Street level accuracy. (Since 2.59)
|
||||
7 Intersection level accuracy. (Since 2.59)
|
||||
8 Address level accuracy. (Since 2.59)
|
||||
*/
|
||||
0 Unknown location. (Since 2.59)
|
||||
1 Country level accuracy. (Since 2.59)
|
||||
2 Region (state, province, prefecture, etc.) level accuracy. (Since 2.59)
|
||||
3 Sub-region (county, municipality, etc.) level accuracy. (Since 2.59)
|
||||
4 Town (city, village) level accuracy. (Since 2.59)
|
||||
5 Post code (zip code) level accuracy. (Since 2.59)
|
||||
6 Street level accuracy. (Since 2.59)
|
||||
7 Intersection level accuracy. (Since 2.59)
|
||||
8 Address level accuracy. (Since 2.59)
|
||||
*/
|
||||
$this->latitudeDec=@$result->location->coordinates->y;
|
||||
$this->longitudeDec=@$result->location->coordinates->x;
|
||||
$this->latitudeDeg=dec2dms($this->latitudeDec);
|
||||
@ -718,7 +718,7 @@ API keybing = 56D6CBA671C986D3EA11B1B48F97507BE9B46999
|
||||
<latitude>48.281769</latitude><longitude>4.09041</longitude><offsetlat>48.281731</offsetlat><offsetlon>4.09047</offsetlon><radius>400</radius>
|
||||
<name/><line1>38B, Rue Maurice Romagon</line1><line2>10800 Saint-Julien-les-Villas</line2><line3/><line4>France</line4><house>38B</house><street>Rue Maurice Romagon</street><xstreet/>
|
||||
<unittype/><unit/><postal>10800</postal><neighborhood/><city>Saint-Julien-les-Villas</city><county>Aube</county><state>Champagne-Ardenne</state><country>France</country><countrycode>FR</countrycode><statecode/><countycode>10</countycode><uzip>10800</uzip><hash>D49A3CF6AD6DEB1C</hash><woeid>12722975</woeid><woetype>11</woetype></Result></results></query><!-- total: 49 -->
|
||||
<!-- engine4.yql.bf1.yahoo.com -->
|
||||
<!-- engine4.yql.bf1.yahoo.com -->
|
||||
|
||||
*/
|
||||
|
||||
@ -936,24 +936,28 @@ API keybing = 56D6CBA671C986D3EA11B1B48F97507BE9B46999
|
||||
return false;
|
||||
}
|
||||
|
||||
/** Géocodage d'une adresse
|
||||
0 Unknown location. (Since 2.59)
|
||||
1 Country level accuracy. (Since 2.59)
|
||||
2 Region (state, province, prefecture, etc.) level accuracy. (Since 2.59)
|
||||
3 Sub-region (county, municipality, etc.) level accuracy. (Since 2.59)
|
||||
4 Town (city, village) level accuracy. (Since 2.59)
|
||||
5 Post code (zip code) level accuracy. (Since 2.59)
|
||||
6 Street level accuracy. (Since 2.59)
|
||||
7 Intersection level accuracy. (Since 2.59)
|
||||
8 Address level accuracy. (Since 2.59)
|
||||
9 Address level accuracy +++
|
||||
**/
|
||||
function geoCodeAdresse($adrNum, $adrIndRep, $adrTypeVoieCourt, $adrTypeVoieLong, $adrLibVoie, $cp, $ville='', $pays='France', $codeRivoli='')
|
||||
/** Géocodage d'une adresse
|
||||
0 Unknown location. (Since 2.59)
|
||||
1 Country level accuracy. (Since 2.59)
|
||||
2 Region (state, province, prefecture, etc.) level accuracy. (Since 2.59)
|
||||
3 Sub-region (county, municipality, etc.) level accuracy. (Since 2.59)
|
||||
4 Town (city, village) level accuracy. (Since 2.59)
|
||||
5 Post code (zip code) level accuracy. (Since 2.59)
|
||||
6 Street level accuracy. (Since 2.59)
|
||||
7 Intersection level accuracy. (Since 2.59)
|
||||
8 Address level accuracy. (Since 2.59)
|
||||
9 Address level accuracy +++
|
||||
**/
|
||||
public function geoCodeAdresse($adrNum, $adrIndRep, $adrTypeVoieCourt, $adrTypeVoieLong, $adrLibVoie, $cp, $ville='', $pays='France', $codeRivoli='')
|
||||
{
|
||||
$tabRep=array();
|
||||
$adresse=addslashes(trim(preg_replace('/ +/',' ', "$adrNum $adrIndRep $adrTypeVoieLong $adrLibVoie")));
|
||||
$ville=addslashes($ville);
|
||||
$ret=$this->iDb->select('zonageXY', 'lat, lon, l93_x, l93_y, alt, precis, adresseValidee, dateInsert', "address='$adresse' AND adr_cp='$cp' AND adr_ville='$ville'",false, MYSQL_ASSOC);
|
||||
$ret = $this->iDb->select('zonageXY',
|
||||
'lat, lon, l93_x, l93_y, alt, precis, adresseValidee, dateInsert',
|
||||
"address='$adresse' AND adr_cp='$cp' AND adr_ville='$ville'", false, MYSQL_ASSOC);
|
||||
|
||||
//Existe dans la base
|
||||
if (count($ret)>0) {
|
||||
$zonage=$ret[0];
|
||||
$this->precision=$zonage['precis']*1;
|
||||
@ -975,18 +979,23 @@ API keybing = 56D6CBA671C986D3EA11B1B48F97507BE9B46999
|
||||
$this->l93y=$tmp['y_93'];
|
||||
}
|
||||
if ($this->altitude<>NULL || $this->l93x<>NULL) {
|
||||
$tabUpdate=array( 'alt'=>$this->altitude,
|
||||
'l93_x'=>$this->l93x,
|
||||
'l93_y'=>$this->l93y);
|
||||
//'dateUpdate'=>DATETIME,
|
||||
$this->iDb->update('zonageXY', $tabUpdate, "address='$adresse' AND adr_cp='$cp' AND adr_ville='$ville'");
|
||||
$tabUpdate=array(
|
||||
'alt'=>$this->altitude,
|
||||
'l93_x'=>$this->l93x,
|
||||
'l93_y'=>$this->l93y
|
||||
);
|
||||
$this->iDb->update('zonageXY', $tabUpdate, "address='$adresse' AND adr_cp='$cp' AND adr_ville='$ville'");
|
||||
}
|
||||
|
||||
$this->latitudeDeg=dec2dms($this->latitudeDec);
|
||||
$this->longitudeDeg=dec2dms($this->longitudeDec);
|
||||
$this->latitudeDeg = dec2dms($this->latitudeDec);
|
||||
$this->longitudeDeg = dec2dms($this->longitudeDec);
|
||||
$this->enCache=true;
|
||||
$ligne='En base : '.print_r($zonage, true);
|
||||
} elseif ($this->accesDist) {
|
||||
}
|
||||
|
||||
//Acces Distant
|
||||
elseif ($this->accesDist)
|
||||
{
|
||||
$this->enCache=false;
|
||||
$retG=$retY=$retC=$retM=false;
|
||||
if (substr($codeRivoli,0,3)*1==971) $pays='Guadeloupe';
|
||||
@ -1072,17 +1081,6 @@ API keybing = 56D6CBA671C986D3EA11B1B48F97507BE9B46999
|
||||
}
|
||||
}
|
||||
}
|
||||
/* if (latnorth == 'S') latdir='-'
|
||||
if (lonwest == 'W') longdir='-'
|
||||
latdec=Math.round(lat1)+lat2/60
|
||||
londec=Math.round(long1)+long2/60
|
||||
gmdatalat=latdir+latdec.toFixed(6)
|
||||
gmdatalon=longdir+londec.toFixed(6)
|
||||
//GM_log( 'Latdec:'+gmdatalat+' LongDec:'+gmdatalon)
|
||||
gmx=gmdatalat*Math.pow(10,6)
|
||||
gmy=gmdatalon*Math.pow(10,6)
|
||||
if (gmx < 0) gmx=gmx+Math.pow(2,32)*/
|
||||
|
||||
|
||||
/** Retourne la distance en kilomètres entre 2 coordonnées GPS à la surface de la terre
|
||||
**
|
||||
|
@ -383,7 +383,11 @@ class MRncs
|
||||
else $strSql=" AND siege=1 ORDER BY actif DESC, nic DESC";
|
||||
|
||||
$rep=$this->iDb->select('rncs_etab', 'siren, nic, siege, actif, enseigne, nomCommercial, adrNumVoie, adrIndRep, adrLibVoie, adrTypeVoie, adrVoie, cp, commune, adrComp, adresse1, adresse2, adresse3, naf, dateFermeture, flux, DATE(dateUpdate) AS jourUpdate', "siren=$siren $strSql", false, MYSQL_ASSOC);
|
||||
$entrep=$rep[0];
|
||||
if ( count($rep)==0 ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$entrep = $rep[0];
|
||||
|
||||
if ($entrep['jourUpdate']<>'0000-00-00') $dateMaj=$entrep['jourUpdate'];
|
||||
else $dateMaj=$entrep['flux'];
|
||||
@ -394,29 +398,31 @@ class MRncs
|
||||
else $adresse2=trim(strtoupper($entrep['adresse2']));
|
||||
if (trim($entrep['adresse3'])=='') $adresse3='';
|
||||
else $adresse3=trim(strtoupper($entrep['adresse3']));
|
||||
$tabIdentite=array( 'siren' => $entrep['siren'],
|
||||
'nic' => $entrep['nic'],
|
||||
'siret' => $entrep['siren'].$entrep['nic'],
|
||||
'actif' => $entrep['actif'],
|
||||
'actifEt' => $entrep['actif'],
|
||||
'siege' => $entrep['siege'],
|
||||
'enseigne' => strtoupper($entrep['enseigne']),
|
||||
'nomCommercial' => strtoupper($entrep['nomCommercial']),
|
||||
'adrNumVoie' => $entrep['adrNumVoie'],
|
||||
'adrIndRep' => strtoupper($entrep['adrIndRep']),
|
||||
'adrTypeVoie' => strtoupper($entrep['adrTypeVoie']),
|
||||
'adrVoie' => strtoupper($entrep['adrVoie']),
|
||||
'adrComp' => strtoupper($entrep['adrComp']),
|
||||
'cp' => strtoupper($entrep['cp']),
|
||||
'commune' => strtoupper($entrep['commune']),
|
||||
'adresse1' => $adresse1,
|
||||
'adresse2' => $adresse2,
|
||||
'adresse3' => $adresse3,
|
||||
'nafEtab' => $entrep['naf'],
|
||||
'nafEtabLib' => $this->getLibelleNaf($entrep['naf']),
|
||||
'dateFerEtab' => $entrep['dateFermeture'],
|
||||
'dateMajEtab' => $dateMaj,
|
||||
);
|
||||
$tabIdentite=array(
|
||||
'siren' => $entrep['siren'],
|
||||
'nic' => $entrep['nic'],
|
||||
'siret' => $entrep['siren'].$entrep['nic'],
|
||||
'actif' => $entrep['actif'],
|
||||
'actifEt' => $entrep['actif'],
|
||||
'siege' => $entrep['siege'],
|
||||
'enseigne' => strtoupper($entrep['enseigne']),
|
||||
'nomCommercial' => strtoupper($entrep['nomCommercial']),
|
||||
'adrNumVoie' => $entrep['adrNumVoie'],
|
||||
'adrIndRep' => strtoupper($entrep['adrIndRep']),
|
||||
'adrLibVoie' => strtoupper($entrep['adrLibVoie']),
|
||||
'adrTypeVoie' => strtoupper($entrep['adrTypeVoie']),
|
||||
'adrVoie' => strtoupper($entrep['adrVoie']),
|
||||
'adrComp' => strtoupper($entrep['adrComp']),
|
||||
'cp' => strtoupper($entrep['cp']),
|
||||
'commune' => strtoupper($entrep['commune']),
|
||||
'adresse1' => $adresse1,
|
||||
'adresse2' => $adresse2,
|
||||
'adresse3' => $adresse3,
|
||||
'nafEtab' => $entrep['naf'],
|
||||
'nafEtabLib' => $this->getLibelleNaf($entrep['naf']),
|
||||
'dateFerEtab' => $entrep['dateFermeture'],
|
||||
'dateMajEtab' => $dateMaj,
|
||||
);
|
||||
return array_merge($tabIdentite, $this->getInfosEntrep($siren));
|
||||
}
|
||||
|
||||
@ -429,44 +435,48 @@ class MRncs
|
||||
{
|
||||
$siren=$siren*1;
|
||||
$rep=$this->iDb->select('rncs_entrep', 'siren, sirenValide, actif, numGreffe, triCode, triId, numRC, numRC2, raisonSociale, nom, prenom, nomUsage, sigle, dateNaiss, lieuNaiss, sexe, nationalite, pays, naf, cj, capitalMontant, capitalDevise, capitalDevIso, dateImma, dateRad, capitalType, capitalCent, provisoires, flux, DATE(dateUpdate) AS jourUpdate', "siren=$siren", false, MYSQL_ASSOC);
|
||||
$entrep=$rep[0];
|
||||
|
||||
if ($entrep['jourUpdate']<>'0000-00-00') $dateMaj=$entrep['jourUpdate'];
|
||||
else $dateMaj=$entrep['flux'];
|
||||
if (count($rep)>0) {
|
||||
$entrep=$rep[0];
|
||||
|
||||
$tabIdentite=array(
|
||||
'siren' => $entrep['siren'],
|
||||
'sirenValide' => $entrep['sirenValide'],
|
||||
'actif' => $entrep['actif'],
|
||||
'actifEn' => $entrep['actif'],
|
||||
'numGreffe' => $entrep['numGreffe'],
|
||||
'triCode' => $entrep['triCode'],
|
||||
'triId' => $entrep['triId'],
|
||||
'libGreffe' => preg_replace('/^(TC |TGI |TGIcc |TMX |Tribunal Inconnu)/Ui','', $this->getLibTribunal($entrep['numGreffe']*1)),
|
||||
'numRC' => $entrep['numRC2'],
|
||||
'raisonSociale' => strtoupper($entrep['raisonSociale']),
|
||||
'nom' => strtoupper($entrep['nom']),
|
||||
'prenom' => strtoupper($entrep['prenom']),
|
||||
'nomUsage' => strtoupper($entrep['nomUsage']),
|
||||
'sigle' => strtoupper($entrep['sigle']),
|
||||
'dateNaiss' => $entrep['dateNaiss'],
|
||||
'lieuNaiss' => strtoupper($entrep['lieuNaiss']),
|
||||
'sexe' => $entrep['sexe'],
|
||||
'pays' => $entrep['pays'],
|
||||
'cj' => $entrep['cj'],
|
||||
'cjLib' => $this->getLibelleFJ($entrep['cj']),
|
||||
'nafEnt' => $entrep['naf'],
|
||||
'nafEntLib' => $this->getLibelleNaf($entrep['naf']),
|
||||
'capital' => $entrep['capitalMontant']+($entrep['capitalCent']/100),
|
||||
'capitalDev' => $entrep['capitalDevIso'],
|
||||
'capitalType' => $entrep['capitalType'],
|
||||
'dateImma' => $entrep['dateImma'],
|
||||
'dateRad' => $entrep['dateRad'],
|
||||
'provisoires' => $entrep['provisoires'],
|
||||
'dateMajEnt' => $dateMaj,
|
||||
);
|
||||
if ($entrep['jourUpdate']<>'0000-00-00') $dateMaj=$entrep['jourUpdate'];
|
||||
else $dateMaj=$entrep['flux'];
|
||||
|
||||
return $tabIdentite;
|
||||
$tabIdentite = array(
|
||||
'siren' => $entrep['siren'],
|
||||
'sirenValide' => $entrep['sirenValide'],
|
||||
'actif' => $entrep['actif'],
|
||||
'actifEn' => $entrep['actif'],
|
||||
'numGreffe' => $entrep['numGreffe'],
|
||||
'triCode' => $entrep['triCode'],
|
||||
'triId' => $entrep['triId'],
|
||||
'libGreffe' => preg_replace('/^(TC |TGI |TGIcc |TMX |Tribunal Inconnu)/Ui','', $this->getLibTribunal($entrep['numGreffe']*1)),
|
||||
'numRC' => $entrep['numRC2'],
|
||||
'raisonSociale' => strtoupper($entrep['raisonSociale']),
|
||||
'nom' => strtoupper($entrep['nom']),
|
||||
'prenom' => strtoupper($entrep['prenom']),
|
||||
'nomUsage' => strtoupper($entrep['nomUsage']),
|
||||
'sigle' => strtoupper($entrep['sigle']),
|
||||
'dateNaiss' => $entrep['dateNaiss'],
|
||||
'lieuNaiss' => strtoupper($entrep['lieuNaiss']),
|
||||
'sexe' => $entrep['sexe'],
|
||||
'pays' => $entrep['pays'],
|
||||
'cj' => $entrep['cj'],
|
||||
'cjLib' => $this->getLibelleFJ($entrep['cj']),
|
||||
'nafEnt' => $entrep['naf'],
|
||||
'nafEntLib' => $this->getLibelleNaf($entrep['naf']),
|
||||
'capital' => $entrep['capitalMontant']+($entrep['capitalCent']/100),
|
||||
'capitalDev' => $entrep['capitalDevIso'],
|
||||
'capitalType' => $entrep['capitalType'],
|
||||
'dateImma' => $entrep['dateImma'],
|
||||
'dateRad' => $entrep['dateRad'],
|
||||
'provisoires' => $entrep['provisoires'],
|
||||
'dateMajEnt' => $dateMaj,
|
||||
);
|
||||
|
||||
return $tabIdentite;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -477,7 +487,7 @@ class MRncs
|
||||
*/
|
||||
public function getListeDepots($siren, $dateDepot = null)
|
||||
{
|
||||
$where = "e.siren=$siren ORDER BY e.dateDepot DESC";
|
||||
$where = "e.siren=$siren ORDER BY e.dateDepot DESC, e.codeInterne ASC";
|
||||
if (null != $dateDepot) {
|
||||
$where = "e.siren=$siren AND e.dateDepot='$dateDepot'";
|
||||
}
|
||||
@ -511,59 +521,61 @@ class MRncs
|
||||
public function getListeJugements($siren)
|
||||
{
|
||||
$siren=$siren*1;
|
||||
$rep=$this->iDb->select('rncs_jugements j, tabJugeRncs l, tabEvenements e',
|
||||
'siren, j.dateEffet, j.codeJugement, j.flux, l.libJugement, e.codEven, e.libEven,
|
||||
adm1id, adm1codeFct, adm1type, adm1nom, adm1adrNum, adm1adrInd, adm1adrType, adm1adrLibVoie, adm1adrVoie, adm1adr1, adm1adr2, adm1adr3, adm1adrCP, adm1adrVille,
|
||||
adm2id, adm2codeFct, adm2type, adm2nom, adm2adrNum, adm2adrInd, adm2adrType, adm2adrLibVoie, adm2adrVoie, adm2adr1, adm2adr2, adm2adr3, adm2adrCP, adm2adrVille',
|
||||
"j.siren=$siren AND j.codeJugement=l.codJugement AND l.codEven=e.codEven ORDER BY j.dateEffet DESC", false, MYSQL_ASSOC);
|
||||
/*adm1adrNum adm1adrInd adm1adrType adm1adrLibVoie adm1adrVoie adm1adr1 adm1adr2 adm1adr3 adm1adrCP adm1adrVille adm2codeFct adm2type adm2id adm2nom adm2adrNum adm2adrInd adm2adrType adm2adrLibVoie adm2adrVoie adm2adr1 adm2adr2 adm2adr3 adm2adrCP adm2adrVille flux dateSuppr dateInsert
|
||||
Modifier Effacer 490524055 2010-12-20 11 1 1200 4000 A 0 ME TULIER 0000 IMM LE MAZIERE 4EME ETAGE Immeuble le Mazière - 4ème étage rue René Cassin */
|
||||
$rep=$this->iDb->select(
|
||||
'rncs_jugements j, tabJugeRncs l, tabEvenements e',
|
||||
'siren, j.dateEffet, j.codeJugement, j.flux, l.libJugement, e.codEven, e.libEven,
|
||||
adm1id, adm1codeFct, adm1type, adm1nom, adm1adrNum, adm1adrInd, adm1adrType, adm1adrLibVoie, adm1adrVoie, adm1adr1, adm1adr2, adm1adr3, adm1adrCP, adm1adrVille,
|
||||
adm2id, adm2codeFct, adm2type, adm2nom, adm2adrNum, adm2adrInd, adm2adrType, adm2adrLibVoie, adm2adrVoie, adm2adr1, adm2adr2, adm2adr3, adm2adrCP, adm2adrVille',
|
||||
"j.siren=$siren AND j.codeJugement=l.codJugement AND l.codEven=e.codEven ORDER BY j.dateEffet DESC", false, MYSQL_ASSOC);
|
||||
$tabDepots=array();
|
||||
foreach ($rep as $iDepot=>$depot) {
|
||||
$tabDepots[]=array( 'codEven' => $depot['codEven'],
|
||||
'libEven' => $depot['libEven'],
|
||||
'dateEffet' => $depot['dateEffet'],
|
||||
'adm1id' => $depot['adm1id'],
|
||||
'adm1code' => $depot['adm1codeFct'],
|
||||
'adm1type' => $depot['adm1type'],
|
||||
'adm1fonction' => @$this->getLibFctDir($depot['adm1codeFct']),
|
||||
'adm1nom' => $depot['adm1nom'],
|
||||
'adm1adrNum' => $depot['adm1adrNum'],
|
||||
'adm1adrInd' => $depot['adm1adrInd'],
|
||||
'adm1adrType' => $depot['adm1adrType'],
|
||||
'adm1adrVoie' => $depot['adm1adrLibVoie'], // @todo : adm1adr1, , adm1adr3,
|
||||
'adm1adr2' => $depot['adm1adr2'],
|
||||
'adm1adrCP' => $depot['adm1adrCP'],
|
||||
'adm1adrVille' => $depot['adm1adrVille'],
|
||||
'adm2id' => $depot['adm2id'],
|
||||
'adm2code' => $depot['adm2codeFct'],
|
||||
'adm2type' => $depot['adm2type'],
|
||||
'adm2fonction' => @$this->getLibFctDir($depot['adm2codeFct']),
|
||||
'adm2nom' => $depot['adm2nom'],
|
||||
'adm2adrNum' => $depot['adm2adrNum'],
|
||||
'adm2adrInd' => $depot['adm2adrInd'],
|
||||
'adm2adrType' => $depot['adm2adrType'],
|
||||
'adm2adrVoie' => $depot['adm2adrLibVoie'], // @todo : adm1adr1, adm1adr2, adm1adr3,
|
||||
'adm2adr2' => $depot['adm2adr2'],
|
||||
'adm2adrCP' => $depot['adm2adrCP'],
|
||||
'adm2adrVille' => $depot['adm2adrVille'],
|
||||
);
|
||||
$tabDepots[]=array(
|
||||
'codEven' => $depot['codEven'],
|
||||
'libEven' => $depot['libEven'],
|
||||
'dateEffet' => $depot['dateEffet'],
|
||||
'adm1id' => $depot['adm1id'],
|
||||
'adm1code' => $depot['adm1codeFct'],
|
||||
'adm1type' => $depot['adm1type'],
|
||||
'adm1fonction' => @$this->getLibFctDir($depot['adm1codeFct']),
|
||||
'adm1nom' => $depot['adm1nom'],
|
||||
'adm1adrNum' => $depot['adm1adrNum'],
|
||||
'adm1adrInd' => $depot['adm1adrInd'],
|
||||
'adm1adrType' => $depot['adm1adrType'],
|
||||
'adm1adrVoie' => $depot['adm1adrLibVoie'], // @todo : adm1adr1, , adm1adr3,
|
||||
'adm1adr2' => $depot['adm1adr2'],
|
||||
'adm1adrCP' => $depot['adm1adrCP'],
|
||||
'adm1adrVille' => $depot['adm1adrVille'],
|
||||
'adm2id' => $depot['adm2id'],
|
||||
'adm2code' => $depot['adm2codeFct'],
|
||||
'adm2type' => $depot['adm2type'],
|
||||
'adm2fonction' => @$this->getLibFctDir($depot['adm2codeFct']),
|
||||
'adm2nom' => $depot['adm2nom'],
|
||||
'adm2adrNum' => $depot['adm2adrNum'],
|
||||
'adm2adrInd' => $depot['adm2adrInd'],
|
||||
'adm2adrType' => $depot['adm2adrType'],
|
||||
'adm2adrVoie' => $depot['adm2adrLibVoie'], // @todo : adm1adr1, adm1adr2, adm1adr3,
|
||||
'adm2adr2' => $depot['adm2adr2'],
|
||||
'adm2adrCP' => $depot['adm2adrCP'],
|
||||
'adm2adrVille' => $depot['adm2adrVille'],
|
||||
);
|
||||
}
|
||||
return $tabDepots;
|
||||
}
|
||||
|
||||
public function getEvenements($siren, $nic=0, $type='', $dateDeb='', $dateFin='') {
|
||||
$tabEven=array( 'p120'=>'Réactivation de l\'entreprise',
|
||||
'p410'=>'Cessation juridique de l\'entreprise',
|
||||
'pCAP'=>'Modification du capital social',
|
||||
'pCAT'=>'Modification du type de capital',
|
||||
'pCJ' =>'Modification de la forme juridique',
|
||||
'pIMM'=>'Modification de la date d\'immatriculation',
|
||||
'pRAD'=>'Modification de la date de radiation',
|
||||
'pNTR'=>'Modification du greffe d\'enregistrement',
|
||||
'pNRC'=>'Modification du numéro du RC',
|
||||
'pNOM'=>'Modification de la dénomination',
|
||||
);
|
||||
public function getEvenements($siren, $nic=0, $type='', $dateDeb='', $dateFin='')
|
||||
{
|
||||
$tabEven=array(
|
||||
'p120'=>'Réactivation de l\'entreprise',
|
||||
'p410'=>'Cessation juridique de l\'entreprise',
|
||||
'pCAP'=>'Modification du capital social',
|
||||
'pCAT'=>'Modification du type de capital',
|
||||
'pCJ' =>'Modification de la forme juridique',
|
||||
'pIMM'=>'Modification de la date d\'immatriculation',
|
||||
'pRAD'=>'Modification de la date de radiation',
|
||||
'pNTR'=>'Modification du greffe d\'enregistrement',
|
||||
'pNRC'=>'Modification du numéro du RC',
|
||||
'pNOM'=>'Modification de la dénomination',
|
||||
);
|
||||
$tabRet=array();
|
||||
$siren=$siren*1;
|
||||
if ($nic>0) $strNic =" AND nic=$nic ";
|
||||
@ -571,9 +583,10 @@ class MRncs
|
||||
if ($dateDeb<>'') $strDateDeb=" AND flux>='$dateDeb' ";
|
||||
if ($dateFin<>'') $strDateFin=" AND flux<='$dateFin' ";
|
||||
|
||||
$rep=$this->iDb->select('rncs_modifs',
|
||||
'siren, nic, `table`, champs, valeur, flux, dateInsert',
|
||||
"siren=$siren $strNic $strType $strDateDeb $strDateFin AND `table`='rncs_entrep' ORDER BY flux DESC", false, MYSQL_ASSOC);
|
||||
$rep=$this->iDb->select(
|
||||
'rncs_modifs',
|
||||
'siren, nic, `table`, champs, valeur, flux, dateInsert',
|
||||
"siren=$siren $strNic $strType $strDateDeb $strDateFin AND `table`='rncs_entrep' ORDER BY flux DESC", false, MYSQL_ASSOC);
|
||||
foreach ($rep as $iModif=>$modif) {
|
||||
$codEve=array();
|
||||
switch($modif['champs']) {
|
||||
@ -590,21 +603,24 @@ class MRncs
|
||||
case 'numGreffe': $codEve[]='NTR'; break;
|
||||
case 'numRC2': $codEve[]='NRC'; break;
|
||||
}
|
||||
foreach ($codEve as $even)
|
||||
$tabRet[]=array('codeEven' => 'P'.$even,
|
||||
'nic' => 0,
|
||||
'siretAssocie'=>0,
|
||||
'typeSiretAss'=>0,
|
||||
'siege' => 1,
|
||||
'libEven' => $tabEven['p'.trim($even)],
|
||||
'libEvenDet'=> '',
|
||||
'dateMAJ' => $modif['dateInsert'],
|
||||
'dateEven' => $modif['flux'],
|
||||
);
|
||||
foreach ($codEve as $even) {
|
||||
$tabRet[]=array(
|
||||
'codeEven' => 'P'.$even,
|
||||
'nic' => 0,
|
||||
'siretAssocie'=>0,
|
||||
'typeSiretAss'=>0,
|
||||
'siege' => 1,
|
||||
'libEven' => $tabEven['p'.trim($even)],
|
||||
'libEvenDet'=> '',
|
||||
'dateMAJ' => $modif['dateInsert'],
|
||||
'dateEven' => $modif['flux'],
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function getIntervenants($siren) {
|
||||
public function getIntervenants($siren)
|
||||
{
|
||||
$tabJuge=$this->getListeJugements($siren);
|
||||
$tabDepots=$tabDeja=array();
|
||||
$tabAdm=array( 'A'=>'Administrateur judiciaire',
|
||||
|
@ -1,4 +1,8 @@
|
||||
<?php
|
||||
require_once 'framework/common/mysql.php';
|
||||
require_once 'framework/common/curl.php';
|
||||
require_once 'framework/common/strings.php';
|
||||
|
||||
class MTel
|
||||
{
|
||||
public $body = '';
|
||||
@ -31,7 +35,6 @@ class MTel
|
||||
} else {
|
||||
$this->iDb = $db;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -73,9 +76,8 @@ class MTel
|
||||
'telephonie',
|
||||
'siren,nic,dateProvPartenaire,typeTel,infoTel,LPAD(telephone,10,0) AS telephone,actif,partenaire,idUtilisateur,dateInsert,dateInsert*1 AS dateInsertYmd,dateConfPartenaire,partenaireConf,nbConf,idUpdate,dateUpdate,dateUpdate*1 AS dateUpdateYmd',
|
||||
"siren=$siren $strNic $strActif AND dateSuppr=0 ORDER BY typeTel ASC, nbConf DESC", false, MYSQL_ASSOC);
|
||||
|
||||
if (count($ret)>0) {
|
||||
|
||||
if (count($ret)>0)
|
||||
{
|
||||
$this->enCache=true;
|
||||
foreach ($ret as $tabTel)
|
||||
{
|
||||
@ -113,8 +115,9 @@ class MTel
|
||||
}
|
||||
}
|
||||
|
||||
} elseif ($this->accesDistant) {
|
||||
|
||||
}
|
||||
elseif ($this->accesDistant)
|
||||
{
|
||||
$this->enCache=false;
|
||||
$tabPost = array(
|
||||
'p_ACTION'=>'',
|
||||
@ -240,8 +243,10 @@ class MTel
|
||||
);
|
||||
}
|
||||
|
||||
if (preg_match_all('/<tr>(?:.*)<th>(?:.*)<span>(.*)(tél|fax)(?:.*)<\/span>(?:.*)<\/th>(?:.*)<td>(?:.*)<span>(.*)<\/span>(?:.*)<\/td>(?:.*)<\/tr>/Uis', $body, $matches)) {
|
||||
foreach ($matches[2] as $j=>$tmp) {
|
||||
if (preg_match_all('/<tr>(?:.*)<th>(?:.*)<span>(.*)(tél|fax)(?:.*)<\/span>(?:.*)<\/th>(?:.*)<td>(?:.*)<span>(.*)<\/span>(?:.*)<\/td>(?:.*)<\/tr>/Uis', $body, $matches))
|
||||
{
|
||||
foreach ($matches[2] as $j=>$tmp)
|
||||
{
|
||||
$lib=$tmp;
|
||||
$precis=trim(strtr($matches[1][$j], array('-'=>' ')));
|
||||
$num=trim(strtr($matches[3][$j],array(' '=>'','<br />'=>'')));
|
||||
@ -249,8 +254,8 @@ class MTel
|
||||
}
|
||||
$tabTel=array_values($tabTel);
|
||||
|
||||
|
||||
foreach ($tabTel as $tabT) {
|
||||
foreach ($tabTel as $tabT)
|
||||
{
|
||||
$tabRet[]=array(
|
||||
'siren'=>$siren,
|
||||
'nic'=>substr($res['siret'],-5),
|
||||
@ -275,7 +280,8 @@ class MTel
|
||||
}
|
||||
}
|
||||
|
||||
if ($last) {
|
||||
if ($last)
|
||||
{
|
||||
$tabRet=array();
|
||||
foreach($tabLast as $typeTel=>$tabPriorite) {
|
||||
ksort($tabPriorite);
|
||||
|
@ -617,8 +617,8 @@ function calculIndiScore($siren, $nic=0, $accesDist=false, $cycleClient=2, $mail
|
||||
$NIVEAU=$cycleClient; // 1, 2, 3 ou 5 Niveau de version des commentaires
|
||||
|
||||
$iDb = new WDB();
|
||||
$iRncs = new MRncs();
|
||||
$iInsee = new MInsee();
|
||||
$iRncs = new MRncs($iDb);
|
||||
$iInsee = new MInsee($iDb);
|
||||
$iInsee->AnnoncesInMemory = true;
|
||||
|
||||
/**
|
||||
@ -642,19 +642,6 @@ function calculIndiScore($siren, $nic=0, $accesDist=false, $cycleClient=2, $mail
|
||||
$genereComment = true;
|
||||
}
|
||||
|
||||
//Chargement des phrases de commentaires - @todo : Mettre en cache
|
||||
$tabCommentaires = $tabTri = $tabTriAff = array();
|
||||
switch( $type ) {
|
||||
case 'scores':
|
||||
$version = '414';
|
||||
require_once 'Metier/scores/Variables/CommentsIndiscore'.$version.'.php';
|
||||
break;
|
||||
case 'valo':
|
||||
$version = '26';
|
||||
require_once 'Metier/scores/Variables/CommentsValo'.$version.'.php';
|
||||
break;
|
||||
}
|
||||
|
||||
$classWdate = new WDate();
|
||||
|
||||
//Initialisation tabFormules depuis le cache
|
||||
@ -855,29 +842,6 @@ function calculIndiScore($siren, $nic=0, $accesDist=false, $cycleClient=2, $mail
|
||||
$depcomen=$tabIden80['insDEPCOMEN']*1;
|
||||
$TU=$tabIden80['insTU'];
|
||||
|
||||
/**
|
||||
* Solvabilité
|
||||
*/
|
||||
$isolv = new MSolvabilite($siren, $naf, $tabIdentite['EffEnTr'], $tabIdentite['Effectif']*1, $tabIdentite['CP'],
|
||||
$fj, $tabIdentite['Capital'], $tabIdentite['CapitalDev'], $tabIdentite['DateCreaEn'],
|
||||
$tabIdentite['DateCreaEt'], '', $RECME);//, $tabIdentite['Singularite']);
|
||||
$noteStructure=$isolv->getSolvabilite();
|
||||
$timer['solv']=microtime(true);
|
||||
|
||||
/**
|
||||
* Bilan - Liste des bilans
|
||||
*/
|
||||
$mBil=new MBilans($siren);
|
||||
$tabBilans=$mBil->listeBilans($accesDist);
|
||||
$NBBILAN=count($tabBilans);
|
||||
|
||||
/**
|
||||
* Calcul des ratios
|
||||
*/
|
||||
$tabBilan=$tabBil=array();
|
||||
if ($NBBILAN>0) $tabRatios = calculRatios($tabBilans, $tabIdentite, $accesDist);
|
||||
$timer['ratios']=microtime(true);
|
||||
|
||||
/**
|
||||
* Différences INSEE/RNCS
|
||||
*/
|
||||
@ -985,6 +949,20 @@ function calculIndiScore($siren, $nic=0, $accesDist=false, $cycleClient=2, $mail
|
||||
}
|
||||
*/
|
||||
|
||||
/**
|
||||
* Bilan - Liste des bilans
|
||||
*/
|
||||
$mBil = new MBilans($siren, $iDb);
|
||||
$tabBilans = $mBil->listeBilans($accesDist);
|
||||
$NBBILAN = count($tabBilans);
|
||||
|
||||
/**
|
||||
* Calcul des ratios
|
||||
*/
|
||||
$tabBilan=$tabBil=array();
|
||||
if ($NBBILAN>0) $tabRatios = calculRatios($tabBilans, $tabIdentite, $accesDist);
|
||||
$timer['ratios']=microtime(true);
|
||||
|
||||
// Tableau des années de bilans
|
||||
$tabAnnees=array();
|
||||
// Tableau d'infos sur les bilans
|
||||
@ -1910,7 +1888,16 @@ function calculIndiScore($siren, $nic=0, $accesDist=false, $cycleClient=2, $mail
|
||||
elseif ($depcomen>96000) $DEPSIE=substr($depcomen,0,3);
|
||||
elseif ($depcomen<10000) $DEPSIE=substr($depcomen,0,1);
|
||||
else $DEPSIE=substr($depcomen,0,2);
|
||||
$DEPSIE_DE=$iInsee->getDepartement($DEPSIE,true);
|
||||
$DEPSIE_DE=$iInsee->getDepartement($DEPSIE,true);
|
||||
|
||||
/**
|
||||
* Solvabilité
|
||||
*/
|
||||
$isolv = new MSolvabilite($siren, $naf, $tabIdentite['EffEnTr'], $tabIdentite['Effectif']*1, $tabIdentite['CP'],
|
||||
$fj, $tabIdentite['Capital'], $tabIdentite['CapitalDev'], $tabIdentite['DateCreaEn'],
|
||||
$tabIdentite['DateCreaEt'], '', $RECME);//, $tabIdentite['Singularite']);
|
||||
$noteStructure=$isolv->getSolvabilite();
|
||||
$timer['solv']=microtime(true);
|
||||
|
||||
$tabStructure['activite']= $isolv->getPtActivite();
|
||||
$tabStructure['naf4']= $isolv->getNaf4($naf);
|
||||
@ -1960,18 +1947,8 @@ function calculIndiScore($siren, $nic=0, $accesDist=false, $cycleClient=2, $mail
|
||||
}
|
||||
$timer['importexport']=microtime(true);
|
||||
|
||||
/** Sauvegarde des valeurs propres à l'entreprise, à causes des variables globales de calculRatios **/
|
||||
$tabSav=array(
|
||||
'mBil'=> $mBil,
|
||||
'tabBilan'=>$tabBilan,
|
||||
'tabBil'=> $tabBil,
|
||||
'efftr'=> $efftr
|
||||
);
|
||||
|
||||
/** Recherche d'une annonce de RJ sur Actionnaire / Participation **/
|
||||
$RJMERE=$RJFILLE=false;
|
||||
|
||||
$nbBilansA=0;
|
||||
$SITUACT=$NICMERE=$SIRENMERE=$SIRETMERE=$NOMMERE='';
|
||||
|
||||
$lienM = new MLiens2($siren, 'siren');
|
||||
@ -1979,9 +1956,11 @@ function calculIndiScore($siren, $nic=0, $accesDist=false, $cycleClient=2, $mail
|
||||
//Actionnaire
|
||||
$tabA = $lienM->getActionnaires(null, true);
|
||||
if (count($tabA)>0) {
|
||||
foreach ($tabA as $i=>$lien) {
|
||||
foreach ($tabA as $i=>$lien)
|
||||
{
|
||||
$lienInsee = new MInsee();
|
||||
if(intval($lien->siren)>100 && ( $lien->MajMin=='+' || $lien->PDetention>50) && $nbBilansA==0) {
|
||||
if(intval($lien->siren)>100 && ( $lien->MajMin=='+' || $lien->PDetention>50))
|
||||
{
|
||||
$tabIdentiteA=$lienInsee->getIdentiteLight($lien->siren);
|
||||
if ($NICMERE*1==0) {
|
||||
$NICMERE=substr($tabIdentiteA['SiretSiege'],-5);
|
||||
@ -1993,26 +1972,22 @@ function calculIndiScore($siren, $nic=0, $accesDist=false, $cycleClient=2, $mail
|
||||
else
|
||||
$TYPEMERE='PM';
|
||||
}
|
||||
$mBil=new MBilans($lien->siren);
|
||||
$tabBilansA=$mBil->listeBilans(false,2);
|
||||
$nbBilansA=count($tabBilansA);
|
||||
$tabBilan=$tabBil=array();
|
||||
if ($nbBilansA>0) {
|
||||
$tabRatiosA=@calculRatios($tabBilansA, $tabIdentiteA, $accesDist);
|
||||
$mBilA = new MBilans($lien->siren, $iDb);
|
||||
$tabBilansA = $mBilA->listeBilans(false,2);
|
||||
$nbBilansA = count($tabBilansA);
|
||||
if ($nbBilansA > 0) {
|
||||
$tabRatiosA = calculRatios($tabBilansA, $tabIdentiteA, $accesDist);
|
||||
$SITUACT=$tabRatiosA[0][19];
|
||||
$Ra=$tabRatiosA[0];
|
||||
$Rap=$tabRatiosA[1];
|
||||
}
|
||||
}
|
||||
if ($lien->siren>100 && count($lienInsee->getAnnoncesLegales($lien->siren, 0, 'P', false))>0) {
|
||||
$RJMERE=true;
|
||||
if ($lien->siren>100 && count($lienInsee->getAnnoncesLegales($lien->siren, 0, 'P', false))>0) {
|
||||
$RJMERE=true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
$tabBilanA=$tabBilan;
|
||||
$tabBilA=$tabBil;
|
||||
$mBilA=$mBil;
|
||||
$timer['actionnaires']=microtime(true);
|
||||
|
||||
//Participation
|
||||
@ -2031,21 +2006,17 @@ function calculIndiScore($siren, $nic=0, $accesDist=false, $cycleClient=2, $mail
|
||||
$SIRETFILLE=$tabIdentiteP['SiretSiege']; // N° SIRET de la sté 1ere fille à plus de 50%
|
||||
$NOMFILLE=$tabIdentiteP['Nom'];
|
||||
}
|
||||
if (count($lienInsee->getAnnoncesLegales($lien->siren, 0, 'P', false))>0)
|
||||
if (count($lienInsee->getAnnoncesLegales($lien->siren, 0, 'P', false))>0) {
|
||||
$RJFILLE=true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$timer['participations']=microtime(true);
|
||||
|
||||
/** Récupération des valeurs propres à l'entreprise, à causes des variables globales de calculRatios **/
|
||||
$mBil=$tabSav['mBil'];
|
||||
$tabBilan=$tabSav['tabBilan'];
|
||||
$tabBil=$tabSav['tabBil'];
|
||||
$efftr=$tabSav['efftr'];
|
||||
|
||||
$tabBil=array();
|
||||
if ($NBBILAN==0) {
|
||||
if ($NBBILAN==0)
|
||||
{
|
||||
$noteSolvabilite=round($noteStructure)*5; // La note finale est sur 100
|
||||
/** Pas de bilan mais capital elevé **/
|
||||
if ($ACTIFRNCS && $FJURRNCS1>1 && $FJURRNCS1<7) {
|
||||
@ -2061,10 +2032,13 @@ function calculIndiScore($siren, $nic=0, $accesDist=false, $cycleClient=2, $mail
|
||||
elseif ($CAPITAL<10000000) $NOTECAP20=17;
|
||||
else $NOTECAP20=19;
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
$numBil=0;//sleep(1);
|
||||
|
||||
for ($i=0; isset($tabBilan[$i]); $i++) {
|
||||
for ($i=0; isset($tabBilan[$i]); $i++)
|
||||
{
|
||||
|
||||
//if (substr($millesime,0,1)=='S') {
|
||||
// @todo attention au type de bilan S en N et banque assu consolidé !!!
|
||||
@ -3457,6 +3431,19 @@ function calculIndiScore($siren, $nic=0, $accesDist=false, $cycleClient=2, $mail
|
||||
$VALCOEFMAXCA=$tabTmp['MAXI'];
|
||||
}
|
||||
|
||||
//Chargement des phrases de commentaires - @todo : Mettre en cache
|
||||
$tabCommentaires = $tabTri = $tabTriAff = array();
|
||||
switch( $type ) {
|
||||
case 'scores':
|
||||
$version = '414';
|
||||
require_once 'Metier/scores/Variables/CommentsIndiscore'.$version.'.php';
|
||||
break;
|
||||
case 'valo':
|
||||
$version = '26';
|
||||
require_once 'Metier/scores/Variables/CommentsValo'.$version.'.php';
|
||||
break;
|
||||
}
|
||||
|
||||
// Inclusion du fichier généré lors de la compilation
|
||||
if ($type == 'scores') {
|
||||
$fileIndiscore = 'FormulesIndiscore'.$version.'.php';
|
||||
@ -3468,7 +3455,6 @@ function calculIndiScore($siren, $nic=0, $accesDist=false, $cycleClient=2, $mail
|
||||
asort($tabTri);
|
||||
asort($tabTriAff);
|
||||
$tabCommentairesATrier=array();
|
||||
$tabCommentairesTmp=array();
|
||||
global $idx;
|
||||
$timer['calculcommentaires']=microtime(true);
|
||||
//sendMail('production@scores-decisions.com', 'ylenaour@scores-decisions.com', "Indiscore sur $siren : Trace1", print_r($C,true));
|
||||
@ -3481,20 +3467,19 @@ function calculIndiScore($siren, $nic=0, $accesDist=false, $cycleClient=2, $mail
|
||||
$commentaires=@implode('<br/>',$tabCommentaires[$idx][$cycleClient]);
|
||||
$commentaires=preg_replace('/\[0+/', '[', $commentaires);
|
||||
|
||||
if(INDISCORE_DEBUG) $fp=fopen(LOG_PATH.'/debugFmt.log', 'a');
|
||||
if(INDISCORE_DEBUG) fwrite($fp, EOL.date("Y/m/d H:i:s")." - formule 0=$idx : $commentaires".EOL);
|
||||
|
||||
if (preg_match_all('/(\{.*\})/Us',$commentaires, $tabTmp)) {
|
||||
foreach ($tabTmp[1] as $valeur) {
|
||||
$set=false;
|
||||
$valeur2=strtr($valeur, array('{'=>'', '}'=>''));
|
||||
if(INDISCORE_DEBUG) fwrite($fp, date("Y/m/d H:i:s")." - formule A=$idx : $valeur".EOL);
|
||||
}
|
||||
}
|
||||
if(INDISCORE_DEBUG) fclose($fp);
|
||||
if(INDISCORE_DEBUG) {
|
||||
$fp=fopen(LOG_PATH.'/debugFmt.log', 'a');
|
||||
fwrite($fp, EOL.date("Y/m/d H:i:s")." - formule 0=$idx : $commentaires".EOL);
|
||||
if ( preg_match_all('/(\{.*\})/Us', $commentaires, $tabTmp) ) {
|
||||
foreach ($tabTmp[1] as $valeur) {
|
||||
$valeur2=strtr($valeur, array('{'=>'', '}'=>''));
|
||||
fwrite($fp, date("Y/m/d H:i:s")." - formule A=$idx : $valeur".EOL);
|
||||
}
|
||||
}
|
||||
fclose($fp);
|
||||
}
|
||||
|
||||
$strCommentaire=strtr(preg_replace_callback('/(\{.*\})/U', 'format', $commentaires), array('"'=>'\''));
|
||||
$tabCommentairesTmp[$idx]=$strCommentaire;
|
||||
|
||||
//echo "<b>$idx</b>";
|
||||
//eval('echo "'.$strCommentaire.'";');
|
||||
@ -3609,83 +3594,22 @@ function calculIndiScore($siren, $nic=0, $accesDist=false, $cycleClient=2, $mail
|
||||
$timer['finIndiscore']=microtime(true);
|
||||
//sendMail('production@scores-decisions.com', 'ylenaour@scores-decisions.com', "Indiscore sur $siren : Trace20", 'ici');
|
||||
|
||||
/** @todo
|
||||
|
||||
$NOMFUSION Nom de l'entrep concernée par la fusion
|
||||
$GERANTMAJ
|
||||
$ANNONCELIM Annonce en cours
|
||||
$ANNONCELJDELAI Délai pour rescorer après annonce de LJ
|
||||
$ANNONCECLODELAI Délai pour rescorer après annonce de cloture
|
||||
$APEAGRICPAC
|
||||
$NOTEDEFPRO Note de la probabilité de défaillance du profil sur 100
|
||||
$SOCIETE_COTE_MARCHE_MERE Nom du marché de l'actionnaire côté
|
||||
|
||||
GEOACT1K_NB nombre Nb entrep du même secteur (APE 4ch) à moins de 1km
|
||||
GEOACT5K_NB nombre Nb entrep du même secteur (APE 4ch) à moins de 5km
|
||||
GEOACT10K_NB nombre Nb entrep du même secteur (APE 4ch) à moins de 10km
|
||||
|
||||
RISQUEGEOEAU_DIS nombre distance d'un point d'eau en metres
|
||||
RISQUEGEOEAU_MIL libellé milieu: classification du point d'eau en metre ex: rivière, pland'eau etc
|
||||
RISQUEGEOEAU_ALT nombre altitude du point d'eau en metres
|
||||
RISQUEGEOEAU_PRELS nombre M3 par an; prélèvement eau en surface
|
||||
RISQUEGEOEAU_PRELF nombre M3 par an; prélèvement eau souterraine par forage
|
||||
|
||||
$MOY(R[512],3)
|
||||
|
||||
**/
|
||||
|
||||
|
||||
$variables="\n\$NIVEAU=$NIVEAU\n\$numBil=$numBil\n\$noteSD=$noteSD\n\t-----";
|
||||
|
||||
foreach ($tabVar as $var){
|
||||
if (isset(${$var})) $variables.="$var='${$var}'".EOL;
|
||||
else $variables.="$var='${$var}' NON DEFINIE !!!".EOL;
|
||||
}
|
||||
|
||||
/*
|
||||
if(ENV<>'PRD' && $mailDebug)
|
||||
sendMail('production@scores-decisions.com', 'mricois@scores-decisions.com,jm.champeau@recocash.com', "Indiscore sur $siren : Variables",
|
||||
'CA_COEF='.$CA_COEF.EOL.
|
||||
'CA_Y='.print_r($CA_Y,true).EOL.
|
||||
EOL.
|
||||
'RCAI_COEF='.$RCAI_COEF.EOL.
|
||||
'RCAI_Y='.print_r($RCAI_Y,true).EOL.
|
||||
"rcai TAUX=$PROJECTAUX".EOL.
|
||||
"y aff=".print_r($Yaff,true).EOL.
|
||||
"x=".print_r($tabRegX,true).EOL.
|
||||
EOL.
|
||||
print_r($tabComment, true).EOL.EOL.
|
||||
$variables.EOL."Liste des Ratios :\n".print_r($tabRatios, true).EOL.
|
||||
"Liste des ratios Evolutions :\n". print_r($tabRatiosEvol, true).EOL.
|
||||
"Liste des commentaires Debug :\n".print_r($tabCommentairesTmp, true));
|
||||
*/
|
||||
|
||||
/*sendMail('production@scores-decisions.com', 'mricois@scores-decisions.com',
|
||||
"Indiscore sur $siren : Commentaires",
|
||||
"Liste des variables :\n$variables".EOL.
|
||||
print_r($tabComment, true).EOL.
|
||||
"Liste des variables :\n".print_r($tabVariables, true).EOL.
|
||||
"Liste des commentaires Debug :\n".print_r($tabCommentairesTmp, true).EOL.
|
||||
"Liste des commentaires a trier :\n".print_r($tabCommentairesATrier,true).EOL.
|
||||
"Tableau des codes de tri pour calcul :\n".print_r($tabTri,true).EOL.
|
||||
"Tableau des codes de tri pour affichage :\n".print_r($tabTriAff,true).EOL.
|
||||
$debugFormule.EOL.'-----------------------'.EOL.
|
||||
"Liste des Bilans :\n".print_r($tabBilans, true).EOL.
|
||||
//"Détail des postes Bilans :\n".print_r($tabBilan, true).EOL.
|
||||
//
|
||||
//"Liste des Formules Ratios :\n".print_r($tabFormulesRatios, true).EOL.
|
||||
//"Debug variables :\n".file_get_contents('/var/www/log/debugFmt.log').EOL.
|
||||
"\$tabBil=\n".print_r($tabBil,true).EOL
|
||||
);*/
|
||||
} // Fin Génération des commentaires
|
||||
|
||||
if(INDISCORE_DEBUG)
|
||||
if(INDISCORE_DEBUG) {
|
||||
|
||||
$variables="\n\$NIVEAU=$NIVEAU\n\$numBil=$numBil\n\$noteSD=$noteSD\n\t-----";
|
||||
|
||||
foreach ($tabVar as $var){
|
||||
if (isset(${$var})) $variables.="$var='${$var}'".EOL;
|
||||
else $variables.="$var='${$var}' NON DEFINIE !!!".EOL;
|
||||
}
|
||||
|
||||
file_put_contents('test.log',
|
||||
"Indiscore sur $siren : Commentaires".EOL.
|
||||
"Liste des variables :\n$variables".EOL.
|
||||
print_r($tabComment, true).EOL.
|
||||
"Liste des variables :\n".print_r($tabVariables, true).EOL.
|
||||
"Liste des commentaires Debug :\n".print_r($tabCommentairesTmp, true).EOL.
|
||||
"Liste des commentaires a trier :\n".print_r($tabCommentairesATrier,true).EOL.
|
||||
"Tableau des codes de tri pour calcul :\n".print_r($tabTri,true).EOL.
|
||||
"Tableau des codes de tri pour affichage :\n".print_r($tabTriAff,true).EOL.
|
||||
@ -3698,16 +3622,70 @@ function calculIndiScore($siren, $nic=0, $accesDist=false, $cycleClient=2, $mail
|
||||
"\$tabBil=\n".print_r($tabBil,true).EOL
|
||||
);
|
||||
|
||||
$i=0; $strTime='';
|
||||
foreach ($timer as $lib=>$time) {
|
||||
$strTime.="$lib : ";
|
||||
$duree=round($time-$timePre,3);
|
||||
if ($i==0) { $strTime.="0 s"; $timeDeb=$time; }
|
||||
else $strTime.="$duree s";
|
||||
$strTime.="\n";
|
||||
$timePre=$time;
|
||||
$i++;
|
||||
}
|
||||
$duree=round($time-$timeDeb,3);
|
||||
$strTime.="---------------------\nTOTAL : $duree secondes\n";
|
||||
file_put_contents('time.log', "Indiscore sur $siren : Durées ".ENV, $strTime.EOL.$strNote.EOL.$variables.EOL.print_r($tabRatiosInfos,true));
|
||||
//sendMail('production@scores-decisions.com', 'mricois@scores-decisions.com', "Indiscore sur $siren : Durées ".ENV, $strTime.EOL.$strNote.EOL.$variables.EOL.print_r($tabRatiosInfos,true));
|
||||
}
|
||||
/*
|
||||
if(ENV<>'PRD' && $mailDebug)
|
||||
sendMail('production@scores-decisions.com', 'mricois@scores-decisions.com,jm.champeau@recocash.com', "Indiscore sur $siren : Variables",
|
||||
'CA_COEF='.$CA_COEF.EOL.
|
||||
'CA_Y='.print_r($CA_Y,true).EOL.
|
||||
EOL.
|
||||
'RCAI_COEF='.$RCAI_COEF.EOL.
|
||||
'RCAI_Y='.print_r($RCAI_Y,true).EOL.
|
||||
"rcai TAUX=$PROJECTAUX".EOL.
|
||||
"y aff=".print_r($Yaff,true).EOL.
|
||||
"x=".print_r($tabRegX,true).EOL.
|
||||
EOL.
|
||||
print_r($tabComment, true).EOL.EOL.
|
||||
$variables.EOL."Liste des Ratios :\n".print_r($tabRatios, true).EOL.
|
||||
"Liste des ratios Evolutions :\n". print_r($tabRatiosEvol, true).EOL.
|
||||
"Liste des commentaires Debug :\n".print_r($tabCommentairesTmp, true));
|
||||
*/
|
||||
|
||||
/*sendMail('production@scores-decisions.com', 'mricois@scores-decisions.com',
|
||||
"Indiscore sur $siren : Commentaires",
|
||||
"Liste des variables :\n$variables".EOL.
|
||||
print_r($tabComment, true).EOL.
|
||||
"Liste des variables :\n".print_r($tabVariables, true).EOL.
|
||||
"Liste des commentaires Debug :\n".print_r($tabCommentairesTmp, true).EOL.
|
||||
"Liste des commentaires a trier :\n".print_r($tabCommentairesATrier,true).EOL.
|
||||
"Tableau des codes de tri pour calcul :\n".print_r($tabTri,true).EOL.
|
||||
"Tableau des codes de tri pour affichage :\n".print_r($tabTriAff,true).EOL.
|
||||
$debugFormule.EOL.'-----------------------'.EOL.
|
||||
"Liste des Bilans :\n".print_r($tabBilans, true).EOL.
|
||||
//"Détail des postes Bilans :\n".print_r($tabBilan, true).EOL.
|
||||
//
|
||||
//"Liste des Formules Ratios :\n".print_r($tabFormulesRatios, true).EOL.
|
||||
//"Debug variables :\n".file_get_contents('/var/www/log/debugFmt.log').EOL.
|
||||
"\$tabBil=\n".print_r($tabBil,true).EOL
|
||||
);*/
|
||||
|
||||
// EntActiveRCS
|
||||
if ($ACTIFRNCS || $ACTIFINSEE)
|
||||
if ($ACTIFRNCS || $ACTIFINSEE) {
|
||||
$actif=1;
|
||||
else
|
||||
} else {
|
||||
$actif=0;
|
||||
}
|
||||
|
||||
if ($libInfoPaiement<>'' && $tabIdentite['SituationJuridique']=='P')
|
||||
//Libellé Information de paiemet - Procédure collective
|
||||
if ($libInfoPaiement<>'' && $tabIdentite['SituationJuridique']=='P') {
|
||||
$libInfoPaiement='En procédure collective';
|
||||
}
|
||||
|
||||
//Retour
|
||||
$tabRet = array(
|
||||
'id' => $tabIdentite['id'],
|
||||
'Siret' => $tabIdentite['SiretSiege'],
|
||||
@ -3881,114 +3859,91 @@ function calculIndiScore($siren, $nic=0, $accesDist=false, $cycleClient=2, $mail
|
||||
|
||||
//Insertion ou mise à jour du score
|
||||
$tabUpdate = array(
|
||||
'siren' => $siren,
|
||||
'naf' => $naf,
|
||||
'CJ' => $tabIdentite['FJ'],
|
||||
'dateImmat' => $tabIdentite['dateImmat'],
|
||||
'dateCrea' => $tabIdentite['DateCreaEn'],
|
||||
'effectif' => $EffectifEn,
|
||||
'actif' => $tabRet['Actif'],
|
||||
'procol' => $tabRet['SituationJuridique'],
|
||||
'indiScore' => $tabRet['Indiscore'],
|
||||
'indiScore20' => $tabRet['Indiscore20'],
|
||||
'encours' => $tabRet['encours'],
|
||||
'indiScoreDate' => $JOUR_DATE,
|
||||
'dateBilan' => @$tabRet['Bilans'][0]['Millesime'],
|
||||
'scoreSolv' => $tabRet['ScoreSolvabilite'],
|
||||
'scoreConf' => $tabRet['ScoreConfor'],
|
||||
'scoreDir' => $tabRet['ScoreDirigeance'],
|
||||
'scoreZ' => $tabRet['scores']['Z'],
|
||||
'scoreCH' => $tabRet['scores']['ConanH'],
|
||||
'siren' => $siren,
|
||||
'naf' => $naf,
|
||||
'CJ' => $tabIdentite['FJ'],
|
||||
'dateImmat' => $tabIdentite['dateImmat'],
|
||||
'dateCrea' => $tabIdentite['DateCreaEn'],
|
||||
'effectif' => $EffectifEn,
|
||||
'actif' => $tabRet['Actif'],
|
||||
'procol' => $tabRet['SituationJuridique'],
|
||||
'indiScore' => $tabRet['Indiscore'],
|
||||
'indiScore20' => $tabRet['Indiscore20'],
|
||||
'encours' => $tabRet['encours'],
|
||||
'indiScoreDate' => $JOUR_DATE,
|
||||
'dateBilan' => @$tabRet['Bilans'][0]['Millesime'],
|
||||
'scoreSolv' => $tabRet['ScoreSolvabilite'],
|
||||
'scoreConf' => $tabRet['ScoreConfor'],
|
||||
'scoreDir' => $tabRet['ScoreDirigeance'],
|
||||
'scoreZ' => $tabRet['scores']['Z'],
|
||||
'scoreCH' => $tabRet['scores']['ConanH'],
|
||||
|
||||
'scoreAfdcc1' => $tabRet['scores']['Afdcc1'],
|
||||
'scoreAfdcc2' => $tabRet['scores']['Afdcc2'],
|
||||
'scoreAfdcc2note' => $tabRet['scores']['Afdcc2note'],
|
||||
'scoreAltman' => $tabRet['scores']['Altman'],
|
||||
'scoreAltmanCote' => $tabRet['scores']['AltmanCote'],
|
||||
'scoreCCF' => $tabRet['scores']['CCF'],
|
||||
'scoreAfdcc1' => $tabRet['scores']['Afdcc1'],
|
||||
'scoreAfdcc2' => $tabRet['scores']['Afdcc2'],
|
||||
'scoreAfdcc2note' => $tabRet['scores']['Afdcc2note'],
|
||||
'scoreAltman' => $tabRet['scores']['Altman'],
|
||||
'scoreAltmanCote' => $tabRet['scores']['AltmanCote'],
|
||||
'scoreCCF' => $tabRet['scores']['CCF'],
|
||||
|
||||
'situFi' => $tabRet['tabInfosNotations']['SituationFinanciere'],
|
||||
'infoNote' => $tabRet['tabInfosNotations']['Notation'],
|
||||
'noteStruct' => $tabRet['Note_Structure'],
|
||||
'noteFin' => $tabRet['Note_Financiere'],
|
||||
'tendance' => $tabRet['TendanceIndiscore'],
|
||||
'cs' => $tabRet['cs'],
|
||||
'csMoisMaj' => $tabRet['csMoisMaj'],
|
||||
'csMoisFin' => $tabRet['csMoisFin'],
|
||||
'adresseDom' => $tabRet['AdresseDom'],
|
||||
'situFi' => $tabRet['tabInfosNotations']['SituationFinanciere'],
|
||||
'infoNote' => $tabRet['tabInfosNotations']['Notation'],
|
||||
'noteStruct' => $tabRet['Note_Structure'],
|
||||
'noteFin' => $tabRet['Note_Financiere'],
|
||||
'tendance' => $tabRet['TendanceIndiscore'],
|
||||
'cs' => $tabRet['cs'],
|
||||
'csMoisMaj' => $tabRet['csMoisMaj'],
|
||||
'csMoisFin' => $tabRet['csMoisFin'],
|
||||
'adresseDom' => $tabRet['AdresseDom'],
|
||||
|
||||
'sourceModif' => $sourceModif,
|
||||
'indiScorePre' => $entrep['indiScore'],
|
||||
'indiScore20Pre' => $entrep['indiScore20'],
|
||||
'indiScoreDatePre' => $entrep['indiScoreDate'],
|
||||
'encoursPre' => $entrep['encours'],
|
||||
'scoreSolvPre' => $entrep['scoreSolv'],
|
||||
'scoreConfPre' => $entrep['scoreConf'],
|
||||
'scoreDirPre' => $entrep['scoreDir'],
|
||||
'scoreZPre' => $entrep['scoreZ'],
|
||||
'scoreCHPre' => $entrep['scoreCH'],
|
||||
'scoreAfdcc1Pre' => $entrep['scoreAfdcc1'],
|
||||
'scoreAfdcc2Pre' => $entrep['scoreAfdcc2'],
|
||||
'scoreAfdcc2notePre'=> $entrep['scoreAfdcc2note'],
|
||||
'sourceModif' => $sourceModif,
|
||||
'indiScorePre' => $entrep['indiScore'],
|
||||
'indiScore20Pre' => $entrep['indiScore20'],
|
||||
'indiScoreDatePre' => $entrep['indiScoreDate'],
|
||||
'encoursPre' => $entrep['encours'],
|
||||
'scoreSolvPre' => $entrep['scoreSolv'],
|
||||
'scoreConfPre' => $entrep['scoreConf'],
|
||||
'scoreDirPre' => $entrep['scoreDir'],
|
||||
'scoreZPre' => $entrep['scoreZ'],
|
||||
'scoreCHPre' => $entrep['scoreCH'],
|
||||
'scoreAfdcc1Pre' => $entrep['scoreAfdcc1'],
|
||||
'scoreAfdcc2Pre' => $entrep['scoreAfdcc2'],
|
||||
'scoreAfdcc2notePre'=> $entrep['scoreAfdcc2note'],
|
||||
|
||||
'scoreAltmanPre' => $entrep['scoreAltman'],
|
||||
'scoreAltmanCotePre'=> $entrep['scoreAltmanCote'],
|
||||
'scoreCCFPre' => $entrep['scoreCCF'],
|
||||
'scoreAltmanPre' => $entrep['scoreAltman'],
|
||||
'scoreAltmanCotePre'=> $entrep['scoreAltmanCote'],
|
||||
'scoreCCFPre' => $entrep['scoreCCF'],
|
||||
|
||||
'situFiPre' => $entrep['situFi'],
|
||||
'infoNotePre' => $entrep['infoNote'],
|
||||
'noteStructPre' => $entrep['noteStruct'],
|
||||
'noteFinPre' => $entrep['noteFin'],
|
||||
'tendancePre' => $entrep['tendance'],
|
||||
'csPre' => $entrep['cs'],
|
||||
'csMoisMajPre' => $entrep['csMoisMaj'],
|
||||
'csMoisFinPre' => $entrep['csMoisFin'],
|
||||
'adresseDomPre' => $entrep['adresseDom'],
|
||||
'nbModifs' => $nbModifs,
|
||||
'situFiPre' => $entrep['situFi'],
|
||||
'infoNotePre' => $entrep['infoNote'],
|
||||
'noteStructPre' => $entrep['noteStruct'],
|
||||
'noteFinPre' => $entrep['noteFin'],
|
||||
'tendancePre' => $entrep['tendance'],
|
||||
'csPre' => $entrep['cs'],
|
||||
'csMoisMajPre' => $entrep['csMoisMaj'],
|
||||
'csMoisFinPre' => $entrep['csMoisFin'],
|
||||
'adresseDomPre' => $entrep['adresseDom'],
|
||||
'nbModifs' => $nbModifs,
|
||||
);
|
||||
if ( $actionHisto == 'insert' )
|
||||
{
|
||||
if (!$iDb->insert('scores_surveillance', $tabUpdate, false, true)) {
|
||||
echo "Erreur lors de l'ajout"; echo mysql_error().EOL;
|
||||
debugLog('W', "Erreur lors de l'ajout du score en surveillance pour ". $tabIdentite['Nom']." - ".mysql_error(), __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
||||
debugLog('W', "Erreur lors de l'ajout du score en surveillance pour ". $tabIdentite['Nom']." - ".mysql_error(), __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!$iDb->update('scores_surveillance', $tabUpdate, "siren=$siren", false, 0, true)) {
|
||||
echo "Erreur lors de l'update";
|
||||
debugLog('W', "Erreur lors de mise à jour du score en surveillance pour ". $tabIdentite['Nom']." - ".mysql_error(), __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
||||
debugLog('W', "Erreur lors de mise à jour du score en surveillance pour ". $tabIdentite['Nom']." - ".mysql_error(), __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
||||
}
|
||||
}
|
||||
|
||||
// Historisation du score
|
||||
$iDbHisto=new WDB('historiques');
|
||||
if (!$iDbHisto->insert('scores_surveillance', $tabUpdate)) {
|
||||
echo "Erreur lors de l'historique";
|
||||
//print_r($tabUpdate);
|
||||
echo mysql_error().EOL;
|
||||
echo date ('Y/m/d - H:i:s') . " - Erreur SQL sur l'historisation du score pour le siren $siren".EOL;
|
||||
debugLog('W', "Erreur lors de l'historisation du score pour ". $tabIdentite['Nom'], __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
||||
}
|
||||
}
|
||||
|
||||
if (INDISCORE_DEBUG) {
|
||||
$i=0; $strTime='';
|
||||
foreach ($timer as $lib=>$time) {
|
||||
$strTime.="$lib : ";
|
||||
$duree=round($time-$timePre,3);
|
||||
if ($i==0) { $strTime.="0 s"; $timeDeb=$time; }
|
||||
else $strTime.="$duree s";
|
||||
$strTime.="\n";
|
||||
$timePre=$time;
|
||||
$i++;
|
||||
}
|
||||
$duree=round($time-$timeDeb,3);
|
||||
$strTime.="---------------------\nTOTAL : $duree secondes\n";
|
||||
file_put_contents('time.log', "Indiscore sur $siren : Durées ".ENV, $strTime.EOL.$strNote.EOL.$variables.EOL.print_r($tabRatiosInfos,true));
|
||||
//sendMail('production@scores-decisions.com', 'mricois@scores-decisions.com', "Indiscore sur $siren : Durées ".ENV, $strTime.EOL.$strNote.EOL.$variables.EOL.print_r($tabRatiosInfos,true));
|
||||
}
|
||||
|
||||
debugLog('I', 'Etablissement retourné FIN = '. $tabIdentite['Nom'], __LINE__, __FILE__, __FUNCTION__, __CLASS__);
|
||||
|
||||
return $tabRet;
|
||||
|
Loading…
Reference in New Issue
Block a user