Merge from 2.7

This commit is contained in:
Michael RICOIS 2014-10-20 15:30:46 +00:00
commit 50e7f9a998
11 changed files with 1488 additions and 1689 deletions

View File

@ -171,14 +171,24 @@ $tabLibCodeSaisie=array(
'_70'=>'Document relatif à une autre société', '_70'=>'Document relatif à une autre société',
); );
class MBilans { class MBilans
{
/**
* Siren de l'entité
* @var string
*/
public $siren; public $siren;
public $dernierExerciceDepose=0; public $dernierExerciceDepose=0;
public $dernierExerciceDeposeLe=0; public $dernierExerciceDeposeLe=0;
/**
* Stockage mémoire
* @var array
*/
protected $Bilans = array();
private $tabBS2BN = array( private $tabBS2BN = array(
//2033 ACTIF PASSIF //2033 ACTIF PASSIF
'AH' => '010', 'AH' => '010',
@ -554,47 +564,68 @@ class MBilans {
return $tabRet3; return $tabRet3;
} }
/** Retourne un bilan disponible au format numérique pour une entreprise /**
** * Retourne un bilan disponible au format numérique pour une entreprise
** @param $millesime date Date de cloture du bilan au format d/m/Y * @param string $millesime
** @param $typeBilan enum Type de bilan (N=Réel Normal, S=Réel Simplifié, C=Consolidé, A=Assurance, B=Banque) * Date de cloture du bilan au format d/m/Y
** @param $refPart string Référence du bilan chez le partenaire (si $accesPartenaire=true) * @param string $typeBilan
** @param $accesPartenaire bool Accès autorisé aux partenaires distant si le bilan est absenr * Type de bilan (N=Réel Normal, S=Réel Simplifié, C=Consolidé, A=Assurance, B=Banque)
**/ * @param number $refPart
* Référence du bilan chez le partenaire (si $accesPartenaire=true)
* @param string $accesPartenaire
* Accès autorisé aux partenaires distant si le bilan est absent
* @return array
*/
public function getBilan($millesime='', $typeBilan='N', $refPart=0, $accesPartenaire=false) public function getBilan($millesime='', $typeBilan='N', $refPart=0, $accesPartenaire=false)
{ {
$classWDate = new WDate(); //Get bilan in memory
if (count($this->Bilans) > 0 && array_key_exists($typeBilan.$millesime, $this->Bilans))
{
return $this->Bilans[$typeBilan.$millesime];
}
$classWDate = new WDate();
$millesimeDB = $classWDate->dateT('d/m/Y', 'Ymd', $millesime); $millesimeDB = $classWDate->dateT('d/m/Y', 'Ymd', $millesime);
if ($accesPartenaire) if ($accesPartenaire)
{
// On ne veut pas de bilans "Téléchargés" directement sur Internet // On ne veut pas de bilans "Téléchargés" directement sur Internet
$strSansBilansWeb=' AND partenaire<>7 '; $strSansBilansWeb=' AND partenaire<>7 ';
}
else else
{
$strSansBilansWeb=''; $strSansBilansWeb='';
}
$bilan = null;
$iGreffe = new MGreffes(); $iGreffe = new MGreffes();
$ret = $this->iDb->select('bilans', 'dateProvPartenaire, dateExercice, dateExercicePre, dureeExercice, dureeExercicePre, monnaie, typeBilan, monnaieOrigine, unite, postes, partenaire, id, confidentiel, dateInsert', "siren='$this->siren' AND typeBilan='$typeBilan' AND dateExercice='$millesimeDB' $strSansBilansWeb", true, MYSQL_ASSOC); $ret = $this->iDb->select('bilans',
$bilan=$ret[0]; 'dateProvPartenaire, dateExercice, dateExercicePre, dureeExercice, dureeExercicePre, monnaie, typeBilan, monnaieOrigine, unite, postes, partenaire, id, confidentiel, dateInsert',
if (count($ret)==0 && $accesPartenaire) { "siren='$this->siren' AND typeBilan='$typeBilan' AND dateExercice='$millesimeDB' $strSansBilansWeb", false, MYSQL_ASSOC);
if ($refPart=='' || $refPart==0) { if (count($ret)==0 && $accesPartenaire)
{
if ($refPart=='' || $refPart==0)
{
$tabTmp = $iGreffe->getListeBilans($this->siren); $tabTmp = $iGreffe->getListeBilans($this->siren);
foreach ($tabTmp as $idx=>$bil) { foreach ($tabTmp as $idx=>$bil)
{
$typeBil=substr($idx,0,1); $typeBil=substr($idx,0,1);
$millBil=substr($idx,1,10); $millBil=substr($idx,1,10);
if ($typeBil==$typeBilan && $millBil==$millesime) { if ($typeBil==$typeBilan && $millBil==$millesime)
{
$refPart=$bil['ref']; $refPart=$bil['ref'];
break; break;
} }
} }
} }
$tabBilan = $iGreffe->getBilan($this->siren, $refPart); $tabBilan = $iGreffe->getBilan($this->siren, $refPart);
if ($tabBilan) if ($tabBilan)
{ {
$strPostes=''; $strPostes='';
foreach ($tabBilan['POSTES'] as $poste=>$valeur) foreach ($tabBilan['POSTES'] as $poste=>$valeur) {
$strPostes.="$poste=$valeur;"; $strPostes.="$poste=$valeur;";
}
$tabInsert=array( $tabInsert=array(
'siren' =>$this->siren, 'siren' =>$this->siren,
@ -610,14 +641,23 @@ class MBilans {
'postes' =>$strPostes, 'postes' =>$strPostes,
'partenaire' =>$tabBilan['SOURCE'], 'partenaire' =>$tabBilan['SOURCE'],
); );
if (!$this->iDb->insert('bilans', $tabInsert, true)) if (!$this->iDb->insert('bilans', $tabInsert, true)) {
$this->iDb->update('bilans', $tabInsert, "siren='$this->siren' AND typeBilan='$typeBilan' AND dateExercice='$millesimeDB'"); $this->iDb->update('bilans', $tabInsert, "siren='$this->siren' AND typeBilan='$typeBilan' AND dateExercice='$millesimeDB'");
}
$ret = $this->iDb->select('bilans', 'dateProvPartenaire, dateExercice, dateExercicePre, dureeExercice, dureeExercicePre, monnaie, typeBilan, monnaieOrigine, unite, postes, partenaire, id, confidentiel, dateInsert', "siren='$this->siren' AND typeBilan='$typeBilan' AND dateExercice='$millesimeDB'", true); $ret = $this->iDb->select('bilans', 'dateProvPartenaire, dateExercice, dateExercicePre, dureeExercice, dureeExercicePre, monnaie, typeBilan, monnaieOrigine, unite, postes, partenaire, id, confidentiel, dateInsert', "siren='$this->siren' AND typeBilan='$typeBilan' AND dateExercice='$millesimeDB'", true);
if (count($ret) > 0) {
$bilan = $ret[0]; $bilan = $ret[0];
} }
} }
} else {
$bilan = $ret[0];
}
$tabBilan = $tabBilanPre = $bilanPre = array(); $tabBilan = $tabBilanPre = $bilanPre = array();
if ($bilan !== null)
{
$tabBilan['SIREN'] = $this->siren; $tabBilan['SIREN'] = $this->siren;
$tabBilan['DATE_FRAICHE_BILAN'] = $bilan['dateProvPartenaire']; // SSAAMMJJ $tabBilan['DATE_FRAICHE_BILAN'] = $bilan['dateProvPartenaire']; // SSAAMMJJ
$tabBilan['DATE_CLOTURE'] = $bilan['dateExercice']; // SSAAMMJJ $tabBilan['DATE_CLOTURE'] = $bilan['dateExercice']; // SSAAMMJJ
@ -1079,6 +1119,11 @@ class MBilans {
if (!isset($tabBilan['NR4']) && isset($tabBilanPre['AR4'])) $tabBilan['AR4']=$tabBilanPre['AR4']; if (!isset($tabBilan['NR4']) && isset($tabBilanPre['AR4'])) $tabBilan['AR4']=$tabBilanPre['AR4'];
} }
} }
//Put Result in memory
$this->Bilans[$typeBilan.$millesime] = $tabBilan;
}
return $tabBilan; return $tabBilan;
} }

View File

@ -76,9 +76,8 @@ class MTel
'telephonie', '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,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); "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; $this->enCache=true;
foreach ($ret as $tabTel) foreach ($ret as $tabTel)
{ {
@ -116,8 +115,9 @@ class MTel
} }
} }
} elseif ($this->accesDistant) { }
elseif ($this->accesDistant)
{
$this->enCache=false; $this->enCache=false;
$tabPost = array( $tabPost = array(
'p_ACTION'=>'', 'p_ACTION'=>'',
@ -243,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)) { 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) { {
foreach ($matches[2] as $j=>$tmp)
{
$lib=$tmp; $lib=$tmp;
$precis=trim(strtr($matches[1][$j], array('-'=>' '))); $precis=trim(strtr($matches[1][$j], array('-'=>' ')));
$num=trim(strtr($matches[3][$j],array('&nbsp;'=>'','<br />'=>''))); $num=trim(strtr($matches[3][$j],array('&nbsp;'=>'','<br />'=>'')));
@ -252,8 +254,8 @@ class MTel
} }
$tabTel=array_values($tabTel); $tabTel=array_values($tabTel);
foreach ($tabTel as $tabT)
foreach ($tabTel as $tabT) { {
$tabRet[]=array( $tabRet[]=array(
'siren'=>$siren, 'siren'=>$siren,
'nic'=>substr($res['siret'],-5), 'nic'=>substr($res['siret'],-5),
@ -278,7 +280,8 @@ class MTel
} }
} }
if ($last) { if ($last)
{
$tabRet=array(); $tabRet=array();
foreach($tabLast as $typeTel=>$tabPriorite) { foreach($tabLast as $typeTel=>$tabPriorite) {
ksort($tabPriorite); ksort($tabPriorite);

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 @@
<? <?php
/** Ratios pour les collectivités **/ $tva=20.0;
global $tabZones2Ratios;
/** Tableau de conversion des communes **/ /** Donne le taux d'inflation pour une année donnée **/
$tabZones2Ratios=array( function getInflation($annee) {
'R01a'=>'R[801]', $tabInfla = include __DIR__ . '/Variables/CacheTabInfla.php';
'R01b'=>'Rh[801]', if (isset($tabInfla[$annee])) return $tabInfla[$annee];
'R01c'=>'Rs[801]', }
'R02a'=>'R[802]', /** Donne le taux de rendement des actions pour une année donnée **/
'R02b'=>'Rh[802]', function getTxRendement($annee) {
'R02c'=>'Rs[802]', $tabTxRendObli = include __DIR__ . '/Variables/CacheTabRendObli.php';
'R02d'=>'Rq[802]', if (isset($tabTxRendObli[$annee])) return $tabInfla[$annee];
'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]',
);
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());
}
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';
/** Conversion des zones pour les collectivités **/ $tabRatios[$numBil]=$R;
function convertZones($codeR, $zonesDB) { $numBil++;
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];
} }
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;
} }
return $ret;
}
?>

View File

@ -1,16 +1,11 @@
<?php <?php
require_once 'Metier/partenaires/classMPrivileges.php'; require_once 'Metier/partenaires/classMPrivileges.php';
require_once 'Metier/partenaires/classMMarques.php'; require_once 'Metier/partenaires/classMMarques.php';
require_once 'Metier/scores/classMRegression.php'; require_once 'Metier/scores/classMRegression.php';
require_once 'Metier/partenaires/classMLiens2.php'; require_once 'Metier/partenaires/classMLiens2.php';
require_once 'Metier/scores/classMSolvabilite.php'; require_once 'Metier/scores/classMSolvabilite.php';
require_once 'Metier/scores/classMRatios.php';
require_once 'Metier/scores/Variables/configMRatios.php';
define('INDISCORE_DEBUG', false); define('INDISCORE_DEBUG', false);
@ -596,7 +591,6 @@ function calculIndiScore($siren, $nic=0, $accesDist=false, $cycleClient=2, $mail
global $tabFormules; global $tabFormules;
global $tabFormulesRatios; global $tabFormulesRatios;
global $mBil; global $mBil;
global $tabBilan;
global $efftr; global $efftr;
global $tabRatiosInfos; global $tabRatiosInfos;
@ -625,7 +619,6 @@ function calculIndiScore($siren, $nic=0, $accesDist=false, $cycleClient=2, $mail
* Récupération des informations identitaire * Récupération des informations identitaire
*/ */
$tabIdentite=$iInsee->getIdentiteEntreprise($siren, $nic, 0, false, $accesDist); $tabIdentite=$iInsee->getIdentiteEntreprise($siren, $nic, 0, false, $accesDist);
$tabBilan=array();
$timer['identite']=microtime(true); $timer['identite']=microtime(true);
if (empty($tabIdentite)) { if (empty($tabIdentite)) {
@ -645,15 +638,15 @@ function calculIndiScore($siren, $nic=0, $accesDist=false, $cycleClient=2, $mail
$classWdate = new WDate(); $classWdate = new WDate();
//Initialisation tabFormules depuis le cache //Initialisation tabFormules depuis le cache
$tabVariables = include realpath(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'Variables/CacheTabVariables.php'; $tabVariables = include __DIR__ . '/Variables/CacheTabVariables.php';
$tabFormules = include realpath(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'Variables/CacheTabFormules.php'; $tabFormules = include __DIR__ . '/Variables/CacheTabFormules.php';
$tabFormulesRatios = array(); $tabFormulesRatios = array();
foreach ($tabFormules as $tmpFormule) { foreach ($tabFormules as $tmpFormule) {
$tabFormulesRatios[$tmpFormule['id']] = $tmpFormule; $tabFormulesRatios[$tmpFormule['id']] = $tmpFormule;
$tabRatiosInfos[$tmpFormule['id']]=array('unite' => $tmpFormule['unite']); $tabRatiosInfos[$tmpFormule['id']]=array('unite' => $tmpFormule['unite']);
} }
$tabRatiosSecteurs = $tabBilansR = $tabRatios2 = $tabRatiosEvol = array(); $tabRatiosSecteurs = $tabRatios2 = $tabRatiosEvol = array();
$NIC=substr($tabIdentite['SiretSiege'],-5); $NIC=substr($tabIdentite['SiretSiege'],-5);
$SIREN=$siren; $SIREN=$siren;
@ -933,49 +926,41 @@ function calculIndiScore($siren, $nic=0, $accesDist=false, $cycleClient=2, $mail
$DCREN_AA=substr($dateCrea,0,4); $DCREN_AA=substr($dateCrea,0,4);
$AGE=$classWdate->nbMoisEntre($dateCrea, date('Ymd')); $AGE=$classWdate->nbMoisEntre($dateCrea, date('Ymd'));
/** Elements provenant des ratios : $tabBilan = $tabBil = array();
** @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++
}
*/
/** /**
* Bilan - Liste des bilans * Bilan - Liste des bilans
*/ */
$mBil = new MBilans($siren, $iDb); $mBil = new MBilans($siren, $iDb);
$tabBilans = $mBil->listeBilans($accesDist); $tabBilans = $mBil->listeBilans($accesDist);
$NBBILAN = count($tabBilans); $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 * Calcul des ratios
*/ */
$tabBilan=$tabBil=array(); $tabRatios = calculRatios($tabBilans, $tabIdentite, $accesDist);
if ($NBBILAN>0) $tabRatios = calculRatios($tabBilans, $tabIdentite, $accesDist); }
$timer['ratios']=microtime(true); $timer['ratios']=microtime(true);
// Tableau des années de bilans // Tableau des années de bilans
$tabAnnees = array(); $tabAnnees = array();
// Tableau d'infos sur les bilans // Tableau d'infos sur les bilans
$i2=0; $i2=0;
if (count($tabRatios)>0) { if (count($tabRatios)>0)
foreach ($tabRatios as $i=>$Rtmp) { {
$tabBilansR[$i]=array( foreach ($tabRatios as $i=>$Rtmp)
'dateCloture' => $tabBilan[$i]['DATE_CLOTURE'], {
'duree' => $tabBilan[$i]['DUREE_MOIS'],
'devise' => $tabBilan[$i]['MONNAIE'],
'type' => $tabBilan[$i]['CONSOLIDE'],
'unite' => 'U',
);
if (substr($tabBilan[$i]['DATE_CLOTURE'],0,4)>1900){ if (substr($tabBilan[$i]['DATE_CLOTURE'],0,4)>1900){
$tabAnnees[$i]=substr($tabBilan[$i]['DATE_CLOTURE'],0,4); $tabAnnees[$i]=substr($tabBilan[$i]['DATE_CLOTURE'],0,4);
} }
@ -1041,8 +1026,8 @@ function calculIndiScore($siren, $nic=0, $accesDist=false, $cycleClient=2, $mail
$MARCHE=$MARCHEp=$MARCHEVOL=$MARCHEPART=$MARCHEPARTp=$MARCHEPARTEVOL=''; $MARCHE=$MARCHEp=$MARCHEVOL=$MARCHEPART=$MARCHEPARTp=$MARCHEPARTEVOL='';
$MARCHESAL=$MARCHESALp=$MARCHENBENT=$MARCHENBENTp=''; $MARCHESAL=$MARCHESALp=$MARCHENBENT=$MARCHENBENTp='';
$tabRatiosSecteurs=$Rtot=array(); $tabRatiosSecteurs=$Rtot=array();
if (count($tabAnnees)>0) { if (count($tabAnnees)>0)
{
if (strlen($naf)>4) $strNaf=" AND naf5='$naf' "; if (strlen($naf)>4) $strNaf=" AND naf5='$naf' ";
else $strNaf=" AND naf4='$naf' "; else $strNaf=" AND naf4='$naf' ";
if (count($tabAnnees)>2) $strAnnees='AND annee BETWEEN '.$tabAnnees[2].' AND '.$tabAnnees[0]; if (count($tabAnnees)>2) $strAnnees='AND annee BETWEEN '.$tabAnnees[2].' AND '.$tabAnnees[0];
@ -1153,22 +1138,6 @@ function calculIndiScore($siren, $nic=0, $accesDist=false, $cycleClient=2, $mail
$timer['regression']=microtime(true); $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 // Elements provenant des bilans
$EFFBILAN=$tabBilan[0]['YP']; $EFFBILAN=$tabBilan[0]['YP'];
$nm=$nbMoisBilCumul=$tabBilan[0]['DUREE_MOIS']; $nm=$nbMoisBilCumul=$tabBilan[0]['DUREE_MOIS'];
@ -2035,38 +2004,32 @@ function calculIndiScore($siren, $nic=0, $accesDist=false, $cycleClient=2, $mail
} }
else else
{ {
$numBil=0;//sleep(1); $numBil = $i = 0;
foreach ($tabBilan as $item)
for ($i=0; isset($tabBilan[$i]); $i++)
{ {
$i++;
//if (substr($millesime,0,1)=='S') { if ($item['CONSOLIDE']=='S')
// @todo attention au type de bilan S en N et banque assu consolidé !!! {
$tabTmp=$mBil->bilanSimplifie2Normal($item);
if ($tabBilan[$i]['CONSOLIDE']=='S') { $tabBilan[$i] = array_merge($tabTmp, $item);
$tabTmp=$mBil->bilanSimplifie2Normal($tabBilan[$i]);
$tabBilan[$i]=array_merge($tabTmp, $tabBilan[$i]);
$numBil++; $numBil++;
} elseif ($tabBilan[$i]['CONSOLIDE']=='N') }
elseif ($item['CONSOLIDE']=='N')
{
$numBil++; $numBil++;
else { }
/** On ignore les bilans Assurance, Banques et Consolidés **/ else
/*if ($tabBilan[$i]['CONSOLIDE']=='C' && $scoreAltman=='') { {
$icotation = new ICotation($tabBilan[$i], true);
$scoreAltman=round($icotation->scoreAltman(),2);
}*/
continue; continue;
} }
if ($numBil>2) break; if ($numBil>2) break;
unset($icotation); $icotation = new ICotation($item, true);
$icotation = new ICotation($tabBilan[$i], true);
$secteur=$icotation->getSecteurActivite($isolv->getNaf4($naf)); $secteur=$icotation->getSecteurActivite($isolv->getNaf4($naf));
$libSecteur=$icotation->tabLibActivite[$secteur]; $libSecteur=$icotation->tabLibActivite[$secteur];
$chiffeAffaire=$icotation->calculChiffreAffaires($isolv->getNaf4($naf)); $chiffeAffaire=$icotation->calculChiffreAffaires($isolv->getNaf4($naf));
$tabBil[$i] = array( $tabBil[$i] = array(
'Millesime'=>$tabBilan[$i]['DATE_CLOTURE'], 'Millesime'=>$item['DATE_CLOTURE'],
'FraisPerso'=>$icotation->calculFraisPersonnel(), 'FraisPerso'=>$icotation->calculFraisPersonnel(),
'CA'=>$chiffeAffaire, 'CA'=>$chiffeAffaire,
'EBE'=>$icotation->calculEBE(), 'EBE'=>$icotation->calculEBE(),
@ -2229,14 +2192,14 @@ 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); //sendMail('production@scores-decisions.com', 'ylenaour@scores-decisions.com', "Indiscore sur $siren : Structure Score Financier", $strNote);
} }
} }
else { else
{
$noteSolvabilitePre=$noteSD; $noteSolvabilitePre=$noteSD;
$noteFinPre=$noteMoy; $noteFinPre=$noteMoy;
if ($noteSolvabilite>$noteSolvabilitePre) $tendance='Haussière'; if ($noteSolvabilite>$noteSolvabilitePre) $tendance='Haussière';
elseif ($noteSolvabilite==$noteSolvabilitePre) $tendance='Stable'; elseif ($noteSolvabilite==$noteSolvabilitePre) $tendance='Stable';
else $tendance='Baissière'; else $tendance='Baissière';
} }
//Note financière Solvabilite = $icotation->scoreD($naf)
} }
// Cas de présence unique de bilan Banque ou Assurance qui ne sont pas géré financièrement // Cas de présence unique de bilan Banque ou Assurance qui ne sont pas géré financièrement
@ -2264,7 +2227,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 (substr($tabIdentite['DateCreaEn'],0,4)*1+2)<date('Y') && // L'entreprise à plus de 2 ans
$FJURPUB ) { // et est soumise à publication $FJURPUB ) { // et est soumise à publication
$SCORECONF-=20; $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 if (!$tabIdentite['TvaAttribue']) { // Entreprise sans numéro de TVA
$TVAINTRA=false; $TVAINTRA=false;
@ -2774,7 +2736,6 @@ function calculIndiScore($siren, $nic=0, $accesDist=false, $cycleClient=2, $mail
// Encours estimé = CA Estimé / 72 // Encours estimé = CA Estimé / 72
if ($CAESTIME>0) $encoursEstime=$CAESTIME/36; 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 /** Plafond des encours en fonction de la note / 100
**/ **/

View File

@ -63,6 +63,7 @@ class Scores_Ws_Server
'195.154.174.221', //Extranet - sd-46528 '195.154.174.221', //Extranet - sd-46528
'91.121.157.194', //Extranet - ns359466 '91.121.157.194', //Extranet - ns359466
'78.31.45.206', //SDSL RAMBOUILLET '78.31.45.206', //SDSL RAMBOUILLET
'127.0.0.1',
); );
/** /**
@ -628,12 +629,51 @@ class Scores_Ws_Server
return false; return false;
} }
/**
* Acces WS, block access to other apps
*/
if ($result->accesWS==1 && $result->idClient!=1) {
// Webservice user don't need access to others apps
if ( in_array($ipConnexion, $this->listApplicationIp) && $tabRep['idClient']!=1 ) {
return '0901';
} 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';
}
/** /**
* IP Validation * IP Validation
* Get an array of IP and IP range * Get an array of IP and IP range
* 192.168.3.5-192.68.3.10;192.168.3.*;192.168.3.10 * 192.168.3.5-192.68.3.10;192.168.3.*;192.168.3.10
*/ */
if ( !empty($result->filtre_ip) ) if ( !empty($result->filtre_ip) && !in_array($ipConnexion, $this->listApplicationIp) )
{ {
$filtreIp = explode(';', trim($result->filtre_ip, ';')); $filtreIp = explode(';', trim($result->filtre_ip, ';'));
if ( count($filtreIp)>0 ) if ( count($filtreIp)>0 )
@ -677,7 +717,6 @@ class Scores_Ws_Server
} }
} }
/** /**
* @todo : * @todo :
* Check how password is check * Check how password is check
@ -752,44 +791,6 @@ class Scores_Ws_Server
} }
} }
/**
* Acces WS, block access to other apps
*/
if ($result->accesWS==1 && $result->idClient!=1) {
// Webservice user don't need access to others apps
if ( in_array($ipConnexion, $this->listApplicationIp) && $tabRep['idClient']!=1 ) {
return '0901';
} 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 true;
} }

View File

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

View File

@ -813,6 +813,7 @@ class Entreprise extends Scores_Ws_Server
$this->authenticate(); $this->authenticate();
$this->permission('liens'); $this->permission('liens');
//Load country table
try { try {
$countryM = new Application_Model_JoTabPays(); $countryM = new Application_Model_JoTabPays();
$sql = $countryM->select()->from($countryM, array('codPays3', 'libPays')); $sql = $countryM->select()->from($countryM, array('codPays3', 'libPays'));
@ -2688,31 +2689,8 @@ class Entreprise extends Scores_Ws_Server
$output->Indiscore = $Indiscore; $output->Indiscore = $Indiscore;
//Ratios
global $tva, $mBil, $tabBilan, $efftr, $tabInfla;
$tabFormules = include APPLICATION_PATH . '/../library/Metier/scores/Variables/CacheTabFormules.php';
require_once 'Metier/scores/Variables/configMRatios.php';
$mBil = new MBilans($siren);
$tabBilans = $mBil->listeBilans($accesPartenaire);
$nbBilans = count($tabBilans);
$tabBilan = $tabBil = array();
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__);
$naf = $tabIdentite['NafEnt'];
$nafLib = $tabIdentite['NafEntLib'];
$efftr = $tabIdentite['Effectif']*1;
$fj = $tabIdentite['FJ'];
$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 //Tableau d'infos sur les formules
$tabFormules = include APPLICATION_PATH . '/../library/Metier/scores/Variables/CacheTabFormules.php';
$tabBorneMin = $tabBorneMax = array(); $tabBorneMin = $tabBorneMax = array();
foreach ($tabFormules as $formule) { foreach ($tabFormules as $formule) {
$id = $formule['id']*1; $id = $formule['id']*1;
@ -2725,12 +2703,38 @@ class Entreprise extends Scores_Ws_Server
$ratiosInfos->libelle = $formule['libelle']; $ratiosInfos->libelle = $formule['libelle'];
$ratiosInfos->unite = $formule['unite']; $ratiosInfos->unite = $formule['unite'];
$ratiosInfos->commentaires = $formule['commentaires']; $ratiosInfos->commentaires = $formule['commentaires'];
$tabRatiosInfos[] = $ratiosInfos; $tabRatiosInfos[] = $ratiosInfos;
$tabBorneMin[$id] = $formule['borneMin']; $tabBorneMin[$id] = $formule['borneMin'];
$tabBorneMax[$id] = $formule['borneMax']; $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)
{
$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__);
$naf = $tabIdentite['NafEnt'];
$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__);
$tabAnnees = array(); $tabAnnees = array();
if ( $nbRatios > 0 ) { if ( $nbRatios > 0 ) {
foreach ( $tabRatios as $i=>$R ) { foreach ( $tabRatios as $i=>$R ) {
@ -4538,23 +4542,10 @@ class Entreprise extends Scores_Ws_Server
$tabRatios = $tabRatiosEvol = array(); $tabRatios = $tabRatiosEvol = array();
$tabRet = 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'; $tabFormules = include APPLICATION_PATH . '/../library/Metier/scores/Variables/CacheTabFormules.php';
require_once 'Metier/scores/Variables/configMRatios.php';
$mBil = new MBilans($siren);
$tabBilans = $mBil->listeBilans($accesPartenaire);
$nbBilans = count($tabBilans);
$tabBilan = $tabBil = array();
if ($nbBilans>0) {
$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(); $tabBorneMin = $tabBorneMax = array();
foreach ($tabFormules as $formule) { foreach ($tabFormules as $formule) {
$id = $formule['id']*1; $id = $formule['id']*1;
@ -4572,6 +4563,24 @@ class Entreprise extends Scores_Ws_Server
$tabBorneMax[$id] = $formule['borneMax']; $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)
{
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__);
$tabAnnees = array(); $tabAnnees = array();
if ( $nbRatios > 0 ) { if ( $nbRatios > 0 ) {
foreach ( $tabRatios as $i=>$R ) { foreach ( $tabRatios as $i=>$R ) {

View File

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

View File

@ -116,22 +116,19 @@ class Saisie extends Scores_Ws_Server
); );
$db = Zend_Db_Table_Abstract::getDefaultAdapter(); $db = Zend_Db_Table_Abstract::getDefaultAdapter();
$isUpdated = $db->update('jo.infos_entrep', $tabUpdate, "siren=$siren"); $sql = $db->select()->from('infos_entrep', array('siren'), 'jo')->where('siren=?',$siren);
if ($isUpdated == 0) $result = $db->fetchRow($sql);
{ if (count($result) == 0 ) {
try { try {
$isInserted = $db->insert('jo.infos_entrep', array_merge(array('siren'=>$siren), $tabUpdate)); $isInserted = $db->insert('jo.infos_entrep', array_merge(array('siren'=>$siren), $tabUpdate));
} catch(Zend_Db_Exception $e) { } catch(Zend_Db_Exception $e) {
//file_put_contents('test.log', "INSERT = ".$e->getMessage()); file_put_contents('insert.log', "INSERT = ".$e->getMessage());
} }
if ($isInserted == 0) } else {
{ try {
$error->errnum = 1; $isUpdated = $db->update('jo.infos_entrep', $tabUpdate, "siren=$siren");
$error->errmsg = 'Mise a jour impossible'; } catch(Zend_Db_Exception $e) {
$output = new SetInfosEntrepReturn(); file_put_contents('update.log', "INSERT = ".$e->getMessage());
$output->error = $error;
$output->result = $result;
return $output;
} }
} }
// Fin mise à jour identité // Fin mise à jour identité

View File

@ -409,15 +409,17 @@ function getTxRendement($annee) {
$fp=fopen($configFile, 'w'); $fp=fopen($configFile, 'w');
fwrite($fp, '<?php'."\n"); fwrite($fp, '<?php'."\n");
fwrite($fp, '$tva=20;' ."\n"); fwrite($fp, '$tva=20.0;' ."\n");
fwrite($fp, $strFonctions ."\n"); fwrite($fp, $strFonctions ."\n");
fwrite($fp, "\n".'function calculRatios($tabBilans, $tabIdentite, $accesPartenaire) {' ."\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, ' $numBil=0;' ."\n");
fwrite($fp, ' $numBilType=array();' ."\n"); fwrite($fp, ' $numBilType=array();' ."\n");
fwrite($fp, ' foreach ($tabBilans as $millesime=>$bil) {' ."\n"); fwrite($fp, ' $nbRatiosMax = 5;' ."\n");
fwrite($fp, ' $tabTmp=@$mBil->getBilan(substr($millesime,-10), substr($millesime,0,1), @$bil[\'ref\'], $accesPartenaire, $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, ' $numBilType[substr($millesime,0,1)]++;' ."\n");
fwrite($fp, ' if (substr($millesime,0,1)==\'S\') {' ."\n"); fwrite($fp, ' if (substr($millesime,0,1)==\'S\') {' ."\n");