Modification des session + création des formulaires

This commit is contained in:
Damien LASSERRE 2011-12-16 15:00:06 +00:00
parent 1773462af9
commit f1b683d07e
15 changed files with 227 additions and 111 deletions

View File

@ -5,25 +5,18 @@ class ComptageController extends Zend_Controller_Action
{
$this->_helper->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);
$explode = array('dateCrea_etab', 'dateCrea_ent', 'dateImmat', 'nbEtab', 'teff_entrep', 'teff_etab',
'teff_entrep', 'teff_etab', 'eff_etab', 'eff_entrep', 'adr_dep', 'adr_cp', 'nbMPubli',
'nbPart', 'nbAction', 'capital', 'bilAnnee', 'bilCloture', 'bilEE', 'bilFL', 'bilFK',
'bilFR', 'bilGF', 'bilGP', 'bilGU', 'bilGW', 'bilHD', 'bilHH', 'bilHL', 'bilHM', 'bilHN', 'bilYP', 'adr_com'
);
$request = $this->getRequest();
$key = $request->getParam('cle');
$request = $this->getRequest();
$key = $request->getParam('cle');
switch($key) {
case 'dateCrea_etab':
case 'dateCrea_ent':
case 'dateImmat':
case 'nbEtab':
case 'teff_entrep':
case 'teff_etab':
case 'teff_entrep':
case 'teff_etab':
$value = explode(',', $request->getParam('valeur'));
break;
default:
$value = $request->getParam('valeur');
break;
}
if(in_array($key, $explode))
$value = explode(',', $request->getParam('valeur'));
else
$value = $request->getParam('valeur');
//Session
require_once 'Scores/SessionCiblage.php';
@ -36,6 +29,9 @@ class ComptageController extends Zend_Controller_Action
$total = $ciblage->execute();
$insee = $ciblage->calculeRedevanceInsee();
$session->setCritere('total', $total);
$session->setCritere('insee', $insee);
//Retour comptage, unité Insee
$result = array(
'count' => number_format($total, 0, '', ' '),

View File

@ -3,48 +3,54 @@ class CriteresController extends Zend_Controller_Action
{
public function indexAction(){}
protected function createSelectProvisoir($nb)
{
$array = array();
for($i = 0;$i != ($nb+1); $i++)
$array[$i] = "$i";
return ($array);
}
public function entrepriseAction()
{
//$this->_helper->layout()->disableLayout();
$champs = array(array('name' => 'siege', 'libelle' => 'Siége', 'type' => 'select', 'parametres' => array('Etablissement' => '0', 'Siege' => '1')),
$champs = array(array('name' => 'siege', 'libelle' => 'Siège', 'type' => 'select', 'parametres' => array('Etablissement' => '0', 'Siege' => '1')),
array('name' => 'sirenGrp', 'libelle' => 'Siren de groupe', 'type' => 'select', 'parametres' => array('Oui' => '1', 'Non' => '0')),
array('name' => 'tel', 'libelle' => 'Téléphone', 'type' => 'select', 'parametres' => array('Oui' => 1, 'Non' => '0')),
array('name' => 'fax', 'libelle' => 'Télécopie', 'type' => 'select', 'parametres' => array('Oui' => 1, 'Non' => '0')),
array('name' => 'web', 'libelle' => 'Site Internet', 'type' => 'select', 'parametres' => array('Oui' => '1', 'Non' => '0')),
array('name' => 'mail', 'libelle' => 'Email', 'type' => 'select', 'parametres' => array('Oui' => '1', 'Non' => '0')),
array('name' => 'presentRcs', 'libelle' => 'Etablissement présent au RNCS', 'type' => 'select', 'parametres' => array('Oui' => '1', 'Non' => '0')),
array('name' => 'tvaIntraValide', 'libelle' => 'Numéro de TVA Valide', 'type' => 'select', 'parametres' => array('Oui' => '1', 'Non' => '0')),
array('name' => 'adrDom', 'libelle' => 'Adresse de domiciliation', 'type' => 'select', 'parametres' => array('Oui' => '1', 'Non' => '0')),
array('name' => 'dirNom', 'libelle' => 'Nom du principal dirigeant', 'type' => 'select', 'parametres' => array('Oui' => '1', 'Non' => '0')),
array('name' => 'lieuAct', 'libelle' => 'Lieu d\'activté', 'type' => 'select', 'parametres' => array('0' => '0', '1' => '1', '2' => '2', '3' => '3', '4' => '4', '5' => '5', '6' => '6', '7' => '7', '8' => '8', '9' => '9', '91' => '91', '92' => '92', '93' => '93', '99' => '99')),
array('name' => 'nbMPubli', 'libelle' => 'Nombre de marchés publiques remportés', 'type' => 'interval'),
array('name' => 'dateCrea_ent', 'libelle' => 'Date de création de l\'entreprose', 'type' => 'interval'),
array('name' => 'dateCrea_etab', 'libelle' => 'Date de création de l\'etablissement', 'type' => 'interval'),
array('name' => 'dateImmat', 'libelle' => 'Date d\'immatriculation de l\'entreprise', 'type' => 'interval'),
array('name' => 'nbEtab', 'libelle' => 'Nombre d\'établissements', 'type' => 'interval'),
array('name' => 'teff_entrep', 'libelle' => 'Tranche d\'effectif de l\'entreprise', 'type' => 'interval'),
array('name' => 'teff_etab', 'libelle' => 'Tranche d\'effectif de l\'etablissement', 'type' => 'interval')
array('name' => 'nbAction', 'libelle' => 'Nombre d\'actionnaires connus', 'type' => 'interval'),
array('name' => 'nbPart', 'libelle' => 'Nombre de participations connues', 'type' => 'interval')
);
$this->view->champs = $champs;
}
public function economiqueAction()
{
$this->_helper->layout()->disableLayout();
$champs = array(array('name' => 'ape_etab', 'libelle' => 'Code NAF Etablissement', 'type' => 'text'),
array('name' => 'ape_entrep', 'libelle' => 'Code NAF Entreprise', 'type' => 'text'),
array('name' => 'age_etab', 'libelle' => 'Code AGE Etablissement', 'type' => 'text'),
array('name' => 'age_entrep', 'libelle' => 'Code AGE Entreprise', 'type' => 'text'),
array('name' => 'tca', 'libelle' => 'Tranche de Chiffre d\'affaire de l\'entreprise (Insee)', 'type' => 'interval'),
array('name' => 'tcaexp', 'libelle' => 'Tranche de Chiffre d\'affaire à l\'export', 'type' => 'interval'),
array('name' => 'actifEco', 'libelle' => 'Etablissement économiquement actif', 'type' => 'select', 'parametres' => array('Oui' => '1', 'Non' => '0')),
array('name' => '', 'libelle' => '', 'type' => ''),
array('name' => '', 'libelle' => '', 'type' => ''),
array('name' => '', 'libelle' => '', 'type' => ''),
array('name' => '', 'libelle' => '', 'type' => ''),
array('name' => '', 'libelle' => '', 'type' => ''),
array('name' => '', 'libelle' => '', 'type' => ''),
array('name' => '', 'libelle' => '', 'type' => '')
array('name' => 'NaceEtab', 'libelle' => 'Code NACE de l\'établissement', 'type' => 'text'),
array('name' => 'NaceEntrep', 'libelle' => 'Code NACE de l\'entreprise', 'type' => 'text'),
array('name' => 'teff_entrep', 'libelle' => 'Tranche d\'effectif de l\'entreprise', 'type' => 'interval'),
array('name' => 'teff_etab', 'libelle' => 'Tranche d\'effectif de l\'etablissement', 'type' => 'interval'),
array('name' => 'nbEtab', 'libelle' => 'Nombre d\'établissements', 'type' => 'interval'),
array('name' => 'eff_entrep', 'libelle' => 'Effectif réel de l\'entreprise', 'type' => 'interval'),
array('name' => 'eff_etab', 'libelle' => 'Effectif réel de l\'établissement', 'type' => 'interval'),
array('name' => 'capital', 'libelle' => 'Capital de l\'entreprise', 'type' => 'interval'),
);
$this->view->champs = $champs;
$this->_helper->layout()->disableLayout();
}
public function nafAction()
@ -85,21 +91,61 @@ class CriteresController extends Zend_Controller_Action
{
$this->_helper->layout()->disableLayout();
$this->view->inlineScript()->appendFile('/themes/default/scripts/jquery.jstree.js');
$regionsM = new Application_Model_Regions();
$champs = array(array('name' => 'adr_cp', 'libelle' => 'Code postal', 'type' => 'text'),
array('name' => 'adr_dep', 'libelle' => 'Département', 'type' => 'text'),
array('name' => 'adr_com', 'libelle' => 'Code commune Insee', 'type' => 'text'),
);
$this->view->champs = $champs;
/*$regionsM = new Application_Model_Regions();
//$sql = $regionsM->select();
$this->view->assign('regions', $regionsM->fetchAll()->toArray());
$this->view->assign('regions', $regionsM->fetchAll()->toArray());*/
}
public function juridiqueAction()
{
$this->_helper->layout()->disableLayout();
$champs = array(array('name' => 'cj', 'libelle' => 'Forme Juridique', 'type' => 'select', 'parametres' => array('1' => '1', '2' => '2', '3' => '3')),
array('name' => 'actifEco', 'libelle' => 'Établissement économiquement actif', 'type' => 'select', 'parametres' => array('Oui' => '1', 'Non' => '0')),
array('name' => 'procolHisto', 'libelle' => 'Présence d\'une procédure collective dans l\'histo.', 'type' => 'select', 'parametres' => array('Oui' => '1', 'Non' => '0')),
array('name' => 'tvaIntraValide', 'libelle' => 'Numéro de TVA Valide', 'type' => 'select', 'parametres' => array('Oui' => '1', 'Non' => '0')),
array('name' => 'dateImmat', 'libelle' => 'Date d\'immatriculation de l\'entreprise', 'type' => 'interval')
);
$this->view->champs = $champs;
}
public function financiereAction()
{
$this->_helper->layout()->disableLayout();
$champs = array(array('name' => 'bilType', 'libelle' => 'Type du dernier bilan', 'type' => 'select', 'parametres' => array('Inconnue' => 'I', 'Estimé' => 'E', 'Réel' => 'R')),
array('name' => 'avisCs', 'libelle' => 'Informations de paiements', 'type' => 'select', 'parametres' => $this->createSelectProvisoir(50)),
array('name' => 'bilDuree', 'libelle' => 'Durée du dernier bilan en mois', 'type' => 'select', 'parametres' => $this->createSelectProvisoir(9)),
array('name' => 'bilTca', 'libelle' => 'Tranche de CA issue du bilan', 'type' => 'select', 'parametres' => $this->createSelectProvisoir(23)),
array('name' => 'bilAnnee', 'libelle' => 'Dernière année de bilan', 'type' => 'interval'),
array('name' => 'bilCloture', 'libelle' => 'Dernière date de clôture du bilan', 'type' => 'interval'),
array('name' => 'bilEE', 'libelle' => 'Total bilan', 'type' => 'interval'),
array('name' => 'bilFL', 'libelle' => 'CA total', 'type' => 'interval'),
array('name' => 'bilFK', 'libelle' => 'Chiffre d\'affaires Export', 'type' => 'interval'),
array('name' => 'bilFR', 'libelle' => 'Produits d\'Exploitation', 'type' => 'interval'),
array('name' => 'bilGF', 'libelle' => 'Charges d\'Exploitation', 'type' => 'interval'),
array('name' => 'bilGP', 'libelle' => 'Produits Financiers', 'type' => 'interval'),
array('name' => 'bilGU', 'libelle' => 'Charges Financières', 'type' => 'interval'),
array('name' => 'bilGW', 'libelle' => 'RCAI (résultat courant avant impôt)', 'type' => 'interval'),
array('name' => 'bilHD', 'libelle' => 'Produits Exceptionnels', 'type' => 'interval'),
array('name' => 'bilHH', 'libelle' => 'Charges Exceptionnels', 'type' => 'interval'),
array('name' => 'bilHL', 'libelle' => 'Total des Produits', 'type' => 'interval'),
array('name' => 'bilHM', 'libelle' => 'Total des Charges', 'type' => 'interval'),
array('name' => 'bilHN', 'libelle' => 'Résultat', 'type' => 'interval'),
array('name' => 'bilYP', 'libelle' => 'Effectif de l\'entreprise au dernier bilan (poste YP)', 'type' => 'interval')
);
/*array('name' => 'tca', 'libelle' => 'Tranche de Chiffre d\'affaire de l\'entreprise (Insee)', 'type' => 'interval'),
array('name' => 'tcaexp', 'libelle' => 'Tranche de Chiffre d\'affaire à l\'export', 'type' => 'interval'),
array('name' => 'actifEco', 'libelle' => 'Etablissement économiquement actif', 'type' => 'select', 'parametres' => array('Oui' => '1', 'Non' => '0')),
array('name' => 'tvaIntraValide', 'libelle' => 'Numéro de TVA Valide', 'type' => 'select', 'parametres' => array('Oui' => '1', 'Non' => '0')),
*/
$this->view->champs = $champs;
}
}

View File

@ -1,7 +1,13 @@
<?php
class IndexController extends Zend_Controller_Action
{
public function indexAction(){}
public function indexAction()
{
$session = new Zend_Session_Namespace('ciblage');
$this->view->total = number_format($session->ciblage['total'], 0, '', ' ');
$this->view->insee = number_format($session->ciblage['insee'], 0, '', ' ');
}
//Selection
public function selectionAction(){}
@ -21,6 +27,9 @@ class IndexController extends Zend_Controller_Action
{
require_once 'Scores/SessionCiblage.php';
$session = new Zend_Session_Namespace('ciblage');
$nbCriteres = count($session->ciblage);
$this->view->count = (($nbCriteres == 0)?0:($nbCriteres - 2));
$this->view->entreprise = $session->ciblage;
}

View File

@ -13,7 +13,7 @@ Class Zend_View_Helper_Interval extends Zend_View_Helper_Abstract
public function Interval($name, $libelle, $date = false)
{
$session = $this->getValueSession($name);
$champ = '<div>';
$champ .= '<div style="float:left;text-align:left;">
<label>'.$libelle.'</label>

View File

@ -5,7 +5,8 @@ Class Zend_View_Helper_Select extends Zend_View_Helper_Abstract
public function Select($name, $libelle, $liste)
{
$session = new Zend_Session_Namespace('ciblage');
$compar = $session->ciblage[$name];
$compar = $session->ciblage[$name][0];
$select = '<option value="tous">Tous</option>';
foreach($liste as $item => $value) {

View File

@ -0,0 +1,31 @@
<?php
Class Zend_View_Helper_Text extends Zend_View_Helper_Abstract
{
public function printHistorique($val)
{
if(is_array($val)) {
return (implode(',', $val));
}
return ($val);
}
public function Text($name, $libelle)
{
$session = new Zend_Session_Namespace('ciblage');
$val = $session->ciblage[$name];
$champ = '<div>';
$champ .= '<div style="float:left;text-align:left;">
<label>'.$libelle.'</label>
</div>';
$champ .= '<div style="text-align:right;">
<input class="criteres" type="text" name="'.$name.'" value="'.((!empty($val))?$this->printHistorique($val):null).'" />
</div>';
$champ .= '<div>
<hr />
</div>';
$champ .= '</div>';
return ($champ);
}
}

View File

@ -1,19 +1,19 @@
<div>
<label>Recherche textuel de code NAF</label>
<input type="text" name="autocompleteNaf" value=""/>
<?php foreach($this->champs as $champ){
switch ($champ['type']) {
case 'select':
echo $this->Select($champ['name'], $champ['libelle'], $champ['parametres']);
break;
case 'interval':
echo $this->Interval($champ['name'], $champ['libelle']);
break;
case 'text':
echo $this->Text($champ['name'], $champ['libelle']);
break;
}
} ?>
</div>
<br/>
<div>
<label>Liste de NAF (séparés par des virgules)</label><br/>
<textarea cols="100" name="" style="width:100%;"></textarea>
<div style="text-align:right;">
<a href="">Intégrer dans les critères</a>
</div>
</div>
<br/>
<div style="text-align:right;">
<a href="">Réinitialiser les critères économiques</a>
</div>

View File

@ -1,15 +1,15 @@
<p>
<label>Date de clôture de l'exercice</label>
<input type="texte" name="Bilan[date]" value=""/>
</p>
<p>
Intervalle CA - Selection (Moins de 15000 euros, de 15000 à 30000, de 30000 à 75000, de 75000 à 150000, de 150000 à 750000, Plus de 750000)
</p>
<p>Intervalle Résultat net</p>
<p>Intervalle CA à l'export</p>
<p>ACTIF - PASSIF - COMPTE DE RESULTAT - ANNEXES</p>
<p>Ratios</p>
<p>Scores (Risques de défaillance)</p>
<div>
<?php foreach($this->champs as $champ){
switch ($champ['type']) {
case 'select':
echo $this->Select($champ['name'], $champ['libelle'], $champ['parametres']);
break;
case 'interval':
echo $this->Interval($champ['name'], $champ['libelle']);
break;
}
} ?>
</div>
<div style="text-align:right;">
<a href="">Réinitialiser les critères financiers</a>

View File

@ -1,22 +1,18 @@
<fieldset>
<legend>Recherche textuel sur les régions, les départements ou les communes</legend>
<input type="text" name="autocompleteGeo" value=""/>
</fieldset>
<br/>
<fieldset>
<legend>Liste brutes (séparés par des virgules)</legend>
<label>Départements</label>
<input type="text" name=""/>
<br/><a href="">Consulter la liste des départements</a>, ex: 75,78,...
<br/><br/>
<label>Code postaux</label>
<input type="text" name=""/>
<br/><a href="">Consulter la liste des codes postaux</a>, ex: 75015,78120,...
</fieldset>
<br/>
<div>
<?php foreach($this->champs as $champ){
switch ($champ['type']) {
case 'select':
echo $this->Select($champ['name'], $champ['libelle'], $champ['parametres']);
break;
case 'interval':
echo $this->Interval($champ['name'], $champ['libelle']);
break;
case 'text':
echo $this->Text($champ['name'], $champ['libelle']);
break;
}
} ?>
</div>
<div style="text-align:right;">
<a href="">Réinitialiser les critères géographiques</a>

View File

@ -1,15 +1,18 @@
<fieldset>
<legend>Recherche textuel de catégorie juridique</legend>
<input type="text" name="autocompleteGeo" value=""/>
</fieldset>
<fieldset>
<legend>Liste brutes (séparés par des virgules)</legend>
<label>Catégories juridiques</label>
<input type="text" name=""/>
<br/><a href="">Consulter la liste des catégories juridiques</a>, ex: 75,78,...
<br/><br/>
</fieldset>
<div>
<?php foreach($this->champs as $champ){
switch ($champ['type']) {
case 'select':
echo $this->Select($champ['name'], $champ['libelle'], $champ['parametres']);
break;
case 'interval':
echo $this->Interval($champ['name'], $champ['libelle']);
break;
case 'text':
echo $this->Text($champ['name'], $champ['libelle']);
break;
}
} ?>
</div>
<div style="text-align:right;">
<a href="">Réinitialiser les critères juridiques</a>

View File

@ -1,7 +1,11 @@
<h3><a href="#">Entreprise - <span style="font-size:10px">Nombre de critéres : <?php echo count($this->entreprise) ?></span></a></h3>
<h3><a href="#">Entreprise - <span style="font-size:10px">Nombre de critéres : <?php echo $this->count; ?></span></a></h3>
<div>
<?php foreach($this->entreprise as $item => $valeur): ?>
<span><?php echo '<b>'.$item.' :</b> '.(($valeur=='0' or $valeur == '1')?(($valeur=='0')?'Non':'Oui'):str_replace(',', ' à ', implode(' à ', $valeur))); ?><span/><br />
<?php if($item != 'total' and $item != 'insee'):?>
<span>
<?php echo '<b>'.$item.' :</b> '.(($valeur=='0' or $valeur == '1')?(($valeur=='0')?'Non':'Oui'):str_replace(',', ' à ', ((is_array($valeur))?implode(' à ', $valeur):$valeur))); ?>
<span/><br />
<?php endif; ?>
<?php endforeach; ?>
</div>
<h3><a href="#">Situation economique</a></h3>

View File

@ -15,12 +15,12 @@
<div id="critères">
<div id="accordion">
<h3><a href="">Résultats</a></h3>
<div style="padding:0px;">
<div id="comptage" style="margin-bottom:40px">
<div style="padding:0px;height:100px;">
<div id="comptage" style="margin-bottom:40px;">
Nombre d'entreprises sélectionnées :
<span style="font-weight:800;" id="count">-</span>
<span style="font-weight:800;" id="count"><?php echo ((!empty($this->total))?$this->total:'-');?></span>
<br/>
(dont <span style="font-weight:800;" id="insee">-</span> unité(s) insee)
(dont <span style="font-weight:800;" id="insee"><?php echo ((!empty($this->insee))?$this->insee:'-');?></span> unité(s) insee)
</div>
<div id="attente" style="text-align:center;display:none;">
<img width="15%" src="/themes/default/images/ajax.gif" /><br />

View File

@ -5,8 +5,8 @@ require_once 'configuration.php';
Class Ciblage
{
private $sphinx;
private $alpha = '';
private $presentRcs = 0;
private $alpha = '';
private $presentRcs = 0;
public function __construct($structure, $need = false)
{
@ -36,7 +36,8 @@ Class Ciblage
$resSphinx = $this->sphinx->Query($this->alpha, ConfigurationCiblage::$index);
return ($resSphinx['total_found']);
}
/*30036,30039,30047,30060,30075,30082,30102,30125, 30128, 30061, 30138, 30145, 30155, 30156, 30169, 30189, 30189, 30927, 30935, 30206, 30211, 30356, 30241, 30245, 30249, 30257, 30258, 30190, 30210
*/
public function execute($need = false)
{
if($need) {
@ -96,7 +97,7 @@ Class Ciblage
protected function setAlpha($name, $valeur)
{
$or = array('adr_cp', 'adr_dep', 'adr_com');
$or = array('adr_cp', 'adr_dep');
$and = array('ape_entrep', 'ape_etab', 'age_entrep', 'age_etab', 'NaceEntrep', 'NaceEtab');
if(in_array($name, $or)) {
@ -327,6 +328,10 @@ Class Ciblage
protected function bilHI($valeur) {
$this->setFilterRange('bilHI', $valeur);
}
protected function adrdom($valeur) {
$this->setFilter('adrDom', $valeur);
}
}
Class SDLocalisation

View File

@ -2,7 +2,7 @@
require_once('commons/dates.php');
class SessionCiblage
{
protected $criteres = array('siege', 'adr_cp', 'adr_dep', 'adr_com', 'tel', 'fax', 'cj', 'capital', 'ape_etab', 'ape_entrep', 'age_entrep',
protected $criteres = array('nbMPubli' ,'total', 'insee', 'siege', 'adr_cp', 'adr_dep', 'adr_com', 'tel', 'fax', 'cj', 'capital', 'ape_etab', 'ape_entrep', 'age_entrep',
'age_etab', 'tcaexp', 'teff_entrep', 'teff_etab', 'rang', 'actifEco', 'presentRcs', 'procolHisto', 'tvaIntraValide',
'NaceEtab', 'NaceEntrep', 'dateCrea_etab', 'dateCrea_ent', 'dateImmat', 'eff_entrep', 'eff_etab', 'rivoli', 'nbEtab',
'sirenGrp', 'nbActio', 'nbPart', 'bilType', 'bilAnnee', 'avisCs', 'bilTca', 'bilEE', 'bilFL', 'bilFK', 'bilFR', 'bilGF', 'bilGP',

View File

@ -1,5 +1,30 @@
$(document).ready(function(){
$(".tooltip").qtip();
$('.tooltip').each(function(){
var title = $(this).attr('title');
var width = $(this).attr('wdth');
$(this).attr('title', '');
$(this).qtip({
solo:true,
content: title,
style: {
width: width,
classes: "ui-tooltip-cream"
},
position: {
at: $('#at').val(),
my: $('#my').val(),
viewport: $(window),
adjust: {
method: $('#adjust_method').val(),
x: parseInt($('#adjust_x').val(), 10) || 0,
y: parseInt($('#adjust_y').val(), 10) || 0
}
}
});
});
$('.accordion .head').click(function() {
$(this).next().toggle('slow');
return false;