extranet/application/controllers/FinanceController.php

1185 lines
47 KiB
PHP
Raw Normal View History

2011-02-21 08:45:13 +00:00
<?php
2011-04-21 15:04:27 +00:00
require_once ('common/dates.php');
2011-04-26 13:39:19 +00:00
require_once ('Scores/SessionEntreprise.php');
require_once ('Scores/Utilisateur.php');
2011-04-21 15:04:27 +00:00
require_once ('finance/synthese.lib.php');
require_once ('Scores/WsScores.php');
require_once ('ChartDirector/phpchartdir.php');
require_once ('ChartDirector/FinanceChart.php');
2011-04-21 15:04:27 +00:00
2011-05-09 11:43:43 +00:00
/**
* La Classe finance gére les actions concernant la partie element financiés du menu
2011-05-18 12:22:08 +00:00
*
2011-05-09 11:43:43 +00:00
* Les Bilans.
* La Synthese.
* Les Ratios.
* Les Etablissements bancaires.
* Les Liasses fiscales.
* Les cotations en bourses.
2011-05-18 12:22:08 +00:00
*
2011-05-09 11:43:43 +00:00
* @author Damien Lasserre
*
*/
2011-02-21 08:45:13 +00:00
class FinanceController extends Zend_Controller_Action
2011-04-11 14:19:14 +00:00
{
2011-05-09 11:43:43 +00:00
private $ws; // L'objet WSScores pour les requetes.
private $entreprise; // Un stdClass pour quelques info sur la société.
private $dateFunction; // Objet qui gére les dates.
private $imageCachePath; // Chemin des images de graphique en cache.
private $idSC; // Id unique Scores-et-decision ( URL ).
2011-04-19 15:59:50 +00:00
public function init()
{
define('FIRST_POSITION', 0);
define('SECOND_POSITION', 1);
define('THREE_POSITION', 2);
$this->entreprise = new stdClass();
$this->dateFunction = new WDate();
$this->ws = new WsScores();
$entreprise = new SessionEntreprise($this->getRequest()->getParam('siret'), $this->getRequest()->getParam('id'));
2011-05-18 15:10:54 +00:00
$this->entreprise->id = $entreprise->getId();
$this->entreprise->nom = $entreprise->getRaisonSociale();
$this->entreprise->siret = $this->getRequest()->getParam('siret');
2011-05-04 14:18:22 +00:00
$this->entreprise->siren = substr($this->entreprise->siret,0,9);
$this->entreprise->naf = $entreprise->getNaf();
$this->imageCachePath = APPLICATION_PATH. '/../cache/pages/imgcache/';
2011-05-18 15:10:54 +00:00
2011-05-04 14:18:22 +00:00
$this->entreprise->siren = substr($this->getRequest()->getParam('siret'), 0, 9);
$this->view->assign('isChecked', 'checked="ckecket"');
$this->view->assign('isNotChecked', 'false');
$this->view->assign('dateFunction', $this->dateFunction);
$this->view->headLink()
->appendStylesheet('/themes/default/styles/finance.css', 'all');
$this->view->headScript()
2011-05-18 12:22:08 +00:00
->appendFile('/themes/default/scripts/finance.js', 'text/javascript');
2011-04-19 15:59:50 +00:00
}
/* --------------------------------------------------------------------------------------------------- */
/* Gestion de la synthése avec les graphiques */
/* ----------------------------------------------------------------------------------------------------*/
2011-04-19 15:59:50 +00:00
/**
2011-05-06 15:26:56 +00:00
* cette fonction gére l'affichage des données pour la synthése avec les différents graphiques.
* Il est possible de rajouter des champs dans le tableau bilanReference en respectant la synthaxe.
*/
2011-04-19 15:59:50 +00:00
public function syntheseAction()
2011-05-04 14:18:22 +00:00
{
$bilanN = array();
$bilanReference = array('r5' => array('evolution' => 'r6' , 'unite' => 'EUR', 'operateur' => 1000, 'name' => 'CHIFFRE D\'AFFAIRES'),
'r7' => array('evolution' => 'r8' , 'unite' => 'EUR', 'operateur' => 1000, 'name' => 'RESULTAT COURANT AVANT IMPOTS'),
'r10' => array('evolution' => 'r11' , 'unite' => 'EUR', 'operateur' => 1000, 'name' => 'RESULTAT NET'),
'r18' => array('evolution' => 'r19' , 'unite' => 'EUR', 'operateur' => 1000, 'name' => 'FONDS PROPRES'),
'r22' => array('evolution' => 'r23' , 'unite' => 'EUR', 'operateur' => 1000, 'name' => 'TOTAL BILAN'),
'r231' => array('evolution' => 'r235', 'unite' => 'EUR', 'operateur' => 1000, 'name' => 'FONDS DE ROULEMENT'),
'r232' => array('evolution' => 'r236', 'unite' => 'EUR', 'operateur' => 1000, 'name' => 'BESOIN EN FONDS DE ROULEMENT'),
'r249' => array('evolution' => 'r254', 'unite' => 'EUR', 'operateur' => 1000, 'name' => 'TRESORERIE'),
'r24' => array('evolution' => 'r24' , 'unite' => 'Pers.', 'operateur' => 1, 'name' => 'EFFECTIF')
);
$request = $this->getRequest();
$synthese = $this->ws->getRatios(substr($request->getParam('siret'), 0, 9), 'synthese');
2011-04-19 15:59:50 +00:00
foreach ($synthese->BilansInfos->item as $item) {
if ($item->typeBilan == self::getTypeSynthese()) {
foreach ($item->RatiosEntrep->item as $RatiosEntrep) {
foreach ($bilanReference as $id => $params) {
if ($RatiosEntrep->id == $id) {
$bilanN[$id]['name'] = $params['name'];
$bilanN[$id]['unite'] = $params['unite'];
if (count($bilanN[$id]['item']) <= 2) {
if (is_numeric($RatiosEntrep->val))
$valeur = number_format(($RatiosEntrep->val/$params['operateur']), 0, '', ' ');
$bilanN[$id]['item'][$item->dateCloture]['ValEntrep'] = $valeur;
}
if (!self::checkIfImageExist(self::getTypeSynthese().'-'.$id))
self::createGraphiqueSynthes($id, $synthese, self::getTypeSynthese());
}
}
}
foreach ($item->RatiosEntrepEvol->item as $RatiosEntrepEvol) {
foreach ($bilanReference as $id => $params) {
if ($RatiosEntrepEvol->id == $params['evolution']) {
if (array_key_exists($item->dateCloture, $bilanN[$id]['item']))
$bilanN[$id]['item'][$item->dateCloture]['ValEntrepEvol'] = $RatiosEntrepEvol->val;
}
}
2011-05-04 14:18:22 +00:00
}
2011-04-21 15:04:27 +00:00
}
}
foreach ($bilanN as $id => $val)
ksort($bilanN[$id]['item']);
if ($this->getRequest()->isPost())
$typeBilan = $this->getRequest()->getParam('typeBilan');
else
$typeBilan = 'N';
$this->view->assign('typeBilan', $typeBilan);
$this->view->assign('raisonSociale', $this->entreprise->nom);
2011-05-04 14:18:22 +00:00
$this->view->assign('siret', $this->entreprise->siret);
$this->view->assign('siren', $this->entreprise->siren);
$this->view->assign('synthese', $bilanN);
$this->view->assign('nameForGraphique', $bilanReference);
2011-05-09 11:43:43 +00:00
self::analyseSyntheseGraphique($synthese->BilansInfos->item);
}
/**
* Permet de determiner le type de bilan choise
* par default c'est le type N
2011-05-04 14:18:22 +00:00
*
*/
protected function getTypeSynthese()
{
$typeBilan = $this->getRequest()->getParam('typeBilan');
switch($this->getRequest()->getParam('typeBilan')) {
case 'C':
return ($typeBilan);
case 'N':
return ($typeBilan);
default:
return ('N');
}
return ('N');
}
/**
* Création des elements servant au graphique les donnée entreprise sur toutes les années.
2011-05-04 14:18:22 +00:00
*
* @param L'objet $synthese
* @param id courrent $id
* @param l'adresse du label $labelX
* @param le type de bilan C/N $type
*/
protected function createAbscisseSynthese($synthese, $id, &$labelX, $type)
{
$dataX1 = array();
foreach ($synthese->BilansInfos->item as $item) {
if ($item->typeBilan == $type) {
$labelX[] = substr($item->dateCloture, 0, 4);
foreach ($item->RatiosEntrep->item as $RatiosEntrep) {
if ($RatiosEntrep->id == $id) {
if (is_numeric($RatiosEntrep->val))
2011-05-04 14:18:22 +00:00
$dataX1[] = ($RatiosEntrep->val / 1000);
}
}
2011-05-04 14:18:22 +00:00
}
}
$labelX = array_reverse($labelX);
$dataX1 = array_reverse($dataX1);
return ($dataX1);
}
/**
* Création des graphiques pour chaque lignes de la synthése.
2011-05-04 14:18:22 +00:00
*
* @param id courrent $id
* @param l'objet $synthese
* @param le type de bilan C/N $type
*/
protected function createGraphiqueSynthes($id, $synthese, $type)
{
$labelX = array();
$labelY = array();
2011-05-04 14:18:22 +00:00
$file = $id.'.png';
$dataX1 = self::createAbscisseSynthese($synthese,$id, $labelX, $type);
$c = new XYChart(350, 250);
$c->setPlotArea(55, 10, 280, 200);
$c->yAxis->setTitle('Keuros');
$c->xAxis->setTitle("Années");
$c->xAxis->setWidth(2);
$c->yAxis->setWidth(2);
$legendObj = $c->addLegend(50, 10, false, "times.ttf", 9);
$legendObj->setBackground(Transparent);
$c->addLineLayer($dataX1, 0xff0000, "Entreprise");
$c->yAxis->setLabels($labelY);
$c->yAxis->setLabelStep(10);
$c->xAxis->setLabels($labelX);
$c->makeChart($this->imageCachePath.$type.'-'.$file);
}
/**
* En cours de developement
2011-05-04 14:18:22 +00:00
*
* @param unknown_type $id
* @param unknown_type $dataX
* @param unknown_type $synthese
*/
protected function getVal($id, &$dataX, $synthese)
{
$dataX = array();
foreach ($synthese->BilansInfos->item as $element){
foreach($element->RatiosEntrepEvol->item as $RatiosEntrepEvol){
if ($RatiosEntrepEvol->id == $id) {
$dataX[] = ($RatiosEntrepEvol->val == 'NS')?0:$RatiosEntrepEvol->val;
}
}
}
}
2011-05-09 11:43:43 +00:00
private function getValFromKey($stdClass, $key)
{
foreach($stdClass as $element) {
if ($element->id == $key)
return ($element->val/1000);
}
}
/**
* En cours de developement
2011-05-04 14:18:22 +00:00
*
* @param unknown_type $synthese
* @param unknown_type $bilanReference
*/
2011-05-09 11:43:43 +00:00
protected function analyseSyntheseGraphique($data)
{
2011-05-09 11:43:43 +00:00
$filename = "test.png";
2011-05-09 11:43:43 +00:00
//Tri des données par date et par ordre croissant
foreach ($data as $key => $row) { $date[$key] = $row->dateCloture; }
array_multisort($date, SORT_ASC, $data);
//Définition des valeurs pour le graph
$dataBFR = array();
$dataFR = array();
$dataCA = array();
$BFR = array();
$i=0;
$nbAnnees = 0;
//Parcourir les années
2011-05-18 12:22:08 +00:00
foreach($data as $item) {
2011-05-09 11:43:43 +00:00
$anneeFin = substr($item->dateCloture,0,4);
$moisFin = substr($item->dateCloture,4,2);
$jourFin = substr($item->dateCloture,6,2);
//Calcul de la date de début
$dateDebut = date("Ymd", mktime(0, 0, 0, $moisFin-$item->duree, $jourFin, $anneeFin));
$anneeDebut = substr($dateDebut,0,4);
$moisDebut = substr($dateDebut,4,2);
$jourDebut = substr($dateDebut,6,2);
//Affectation des abscisses
if(count($dataBFR['x']) < 5) {
2011-05-09 11:43:43 +00:00
$dataBFR['x'][$i] = $dataFR['x'][$i] = $dataCA['x'][$i] = $dataEBE['x'][$i] = chartTime((int)$anneeDebut, (int)$moisDebut, (int)$jourDebut);
$dataBFR['x'][$i+1] = $dataFR['x'][$i+1] = $dataCA['x'][$i+1] = $dataEBE['x'][$i+1] = chartTime((int)$anneeFin, (int)$moisFin, (int)$jourFin);
}
//Affectation des ordonnées
if(count($dataBFR['y']) < 5)
$dataBFR['y'][$i] = $dataBFR['y'][$i+1] = self::getValFromKey($item->RatiosEntrep->item, 'r236');
if(count($dataFR['y']) < 5)
$dataFR['y'][$i] = $dataFR['y'][$i+1] = self::getValFromKey($item->RatiosEntrep->item, 'r235');
2011-05-18 12:22:08 +00:00
if(count($dataCA['y']) < 5)
2011-05-09 11:43:43 +00:00
$dataCA['y'][$i] = $dataCA['y'][$i+1] = self::getValFromKey($item->RatiosEntrep->item, 'r6');
2011-05-18 12:22:08 +00:00
if(count($dataEBE['y']) < 5)
2011-05-09 11:43:43 +00:00
$dataEBE['y'][$i] = $dataEBE['y'][$i+1] = self::getValFromKey($item->RatiosEntrep->item, 'r146');
$i+=2;
}
$c = new XYChart(660, 350, 0xcccccc, 0x000000, 1);
$c->addTitle("Synthèse *", "timesbi.ttf", 15, 0x000000);
$c->addText(60, 320, "* Elements financier rapportés à 12 mois" );
$c->setPlotArea(60, 80, 500, 200, 0xffffff, -1, -1, 0xcccccc, 0xcccccc);
$c->yAxis->setTitle("KEUROS","timesbi.ttf",10);
$c->xAxis->setTitle( "<*block,valign=absmiddle*>Années<*/*>");
$c->xAxis->setWidth(2);
$c->yAxis->setWidth(2);
// Add a legend box at (55, 32) (top of the chart) with horizontal layout. Use 9 pts
// Arial Bold font. Set the background and border color to Transparent.
$legendObj = $c->addLegend(55, 30, false, "times.ttf", 9);
$legendObj->setBackground(Transparent);
// Add a blue (0000ff) step line layer to the chart and set the line width to 2 pixels
$layer1 = $c->addStepLineLayer($dataFR['y'], 0x0000ff, "FONDS DE ROULEMENT");
$layer1->setXData($dataFR['x']);
$layer1->setLineWidth(2);
// Add a red (ff0000) step line layer to the chart and set the line width to 2 pixels
$layer0 = $c->addStepLineLayer($dataBFR['y'], 0xff0000, "BESOIN EN FONDS DE ROULEMENT");
$layer0->setXData($dataBFR['x']);
$layer0->setLineWidth(2);
// Add a green (00ff00) step line layer to the chart and set the line width to 2 pixels
$layer2 = $c->addStepLineLayer($dataCA['y'], 0x00ff00, "CHIFFRE D'AFFAIRES");
$layer2->setXData($dataCA['x']);
$layer2->setLineWidth(2);
// Add a black (000000) step line layer style dash to the chart and set the line width to 2 pixels
$layer3 = $c->addStepLineLayer($dataEBE['y'], $c->dashLineColor(0x000000, DashLine), "EXCEDENT BRUT D'EXPLOITATION");
$layer3->setXData($dataEBE['x']);
$layer3->setLineWidth(2);
# If the FR line gets above the BFR line, color to area between the lines red (ff0000)
$c->addInterLineLayer($layer0->getLine(0), $layer1->getLine(0), 0xff0000, Transparent);
# If the FR line gets below the lower BFR line, color to area between the lines light green (8099ff99)
$c->addInterLineLayer($layer0->getLine(0), $layer1->getLine(0), Transparent, 0x8044ff44);
if($c->makeChart($this->imageCachePath.$filename) === TRUE){
$return = '<img src="./fichier/imgcache/'.$filename.'"/>';
}else{
$return = 'Impossible de générer le graphique';
}
return $return;
}
/* --------------------------------------------------------------------------------------------------- */
/* Gestion des bilans ACTIF/PASSIF/CR */
/* ----------------------------------------------------------------------------------------------------*/
2011-05-06 15:26:56 +00:00
/**
* Construit les elements des bilan en particulié les valeurs.
2011-05-18 12:22:08 +00:00
*
2011-05-06 15:26:56 +00:00
* @param objet $bilan
* @param le tableau de reference $tableauDeReference
* @param type de bilan $type
* @param date $date
* @param duree 12Mois/... $duree
* @param consolidé ou Normale (formulaire) $typebilan
*/
protected function constructElementForBilan($bilan, $tableauDeReference, &$type, &$date, &$duree, $typebilan)
2011-05-04 14:18:22 +00:00
{
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) {
2011-05-04 14:18:22 +00:00
if ($item->id == $id) {
if (count($type[$id]['item']) < 5) {
if ($item->val > 0) {
$type[$id]['item'][$element->dateCloture] = $item->val / 1000;
}
2011-05-04 14:18:22 +00:00
else
$type[$id]['item'][$element->dateCloture] = 'NS';
}
}
2011-05-04 14:18:22 +00:00
}
}
}
}
foreach ($type as $id => $valeur) {
$type[$id]['item'] = array_reverse($valeur['item']);
}
$date = array_reverse($date);
2011-04-19 15:59:50 +00:00
}
2011-04-11 14:19:14 +00:00
2011-05-06 15:26:56 +00:00
/**
* Fonction qui affiche les bilan (actif, passif, SIG).
* Le principe est d'utiliser le mapping de données.
2011-05-18 12:22:08 +00:00
*
2011-05-06 15:26:56 +00:00
*/
public function bilanAction()
2011-04-19 15:59:50 +00:00
{
$actif = array();
$passif = array();
$SIG = array();
$date = array();
$duree = EOF;
$request = $this->getRequest();
$listeBilan = array('actif', 'passif', 'sig');
2011-05-13 16:33:21 +00:00
$referenceActif = array('r59' => 'Actif Immobilisé Net','r51' => 'Incorporelles',
'r52' => 'Corporelles', 'r53' => 'Financières',
'r69' => 'Actif Circulant Net', 'r60' => 'Stock et encours',
'r61' => 'Créances Clients', 'r62' => 'Autres Créances',
'r63' => 'Trésorerie Active', 'r22' => 'TOTAL ACTIF'
);
$referencePassif = array('r79' => 'Ressources Propres', 'r70' => 'Fonds Propres',
'r71' => 'Provisions Risques', 'r72' => 'Comptes Courants',
'r90' => 'Ressources Externes', 'r83' => 'Dettes Financières',
'r84' => 'Dettes Fournisseurs', 'r85' => 'Dettes Fiscales',
'r86' => 'Autres Dettes', 'r87' => 'Trésorerie Passive',
'r22' => 'TOTAL PASSIF'
);
$referenceSIG = array('r101' => 'CHIFFRE D\'AFFAIRES HORS TAXE', 'r102' => '-Achat de marchandises, de matières premières',
2011-05-04 14:18:22 +00:00
'r110' => 'MARGE COMMERCIALE', 'r111' => '+Production vendue',
2011-05-18 12:22:08 +00:00
'r112' => '+Production immobilisée et stockée',
2011-05-04 14:18:22 +00:00
'r120' => 'PRODUCTION DE L\'EXERCICE',
'r121' => 'Variation de stock de marchandises et matières premières',
2011-05-04 14:18:22 +00:00
'r122' => 'MARGE BRUTE',
'r123' => '-Autres charges externes',
'r130' => 'VALEUR AJOUTÉE', 'r132' => 'Charges de personnel',
'r133' => '-Impôts, taxes & versements assimilés', 'r131' => '+Subventions d\'exploitation',
'r140' => 'EXCÉDENT BRUT D\'EXPLOITATION (EBE)', 'r141' => '+Autres produits d\'exploitation',
'r142' => '-Autres charges d\'exploitation', 'r143' => '+Reprise sur dotations & transferts de charges',
'r144' => '+70% Loyer de crédit bail', 'r145' => '-Dotations d\'exploitation & provisions d\'exploitation',
'r150' => 'RÉSULTAT D\'EXPLOITATION', 'r151' => '+Produits financiers',
'r152' => '+30% Loyer de crédit bail', 'r153' => '+Charges financières',
'r170' => 'RÉSULTAT COURANT AVANT IMPOTS', 'r171' => '+Produits exceptionnels',
'r172' => '-Charges exceptionnelles', 'r181' => '-Impôts sur les bénéfices',
2011-05-04 14:18:22 +00:00
'r182' => '-Participation salariale',
'r199' => 'RÉSULTAT NET'
);
$bilan = array();
2011-05-18 12:22:08 +00:00
$typeBilan = ($this->getRequest()->isPost())?$this->getRequest()->getParam('typeBilan'):'N';
$bilan = $this->ws->getRatios($this->entreprise->siren, 'ratios');
self::constructElementForBilan($bilan, $referenceActif, $actif, $date, $duree, $typeBilan);
self::constructElementForBilan($bilan, $referencePassif, $passif, $date, $duree, $typeBilan);
self::constructElementForBilan($bilan, $referenceSIG, $SIG, $date, $duree, $typeBilan);
2011-05-13 16:33:21 +00:00
$this->view->assign('referenceactif', $referenceActif);
$this->view->assign('referencepassif', $referencePassif);
$this->view->assign('referencesig', $referenceSIG);
2011-05-13 16:33:21 +00:00
$this->view->assign('typeBilan', $typeBilan);
$this->view->assign('typeBilan', $typeBilan);
$this->view->assign('siren', $this->entreprise->siren);
$this->view->assign('raisonSociale', $this->entreprise->nom);
$this->view->assign('listeBilan', $listeBilan);
$this->view->assign('date', $date);
$this->view->assign('duree', $duree);
$this->view->assign('actif', $actif);
$this->view->assign('passif', $passif);
$this->view->assign('sig', $SIG);
}
private function formatElementForGraphiqueBilan($bilan)
{
$tb = array();
foreach ($bilan as $id => $item) {
foreach($bilan[$id]['item'] as $element) {
$tb[] = round($element*100/$bilan[$id]['item'][key($bilan['r22']['item'])],2);
}
}
return ($tb);
}
2011-05-19 15:48:36 +00:00
protected function selectTitleForGraphique($title) {
switch ($title) {
case 'actif':
return ('Composition de l\'actif');
case 'passif':
return ('Composition du passif');
case 'sig':
return ('');
}
}
protected function makeBigGraphiqueBilan($type, $data, $siren, $annee, $i, $unite)
{
$filename = $siren;
$file = $i.'-'.$filename.'-graph-actif.png';
$w = 660;
$h = 243;
$x = round($w/2);
$y = round($h/2);
$radius = 90;
$c = new PieChart($w, $h);
$labels = array('Immo. incorporelles', 'Immo. corporelles',
'Immo. financières', 'Stock et encours',
'Créances Clients', 'Autres créances',
'Trésorerie Active');
$t = $c->setLabelStyle();
$t->setBackground(SameAsMainColor, Transparent, glassEffect());
$t->setRoundedCorners(5);
$c->setLineColor(SameAsMainColor, 0x000000);
$c->setStartAngle(135);
$c->setLabelFormat("<*block,valign=absmiddle*>{label} <*font=timesbi.ttf,size=0*>({percent|0}%)");
$c->setData($data, $labels);
$c->set3D(20);
$chart1URL = $c->makeSession("chart1"); // Gère le cache immédiat de la page ( F5 ).
$imageMap = $c->getHTMLImageMap("", "", "name='{label}' title='<b>{label}</b> ".$annee."<br />{value|0} ".$unite."' class='detailsgraphique'");
$c->makeChart($this->imageCachePath.$file);
$parametres = new stdClass();
$parametres->file = $file;
$parametres->chart1URL = $chart1URL;
$parametres->imageMap = $imageMap;
$parametres->i = $i;
return ($parametres);
}
public function actifgraphAction()
{
$type = 'actif';
$data = $this->getRequest()->getParam('data');
$siren = $this->getRequest()->getParam('siren');
$annee = $this->getRequest()->getParam('annee');
$i = $this->getRequest()->getParam('i');
$parametres = self::makeBigGraphiqueBilan($type, $data, $siren, $annee, $i, 'K.euros');
$this->view->assign('file', $parametres->file);
$this->view->assign('chart1URL', $parametres->chart1URL);
$this->view->assign('imageMap', $parametres->imageMap);
$this->view->assign('i', $parametres->i);
$this->render('printgraphbilan');
}
public function passifgraphAction()
{
$data = $this->getRequest()->getParam('data');
$siren = $this->getRequest()->getParam('siren');
$annee = $this->getRequest()->getParam('annee');
$i = $this->getRequest()->getParam('i');
$filename = $siren;
$file = $i.'-'.$filename.'-graph-passif.png';
$w = 660;
$h = 243;
$x = round($w/2);
$y = round($h/2);
$radius = 90;
$c = new PieChart($w, $h);
$labels = array('Fonds propres',
'Provisions Risques',
'Compte Courant',
'Dettes Financières',
'Dettes Fournisseurs',
'Dettes fiscales',
'Autres Dettes',
'Trésorerie Passive'
);
$textBoxObj = $c->addTitle("Composition du passif", "timesbi.ttf", 15);
$c->setPieSize($x, $y, $radius);
$c->setLabelLayout(SideLayout);
$t = $c->setLabelStyle();
$t->setBackground(SameAsMainColor, Transparent, glassEffect());
$t->setRoundedCorners(5);
# Set the border color of the sector the same color as the fill color. Set the line # color of the join line to black (0x0)
$c->setLineColor(SameAsMainColor, 0x000000);
$c->setStartAngle(135);
$c->setLabelFormat("<*block,valign=absmiddle*>{label} <*font=timesbi.ttf,size=0*>({percent|0}%)");
$c->setData($data, $labels);
$c->set3D(20);
$chart1URL = $c->makeSession("chart1");
$imageMap = $c->getHTMLImageMap("", "", "name='{label}' title='<b>{label}</b><br />{value|0} K.Euros' class='detailsgraphique'");
$c->makeChart($this->imageCachePath.$file);
$this->view->assign('file', $file);
$this->view->assign('chart1URL', $chart1URL);
$this->view->assign('imageMap', $imageMap);
$this->view->assign('i', '2'.$i);
$this->render('printgraphbilan');
}
2011-05-19 15:48:36 +00:00
public function siggraphAction()
{
$data = $this->getRequest()->getParam('data');
$siren = $this->getRequest()->getParam('siren');
$annee = $this->getRequest()->getParam('annee');
$i = $this->getRequest()->getParam('i');
$filename = $siren;
$file = $i.'-'.$filename.'-graph-sig.png';
$w = 660;
$h = 243;
$x = round($w/2);
$y = round($h/2);
$radius = 90;
$c = new PieChart($w, $h);
$labels = array('Achats de marchandises.',
'Autres achats externes',
'Charges de fonctionnement',
'Amortissement et provisions',
'Perte financière',
'Impôts sociétés',
'RÉSULTAT NET',
);
$textBoxObj = $c->addTitle("Solde intermédiaire de gestion", "timesbi.ttf", 15);
$c->setPieSize($x, $y, $radius);
$c->setLabelLayout(SideLayout);
$t = $c->setLabelStyle();
$t->setBackground(SameAsMainColor, Transparent, glassEffect());
$t->setRoundedCorners(5);
# Set the border color of the sector the same color as the fill color. Set the line # color of the join line to black (0x0)
$c->setLineColor(SameAsMainColor, 0x000000);
$c->setStartAngle(135);
$c->setLabelFormat("<*block,valign=absmiddle*>{label} <*font=timesbi.ttf,size=0*>({percent|0}%)");
$c->setData($data, $labels);
$c->set3D(20);
$chart1URL = $c->makeSession("chart1");
$imageMap = $c->getHTMLImageMap("", "", "name='{label}' title='<b>{label}</b><br />{value|0} %' class='detailsgraphique'");
$c->makeChart('../cache/pages/imgcache/'.$file);
$c->makeChart($this->imageCachePath.$file);
$this->view->assign('file', $file);
$this->view->assign('chart1URL', $chart1URL);
$this->view->assign('imageMap', $imageMap);
$this->view->assign('i', '3'.$i);
$this->render('printgraphbilan');
}
/* --------------------------------------------------------------------------------------------------- */
/* Gestion des ratios avec les graphiques */
/* ----------------------------------------------------------------------------------------------------*/
/**
* Permet de formater correctement les données.
*
* @param type d'unite $unite
* @param la valeur a transcrire $valeur
*/
protected function parseUnite($unite, $valeur)
{
switch ($unite)
{
case 'EUR':
return (number_format((round($valeur)/1000), 0, '', ' '));
2011-05-09 11:43:43 +00:00
case '%' :
return (round($valeur));
case 'Jours':
return ($valeur);
default:
return ($valeur);
}
}
/**
* Permet de determiner si ont crée l'image ou s'il elle existe daja dans une periode de 8 heures MAX.
2011-05-04 14:18:22 +00:00
*
* @param nom de l'image $name
*/
protected function checkIfImageExist($name)
{
$path = APPLICATION_PATH.'/../cache/pages/imgcache/';
if (file_exists($path.$name.'.png')) {
$date = date('Ymdh', filemtime($path.$name.'.png'));
if($date + 8 > date('Ymdh'))
return (false);
else
return (true);
}
return (false);
}
/**
* Cette fonction permet de comparer les donnée entre elles pour determiner l'evolution
* positive ou négative, ( j'ai respecté les consigne apppliqué préalablement sur l'ancien Extranet.
*
* @param Objet $valeurEnt
* @param Objet $valeurSec
* @param string (le signe de comparaison) $compare
*/
protected function compareValeur($valeurEnt, $valeurSec, $compare)
{
$ecart = 1/100;
2011-04-19 15:59:50 +00:00
if( $valeurSec=='NS' || $valeurEnt == 'NS' || $valeurSec==NULL || $valeurEnt==NULL) {
return ('-');
} else if ($compare == '>') {
if (($valeurEnt + $ecart) > $valeurSec) {
$return = '<img src="/themes/default/images/finance/ratios_bon.png" />';
} elseif( ($valeurSec - ($valeurSec * $ecart)) < $valeurEnt && ($valeurSec + ($valeurSec * $ecart)) > $valeurEnt) {
$return = '-';
} else {
$return = '<img src="/themes/default/images/finance/ratios_mauvais.png" />';
}
} else if ($compare == '<') {
if (($valeurEnt + $ecart) > $valeurSec) {
$return = '<img src="/themes/default/images/finance/ratios_bon.png" />';
} elseif( ($valeurSec - ($valeurSec * $ecart)) < $valeurEnt && ($valeurSec + ($valeurSec * $ecart)) > $valeurEnt) {
$return = '-';
} else {
$return = '<img src="/themes/default/images/finance/ratios_mauvais.png" />';
}
}
return ($return);
2011-04-19 15:59:50 +00:00
}
/**
* Permet d'afficher les elements par block avec un titre.
*
* @param Le tableau de reference des ID a afficher $tableau
* @param Le nom du block en traitement $name
* @param Les elements de Ratios $element
* @param L'adresse de la variable $html
* @param l'object ratio $ratios
* @param la date du block $date
*/
protected function printElementRatio($tableau, $name, $element, &$html, $ratios, $date)
{
foreach($tableau[$name] as $row => $val) {
if ($row == $element->id) {
foreach ($ratios->RatiosInfos->item as $item) {
if ($item->id == $element->id) {
foreach ($ratios->RatiosSecteur->item as $Secteur) {
if (substr($date, 0, 4) == $Secteur->annee) {
foreach ($Secteur->liste->item as $liste) {
if ($item->id == $liste->id) {
if (!self::checkIfImageExist($liste->id))
self::createGraphique($ratios, $liste->id, $item->unite, $liste->id);
$html .= '<tr>';
$html .= '<td>'.$item->libelle.'</td>';
$html .= '<td class="right">'.self::parseUnite($item->unite, $element->val).' '.$item->unite.'</td>';
$html .= '<td class="right">'.self::parseUnite($item->unite, $liste->val).' '.$item->unite.'</td>';
$html .= '<td align="center">';
$html .= '<a name="'.$item->libelle.'" class="rTip" rel="'.$this->view->url(array('controller' => 'finance',
'action' => 'printgraph',
'idGraph' => $liste->id.'-'.$this->entreprise->siren.'.png')).'" >'.self::compareValeur($element->val, $liste->val, $val).'</a>';
$html .= '</td>';
$html .= '</tr>';
}
}
}
}
}
}
}
}
}
/**
* Apelle la view avec la balise image, j'ai désactivé le layout pour un affichage spécial.
*/
public function printgraphAction()
{
$this->_helper->layout()->disableLayout();
$filename = $this->getRequest()->getParam('idGraph');
$this->view->assign('filename', $filename);
}
/**
* Permet de mettres les clefs du tableau sous forme indexé pour ChartDirector
* @param array $tableau
*/
protected function initTableau($tableau)
{
$i = 0;
foreach($tableau as $date => $valeur){
$tableau[$i] = $valeur;
unset($tableau[$date]);
$i++;
}
return ($tableau);
}
/**
* Permet de calculer avec les unité fournies ( exemple 1 000 000 = 1 000 000 / 1000 (EUR) )
*
* @param la valeur $valeur
* @param l'unité $unite
*/
protected function setUnite($valeur, $unite)
{
switch ($unite) {
case 'EUR':
return ($valeur = $valeur / 1000);
2011-04-29 10:30:26 +00:00
default:
return ($valeur);
}
}
/**
* Cette fonction permet de créer les abscisses pour les données, en l'ocurence elle gére Entreprise et Secteur
*
* @param le type de courbe $type
* @param l'unité de l'information $unite
* @param l'object ratio $ratio
* @param le tableau a formater $dataX
* @param id de l'element courant $id
* @param l'adresse du tableau de label $labelX
*/
protected function createAbscisse($type, $unite, $ratio, $dataX, $id, &$labelX = null)
{
$i = 0;
if ($type == 'RatiosEntrep') {
foreach ($ratio->BilansInfos->item as $element) {
if ($i >= 5)
break;
if (is_array($labelX))
$labelX[] = substr($element->dateCloture, 0, 4);
foreach ($element->RatiosEntrep->item as $ratioEntre) {
if ($ratioEntre->id == $id) {
$dataX[substr($element->dateCloture, 0, 4)] = self::setUnite($ratioEntre->val, $unite);$i++;
}
}
}
}
if ($type == 'RatiosSecteur') {
foreach ($ratio->RatiosSecteur->item as $element) {
if($i >= 5)
break;
foreach($element->liste->item as $item) {
if ($item->id == $id) {
$dataX[$element->annee] = self::setUnite($item->val, $unite);$i++;
}
}
}
}
if (is_array($labelX))
sort($labelX);
ksort($dataX);
$dataX = self::initTableau($dataX);
return ($dataX);
}
/**
* Cette fonction crée le graphique et le stock dans cache/imgcache.
*
* @param l'objet ratio $ratio
* @param id de l'element courant $id
* @param l'unité courante $unite
* @param l'id qui servira de nom pour l'image $filename
*/
protected function createGraphique($ratio, $id, $unite, $filename)
2011-04-19 15:59:50 +00:00
{
$labelX = array();
$labelY = array();
$dataX1 = array();
$dataX2 = array();
$file = $filename.'-'.$this->entreprise->siren.'.png';
if(file_exists(APPLICATION_PATH.'/../cache/pages/imgcache/'.$file))
$return = '/fichier/imgcache/'.$file;
$dataX1 = self::createAbscisse('RatiosEntrep', $unite, $ratio, $dataX1, $id, $labelX);
$dataX2 = self::createAbscisse('RatiosSecteur', $unite, $ratio, $dataX2, $id);
$c = new XYChart(350, 250);
$c->setPlotArea(55, 10, 280, 200);
$c->yAxis->setTitle($unite);
$c->xAxis->setTitle("Années");
$c->xAxis->setWidth(2);
$c->yAxis->setWidth(2);
$legendObj = $c->addLegend(50, 10, false, "times.ttf", 9);
$legendObj->setBackground(Transparent);
$c->addLineLayer($dataX1, 0x0000ff, "Entreprise");
$c->addLineLayer($dataX2, 0x008C00, "Secteur");
$c->yAxis->setLabels($labelY);
$c->yAxis->setLabelStep(10);
$c->xAxis->setLabels($labelX);
$c->makeChart($this->imageCachePath.$file);
$return = '/fichier/imgcache/'.$file;
return ($return);
2011-04-19 15:59:50 +00:00
}
2011-05-13 16:33:21 +00:00
/**
* Permet de gerer les date pour les switch de formulaire.
2011-05-18 12:22:08 +00:00
*
2011-05-13 16:33:21 +00:00
* @param unknown_type $ratio
* @param unknown_type $type
* @param unknown_type $date
*/
private function getSwitchFormRatios($ratio, $type, $date = false)
2011-05-18 12:22:08 +00:00
{
2011-05-13 16:33:21 +00:00
$change = false;
if(!$date) {
foreach($ratio->BilansInfos->item as $valeur) {
if ($valeur->typeBilan == $type)
return ($valeur);
}
} else {
foreach($ratio->BilansInfos->item as $valeur) {
if ($valeur->typeBilan == $type and $valeur->dateCloture == $date)
return ($valeur);
else
$change = true;
}
}
if($change) {
foreach($ratio->BilansInfos->item as $valeur) {
if ($valeur->typeBilan == $type)
return ($valeur);
2011-05-18 12:22:08 +00:00
}
2011-05-13 16:33:21 +00:00
}
}
/**
* Gestion de l'affichage des ratios.
*/
public function ratiosAction()
{
/**
* Ont ajoute de nouveaux ratios a cette endroit
* @var unknown_type
*/
2011-05-09 11:43:43 +00:00
$tableau = array('EquilibreFinancier' => array('r233' => '>', 'r234' => '>', 'r237' => '>', 'r238' => '>', 'r239' => '>', 'r240' => '>'),
'Profitabilite' => array('r262' => '>', 'r263' => '>', 'r264' => '>', 'r265' => '>', 'r266' => '>'),
'Liquidite' => array('r250' => '>', 'r251' => '>', 'r252' => '>'),
'Endetement' => array('r241' => '<', 'r247' => '<', 'r248' => '<'),
'Productivite' => array('r271' => '>', 'r278' => '<', 'r279' => '<', 'r281' => '<', 'r261' => '>', 'r267' => '>')
);
$tab = array();
$siret = $this->getRequest()->getParam('siret');
$id = $this->getRequest()->getParam('id');
$i = 0;
2011-05-13 16:33:21 +00:00
$i_view = 0;
$listeDate = array();
$request = $this->getRequest();
2011-05-18 12:22:08 +00:00
$html = '';
2011-05-09 11:43:43 +00:00
$ratios = $this->ws->getRatios($this->entreprise->siren, 'ratios');
2011-05-13 16:33:21 +00:00
$type = ($request->isPost())?$request->getParam('typeBilan'):'N';
$date = self::getSwitchFormRatios($ratios, $type, $request->getParam('Date'))->dateCloture;
2011-05-13 16:33:21 +00:00
foreach($ratios->BilansInfos->item as $elements) {
$tab[$elements->dateCloture][$elements->typeBilan] = $elements;
$i++;
}
foreach ($tab as $champDate => $valeur)
$listeDate[] = $champDate;
if (isset($date)) {
if (!empty($date)) {
foreach ($tableau as $name => $valeur) {
$html .= '<tr class="subhead">
<td align="center">'.$name.'</td>
<td>Entreprise</td>
<td>Secteur</td>
<td>Position</td>
</tr>';
foreach ($tab[$date][$type]->RatiosEntrep->item as $element)
self::printElementRatio($tableau, $name, $element, $html, $ratios, $date);
}
}
}
/** Gestion de la vue **/
2011-05-13 16:33:21 +00:00
$this->view->assign('typeBilan', $type);
$this->view->assign('Date', $date);
$this->view->assign('i', $i_view);
$this->view->assign('html', $html);
$this->view->assign('raisonSociale', $this->entreprise->nom);
$this->view->assign('siret', $siret);
$this->view->assign('id', $id);
$this->view->assign('ratios', $tab);
$this->view->assign('naf', $this->entreprise->naf);
}
/* --------------------------------------------------------------------------------------------------- */
/* Gestion des liasses fiscales */
/* ----------------------------------------------------------------------------------------------------*/
2011-05-06 15:26:56 +00:00
/**
* Selectionne les Unité pour l'affichage des valeurs dans les liasses
2011-05-18 12:22:08 +00:00
*
2011-05-06 15:26:56 +00:00
* @param unknown_type $tab
* @param unknown_type $unite
*/
2011-04-26 13:39:19 +00:00
private function selectInUnit($tab, $unite)
{
foreach($tab as $champ => $val) {
if($val == $unite)
return ($champ);
}
return (false);
}
2011-05-18 12:22:08 +00:00
/**
* Export d'une liasse au format XLS
*/
2011-05-18 13:04:29 +00:00
public function liassexlsAction()
{
2011-05-18 13:35:56 +00:00
$this->_helper->layout()->disableLayout();
2011-05-18 13:04:29 +00:00
2011-05-18 13:35:56 +00:00
$request = $this->getRequest();
$unite = $request->getParam('unit', '€');
$type = $request->getParam('type', '');
$date = $request->getParam('date', '');
2011-05-18 13:04:29 +00:00
switch($type) {
case 'C':
case 'N':
$model = 'liasse_2050';
break;
case 'S':
$model = 'liasse_2033';
break;
}
2011-05-18 15:10:54 +00:00
$liasses = $this->ws->getBilan($this->entreprise->siren, $date, $type);
$liasse = array();
$liasse = $liasses->DATE_CLOTURE;
$liasse = $liasses->DATE_CLOTURE_PRE;
$liasse = $liasses->DUREE_MOIS;
$liasse = $liasses->DUREE_MOIS_PRE;
foreach ($liasses->POSTES->item as $element) {
$liasse[$element->id] =$element->val;
}
2011-05-18 13:35:56 +00:00
$path = APPLICATION_PATH . '/../cache/liasse/';
2011-05-18 15:10:54 +00:00
$file = 'liasse-'.$this->entreprise->siren.'-'.$this->entreprise->id.'-'.$type.$date.'.xls';
2011-05-18 13:35:56 +00:00
require_once 'finance/LiasseXLS.php';
2011-05-18 13:04:29 +00:00
$liasse = new LiasseXLS($model);
2011-05-18 15:10:54 +00:00
$liasse->dataModel($this->entreprise->siren, $this->entreprise->nom, $liasse);
2011-05-18 13:04:29 +00:00
$liasse->dataFile($file);
2011-05-18 13:35:56 +00:00
if( file_exists($path.$file) ){
2011-05-18 15:10:54 +00:00
//$client->setLog('liassexls', $siren, 0, '');
2011-05-18 13:35:56 +00:00
$this->view->assign('file', $file);
2011-05-18 13:04:29 +00:00
}
2011-05-18 12:22:08 +00:00
}
2011-05-06 15:26:56 +00:00
/**
2011-05-18 13:04:29 +00:00
* Affichage des liasses.
* @todo :
* ATTENTION LES BILANS SIMPLIFIES ONT ETE RETIRE ALORS QU'IL FAUT LES TRAITER
* NE PAS FAIRE COMME DANS LES RATIOS
2011-05-06 15:26:56 +00:00
*/
2011-04-19 15:59:50 +00:00
public function liasseAction()
{
2011-05-13 16:33:21 +00:00
/** Les ancres pour les liens **/
2011-05-18 13:04:29 +00:00
$ancres = array(
'C' => array('actif', 'passif', 'compteDeResultat'),
'N' => array('actif', 'passif', 'compteDeResultat', 'immobilisations',
'amortissements', 'provisions', 'creancesDettes', 'affectation'),
'A' => array('actif', 'passif', 'compteDeResultat'),
'B' => array('actif', 'passif', 'compteDeResultat')
2011-04-26 13:39:19 +00:00
);
/** La liste des type de bilan existant **/
2011-05-18 15:10:54 +00:00
$liste = array (
2011-05-18 13:04:29 +00:00
'N' => array(),
'S' => array(),
'C' => array(),
'B' => array(),
'A' => array());
2011-04-26 13:39:19 +00:00
/** Le nom des type pour le select */
2011-05-18 15:10:54 +00:00
$type = array (
2011-05-18 13:04:29 +00:00
'A' => 'Assurance',
'B' => 'Banque',
'C' => 'Consolidé',
'N' => ''
);
2011-04-26 13:39:19 +00:00
/** Liste des unités que l'ont proposent **/
2011-05-18 15:10:54 +00:00
$unit = array (
2011-05-18 13:04:29 +00:00
'€' => 1,
'K€' => 1000,
'M€' => 1000000
);
2011-04-26 13:39:19 +00:00
$liasse = array ();
2011-05-13 16:33:21 +00:00
$request = $this->getRequest();
2011-04-26 13:39:19 +00:00
$siret = $this->getRequest()->getParam('siret');
$id = $this->getRequest()->getParam('id');
$listBilan = $this->ws->getListeBilans($this->entreprise->siren);
2011-05-18 13:35:56 +00:00
$date = ($request->isPost())? $request->getParam('date') :
$listBilan->result->item[0]->dateExercice.':'.$listBilan->result->item[0]->typeBilan;
2011-05-13 16:33:21 +00:00
$unite = ($request->isPost())?$request->getParam('unit'):'€';
2011-04-26 13:39:19 +00:00
foreach ($listBilan->result->item as $item)
$liste[$item->typeBilan][] = $item->dateExercice;
2011-05-18 15:10:54 +00:00
/** ont transforme les bilan de type S en N => !!!! ERREUR !!!! **/
2011-05-09 11:43:43 +00:00
$NandS = array_merge($liste['N'], $liste['S']);
2011-04-26 13:39:19 +00:00
$liste['N'] = $NandS;unset($liste['S']);
2011-05-19 15:48:36 +00:00
/**
* Utiliser un système de masque pour mapper les données sur le rapport normal.
* Exemple : DL => 142
*/
2011-04-26 13:39:19 +00:00
if (!empty($date)) {
$dateAndType = explode(':', $date);
2011-05-09 11:43:43 +00:00
$liasses = $this->ws->getBilan($this->entreprise->siren, $dateAndType[0], $dateAndType[1], true);
2011-04-26 13:39:19 +00:00
$this->view->assign('dateCloture', $liasses->DATE_CLOTURE);
$this->view->assign('dateCloturePre', $liasses->DATE_CLOTURE_PRE);
$this->view->assign('dureesMois', $liasses->DUREE_MOIS);
$this->view->assign('dureesMoisPre', $liasses->DUREE_MOIS_PRE);
foreach ($liasses->POSTES->item as $element) {
2011-05-13 16:33:21 +00:00
$liasse[$element->id] =$element->val;
//number_format(($element->val > 0)?$element->val / $unite:$element->val, 0, '', ' ') .' '.self::selectInUnit($unit, $unite);
2011-04-26 13:39:19 +00:00
}
$this->view->assign('date', $dateAndType[0]);
2011-05-19 14:30:08 +00:00
$this->view->assign('champType', $dateAndType[1]);
2011-04-26 13:39:19 +00:00
$this->view->assign('liasse', $liasse);
//Gestion export de la liasse au format XLS
$user = new Utilisateur();
if (in_array($user->getIdClient(), array(1,86))
&& in_array($dateAndType[1],array('C', 'N', 'S')) ) {
$this->view->assign('exportxls', true);
}
2011-04-26 13:39:19 +00:00
}
2011-04-26 13:39:19 +00:00
/** Partie vue **/
$this->view->assign('ancres', $ancres);
$this->view->assign('liste', $liste);
2011-05-18 13:35:56 +00:00
$this->view->assign('raisonSociale', $this->entreprise->nom);
$this->view->assign('siren', $this->entreprise->siren);
2011-04-26 13:39:19 +00:00
$this->view->assign('siret', $siret);
$this->view->assign('id', $id);
$this->view->assign('type', $type);
$this->view->assign('unit', $unit);
2011-04-19 15:59:50 +00:00
}
/* --------------------------------------------------------------------------------------------------- */
/* Gestion des bourses */
/* ----------------------------------------------------------------------------------------------------*/
public function bourseGraphique($filename)
{
$file = $filename.'.png';
2011-05-19 14:30:08 +00:00
$noOfDays = 30;
$extraDays = 30;
2011-05-19 14:30:08 +00:00
$rantable = new RanTable(9, 6, $noOfDays + $extraDays);
$rantable->setDateCol(0, chartTime(2002, 9, 4), 86400, true);
$rantable->setHLOCCols(1, 100, -5, 5);
$rantable->setCol(5, 50000000, 250000000);
$timeStamps = $rantable->getCol(0); // Les date
$highData = $rantable->getCol(1); // les données les plus hautes
$lowData = $rantable->getCol(2); // Les données les plus basses
$openData = $rantable->getCol(3); // Les donnée d'ouverture
$closeData = $rantable->getCol(4); // Les donnée de fermeture
$volData = $rantable->getCol(5); // Volume de data
2011-05-19 14:30:08 +00:00
$c = new FinanceChart(640);
$c->addTitle($this->entreprise->nom);
$c->setData($timeStamps, $highData, $lowData, $openData, $closeData, $volData, $extraDays);
2011-05-19 14:30:08 +00:00
$c->addSlowStochastic(75, 14, 3, 0x006060, 0x606000);
$c->addMainChart(240);
$c->addSimpleMovingAvg(10, 0x663300);
$c->addSimpleMovingAvg(20, 0x9900ff);
$c->addCandleStick(0x00ff00, 0xff0000);
$c->addDonchianChannel(20, 0x9999ff, 0xc06666ff);
$c->addVolBars(75, 0x99ff99, 0xff9999, 0x808080);
$c->addMACD(75, 26, 12, 9, 0x0000ff, 0xff00ff, 0x008000);
$chart1URL = $c->makeSession("chart1");
$imageMap = $c->getHTMLImageMap("", "", "name='' title='{value|0} K.Euros' class='detailsgraphique'");
$c->makeChart($this->imageCachePath.$file);
return ('<img src="/fichier/imgcache/'.$file.'?'.$chart1URL.'" border="1" usemap="#map1"><map name="map1">'.$imageMap.'</map>');
}
2011-04-19 15:59:50 +00:00
2011-05-09 11:43:43 +00:00
/**
* Fonction qui gére la cotation en bourse.
* Enter description here ...
*/
2011-04-19 15:59:50 +00:00
public function bourseAction()
{
$this->view->assign('graphique', self::bourseGraphique('test'));
2011-04-19 15:59:50 +00:00
}
/* --------------------------------------------------------------------------------------------------- */
/* Gestion des etablissements bancaires */
/* ----------------------------------------------------------------------------------------------------*/
2011-05-09 11:43:43 +00:00
/**
* Fonction qui gére les etablissements bancaires.
*/
2011-04-19 15:59:50 +00:00
public function banqueAction()
{
$banque = $this->ws->getBanques($this->entreprise->siren);
$this->view->assign('banques', $banque->result->item);
2011-05-19 14:30:08 +00:00
$this->view->assign('raisonSociale', $this->entreprise->nom);
$this->view->assign('siren', $this->entreprise->siren);
2011-04-19 15:59:50 +00:00
}
2011-04-11 14:19:14 +00:00
}