extranet/library/Finance/Liasse.php
2011-07-08 09:13:28 +00:00

55 lines
1.1 KiB
PHP

<?php
class Liasse
{
protected $postes = array();
protected $info = array();
protected $div;
protected $unit = array (
'E' => 1,
'K' => 1000,
'M' => 1000000,
);
public function __construct($liasse, $unit = 'K')
{
$this->div = $this->unit[$unit];
$this->setData($liasse);
}
protected function setData($data)
{
$this->info = array(
'dateFraicheBilan' => $data->DATE_FRAICHE_BILAN,
'dateCloture' => $data->DATE_CLOTURE,
'dateCloturePre' => $data->DATE_CLOTURE_PRE,
'dureeMois' => $data->DUREE_MOIS,
'dureeMoisPre' => $data->DUREE_MOIS_PRE,
'monnaie' => $data->MONNAIE,
'monnaieOri' => $data->MONNAIE_ORI,
'monnaieLivUnite' => $data->MONNAIE_LIV_UNITE,
'consolide' => $data->CONSOLIDE,
'source' => $data->SOURCE,
);
//Affectaction des postes
foreach ($data->POSTES->item as $element){
$this->postes[$element->id] = $this->dMontant($element->val);
}
}
public function getInfo($key)
{
return $this->info[$key];
}
public function getPostes()
{
return $this->postes;
}
protected function dMontant($montant)
{
return number_format($montant/$this->div, 0, '', ' ');
}
}