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');
|
2011-04-21 15:04:27 +00:00
|
|
|
require_once ('finance/synthese.lib.php');
|
2011-04-29 10:28:32 +00:00
|
|
|
require_once ('Scores/WsScores.php');
|
2011-04-29 12:47:09 +00:00
|
|
|
require_once ('ChartDirector/phpchartdir.php');
|
2011-04-21 15:04:27 +00:00
|
|
|
|
2011-02-21 08:45:13 +00:00
|
|
|
class FinanceController extends Zend_Controller_Action
|
2011-04-11 14:19:14 +00:00
|
|
|
{
|
2011-04-19 15:59:50 +00:00
|
|
|
private $ws;
|
2011-04-26 13:39:19 +00:00
|
|
|
private $entreprise;
|
|
|
|
private $dateFunction;
|
2011-04-29 10:28:32 +00:00
|
|
|
private $graphiqueRatio = array();
|
2011-04-19 15:59:50 +00:00
|
|
|
|
|
|
|
public function init()
|
|
|
|
{
|
2011-04-29 10:28:32 +00:00
|
|
|
$this->entreprise = new stdClass();
|
|
|
|
$this->dateFunction = new WDate();
|
|
|
|
$this->ws = new WsScores();
|
|
|
|
$entreprise = new SessionEntreprise($this->getRequest()->getParam('siret'), $this->getRequest()->getParam('id'));
|
|
|
|
$this->entreprise->nom = $entreprise->getRaisonSociale();
|
|
|
|
$this->entreprise->siret = $this->getRequest()->getParam('siret');
|
|
|
|
$this->entreprise->naf = $entreprise->getNaf();
|
|
|
|
|
2011-04-26 13:39:19 +00:00
|
|
|
$this->view->headLink()->appendStylesheet('/themes/default/styles/finance.css', 'all');
|
2011-04-29 10:28:32 +00:00
|
|
|
$this->view->headScript()
|
|
|
|
->appendFile('/themes/default/scripts/finance.js', 'text/javascript');
|
|
|
|
|
2011-04-26 13:39:19 +00:00
|
|
|
$this->view->assign('dateFunction', $this->dateFunction);
|
2011-04-19 15:59:50 +00:00
|
|
|
}
|
2011-04-29 10:28:32 +00:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------------- */
|
|
|
|
/* Gestion de la synthése avec le graphique */
|
2011-04-29 12:47:09 +00:00
|
|
|
/* ----------------------------------------------------------------------------------------------------*/
|
2011-04-19 15:59:50 +00:00
|
|
|
|
|
|
|
public function syntheseAction()
|
|
|
|
{
|
2011-04-26 13:39:19 +00:00
|
|
|
|
2011-04-21 15:04:27 +00:00
|
|
|
$syntheseReference = array();
|
|
|
|
$tabRatio = array(
|
|
|
|
'r5' => array('CHIFFRE D\'AFFAIRES', 1000, ' K€', 'r6'),
|
|
|
|
'r7' => array('RESULTAT COURANT AVANT IMPOTS', 1000, ' K€', 'r8'),
|
|
|
|
'r10' => array('RESULTAT NET', 1000, ' K€', 'r11'),
|
|
|
|
'r18' => array('FONDS PROPRES', 1000, ' K€', 'r19'),
|
|
|
|
'r22' => array('TOTAL BILAN', 1000,' K€', 'r23'),
|
|
|
|
'r231' => array('FONDS DE ROULEMENT', 1000, ' K€', 'r235'),
|
|
|
|
'r232' => array('BESOIN EN FONDS DE ROULEMENT', 1000, ' K€', 'r236'),
|
|
|
|
'r249' => array('TRESORERIE', 1000, ' K€','r254'),
|
|
|
|
'r24' => array('EFFECTIF', 1, ' Pers.', 'r24')
|
2011-04-19 15:59:50 +00:00
|
|
|
);
|
|
|
|
|
2011-04-21 15:04:27 +00:00
|
|
|
$this->view->assign('tabRatio', $tabRatio);
|
|
|
|
$results = $this->ws->getRatios(substr($this->getRequest()->getParam('siret'), 0, 9), 'synthese');
|
|
|
|
$this->view->assign('results', $results);
|
|
|
|
$this->view->assign('siret', $this->getRequest()->getParam('siret'));
|
|
|
|
$this->view->assign('bilanInfo', $results->RatiosInfos->item);
|
|
|
|
foreach ($results->BilansInfos as $items)
|
|
|
|
{
|
|
|
|
foreach ($items as $row) {
|
|
|
|
foreach ($row as $champ => $valeur) {
|
|
|
|
foreach($row->RatiosEntrepEvol as $champRatiosEntrepEvol => $RatiosEntrepEvol) {
|
|
|
|
if ($champ == 'dateCloture') {
|
|
|
|
$date = $valeur;
|
|
|
|
if (!array_key_exists($date, $syntheseReference))
|
|
|
|
$syntheseReference[$date] = array();
|
|
|
|
}
|
|
|
|
if($champ == 'duree')
|
|
|
|
$syntheseReference[$date][$champ] = $valeur;
|
|
|
|
if ($champ == 'typeBilan') {
|
|
|
|
$type = $valeur;
|
|
|
|
$syntheseReference[$date][$type] = array();
|
|
|
|
}
|
|
|
|
if($champ == 'RatiosEntrep') {
|
|
|
|
$rationEntrep = $champ;
|
|
|
|
foreach($tabRatio as $chm => $element) {
|
|
|
|
foreach($valeur->item as $itemElement) {
|
|
|
|
if ($chm == $itemElement->id) {
|
|
|
|
$var = $syntheseReference[$date][$type][$rationEntrep][] = new stdClass();
|
|
|
|
$var->val = number_format($itemElement->val/$element[1], 0, '', ' ') . ' ' .$element[2];
|
|
|
|
$var->label = $element[0];
|
|
|
|
foreach ($RatiosEntrepEvol as $itemRatiosEntrepEvol) {
|
|
|
|
if($itemRatiosEntrepEvol->id == $element[3]) {
|
|
|
|
$var->evol = $itemRatiosEntrepEvol->val;
|
|
|
|
(($itemRatiosEntrepEvol->val != 'NS') ? $var->evol .= ' %' : false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
arsort($syntheseReference);
|
|
|
|
$i = count($syntheseReference);
|
|
|
|
$syntheseReference2 = array_slice($syntheseReference, $i-3, $i, true);
|
|
|
|
$this->view->assign('synthese', $syntheseReference2);
|
2011-04-19 15:59:50 +00:00
|
|
|
}
|
2011-04-11 14:19:14 +00:00
|
|
|
|
2011-04-19 15:59:50 +00:00
|
|
|
public function bilansAction()
|
|
|
|
{
|
2011-04-29 10:28:32 +00:00
|
|
|
/*$bilan = $this->ws->getBilan(substr($this->entreprise->siret, 0, 9), $millesime, $typeBilan, $ref);
|
|
|
|
$this->view->assign('bilan', */
|
|
|
|
}
|
|
|
|
/* --------------------------------------------------------------------------------------------------- */
|
|
|
|
/* Gestion des ratios avec les graphiques */
|
2011-04-29 12:47:09 +00:00
|
|
|
/* ----------------------------------------------------------------------------------------------------*/
|
2011-04-29 10:28:32 +00:00
|
|
|
/**
|
|
|
|
* Permet de formater correctement les données.
|
2011-04-29 12:47:09 +00:00
|
|
|
*
|
2011-04-29 10:28:32 +00:00
|
|
|
* @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, '', ' '));
|
|
|
|
case '%':
|
|
|
|
return (round($valeur));
|
|
|
|
case 'Jours':
|
|
|
|
return ($valeur);
|
|
|
|
default:
|
|
|
|
return ($valeur);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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.
|
2011-04-29 12:47:09 +00:00
|
|
|
*
|
2011-04-29 10:28:32 +00:00
|
|
|
* @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
|
|
|
|
2011-04-29 10:28:32 +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 {
|
2011-04-29 12:47:09 +00:00
|
|
|
$return = '<img src="/themes/default/images/finance/ratios_mauvais.png" />';
|
2011-04-29 10:28:32 +00:00
|
|
|
}
|
|
|
|
} 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 {
|
2011-04-29 12:47:09 +00:00
|
|
|
$return = '<img src="/themes/default/images/finance/ratios_mauvais.png" />';
|
2011-04-29 10:28:32 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return ($return);
|
2011-04-19 15:59:50 +00:00
|
|
|
}
|
2011-04-29 10:28:32 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Permet d'afficher les elements par block avec un titre.
|
2011-04-29 12:47:09 +00:00
|
|
|
*
|
2011-04-29 10:28:32 +00:00
|
|
|
* @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) {
|
|
|
|
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.'.png')).'" href="">'.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) )
|
2011-04-29 12:47:09 +00:00
|
|
|
*
|
2011-04-29 10:28:32 +00:00
|
|
|
* @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);
|
2011-04-29 10:28:32 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Cette fonction permet de créer les abscisses pour les données, en l'ocurence elle gére Entreprise et Secteur
|
2011-04-29 12:47:09 +00:00
|
|
|
*
|
2011-04-29 10:28:32 +00:00
|
|
|
* @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);
|
|
|
|
//$dataX[substr($element->dateCloture, 0, 4)] = array();
|
|
|
|
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.
|
2011-04-29 12:47:09 +00:00
|
|
|
*
|
2011-04-29 10:28:32 +00:00
|
|
|
* @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
|
|
|
{
|
2011-04-29 10:28:32 +00:00
|
|
|
$labelX = array();
|
|
|
|
$labelY = array();
|
|
|
|
$dataX1 = array();
|
2011-04-29 12:47:09 +00:00
|
|
|
$dataX2 = array();
|
2011-04-29 10:28:32 +00:00
|
|
|
$path = APPLICATION_PATH. '/../cache/pages/imgcache/';
|
|
|
|
$file = $filename.'.png';
|
|
|
|
$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($path.$file);
|
|
|
|
$return = '/fichier/imgcache/'.$file;
|
|
|
|
|
|
|
|
return ($return);
|
2011-04-19 15:59:50 +00:00
|
|
|
}
|
|
|
|
|
2011-04-29 10:28:32 +00:00
|
|
|
/**
|
|
|
|
* Gestion de l'affichage des ratios.
|
|
|
|
*/
|
|
|
|
public function ratiosAction()
|
2011-04-29 12:47:09 +00:00
|
|
|
{
|
2011-04-29 10:28:32 +00:00
|
|
|
/**
|
|
|
|
* Ont ajoute de nouveaux ratios a cette endroit
|
|
|
|
* @var unknown_type
|
|
|
|
*/
|
|
|
|
$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;
|
|
|
|
$listeDate = array();
|
|
|
|
$request = $this->getRequest();
|
|
|
|
$date = $this->getRequest()->getParam('Date');
|
|
|
|
$type = $this->getRequest()->getParam('typeBilan');
|
|
|
|
$html = '';
|
|
|
|
|
|
|
|
$ratios = $this->ws->getRatios(substr($this->getRequest()->getParam('siret'), 0, 9), 'ratios');
|
|
|
|
|
|
|
|
//echo '<pre>';print_r($ratios);echo '</pre>';exit;
|
|
|
|
foreach($ratios->BilansInfos->item as $elements) {
|
|
|
|
//if ($i > 5)break;
|
|
|
|
$tab[$elements->dateCloture][$elements->typeBilan] = $elements;
|
|
|
|
$i++;
|
|
|
|
}
|
|
|
|
|
|
|
|
foreach ($tab as $champDate => $valeur)
|
|
|
|
$listeDate[] = $champDate;
|
|
|
|
|
2011-04-29 12:47:09 +00:00
|
|
|
if (isset($date)) {
|
2011-04-29 10:28:32 +00:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$i = 0;
|
|
|
|
|
|
|
|
/** Gestion de la vue **/
|
|
|
|
$this->view->assign('i', $i);
|
|
|
|
$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-04-29 12:47:09 +00:00
|
|
|
/* ----------------------------------------------------------------------------------------------------*/
|
2011-04-29 10:28:32 +00:00
|
|
|
|
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-04-19 15:59:50 +00:00
|
|
|
public function liasseAction()
|
|
|
|
{
|
2011-04-26 13:39:19 +00:00
|
|
|
$ancres = array('C' => array('actif', 'passif', 'compteDeResultat'),
|
|
|
|
'N' => array('actif', 'passif', 'compteDeResultat', 'immobilisations',
|
|
|
|
'amortissements', 'provisions', 'creancesDettes',
|
|
|
|
'affectation'),
|
2011-04-26 14:26:10 +00:00
|
|
|
'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 **/
|
|
|
|
$liste = array ('N' => array(), 'S' => array(),
|
|
|
|
'C' => array(), 'B' => array(),
|
2011-04-29 12:47:09 +00:00
|
|
|
'A' => array());
|
2011-04-26 13:39:19 +00:00
|
|
|
/** Le nom des type pour le select */
|
|
|
|
$type = array ('A' => 'Assurance', 'B' => 'Banque',
|
|
|
|
'C' => 'Consolidé', 'N' => '');
|
|
|
|
/** Liste des unités que l'ont proposent **/
|
|
|
|
$unit = array ('€' => 1, 'K€' => 1000,
|
|
|
|
'M€' => 1000000);
|
|
|
|
$liasse = array ();
|
|
|
|
$date = $this->getRequest()->getParam('date');
|
|
|
|
$siret = $this->getRequest()->getParam('siret');
|
|
|
|
$id = $this->getRequest()->getParam('id');
|
|
|
|
$listBilan = $this->ws->getListeBilans(substr($this->getRequest()->getParam('siret'), 0, 9));
|
|
|
|
$unite = $this->getRequest()->getParam('unit');
|
|
|
|
|
|
|
|
foreach ($listBilan->result->item as $item)
|
|
|
|
$liste[$item->typeBilan][] = $item->dateExercice;
|
|
|
|
|
2011-04-29 12:47:09 +00:00
|
|
|
/** ont transforme les bilan de type S en N **/
|
2011-04-26 13:39:19 +00:00
|
|
|
$NandS = array_merge($liste['N'], $liste['S']);
|
|
|
|
$liste['N'] = $NandS;unset($liste['S']);
|
|
|
|
|
|
|
|
if (!empty($date)) {
|
|
|
|
$dateAndType = explode(':', $date);
|
|
|
|
$liasses = $this->ws->getBilan(substr($this->getRequest()->getParam('siret'), 0, 9), $dateAndType[0], $dateAndType[1], true);
|
|
|
|
|
|
|
|
$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);
|
|
|
|
|
2011-04-29 12:47:09 +00:00
|
|
|
foreach ($liasses->POSTES->item as $element) {
|
|
|
|
$liasse[$element->id] =
|
2011-04-26 13:39:19 +00:00
|
|
|
number_format(($element->val > 0)?$element->val / $unite:$element->val, 0, '', ' ') .' '.self::selectInUnit($unit, $unite);
|
|
|
|
}
|
|
|
|
$t = explode(':', $date);
|
|
|
|
$this->view->assign('champType', $t[1]);
|
|
|
|
$this->view->assign('liasse', $liasse);
|
|
|
|
}
|
2011-04-29 10:28:32 +00:00
|
|
|
|
2011-04-26 13:39:19 +00:00
|
|
|
/** Partie vue **/
|
|
|
|
$this->view->assign('ancres', $ancres);
|
|
|
|
$this->view->assign('typeFeuille', $typeFeuille);
|
|
|
|
$this->view->assign('liste', $liste);
|
|
|
|
$this->view->assign('nomSociete', $this->entreprise->nom);
|
|
|
|
$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
|
|
|
}
|
2011-04-29 10:28:32 +00:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------------- */
|
|
|
|
/* Gestion des bourses */
|
2011-04-29 12:47:09 +00:00
|
|
|
/* ----------------------------------------------------------------------------------------------------*/
|
2011-04-19 15:59:50 +00:00
|
|
|
|
|
|
|
public function bourseAction()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
2011-04-29 10:28:32 +00:00
|
|
|
|
|
|
|
/* --------------------------------------------------------------------------------------------------- */
|
|
|
|
/* Gestion des etablissements bancaires */
|
2011-04-29 12:47:09 +00:00
|
|
|
/* ----------------------------------------------------------------------------------------------------*/
|
2011-04-19 15:59:50 +00:00
|
|
|
public function banqueAction()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
2011-04-11 14:19:14 +00:00
|
|
|
}
|