2054 lines
65 KiB
PHP
2054 lines
65 KiB
PHP
<?php
|
|
class SaisieController extends Zend_Controller_Action
|
|
{
|
|
|
|
/**
|
|
* Enter description here ...
|
|
* @var unknown_type
|
|
*/
|
|
protected $coursAppel = array(
|
|
array( "triId"=>"1756", "triCode"=>"AIXPRL", "triNom"=>"Cour d'Appel d'Aix-en-Provence", "triCP"=>"13616" ),
|
|
array( "triId"=>"1757", "triCode"=>"AMIENL", "triNom"=>"Cour d'Appel d'Amiens", "triCP"=>"80027" ),
|
|
array( "triId"=>"1758", "triCode"=>"ANGERL", "triNom"=>"Cour d'Appel d'Angers", "triCP"=>"49043" ),
|
|
array( "triId"=>"1759", "triCode"=>"BASSEL", "triNom"=>"Cour d'Appel de Basse-Terre", "triCP"=>"97109" ),
|
|
array( "triId"=>"1760", "triCode"=>"BASTIL", "triNom"=>"Cour d'Appel de Bastia", "triCP"=>"20407" ),
|
|
array( "triId"=>"1761", "triCode"=>"BESANL", "triNom"=>"Cour d'Appel de Besançon", "triCP"=>"25017" ),
|
|
array( "triId"=>"1762", "triCode"=>"BORDEL", "triNom"=>"Cour d'Appel de Bordeaux", "triCP"=>"33077" ),
|
|
array( "triId"=>"1763", "triCode"=>"BOURGL", "triNom"=>"Cour d'Appel de Bourges", "triCP"=>"18023" ),
|
|
array( "triId"=>"1764", "triCode"=>"CAENL", "triNom"=>"Cour d'Appel de Caen", "triCP"=>"14050" ),
|
|
array( "triId"=>"1765", "triCode"=>"CHAMBL", "triNom"=>"Cour d'Appel de Chambéry", "triCP"=>"73018" ),
|
|
array( "triId"=>"1766", "triCode"=>"COLMAL", "triNom"=>"Cour d'Appel de Colmar", "triCP"=>"68027" ),
|
|
array( "triId"=>"1767", "triCode"=>"DIJONL", "triNom"=>"Cour d'Appel de Dijon", "triCP"=>"21034" ),
|
|
array( "triId"=>"1768", "triCode"=>"DOUAIL", "triNom"=>"Cour d'Appel de Douai", "triCP"=>"59507" ),
|
|
array( "triId"=>"1769", "triCode"=>"FORTFL", "triNom"=>"Cour d'Appel de Fort-de-France", "triCP"=>"97200" ),
|
|
array( "triId"=>"1770", "triCode"=>"GRENOL", "triNom"=>"Cour d'Appel de Grenoble", "triCP"=>"38019" ),
|
|
array( "triId"=>"1771", "triCode"=>"LIMOGL", "triNom"=>"Cour d'Appel de Limoges", "triCP"=>"87031" ),
|
|
array( "triId"=>"1772", "triCode"=>"LYONL", "triNom"=>"Cour d'Appel de Lyon", "triCP"=>"69321" ),
|
|
array( "triId"=>"1773", "triCode"=>"METZL", "triNom"=>"Cour d'Appel de Metz", "triCP"=>"57036" ),
|
|
array( "triId"=>"1774", "triCode"=>"MONTPL", "triNom"=>"Cour d'Appel de Montpellier", "triCP"=>"34023" ),
|
|
array( "triId"=>"1775", "triCode"=>"NANCYL", "triNom"=>"Cour d'Appel de Nancy", "triCP"=>"54035" ),
|
|
array( "triId"=>"1776", "triCode"=>"NIMESL", "triNom"=>"Cour d'Appel de Nîmes", "triCP"=>"30031" ),
|
|
array( "triId"=>"1777", "triCode"=>"NOUMEL", "triNom"=>"Cour d'Appel de Nouméa", "triCP"=>"98848" ),
|
|
array( "triId"=>"1778", "triCode"=>"PAPEEL", "triNom"=>"Cour d'Appel de Papeete", "triCP"=>"98714" ),
|
|
array( "triId"=>"1779", "triCode"=>"PARISL", "triNom"=>"Cour d'Appel de Paris", "triCP"=>"75055" ),
|
|
array( "triId"=>"1780", "triCode"=>"PAUL", "triNom"=>"Cour d'Appel de Pau", "triCP"=>"64034" ),
|
|
array( "triId"=>"1781", "triCode"=>"POITIL", "triNom"=>"Cour d'Appel de Poitiers", "triCP"=>"86020" ),
|
|
array( "triId"=>"1782", "triCode"=>"REIMSL", "triNom"=>"Cour d'Appel de Reims", "triCP"=>"51096" ),
|
|
array( "triId"=>"1783", "triCode"=>"RENNEL", "triNom"=>"Cour d'Appel de Rennes", "triCP"=>"35064" ),
|
|
array( "triId"=>"1784", "triCode"=>"RIOML", "triNom"=>"Cour d'Appel de Riom", "triCP"=>"63201" ),
|
|
array( "triId"=>"1785", "triCode"=>"ROUENL", "triNom"=>"Cour d'Appel de Rouen", "triCP"=>"76037" ),
|
|
array( "triId"=>"1786", "triCode"=>"STDENL", "triNom"=>"Cour d'Appel de Saint-Denis-de-La Réunion", "triCP"=>"97488" ),
|
|
array( "triId"=>"1787", "triCode"=>"TOULOL", "triNom"=>"Cour d'Appel de Toulouse", "triCP"=>"31068" ),
|
|
array( "triId"=>"1788", "triCode"=>"VERSAL", "triNom"=>"Cour d'Appel de Versailles", "triCP"=>"78011" ),
|
|
array( "triId"=>"1789", "triCode"=>"ORLEAL", "triNom"=>"Cour d'Appel d'Orléans", "triCP"=>"45044" ),
|
|
array( "triId"=>"1790", "triCode"=>"CAYENL", "triNom"=>"Chambre Détachée de la Cour d'Appel de Fort de France à Cayenne", "triCP"=>"97300" ),
|
|
array( "triId"=>"1798", "triCode"=>"AGENL", "triNom"=>"Cour d'Appel d'Agen", "triCP"=>"47916" ),
|
|
);
|
|
|
|
/**
|
|
* Retourne Fonctions de direction
|
|
*/
|
|
protected function fctDir()
|
|
{
|
|
$fctdir = new Application_Model_FctDir();
|
|
$sql = $fctdir->select('codeFct, libelle');
|
|
$selectDir['0000'] = '-';
|
|
$rows = $fctdir->fetchAll($sql);
|
|
if ( count($rows)>0 ) {
|
|
foreach ($rows as $item) {
|
|
$index = str_pad($item->codeFct, 4, "0", STR_PAD_LEFT);
|
|
$selectDir[$index] = $item->libelle;
|
|
}
|
|
}
|
|
return $selectDir;
|
|
}
|
|
|
|
/**
|
|
* Genre
|
|
* @var array
|
|
*/
|
|
protected $selectGenre = array(
|
|
'' => '-',
|
|
'M.' => 'M',
|
|
'Mme' => 'Mme',
|
|
'Mlle' => 'Mlle',
|
|
'Societe' => 'STE'
|
|
);
|
|
|
|
/**
|
|
* Liste des pays
|
|
* @var array
|
|
*/
|
|
protected $selectPays = array(
|
|
'FRA' => "France",
|
|
'AND' => "Andorre",
|
|
'ARE' => "Emirats Arabes Unis",
|
|
'AFG' => "Afghanistan",
|
|
'ATG' => "Antigua",
|
|
'AIA' => "Anguilla",
|
|
'ALB' => "Albanie",
|
|
'ARM' => "Arménie",
|
|
'ANT' => "Antilles Néerlandaises",
|
|
'AGO' => "Angola",
|
|
'ATA' => "Antarctique",
|
|
'ARG' => "Argentine",
|
|
'ASM' => "Samoa Américaines",
|
|
'AUT' => "Autriche",
|
|
'AUS' => "Australie",
|
|
'ABW' => "Aruba",
|
|
'AZE' => "Azerbaïdjan",
|
|
'BIH' => "Bosnie-Herzégovine",
|
|
'BRB' => "Barbade",
|
|
'BGD' => "Bangladesh",
|
|
'BEL' => "Belgique",
|
|
'BFA' => "Burkina Faso",
|
|
'BGR' => "Bulgarie",
|
|
'BHR' => "Bahreïn",
|
|
'BDI' => "Burundi",
|
|
'BEN' => "Bénin",
|
|
'BMU' => "Bermudes",
|
|
'BRN' => "Brunei",
|
|
'BOL' => "Bolivie",
|
|
'BRA' => "Brésil",
|
|
'BHS' => "Bahamas",
|
|
'BTN' => "Bhoutan",
|
|
'BVT' => "Iles Bouvet",
|
|
'BWA' => "Botswana",
|
|
'BLR' => "Biélorussie",
|
|
'BLZ' => "Bélize",
|
|
'CAN' => "Canada",
|
|
'CCK' => "Iles Cocos",
|
|
'CAF' => "République Centrafricaine",
|
|
'COG' => "Congo",
|
|
'CHE' => "Suisse",
|
|
'CIV' => "Côte d\'Ivoire",
|
|
'COK' => "Iles Cook",
|
|
'CHL' => "Chili",
|
|
'CMR' => "Cameroun",
|
|
'CHN' => "Chine",
|
|
'COL' => "Colombie",
|
|
'CRI' => "Costa Rica",
|
|
'CSK' => "Tchécoslovaquie",
|
|
'CUB' => "Cuba",
|
|
'CPV' => "Cap-Vert",
|
|
'CXR' => "Ile Christmas",
|
|
'CYP' => "Chypre",
|
|
'CZE' => "Rébublique Tchèque",
|
|
'DDR' => "République Démocratique Allemande",
|
|
'DEU' => "Allemagne",
|
|
'DJI' => "Djibouti",
|
|
'DNK' => "Danemark",
|
|
'DMA' => "Dominique",
|
|
'DOM' => "République Dominicaine",
|
|
'DZA' => "Algérie",
|
|
'ECU' => "Equateur",
|
|
'EST' => "Estonie",
|
|
'EGY' => "Egypte",
|
|
'ESH' => "Sahara Occidental",
|
|
'ERI' => "Eritrea",
|
|
'ESP' => "Espagne",
|
|
'ETH' => "Ethiopie",
|
|
'FIN' => "Finlande",
|
|
'FJI' => "Iles Fidji",
|
|
'FLK' => "Iles Malouines",
|
|
'FSM' => "Etats Fédérés de Micronésie",
|
|
'FRO' => "Iles Féroé",
|
|
'GAB' => "Gabon",
|
|
'GBR' => "Royaume-Uni",
|
|
'GRD' => "Grenade",
|
|
'GEO' => "Géorgie",
|
|
'GUF' => "Guinée française",
|
|
'GHA' => "Ghana",
|
|
'GIB' => "Gibraltar",
|
|
'GRL' => "Groënland",
|
|
'GMB' => "Gambie",
|
|
'GIN' => "Guinée",
|
|
'GLP' => "Guadeloupe",
|
|
'GNQ' => "Guinée Equatoriale",
|
|
'GRC' => "Grèce",
|
|
'SGS' => "Géorgie du sud & Iles Sandwich",
|
|
'GTM' => "Guatemala",
|
|
'GUM' => "Guam",
|
|
'GNB' => "Guinée-Bissau",
|
|
'GUY' => "Guyane",
|
|
'HKG' => "Hong Kong",
|
|
'HMD' => "Iles Heard et Mc Donald",
|
|
'HND' => "Honduras",
|
|
'HRV' => "Croatie",
|
|
'HTI' => "Haïti",
|
|
'HUN' => "Hongrie",
|
|
'IDN' => "Indonésie",
|
|
'IRL' => "Irlande",
|
|
'ISR' => "Israël",
|
|
'IND' => "Inde",
|
|
'IOT' => "Iles Vierges Britanniques",
|
|
'IRQ' => "Irak",
|
|
'IRN' => "Iran",
|
|
'ISL' => "Islande",
|
|
'ITA' => "Italie",
|
|
'JAM' => "Jamaïque",
|
|
'JOR' => "Jordanie",
|
|
'JPN' => "Japon",
|
|
'KEN' => "Kenya",
|
|
'KGZ' => "Kirghizistan",
|
|
'KHM' => "Cambodge",
|
|
'KIR' => "Kiribati",
|
|
'COM' => "Comores",
|
|
'KNA' => "Saint-Kitts",
|
|
'PRK' => "Corée",
|
|
'KOR' => "République de Corée",
|
|
'KWT' => "Koweït",
|
|
'CYM' => "Iles Caïman",
|
|
'KAZ' => "Kazakhstan",
|
|
'LAO' => "Laos",
|
|
'LBN' => "Liban",
|
|
'LCA' => "Sainte-Lucie",
|
|
'LIE' => "Liechtenstein",
|
|
'LKA' => "Sri Lanka",
|
|
'LBR' => "Libéria",
|
|
'LSO' => "Lesotho",
|
|
'LTU' => "Lithuanie",
|
|
'LUX' => "Luxembourg",
|
|
'LVA' => "Lettonie",
|
|
'LBY' => "Libye",
|
|
'MAR' => "Maroc",
|
|
'MCO' => "Monaco",
|
|
'MDA' => "Moldavie",
|
|
'MDG' => "Madagascar",
|
|
'MHL' => "Iles Marshall",
|
|
'MKD' => "Macédoine",
|
|
'MLI' => "Mali",
|
|
'MMR' => "Myanmar",
|
|
'MNG' => "Mongolie",
|
|
'MAC' => "Macao",
|
|
'MNP' => "Iles Mariannes",
|
|
'MTQ' => "Martinique",
|
|
'MRT' => "Mauritanie",
|
|
'MNE' => "Monténégro",
|
|
'MSR' => "Montserrat",
|
|
'MLT' => "Malte",
|
|
'MUS' => "Ile Maurice",
|
|
'MDV' => "Maldives",
|
|
'MWI' => "Malawi",
|
|
'MEX' => "Mexique",
|
|
'MYS' => "Malaisie",
|
|
'MOZ' => "Mozambique",
|
|
'NAM' => "Namibie",
|
|
'NCL' => "Nouvelle Calédonie",
|
|
'NER' => "Niger",
|
|
'NFK' => "Iles Norfolk",
|
|
'NGA' => "Nigeria",
|
|
'NIC' => "Nicaragua",
|
|
'NLD' => "Pays-Bas",
|
|
'NOR' => "Norvège",
|
|
'NPL' => "Népal",
|
|
'NRU' => "Nauru",
|
|
'NTZ' => "Zone Neutre",
|
|
'NIU' => "Niue",
|
|
'NZL' => "Nouvelle Zélande",
|
|
'OMN' => "Oman",
|
|
'PAN' => "Panama",
|
|
'PER' => "Pérou",
|
|
'PYF' => "Polynésie Francaise",
|
|
'PNG' => "Papouasie Nouvelle-Guinée",
|
|
'PHL' => "Philippines",
|
|
'PAK' => "Pakistan",
|
|
'POL' => "Pologne",
|
|
'SPM' => "Saint Pierre et Miquelon",
|
|
'PCN' => "Pitcairn",
|
|
'PRI' => "Porto Rico",
|
|
'PRT' => "Portugal",
|
|
'PLW' => "Palau",
|
|
'PRY' => "Paraguay",
|
|
'QAT' => "Qatar",
|
|
'REU' => "Ile de la Réunion",
|
|
'ROM' => "Roumanie",
|
|
'RUS' => "Russie",
|
|
'RWA' => "Rwanda",
|
|
'SAU' => "Arabie Saoudite",
|
|
'SLB' => "Iles Salomon",
|
|
'SRB' => "Serbie",
|
|
'SYC' => "Seychelles",
|
|
'SDN' => "Soudan",
|
|
'SWE' => "Suède",
|
|
'SGP' => "Singapour",
|
|
'SHN' => "Sainte-Hélène",
|
|
'SVN' => "Slovénie",
|
|
'SJM' => "Spitsberg et lle Jan Mayen",
|
|
'SVK' => "Slovaquie",
|
|
'SLE' => "Sierra Leone",
|
|
'SMR' => "Saint-Marin",
|
|
'SEN' => "Sénégal",
|
|
'SOM' => "Somalie",
|
|
'SUR' => "Surinam",
|
|
'STP' => "São Tomé et Principe",
|
|
'SUN' => "URSS",
|
|
'SLV' => "Salvador",
|
|
'SYR' => "Syrie",
|
|
'SWZ' => "Swaziland",
|
|
'TCA' => "Iles Turques et Caïques",
|
|
'TCD' => "Tchad",
|
|
'ATF' => "Terres Australes Francaises",
|
|
'TGO' => "Togo",
|
|
'THA' => "Thaïlande",
|
|
'TJK' => "Tadjikistan",
|
|
'TKL' => "Iles Tokélaou",
|
|
'TKM' => "Turkménistan",
|
|
'TUN' => "Tunisie",
|
|
'TON' => "Tonga",
|
|
'TMP' => "Timor Oriental",
|
|
'TUR' => "Turquie",
|
|
'TTO' => "Trinité-et-Tobago",
|
|
'TUV' => "Tuvalu",
|
|
'TWN' => "Taïwan, République de Chine",
|
|
'TZA' => "Tanzanie",
|
|
'UKR' => "Ukraine",
|
|
'UGA' => "Ouganda",
|
|
'UMI' => "Iles mineures éloignées des E.U",
|
|
'USA' => "Etats Unis",
|
|
'URY' => "Uruguay",
|
|
'UZB' => "Ouzbékistan",
|
|
'VAT' => "Vatican",
|
|
'VCT' => "Saint Vincent et les Grenadines",
|
|
'VEN' => "Vénézuéla",
|
|
'VGB' => "Iles Vierges Britaniques",
|
|
'VIR' => "Iles Vierges U.S",
|
|
'VNM' => "Vietnam",
|
|
'VUT' => "Vanuatu",
|
|
'WLF' => "Wallis et Futuna",
|
|
'WSM' => "Samoa Américaines",
|
|
'XBA' => "Rép. Turque de Chypre",
|
|
'YMD' => "Yémen (République Démocratique)",
|
|
'YEM' => "Yemen",
|
|
'MYT' => "Mayotte",
|
|
'YUG' => "Yougoslavie",
|
|
'ZAF' => "Afrique du sud",
|
|
'ZMB' => "Zambie",
|
|
'ZAR' => "Zaïre",
|
|
'ZWE' => "Zimbabwe",
|
|
);
|
|
|
|
public function init()
|
|
{
|
|
require_once 'Scores/WsScores.php';
|
|
require_once 'Scores/SessionEntreprise.php';
|
|
require_once 'Scores/IdentiteEntreprise.php';
|
|
require_once 'common/dates.php';
|
|
|
|
$ws = new WsScores();
|
|
$countries = json_decode($ws->getCatalogCountry(),true);
|
|
if ($countries!==false) {
|
|
$lib = array();
|
|
foreach ($countries as $key => $row) {
|
|
$lib[$key] = $row['libPays'];
|
|
}
|
|
array_multisort($lib, SORT_ASC, SORT_STRING, $countries);
|
|
$this->countries = $countries;
|
|
}
|
|
|
|
$currencies = json_decode($ws->getCatalogCurrency(),true);
|
|
if ($currencies!==false) {
|
|
$lib = array();
|
|
foreach ($currencies as $key => $row) {
|
|
$lib[$key] = $row['devNom'];
|
|
}
|
|
array_multisort($lib, SORT_ASC, SORT_STRING, $currencies);
|
|
$this->currencies = $currencies;
|
|
}
|
|
|
|
$this->view->headLink()->appendStylesheet('/themes/default/styles/saisie.css', 'all');
|
|
}
|
|
|
|
/**
|
|
* Index
|
|
*/
|
|
public function indexAction(){}
|
|
|
|
/**
|
|
* Affichage du formulaire de saisie
|
|
* @todo : Enregistrement des informations en session pour récupération
|
|
*/
|
|
public function ficheAction()
|
|
{
|
|
$this->view->headScript()
|
|
->appendFile('/themes/default/scripts/saisie.js', 'text/javascript')
|
|
->appendFile('/libs/form/jquery.form.js', 'text/javascript');
|
|
|
|
$request = $this->getRequest();
|
|
$siret = $request->getParam('siret');
|
|
$id = $request->getParam('id', 0);
|
|
|
|
$this->view->headTitle()->append('Saisie - '.$siret);
|
|
|
|
$ws = new WsScores();
|
|
$infos = $ws->getIdentite($siret, $id);
|
|
$devisesReponse = $ws->getDevises();
|
|
$devises = $devisesReponse->result->item;
|
|
|
|
//Mise en session
|
|
$session = new SessionEntreprise($siret, $id, true);
|
|
$session->setInfoEntrep($infos);
|
|
|
|
$sessionSaisie = new Zend_Session_Namespace('saisie');
|
|
$sessionSaisie->tabSaisie['tribunal'] = $infos->TribunalCode;
|
|
|
|
$this->view->assign('selectPays', $this->selectPays);
|
|
|
|
$this->view->assign('siret', $siret);
|
|
$this->view->assign('id', $id);
|
|
$this->view->assign('devises', $devises);
|
|
$this->view->assign('etab', $infos);
|
|
}
|
|
|
|
/**
|
|
* Sauvegarde des informations de saisie
|
|
* @todo : Sauvegarder en mémoire la saisie
|
|
*/
|
|
public function saveAction()
|
|
{
|
|
//$this->_helper->layout()->disableLayout();
|
|
//$this->_helper->viewRenderer->setNoRender(true);
|
|
|
|
$request = $this->getRequest();
|
|
|
|
$siret = $request->getParam('siret');
|
|
$id = $request->getParam('id', 0);
|
|
|
|
$tabSaisie = $request->getParam('frmSaisie');
|
|
$tabJugement = $request->getParam('jugement');
|
|
$tabActionna = $request->getParam('actionnaire');
|
|
$tabParticip = $request->getParam('particip');
|
|
$tabScore = $request->getParam('score');
|
|
$perimetreVente = $request->getParam('perimetreVente');
|
|
$etablissement5500 = $request->getParam('etablissement5500');
|
|
$etabnic = $request->getParam('etabnic');
|
|
|
|
//Vente et Cession evénement 5500
|
|
if ($perimetreVente!=null){
|
|
foreach($perimetreVente as $k => $p){
|
|
if ( $p=='-' ){
|
|
array_splice($perimetreVente, $k, 1);
|
|
}
|
|
}
|
|
if ( isset($perimetreVente) && count($perimetreVente)>0 ){
|
|
$tabJugement['even'] = array_merge(
|
|
$tabJugement['even'],
|
|
$perimetreVente);
|
|
}
|
|
}
|
|
//Liste établissements concernées
|
|
if ( $etablissement5500!=null && count($etablissement5500)>0 ) {
|
|
$countEtab = 0;
|
|
$txtEtab = '';
|
|
foreach($etablissement5500 as $etab){
|
|
$txtEtab.= $etab;
|
|
$countEtab++;
|
|
if($countEtab>10) break;
|
|
if( count($etablissement5500) > $countEtab )
|
|
{ $txtEtab.=', '; }
|
|
}
|
|
|
|
if ( count($etablissement5500)>1 ){
|
|
$txt = 'Etablissement(s) concerné(s) : ';
|
|
} else {
|
|
$txt = 'Etablissement concerné : ';
|
|
}
|
|
|
|
if ( $tabJugement['comp']!='' ) {
|
|
$tabJugement['comp'].= ' '.$txt.$txtEtab;
|
|
} else {
|
|
$tabJugement['comp'] = ' '.$txt.$txtEtab;
|
|
}
|
|
}
|
|
|
|
//Sélection nic pour établissement concerné
|
|
if ( $etabnic!=null && $etabnic != '' ) {
|
|
if ( isset($txtEtab) && $txtEtab!='' ) {
|
|
$tabJugement['comp'].= ', '.$etabnic;
|
|
} else {
|
|
$tabJugement['comp'].= 'Etablissement concerné : '.$etabnic;
|
|
}
|
|
}
|
|
|
|
//Opposition à l'adresse
|
|
if ( $tabJugement['oppo'] == 'adresse' ) {
|
|
if ( $tabJugement['comp']!='' ) {
|
|
$tabJugement['comp'].= ' Opposition : A l\'adresse du bien vendu';
|
|
} else {
|
|
$tabJugement['comp'] = 'Opposition : A l\'adresse du bien vendu';
|
|
}
|
|
}
|
|
|
|
$tabInfos = array();
|
|
$tabInfos['identite'] = $tabSaisie;
|
|
$tabInfos['jugement'] = $tabJugement;
|
|
$tabInfos['actionnaire'] = $tabActionna;
|
|
$tabInfos['participation'] = $tabParticip;
|
|
$tabInfos['scores'] = $tabScore;
|
|
|
|
$ws = new WsScores();
|
|
$O = $ws->setInfosEntrep($siret, $id, $tabInfos);
|
|
|
|
//Enregistrement en session pour saisie supplémentaire ou lors d'erreur
|
|
$tabSaisie = array(
|
|
'source' => $tabJugement['source'],
|
|
'dateParution' => $tabJugement['dateParution'],
|
|
'numParution' => $tabJugement['numParution']
|
|
);
|
|
|
|
$session = new Zend_Session_Namespace('saisie');
|
|
$session->tabSaisie = $tabSaisie;
|
|
|
|
if ($O->error->errNum!=0){
|
|
$message = 'Erreur lors de l\'enregistrement !';
|
|
$this->_helper->getHelper('Redirector')->setGotoSimple('fiche', 'saisie', null, array(
|
|
'siret' => $siret,
|
|
'id' => $id,
|
|
'message' => $message
|
|
));
|
|
} else {
|
|
$message = 'Saisie enregistrée !';
|
|
$this->view->assign('params', $request->getParams());
|
|
$this->view->assign('tabInfos', $tabInfos);
|
|
$this->view->assign('O', $O);
|
|
$this->view->assign('siret', $siret);
|
|
$this->view->assign('id', $id);
|
|
$this->view->assign('message', $message);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Retourne le formulaire bodacc
|
|
*/
|
|
public function formAction()
|
|
{
|
|
$request = $this->getRequest();
|
|
$siret = $request->getParam('siret');
|
|
$id = $request->getParam('id', 0);
|
|
|
|
$session = new SessionEntreprise($siret, $id);
|
|
|
|
$ws = new WsScores();
|
|
|
|
$reponse = $ws->getListeJalCollecte();
|
|
$listeJalCollecte = $reponse->result->item;
|
|
$this->view->assign('ListeJalCollecte', $listeJalCollecte);
|
|
|
|
if (Zend_Session::sessionExists()){
|
|
if(Zend_Session::namespaceIsset('saisie')){
|
|
$sessionSaisie = new Zend_Session_Namespace('saisie');
|
|
$saisie = $sessionSaisie->tabSaisie;
|
|
$this->view->assign('saisie', $saisie);
|
|
}
|
|
}
|
|
|
|
$eventNum = isset($saisie['eventNum']) ? $saisie['eventNum'] : '0000' ;
|
|
$this->view->assign('eventNum', $eventNum);
|
|
|
|
//Si le code tribunal n'est pas défini dans la fiche identité
|
|
//alors en sélectionner un par défault suivant le code INSEE
|
|
$tribunal = isset($saisie['tribunal']) ? $saisie['tribunal'] : '' ;
|
|
$this->view->assign('codeTribunalCmp', $tribunal);
|
|
|
|
$listeCompetences = array();
|
|
if ($tribunal=='') {
|
|
$siret = $session->getSiret();
|
|
$codeCommune = $session->getCodeCommune();
|
|
$reponse = $ws->getListeCompetences($siret, 'tri', $codeCommune);
|
|
$listeCompetences = $reponse->result->item;
|
|
}
|
|
$this->view->assign('ListeCompetences', $listeCompetences);
|
|
|
|
$reponse = $ws->getTribunaux( array('C','I','G','M','P') );
|
|
$listeTribunaux = array();
|
|
if (count($reponse->result->item)>0) {
|
|
foreach($reponse->result->item as $item) {
|
|
$listeTribunaux[$item->code] = $item->nom;
|
|
}
|
|
asort($listeTribunaux);
|
|
}
|
|
$this->view->assign('ListeTribunaux', $listeTribunaux);
|
|
|
|
$selectEvent = array(
|
|
'1100', '1101' , '1200', '1201', '1300', '1301', '1302', '1303', '1304', '1305', '1306',
|
|
'1307',
|
|
'1308', '1309', '1310', '1311', '1312', '1408', '1411', '1412', '1413', '1414', '1415',
|
|
'1511', '1502', '1503', '1512', '1600', '1601', '1999', '2102', '2100', '2202', '2206',
|
|
'2319', '2315', '2313', '2305', '2307', '2303', '2306', '2901', '5500', '6700', '1010',
|
|
'1050', '1055', '2203', '2204', '2210', '2212',
|
|
);
|
|
$eventM = new Application_Model_TabEvenements();
|
|
$sql = $eventM->select()
|
|
->where('codEven IN ('.join(',',$selectEvent).')')
|
|
->order('libEven ASC');
|
|
$rows = $eventM->fetchAll($sql);
|
|
$tabEvent = array();
|
|
if ($rows->count()>0) {
|
|
foreach($rows as $row){
|
|
$tabEvent[$row->codEven] = $row->libEven;
|
|
}
|
|
}
|
|
$this->view->assign('tabEvent', $tabEvent);
|
|
$this->view->assign('siret', $siret);
|
|
}
|
|
|
|
/**
|
|
* Retourne le formulaire correspondant à l'évenement
|
|
*/
|
|
public function evenAction()
|
|
{
|
|
$request = $this->getRequest();
|
|
if ( $request->isPost() ){
|
|
$this->_helper->layout->disableLayout();
|
|
}
|
|
$num = $request->getParam('num', '0000');
|
|
$siren = $request->getParam('siren', '');
|
|
$nic = $request->getParam('nic', '');
|
|
$tribunal = $request->getParam('tribunal', '');
|
|
$selectDir = $this->fctDir();
|
|
|
|
if (Zend_Session::sessionExists()){
|
|
/*if(Zend_Session::namespaceIsset('saisie')){
|
|
$sessionSaisie = new Zend_Session_Namespace('saisie');
|
|
$this->view->assign('saisie', $sessionSaisie->tabSaisie);
|
|
$num = $sessionSaisie->tabSaisie['eventNum'];
|
|
$tribunal = $sessionSaisie->tabSaisie['tribunal'];
|
|
$siren = substr($siren, 0, 9);
|
|
$nic = substr($siren, 9, 5);
|
|
}*/
|
|
}
|
|
|
|
switch($num) {
|
|
case '5500':
|
|
//Liste des établissements
|
|
$ws = new WsScores();
|
|
$reponse = $ws->getListeEtablissements($siren);
|
|
$listeEtablissements = $reponse->result->item;
|
|
$this->view->assign('ListeEtablissements', $listeEtablissements);
|
|
break;
|
|
case '6700':
|
|
//Liste des établissements
|
|
$ws = new WsScores();
|
|
$reponse = $ws->getListeEtablissements($siren);
|
|
$listeEtablissements = $reponse->result->item;
|
|
//Zend_Registry::get('firebug')->info(count($listeEtablissements));
|
|
$this->view->assign('ListeEtablissements', $listeEtablissements);
|
|
//Assign constantes
|
|
$this->view->assign('selectDir', $selectDir);
|
|
$this->view->assign('selectGenre',$this->selectGenre);
|
|
break;
|
|
|
|
case '2202':
|
|
case '2203':
|
|
case '2204':
|
|
case '2210':
|
|
case '2212':
|
|
case '2315':
|
|
//Assign constantes
|
|
$this->view->assign('selectDir', $selectDir);
|
|
$this->view->assign('selectGenre',$this->selectGenre);
|
|
break;
|
|
}
|
|
$this->view->assign('siren', $siren);
|
|
$this->view->assign('nic', $nic);
|
|
$this->view->assign('tribunal', $tribunal);
|
|
$this->renderScript('saisie/even/'.$num.'.phtml');
|
|
}
|
|
|
|
/**
|
|
* Affiche un champ de formulaire
|
|
*/
|
|
public function champsAction()
|
|
{
|
|
$request = $this->getRequest();
|
|
$champ = $request->getParam('champ', '');
|
|
$this->renderScript('saisie/champs/'.$champ.'.phtml');
|
|
}
|
|
|
|
/**
|
|
* Retourne les informations de l'établissements
|
|
*/
|
|
public function etabnicAction()
|
|
{
|
|
$this->_helper->layout->disableLayout();
|
|
$this->_helper->viewRenderer->setNoRender();
|
|
|
|
$request = $this->getRequest();
|
|
$siret = $request->getParam('siret', '');
|
|
if($siret!='') {
|
|
$ws = new WsScores();
|
|
$etab = $ws->getIdentite($siret);
|
|
if($etab->Siret==$siret){
|
|
echo $etab->Adresse.' '.$etab->CP.' '.$etab->Ville.' ('. $etab->Nic.')';
|
|
}
|
|
}
|
|
}
|
|
|
|
public function listetabAction()
|
|
{
|
|
$this->_helper->layout->disableLayout();
|
|
$this->_helper->viewRenderer->setNoRender();
|
|
|
|
$request = $this->getRequest();
|
|
$siren = $this->getParam('siren');
|
|
$p = $request->getParam('p', 0);
|
|
if (!empty($p)) {
|
|
$ws = new WsScores();
|
|
$reponse = $ws->getListeEtablissements($siren, -1, $p);
|
|
$liste = array();
|
|
if (count($reponse->result->item)>0) {
|
|
foreach ($reponse->result->item as $item) {
|
|
$liste[] = array(
|
|
'value' => $item->Nic,
|
|
'label' => $siren.$item->Nic.' - '.$item->Adresse.' '.$item->CP.' '.$item->Ville,
|
|
);
|
|
}
|
|
}
|
|
if ($p < $reponse->nbReponses) {
|
|
$p = $p+200;
|
|
}
|
|
$output = array( 'p' => $p, 'list' => $liste );
|
|
}
|
|
echo json_encode($output);
|
|
}
|
|
|
|
|
|
/**
|
|
* Retourne le formulaire d'opposition insee
|
|
*/
|
|
public function oppositioninseeAction()
|
|
{
|
|
$this->_helper->layout->disableLayout();
|
|
}
|
|
|
|
/**
|
|
* Retourne le formulaire de refus rncs
|
|
*/
|
|
public function refusrncsAction()
|
|
{
|
|
$this->_helper->layout->disableLayout();
|
|
}
|
|
|
|
/**
|
|
* Suppression / Copie et Edition des annonces
|
|
* @todo : Faire l'edition des annonces
|
|
*/
|
|
public function annonceAction()
|
|
{
|
|
$this->_helper->layout->disableLayout();
|
|
$this->_helper->viewRenderer->setNoRender();
|
|
|
|
$request = $this->getRequest();
|
|
$source = $request->getParam('source');
|
|
$op = $request->getParam('op');
|
|
|
|
switch($op)
|
|
{
|
|
case 'delete':
|
|
|
|
$siret = str_replace(' ', '', $request->getParam('siret'));
|
|
$idan = $request->getParam('idan');
|
|
|
|
$sourceNum = false;
|
|
$source = strtoupper($source);
|
|
if (in_array($source, array('BODA', 'BODB', 'BODC'))){
|
|
$sourceNum = 1;
|
|
} elseif ($source == 'BALO') {
|
|
$sourceNum = 2;
|
|
} elseif ($source == 'ASSO') {
|
|
$sourceNum = 3;
|
|
} elseif (in_array($source, array('BOMP A', 'BOMP B', 'BOMP C', 'MAPA'))) {
|
|
$sourceNum = 4;
|
|
} elseif (!empty($source)){
|
|
$sourceNum = 0;
|
|
}
|
|
|
|
if ($sourceNum === false) {
|
|
echo "Source inconnu"; exit;
|
|
}
|
|
|
|
$ws = new WsScores();
|
|
$reponse = $ws->supprAnnonce($sourceNum, $idan, $siret);
|
|
$error = $reponse->error;
|
|
if ( isset($error) && $error->errnum == 0 ){
|
|
$output = 'Annonce '.$idan.' supprimé !';
|
|
} elseif ( isset($error) && $error->errnum != 0 ) {
|
|
$output = 'Erreur lors de la suppression.';
|
|
} else {
|
|
$output = "Une erreur est survenue...";
|
|
}
|
|
echo $output;
|
|
|
|
break;
|
|
|
|
case 'copy':
|
|
|
|
$siretIn = str_replace(' ', '', $request->getParam('siretIn'));
|
|
$siretOut = str_replace(' ', '', $request->getParam('siretOut'));
|
|
$idan = $request->getParam('idan');
|
|
|
|
$sourceNum = false;
|
|
$source = strtoupper($source);
|
|
if (in_array($source, array('BODA', 'BODB', 'BODC'))){
|
|
$sourceNum = 1;
|
|
} elseif ($source == 'BALO') {
|
|
$sourceNum = 2;
|
|
} elseif ($source == 'ASSO') {
|
|
$sourceNum = 3;
|
|
} elseif (in_array($source, array('BOMP A', 'BOMP B', 'BOMP C', 'MAPA'))) {
|
|
$sourceNum = 4;
|
|
} elseif (!empty($source)){
|
|
$sourceNum = 0;
|
|
}
|
|
if ($sourceNum === false) {
|
|
echo "Source inconnu"; exit;
|
|
}
|
|
$ws = new WsScores();
|
|
$reponse = $ws->dupliqueAnnonce($sourceNum, $idan, $siretIn, $siretOut);
|
|
$error = $reponse->error;
|
|
if ( isset($error) && $error->errnum == 0 ){
|
|
$output = 'Annonce '.$idan.' dupliqué sur '.$siretOut.'!';
|
|
} elseif ( isset($error) && $error->errnum != 0 ) {
|
|
$output = 'Erreur lors de la duplication.';
|
|
} else {
|
|
$output = "Une erreur est survenue...";
|
|
}
|
|
echo $output;
|
|
|
|
break;
|
|
|
|
case 'edit':
|
|
|
|
//@todo : sauvegarder
|
|
|
|
$siret = $request->getParam('siret');
|
|
$idan = $request->getParam('idan');
|
|
|
|
print_r($request->getParams());
|
|
|
|
|
|
|
|
/*
|
|
echo saisie_save($siret, '', $tabInfo);
|
|
echo '<br/>';
|
|
|
|
*/
|
|
|
|
break;
|
|
|
|
case 'even':
|
|
|
|
$siret = str_replace(' ', '', $request->getParam('siret'));
|
|
$idan = $request->getParam('idan');
|
|
$codeEven = $request->getParam('even');
|
|
$siren = substr($siret,0,9);
|
|
$ws = new WsScores();
|
|
$result = $ws->setAnnonceEven($siren, $idan, $codeEven);
|
|
if ($result===true) {
|
|
echo "Modification effectué";
|
|
} else {
|
|
echo "Erreur !";
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
echo 'Error !';
|
|
break;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Affiche le fomulaire d'edition/suppression/copie d'annonce
|
|
*/
|
|
public function annoncedialogAction()
|
|
{
|
|
$this->_helper->layout->disableLayout();
|
|
|
|
$request = $this->getRequest();
|
|
$siret = $request->getParam('siret');
|
|
$op = $request->getParam('op');
|
|
$idan = $request->getParam('idAnn');
|
|
$source = $request->getParam('code');
|
|
|
|
if ($op == 'edit')
|
|
{
|
|
$siret = $request->getParam('siret');
|
|
|
|
$siren = substr($siret,0,9);
|
|
$nic = substr($siret,10,5);
|
|
if ( !empty($idan) )
|
|
{
|
|
$ws = new WsScores();
|
|
$reponse = $ws->getAnnonceCollecte($idan, $siret);
|
|
|
|
if ($reponse->error->errnum>0)
|
|
{
|
|
$message = $reponse->error->errmsg;
|
|
$this->view->assign('message', $message);
|
|
}
|
|
else
|
|
{
|
|
$idanResult = $reponse->result;
|
|
//Limitation des événements
|
|
$eventLimits = array('5500');
|
|
foreach ( $eventLimits as $eventLimit )
|
|
{
|
|
$isEditable = false;
|
|
if (count($idanResult->even->item)>0){
|
|
foreach($idanResult->even->item as $even){
|
|
if ($eventLimit == $even->CodeEven){
|
|
$isEditable = true;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
if ( $isEditable && in_array($idanResult->source, array('JT', 'ANTE')))
|
|
{
|
|
//Mapper idanResult dans le tableau de saisie
|
|
$saisie = array(
|
|
'source' => isset($_SESSION['source']) ? $_SESSION['source'] : $idanResult->source,
|
|
'dateParution' => isset($_SESSION['dateParution']) ? $_SESSION['dateParution'] :
|
|
WDate::dateT('Y-m-d', 'd/m/Y', substr($idanResult->dateSource,0,10)),
|
|
'numParution' => isset($_SESSION['numParution']) ? $_SESSION['numParution'] : '',
|
|
'dateJugement' => WDate::dateT('Y-m-d', 'd/m/Y', $idanResult->dateEffetFinP),
|
|
'tribunal' => $idanResult->tribunal,
|
|
'even' => $idanResult->even->item,
|
|
'eventNum' => $eventLimit,
|
|
'comp' => $idanResult->complement,
|
|
'montant' => $idanResult->montant,
|
|
'dateFinPeriode' => WDate::dateT('Y-m-d', 'd/m/Y', $idanResult->dateJugement),
|
|
);
|
|
|
|
$intervenants = array();
|
|
for ( $i=0 ; $i<3 ; $i++ ) {
|
|
$intervenants[$i] = array(
|
|
'type' => $idanResult->{'inter'.($i+1).'type'},
|
|
'id' => $idanResult->{'inter'.($i+1).'id'},
|
|
'nom' => $idanResult->{'inter'.($i+1).'nom'},
|
|
);
|
|
}
|
|
|
|
$sessionSaisie = new Zend_Session_Namespace('saisie');
|
|
$sessionSaisie->tabSaisie = $saisie;
|
|
|
|
//require_once realpath(dirname(__FILE__)).'/constantes.php';
|
|
//require_once realpath(dirname(__FILE__)).'/saisie_form_event.php';
|
|
break;
|
|
} else {
|
|
$message = "Source : ".$idanResult->source."<br/>";
|
|
$message.= "Evénement(s) non éditable : <br/>";
|
|
foreach($idanResult->even->item as $even){
|
|
$message.= $even->CodeEven." - ";
|
|
$eventM = new Application_Model_TabEvenements();
|
|
$row = $eventM->find($even->CodeEven);
|
|
if (null !== row) {
|
|
$message.= $row->current()->libEven;
|
|
}
|
|
$message.= "<br/>";
|
|
}
|
|
$this->view->assign('message', $message);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
elseif ($op == 'even')
|
|
{
|
|
$eventM = new Application_Model_TabEvenements();
|
|
$sql = $eventM->select()->order('libEven ASC');
|
|
$rows = $eventM->fetchAll($sql);
|
|
$tabEvent = array();
|
|
if ($rows->count()>0) {
|
|
foreach($rows as $row){
|
|
$tabEvent[$row->codEven] = $row->libEven;
|
|
}
|
|
}
|
|
$this->view->assign('evens', $tabEvent);
|
|
}
|
|
|
|
$this->view->assign('op', $op);
|
|
$this->view->assign('idan', $idan);
|
|
$this->view->assign('source', $source);
|
|
$this->view->assign('siret', $siret);
|
|
}
|
|
|
|
public function associationAction()
|
|
{
|
|
$this->_helper->layout()->disableLayout();
|
|
|
|
$request = $this->getRequest();
|
|
$type = $request->getParam('type');
|
|
$siren = $request->getParam('siren');
|
|
$waldec = $request->getParam('waldec');
|
|
|
|
//Téléchargement du fichier
|
|
if ( isset($_FILES) && count($_FILES)==1 ) {
|
|
$this->_helper->viewRenderer->setNoRender(true);
|
|
|
|
if ( empty($siren) ) {
|
|
echo "Pas d'identifiant!";
|
|
} else {
|
|
|
|
$c = Zend_Registry::get('config');
|
|
$path = $c->profil->path->data.'/association';
|
|
|
|
if ( $type=='bilan' ){
|
|
$dateCloture = $request->getParam('dateCloture');
|
|
if (strlen($dateCloture)!=8) {
|
|
echo "Erreur format date cloture";
|
|
}
|
|
$path.= '/bilans';
|
|
$name = $siren.'_'.$dateCloture;
|
|
} elseif ( $type=='acte' ) {
|
|
$date = $request->getParam('date');
|
|
if (strlen($date)!=8) {
|
|
echo "Erreur format date";
|
|
}
|
|
$name = 'ST-'.$siren.'-'.$date;
|
|
$path.= '/actes';
|
|
}
|
|
|
|
$n = $_FILES['fichier']['name'];
|
|
$s = $_FILES['fichier']['size'];
|
|
$tmp_name = $_FILES['fichier']['tmp_name'];
|
|
|
|
$extValide = array('pdf');
|
|
$extension = strrchr($n,'.');
|
|
$extension = strtolower(substr($extension,1));
|
|
//Vérifier l'extension du fichier
|
|
if( !in_array($extension, $extValide) ){
|
|
echo "Extension de fichier incorrect !";
|
|
} elseif ( move_uploaded_file($tmp_name, $path.'/'.$name.'.'.$extension) ){
|
|
|
|
$result = true;
|
|
//Send info to webservice
|
|
if ( $type='acte' ) {
|
|
$ws = new WsScores();
|
|
$info = $ws->setActeAsso($siren, $waldec, 'ST', 'Statut', $date);
|
|
if (is_string($info)) {
|
|
$result = false;
|
|
}
|
|
}
|
|
|
|
//Display message
|
|
if ($result) {
|
|
echo "Fichier envoyé, <a target=\"_blank\" href=\"".$this->view->url(array(
|
|
'controller' => 'fichier',
|
|
'action' => 'pdfassociation',
|
|
'file' => $name.'.'.$extension,
|
|
), null , true)."\">Cliquez pour voir le fichier</a>";
|
|
}
|
|
|
|
} else {
|
|
echo "Erreur lors du déplacement du fichier !";
|
|
}
|
|
}
|
|
//Affichage formulaire
|
|
} else {
|
|
|
|
$this->view->inlineScript()->appendFile('/libs/form/jquery.form.js');
|
|
if ( intval($siren)==0 ) {
|
|
$session = new SessionEntreprise();
|
|
$siren = '';
|
|
if ( substr($session->AutreId,0,1)=='W' ) {
|
|
$siren = $session->AutreId;
|
|
}
|
|
}
|
|
$this->view->assign('siren', $siren);
|
|
$this->view->assign('type', $type);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
public function liasseAction()
|
|
{
|
|
$request = $this->getRequest();
|
|
|
|
$siret = $request->getParam('siret');
|
|
$id = $request->getParam('id');
|
|
|
|
$siren = substr($siret,0,9);
|
|
$this->view->assign('siren', $siren);
|
|
|
|
$session = new SessionEntreprise($siret, $id);
|
|
$this->view->assign('siret', $siret);
|
|
$this->view->assign('raisonSociale', $session->getRaisonSociale());
|
|
|
|
require_once 'Scores/WsScores.php';
|
|
$ws = new WsScores();
|
|
|
|
$selection = $request->getParam('selection', '');
|
|
|
|
if ( !empty($selection) ) {
|
|
list($date, $type) = explode(':', $selection);
|
|
if ($date!='NEW') {
|
|
$response = $ws->getBilan($siren, $date, $type, true);
|
|
$infos = new stdClass();
|
|
$infos->siren = $response->siren;
|
|
$infos->dateCloture = $response->DATE_CLOTURE;
|
|
$infos->dateCloturePre = $response->DATE_CLOTURE_PRE;
|
|
$infos->dureeMois = $response->DUREE_MOIS;
|
|
$infos->dureeMoisPre = $response->DUREE_MOIS_PRE;
|
|
$infos->unite = empty($response->MONNAIE_LIV_UNITE) ? 'U' : $response->MONNAIE_LIV_UNITE;
|
|
|
|
$postes = array();
|
|
foreach ($response->POSTES->item as $item) {
|
|
$postes[$item->id] = $item->val;
|
|
}
|
|
Zend_Registry::get('firebug')->info($postes);
|
|
} else {
|
|
$infos = 'NEW';
|
|
}
|
|
}
|
|
|
|
$ancres = array(
|
|
'C' => array(
|
|
'actif' => 'Actif',
|
|
'passif' => 'Passif',
|
|
'compteDeResultat' => 'Compte de résultat',
|
|
//+ Poste YP pour l'effectif du groupe
|
|
),
|
|
'N' => array(
|
|
'actif' => 'Actif',
|
|
'passif' => 'Passif',
|
|
'compteDeResultat' => 'Compte de résultat',
|
|
'immobilisations' => 'Immobilisations',
|
|
'amortissements' => 'Amortissements',
|
|
'provisions' => 'Provisions',
|
|
'creancesDettes' => 'Créances, Dettes',
|
|
'resultatfiscal' => 'Détermination du résultat fiscal',
|
|
'deficit' => 'DÉFICITS, INDEMNITÉS POUR CONGÉS À PAYER ET PROVISIONS NON DÉDUCTIBLES',
|
|
'affectation' => 'Affectation',
|
|
'annexe16' => 'DÉTERMINATION DE LA VALEUR AJOUTÉE PRODUITE AU COURS DE L\'EXERCICE',
|
|
),
|
|
'S' => array(
|
|
'actif' => 'Actif',
|
|
'passif' => 'Passif',
|
|
'compteDeResultat' => 'Compte de résultat',
|
|
'immobilisations' => 'Immobilisations',
|
|
'amortissements' => 'Amortissements',
|
|
'provisions' => 'Provisions',
|
|
'creancesDettes' => 'Créances, Dettes',
|
|
'affectation' => 'Affectation'
|
|
),
|
|
'A' => array(
|
|
'actif' => 'Actif',
|
|
'passif' => 'Passif',
|
|
'compteDeResultat' => 'Compte de résultat',
|
|
),
|
|
'B' => array(
|
|
'actif' => 'Actif',
|
|
'passif' => 'Passif',
|
|
'compteDeResultat' => 'Compte de résultat',
|
|
),
|
|
);
|
|
|
|
if (!empty($infos)) {
|
|
//Default value
|
|
if ( is_string($infos) && $infos == 'NEW' ) {
|
|
$dateCloture = (date('Y')-1).'1231';
|
|
$dureeMois = '12';
|
|
$dateCloturePre = 'AAAAMMJJ';
|
|
$dureeMoisPre = '0';
|
|
$unite = 'U';
|
|
} else {
|
|
$dateCloture = $infos->dateCloture;
|
|
$dureeMois = $infos->dureeMois;
|
|
$dateCloturePre = empty($infos->dateCloturePre) ? 'AAAAMMJJ' : $infos->dateCloturePre ;
|
|
$dureeMoisPre = empty($infos->dureeMoisPre) ? '0' : $infos->dureeMoisPre;
|
|
$unite = $infos->unite;
|
|
$this->view->assign('liasse', $postes);
|
|
}
|
|
|
|
//Formattage date
|
|
$dateCloture = substr($dateCloture,6,2).'/'.substr($dateCloture,4,2).'/'.substr($dateCloture,0,4);
|
|
$dateCloturePre = substr($dateCloturePre,6,2).'/'.substr($dateCloturePre,4,2).'/'.substr($dateCloturePre,0,4);
|
|
|
|
$this->view->assign('dateCloture', $dateCloture);
|
|
$this->view->assign('dateCloturePre', $dateCloturePre);
|
|
$this->view->assign('dureeMois', $dureeMois);
|
|
$this->view->assign('dureeMoisPre', $dureeMoisPre);
|
|
$this->view->assign('unite', $unite);
|
|
$this->view->assign('typeBilan', $type);
|
|
|
|
$this->view->assign('ancres', $ancres[$type]);
|
|
$this->view->inlineScript()->appendFile('/libs/editable/jquery.jeditable.js');
|
|
$this->view->assign('infos', $infos);
|
|
}
|
|
|
|
|
|
}
|
|
|
|
/**
|
|
* Sauvegarde de la liasse saisie
|
|
*/
|
|
public function liassesaveAction()
|
|
{
|
|
$this->_helper->layout()->disableLayout();
|
|
//Renvoyer flux json STATUS : OK ou ERR, MESSAGE : TEXTE, POSTE : ARRAY ou vide
|
|
|
|
$request = $this->getRequest();
|
|
$params = $request->getParams();
|
|
|
|
$dateCloture = substr($params['dateCloture'],6,4).
|
|
substr($params['dateCloture'],3,2).
|
|
substr($params['dateCloture'],0,2);
|
|
$dateCloturePre = substr($params['dateCloturePre'],6,4).
|
|
substr($params['dateCloturePre'],3,2).
|
|
substr($params['dateCloturePre'],0,2);
|
|
|
|
$ws = new WsScores();
|
|
$response = $ws->setBilan(
|
|
$params['siren'],
|
|
$params['unite'],
|
|
$dateCloture,
|
|
$params['dureeMois'],
|
|
$dateCloturePre,
|
|
$params['dureeMoisPre'],
|
|
$params['typeBilan'],
|
|
$params['postes'],
|
|
$params['step']
|
|
);
|
|
|
|
Zend_Registry::get('firebug')->info($response);
|
|
|
|
if (is_int($response)) {
|
|
$this->view->assign('result', array('status'=>'OK'));
|
|
} else {
|
|
if ( preg_match_all('/([A-Z0-9]{2,});?/', $response, $postes) ) {
|
|
Zend_Registry::get('firebug')->info($postes[1]);
|
|
$this->view->assign('result', array(
|
|
'status'=>'ERR',
|
|
'message'=>'Erreur valeur',
|
|
'postes' => $postes[1],
|
|
));
|
|
} else {
|
|
$this->view->assign('result', array(
|
|
'status'=>'ERR',
|
|
'message'=>$response,
|
|
'postes'=>array(),
|
|
));
|
|
}
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Affichage du formulaire pour les liens
|
|
*/
|
|
public function lienAction()
|
|
{
|
|
$this->_helper->layout()->disableLayout();
|
|
$request = $this->getRequest();
|
|
$siren = $request->getParam('siren', null);
|
|
$mode = $request->getParam('mode');
|
|
$type = $request->getParam('type');
|
|
$idLien = $request->getParam('idLien', null);
|
|
$lienRef = $request->getParam('lienref', null);
|
|
$createFiche = $request->getParam('createfiche', null);
|
|
|
|
$ws = new WsScores();
|
|
|
|
Zend_Registry::get('firebug')->info('createfiche:'.$createFiche);
|
|
|
|
$id2 = null;
|
|
|
|
if ($createFiche) {
|
|
//Get identite
|
|
$result = $ws->getIdentiteLight($createFiche);
|
|
//Compute informations
|
|
$infos = array(
|
|
'siren' => $result->Siren,
|
|
'actif' => 1,
|
|
'PpPm' => 'PM',
|
|
'RS' => $result->Nom,
|
|
'civilite' => '',
|
|
'nom' => '',
|
|
'prenom' => '',
|
|
'nom_usage' => '',
|
|
'naissance_date' => '',
|
|
'naissance_dept_pays' => '',
|
|
'naissance_lieu' => '',
|
|
'nat' => '',
|
|
'adresse_num' => $result->AdresseNum,
|
|
'adresse_btq' => $result->AdresseBtq,
|
|
'adresse_codvoie' => $result->AdresseVoie,
|
|
'adresse_libvoie' => $result->AdresseRue,
|
|
'adresse_comp' => '',
|
|
'adresse_cp' => $result->CP,
|
|
'adresse_ville' => $result->Ville,
|
|
'adresse_pays' => 'FRA',
|
|
'dateSaisie' => date('YmdHis'),
|
|
'capital' => $result->CapitalDev,
|
|
'deviseCapital' => $result->CapitalDev,
|
|
'nbActions' => '',
|
|
'idLoc1Type' => '',
|
|
'idLoc1Num' => '',
|
|
'idLoc2Type' => '',
|
|
'idLoc2Num' => '',
|
|
'idLoc3Type' => '',
|
|
'idLoc3Num' => '',
|
|
);
|
|
$id2 = $ws->setLienRef(json_encode($infos));
|
|
if (is_int($id2)) {
|
|
Zend_Registry::get('firebug')->info('id2:'.$id2);
|
|
$this->view->assign('id2', $id2);
|
|
$this->view->assign('id2Nom', $result->Nom);
|
|
}
|
|
}
|
|
|
|
if ( $lienRef && $siren !== null ) {
|
|
$result = $ws->getLienRef($lienRef);
|
|
$rs = $result->RS;
|
|
if ( intval($result->siren)!=0 ) {
|
|
$siren = $result->siren;
|
|
$session = new SessionEntreprise($siren);
|
|
}
|
|
|
|
} else {
|
|
$session = new SessionEntreprise($siren);
|
|
$rs = $session->getRaisonSociale();
|
|
}
|
|
|
|
$detention = array(
|
|
'+' => 'Major.',
|
|
'-' => 'Minor.',
|
|
'C' => 'Contrôle',
|
|
'S' => 'Scission',
|
|
'F' => 'Fusion',
|
|
'P' => 'Projet de fusion',
|
|
'T' => 'TUP',
|
|
'L' => 'Tutelle',
|
|
'E' => 'Franchise',
|
|
);
|
|
$this->view->assign('detention', $detention);
|
|
|
|
//Mode = delete
|
|
/*
|
|
id du lien pour récupérer les informations
|
|
- rs1, siren1, rs2, siren2
|
|
*/
|
|
if ($mode == 'delete') {
|
|
|
|
$result = $ws->getSaisieLien($idLien);
|
|
$infos = json_decode($result, true);
|
|
|
|
Zend_Registry::get('firebug')->info($infos);
|
|
|
|
if ($type=='actionnaire') {
|
|
$this->view->assign('id1', $infos['idPar']);
|
|
$this->view->assign('id2', $infos['idAct']);
|
|
$idFiche = $infos['idAct'];
|
|
} elseif ($type=='participation') {
|
|
$this->view->assign('id2', $infos['idPar']);
|
|
$this->view->assign('id1', $infos['idAct']);
|
|
$idFiche = $infos['idPar'];
|
|
}
|
|
|
|
if ($idFiche) {
|
|
$result = $ws->getLienRef($idFiche);
|
|
if ($result->raisonSociale!='') {
|
|
$this->view->assign('rs2', $result->raisonSociale);
|
|
} else {
|
|
$this->view->assign('rs2', $result->nom);
|
|
}
|
|
$this->view->assign('siren2', $result->siren);
|
|
}
|
|
|
|
$this->view->assign('PDetention', $infos['PDetention']);
|
|
$this->view->assign('Pvote', $infos['Pvote']);
|
|
$this->view->assign('MajMin', $infos['MajMin']);
|
|
$this->view->assign('dateEffetLien', WDate::dateT('Y-m-d', 'd/m/Y', $infos['dateEffetLien']));
|
|
|
|
}
|
|
//Mode = edit / add
|
|
/*
|
|
id du lien pour récupérer les informations
|
|
- siren, rs actuel
|
|
- Liste des documents de référence
|
|
- Liste des types d'identifiant par pays sdv1.tabIdLocal
|
|
*/
|
|
elseif ($mode == 'edit') {
|
|
|
|
$result = $ws->getSaisieLien($idLien);
|
|
$infos = json_decode($result, true);
|
|
|
|
Zend_Registry::get('firebug')->info($infos);
|
|
|
|
if ($type=='actionnaire') {
|
|
$this->view->assign('id1', $infos['idPar']);
|
|
$this->view->assign('id2', $infos['idAct']);
|
|
} elseif ($type=='participation') {
|
|
$this->view->assign('id2', $infos['idPar']);
|
|
$this->view->assign('id1', $infos['idAct']);
|
|
}
|
|
|
|
$this->view->assign('PDetention', $infos['PDetention']);
|
|
$this->view->assign('Pvote', $infos['Pvote']);
|
|
$this->view->assign('MajMin', $infos['MajMin']);
|
|
$this->view->assign('dateEffetLien', WDate::dateT('Y-m-d', 'd/m/Y', $infos['dateEffetLien']));
|
|
|
|
} else {
|
|
|
|
$date = $request->getParam('date');
|
|
|
|
if ($date) {
|
|
$this->view->assign('dateEffetLien', substr($date,8,2).'/'.substr($date,5,2).'/'.substr($date,0,4));
|
|
}
|
|
|
|
if ( $lienRef ) {
|
|
$this->view->assign('id1', $lienRef);
|
|
} else {
|
|
//Création de la première référence lien
|
|
$infos = array(
|
|
'siren' => $siren,
|
|
'actif' => 1,
|
|
'PpPm' => 'PM',
|
|
'RS' => $rs,
|
|
'civilite' => '',
|
|
'nom' => '',
|
|
'prenom' => '',
|
|
'nom_usage' => '',
|
|
'naissance_date' => '',
|
|
'naissance_dept_pays' => '',
|
|
'naissance_lieu' => '',
|
|
'nat' => '',
|
|
'adresse_num' => '',
|
|
'adresse_btq' => '',
|
|
'adresse_codvoie' => '',
|
|
'adresse_libvoie' => '',
|
|
'adresse_comp' => '',
|
|
'adresse_cp' => '',
|
|
'adresse_ville' => '',
|
|
'adresse_pays' => '',
|
|
'dateSaisie' => date('YmdHis'),
|
|
'capital' => '',
|
|
'deviseCapital' => 'EUR',
|
|
'nbActions' => '',
|
|
'idLoc1Type' => '',
|
|
'idLoc1Num' => '',
|
|
'idLoc2Type' => '',
|
|
'idLoc2Num' => '',
|
|
'idLoc3Type' => '',
|
|
'idLoc3Num' => '',
|
|
);
|
|
$idNewLien = $ws->setLienRef(json_encode($infos));
|
|
Zend_Registry::get('firebug')->info('idNewLien:'.$idNewLien);
|
|
if (is_int($idNewLien)) {
|
|
$this->view->assign('id1', $idNewLien);
|
|
}
|
|
}
|
|
|
|
$this->view->assign('countries', $this->countries);
|
|
}
|
|
|
|
//Affichage
|
|
$this->view->assign('rs', $rs);
|
|
$this->view->assign('siren', $siren);
|
|
$this->view->assign('mode', $mode);
|
|
$this->view->assign('type', $type);
|
|
$this->view->assign('idLien', $idLien);
|
|
|
|
}
|
|
|
|
public function liensearchAction()
|
|
{
|
|
$this->_helper->layout()->disableLayout();
|
|
$query = $this->getRequest()->getParam('q');
|
|
$type = $this->getRequest()->getParam('type', null);
|
|
|
|
//Some transformation
|
|
if ( $type == 'siren' || $type == 'id' ) {
|
|
$query = str_replace(array(' ','.','-',','), array('','','',''), $query);
|
|
}
|
|
|
|
$ws = new WsScores();
|
|
$result = $ws->searchLienRef($query, $type);
|
|
Zend_Registry::get('firebug')->info($result);
|
|
$output = array();
|
|
if (count($result->item)>0) {
|
|
foreach ($result->item as $item) {
|
|
$output[] = array(
|
|
'value' => $item->id,
|
|
'label' => $item->lib,
|
|
);
|
|
}
|
|
}
|
|
$this->view->assign('output', $output);
|
|
}
|
|
|
|
|
|
/**
|
|
* Gestion des liens étrangers
|
|
*/
|
|
public function lienetrangerAction()
|
|
{
|
|
$request = $this->getRequest();
|
|
$mode = $request->getParam('mode', null);
|
|
$this->view->assign('mode', $mode);
|
|
|
|
Zend_Registry::get('firebug')->info($mode);
|
|
|
|
if ($mode === null) {
|
|
$this->_helper->layout()->disableLayout();
|
|
}
|
|
|
|
$this->view->assign('currencies', $this->currencies);
|
|
$this->view->assign('countries', $this->countries);
|
|
$this->view->assign('type', $this->getRequest()->getParam('type'));
|
|
}
|
|
|
|
/**
|
|
* Gestion des liens étrangers
|
|
*/
|
|
public function lienppAction()
|
|
{
|
|
$this->_helper->layout()->disableLayout();
|
|
$this->view->assign('countries', $this->countries);
|
|
}
|
|
|
|
|
|
public function lienrefsaveAction()
|
|
{
|
|
$this->_helper->layout()->disableLayout();
|
|
$params = $this->getRequest()->getParams();
|
|
|
|
//Construct reference informations
|
|
|
|
$params['PpPm'] = 'PM';
|
|
|
|
//Check params
|
|
if ( empty($params['nom'])
|
|
|| $params['pp']==1 && empty($params['prenom'])
|
|
|| empty($params['adresse_pays'])
|
|
|| empty($params['adresse_ville']) ) {
|
|
|
|
$this->view->assign('error', 'Champs non saisi !');
|
|
|
|
} else {
|
|
|
|
//Personne Physique
|
|
if ($params['pp']==1) {
|
|
//Fill data
|
|
$params['PpPm'] = 'PP';
|
|
$params['RS'] = $params['civilite'].' '.$params['nom'].' '.$params['prenom'].' '.$params['nom_usage'];
|
|
//Personne Morale
|
|
} elseif (!empty($params['siren'])) {
|
|
//Fill data
|
|
$params['RS'] = $params['nom'];
|
|
$params['civilite'] = '';
|
|
$params['nom'] = '';
|
|
$params['prenom'] = '';
|
|
$params['nom_usage'] = '';
|
|
$params['naissance_date'] = '';
|
|
$params['naissance_dept_pays'] = '';
|
|
$params['naissance_lieu'] = '';
|
|
$params['nat'] = '';
|
|
} else {
|
|
//Fill data
|
|
$params['siren'] = '000000000';
|
|
$params['RS'] = $params['nom'];
|
|
$params['civilite'] = '';
|
|
$params['nom'] = '';
|
|
$params['prenom'] = '';
|
|
$params['nom_usage'] = '';
|
|
$params['naissance_date'] = '';
|
|
$params['naissance_dept_pays'] = '';
|
|
$params['naissance_lieu'] = '';
|
|
$params['nat'] = '';
|
|
}
|
|
|
|
$infos = array(
|
|
'siren' => $params['siren'],
|
|
'actif' => 1,
|
|
'PpPm' => $params['PpPm'],
|
|
'RS' => strtoupper(trim($params['RS'])),
|
|
'civilite' => $params['civilite'],
|
|
'nom' => strtoupper(trim($params['nom'])),
|
|
'prenom' => ucfirst(trim($params['prenom'])),
|
|
'nom_usage' => strtoupper(trim($params['nom_usage'])),
|
|
'naissance_date' => empty($params['naissance_date']) ? '' : WDate::dateT('d/m/Y','Ymd',$params['naissance_date']),
|
|
'naissance_dept_pays' => $params['naissance_dept_pays'],
|
|
'naissance_lieu' => $params['naissance_lieu'],
|
|
'nat' => $params['nat'],
|
|
'adresse_num' => empty($params['adresse_num']) ? '' : trim($params['adresse_num']),
|
|
'adresse_btq' => empty($params['adresse_btq']) ? '' : trim($params['adresse_btq']),
|
|
'adresse_codvoie' => empty($params['adresse_codvoie']) ? '' : strtoupper(trim($params['adresse_codvoie'])),
|
|
'adresse_libvoie' => empty($params['adresse_libvoie']) ? '' : strtoupper(trim($params['adresse_libvoie'])),
|
|
'adresse_comp' => empty($params['adresse_comp']) ? '' : strtoupper(trim($params['adresse_comp'])),
|
|
'adresse_cp' => empty($params['adresse_cp']) ? '' : trim($params['adresse_cp']),
|
|
'adresse_ville' => empty($params['adresse_ville']) ? '' : trim($params['adresse_ville']),
|
|
'adresse_pays' => empty($params['adresse_pays']) ? '' : trim($params['adresse_pays']),
|
|
'tel' => empty($params['tel']) ? '' : trim($params['tel']),
|
|
'fax' => empty($params['fax']) ? '' : trim($params['fax']),
|
|
'web' => empty($params['web']) ? '' : trim($params['web']),
|
|
'email' => empty($params['email']) ? '' : trim($params['email']),
|
|
'dateSaisie' => date('YmdHis'),
|
|
'capital' => empty($params['capital']) ? '' : trim($params['capital']),
|
|
'deviseCapital' => empty($params['deviseCapital']) ? 'EUR' : $params['deviseCapital'],
|
|
'dateCapital' => empty($params['dateCapital']) ? '' : WDate::dateT('d/m/Y', 'Ymd', $params['dateCapital']),
|
|
'nbActions' => empty($params['nbActions']) ? '' : $params['nbActions'],
|
|
'idLoc1Type' => $params['idLoc1Type'],
|
|
'idLoc1Num' => trim($params['idLoc1Num']),
|
|
'idLoc2Type' => $params['idLoc2Type'],
|
|
'idLoc2Num' => trim($params['idLoc2Num']),
|
|
'idLoc3Type' => $params['idLoc3Type'],
|
|
'idLoc3Num' => trim($params['idLoc3Num']),
|
|
'bilMillesime' => $params['bilMillesime'],
|
|
'bilDev' => empty($params['bilDev']) ? 'EUR' : $params['bilDev'],
|
|
'bilFL' => $params['bilFL'],
|
|
'bilHN' => $params['bilHN'],
|
|
'bilFPr' => $params['bilFPr'],
|
|
'bilEE' => $params['bilEE'],
|
|
);
|
|
|
|
Zend_Registry::get('firebug')->info($params);
|
|
|
|
$ws = new WsScores();
|
|
$idNewLien = $ws->setLienRef(json_encode($infos), $params['idLien']);
|
|
$this->view->assign('idNewLien', $idNewLien);
|
|
$rs = empty($infos['RS']) ? $infos['nom'] : $infos['RS'];
|
|
$this->view->assign('RS', $rs);
|
|
$this->view->assign('error', '');
|
|
if (!is_int($idNewLien) || $idNewLien==0){
|
|
$this->view->assign('error', $idNewLien);
|
|
}
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Sauvegarde
|
|
*/
|
|
public function liensaveAction()
|
|
{
|
|
$this->_helper->layout()->disableLayout();
|
|
|
|
$params = $this->getRequest()->getParams();
|
|
|
|
if ($params['mode']=='delete') {
|
|
$infos = array(
|
|
'actif' => 0,
|
|
'dateEffetLien' => empty($params['dateEffetLien']) ? date('Ymd') : WDate::dateT('d/m/Y', 'Ymd', $params['dateEffetLien']),
|
|
'motifUpdate' => empty($params['motifUpdate']) ? '' : $params['motifUpdate'],
|
|
);
|
|
} else {
|
|
|
|
if ($params['type']=='actionnaire') {
|
|
$idAct = $params['id2'];
|
|
$idPar = $params['id1'];
|
|
} elseif ($params['type']=='participation') {
|
|
$idPar = $params['id2'];
|
|
$idAct = $params['id1'];
|
|
}
|
|
|
|
$infos = array(
|
|
'idAct' => $idAct,
|
|
'actif' => 1,
|
|
'PDetention' => $params['PDetention'],
|
|
'Pvote' => ($params['Pvote']=='') ? null : $params['Pvote'],
|
|
'MajMin' => $params['MajMin'],
|
|
'idPar' => $idPar,
|
|
'dateEffetLien' => empty($params['dateEffetLien']) ? date('Ymd') : WDate::dateT('d/m/Y', 'Ymd', $params['dateEffetLien']),
|
|
'motifUpdate' => empty($params['motifUpdate']) ? '' : $params['motifUpdate'],
|
|
);
|
|
}
|
|
Zend_Registry::get('firebug')->info($infos);
|
|
|
|
$ws = new WsScores();
|
|
$idNewLien = $ws->setLien(json_encode($infos), $params['idLien']);
|
|
|
|
if (!is_int($idNewLien)){
|
|
$this->view->assign('error', $idNewLien);
|
|
} else {
|
|
$this->view->assign('id', $idNewLien);
|
|
$this->view->assign('mode', $params['mode']);
|
|
}
|
|
}
|
|
|
|
public function liendocAction()
|
|
{
|
|
$this->_helper->layout()->disableLayout();
|
|
$request = $this->getRequest();
|
|
|
|
$mode = $request->getParam('mode');
|
|
if ($mode == 'delete') {
|
|
$this->view->assign('mode', $mode);
|
|
$id = $request->getParam('id');
|
|
$this->view->assign('idNum', $id);
|
|
|
|
//Get Infos
|
|
$ws = new WsScores();
|
|
$docs = $ws->getLienDoc($id);
|
|
if (count($docs->item)==1) {
|
|
$this->view->assign('doc', $docs->item[0]);
|
|
}
|
|
|
|
} else {
|
|
$siren = $request->getParam('siren', null);
|
|
$idLien = $request->getParam('idLien', null);
|
|
$type = $request->getParam('type', null);
|
|
$this->view->assign('idType', $type);
|
|
|
|
if ($siren===null) {
|
|
$this->view->assign('idNum', $idLien);
|
|
} else {
|
|
$ws = new WsScores();
|
|
$identite = $ws->getIdentite($siren);
|
|
$infos = array(
|
|
'siren' => $siren,
|
|
'actif' => 1,
|
|
'PpPm' => 'PP',
|
|
'RS' => $identite->Nom,
|
|
'civilite' => '',
|
|
'nom' => '',
|
|
'prenom' => '',
|
|
'nom_usage' => '',
|
|
'naissance_date' => '',
|
|
'naissance_dept_pays' => '',
|
|
'naissance_lieu' => '',
|
|
'nat' => '',
|
|
'adresse_num' => $identite->AdresseNum,
|
|
'adresse_btq' => $identite->AdresseBtq,
|
|
'adresse_codvoie' => $identite->AdresseVoie,
|
|
'adresse_libvoie' => $idenite->AdresseRue,
|
|
'adresse_comp' => $identite->Adresse2,
|
|
'adresse_cp' => $identite->CP,
|
|
'adresse_ville' => $identite->Ville,
|
|
'adresse_pays' => 'FRA',
|
|
'dateSaisie' => date('YmdHis'),
|
|
'capital' => $identite->Bilan->Capital,
|
|
'deviseCapital' => 'EUR',
|
|
'dateCapital' => empty($identite->Bilan->Cloture) ? '' :
|
|
WDate::dateT('Ymd','d/m/Y',$identite->Bilan->Cloture),
|
|
'nbActions' => '',
|
|
'idLoc1Type' => '',
|
|
'idLoc1Num' => '',
|
|
'idLoc2Type' => '',
|
|
'idLoc2Num' => '',
|
|
'idLoc3Type' => '',
|
|
'idLoc3Num' => '',
|
|
'bilMillesime' => $identite->Bilan->Millesime,
|
|
'bilDev' => 'EUR',
|
|
'bilFL' => $identite->Bilan->CA,
|
|
'bilHN' => $identite->Bilan->Resultat,
|
|
'bilFPr' => '',
|
|
'bilEE' => '',
|
|
);
|
|
$idNum = $ws->setLienRef(json_encode($infos));
|
|
$this->view->assign('idNum', $idNum);
|
|
}
|
|
}
|
|
}
|
|
|
|
public function liendocsaveAction()
|
|
{
|
|
$this->_helper->layout()->disableLayout();
|
|
$this->_helper->viewRenderer->setNoRender(true);
|
|
|
|
$request = $this->getRequest();
|
|
$params = $request->getParams();
|
|
|
|
if (empty($params['idNum'])) {
|
|
echo "Erreur";
|
|
}
|
|
//
|
|
elseif ($params['mode']=='delete') {
|
|
$ws = new WsScores();
|
|
$result = $ws->setLienDoc(json_encode(array()), $params['idNum']);
|
|
if ($result) {
|
|
echo "Fichier supprimé";
|
|
} else {
|
|
echo "Erreur lors de la suppression";
|
|
}
|
|
}
|
|
//Téléchargement du fichier
|
|
elseif ( isset($_FILES) && count($_FILES)==1 )
|
|
{
|
|
$c = Zend_Registry::get('config');
|
|
$path = realpath($c->profil->path->data).'/groupes';
|
|
|
|
if (!file_exists($path)) { mkdir($path); }
|
|
|
|
$date = WDate::dateT('d/m/Y', 'Ymd', $params['fileDate']);
|
|
$name = 'INTERNE-'.$params['idNum'].'-'.$params['fileType'].'-'.$date;
|
|
|
|
$n = $_FILES['fichier']['name'];
|
|
$s = $_FILES['fichier']['size'];
|
|
$tmp_name = $_FILES['fichier']['tmp_name'];
|
|
|
|
$extValide = array('pdf');
|
|
$extension = strrchr($n,'.');
|
|
$extension = substr($extension,1);
|
|
//Vérifier l'extension du fichier
|
|
if( !in_array($extension, $extValide) ){
|
|
echo "Extension de fichier incorrect !";
|
|
} elseif ( move_uploaded_file($tmp_name, $path.'/'.$name.'.'.$extension) ){
|
|
|
|
$result = false;
|
|
//Send info to webservice
|
|
$infos = array(
|
|
'idType' => $params['idType'],
|
|
'idNum' => $params['idNum'],
|
|
'periDoc' => $params['periDoc'],
|
|
'docRef' => $name,
|
|
'dateDocRef' => $date,
|
|
);
|
|
|
|
$ws = new WsScores();
|
|
$result = $ws->setLienDoc(json_encode($infos));
|
|
//Display message
|
|
if ($result) {
|
|
echo "Fichier envoyé";
|
|
} else {
|
|
//Delete file
|
|
unlink($path.'/'.$name.'.'.$extension);
|
|
echo "Erreur lors de l'enregistrement des informations !";
|
|
}
|
|
} else {
|
|
echo "Erreur lors du déplacement du fichier !";
|
|
}
|
|
}
|
|
//Greffe
|
|
else {
|
|
echo "Greffe";
|
|
}
|
|
}
|
|
|
|
public function countryidAction()
|
|
{
|
|
$this->_helper->layout()->disableLayout();
|
|
$request = $this->getRequest();
|
|
$code = $request->getParam('code');
|
|
$ws = new WsScores();
|
|
$result = $ws->getCountryId($code);
|
|
$this->view->assign('identifiant', $result->item);
|
|
}
|
|
|
|
public function bourseAction()
|
|
{
|
|
$request = $this->getRequest();
|
|
$siret = $request->getParam('siret');
|
|
$id = $request->getParam('id', 0);
|
|
|
|
$this->view->headTitle()->append('Saisie - '.$siret);
|
|
|
|
$session = new SessionEntreprise($siret, $id);
|
|
$isin = $session->getIsin();
|
|
|
|
$ws = new WsScores();
|
|
$result = $ws->getSaisieBourse($isin);
|
|
$infos = json_decode($result, true);
|
|
if ( $infos === null ) {
|
|
$this->view->assign('error', $result);
|
|
} else {
|
|
foreach ( $infos as $key => $val ) {
|
|
$this->view->assign($key, $val);
|
|
}
|
|
}
|
|
|
|
$this->view->assign('raisonSociale', $session->getRaisonSociale());
|
|
$this->view->assign('siren', $session->getSiren());
|
|
}
|
|
|
|
public function boursesaveAction()
|
|
{
|
|
|
|
|
|
}
|
|
|
|
public function lienidentiteAction()
|
|
{
|
|
$this->_helper->layout()->disableLayout();
|
|
$request = $this->getRequest();
|
|
|
|
$this->view->assign('type', $request->getParam('type'));
|
|
|
|
$siren = $request->getParam('siren');
|
|
|
|
$ws = new WsScores();
|
|
$result = $ws->getIdentite($siren);
|
|
|
|
Zend_Registry::get('firebug')->info($result);
|
|
|
|
$this->view->assign('nom',$result->Nom);
|
|
$this->view->assign('adresse_num',$result->AdresseNum);
|
|
$this->view->assign('adresse_btq',$result->AdresseBtq);
|
|
$this->view->assign('adresse_codvoie',$result->AdresseVoie);
|
|
$this->view->assign('adresse_libvoie',$result->AdresseRue);
|
|
$this->view->assign('adresse_comp',$result->Adresse2);
|
|
$this->view->assign('adresse_cp',$result->CP);
|
|
$this->view->assign('adresse_ville',$result->Ville);
|
|
|
|
$this->view->assign('tel',$result->Tel);
|
|
$this->view->assign('fax',$result->Fax);
|
|
$this->view->assign('web',$result->Web);
|
|
$this->view->assign('mail',$result->Mail);
|
|
$this->view->assign('cj',$result->FJ);
|
|
$this->view->assign('ape',$result->NafEnt);
|
|
$this->view->assign('capital',$result->Bilan->Capital);
|
|
$this->view->assign('deviseCapital', 'EUR');
|
|
$this->view->assign('dateCapital', Wdate::dateT('Ymd','d/m/Y',$result->Bilan->Cloture));
|
|
$this->view->assign('bilDev', 'EUR');
|
|
$this->view->assign('bilMillesime', $result->Bilan->Millesime);
|
|
$this->view->assign('bilFL', $result->Bilan->CA);
|
|
$this->view->assign('bilHN', $result->Bilan->Resultat);
|
|
|
|
$this->view->assign('currencies', $this->currencies);
|
|
|
|
//Special legal form, go to other display
|
|
if ( ($result->FJ>=1000 && $result->FJ<=1999) || ($result->FJ>=10 && $result->FJ<=19) ) {
|
|
$this->view->assign('countries', $this->countries);
|
|
$this->renderScript('saisie/lienpp.phtml');
|
|
}
|
|
|
|
}
|
|
|
|
public function lienficheAction()
|
|
{
|
|
$this->_helper->layout()->disableLayout();
|
|
$request = $this->getRequest();
|
|
$id = $request->getParam('idFiche', null);
|
|
|
|
$ws = new WsScores();
|
|
|
|
if ($id===null) {
|
|
$siren = $request->getParam('siren');
|
|
$result = $ws->searchLienRef($siren, 'siren');
|
|
if (count($result->item)>0) {
|
|
foreach ($result->item as $item) {
|
|
$id = $item->id;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
$this->view->assign('edit', $id);
|
|
|
|
$this->view->assign('currencies', $this->currencies);
|
|
$this->view->assign('countries', $this->countries);
|
|
|
|
$result = $ws->getSaisieLienRef($id);
|
|
$items = json_decode($result, true);
|
|
|
|
//Get country code
|
|
if ($items->adresse_pays!='FRA') {
|
|
$result = $ws->getCountryId($items['adresse_pays']);
|
|
$this->view->assign('identifiant', $result->item);
|
|
}
|
|
|
|
Zend_Registry::get('firebug')->info($items);
|
|
|
|
if (count($items)>0) {
|
|
foreach( $items as $key => $val ) {
|
|
switch ($key) {
|
|
case 'dateCapital':
|
|
case 'dateNbActions':
|
|
case 'naissance_date':
|
|
if (!empty($val) && $val!='0000-00-00')
|
|
$this->view->assign($key, WDate::dateT('Y-m-d', 'd/m/Y', $val));
|
|
break;
|
|
default:
|
|
$this->view->assign($key, $val);
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
if ($items['PpPm']=='PM') {
|
|
$this->view->assign('nom', $items['RS']);
|
|
} else {
|
|
$this->view->assign('nom', $items['nom']);
|
|
}
|
|
}
|
|
|
|
public function lienchangeAction()
|
|
{
|
|
$this->_helper->layout()->disableLayout();
|
|
$request = $this->getRequest();
|
|
|
|
$mode = $request->getParam('mode');
|
|
$this->view->assign('mode', $mode);
|
|
|
|
$lienref = $request->getParam('lienref');
|
|
$this->view->assign('lienref', $lienref);
|
|
|
|
$ws = new WsScores();
|
|
|
|
//Save data
|
|
if ( $request->isPost() ){
|
|
$idLien = $request->getParam('idLien');
|
|
$id = $request->getParam('id');
|
|
$result = $ws->setLienChange($mode, $idLien, $id);
|
|
if (true === $result) {
|
|
$this->view->assign('message', 'Déplacement effectué.');
|
|
} else {
|
|
$this->view->assign('message', 'Erreur : '.$result);
|
|
}
|
|
|
|
} else {
|
|
|
|
$this->view->assign('countries', $this->countries);
|
|
|
|
//Obtain LienRef
|
|
$result = $ws->getSaisieLienRef($lienref);
|
|
$infos = json_decode($result,true);
|
|
|
|
if ($infos['PpPm']=='PM') {
|
|
$this->view->assign('nom', $infos['RS']);
|
|
} else {
|
|
$this->view->assign('nom', $infos['nom'].' '.$infos['prenom']);
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
public function scorecutoffAction()
|
|
{
|
|
$request = $this->getRequest();
|
|
$siren = $request->getParam('siren');
|
|
$this->view->assign('siren', $siren);
|
|
|
|
if ( $request->isXmlHttpRequest() ) {
|
|
$this->_helper->layout()->disableLayout();
|
|
if ( $request->isPost() ) {
|
|
$paramlist = array(
|
|
'siren' => '',
|
|
'encours' => array('min'=>0, 'max'=>500000),
|
|
'scoreSolv' => array('min'=>0, 'max'=>100),
|
|
'scoreDir' => array('min'=>0, 'max'=>100),
|
|
'scoreConf' => array('min'=>0, 'max'=>100),
|
|
'remarque' => '',
|
|
);
|
|
$message = '';
|
|
$params = $request->getParams();
|
|
foreach ($paramlist as $item => $val) {
|
|
if (!isset($params[$item])) {
|
|
$message = "Valeur $item vide !";
|
|
break;
|
|
}
|
|
if (is_array($val)) {
|
|
if(intval($params[$item])<$val['min'] || intval($params[$item]>$val['max'])) {
|
|
$message = "$item : Erreur borne";
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
if( empty($message)) {
|
|
//Enregistrer le formulaire
|
|
$ws = new WsScores();
|
|
$message = $ws->setScoreCutoff($params['siren'], $params['encours'], $params['scoreSolv'], $params['scoreDir'], $params['scoreConf'], $params['remarque']);
|
|
|
|
}
|
|
$this->view->assign('message', $message);
|
|
|
|
}
|
|
|
|
} else {
|
|
$this->view->assign('name', "Définir un Cut-off");
|
|
$this->view->assign('href', $this->view->url(array('controller'=>'saisie','action'=>'scorecutoff','siren'=>$siren)));
|
|
}
|
|
}
|
|
|
|
} |