Mark with level Development a not stable feature.
This commit is contained in:
parent
85cd391752
commit
d5ce66c5d8
@ -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<EFBFBD>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'<EFBFBD>taient pas li<EFBFBD>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 "<tr class=\"liste_titre\">";
|
||||
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 "</tr>\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 "<tr $bc[$var]>";
|
||||
@ -190,23 +194,27 @@ if (sizeof($amount))
|
||||
$linkname='<a href="'.DOL_URL_ROOT.'/user/fiche.php?id='.$key.'">'.img_object($langs->trans("ShowUser"),'user').' '.$fullname.'</a>';
|
||||
}
|
||||
else {
|
||||
$linkname=$langs->trans("Paiements liés à aucune facture");
|
||||
$linkname=$langs->trans("PaymentsLinkedToNoUsers");
|
||||
}
|
||||
print "<td>".$linkname."</td>\n";
|
||||
print '<td align="right">'.price($amount[$key]).'</td>';
|
||||
print '<td align="right">'.($catotal > 0 ? round(100 * $amount[$key] / $catotal,2).'%' : ' ').'</td>';
|
||||
if($key>0){
|
||||
print '<td align="center"><a href="comm.php?id='.$key.'">'.img_picto($langs->trans("Show"),"vcard").'</a></td>';
|
||||
} else {
|
||||
print '<td> </td>' ;
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL == 2)
|
||||
{
|
||||
if($key>0){
|
||||
print '<td align="center"><a href="comm.php?id='.$key.'">'.img_picto($langs->trans("Show"),"vcard").'</a></td>';
|
||||
} else {
|
||||
print '<td> </td>' ;
|
||||
}
|
||||
}
|
||||
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
|
||||
// Total
|
||||
print '<tr class="liste_total"><td>'.$langs->trans("Total").'</td><td align="right">'.price($catotal).'</td><td> </td></tr>';
|
||||
print '<tr class="liste_total"><td>'.$langs->trans("Total").'</td><td align="right">'.price($catotal).'</td><td> </td>';
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL == 2) print '<td> </td>';
|
||||
print '</tr>';
|
||||
|
||||
$db->free($result);
|
||||
}
|
||||
|
||||
@ -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<EFBFBD>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<EFBFBD>e de d<>part est l<> m<>me que l'ann<6E>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<EFBFBD>but de l'ann<6E>e comptable <20>tait l'ann<6E>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<EFBFBD>cup<EFBFBD>ration et g<EFBFBD>n<EFBFBD>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<EFBFBD>cup<EFBFBD>re tout <20> la fois
|
||||
$recapAnneeCA = array() ;
|
||||
$recapMoisCA = array() ;
|
||||
$recapAnneeMR = array() ;
|
||||
@ -95,10 +98,10 @@ if($_GET['id']!=""){
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$mesg = 'Aucun enregistrement retourné pour '.$user->login.'<br>' ;
|
||||
$mesg = 'Aucun enregistrement retourne pour '.$user->login.'<br>' ;
|
||||
}
|
||||
} else {
|
||||
$mesg = 'erreur sql : '.$db->error().'<br> requète : '.$db->lastquery().'<br>' ;
|
||||
$mesg = 'erreur sql : '.$db->error().'<br> requete : '.$db->lastquery().'<br>' ;
|
||||
}
|
||||
|
||||
$graphfiles=array(
|
||||
@ -163,7 +166,7 @@ if($_GET['id']!=""){
|
||||
/************
|
||||
* Affichage
|
||||
************/
|
||||
// en-tête
|
||||
// en-t<EFBFBD>te
|
||||
if($mesg) print '<div class="error">'.$mesg.'</div>' ;
|
||||
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<EFBFBD>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")) : "" ;
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user