2011-09-28 08:44:27 +00:00
< ? php
class CriteresController extends Zend_Controller_Action
{
public function indexAction (){}
2011-12-23 18:23:58 +00:00
protected $entreprise = array ( 'siege' , 'sirenGrp' , 'tel' , 'fax' , 'web' , 'mail' , 'presentRcs' , 'adrDom' , 'dirNom' , 'lieuAct' , 'nbMPubli' , 'dateCrea_ent' , 'dateCrea_etab' , 'nbActio' , 'nbPart' );
2011-12-19 16:48:03 +00:00
protected $economique = array ( 'ape_etab' , 'ape_entrep' , 'NaceEtab' , 'NaceEntrep' , 'age_etab' , 'age_entrep' , 'teff_entrep' , 'teff_etab' , 'nbEtab' , 'eff_entrep' , 'eff_etab' , 'capital' );
protected $geographique = array ( 'adr_cp' , 'adr_dep' , 'adr_com' );
protected $juridique = array ( 'cj' , 'actifEco' , 'procolHisto' , 'tvaIntraValide' , 'dateImmat' );
protected $financier = array ( 'bilType' , 'avisCs' , 'bilDuree' , 'bilTca' , 'bilAnnee' , 'bilCloture' , 'bilEE' , 'bilFL' , 'bilFK' , 'bilFR' , 'bilGF' , 'bilGP' , 'bilGU' , 'bilGW' , 'bilHD' , 'bilHH' , 'bilHL' , 'bilHM' , 'bilHN' , 'bilYP' );
2011-09-28 08:44:27 +00:00
2011-12-16 15:00:06 +00:00
protected function createSelectProvisoir ( $nb )
{
$array = array ();
for ( $i = 0 ; $i != ( $nb + 1 ); $i ++ )
$array [ $i ] = " $i " ;
return ( $array );
}
2011-09-28 08:44:27 +00:00
public function entrepriseAction ()
{
2011-12-16 15:00:06 +00:00
$champs = array ( array ( 'name' => 'siege' , 'libelle' => 'Siège' , 'type' => 'select' , 'parametres' => array ( 'Etablissement' => '0' , 'Siege' => '1' )),
2011-12-16 09:00:12 +00:00
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' )),
2011-12-16 15:00:06 +00:00
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' )),
2011-12-16 09:00:12 +00:00
array ( 'name' => 'presentRcs' , 'libelle' => 'Etablissement présent au RNCS' , 'type' => 'select' , 'parametres' => array ( 'Oui' => '1' , 'Non' => '0' )),
2011-12-16 15:00:06 +00:00
array ( 'name' => 'adrDom' , 'libelle' => 'Adresse de domiciliation' , 'type' => 'select' , 'parametres' => array ( 'Oui' => '1' , 'Non' => '0' )),
2011-12-16 09:00:12 +00:00
array ( 'name' => 'dirNom' , 'libelle' => 'Nom du principal dirigeant' , 'type' => 'select' , 'parametres' => array ( 'Oui' => '1' , 'Non' => '0' )),
2011-12-16 15:00:06 +00:00
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' )),
2011-12-16 16:42:58 +00:00
array ( 'name' => 'nbMPubli' , 'libelle' => 'Nombre de marchés publiques remportés' , 'type' => 'interval:regle' ),
array ( 'name' => 'dateCrea_ent' , 'libelle' => 'Date de création de l\'entreprose' , 'type' => 'interval:date' ),
array ( 'name' => 'dateCrea_etab' , 'libelle' => 'Date de création de l\'etablissement' , 'type' => 'interval:date' ),
2011-12-23 18:23:58 +00:00
array ( 'name' => 'nbActio' , 'libelle' => 'Nombre d\'actionnaires connus' , 'type' => 'interval:regle' ),
2011-12-16 16:42:58 +00:00
array ( 'name' => 'nbPart' , 'libelle' => 'Nombre de participations connues' , 'type' => 'interval:regle' )
2011-12-16 09:00:12 +00:00
);
2011-12-19 16:48:03 +00:00
$select [ 'entreprise' ] = $this -> entreprise ;
$this -> view -> selectRow = $select ;
2011-12-16 09:00:12 +00:00
$this -> view -> champs = $champs ;
2011-09-28 08:44:27 +00:00
}
2011-10-26 18:33:01 +00:00
public function economiqueAction ()
2011-09-28 08:44:27 +00:00
{
2011-12-16 15:00:06 +00:00
$this -> _helper -> layout () -> disableLayout ();
2011-12-16 09:00:12 +00:00
$champs = array ( array ( 'name' => 'ape_etab' , 'libelle' => 'Code NAF Etablissement' , 'type' => 'text' ),
2011-12-16 15:36:34 +00:00
array ( 'name' => 'ou' ),
array ( 'name' => 'ape_etab' , 'libelle' => 'Liste Code NAF Etablissement' , 'type' => 'textarea' ),
2011-12-16 09:00:12 +00:00
array ( 'name' => 'ape_entrep' , 'libelle' => 'Code NAF Entreprise' , 'type' => 'text' ),
2011-12-16 15:36:34 +00:00
array ( 'name' => 'ou' ),
array ( 'name' => 'ape_entrep' , 'libelle' => 'Liste Code NAF Entreprise' , 'type' => 'textarea' ),
array ( 'name' => 'NaceEtab' , 'libelle' => 'Code NACE de l\'établissement' , 'type' => 'text' ),
array ( 'name' => 'ou' ),
array ( 'name' => 'NaceEtab' , 'libelle' => 'Liste Code NACE de l\'établissement' , 'type' => 'textarea' ),
2011-12-19 09:44:31 +00:00
array ( 'name' => 'NaceEntrep' , 'libelle' => 'Code NACE de l\'entreprise' , 'type' => 'text' ),
2011-12-16 15:36:34 +00:00
array ( 'name' => 'ou' ),
array ( 'name' => 'NaceEntrep' , 'libelle' => 'Liste Code NACE de l\'entreprise' , 'type' => 'textarea' ),
2011-12-16 09:00:12 +00:00
array ( 'name' => 'age_etab' , 'libelle' => 'Code AGE Etablissement' , 'type' => 'text' ),
array ( 'name' => 'age_entrep' , 'libelle' => 'Code AGE Entreprise' , 'type' => 'text' ),
2011-12-16 16:50:07 +00:00
array ( 'name' => 'teff_entrep' , 'libelle' => 'Tranche d\'effectif de l\'entreprise' , 'type' => 'interval:regle' ),
array ( 'name' => 'teff_etab' , 'libelle' => 'Tranche d\'effectif de l\'etablissement' , 'type' => 'interval:regle' ),
2011-12-16 15:00:06 +00:00
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' ),
2011-12-16 16:50:07 +00:00
array ( 'name' => 'capital' , 'libelle' => 'Capital de l\'entreprise' , 'type' => 'interval:regle' ),
2011-12-16 09:00:12 +00:00
);
$this -> view -> champs = $champs ;
2011-11-08 19:51:54 +00:00
}
public function nafAction ()
{
$this -> _helper -> layout () -> disableLayout ();
$this -> _helper -> viewRenderer -> setNoRender ();
2011-12-22 15:34:40 +00:00
$request = $this -> getRequest ();
$niveau = $request -> getParam ( 'niveau' , 1 );
$parent = $request -> getParam ( 'parent' , '' );
$nafM = new Application_Model_Naf ();
$sql = $nafM -> select ();
2011-11-08 19:51:54 +00:00
$niveau ++ ;
2011-12-22 15:34:40 +00:00
2011-11-08 19:51:54 +00:00
if ( ! empty ( $parent ) && $niveau == 2 ) {
$sql -> where ( 'parent = ?' , $parent );
} elseif ( ! empty ( $parent ) && $niveau > 2 ) {
$sql -> where ( " code LIKE ' " . $parent . " %' " );
}
2011-12-22 15:34:40 +00:00
2011-11-08 19:51:54 +00:00
$sql -> where ( 'niveau = ?' , $niveau ) -> order ( 'code ASC' );
$result = $nafM -> fetchAll ( $sql ) -> toArray ();
$tabNaf = array ();
foreach ( $result as $item ){
$naf = array (
'data' => $item [ 'code' ] . ' - ' . $item [ 'lib' ],
'attr' => array ( 'id' => $item [ 'code' ], 'niveau' => $item [ 'niveau' ]),
);
if ( $niveau < 5 ){
$naf [ 'state' ] = 'closed' ;
$naf [ 'children' ] = array ();
}
$tabNaf [] = $naf ;
}
echo json_encode ( $tabNaf );
2011-09-28 08:44:27 +00:00
}
2011-10-26 18:33:01 +00:00
public function geographiqueAction ()
2011-09-28 08:44:27 +00:00
{
$this -> _helper -> layout () -> disableLayout ();
2011-11-07 13:20:19 +00:00
$this -> view -> inlineScript () -> appendFile ( '/themes/default/scripts/jquery.jstree.js' );
2011-12-16 15:00:06 +00:00
$champs = array ( array ( 'name' => 'adr_cp' , 'libelle' => 'Code postal' , 'type' => 'text' ),
2011-12-16 15:36:34 +00:00
array ( 'name' => 'ou' ),
array ( 'name' => 'adr_cp' , 'libelle' => 'Liste Code postal' , 'type' => 'textarea' ),
2011-12-16 15:00:06 +00:00
array ( 'name' => 'adr_dep' , 'libelle' => 'Département' , 'type' => 'text' ),
2011-12-16 15:36:34 +00:00
array ( 'name' => 'ou' ),
array ( 'name' => 'adr_dep' , 'libelle' => 'Liste Département' , 'type' => 'textarea' ),
2011-12-16 15:00:06 +00:00
array ( 'name' => 'adr_com' , 'libelle' => 'Code commune Insee' , 'type' => 'text' ),
2011-12-16 15:36:34 +00:00
array ( 'name' => 'ou' ),
array ( 'name' => 'adr_com' , 'libelle' => 'Liste Code commune Insee' , 'type' => 'textarea' ),
2011-12-16 15:00:06 +00:00
);
$this -> view -> champs = $champs ;
2011-09-28 08:44:27 +00:00
}
2011-10-26 18:33:01 +00:00
public function juridiqueAction ()
2011-09-28 08:44:27 +00:00
{
$this -> _helper -> layout () -> disableLayout ();
2011-12-16 15:00:06 +00:00
$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' )),
2011-12-16 16:50:07 +00:00
array ( 'name' => 'dateImmat' , 'libelle' => 'Date d\'immatriculation de l\'entreprise' , 'type' => 'interval:date' )
2011-12-16 15:00:06 +00:00
);
$this -> view -> champs = $champs ;
2011-09-28 08:44:27 +00:00
}
2011-10-26 18:33:01 +00:00
public function financiereAction ()
2011-09-28 08:44:27 +00:00
{
$this -> _helper -> layout () -> disableLayout ();
2011-12-16 15:00:06 +00:00
$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' )
);
$this -> view -> champs = $champs ;
2011-09-28 08:44:27 +00:00
}
}