dateFunction = new WDate(); $c = Zend_Registry::get('config'); $this->graphique = new Graphique($c->profil->path->pages . '/imgcache/'); $this->siret = $siret; $this->idSC = $idSC; } /** */ public function getRatiosValeur($date, $id, $type, $ratios) { $ratio = self::getRatios($ratios, 'entreprise'); foreach($ratio[$date][$type] as $element) { if ($element->id == $id) return ($element->val); } } public function getRatios($ratios, $RatioType) { $retour = array(); foreach($ratios->BilansInfos->item as $item) { if ($RatioType == 'entreprise') { $retour[$item->dateCloture][$item->typeBilan] = $item->RatiosEntrep->item; } else if($RatioType == 'secteur') { echo ""; } } return ($retour); } public function rsynthese($synthese, $idsReference, &$tabAnnee, &$final) { $OtherFunction = new OtherFunction(); foreach ($synthese->BilansInfos->item as $item) { $annee = substr($item->dateCloture, 0, 4); if( $annee >= substr($synthese->BilansInfos->item[0]->dateCloture, 0, 4)-2) { $tabAnnee[$this->dateFunction->dateT('Ymd', 'd/m/Y', $item->dateCloture)] = $item->duree; foreach ($item->RatiosEntrep->item as $RatiosEntrep) { foreach($idsReference as $id => $elements) { if ($RatiosEntrep->id == $id) { $final[$id.':'.$elements['titre']][$item->dateCloture] = array('Valeur' => $RatiosEntrep->val/1000, 'percent' => $OtherFunction->getReference($RatiosEntrep->val, $elements['total'], $annee, $synthese), 'id' => $id); ksort($final[$id.':'.$elements['titre']]); } } } } } ksort($tabAnnee); } public function synthese($synthese, $bilanReference, $typeBilan, $RatiosGraph) { $OtherFunction = new OtherFunction(); $RatiosGraph = new RatiosGraph($this->siret, $this->idSC); foreach ($synthese->BilansInfos->item as $item) { if ($item->typeBilan == $typeBilan) { foreach ($item->RatiosEntrep->item as $RatiosEntrep) { foreach ($bilanReference as $id => $params) { if ($RatiosEntrep->id == $id) { $bilan[$id]['name'] = $params['name']; $bilan[$id]['unite'] = $params['unite']; $bilan[$id]['commentaires'] = $params['commentaires']; if (count($bilan[$id]['item']) <= 2) { if (is_numeric($RatiosEntrep->val)) $valeur = number_format(($RatiosEntrep->val / $params['operateur']), 0, '', ' '); $bilan[$id]['item'][$item->dateCloture]['ValEntrep'] = $valeur;} $this->graphique->GraphiqueLineXY($RatiosGraph->GraphiqueSyntheseLine($id, $synthese, $item->typeBilan, $OtherFunction->maskNameImg('synthese', $this->siret, array($id,$item->typeBilan))), true); } } } foreach ($item->RatiosEntrepEvol->item as $RatiosEntrepEvol) { foreach ($bilanReference as $id => $params) { if ($RatiosEntrepEvol->id == $params['evolution']) { if (array_key_exists($item->dateCloture, $bilan[$id]['item'])) { $bilan[$id]['item'][$item->dateCloture]['duree'] = $item->duree; $bilan[$id]['item'][$item->dateCloture]['ValEntrepEvol'] = $RatiosEntrepEvol->val; } } } } } } foreach ($bilan as $id => $val) ksort($bilan[$id]['item']); return ($bilan); } public function constructElementForBilan($bilan, $tableauDeReference, &$type, &$date, &$duree, $typebilan) { foreach($bilan->BilansInfos->item as $element) { if($element->typeBilan == $typebilan) { if($duree == EOF) $duree = $element->duree; if (@count($date) < 5) { if(!in_array($element->dateCloture, $date)) $date[] = $element->dateCloture; } foreach($element->RatiosEntrep->item as $item) { foreach($tableauDeReference as $id => $valeur) { if ($item->id == $id) { if (count($type[$id]['item']) < 5) { if ($item->val > 0) { $type[$id]['item'][$element->dateCloture] = $item->val / 1000; } else $type[$id]['item'][$element->dateCloture] = 'NS'; } } } } } } foreach ($type as $id => $valeur) { $type[$id]['item'] = array_reverse($valeur['item']); } $date = array_reverse($date); } public function specialSIG($id, $element, $partial, $count) { $OtherFunction = new OtherFunction(); if($element != 'NS') { if ($id == 'r101') return $OtherFunction->Tb($element, $element) - $OtherFunction->Tb($partial['r122']['item'][$count], $partial['r101']['item'][$count]); else if ($id == 'r122') return $OtherFunction->Tb($element, $partial['r101']['item'][$count]) - $OtherFunction->Tb($partial['r130']['item'][$count], $partial['r101']['item'][$count]); else if ($id == 'r130') return $OtherFunction->Tb($element, $partial['r101']['item'][$count]) - $OtherFunction->Tb($partial['r140']['item'][$count], $partial['r101']['item'][$count]); else if ($id == 'r140') return $OtherFunction->Tb($element, $partial['r101']['item'][$count]) - $OtherFunction->Tb($partial['r150']['item'][$count], $partial['r101']['item'][$count]); else if ($id == 'r150') return $OtherFunction->Tb($element, $partial['r101']['item'][$count]) - $OtherFunction->Tb($partial['r170']['item'][$count], $partial['r101']['item'][$count]); else if ($id == 'r170') return $OtherFunction->Tb($element, $partial['r101']['item'][$count]) - $OtherFunction->Tb($partial['r199']['item'][$count], $partial['r101']['item'][$count]); else if ($id == 'r199') return $OtherFunction->Tb($element, $partial['r101']['item'][$count]); } else return (null); } public function LineBilan(&$tableauBilanGraphique, $helper, $id, $Graphdate, $partial, $reference, $name, $url, $siren, $sig = false) { $i = 0; $this->column = 0; $GraphLine = array(); $OtherFunction = new OtherFunction(); $RatiosGraph = new RatiosGraph($this->siret, $this->idSC); /** Ont enregistre les données (premié temps) **/ foreach($partial[$id]['item'] as $element) { if($element != 'NS'){ $GraphLine[] = $number = $element; }else{$number = 0; $GraphLine[] = 0;}; if($sig) { $result = self::specialSIG($id, $element, $partial, $i); if(is_numeric($result)) $gr[] = ($result < 0)?0:$result; } else if($OtherFunction->createlementForGraphique($id))$gr[] = $number; } ($gr != 0)?$tableauBilanGraphique = $gr:$tableauBilanGraphique = false; /** Ont affiche les données (deuxiéme temps) **/ $html .= '