diff --git a/application/controllers/FinanceController.php b/application/controllers/FinanceController.php
index 6587c7821..eb35c8e02 100644
--- a/application/controllers/FinanceController.php
+++ b/application/controllers/FinanceController.php
@@ -15,6 +15,10 @@ class FinanceController extends Zend_Controller_Action
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();
@@ -24,13 +28,14 @@ class FinanceController extends Zend_Controller_Action
$this->entreprise->naf = $entreprise->getNaf();
$this->imageCachePath = APPLICATION_PATH. '/../cache/pages/imgcache/';
$this->idSC = $this->getRequest()->getParam('id');
- $this->entreprise->siren = substr($this->getRequest()->getParam('siret'), 0, 9);
+ $this->entreprise->siren = substr($this->getRequest()->getParam('siret'), 0, 9);
$this->view->assign('dateFunction', $this->dateFunction);
$this->view->headLink()
->appendStylesheet('/themes/default/styles/finance.css', 'all');
$this->view->headScript()
->appendFile('/themes/default/scripts/finance.js', 'text/javascript');
+
}
@@ -213,41 +218,54 @@ class FinanceController extends Zend_Controller_Action
self::getVal($id, $dataX[$id], $synthese);
}
- echo '
';
- print_r($dataX);exit;
}
/* --------------------------------------------------------------------------------------------------- */
/* Gestion des bilans ACTIF/PASSIF/CR */
/* ----------------------------------------------------------------------------------------------------*/
-
- protected function constructElementForBilan($bilan, $tableauDeReference, &$type, &$date)
- {
+
+ protected function constructElementForBilan($bilan, $tableauDeReference, &$type, &$date, &$duree, $typebilan)
+ {
foreach($bilan->BilansInfos->item as $element) {
- if (@count($date) < 6) {
- if(!in_array($element->dateCloture, $date))
- $date[] = $element->dateCloture;
+ if($element->typeBilan == $typebilan)
+ {
+ if($duree == EOF)
+ $duree = $element->duree;
+ if (@count($date) < 5) {
+ if(!in_array($element->dateCloture, $date))
+ $date[] = $element->dateCloture;
+ }
+ foreach($element->RatiosEntrep->item as $item) {
+ foreach($tableauDeReference as $id => $valeur) {
+ if ($item->id == $id) {
+ if (count($type[$id]['item']) < 5) {
+ if ($item->val > 0) {
+ $type[$id]['item'][$element->dateCloture] = $item->val / 1000;
+ }
+ else
+ $type[$id]['item'][$element->dateCloture] = 0;
+ }
+ }
+ }
+ }
}
- foreach($element->RatiosEntrep->item as $item) {
- foreach($tableauDeReference as $id => $valeur) {
- if ($item->id == $id) {
- if (count($type[$valeur]) < 6)
- $type[$valeur][$element->dateCloture] = $item->val;
- }
- }
- }
}
+ foreach ($type as $id => $valeur) {
+ $type[$id]['item'] = array_reverse($valeur['item']);
+ }
+ $date = array_reverse($date);
}
- public function bilansAction()
+ public function bilanAction()
{
$actif = array();
$passif = array();
$SIG = array();
$date = array();
-
- $referenceActif = array('r59' => 'Actif Immobilisé Net', 'r51' => 'Incorporelles',
- 'r52' => 'Corporelles', 'r53' => 'Financières',
+ $duree = EOF;
+ $listeBilan = array('actif', 'passif', 'sig');
+ $referenceActif = array('r52' => 'Corporelles', 'r51' => 'Incorporelles',
+ 'r59' => 'Actif Immobilisé Net', 'r53' => 'Financières',
'r69' => 'Actif Circulant Net', 'r60' => 'Stock et encours',
'r61' => 'Créances Clients', 'r62' => 'Autres Créances',
'r00' => '', 'r63' => 'Trésorerie Active',
@@ -262,29 +280,44 @@ class FinanceController extends Zend_Controller_Action
'r22' => 'TOTAL PASSIF'
);
$referenceSIG = array('r101' => 'CHIFFRE D\'AFFAIRES HORS TAXE', 'r102' => '-Achat de marchandises, de matières premières',
- 'r110' => 'MARGE COMMERCIALE', 'r111' => '+Production vendue',
- 'r112' => '+Production immobilisée et stockée', 'r120' => 'PRODUCTION DE L\'EXERCICE',
- 'r121' =>'Variation de stock de marchandises et matières premières', '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',
+
+ 'r110' => 'MARGE COMMERCIALE', 'r111' => '+Production vendue',
+ 'r112' => '+Production immobilisée et stockée',
+
+ 'r120' => 'PRODUCTION DE L\'EXERCICE',
+ 'r121' => 'Variation de stock de marchandises et matières premières',
+
+ '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',
- 'r182' => '-Participation salariale', 'r199' => 'RÉSULTAT NET'
+ 'r182' => '-Participation salariale',
+
+ 'r199' => 'RÉSULTAT NET'
);
$bilan = array();
- $typeBilan = /*$this->getrequest()->getParam('typebilan')*/ 'N';
+ $typeBilan = /*$this->getrequest()->getParam('typebilan')*/ 'C';
$bilan = $this->ws->getRatios($this->entreprise->siren, 'ratios');
- self::constructElementForBilan($bilan, $referenceActif, $actif, $date);
- self::constructElementForBilan($bilan, $referencePassif, $passif, $date);
- self::constructElementForBilan($bilan, $referenceSIG, $SIG, $date);
-
+ self::constructElementForBilan($bilan, $referenceActif, $actif, $date, $duree, $typeBilan);
+ self::constructElementForBilan($bilan, $referencePassif, $passif, $date, $duree, $typeBilan);
+ self::constructElementForBilan($bilan, $referenceSIG, $SIG, $date, $duree, $typeBilan);
+
+ $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);
diff --git a/application/views/default/scripts/finance/bilan.phtml b/application/views/default/scripts/finance/bilan.phtml
new file mode 100644
index 000000000..ad29df327
--- /dev/null
+++ b/application/views/default/scripts/finance/bilan.phtml
@@ -0,0 +1,15 @@
+
+
Les bilans
+
+ listeBilan as $bilan):?>
+ partial('finance/bilansPartials/'.$bilan.'.partial.phtml',
+ array(
+ 'date' => $this->date,
+ 'duree' => $this->duree,
+ 'dateFunction' => $this->dateFunction,
+ $bilan => $this->$bilan
+ ));
+ ?>
+
+
+
\ No newline at end of file
diff --git a/application/views/default/scripts/finance/bilans.phtml b/application/views/default/scripts/finance/bilans.phtml
deleted file mode 100644
index 25035f07f..000000000
--- a/application/views/default/scripts/finance/bilans.phtml
+++ /dev/null
@@ -1,50 +0,0 @@
-
-
- |
- date as $date):?>
- |
-
-
- actif as $name => $actif):?>
-
- |
-
- |
-
-
-
-
-
-
-
- |
- date as $date):?>
- |
-
-
- passif as $name => $passif):?>
-
- |
-
- |
-
-
-
-
-
-
-
- |
- date as $date):?>
- |
-
-
- sig as $name => $sig):?>
-
- |
-
- |
-
-
-
-
\ No newline at end of file
diff --git a/application/views/default/scripts/finance/bilansPartials/actif.partial.phtml b/application/views/default/scripts/finance/bilansPartials/actif.partial.phtml
new file mode 100644
index 000000000..48242be4b
--- /dev/null
+++ b/application/views/default/scripts/finance/bilansPartials/actif.partial.phtml
@@ -0,0 +1,84 @@
+actif['r22']['item'])?>
+Bilan actif - passif
+
+
+
+ Actif |
+ date as $date):?>
+ dateFunction->dateT('Ymd', 'd/m/Y', $date);?>
+ duree;?> Mois |
+
+ % T.B. |
+
+
+
+ Actif Immobilisé Net |
+ actif['r59']['item'] as $element): ?>
+ |
+
+ actif['r22']['item'][key($this->actif['r22']['item'])],2);?> |
+
+
+ Incorporelles |
+ actif['r51']['item'] as $element): ?>
+ |
+
+ actif['r22']['item'][key($this->actif['r22']['item'])],2);?> |
+
+
+ Corporelles |
+ actif['r52']['item'] as $element): ?>
+ |
+
+ actif['r22']['item'][key($this->actif['r22']['item'])],2);?> |
+
+
+ Financières |
+ actif['r53']['item'] as $element): ?>
+ |
+
+ actif['r22']['item'][key($this->actif['r22']['item'])],2);?> |
+
+
+ Actif Circulant Net |
+ actif['r69']['item'] as $element): ?>
+ |
+
+ actif['r22']['item'][key($this->actif['r22']['item'])],2);?> |
+
+
+ Stock et encours |
+ actif['r60']['item'] as $element): ?>
+ |
+
+ actif['r22']['item'][key($this->actif['r22']['item'])],2);?> |
+
+
+ Créances Clients |
+ actif['r61']['item'] as $element): ?>
+ |
+
+ actif['r22']['item'][key($this->actif['r22']['item'])],2);?> |
+
+
+ Autres Créances |
+ actif['r62']['item'] as $element): ?>
+ |
+
+ actif['r22']['item'][key($this->actif['r22']['item'])],2);?> |
+
+
+ Trésorerie Active |
+ actif['r63']['item'] as $element): ?>
+ |
+
+ actif['r22']['item'][key($this->actif['r22']['item'])],2);?> |
+
+
+ TOTAL ACTIF |
+ actif['r22']['item'] as $element): ?>
+ |
+
+ |
+
+
\ No newline at end of file
diff --git a/application/views/default/scripts/finance/bilansPartials/passif.partial.phtml b/application/views/default/scripts/finance/bilansPartials/passif.partial.phtml
new file mode 100644
index 000000000..9063ce44e
--- /dev/null
+++ b/application/views/default/scripts/finance/bilansPartials/passif.partial.phtml
@@ -0,0 +1,90 @@
+passif['r22']['item'])?>
+
+
+
+ Passif |
+ date as $date):?>
+ dateFunction->dateT('Ymd', 'd/m/Y', $date);?>
+ duree;?> Mois |
+
+ % T.B. |
+
+
+
+ Ressources Propres |
+ passif['r79']['item'] as $element): ?>
+ |
+
+ passif['r22']['item'][key($this->passif['r22']['item'])],2);?> |
+
+
+ Fonds Propres |
+ passif['r70']['item'] as $element): ?>
+ |
+
+ passif['r22']['item'][key($this->passif['r22']['item'])],2);?> |
+
+
+ Provisions Risques |
+ passif['r71']['item'] as $element): ?>
+ |
+
+ passif['r22']['item'][key($this->passif['r22']['item'])],2);?> |
+
+
+ Comptes Courants |
+ passif['r72']['item'] as $element): ?>
+ |
+
+ passif['r22']['item'][key($this->passif['r22']['item'])],2);?> |
+
+
+ Ressources Externes |
+ passif['r90']['item'] as $element): ?>
+ |
+
+ passif['r22']['item'][key($this->passif['r22']['item'])],2);?> |
+
+
+ Dettes Financières |
+ passif['r83']['item'] as $element): ?>
+ |
+
+ passif['r22']['item'][key($this->passif['r22']['item'])],2);?> |
+
+
+ Dettes Fournisseurs |
+ passif['r84']['item'] as $element): ?>
+ |
+
+ passif['r22']['item'][key($this->passif['r22']['item'])],2);?> |
+
+
+ Dettes Fiscales |
+ passif['r85']['item'] as $element): ?>
+ |
+
+ passif['r22']['item'][key($this->passif['r22']['item'])],2);?> |
+
+
+ Autres Dettes |
+ passif['r86']['item'] as $element): ?>
+ |
+
+ passif['r22']['item'][key($this->passif['r22']['item'])],2);?> |
+
+
+ Trésorerie Passive |
+ passif['r87']['item'] as $element): ?>
+ |
+
+ passif['r22']['item'][key($this->passif['r22']['item'])],2);?> |
+
+
+ TOTAL PASSIF |
+ passif['r22']['item'] as $element): ?>
+ |
+
+ |
+
+
\ No newline at end of file
diff --git a/application/views/default/scripts/finance/bilansPartials/sig.partial.phtml b/application/views/default/scripts/finance/bilansPartials/sig.partial.phtml
new file mode 100644
index 000000000..0a3a11d20
--- /dev/null
+++ b/application/views/default/scripts/finance/bilansPartials/sig.partial.phtml
@@ -0,0 +1,237 @@
+sig['r101']['item'])?>
+Soldes Intermédiaire de Gestion
+
+
+
+ SOLDES INTERMEDIAIRES DE GESTION |
+ date as $date):?>
+ dateFunction->dateT('Ymd', 'd/m/Y', $date);?>
+ duree;?> Mois |
+
+ % C.A. |
+
+
+
+ CHIFFRE D'AFFAIRES HORS TAXE |
+ sig['r101']['item'] as $element): ?>
+ |
+
+ |
+
+
+ - |
+ Achat de marchandises, de matières premières |
+ sig['r102']['item'] as $element): ?>
+ |
+
+ |
+
+
+ MARGE COMMERCIALE |
+ sig['r110']['item'] as $element): ?>
+ |
+
+ |
+
+
+ + |
+ Production vendue |
+ sig['r111']['item'] as $element): ?>
+ |
+
+ |
+
+
+ + |
+ Production immobilisée et stockée |
+ sig['r112']['item'] as $element): ?>
+ |
+
+ |
+
+
+ PRODUCTION DE L'EXERCICE |
+ sig['r120']['item'] as $element): ?>
+ |
+
+ |
+
+
+ + |
+ Variation de stock de marchandises et matières premières |
+ sig['r121']['item'] as $element): ?>
+ |
+
+ |
+
+
+ MARGE BRUTE |
+ sig['r122']['item'] as $element): ?>
+ |
+
+ |
+
+
+ - |
+ Autres charges externes |
+ sig['r123']['item'] as $element): ?>
+ |
+
+ |
+
+
+ VALEUR AJOUTÉE |
+ sig['r130']['item'] as $element): ?>
+ |
+
+ |
+
+
+ - |
+ Charges de personnel |
+ sig['r132']['item'] as $element): ?>
+ |
+
+ |
+
+
+ - |
+ Impôts, taxes & versements assimilés |
+ sig['r133']['item'] as $element): ?>
+ |
+
+ |
+
+
+ + |
+ Subventions d'exploitation |
+ sig['r131']['item'] as $element): ?>
+ |
+
+ |
+
+
+ EXCÉDENT BRUT D'EXPLOITATION (EBE) |
+ sig['r140']['item'] as $element): ?>
+ |
+
+ |
+
+
+ + |
+ Autres produits d'exploitation |
+ sig['r141']['item'] as $element): ?>
+ |
+
+ |
+
+
+ - |
+ Autres charges d'exploitation |
+ sig['r142']['item'] as $element): ?>
+ |
+
+ |
+
+
+ + |
+ Reprise sur dotations & transferts de charges |
+ sig['r143']['item'] as $element): ?>
+ |
+
+ |
+
+
+ + |
+ 70% Loyer de crédit bail |
+ sig['r144']['item'] as $element): ?>
+ |
+
+ |
+
+
+ - |
+ Dotations d'exploitation & provisions d'exploitation |
+ sig['r145']['item'] as $element): ?>
+ |
+
+ |
+
+
+ RÉSULTAT D'EXPLOITATION |
+ sig['r150']['item'] as $element): ?>
+ |
+
+ |
+
+
+ + |
+ Produits financiers |
+ sig['r151']['item'] as $element): ?>
+ |
+
+ |
+
+
+ + |
+ 30% Loyer de crédit bail |
+ sig['r152']['item'] as $element): ?>
+ |
+
+ |
+
+
+ + |
+ Charges financières |
+ sig['r153']['item'] as $element): ?>
+ |
+
+ |
+
+
+ RÉSULTAT COURANT AVANT IMPOTS |
+ sig['r170']['item'] as $element): ?>
+ |
+
+ |
+
+
+ + |
+ Produits exceptionnels |
+ sig['r171']['item'] as $element): ?>
+ |
+
+ |
+
+
+ - |
+ Charges exceptionnelles |
+ sig['r172']['item'] as $element): ?>
+ |
+
+ |
+
+
+ - |
+ Impôts sur les bénéfices |
+ sig['r181']['item'] as $element): ?>
+ |
+
+ |
+
+
+ - |
+ Participation salariale |
+ sig['r182']['item'] as $element): ?>
+ |
+
+ |
+
+
+ RÉSULTAT NET |
+ sig['r199']['item'] as $element): ?>
+ |
+
+ |
+
+
\ No newline at end of file
diff --git a/application/views/default/scripts/finance/liasse.phtml b/application/views/default/scripts/finance/liasse.phtml
index f18cdb78c..6a97d33a7 100644
--- a/application/views/default/scripts/finance/liasse.phtml
+++ b/application/views/default/scripts/finance/liasse.phtml
@@ -63,21 +63,21 @@
champType == 'N' or $this->champType == 'S'):?>
- partial('finance/partials/'.$partial.'.partial.phtml',
+ partial('finance/liassesPartials/'.$partial.'.partial.phtml',
array('liasse' => $this->liasse,
'dateCloture' => $this->dateFunction->dateT('Ymd', 'd/m/Y', $this->dateCloture),
'dateCloturePre' => $this->dateFunction->dateT('Ymd', 'd/m/Y', $this->dateCloturePre),
'dureesMois' => $this->dureesMois,
'dureesMoisPre'=> $this->dureesMois)).'
';?>
champType == 'B'):?>
- partial('finance/partials/banque/'.$partial.'.partial.phtml',
+ partial('finance/liassesPartials/banque/'.$partial.'.partial.phtml',
array('liasse' => $this->liasse,
'dateCloture' => $this->dateFunction->dateT('Ymd', 'd/m/Y', $this->dateCloture),
'dateCloturePre' => $this->dateFunction->dateT('Ymd', 'd/m/Y', $this->dateCloturePre),
'dureesMois' => $this->dureesMois,
'dureesMoisPre'=> $this->dureesMois)).'
';?>
champType == 'A'):?>
- partial('finance/partials/assurance/'.$partial.'.partial.phtml',
+ partial('finance/liassesPartials/assurance/'.$partial.'.partial.phtml',
array('liasse' => $this->liasse,
'dateCloture' => $this->dateFunction->dateT('Ymd', 'd/m/Y', $this->dateCloture),
'dateCloturePre' => $this->dateFunction->dateT('Ymd', 'd/m/Y', $this->dateCloturePre),
diff --git a/public/themes/default/styles/finance.css b/public/themes/default/styles/finance.css
index edb80726e..fb40a8315 100644
--- a/public/themes/default/styles/finance.css
+++ b/public/themes/default/styles/finance.css
@@ -1,5 +1,18 @@
@CHARSET "UTF-8";
+.bilans {font-family:"Lucida Sans Unicode", "Lucida Grande", Sans-Serif; font-size:12px; margin: 10px 0 0 0; width:100%; text-align:left; border-collapse:collapse;}
+.bilans th {padding:4px; font-weight:normal; font-size:11px; border:1px solid #000; color:#000; background:#b9c9fe; text-align:center; font-weight:bold;}
+.bilans td {font-size:11px;padding:4px; border:1px solid #000; color:#000;}
+.bilans td.graph {padding:0; margin:0;}
+.bilans th.date {font-size:10px;}
+.bilans td.right {text-align:right;}
+.bilans td.center {text-align: center;}
+.bilans td.italique {font-style:italic;}
+.bilans tr.subhead td {font-size:11px;padding:4px; background:#b9c9fe; border: 1px solid #000; font-weight:bold; color:#000;}
+.bilans tr.darkblue td {padding:4px; background:#00008c; border: 1px solid #000; font-weight:bold; color:#fff;}
+.entete {margin:1px;}
+.subentete {margin:2px;}
+
#ratios tr.subhead td
{
background: none repeat scroll 0 0 #B9C9FE;