2011-02-21 08:45:13 +00:00
|
|
|
<?php
|
|
|
|
class FinanceController extends Zend_Controller_Action
|
2011-04-11 14:19:14 +00:00
|
|
|
{
|
2011-06-08 15:41:59 +00:00
|
|
|
protected $siret = null;
|
|
|
|
protected $id = 0;
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-04-19 15:59:50 +00:00
|
|
|
public function init()
|
2011-06-22 15:09:06 +00:00
|
|
|
{
|
2011-07-05 14:41:20 +00:00
|
|
|
require_once 'common/dates.php';
|
|
|
|
require_once 'Scores/SessionEntreprise.php';
|
|
|
|
require_once 'Scores/WsScores.php';
|
|
|
|
require_once 'Finance/Liasse.php';
|
|
|
|
require_once 'Finance/RatiosData.php';
|
|
|
|
require_once 'Finance/RatiosGraph.php';
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-07-05 14:41:20 +00:00
|
|
|
$request = $this->getRequest();
|
|
|
|
$this->siret = $request->getParam('siret');
|
|
|
|
$this->id = $request->getParam('id', 0);
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2012-11-20 07:33:06 +00:00
|
|
|
$this->view->headScript()->appendFile('/themes/default/scripts/finance.js', 'text/javascript');
|
2011-04-19 15:59:50 +00:00
|
|
|
}
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-08-19 15:57:51 +00:00
|
|
|
public function indexAction()
|
|
|
|
{
|
2012-05-20 16:31:28 +00:00
|
|
|
$this->_forward('index', 'index');
|
2011-08-19 15:57:51 +00:00
|
|
|
}
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-05-02 15:53:31 +00:00
|
|
|
/**
|
2011-07-05 14:41:20 +00:00
|
|
|
* Affichage de la synthese
|
2011-05-02 15:53:31 +00:00
|
|
|
*/
|
2011-04-19 15:59:50 +00:00
|
|
|
public function syntheseAction()
|
2011-05-04 14:18:22 +00:00
|
|
|
{
|
2012-05-20 16:31:28 +00:00
|
|
|
$user = new Scores_Utilisateur();
|
2011-10-26 10:34:32 +00:00
|
|
|
$session = new SessionEntreprise($this->siret, $this->id);
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-04-29 15:46:59 +00:00
|
|
|
$request = $this->getRequest();
|
2011-07-05 14:41:20 +00:00
|
|
|
$typeBilan = $request->getParam('typeBilan', 'N');
|
|
|
|
$ratio = $request->getParam('ratio', '');
|
|
|
|
$autrePage = $request->getParam('apage');
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-07-05 14:41:20 +00:00
|
|
|
//Récupération des informations
|
2011-06-23 09:14:03 +00:00
|
|
|
if (empty($autrePage)) {
|
|
|
|
$ws = new WsScores();
|
2011-07-05 14:41:20 +00:00
|
|
|
$infos = $ws->getRatios(substr($this->siret, 0, 9), 'synthese');
|
2011-08-19 12:47:24 +00:00
|
|
|
if ($infos === false) $this->_forward('soap', 'error');
|
2011-06-23 09:14:03 +00:00
|
|
|
} else {
|
2011-07-05 14:41:20 +00:00
|
|
|
$infos = $request->getParam('infos');
|
2011-06-23 09:14:03 +00:00
|
|
|
}
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-07-05 14:41:20 +00:00
|
|
|
$tabRatio = array(
|
2011-07-05 15:57:26 +00:00
|
|
|
'r5' => array('evol'=>'r6', 'op' => 1000, 'titre'=>'CHIFFRE D\'AFFAIRES'),
|
|
|
|
'r7' => array('evol'=>'r8', 'op' => 1000, 'titre'=>'RESULTAT COURANT AVANT IMPOTS'),
|
|
|
|
'r10' => array('evol'=>'r11', 'op' => 1000, 'titre'=>'RESULTAT NET'),
|
|
|
|
'r18' => array('evol'=>'r19', 'op' => 1000, 'titre'=>'FONDS PROPRES'),
|
|
|
|
'r22' => array('evol'=>'r23', 'op' => 1000, 'titre'=>'TOTAL BILAN'),
|
|
|
|
'r231' => array('evol'=>'r235', 'op' => 1000, 'titre'=>'FONDS DE ROULEMENT'),
|
|
|
|
'r232' => array('evol'=>'r236', 'op' => 1000, 'titre'=>'BESOIN EN FONDS DE ROULEMENT'),
|
|
|
|
'r249' => array('evol'=>'r254', 'op' => 1000, 'titre'=>'TRESORERIE'),
|
|
|
|
'r24' => array('evol'=>'r24', 'op' => 1, 'titre'=>'EFFECTIF', 'unite' => 1),
|
2011-07-05 14:41:20 +00:00
|
|
|
);
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-07-05 14:41:20 +00:00
|
|
|
$tabRatioGraph = array(
|
|
|
|
0 => array('ratio'=>'r236', 'op' => 1000),
|
|
|
|
1 => array('ratio'=>'r235', 'op' => 1000),
|
|
|
|
2 => array('ratio'=>'r6', 'op' => 1000),
|
|
|
|
3 => array('ratio'=>'r146', 'op' => 1000)
|
|
|
|
);
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-07-05 14:41:20 +00:00
|
|
|
if($ratio!=''){
|
|
|
|
$tabRatio = array( $ratio => $tabRatio[$ratio] );
|
|
|
|
}
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-07-05 14:41:20 +00:00
|
|
|
//Formattage des données
|
2011-07-06 06:49:05 +00:00
|
|
|
$ratiosData = new RatiosData($infos);
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-07-06 06:49:05 +00:00
|
|
|
$nbBilanN = $ratiosData->getNbBilan('N');
|
|
|
|
$nbBilanC = $ratiosData->getNbBilan('C');
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-07-06 06:49:05 +00:00
|
|
|
if ($typeBilan == 'N' && $nbBilanN==0){
|
|
|
|
$typeBilan = 'C';
|
|
|
|
}
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-07-06 06:49:05 +00:00
|
|
|
if ($nbBilanN!=0 || $nbBilanC!=0)
|
|
|
|
{
|
|
|
|
foreach($tabRatio as $idRatio => $valRatio){
|
|
|
|
$tabRatio[$idRatio]['comment'] = $ratiosData->wrapComment($idRatio);
|
|
|
|
}
|
|
|
|
$this->view->assign('tabRatio', $tabRatio);
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-07-06 15:31:24 +00:00
|
|
|
$infosAnnee = $ratiosData->getBilansInfo($typeBilan);
|
2011-07-06 06:49:05 +00:00
|
|
|
$annees = array_keys($infosAnnee);
|
2011-09-20 12:46:00 +00:00
|
|
|
sort($annees);
|
2011-09-14 16:09:24 +00:00
|
|
|
if (count($annees)>1){
|
|
|
|
//Générer les différents graphiques d'évolutions
|
|
|
|
$ratiosGraph = new RatiosGraph($this->siret, $this->id);
|
|
|
|
$tabGraphEvol = array();
|
|
|
|
foreach($tabRatio as $idRatio => $infoRatio){
|
|
|
|
$dataGraphEvol = array();
|
|
|
|
foreach($annees as $annee){
|
|
|
|
$dataGraphEvol[] = array(
|
|
|
|
'date' => $annee,
|
|
|
|
'value' => ($ratiosData->getRatiosEntrep($typeBilan, $annee, $idRatio)!='NS') ?
|
|
|
|
$ratiosData->getRatiosEntrep($typeBilan, $annee, $idRatio)/$infoRatio['op'] : 0
|
|
|
|
);
|
|
|
|
}
|
|
|
|
$tabGraphEvol[$idRatio] = $ratiosGraph->syntheseGraphEvol($dataGraphEvol, $idRatio, $unite);
|
2011-07-06 06:49:05 +00:00
|
|
|
}
|
2012-05-20 16:31:28 +00:00
|
|
|
|
|
|
|
//Générer le graphique de comparaison
|
2011-09-14 15:58:05 +00:00
|
|
|
$dataGraph = array();
|
|
|
|
$i=0;
|
|
|
|
foreach($annees as $annee){
|
|
|
|
$dataGraph[$i]['date'] = $infosAnnee[$annee]->dateCloture;
|
|
|
|
$dataGraph[$i]['duree'] = $infosAnnee[$annee]->duree;
|
|
|
|
foreach($tabRatioGraph as $item){
|
|
|
|
$dataGraph[$i][$item['ratio']] = $ratiosData->getRatiosEntrep($typeBilan, $annee, $item['ratio'])/$item['op'];
|
|
|
|
}
|
|
|
|
$i++;
|
2011-07-06 06:49:05 +00:00
|
|
|
}
|
2011-09-14 15:58:05 +00:00
|
|
|
$graphLineCompare = $ratiosGraph->syntheseGraphLineCompare($dataGraph, $typeBilan);
|
2011-09-14 16:09:24 +00:00
|
|
|
$this->view->assign('graph', true);
|
2011-09-14 15:58:05 +00:00
|
|
|
} else {
|
2012-05-20 16:31:28 +00:00
|
|
|
$this->view->assign('graph', false);
|
2011-07-05 14:41:20 +00:00
|
|
|
}
|
2012-05-20 16:31:28 +00:00
|
|
|
|
|
|
|
|
2011-07-06 06:49:05 +00:00
|
|
|
//On prend les 3 derniers bilans pour l'affichage
|
|
|
|
$nbMaxBilan = 3;
|
|
|
|
rsort($annees);
|
|
|
|
$annees = array_slice($annees, 0, $nbMaxBilan);
|
|
|
|
sort($annees);
|
|
|
|
$tabResult = array();
|
|
|
|
foreach($annees as $annee){
|
|
|
|
$data = array();
|
|
|
|
$dataEvol = array();
|
|
|
|
//Formatter les données
|
|
|
|
foreach($tabRatio as $idRatio => $valRatio){
|
|
|
|
$data[$idRatio] = $ratiosData->dRatio($typeBilan, $annee, $idRatio);
|
|
|
|
$dataEvol[$idRatio] = $ratiosData->dEvol($typeBilan, $annee, $valRatio['evol']);
|
|
|
|
}
|
|
|
|
$tabResult[] = array(
|
|
|
|
'dateCloture' => WDate::dateT('Ymd','d/m/Y',$annee),
|
|
|
|
'duree' => $infosAnnee[$annee]->duree.' Mois',
|
|
|
|
'entrep' => $data,
|
|
|
|
'entrepEvol' => $dataEvol,
|
|
|
|
);
|
2011-07-05 14:41:20 +00:00
|
|
|
}
|
2011-07-06 06:49:05 +00:00
|
|
|
$this->view->assign('tabResult', $tabResult);
|
2011-07-05 14:41:20 +00:00
|
|
|
}
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-07-06 06:49:05 +00:00
|
|
|
$this->view->assign('nbBilanN', $nbBilanN);
|
|
|
|
$this->view->assign('nbBilanC', $nbBilanC);
|
|
|
|
$this->view->assign('typeBilan', $typeBilan);
|
2011-07-05 14:41:20 +00:00
|
|
|
$this->view->assign('raisonSociale', $session->getRaisonSociale());
|
|
|
|
$this->view->assign('id', $this->id);
|
|
|
|
$this->view->assign('siret', $this->siret);
|
|
|
|
$this->view->assign('siren', substr($this->siret, 0, 9));
|
|
|
|
$this->view->assign('AutrePage', $autrePage);
|
2011-08-23 07:33:39 +00:00
|
|
|
$this->view->assign('exportObjet', $infos);
|
2011-05-02 15:53:31 +00:00
|
|
|
}
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-09-05 13:54:04 +00:00
|
|
|
/**
|
|
|
|
* Affichage des graphiques d'évolution (synthese)
|
|
|
|
*/
|
2011-07-05 14:41:20 +00:00
|
|
|
public function synthesegraphevolAction()
|
|
|
|
{
|
|
|
|
$this->_helper->layout()->disableLayout();
|
|
|
|
$this->_helper->viewRenderer->setNoRender(true);
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-07-05 14:41:20 +00:00
|
|
|
$request = $this->getRequest();
|
|
|
|
$ratio = $request->getParam('ratio');
|
2012-11-16 14:12:03 +00:00
|
|
|
$c = Zend_Registry::get('config');
|
|
|
|
$path = $c->profil->path->pages . '/imgcache/';
|
2011-07-05 14:41:20 +00:00
|
|
|
$file = 'syntheseEvol-'.$this->siret.'-'.$this->id.'-'.$ratio.'.png';
|
|
|
|
if (file_exists($path.$file)) {
|
|
|
|
echo '<img src="/fichier/imgcache/'.$file.'" />';
|
|
|
|
} else {
|
|
|
|
echo "Erreur de génération du graphique";
|
|
|
|
}
|
|
|
|
}
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-09-05 13:54:04 +00:00
|
|
|
/**
|
|
|
|
* Affichage du graphique de comparaison (synthese)
|
|
|
|
*/
|
2011-07-05 14:41:20 +00:00
|
|
|
public function synthesegraphcompareAction()
|
2011-05-27 16:07:48 +00:00
|
|
|
{
|
2011-07-05 14:41:20 +00:00
|
|
|
$this->_helper->viewRenderer->setNoRender(true);
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-07-05 14:41:20 +00:00
|
|
|
$request = $this->getRequest();
|
|
|
|
$typeBilan = $request->getParam('typeBilan');
|
2012-11-16 14:12:03 +00:00
|
|
|
$c = Zend_Registry::get('config');
|
|
|
|
$path = $c->profil->path->pages . '/imgcache/';
|
2011-07-05 14:41:20 +00:00
|
|
|
$file = 'synthese-linecompare-'.$this->siret.'-'.$this->id.'-'.$typeBilan.'.png';
|
|
|
|
if (file_exists($path.$file)) {
|
|
|
|
echo '<img src="/fichier/imgcache/'.$file.'" />';
|
|
|
|
} else {
|
|
|
|
echo "Erreur de génération du graphique";
|
|
|
|
}
|
2011-05-27 16:07:48 +00:00
|
|
|
}
|
2012-05-20 16:31:28 +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-07-04 10:13:45 +00:00
|
|
|
* @todo : RatiosData, RatiosGraph
|
2011-05-06 15:26:56 +00:00
|
|
|
*/
|
2011-05-03 15:31:32 +00:00
|
|
|
public function bilanAction()
|
2011-04-19 15:59:50 +00:00
|
|
|
{
|
2012-05-20 16:31:28 +00:00
|
|
|
$user = new Scores_Utilisateur();
|
2011-07-05 14:41:20 +00:00
|
|
|
$request = $this->getRequest();
|
|
|
|
$autrePage = $request->getParam('apage');
|
|
|
|
$typeBilan = $request->getParam('typeBilan', 'N');
|
|
|
|
$entreprise = new SessionEntreprise($this->siret, $this->id);
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-07-05 14:41:20 +00:00
|
|
|
//Récupération des informations
|
2011-06-23 09:14:03 +00:00
|
|
|
if (empty($autrePage)) {
|
|
|
|
$ws = new WsScores();
|
2011-07-05 14:41:20 +00:00
|
|
|
$infos = $ws->getRatios(substr($this->siret, 0, 9), 'ratios');
|
2011-08-19 12:47:24 +00:00
|
|
|
if ($infos === false) $this->_forward('soap', 'error');
|
2011-06-23 09:14:03 +00:00
|
|
|
} else {
|
2011-07-05 14:41:20 +00:00
|
|
|
$infos = $this->getRequest()->getParam('infos');
|
2011-06-23 09:14:03 +00:00
|
|
|
}
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-07-06 06:49:05 +00:00
|
|
|
$ratiosData = new RatiosData($infos);
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-07-06 06:49:05 +00:00
|
|
|
$nbBilanN = $ratiosData->getNbBilan('N');
|
|
|
|
$nbBilanC = $ratiosData->getNbBilan('C');
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-07-06 06:49:05 +00:00
|
|
|
if ($typeBilan == 'N' && $nbBilanN==0){
|
|
|
|
$typeBilan = 'C';
|
|
|
|
}
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-07-06 06:49:05 +00:00
|
|
|
if ($nbBilanN!=0 || $nbBilanC!=0)
|
|
|
|
{
|
2011-07-06 15:31:24 +00:00
|
|
|
$infosAnnee = $ratiosData->getBilansInfo($typeBilan);
|
2011-07-06 06:49:05 +00:00
|
|
|
$annees = array_keys($infosAnnee);
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-07-06 06:49:05 +00:00
|
|
|
$ratiosGraph = new RatiosGraph($this->siret, $this->id);
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-07-06 06:49:05 +00:00
|
|
|
$tabRatioActif = array(
|
|
|
|
'r59' => array( 'titre' => 'Actif Immobilisé Net', 'class' => 'subhead'),
|
|
|
|
'r51' => array( 'titre' => 'Incorporelles', 'class' => ''),
|
|
|
|
'r52' => array( 'titre' => 'Corporelles', 'class' => '' ),
|
|
|
|
'r53' => array( 'titre' => 'Financières', 'class' => '' ),
|
|
|
|
'r69' => array( 'titre' => 'Actif Circulant Net', 'class' => 'subhead' ),
|
|
|
|
'r60' => array( 'titre' => 'Stock et encours', 'class' => '' ),
|
|
|
|
'r61' => array( 'titre' => 'Créances Clients', 'class' => '' ),
|
|
|
|
'r62' => array( 'titre' => 'Autres Créances', 'class' => '' ),
|
|
|
|
'00' => array( 'titre' => '', 'class' => '' ),
|
|
|
|
'r63' => array( 'titre' => 'Trésorerie Active', 'class' => '' ),
|
|
|
|
'r22' => array( 'titre' => 'TOTAL ACTIF', 'class' => 'subhead' ),
|
2011-07-05 14:41:20 +00:00
|
|
|
);
|
2011-07-06 06:49:05 +00:00
|
|
|
$totalRatioActif = 'r22';
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-07-06 06:49:05 +00:00
|
|
|
$tabRatioPassif = array(
|
|
|
|
'r79' => array( 'titre' => 'Ressources Propres', 'class' => 'subhead'),
|
|
|
|
'r70' => array( 'titre' => 'Fonds Propres', 'class' => ''),
|
|
|
|
'r71' => array( 'titre' => 'Provisions Risques', 'class' => ''),
|
|
|
|
'r72' => array( 'titre' => 'Comptes Courants', 'class' => ''),
|
|
|
|
'r90' => array( 'titre' => 'Ressources Externes', 'class' => 'subhead'),
|
|
|
|
'r83' => array( 'titre' => 'Dettes Financières', 'class' => ''),
|
|
|
|
'r84' => array( 'titre' => 'Dettes Fournisseurs', 'class' => ''),
|
|
|
|
'r85' => array( 'titre' => 'Dettes Fiscales', 'class' => ''),
|
|
|
|
'r86' => array( 'titre' => 'Autres Dettes', 'class' => ''),
|
|
|
|
'r87' => array( 'titre' => 'Trésorerie Passive', 'class' => ''),
|
|
|
|
'r22' => array( 'titre' => 'TOTAL PASSIF', 'class' => 'subhead'),
|
|
|
|
);
|
|
|
|
$totalRatioPassif = 'r22';
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-07-06 06:49:05 +00:00
|
|
|
$tabRatioSig = array(
|
|
|
|
'r101' => array( 'titre' => 'CHIFFRE D\'AFFAIRES HORS TAXE', 'op' => '', 'class' => 'subhead'),
|
|
|
|
'r102' => array( 'titre' => 'Achat de marchandises, de matières premières', 'op' => '-', 'class' => ''),
|
|
|
|
'r110' => array( 'titre' => 'MARGE COMMERCIALE', 'op' => '', 'class' => 'subhead'),
|
|
|
|
'r111' => array( 'titre' => 'Production vendue', 'op' => '+', 'class' => ''),
|
|
|
|
'r112' => array( 'titre' => 'Production immobilisée et stockée', 'op' => '+', 'class' => ''),
|
|
|
|
'r120' => array( 'titre' => 'PRODUCTION DE L\'EXERCICE', 'op' => '', 'class' => 'subhead'),
|
|
|
|
'r121' => array( 'titre' => 'Variation de stock de marchandises et matières premières', 'op' => '±', 'class' => ''),
|
|
|
|
'r122' => array( 'titre' => 'MARGE BRUTE', 'op' => '', 'class' => 'subhead'),
|
|
|
|
'r123' => array( 'titre' => 'Autres charges externes', 'op' => '-', 'class' => ''),
|
|
|
|
'r130' => array( 'titre' => 'VALEUR AJOUTÉE', 'op' => '', 'class' => 'subhead'),
|
|
|
|
'r132' => array( 'titre' => 'Charges de personnel', 'op' => '-', 'class' => ''),
|
|
|
|
'r133' => array( 'titre' => 'Impôts, taxes & versements assimilés', 'op' => '-', 'class' => ''),
|
|
|
|
'r131' => array( 'titre' => 'Subventions d\'exploitation', 'op' => '+', 'class' => ''),
|
|
|
|
'r140' => array( 'titre' => 'EXCÉDENT BRUT D\'EXPLOITATION (EBE)', 'op' => '', 'class' => 'subhead'),
|
|
|
|
'r141' => array( 'titre' => 'Autres produits d\'exploitation', 'op' => '+', 'class' => ''),
|
|
|
|
'r142' => array( 'titre' => 'Autres charges d\'exploitation', 'op' => '-', 'class' => ''),
|
|
|
|
'r143' => array( 'titre' => 'Reprise sur dotations & transferts de charges', 'op' => '+', 'class' => ''),
|
|
|
|
'r144' => array( 'titre' => '70% Loyer de crédit bail', 'op' => '+', 'class' => ''),
|
|
|
|
'r145' => array( 'titre' => 'Dotations d\'exploitation & provisions d\'exploitation', 'op' => '-', 'class' => ''),
|
|
|
|
'r150' => array( 'titre' => 'RÉSULTAT D\'EXPLOITATION', 'op' => '', 'class' => 'subhead'),
|
|
|
|
'r151' => array( 'titre' => 'Produits financiers', 'op' => '+', 'class' => ''),
|
|
|
|
'r152' => array( 'titre' => '30% Loyer de crédit bail', 'op' => '+', 'class' => ''),
|
|
|
|
'r153' => array( 'titre' => 'Charges financières', 'op' => '+', 'class' => ''),
|
|
|
|
'r170' => array( 'titre' => 'RÉSULTAT COURANT AVANT IMPOTS', 'op' => '', 'class' => 'subhead'),
|
|
|
|
'r171' => array( 'titre' => 'Produits exceptionnels', 'op' => '+', 'class' => ''),
|
|
|
|
'r172' => array( 'titre' => 'Charges exceptionnelles', 'op' => '-', 'class' => ''),
|
|
|
|
'r181' => array( 'titre' => 'Impôts sur les bénéfices', 'op' => '-', 'class' => ''),
|
|
|
|
'r182' => array( 'titre' => 'Participation salariale', 'op' => '-', 'class' => ''),
|
|
|
|
'r199' => array( 'titre' => 'RÉSULTAT NET', 'op' => '', 'class' => 'subhead'),
|
|
|
|
);
|
|
|
|
$totalRatioSig = 'r101';
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-07-06 06:49:05 +00:00
|
|
|
//On prend les 5 derniers bilans pour l'affichage
|
|
|
|
$nbMaxBilan = 5;
|
|
|
|
rsort($annees);
|
|
|
|
$annees = array_slice($annees, 0, $nbMaxBilan);
|
|
|
|
sort($annees);
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-07-06 06:49:05 +00:00
|
|
|
$tabResultActif = array();
|
|
|
|
$tabResultPassif = array();
|
|
|
|
$tabResultSig = array();
|
|
|
|
foreach($annees as $annee){
|
|
|
|
//Formatter les données Actif
|
|
|
|
$data = array();
|
|
|
|
foreach($tabRatioActif as $idRatio => $valRatio){
|
|
|
|
if ($idRatio == '00'){
|
|
|
|
$data[$idRatio] = '';
|
|
|
|
$dataTotal[$idRatio] = '';
|
|
|
|
} else {
|
|
|
|
$data[$idRatio] = $ratiosData->dRatio($typeBilan, $annee, $idRatio);
|
|
|
|
$dataTotal[$idRatio] = $ratiosData->dPercent($typeBilan, $annee, $idRatio, $totalRatioActif);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//Génération du graphique Actif
|
|
|
|
$dataGraphActif = array(
|
|
|
|
$ratiosData->graphPercent($typeBilan, $annee, 'r51', 'r22'),
|
|
|
|
$ratiosData->graphPercent($typeBilan, $annee, 'r52', 'r22'),
|
|
|
|
$ratiosData->graphPercent($typeBilan, $annee, 'r53', 'r22'),
|
|
|
|
$ratiosData->graphPercent($typeBilan, $annee, 'r60', 'r22'),
|
|
|
|
$ratiosData->graphPercent($typeBilan, $annee, 'r61', 'r22'),
|
|
|
|
$ratiosData->graphPercent($typeBilan, $annee, 'r62', 'r22'),
|
|
|
|
$ratiosData->graphPercent($typeBilan, $annee, 'r63', 'r22'),
|
|
|
|
);
|
|
|
|
$ratiosGraph->bilansgraphactif($dataGraphActif, $typeBilan, $annee);
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-07-06 06:49:05 +00:00
|
|
|
$tabResultActif[] = array(
|
|
|
|
'dateCloture' => WDate::dateT('Ymd','d/m/Y',$annee),
|
|
|
|
'duree' => $infosAnnee[$annee]->duree.' Mois',
|
|
|
|
'entrep' => $data,
|
|
|
|
'total' => $dataTotal,
|
|
|
|
);
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-07-06 06:49:05 +00:00
|
|
|
//Formatter les données Passif
|
|
|
|
$data = array();
|
|
|
|
foreach($tabRatioPassif as $idRatio => $valRatio){
|
|
|
|
$data[$idRatio] = $ratiosData->dRatio($typeBilan, $annee, $idRatio);
|
|
|
|
$dataTotal[$idRatio] = $ratiosData->dPercent($typeBilan, $annee, $idRatio, $totalRatioPassif);
|
|
|
|
}
|
|
|
|
//Génération données graphique passif
|
|
|
|
$dataGraphPassif = array(
|
|
|
|
$ratiosData->graphPercent($typeBilan, $annee, 'r70','r22'),
|
|
|
|
$ratiosData->graphPercent($typeBilan, $annee, 'r71','r22'),
|
|
|
|
$ratiosData->graphPercent($typeBilan, $annee, 'r72','r22'),
|
|
|
|
$ratiosData->graphPercent($typeBilan, $annee, 'r83','r22'),
|
|
|
|
$ratiosData->graphPercent($typeBilan, $annee, 'r84','r22'),
|
|
|
|
$ratiosData->graphPercent($typeBilan, $annee, 'r85','r22'),
|
|
|
|
$ratiosData->graphPercent($typeBilan, $annee, 'r86','r22'),
|
|
|
|
$ratiosData->graphPercent($typeBilan, $annee, 'r87','r22'),
|
|
|
|
);
|
|
|
|
$ratiosGraph->bilansgraphpassif($dataGraphPassif, $typeBilan, $annee);
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-07-06 06:49:05 +00:00
|
|
|
$tabResultPassif[] = array(
|
|
|
|
'dateCloture' => WDate::dateT('Ymd','d/m/Y',$annee),
|
|
|
|
'duree' => $infosAnnee[$annee]->duree.' Mois',
|
|
|
|
'entrep' => $data,
|
|
|
|
'total' => $dataTotal,
|
|
|
|
);
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-07-06 06:49:05 +00:00
|
|
|
//Formatter les données Sig
|
|
|
|
$data = array();
|
|
|
|
foreach($tabRatioSig as $idRatio => $valRatio){
|
|
|
|
$data[$idRatio] = $ratiosData->dRatio($typeBilan, $annee, $idRatio);
|
|
|
|
$dataTotal[$idRatio] = $ratiosData->dPercent($typeBilan, $annee, $idRatio, $totalRatioSig);
|
|
|
|
}
|
|
|
|
//Génération données graphique SIG
|
|
|
|
$dataGraphSIG = array(
|
|
|
|
$ratiosData->graphPercent($typeBilan, $annee, 'r101','r101')-$ratiosData->graphPercent($typeBilan, $annee, 'r122','r101'),
|
|
|
|
$ratiosData->graphPercent($typeBilan, $annee, 'r122','r101')-$ratiosData->graphPercent($typeBilan, $annee, 'r130','r101'),
|
|
|
|
$ratiosData->graphPercent($typeBilan, $annee, 'r130','r101')-$ratiosData->graphPercent($typeBilan, $annee, 'r140','r101'),
|
|
|
|
$ratiosData->graphPercent($typeBilan, $annee, 'r140','r101')-$ratiosData->graphPercent($typeBilan, $annee, 'r150','r101'),
|
|
|
|
$ratiosData->graphPercent($typeBilan, $annee, 'r150','r101')-$ratiosData->graphPercent($typeBilan, $annee, 'r170','r101'),
|
|
|
|
$ratiosData->graphPercent($typeBilan, $annee, 'r170','r101')-$ratiosData->graphPercent($typeBilan, $annee, 'r199','r101'),
|
|
|
|
$ratiosData->graphPercent($typeBilan, $annee, 'r199','r101'),
|
|
|
|
);
|
|
|
|
$ratiosGraph->bilansgraphsig($dataGraphSIG, $typeBilan, $annee);
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-07-06 06:49:05 +00:00
|
|
|
$tabResultSig[] = array(
|
|
|
|
'dateCloture' => WDate::dateT('Ymd','d/m/Y',$annee),
|
|
|
|
'duree' => $infosAnnee[$annee]->duree.' Mois',
|
|
|
|
'entrep' => $data,
|
|
|
|
'total' => $dataTotal,
|
|
|
|
);
|
|
|
|
}
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-07-06 06:49:05 +00:00
|
|
|
$this->view->assign('lastDateCloture', $annee);
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-07-06 06:49:05 +00:00
|
|
|
$this->view->assign('tabRatioActif', $tabRatioActif);
|
|
|
|
$this->view->assign('tabRatioPassif', $tabRatioPassif);
|
|
|
|
$this->view->assign('tabRatioSig', $tabRatioSig);
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-07-06 06:49:05 +00:00
|
|
|
$this->view->assign('tabResultActif', $tabResultActif);
|
|
|
|
$this->view->assign('tabResultPassif', $tabResultPassif);
|
|
|
|
$this->view->assign('tabResultSig', $tabResultSig);
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-07-06 06:49:05 +00:00
|
|
|
}
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-07-06 06:49:05 +00:00
|
|
|
$this->view->assign('nbBilanN', $nbBilanN);
|
|
|
|
$this->view->assign('nbBilanC', $nbBilanC);
|
2011-07-05 14:41:20 +00:00
|
|
|
$this->view->assign('typeBilan', $typeBilan);
|
2011-06-15 13:16:39 +00:00
|
|
|
$this->view->assign('id', $this->id);
|
2011-07-05 14:41:20 +00:00
|
|
|
$this->view->assign('siret', $this->siret);
|
2011-06-15 13:16:39 +00:00
|
|
|
$this->view->assign('siren', substr($this->siret, 0, 9));
|
|
|
|
$this->view->assign('raisonSociale', $entreprise->getRaisonSociale());
|
2011-07-05 14:41:20 +00:00
|
|
|
$this->view->assign('AutrePage', $request->getParam('apage'));
|
2011-08-23 07:33:39 +00:00
|
|
|
$this->view->assign('exportObjet', $infos);
|
2011-04-29 10:28:32 +00:00
|
|
|
}
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-04-29 10:28:32 +00:00
|
|
|
/**
|
2011-09-05 13:54:04 +00:00
|
|
|
* Affichage des graphiques bilan Actif/Passif/SIG
|
2011-04-29 10:28:32 +00:00
|
|
|
*/
|
2011-07-05 14:41:20 +00:00
|
|
|
public function bilangraphAction()
|
2011-04-29 10:28:32 +00:00
|
|
|
{
|
2011-07-05 14:41:20 +00:00
|
|
|
$this->_helper->viewRenderer->setNoRender(true);
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-07-05 14:41:20 +00:00
|
|
|
$request = $this->getRequest();
|
|
|
|
$type = $request->getParam('type', '');
|
|
|
|
$typeBilan = $request->getParam('typeBilan');
|
2012-05-20 16:31:28 +00:00
|
|
|
$dateCloture = $request->getParam('dateCloture');
|
|
|
|
|
2011-07-05 14:41:20 +00:00
|
|
|
Zend_Registry::get('firebug')->info($request->getParams());
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2012-11-16 14:12:03 +00:00
|
|
|
$c = Zend_Registry::get('config');
|
|
|
|
$path = $c->profil->path->pages . '/imgcache/';
|
2011-07-05 14:41:20 +00:00
|
|
|
switch($type){
|
|
|
|
case 'actif':
|
|
|
|
$file = 'bilansgraphactif-'.$this->siret.'-'.$this->id.'-'.$typeBilan.$dateCloture.'.png';
|
|
|
|
break;
|
|
|
|
case 'passif':
|
|
|
|
$file = 'bilansgraphpassif-'.$this->siret.'-'.$this->id.'-'.$typeBilan.$dateCloture.'.png';
|
|
|
|
break;
|
|
|
|
case 'sig':
|
|
|
|
$file = 'bilansgraphsig-'.$this->siret.'-'.$this->id.'-'.$typeBilan.$dateCloture.'.png';
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (file_exists($path.$file)) {
|
|
|
|
echo '<img src="/fichier/imgcache/'.$file.'" />';
|
|
|
|
} else {
|
|
|
|
echo "Erreur de génération du graphique";
|
|
|
|
}
|
2011-04-29 10:28:32 +00:00
|
|
|
}
|
2012-05-20 16:31:28 +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
|
|
|
{
|
2012-05-20 16:31:28 +00:00
|
|
|
$user = new Scores_Utilisateur();
|
2011-04-29 10:28:32 +00:00
|
|
|
$request = $this->getRequest();
|
2011-07-05 14:41:20 +00:00
|
|
|
$autrePage = $request->getParam('apage');
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-06-23 09:14:03 +00:00
|
|
|
//Récupération des informations
|
|
|
|
if (empty($autrePage)) {
|
|
|
|
$ws = new WsScores();
|
2011-07-05 14:41:20 +00:00
|
|
|
$infos = $ws->getRatios(substr($this->siret, 0, 9), 'ratios');
|
2011-08-19 12:47:24 +00:00
|
|
|
if ($infos === false) $this->_forward('soap', 'error');
|
2011-06-23 09:14:03 +00:00
|
|
|
} else {
|
2011-07-05 14:41:20 +00:00
|
|
|
$infos = $this->getRequest()->getParam('infos');
|
2011-06-29 12:44:20 +00:00
|
|
|
}
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-07-05 14:41:20 +00:00
|
|
|
$typeBilan = $request->getParam('typeBilan', 'N');
|
|
|
|
$entreprise = new SessionEntreprise($this->siret, $this->id);
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-07-05 14:41:20 +00:00
|
|
|
$tabRatio = array(
|
|
|
|
array('titre' => 'EQUILIBRE FINANCIER'),
|
|
|
|
array('titre' => 'MARGE BRUTE D\'AUTOFINANCEMENT',
|
|
|
|
'stitre'=> '(MBA ou CAF)',
|
|
|
|
'ratio' => 'r233', 'parent' => 0, 'position' => '>'),
|
|
|
|
array('titre' => 'COUVERTURE du BFR',
|
|
|
|
'stitre'=> '(FR/BFR)',
|
|
|
|
'ratio' => 'r234', 'parent' => 0, 'position' => '>'),
|
|
|
|
array('titre' => 'COUVERTURE des IMMOS NETTES',
|
|
|
|
'stitre'=> '(Capitaux permanents / Immobilisations nettes)',
|
|
|
|
'ratio' => 'r237', 'parent' => 0, 'position' => '>'),
|
|
|
|
array('titre' => 'COUVERTURE du CA',
|
|
|
|
'stitre'=> '(Fond de roulement net global sur 12m x 360'.
|
|
|
|
' / Chiffre d\'affaire)',
|
|
|
|
'ratio' => 'r238', 'parent' => 0, 'position' => '>'),
|
|
|
|
array('titre' => 'SOLVABILITE',
|
|
|
|
'stitre'=> '(Capitaux propres / Ensemble des dettes)',
|
|
|
|
'ratio' => 'r239', 'parent' => 0, 'position' => '>'),
|
|
|
|
array('titre' => 'INDEPENDANCE FINANCIERE',
|
|
|
|
'stitre'=> '(Cap.propres/Capitaux permanents)',
|
|
|
|
'ratio' => 'r240', 'parent' => 0, 'position' => '>'),
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-07-05 14:41:20 +00:00
|
|
|
array('titre' => 'PROFITABILITE'),
|
|
|
|
array('titre' => 'RENTABILITE ECONOMIQUE',
|
|
|
|
'stitre'=> '(EBE/TOTAL bilan)',
|
|
|
|
'ratio' => 'r262', 'parent' => 7, 'position' => '>'),
|
|
|
|
array('titre' => 'RENTABILITE FINANCIERE',
|
|
|
|
'stitre'=> '(Résult.Net/Cap.propres)',
|
|
|
|
'ratio' => 'r263', 'parent' => 7, 'position' => '>'),
|
|
|
|
array('titre' => 'RENTABILITE COMMERCIALE',
|
|
|
|
'stitre'=> '(Résultat net/CA)',
|
|
|
|
'ratio' => 'r264', 'parent' => 7, 'position' => '>'),
|
|
|
|
array('titre' => 'CONTRIBUTION DU CAPITAL',
|
|
|
|
'stitre'=> '(Capacité d\'autofinancement sur 12 mois'.
|
|
|
|
' / Capitaux permanents)',
|
|
|
|
'ratio' => 'r265', 'parent' => 7, 'position' => '>'),
|
|
|
|
array('titre' => 'CONTRIBUTION DE LA VA',
|
|
|
|
'stitre'=>'(Capacité d\'autofinancement / Valeur ajoutée)',
|
|
|
|
'ratio' => 'r266', 'parent' => 7, 'position' => '>'),
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-07-05 14:41:20 +00:00
|
|
|
array('titre' => 'LIQUIDITE'),
|
|
|
|
array('titre' => 'LIQUIDITE IMMEDIATE',
|
|
|
|
'stitre'=> '(Disponibilité / Dettes CT)',
|
|
|
|
'ratio' => 'r250', 'parent' => 13, 'position' => '>'),
|
|
|
|
array('titre' => 'LIQUIDITE GENERALE',
|
|
|
|
'stitre'=> '(Act.circulant net/Dettes CT)',
|
|
|
|
'ratio' => 'r251', 'parent' => 13, 'position' => '>'),
|
|
|
|
array('titre' => 'LIQUIDITE REDUITE',
|
|
|
|
'stitre'=>'(Disponibilité et créances réelles / Dettes CT)',
|
|
|
|
'ratio' => 'r252', 'parent' => 13, 'position' => '>'),
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-07-05 14:41:20 +00:00
|
|
|
array('titre' => 'ENDETTEMENT'),
|
|
|
|
array('titre' => 'ENDETTEMENT',
|
|
|
|
'stitre'=> '(Dettes a + 1 an / Capitaux propres)',
|
|
|
|
'ratio' => 'r244', 'parent' => 17, 'position' => '<'),
|
|
|
|
array('titre' => 'CAPACITE DE REMBOURSEMENT',
|
|
|
|
'stitre'=> '(Dettes.bancaires.(+MT+LT+C.bail)/CAF)',
|
|
|
|
'ratio' => 'r247', 'parent' => 17, 'position' => '<'),
|
|
|
|
array('titre' => 'FINANCEMENT DES STOCKS',
|
|
|
|
'stitre'=> '(Dettes aux fournisseurs / Stock)',
|
|
|
|
'ratio' => 'r248', 'parent' => 17, 'position' => '<'),
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-07-05 14:41:20 +00:00
|
|
|
array('titre' => 'PRODUCTIVITE'),
|
|
|
|
array('titre' => 'PRODUCTIVITE DE L\'ACTIF',
|
|
|
|
'stitre'=> '(Chiffre d\'affaire / Actif comptable)',
|
|
|
|
'ratio' => 'r271', 'parent' => 21, 'position' => '>'),
|
|
|
|
array('titre' => 'DUREE CLIENT',
|
|
|
|
'stitre'=> '(Rotation clients en VJ TTC)',
|
|
|
|
'ratio' => 'r278', 'parent' => 21, 'position' => '<'),
|
|
|
|
array('titre' => 'DUREE FOURNISSEUR',
|
|
|
|
'stitre'=> '(Rotation fournisseurs en JA TTC)',
|
|
|
|
'ratio' => 'r279', 'parent' => 21, 'position' => '<'),
|
|
|
|
array('titre' => 'POIDS MASSE SALARIALE',
|
|
|
|
'stitre'=> '(Ch personnel / VA)',
|
|
|
|
'ratio' => 'r281', 'parent' => 21, 'position' => '<'),
|
|
|
|
array('titre' => 'RENDEMENT',
|
|
|
|
'stitre'=> '(Production sur 12mois / Effectif)',
|
|
|
|
'ratio' => 'r261', 'parent' => 21, 'position' => '>'),
|
|
|
|
array('titre' => 'PRODUCTIVITE',
|
|
|
|
'stitre'=> '(CA / Effectif)',
|
|
|
|
'ratio' => 'r267', 'parent' => 21, 'position' => '>')
|
|
|
|
);
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-07-05 14:41:20 +00:00
|
|
|
if($ratio!=''){
|
|
|
|
$tabRatio = array( $ratio => $tabRatio[$ratio] );
|
|
|
|
}
|
2011-07-11 13:26:18 +00:00
|
|
|
|
|
|
|
$ratiosData = new RatiosData($infos);
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-07-06 06:49:05 +00:00
|
|
|
$nbBilanN = $ratiosData->getNbBilan('N');
|
|
|
|
$nbBilanC = $ratiosData->getNbBilan('C');
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-07-06 06:49:05 +00:00
|
|
|
if ($typeBilan == 'N' && $nbBilanN==0){
|
|
|
|
$typeBilan = 'C';
|
|
|
|
}
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-07-06 06:49:05 +00:00
|
|
|
if ($nbBilanN!=0 || $nbBilanC!=0)
|
|
|
|
{
|
|
|
|
//Génération Graphique evolution
|
|
|
|
$ratiosGraph = new RatiosGraph($this->siret, $this->id);
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-07-06 15:31:24 +00:00
|
|
|
$infosAnnee = $ratiosData->getBilansInfo($typeBilan);
|
2011-07-06 06:49:05 +00:00
|
|
|
$annees = array_keys($infosAnnee);
|
|
|
|
rsort($annees);
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-07-06 15:31:24 +00:00
|
|
|
$mil = $request->getParam('mil', $annees[0]);
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-07-06 15:31:24 +00:00
|
|
|
$tabAnnees = array();
|
|
|
|
foreach($annees as $annee){
|
|
|
|
$tabAnnees[$annee] = WDate::dateT('Ymd', 'd/m/Y', $annee);
|
|
|
|
}
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-07-06 06:49:05 +00:00
|
|
|
$tabResult = array();
|
2012-05-20 16:31:28 +00:00
|
|
|
foreach($tabRatio as $item ) {
|
2011-07-11 13:26:18 +00:00
|
|
|
if (isset($item['ratio'])){
|
|
|
|
$dataGraph = $ratiosData->dGraph($typeBilan, $item['ratio']);
|
|
|
|
$ratiosGraph->ratiosgraph($item['ratio'], $dataGraph);
|
2011-07-06 15:31:24 +00:00
|
|
|
$item['entrep'] = $ratiosData->dRatio($typeBilan, $mil, $item['ratio']);
|
|
|
|
$item['secteur'] = $ratiosData->dSecteur($mil, $item['ratio']);
|
|
|
|
$item['position'] = $ratiosData->dPosition($typeBilan, $mil, $item['ratio'], $item['position']);
|
2011-07-06 06:49:05 +00:00
|
|
|
$item['comment'] = $ratiosData->wrapComment($item['ratio']);
|
|
|
|
}
|
|
|
|
$tabResult[] = $item;
|
|
|
|
}
|
|
|
|
$this->view->assign('tabResult', $tabResult);
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-07-06 06:49:05 +00:00
|
|
|
$this->view->assign('annees', $tabAnnees);
|
|
|
|
$this->view->assign('mil', $mil);
|
2011-07-06 15:31:24 +00:00
|
|
|
$this->view->assign('typeBilan', $typeBilan);
|
2011-07-06 15:36:03 +00:00
|
|
|
$this->view->assign('duree', $infosAnnee[$mil]->duree);
|
2011-07-05 14:41:20 +00:00
|
|
|
}
|
2011-07-06 06:49:05 +00:00
|
|
|
$this->view->assign('nbBilanN', $nbBilanN);
|
2012-05-20 16:31:28 +00:00
|
|
|
$this->view->assign('nbBilanC', $nbBilanC);
|
|
|
|
|
2011-06-15 13:16:39 +00:00
|
|
|
$this->view->assign('raisonSociale', $entreprise->getRaisonSociale());
|
2011-07-05 14:41:20 +00:00
|
|
|
$this->view->assign('siret', $this->siret);
|
|
|
|
$this->view->assign('id', $this->id);
|
2011-07-06 15:31:24 +00:00
|
|
|
$this->view->assign('naf', $infos->NafEnt);
|
|
|
|
$this->view->assign('nafLib', $infos->NafEntLib);
|
2011-06-22 15:09:06 +00:00
|
|
|
$this->view->assign('AutrePage', $request->getParam('apage'));
|
2011-08-23 07:33:39 +00:00
|
|
|
$this->view->assign('exportObjet', $infos);
|
2011-04-29 10:28:32 +00:00
|
|
|
}
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-09-05 13:54:04 +00:00
|
|
|
/**
|
|
|
|
* Affichage des graphiques d'évolutions (ratios)
|
|
|
|
*/
|
2011-07-05 14:41:20 +00:00
|
|
|
public function ratiosgraphAction()
|
|
|
|
{
|
|
|
|
$this->_helper->layout()->disableLayout();
|
|
|
|
$this->_helper->viewRenderer->setNoRender(true);
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-07-05 14:41:20 +00:00
|
|
|
$request = $this->getRequest();
|
|
|
|
$ratio = $request->getParam('ratio');
|
2012-11-16 14:12:03 +00:00
|
|
|
$c = Zend_Registry::get('config');
|
|
|
|
$path = $c->profil->path->pages . '/imgcache/';
|
2011-07-05 14:41:20 +00:00
|
|
|
$file = 'ratiosgraph-'.$this->siret.'-'.$this->id.'-'.$ratio.'.png';
|
|
|
|
if (file_exists($path.$file)) {
|
|
|
|
echo '<img src="/fichier/imgcache/'.$file.'" />';
|
|
|
|
} else {
|
|
|
|
echo "Erreur de génération du graphique";
|
|
|
|
}
|
|
|
|
}
|
2012-05-20 16:31:28 +00:00
|
|
|
|
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-23 09:51:37 +00:00
|
|
|
//@todo : Gestion des unités dans l'export XLS
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-05-18 13:35:56 +00:00
|
|
|
$this->_helper->layout()->disableLayout();
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-06-15 13:16:39 +00:00
|
|
|
$request = $this->getRequest();
|
|
|
|
$unite = $request->getParam('unit', '€');
|
|
|
|
$type = $request->getParam('type', '');
|
|
|
|
$date = $request->getParam('date', '');
|
|
|
|
$entreprise = new SessionEntreprise($this->siret, $this->id);
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-06-07 09:06:15 +00:00
|
|
|
switch($type)
|
2011-05-26 15:56:16 +00:00
|
|
|
{
|
2011-05-18 14:06:36 +00:00
|
|
|
case 'C':
|
|
|
|
case 'N':
|
|
|
|
$model = 'liasse_2050';
|
2011-05-26 15:56:16 +00:00
|
|
|
break;
|
2011-05-18 14:06:36 +00:00
|
|
|
case 'S':
|
|
|
|
$model = 'liasse_2033';
|
2011-05-26 15:56:16 +00:00
|
|
|
break;
|
|
|
|
}
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-07-04 08:31:42 +00:00
|
|
|
$ws = new WsScores();
|
|
|
|
$liasses = $ws->getBilan(substr($this->siret, 0, 9), $date, $type, '');
|
2011-05-26 15:56:16 +00:00
|
|
|
$data = array();
|
|
|
|
$data['DATE_CLOTURE'] = $liasses->DATE_CLOTURE;
|
2011-05-23 09:51:37 +00:00
|
|
|
$data['DATE_CLOTURE_PRE'] = $liasses->DATE_CLOTURE_PRE;
|
2011-05-26 15:56:16 +00:00
|
|
|
$data['DUREE_MOIS'] = $liasses->DUREE_MOIS;
|
|
|
|
$data['DUREE_MOIS_PRE'] = $liasses->DUREE_MOIS_PRE;
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-05-26 15:56:16 +00:00
|
|
|
foreach ($liasses->POSTES->item as $element)
|
|
|
|
$data[$element->id] = $element->val;
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2012-11-16 14:12:03 +00:00
|
|
|
$c = Zend_Registry::get('config');
|
|
|
|
$path = $c->profil->path->files . '/';
|
2011-06-15 13:16:39 +00:00
|
|
|
$file = 'liasse-'.substr($this->siret, 0, 9).'-'.$this->id.'-'.$type.$date.'.xls';
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-06-07 09:48:57 +00:00
|
|
|
require_once 'Finance/LiasseXLS.php';
|
2011-05-18 13:04:29 +00:00
|
|
|
$liasse = new LiasseXLS($model);
|
2011-06-15 13:16:39 +00:00
|
|
|
$liasse->dataModel(substr($this->siret, 0, 9), $entreprise->getRaisonSociale(), $data);
|
2011-05-18 13:04:29 +00:00
|
|
|
$liasse->dataFile($file);
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-05-18 13:35:56 +00:00
|
|
|
if( file_exists($path.$file) ){
|
2011-06-29 12:44:20 +00:00
|
|
|
$ws = new WsScores();
|
|
|
|
$ws->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
|
|
|
}
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-07-12 15:13:03 +00:00
|
|
|
/**
|
|
|
|
* Envoi de bilan pour saisie
|
|
|
|
* L'envoi se déroule en plusieurs étapes
|
|
|
|
* 1 - Saisie des informations
|
|
|
|
* 2 - Validation du formulaire
|
2012-05-20 16:31:28 +00:00
|
|
|
* 3 -
|
2011-07-12 15:13:03 +00:00
|
|
|
*/
|
|
|
|
public function saisiebilanAction()
|
|
|
|
{
|
|
|
|
$this->_helper->layout()->disableLayout();
|
|
|
|
|
|
|
|
$request = $this->getRequest();
|
2012-05-20 16:31:28 +00:00
|
|
|
$user = new Scores_Utilisateur();
|
2011-07-12 15:13:03 +00:00
|
|
|
$params = $request->getParams();
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-09-27 15:33:24 +00:00
|
|
|
$bilanSaisie = new Application_Model_BilanSaisie();
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-07-12 15:13:03 +00:00
|
|
|
$this->view->assign('email', $user->getEmail());
|
|
|
|
$this->view->assign('siren', $params['siren']);
|
|
|
|
Zend_Registry::get('firebug')->info($params);
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2012-01-25 09:27:21 +00:00
|
|
|
$ref = $params['ref'];
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-07-12 15:13:03 +00:00
|
|
|
//Annulation de la saisie
|
2013-02-05 07:16:49 +00:00
|
|
|
if ($params['annule'])
|
|
|
|
{
|
2011-07-12 15:13:03 +00:00
|
|
|
$data = array( 'fichier' => '' );
|
|
|
|
$bilanSaisie->update($data, "ref='$ref'");
|
|
|
|
echo 'Saisie bilan annulé';
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
//Envoi du fichier @todo ça passe pas
|
|
|
|
elseif ($params['upload'])
|
2012-05-20 16:31:28 +00:00
|
|
|
{
|
2011-07-12 15:13:03 +00:00
|
|
|
if ( count($_FILES)==1 ){
|
|
|
|
$n = $_FILES['fichier']['name'];
|
|
|
|
$s = $_FILES['fichier']['size'];
|
|
|
|
$tmp_name = $_FILES['fichier']['tmp_name'];
|
|
|
|
//Vérifier que l'extension du fichier est bien correcte
|
|
|
|
$extValide = array('pdf', 'tiff');
|
|
|
|
$extension = strrchr($n,'.');
|
|
|
|
$extension = substr($extension,1);
|
|
|
|
if ( in_array($extension, $extValide) ){
|
|
|
|
//Lecture dans la bdd des informations
|
|
|
|
$infos = $bilanSaisie->getInfosBilan($ref);
|
|
|
|
$name = $infos['ref'].'-'.$infos['siren'].'.'.$extension;
|
2012-11-05 15:33:01 +00:00
|
|
|
$c = Zend_Registry::get('config');
|
2012-11-16 14:12:03 +00:00
|
|
|
$file = realpath($c->profil->path->data).'/bilanclient/'.$name;
|
2012-02-28 11:20:21 +00:00
|
|
|
if ( move_uploaded_file($tmp_name, $file) ){
|
2011-07-12 15:13:03 +00:00
|
|
|
$bilanSaisie->setFilename($ref, $name);
|
|
|
|
switch($infos['format']){
|
|
|
|
case 'C':
|
|
|
|
$type = 'consolidé';
|
|
|
|
break;
|
|
|
|
case 'N':
|
|
|
|
$type = 'réel normal ou simplifié';
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
$session = new SessionEntreprise($params['siren']);
|
|
|
|
$this->view->assign('raisonSociale', $session->getRaisonSociale());
|
2012-02-28 11:20:21 +00:00
|
|
|
$this->view->assign('size', filesize($file));
|
2011-07-12 15:13:03 +00:00
|
|
|
$this->view->assign('name', $name);
|
|
|
|
$this->view->assign('infos', $infos);
|
2012-01-25 09:27:21 +00:00
|
|
|
$this->view->assign('ref', $ref);
|
2011-07-12 15:13:03 +00:00
|
|
|
$this->view->assign('upload', true);
|
|
|
|
} else {
|
|
|
|
$this->view->assign('upload', false);
|
|
|
|
$this->view->assign('errMsg', "<br/>Erreur lors de l'envoi du fichier!");
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
$this->view->assign('upload', false);
|
|
|
|
$this->view->assign('errMsg', "Extension de fichier invalide.");
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
$this->view->assign('upload', false);
|
|
|
|
$this->view->assign('errMsg', "<br/>Erreur.");
|
2012-05-20 16:31:28 +00:00
|
|
|
}
|
2011-07-12 15:13:03 +00:00
|
|
|
$this->renderScript('finance/saisiebilan-upload.phtml');
|
2012-05-20 16:31:28 +00:00
|
|
|
}
|
2011-07-12 15:13:03 +00:00
|
|
|
//Validation du formulaire
|
|
|
|
elseif (isset($params['method']))
|
2012-05-20 16:31:28 +00:00
|
|
|
{
|
2011-07-12 15:13:03 +00:00
|
|
|
$valideField = true;
|
|
|
|
if ( empty($params['email'])) {
|
|
|
|
$valideField = false;
|
|
|
|
}
|
|
|
|
if ( empty($params['method'])) {
|
|
|
|
$valideField = false;
|
|
|
|
}
|
|
|
|
if ( empty($params['siren'])) {
|
|
|
|
$valideField = false;
|
|
|
|
}
|
2013-02-05 07:16:49 +00:00
|
|
|
if ( empty($params['dateCloture'])
|
|
|
|
&& !preg_match('/^[0-9]{2}\/[0-9]{2}\/[0-9]{4}/', $params['dateCloture'])
|
|
|
|
&& checkdate(substr($params['dateCloture'],3,2),substr($params['dateCloture'],0,2),substr($params['dateCloture'],6,2))){
|
2011-07-12 15:13:03 +00:00
|
|
|
$valideField = false;
|
|
|
|
}
|
|
|
|
if ( empty($params['dureeExercice'])) {
|
|
|
|
$valideField = false;
|
2012-05-20 16:31:28 +00:00
|
|
|
}
|
2011-07-12 15:13:03 +00:00
|
|
|
if ($valideField){
|
|
|
|
$ref = $bilanSaisie->setInformations(
|
2012-05-20 16:31:28 +00:00
|
|
|
$user->getIdClient(),
|
|
|
|
$user->getId(),
|
|
|
|
$user->getLogin(),
|
|
|
|
$params['email'],
|
|
|
|
$params['method'],
|
|
|
|
$params['confidentiel'],
|
|
|
|
$params['siren'],
|
|
|
|
$params['dateCloture'],
|
|
|
|
$params['format'],
|
2011-07-12 15:13:03 +00:00
|
|
|
$params['dureeExercice']
|
|
|
|
);
|
|
|
|
$this->view->assign('ref', $ref);
|
|
|
|
if ($params['method']=='courrier'){
|
|
|
|
$this->renderScript('finance/saisiebilan-courrier.phtml');
|
|
|
|
} elseif ($params['method']=='fichier') {
|
|
|
|
$this->renderScript('finance/saisiebilan-upload.phtml');
|
2012-05-20 16:31:28 +00:00
|
|
|
}
|
|
|
|
}
|
2011-07-12 15:13:03 +00:00
|
|
|
}
|
|
|
|
}
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-05-06 15:26:56 +00:00
|
|
|
/**
|
2011-05-18 13:04:29 +00:00
|
|
|
* Affichage des liasses.
|
|
|
|
* @todo :
|
2011-09-05 13:54:04 +00:00
|
|
|
* Afficher les liasses Simplifiées
|
2011-07-04 10:02:31 +00:00
|
|
|
* Sélection des unités non fonctionnel
|
|
|
|
* Sélection de la dernière date, est ce que l'on est sur que c'est la dernière en fonction du type
|
|
|
|
* Class LiasseList pour la gestion de la liste
|
2011-05-06 15:26:56 +00:00
|
|
|
*/
|
2011-04-19 15:59:50 +00:00
|
|
|
public function liasseAction()
|
|
|
|
{
|
2012-05-20 16:31:28 +00:00
|
|
|
$user = new Scores_Utilisateur();
|
2012-09-14 09:50:24 +00:00
|
|
|
$this->view->assign('edition', $user->checkModeEdition());
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-05-13 16:33:21 +00:00
|
|
|
/** Les ancres pour les liens **/
|
2011-06-13 07:04:46 +00:00
|
|
|
$ancres = array(
|
2011-07-07 13:43:22 +00:00
|
|
|
'C' => array(
|
2012-05-20 16:31:28 +00:00
|
|
|
'actif' => 'Actif',
|
|
|
|
'passif' => 'Passif',
|
2011-07-07 13:43:22 +00:00
|
|
|
'compteDeResultat' => 'Compte de résultat',
|
|
|
|
),
|
|
|
|
'N' => array(
|
2012-05-20 16:31:28 +00:00
|
|
|
'actif' => 'Actif',
|
|
|
|
'passif' => 'Passif',
|
|
|
|
'compteDeResultat' => 'Compte de résultat',
|
|
|
|
'immobilisations' => 'Immobilisations',
|
|
|
|
'amortissements' => 'Amortissements',
|
|
|
|
'provisions' => 'Provisions',
|
|
|
|
'creancesDettes' => 'Créances, Dettes',
|
2011-07-07 13:43:22 +00:00
|
|
|
'affectation' => 'Affectation'
|
|
|
|
),
|
2012-02-07 10:10:26 +00:00
|
|
|
'S' => array(
|
2012-05-20 16:31:28 +00:00
|
|
|
'actif' => 'Actif',
|
|
|
|
'passif' => 'Passif',
|
|
|
|
'compteDeResultat' => 'Compte de résultat',
|
|
|
|
'immobilisations' => 'Immobilisations',
|
|
|
|
'amortissements' => 'Amortissements',
|
|
|
|
'provisions' => 'Provisions',
|
|
|
|
'creancesDettes' => 'Créances, Dettes',
|
2012-02-07 10:10:26 +00:00
|
|
|
'affectation' => 'Affectation'
|
|
|
|
),
|
2011-07-07 13:43:22 +00:00
|
|
|
'A' => array(
|
2012-05-20 16:31:28 +00:00
|
|
|
'actif' => 'Actif',
|
|
|
|
'passif' => 'Passif',
|
2011-07-07 13:43:22 +00:00
|
|
|
'compteDeResultat' => 'Compte de résultat',
|
|
|
|
),
|
|
|
|
'B' => array(
|
2012-05-20 16:31:28 +00:00
|
|
|
'actif' => 'Actif',
|
|
|
|
'passif' => 'Passif',
|
2011-07-07 13:43:22 +00:00
|
|
|
'compteDeResultat' => 'Compte de résultat',
|
|
|
|
),
|
2011-04-26 13:39:19 +00:00
|
|
|
);
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-07-12 15:13:03 +00:00
|
|
|
/** La liste des types 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());
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-07-12 15:13:03 +00:00
|
|
|
/** Le nom des types 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é',
|
2011-06-03 08:52:01 +00:00
|
|
|
'S' => 'Simplifié',
|
2011-05-18 13:04:29 +00:00
|
|
|
'N' => ''
|
|
|
|
);
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-04-26 13:39:19 +00:00
|
|
|
/** Liste des unités que l'ont proposent **/
|
2011-07-07 14:44:49 +00:00
|
|
|
$unit = array (
|
|
|
|
'E' => '€',
|
2012-05-20 16:31:28 +00:00
|
|
|
'K' => 'K€',
|
2011-07-07 14:44:49 +00:00
|
|
|
'M' => 'M€',
|
2011-05-18 13:04:29 +00:00
|
|
|
);
|
2011-04-26 13:39:19 +00:00
|
|
|
$liasse = array ();
|
2011-05-13 16:33:21 +00:00
|
|
|
$request = $this->getRequest();
|
2011-07-07 14:44:49 +00:00
|
|
|
$unite = $request->getParam('unit','K');
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-07-04 08:36:22 +00:00
|
|
|
$ws = new WsScores();
|
|
|
|
$listBilan = $ws->getListeBilans(substr($this->siret, 0, 9));
|
2011-08-19 12:47:24 +00:00
|
|
|
if ($listBilan === false) $this->_forward('soap', 'error');
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-06-15 13:16:39 +00:00
|
|
|
$entreprise = new SessionEntreprise($this->siret, $this->id);
|
2012-05-20 16:31:28 +00:00
|
|
|
|
|
|
|
if( $listBilan->nbReponses > 0 )
|
2011-07-07 14:44:49 +00:00
|
|
|
{
|
|
|
|
$date = $request->getParam('date',$listBilan->result->item[0]->dateExercice.':'.$listBilan->result->item[0]->typeBilan);
|
|
|
|
$dateFunction = new WDate();
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-06-23 09:14:03 +00:00
|
|
|
foreach ($listBilan->result->item as $item)
|
|
|
|
$liste[$item->typeBilan][] = $item->dateExercice;
|
2012-05-20 16:31:28 +00:00
|
|
|
|
|
|
|
if (!empty($date))
|
2011-07-07 14:44:49 +00:00
|
|
|
{
|
2011-06-23 09:14:03 +00:00
|
|
|
$dateAndType = explode(':', $date);
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-08-23 07:33:39 +00:00
|
|
|
$infos = $ws->getBilan(substr($this->siret, 0, 9), $dateAndType[0], $dateAndType[1], true);
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-08-19 12:47:24 +00:00
|
|
|
if ($infos === false) $this->_forward('soap', 'error');
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2012-01-24 14:33:47 +00:00
|
|
|
$infoLiasse = new Liasse($infos, $unite);
|
2011-07-04 10:00:22 +00:00
|
|
|
$this->view->assign('dateCloture', $infoLiasse->getInfo('dateCloture'));
|
|
|
|
$this->view->assign('dateCloturePre', $infoLiasse->getInfo('dateCloturePre'));
|
|
|
|
$this->view->assign('dureesMois', $infoLiasse->getInfo('dureeMois'));
|
|
|
|
$this->view->assign('dureesMoisPre', $infoLiasse->getInfo('dureeMoisPre'));
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-06-23 09:14:03 +00:00
|
|
|
$this->view->assign('date', $dateAndType[0]);
|
|
|
|
$this->view->assign('champType', $dateAndType[1]);
|
2011-07-04 10:00:22 +00:00
|
|
|
$this->view->assign('liasse', $infoLiasse->getPostes());
|
2011-07-07 13:43:22 +00:00
|
|
|
$this->view->assign('ancres', $ancres[$dateAndType[1]]);
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-06-23 09:14:03 +00:00
|
|
|
//Gestion export de la liasse au format XLS
|
2012-07-26 11:51:34 +00:00
|
|
|
if ($user->checkPerm('liassexls')
|
|
|
|
&& in_array($dateAndType[1],array('C', 'N', 'S')) ) {
|
2011-07-04 08:49:06 +00:00
|
|
|
$this->view->assign('exportxls', true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$this->view->assign('dateFunction', $dateFunction);
|
|
|
|
$this->view->assign('liste', $liste);
|
|
|
|
$this->view->assign('id', $id);
|
|
|
|
$this->view->assign('type', $type);
|
2011-07-07 14:44:49 +00:00
|
|
|
$this->view->assign('unite', $unite);
|
2011-07-04 08:49:06 +00:00
|
|
|
$this->view->assign('unit', $unit);
|
2011-06-23 09:14:03 +00:00
|
|
|
}
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-07-12 15:13:03 +00:00
|
|
|
//Gestion saisie bilan
|
|
|
|
if ( $user->checkPerm('UPLOADBILAN') ) {
|
|
|
|
$this->view->assign('saisiebilan', true);
|
|
|
|
}
|
2012-03-01 13:10:25 +00:00
|
|
|
$this->view->assign('surveillance', $user->checkPerm('survbilan'));
|
2012-05-20 16:31:28 +00:00
|
|
|
|
|
|
|
|
2011-04-26 13:39:19 +00:00
|
|
|
/** Partie vue **/
|
2012-02-10 16:24:36 +00:00
|
|
|
$this->view->haveLiasse = ($listBilan->nbReponses > 0) ? true : false;
|
2011-06-15 13:16:39 +00:00
|
|
|
$this->view->assign('raisonSociale', $entreprise->getRaisonSociale());
|
|
|
|
$this->view->assign('siren', substr($this->siret, 0, 9));
|
2011-07-04 08:49:06 +00:00
|
|
|
$this->view->assign('siret', $this->siret);
|
2011-08-23 07:33:39 +00:00
|
|
|
$this->view->assign('exportObjet', $infos);
|
2011-04-19 15:59:50 +00:00
|
|
|
}
|
2011-04-29 10:28:32 +00:00
|
|
|
|
2011-05-09 11:43:43 +00:00
|
|
|
/**
|
|
|
|
* Fonction qui gére la cotation en bourse.
|
|
|
|
*/
|
2011-04-19 15:59:50 +00:00
|
|
|
public function bourseAction()
|
|
|
|
{
|
2011-06-08 15:41:59 +00:00
|
|
|
$siren = substr($this->siret, 0, 9);
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-06-08 15:41:59 +00:00
|
|
|
$sessionEntreprise = new SessionEntreprise($this->siret, $this->id);
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-06-08 15:41:59 +00:00
|
|
|
$ws = new WsScores();
|
2011-08-19 12:47:24 +00:00
|
|
|
$infos = $ws->getInfosBourse($siren);
|
|
|
|
if ($infos === false) $this->_forward('soap', 'error');
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2011-08-19 12:47:24 +00:00
|
|
|
$this->view->assign('InfosBourse', $infos);
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2012-10-26 08:13:56 +00:00
|
|
|
$user = new Scores_Utilisateur();
|
|
|
|
if ($user->checkModeEdition()) {
|
|
|
|
$this->view->assign('edition', $this->view->url(array(
|
|
|
|
'controller'=>'saisie',
|
|
|
|
'action'=>'bourse',
|
|
|
|
'siren' => $siren
|
|
|
|
), null, true));
|
|
|
|
}
|
2013-02-05 07:16:49 +00:00
|
|
|
|
2011-06-08 15:41:59 +00:00
|
|
|
$this->view->assign('id', $this->id);
|
|
|
|
$this->view->assign('siret', $this->siret);
|
|
|
|
$this->view->assign('raisonSociale', $sessionEntreprise->getRaisonSociale());
|
|
|
|
$this->view->assign('siren', $siren);
|
2011-08-23 07:33:39 +00:00
|
|
|
$this->view->assign('exportObjet', $infos);
|
2011-04-19 15:59:50 +00:00
|
|
|
}
|
2012-05-20 16:31:28 +00:00
|
|
|
|
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()
|
|
|
|
{
|
2011-06-23 09:14:03 +00:00
|
|
|
$autrePage = $this->getRequest()->getParam('apage');
|
|
|
|
//Récupération des informations
|
|
|
|
if (empty($autrePage)) {
|
|
|
|
$ws = new WsScores();
|
2011-08-19 12:47:24 +00:00
|
|
|
$infos = $ws->getBanques(substr($this->siret, 0, 9));
|
|
|
|
if ($infos === false) $this->_forward('soap', 'error');
|
2011-06-23 09:14:03 +00:00
|
|
|
} else {
|
2011-08-19 12:47:24 +00:00
|
|
|
$infos = $this->getRequest()->getParam('infos');
|
2011-06-23 09:14:03 +00:00
|
|
|
}
|
|
|
|
|
2011-06-15 13:16:39 +00:00
|
|
|
$entreprise = new SessionEntreprise($this->siret, $this->id);
|
2011-08-19 12:47:24 +00:00
|
|
|
$this->view->assign('banques', $infos->result->item);
|
2011-06-15 13:16:39 +00:00
|
|
|
$this->view->assign('raisonSociale', $entreprise->getRaisonSociale());
|
|
|
|
$this->view->assign('siren', substr($this->siret, 0, 9));
|
2011-08-23 07:33:39 +00:00
|
|
|
$this->view->assign('exportObjet', $infos);
|
2011-04-19 15:59:50 +00:00
|
|
|
}
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2012-11-19 15:53:10 +00:00
|
|
|
/**
|
|
|
|
* Flux de trésorerie
|
|
|
|
*/
|
|
|
|
public function fluxAction()
|
|
|
|
{
|
|
|
|
$request = $this->getRequest();
|
|
|
|
$typeBilan = $request->getParam('type', 'N');
|
2012-04-05 09:14:03 +00:00
|
|
|
$this->view->assign('typeBilan', $typeBilan);
|
2012-11-19 15:53:10 +00:00
|
|
|
|
|
|
|
$this->view->assign('siret', $this->siret);
|
|
|
|
|
|
|
|
$siren = substr($this->siret, 0, 9);
|
|
|
|
|
|
|
|
$ws = new WsScores();
|
2012-04-05 09:14:03 +00:00
|
|
|
$entreprise = new SessionEntreprise($this->siret, $this->id);
|
|
|
|
$this->view->assign('raisonSociale', $entreprise->getRaisonSociale());
|
2012-11-19 15:53:10 +00:00
|
|
|
|
2012-04-05 09:14:03 +00:00
|
|
|
$infos = $ws->getRatios($siren, 'ratios');
|
2012-11-19 15:53:10 +00:00
|
|
|
|
|
|
|
//Formattage des données
|
|
|
|
$ratiosData = new RatiosData($infos);
|
|
|
|
$nbBilanN = $ratiosData->getNbBilan('N');
|
2012-04-23 09:57:41 +00:00
|
|
|
$nbBilanC = $ratiosData->getNbBilan('C');
|
2012-11-19 15:53:10 +00:00
|
|
|
|
|
|
|
$this->view->assign('nbBilanN', $nbBilanN);
|
|
|
|
$this->view->assign('nbBilanC', $nbBilanC);
|
|
|
|
|
2012-04-05 09:14:03 +00:00
|
|
|
$bilansInfos = $ratiosData->getBilansInfo($typeBilan);
|
|
|
|
foreach ($bilansInfos as $infos) {
|
2012-05-20 16:31:28 +00:00
|
|
|
$dateCloture[] = $infos->dateCloture;
|
2012-04-05 09:14:03 +00:00
|
|
|
}
|
2012-11-19 15:53:10 +00:00
|
|
|
sort($dateCloture);
|
2012-04-23 09:57:41 +00:00
|
|
|
$this->view->assign('dateCloture', $dateCloture);
|
2012-11-19 15:53:10 +00:00
|
|
|
$this->view->assign('bilansInfos', $bilansInfos);
|
|
|
|
|
|
|
|
$ratiosInfos = $ratiosData->getTableRatiosInfos();
|
|
|
|
$this->view->assign('ratiosInfos', $ratiosInfos);
|
|
|
|
|
|
|
|
$ratiosEntrep = $ratiosData->getTableRatiosEntrep($typeBilan);
|
|
|
|
$this->view->assign('ratiosEntrep', $ratiosEntrep);
|
|
|
|
|
|
|
|
$ratiosEntrepEvol = $ratiosData->getTableRatiosEntrepEvol($typeBilan);
|
|
|
|
$this->view->assign('ratiosEntrepEvol', $ratiosEntrepEvol);
|
|
|
|
|
|
|
|
$ratiosSecteur = $ratiosData->getTableRatiosSecteur();
|
|
|
|
$this->view->assign('ratiosSecteur', $ratiosSecteur);
|
|
|
|
|
|
|
|
//Tableau des différents type de bilans
|
|
|
|
$typBil = array('C'=>'Consolidé', 'N'=>'', 'S'=>'Réel Simplifié', 'B'=> 'Banque', 'A'=>'Assurance');
|
|
|
|
|
|
|
|
$dataTable = array(
|
|
|
|
0 => array(
|
|
|
|
'titre' => "ACTIVITE",
|
|
|
|
'r' => '', 'op' => '',
|
|
|
|
),
|
|
|
|
1 => array(
|
|
|
|
'titre' => "Chiffre d'affaires HT & autres produits d'exploitation",
|
|
|
|
'r' => 561, 'op' => '',
|
|
|
|
),
|
|
|
|
2 => array(
|
|
|
|
'titre' => "Variation des creances clients & autres creances d'exploitation",
|
|
|
|
'r' => 562, 'op' => '-',
|
|
|
|
),
|
|
|
|
3 => array(
|
|
|
|
'titre' => "Recettes d'exploitation (a)",
|
|
|
|
'r' => 563, 'op' => '=', 'class' => 'subhead'
|
|
|
|
),
|
|
|
|
4 => array(
|
|
|
|
'titre' => "Achats & autres charges d'exploitation",
|
|
|
|
'r' => 564, 'op' => '',
|
|
|
|
),
|
|
|
|
5 => array(
|
|
|
|
'titre' => "Variation des dettes fournisseurs & autres dettes d'exploitation",
|
|
|
|
'r' => 565, 'op' => '-',
|
|
|
|
),
|
|
|
|
6 => array(
|
|
|
|
'titre' => "Depenses d'exploitation (b)",
|
|
|
|
'r' => 566, 'op' => '=', 'class' => 'subhead'
|
|
|
|
),
|
|
|
|
7 => array(
|
|
|
|
'titre' => "Excedent de Tresorerie d'Exploitation (ETE) (a-b)",
|
|
|
|
'r' => 567, 'op' => '=', 'class' => 'subhead'
|
|
|
|
),
|
|
|
|
8 => array(
|
|
|
|
'titre' => "Flux lies aux operations hors exploitation",
|
|
|
|
'r' => 568,
|
|
|
|
'op' => '+',
|
|
|
|
),
|
|
|
|
9 => array(
|
|
|
|
'titre' => "Interets bancaires",
|
|
|
|
'r' => 569,
|
|
|
|
'op' => '-',
|
|
|
|
),
|
|
|
|
10 => array(
|
|
|
|
'titre' => "Impots sur les benefices",
|
|
|
|
'r' => 570,
|
|
|
|
'op' => '-',
|
|
|
|
),
|
|
|
|
11 => array(
|
|
|
|
'titre' => "Flux affectes a la participation des salaries",
|
|
|
|
'r' => 571,
|
|
|
|
'op' => '-',
|
|
|
|
),
|
|
|
|
12 => array(
|
|
|
|
'titre' => "Dividendes verses",
|
|
|
|
'r' => 572,
|
|
|
|
'op' => '-',
|
|
|
|
),
|
|
|
|
13 => array(
|
|
|
|
'titre' => "Flux de tresorerie interne (A)",
|
|
|
|
'r' => 573, 'op' => '=', 'class' => 'subhead'
|
|
|
|
),
|
|
|
|
14 => array(
|
|
|
|
'titre' => "INVESTISSEMENT",
|
|
|
|
'r' => '',
|
|
|
|
'op' => '',
|
|
|
|
),
|
|
|
|
15 => array(
|
|
|
|
'titre' => "Investissements d'exploitation hors production immobilisee",
|
|
|
|
'r' => 574,
|
|
|
|
'op' => '',
|
|
|
|
),
|
|
|
|
16 => array(
|
|
|
|
'titre' => "Acquisition de participations & autres titres immobilises",
|
|
|
|
'r' => 575,
|
|
|
|
'op' => '+',
|
|
|
|
),
|
|
|
|
17 => array(
|
|
|
|
'titre' => "Variation des autres actifs immobilises hors charges a repartir",
|
|
|
|
'r' => 576,
|
|
|
|
'op' => '+',
|
|
|
|
),
|
|
|
|
18 => array(
|
|
|
|
'titre' => "Subventions d'investissement recues",
|
|
|
|
'r' => 577,
|
|
|
|
'op' => '-',
|
|
|
|
),
|
|
|
|
19 => array(
|
|
|
|
'titre' => "Variation des dettes sur immobilisations",
|
|
|
|
'r' => 578,
|
|
|
|
'op' => '-',
|
|
|
|
),
|
|
|
|
20 => array(
|
|
|
|
'titre' => "Encaissements sur cessions d'immobilisations",
|
|
|
|
'r' => 579,
|
|
|
|
'op' => '-',
|
|
|
|
),
|
|
|
|
21 => array(
|
|
|
|
'titre' => "Flux d'investissement (I)",
|
|
|
|
'r' => 580, 'op' => '=', 'class' => 'subhead'
|
|
|
|
),
|
|
|
|
22 => array(
|
|
|
|
'titre' => "FINANCEMENT",
|
|
|
|
'r' => '',
|
|
|
|
'op' => '',
|
|
|
|
),
|
|
|
|
23 => array(
|
|
|
|
'titre' => "Augmentation-Reduction de capital",
|
|
|
|
'r' => 581,
|
|
|
|
'op' => '',
|
|
|
|
),
|
|
|
|
24 => array(
|
|
|
|
'titre' => "Variation des creances sur capital appele non verse",
|
|
|
|
'r' => 582,
|
|
|
|
'op' => '-',
|
|
|
|
),
|
|
|
|
25 => array(
|
|
|
|
'titre' => "Flux du capital (C)",
|
|
|
|
'r' => 583,
|
|
|
|
'op' => '=',
|
|
|
|
),
|
|
|
|
26 => array(
|
|
|
|
'titre' => "Variation des emprunts (D)",
|
|
|
|
'r' => 586,
|
|
|
|
'op' => '=',
|
|
|
|
),
|
|
|
|
27 => array(
|
|
|
|
'titre' => "Variation de la tresorerie du passif (E)",
|
|
|
|
'r' => 589,
|
|
|
|
'op' => '=',
|
|
|
|
),
|
|
|
|
28 => array(
|
|
|
|
'titre' => "Flux du financement (F)=(C)+(D)+(E)",
|
|
|
|
'r' => 590,
|
|
|
|
'op' => '=',
|
|
|
|
),
|
|
|
|
29 => array(
|
|
|
|
'titre' => "VARIATION DE TRESORERIE D'ACTIF",
|
|
|
|
'r' => '',
|
|
|
|
'op' => '=',
|
|
|
|
),
|
|
|
|
30 => array(
|
|
|
|
'titre' => "Variation du disponible",
|
|
|
|
'r' => 591,
|
|
|
|
'op' => '',
|
|
|
|
),
|
|
|
|
31 => array(
|
|
|
|
'titre' => "Variation des valeurs mobilieres de placement",
|
|
|
|
'r' => 592,
|
|
|
|
'op' => '',
|
|
|
|
),
|
|
|
|
32 => array(
|
|
|
|
'titre' => "Variation de la tresorerie d'actif = (A)-(I)+(F)",
|
|
|
|
'r' => 593, 'op' => '=', 'class' => 'subhead'
|
|
|
|
),
|
2012-04-05 09:14:03 +00:00
|
|
|
);
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2012-04-05 09:14:03 +00:00
|
|
|
for ( $i=0 ; $i<count($dataTable) ; $i++ ) {
|
2012-05-20 16:31:28 +00:00
|
|
|
$values = array();
|
2012-04-05 09:14:03 +00:00
|
|
|
if ( !empty($dataTable[$i]['r']) ) {
|
2012-05-20 16:31:28 +00:00
|
|
|
foreach ($dateCloture as $k=>$date) {
|
2012-04-05 09:14:03 +00:00
|
|
|
$values[$date] = $ratiosData->dRatio($typeBilan, $date, 'r'.$dataTable[$i]['r']);
|
|
|
|
}
|
|
|
|
}
|
2012-05-20 16:31:28 +00:00
|
|
|
$dataTable[$i]['values'] = $values;
|
2012-11-19 15:53:10 +00:00
|
|
|
}
|
2012-04-05 09:14:03 +00:00
|
|
|
$this->view->assign('dataTable',$dataTable);
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2012-04-05 09:14:03 +00:00
|
|
|
//Calcul du graph
|
|
|
|
$labels = array();
|
|
|
|
$data = array();
|
2012-11-19 15:53:10 +00:00
|
|
|
$graphRatio = array(28, 21, 13);
|
|
|
|
foreach ($graphRatio as $iRatio => $ratio) {
|
|
|
|
$data[$iRatio]['titre'] = $dataTable[$ratio]['titre'];
|
|
|
|
$data[$iRatio]['values'] = array();
|
|
|
|
foreach ($dateCloture as $k=>$date) {
|
|
|
|
$data[$iRatio]['values'][] = $ratiosEntrep[$date]['r'.$dataTable[$ratio]['r']];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
foreach ($dateCloture as $k=>$date) {
|
|
|
|
$labels[] = substr($date, 0, 4);
|
2012-04-05 09:14:03 +00:00
|
|
|
}
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2012-11-19 15:53:10 +00:00
|
|
|
$graph = new RatiosGraph($this->siret, $this->id);
|
|
|
|
$image = $graph->flux($labels, $data, $typeBilan);
|
|
|
|
if ( $image != false ){
|
2012-04-05 09:14:03 +00:00
|
|
|
$this->view->assign('graph', $image);
|
|
|
|
}
|
2012-05-20 16:31:28 +00:00
|
|
|
|
2012-11-19 15:53:10 +00:00
|
|
|
}
|
2011-04-11 14:19:14 +00:00
|
|
|
}
|