extranet/library/Finance/RatiosData.lib.php
Damien LASSERRE bdf5a954db création de la lib de gestion ratiosDatas.
avec les consignes de mickael.

Mise en place de 4 fonctions : 
getRatios..... etc...
2011-06-22 13:00:17 +00:00

56 lines
1.9 KiB
PHP

<?php
Class RatiosDatas
{
protected $ratiosInfos;
protected $bilansInfo;
protected $ratiosEntrep;
protected $ratiosEntrepEvol;
protected $ratiosSecteur;
public function __construct($ratios, $typeDelete = array('S'))
{
foreach ($ratios->RatiosInfos->item as $item) {
$this->ratiosInfos[$item->id] = $item;
}
foreach ($ratios->BilansInfos->item as $item) {
if (self::ignoreType($item->type, $typeDelete)) {
$this->bilansInfo[$item->type.':'.$item->dateCloture] = $item;
foreach ($item->RatiosEntrep->item as $ratios)
$this->ratiosEntrep[$item->type.':'.$item->datecloture][$ratios->id] = $ratios->val;
foreach ($item->ratiosEntrepEvol->item as $ratios)
$this->ratiosEntrepEvol[$item->type.':'.$item->dateCloture][$ratios->id] = $ratios->val;
}
}
foreach ($ratios->RatiosSecteur->item as $item) {
foreach ($item->liste->item as $ratios)
$this->ratiosSecteur[$item->anneee][$ratios->id] = $ratios->val;
}
}
public function getRatiosInfos($id) {
return ($this->ratiosInfos[$id]);
}
public function getRatiosEntrep($type, $dateCloture, $id) {
return ($this->ratiosEntrep[$type.':'.$dateCloture][$id]);
}
public function getRatiosEntrepEvol($type, $dateCloture, $id) {
return ($this->ratiosEntrepEvol[$type.':'.$dateCloture][$id]);
}
public function getRatiosSecteur($annee, $id) {
return ($this->ratiosSecteur[$annee][$id]);
}
public function __toString() {
return ($this->ratiosEntrep);
}
private function ignoreType($type, $typeDelete) {
foreach ($typeDelete as $t) {
if ($t == $type) return (false);
}
return (true);
}
}