issue #0001772 : Affichage des subventions

This commit is contained in:
Michael RICOIS 2013-11-11 12:23:50 +00:00
parent d335aa9774
commit 75047c808c
4 changed files with 227 additions and 0 deletions

View File

@ -1253,4 +1253,57 @@ class FinanceController extends Zend_Controller_Action
}
}
public function subventionsAction()
{
$sessionEntreprise = new SessionEntreprise($this->siret, $this->id);
$siren = substr($this->siret, 0, 9);
$this->view->assign('raisonSociale', $session->getRaisonSociale());
$this->view->assign('id', $this->id);
$this->view->assign('siret', $this->siret);
$this->view->assign('siren', $siren);
$ws = new WsScores();
$infos = $ws->getSubventionList($siren);
if ($infos === false) {
$this->forward('soap', 'error');
} elseif (is_string($infos)) {
$this->view->assign('msg', $infos);
} else {
$this->view->assign('subventions', $infos->result->item);
}
}
public function subventionAction()
{
$sessionEntreprise = new SessionEntreprise($this->siret, $this->id);
$siren = substr($this->siret, 0, 9);
$this->view->assign('raisonSociale', $session->getRaisonSociale());
$this->view->assign('id', $this->id);
$this->view->assign('siret', $this->siret);
$this->view->assign('siren', $siren);
$request = $this->getRequest();
$id = $request->getParam('subventionId');
$ws = new WsScores();
$infos = $ws->getSubvention($id);
if ($infos === false) {
$this->forward('soap', 'error');
} elseif (is_string($infos)) {
$this->view->assign('msg', $infos);
} else {
$this->view->assign('Millesime',$infos->Millesime);
$this->view->assign('Budget',$infos->Budget);
$this->view->assign('AssoSiren',$infos->AssoSiren);
$this->view->assign('AssoNom',$infos->AssoNom);
$this->view->assign('OrigineSiren',$infos->OrigineSiren);
$this->view->assign('OrigineLib',$infos->OrigineLib);
$this->view->assign('Programme',$infos->Programme);
$this->view->assign('Montant',$infos->Montant);
$this->view->assign('SubventionObjet',$infos->SubventionObjet);
$this->view->assign('Mission',$infos->Mission);
}
}
}

View File

@ -0,0 +1,64 @@
<div id="center">
<h1 class="titre">SUBVENTIONS</h1>
<div class="paragraph">
<table class="identite">
<tr>
<td width="30">&nbsp;</td>
<td width="200" class="StyleInfoLib">Num&eacute;ro identifiant Siren</td>
<td width="350" class="StyleInfoData"><?=$this->SirenTexte($this->siren)?></td>
</tr>
<tr>
<td width="30">&nbsp;</td>
<td width="200" class="StyleInfoLib">Raison Sociale</td>
<td width="350" class="StyleInfoData"><?=$this->raisonSociale?></td>
</tr>
</table>
</div>
<h2>Détail de la subvention</h2>
<div class="paragraph">
<table>
<tbody>
<tr>
<td>Année</td>
<td><?=$this->Millesime?></td>
</tr>
<tr>
<td>Subvention versé à</td>
<td><?=$this->AssoNom?> (<?=$this->AssoSiren?>)</td>
</tr>
<tr>
<td>Budget</td>
<td><?=$this->Budget?></td>
</tr>
<tr>
<td>Subvention reçu de </td>
<td><?=$this->OrigineSiren?></td>
</tr>
<tr>
<td>Origine de la subvention</td>
<td><?=$this->OrigineLib?></td>
</tr>
<tr>
<td>Imputation / Programme</td>
<td><?=$this->Programme?></td>
</tr>
<tr>
<td>Montant</td>
<td><?=$this->Montant?></td>
</tr>
<tr>
<td>Objet</td>
<td><?=$this->SubventionObjet?></td>
</tr>
<tr>
<td>Evaluation</td>
<td></td>
</tr>
<tr>
<td>Mission</td>
<td><?=$this->Mission?></td>
</tr>
</tbody>
</table>
</div>

View File

@ -0,0 +1,59 @@
<div id="center">
<h1 class="titre">SUBVENTIONS</h1>
<div class="paragraph">
<table class="identite">
<tr>
<td width="30">&nbsp;</td>
<td width="200" class="StyleInfoLib">Num&eacute;ro identifiant Siren</td>
<td width="350" class="StyleInfoData"><?=$this->SirenTexte($this->siren)?></td>
</tr>
<tr>
<td width="30">&nbsp;</td>
<td width="200" class="StyleInfoLib">Raison Sociale</td>
<td width="350" class="StyleInfoData"><?=$this->raisonSociale?></td>
</tr>
</table>
</div>
<h2>Liste des subventions</h2>
<div class="paragraph">
<?php if ($this->msg) {?>
<?=$this->msg?>
<?php } else { ?>
<table class="data">
<thead>
<tr>
<th>Année</th>
<th>Type</th>
<th>Origine</th>
<th>Entité subventionnée</th>
<th>Programme</th>
<th>Montant</th>
</tr>
</thead>
<tbody>
<?php foreach ( $this->subventions as $item ) {?>
<tr>
<td><?=$item->Millesime?></td>
<td>
<?php if ($item->Type=='IN') {?>
Reçue
<?php } else { ?>
Versée
<?php }?>
</td>
<td><?=$item->OrigineLib?></td>
<td><?=$item->AssoNom?> (<?=$this->AssoSiren?>)</td>
<td><a href="<?=$this->url(array('controller'=>'finance', 'action'=>'subvention', 'subventionId'=>$item->Id, 'siret'=>$this->siret, 'id'=>$this->id), null, true)?>" title="Détail de la subvention">
<?=$item->Programme?></a></td>
<td><?=$item->Montant?></td>
</tr>
<?php }?>
</tbody>
</table>
<?php }?>
</div>
<div class="paragraph">
Pagination
</div>

View File

@ -101,6 +101,57 @@ class WsScores
return $client;
}
public function getSubventionList($siren, $offset = 0, $nbItems = 100)
{
$params = new stdClass();
$params->companyId = $siren;
$params->offset = $offset;
$params->nbItems = $nbItems;
$client = $this->loadClient('entreprise');
try {
$reponse = $client->getSubventionList($params);
return $reponse->getSubventionListResult;
} catch (SoapFault $fault) {
if ( in_array($fault->faultcode, array('ERR', 'MSG')) ){
return $fault->faultstring;
} else {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
}
/**
* Subvention Detail
* @param int $id
* @return boolean
*/
public function getSubventionDetail($id)
{
$params = new stdClass();
$params->id = $id;
$client = $this->loadClient('entreprise');
try {
$reponse = $client->getSubventionDetail($params);
return $reponse->getSubventionDetailResult;
} catch (SoapFault $fault) {
if ( in_array($fault->faultcode, array('ERR', 'MSG')) ){
return $fault->faultstring;
} else {
$this->soaperror(__FUNCTION__, $fault, $client->__getLastRequest(), $client->__getLastResponse());
return false;
}
}
}
/**
*
* @param unknown $siren
* @param number $nic
* @param number $niveau
* @return Ambigous <boolean, mixed>|boolean
*/
public function getEntrepriseValo($siren, $nic=0, $niveau=2)
{
$filename = 'getvalo-'.$siren.'-'.$nic.'-'.$niveau;