]> _ Git - cubeextranet.git/commitdiff
(no commit message)
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Tue, 2 Dec 2014 09:00:27 +0000 (09:00 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Tue, 2 Dec 2014 09:00:27 +0000 (09:00 +0000)
inc/commons/class.common.core.php
inc/commons/class.common.tools.php
inc/ws/Util/class.ws.tools.php
swf/robots.txt [new file with mode: 0644]

index 0b80db14199a5c7d7f4426795fc8c778c61155a5..0ce34e21a4cc425aa0e316210142b0572fef07bb 100644 (file)
@@ -44,6 +44,7 @@ class commonCore extends cubeCore {
                        2 => __('Payée'), 3 => __('Annulée'), 4 => __('Avoir'), 5 => __('Impayée'));\r
                $this->books_status = array(-1 => __('Brouillon'), 0 => __('Prêt'), 1 => __('Téléchargé'), 2 => __('Facturé'));\r
                $this->agences = array('Paris', 'Montpellier');\r
+               $this->client_type=array(0=>__('Non défini'),1=>__('TPE'),2=>__('Startup'),3=>__('PME'),4=>__('Agence'),5=>__('Grande entreprise'));\r
                $this->demandes_type = array(0 => __('Non défini'),\r
                        1 => __('Catalogue'),\r
                        2 => __('Magazine / Presse'),\r
@@ -169,6 +170,7 @@ class commonCore extends cubeCore {
                $db->entreprises->date_creation('integer', 0, false);\r
                $db->entreprises->notes('text', 0, false);\r
                $db->entreprises->site('varchar', 256, false);\r
+               $db->entreprises->type('integer',0,false);\r
                $db->entreprises->ws_signatures('text', 0, false);\r
                // Clés\r
                $db->entreprises->primary('pk_entreprises', 'entreprise_id');\r
@@ -548,7 +550,7 @@ class commonCore extends cubeCore {
                                . 'LEFT JOIN utilisateurs ur ON e.ws_admin=ur.utilisateur_id '\r
                                . 'LEFT JOIN entreprises r ON ur.entreprise=r.entreprise_id '\r
                                . 'LEFT JOIN utilisateurs a ON ri.administrateur_id=a.utilisateur_id ');\r
-               $this->views->createView('clients_entreprise', 'SELECT u.*,e.nom AS rs, e.adresse_facturation AS adresse_facturation, e.site AS site '\r
+               $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 '\r
                                . 'FROM entreprises e LEFT JOIN utilisateurs u ON u.entreprise=e.entreprise_id AND u.grade=0');\r
                $this->views->createView('utilisateurs_entreprise', 'SELECT u.*,e.nom AS rs, e.adresse_facturation AS adresse_facturation, '\r
                                . 'e.ws_grade, e.ws_admin, e.ws_signatures AS ws_signatures, e.site AS site '\r
@@ -564,9 +566,15 @@ class commonCore extends cubeCore {
                                . 'LEFT JOIN taches_books tb ON tb.tache=taches.tache_id '\r
                                . 'GROUP BY taches.tache_id');\r
                $this->views->createView('taches_projet', 'SELECT projet, '\r
-                               . 'SUM(jours_prevus) AS jours_prevus,SUM(budget) AS budget,'\r
+                               . 'SUM(jours_prevus) AS jours_prevus,SUM(budget) AS budget, '\r
                                . 'SUM(jours_consommes) AS jours_consommes, (SUM(jours_consommes)/SUM(jours_prevus))*100 AS progression '\r
                                . 'FROM taches_vue GROUP BY projet');\r
+                               \r
+                               $this->views->createView('taches_projet_hf', 'SELECT projet, '\r
+                               . 'SUM(jours_prevus) AS jours_prevus,SUM(budget) AS budget, '\r
+                               . 'SUM(jours_consommes) AS jours_consommes, (SUM(jours_consommes)/SUM(jours_prevus))*100 AS progression '\r
+                               . 'FROM taches_vue WHERE categorie!=8 GROUP BY projet');\r
+                               \r
                $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 '\r
                                . 'FROM devis,clients,equipiers '\r
                                . 'WHERE devis.client=clients.utilisateur_id AND devis.createur=equipiers.utilisateur_id');\r
@@ -586,12 +594,22 @@ class commonCore extends cubeCore {
                                . 'FROM projets_inter p '\r
                                . 'LEFT JOIN projets_facturation f ON  f.projet=p.projet_id '\r
                                . 'LEFT JOIN taches_projet t ON p.projet_id=t.projet');\r
+                               \r
+       $this->views->createView('projets_vue_hf', 'SELECT p.*,f.montant_facture,f.montant_paye, '\r
+                               . 't.jours_prevus,t.jours_consommes,t.progression,t.budget AS budget, '\r
+                               . 'IF(t.budget>0,f.montant_paye/t.budget,1) AS rapport_paiement, '\r
+                               . 'IF(t.budget>0,f.montant_facture/t.budget,1) AS rapport_facturation '\r
+                               . 'FROM projets_inter p '\r
+                               . 'LEFT JOIN projets_facturation f ON  f.projet=p.projet_id '\r
+                               . 'LEFT JOIN taches_projet_hf t ON p.projet_id=t.projet');\r
+                               \r
                $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,'\r
                                . '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 '\r
                                . 'FROM factures,projets,equipiers,clients '\r
                                . '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)  ');\r
                $this->views->createView('projets_timereport', 'SELECT * FROM projets_vue WHERE status=0');\r
                $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');\r
+               $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');\r
                $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');\r
                $this->views->createView('cai', 'SELECT SUM(total_ht) AS ca, YEAR(FROM_UNIXTIME(date_creation)) annee FROM factures WHERE status = 5 GROUP BY annee');\r
                $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');\r
@@ -607,6 +625,7 @@ class commonCore extends cubeCore {
                                . 'FROM projets_vue p, taches_vue t '\r
                                . 'WHERE t.projet=p.projet_id '\r
                                . 'GROUP BY t.categorie,p.annee_fin');\r
+\r
                $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 '\r
                                . 'FROM projets_vue p, taches_vue t '\r
                                . 'WHERE t.projet=p.projet_id '\r
@@ -638,6 +657,18 @@ class commonCore extends cubeCore {
                                . 'LEFT JOIN utilisateurs_entreprise r ON d.revendeur=r.utilisateur_id '\r
                                . 'LEFT JOIN utilisateurs_entreprise c ON d.utilisateur=c.utilisateur_id '\r
                                . 'LEFT JOIN utilisateurs a ON d.administrateur=a.utilisateur_id');\r
+                               \r
+               $this->views->createView('chiffres_types','SELECT p.annee_fin AS annee, e.type, SUM(p.budget) AS ca '\r
+                               .'FROM projets_vue p, clients_entreprise e '\r
+                               .'WHERE p.client_id=e.utilisateur_id '\r
+                               .'GROUP BY e.type, p.annee_fin');\r
+                               \r
+               $this->views->createView('chiffres_types_hf','SELECT p.annee_fin AS annee, e.type, SUM(p.budget) AS ca '\r
+                               .'FROM projets_vue_hf p, clients_entreprise e '\r
+                               .'WHERE p.client_id=e.utilisateur_id '\r
+                               .'GROUP BY e.type, p.annee_fin');\r
+                               \r
+                               \r
                //cubeDb::mysqlConvert($this->con, 'UTF8', 'utf8_general_ci', 'MYISAM');\r
                touch($cache);\r
        }\r
@@ -666,6 +697,4 @@ class commonCore extends cubeCore {
                require_once(dirname(__FILE__) . '/../ws/DAO/_common.php');\r
        }\r
 \r
-}\r
-\r
-?>
\ No newline at end of file
+}
\ No newline at end of file
index 32be77ce80e370ff57563c2188e9839d09bfb0ad..9a832236565a9d741e3e083f41a4f224bf5041ff 100644 (file)
@@ -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;
+               }
        }
 
 }
index 3e0c4166305de792a2cfcd5773c667b756036c6a..3e0f47e60d061b925bce97d28961446a121fba63 100644 (file)
@@ -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 (file)
index 0000000..d476dd8
--- /dev/null
@@ -0,0 +1,2 @@
+User-Agent: *\r
+Allow: /
\ No newline at end of file