Modification des bilans + des news

This commit is contained in:
Damien LASSERRE 2011-05-19 15:48:36 +00:00
parent 873888779b
commit 919fd78382
11 changed files with 315 additions and 151 deletions

View File

@ -455,6 +455,168 @@ class FinanceController extends Zend_Controller_Action
}
return ($tb);
}
protected function selectTitleForGraphique($title) {
switch ($title) {
case 'actif':
return ('Composition de l\'actif');
case 'passif':
return ('Composition du passif');
case 'sig':
return ('');
}
}
protected function makeBigGraphiqueBilan($type, $data, $siren, $annee, $i, $unite)
{
$filename = $siren;
$file = $i.'-'.$filename.'-graph-actif.png';
$w = 660;
$h = 243;
$x = round($w/2);
$y = round($h/2);
$radius = 90;
$c = new PieChart($w, $h);
$labels = array('Immo. incorporelles', 'Immo. corporelles',
'Immo. financières', 'Stock et encours',
'Créances Clients', 'Autres créances',
'Trésorerie Active');
$t = $c->setLabelStyle();
$t->setBackground(SameAsMainColor, Transparent, glassEffect());
$t->setRoundedCorners(5);
$c->setLineColor(SameAsMainColor, 0x000000);
$c->setStartAngle(135);
$c->setLabelFormat("<*block,valign=absmiddle*>{label} <*font=timesbi.ttf,size=0*>({percent|0}%)");
$c->setData($data, $labels);
$c->set3D(20);
$chart1URL = $c->makeSession("chart1"); // Gère le cache immédiat de la page ( F5 ).
$imageMap = $c->getHTMLImageMap("", "", "name='{label}' title='<b>{label}</b> ".$annee."<br />{value|0} ".$unite."' class='detailsgraphique'");
$c->makeChart($this->imageCachePath.$file);
$parametres = new stdClass();
$parametres->file = $file;
$parametres->chart1URL = $chart1URL;
$parametres->imageMap = $imageMap;
$parametres->i = $i;
return ($parametres);
}
public function actifgraphAction()
{
$type = 'actif';
$data = $this->getRequest()->getParam('data');
$siren = $this->getRequest()->getParam('siren');
$annee = $this->getRequest()->getParam('annee');
$i = $this->getRequest()->getParam('i');
$parametres = self::makeBigGraphiqueBilan($type, $data, $siren, $annee, $i, 'K.euros');
$this->view->assign('file', $parametres->file);
$this->view->assign('chart1URL', $parametres->chart1URL);
$this->view->assign('imageMap', $parametres->imageMap);
$this->view->assign('i', $parametres->i);
$this->render('printgraphbilan');
}
public function passifgraphAction()
{
$data = $this->getRequest()->getParam('data');
$siren = $this->getRequest()->getParam('siren');
$annee = $this->getRequest()->getParam('annee');
$i = $this->getRequest()->getParam('i');
$filename = $siren;
$file = $i.'-'.$filename.'-graph-passif.png';
$w = 660;
$h = 243;
$x = round($w/2);
$y = round($h/2);
$radius = 90;
$c = new PieChart($w, $h);
$labels = array('Fonds propres',
'Provisions Risques',
'Compte Courant',
'Dettes Financières',
'Dettes Fournisseurs',
'Dettes fiscales',
'Autres Dettes',
'Trésorerie Passive'
);
$textBoxObj = $c->addTitle("Composition du passif", "timesbi.ttf", 15);
$c->setPieSize($x, $y, $radius);
$c->setLabelLayout(SideLayout);
$t = $c->setLabelStyle();
$t->setBackground(SameAsMainColor, Transparent, glassEffect());
$t->setRoundedCorners(5);
# Set the border color of the sector the same color as the fill color. Set the line # color of the join line to black (0x0)
$c->setLineColor(SameAsMainColor, 0x000000);
$c->setStartAngle(135);
$c->setLabelFormat("<*block,valign=absmiddle*>{label} <*font=timesbi.ttf,size=0*>({percent|0}%)");
$c->setData($data, $labels);
$c->set3D(20);
$chart1URL = $c->makeSession("chart1");
$imageMap = $c->getHTMLImageMap("", "", "name='{label}' title='<b>{label}</b><br />{value|0} K.Euros' class='detailsgraphique'");
$c->makeChart($this->imageCachePath.$file);
$this->view->assign('file', $file);
$this->view->assign('chart1URL', $chart1URL);
$this->view->assign('imageMap', $imageMap);
$this->view->assign('i', '2'.$i);
$this->render('printgraphbilan');
}
public function siggraphAction()
{
$data = $this->getRequest()->getParam('data');
$siren = $this->getRequest()->getParam('siren');
$annee = $this->getRequest()->getParam('annee');
$i = $this->getRequest()->getParam('i');
$filename = $siren;
$file = $i.'-'.$filename.'-graph-sig.png';
$w = 660;
$h = 243;
$x = round($w/2);
$y = round($h/2);
$radius = 90;
$c = new PieChart($w, $h);
$labels = array('Achats de marchandises.',
'Autres achats externes',
'Charges de fonctionnement',
'Amortissement et provisions',
'Perte financière',
'Impôts sociétés',
'RÉSULTAT NET',
);
$textBoxObj = $c->addTitle("Solde intermédiaire de gestion", "timesbi.ttf", 15);
$c->setPieSize($x, $y, $radius);
$c->setLabelLayout(SideLayout);
$t = $c->setLabelStyle();
$t->setBackground(SameAsMainColor, Transparent, glassEffect());
$t->setRoundedCorners(5);
# Set the border color of the sector the same color as the fill color. Set the line # color of the join line to black (0x0)
$c->setLineColor(SameAsMainColor, 0x000000);
$c->setStartAngle(135);
$c->setLabelFormat("<*block,valign=absmiddle*>{label} <*font=timesbi.ttf,size=0*>({percent|0}%)");
$c->setData($data, $labels);
$c->set3D(20);
$chart1URL = $c->makeSession("chart1");
$imageMap = $c->getHTMLImageMap("", "", "name='{label}' title='<b>{label}</b><br />{value|0} %' class='detailsgraphique'");
$c->makeChart('../cache/pages/imgcache/'.$file);
$c->makeChart($this->imageCachePath.$file);
$this->view->assign('file', $file);
$this->view->assign('chart1URL', $chart1URL);
$this->view->assign('imageMap', $imageMap);
$this->view->assign('i', '3'.$i);
$this->render('printgraphbilan');
}
/* --------------------------------------------------------------------------------------------------- */
/* Gestion des ratios avec les graphiques */
@ -916,6 +1078,10 @@ class FinanceController extends Zend_Controller_Action
/** ont transforme les bilan de type S en N => !!!! ERREUR !!!! **/
$NandS = array_merge($liste['N'], $liste['S']);
$liste['N'] = $NandS;unset($liste['S']);
/**
* Utiliser un système de masque pour mapper les données sur le rapport normal.
* Exemple : DL => 142
*/
if (!empty($date)) {
$dateAndType = explode(':', $date);

View File

@ -1,36 +0,0 @@
<?php
require_once ('ChartDirector/phpchartdir.php');
Class Zend_View_Helper_ActifGraph extends Zend_View_Helper_Abstract
{
public function ActifGraph($data, $siren, $url, $annee)
{
$filename = $siren;
$file = $filename.'-graph-actif.png';
$w = 660;
$h = 243;
$x = round($w/2);
$y = round($h/2);
$radius = 90;
$c = new PieChart($w, $h);
$labels = array('Immo. incorporelles', 'Immo. corporelles',
'Immo. financières', 'Stock et encours',
'Créances Clients', 'Autres créances',
'Trésorerie Active');
$textBoxObj = $c->addTitle("Composition de l'actif", "timesbi.ttf", 15);
$c->setPieSize($x, $y, $radius);
$c->setLabelLayout(SideLayout);
$t = $c->setLabelStyle();
$t->setBackground(SameAsMainColor, Transparent, glassEffect());
$t->setRoundedCorners(5);
$c->setLineColor(SameAsMainColor, 0x000000);
$c->setStartAngle(135);
$c->setLabelFormat("<*block,valign=absmiddle*>{label} <*font=timesbi.ttf,size=0*>({percent|0}%)");
$c->setData($data, $labels);
$c->set3D(20);
$chart1URL = $c->makeSession("chart1"); // Gère le cache immédiat de la page ( F5 ).
$imageMap = $c->getHTMLImageMap("", "", "name='{label}' title='<b>{label}</b> ".$annee."<br />{value|0} K.Euros' class='detailsgraphique'");
$c->makeChart('../cache/pages/imgcache/'.$file);
echo '<img src="/fichier/imgcache/'.$file.'?'.$chart1URL.'" border="1" usemap="#map1"><map name="map1">'.$imageMap.'</map>';
}
}

View File

@ -16,9 +16,11 @@ Class Zend_View_Helper_LineBilan extends Zend_View_Helper_Abstract
if($element != 'NS') {
if ($element != 0 and $reference != 0) {
return (round(($element * 100) / $reference, 2));
} else {
return($element);
}
}
return (0);
return (false);
}
/**
@ -79,22 +81,25 @@ Class Zend_View_Helper_LineBilan extends Zend_View_Helper_Abstract
return (false);
}
public function specialSIG($id, $partial)
public function specialSIG($id, $element, $partial, $count)
{
if ($id == 'r101')
return self::Tb(end($partial['r101']['item']), end($partial['r101']['item'])) - self::Tb(end($partial['r122']['item']), end($partial['r101']['item']));
else if ($id == 'r122')
return self::Tb(end($partial['r122']['item']), end($partial['r101']['item'])) - self::Tb(end($partial['r130']['item']), end($partial['r101']['item']));
else if ($id == 'r130')
return self::Tb(end($partial['r130']['item']), end($partial['r101']['item'])) - self::Tb(end($partial['r140']['item']), end($partial['r101']['item']));
else if ($id == 'r140')
return self::Tb(end($partial['r140']['item']), end($partial['r101']['item'])) - self::Tb(end($partial['r150']['item']), end($partial['r101']['item']));
else if ($id == 'r150')
return self::Tb(end($partial['r150']['item']), end($partial['r101']['item'])) - self::Tb(end($partial['r170']['item']), end($partial['r101']['item']));
else if ($id == 'r170')
return self::Tb(end($partial['r170']['item']), end($partial['r101']['item'])) - self::Tb(end($partial['r199']['item']), end($partial['r101']['item']));
else if ($id == 'r199')
return self::Tb(end($partial['r199']['item']), end($partial['r101']['item']));
if($element != 'NS') {
if ($id == 'r101')
return self::Tb($element, $element) - self::Tb($partial['r122']['item'][$count], $partial['r101']['item'][$count]);
else if ($id == 'r122')
return self::Tb($element, $partial['r101']['item'][$count]) - self::Tb($partial['r130']['item'][$count], $partial['r101']['item'][$count]);
else if ($id == 'r130')
return self::Tb($element, $partial['r101']['item'][$count]) - self::Tb($partial['r140']['item'][$count], $partial['r101']['item'][$count]);
else if ($id == 'r140')
return self::Tb($element, $partial['r101']['item'][$count]) - self::Tb($partial['r150']['item'][$count], $partial['r101']['item'][$count]);
else if ($id == 'r150')
return self::Tb($element, $partial['r101']['item'][$count]) - self::Tb($partial['r170']['item'][$count], $partial['r101']['item'][$count]);
else if ($id == 'r170')
return self::Tb($element, $partial['r101']['item'][$count]) - self::Tb($partial['r199']['item'][$count], $partial['r101']['item'][$count]);
else if ($id == 'r199')
return self::Tb($element, $partial['r101']['item'][$count]);
} else
return (null);
}
/**
@ -110,19 +115,23 @@ Class Zend_View_Helper_LineBilan extends Zend_View_Helper_Abstract
*/
public function LineBilan($id, $Graphdate, $partial, $reference, $url, $name, $tb_reference, $siren, $sig = false)
{
$i = 0;
$this->column = 0;
echo '<tr '.((self::ifIsHead($id))?'class="subhead"':'class="bilanDatas"').'>';
echo '<td>'.$name.'</td>';
foreach($partial[$id]['item'] as $element) {
if($element != 'NS'){ $GraphLine[] = $number = $element; }else{$number = 0; $GraphLine[] = 0;};
echo '<td align="right">' . (($element != 'NS') ? number_format($element, 0, '', ' ') . ' K€':$element).'</td>';
if($sig)$gr = self::specialSIG($id, $partial);
if(self::createlementForGraphique($id))$gr = $number;
if($sig) {
$result = self::specialSIG($id, $element, $partial, $i);
if($result != null){
$gr[] = $result;$i++;
}
}
else
if(self::createlementForGraphique($id))$gr[] = $number;
}
if($id != 'r22' and $id != 'r101')
echo '<td align="right">' . self::Tb($element, (!$this->sig)?$partial[$tb_reference]['item'][key($partial[$tb_reference]['item'])]:$this->sig) . '</td>';
else
echo '<td align="right">'.self::Tb($element, (($this->sig)?$this->sig = $element:$element)).'</td>';
echo '<td align="right">'.self::Tb(end($partial[$id]['item']), end($partial[$tb_reference]['item'])).'</td>';
self::GraphLineBilan($GraphLine, $id.'-'.$siren, $Graphdate);
echo '<td>';
echo '<a name="Actif Immobilisé Net" class="rTip"

View File

@ -0,0 +1,58 @@
<?php
Class Zend_View_Helper_News extends Zend_View_Helper_Abstract
{
protected $jours = array('Mon,' => 'Lundi',
'Tue,' => 'Mardi',
'Wed,' => 'Mercredi',
'Thu,' => 'Jeudi',
'Fri,' => 'Vendredi',
'Sat,' => 'Samedi',
'Sun,' => 'Dimanche'
);
protected $mois = array ('Jan' => 'Janvier',
'Feb' => 'Février',
'Mar' => 'Mars',
'Apr' => 'Avril',
'May' => 'Mai',
'Jun' => 'Juin',
'Jul' => 'Juillet',
'Aug' => 'Aout',
'Sep' => 'Septembre',
'Oct' => 'Octobre',
'Nov' => 'Novembre',
'Dev' => 'Décembre'
);
private function returnNumberMonth($moisRecherche) {
$i = 0;
foreach($this->mois as $mois => $valeur) {
if (($i + 1) == $moisRecherche) {
return ($mois);
}
$i++;
}
}
public function News($date)
{
$elementDate = explode(' ',$date);
$today = explode('/', date('d/m/Y'));
if ((self::returnNumberMonth($today[1]) == $elementDate[2]) and $today[0] == $elementDate[1])
return ('Aujourd\'huit');
$dateFormate = '';
foreach ($this->jours as $jour => $valeurFR) {
if ($jour == $elementDate[0])
$dateFormate = $valeurFR;
}
$dateFormate .= ' '.$elementDate[1].' ';
foreach ($this->mois as $mois => $valeurFR) {
if ($mois == $elementDate[2])
$dateFormate .= $valeurFR;
}
return ($dateFormate .= ' '.$elementDate[3]);
}
}

View File

@ -1,42 +0,0 @@
<?php
require_once ('ChartDirector/phpchartdir.php');
Class Zend_View_Helper_PassifGraph extends Zend_View_Helper_Abstract
{
public function PassifGraph($data, $siren, $url)
{
$filename = $siren;
$file = $filename.'-graph-passif.png';
$w = 660;
$h = 243;
$x = round($w/2);
$y = round($h/2);
$radius = 90;
$c = new PieChart($w, $h);
$labels = array('Fonds propres',
'Provisions Risques',
'Compte Courant',
'Dettes Financières',
'Dettes Fournisseurs',
'Dettes fiscales',
'Autres Dettes',
'Trésorerie Passive'
);
$textBoxObj = $c->addTitle("Composition du passif", "timesbi.ttf", 15);
$c->setPieSize($x, $y, $radius);
$c->setLabelLayout(SideLayout);
$t = $c->setLabelStyle();
$t->setBackground(SameAsMainColor, Transparent, glassEffect());
$t->setRoundedCorners(5);
# Set the border color of the sector the same color as the fill color. Set the line # color of the join line to black (0x0)
$c->setLineColor(SameAsMainColor, 0x000000);
$c->setStartAngle(135);
$c->setLabelFormat("<*block,valign=absmiddle*>{label} <*font=timesbi.ttf,size=0*>({percent|0}%)");
$c->setData($data, $labels);
$c->set3D(20);
$chart1URL = $c->makeSession("chart1");
$imageMap = $c->getHTMLImageMap("", "", "name='{label}' title='<b>{label}</b><br />{value|0} K.Euros' class='detailsgraphique'");
$c->makeChart('../cache/pages/imgcache/'.$file);
echo '<img src="/fichier/imgcache/'.$file.'?'.$chart1URL.'" border="1" usemap="#map2"><map name="map2">'.$imageMap.'</map>';
}
}

View File

@ -1,40 +0,0 @@
<?php
require_once ('ChartDirector/phpchartdir.php');
Class Zend_View_Helper_SigGraph extends Zend_View_Helper_Abstract
{
public function SigGraph($data, $siren, $url)
{
$filename = $siren;
$file = $filename.'-graph-sig.png';
$w = 660;
$h = 243;
$x = round($w/2);
$y = round($h/2);
$radius = 90;
$c = new PieChart($w, $h);
$labels = array('Achats de marchandises.',
'Autres achats externes',
'Charges de fonctionnement',
'Amortissement et provisions',
'Perte financière',
'Impôts sociétés',
'RÉSULTAT NET',
);
$textBoxObj = $c->addTitle("Solde intermédiaire de gestion", "timesbi.ttf", 15);
$c->setPieSize($x, $y, $radius);
$c->setLabelLayout(SideLayout);
$t = $c->setLabelStyle();
$t->setBackground(SameAsMainColor, Transparent, glassEffect());
$t->setRoundedCorners(5);
# Set the border color of the sector the same color as the fill color. Set the line # color of the join line to black (0x0)
$c->setLineColor(SameAsMainColor, 0x000000);
$c->setStartAngle(135);
$c->setLabelFormat("<*block,valign=absmiddle*>{label} <*font=timesbi.ttf,size=0*>({percent|0}%)");
$c->setData($data, $labels);
$c->set3D(20);
$chart1URL = $c->makeSession("chart1");
$imageMap = $c->getHTMLImageMap("", "", "name='{label}' title='<b>{label}</b><br />{value|0} K.Euros' class='detailsgraphique'");
$c->makeChart('../cache/pages/imgcache/'.$file);
echo '<img src="/fichier/imgcache/'.$file.'?'.$chart1URL.'" border="1" usemap="#map3"><map name="map3">'.$imageMap.'</map>';
}
}

View File

@ -1,14 +1,15 @@
<?php end($this->actif['r22']['item']);?>
<?php $tb = array();?>
<?php $tb = array();$i=0;?>
<h2>Bilan actif - passif</h2>
<table class="bilans">
<thead>
<tr>
<th>Actif</th>
<?php foreach($this->date as $date):?>
<th class="date"><?php echo $date = $this->dateFunction->dateT('Ymd', 'd/m/Y', $date);?><br />
<?php $Graphdate[] = substr($date, 6, 9);?>
<th class="date" ><?php echo $date = $this->dateFunction->dateT('Ymd', 'd/m/Y', $date);?><br />
<?php $Graphdate[] = substr($date, 6, 9);?>
<?php echo $this->duree;?> Mois</th>
<?php $i++;?>
<?php endforeach;?>
<th>% T.B.</th>
</tr>
@ -21,5 +22,19 @@
<?php if($gr)$tb[] = $gr?>
<?php endforeach;?>
</table>
<?php $this->actifGraph($tb, $this->siren.'-'.$this->typeBilan, $this, end($Graphdate));?>
<?php
$valeur = array();
$case = 0;
for ($i =0; $i < count($tb); $i++) {
foreach ($tb as $tableau) {
while($case < count($tableau)) {
$valeur[$i][] = $tableau[$case];
break;
}
}
$case++;
}
?>
<?php for($i=0; $i < count($valeur);$i++):?>
<?php echo $this->action('actifgraph', 'finance', null, array('data' => $valeur[$i], 'siren' => $this->siren.'-'.$this->typeBilan, 'annee' => end($Graphdate), 'i' => $i));?>
<?php endfor;?>

View File

@ -20,4 +20,18 @@
<?php if($gr)$tb[] = $gr?>
<?php endforeach;?>
</table>
<?php $this->passifGraph($tb, $this->siren.'-'.$this->typeBilan, $this);?>
<?php
$valeur = array();
$case = 0;
for ($i =0; $i < count($tb); $i++) {
foreach ($tb as $tableau) {
while($case < count($tableau)) {
$valeur[$i][] = $tableau[$case];
break;
}
}
$case++;
}?>
<?php for($i=0; $i < count($valeur);$i++):?>
<?php echo $this->action('passifgraph', 'finance', null, array('data' => $valeur[$i], 'siren' => $this->siren.'-'.$this->typeBilan, 'annee' => end($Graphdate), 'i' => $i));?>
<?php endfor;?>

View File

@ -21,4 +21,19 @@
<?php if($gr)$tb[] = $gr?>
<?php endforeach;?>
</table>
<?php $this->sigGraph($tb, $this->siren.'-'.$this->typeBilan, $this);?>
<?php
$valeur = array();
$case = 0;
for ($i =0; $i < count($tb); $i++) {
foreach ($tb as $tableau) {
while($case < count($tableau)) {
$valeur[$i][] = $tableau[$case];
break;
}
}
$case++;
}
?>
<?php for($i=0; $i < count($valeur);$i++):?>
<?php echo $this->action('siggraph', 'finance', null, array('data' => $valeur[$i], 'siren' => $this->siren.'-'.$this->typeBilan, 'annee' => end($Graphdate), 'i' => $i));?>
<?php endfor;?>

View File

@ -0,0 +1,4 @@
<img src="/fichier/imgcache/<?php echo $this->file;?>?<?php echo $this->chart1URL;?>" border="1" usemap="#map<?php echo $this->i;?>">
<map name="map<?php echo $this->i;?>">
<?php echo $this->imageMap;?>
</map>

View File

@ -1,9 +1,10 @@
<div id="paragraph">
<h2>Actualités en directe</h2>
<h2>Information presse (Source Google News &copy;)</h2>
<br />
<ol style="margin-left:50px;">
<?php foreach($this->items as $item):?>
<li>
<a target="_blank" href="<?php echo $item['link'];?>"><?php echo utf8_encode($item['title']);?></a>
<li style="padding-top:2px;">
[ <?php echo $this->News($item['pubdate']);?> ] <a target="_blank" href="<?php echo $item['link'];?>"><?php echo utf8_encode($item['title']);?></a>
</li>
<?php endforeach;?>
</ol>