From: vincent@cubedesigners.com Date: Tue, 2 Dec 2014 09:00:27 +0000 (+0000) Subject: (no commit message) X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=fa9154c899c6990f5848e4e12cb33ea6e2036ba8;p=cubeextranet.git --- diff --git a/inc/commons/class.common.core.php b/inc/commons/class.common.core.php index 0b80db141..0ce34e21a 100644 --- a/inc/commons/class.common.core.php +++ b/inc/commons/class.common.core.php @@ -44,6 +44,7 @@ class commonCore extends cubeCore { 2 => __('Payée'), 3 => __('Annulée'), 4 => __('Avoir'), 5 => __('Impayée')); $this->books_status = array(-1 => __('Brouillon'), 0 => __('Prêt'), 1 => __('Téléchargé'), 2 => __('Facturé')); $this->agences = array('Paris', 'Montpellier'); + $this->client_type=array(0=>__('Non défini'),1=>__('TPE'),2=>__('Startup'),3=>__('PME'),4=>__('Agence'),5=>__('Grande entreprise')); $this->demandes_type = array(0 => __('Non défini'), 1 => __('Catalogue'), 2 => __('Magazine / Presse'), @@ -169,6 +170,7 @@ class commonCore extends cubeCore { $db->entreprises->date_creation('integer', 0, false); $db->entreprises->notes('text', 0, false); $db->entreprises->site('varchar', 256, false); + $db->entreprises->type('integer',0,false); $db->entreprises->ws_signatures('text', 0, false); // Clés $db->entreprises->primary('pk_entreprises', 'entreprise_id'); @@ -548,7 +550,7 @@ class commonCore extends cubeCore { . 'LEFT JOIN utilisateurs ur ON e.ws_admin=ur.utilisateur_id ' . 'LEFT JOIN entreprises r ON ur.entreprise=r.entreprise_id ' . 'LEFT JOIN utilisateurs a ON ri.administrateur_id=a.utilisateur_id '); - $this->views->createView('clients_entreprise', 'SELECT u.*,e.nom AS rs, e.adresse_facturation AS adresse_facturation, e.site AS site ' + $this->views->createView('clients_entreprise', 'SELECT u.*,e.nom AS rs, e.adresse_facturation AS adresse_facturation, e.site AS site, e.type AS type ' . 'FROM entreprises e LEFT JOIN utilisateurs u ON u.entreprise=e.entreprise_id AND u.grade=0'); $this->views->createView('utilisateurs_entreprise', 'SELECT u.*,e.nom AS rs, e.adresse_facturation AS adresse_facturation, ' . 'e.ws_grade, e.ws_admin, e.ws_signatures AS ws_signatures, e.site AS site ' @@ -564,9 +566,15 @@ class commonCore extends cubeCore { . 'LEFT JOIN taches_books tb ON tb.tache=taches.tache_id ' . 'GROUP BY taches.tache_id'); $this->views->createView('taches_projet', 'SELECT projet, ' - . 'SUM(jours_prevus) AS jours_prevus,SUM(budget) AS budget,' + . 'SUM(jours_prevus) AS jours_prevus,SUM(budget) AS budget, ' . 'SUM(jours_consommes) AS jours_consommes, (SUM(jours_consommes)/SUM(jours_prevus))*100 AS progression ' . 'FROM taches_vue GROUP BY projet'); + + $this->views->createView('taches_projet_hf', 'SELECT projet, ' + . 'SUM(jours_prevus) AS jours_prevus,SUM(budget) AS budget, ' + . 'SUM(jours_consommes) AS jours_consommes, (SUM(jours_consommes)/SUM(jours_prevus))*100 AS progression ' + . 'FROM taches_vue WHERE categorie!=8 GROUP BY projet'); + $this->views->createView('devis_vue', 'SELECT devis.devis_id,devis.nom,devis.lignes,devis.status,devis.total_ht,devis.date_creation,devis.email,clients.utilisateur_id AS client_id,clients.rs AS client,equipiers.prenom AS createur,equipiers.utilisateur_id AS createur_id,devis.adresse ' . 'FROM devis,clients,equipiers ' . 'WHERE devis.client=clients.utilisateur_id AND devis.createur=equipiers.utilisateur_id'); @@ -586,12 +594,22 @@ class commonCore extends cubeCore { . 'FROM projets_inter p ' . 'LEFT JOIN projets_facturation f ON f.projet=p.projet_id ' . 'LEFT JOIN taches_projet t ON p.projet_id=t.projet'); + + $this->views->createView('projets_vue_hf', 'SELECT p.*,f.montant_facture,f.montant_paye, ' + . 't.jours_prevus,t.jours_consommes,t.progression,t.budget AS budget, ' + . 'IF(t.budget>0,f.montant_paye/t.budget,1) AS rapport_paiement, ' + . 'IF(t.budget>0,f.montant_facture/t.budget,1) AS rapport_facturation ' + . 'FROM projets_inter p ' + . 'LEFT JOIN projets_facturation f ON f.projet=p.projet_id ' + . 'LEFT JOIN taches_projet_hf t ON p.projet_id=t.projet'); + $this->views->createView('factures_vue', 'SELECT factures.facture_id,factures.nom,factures.lignes,factures.status,factures.total_ht,factures.date_creation,factures.texte_complementaire,factures.informations_paiement,factures.date_paiement,factures.adresse,factures.avoir,' . 'projets.projet_id AS projet_id,projets.nom AS projet,clients.utilisateur_id AS client_id,clients.rs as client,equipiers.prenom AS createur,equipiers.utilisateur_id AS createur_id ' . 'FROM factures,projets,equipiers,clients ' . 'WHERE factures.projet=projets.projet_id AND clients.utilisateur_id=projets.client AND factures.createur=equipiers.utilisateur_id AND (factures.facture_id>=0 OR factures.status=1) '); $this->views->createView('projets_timereport', 'SELECT * FROM projets_vue WHERE status=0'); $this->views->createView('order_timereport', 'SELECT utilisateur_id,projet AS projet_id,MAX(date) AS derniere_activite FROM timereport,taches,projets WHERE taches.tache_id=timereport.tache_id AND taches.projet=projets.projet_id AND projets.status=0 GROUP BY utilisateur_id,taches.projet ORDER BY utilisateur_id ASC,MAX(date) DESC'); + $this->views->createView('catype', 'SELECT SUM(total_ht) AS ca, YEAR(FROM_UNIXTIME(date_creation)) annee FROM factures_vue WHERE status BETWEEN 1 AND 4 GROUP BY annee'); $this->views->createView('ca', 'SELECT SUM(total_ht) AS ca, YEAR(FROM_UNIXTIME(date_creation)) annee FROM factures WHERE status BETWEEN 1 AND 4 GROUP BY annee'); $this->views->createView('cai', 'SELECT SUM(total_ht) AS ca, YEAR(FROM_UNIXTIME(date_creation)) annee FROM factures WHERE status = 5 GROUP BY annee'); $this->views->createView('cam', 'SELECT SUM(total_ht) AS ca, DATE_FORMAT(FROM_UNIXTIME(date_creation),\'%Y-%m\') mois FROM factures WHERE status BETWEEN 1 AND 4 GROUP BY mois'); @@ -607,6 +625,7 @@ class commonCore extends cubeCore { . 'FROM projets_vue p, taches_vue t ' . 'WHERE t.projet=p.projet_id ' . 'GROUP BY t.categorie,p.annee_fin'); + $this->views->createView('temps_categories', 'SELECT p.annee_fin AS annee, t.categorie, SUM(t.jours_consommes) AS jours_consommes,SUM(t.jours_prevus) AS jours_prevus ' . 'FROM projets_vue p, taches_vue t ' . 'WHERE t.projet=p.projet_id ' @@ -638,6 +657,18 @@ class commonCore extends cubeCore { . 'LEFT JOIN utilisateurs_entreprise r ON d.revendeur=r.utilisateur_id ' . 'LEFT JOIN utilisateurs_entreprise c ON d.utilisateur=c.utilisateur_id ' . 'LEFT JOIN utilisateurs a ON d.administrateur=a.utilisateur_id'); + + $this->views->createView('chiffres_types','SELECT p.annee_fin AS annee, e.type, SUM(p.budget) AS ca ' + .'FROM projets_vue p, clients_entreprise e ' + .'WHERE p.client_id=e.utilisateur_id ' + .'GROUP BY e.type, p.annee_fin'); + + $this->views->createView('chiffres_types_hf','SELECT p.annee_fin AS annee, e.type, SUM(p.budget) AS ca ' + .'FROM projets_vue_hf p, clients_entreprise e ' + .'WHERE p.client_id=e.utilisateur_id ' + .'GROUP BY e.type, p.annee_fin'); + + //cubeDb::mysqlConvert($this->con, 'UTF8', 'utf8_general_ci', 'MYISAM'); touch($cache); } @@ -666,6 +697,4 @@ class commonCore extends cubeCore { require_once(dirname(__FILE__) . '/../ws/DAO/_common.php'); } -} - -?> \ No newline at end of file +} \ No newline at end of file diff --git a/inc/commons/class.common.tools.php b/inc/commons/class.common.tools.php index 32be77ce8..9a8322365 100644 --- a/inc/commons/class.common.tools.php +++ b/inc/commons/class.common.tools.php @@ -1030,50 +1030,58 @@ class commonTools { exit; } - public static function cg_sommaire_fr() { - $flux = array('@Capgemini', - '@capgeminifrance', - '@CapgeminiConsul'); - } + public static function chiffres() { + global $core; + $datas_types = array(); + $datas_entreprises = array(); - public static function cg_sommaire_en() { - $flux = array('@Capgemini', - '@CapgeminiConsul'); - } + $dao = new commonDAOClient($core->con); + $clients = $dao->getListe(); - public static function cg_expertises() { - $flux = array('#advice', - '#advices', - '#apps', - '#bigdata', - '#bpo', - '#business', - '#cloud', - '#collaborators', - '#conference', - '#consulting', - '#digital', - '#euriware', - '#infographics', - '#infra', - '#innovation', - '#IS', - '#IT', - '#labinnovation', - '#mobile', - '#new', - '#outsourcing', - '#partners', - '#RT', - '#show', - '#shows', - '#systems', - '#technovision', - '#testing'); - } + $dao = new commonDAOEntreprise($core->con); + $entreprises = $dao->getListe(); - public static function cg_strategies() { + $dao = new extranetDAOFacture($core->con); + $factures = $dao->getListe('date_creation', 'ASC'); + foreach ($factures as $f) { + if ($f->status < 1 || $f->status > 2) { + continue; + } + $client = $clients[$f->client_id]; + $entreprise = $entreprises[$client->entreprise]; + $annee = date('Y', $f->date_creation); + + if (!isset($datas_types[$entreprise->type])) { + $datas_types[$entreprise->type] = array(); + } + if (!isset($datas_types[$entreprise->type][$annee])) { + $datas_types[$entreprise->type][$annee] = 0; + } + $datas_types[$entreprise->type][$annee]+=$f->total_ht; + sort($datas_types); + + $csv = fopen(ROOT . '/types.csv', 'wb'); + $range = array_merge(array(''), range(2006, date('Y'))); + fputcsv($csv, $range, ';'); + foreach ($datas_types as $type => $annees) { + $line = array($type); + foreach ($annees as $a => $m) { + $c = $a - 2005; + $line[$c] = $m; + } + fputcsv($csv, $line, ';'); + } + fclose($csv); + + if (!isset($datas_entreprises[$entreprise->nom])) { + $datas_entreprises[$entreprise->nom] = array(); + } + if (!isset($datas_entreprises[$entreprise->nom][$annee])) { + $datas_entreprises[$entreprise->nom][$annee] = 0; + } + $datas_entreprises[$entreprise->nom][$annee]+=$f->total_ht; + } } } diff --git a/inc/ws/Util/class.ws.tools.php b/inc/ws/Util/class.ws.tools.php index 3e0c41663..3e0f47e60 100644 --- a/inc/ws/Util/class.ws.tools.php +++ b/inc/ws/Util/class.ws.tools.php @@ -9,7 +9,6 @@ class wsTools { $videos = array('mp4', 'webm', 'ogv', 'jpg'); - if (is_string($format)) { if ($format == 'none') { $format = array(); @@ -20,7 +19,6 @@ class wsTools { } } - if (!$force) { $format = array(); } @@ -28,16 +26,13 @@ class wsTools { $base = $dir . '/' . cubeFiles::getName($file); $log = $base . '.log'; - foreach ($videos as $v) { $vfile = $base . '.' . $v; - fb($vfile); if (!file_exists($vfile)) { $force = true; } else if (filemtime($file) > filemtime($vfile) || in_array($v, $format)) { $force = true; unlink($vfile); - fb('unlink'); } } @@ -53,8 +48,6 @@ class wsTools { $webvideo->setArg(null, $file); $webvideo->setArg(null, $dir); $webvideo->execute(); - fb($webvideo->commande); - fb($webvideo->output); } public static function colorizeAndRasterizeIcon($iconSet, $icon, $colors, $dest, $scale, &$w, &$h, $makepng = true) { @@ -88,10 +81,7 @@ class wsTools { if (!file_exists($dirColorized)) { mkdir($dirColorized, 0777, true); } - - // SVG - if (!file_exists($svgColorized) || filemtime($svgColorized) <= filemtime($svgRef)) { $svg = file_get_contents($svgRef); // Colorize it @@ -150,4 +140,8 @@ class wsTools { touch($dest, filemtime($source)); } + public function chiffres() { + + } + } diff --git a/swf/robots.txt b/swf/robots.txt new file mode 100644 index 000000000..d476dd830 --- /dev/null +++ b/swf/robots.txt @@ -0,0 +1,2 @@ +User-Agent: * +Allow: / \ No newline at end of file