diff --git a/htdocs/compta/stats/cabyuser.php b/htdocs/compta/stats/cabyuser.php index 7ac8e58ea93..20c8dbcc709 100644 --- a/htdocs/compta/stats/cabyuser.php +++ b/htdocs/compta/stats/cabyuser.php @@ -40,16 +40,20 @@ $sortfield=isset($_GET["sortfield"])?$_GET["sortfield"]:$_POST["sortfield"]; if (! $sortorder) $sortorder="asc"; if (! $sortfield) $sortfield="name"; -// Sécurité accés client +// Security check if ($user->societe_id > 0) $socid = $user->societe_id; +/* + * View + */ + llxHeader(); $html=new Form($db); -// Affiche en-tête du rapport +// Affiche en-t�te du rapport if ($modecompta=="CREANCES-DETTES") { $nom=$langs->trans("SalesTurnover").', '.$langs->trans("ByUserAuthorOfInvoice"); @@ -85,7 +89,7 @@ else { /* * Liste des paiements (les anciens paiements ne sont pas vus par cette requete car, sur les - * vieilles versions, ils n'étaient pas liés via paiement_facture. On les ajoute plus loin) + * vieilles versions, ils n'�taient pas li�s via paiement_facture. On les ajoute plus loin) */ $sql = "SELECT u.rowid as rowid, u.name as name, u.firstname as firstname, sum(pf.amount) as amount_ttc"; $sql .= " FROM ".MAIN_DB_PREFIX."user as u" ; @@ -117,7 +121,7 @@ else { dolibarr_print_error($db); } -// On ajoute les paiements anciennes version, non liés par paiement_facture +// On ajoute les paiements anciennes version, non lies par paiement_facture if ($modecompta != 'CREANCES-DETTES') { $sql = "SELECT -1 as rowid, '' as name, '' as firstname, sum(p.amount) as amount_ttc"; @@ -154,7 +158,7 @@ print ""; print_liste_field_titre($langs->trans("User"),$_SERVER["PHP_SELF"],"name","",'&year='.($year).'&modecompta='.$modecompta,"",$sortfield,$sortorder); print_liste_field_titre($langs->trans("AmountTTC"),$_SERVER["PHP_SELF"],"amount_ttc","",'&year='.($year).'&modecompta='.$modecompta,'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Percentage"),$_SERVER["PHP_SELF"],"amount_ttc","",'&year='.($year).'&modecompta='.$modecompta,'align="right"',$sortfield,$sortorder); -print_liste_field_titre($langs->trans("OrderStats"),$_SERVER["PHP_SELF"],"","","",'align="center" width="20%"'); +if ($conf->global->MAIN_FEATURES_LEVEL == 2) print_liste_field_titre($langs->trans("OrderStats"),$_SERVER["PHP_SELF"],"","","",'align="center" width="20%"'); print "\n"; $var=true; @@ -162,7 +166,7 @@ if (sizeof($amount)) { $arrayforsort=$name; - // On définit tableau arrayforsort + // We define arrayforsort if ($sortfield == 'name' && $sortorder == 'asc') { asort($name); $arrayforsort=$name; @@ -180,7 +184,7 @@ if (sizeof($amount)) $arrayforsort=$amount; } - foreach($arrayforsort as $key=>$value) + foreach($arrayforsort as $key => $value) { $var=!$var; print ""; @@ -190,23 +194,27 @@ if (sizeof($amount)) $linkname=''.img_object($langs->trans("ShowUser"),'user').' '.$fullname.''; } else { - $linkname=$langs->trans("Paiements liés à aucune facture"); + $linkname=$langs->trans("PaymentsLinkedToNoUsers"); } print "".$linkname."\n"; print ''.price($amount[$key]).''; print ''.($catotal > 0 ? round(100 * $amount[$key] / $catotal,2).'%' : ' ').''; - if($key>0){ - print ''.img_picto($langs->trans("Show"),"vcard").''; - } else { - print '   ' ; + if ($conf->global->MAIN_FEATURES_LEVEL == 2) + { + if($key>0){ + print ''.img_picto($langs->trans("Show"),"vcard").''; + } else { + print '   ' ; + } } - print "\n"; $i++; } // Total - print ''.$langs->trans("Total").''.price($catotal).' '; + print ''.$langs->trans("Total").''.price($catotal).' '; + if ($conf->global->MAIN_FEATURES_LEVEL == 2) print ' '; + print ''; $db->free($result); } diff --git a/htdocs/compta/stats/comm.php b/htdocs/compta/stats/comm.php index 592bc548777..c7020702b87 100644 --- a/htdocs/compta/stats/comm.php +++ b/htdocs/compta/stats/comm.php @@ -30,20 +30,23 @@ require_once(DOL_DOCUMENT_ROOT."/core/dolgraph.class.php"); if (!$user->rights->compta->resultat->lire) accessforbidden(); + +/* + * View + */ + llxHeader('',"Stats"); -if($_GET['id']!=""){ - /************** - * Paramètrage - *************/ - // Utilisateur à partir duquel il faut générer les stats +if($_GET['id']!="") +{ + // Utilisateur a partir duquel il faut generer les stats $userstats = new User($db,$_GET['id']) ; $userstats->fetch() ; - // Dossier où générer les fichiers + // Dossier ou generer les fichiers $dir = $conf->commercial->dir_temp . '/' .$userstats->id ; - if(!is_dir($dir)) mkdir($dir,0777,true) ; + create_exdir($dir); // graphes $graphwidth = 380 ; @@ -53,21 +56,21 @@ if($_GET['id']!=""){ // Chaine contenant les messages d'erreur $msq = '' ; - // Date de début du graphe + // Date de d�but du graphe $date_debut = time() ; $annees = "" ; if ($conf->global->SOCIETE_FISCAL_MONTH_START < dolibarr_date("m",time()) ){ - // Si le mois actuel est plus grand, l'année de départ est là même que l'année actuelle + // Si le mois actuel est plus grand, l'ann�e de d�part est l� m�me que l'ann�e actuelle $date_debut = mktime(0,0,0,$conf->global->SOCIETE_FISCAL_MONTH_START,1,dolibarr_date("Y",time())) ; $annees = dolibarr_date("Y",time()) ; } else { - // Sinon le début de l'année comptable était l'année d'avant + // Sinon le d�but de l'ann�e comptable �tait l'ann�e d'avant $date_debut = mktime(0,0,0,$conf->global->SOCIETE_FISCAL_MONTH_START,1,dolibarr_date("Y",time())-1) ; $annees = (dolibarr_date("Y",time())-1).' - '.(dolibarr_date("Y",time())) ; } /********************************************** - * Récupération et génération des Infomations + * R�cup�ration et g�n�ration des Infomations **********************************************/ $sql = "SELECT sum(d.qty * d.price) as CAMois, sum( d.qty * (d.price - p.price_min) ) as MRMois, date_format(c.date_valid, '%Y%m') as date, date_format(c.date_valid, '%b') as month"; $sql .= " FROM ".MAIN_DB_PREFIX."commandedet as d, ".MAIN_DB_PREFIX."commande as c, ".MAIN_DB_PREFIX."product as p"; @@ -78,7 +81,7 @@ if($_GET['id']!=""){ $result = $db->query($sql) ; - // On Récupère tout à la fois + // On R�cup�re tout � la fois $recapAnneeCA = array() ; $recapMoisCA = array() ; $recapAnneeMR = array() ; @@ -95,10 +98,10 @@ if($_GET['id']!=""){ } } } else { - $mesg = 'Aucun enregistrement retourné pour '.$user->login.'
' ; + $mesg = 'Aucun enregistrement retourne pour '.$user->login.'
' ; } } else { - $mesg = 'erreur sql : '.$db->error().'
requète : '.$db->lastquery().'
' ; + $mesg = 'erreur sql : '.$db->error().'
requete : '.$db->lastquery().'
' ; } $graphfiles=array( @@ -163,7 +166,7 @@ if($_GET['id']!=""){ /************ * Affichage ************/ - // en-tête + // en-t�te if($mesg) print '
'.$mesg.'
' ; dolibarr_fiche_head(array(array('stats.php',$langs->trans("Commercial"))), 0, $langs->trans("Stats")); /***************************** @@ -188,7 +191,7 @@ if($_GET['id']!=""){ ***************************/ //tableaux foreach($graphfiles as $graph){ - // données + // donn�es $url=DOL_URL_ROOT.'/viewimage.php?modulepart=graph_comm&file='.urlencode($userstats->id .'/'.$graph['file']); $generateOn = (file_exists($dir."/".$graph['file']))? $langs->trans("GeneratedOn",dolibarr_print_date(filemtime($dir."/".$graph['file']),"dayhour")) : "" ;