Recreate branch 2.8, November 3

This commit is contained in:
Michael RICOIS 2014-11-03 22:08:00 +00:00
commit a848819181
54 changed files with 31472 additions and 25187 deletions

View File

@ -6,7 +6,7 @@ class DemoController extends Zend_Controller_Action
protected $methods = array(
'getIdentite' => array(
'ws' => 'entreprise/v0.7?wsdl',
'ws' => 'entreprise/v0.8?wsdl',
'form' => 'getIdentite',
),
);

View File

@ -22,18 +22,22 @@ class ServiceController extends Zend_Controller_Action
$serviceClassName = ucfirst($serviceName);
//Customize service for customers
if ('clients' == $serviceName ) {
if ('clients' == $serviceName )
{
$client = strtolower($request->getParam('client', ''));
$clientClassName = ucfirst($client);
//Get list of customers
$clients = array();
$listeClients = include APPLICATION_PATH . '/../library/WsScore/Clients/ClientsConfig.php';
foreach ( $listeClients as $section => $params ){
if ($params['actif']) {
foreach ( $listeClients as $section => $params )
{
if ($params['actif'])
{
$clients[$section] = $params;
}
}
if (!array_key_exists($client, $clients)){
if (!array_key_exists($client, $clients))
{
echo 'Service clients introuvable !';
exit;
}
@ -47,7 +51,8 @@ class ServiceController extends Zend_Controller_Action
}
// Check versions
foreach( $configServiceVersions as $section => $params ) {
foreach( $configServiceVersions as $section => $params )
{
$serviceVersions[$section] = $params;
if ($params['defaut']) {
$defautVersion = $section;
@ -57,19 +62,21 @@ class ServiceController extends Zend_Controller_Action
$version = substr($version, 1);
// Version inexistante
if ( !array_key_exists($version, $serviceVersions) ) {
if ( !array_key_exists($version, $serviceVersions) )
{
echo "Version inexistante.";
exit;
}
// Version désactivé
if ( !$serviceVersions[$version]['actif'] ) {
if ( !$serviceVersions[$version]['actif'] )
{
echo "Version désactivée.";
exit;
}
// Charger les classes et les types pour le service suivant la version
if ('clients' == $serviceName) {
if ('clients' == $serviceName)
{
$pathServiceClassIni = 'WsScore/Clients/'.$clientClassName.'/v'.$version.'/Config.php';
$pathServiceClassPhp = 'WsScore/Clients/'.$clientClassName.'/v'.$version.'/Entreprise.php';
//Gestion du mode de génération du wsdl
@ -80,12 +87,12 @@ class ServiceController extends Zend_Controller_Action
} else {
$pathServiceUrl = 'clients/'.$client.'/v'.$version.'?wsdl';
}
// On redéfini le nom du service
//On redéfini le nom du service
$serviceClassName = 'Entreprise';
$fichierWsdl = $clientClassName.'-'.$serviceClassName.'-'.$version.'.wsdl';
} else {
}
else
{
$pathServiceClassIni = 'WsScore/'.$serviceClassName.'/v'.$version.'/Config.php';
$pathServiceClassPhp = 'WsScore/'.$serviceClassName.'/v'.$version.'/'.$serviceClassName.'.php';
//Gestion du mode de génération du wsdl
@ -100,24 +107,30 @@ class ServiceController extends Zend_Controller_Action
}
// Get map of WSDL type to PHP Classes
//Get map of WSDL type to PHP Classes
$classmap = include $pathServiceClassIni;
//Inclusion des classes de données
require_once $pathServiceClassPhp;
// Fourniture du wsdl
if ( isset($_GET['wsdl']) && file_exists($fichierWsdl) ) {
//Get hostname - add compatibility with Reverse Proxy
$hostName = $this->getRequest()->getHttpHost();
$fichierWsdl = $hostName . '-' . $fichierWsdl;
$wsdlPath = APPLICATION_PATH.'/../data/wsdl';
// Fourniture du wsdl
if ( isset($_GET['wsdl']) && file_exists($wsdlPath . '/' . $fichierWsdl) )
{
if (!headers_sent()) {
header('Content-Type: text/xml');
}
echo file_get_contents($fichierWsdl);
echo file_get_contents($wsdlPath . '/' . $fichierWsdl);
} elseif ( isset($_GET['wsdl']) && !file_exists($fichierWsdl)
}
elseif ( isset($_GET['wsdl']) && !file_exists($wsdlPath . '/' . $fichierWsdl)
|| isset($_GET['wsdl-generate'])
|| isset($_GET['wsdl-auto']) ) {
|| isset($_GET['wsdl-auto']) )
{
// Définition du webservice
$wsdl = new Zend_Soap_AutoDiscover();
$wsdl->setComplexTypeStrategy('Zend_Soap_Wsdl_Strategy_ArrayOfTypeSequence');
@ -127,58 +140,69 @@ class ServiceController extends Zend_Controller_Action
// Enregistrement du WSDL dans un fichier
if ( isset($_GET['wsdl-generate']) ) {
if (file_exists($fichierWsdl)) {
unlink($fichierWsdl);
if (file_exists($wsdlPath . '/' . $fichierWsdl)) {
unlink($wsdlPath . '/' . $fichierWsdl);
}
$wsdl->dump($fichierWsdl);
$wsdl->dump($wsdlPath . '/' . $fichierWsdl);
echo "Le fichier $fichierWsdl a été généré";
// Génération/Fourniture du wsdl
} elseif (isset($_GET['wsdl']) && !file_exists($fichierWsdl)) {
$wsdl->dump($fichierWsdl);
//Génération/Fourniture du wsdl
} elseif (isset($_GET['wsdl']) && !file_exists($wsdlPath . '/' . $fichierWsdl)) {
$wsdl->dump($wsdlPath . '/' . $fichierWsdl);
if (!headers_sent()) {
header('Content-Type: text/xml');
}
echo file_get_contents($fichierWsdl);
echo file_get_contents($wsdlPath . '/' . $fichierWsdl);
// Envoi sur la sortie standard le wsdl sans enregistrement dans un fichier
} elseif ( isset($_GET['wsdl-auto']) ){
$wsdl->handle();
}
}
// Fourniture du service
else
{
// Fourniture du service
} else {
// Get Ip Connexion
$ip = $this->getRequest()->getClientIp(true);
// Start SOAP Server
if (APPLICATION_ENV == 'production' && file_exists($fichierWsdl)) {
$server = new Zend_Soap_Server($fichierWsdl);
// Traitement
if (APPLICATION_ENV == 'production' && file_exists($wsdlPath . '/' . $fichierWsdl)) {
$server = new Zend_Soap_Server($wsdlPath . '/' . $fichierWsdl);
} else {
$hostName = $this->getRequest()->getHttpHost();
$server = new Zend_Soap_Server('http://'.$hostName.'/'.$pathServiceUrl);
}
// Instantiate object to serve
$objToServe = new $serviceClassName($ip);
//Sonde paramètres server
$debug = false;
$debugUser = '';
if ($debug && $_SERVER['PHP_AUTH_USER'] == $debugUser)
{
file_put_contents(APPLICATION_PATH . '/../debugserver.log',
"FichierWSDL : ".$fichierWsdl."\n".
"Hostname : ".$hostName."\n"
);
}
// Configure Server
//Options et traitement de la requete
$server->setSoapFeatures(SOAP_USE_XSI_ARRAY_TYPE + SOAP_SINGLE_ELEMENT_ARRAYS);
$server->setClassmap($classmap);
$server->setEncoding('UTF-8');
$server->registerFaultException(array('Scores_Ws_Exception'));
$server->setWsiCompliant(true);
$server->setObject($objToServe);
$server->setObject(new $serviceClassName());
$server->handle();
// Pour débuggage ultime
//Pour débuggage ultime
$debug = false;
if ($debug){
$request = $server->getLastRequest();
file_put_contents(APPLICATION_PATH . '/../request.log', $request);
$response = $server->getLastResponse();
file_put_contents(APPLICATION_PATH . '/../response.log', $response);
$debugUser = '';
if ($debug && $_SERVER['PHP_AUTH_USER'] == $debugUser)
{
file_put_contents(APPLICATION_PATH . '/../debugcall.log',
"FichierWSDL : ".$fichierWsdl."\n".
"Hostname : ".$hostName."\n"
);
$request = $server->getLastRequest();
file_put_contents(APPLICATION_PATH . '/../debugcall.log', $request . "\n", FILE_APPEND);
$response = $server->getLastResponse();
file_put_contents(APPLICATION_PATH . '/../debugcall.log', $response. "\n", FILE_APPEND);
}
}
}

View File

@ -45,6 +45,7 @@ return array(
'Application_Model_JoTabNaf5' => dirname(__FILE__) . '/Model/JoTabNaf5.php',
'Application_Model_JoTabPays' => dirname(__FILE__) . '/Model/JoTabPays.php',
'Application_Model_JoTelephonie' => dirname(__FILE__) . '/Model/JoTelephonie.php',
'Application_Model_Sdv1BilanCommandeEnter' => dirname(__FILE__) . '/Model/Sdv1BilanCommandeEnter.php',
'Application_Model_Sdv1BourseIsin' => dirname(__FILE__) . '/Model/Sdv1BourseIsin.php',
'Application_Model_Sdv1Clients' => dirname(__FILE__) . '/Model/Sdv1Clients.php',
'Application_Model_Sdv1ClientsServices' => dirname(__FILE__) . '/Model/Sdv1ClientsServices.php',

View File

@ -24,6 +24,7 @@ $tabTypeAsso=array(
'_666'=>array('even'=>8090,'type'=>'Suppression', 'forme'=>'FON','lib'=>'FONDATION/DISSOLUTION/ANNULATION'),
'_201'=>array('even'=>8079,'type'=>'Insertion', 'forme'=>'ASL','lib'=>'ASL/MODIFICATION'),
'_202'=>array('even'=>8079,'type'=>'Rectificatif', 'forme'=>'ASL','lib'=>'ASL/MODIFICATION/RECTIFICATIF'),
'_203'=>array('even'=>8079,'type'=>'Suppression', 'forme'=>'ASL','lib'=>'ASL/MODIFICATION/ANNULATION'),
'_301'=>array('even'=>8090,'type'=>'Insertion', 'forme'=>'ASL','lib'=>'ASL/DISSOLUTION'),
'_302'=>array('even'=>8090,'type'=>'Rectificatif', 'forme'=>'ASL','lib'=>'ASL/DISSOLUTION/RECTIFICATIF'),
'_303'=>array('even'=>8090,'type'=>'Suppression', 'forme'=>'ASL','lib'=>'ASL/DISSOLUTION/ANNULATION'),
@ -784,7 +785,7 @@ class MBodacc
' DU MANS'=>' LE MANS',
' DU CREUSOT'=>' LE CREUSOT',
' DU HAVRE'=>' LE HAVRE',
' DU '=>' ', 'PUY'=>'PUY EN VELAY',
' DU '=>' ', 'PUY'=>'PUY EN VELAY', 'LE PUY EN VELAY'=>'PUY EN VELAY',
'ALÈS'=>'ALES',
'.'=>' ',
)
@ -822,6 +823,8 @@ class MBodacc
return $code;
elseif ( $dep==975 && $libelleDuTribunal=='TGI SAINT PIERRE')
return $code;
elseif ( $dep==70 && $libelleDuTribunal=='TC VESOUL')
return $code;
elseif ( ($dep==95 || $dep==975) &&
($libelleDuTribunal=='TRIBUNAL PREMIERE INSTANCE SAINT PIERRE ET MIQUELON' || $libelleDuTribunal=='TPI SAINT PIERRE ET MIQUELON')
@ -1048,6 +1051,12 @@ class MBodacc
} else
die("Cas non gérée pour cette structure de noms : '$noms'");
/** @todo Il manque le cas de repr par pour le STE ??? **/
if (preg_match('/(en fonction le)|(modification le)/Ui', $nom)) {
echo "Je remplace le nom du dirigeant BODACC '$nom' par ";
$nom=preg_replace('/\s+en fonction le.*$/','', $nom);
$nom=preg_replace('/\s+modification le.*$/','', $nom);
echo "'$nom'".EOL;
}
$tabRet[]=array('fonction'=>$numFonction, 'rs'=>trim(str_replace(',','',$raisonSociale)), 'nom'=>$nom, 'prenom'=>$prenom, 'nomUsage'=>$usage, 'depart'=>$oldFonction);
}
}

View File

@ -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'];
@ -2241,9 +2266,8 @@ class MInsee
/** Informations INSEE **/
if ($siren>100) {
$insee=$this->iDb->select(
'insee.identite',
'ACTIF%10 AS ACTIF, actifEco%10 AS actifEco, NOM, NOM2, SIGLE, ENSEIGNE, ADR_NUMVOIE, ADR_BTQ, ADR_TYPVOIE, ADR_LIBVOIE, ADR_LIBCOM, ADR_CP, ADR_COMP, ADR_DISTSP, PAYS, DCREN, SIEGE, AUXILT, SAISONAT, CJ, CIVILITE, NBETAB, APE_ENT, APE_ETAB, PROCOL, PROCOL_TYPE, PROCOL_DATE, CAPITAL, EFF_ENT, NUMRC, TEL, FAX, DIR_FCT, DIR_IDEN, DIR_DATEN, DIR_LIEUN, CAPITAL_DATE, CAPITAL_DEV, DCRET, TEFF_ENT, ADR_DEP, ADR_COM, TCA, TCAEXP, EFF_ET, TEFF_ET, CODEVOIE, DATE_MAJ, APRM, ACTIVNAT, ORIGINE, MODET, EXPLET, LIEUACT, ACTISURF, DEFET, MODEN, PRODPART, EXPLEN, MONOREG, REGIMP, MONOACT, DEFEN, DEFET, IDENTITE_PRE',
$insee = $this->iDb->select('insee.identite',
'ACTIF%10 AS ACTIF, actifEco%10 AS actifEco, NOM, NOM2, SIGLE, ENSEIGNE, ADR_NUMVOIE, ADR_BTQ, ADR_TYPVOIE, ADR_LIBVOIE, ADR_LIBCOM, ADR_CP, ADR_COMP, ADR_DISTSP, PAYS, DCREN, SIEGE, AUXILT, SAISONAT, CJ, CIVILITE, NBETAB, APE_ENT, APE_ETAB, PROCOL, PROCOL_TYPE, PROCOL_DATE, CAPITAL, EFF_ENT, NUMRC, TEL, FAX, DIR_FCT, DIR_IDEN, DIR_DATEN, DIR_LIEUN, CAPITAL_DATE, CAPITAL_DEV, DCRET, TEFF_ENT, ADR_DEP, ADR_COM, TCA, TCAEXP, EFF_ET, TEFF_ET, CODEVOIE, DATE_MAJ, APRM, ACTIVNAT, ORIGINE, MODET, EXPLET, LIEUACT, ACTISURF, DEFET, MODEN, PRODPART, EXPLEN, MONOREG, REGIMP, MONOACT, DEFEN, DEFET, IDENTITE_PRE, insL1_NOMEN, insL2_COMP, insL3_CADR, insL4_VOIE, insL5_DISP, insL6_POST, insL7_ETRG, dateMajRNVP, insCATEGORIE, insIND_PUBLIPO, RPET, ARRONET, CTONET, DU, TU, UU, TCD, ZEMET, ESAANN, ESAAPEN, DREACTET, AMINTRET, DREACTEN, AMINTREN, NOMEN_LONG, CEDEX, EPCI, NOM_COM, NATETAB, PRODET, PRODEN',
"SIREN=$siren $strNic ORDER BY SIEGE DESC, ACTIF DESC LIMIT 0,1",false,MYSQL_ASSOC);
if (count($insee)>0) {
$tabInsee=$insee[0];
@ -2252,6 +2276,12 @@ class MInsee
$tabInsee['RECME']=$tabNotice['insRECME'];
// On force l'indicateur "actifEco" à 0 si l'établissement est juridiquement inactif
if ($tabInsee['ACTIF']*1==0) $tabInsee['actifEco']=0;
if (trim($tabInsee['CODEVOIE'])=='') {
$codeCommune=$tabInsee['ADR_DEP'].sprintf("%03s",$tabInsee['ADR_COM']);
//echo $codeCommune.','.$tabInsee['ADR_TYPVOIE'].','.$tabInsee['ADR_LIBVOIE'].EOL;
$tabInsee['CODEVOIE']=$this->getCodeVoieRivoli($codeCommune, $tabInsee['ADR_TYPVOIE'], $tabInsee['ADR_LIBVOIE']);
//echo $tabInsee['CODEVOIE'].EOL;
}
} else {
// Siren absent de l'Insee
$tabInsee = array(
@ -2588,6 +2618,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'],
@ -2678,6 +2712,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é
@ -2700,7 +2735,42 @@ class MInsee
'APRM'=>$tabInsee['APRM'],
'APRM_Lib'=>$this->getLibelleNafa($tabInsee['APRM']),
'AutreSiret'=>$tabAssoc,
// MODET,
'L1_NOMEN'=>$tabInsee['insL1_NOMEN'], // Nom ou raison sociale de l'entreprise pour l'adressage
'L2_COMP'=> $tabInsee['insL2_COMP'], // Complément de nom de l'entreprise pour l'adressage
'L3_CADR'=> $tabInsee['insL3_CADR'], // Complément d'adresse pour l.adressage
'L4_VOIE'=> $tabInsee['insL4_VOIE'], // Numéro et libellé dans la voie
'L5_DISP'=> $tabInsee['insL5_DISP'], // Distribution spéciale
'L6_POST'=> $tabInsee['insL6_POST'], // Ligne d'acheminement postal pour l'adressage
'L7_ETRG'=> $tabInsee['insL7_ETRG'], // Libellé du pays pour les adresses à l'étranger
'IND_PUBLIPO'=> $tabInsee['insIND_PUBLIPO'], // Indicateur du champ de publipostage
'dateMajRNVP'=>$tabInsee['dateMajRNVP'],
'RNVP_Niveau'=>0,
'RPET'=> $tabInsee['RPET'], //
'ARRONET'=> $tabInsee['ARRONET'], //
'CTONET'=> $tabInsee['CTONET'], //
'DU'=> $tabInsee['DU'], //
'TU'=> $tabInsee['TU'], //
'UU'=> $tabInsee['UU'], //
'TCD'=> $tabInsee['TCD'], //
'ZEMET'=> $tabInsee['ZEMET'], //
'ESAANN'=> $tabInsee['ESAANN'], //
'ESAAPEN'=> $tabInsee['ESAAPEN'], //
'DREACTET'=> $tabInsee['DREACTET'], //
'AMINTRET'=> $tabInsee['AMINTRET'], //
'DREACTEN'=> $tabInsee['DREACTEN'], //
'AMINTREN'=> $tabInsee['AMINTREN'], //
'CATEGORIE'=> $tabInsee['insCATEGORIE'], // Catégorie d'entreprise
'NOMEN_LONG'=> $tabInsee['NOMEN_LONG'], // Nom ou raison sociale de l'entreprise
'PRODET'=> $tabInsee['PRODET'],
'PRODEN'=> $tabInsee['PRODEN'],
'NATETAB'=> $tabInsee['NATETAB'],
'CEDEX'=> $tabInsee['CEDEX'],
'EPCI'=> $tabInsee['EPCI'],
// MODET,
);
/** Estimation du Chiffre d'affaires **/
@ -2896,16 +2966,22 @@ 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']='';
$entrep['sexe']=$tabRet['dir1Genre'];
unset($tmp);
}
@ -3070,10 +3146,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='';
@ -3085,10 +3164,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++;
}
@ -3229,6 +3313,7 @@ class MInsee
$tabRet['dir1NomUsage']=strtoupper($entrep['nomUsage']);
$tabRet['dir1DateNaiss']=$entrep['dateNaiss'];
$tabRet['dir1LieuNaiss']=$entrep['lieuNaiss'];
$tabRet['dir1Genre']=$entrep['sexe'];
}
if ($tabRet['DateMajRCS']=='') {
@ -5402,6 +5487,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;
}
}
@ -5469,7 +5560,7 @@ class MInsee
'Departement'=>$dept,
'Tribunal'=>$ann['triNom'],
'TribunalSiret'=>$ann['triSiret'],
'Rubrique'=>'procol',
'Rubrique'=>$rubriqueRet,
'typeAnnonce'=>'insertion',
'dateEffet'=>$ann['dateCessationPaiement'],
'dateJugement'=>$ann['dateJugement'],
@ -5586,6 +5677,16 @@ class MInsee
insEAEAPET, insEAESEC1T, insEAESEC2T, insEAEANN, insEAEAPEN, insEAESEC1N, insEAESEC2N, insEAESEC3N,
insEAESEC4N, dateNotice',
"insSIREN=$siren AND insNIC=$nic ORDER BY dateNotice DESC LIMIT 0,1", false, MYSQL_ASSOC);
if (count($tabTmp)==0)
$tabTmp=$this->iDb->select('insee.insee_even',
"insSIREN, insNIC, insL4_VOIE, insL6_POST, insRPET, insDEPCOMEN, insRPEN, insARRONET, insCTONET, insTCD,
insZEMET, insDU, insTU, insUU, insAMINTRET, insAMINTREN, insVMAJ, insVMAJ1, insVMAJ2, insVMAJ3,
'' AS insRECME, '' AS insEAEANT, '' AS insEAEAPET, '' AS insEAESEC1T, '' AS insEAESEC2T,
insESAANN AS insEAEANN, insESAPEN AS insEAEAPEN, insESASEC1N AS insEAESEC1N, insESASEC2N AS insEAESEC2N,
insESASEC3N AS insEAESEC3N, insESASEC4N AS insEAESEC4N, dateInsert AS dateNotice",
"insSIREN=$siren AND insNIC=$nic ORDER BY dateInsert DESC LIMIT 0,1", false, MYSQL_ASSOC);
return $tabTmp[0];
}
@ -5613,7 +5714,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.
@ -6174,34 +6275,40 @@ class MInsee
$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.insee_even WHERE insSIREN=$siren AND insNIC=$nic AND (insEVE IN ('510','520','530','540') OR insEVE LIKE 'T%')
"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);
if ( count($ret)>0 ) {
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;
}
}
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;
}
}
}
$adr1=$tabEve['insL1_NOMEN'];
if ($adr1==NULL) $adr1=$tabEve['insNOMEN'];
@ -6425,6 +6532,34 @@ class MInsee
return 0;
}
/**
*
* @param unknown $codeCommune
* @param unknown $adrTypVoie
* @param unknown $adrLibVoie
* @return string|Ambigous <string, multitype:>
*/
public function getCodeVoieRivoli($codeCommune, $adrTypVoie, $adrLibVoie)
{
$codeVoie='';
$adrLibVoie2=addslashes($adrLibVoie);
$tDeb=microtime(1);
$ret=$this->iDb->select('insee.fantoirVoi', "codComInsee, idVoieCom, cleRivoli, voieNature, voieLib, 1 AS score",
"codComInsee='$codeCommune' AND voieNature='$adrTypVoie' AND voieLib='$adrLibVoie2'",false, MYSQL_ASSOC);
$nbRet = count($ret);
if ($nbRet == 0) {
return ''; //'Aucune correspondance Rivoli'.EOL;
} else {
foreach($ret as $i=>$iRet) {
if ($iRet['voieNature'] == $adrTypVoie && $iRet['voieLib'] == $adrLibVoie) {
$codeVoie=$iRet['idVoieCom'];
break;
}
}
}
return $codeVoie;
}
/**
* Information de l'événement précédent associé
* @param string $siren

View File

@ -293,6 +293,225 @@ class MAmabis
fclose($fp);
}
/**
* @todo Corriger les adresses présentes dans CEDEXA (toutes les lignes)
* @todo Ligne 3, acheter HEXALIGNE3
*/
function normaliseAdresse($adrL1, $adrL2, $adrL3, $adrL4, $adrL5, $adrL6, $adrL7='', $norme=38) {
if ($norme<>32 && $norme<>38) {
return 'La norme doit être 32 ou 38 caractères (38 par défaut)'.EOL;
}
$iInsee=new MInsee();
$iDb=new WDB('villes');
$adrL=array();
$adrL[1]=$adrL1=trim(preg_replace('/\s+/',' ',preg_replace('/[^a-z\d ]/i', ' ', strtoupper(trimAccent($adrL1)))));
$adrL[2]=$adrL2=trim(preg_replace('/\s+/',' ',preg_replace('/[^a-z\d ]/i', ' ', strtoupper(trimAccent($adrL2)))));
$adrL[3]=$adrL3=trim(preg_replace('/\s+/',' ',preg_replace('/[^a-z\d ]/i', ' ', strtoupper(trimAccent($adrL3)))));
$adrL[4]=$adrL4=trim(preg_replace('/\s+/',' ',preg_replace('/[^a-z\d ]/i', ' ', strtoupper(trimAccent($adrL4)))));
$adrL[5]=$adrL5=trim(preg_replace('/\s+/',' ',preg_replace('/[^a-z\d ]/i', ' ', strtoupper(trimAccent($adrL5)))));
$adrL[6]=$adrL6=trim(preg_replace('/\s+/',' ',preg_replace('/[^a-z\d ]/i', ' ', strtoupper(trimAccent($adrL6)))));
$adrL[7]=$adrL7=trim(preg_replace('/\s+/',' ',preg_replace('/[^a-z\d ]/i', ' ', strtoupper(trimAccent($adrL7)))));
if ($adrL7<>'' || $adrL7<>'FRANCE' || $adrL7<>'MONACO')
$tabLen=$tabMaxLen=array();
$tabLen[1]=strlen($adrL1); if ($tabLen[1]>$norme) $tabMaxLen[]=1;
$tabLen[2]=strlen($adrL2); if ($tabLen[2]>$norme) $tabMaxLen[]=2;
$tabLen[3]=strlen($adrL3); if ($tabLen[3]>$norme) $tabMaxLen[]=3;
$tabLen[4]=strlen($adrL4); if ($tabLen[4]>$norme) $tabMaxLen[]=4;
$tabLen[5]=strlen($adrL5); if ($tabLen[5]>$norme) $tabMaxLen[]=5;
$tabLen[6]=strlen($adrL6); if ($tabLen[6]>$norme) $tabMaxLen[]=6;
$tabLen[7]=strlen($adrL7); if ($tabLen[7]>$norme) $tabMaxLen[]=7;
if (count($tabMaxLen)>0) {
//print_r($tabLen);
foreach($tabMaxLen as $j) {
echo "La ligne n°$j fait ".$tabLen[$j]." caractères : '".$adrL[$j]."'".EOL;
}
if ($j>1) die("Une des lignes fait plus de $norme caractères !".EOL);
return "Une des lignes fait plus de $norme caractères !".EOL;
}
$L1=$adrL1;
$L2=$adrL2;
// Ligne 3, acheter HEXALIGNE3
$L3=$adrL3;
// Ligne 5 et 7 par défaut
$L7=$adrL7;
$L5=$adrL5;
// Ligne 6 : CP + Localité
$idAdr56=false;
$tabAdr56k=$tabAdr56L=array();
$cp=substr(trim($adrL6),0,5);
$cp2=substr($cp,0,2);
$ville=trim(strtr(substr($adrL6,5),array(' SAINT '=>' ST ',' SAINTE '=>' STE ')));
$ret=$iDb->select( 'hexaviaVilles',
"idAdr56, codeInseeCom, libCom$norme, codeInseeGlobal, indPluridis, libLigne5n$norme, indRoudis, codePostal, libLigne6n$norme, codeInseePre, codeMaj$norme, dateMaj$norme, MATCH (codePostal, libCom38) AGAINST ('$cp $ville' IN NATURAL LANGUAGE MODE) AS score",
"(MATCH (codePostal, libCom38) AGAINST ('$cp $ville' IN NATURAL LANGUAGE MODE) OR MATCH (codePostal, libCom38) AGAINST ('$cp2 $ville' IN NATURAL LANGUAGE MODE)) /*OR codePostal='$cp' AND libCom$norme='$ville'*/",false, MYSQL_ASSOC);
$nbRet=count($ret);
if ($nbRet==0) return 'Aucune correspondance CP VILLE'.EOL;
else {
foreach($ret as $i=>$iRet) {
//echo "je compare '$cp' avec '".$iRet['codePostal']."' et '$ville' avec '".$iRet["libCom$norme"]."' (".$iRet['idAdr56'].")".EOL;
if (($iRet['codePostal']==$cp || substr($iRet['codePostal'],0,2)==$cp2) && ($iRet["libCom$norme"]==$ville || preg_replace('/ 0/', ' ',$iRet["libCom$norme"])==$ville) || (strpos($iRet["libCom$norme"],$ville)>0 && $nbRet==1)) {
$idAdr56=$iRet['idAdr56'];
$dateMajHexavia=$iRet["dateMaj$norme"];
$hexaViaComCod=$iRet['codeInseeCom'];
$hexaViaComLib=$iRet["libCom$norme"];
$hexaViaCP=$iRet['codePostal'];
$L5=$iRet["libLigne5n$norme"];
$L6=$iRet['codePostal'].' '.$iRet["libLigne6n$norme"];
$L7='';
$tabAdr56k[]=$idAdr56;
$tabAdr56L['_'.$idAdr56]=array('L5'=>$L5,'L6'=>$L6,'L7'=>$L7,);
//break;
}
}
if (!$idAdr56) {
//print_r($ret);
//die('Plusieurs correspondances CP VILLE'.EOL);
return 'Plusieurs correspondances CP VILLE'.EOL;
}
}
/*if (count($ret)>1) {
print_r($ret);
die('Plusieurs correspondances CP VILLE'.EOL);
return 'Plusieurs correspondances CP VILLE'.EOL;
}
elseif (count($ret)==1) {
$ret=$ret[0];
$idAdr56=$ret['idAdr56'];
$L5=$ret["libLigne5n$norme"];
$L6=$ret['codePostal'].' '.$ret["libLigne6n$norme"];
$L7='';
}*/
// Ligne 4 :
$matriculeHexavia=false;
if(preg_match('/(^(\d{0,4})\s?([a-z]{0,1}))\s(.*)$/i', $adrL4, $matches)) {
$numVoieRep=$matches[1];
$numVoie=$matches[2];
$indRep=$matches[3];
$libVoie=$matches[4];
$libVoie5=substr($libVoie,0,5);
$tabAdr=$iInsee->structureVoie($libVoie);
$typeVoie=@$tabAdr['typeVoie'];
preg_match('/([a-z\d]{1,20})$/i', $libVoie, $matches2);
$derMot=$matches2[1];
$derMot5=substr($derMot,0,5);
//print_r($matches);
//die($derMot);
//foreach($tabAdr56 as $k=>$tabAdr56) //=array('idAdr56'=>$idAdr56,'L5'=>$L5,'L6'=>$L6,'L7'=>$L7,);
$strAdr56=implode("','", $tabAdr56k);
$ret=$iDb->select( 'hexaviaVoies',
"idAdr56, codeVoie, derElemVoie, libVoie$norme, typeVoie, descLibVoie, indStand$norme, indScind, indHomo, codePostal, codeRoudis, codeMaj$norme, dateMaj$norme
numImpMin, numImpMinExt, numImpMax, numImpMaxExt, numPairMin, numPairMinExt, numPairMax, numPairMaxExt, MATCH (libVoie38) AGAINST ('$libVoie' IN NATURAL LANGUAGE MODE) AS score",
// "idAdr56='$idAdr56' AND (MATCH (libVoie38) AGAINST ('$libVoie' IN NATURAL LANGUAGE MODE) OR libVoie38 LIKE '$libVoie5%' OR derElemVoie LIKE '$libVoie5%')/*AND typeVoie='$typeVoie' AND derElemVoie='$derMot'*/",false, MYSQL_ASSOC);
"idAdr56 IN ('$strAdr56') AND (MATCH (libVoie38) AGAINST ('$libVoie' IN NATURAL LANGUAGE MODE) OR libVoie38 LIKE '$libVoie5%' OR derElemVoie LIKE '$libVoie5%')/*AND typeVoie='$typeVoie' AND derElemVoie='$derMot'*/",false, MYSQL_ASSOC);
$nbRet=count($ret);
if ($nbRet==0) {
// Vérifier si la commune à des voies normées 98816
$ret=$iDb->select( 'hexaviaVoies', "codeVoie", "idAdr56 IN('$strAdr56')",false, MYSQL_ASSOC);
$nbVoiesCom=count($ret);
if (count($ret)==0) {
return "Aucune Voie recensée dans cette commune ('$strAdr56') !".EOL;
}
return "Aucune correspondance Voie pour '$adrL4', '$libVoie' ($nbVoiesCom voies dans la commune #$idAdr56)".EOL;
}
else {
foreach($ret as $i=>$iRet) {
//echo "je compare '$libVoie' avec '".$iRet["libVoie$norme"]."'".EOL;
if ($iRet["libVoie$norme"]==$libVoie || $iRet['derElemVoie']==$derMot || /*substr($iRet["libVoie$norme"],0,5)==$libVoie5 || */substr($iRet['derElemVoie'],0,5)==$derMot5) {
$tabAdr=$iInsee->structureVoie($libVoie);
if ($tabAdr['typeVoie']<>$iRet['typeVoie'] && $nbRet>1) continue;
$idAdr56=$iRet['idAdr56'];
$L4=preg_replace('/\s+/', ' ', trim($numVoie.' '.$indRep.' '.$iRet["libVoie$norme"]));
$L4=preg_replace('/^0+/','',$L4);
$hexaViaVoie=$iRet["libVoie$norme"];
if (strlen($L4)>$norme) return "Taille de la ligne 4 générée en sortie plus longue que $norme !".EOL;
$matriculeHexavia=$iRet['codeVoie'];
$codeRoudis=$iRet['codeRoudis'];
$L5=$tabAdr56L['_'.$idAdr56]['L5'];
$L6=$tabAdr56L['_'.$idAdr56]['L6'];
$L7=$tabAdr56L['_'.$idAdr56]['L7'];
break;
}
}
if (!$matriculeHexavia) {
//print_r($ret);
// die("Plusieurs correspondances Voies pour $adrL4 $adrL6 dans cette commune ('$strAdr56') !".EOL);
return 'Plusieurs correspondances Voies'.EOL;
}
}
}
/*
if (count($ret)==0) {
// Vérifier si la commune à des voies normées 98816
$ret=$iDb->select( 'hexaviaVoies', "codeVoie", "idAdr56='$idAdr56'",false, MYSQL_ASSOC);
if (count($ret)==0) {
return 'Aucune Voie recensée dans cette commune !'.EOL;
}
return 'Aucune correspondance Voie'.EOL;
}
elseif (count($ret)>1) {
print_r($ret);
$tabAdr=$iInsee->structureVoie($libVoie);
print_r($tabAdr);
return 'Plusieurs correspondances Voies'.EOL;
}
elseif (count($ret)==1) {
$ret=$ret[0];
$L4=preg_replace('/\s+/', ' ', trim($numVoie.' '.$indRep.' '.$ret["libVoie$norme"]));
if (strlen($L4)>$norme) return "Taille de la ligne 4 générée en sortie plus longue que $norme !".EOL;
$matriculeHexavia=$ret['codeVoie'];
$codeRoudis=$ret['codeRoudis'];
}
}
*/
$tabAdr=array(
'L1'=>$L1,
'L2'=>$L2,
'L3'=>$L3,
'L4'=>$L4,
'L5'=>$L5,
'L6'=>$L6,
'L7'=>$L7,
'HexaviaDateRef'=>$dateMajHexavia,
'HexaviaComCod'=>$hexaViaComCod,
'HexaviaComLib'=>$hexaViaComLib,
'HexaviaCP'=>$hexaViaCP,
'HexaVia56'=>$idAdr56,
'HexaViaVoie'=>$hexaViaVoie,
'HexaViaMat'=>$matriculeHexavia,
'RoudisId'=>$codeRoudis);
return $tabAdr;
/*
if ($adresseNum=='' && $adresseBtq=='' && $adresseVoie=='' && $adresseRue=='' && $cp=='' && $ville=='')
return false;
$tabAdr=$this->structureVoie($adresseNum.' '.$adresseBtq.' '.$adresseVoie.' '.$adresseRue);
$num=$tabAdr['num']*1;
if ($num==0) return false;
$indRep=trim($tabAdr['indRep']);
$typeVoie=trim($tabAdr['typeVoie']);
$libVoie=trim(substr($tabAdr['libVoie'],-5));
$strAdrActive='';
if ($active) {
$strAdrActive.=" AND (enActif=1 OR etActif=1) AND nbEntrep>30 AND pasEntrepDom=0 AND siren>1000 ";
}
$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 GROUP BY siren ORDER BY enActif DESC, nbEntrep DESC", false, MYSQL_ASSOC);
if (count($tabTmp)>0) {
return $tabTmp;
}
*/
return false;
}
}
?>

File diff suppressed because it is too large Load Diff

View File

@ -145,12 +145,12 @@ class MBourse
$timer['infosBoursieres-getCodeIsin']=microtime(true);
$tabRet=array();
if ($isin<>'') {
$tabRes=$iDb->select( 'bourse_isin b, bourse_cours c',
'siren, raisonSociale, adresse, effectif, code_sicovam, code_mnemo, code_bloomberg, code_datastream, code_isin, logo, code_ric, '.
'dateIntroduction, dateDerAG, dateRadiation, autre_isin, eligibleSRD, eligiblePEA, nombreTitres, tel1, tel2, fax1, fax2, web, mail, '.
'marche, placeCotation, description, secteur, activite, activiteDet, dirigeants, actionnaires, chiffresTrim, '.
'c.autre, c.`date`, c.`heure`, c.`open` , c.`high` , c.`low` , c.`close` , c.`volume`',
"code_isin='$isin' /*OR siren=$siren)*/ AND b.code_isin=c.isin AND c.autre IN('','e','f','g','m','s','u') ORDER BY c.`date` DESC, c.`heure` DESC LIMIT 0,1", false, MYSQL_ASSOC);
$tabRes=$iDb->select( 'bourse_isin b, bourse_cours c',
'siren, raisonSociale, adresse, effectif, code_sicovam, code_mnemo, code_bloomberg, code_datastream, code_isin, logo, code_ric, '.
'dateIntroduction, dateDerAG, dateRadiation, autre_isin, eligibleSRD, eligiblePEA, nombreTitres, tel1, tel2, fax1, fax2, web, mail, '.
'marche, placeCotation, description, secteur, activite, activiteDet, dirigeants, actionnaires, chiffresTrim, '.
'c.autre, c.`date`, c.`heure`, c.`open` , c.`high` , c.`low` , c.`close` , c.`volume`',
"code_isin='$isin' /*OR siren=$siren)*/ AND b.code_isin=c.isin AND c.autre IN('','e','f','g','m','s','u') ORDER BY c.`date` DESC, c.`heure` DESC LIMIT 0,1", false, MYSQL_ASSOC);
$tabRet=$tabRes[0];
$timer['infosBoursieres-infosIsin']=microtime(true);

View File

@ -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'],
);
}
}

View File

@ -3694,6 +3694,8 @@ function getListeActes($siren) {
'mode_diffusion' => implode(',',$tabVecteurs),
'decision_nature' => utf8_decode($acte_nature),
'decision_libelle' => utf8_decode($acte_decision),
'actif' => 1,
'dateInsert' => date('YmdHis'),
);
@$iDb->insert('greffes_actes', $tabInsert);
//@sendMail('production@scores-decisions.com', 'ylenaour@scores-decisions.com', "classMGreffes::Debug getListeActes($siren)", print_r($tabInsert,true).mysql_error()) ;

View File

@ -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;

View File

@ -1,112 +0,0 @@
<html>
<head>
<title>Imagery Service example in PHP (with Geocode)</title>
</head>
<body>
This example currently accesses the staging environment only. Username, password, and address are required.<br>
In order to run this example, the php_soap extension must be enabled. This was built and tested using PHP 5.3.0.<br><br>
<form action="imageryservicesample.php" method="post">
Username: <input type="text" name="username" value="<?php echo (isset($_POST['username'])?$_POST['username']:'') ?>">
Password: <input type="text" name="password" value="<?php echo (isset($_POST['password'])?$_POST['password']:'') ?>"><br>
Address: <input type="text" name="address" value="<?php echo (isset($_POST['address'])?$_POST['address']:'') ?>"><br>
Zoom: <input type="text" name="zoomlevel" value="<?php echo (isset($_POST['zoomlevel'])?$_POST['zoomlevel']:'') ?>"><br>
<input type="submit" value="Submit">
</form>
<?php
if(isset($_POST['username']) && isset($_POST['password']))
{
$UserName = $_POST['username'];
$Password = $_POST['password'];
// Url to the token service wsdl (for now it's a local file)
$TokenServiceWsdl = "tokenreference.wsdl";
// Create the service client object
//trace allows us to see last response and request for debugging
$tokenClient = new SoapClient($TokenServiceWsdl, array('login' => $UserName, 'password' => $Password, 'trace' => true));
// TokenSpecification "object"
$tokenSpec = array(
'ClientIPAddress' => '0.0.0.0',
'TokenValidityDurationMinutes' => '60'
);
try {
// Get the client token
$tokenResponse = $tokenClient->GetClientToken(array('specification' => $tokenSpec));
}
catch(SoapFault $e)
{
die('Fault occurred using Web Service: '.$e->getMessage());//.print_r($res,true));
}
// Get the token from the response object
$token = $tokenResponse->GetClientTokenResult;
// URLs to the Imagery and Geocode services
$imageryServiceWsdl = 'imageryservice.wsdl';
$geocodeServiceWsdl = 'geocodeservice.wsdl';
// Credentials "object"
$credentials = array('Token' => $token);
// Create the geocode service and imagery service clients
$geocodeClient = new SoapClient($geocodeServiceWsdl, array('trace' => 1));
$imageryClient = new SoapClient($imageryServiceWsdl, array('trace' => 1));
// GeocodeRequest "object"
$geocodeRequest = array(
'Credentials' => $credentials,
'Query' => $_POST['address']
);
try {
if(isset($_POST['address']))
$geocodeResponse = $geocodeClient->Geocode(array('request' => $geocodeRequest));
}
catch(SoapFault $e)
{
die('Fault occurred using Web Service: '.$e->getMessage());
}
// Retrieve the latitude and longitude from the response object
$lat = $geocodeResponse->GeocodeResult->Results->GeocodeResult->Locations->GeocodeLocation->Latitude;
$lon = $geocodeResponse->GeocodeResult->Results->GeocodeResult->Locations->GeocodeLocation->Longitude;
// Location "object"
$location = array(
'Latitude' => $lat,
'Longitude' => $lon
);
if($_POST['zoomlevel'] == '')
$_POST['zoomlevel'] = null;
// MapUriOptions "object"
$options = array(
'ZoomLevel' => $_POST['zoomlevel']
);
// MapUriRequest "object"
$mapUriRequest = array(
'Credentials' => $credentials,
'Center' => $location,
'Options' => $options
);
try {
// GetMapUri method call
$mapUriResponse = $imageryClient->GetMapUri(array('request' => $mapUriRequest));
}
catch(SoapFault $e)
{
die('Fault occurred using Web Service: '.$e->getMessage());
}
// Display the URI and lat/lon returned from the service call
echo '<img src="' . $mapUriResponse->GetMapUriResult->Uri . '"><br>';
echo 'Latitude: '.$lat.' Longitude: '.$lon;
}
?>
</body>
</html>

View File

@ -287,6 +287,9 @@ une erreur sur cette notice">Signalez une erreur sur cette notice</a></p>
if (preg_match('/<div><p style="color\:red;"><strong>(.*)<\/strong><\/p>/Uis', $body, $matches))
$tabMarque['infoMarque']=trim(utf8_decode($matches[1]));
if (preg_match('/<strong>Date de dépôt \/ Enregistrement<\/strong>(.*)<\/p>/Uis', $body, $matches))
$tabMarque['dateDepot']=trim(utf8_decode(strtr($matches[1],array(' '=>' ',':'=>' '))));
if (preg_match("/<div class=\"images\"><p><u><strong>(.*)<\/strong><\/u><\/p><img src='Typo3_INPI_Marques\/getImg\?doc=(.*)' alt='(.*)' class='null'\/><\/div>/Uis", $body, $matches)) {
$tabMarque['periMarque']=trim(utf8_decode($matches[1]));
$tabMarque['idObjetImg']=trim($matches[2]);
@ -298,13 +301,40 @@ une erreur sur cette notice">Signalez une erreur sur cette notice</a></p>
if ($page['code']==200) {
$ext=trim('.'.strtr(preg_replace('/^image\//','',preg_replace('/;.*/','',$page['header']['Content-Type'])),array('?'=>'')));
//die("'".DOC_WEB_LOCAL.'marques/'.$tabMarque['numeroMarque'].$ext."'");
$fp=@fopen(DOC_WEB_LOCAL.'marques/'.$tabMarque['numeroMarque'].$ext, 'a');
// Gestion des dossiers
$annee=substr($tabMarque['dateDepot'],0,4);
$dateDepotYMD=str_replace('-','',$tabMarque['dateDepot']);
$dossierCible=DOC_WEB_LOCAL."marques/$annee/$dateDepotYMD/";
@mkdir(DOC_WEB_LOCAL."marques/$annee");
@mkdir($dossierCible);
// Gestion de l'image
$fp=@fopen($dossierCible.$tabMarque['numeroMarque'].$ext, 'a');
/* echo $dossierCible.$tabMarque['numeroMarque'].$ext;
echo "\t".filesize($dossierCible.$tabMarque['numeroMarque'].$ext).' octets';*/
@fwrite($fp, $page['body']);
@fclose($fp);
$tabMarque['fileName']=$tabMarque['numeroMarque'].$ext;
if ($tabMarque['nomMarque']=='' || $tabMarque['nomMarque']=='&nbsp;')
$tabMarque['typeMarque']='Figurative';
else
$tabMarque['typeMarque']='Semi-Figurative';
/*
Une marque verbale
composée d'un ou plusieurs termes qui peuvent s'écrire ou se prononcer,
c'est à dire par exemple un nom de naissance ou patronymique (par exemple : Guy Degrenne), une dénomination arbitraire créée de toutes pièces (par exemple : Yoplait) , un mot détourné de son sens, un slogan (par exemple : Parce que vous le valez bien)
Une marque semi-figurative
marque associant un terme verbal et un visuel.
Elle peut également être qualifiée de marque complexe.
Une marque figurative
marque composée uniquement d’un visuel, c’est à dire un signe qui ne s'adresse qu’à l’œil (par exemple : le crocodile Lacoste)
*/
}
//die();
}
}
} else
$tabMarque['typeMarque']='Verbale';
if (preg_match('/<p><strong>Produits et services<\/strong><\/p>(.*)<\/ul><\/p>/Uis', $body, $matches)) {
$tabClasses=array();
@ -400,8 +430,17 @@ une erreur sur cette notice">Signalez une erreur sur cette notice</a></p>
//die();
$ret=$this->iDb->insert('marques', $tabInsert);
if (!$ret && mysql_errno()<>1062) {
echo "Erreur 'marques' : ".mysql_error().EOL;
die();
//echo "Erreur INSERT 'marques' : ".mysql_error().EOL;
//die();
} elseif (mysql_errno()==1062) {
unset($tabInsert['dateInsert']);
if (!$this->iDb->update('marques', $tabInsert, "numeroMarque='".$tabMarque['numeroMarque']."' AND rayonMarque='".$tabMarque['rayonMarque']."'", false)) {
//echo "Erreur UPDATE 'marques' : ".mysql_error().EOL;
//die();
}
$ret=$this->iDb->select('marques', 'id', "numeroMarque='".$tabMarque['numeroMarque']."' AND rayonMarque='".$tabMarque['rayonMarque']."'", false, MYSQL_ASSOC);
$ret=$ret[0]['id'];
$updateTodo=true;
}
// Insertion du détail des classes
@ -418,6 +457,9 @@ une erreur sur cette notice">Signalez une erreur sur cette notice</a></p>
print_r($tabInsert);
print_r($tabMarque['classes']);
die("Erreur 'marques_classes' : ".mysql_error().EOL);
} elseif ($updateTodo && mysql_errno()==1062) {
unset($tabInsert['dateInsert']);
$this->iDb->update('marques_classes', $tabInsert, "id=$ret AND id2=$i", false);
}
}
@ -435,6 +477,9 @@ une erreur sur cette notice">Signalez une erreur sur cette notice</a></p>
print_r($tabInsert);
print_r($tabMarque['pays']);
die("Erreur 'marques_pays' : ".mysql_error().EOL);
} elseif ($updateTodo && mysql_errno()==1062) {
unset($tabInsert['dateInsert']);
$this->iDb->update('marques_pays', $tabInsert, "id=$ret AND id2=$i", false);
}
}
@ -452,6 +497,9 @@ une erreur sur cette notice">Signalez une erreur sur cette notice</a></p>
print_r($tabInsert);
print_r($tabMarque['priorite']);
die("Erreur 'marques_priorite' : ".mysql_error().EOL);
} elseif ($updateTodo && mysql_errno()==1062) {
unset($tabInsert['dateInsert']);
$this->iDb->update('marques_priorite', $tabInsert, "id=$ret AND id2=$i", false);
}
}
@ -467,6 +515,9 @@ une erreur sur cette notice">Signalez une erreur sur cette notice</a></p>
print_r($tabInsert);
print_r($tabMarque['historique']);
die("Erreur 'marques_histo' : ".mysql_error().EOL);
} elseif ($updateTodo && mysql_errno()==1062) {
unset($tabInsert['dateInsert']);
$this->iDb->update('marques_classes', $tabInsert, "id=$ret AND id2=$i", false);
}
}

View File

@ -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('&nbsp;'=>'','<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);

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,750 +0,0 @@
<?php
$tva=19.6;
/** Donne le taux d'inflation pour une année donnée **/
function getInflation($annee) {
$tabInfla = include realpath(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'CacheTabInfla.php';
if (isset($tabInfla[$annee])) return $tabInfla[$annee];
}
/** Donne le taux de rendement des actions pour une année donnée **/
function getTxRendement($annee) {
$tabTxRendObli = include realpath(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'CacheTabRendObli.php';
if (isset($tabTxRendObli[$annee])) return $tabInfla[$annee];
}
function calculRatios($tabBilans, $tabIdentite, $accesPartenaire) {
global $tva, $mBil, $tabBilan, $efftr;
$numBil=0;
$numBilType=array();
foreach ($tabBilans as $millesime=>$bil) {
$tabTmp=@$mBil->getBilan(substr($millesime,-10), substr($millesime,0,1), @$bil['ref'], $accesPartenaire, $nbRatiosMax=5);
$numBilType[substr($millesime,0,1)]++;
if (substr($millesime,0,1)=='S') {
if ($numBilType['S']>$nbRatiosMax) continue;
$tabTmp2=$mBil->bilanSimplifie2Normal($tabTmp);
$tabBilan[$numBil]=array_merge($tabTmp2, $tabTmp);
} elseif (substr($millesime,0,1)=='N') {
if ($numBilType['N']>$nbRatiosMax) continue;
$tabBilan[$numBil]=$tabTmp;
} elseif (substr($millesime,0,1)=='C') {
if ($numBilType['C']>$nbRatiosMax) continue;
$tabBilan[$numBil]=$tabTmp;
} elseif (substr($millesime,0,1)=='A') {
if ($numBilType['A']>$nbRatiosMax) continue;
$tabBilan[$numBil]=$tabTmp;
//return(array());
} elseif (substr($millesime,0,1)=='B') {
if ($numBilType['B']>$nbRatiosMax) continue;
$tabBilan[$numBil]=$tabTmp;
//return(array());
}
unset($tabTmp); unset($tabTmp2);
if ($numBil>10) break;
$p=$tabBilan[$numBil];
$nm=$p['DUREE_MOIS'];
$nmp=$p['DUREE_MOIS_PRE'];
$R=array();
$R[0]=0;
if (!isset($R[0])) $R[0]='NS';
$R[1]=$p['FJ'];
if (!isset($R[1])) $R[1]='NS';
$R[2]=($p['FJ']*12)/$nm;if ($R[2]<0) $R[2]=0;
if (!isset($R[2])) $R[2]='NS';
$R[3]=$p['FK'];
if (!isset($R[3])) $R[3]='NS';
$R[4]=($p['FK']*12)/$nm;if ($R[4]<0) $R[4]=0;
if (!isset($R[4])) $R[4]='NS';
$R[5]=$p['FL'];
if (!isset($R[5])) $R[5]='NS';
$R[6]=($p['FL']*12)/$nm;if ($R[6]<0) $R[6]=0;
if (!isset($R[6])) $R[6]='NS';
$R[7]=$p['GW'];
if (!isset($R[7])) $R[7]='NS';
$R[8]=($p['GW']*12)/$nm;
if (!isset($R[8])) $R[8]='NS';
$R[10]=$p['HN'];
if (!isset($R[10])) $R[10]='NS';
$R[11]=($p['HN']*12)/$nm;
if (!isset($R[11])) $R[11]='NS';
$R[12]=$p['HI'];
if (!isset($R[12])) $R[12]='NS';
$R[13]=($p['HI']*12)/$nm;
if (!isset($R[13])) $R[13]='NS';
$R[14]=$p['GV'];
if (!isset($R[14])) $R[14]='NS';
$R[15]=($p['GV']*12)/$nm;
if (!isset($R[15])) $R[15]='NS';
$R[16]=$p['GG'];
if (!isset($R[16])) $R[16]='NS';
$R[17]=($p['GG']*12)/$nm;
if (!isset($R[17])) $R[17]='NS';
$R[18]=$p['DL'];
if (!isset($R[18])) $R[18]='NS';
$R[19]=($p['DL']*12)/$nm;
if (!isset($R[19])) $R[19]='NS';
$R[20]=$p['GR'];
if (!isset($R[20])) $R[20]='NS';
$R[21]=($p['GR']*12)/$nm;
if (!isset($R[21])) $R[21]='NS';
$R[22]=$p['EE'];
if (!isset($R[22])) $R[22]='NS';
$R[23]=($p['EE']*12)/$nm;
if (!isset($R[23])) $R[23]='NS';
$R[24]=$p['YP'];if ($R[24]==0) $R[24]=$efftr;
if (!isset($R[24])) $R[24]='NS';
$R[25]=($p['FK']*100)/$p['FL'];if ($R[25]<0) $R[25]=0;
if (!isset($R[25])) $R[25]='NS';
$R[30]=$p['AF'];
if (!isset($R[30])) $R[30]='NS';
$R[31]=$p['AN'];
if (!isset($R[31])) $R[31]='NS';
$R[32]=$p['EC'];
if (!isset($R[32])) $R[32]='NS';
$R[33]=$p['DR'];
if (!isset($R[33])) $R[33]='NS';
$R[51]=$p['AB']+$p['AD']+$p['AF']+$p['AH']+$p['AJ']+$p['AL']-$p['AC']-$p['AE']-$p['AG']-$p['AI']-$p['AK']-$p['AM'];
if (!isset($R[51])) $R[51]='NS';
$R[52]=$p['AN']+ $p['AP']+ $p['AR']+ $p['AT']+ $p['AV']+ $p['AX']- $p['AO']- $p['AQ']- $p['AS']- $p['AU']- $p['AW']- $p['AY'];
if (!isset($R[52])) $R[52]='NS';
$R[53]=$p['CS']+ $p['CU']+ $p['BB']+ $p['BD']+ $p['BF']+ $p['BH']- $p['CT']- $p['CV']- $p['BC']- $p['BE']- $p['BG']- $p['BI'];
if (!isset($R[53])) $R[53]='NS';
$R[59]=$R[51]+$R[52]+$R[53];
if (!isset($R[59])) $R[59]='NS';
$R[60]=$p['BL']+ $p['BN']+ $p['BP']+ $p['BR']+ $p['BT']- $p['BM']- $p['BO']- $p['BQ']- $p['BS']- $p['BU'];
if (!isset($R[60])) $R[60]='NS';
$R[61]=$p['BX']-$p['DW']+$p['YS']-$p['BY'];
if (!isset($R[61])) $R[61]='NS';
$R[62]=$p['BZ']+ $p['CB']+ $p['CH']- $p['CA']- $p['CC']- $p['CI'];
if (!isset($R[62])) $R[62]='NS';
$R[63]=$p['CD']+$p['CF']-$p['CE']-$p['CG'];
if (!isset($R[63])) $R[63]='NS';
$R[64]=($R[63]*12)/$nm;
if (!isset($R[64])) $R[64]='NS';
$R[65]=$R[61]+$R[62];
if (!isset($R[65])) $R[65]='NS';
$R[67]=($R[59]*12)/$nm;
if (!isset($R[67])) $R[67]='NS';
$R[69]=$R[60]+$R[61]+$R[62]+$R[63];
if (!isset($R[69])) $R[69]='NS';
$R[70]=$p['DL']+$p['DO']-$p['AA']-($p['CL']+$p['CM']+$p['CN'])+$p['ED'];
if (!isset($R[70])) $R[70]='NS';
$R[71]=$p['DR'];
if (!isset($R[71])) $R[71]='NS';
$R[72]=$p['VI'];
if (!isset($R[72])) $R[72]='NS';
$R[73]=$p['DW']+$p['DX']+$p['DY']+$p['DZ']+$p['EA']+$p['EH'];
if (!isset($R[73])) $R[73]='NS';
$R[74]=$p['DK'];
if (!isset($R[74])) $R[74]='NS';
$R[79]=$R[70]+$R[71]+$R[72];
if (!isset($R[79])) $R[79]='NS';
$R[80]=$p['DS']+$p['DT']+$p['DU']+$p['DV']-$p['EH']-$p['VI'];if ($R[80]<0) $R[80]=0;
if (!isset($R[80])) $R[80]='NS';
$R[81]=$p['VG1']+$p['VH1'];
if (!isset($R[81])) $R[81]='NS';
$R[82]=$R[70];if ($R[82]<0) $R[82]=0;
if (!isset($R[82])) $R[82]='NS';
$R[83]=$p['DS']+$p['DT']+$p['DU']+$p['DV']-$p['EH']-$p['VI'];if ($R[83]<0) $R[83]=0;
if (!isset($R[83])) $R[83]='NS';
$R[84]=$p['DX']- $p['BV']+ $p['BW'];
if (!isset($R[84])) $R[84]='NS';
$R[85]=$p['DY'];
if (!isset($R[85])) $R[85]='NS';
$R[86]=$p['DZ']+ $p['EA']+ $p['EB']+ $R[80];
if (!isset($R[86])) $R[86]='NS';
$R[87]=$p['YS']+ $p['EH'];
if (!isset($R[87])) $R[87]='NS';
$R[88]=$p['DW']+ $p['DY']+ $p['EH']+ $p['DZ']+ $p['EA']+ $p['EB']+ $p['YS'];
if (!isset($R[88])) $R[88]='NS';
$R[89]=$p['DS']+ $p['DT']+ $p['DU']+ $p['DV']- $p['EH']- $p['VI'];
if (!isset($R[89])) $R[89]='NS';
$R[90]=$R[83]+$R[84]+$R[85]+$R[86]+$R[87];
if (!isset($R[90])) $R[90]='NS';
$R[91]=$p['DL']+$p['DO']+$p['DR']+$p['VI']-$p['DJ']-$p['DK']-$p['AA'];
if (!isset($R[91])) $R[91]='NS';
$R[92]=($p['DL']+$p['DO']+$p['DR']+$p['VI']-$p['DJ']-$p['DK']-$p['AA'])/$p['EE'];
if (!isset($R[92])) $R[92]='NS';
$R[93]=($R[69]*12)/$nm;
if (!isset($R[93])) $R[93]='NS';
$R[101]=$p['FL'];
if (!isset($R[101])) $R[101]='NS';
$R[102]=$p['FS']+ $p['FU'];
if (!isset($R[102])) $R[102]='NS';
$R[110]=$R[101]-$p['FS'] -$p['FT'];
if (!isset($R[110])) $R[110]='NS';
$R[111]=$p['FF']+$p['FI'];
if (!isset($R[111])) $R[111]='NS';
$R[112]=$p['FM']+ $p['FN'];
if (!isset($R[112])) $R[112]='NS';
$R[120]=$R[111]+$R[112];
if (!isset($R[120])) $R[120]='NS';
$R[121]=$p['FT']+ $p['FV'];
if (!isset($R[121])) $R[121]='NS';
$R[122]=$R[101]+$R[112]-$R[102]-$R[121];
if (!isset($R[122])) $R[122]='NS';
$R[123]=$p['FW']- $p['HP']- $p['HQ'];
if (!isset($R[123])) $R[123]='NS';
$R[124]=($R[120]*12)/$nm;
if (!isset($R[124])) $R[124]='NS';
$R[130]=$R[122]-$R[123];
if (!isset($R[130])) $R[130]='NS';
$R[131]=$p['FO'];
if (!isset($R[131])) $R[131]='NS';
$R[132]=$p['FY']+$p['FZ'];
if (!isset($R[132])) $R[132]='NS';
$R[133]=$p['FX'];
if (!isset($R[133])) $R[133]='NS';
$R[140]=$R[130]-$R[132]-$R[133]+$R[131];
if (!isset($R[140])) $R[140]='NS';
$R[141]=$p['FQ'];
if (!isset($R[141])) $R[141]='NS';
$R[142]=$p['GE'];
if (!isset($R[142])) $R[142]='NS';
$R[143]=$p['FP'];
if (!isset($R[143])) $R[143]='NS';
$R[144]=($p['HP']+ $p['HQ'])*0.7;
if (!isset($R[144])) $R[144]='NS';
$R[145]=$p['GA']+ $p['GB']+ $p['GC']+ $p['GD']+$R[144];
if (!isset($R[145])) $R[145]='NS';
$R[146]=($R[140]*12)/$nm;
if (!isset($R[146])) $R[146]='NS';
$R[150]=$R[140]+$R[141]-$R[142]+$R[143]-$R[145];
if (!isset($R[150])) $R[150]='NS';
$R[151]=$p['GP'];
if (!isset($R[151])) $R[151]='NS';
$R[152]=($p['HP']+ $p['HQ'])*0.3;
if (!isset($R[152])) $R[152]='NS';
$R[153]=$p['GU']+$R[152];
if (!isset($R[153])) $R[153]='NS';
$R[160]=$R[151]-$R[153];
if (!isset($R[160])) $R[160]='NS';
$R[161]=$p['GH']- $p['GI'];
if (!isset($R[161])) $R[161]='NS';
$R[170]=$R[150]+$R[161]+$R[151]-$R[153];
if (!isset($R[170])) $R[170]='NS';
$R[171]=$p['HD'];
if (!isset($R[171])) $R[171]='NS';
$R[172]=$p['HH'];
if (!isset($R[172])) $R[172]='NS';
$R[180]=$R[171]-$R[172];
if (!isset($R[180])) $R[180]='NS';
$R[181]=$p['HK'];
if (!isset($R[181])) $R[181]='NS';
$R[182]=$p['HJ'];
if (!isset($R[182])) $R[182]='NS';
$R[199]=$R[170]+$R[171]-$R[172]-$R[181]-$R[182];
if (!isset($R[199])) $R[199]='NS';
$R[201]=$p['DL']+ $p['DO']+ $p['DR']+ $p['VI']- $p['AA'];
if (!isset($R[201])) $R[201]='NS';
$R[202]=$R[201]+$R[80];
if (!isset($R[202])) $R[202]='NS';
$R[203]=$p['YY'];if ($R[203]==0) $R[203]=(($p['FJ']*$tva)/100);
if (!isset($R[203])) $R[203]='NS';
$R[204]=(($R[203]+$R[5])*12/$nm)/360;if ($R[204]<0) $R[204]=0;
if (!isset($R[204])) $R[204]='NS';
$R[205]=($p['FS']-$p['FT']+$p['FU']-$p['FV']+$p['FW'])*$tva/100;
if (!isset($R[205])) $R[205]='NS';
$R[206]=$p['YZ'];if ($R[206]==0) $R[206]=$R[205];
if (!isset($R[206])) $R[206]='NS';
$R[207]=((($p['FS']- $p['FT']+ $p['FU']- $p['FV']+ $p['FW'])+ ($R[206]))*12/$nm)/360;if ($R[207]<0) $R[207]=0;
if (!isset($R[207])) $R[207]='NS';
$R[208]=($R[5]*100)/$p['EE'];
if (!isset($R[208])) $R[208]='NS';
$R[209]=$p['HP']+$p['HQ']-$p['GR'];
if (!isset($R[209])) $R[209]='NS';
$R[210]=$p['BX']-$p['BY']+$p['YS'];
if (!isset($R[210])) $R[210]='NS';
$R[211]=($R[210]*100)/$p['EE'];
if (!isset($R[211])) $R[211]='NS';
$R[212]=($R[84]*100)/$p['EE'];
if (!isset($R[212])) $R[212]='NS';
$R[213]=$p['BL']-$p['BM'];
if (!isset($R[213])) $R[213]='NS';
$R[214]=($R[213]*100)/$p['EE'];
if (!isset($R[214])) $R[214]='NS';
$R[215]=$p['BN']-$p['BO'];
if (!isset($R[215])) $R[215]='NS';
$R[216]=($R[215]*100)/$p['EE'];
if (!isset($R[216])) $R[216]='NS';
$R[217]=$p['BP']-$p['BQ'];
if (!isset($R[217])) $R[217]='NS';
$R[218]=($R[217]*100)/$p['EE'];
if (!isset($R[218])) $R[218]='NS';
$R[219]=$p['BR']-$p['BS'];
if (!isset($R[219])) $R[219]='NS';
$R[220]=($R[219]*100)/$p['EE'];
if (!isset($R[220])) $R[220]='NS';
$R[221]=$p['BT']-$p['BU'];
if (!isset($R[221])) $R[221]='NS';
$R[222]=($R[221]*100)/$p['EE'];
if (!isset($R[222])) $R[222]='NS';
$R[223]=$R[79]+$R[80]-$R[59];
if (!isset($R[223])) $R[223]='NS';
$R[224]=$p['CJ']-$p['CK']-$p['CH']+$p['CI']-$p['DW']-$p['DX']-$p['DY']-$p['DZ']-$p['EA']-$p['EH'];
if (!isset($R[224])) $R[224]='NS';
$R[225]=$R[60]+$R[61]+$R[62]-$R[84]-$R[85]-$R[86];
if (!isset($R[225])) $R[225]='NS';
$R[226]=$R[223]-$R[225];
if (!isset($R[226])) $R[226]='NS';
$R[227]=$p['YS'];
if (!isset($R[227])) $R[227]='NS';
$R[228]=($R[79]*12)/$nm;
if (!isset($R[228])) $R[228]='NS';
$R[229]=$p['FY']+$p['FZ'];
if (!isset($R[229])) $R[229]='NS';
$R[230]=abs($R[223]);
if (!isset($R[230])) $R[230]='NS';
$R[231]=$R[202]- $p['BJ']+ $p['BK']+ $p['ED']- $p['CL']- $p['CM']- $p['CN'];
if (!isset($R[231])) $R[231]='NS';
$R[232]=$p['CJ']- $p['CK']+ $p['YS']- $p['CF']- $p['CD']+ $p['CE']+$p['CG']- $p['DW']- $p['DX']- $p['DY']- $p['DZ']- $p['EA']- $p['EB'];
if (!isset($R[232])) $R[232]='NS';
$R[233]=$p['HN']+ $p['HF']+ $p['HG']- $p['HB']- $p['HC']+ $p['GQ']- $p['GM']+ $p['GA']+ $p['GB']+ $p['GC']+ $p['GD']- $p['FP'];
if (!isset($R[233])) $R[233]='NS';
$R[234]=($R[231]*100)/$R[232];
if (!isset($R[234])) $R[234]='NS';
$R[235]=($R[231])*12/$nm;
if (!isset($R[235])) $R[235]='NS';
$R[236]=($R[232])*12/$nm;
if (!isset($R[236])) $R[236]='NS';
$R[237]=($R[202]*100)/$R[59];
if (!isset($R[237])) $R[237]='NS';
$R[238]=($R[235]*360)/$R[6];
if (!isset($R[238])) $R[238]='NS';
$R[239]=($R[70]*100)/$p['EC'];
if (!isset($R[239])) $R[239]='NS';
$R[240]=($R[70]*100)/abs($R[202]);if ($R[240]<0) $R[240]=0;
if (!isset($R[240])) $R[240]='NS';
$R[241]=($p['EC']/($R[70]))*100;
if (!isset($R[241])) $R[241]='NS';
$R[242]=(($p['GR']+$R[152])*100)/$R[140];if ($R[242]<-200) $R[242]=-200;
if (!isset($R[242])) $R[242]='NS';
$R[243]=($R[81]*100)/($R[79]+$R[90]);
if (!isset($R[243])) $R[243]='NS';
$R[244]=($R[89]*100)/$R[70];
if (!isset($R[244])) $R[244]='NS';
$R[245]=($R[153]*100)/$p['EC'];
if (!isset($R[245])) $R[245]='NS';
$R[246]=($R[153]*100)/$R[140];
if (!isset($R[246])) $R[246]='NS';
$R[247]=($R[80]+$p['YQ']+$p['YR'])/$R[233];
if (!isset($R[247])) $R[247]='NS';
$R[248]=$R[84]*100/$R[60];
if (!isset($R[248])) $R[248]='NS';
$R[249]=$R[231]-$R[232];
if (!isset($R[249])) $R[249]='NS';
$R[250]=($R[63]*100)/$R[88];
if (!isset($R[250])) $R[250]='NS';
$R[251]=(($p['CJ']- $p['CK']- $p['CH']+ $p['CL'])*100/$R[88]);
if (!isset($R[251])) $R[251]='NS';
$R[252]=($R[63]+$R[61])*100/$R[88];
if (!isset($R[252])) $R[252]='NS';
$R[253]=($p['CJ']-$p['CK']-$p['CH']+$p['CL'])*100/$R[73];
if (!isset($R[253])) $R[253]='NS';
$R[254]=$p['AO']+$p['AQ']+$p['AS']+$p['AU']+$p['AW']+$p['AY'];
if (!isset($R[254])) $R[254]='NS';
$R[261]=$R[124]/$R[24];
if (!isset($R[261])) $R[261]='NS';
$R[262]=($R[140]*100/$p['EE']);
if (!isset($R[262])) $R[262]='NS';
$R[263]=($p['HN']*100/$R[70]);
if (!isset($R[263])) $R[263]='NS';
$R[264]=($p['HN']*100/($p['FL']+ $p['FO']));
if (!isset($R[264])) $R[264]='NS';
$R[265]=((($R[233]*12)/$nm)*100)/$R[202];
if (!isset($R[265])) $R[265]='NS';
$R[266]=($R[233]*100)/$R[130];
if (!isset($R[266])) $R[266]='NS';
$R[267]=$R[6]/$R[24];
if (!isset($R[267])) $R[267]='NS';
$R[268]=($R[140]*100)/($p['FL']+$p['FO']);
if (!isset($R[268])) $R[268]='NS';
$R[269]=($R[130]*100)/($R[51]+$R[52]);
if (!isset($R[269])) $R[269]='NS';
$R[271]=($p['FL']+$p['FO'])*100/$p['EE'];
if (!isset($R[271])) $R[271]='NS';
$R[272]=((($p['FU']- $p['FV'])*12)/$nm)/360;
if (!isset($R[272])) $R[272]='NS';
$R[273]=($p['BL']- $p['BM'])/$R[272];if ($R[273]<0) $R[273]=0;if ($R[273]>730) $R[273]=730;
if (!isset($R[273])) $R[273]='NS';
$R[274]=(($p['FS']- $p['FT'])*12/$nm)/360;if ($R[274]<0) $R[274]=0;
if (!isset($R[274])) $R[274]='NS';
$R[275]=($p['BT']- $p['BU'])/$R[274];if ($R[275]<0) $R[275]=0;if ($R[275]>730) $R[275]=730;
if (!isset($R[275])) $R[275]='NS';
$R[276]=((($p['FL']+$p['FM']+$p['FN'])*12)/$nm)/360;if ($R[276]<0) $R[276]=0;
if (!isset($R[276])) $R[276]='NS';
$R[277]=(($p['BR']-$p['BS'])+($p['BN']- $p['BO'])+($p['BP']- $p['BQ'])- $p['DW'])/$R[276];if ($R[277]<0) $R[277]=0;if ($R[277]>730) $R[277]=730;
if (!isset($R[277])) $R[277]='NS';
$R[278]=(($p['BX']-$p['BY']+ $p['YS'])/$R[204]);if ($R[278]<0) $R[278]=0;if ($R[278]>730) $R[278]=730;
if (!isset($R[278])) $R[278]='NS';
$R[279]=($p['DX']-$p['BV'])/$R[207];if ($R[279]<0) $R[279]=0;if ($R[279]>730) $R[279]=730;
if (!isset($R[279])) $R[279]='NS';
$R[280]=(($p['AO']+ $p['AQ']+ $p['AS']+ $p['AU']+ $p['AW']+ $p['AY'])/($p['AN']+ $p['AP']+ $p['AR']+ $p['AT']+ $p['AV']+ $p['AX']))*100;
if (!isset($R[280])) $R[280]='NS';
$R[281]=(($p['FY']+ $p['FZ'])/$R[130])*100;
if (!isset($R[281])) $R[281]='NS';
$R[282]=(($p['GA']+$p['GB'])*100)/$R[130];
if (!isset($R[282])) $R[282]='NS';
$R[283]=(($p['HN'])*100)/$R[130];
if (!isset($R[283])) $R[283]='NS';
$R[284]=($R[153]*100)/$R[130];
if (!isset($R[284])) $R[284]='NS';
$R[285]=(($p['HK']+$p['FX'])*100)/$R[130];
if (!isset($R[285])) $R[285]='NS';
$R[286]=($R[6])/360;if ($R[286]<0) $R[286]=0;
if (!isset($R[286])) $R[286]='NS';
$R[297]=$R[215]/$R[286];
if (!isset($R[297])) $R[297]='NS';
$R[298]=$R[217]/$R[286];
if (!isset($R[298])) $R[298]='NS';
$R[299]=$R[219]/$R[286];
if (!isset($R[299])) $R[299]='NS';
$R[300]=($p['YS']*100)/abs($R[226]);
if (!isset($R[300])) $R[300]='NS';
$R[301]=($R[140]*12)/$nm;
if (!isset($R[301])) $R[301]='NS';
$R[302]=$p['IJ'];
if (!isset($R[302])) $R[302]='NS';
$R[303]=$p['JH'];
if (!isset($R[303])) $R[303]='NS';
$R[304]=$p['ZR'];
if (!isset($R[304])) $R[304]='NS';
$R[305]=$R[70]+$R[88]+$R[89]-$R[226];
if (!isset($R[305])) $R[305]='NS';
$R[306]=($R[6]*(100-getInflation(substr($millesime,-4))))/100;
if (!isset($R[306])) $R[306]='NS';
$R[307]=($R[140]*100)/$R[130];
if (!isset($R[307])) $R[307]='NS';
$R[308]=(($p['CJ']-$p['CK']-$p['CH']+$p['CL'])/$R[88]);
if (!isset($R[308])) $R[308]='NS';
$R[309]=$p['CB'];
if (!isset($R[309])) $R[309]='NS';
$R[310]=(($p['BJ']-$p['AN'])*100)/$p['EE'];
if (!isset($R[310])) $R[310]='NS';
$R[311]=$p['AN']+$p['AP'];
if (!isset($R[311])) $R[311]='NS';
$R[312]=$p['AH'];
if (!isset($R[312])) $R[312]='NS';
$R[313]=$R[10]*100/$p['EE'];
if (!isset($R[313])) $R[313]='NS';
$R[314]=$R[311]*100/$p['EE'];
if (!isset($R[314])) $R[314]='NS';
$R[315]=(($p['YT']+$p['YU'])*12)/$nm ;
if (!isset($R[315])) $R[315]='NS';
$R[316]=($p['YT']+$p['YU'])*100/($p['FY']+$p['FZ']);
if (!isset($R[316])) $R[316]='NS';
$R[317]=$p['CP'];
if (!isset($R[317])) $R[317]='NS';
$R[318]=(($R[170]-$R[181])*12)/$nm;
if (!isset($R[318])) $R[318]='NS';
$R[321]=(($R[199]-$R[171]+$R[172]+$p['GA'])*12)/$nm;
if (!isset($R[321])) $R[321]='NS';
$R[330]=$p['FZ']/$p['FY'];
if (!isset($R[330])) $R[330]='NS';
$R[331]=$p['FY']/$p['YP'];
if (!isset($R[331])) $R[331]='NS';
$R[500]=$p['EE']*0.15;
if (!isset($R[500])) $R[500]='NS';
$R[501]=($p['CS']+$p['CU'])*100/($p['BJ']-$p['AN']);
if (!isset($R[501])) $R[501]='NS';
$R[502]=($p['CV']+$p['BC'])*100/($p['CS']+$p['CU']);
if (!isset($R[502])) $R[502]='NS';
$R[503]=$R[233]*100/$R[5];
if (!isset($R[503])) $R[503]='NS';
$R[504]=((($p['FL']+$p['FM']+$p['FN'])*12)/$nm);if ($R[504]<0) $R[504]=0;
if (!isset($R[504])) $R[504]='NS';
$R[505]=(($R[130]*12)/$nm)*100/$R[6];
if (!isset($R[505])) $R[505]='NS';
$R[506]=(($R[140]*12)/$nm)*100/$R[6];
if (!isset($R[506])) $R[506]='NS';
$R[507]=($R[17]*100)/$R[6];
if (!isset($R[507])) $R[507]='NS';
$R[508]=(($R[170]*12)/$nm)*100/$R[6];
if (!isset($R[508])) $R[508]='NS';
$R[509]=($R[11]*100)/$R[6];
if (!isset($R[509])) $R[509]='NS';
$R[510]=($R[70]*100)/$R[22];
if (!isset($R[510])) $R[510]='NS';
$R[511]=($R[70]+$R[72])*100/($R[79]+$R[90]);
if (!isset($R[511])) $R[511]='NS';
$R[512]=$R[226]/$R[286];
if (!isset($R[512])) $R[512]='NS';
$R[513]=(($p['HN']- $p['HI']- $p['FO']- $p['FP'])*12)/$nm;
if (!isset($R[513])) $R[513]='NS';
$R[514]=($R[513]*100)/$R[6];
if (!isset($R[514])) $R[514]='NS';
$R[515]=($p['HN']-$p['HI']-$p['FO']-$p['FP']);
if (!isset($R[515])) $R[515]='NS';
$R[516]=($R[513]-$R[11])*100/$R[11];
if (!isset($R[516])) $R[516]='NS';
$R[517]=($R[233]*100)/($p['BJ']-$p['AN']);
if (!isset($R[517])) $R[517]='NS';
$R[518]=($R[233]*100)/$R[80];
if (!isset($R[518])) $R[518]='NS';
$R[519]=($R[80]*100)/$R[22];
if (!isset($R[519])) $R[519]='NS';
$R[520]=($R[153]*100)/$R[5];
if (!isset($R[520])) $R[520]='NS';
$R[521]=($R[226]+$p['CS']-$p['CT']+$p['CU']-$p['CV']+$p['BB']-$p['BC']+$R[210])/(($R[102]+$R[121]+$R[123]+$R[132]+$R[133]+$R[142])/360);
if (!isset($R[521])) $R[521]='NS';
$R[522]=($R[16]*100)/$R[22];
if (!isset($R[522])) $R[522]='NS';
$R[523]=($R[10]*100)/$R[70];
if (!isset($R[523])) $R[523]='NS';
$R[524]=($R[52]*100)/$R[22];
if (!isset($R[524])) $R[524]='NS';
$R[525]=($R[60]*100)/$R[22];
if (!isset($R[525])) $R[525]='NS';
$R[526]=($R[63]*100)/$R[22];
if (!isset($R[526])) $R[526]='NS';
$R[527]=($R[202]*100)/$R[22];
if (!isset($R[527])) $R[527]='NS';
$R[528]=($R[110]*100)/$R[5];
if (!isset($R[528])) $R[528]='NS';
$R[529]=($p['ZE']*12)/$nm;
if (!isset($R[529])) $R[529]='NS';
$R[530]=(($R[153]+$R[170])*100)/$R[153];
if (!isset($R[530])) $R[530]='NS';
$R[531]=(($R[153]+$R[170]+$p['XQ'])*100)/($R[153]+$p['XQ']);
if (!isset($R[531])) $R[531]='NS';
$R[532]=($R[52]*100)/($p['BJ']-$p['AN']);
if (!isset($R[532])) $R[532]='NS';
$R[533]=($R[53]*100)/$R[22];
if (!isset($R[533])) $R[533]='NS';
$R[534]=($R[1]*100)/$R[5];
if (!isset($R[534])) $R[534]='NS';
$R[535]=($p['ZE']*100)/$R[70];
if (!isset($R[535])) $R[535]='NS';
$R[538]=($R[233]*100)/$R[305];
if (!isset($R[538])) $R[538]='NS';
$R[540]=($R[233]*100)/$R[202];
if (!isset($R[540])) $R[540]='NS';
$R[542]=($R[16]*100)/$R[153];
if (!isset($R[542])) $R[542]='NS';
$R[543]=($R[10]*100)/($R[70]+$R[72]);
if (!isset($R[543])) $R[543]='NS';
$R[544]=(($R[130]*12)/$nm)/$R[24];
if (!isset($R[544])) $R[544]='NS';
$R[545]=$R[515]-$R[10];
if (!isset($R[545])) $R[545]='NS';
$R[546]=$R[22]-$R[231]-$R[202];
if (!isset($R[546])) $R[546]='NS';
$R[547]=$p['CJ']-$p['CK'];
if (!isset($R[547])) $R[547]='NS';
$R[548]=$R[22]-$R[547];
if (!isset($R[548])) $R[548]='NS';
$R[549]=$p['DB'];
if (!isset($R[549])) $R[549]='NS';
$R[550]=$p['DC'];
if (!isset($R[550])) $R[550]='NS';
$R[551]=$p['DH'];
if (!isset($R[551])) $R[551]='NS';
$R[552]=$R[549]+$R[550]+$R[551];
if (!isset($R[552])) $R[552]='NS';
$R[553]=$R[145]-$R[144];
if (!isset($R[553])) $R[553]='NS';
$R[554]=($R[51]*100)/$R[22];
if (!isset($R[554])) $R[554]='NS';
$R[555]=($R[151]*100)/$R[53];
if (!isset($R[555])) $R[555]='NS';
$R[556]=($R[62]*100)/$R[22];
if (!isset($R[556])) $R[556]='NS';
$R[558]=$R[547]-$R[63]-$R[60]-$R[223];
if (!isset($R[558])) $R[558]='NS';
$R[559]=abs($R[223]);
if (!isset($R[559])) $R[559]='NS';
$R[560]=abs($R[63]);
if (!isset($R[560])) $R[560]='NS';
$R[561]=$R[5]+$p['FQ']+$p['FO'];
if (!isset($R[561])) $R[561]='NS';
$R[562]=($p['BX']+$p['BV']-$p['BW'])+($p['YS'])+($p['CN'])+($p['CH']-$p['CI']);
if (!isset($R[562])) $R[562]='NS';
$R[563]=$R[561]-$R[562];
if (!isset($R[563])) $R[563]='NS';
$R[564]=$p['FW']+$p['FX']+$p['FY']+$p['FZ']+$p['GE'];
if (!isset($R[564])) $R[564]='NS';
$R[565]=$p['DX']+$p['DW']+$p['EB']+$p['ED'];
if (!isset($R[565])) $R[565]='NS';
$R[566]=$R[564]-$R[565];
if (!isset($R[566])) $R[566]='NS';
$R[567]=$R[563]-$R[566];
if (!isset($R[567])) $R[567]='NS';
$R[568]=$p['GL']+$p['GN']-$p['GS']+$p['HA']-$p['HE'];
if (!isset($R[568])) $R[568]='NS';
$R[569]=$p['GR'];
if (!isset($R[569])) $R[569]='NS';
$R[570]=$p['HK']+$p['DY1']-$p['DY'];
if (!isset($R[570])) $R[570]='NS';
$R[571]=$p['HJ'];
if (!isset($R[571])) $R[571]='NS';
$R[572]=$p['ZE'];
if (!isset($R[572])) $R[572]='NS';
$R[573]=$R[567]+$R[568]-$R[569]-$R[570]-$R[571]-$R[572];
if (!isset($R[573])) $R[573]='NS';
$R[574]=$p['LP']+$p['KF'];
if (!isset($R[574])) $R[574]='NS';
$R[575]=$p['LS'];
if (!isset($R[575])) $R[575]='NS';
$R[576]=$p['KF'];
if (!isset($R[576])) $R[576]='NS';
$R[577]=$p['DJ'];
if (!isset($R[577])) $R[577]='NS';
$R[578]=$p['DZ']-$p['DZ1'];
if (!isset($R[578])) $R[578]='NS';
$R[579]=$p['NG'];
if (!isset($R[579])) $R[579]='NS';
$R[580]=$R[574]+$R[575]+$R[576]-$R[577]-$R[578]-$R[579];
if (!isset($R[580])) $R[580]='NS';
$R[581]=$p['AA']-$p['AA1'];
if (!isset($R[581])) $R[581]='NS';
$R[582]=$p['CC1']-$p['CC2'];
if (!isset($R[582])) $R[582]='NS';
$R[583]=$R[581]-$R[582];
if (!isset($R[583])) $R[583]='NS';
$R[584]=$p['VJ']+$p['GR'];
if (!isset($R[584])) $R[584]='NS';
$R[585]=$p['VK']+($p['HP']+$p['HQ'])+$p['GR1'];
if (!isset($R[585])) $R[585]='NS';
$R[586]=($R[584]-$R[585]);
if (!isset($R[586])) $R[586]='NS';
$R[587]=$p['EH']-$p['EH1'];
if (!isset($R[587])) $R[587]='NS';
$R[588]=$p['YS']-$p['YS1'];
if (!isset($R[588])) $R[588]='NS';
$R[589]=$R[587]+$R[588];
if (!isset($R[589])) $R[589]='NS';
$R[590]=$R[583]+$R[586]+$R[589];
if (!isset($R[590])) $R[590]='NS';
$R[591]=$p['CG']-$p['CG2'];
if (!isset($R[591])) $R[591]='NS';
$R[592]=$p['CE']-$p['CE2'];
if (!isset($R[592])) $R[592]='NS';
$R[593]=$R[573]-$R[580]+$R[590];
if (!isset($R[593])) $R[593]='NS';
$R[594]=($R[22]-$R[59]-$R[223]);
if (!isset($R[594])) $R[594]='NS';
$R[595]=($R[22]-$R[79]-$R[80]-$R[230]);
if (!isset($R[595])) $R[595]='NS';
$R[596]=$p['EE']-$R[79]-$R[89]-$R[84];
if (!isset($R[596])) $R[596]='NS';
$R[597]=$p['EE']-$R[65]-$R[60]-$R[59];
if (!isset($R[597])) $R[597]='NS';
$R[701]=$p['BP3'];
if (!isset($R[701])) $R[701]='NS';
$R[702]=$p['BR3'];
if (!isset($R[702])) $R[702]='NS';
$R[703]=$p['BP8'];
if (!isset($R[703])) $R[703]='NS';
$R[704]=$p['BP3'];
if (!isset($R[704])) $R[704]='NS';
$R[705]=($p['BA1']-$p['BP1'])*12/$nm;
if (!isset($R[705])) $R[705]='NS';
$R[706]=($p['BA2']-$p['BP2'])*12/$nm;
if (!isset($R[706])) $R[706]='NS';
$R[707]=($p['BR1']*12)/$nm;
if (!isset($R[707])) $R[707]='NS';
$R[708]=($p['BR2']*12)/$nm;
if (!isset($R[708])) $R[708]='NS';
$R[710]=$p['BP3']+$p['BP4']+$p['BP5']+$p['BP7']+$p['BP8']-($p['BP8']*0.07);
if (!isset($R[710])) $R[710]='NS';
$R[711]=$p['BP6'];if ($R[711]>0) $R[711]=0;
if (!isset($R[711])) $R[711]='NS';
$R[712]=($R[710]*12)/$nm;
if (!isset($R[712])) $R[712]='NS';
$R[713]=($R[711]*12)/$nm;
if (!isset($R[713])) $R[713]='NS';
$R[715]=0;
if (!isset($R[715])) $R[715]='NS';
$R[716]=($p['BP1']+$p['BP2']-$p['BA1']-$p['BA2'])/($R[710]*12.5);
if (!isset($R[716])) $R[716]='NS';
$R[720]=($p['BP1']+$p['BP2']-$p['BA1']+($p['BA1']*0.20)-$p['BA2']+($p['BA2']*0.025));
if (!isset($R[720])) $R[720]='NS';
$R[721]=($R[720]*12)/$nm;
if (!isset($R[721])) $R[721]='NS';
$R[722]=($R[712]*100)/$R[721];
if (!isset($R[722])) $R[722]='NS';
$R[723]=($R[712]+$R[713])*100/$R[721];
if (!isset($R[723])) $R[723]='NS';
$R[724]=$R[721]*0.08;
if (!isset($R[724])) $R[724]='NS';
$R[730]=$p['BR3']/$R[710];
if (!isset($R[730])) $R[730]='NS';
$R[731]=$p['BR3']/($R[710]+$R[711]);
if (!isset($R[731])) $R[731]='NS';
$R[732]=$p['BR3']/$p['BA3'];
if (!isset($R[732])) $R[732]='NS';
$R[740]=($p['BA1']-($p['BA1']*0.2)+$p['BA2']-($p['BA2']*0.025)-($R[710]*0.15))*100/($R[710]*8);
if (!isset($R[740])) $R[740]='NS';
$R[741]=($p['BA1']-($p['BA1']*0.2)+$p['BA2']-($p['BA2']*0.025)-(($R[710]+$R[711])*0.15))*100/(($R[710]+$R[711])*8);
if (!isset($R[741])) $R[741]='NS';
$R[742]=0;
if (!isset($R[742])) $R[742]='NS';
$R[751]=$p['AP1'];
if (!isset($R[751])) $R[751]='NS';
$R[752]=$p['AP2'];
if (!isset($R[752])) $R[752]='NS';
$R[753]=$p['AR3'];
if (!isset($R[753])) $R[753]='NS';
$R[757]=($p['AR1']*12)/$nm;
if (!isset($R[757])) $R[757]='NS';
$R[758]=($p['AR2']*12)/$nm;
if (!isset($R[758])) $R[758]='NS';
$R[761]=($p['AP1']*12)/$nm;
if (!isset($R[761])) $R[761]='NS';
$R[762]=($p['AP2']*12)/$nm;
if (!isset($R[762])) $R[762]='NS';
$R[770]=($R[761]*100)/$R[762];
if (!isset($R[770])) $R[770]='NS';
$R[771]=($p['AP1']*100)/$p['AR1'];
if (!isset($R[771])) $R[771]='NS';
$R[772]=($p['AP1']*100)/$p['AR2'];
if (!isset($R[772])) $R[772]='NS';
$R[780]=($p['AR4']*100)/$p['AP1'];
if (!isset($R[780])) $R[780]='NS';
$R[781]=($p['AR4']*100)/$p['AR1'];
if (!isset($R[781])) $R[781]='NS';
$R[782]=($p['AR4']*100)/$p['AA2'];
if (!isset($R[782])) $R[782]='NS';
$R[783]=($p['AR4']*100)/($p['AP1']-$p['AR4']);
if (!isset($R[783])) $R[783]='NS';
$R[784]=($p['AR2']*100)/$p['AR1'];
if (!isset($R[784])) $R[784]='NS';
$R[791]=($p['AA1']*100)/$p['AP1'];
if (!isset($R[791])) $R[791]='NS';
$R[792]=($p['AA1']*100)/$p['AP2'];
if (!isset($R[792])) $R[792]='NS';
$R[333]=($R[233]*12)/$nm;
if (!isset($R[333])) $R[333]='NS';
$tabRatios[$numBil]=$R;
$numBil++;
}
for($i=0; $i<$numBil; $i++) {
$tabRatios[$i][319]=($tabRatios[$i][318]+$tabRatios[$i+1][318]+$tabRatios[$i+2][318])/3; }
for($i=0; $i<$numBil; $i++) {
$tabRatios[$i][320]=($tabRatios[$i][11]+$tabRatios[$i+1][11]+$tabRatios[$i+2][11])/3; }
for($i=0; $i<$numBil; $i++) {
$tabRatios[$i][322]=($tabRatios[$i][321]+$tabRatios[$i+1][321]+$tabRatios[$i+2][321])/3; }
for($i=0; $i<$numBil; $i++) {
$tabRatios[$i][536]=($tabRatios[$i][306]+$tabRatios[$i+1][306]+$tabRatios[$i+2][306])/3; }
for($i=0; $i<$numBil; $i++) {
$tabRatios[$i][537]=($tabRatios[$i][503]+$tabRatios[$i+1][503]+$tabRatios[$i+2][503])/3; }
for($i=0; $i<$numBil; $i++) {
$tabRatios[$i][539]=($tabRatios[$i][538]+$tabRatios[$i+1][538]+$tabRatios[$i+2][538])/3; }
for($i=0; $i<$numBil; $i++) {
$tabRatios[$i][541]=($tabRatios[$i][540]+$tabRatios[$i+1][540]+$tabRatios[$i+2][540])/3; }
for($i=0; $i<$numBil; $i++) {
$tabRatios[$i][557]=($tabRatios[$i][265]+$tabRatios[$i+1][265]+$tabRatios[$i+2][265])/3; }
for($i=0; $i<$numBil; $i++) {
$tabRatios[$i][598]=($tabRatios[$i][529]+$tabRatios[$i+1][529]+$tabRatios[$i+2][529])/3; }
return $tabRatios;
}

View File

@ -1,227 +1,752 @@
<?
/** Ratios pour les collectivités **/
global $tabZones2Ratios;
<?php
$tva=20.0;
/** Tableau de conversion des communes **/
$tabZones2Ratios=array(
'R01a'=>'R[801]',
'R01b'=>'Rh[801]',
'R01c'=>'Rs[801]',
'R02a'=>'R[802]',
'R02b'=>'Rh[802]',
'R02c'=>'Rs[802]',
'R02d'=>'Rq[802]',
'R02e'=>'Rt[802]',
'R03a'=>'R[803]',
'R03b'=>'Rh[803]',
'R03c'=>'Rs[803]',
'R03d'=>'Rq[803]',
'R03e'=>'Rt[803]',
'R04a'=>'R[804]',
'R04b'=>'Rh[804]',
'R04c'=>'Rs[804]',
'R04d'=>'Rq[804]',
'R04e'=>'Rt[804]',
'R05a'=>'R[805]',
'R05b'=>'Rh[805]',
'R05c'=>'Rs[805]',
'R06a'=>'R[806]',
'R06b'=>'Rh[806]',
'R06c'=>'Rs[806]',
'R06d'=>'Rq[806]',
'R06e'=>'Rt[806]',
'R07a'=>'R[807]',
'R07b'=>'Rh[807]',
'R07c'=>'Rs[807]',
'R07d'=>'Rq[807]',
'R07e'=>'Rt[807]',
'R08a'=>'R[808]',
'R08b'=>'Rh[808]',
'R08c'=>'Rs[808]',
'R08d'=>'Rq[808]',
'R08e'=>'Rt[808]',
'R09a'=>'R[809]',
'R09b'=>'Rh[809]',
'R09c'=>'Rs[809]',
'R09d'=>'Rq[809]',
'R09e'=>'Rt[809]',
'R10a'=>'R[810]',
'R10b'=>'Rh[810]',
'R10c'=>'Rs[810]',
'R10d'=>'Rq[810]',
'R10e'=>'Rt[810]',
'R11a'=>'R[811]',
'R11b'=>'Rh[811]',
'R11c'=>'Rs[811]',
'R12a'=>'R[812]',
'R12b'=>'Rh[812]',
'R12c'=>'Rs[812]',
'R13a'=>'R[813]',
'R13b'=>'Rh[813]',
'R13c'=>'Rs[813]',
'R13d'=>'Rq[813]',
'R13e'=>'Rt[813]',
'R14a'=>'R[814]',
'R14b'=>'Rh[814]',
'R14c'=>'Rs[814]',
'R14d'=>'Rq[814]',
'R14e'=>'Rt[814]',
'R15a'=>'R[815]',
'R15b'=>'Rh[815]',
'R15c'=>'Rs[815]',
'R15d'=>'Rq[815]',
'R15e'=>'Rt[815]',
'R16a'=>'R[816]',
'R16b'=>'Rh[816]',
'R16c'=>'Rs[816]',
'R16d'=>'Rq[816]',
'R16e'=>'Rt[816]',
'R17a'=>'R[817]',
'R17b'=>'Rh[817]',
'R17c'=>'Rs[817]',
'R18a'=>'R[818]',
'R18b'=>'Rh[818]',
'R18c'=>'Rs[818]',
'R18d'=>'Rq[818]',
'R18e'=>'Rt[818]',
'R19a'=>'R[819]',
'R19b'=>'Rh[819]',
'R19c'=>'Rs[819]',
'R19d'=>'Rq[819]',
'R19e'=>'Rt[819]',
'R20a'=>'R[820]',
'R20b'=>'Rh[820]',
'R20c'=>'Rs[820]',
'R20d'=>'Rq[820]',
'R20e'=>'Rt[820]',
'R21a'=>'R[821]',
'R21b'=>'Rh[821]',
'R21c'=>'Rs[821]',
'R21d'=>'Rq[821]',
'R21e'=>'Rt[821]',
'R22a'=>'R[822]',
'R22b'=>'Rh[822]',
'R22c'=>'Rs[822]',
'R23a'=>'R[823]',
'R23b'=>'Rh[823]',
'R23c'=>'Rs[823]',
'R24a'=>'R[824]',
'R24b'=>'Rh[824]',
'R24c'=>'Rs[824]',
'R25a'=>'R[825]',
'R25b'=>'Rh[825]',
'R25c'=>'Rs[825]',
'R26a'=>'R[826]',
'R26b'=>'Rh[826]',
'R26c'=>'Rs[826]',
'R26d'=>'Rq[826]',
'R26e'=>'Rt[826]',
'R27a'=>'R[827]',
'R27b'=>'Rh[827]',
'R27c'=>'Rs[827]',
'R27d'=>'Rq[827]',
'R27e'=>'Rt[827]',
'R28a'=>'R[828]',
'R28b'=>'Rh[828]',
'R28c'=>'Rs[828]',
'R28d'=>'Rq[828]',
'R28e'=>'Rt[828]',
'R29a'=>'R[829]',
'R29b'=>'Rh[829]',
'R29c'=>'Rs[829]',
'R29d'=>'Rq[829]',
'R29e'=>'Rt[829]',
'R30a'=>'R[830]',
'R30b'=>'Rh[830]',
'R30c'=>'Rs[830]',
'R30d'=>'Rq[830]',
'R30e'=>'Rt[830]',
'R31a'=>'R[843]',
'R31b'=>'Rh[843]',
'R31c'=>'Rs[843]',
'R31d'=>'Rq[843]',
'R31e'=>'Rt[843]',
'R32a'=>'R[831]',
'R32b'=>'Rh[831]',
'R32c'=>'Rs[831]',
'R33a'=>'R[832]',
'R33b'=>'Rh[832]',
'R33c'=>'Rs[832]',
'R33d'=>'R[845]',
'R33e'=>'Rh[845]',
'R33f'=>'Rs[845]',
'R34a'=>'R[833]',
'R34b'=>'Rh[833]',
'R34c'=>'Rs[833]',
'R34d'=>'R[846]',
'R34e'=>'Rh[846]',
'R34f'=>'Rs[846]',
'R35a'=>'R[834]',
'R35b'=>'Rh[834]',
'R35c'=>'Rs[834]',
'R35d'=>'R[847]',
'R35e'=>'Rh[847]',
'R35f'=>'Rs[847]',
'R36a'=>'R[835]',
'R36b'=>'Rh[835]',
'R36c'=>'Rs[835]',
'R36d'=>'R[849]',
'R36e'=>'Rh[849]',
'R36f'=>'Rs[849]',
'R37a'=>'R[844]',
'R37b'=>'Rh[844]',
'R37c'=>'Rs[844]',
'R37d'=>'R[848]',
'R37e'=>'Rh[848]',
'R37f'=>'Rs[848]',
'R38a'=>'R[836]',
'R38b'=>'Rh[836]',
'R38c'=>'Rs[836]',
'R38d'=>'Rq[836]',
'R38e'=>'Rt[836]',
'R39a'=>'R[837]',
'R39b'=>'Rh[837]',
'R39c'=>'Rs[837]',
'R39d'=>'Rq[837]',
'R39e'=>'Rt[837]',
'R40a'=>'R[838]',
'R40b'=>'Rh[838]',
'R40c'=>'Rs[838]',
'R40d'=>'Rq[838]',
'R40e'=>'Rt[838]',
'R41a'=>'R[842]',
'R41b'=>'Rh[842]',
'R41c'=>'Rs[842]',
'R41d'=>'Rq[842]',
'R41e'=>'Rt[842]',
'R42a'=>'R[839]',
'R42b'=>'Rh[839]',
'R42c'=>'Rs[839]',
'R42d'=>'Rq[839]',
'R42e'=>'Rt[839]',
'R43a'=>'R[840]',
'R43b'=>'Rh[840]',
'R43c'=>'Rs[840]',
'R43d'=>'Rq[840]',
'R43e'=>'Rt[840]',
'R44a'=>'R[841]',
'R44b'=>'Rh[841]',
'R44c'=>'Rs[841]',
);
/** Donne le taux d'inflation pour une année donnée **/
function getInflation($annee) {
$tabInfla = include __DIR__ . '/Variables/CacheTabInfla.php';
if (isset($tabInfla[$annee])) return $tabInfla[$annee];
}
/** Donne le taux de rendement des actions pour une année donnée **/
function getTxRendement($annee) {
$tabTxRendObli = include __DIR__ . '/Variables/CacheTabRendObli.php';
if (isset($tabTxRendObli[$annee])) return $tabInfla[$annee];
}
/** Conversion des zones pour les collectivités **/
function convertZones($codeR, $zonesDB) {
global $tabZones2Ratios;
foreach($tabZones2Ratios as $oldR=>$newR) {
if (preg_match('/(\D+)\[(\d+)\]/Uis', $newR, $matches) && $matches[1]==$codeR) {
$iRatio=$matches[2];
if ($codeR=='R')
$ret[$iRatio]=$zonesDB[$oldR]*1000;
else
$ret[$iRatio]=$zonesDB[$oldR];
}
function calculRatios($tabBilans, $tabIdentite, $accesPartenaire) {
global $tva, $mBil, $efftr;
$numBil=0;
$numBilType=array();
$nbRatiosMax = 5;
foreach ($tabBilans as $millesime => $bil)
{
$tabTmp = $mBil->getBilan(substr($millesime,-10), substr($millesime,0,1), @$bil['ref'], $accesPartenaire);
$numBilType[substr($millesime,0,1)]++;
if (substr($millesime,0,1)=='S') {
if ($numBilType['S']>$nbRatiosMax) continue;
$tabTmp2=$mBil->bilanSimplifie2Normal($tabTmp);
$tabBilan[$numBil]=array_merge($tabTmp2, $tabTmp);
} elseif (substr($millesime,0,1)=='N') {
if ($numBilType['N']>$nbRatiosMax) continue;
$tabBilan[$numBil]=$tabTmp;
} elseif (substr($millesime,0,1)=='C') {
if ($numBilType['C']>$nbRatiosMax) continue;
$tabBilan[$numBil]=$tabTmp;
} elseif (substr($millesime,0,1)=='A') {
if ($numBilType['A']>$nbRatiosMax) continue;
$tabBilan[$numBil]=$tabTmp;
//return(array());
} elseif (substr($millesime,0,1)=='B') {
if ($numBilType['B']>$nbRatiosMax) continue;
$tabBilan[$numBil]=$tabTmp;
//return(array());
}
return $ret;
unset($tabTmp); unset($tabTmp2);
if ($numBil>10) break;
$p=$tabBilan[$numBil];
$nm=$p['DUREE_MOIS'];
$nmp=$p['DUREE_MOIS_PRE'];
$R=array();
$R[0]=0;
if (!isset($R[0])) $R[0]='NS';
$R[1]=$p['FJ'];
if (!isset($R[1])) $R[1]='NS';
$R[2]=($p['FJ']*12)/$nm;if ($R[2]<0) $R[2]=0;
if (!isset($R[2])) $R[2]='NS';
$R[3]=$p['FK'];
if (!isset($R[3])) $R[3]='NS';
$R[4]=($p['FK']*12)/$nm;if ($R[4]<0) $R[4]=0;
if (!isset($R[4])) $R[4]='NS';
$R[5]=$p['FL'];
if (!isset($R[5])) $R[5]='NS';
$R[6]=($p['FL']*12)/$nm;if ($R[6]<0) $R[6]=0;
if (!isset($R[6])) $R[6]='NS';
$R[7]=$p['GW'];
if (!isset($R[7])) $R[7]='NS';
$R[8]=($p['GW']*12)/$nm;
if (!isset($R[8])) $R[8]='NS';
$R[10]=$p['HN'];
if (!isset($R[10])) $R[10]='NS';
$R[11]=($p['HN']*12)/$nm;
if (!isset($R[11])) $R[11]='NS';
$R[12]=$p['HI'];
if (!isset($R[12])) $R[12]='NS';
$R[13]=($p['HI']*12)/$nm;
if (!isset($R[13])) $R[13]='NS';
$R[14]=$p['GV'];
if (!isset($R[14])) $R[14]='NS';
$R[15]=($p['GV']*12)/$nm;
if (!isset($R[15])) $R[15]='NS';
$R[16]=$p['GG'];
if (!isset($R[16])) $R[16]='NS';
$R[17]=($p['GG']*12)/$nm;
if (!isset($R[17])) $R[17]='NS';
$R[18]=$p['DL'];
if (!isset($R[18])) $R[18]='NS';
$R[19]=($p['DL']*12)/$nm;
if (!isset($R[19])) $R[19]='NS';
$R[20]=$p['GR'];
if (!isset($R[20])) $R[20]='NS';
$R[21]=($p['GR']*12)/$nm;
if (!isset($R[21])) $R[21]='NS';
$R[22]=$p['EE'];
if (!isset($R[22])) $R[22]='NS';
$R[23]=($p['EE']*12)/$nm;
if (!isset($R[23])) $R[23]='NS';
$R[24]=$p['YP'];if ($R[24]==0) $R[24]=$efftr;
if (!isset($R[24])) $R[24]='NS';
$R[25]=($p['FK']*100)/$p['FL'];if ($R[25]<0) $R[25]=0;
if (!isset($R[25])) $R[25]='NS';
$R[30]=$p['AF'];
if (!isset($R[30])) $R[30]='NS';
$R[31]=$p['AN'];
if (!isset($R[31])) $R[31]='NS';
$R[32]=$p['EC'];
if (!isset($R[32])) $R[32]='NS';
$R[33]=$p['DR'];
if (!isset($R[33])) $R[33]='NS';
$R[51]=$p['AB']+$p['AD']+$p['AF']+$p['AH']+$p['AJ']+$p['AL']-$p['AC']-$p['AE']-$p['AG']-$p['AI']-$p['AK']-$p['AM'];
if (!isset($R[51])) $R[51]='NS';
$R[52]=$p['AN']+ $p['AP']+ $p['AR']+ $p['AT']+ $p['AV']+ $p['AX']- $p['AO']- $p['AQ']- $p['AS']- $p['AU']- $p['AW']- $p['AY'];
if (!isset($R[52])) $R[52]='NS';
$R[53]=$p['CS']+ $p['CU']+ $p['BB']+ $p['BD']+ $p['BF']+ $p['BH']- $p['CT']- $p['CV']- $p['BC']- $p['BE']- $p['BG']- $p['BI'];
if (!isset($R[53])) $R[53]='NS';
$R[59]=$R[51]+$R[52]+$R[53];
if (!isset($R[59])) $R[59]='NS';
$R[60]=$p['BL']+ $p['BN']+ $p['BP']+ $p['BR']+ $p['BT']- $p['BM']- $p['BO']- $p['BQ']- $p['BS']- $p['BU'];
if (!isset($R[60])) $R[60]='NS';
$R[61]=$p['BX']-$p['DW']+$p['YS']-$p['BY'];
if (!isset($R[61])) $R[61]='NS';
$R[62]=$p['BZ']+ $p['CB']+ $p['CH']- $p['CA']- $p['CC']- $p['CI'];
if (!isset($R[62])) $R[62]='NS';
$R[63]=$p['CD']+$p['CF']-$p['CE']-$p['CG'];
if (!isset($R[63])) $R[63]='NS';
$R[64]=($R[63]*12)/$nm;
if (!isset($R[64])) $R[64]='NS';
$R[65]=$R[61]+$R[62];
if (!isset($R[65])) $R[65]='NS';
$R[67]=($R[59]*12)/$nm;
if (!isset($R[67])) $R[67]='NS';
$R[69]=$R[60]+$R[61]+$R[62]+$R[63];
if (!isset($R[69])) $R[69]='NS';
$R[70]=$p['DL']+$p['DO']-$p['AA']-($p['CL']+$p['CM']+$p['CN'])+$p['ED'];
if (!isset($R[70])) $R[70]='NS';
$R[71]=$p['DR'];
if (!isset($R[71])) $R[71]='NS';
$R[72]=$p['VI'];
if (!isset($R[72])) $R[72]='NS';
$R[73]=$p['DW']+$p['DX']+$p['DY']+$p['DZ']+$p['EA']+$p['EH'];
if (!isset($R[73])) $R[73]='NS';
$R[74]=$p['DK'];
if (!isset($R[74])) $R[74]='NS';
$R[79]=$R[70]+$R[71]+$R[72];
if (!isset($R[79])) $R[79]='NS';
$R[80]=$p['DS']+$p['DT']+$p['DU']+$p['DV']-$p['EH']-$p['VI'];if ($R[80]<0) $R[80]=0;
if (!isset($R[80])) $R[80]='NS';
$R[81]=$p['VG1']+$p['VH1'];
if (!isset($R[81])) $R[81]='NS';
$R[82]=$R[70];if ($R[82]<0) $R[82]=0;
if (!isset($R[82])) $R[82]='NS';
$R[83]=$p['DS']+$p['DT']+$p['DU']+$p['DV']-$p['EH']-$p['VI'];if ($R[83]<0) $R[83]=0;
if (!isset($R[83])) $R[83]='NS';
$R[84]=$p['DX']- $p['BV']+ $p['BW'];
if (!isset($R[84])) $R[84]='NS';
$R[85]=$p['DY'];
if (!isset($R[85])) $R[85]='NS';
$R[86]=$p['DZ']+ $p['EA']+ $p['EB']+ $R[80];
if (!isset($R[86])) $R[86]='NS';
$R[87]=$p['YS']+ $p['EH'];
if (!isset($R[87])) $R[87]='NS';
$R[88]=$p['DW']+ $p['DY']+ $p['EH']+ $p['DZ']+ $p['EA']+ $p['EB']+ $p['YS'];
if (!isset($R[88])) $R[88]='NS';
$R[89]=$p['DS']+ $p['DT']+ $p['DU']+ $p['DV']- $p['EH']- $p['VI'];
if (!isset($R[89])) $R[89]='NS';
$R[90]=$R[83]+$R[84]+$R[85]+$R[86]+$R[87];
if (!isset($R[90])) $R[90]='NS';
$R[91]=$p['DL']+$p['DO']+$p['DR']+$p['VI']-$p['DJ']-$p['DK']-$p['AA'];
if (!isset($R[91])) $R[91]='NS';
$R[92]=($p['DL']+$p['DO']+$p['DR']+$p['VI']-$p['DJ']-$p['DK']-$p['AA'])/$p['EE'];
if (!isset($R[92])) $R[92]='NS';
$R[93]=($R[69]*12)/$nm;
if (!isset($R[93])) $R[93]='NS';
$R[101]=$p['FL'];
if (!isset($R[101])) $R[101]='NS';
$R[102]=$p['FS']+ $p['FU'];
if (!isset($R[102])) $R[102]='NS';
$R[110]=$R[101]-$p['FS'] -$p['FT'];
if (!isset($R[110])) $R[110]='NS';
$R[111]=$p['FF']+$p['FI'];
if (!isset($R[111])) $R[111]='NS';
$R[112]=$p['FM']+ $p['FN'];
if (!isset($R[112])) $R[112]='NS';
$R[120]=$R[111]+$R[112];
if (!isset($R[120])) $R[120]='NS';
$R[121]=$p['FT']+ $p['FV'];
if (!isset($R[121])) $R[121]='NS';
$R[122]=$R[101]+$R[112]-$R[102]-$R[121];
if (!isset($R[122])) $R[122]='NS';
$R[123]=$p['FW']- $p['HP']- $p['HQ'];
if (!isset($R[123])) $R[123]='NS';
$R[124]=($R[120]*12)/$nm;
if (!isset($R[124])) $R[124]='NS';
$R[130]=$R[122]-$R[123];
if (!isset($R[130])) $R[130]='NS';
$R[131]=$p['FO'];
if (!isset($R[131])) $R[131]='NS';
$R[132]=$p['FY']+$p['FZ'];
if (!isset($R[132])) $R[132]='NS';
$R[133]=$p['FX'];
if (!isset($R[133])) $R[133]='NS';
$R[140]=$R[130]-$R[132]-$R[133]+$R[131];
if (!isset($R[140])) $R[140]='NS';
$R[141]=$p['FQ'];
if (!isset($R[141])) $R[141]='NS';
$R[142]=$p['GE'];
if (!isset($R[142])) $R[142]='NS';
$R[143]=$p['FP'];
if (!isset($R[143])) $R[143]='NS';
$R[144]=($p['HP']+ $p['HQ'])*0.7;
if (!isset($R[144])) $R[144]='NS';
$R[145]=$p['GA']+ $p['GB']+ $p['GC']+ $p['GD']+$R[144];
if (!isset($R[145])) $R[145]='NS';
$R[146]=($R[140]*12)/$nm;
if (!isset($R[146])) $R[146]='NS';
$R[150]=$R[140]+$R[141]-$R[142]+$R[143]-$R[145];
if (!isset($R[150])) $R[150]='NS';
$R[151]=$p['GP'];
if (!isset($R[151])) $R[151]='NS';
$R[152]=($p['HP']+ $p['HQ'])*0.3;
if (!isset($R[152])) $R[152]='NS';
$R[153]=$p['GU']+$R[152];
if (!isset($R[153])) $R[153]='NS';
$R[160]=$R[151]-$R[153];
if (!isset($R[160])) $R[160]='NS';
$R[161]=$p['GH']- $p['GI'];
if (!isset($R[161])) $R[161]='NS';
$R[170]=$R[150]+$R[161]+$R[151]-$R[153];
if (!isset($R[170])) $R[170]='NS';
$R[171]=$p['HD'];
if (!isset($R[171])) $R[171]='NS';
$R[172]=$p['HH'];
if (!isset($R[172])) $R[172]='NS';
$R[180]=$R[171]-$R[172];
if (!isset($R[180])) $R[180]='NS';
$R[181]=$p['HK'];
if (!isset($R[181])) $R[181]='NS';
$R[182]=$p['HJ'];
if (!isset($R[182])) $R[182]='NS';
$R[199]=$R[170]+$R[171]-$R[172]-$R[181]-$R[182];
if (!isset($R[199])) $R[199]='NS';
$R[201]=$p['DL']+ $p['DO']+ $p['DR']+ $p['VI']- $p['AA'];
if (!isset($R[201])) $R[201]='NS';
$R[202]=$R[201]+$R[80];
if (!isset($R[202])) $R[202]='NS';
$R[203]=$p['YY'];if ($R[203]==0) $R[203]=(($p['FJ']*$tva)/100);
if (!isset($R[203])) $R[203]='NS';
$R[204]=(($R[203]+$R[5])*12/$nm)/360;if ($R[204]<0) $R[204]=0;
if (!isset($R[204])) $R[204]='NS';
$R[205]=($p['FS']-$p['FT']+$p['FU']-$p['FV']+$p['FW'])*$tva/100;
if (!isset($R[205])) $R[205]='NS';
$R[206]=$p['YZ'];if ($R[206]==0) $R[206]=$R[205];
if (!isset($R[206])) $R[206]='NS';
$R[207]=((($p['FS']- $p['FT']+ $p['FU']- $p['FV']+ $p['FW'])+ ($R[206]))*12/$nm)/360;if ($R[207]<0) $R[207]=0;
if (!isset($R[207])) $R[207]='NS';
$R[208]=($R[5]*100)/$p['EE'];
if (!isset($R[208])) $R[208]='NS';
$R[209]=$p['HP']+$p['HQ']-$p['GR'];
if (!isset($R[209])) $R[209]='NS';
$R[210]=$p['BX']-$p['BY']+$p['YS'];
if (!isset($R[210])) $R[210]='NS';
$R[211]=($R[210]*100)/$p['EE'];
if (!isset($R[211])) $R[211]='NS';
$R[212]=($R[84]*100)/$p['EE'];
if (!isset($R[212])) $R[212]='NS';
$R[213]=$p['BL']-$p['BM'];
if (!isset($R[213])) $R[213]='NS';
$R[214]=($R[213]*100)/$p['EE'];
if (!isset($R[214])) $R[214]='NS';
$R[215]=$p['BN']-$p['BO'];
if (!isset($R[215])) $R[215]='NS';
$R[216]=($R[215]*100)/$p['EE'];
if (!isset($R[216])) $R[216]='NS';
$R[217]=$p['BP']-$p['BQ'];
if (!isset($R[217])) $R[217]='NS';
$R[218]=($R[217]*100)/$p['EE'];
if (!isset($R[218])) $R[218]='NS';
$R[219]=$p['BR']-$p['BS'];
if (!isset($R[219])) $R[219]='NS';
$R[220]=($R[219]*100)/$p['EE'];
if (!isset($R[220])) $R[220]='NS';
$R[221]=$p['BT']-$p['BU'];
if (!isset($R[221])) $R[221]='NS';
$R[222]=($R[221]*100)/$p['EE'];
if (!isset($R[222])) $R[222]='NS';
$R[223]=$R[79]+$R[80]-$R[59];
if (!isset($R[223])) $R[223]='NS';
$R[224]=$p['CJ']-$p['CK']-$p['CH']+$p['CI']-$p['DW']-$p['DX']-$p['DY']-$p['DZ']-$p['EA']-$p['EH'];
if (!isset($R[224])) $R[224]='NS';
$R[225]=$R[60]+$R[61]+$R[62]-$R[84]-$R[85]-$R[86];
if (!isset($R[225])) $R[225]='NS';
$R[226]=$R[223]-$R[225];
if (!isset($R[226])) $R[226]='NS';
$R[227]=$p['YS'];
if (!isset($R[227])) $R[227]='NS';
$R[228]=($R[79]*12)/$nm;
if (!isset($R[228])) $R[228]='NS';
$R[229]=$p['FY']+$p['FZ'];
if (!isset($R[229])) $R[229]='NS';
$R[230]=abs($R[223]);
if (!isset($R[230])) $R[230]='NS';
$R[231]=$R[202]- $p['BJ']+ $p['BK']+ $p['ED']- $p['CL']- $p['CM']- $p['CN'];
if (!isset($R[231])) $R[231]='NS';
$R[232]=$p['CJ']- $p['CK']+ $p['YS']- $p['CF']- $p['CD']+ $p['CE']+$p['CG']- $p['DW']- $p['DX']- $p['DY']- $p['DZ']- $p['EA']- $p['EB'];
if (!isset($R[232])) $R[232]='NS';
$R[233]=$p['HN']+ $p['HF']+ $p['HG']- $p['HB']- $p['HC']+ $p['GQ']- $p['GM']+ $p['GA']+ $p['GB']+ $p['GC']+ $p['GD']- $p['FP'];
if (!isset($R[233])) $R[233]='NS';
$R[234]=($R[231]*100)/$R[232];
if (!isset($R[234])) $R[234]='NS';
$R[235]=($R[231])*12/$nm;
if (!isset($R[235])) $R[235]='NS';
$R[236]=($R[232])*12/$nm;
if (!isset($R[236])) $R[236]='NS';
$R[237]=($R[202]*100)/$R[59];
if (!isset($R[237])) $R[237]='NS';
$R[238]=($R[235]*360)/$R[6];
if (!isset($R[238])) $R[238]='NS';
$R[239]=($R[70]*100)/$p['EC'];
if (!isset($R[239])) $R[239]='NS';
$R[240]=($R[70]*100)/abs($R[202]);if ($R[240]<0) $R[240]=0;
if (!isset($R[240])) $R[240]='NS';
$R[241]=($p['EC']/($R[70]))*100;
if (!isset($R[241])) $R[241]='NS';
$R[242]=(($p['GR']+$R[152])*100)/$R[140];if ($R[242]<-200) $R[242]=-200;
if (!isset($R[242])) $R[242]='NS';
$R[243]=($R[81]*100)/($R[79]+$R[90]);
if (!isset($R[243])) $R[243]='NS';
$R[244]=($R[89]*100)/$R[70];
if (!isset($R[244])) $R[244]='NS';
$R[245]=($R[153]*100)/$p['EC'];
if (!isset($R[245])) $R[245]='NS';
$R[246]=($R[153]*100)/$R[140];
if (!isset($R[246])) $R[246]='NS';
$R[247]=($R[80]+$p['YQ']+$p['YR'])/$R[233];
if (!isset($R[247])) $R[247]='NS';
$R[248]=$R[84]*100/$R[60];
if (!isset($R[248])) $R[248]='NS';
$R[249]=$R[231]-$R[232];
if (!isset($R[249])) $R[249]='NS';
$R[250]=($R[63]*100)/$R[88];
if (!isset($R[250])) $R[250]='NS';
$R[251]=(($p['CJ']- $p['CK']- $p['CH']+ $p['CL'])*100/$R[88]);
if (!isset($R[251])) $R[251]='NS';
$R[252]=($R[63]+$R[61])*100/$R[88];
if (!isset($R[252])) $R[252]='NS';
$R[253]=($p['CJ']-$p['CK']-$p['CH']+$p['CL'])*100/$R[73];
if (!isset($R[253])) $R[253]='NS';
$R[254]=$p['AO']+$p['AQ']+$p['AS']+$p['AU']+$p['AW']+$p['AY'];
if (!isset($R[254])) $R[254]='NS';
$R[261]=$R[124]/$R[24];
if (!isset($R[261])) $R[261]='NS';
$R[262]=($R[140]*100/$p['EE']);
if (!isset($R[262])) $R[262]='NS';
$R[263]=($p['HN']*100/$R[70]);
if (!isset($R[263])) $R[263]='NS';
$R[264]=($p['HN']*100/($p['FL']+ $p['FO']));
if (!isset($R[264])) $R[264]='NS';
$R[265]=((($R[233]*12)/$nm)*100)/$R[202];
if (!isset($R[265])) $R[265]='NS';
$R[266]=($R[233]*100)/$R[130];
if (!isset($R[266])) $R[266]='NS';
$R[267]=$R[6]/$R[24];
if (!isset($R[267])) $R[267]='NS';
$R[268]=($R[140]*100)/($p['FL']+$p['FO']);
if (!isset($R[268])) $R[268]='NS';
$R[269]=($R[130]*100)/($R[51]+$R[52]);
if (!isset($R[269])) $R[269]='NS';
$R[271]=($p['FL']+$p['FO'])*100/$p['EE'];
if (!isset($R[271])) $R[271]='NS';
$R[272]=((($p['FU']- $p['FV'])*12)/$nm)/360;
if (!isset($R[272])) $R[272]='NS';
$R[273]=($p['BL']- $p['BM'])/$R[272];if ($R[273]<0) $R[273]=0;if ($R[273]>730) $R[273]=730;
if (!isset($R[273])) $R[273]='NS';
$R[274]=(($p['FS']- $p['FT'])*12/$nm)/360;if ($R[274]<0) $R[274]=0;
if (!isset($R[274])) $R[274]='NS';
$R[275]=($p['BT']- $p['BU'])/$R[274];if ($R[275]<0) $R[275]=0;if ($R[275]>730) $R[275]=730;
if (!isset($R[275])) $R[275]='NS';
$R[276]=((($p['FL']+$p['FM']+$p['FN'])*12)/$nm)/360;if ($R[276]<0) $R[276]=0;
if (!isset($R[276])) $R[276]='NS';
$R[277]=(($p['BR']-$p['BS'])+($p['BN']- $p['BO'])+($p['BP']- $p['BQ'])- $p['DW'])/$R[276];if ($R[277]<0) $R[277]=0;if ($R[277]>730) $R[277]=730;
if (!isset($R[277])) $R[277]='NS';
$R[278]=(($p['BX']-$p['BY']+ $p['YS'])/$R[204]);if ($R[278]<0) $R[278]=0;if ($R[278]>730) $R[278]=730;
if (!isset($R[278])) $R[278]='NS';
$R[279]=($p['DX']-$p['BV'])/$R[207];if ($R[279]<0) $R[279]=0;if ($R[279]>730) $R[279]=730;
if (!isset($R[279])) $R[279]='NS';
$R[280]=(($p['AO']+ $p['AQ']+ $p['AS']+ $p['AU']+ $p['AW']+ $p['AY'])/($p['AN']+ $p['AP']+ $p['AR']+ $p['AT']+ $p['AV']+ $p['AX']))*100;
if (!isset($R[280])) $R[280]='NS';
$R[281]=(($p['FY']+ $p['FZ'])/$R[130])*100;
if (!isset($R[281])) $R[281]='NS';
$R[282]=(($p['GA']+$p['GB'])*100)/$R[130];
if (!isset($R[282])) $R[282]='NS';
$R[283]=(($p['HN'])*100)/$R[130];
if (!isset($R[283])) $R[283]='NS';
$R[284]=($R[153]*100)/$R[130];
if (!isset($R[284])) $R[284]='NS';
$R[285]=(($p['HK']+$p['FX'])*100)/$R[130];
if (!isset($R[285])) $R[285]='NS';
$R[286]=($R[6])/360;if ($R[286]<0) $R[286]=0;
if (!isset($R[286])) $R[286]='NS';
$R[297]=$R[215]/$R[286];
if (!isset($R[297])) $R[297]='NS';
$R[298]=$R[217]/$R[286];
if (!isset($R[298])) $R[298]='NS';
$R[299]=$R[219]/$R[286];
if (!isset($R[299])) $R[299]='NS';
$R[300]=($p['YS']*100)/abs($R[226]);
if (!isset($R[300])) $R[300]='NS';
$R[301]=($R[140]*12)/$nm;
if (!isset($R[301])) $R[301]='NS';
$R[302]=$p['IJ'];
if (!isset($R[302])) $R[302]='NS';
$R[303]=$p['JH'];
if (!isset($R[303])) $R[303]='NS';
$R[304]=$p['ZR'];
if (!isset($R[304])) $R[304]='NS';
$R[305]=$R[70]+$R[88]+$R[89]-$R[226];
if (!isset($R[305])) $R[305]='NS';
$R[306]=($R[6]*(100-getInflation(substr($millesime,-4))))/100;
if (!isset($R[306])) $R[306]='NS';
$R[307]=($R[140]*100)/$R[130];
if (!isset($R[307])) $R[307]='NS';
$R[308]=(($p['CJ']-$p['CK']-$p['CH']+$p['CL'])/$R[88]);
if (!isset($R[308])) $R[308]='NS';
$R[309]=$p['CB'];
if (!isset($R[309])) $R[309]='NS';
$R[310]=(($p['BJ']-$p['AN'])*100)/$p['EE'];
if (!isset($R[310])) $R[310]='NS';
$R[311]=$p['AN']+$p['AP'];
if (!isset($R[311])) $R[311]='NS';
$R[312]=$p['AH'];
if (!isset($R[312])) $R[312]='NS';
$R[313]=$R[10]*100/$p['EE'];
if (!isset($R[313])) $R[313]='NS';
$R[314]=$R[311]*100/$p['EE'];
if (!isset($R[314])) $R[314]='NS';
$R[315]=(($p['YT']+$p['YU'])*12)/$nm ;
if (!isset($R[315])) $R[315]='NS';
$R[316]=($p['YT']+$p['YU'])*100/($p['FY']+$p['FZ']);
if (!isset($R[316])) $R[316]='NS';
$R[317]=$p['CP'];
if (!isset($R[317])) $R[317]='NS';
$R[318]=(($R[170]-$R[181])*12)/$nm;
if (!isset($R[318])) $R[318]='NS';
$R[321]=(($R[199]-$R[171]+$R[172]+$p['GA'])*12)/$nm;
if (!isset($R[321])) $R[321]='NS';
$R[330]=$p['FZ']/$p['FY'];
if (!isset($R[330])) $R[330]='NS';
$R[331]=$p['FY']/$p['YP'];
if (!isset($R[331])) $R[331]='NS';
$R[500]=$p['EE']*0.15;
if (!isset($R[500])) $R[500]='NS';
$R[501]=($p['CS']+$p['CU'])*100/($p['BJ']-$p['AN']);
if (!isset($R[501])) $R[501]='NS';
$R[502]=($p['CV']+$p['BC'])*100/($p['CS']+$p['CU']);
if (!isset($R[502])) $R[502]='NS';
$R[503]=$R[233]*100/$R[5];
if (!isset($R[503])) $R[503]='NS';
$R[504]=((($p['FL']+$p['FM']+$p['FN'])*12)/$nm);if ($R[504]<0) $R[504]=0;
if (!isset($R[504])) $R[504]='NS';
$R[505]=(($R[130]*12)/$nm)*100/$R[6];
if (!isset($R[505])) $R[505]='NS';
$R[506]=(($R[140]*12)/$nm)*100/$R[6];
if (!isset($R[506])) $R[506]='NS';
$R[507]=($R[17]*100)/$R[6];
if (!isset($R[507])) $R[507]='NS';
$R[508]=(($R[170]*12)/$nm)*100/$R[6];
if (!isset($R[508])) $R[508]='NS';
$R[509]=($R[11]*100)/$R[6];
if (!isset($R[509])) $R[509]='NS';
$R[510]=($R[70]*100)/$R[22];
if (!isset($R[510])) $R[510]='NS';
$R[511]=($R[70]+$R[72])*100/($R[79]+$R[90]);
if (!isset($R[511])) $R[511]='NS';
$R[512]=$R[226]/$R[286];
if (!isset($R[512])) $R[512]='NS';
$R[513]=(($p['HN']- $p['HI']- $p['FO']- $p['FP'])*12)/$nm;
if (!isset($R[513])) $R[513]='NS';
$R[514]=($R[513]*100)/$R[6];
if (!isset($R[514])) $R[514]='NS';
$R[515]=($p['HN']-$p['HI']-$p['FO']-$p['FP']);
if (!isset($R[515])) $R[515]='NS';
$R[516]=($R[513]-$R[11])*100/$R[11];
if (!isset($R[516])) $R[516]='NS';
$R[517]=($R[233]*100)/($p['BJ']-$p['AN']);
if (!isset($R[517])) $R[517]='NS';
$R[518]=($R[233]*100)/$R[80];
if (!isset($R[518])) $R[518]='NS';
$R[519]=($R[80]*100)/$R[22];
if (!isset($R[519])) $R[519]='NS';
$R[520]=($R[153]*100)/$R[5];
if (!isset($R[520])) $R[520]='NS';
$R[521]=($R[226]+$p['CS']-$p['CT']+$p['CU']-$p['CV']+$p['BB']-$p['BC']+$R[210])/(($R[102]+$R[121]+$R[123]+$R[132]+$R[133]+$R[142])/360);
if (!isset($R[521])) $R[521]='NS';
$R[522]=($R[16]*100)/$R[22];
if (!isset($R[522])) $R[522]='NS';
$R[523]=($R[10]*100)/$R[70];
if (!isset($R[523])) $R[523]='NS';
$R[524]=($R[52]*100)/$R[22];
if (!isset($R[524])) $R[524]='NS';
$R[525]=($R[60]*100)/$R[22];
if (!isset($R[525])) $R[525]='NS';
$R[526]=($R[63]*100)/$R[22];
if (!isset($R[526])) $R[526]='NS';
$R[527]=($R[202]*100)/$R[22];
if (!isset($R[527])) $R[527]='NS';
$R[528]=($R[110]*100)/$R[5];
if (!isset($R[528])) $R[528]='NS';
$R[529]=($p['ZE']*12)/$nm;
if (!isset($R[529])) $R[529]='NS';
$R[530]=(($R[153]+$R[170])*100)/$R[153];
if (!isset($R[530])) $R[530]='NS';
$R[531]=(($R[153]+$R[170]+$p['XQ'])*100)/($R[153]+$p['XQ']);
if (!isset($R[531])) $R[531]='NS';
$R[532]=($R[52]*100)/($p['BJ']-$p['AN']);
if (!isset($R[532])) $R[532]='NS';
$R[533]=($R[53]*100)/$R[22];
if (!isset($R[533])) $R[533]='NS';
$R[534]=($R[1]*100)/$R[5];
if (!isset($R[534])) $R[534]='NS';
$R[535]=($p['ZE']*100)/$R[70];
if (!isset($R[535])) $R[535]='NS';
$R[538]=($R[233]*100)/$R[305];
if (!isset($R[538])) $R[538]='NS';
$R[540]=($R[233]*100)/$R[202];
if (!isset($R[540])) $R[540]='NS';
$R[542]=($R[16]*100)/$R[153];
if (!isset($R[542])) $R[542]='NS';
$R[543]=($R[10]*100)/($R[70]+$R[72]);
if (!isset($R[543])) $R[543]='NS';
$R[544]=(($R[130]*12)/$nm)/$R[24];
if (!isset($R[544])) $R[544]='NS';
$R[545]=$R[515]-$R[10];
if (!isset($R[545])) $R[545]='NS';
$R[546]=$R[22]-$R[231]-$R[202];
if (!isset($R[546])) $R[546]='NS';
$R[547]=$p['CJ']-$p['CK'];
if (!isset($R[547])) $R[547]='NS';
$R[548]=$R[22]-$R[547];
if (!isset($R[548])) $R[548]='NS';
$R[549]=$p['DB'];
if (!isset($R[549])) $R[549]='NS';
$R[550]=$p['DC'];
if (!isset($R[550])) $R[550]='NS';
$R[551]=$p['DH'];
if (!isset($R[551])) $R[551]='NS';
$R[552]=$R[549]+$R[550]+$R[551];
if (!isset($R[552])) $R[552]='NS';
$R[553]=$R[145]-$R[144];
if (!isset($R[553])) $R[553]='NS';
$R[554]=($R[51]*100)/$R[22];
if (!isset($R[554])) $R[554]='NS';
$R[555]=($R[151]*100)/$R[53];
if (!isset($R[555])) $R[555]='NS';
$R[556]=($R[62]*100)/$R[22];
if (!isset($R[556])) $R[556]='NS';
$R[558]=$R[547]-$R[63]-$R[60]-$R[223];
if (!isset($R[558])) $R[558]='NS';
$R[559]=abs($R[223]);
if (!isset($R[559])) $R[559]='NS';
$R[560]=abs($R[63]);
if (!isset($R[560])) $R[560]='NS';
$R[561]=$R[5]+$p['FQ']+$p['FO'];
if (!isset($R[561])) $R[561]='NS';
$R[562]=($p['BX']+$p['BV']-$p['BW'])+($p['YS'])+($p['CN'])+($p['CH']-$p['CI']);
if (!isset($R[562])) $R[562]='NS';
$R[563]=$R[561]-$R[562];
if (!isset($R[563])) $R[563]='NS';
$R[564]=$p['FW']+$p['FX']+$p['FY']+$p['FZ']+$p['GE'];
if (!isset($R[564])) $R[564]='NS';
$R[565]=$p['DX']+$p['DW']+$p['EB']+$p['ED'];
if (!isset($R[565])) $R[565]='NS';
$R[566]=$R[564]-$R[565];
if (!isset($R[566])) $R[566]='NS';
$R[567]=$R[563]-$R[566];
if (!isset($R[567])) $R[567]='NS';
$R[568]=$p['GL']+$p['GN']-$p['GS']+$p['HA']-$p['HE'];
if (!isset($R[568])) $R[568]='NS';
$R[569]=$p['GR'];
if (!isset($R[569])) $R[569]='NS';
$R[570]=$p['HK']+$p['DY1']-$p['DY'];
if (!isset($R[570])) $R[570]='NS';
$R[571]=$p['HJ'];
if (!isset($R[571])) $R[571]='NS';
$R[572]=$p['ZE'];
if (!isset($R[572])) $R[572]='NS';
$R[573]=$R[567]+$R[568]-$R[569]-$R[570]-$R[571]-$R[572];
if (!isset($R[573])) $R[573]='NS';
$R[574]=$p['LP']+$p['KF'];
if (!isset($R[574])) $R[574]='NS';
$R[575]=$p['LS'];
if (!isset($R[575])) $R[575]='NS';
$R[576]=$p['KF'];
if (!isset($R[576])) $R[576]='NS';
$R[577]=$p['DJ'];
if (!isset($R[577])) $R[577]='NS';
$R[578]=$p['DZ']-$p['DZ1'];
if (!isset($R[578])) $R[578]='NS';
$R[579]=$p['NG'];
if (!isset($R[579])) $R[579]='NS';
$R[580]=$R[574]+$R[575]+$R[576]-$R[577]-$R[578]-$R[579];
if (!isset($R[580])) $R[580]='NS';
$R[581]=$p['AA']-$p['AA1'];
if (!isset($R[581])) $R[581]='NS';
$R[582]=$p['CC1']-$p['CC2'];
if (!isset($R[582])) $R[582]='NS';
$R[583]=$R[581]-$R[582];
if (!isset($R[583])) $R[583]='NS';
$R[584]=$p['VJ']+$p['GR'];
if (!isset($R[584])) $R[584]='NS';
$R[585]=$p['VK']+($p['HP']+$p['HQ'])+$p['GR1'];
if (!isset($R[585])) $R[585]='NS';
$R[586]=($R[584]-$R[585]);
if (!isset($R[586])) $R[586]='NS';
$R[587]=$p['EH']-$p['EH1'];
if (!isset($R[587])) $R[587]='NS';
$R[588]=$p['YS']-$p['YS1'];
if (!isset($R[588])) $R[588]='NS';
$R[589]=$R[587]+$R[588];
if (!isset($R[589])) $R[589]='NS';
$R[590]=$R[583]+$R[586]+$R[589];
if (!isset($R[590])) $R[590]='NS';
$R[591]=$p['CG']-$p['CG2'];
if (!isset($R[591])) $R[591]='NS';
$R[592]=$p['CE']-$p['CE2'];
if (!isset($R[592])) $R[592]='NS';
$R[593]=$R[573]-$R[580]+$R[590];
if (!isset($R[593])) $R[593]='NS';
$R[594]=($R[22]-$R[59]-$R[223]);
if (!isset($R[594])) $R[594]='NS';
$R[595]=($R[22]-$R[79]-$R[80]-$R[230]);
if (!isset($R[595])) $R[595]='NS';
$R[596]=$p['EE']-$R[79]-$R[89]-$R[84];
if (!isset($R[596])) $R[596]='NS';
$R[597]=$p['EE']-$R[65]-$R[60]-$R[59];
if (!isset($R[597])) $R[597]='NS';
$R[701]=$p['BP3'];
if (!isset($R[701])) $R[701]='NS';
$R[702]=$p['BR3'];
if (!isset($R[702])) $R[702]='NS';
$R[703]=$p['BP8'];
if (!isset($R[703])) $R[703]='NS';
$R[704]=$p['BP3'];
if (!isset($R[704])) $R[704]='NS';
$R[705]=($p['BA1']-$p['BP1'])*12/$nm;
if (!isset($R[705])) $R[705]='NS';
$R[706]=($p['BA2']-$p['BP2'])*12/$nm;
if (!isset($R[706])) $R[706]='NS';
$R[707]=($p['BR1']*12)/$nm;
if (!isset($R[707])) $R[707]='NS';
$R[708]=($p['BR2']*12)/$nm;
if (!isset($R[708])) $R[708]='NS';
$R[710]=$p['BP3']+$p['BP4']+$p['BP5']+$p['BP7']+$p['BP8']-($p['BP8']*0.07);
if (!isset($R[710])) $R[710]='NS';
$R[711]=$p['BP6'];if ($R[711]>0) $R[711]=0;
if (!isset($R[711])) $R[711]='NS';
$R[712]=($R[710]*12)/$nm;
if (!isset($R[712])) $R[712]='NS';
$R[713]=($R[711]*12)/$nm;
if (!isset($R[713])) $R[713]='NS';
$R[715]=0;
if (!isset($R[715])) $R[715]='NS';
$R[716]=($p['BP1']+$p['BP2']-$p['BA1']-$p['BA2'])/($R[710]*12.5);
if (!isset($R[716])) $R[716]='NS';
$R[720]=($p['BP1']+$p['BP2']-$p['BA1']+($p['BA1']*0.20)-$p['BA2']+($p['BA2']*0.025));
if (!isset($R[720])) $R[720]='NS';
$R[721]=($R[720]*12)/$nm;
if (!isset($R[721])) $R[721]='NS';
$R[722]=($R[712]*100)/$R[721];
if (!isset($R[722])) $R[722]='NS';
$R[723]=($R[712]+$R[713])*100/$R[721];
if (!isset($R[723])) $R[723]='NS';
$R[724]=$R[721]*0.08;
if (!isset($R[724])) $R[724]='NS';
$R[730]=$p['BR3']/$R[710];
if (!isset($R[730])) $R[730]='NS';
$R[731]=$p['BR3']/($R[710]+$R[711]);
if (!isset($R[731])) $R[731]='NS';
$R[732]=$p['BR3']/$p['BA3'];
if (!isset($R[732])) $R[732]='NS';
$R[740]=($p['BA1']-($p['BA1']*0.2)+$p['BA2']-($p['BA2']*0.025)-($R[710]*0.15))*100/($R[710]*8);
if (!isset($R[740])) $R[740]='NS';
$R[741]=($p['BA1']-($p['BA1']*0.2)+$p['BA2']-($p['BA2']*0.025)-(($R[710]+$R[711])*0.15))*100/(($R[710]+$R[711])*8);
if (!isset($R[741])) $R[741]='NS';
$R[742]=0;
if (!isset($R[742])) $R[742]='NS';
$R[751]=$p['AP1'];
if (!isset($R[751])) $R[751]='NS';
$R[752]=$p['AP2'];
if (!isset($R[752])) $R[752]='NS';
$R[753]=$p['AR3'];
if (!isset($R[753])) $R[753]='NS';
$R[757]=($p['AR1']*12)/$nm;
if (!isset($R[757])) $R[757]='NS';
$R[758]=($p['AR2']*12)/$nm;
if (!isset($R[758])) $R[758]='NS';
$R[761]=($p['AP1']*12)/$nm;
if (!isset($R[761])) $R[761]='NS';
$R[762]=($p['AP2']*12)/$nm;
if (!isset($R[762])) $R[762]='NS';
$R[770]=($R[761]*100)/$R[762];
if (!isset($R[770])) $R[770]='NS';
$R[771]=($p['AP1']*100)/$p['AR1'];
if (!isset($R[771])) $R[771]='NS';
$R[772]=($p['AP1']*100)/$p['AR2'];
if (!isset($R[772])) $R[772]='NS';
$R[780]=($p['AR4']*100)/$p['AP1'];
if (!isset($R[780])) $R[780]='NS';
$R[781]=($p['AR4']*100)/$p['AR1'];
if (!isset($R[781])) $R[781]='NS';
$R[782]=($p['AR4']*100)/$p['AA2'];
if (!isset($R[782])) $R[782]='NS';
$R[783]=($p['AR4']*100)/($p['AP1']-$p['AR4']);
if (!isset($R[783])) $R[783]='NS';
$R[784]=($p['AR2']*100)/$p['AR1'];
if (!isset($R[784])) $R[784]='NS';
$R[791]=($p['AA1']*100)/$p['AP1'];
if (!isset($R[791])) $R[791]='NS';
$R[792]=($p['AA1']*100)/$p['AP2'];
if (!isset($R[792])) $R[792]='NS';
$R[333]=($R[233]*12)/$nm;
if (!isset($R[333])) $R[333]='NS';
$tabRatios[$numBil]=$R;
$numBil++;
}
?>
for($i=0; $i<$numBil; $i++) {
$tabRatios[$i][319]=($tabRatios[$i][318]+$tabRatios[$i+1][318]+$tabRatios[$i+2][318])/3; }
for($i=0; $i<$numBil; $i++) {
$tabRatios[$i][320]=($tabRatios[$i][11]+$tabRatios[$i+1][11]+$tabRatios[$i+2][11])/3; }
for($i=0; $i<$numBil; $i++) {
$tabRatios[$i][322]=($tabRatios[$i][321]+$tabRatios[$i+1][321]+$tabRatios[$i+2][321])/3; }
for($i=0; $i<$numBil; $i++) {
$tabRatios[$i][536]=($tabRatios[$i][306]+$tabRatios[$i+1][306]+$tabRatios[$i+2][306])/3; }
for($i=0; $i<$numBil; $i++) {
$tabRatios[$i][537]=($tabRatios[$i][503]+$tabRatios[$i+1][503]+$tabRatios[$i+2][503])/3; }
for($i=0; $i<$numBil; $i++) {
$tabRatios[$i][539]=($tabRatios[$i][538]+$tabRatios[$i+1][538]+$tabRatios[$i+2][538])/3; }
for($i=0; $i<$numBil; $i++) {
$tabRatios[$i][541]=($tabRatios[$i][540]+$tabRatios[$i+1][540]+$tabRatios[$i+2][540])/3; }
for($i=0; $i<$numBil; $i++) {
$tabRatios[$i][557]=($tabRatios[$i][265]+$tabRatios[$i+1][265]+$tabRatios[$i+2][265])/3; }
for($i=0; $i<$numBil; $i++) {
$tabRatios[$i][598]=($tabRatios[$i][529]+$tabRatios[$i+1][529]+$tabRatios[$i+2][529])/3; }
return $tabRatios;
}

View File

@ -1,16 +1,11 @@
<?php
require_once 'Metier/partenaires/classMPrivileges.php';
require_once 'Metier/partenaires/classMMarques.php';
require_once 'Metier/scores/classMRegression.php';
require_once 'Metier/partenaires/classMLiens2.php';
require_once 'Metier/scores/classMSolvabilite.php';
require_once 'Metier/scores/Variables/configMRatios.php';
require_once 'Metier/scores/classMRatios.php';
define('INDISCORE_DEBUG', false);
@ -596,7 +591,6 @@ function calculIndiScore($siren, $nic=0, $accesDist=false, $cycleClient=2, $mail
global $tabFormules;
global $tabFormulesRatios;
global $mBil;
global $tabBilan;
global $efftr;
global $tabRatiosInfos;
@ -625,7 +619,6 @@ function calculIndiScore($siren, $nic=0, $accesDist=false, $cycleClient=2, $mail
* Récupération des informations identitaire
*/
$tabIdentite=$iInsee->getIdentiteEntreprise($siren, $nic, 0, false, $accesDist);
$tabBilan=array();
$timer['identite']=microtime(true);
if (empty($tabIdentite)) {
@ -642,31 +635,18 @@ 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
$tabVariables = include realpath(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'Variables/CacheTabVariables.php';
$tabFormules = include realpath(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'Variables/CacheTabFormules.php';
$tabVariables = include __DIR__ . '/Variables/CacheTabVariables.php';
$tabFormules = include __DIR__ . '/Variables/CacheTabFormules.php';
$tabFormulesRatios = array();
foreach ($tabFormules as $tmpFormule) {
$tabFormulesRatios[$tmpFormule['id']] = $tmpFormule;
$tabRatiosInfos[$tmpFormule['id']]=array('unite' => $tmpFormule['unite']);
}
$tabRatiosSecteurs = $tabBilansR = $tabRatios2 = $tabRatiosEvol = array();
$tabRatiosSecteurs = $tabRatios2 = $tabRatiosEvol = array();
$NIC=substr($tabIdentite['SiretSiege'],-5);
$SIREN=$siren;
@ -855,29 +835,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
*/
@ -969,35 +926,41 @@ function calculIndiScore($siren, $nic=0, $accesDist=false, $cycleClient=2, $mail
$DCREN_AA=substr($dateCrea,0,4);
$AGE=$classWdate->nbMoisEntre($dateCrea, date('Ymd'));
/** Elements provenant des ratios :
** @todo Problème sur les comptes consolides avec R et Rs **
$i2=0;
foreach ($tabRatios as $i=>$Rtmp) {
if ( ($tabBilan[$i]['CONSOLIDE']=='S'&&isset($tabRatios[$i+1])&&($tabBilan[$i+1]['CONSOLIDE']=='S'||($tabBilan[$i+1]['CONSOLIDE']=='N'&&$tabBilan[$i+1]['DATE_CLOTURE']<>$tabBilan[$i]['DATE_CLOTURE'])))
|| ($tabBilan[$i]['CONSOLIDE']=='N'&&isset($tabRatios[$i+1])&&($tabBilan[$i+1]['CONSOLIDE']=='N'||($tabBilan[$i+1]['CONSOLIDE']=='S'&&$tabBilan[$i+1]['DATE_CLOTURE']<>$tabBilan[$i]['DATE_CLOTURE'])))
)
$i2++;
// $Rmont=(($R[$Ridx]-$tabRatios[$i+1][$Ridx])*100)/abs($tabRatios[$i+1][$Ridx]);
elseif ( ($tabBilan[$i]['CONSOLIDE']=='S'&&isset($tabRatios[$i+1])&&($tabBilan[$i+2]['CONSOLIDE']=='S'||($tabBilan[$i+2]['CONSOLIDE']=='N'&&$tabBilan[$i+2]['DATE_CLOTURE']<>$tabBilan[$i]['DATE_CLOTURE'])))
|| ($tabBilan[$i]['CONSOLIDE']=='N'&&isset($tabRatios[$i+1])&&($tabBilan[$i+2]['CONSOLIDE']=='N'||($tabBilan[$i+2]['CONSOLIDE']=='S'&&$tabBilan[$i+2]['DATE_CLOTURE']<>$tabBilan[$i]['DATE_CLOTURE'])))
$i2=$i2+2;
$i2++
$tabBilan = $tabBil = array();
/**
* Bilan - Liste des bilans
*/
$mBil = new MBilans($siren, $iDb);
$tabBilans = $mBil->listeBilans($accesDist);
$NBBILAN = count($tabBilans);
if ($NBBILAN > 0)
{
/**
* Postes des bilans
*/
foreach ($tabBilans as $millesime => $item)
{
if(in_array($item['typeBilan'], array('S', 'N')))
{
$tabBilan[] = $mBil->getBilan(substr($millesime,-10), substr($millesime,0,1), '');
}
}
/**
* Calcul des ratios
*/
$tabRatios = calculRatios($tabBilans, $tabIdentite, $accesDist);
}
*/
$timer['ratios']=microtime(true);
// Tableau des années de bilans
$tabAnnees=array();
$tabAnnees = array();
// Tableau d'infos sur les bilans
$i2=0;
if (count($tabRatios)>0) {
foreach ($tabRatios as $i=>$Rtmp) {
$tabBilansR[$i]=array(
'dateCloture' => $tabBilan[$i]['DATE_CLOTURE'],
'duree' => $tabBilan[$i]['DUREE_MOIS'],
'devise' => $tabBilan[$i]['MONNAIE'],
'type' => $tabBilan[$i]['CONSOLIDE'],
'unite' => 'U',
);
if (count($tabRatios)>0)
{
foreach ($tabRatios as $i=>$Rtmp)
{
if (substr($tabBilan[$i]['DATE_CLOTURE'],0,4)>1900){
$tabAnnees[$i]=substr($tabBilan[$i]['DATE_CLOTURE'],0,4);
}
@ -1063,8 +1026,8 @@ function calculIndiScore($siren, $nic=0, $accesDist=false, $cycleClient=2, $mail
$MARCHE=$MARCHEp=$MARCHEVOL=$MARCHEPART=$MARCHEPARTp=$MARCHEPARTEVOL='';
$MARCHESAL=$MARCHESALp=$MARCHENBENT=$MARCHENBENTp='';
$tabRatiosSecteurs=$Rtot=array();
if (count($tabAnnees)>0) {
if (count($tabAnnees)>0)
{
if (strlen($naf)>4) $strNaf=" AND naf5='$naf' ";
else $strNaf=" AND naf4='$naf' ";
if (count($tabAnnees)>2) $strAnnees='AND annee BETWEEN '.$tabAnnees[2].' AND '.$tabAnnees[0];
@ -1175,29 +1138,12 @@ function calculIndiScore($siren, $nic=0, $accesDist=false, $cycleClient=2, $mail
$timer['regression']=microtime(true);
/** Bilan des collectivités **/
/*if ($FJUR==7210) {
$lstCom=$iDb->select(
'bilansM14',
'millesime, dep, com, depA, siren, sirenValide, depLib, comLib, popLeg, popInf, fiscalite, popFisc, R01a, R01b, R01c, R02a, R02b, R02c, R02d, R02e, R03a, R03b, R03c, R03d, R03e, R04a, R04b, R04c, R04d, R04e, R05a, R05b, R05c, R06a, R06b, R06c, R06d, R06e, R07a, R07b, R07c, R07d, R07e, R08a, R08b, R08c, R08d, R08e, R09a, R09b, R09c, R09d, R09e, R10a, R10b, R10c, R10d, R10e, R11a, R11b, R11c, R12a, R12b, R12c, R13a, R13b, R13c, R13d, R13e, R14a, R14b, R14c, R14d, R14e, R15a, R15b, R15c, R15d, R15e, R16a, R16b, R16c, R16d, R16e, R17a, R17b, R17c, R18a, R18b, R18c, R18d, R18e, R19a, R19b, R19c, R19d, R19e, R20a, R20b, R20c, R20d, R20e, R21a, R21b, R21c, R21d, R21e, R22a, R22b, R22c, R23a, R23b, R23c, R24a, R24b, R24c, R25a, R25b, R25c, R26a, R26b, R26c, R26d, R26e, R27a, R27b, R27c, R27d, R27e, R28a, R28b, R28c, R28d, R28e, R29a, R29b, R29c, R29d, R29e, R30a, R30b, R30c, R30d, R30e, R31a, R31b, R31c, R31d, R31e, R32a, R32b, R32c, R33a, R33b, R33c, R33d, R33e, R33f, R34a, R34b, R34c, R34d, R34e, R34f, R35a, R35b, R35c, R35d, R35e, R35f, R36a, R36b, R36c, R36d, R36e, R36f, R37a, R37b, R37c, R37d, R37e, R37f, R38a, R38b, R38c, R38d, R38e, R39a, R39b, R39c, R39d, R39e, R40a, R40b, R40c, R40d, R40e, R41a, R41b, R41c, R41d, R41e, R42a, R42b, R42c, R42d, R42e, R43a, R43b, R43c, R43d, R43e, R44a, R44b, R44c, dateInsert',
"siren=$siren ORDER BY millesime DESC LIMIT 0,5", false, MYSQL_ASSOC);
foreach ($lstCom as $i=>$tabCom) {
$tabRatios[]=convertZones('R', $tabCom);
}
$R=$tabRatios[0];
$Rp=$tabRatios[1];
$Rp2=$tabRatios[2];
$Rp3=$tabRatios[3];
$Rp4=$tabRatios[4];
}*/
// Elements provenant des bilans
$EFFBILAN=$tabBilan[0]['YP'];
$nm=$nbMoisBilCumul=$tabBilan[0]['DUREE_MOIS'];
$nmp=$tabBilan[0]['DUREE_MOIS_PRE'];
$BILANDATE=$tabBilan[0]['DATE_CLOTURE'];
$tabClotures[$BILANDATE]=$BILANDATE;
$BILANDATEp=$tabBilan[0]['DATE_CLOTURE_PRE'];
if ($BILANDATEp==0) $BILANDATEp=$tabBilan[1]['DATE_CLOTURE'];
@ -1208,7 +1154,6 @@ function calculIndiScore($siren, $nic=0, $accesDist=false, $cycleClient=2, $mail
$BILANp=1;
$nbMoisBilDate=$classWdate->nbMoisEntre($BILANDATEp, $BILANDATE);
$nbMoisBilCumul+=$nmp;
$tabClotures[$BILANDATEp]=$BILANDATEp;
}
$BILANDATEp2 =$tabBilan[2]['DATE_CLOTURE'];
@ -1218,7 +1163,6 @@ function calculIndiScore($siren, $nic=0, $accesDist=false, $cycleClient=2, $mail
$BILANp2=1;
$nbMoisBilDate=$classWdate->nbMoisEntre($BILANDATEp2, $BILANDATE);
$nbMoisBilCumul+=$nmp2;
$tabClotures[$BILANDATEp2]=$BILANDATEp2;
}
$BILANDATEp3 =$tabBilan[3]['DATE_CLOTURE'];
@ -1228,7 +1172,6 @@ function calculIndiScore($siren, $nic=0, $accesDist=false, $cycleClient=2, $mail
$BILANp3=1;
$nbMoisBilDate=$classWdate->nbMoisEntre($BILANDATEp3, $BILANDATE);
$nbMoisBilCumul+=$nmp3;
$tabClotures[$BILANDATEp3]=$BILANDATEp3;
}
$BILANDATEp4 =$tabBilan[4]['DATE_CLOTURE'];
@ -1238,7 +1181,6 @@ function calculIndiScore($siren, $nic=0, $accesDist=false, $cycleClient=2, $mail
$BILANp4=1;
$nbMoisBilDate=$classWdate->nbMoisEntre($BILANDATEp4, $BILANDATE);
//$nbMoisBilCumul+=$nmp4;
$tabClotures[$BILANDATEp4]=$BILANDATEp4;
}
// Liste des années de bilans ultérieurs
@ -1250,7 +1192,8 @@ function calculIndiScore($siren, $nic=0, $accesDist=false, $cycleClient=2, $mail
/** Détection fine de l'état de fermeture éventuel à l'INSEE **/
$tabTmp=$iDb->select('insee.insee_even', 'insEVE, insDATEVE',
"insSIREN=$siren AND insEVE IN ('400','410','420','425','MPF','MNP') ORDER BY insDATEVE DESC", INDISCORE_DEBUG, MYSQL_ASSOC);
"insSIREN=$siren AND insEVE IN ('400','410','420','425','MPF','MNP') ORDER BY insDATEVE DESC",
INDISCORE_DEBUG, MYSQL_ASSOC);
if (count($tabTmp)>0) {
$tabModif=$tabTmp[0];
$ETATINSEE_MMAA=substr($tabModif['insDATEVE'],0,7);
@ -1393,12 +1336,10 @@ function calculIndiScore($siren, $nic=0, $accesDist=false, $cycleClient=2, $mail
}
}
}
$tabClotures[str_replace('-','',$depot['dateEffet'])]=str_replace('-','',$depot['DateParution']);
$lastDepot=$depot['dateEffet'];
$ANNONCEBOD++;
$ANNONCEBODC++;
}
sort($tabClotures);
}
// Publications régulieres et 12 mois identiques
@ -1910,7 +1851,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 +1910,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 +1919,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 +1935,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 +1969,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,38 +1995,34 @@ function calculIndiScore($siren, $nic=0, $accesDist=false, $cycleClient=2, $mail
elseif ($CAPITAL<10000000) $NOTECAP20=17;
else $NOTECAP20=19;
}
} else {
$numBil=0;//sleep(1);
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é !!!
if ($tabBilan[$i]['CONSOLIDE']=='S') {
$tabTmp=$mBil->bilanSimplifie2Normal($tabBilan[$i]);
$tabBilan[$i]=array_merge($tabTmp, $tabBilan[$i]);
}
else
{
$numBil = $i = 0;
foreach ($tabBilan as $item)
{
if ($item['CONSOLIDE']=='S')
{
$tabTmp=$mBil->bilanSimplifie2Normal($item);
$tabBilan[$i] = array_merge($tabTmp, $item);
$numBil++;
} elseif ($tabBilan[$i]['CONSOLIDE']=='N')
}
elseif ($item['CONSOLIDE']=='N')
{
$numBil++;
else {
/** On ignore les bilans Assurance, Banques et Consolidés **/
/*if ($tabBilan[$i]['CONSOLIDE']=='C' && $scoreAltman=='') {
$icotation = new ICotation($tabBilan[$i], true);
$scoreAltman=round($icotation->scoreAltman(),2);
}*/
}
else
{
continue;
}
if ($numBil>2) break;
unset($icotation);
$icotation = new ICotation($tabBilan[$i], true);
$icotation = new ICotation($item, true);
$secteur=$icotation->getSecteurActivite($isolv->getNaf4($naf));
$libSecteur=$icotation->tabLibActivite[$secteur];
$chiffeAffaire=$icotation->calculChiffreAffaires($isolv->getNaf4($naf));
$tabBil[$i]=array(
'Millesime'=>$tabBilan[$i]['DATE_CLOTURE'],
$tabBil[$i] = array(
'Millesime'=>$item['DATE_CLOTURE'],
'FraisPerso'=>$icotation->calculFraisPersonnel(),
'CA'=>$chiffeAffaire,
'EBE'=>$icotation->calculEBE(),
@ -2255,14 +2185,16 @@ function calculIndiScore($siren, $nic=0, $accesDist=false, $cycleClient=2, $mail
//sendMail('production@scores-decisions.com', 'ylenaour@scores-decisions.com', "Indiscore sur $siren : Structure Score Financier", $strNote);
}
}
else {
else
{
$noteSolvabilitePre=$noteSD;
$noteFinPre=$noteMoy;
if ($noteSolvabilite>$noteSolvabilitePre) $tendance='Haussière';
elseif ($noteSolvabilite==$noteSolvabilitePre) $tendance='Stable';
else $tendance='Baissière';
}
//Note financière Solvabilite = $icotation->scoreD($naf)
$i++;
}
// Cas de présence unique de bilan Banque ou Assurance qui ne sont pas géré financièrement
@ -2290,7 +2222,6 @@ function calculIndiScore($siren, $nic=0, $accesDist=false, $cycleClient=2, $mail
(substr($tabIdentite['DateCreaEn'],0,4)*1+2)<date('Y') && // L'entreprise à plus de 2 ans
$FJURPUB ) { // et est soumise à publication
$SCORECONF-=20;
//$tabCommentaires['neg'][]=prepareString("L'entreprise ne respecte pas ses obligations de publication régulière de ses bilans.");
}
if (!$tabIdentite['TvaAttribue']) { // Entreprise sans numéro de TVA
$TVAINTRA=false;
@ -2800,7 +2731,6 @@ function calculIndiScore($siren, $nic=0, $accesDist=false, $cycleClient=2, $mail
// Encours estimé = CA Estimé / 72
if ($CAESTIME>0) $encoursEstime=$CAESTIME/36;
}
// debugLog('I', "INDISCORE A $encoursIni $encoursEstime $encours", __LINE__, __FILE__, __FUNCTION__, __CLASS__);
/** Plafond des encours en fonction de la note / 100
**/
@ -3457,6 +3387,19 @@ function calculIndiScore($siren, $nic=0, $accesDist=false, $cycleClient=2, $mail
$VALCOEFMAXCA=$tabTmp['MAXI'];
}
//Chargement des phrases de commentaires - @todo : Mettre en cache
$tabCommentaires = $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';
@ -3465,10 +3408,8 @@ function calculIndiScore($siren, $nic=0, $accesDist=false, $cycleClient=2, $mail
}
require_once 'Metier/scores/Variables/'.$fileIndiscore;
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));
@ -3478,23 +3419,22 @@ function calculIndiScore($siren, $nic=0, $accesDist=false, $cycleClient=2, $mail
foreach ($C as $idx=>$value){
$numC++;
if ($value) {
$commentaires=@implode('<br/>',$tabCommentaires[$idx][$cycleClient]);
$commentaires=@implode('<br/>',$tabCommentaires[$idx]);
$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 +3549,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 +3577,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 +3814,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;

File diff suppressed because it is too large Load Diff

View File

@ -225,20 +225,17 @@ function filtreNumero(&$formR, &$criteres, &$sphinx)
function filtreDateNaiss(&$formR, &$criteres, &$sphinx)
{
$jj = preg_replace('/[^0-9]/', '', $formR['dirDateNaissJJ']);
if ($jj < 0 ||
$jj > 31) {
echo ('Jour de naissance incorrect !');
if ($jj < 0 || $jj > 31) {
//echo ('Jour de naissance incorrect !');
}
$mm = preg_replace('/[^0-9]/', '', $formR['dirDateNaissMM']);
if ($mm < 0 ||
$mm > 12) {
echo ('Mois de naissance incorrect !');
if ($mm < 0 || $mm > 12) {
//echo ('Mois de naissance incorrect !');
}
$aa = preg_replace('/[^0-9]/', '', $formR['dirDateNaissAAAA']);
$annee = date('Y') - 18;
if ($aa < 0 ||
$aa > $annee) {
echo ('Année de naissance incorrecte !');
if ($aa < 0 || $aa > $annee) {
//echo ('Année de naissance incorrecte !');
}
if (empty($jj) == false && strstr($criteres, 'J') != false) {

View File

@ -9,12 +9,6 @@ class Scores_Ws_Doc
private $serviceTypes = array();
/**
* Parse class and docblock to generate automatically the friendly documentation
* @param string $serviceClass
* @param string $classmap
* @param string $path
*/
public function __construct($serviceClass = null, $classmap = null, $path)
{
$this->serviceClass = $serviceClass;
@ -42,13 +36,11 @@ class Scores_Ws_Doc
return $this->serviceTypes;
}
/**
* Parse a service to get name, desc, params and return
*/
private function parseService()
{
$class = new Zend_Server_Reflection();
$methods = $class->reflectClass($this->serviceClass)->getMethods();
$methods = $class->reflectClass($this->serviceClass)
->getMethods();
$methodsElement = array();
foreach ($methods as $method) {
@ -89,9 +81,6 @@ class Scores_Ws_Doc
$this->serviceMethods = $methodsElement;
}
/**
* Parse type declaration in the docblock and specific declaration
*/
private function parseTypes()
{
$typesElement = array();

View File

@ -3,7 +3,7 @@ class Scores_Ws_Server
{
/**
* User information
* @var object
* @var array
*/
protected $User;
@ -19,6 +19,18 @@ class Scores_Ws_Server
*/
protected $authMethod = null;
/**
* Nom de l'application d'ou provient la demande d'authentification
* @var string
*/
protected $authApp = null;
/**
* IP du client
* @var string
*/
protected $authIp = null;
/**
* Name of Service
* @var string
@ -43,25 +55,26 @@ class Scores_Ws_Server
*/
public $serviceVersion = null;
/**
* Ip Client
* @var string
*/
protected $ipClient = null;
/**
* List all application IPs
* @var array
*/
protected $listApplicationIp = array (
'195.154.174.221', //Extranet - sd-46528
'91.121.157.194', //Extraet - ns359466
'91.121.157.194', //Extranet - ns359466
'78.31.45.206', //SDSL RAMBOUILLET
'127.0.0.1',
);
/**
* List all permission
* @var array
*
* category
*
* acces
* code | label | category
*
*/
protected $listeDroits = array (
@ -337,7 +350,7 @@ class Scores_Ws_Server
'9020' => 'Requête incorrecte',
);
public function __construct($ip = null)
public function __construct()
{
defined('DATETIME')
|| define ('DATETIME', date('YmdHis'));
@ -353,8 +366,6 @@ class Scores_Ws_Server
defined('TIME_LISIBLE')
|| define ('TIME_LISIBLE', substr(DATETIME,8,2).':'.substr(DATETIME,10,2).':'.substr(DATETIME,12,2));
$this->ipClient = $ip;
}
/**
@ -506,7 +517,19 @@ class Scores_Ws_Server
$this->authMethod = 'soapheader';
}
$this->authenticated = $this->checkAuth($username, $password, $this->ipClient);
/**
* @todo : with proxy get the original IP
* $request->getClientIp(true);
*/
$ip = $_SERVER['REMOTE_ADDR'];
if ($this->authIp !== null) {
$ip = $this->authIp;
}
/**
* Check authentication from the database
*/
$this->authenticated = $this->checkAuth($username, $password, $ip);
if ( $this->authenticated === false ) {
$this->sendError('0900');
} elseif ( $this->authenticated !== true ) {
@ -577,69 +600,109 @@ class Scores_Ws_Server
* @param string $ipConnexion
* @return mixed
*/
protected function checkAuth($login, $password, $ipConnexion)
protected function checkAuth($login, $password, $ip)
{
/**
* @todo :
* Information a retourner pour les applications
* id, idClient, login, email, civilite, nom, prenom, acceptationCGU
* droits, pref
*
* Pour la gestion des erreurs en retour
* actif
* dateDebutCompte, dateFinCompte
*
* AccesWS => Service ? ou utilisateur
*
*/
/**
* Load user information
*/
$userM = new Application_Model_Sdv1Utilisateurs();
$sql = $userM->select()
->setIntegrityCheck(false)
->from(array('u'=>'utilisateurs'), array(
'u.login', 'u.id', 'u.email', 'u.password', 'u.idClient', 'u.typeCompte', 'u.actif',
'u.filtre_ip', 'u.profil', 'u.civilite', 'u.nom', 'u.prenom', 'u.tel', 'u.fax',
'u.mobile', 'u.pref', 'u.rechRefType', 'u.profil', 'u.nombreConnexions',
'u.dateDerniereConnexion', 'u.droits', 'u.referenceParDefaut', 'u.nbReponses', 'u.lang',
'u.formatMail', 'u.dateDebutCompte', 'u.dateFinCompte', 'u.accesWS', 'u.acceptationCGU'))
->join(array('c'=>'clients'), 'u.idClient = c.id', array(
'c.droits AS droitsClients', 'c.test AS clientTest', 'c.typeScore', 'c.timeout',
))
->joinLeft(array('s'=>'sdv1.utilisateurs_service'), 'u.login=s.login', array('Service'))
->where('u.login=?', $login)
->where('u.actif=?', 1)
->where('u.deleted=?', 0)
->where('c.actif=?','Oui');
->setIntegrityCheck(false)
->from(array('u'=>'utilisateurs'), array(
'u.login', 'u.id', 'u.email', 'u.password', 'u.idClient', 'u.typeCompte', 'u.actif',
'u.filtre_ip', 'u.profil', 'u.civilite', 'u.nom', 'u.prenom', 'u.tel', 'u.fax',
'u.mobile', 'u.pref', 'u.rechRefType', 'u.profil', 'u.nombreConnexions',
'u.dateDerniereConnexion', 'u.droits', 'u.referenceParDefaut', 'u.nbReponses', 'u.lang',
'u.formatMail', 'u.dateDebutCompte', 'u.dateFinCompte', 'u.accesWS', 'u.acceptationCGU'))
->join(array('c'=>'clients'), 'u.idClient = c.id', array(
'c.droits AS droitsClients', 'c.test AS clientTest', 'c.typeScore', 'c.timeout',
))
->joinLeft(array('s'=>'sdv1.utilisateurs_service'), 'u.login=s.login', array('Service AS serviceCode'))
->joinLeft(array('v'=>'sdv1.clients_version'), 'u.idClient=v.clientId', array('version'))
->where('u.login=?', $login)
->where('u.actif=?', 1)
->where('u.deleted=?', 0)
->where('c.actif=?','Oui');
$result = $userM->fetchRow($sql);
$result = $userM->fetchRow($sql);
if ( null === $result ) {
return false;
}
// Aucun résultat, l'utilisateur n'existe pas ou est inactif
if ( null === $result ) {
return false;
}
if ($result->version == 2) {
return $this->authV2($result, $password, $ip);
} else {
return $this->authV1($result, $password, $ip);
}
/**
* IP Validation
* Get an array of IP and IP range
* 192.168.3.5-192.68.3.10;192.168.3.*;192.168.3.10
*/
if ( !empty($result->filtre_ip) ) {
$filtreIp = explode(';', $result->filtre_ip);
if ( count($filtreIp)>0 ) {
// Extranet
}
protected function authV1($userInfos, $password, $ip)
{
/**
* Acces WS, block access to other apps
*/
if ($userInfos->accesWS == 1 && $userInfos->idClient != 1)
{
// Webservice user don't need access to others apps
if ( in_array($ip, $this->listApplicationIp) && $userInfos->idClient != 1 ) {
return '0901';
} elseif ($ip != '127.0.0.1') {
// For customized version, check user is in the good service
$clients = include APPLICATION_PATH . '/../library/WsScore/Clients/ClientsConfig.php';
foreach( $clients as $section => $params ){
if ($params['actif']) {
$wsClients[$params['idClient']] = $section;
}
}
if ( array_key_exists($userInfos->idClient, $wsClients)
&& ( $this->serviceClient == false
|| strtolower($this->serviceClientName) != $wsClients[$userInfos->idClient] ) ){
return '0901';
}
}
}
/**
* Protect staging environment
* - No webservice access
* - Not in production
* - Not idClient 1 or 147
*/
if ( $userInfos->accesWS==0 && APPLICATION_ENV=='staging' && !in_array($userInfos->idClient, array(1,147)) )
{
return '0905';
}
/**
* IP Validation
* Get an array of IP and IP range
* 192.168.3.5-192.68.3.10;192.168.3.*;192.168.3.10
*/
if ( !empty($userInfos->filtre_ip) && !in_array($ip, $this->listApplicationIp) )
{
$filtreIp = explode(';', trim($userInfos->filtre_ip, ';'));
if ( count($filtreIp)>0 )
{
// Extranet
if ( substr($password,0,7)=='iponly:' ) {
$ipToValidate = substr($password,7);
}
// WebService
else {
$ipToValidate = $ipConnexion;
$ipToValidate = $ip;
}
//Validation
$overallIpValidate = false;
foreach ( $filtreIp as $filtre ) {
foreach ( $filtreIp as $filtre )
{
if ( strpos($filtre, '*') ) {
$filtre = str_replace('*', '0', $filtre) . '-' . str_replace('*', '255', $filtre);
}
// Is it a range ?
if ( strpos($filtre, '-') ) {
$validateIp = new Scores_Validate_IpInNetwork();
@ -661,126 +724,95 @@ class Scores_Ws_Server
if ( $overallIpValidate === false ) {
return '0904';
}
}
}
}
}
/**
* @todo :
* Check how password is check
* md5 => standard method md5 ( login | password )
* key => get associated key with crypt method
* cert => get associated certificat
*/
// Check password with database informations
if ( $userInfos->password == $password //password sent in clear
|| md5($userInfos->password) == $password //password sent with md5
|| md5($userInfos->login.'|'.$userInfos->password) == $password //password sent concat with login and crypt by md5
|| substr($password,0,7) == 'iponly:'
) {
/**
* @todo :
* Check how password is check
* md5 => standard method md5 ( login | password )
* key => get associated key with crypt method
* cert => get associated certificat
*/
// Check password with database informations
if ( $result->password == $password //password sent in clear
|| md5($result->password) == $password //password sent with md5
|| md5($result->login.'|'.$result->password) == $password //password sent concat with login and crypt by md5
) {
//Timeout
$timeout = $userInfos->timeout;
if ($timeout==0) $timeout = 1800;
//Timeout
$timeout = $result->timeout;
if ($timeout==0) $timeout = 1800;
//Infos utilisateur
$this->User = new stdClass();
$this->User->login = $result->login;
$this->User->id = $result->id;
$this->User->civilite = $result->civilite;
$this->User->nom = $result->nom;
$this->User->prenom = $result->prenom;
$this->User->tel = $result->tel;
$this->User->fax = $result->fax;
$this->User->mobile = $result->mobile;
$this->User->email = $result->email;
$this->User->typeCompte = $result->typeCompte;
$this->User->idClient = $result->idClient;
$this->User->Service = $result->Service;
$this->User->filtre_ip = $result->filtre_ip;
//Infos utilisateur
$this->User = new stdClass();
$this->User->login = $userInfos->login;
$this->User->id = $userInfos->id;
$this->User->civilite = $userInfos->civilite;
$this->User->nom = $userInfos->nom;
$this->User->prenom = $userInfos->prenom;
$this->User->tel = $userInfos->tel;
$this->User->fax = $userInfos->fax;
$this->User->mobile = $userInfos->mobile;
$this->User->email = $userInfos->email;
$this->User->typeCompte = $userInfos->typeCompte;
$this->User->idClient = $userInfos->idClient;
$this->User->ServiceCode = $userInfos->serviceCode;
$this->User->filtre_ip = $userInfos->filtre_ip;
$this->User->ipConnexion = $ipConnexion;
$this->User->pref = $result->pref;
$this->User->rechRefType = $result->rechRefType;
$this->User->profil = $result->profil;
$this->User->nombreConnexions = $result->nombreConnexions;
$this->User->dateDerniereConnexion = $result->dateDerniereConnexion;
$this->User->droits = $result->droits;
$this->User->droitsClients = $result->droitsClients;
$this->User->pref = $userInfos->pref;
$this->User->rechRefType = $userInfos->rechRefType;
$this->User->profil = $userInfos->profil;
$this->User->nombreConnexions = $userInfos->nombreConnexions;
$this->User->dateDerniereConnexion = $userInfos->dateDerniereConnexion;
$this->User->droits = $userInfos->droits;
$this->User->droitsClients = $userInfos->droitsClients;
$this->User->timeout = $timeout;
$this->User->clientTest = $result->clientTest;
$this->User->typeScore = $result->typeScore;
$this->User->nbReponses = $result->nbReponses;
$this->User->lang = $result->lang;
$this->User->formatMail = $result->formatMail;
$this->User->referenceParDefaut = $result->referenceParDefaut;
$this->User->dateDebutCompte = $result->dateDebutCompte;
$this->User->dateFinCompte = $result->dateFinCompte;
$this->User->acceptationCGU = $result->acceptationCGU;
$this->User->clientTest = $userInfos->clientTest;
$this->User->typeScore = $userInfos->typeScore;
$this->User->nbReponses = $userInfos->nbReponses;
$this->User->lang = $userInfos->lang;
$this->User->formatMail = $userInfos->formatMail;
$this->User->referenceParDefaut = $userInfos->referenceParDefaut;
$this->User->dateDebutCompte = $userInfos->dateDebutCompte;
$this->User->dateFinCompte = $userInfos->dateFinCompte;
$this->User->acceptationCGU = $userInfos->acceptationCGU;
/**
* Date de debut de compte
*/
if ( !empty($result->dateDebutCompte) && $result->dateDebutCompte!='0000-00-00' ) {
$today = mktime(0, 0, 0, date('m'), date('d'), date('Y'));
$dateDebutCompte = mktime(0, 0, 0, substr($result->dateDebutCompte,5,2), substr($result->dateDebutCompte,8,2), substr($result->dateDebutCompte,0,4));
if ( $today < $dateDebutCompte ) {
return '0903';
}
}
/**
* Date de debut de compte
*/
if ( !empty($userInfos->dateDebutCompte) && $userInfos->dateDebutCompte!='0000-00-00' ) {
$today = mktime(0, 0, 0, date('m'), date('d'), date('Y'));
$dateDebutCompte = mktime(0, 0, 0, substr($userInfos->dateDebutCompte,5,2), substr($userInfos->dateDebutCompte,8,2), substr($userInfos->dateDebutCompte,0,4));
if ( $today < $dateDebutCompte ) {
return '0903';
}
}
/**
* Date de fin de compte
*/
if ( !empty($result->dateFinCompte) && $result->dateFinCompte!='0000-00-00' ) {
$today = mktime(0, 0, 0, date('m'), date('d'), date('Y'));
$dateFinCompte = mktime(0, 0, 0, substr($result->dateFinCompte,5,2), substr($result->dateFinCompte,8,2), substr($result->dateFinCompte,0,4));
if ( $today > $dateFinCompte) {
return '0903';
}
}
/**
* Date de fin de compte
*/
if ( !empty($userInfos->dateFinCompte) && $userInfos->dateFinCompte!='0000-00-00' ) {
$today = mktime(0, 0, 0, date('m'), date('d'), date('Y'));
$dateFinCompte = mktime(0, 0, 0, substr($userInfos->dateFinCompte,5,2), substr($userInfos->dateFinCompte,8,2), substr($userInfos->dateFinCompte,0,4));
if ( $today > $dateFinCompte) {
return '0903';
}
}
/**
* Acces WS, block access to other apps
*/
if ($result->accesWS==1 && $result->idClient!=1) {
return true;
}
// Webservice user don't need access to others apps
if ( in_array($ipConnexion, $this->listApplicationIp) && $tabRep['idClient']!=1 ) {
return false;
}
return '0901';
protected function authV2($userInfos, $password, $ip)
{
} elseif ($ipConnexion!='127.0.0.1') {
// For customized version, check user is in the good service
$clients = include APPLICATION_PATH . '/../library/WsScore/Clients/ClientsConfig.php';
foreach( $clients as $section => $params ){
if ($params['actif']) {
$wsClients[$params['idClient']] = $section;
}
}
if ( array_key_exists($result->idClient, $wsClients)
&& ( $this->serviceClient == false
|| strtolower($this->serviceClientName)!=$wsClients[$result->idClient] ) ){
return '0901';
}
}
}
/**
* Protect staging environment
* - No webservice access
* - Not in production
* - Not idClient 1 or 147
*/
if ( $result->accesWS==0 && APPLICATION_ENV=='staging' && !in_array($result->idClient, array(1,147)) ) {
return '0905';
}
return true;
}
return false;
}
}
protected function trigger($event, $args)
{

View File

@ -1,12 +1,13 @@
<?php
// Generated by ZF's ./bin/classmap_generator.php
return array(
'Scores_Auth_Adapter_Db' => dirname(__FILE__) . '/Auth/Adapter/Db.php',
'Scores_Auth_Adapter_Ws' => dirname(__FILE__) . '/Auth/Adapter/Ws.php',
'Scores_Wkhtml_Pdf' => dirname(__FILE__) . '/Wkhtml/Pdf.php',
'Scores_Ws_Doc' => dirname(__FILE__) . '/Ws/Doc.php',
'Scores_Ws_Exception' => dirname(__FILE__) . '/Ws/Exception.php',
'Scores_Ws_Form_GetIdentite' => dirname(__FILE__) . '/Ws/Form/GetIdentite.php',
'Scores_Ws_Server' => dirname(__FILE__) . '/Ws/Server.php',
'Scores_Ws_Trigger' => dirname(__FILE__) . '/Ws/Trigger.php',
'Scores_Auth_Adapter_Db' => dirname(__FILE__) . '/Auth/Adapter/Db.php',
'Scores_Auth_Adapter_Ws' => dirname(__FILE__) . '/Auth/Adapter/Ws.php',
'Scores_Validate_IpInNetwork' => dirname(__FILE__) . '/Validate/IpInNetwork.php',
'Scores_Wkhtml_Pdf' => dirname(__FILE__) . '/Wkhtml/Pdf.php',
'Scores_Ws_Doc' => dirname(__FILE__) . '/Ws/Doc.php',
'Scores_Ws_Exception' => dirname(__FILE__) . '/Ws/Exception.php',
'Scores_Ws_Form_GetIdentite' => dirname(__FILE__) . '/Ws/Form/GetIdentite.php',
'Scores_Ws_Server' => dirname(__FILE__) . '/Ws/Server.php',
'Scores_Ws_Trigger' => dirname(__FILE__) . '/Ws/Trigger.php',
);

View File

@ -34,8 +34,6 @@ class Entreprise extends Scores_Ws_Server
*/
public function getIdentite($siret, $id, $dept, $waldec)
{
$forceVerif=false;
debugLog('W',"Recherche par identifiant Siren=$siret, Dept=$dep, Id=$id, Waldec=$waldec",__LINE__,__FILE__, __FUNCTION__, __CLASS__);
@ -106,17 +104,6 @@ class Entreprise extends Scores_Ws_Server
return $result;
}
$tabTmp=$this->searchSiren($siret); //@todo : méthode inconnu
if ($tabTmp['results']['nbReponses']==0 && $id==0) {
debugLog('W', "Siren $siren inexistant", __LINE__, __FILE__, __FUNCTION__, __CLASS__);
$error = new ErrorElement();
$error->errnum = 106;
$error->errmsg = 'Siren inconnu';
$result->error = $error;
$result->result = $tabRet;
return $result;
}
if ($dep==974) {
debugLog('I',"AFNIC Recherche par Siren/Dept (Waldec=$waldec, Siren=$siret, Dept=$dep, Id=$id)",__LINE__,__FILE__, __FUNCTION__, __CLASS__);
$rep=$iInsee->getEtablissements($siren, $nic, 0, 20, 20, $dep);
@ -210,73 +197,73 @@ class Entreprise extends Scores_Ws_Server
$tabCarInvalides=array('/'=>' ','*'=>' ', '&amp;'=>' ET ', '&'=>' ET ', '&AMP;'=>' ET ',
'"'=>' ', "'"=>' ');
$entrep = new EntrepElement();
$entrep->id = $entrep['id'];
$entrep->Siret = $entrep['Siret'];
$entrep->SiretSiege = $entrep['SiretSiege'];
$entrep->Siege = $entrep['Siege'];
$entrep->Actif = $actif;
$entrep->AutreId = $autreId;
$entrep->idSd = $entrep['Source'].'-'.$entrep['SourceId'];
$entrep->Nom = trim(prepareString(preg_replace('/ +/',' ', strtr($nom,$tabCarInvalides))));
$entrep->Nom2 = trim(prepareString(preg_replace('/ +/',' ', strtr($entrep['Nom2'],$tabCarInvalides))));
$entrep->NomCommercial = trim(prepareString(preg_replace('/ +/',' ', strtr($entrep['NomCommercial'],$tabCarInvalides))));
$entrep->Sigle = trim(prepareString(preg_replace('/ +/',' ', strtr($sigle,$tabCarInvalides))));
$entrep->Enseigne = trim(prepareString(preg_replace('/ +/',' ', strtr($enseigne,$tabCarInvalides))));
$entrep->Adresse = prepareString($entrep['Adresse']);
$entrep->Adresse2 = prepareString($entrep['Adresse2']);
$entrep->AdresseNum = prepareString($entrep['AdresseNum']);
$entrep->AdresseBtq = prepareString($entrep['AdresseBtq']);
$entrep->AdresseVoie = prepareString($entrep['AdresseVoie']);
$entrep->AdresseRue = prepareString($entrep['AdresseRue']);
$entrep->CP = $entrep['CP'];
$entrep->Ville = prepareString($entrep['Ville']);
$entrep->Pays = prepareString($entrep['Pays']); // Ajouté le 18 02 2008
$entrep->PaysIso2 = $codePaysIso2;
$entrep->Civilite = $entrep['Civilite'];
$entrep->NbEtab = $entrep['NbEtab'];
$entrep->Tel = prepareString($entrep['Tel']);
$entrep->Fax = prepareString($entrep['Fax']);
$entrep->Web = prepareString($entrep['Web']);
$entrep->Mail = prepareString($entrep['Mail']);
$entrep->FJ = $entrep['FJ'];
$entrep->FJ_lib = trim(prepareString(preg_replace('/ +/',' ', strtr($entrep['FJ_lib'],$tabCarInvalides))));
$entrep->Siren = $entrep['Siren'];
$entrep->Nic = $entrep['Nic'];
$entrep->NafEnt = $entrep['NafEnt'];
$entrep->NafEntLib = trim(prepareString(preg_replace('/ +/',' ', strtr($entrep['NafEntLib'],$tabCarInvalides))));
$entrep->Capital = $entrep['Capital'];
$entrep->CapitalDev = $entrep['CapitalDev'];
$entrep->CapitalLib = prepareString($entrep['CapitalLib']); // Ajouté le 18 02 2008
$entrep->DateCreaEt = $entrep['DateCreaEt'];
$entrep->DateCreaEn = $entrep['DateCreaEn'];
$entrep->DateClotEn = $entrep['DateClotEn'];
$entrep->EffEnTr = prepareString($entrep['EffEnTr']);
$entrep->EffEnTrLib = prepareString($entrep['EffEnTrLib']);
$entrep->Effectif = prepareString($entrep['Effectif']);
$entrep->Dept = $entrep['Dept'];
$entrep->codeCommune = prepareString($entrep['codeCommune']);
$entrep->TrancheCA = prepareString($entrep['TrancheCA']);
$entrep->TrancheCALib = prepareString($entrep['TrancheCALib']);
$entrep->dir1Titre = prepareString($entrep['dir1Titre']);//utf8
$entrep->dir1NomPrenom = prepareString($entrep['dir1NomPrenom']);
$entrep->dir1DateFct = prepareString($entrep['dir1DateFct']);
$entrep->SituationJuridique = strtoupper(substr($entrep['SituationJuridique'],0,1));
$item = new EntrepElement();
$item->id = $entrep['id'];
$item->Siret = $entrep['Siret'];
$item->SiretSiege = $entrep['SiretSiege'];
$item->Siege = $entrep['Siege'];
$item->Actif = $actif;
$item->AutreId = $autreId;
$item->idSd = $entrep['Source'].'-'.$entrep['SourceId'];
$item->Nom = trim(prepareString(preg_replace('/ +/',' ', strtr($nom,$tabCarInvalides))));
$item->Nom2 = trim(prepareString(preg_replace('/ +/',' ', strtr($entrep['Nom2'],$tabCarInvalides))));
$item->NomCommercial = trim(prepareString(preg_replace('/ +/',' ', strtr($entrep['NomCommercial'],$tabCarInvalides))));
$item->Sigle = trim(prepareString(preg_replace('/ +/',' ', strtr($sigle,$tabCarInvalides))));
$item->Enseigne = trim(prepareString(preg_replace('/ +/',' ', strtr($enseigne,$tabCarInvalides))));
$item->Adresse = prepareString($entrep['Adresse']);
$item->Adresse2 = prepareString($entrep['Adresse2']);
$item->AdresseNum = prepareString($entrep['AdresseNum']);
$item->AdresseBtq = prepareString($entrep['AdresseBtq']);
$item->AdresseVoie = prepareString($entrep['AdresseVoie']);
$item->AdresseRue = prepareString($entrep['AdresseRue']);
$item->CP = $entrep['CP'];
$item->Ville = prepareString($entrep['Ville']);
$item->Pays = prepareString($entrep['Pays']); // Ajouté le 18 02 2008
$item->PaysIso2 = $codePaysIso2;
$item->Civilite = $entrep['Civilite'];
$item->NbEtab = $entrep['NbEtab'];
$item->Tel = prepareString($entrep['Tel']);
$item->Fax = prepareString($entrep['Fax']);
$item->Web = prepareString($entrep['Web']);
$item->Mail = prepareString($entrep['Mail']);
$item->FJ = $entrep['FJ'];
$item->FJ_lib = trim(prepareString(preg_replace('/ +/',' ', strtr($entrep['FJ_lib'],$tabCarInvalides))));
$item->Siren = $entrep['Siren'];
$item->Nic = $entrep['Nic'];
$item->NafEnt = $entrep['NafEnt'];
$item->NafEntLib = trim(prepareString(preg_replace('/ +/',' ', strtr($entrep['NafEntLib'],$tabCarInvalides))));
$item->Capital = $entrep['Capital'];
$item->CapitalDev = $entrep['CapitalDev'];
$item->CapitalLib = prepareString($entrep['CapitalLib']); // Ajouté le 18 02 2008
$item->DateCreaEt = $entrep['DateCreaEt'];
$item->DateCreaEn = $entrep['DateCreaEn'];
$item->DateClotEn = $entrep['DateClotEn'];
$item->EffEnTr = prepareString($entrep['EffEnTr']);
$item->EffEnTrLib = prepareString($entrep['EffEnTrLib']);
$item->Effectif = prepareString($entrep['Effectif']);
$item->Dept = $entrep['Dept'];
$item->codeCommune = prepareString($entrep['codeCommune']);
$item->TrancheCA = prepareString($entrep['TrancheCA']);
$item->TrancheCALib = prepareString($entrep['TrancheCALib']);
$item->dir1Titre = prepareString($entrep['dir1Titre']);//utf8
$item->dir1NomPrenom = prepareString($entrep['dir1NomPrenom']);
$item->dir1DateFct = prepareString($entrep['dir1DateFct']);
$item->SituationJuridique = strtoupper(substr($entrep['SituationJuridique'],0,1));
if (preg_match('/NAF4/i', $this->User->pref)) {
$entrep2 = $iInsee->getNaf4($siren, $nic, $id);
$entrep->Naf4Ent = $entrep2['apen4'];
$entrep->Naf4Etab = $entrep2['apet4'];
$entrep->Naf4EntLib = prepareString($entrep2['apen4_lib']);
$entrep->Naf4EtabLib = prepareString($entrep2['apet4_lib']);
$item->Naf4Ent = $entrep2['apen4'];
$item->Naf4Etab = $entrep2['apet4'];
$item->Naf4EntLib = prepareString($entrep2['apen4_lib']);
$item->Naf4EtabLib = prepareString($entrep2['apet4_lib']);
}
debugLog('I', 'Etablissement retourné = '. $entrep['Nom'], __LINE__, __FILE__, __FUNCTION__, __CLASS__);
wsLog('identite',$siret,$id);
$this->wsLog('identite',$siret,$id);
$error = new ErrorElement();
$error->errmsg = '';
$error->errnum = 0;
$result->result = $entrep;
$result->result = $item;
return $result;
}

View File

@ -30,4 +30,11 @@ return array(
),
'idClient' => array(1,157),
),
'mixdata' => array(
'actif' => true,
'versions' => array(
'0.1' => array( 'actif' => true, 'defaut' => true ),
),
'idClient' => array(1,190),
),
);

View File

@ -0,0 +1,6 @@
<?php
return array (
'Data' => 'Data',
'Dirigeant' => 'Dirigeant',
'Etablissement' => 'Etablissement',
);

View File

@ -0,0 +1,304 @@
<?php
require_once __DIR__ . '/Types.php';
require_once 'framework/fwk.php';
require_once 'Metier/partenaires/classMTel.php';
require_once 'Metier/insee/classMInsee.php';
class Entreprise extends Scores_Ws_Server
{
public function __construct()
{
parent::__construct();
$this->serviceClient = true;
$this->serviceClientName = 'Mixdata';
$this->serviceName = 'Entreprise';
}
/**
* Méthode spécifique
* @param string $siren
* @return Data
*/
public function getData($siren)
{
$this->authenticate();
$len = strlen($siren);
if ($len != 9)
{
$this->sendError('1010');
}
if (intval($siren)<100)
{
$this->sendError('1020');
}
//Get default DB
$db = Zend_Db_Table_Abstract::getDefaultAdapter();
$db->setFetchMode(Zend_Db::FETCH_OBJ);
//Identite
$modelIdentite = new Data();
$identiteEtabRncsSql = $db->select()
->from('rncs_etab', array(
'LPAD(siren,9,0) AS siren',
'LPAD(nic,5,0) AS nic',
'siege',
'enseigne',
'nomCommercial',
'naf',
), 'jo')
->where('siren=?', $siren)
->where('actif=1')
->where('siege=1');
$identiteEtabRncsResult = $db->fetchRow($identiteEtabRncsSql);
if ($identiteEtabRncsResult === null)
{
$this->sendError('1020');
}
$nic = $identiteEtabRncsResult->nic;
$identiteEntrepRncsSql = $db->select()
->from('rncs_entrep', array(
'raisonSociale',
'sigle',
'naf',
'cj',
'dateImma',
'capitalMontant',
'capitalDevIso',
), 'jo')
->where('siren=?', $siren);
$identiteEntrepRncsResult = $db->fetchRow($identiteEntrepRncsSql);
$modelIdentite->Siret = $identiteEtabRncsResult->siren.$identiteEtabRncsResult->nic;
$modelIdentite->Ape = $identiteEntrepRncsResult->naf;
$modelIdentite->Siege = $identiteEtabRncsResult->siege;
$modelIdentite->RaisonSociale = $identiteEntrepRncsResult->raisonSociale;
$modelIdentite->NomCommercial = $identiteEtabRncsResult->nomCommercial;
$modelIdentite->Enseigne = $identiteEtabRncsResult->enseigne;
$modelIdentite->Sigle = $identiteEntrepRncsResult->sigle;
$modelIdentite->FormeJuridique = substr($identiteEntrepRncsResult->cj,1,2);
$modelIdentite->ImmatDate = $identiteEntrepRncsResult->dateImma;
$modelIdentite->Capital = $identiteEntrepRncsResult->capitalMontant;
$modelIdentite->CapitalDev = $identiteEntrepRncsResult->capitalDevIso;
$mTel = new MTel();
$telephones = $mTel->getTel($siren, $nic, true, 1);
if ($telephones > 0)
{
$modelIdentite->Telephone = $telephones[0]['telephone'];
}
try {
$identiteEntrepInseeSql = $db->select()->from('identite', array('EFF_ENT'), 'insee')
->where('SIREN=?', $siren)
->where('NIC=?', $nic);
$identiteEntrepInseeResult = $db->fetchRow($identiteEntrepInseeSql);
if ($identiteEntrepInseeResult !== null) {
$modelIdentite->Eff = $identiteEntrepInseeResult->EFF_ENT;
}
} catch (Zend_Db_Exception $e) {
if ($this->User->idClient==1) {
throw new SoapFault('ERR', __LINE__ . ' : ' . $e->getMessage());
} else {
throw new SoapFault('ERR', "Application error");
}
}
$inseeM = new MInsee();
$tabProcol = $inseeM->getAnnoncesLegales($siren, 0, 'P', false);
if ( count($tabProcol)>0 ) {
$modelIdentite->JugementDate = $tabProcol[0]['dateJugement'];
$modelIdentite->JugementTypeEven = $tabProcol[0]['evenements'][0]['CodeEven'];
}
try {
$bilanSql = $db->select()->from('bilans_postes', array(
'dateExercice',
'YP',
'FL',
'FK',
'HN',
), 'jo')
->where('consolide=0')
->where('siren=?', $siren)
->order('dateExercice DESC')
->limit(1);
$bilanResult = $db->fetchRow($bilanSql);
if ($bilanResult !== null)
{
$modelIdentite->BilanYP = $bilanResult->YP;
$modelIdentite->BilanType = 'R';
$modelIdentite->BilanClotureDate = substr($bilanResult->dateExercice,0,4).'-'.substr($bilanResult->dateExercice,4,2).'-'.substr($bilanResult->dateExercice,6,2);
$modelIdentite->BilanFL = round($bilanResult->FL/1000);
$modelIdentite->BilanFK = round($bilanResult->FK/1000);
$modelIdentite->BilanHN = round($bilanResult->HN/1000);
}
} catch (Zend_Db_Exception $e) {
if ($this->User->idClient==1) {
throw new SoapFault('ERR', __LINE__ . ' : ' . $e->getMessage());
} else {
throw new SoapFault('ERR', "Application error");
}
}
try {
$bodaccSql = $db->select()->from('bodacc_activite', array('activite'), 'jo')
->where('siren=?', $siren)
->limit(1);
$bodaccResult = $db->fetchRow($bilanSql);
if ($bilanResult !== null)
{
$modelIdentite->ActiviteReel = $bodaccResult->activite;
}
} catch (Zend_Db_Exception $e) {
if ($this->User->idClient==1) {
throw new SoapFault('ERR', __LINE__ . ' : ' . $e->getMessage());
} else {
throw new SoapFault('ERR', "Application error");
}
}
//Etablissemements actifs
$modelEtablissements = array();
try {
$etabSql = $db->select()
->from('etablissements', array(
'LPAD(siren,9,0) AS siren',
'LPAD(nic,5,0) AS nic',
'siege',
'adr_num',
'adr_typeVoie',
'adr_libVoie',
'adr_comp',
'adr_cp',
'adr_ville'
), 'jo')
->where('actif=1')
->where('siren=?', $siren)
->order('siege DESC');
$etabResult = $db->fetchAll($etabSql);
} catch (Zend_Db_Exception $e) {
if ($this->User->idClient==1) {
throw new SoapFault('ERR', __LINE__ . ' : ' . $e->getMessage());
} else {
throw new SoapFault('ERR', "Application error");
}
}
if (count($etabResult) > 0)
{
foreach ($etabResult as $item)
{
if ($item->siege == 1)
{
$modelIdentite->AdrNum = $item->adr_num;
$modelIdentite->AdrTypeVoie = $item->adr_typeVoie;
$modelIdentite->AdrLibVoie = $item->adr_libVoie;
$modelIdentite->AdrComp = $item->adr_comp;
$modelIdentite->AdrCp = $item->adr_cp;
$modelIdentite->AdrVille = $item->adr_ville;
}
$etablissement = new Etablissement();
$etablissement->Siret = $item->siren.$item->nic;
$etablissement->Siege = $item->siege;
$itemEtabRncsResult = null;
try {
$itemEtabRncsSql = $db->select()
->from('rncs_etab', array(
'LPAD(siren,9,0) AS siren',
'LPAD(nic,5,0) AS nic',
'siege',
'enseigne',
'nomCommercial',
'naf',
), 'jo')
->where('siren=?', $item->siren)
->where('nic=?', $item->nic);
$itemEtabRncsResult = $db->fetchRow($itemEtabRncsSql);
} catch (Zend_Db_Exception $e) {
if ($this->User->idClient==1) {
throw new SoapFault('ERR', __LINE__ . ' : ' . $e->getMessage());
} else {
throw new SoapFault('ERR', "Application error");
}
}
if ($itemEtabRncsResult)
{
$etablissement->Siret = $itemEtabRncsResult->siren.$itemEtabRncsResult->nic;
$etablissement->Ape = $itemEtabRncsResult->naf;
$etablissement->Siege = $itemEtabRncsResult->siege;
$etablissement->NomCommercial = $itemEtabRncsResult->nomCommercial;
$etablissement->Enseigne = $itemEtabRncsResult->enseigne;
}
$etablissement->AdrNum = $item->adr_num;
$etablissement->AdrTypeVoie = $item->adr_typeVoie;
$etablissement->AdrLibVoie = $item->adr_libVoie;
$etablissement->AdrComp = $item->adr_comp;
$etablissement->AdrCp = $item->adr_cp;
$etablissement->AdrVille = $item->adr_ville;
$mTel = new MTel();
$telephones = $mTel->getTel($item->siren, $item->nic, true, 1);
if ($telephones > 0)
{
$etablissement->Telephone = $telephones[0]['telephone'];
}
$modelEtablissements[] = $etablissement;
}
}
//Dirigeants actifs
try {
$dirigeantSql = $db->select()->from('rncs_dirigeants',
array(
'dirRS',
'nom',
'prenom',
'naissance_nom',
'fonction_code',
'fonction_lib'
), 'jo')
->where('siren=?', $siren)->where('actif%10=1');
$dirigeantResult = $db->fetchAll($dirigeantSql);
} catch (Zend_Db_Exception $e) {
if ($this->User->idClient==1) {
throw new SoapFault('ERR', __LINE__ . ' : ' . $e->getMessage());
} else {
throw new SoapFault('ERR', "Application error");
}
}
$modelDirigeants = array();
if (count($dirigeantResult) > 0)
{
foreach ($dirigeantResult as $item)
{
$dirigeant = new Dirigeant();
$dirigeant->RaisonSociale = $item->dirRS;
$dirigeant->Nom = $item->nom;
$dirigeant->Prenom = $item->prenom;
$dirigeant->NomNaissance = $item->naissance_nom;
$dirigeant->FonctionCode = $item->fonction_code;
$dirigeant->FonctionLib = $item->fonction_lib;
$modelDirigeants[] = $dirigeant;
}
}
//Return
$modelIdentite->Etablissements = $modelEtablissements;
$modelIdentite->Dirigeants = $modelDirigeants;
$this->wsLog('identite', $siren);
return $modelIdentite;
}
}

View File

@ -0,0 +1,153 @@
<?php
class Data
{
/** @var string */
public $Siret;
/** @var string */
public $Ape;
/** @var string */
public $Siege;
/** @var string */
public $RaisonSociale;
/** @var string */
public $NomCommercial;
/** @var string */
public $Enseigne;
/** @var string */
public $Sigle;
/** @var string */
public $AdrNum;
/** @var string */
public $AdrTypeVoie;
/** @var string */
public $AdrLibVoie;
/** @var string */
public $AdrComp;
/** @var string */
public $AdrCp;
/** @var string */
public $AdrVille;
/** @var string */
public $Telephone;
/** @var string */
public $FormeJuridique;
/** @var string */
public $ImmatDate;
/** @var string */
public $Capital;
/** @var string */
public $CapitalDev;
/** @var string */
public $Eff;
/** @var string */
public $JugementTypeEven;
/** @var string */
public $JugementDate;
/** @var string */
public $BilanYP;
/** @var string */
public $BilanType;
/** @var string */
public $BilanClotureDate;
/** @var string */
public $BilanFL;
/** @var string */
public $BilanFK;
/** @var string */
public $BilanHN;
/** @var string */
public $ActiviteReel;
/** @var Dirigeant[] */
public $Dirigeants;
/** @var Etablissement[] */
public $Etablissements;
}
class Dirigeant
{
/** @var string */
public $RaisonSociale;
/** @var string */
public $Nom;
/** @var string */
public $Prenom;
/** @var string */
public $NomNaissance;
/** @var string */
public $FonctionCode;
/** @var string */
public $FonctionLib;
}
class Etablissement
{
/** @var string */
public $Siret;
/** @var string */
public $Ape;
/** @var string */
public $Siege;
/** @var string */
public $NomCommercial;
/** @var string */
public $Enseigne;
/** @var string */
public $AdrNum;
/** @var string */
public $AdrTypeVoie;
/** @var string */
public $AdrLibVoie;
/** @var string */
public $AdrComp;
/** @var string */
public $AdrCp;
/** @var string */
public $AdrVille;
/** @var string */
public $Telephone;
}

View File

@ -1 +0,0 @@
<?php

View File

@ -1,42 +0,0 @@
<?php
/*
searchNameAdress ( $name, $num, $street, $postalCode, $locality, $region )
Recherche Nom Adresse Ville Pays*
searchById ($value, $type)
Recherche Identifiant TVA, ISIN, SIREN, tout ce qui est disponible
- Base S&D
getIdDetail($id, $type = null)
Retourne micro fiche identité
+ les différents services ou contenu que l'on peut proposer
IDENTIFIANT = SOURCE + SOURCE_ID
source-source_id
+ products available
getProducts
code produits
libellé
tarif produits => suivant paramétrage utilisateur
Créer une table de produit par pays
id produit1 produit2 produit3
*/

View File

@ -1 +0,0 @@
<?php

View File

@ -3548,7 +3548,7 @@ class Entreprise extends Scores_Ws_Server
global $tva, $tabFormules, $mBil, $tabBilan, $efftr, $tabInfla;
$tabFormules = include APPLICATION_PATH . '/../library/Metier/scores/Variables/CacheTabFormules.php';
require_once 'Metier/scores/Variables/configMRatios.php';
require_once 'Metier/scores/classMRatios.php';
//Initialisation
if (empty($page)) $page = 'ratios';

View File

@ -813,6 +813,7 @@ class Entreprise extends Scores_Ws_Server
$this->authenticate();
$this->permission('liens');
//Load country table
try {
$countryM = new Application_Model_JoTabPays();
$sql = $countryM->select()->from($countryM, array('codPays3', 'libPays'));
@ -2688,17 +2689,35 @@ class Entreprise extends Scores_Ws_Server
$output->Indiscore = $Indiscore;
//Ratios
global $tva, $mBil, $tabBilan, $efftr, $tabInfla;
//Tableau d'infos sur les formules
$tabFormules = include APPLICATION_PATH . '/../library/Metier/scores/Variables/CacheTabFormules.php';
require_once 'Metier/scores/Variables/configMRatios.php';
$tabBorneMin = $tabBorneMax = array();
foreach ($tabFormules as $formule) {
$id = $formule['id']*1;
$libelle = $formule['libelle'];
$unite = $formule['unite'];
$commentaires = $formule['commentaires'];
$tabFormulesInfos[$id] = $formule; //Pour la gestion des unités des ratios secteur
$ratiosInfos = new RatiosInfos();
$ratiosInfos->id = 'r'.$id;
$ratiosInfos->libelle = $formule['libelle'];
$ratiosInfos->unite = $formule['unite'];
$ratiosInfos->commentaires = $formule['commentaires'];
$tabRatiosInfos[] = $ratiosInfos;
$tabBorneMin[$id] = $formule['borneMin'];
$tabBorneMax[$id] = $formule['borneMax'];
}
//Ratios
global $tva, $mBil, $efftr, $tabInfla;
require_once 'Metier/scores/classMRatios.php';
$mBil = new MBilans($siren);
$tabBilans = $mBil->listeBilans($accesPartenaire);
$nbBilans = count($tabBilans);
$tabBilan = $tabBil = array();
if ($nbBilans>0) {
if ($nbBilans>0)
{
$iInsee = new MInsee();
$tabIdentite = $iInsee->getIdentiteEntreprise($siren,0,0,false,false);
debugLog('I',"Liste des Ratios demandée pour $siren après getIdentiteEntreprise",__LINE__,__FILE__, __FUNCTION__, __CLASS__);
@ -2706,31 +2725,16 @@ class Entreprise extends Scores_Ws_Server
$nafLib = $tabIdentite['NafEntLib'];
$efftr = $tabIdentite['Effectif']*1;
$fj = $tabIdentite['FJ'];
foreach ($tabBilans as $millesime => $item)
{
$tabBilan[] = $mBil->getBilan(substr($millesime,-10), substr($millesime,0,1), '');
}
$tabRatios = calculRatios($tabBilans, $tabIdentite, $accesPartenaire);
}
$nbRatios = count($tabRatios);
debugLog('I',"Liste des Ratios demandée pour $siren après calculRatios ($nbRatios)",__LINE__,__FILE__, __FUNCTION__, __CLASS__);
//Tableau d'infos sur les formules
$tabBorneMin = $tabBorneMax = array();
foreach ($tabFormules as $formule) {
$id = $formule['id']*1;
$libelle = $formule['libelle'];
$unite = $formule['unite'];
$commentaires = $formule['commentaires'];
$tabFormulesInfos[$id] = $formule; //Pour la gestion des unités des ratios secteur
$ratiosInfos = new RatiosInfos();
$ratiosInfos->id = 'r'.$id;
$ratiosInfos->libelle = $formule['libelle'];
$ratiosInfos->unite = $formule['unite'];
$ratiosInfos->commentaires = $formule['commentaires'];
$tabRatiosInfos[] = $ratiosInfos;
$tabBorneMin[$id] = $formule['borneMin'];
$tabBorneMax[$id] = $formule['borneMax'];
}
$tabAnnees = array();
if ( $nbRatios > 0 ) {
foreach ( $tabRatios as $i=>$R ) {
@ -4537,41 +4541,46 @@ class Entreprise extends Scores_Ws_Server
$tabRatiosInfos = $tabRatiosSecteurs = $tabBilansR = array();
$tabRatios = $tabRatiosEvol = array();
$tabRet = array();
global $tva, $mBil, $tabBilan, $efftr, $tabInfla;
/**
* Tableau d'infos sur les formules
*/
$tabFormules = include APPLICATION_PATH . '/../library/Metier/scores/Variables/CacheTabFormules.php';
$tabBorneMin = $tabBorneMax = array();
foreach ($tabFormules as $formule) {
$id = $formule['id']*1;
$libelle = $formule['libelle'];
$unite = $formule['unite'];
$commentaires = $formule['commentaires'];
$tabFormulesInfos[$id] = $formule; //Pour la gestion des unités des ratios secteur
$ratiosInfos = new RatiosInfos();
$ratiosInfos->id = 'r'.$id;
$ratiosInfos->libelle = $formule['libelle'];
$ratiosInfos->unite = $formule['unite'];
$ratiosInfos->commentaires = $formule['commentaires'];
$tabRatiosInfos[] = $ratiosInfos;
$tabBorneMin[$id] = $formule['borneMin'];
$tabBorneMax[$id] = $formule['borneMax'];
}
require_once 'Metier/scores/Variables/configMRatios.php';
//Ratios
global $tva, $mBil, $efftr, $tabInfla;
require_once 'Metier/scores/classMRatios.php';
$mBil = new MBilans($siren);
$tabBilans = $mBil->listeBilans($accesPartenaire);
$nbBilans = count($tabBilans);
$tabBilan = $tabBil = array();
if ($nbBilans>0) {
if ($nbBilans > 0)
{
foreach ($tabBilans as $millesime => $item)
{
$tabBilan[] = $mBil->getBilan(substr($millesime,-10), substr($millesime,0,1), '');
}
$tabRatios = calculRatios($tabBilans, $tabIdentite, $accesPartenaire);
}
$nbRatios = count($tabRatios);
debugLog('I',"Liste des Ratios demandée pour $siren après calculRatios ($nbRatios)",__LINE__,__FILE__, __FUNCTION__, __CLASS__);
//Tableau d'infos sur les formules
$tabBorneMin = $tabBorneMax = array();
foreach ($tabFormules as $formule) {
$id = $formule['id']*1;
$libelle = $formule['libelle'];
$unite = $formule['unite'];
$commentaires = $formule['commentaires'];
$tabFormulesInfos[$id] = $formule; //Pour la gestion des unités des ratios secteur
$ratiosInfos = new RatiosInfos();
$ratiosInfos->id = 'r'.$id;
$ratiosInfos->libelle = $formule['libelle'];
$ratiosInfos->unite = $formule['unite'];
$ratiosInfos->commentaires = $formule['commentaires'];
$tabRatiosInfos[] = $ratiosInfos;
$tabBorneMin[$id] = $formule['borneMin'];
$tabBorneMax[$id] = $formule['borneMax'];
}
$tabAnnees = array();
if ( $nbRatios > 0 ) {
foreach ( $tabRatios as $i=>$R ) {

View File

@ -24,10 +24,15 @@ class Gestion extends Scores_Ws_Server
*/
public function getInfosLogin($login, $ipUtilisateur = '')
{
//Get User Ip
if (empty($ipUtilisateur)) {
$ipUtilisateur = $_SERVER['REMOTE_ADDR'];
}
$this->authIp = $ipUtilisateur;
//Authenticate
$this->authenticate();
//Initialisation
if (empty($ipUtilisateur)) $ipUtilisateur = $_SERVER['REMOTE_ADDR'];
$error = new ErrorType();
$result = new InfosLogin();
@ -41,10 +46,9 @@ class Gestion extends Scores_Ws_Server
debugLog('I',"getInfosLogin pour $login (IP=$ipUtilisateur)",__LINE__,__FILE__, __FUNCTION__, __CLASS__);
//L'utilisateur qui demande les informations est différent
if ( $this->User->login<>$login
&& in_array($this->User->profil, array('Administrateur', 'SuperAdministrateur') )
) {
/** Un administrateur veut il des infos sur un login ? **/
if ($this->User->login!=$login && in_array($this->User->profil, array('Administrateur', 'SuperAdministrateur')))
{
/** Un administrateur veut il des infos sur un login ? **/
$iDbCrm = new WDB('sdv1');
$rep = $iDbCrm->select(
'utilisateurs u, clients c',

View File

@ -1,4 +1,10 @@
<?php
return array(
'Client' => 'Client',
'ClientServices' => 'ClientServices',
'ClientServicesList' => 'ClientServicesList',
'ServiceList' => 'ServiceList',
'Service' => 'Service',
'Acces' => 'Acces',
'User' => 'User',
);

View File

@ -24,11 +24,11 @@ class Gestion extends Scores_Ws_Server
->where('Code=?', $this->User->Service);
$serviceParams = $serviceM->fetchRow($sql);
switch($app) {
switch ($app) {
case 'extranet':
break;
case 'webservice':
case 'odea':
break;
}
@ -91,7 +91,8 @@ class Gestion extends Scores_Ws_Server
/**
* Information client
* @param string $id
* @param int $id
* ID du client
* @throws SoapFault
* @return Client
*/
@ -127,6 +128,67 @@ class Gestion extends Scores_Ws_Server
return $client;
}
/**
* Information client avec la liste des services
* @param int $id
* ID du client
* @throws SoapFault
* @return ClientServices
*/
public function getClientServices($id = null)
{
$this->authenticate();
if ( $id === null || $this->User->idClient != 1 ) {
$id = $this->User->idClient;
}
$clientM = new Application_Model_Sdv1Clients();
$sql = $clientM->select(true)->columns(array(
'nom AS Nom',
'LPAD(siren,9,0) AS Siren',
'LPAD(nic,5,0) AS Nic',
'IF(actif="Oui",1,0) AS Actif',
'IF(test="Oui",1,0) AS Test'
))->where('id=?', $id);
$result = $clientM->fetchRow($sql);
if ( $result === null ) {
throw new SoapFault('ERR', 'Information client introuvable.');
}
$client = new Client();
$client->Nom = $result->Nom;
$client->Siren = $result->Siren;
$client->Nic = $result->Nic;
$client->Actif = $result->Actif;
$client->Test = $result->Test;
//Get Services
$serviceM = new Application_Model_Sdv1ClientsServices();
$sql = $serviceM->select(true)
->columns(array('id', 'Code', 'Label', 'Editable', 'Active'))
->where('Deleted=?', 0)
->where('idClient=?', $id);
$result = $serviceM->fetchAll($sql);
$services = array();
if (count($result) > 0) {
foreach ($result as $item) {
$clientService = new ClientServicesList();
$clientService->id = $result->id;
$clientService->Code = $result->Code;
$clientService->Label = $result->Label;
$clientService->Editable = $result->Editable;
$clientService->Active = $result->Active;
$services[] = $clientService;
}
}
$client->Services = $services;
return $client;
}
protected function getContrats()
{
//Liste des contrats, par service résumé
@ -478,6 +540,7 @@ class Gestion extends Scores_Ws_Server
/**
* Information Utilisateur
* @param string $id
* ID de l'utilisateur
* @throws SoapFault
* @return User
*/
@ -598,7 +661,7 @@ class Gestion extends Scores_Ws_Server
return $emails;
}
protected function getUserLogByFile($id);
protected function getUserLogByFile($id){}
public function setUser($data, $id = null)
{

View File

@ -15,12 +15,45 @@ class Client
/** @var int */
public $Test;
}
class ClientServices
{
/** @var string */
public $Nom;
/** @var string */
public $Contact;
public $Siren;
/** @var string */
public $ContactSD;
public $Nic;
/** @var int */
public $Actif;
/** @var int */
public $Test;
/** @var ClientServicesList[] */
public $Services;
}
class ClientServicesList
{
/** @var int */
public $id;
/** @var string */
public $Code;
/** @var string */
public $Label;
/** @var string */
public $Editable;
/** @var string */
public $Active;
}
class ServiceList

View File

@ -119,7 +119,13 @@ class Interne extends Scores_Ws_Server
$priv->insCumul = $value['insCumul'];
$tabRet[] = $priv;
}
$this->wsLog('privcumul', $siren, print_r($tabTypes,1));
//Log
foreach ($tabTypes as $type)
{
$this->wsLog('privcumul', $siren, $type);
}
$output = new PrivilegesCumulReturn();
$output->result = $tabRet;
return $output;

View File

@ -889,7 +889,7 @@ class Pieces extends Scores_Ws_Server
}
/**
* Order
* Financial account : Place an order to have number enter in database
* @param string $siren
* @param string $date
* @param string $type N:Normal, S:Simplifié, C:Consolidé
@ -910,7 +910,7 @@ class Pieces extends Scores_Ws_Server
$data = array(
'refCommande' => $refCommande,
'siren' => $siren,
'login' => $this->User->login,
'userId' => $this->User->id,
'bilanConfidentiel' => $private,
'bilanSource' => $source,
'bilanCloture' => $date,
@ -930,5 +930,33 @@ class Pieces extends Scores_Ws_Server
}
}
/**
* Financial account : Tag file is sent
* @param string $ref
* @throws SoapFault
* @return boolean
*/
public function setBilanEnterFile($ref)
{
$this->authenticate();
$this->permission('UPLOADBILAN');
$data = array(
'bilanFileSent' => date('YmdHis'),
);
try {
$commandeM = new Application_Model_Sdv1BilanCommandeEnter();
$commandeM->update($data, "refCommande=$ref");
return true;
} catch (Zend_Db_Exception $e) {
if ($this->User->idClient==1) {
throw new SoapFault('ERR', $e->getMessage());
} else {
throw new SoapFault('ERR', "Application error");
}
}
return false;
}
}

View File

@ -115,17 +115,22 @@ class Saisie extends Scores_Ws_Server
'waldec' => trim(str_replace(' ','',strtr($tabIdentite['waldec'], '"\'./- ,\*#()',' '))),
);
/** @todo non traitées : [capital_mt] => 335400, [capital_dev] => EUR **/
if ( !$iDb->update('infos_entrep', $tabUpdate, "siren='$siren'") ){
if (!$iDb->insert('infos_entrep', array_merge(array('siren'=>$siren),$tabUpdate))){
$error->errnum = 1;
$error->errmsg = 'Mise a jour impossible';
$output = new SetInfosEntrepReturn();
$output->error = $error;
$output->result = $result;
return $output;
}
}
$db = Zend_Db_Table_Abstract::getDefaultAdapter();
$sql = $db->select()->from('infos_entrep', array('siren'), 'jo')->where('siren=?',$siren);
$result = $db->fetchAll($sql);
if (count($result) == 0 ) {
try {
$isInserted = $db->insert('jo.infos_entrep', array_merge(array('siren'=>$siren), $tabUpdate));
} catch(Zend_Db_Exception $e) {
file_put_contents('insert.log', "INSERT = ".$e->getMessage());
}
} else {
try {
$isUpdated = $db->update('jo.infos_entrep', $tabUpdate, "siren=$siren");
} catch(Zend_Db_Exception $e) {
file_put_contents('update.log', "INSERT = ".$e->getMessage());
}
}
// Fin mise à jour identité
// Opposition INSEE
@ -1382,12 +1387,19 @@ class Saisie extends Scores_Ws_Server
/**
* Saisie d'un bilan
* @param string $siren
* SIREN de l'entité
* @param string $cloture
* Date de cloture original
* @param string $type
* Type original du bilan
* @param BilanInfos $data
* Postes et Information du bilan
* @param string $step (normal|nocheck|onlycheck)
* Etape
* @return int
* @throws SoapFault
*/
public function setBilan($siren, $data, $step = null)
public function setBilan($siren, $cloture, $type, $data, $step = null)
{
$this->authenticate();
@ -1407,16 +1419,16 @@ class Saisie extends Scores_Ws_Server
if (!preg_match('/[0-9]{8}/', $data->dateCloture)) {
throw new SoapFault('MSG', "Erreur Date de cloture");
}
if ($data->dateCloturePre!='AAAAMMJJ' && !preg_match('/[0-9]{8}/', $data->dateCloturePre)) {
if ($data->dateCloturePre != 'AAAAMMJJ' && !preg_match('/[0-9]{8}/', $data->dateCloturePre)) {
throw new SoapFault('MSG', "Erreur Date de cloture précédente");
}
if ($data->dateCloturePre=='AAAAMMJJ') {
if ($data->dateCloturePre == 'AAAAMMJJ') {
$data->dateCloturePre = 0;
}
if (intval($data->dureeMois)<1) {
if (intval($data->dureeMois) < 1) {
throw new SoapFault('MSG', "Erreur Durée");
}
if ($data->dureeMoisPre!=0 && intval($data->dureeMoisPre)<1) {
if ($data->dureeMoisPre != 0 && intval($data->dureeMoisPre)<1) {
throw new SoapFault('MSG', "Erreur Durée précédente");
}
if (!empty($data->postes)) {
@ -1505,8 +1517,8 @@ class Saisie extends Scores_Ws_Server
$bilansM = new Application_Model_JoBilans();
$sql = $bilansM->select()
->where('siren=?', $siren)
->where('dateExercice=?', $data->dateCloture)
->where('typeBilan=?', $data->typeBilan);
->where('dateExercice=?', $cloture)
->where('typeBilan=?', $type);
$row = $bilansM->fetchRow($sql);
} catch (Zend_Db_Exception $e) {
@ -1519,7 +1531,7 @@ class Saisie extends Scores_Ws_Server
$postesDiff = array();
if ($row!==null) {
if ($row !== null) {
//Make the diff
$postesDiff = array_diff(explode(';', $data->postes), explode(';',$row->postes));
@ -1540,11 +1552,13 @@ class Saisie extends Scores_Ws_Server
//Define data
$dataToUpdate = array(
'dateProvPartenaire' => date('Ymd'),
'dateProvPartenaire' => date('Ymd'),
'dateExercice' => $data->dateCloture,
'dateExercicePre' => $data->dateCloturePre,
'dureeExercice' => $data->dureeMois,
'dureeExercicePre' => $data->dureeMoisPre,
'monnaie' => 'EUR',
'monnaie' => 'EUR',
'typeBilan' => $data->typeBilan,
'monnaieOrigine' => 'EUR',
'unite' => $data->unite,
'postes' => $data->postes,

View File

@ -231,41 +231,41 @@ class SupprAnnonceReturn
class BilanInfos
{
/**
* Date de cloture précédent au format AAAAMMJJ
* Date de cloture au format AAAAMMJJ
* @var string
*/
public $dateCloture;
/**
* Durée de l'exercice
* @var int
*/
public $dureeMois;
/**
* Date de cloture précédent au format AAAAMMJJ
* @var string
*/
public $dateCloturePre;
/**
* Durée de l'exercice précédent
* @var int
*/
public $dureeMoisPre;
/**
* Unité des postes du bilan U,K,M
* @var string
*/
public $unite;
/**
* N, C, S
* @var string
*/
public $typeBilan;
/**
*
* @var string
@ -277,26 +277,26 @@ class SearchLienRef
{
/** @var int */
public $id;
/** @var string */
public $lib;
}
class LienDoc
{
/** @var int */
public $id;
/** @var string */
public $perimetre;
/** @var string */
public $label;
/** @var string */
public $url;
/** @var string */
public $date;
}

View File

@ -1655,6 +1655,14 @@ return array(
'Zend_Service_Amazon_Sqs' => dirname(__FILE__) . '/Service/Amazon/Sqs.php',
'Zend_Service_Amazon' => dirname(__FILE__) . '/Service/Amazon.php',
'Zend_Service_Audioscrobbler' => dirname(__FILE__) . '/Service/Audioscrobbler.php',
'Zend_Service_Console_Command_ParameterSource_Argv' => dirname(__FILE__) . '/Service/Console/Command/ParameterSource/Argv.php',
'Zend_Service_Console_Command_ParameterSource_ConfigFile' => dirname(__FILE__) . '/Service/Console/Command/ParameterSource/ConfigFile.php',
'Zend_Service_Console_Command_ParameterSource_Env' => dirname(__FILE__) . '/Service/Console/Command/ParameterSource/Env.php',
'Zend_Service_Console_Command_ParameterSource_ParameterSourceInterface' => dirname(__FILE__) . '/Service/Console/Command/ParameterSource/ParameterSourceInterface.php',
'Zend_Service_Console_Command_ParameterSource_Prompt' => dirname(__FILE__) . '/Service/Console/Command/ParameterSource/Prompt.php',
'Zend_Service_Console_Command_ParameterSource_StdIn' => dirname(__FILE__) . '/Service/Console/Command/ParameterSource/StdIn.php',
'Zend_Service_Console_Command' => dirname(__FILE__) . '/Service/Console/Command.php',
'Zend_Service_Console_Exception' => dirname(__FILE__) . '/Service/Console/Exception.php',
'Zend_Service_Delicious_Exception' => dirname(__FILE__) . '/Service/Delicious/Exception.php',
'Zend_Service_Delicious_Post' => dirname(__FILE__) . '/Service/Delicious/Post.php',
'Zend_Service_Delicious_PostList' => dirname(__FILE__) . '/Service/Delicious/PostList.php',

View File

@ -1,7 +1,6 @@
<?php
class WDB {
class WDB
{
private $host;
private $database;
private $user;

View File

@ -1,4 +1,4 @@
<?
<?php
define ('BEFORE', 0);
define ('AFTER', 1);
@ -6,42 +6,46 @@ define ('BOTH', 2);
define ('ALIGN_LEFT', 0);
define ('ALIGN_RIGHT', 1);
/**
* Initialisation d'une chaîne de caractère
* @param string $chaine
* Chaîne de caractère initiale
* @param int $taille
* Taille de la chaîne de caractère à initialiser
* @param string $caractere_pour_combler
* Caractère à utiliser pour combler la chaîne de caractère (espace par défaut)
* @param string $align
* Aligner la chaîne de caractère à droite (right) ou à gauche (left, par défaut)
* @return string
*/
function initstr($chaine, $taille, $caractere_pour_combler=' ', $align=ALIGN_LEFT)
{
if (strlen($chaine) >= $taille) {
return substr($chaine, 0, $taille);
}
/**Initialisation d'une chaîne de caractère
*
* @param string $chaine Chaîne de caractère initiale
* @param int $taille Taille de la chaîne de caractère à initialiser
* @param string $caractere_pour_combler Caractère à utiliser pour combler la chaîne de caractère (espace par défaut)
* @param string $align Aligner la chaîne de caractère à droite (right) ou à gauche (left, par défaut)
* @return string
*/
function initstr($chaine, $taille, $caractere_pour_combler=' ', $align=ALIGN_LEFT) {
if ($align==ALIGN_RIGHT) {
$str2='';
for ($i=0;$i<($taille-strlen($chaine));$i++)
$str2.=$caractere_pour_combler;
$str=$str2.$chaine;
} else {
if (strlen($chaine)>=$taille)
return substr($chaine,0,$taille);
$str=$chaine;
for ($i=strlen($chaine);$i<$taille;$i++)
$str = $str . $caractere_pour_combler;
}
return $str;
if ($align == ALIGN_RIGHT) {
return str_pad($chaine ,$taille, $caractere_pour_combler, STR_PAD_LEFT);
}
if ($align == ALIGN_LEFT) {
return str_pad($chaine, $taille, $caractere_pour_combler, STR_PAD_RIGHT);
}
return $str;
}
/**
* Ajout d'anti-slashs s'il y a lieu en vu d'une insertion en BDD
*
* @param string $str Chaine de caractère
* @return unknown
*/
function checkaddslashes($str){
return addslashes(preg_replace('/\\[^nrt\']/i', '\\', $str));
}
function checkaddslashes2($str){
if(strpos(str_replace("\'",''," $str"),"'")!=false)
return addslashes($str);
@ -56,7 +60,7 @@ define ('ALIGN_RIGHT', 1);
$strWithAccent = trim($strWithAccent , "-");
return $strWithAccent;
}
//function SRSaufVoyelle ($strIn, $mot1, $mot2) {
function str_replace_except_voy($mot1, $mot2, $strIn, $rule=0) {
$Voyelle=array('a','e','i','o','u','y', '1', '2', '3', '4');
@ -64,18 +68,18 @@ define ('ALIGN_RIGHT', 1);
if (strpos($mot2,$mot1)===false)
{
//foreach ($Voyelle as $k => $voy)
$posMot1=strpos($strIn, $mot1);
$posMot1=strpos($strIn, $mot1);
while ($posMot1!==false) {
$lettreAV=$strIn[$posMot1-1];
$lettreAP=$strIn[$posMot1+strlen($mot1)];
//echo "Lettre AV=$lettreAV<br/>";
//echo "Lettre AP=$lettreAP<br/>";
if ( ( $rule==0 && !in_array($lettreAV, $Voyelle) ) ||
if ( ( $rule==0 && !in_array($lettreAV, $Voyelle) ) ||
( $rule==1 && !in_array($lettreAP, $Voyelle) ) ||
( $rule==2 && !in_array($lettreAV, $Voyelle) && !in_array($lettreAP, $Voyelle) ))
$strIn=substr($strIn,0,$posMot1) . $mot2 . substr($strIn,$posMot1+strlen($mot1),strlen($strIn));
//echo "Le Mot devient : $strIn<br/>";
$posMot1=strpos($strIn, $mot1, $posMot1+strlen($mot1));
$posMot1=strpos($strIn, $mot1, $posMot1+strlen($mot1));
}
return $strIn;
}
@ -93,7 +97,7 @@ define ('ALIGN_RIGHT', 1);
$tabSonAIO=array('aino', 'eino', 'aimo', 'eimo');
$tabSonAIU=array('ainu', 'einu', 'aimu', 'eimu');
$tabCarPhon=array('1', '2', '3', '4', '5', 'e', 'f', 'g', 'h', 'i', 'k', 'l', 'n', 'o', 'r', 's', 't', 'u', 'w', 'x', 'y', 'z');
/** On traite tout en minuscule **/
$strIn=strtolower($strIn);
/** On remplace les 'Y' par des 'I' **/
@ -136,7 +140,7 @@ define ('ALIGN_RIGHT', 1);
$strIn=str_replace_except_voy('em', '1', $strIn, BEFORE);
$strIn=str_replace_except_voy('in', '4', $strIn, BEFORE);
/** Remplacement du son 'SCH' **/
$strIn=str_replace('sch', '5', $strIn);
$strIn=str_replace('sch', '5', $strIn);
/** Remplacement du 'S' sauf si voyelle ou son (1 à 4) avant ou après **/
$strIn=str_replace_except_voy('in', '4', $strIn, BOTH);
/** Remplacement de groupe de 2 lettres diverses **/
@ -208,15 +212,15 @@ define ('ALIGN_RIGHT', 1);
}
}
print_r($tabCarPhon);
/** Couversion en flottant **/
$result=0.0;
for ($j=10; $j>0; $j--)
$result+=$sout[$j]*pow($j-1,10);
return $result;
}
/**
* CLASS soundex2
* soundex2 French version
@ -411,7 +415,7 @@ class csoundex2 {
function soundex2($str) {
$soundex2 = new csoundex2();
$soundex2 -> build ($str);
return $soundex2 -> sString;
}

View File

@ -1,25 +1,17 @@
--
-- Base de données : `sdv1`
--
-- --------------------------------------------------------
--
-- Structure de la table `bilan_commande_enter`
--
CREATE TABLE IF NOT EXISTS `bilan_commande_enter` (
`id` int(11) NOT NULL,
`refCommande` varchar(13) NOT NULL,
`siren` varchar(9) NOT NULL,
`login` varchar(50) NOT NULL,
`userId` int(11) NOT NULL,
`bilanConfidentiel` tinyint(1) NOT NULL,
`bilanSource` varchar(20) NOT NULL,
`bilanFile` varchar(50) DEFAULT NULL,
`bilanFileNbPage` int(11) DEFAULT NULL,
`bilanFileSize` int(11) DEFAULT NULL,
`bilanFileDate` date NOT NULL DEFAULT '0000-00-00',
`bilanFileSent` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`bilanFileRecv` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`bilanCloture` date NOT NULL DEFAULT '0000-00-00',
`bilanType` enum('N','S','C') NOT NULL,
`bilanType` enum('N','S','C','') NOT NULL,
`erreurTxt` varchar(100) DEFAULT NULL,
`erreurDate` datetime DEFAULT '0000-00-00 00:00:00',
`erreurLogin` varchar(50) DEFAULT NULL,
@ -27,22 +19,10 @@ CREATE TABLE IF NOT EXISTS `bilan_commande_enter` (
`dateSaisie` datetime NOT NULL DEFAULT '0000-00-00 00:00:00'
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='Enregistrement des demandes de saisie de bilan depuis toute source' AUTO_INCREMENT=1 ;
--
-- Index pour les tables exportées
--
--
-- Index pour la table `bilan_commande_enter`
--
ALTER TABLE `bilan_commande_enter`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT pour les tables exportées
--
--
-- AUTO_INCREMENT pour la table `bilan_commande_enter`
--
ALTER TABLE `bilan_commande_enter`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

View File

@ -89,16 +89,29 @@ if(isset($opts->install))
//Create data directory and all his children
if ( !file_exists(APPLICATION_PATH.'/../data') )
{
mkdir(APPLICATION_PATH.'/../data');
}
if ( !file_exists(APPLICATION_PATH.'/../data/cache') )
{
mkdir(APPLICATION_PATH.'/../data/cache');
}
if ( !file_exists(APPLICATION_PATH.'/../data/files') )
{
mkdir(APPLICATION_PATH.'/../data/files');
}
if ( !file_exists(APPLICATION_PATH.'/../data/sessions') )
{
mkdir(APPLICATION_PATH.'/../data/sessions');
}
if ( !file_exists(APPLICATION_PATH.'/../data/wdsl') )
{
mkdir(APPLICATION_PATH.'/../data/wsdl');
}
// Generate cache file
// genCache.php

View File

@ -409,15 +409,17 @@ function getTxRendement($annee) {
$fp=fopen($configFile, 'w');
fwrite($fp, '<?php'."\n");
fwrite($fp, '$tva=20;' ."\n");
fwrite($fp, '$tva=20.0;' ."\n");
fwrite($fp, $strFonctions ."\n");
fwrite($fp, "\n".'function calculRatios($tabBilans, $tabIdentite, $accesPartenaire) {' ."\n");
fwrite($fp, ' global $tva, $mBil, $tabBilan, $efftr;' ."\n");
fwrite($fp, ' global $tva, $mBil, $efftr;' ."\n");
fwrite($fp, ' $numBil=0;' ."\n");
fwrite($fp, ' $numBilType=array();' ."\n");
fwrite($fp, ' foreach ($tabBilans as $millesime=>$bil) {' ."\n");
fwrite($fp, ' $tabTmp=@$mBil->getBilan(substr($millesime,-10), substr($millesime,0,1), @$bil[\'ref\'], $accesPartenaire, $nbRatiosMax=5);' ."\n");
fwrite($fp, ' $nbRatiosMax = 5;' ."\n");
fwrite($fp, ' foreach ($tabBilans as $millesime => $bil) ' ."\n");
fwrite($fp, ' {' ."\n");
fwrite($fp, ' $tabTmp = $mBil->getBilan(substr($millesime,-10), substr($millesime,0,1), @$bil[\'ref\'], $accesPartenaire);' ."\n");
fwrite($fp, ' $numBilType[substr($millesime,0,1)]++;' ."\n");
fwrite($fp, ' if (substr($millesime,0,1)==\'S\') {' ."\n");
@ -930,28 +932,46 @@ function genereCacheCommentaires($version, $type = 'scores')
false, MYSQL_ASSOC
);
$strCommentaires = "\$tabCommentaires=array();\n";
$strTri = "\$tabTri=array();\n";
$strTriAff = "\$tabTriAff=array();\n";
foreach ($tabTmp as $i => $commentaire) {
$id = $commentaire['code']*1;
$cycle = $commentaire['cycle']*1;
$ligne = $commentaire['ligne']*1;
$strCommentaires.= "\$tabCommentaires[".$id."][".$cycle."][".$ligne."] = \"".str_replace('"','\"',$commentaire['commentaire'])."\";\n";
if ($commentaire['tri']) {
$strTri.= "\$tabTri[".$id."] = ".$commentaire['tri'].";\n";
$strTriAff.= "\$tabTriAff[".$id."] = ".(($commentaire['tri'].'.'.(10000000+(1*$commentaire['code'])))*1).";\n";
}
}
$fp=fopen($fileTmp, 'w');
fwrite($fp, '<?php'."\n");
fwrite($fp, $strCommentaires);
fwrite($fp, $strTri);
fwrite($fp, $strTriAff);
fwrite($fp, "\n");
fclose($fp);
fwrite($fp, "/** Auto generated class ".date('Y-m-d H:i:s')."*/" . "\n");
$tabCommentaires = $tabTri = $tabTriAff = array();
foreach ($tabTmp as $i => $commentaire) {
$id = $commentaire['code']*1;
$ligne = $commentaire['ligne']*1;
$tabCommentaires[$id][$ligne] = str_replace('"','\"',$commentaire['commentaire']);
if ($commentaire['tri']) {
//$tabTri[$id] = $commentaire['tri'];
$tabTriAff[$id] = ($commentaire['tri'].'.'.(10000000+(1*$commentaire['code'])))*1;
}
}
//Table commentaires
fwrite($fp, "\$tabCommentaires = array(" . "\n");
foreach ($tabCommentaires as $id => $idVal) {
fwrite($fp, "\t" . $id." => array(" . "\n");
foreach ($idVal as $ligne => $ligneVal) {
fwrite($fp, "\t\t" . $ligne." => \"".$ligneVal."\"," . "\n");
}
fwrite($fp, "\t" . ")," . "\n");
}
fwrite($fp, ");" . "\n");
//Table Tri
/*fwrite($fp, "\t" . "protected \$tabTri = array(" . "\n");
foreach ($tabTri as $id => $idVal) {
fwrite($fp, "\t\t" . $id." => ".$idVal."," . "\n");
}
fwrite($fp, "\t" . ");" . "\n");*/
//Table Tri Aff
fwrite($fp, "\$tabTriAff = array(" . "\n");
foreach ($tabTriAff as $id => $idVal) {
fwrite($fp, "\t" . $id." => ".$idVal."," . "\n");
}
fwrite($fp, ");" . "\n");
$strOutput = exec('php -l '.$fileTmp, $output);
if (preg_match('/^No syntax errors detected in /', $strOutput)) {

View File

@ -417,7 +417,7 @@ foreach ( $tabCommandes as $ref => $commande ) {
if ( $isFileOnStorage && $item->pdfDate == '0000-00-00' ) {
$bilanM = new Application_Model_JoGreffesBilans();
$sql = $bilanM->select()
->where('siren=?',$siren)
->where('siren=?',$commande->siren)
->where('date_cloture=?', $dateCloture);
if ($commande->bilanType=='sociaux') {
$sql->where('type_comptes="" OR type_comptes="sociaux"');