webservice/library/Metier/Scores/Projection.php

118 lines
2.2 KiB
PHP
Raw Normal View History

2015-01-20 11:01:53 +00:00
<?php
2016-01-27 19:57:03 +00:00
class Metier_Scores_Projection
2015-01-20 11:01:53 +00:00
{
/**
* Tableau des années de millesime de bilans
*/
public $tabRegX;
2016-01-27 19:30:49 +00:00
2015-01-20 11:01:53 +00:00
/**
* Tableau des années en paramètres
*/
protected $Y;
2016-01-27 19:30:49 +00:00
2015-01-20 11:01:53 +00:00
/**
* + $nbAnnees Projetées
*/
protected $Yaff;
2016-01-27 19:30:49 +00:00
2015-01-20 11:01:53 +00:00
/**
* Taux de projection de n à n+$nbAnnees
*/
protected $PROJECTAUX;
2016-01-27 19:30:49 +00:00
2015-01-20 11:01:53 +00:00
/**
* Coef de corélation linéaire
*/
protected $PROJECCOEF;
2016-01-27 19:30:49 +00:00
2015-01-20 11:01:53 +00:00
public function getY()
{
return $this->Y;
}
2016-01-27 19:30:49 +00:00
2015-01-20 11:01:53 +00:00
public function getYaff()
{
return $this->Yaff;
}
2016-01-27 19:30:49 +00:00
2015-01-20 11:01:53 +00:00
public function getProjecTaux()
{
return $this->PROJECTAUX;
}
2016-01-27 19:30:49 +00:00
2015-01-20 11:01:53 +00:00
public function getProjecCoeff()
{
return $this->PROJECCOEF;
}
2016-01-27 19:30:49 +00:00
2015-01-20 11:01:53 +00:00
/**
* Remplace la function PROJECCOEF
* @param array $tabRegY
* @param array $nbAnnees
* @return boolean|number
*/
public function calcCOEF($tabRegY, $nbAnnees)
{
if ( count($this->tabRegX) == 0 || count($tabRegY) == 0 ) {
return false;
}
2016-01-27 19:30:49 +00:00
2015-01-20 11:01:53 +00:00
$oReg = new Regression($tabRegY, $this->tabRegX);
return $oReg->vCoefCorLin;
}
2016-01-27 19:30:49 +00:00
2015-01-20 11:01:53 +00:00
/**
* Remplace la function PROJEC
* @param array $tabRegY
* @param array $nbAnnees
* @return boolean|mixed
*/
public function calc($tabRegY, $nbAnnees)
{
if ( count($this->tabRegX) == 0 || count($tabRegY) == 0 ) {
return false;
}
2016-01-27 19:30:49 +00:00
2015-01-20 11:01:53 +00:00
$oReg = new Regression($tabRegY, $this->tabRegX);
$tab = $oReg->GetProjectionDebut($nbAnnees);
2016-01-27 19:30:49 +00:00
2015-01-20 11:01:53 +00:00
$this->Y = $this->Yaff = array();
$nbRegX = count($this->tabRegX);
// Début des clés pour le tableau Y des critères
$j = 0 - $nbRegX;
foreach($tab as $i=>$valeur) {
$j++;
if ( isset($this->tabRegX[$i]) ) {
$this->Yaff[''.$this->tabRegX[$i].' '] = $this->Y[$j] = $tab[$i];
$lastX = $this->tabRegX[$i];
} else {
$lastX++;
$this->Yaff[''.$lastX.' '] = $this->Y[$j] = $tab[$i];
}
}
$this->PROJECTAUX = $oReg->TauxProgression($nbAnnees);
$this->PROJECCOEF = $oReg->vCoefCorLin*100;
return end($tab);
}
2016-01-27 19:30:49 +00:00
2015-01-20 11:01:53 +00:00
/**
* Remplace la function PROJECTAUX
* @param array $tabRegY
* @param array $nbAnnees
* @return boolean|number
*/
public function calcTAUX($tabRegY, $nbAnnees)
{
if ( count($this->tabRegX) == 0 || count($tabRegY) == 0 ) {
return false;
}
2016-01-27 19:30:49 +00:00
2015-01-20 11:01:53 +00:00
$oReg = new Regression($tabRegY, $this->tabRegX);
return $oReg->TauxProgression($nbAnnees);
}
}