extranet/library/Finance/RatiosData.lib.php

56 lines
1.9 KiB
PHP
Raw Normal View History

2011-06-13 07:08:16 +00:00
<?php
Class RatiosDatas
2011-06-13 07:08:16 +00:00
{
protected $ratiosInfos;
protected $bilansInfo;
protected $ratiosEntrep;
protected $ratiosEntrepEvol;
protected $ratiosSecteur;
2011-06-13 07:08:16 +00:00
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;
}
2011-06-13 07:08:16 +00:00
}
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]);
2011-06-13 07:08:16 +00:00
}
public function getRatiosSecteur($annee, $id) {
return ($this->ratiosSecteur[$annee][$id]);
2011-06-13 07:08:16 +00:00
}
public function __toString() {
return ($this->ratiosEntrep);
2011-06-13 07:08:16 +00:00
}
private function ignoreType($type, $typeDelete) {
foreach ($typeDelete as $t) {
if ($t == $type) return (false);
2011-06-13 07:08:16 +00:00
}
return (true);
2011-06-13 07:08:16 +00:00
}
}