117 lines
4.3 KiB
PHP
117 lines
4.3 KiB
PHP
<?php
|
|
require_once ('common/dates.php');
|
|
require_once ('finance/synthese.lib.php');
|
|
|
|
/**
|
|
* En cours de DEV ne pas modifier le fichier.
|
|
*
|
|
* @author divx
|
|
*
|
|
*/
|
|
class FinanceController extends Zend_Controller_Action
|
|
{
|
|
private $ws;
|
|
|
|
public function init()
|
|
{
|
|
$this->view->headLink()->appendStylesheet('/themes/default/styles/synthese.css', 'all');
|
|
require_once ('Scores/WsScores.php');
|
|
$this->ws = new WsScores();
|
|
}
|
|
|
|
public function syntheseAction()
|
|
{
|
|
$dateFunction = new WDate();
|
|
$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')
|
|
);
|
|
|
|
$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);
|
|
// echo '<pre>'; print_r($results);exit;
|
|
echo '<pre>';$a = new Synthese($results->BilansInfos, $results->RatiosInfos);exit;
|
|
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);
|
|
$this->view->assign('dateFunction', $dateFunction);
|
|
}
|
|
|
|
public function bilansAction()
|
|
{
|
|
|
|
}
|
|
|
|
public function ratiosAction()
|
|
{
|
|
echo '<pre>';
|
|
//print_r($this->ws->getRatios(substr($this->getRequest()->getParam('siret'), 0, 9), 'ratios'));
|
|
echo '</pre>';
|
|
}
|
|
|
|
public function liasseAction()
|
|
{
|
|
|
|
}
|
|
|
|
public function bourseAction()
|
|
{
|
|
|
|
}
|
|
|
|
public function banqueAction()
|
|
{
|
|
|
|
}
|
|
} |