Mise a jours de giant

This commit is contained in:
Damien LASSERRE 2011-08-30 13:38:52 +00:00
parent 83ac38fa44
commit 4ea3ac4ff0
7 changed files with 291 additions and 49 deletions

View File

@ -117,9 +117,14 @@ class GiantController extends Zend_Controller_Action
$giantConstroller = new GiantControllerLib();
$fiche = $giantConstroller->getInformationGenerale($result);
$result = $giantConstroller->getAvisDeCredit($result);
$result = $giantConstroller->getComptesAnnuels($result);
$result = $giantConstroller->getPositionFinanciere($result);
if(isset($result->DataSet->Company->CreditRecommendation))
$result = $giantConstroller->getAvisDeCredit($result);
if(isset($result->DataSet->Company->AnnualAccounts))
$result = $giantConstroller->getComptesAnnuels($result);
if(isset($result->DataSet->Company->FinancialSummary))
$result = $giantConstroller->getPositionFinanciere($result);
if(isset($result->DataSet->Company->PaymentBehaviour))
$result = $giantConstroller->getComportementPaiement($result);
$this->view->reportType = $this->getRequest()->getParam('Type');
$this->view->fiche = $fiche;

View File

@ -1,5 +1,5 @@
<pre>
<?php //print_r($this->report); ?>
<?php print_r($this->report); ?>
</pre>
<?php if(!isset($this->report)): ?>
<div class="paragraph">
@ -192,7 +192,7 @@
<h2>3. Compte Annuels</h2>
<div class="paragraph">
<?php if(!empty($this->report->AnnualAccounts)):?>
<table style="margin-left: 19px;" width="97%">
<table style="margin-left: 19px;" width="97%" class="hoverTr">
<tr>
<td style="font-size:13px;"><b>Date de clôture</b></td>
<?php foreach($this->report->AnnualAccounts as $AnnualAccounts):$i++?>
@ -224,7 +224,7 @@
</table>
<br />
<span style="text-decoration:underline;font-size:16px;color:#00008C;font-weight:800">Actif</span><br />
<table style="font-size:13px;margin-left: 19px;" width="97%">
<table style="font-size:13px;margin-left: 19px;" width="97%" class="hoverTr">
<tr>
<td></td>
<?php $i=0; foreach($this->report->AnnualAccounts as $AnnualAccounts): $i++?>
@ -253,7 +253,7 @@
</center>
<br />
<span style="text-decoration:underline;font-size:16px;color:#00008C;font-weight:800">Passif</span><br />
<table style="font-size:13px;margin-left: 19px;" width="97%">
<table style="font-size:13px;margin-left: 19px;" width="97%" class="hoverTr">
<tr>
<td></td>
<?php $i=0; foreach($this->report->AnnualAccounts as $AnnualAccounts): $i++?>
@ -282,7 +282,7 @@
</center>
<br />
<span style="text-decoration:underline;font-size:16px;color:#00008C;font-weight:800">Compte de résultats</span><br />
<table style="font-size:13px;margin-left: 19px;" width="97%">
<table style="font-size:13px;margin-left: 19px;" width="97%" class="hoverTr">
<tr>
<td></td>
<?php $i=0; foreach($this->report->AnnualAccounts as $AnnualAccounts): $i++?>
@ -304,6 +304,7 @@
</tr>
<?php endforeach; ?>
</table>
<br />
<center>
<span style="font-size:15px;color:#00008C;font-weight:800">Compte de resultats</span>
<img src="/fichier/imgcache/profitandloss.png" />
@ -311,7 +312,7 @@
<br />
<br />
<span style="text-decoration:underline;font-size:16px;color:#00008C;font-weight:800">KeyCreditRatios</span><br />
<table style="font-size:13px;margin-left: 19px;" width="97%">
<table style="font-size:13px;margin-left: 19px;" width="97%" class="hoverTr">
<tr>
<td></td>
<?php $i=0; foreach($this->report->AnnualAccounts as $AnnualAccounts): $i++?>
@ -338,35 +339,142 @@
<?php endif;?>
</div>
<h2>4. Position financiére</h2>
<table style="font-size:13px;margin-left: 19px;" width="97%">
<tr>
<td></td>
<?php $i = 0; foreach($this->report->FinancialSummary as $FinancialSummary):$i++?>
<td><b><?php echo $FinancialSummary->SummaryDate->_?></b></td>
<div class="paragraph">
<?php if(isset($this->report->FinancialSummary)):?>
<span style="text-decoration:underline;font-size:16px;color:#00008C;font-weight:800">Informations Capital</span><br />
<table style="font-size:13px;margin-left: 19px;" width="97%" class="hoverTr">
<tr>
<td></td>
<?php $i = 0; foreach($this->report->FinancialSummary as $FinancialSummary):$i++?>
<td><b><?php echo $FinancialSummary->SummaryDate->_?></b></td>
<?php endforeach;?>
</tr>
<tr>
<td colspan="<?php echo $i+1; ?>"><hr style="border:1px dotted silver" /></td>
</tr>
<?php foreach($this->report->PositionFinanciere as $name => $PositionFinanciere):?>
<tr>
<td><b><?php echo $name;?></b></td>
<?php foreach($PositionFinanciere as $element):?>
<td><?php echo $element?></td>
<?php endforeach;?>
</tr>
<tr>
<td colspan="<?php echo $i+1; ?>"><hr style="border:1px dotted silver" /></td>
</tr>
<?php endforeach;?>
</tr>
<tr>
<td colspan="<?php echo $i+1; ?>"><hr style="border:1px dotted silver" /></td>
</tr>
<?php foreach($this->report->PositionFinanciere as $name => $PositionFinanciere):?>
<tr>
<td><b><?php echo $name;?></b></td>
<?php foreach($PositionFinanciere as $element):?>
<td><?php echo $element?></td>
</table>
<br />
<center>
<span style="font-size:15px;color:#00008C;font-weight:800">Evolution du capital</span><br /><br />
<img src="/fichier/imgcache/damien.png" />
</center>
<span style="text-decoration:underline;font-size:16px;color:#00008C;font-weight:800">Relation banquaires</span><br /><br />
<table style="font-size:13px;margin-left: 19px;" width="97%" class="hoverTr">
<?php foreach($this->report->Bank as $bank):?>
<tr>
<td><?php echo $bank->BankName;?></td>
</tr>
<tr>
<td><hr style="border:1px dotted silver" /></td>
</tr>
<?php endforeach;?>
</tr>
<tr>
<td colspan="<?php echo $i+1; ?>"><hr style="border:1px dotted silver" /></td>
</tr>
<?php endforeach;?>
</table>
<br />
<center>
<span style="font-size:15px;color:#00008C;font-weight:800">Compte de resultats</span><br /><br />
<img src="/fichier/imgcache/damien.png" />
</center>
</table>
<?php else:?>
<span style="font-size:13px;margin-left:30px;">Aucune Position financiére</span>
<?php endif;?>
</div>
<h2>5. Comportement de paiement</h2>
<div class="paragraph">
<?php if(isset($this->report->PaymentBehaviour)):?>
<?php if(isset($this->report->ComportementPaiement)):?>
<span style="text-decoration:underline;font-size:16px;color:#00008C;font-weight:800">Analyse par année</span><br /><br />
<table style="font-size:13px;margin-left: 19px;" width="97%" class="hoverTr">
<?php foreach($this->report->ComportementPaiement as $dates => $valeurs):?>
<?php $date = explode(':', $dates);?>
<tr>
<td><b><?php echo $date[0];?> - <?php echo $date[1];?></b></td>
<?php $i=0;foreach($valeurs as $valeur): $i++; ?>
<td><?php echo $valeur;?> %</td>
<?php endforeach;?>
</tr>
<tr>
<td colspan="<?php echo $i+1;?>"><hr style="border:1px dotted silver" /></td>
</tr>
<?php endforeach;?>
<tr style="font-weight:800">
<td>Jours</td>
<td>1 - 30</td>
<td>31 - 60</td>
<td>61 - 90</td>
<td>91 - 120</td>
<td>121 - 150</td>
<td> + 151</td>
</tr>
</table>
<br />
<center>
<span style="text-decoration:underline;font-size:16px;color:#00008C;font-weight:800">Graphique Analyse par année</span><br /><br />
<img src="/fichier/imgcache/ComportementPaiement.png" />
</center>
<br />
<?php endif;?>
<span style="text-decoration:underline;font-size:16px;color:#00008C;font-weight:800">Qualification de paiement</span><br /><br />
<table style="font-size:13px;margin-left: 19px;" width="97%" class="hoverTr">
<tr>
<td>PaymentQualification</td>
<td><?php echo (isset($this->report->PaymentBehaviour[0]->PaymentQualification))?$this->report->PaymentBehaviour[0]->PaymentQualification->Qualification:'NC';?></td>
</tr>
<tr>
<td colspan="2"><hr style="border:1px dotted silver" /></td>
</tr>
<tr>
<td>DebtorDays</td>
<td><?php echo (isset($this->report->PaymentBehaviour[0]->DebtorDays))?$this->report->PaymentBehaviour[0]->DebtorDays:'NC';?></td>
</tr>
<tr>
<td colspan="2"><hr style="border:1px dotted silver" /></td>
</tr>
<tr>
<td>CreditorDays</td>
<td><?php echo (isset($this->report->PaymentBehaviour[0]->DebtorDays))?$this->report->PaymentBehaviour[0]->CreditorDays:'NC';?></td>
</tr>
<tr>
<td colspan="2"><hr style="border:1px dotted silver" /></td>
</tr>
</table><br />
<span style="text-decoration:underline;font-size:16px;color:#00008C;font-weight:800">Analyse par sommes</span><br /><br />
<table style="font-size:13px;margin-left: 19px;" width="97%" class="hoverTr">
<?php foreach($this->report->ByAmount as $sommes => $valeurs):?>
<?php $somme = explode(':', $sommes);?>
<tr>
<td>entre : <b><?php echo (!empty($somme[0]))?$somme[0].'€':'0';?></b> et <b><?php echo (!empty($somme[1]))?$somme[1].'€':'plus';?></b></td>
<?php $i=0;foreach($valeurs as $valeur): $i++; ?>
<td><?php echo $valeur;?> %</td>
<?php endforeach;?>
</tr>
<tr>
<td colspan="<?php echo $i+1;?>"><hr style="border:1px dotted silver" /></td>
</tr>
<?php endforeach;?>
<tr style="font-weight:800">
<td>Jours</td>
<td>1 - 30</td>
<td>31 - 60</td>
<td>61 - 90</td>
<td>91 - 120</td>
<td>121 - 150</td>
<td> + 151</td>
</tr>
</table><br />
<center>
<span style="text-decoration:underline;font-size:16px;color:#00008C;font-weight:800">Graphique Analyse par année</span><br />
<img src="/fichier/imgcache/ComportementPaiementByAmount.png" />
</center>
<?php else : ?>
<span style="font-size:13px;margin-left:30px;">Aucun Comportement de paiement</span>
<?php endif;?>
</div>
<h2>6. Structure de l'entreprise</h2>
<h2>7. Dirigeants</h2>

View File

@ -57,7 +57,7 @@ Class GiantControllerLib
public function getComportementPaiement($report) {
$ComportementPaiement = new ComportementPaiement($report);
return ($ComportementPaiement);
return ($ComportementPaiement->getDatas());
}
public function getComptesAnnuels($report) {

View File

@ -9,7 +9,123 @@
*
* @author divx
*/
class ComportementPaiement {
//put your code here
class ComportementPaiement
{
private $report;
public function __construct($report)
{
$this->report = $report;
if($this->generateStructure()) {
$this->createGraphique('ComportementPaiement');
$this->createGraphiqueByAmount('ComportementPaiementByAmount');
}
}
public function generateStructure()
{
foreach($this->report->DataSet->Company->PaymentBehaviour as $PaymentBehaviour) {
if(isset($PaymentBehaviour->AnalysisByPeriod->Category)) {
foreach($PaymentBehaviour->AnalysisByPeriod->Category as $period) {
foreach($period->DueDateExceeds as $DueDateExceeds) {
$this->report->DataSet->Company->
ComportementPaiement[WDate::dateT('Ymd', 'd/m/Y', $period->Period->StartDate->_).':'.WDate::dateT('Ymd', 'd/m/Y', $period->Period->EndDate->_)][$DueDateExceeds->NrOfDaysExceeds->LowerLimit->_.':'.$DueDateExceeds->NrOfDaysExceeds->UpperLimit->_] =
$DueDateExceeds->Percentage;
}
}
}
if(isset($PaymentBehaviour->AnalysisByAmount->Category)) {
foreach($PaymentBehaviour->AnalysisByAmount->Category as $Amount) {
foreach($Amount->DueDateExceeds as $AmountExceeds) {
$index = ((isset($Amount->AmountCategory->LowerLimit->_))?$Amount->AmountCategory->LowerLimit->_:0).
':'.(isset($Amount->AmountCategory->HigherLimit->_)?$Amount->AmountCategory->HigherLimit->_:0);
$this->report->DataSet->Company->ByAmount[$index][$AmountExceeds->NrOfDaysExceeds->LowerLimit->_.':'.$AmountExceeds->NrOfDaysExceeds->UpperLimit->_] = $AmountExceeds->Percentage;
}
}
}
}
return (true);
}
public function createGraphique($nameImg)
{
# The data for the chart
foreach($this->report->DataSet->Company->ComportementPaiement as $date => $ComportementPaiement) {
$date = explode(':', $date);
$dates = explode('/', $date[1]);
$labels[] = $dates[1].'/'.$dates[2];
foreach($ComportementPaiement as $name => $element) {
if(max($ComportementPaiement) == $element) {
$name = explode(':', $name);
$datas[] = $name[0];
}
}
}
$data = array_reverse($datas);
$labels = array_reverse($labels);
$c = new XYChart(600, 300, 0xffffc0, 0x000000, 1);
$c->setSearchPath(dirname(__FILE__));
$plotAreaObj = $c->setPlotArea(95, 50, 420, 205, 0xffffff);
$plotAreaObj->setGridColor(0xc0c0c0, 0xc0c0c0);
$legendBox = $c->addLegend(55, 25, false, "", 8);
$legendBox->setBackground(Transparent);
$legendBox->addKey("Normal", 0x8033ff33);
$legendBox->addKey("Attention", 0x80ff8f0f);
$legendBox->addKey("Critique", 0x80ff3333);
$textBoxObj = $c->addTitle(
"<*block,valign=absmiddle*><*img=star.png*><*img=star.png*> Jours ".
"<*img=star.png*><*img=star.png*><*/*>", "arialbi.ttf", 13, 0xffffff);
$textBoxObj->setBackground(0x000000, -1, 1);
$c->yAxis->setTitle("Jours");
$c->xAxis->setLabels($labels);
$c->xAxis->setLabelStep(1);
$c->xAxis->setTitle(
"<*block,valign=absmiddle*><*img=clock.png*> Dates<*/*>");
$c->xAxis->setWidth(2);
$c->yAxis->setWidth(2);
$markObj = $c->yAxis->addMark(30, 0x80ff8f0f, "Attention = 30");
$markObj->setLineWidth(1);
$markObj = $c->yAxis->addMark(60, 0x80ff3333, "Critique = 60");
$markObj->setLineWidth(1);
$c->addAreaLayer($data, $c->yZoneColor(30, 0x8033ff33, 0x80ff8f0f));
$c->addAreaLayer($data, $c->yZoneColor(60, 0x80ff8f0f, 0x80ff3333));
$textBoxObj = $c->addText(475, 255,
"<*block,valign=absmiddle*><*img=small_molecule.png*> <*block*>".
"<*font=timesbi.ttf,size=10,color=804040*>Scores et decisions<*/*>");
$textBoxObj->setAlignment(BottomRight);
$c->makeChart('../cache/pages/imgcache/'.$nameImg.'.png');
}
public function createGraphiqueByAmount($nameImg)
{
foreach($this->report->DataSet->Company->ByAmount as $sommes => $ByAmount) {
$somme = explode(':', $sommes);
$labels[] = round($somme[0]/1000).'-'.round($somme[1]/1000).'K€';
foreach($ByAmount as $name => $element) {
if(max($ByAmount) == $element) {
$name = explode(':', $name);
$data[] = $name[0];
break;
}
}
}
$c = new XYChart(600, 280);
$c->setPlotArea(20, 30, 550, 200);
$c->yAxis->setTitle("Jours");
$c->xAxis->setTitle("Sommes en K€");
$barLayerObj = $c->addBarLayer($data, 0x00ff00);
$barLayerObj->set3D();
$c->xAxis->setLabels($labels);
$c->makeChart('../cache/pages/imgcache/'.$nameImg.'.png');
}
public function getDatas()
{
return ($this->report);
}
}
?>

View File

@ -71,13 +71,15 @@ class ComptesAnnuels {
public function createBilanGraphique($name, $datas, $labels, $width = 590, $height = 270)
{
$c = new PieChart($width, $height);
$c->setPieSize(150, 135, 100);
$c->addLegend(340, 60);
$c->setLabelFormat("{percent}%");
$c->setData($datas, $labels);
$c->setSectorStyle(RoundedEdgeShading, 0xffffff, 1);
$c->makeChart('../cache/pages/imgcache/'.$name.'.png');
if(!file_exists('../cache/pages/imgcache/'.$name.'.png')) {
$c = new PieChart($width, $height);
$c->setPieSize(150, 135, 100);
$c->addLegend(340, 60);
$c->setLabelFormat("{percent}%");
$c->setData($datas, $labels);
$c->setSectorStyle(RoundedEdgeShading, 0xffffff, 1);
$c->makeChart('../cache/pages/imgcache/'.$name.'.png');
}
}
public function generateDatasForGraphique($result)
@ -151,7 +153,7 @@ class ComptesAnnuels {
} else {
if($bilan == $name) {
(!$BalanceSheet == 'KeyCreditRatios')?$div=1000:$div=1;
$bilans[$AnnualAccounts->AccountsDate->_] = number_format($HarmonizedAnnualAccounts->_/$div, 0, '', ' ').' K€'; } } } }
$bilans[$AnnualAccounts->AccountsDate->_] = number_format($HarmonizedAnnualAccounts->_/$div, 0, '', ' ').' €'; } } } }
return $bilans;
}

View File

@ -25,8 +25,10 @@ class PositionFinanciere
{
# The data for the area chart
foreach($this->report->DataSet->Company->PositionFinanciere as $name => $element) {
foreach($element as $item) {
$data[$name][] = ($item < 0)?0:$item;
if($name == 'AuthorizedCapital' or $name == 'IssuedCapital' or $name == 'WorkingCapital') {
foreach($element as $item) {
$data[$name][] = ($item < 0)?0:$item;
}
}
}
@ -55,7 +57,7 @@ class PositionFinanciere
foreach($this->report->DataSet->Company->FinancialSummary as $FinancialSummary) {
foreach($FinancialSummary as $name => $valeur) {
if($name != 'SummaryDate' and $name != 'AccountStatus')
$return[$name][$FinancialSummary->SummaryDate->_] = number_format ($valeur->_/1000, 0, '', ' ');
$return[$name][$FinancialSummary->SummaryDate->_] = number_format ($valeur->_/1000, 0, '', ' ').' K€';
}
}
$this->report->DataSet->Company->PositionFinanciere = $return;

View File

@ -1,4 +1,13 @@
@CHARSET "UTF-8";
/** Giant rapport **/
.hoverTr tr:hover
{
background-color: #E8FAFA;
cursor: default;
}
/** Giant Search **/
#info td
{
padding:2px;