Michael RICOIS 5e05e208ec Reintegrate
2016-07-18 11:23:14 +02:00

118 lines
2.2 KiB
PHP

<?php
class Metier_Scores_Projection
{
/**
* Tableau des années de millesime de bilans
*/
public $tabRegX;
/**
* Tableau des années en paramètres
*/
protected $Y;
/**
* + $nbAnnees Projetées
*/
protected $Yaff;
/**
* Taux de projection de n à n+$nbAnnees
*/
protected $PROJECTAUX;
/**
* Coef de corélation linéaire
*/
protected $PROJECCOEF;
public function getY()
{
return $this->Y;
}
public function getYaff()
{
return $this->Yaff;
}
public function getProjecTaux()
{
return $this->PROJECTAUX;
}
public function getProjecCoeff()
{
return $this->PROJECCOEF;
}
/**
* 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;
}
$oReg = new Metier_Scores_Regression($tabRegY, $this->tabRegX);
return $oReg->vCoefCorLin;
}
/**
* 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;
}
$oReg = new Metier_Scores_Regression($tabRegY, $this->tabRegX);
$tab = $oReg->GetProjectionDebut($nbAnnees);
$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);
}
/**
* 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;
}
$oReg = new Metier_Scores_Regression($tabRegY, $this->tabRegX);
return $oReg->TauxProgression($nbAnnees);
}
}