New: Statistics support filtering on user.
This commit is contained in:
parent
b8574ef39d
commit
3b5bfd5ae0
@ -32,8 +32,8 @@ require_once(DOL_DOCUMENT_ROOT."/core/class/dolgraph.class.php");
|
||||
$WIDTH=500;
|
||||
$HEIGHT=200;
|
||||
|
||||
$userid=GETPOST('userid');
|
||||
$socid=GETPOST('socid');
|
||||
$userid=GETPOST('userid'); if ($userid < 0) $userid=0;
|
||||
$socid=GETPOST('socid'); if ($socid < 0) $socid=0;
|
||||
// Security check
|
||||
if ($user->societe_id > 0)
|
||||
{
|
||||
@ -50,6 +50,8 @@ $endyear=$year;
|
||||
* View
|
||||
*/
|
||||
|
||||
$form=new Form($db);
|
||||
|
||||
$langs->load("propal");
|
||||
|
||||
llxHeader();
|
||||
@ -152,6 +154,22 @@ if (! $mesg)
|
||||
print '<table class="notopnoleftnopadd" width="100%"><tr>';
|
||||
print '<td align="center" valign="top">';
|
||||
|
||||
// Show filter box
|
||||
print '<form name="stats" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
print '<table class="border" width="100%">';
|
||||
print '<tr><td class="liste_titre" colspan="2">'.$langs->trans("Filter").'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("ThirdParty").'</td><td>';
|
||||
$filter='s.client in (1,2,3)';
|
||||
print $form->select_company($socid,'socid',$filter,1);
|
||||
print '</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("User").'</td><td>';
|
||||
print $form->select_users($userid,'userid',1);
|
||||
print '</td></tr>';
|
||||
print '<tr><td align="center" colspan="2"><input type="submit" name="submit" class="button" value="'.$langs->trans("Refresh").'"></td></tr>';
|
||||
print '</table>';
|
||||
print '</form>';
|
||||
print '<br><br>';
|
||||
|
||||
// Show array
|
||||
$data = $stats->getAllByYear();
|
||||
|
||||
|
||||
@ -35,8 +35,7 @@ if (!$user->rights->commande->lire) accessforbidden();
|
||||
$langs->load("orders");
|
||||
|
||||
// Security check
|
||||
$socid='';
|
||||
if ($_GET["socid"]) { $socid=$_GET["socid"]; }
|
||||
$socid=GETPOST('socid');
|
||||
if ($user->societe_id > 0)
|
||||
{
|
||||
$action = '';
|
||||
|
||||
@ -32,13 +32,12 @@ require_once(DOL_DOCUMENT_ROOT."/core/class/dolgraph.class.php");
|
||||
$WIDTH=500;
|
||||
$HEIGHT=200;
|
||||
|
||||
$mode='customer';
|
||||
if (isset($_GET["mode"])) $mode=$_GET["mode"];
|
||||
$mode=GETPOST("mode")?GETPOST("mode"):'customer';
|
||||
if ($mode == 'customer' && ! $user->rights->commande->lire) accessforbidden();
|
||||
if ($mode == 'supplier' && ! $user->rights->fournisseur->commande->lire) accessforbidden();
|
||||
|
||||
$userid=GETPOST('userid');
|
||||
$socid=GETPOST('socid');
|
||||
$userid=GETPOST('userid'); if ($userid < 0) $userid=0;
|
||||
$socid=GETPOST('socid'); if ($socid < 0) $socid=0;
|
||||
// Security check
|
||||
if ($user->societe_id > 0)
|
||||
{
|
||||
@ -57,6 +56,8 @@ $langs->load("orders");
|
||||
* View
|
||||
*/
|
||||
|
||||
$form=new Form($db);
|
||||
|
||||
llxHeader();
|
||||
|
||||
if ($mode == 'customer')
|
||||
@ -168,6 +169,23 @@ if (! $mesg)
|
||||
print '<table class="notopnoleftnopadd" width="100%"><tr>';
|
||||
print '<td align="center" valign="top">';
|
||||
|
||||
// Show filter box
|
||||
print '<form name="stats" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
print '<table class="border" width="100%">';
|
||||
print '<tr><td class="liste_titre" colspan="2">'.$langs->trans("Filter").'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("ThirdParty").'</td><td>';
|
||||
if ($mode == 'customer') $filter='s.client in (1,2,3)';
|
||||
if ($mode == 'supplier') $filter='s.fournisseur = 1';
|
||||
print $form->select_company($socid,'socid',$filter,1);
|
||||
print '</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("User").'</td><td>';
|
||||
print $form->select_users($userid,'userid',1);
|
||||
print '</td></tr>';
|
||||
print '<tr><td align="center" colspan="2"><input type="submit" name="submit" class="button" value="'.$langs->trans("Refresh").'"></td></tr>';
|
||||
print '</table>';
|
||||
print '</form>';
|
||||
print '<br><br>';
|
||||
|
||||
// Show array
|
||||
$data = $stats->getAllByYear();
|
||||
|
||||
|
||||
@ -33,8 +33,8 @@ $langs->load("trips");
|
||||
$WIDTH=500;
|
||||
$HEIGHT=200;
|
||||
|
||||
$userid=GETPOST('userid');
|
||||
$socid=GETPOST('socid');
|
||||
$userid=GETPOST('userid'); if ($userid < 0) $userid=0;
|
||||
$socid=GETPOST('socid'); if ($socid < 0) $socid=0;
|
||||
// Securite acces client
|
||||
if ($user->societe_id > 0)
|
||||
{
|
||||
@ -46,14 +46,15 @@ $year = strftime("%Y", time());
|
||||
$startyear=$year-2;
|
||||
$endyear=$year;
|
||||
|
||||
$mode='customer';
|
||||
if (isset($_GET["mode"])) $mode=$_GET["mode"];
|
||||
$mode=GETPOST("mode")?GETPOST("mode"):'customer';
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$form=new Form($db);
|
||||
|
||||
llxHeader();
|
||||
|
||||
$title=$langs->trans("TripsAndExpensesStatistics");
|
||||
@ -140,6 +141,22 @@ if (! $mesg)
|
||||
print '<table class="notopnoleftnopadd" width="100%"><tr>';
|
||||
print '<td align="center" valign="top">';
|
||||
|
||||
// Show filter box
|
||||
print '<form name="stats" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
print '<table class="border" width="100%">';
|
||||
print '<tr><td class="liste_titre" colspan="2">'.$langs->trans("Filter").'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("ThirdParty").'</td><td>';
|
||||
$filter='';
|
||||
print $form->select_company($socid,'socid',$filter,1,1);
|
||||
print '</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("User").'</td><td>';
|
||||
print $form->select_users($userid,'userid',1);
|
||||
print '</td></tr>';
|
||||
print '<tr><td align="center" colspan="2"><input type="submit" name="submit" class="button" value="'.$langs->trans("Refresh").'"></td></tr>';
|
||||
print '</table>';
|
||||
print '</form>';
|
||||
print '<br><br>';
|
||||
|
||||
// Show array
|
||||
$data = $stats->getAllByYear();
|
||||
|
||||
|
||||
@ -31,8 +31,8 @@ require_once(DOL_DOCUMENT_ROOT."/compta/facture/class/facturestats.class.php");
|
||||
$WIDTH=500;
|
||||
$HEIGHT=200;
|
||||
|
||||
$userid=GETPOST('userid');
|
||||
$socid=GETPOST('socid');
|
||||
$userid=GETPOST('userid'); if ($userid < 0) $userid=0;
|
||||
$socid=GETPOST('socid'); if ($socid < 0) $socid=0;
|
||||
// Security check
|
||||
if ($user->societe_id > 0)
|
||||
{
|
||||
@ -44,14 +44,15 @@ $year = strftime("%Y", time());
|
||||
$startyear=$year-2;
|
||||
$endyear=$year;
|
||||
|
||||
$mode='customer';
|
||||
if (isset($_GET["mode"])) $mode=$_GET["mode"];
|
||||
$mode=GETPOST("mode")?GETPOST("mode"):'customer';
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$form=new Form($db);
|
||||
|
||||
llxHeader();
|
||||
|
||||
if ($mode == 'customer')
|
||||
@ -69,7 +70,7 @@ print_fiche_titre($title, $mesg);
|
||||
|
||||
create_exdir($dir);
|
||||
|
||||
$stats = new FactureStats($db, $socid, $mode, $userid);
|
||||
$stats = new FactureStats($db, $socid, $mode, ($userid>0?$userid:0));
|
||||
|
||||
|
||||
// Build graphic number of object
|
||||
@ -147,6 +148,23 @@ if (! $mesg)
|
||||
print '<table class="notopnoleftnopadd" width="100%"><tr>';
|
||||
print '<td align="center" valign="top">';
|
||||
|
||||
// Show filter box
|
||||
print '<form name="stats" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
print '<table class="border" width="100%">';
|
||||
print '<tr><td class="liste_titre" colspan="2">'.$langs->trans("Filter").'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("ThirdParty").'</td><td>';
|
||||
if ($mode == 'customer') $filter='s.client in (1,2,3)';
|
||||
if ($mode == 'supplier') $filter='s.fournisseur = 1';
|
||||
print $form->select_company($socid,'socid',$filter,1);
|
||||
print '</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("User").'</td><td>';
|
||||
print $form->select_users($userid,'userid',1);
|
||||
print '</td></tr>';
|
||||
print '<tr><td align="center" colspan="2"><input type="submit" name="submit" class="button" value="'.$langs->trans("Refresh").'"></td></tr>';
|
||||
print '</table>';
|
||||
print '</form>';
|
||||
print '<br><br>';
|
||||
|
||||
// Show array
|
||||
$data = $stats->getAllByYear();
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -221,7 +221,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);
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL == 2) print_liste_field_titre($langs->trans("OtherStatistics"),$_SERVER["PHP_SELF"],"","","",'align="center" width="20%"');
|
||||
print_liste_field_titre($langs->trans("OtherStatistics"),$_SERVER["PHP_SELF"],"","","",'align="center" width="20%"');
|
||||
print "</tr>\n";
|
||||
$var=true;
|
||||
|
||||
@ -281,14 +281,11 @@ if (sizeof($amount))
|
||||
print '<td align="right">'.($catotal > 0 ? round(100 * $amount[$key] / $catotal,2).'%' : ' ').'</td>';
|
||||
|
||||
// Other stats
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL == 2)
|
||||
{
|
||||
print '<td align="center">';
|
||||
if ($conf->commande->enabled && $key>0) print ' <a href="'.DOL_URL_ROOT.'/commande/stats/index.php?userid='.$key.'">'.img_picto($langs->trans("OrderStats"),"stats").'</a> ';
|
||||
if ($conf->facture->enabled && $key>0) print ' <a href="'.DOL_URL_ROOT.'/compta/facture/stats/index.php?userid='.$key.'">'.img_picto($langs->trans("InvoiceStats"),"stats").'</a> ';
|
||||
if ($conf->propal->enabled && $key>0) print ' <a href="'.DOL_URL_ROOT.'/comm/propal/stats/index.php?userid='.$key.'">'.img_picto($langs->trans("ProposalStats"),"stats").'</a> ';
|
||||
print '</td>';
|
||||
}
|
||||
print '<td align="center">';
|
||||
if ($conf->propal->enabled && $key>0) print ' <a href="'.DOL_URL_ROOT.'/comm/propal/stats/index.php?userid='.$key.'">'.img_picto($langs->trans("ProposalStats"),"stats").'</a> ';
|
||||
if ($conf->commande->enabled && $key>0) print ' <a href="'.DOL_URL_ROOT.'/commande/stats/index.php?userid='.$key.'">'.img_picto($langs->trans("OrderStats"),"stats").'</a> ';
|
||||
if ($conf->facture->enabled && $key>0) print ' <a href="'.DOL_URL_ROOT.'/compta/facture/stats/index.php?userid='.$key.'">'.img_picto($langs->trans("InvoiceStats"),"stats").'</a> ';
|
||||
print '</td>';
|
||||
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
@ -296,7 +293,7 @@ if (sizeof($amount))
|
||||
|
||||
// Total
|
||||
print '<tr class="liste_total"><td>'.$langs->trans("Total").'</td><td align="right">'.price($catotal).'</td><td> </td>';
|
||||
if ($conf->commande->enabled && $conf->global->MAIN_FEATURES_LEVEL == 2) print '<td> </td>';
|
||||
print '<td> </td>';
|
||||
print '</tr>';
|
||||
|
||||
$db->free($result);
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
|
||||
* Copyright (C) 2007 Franky Van Liedekerke <franky.van.liedekerke@telenet.be>
|
||||
*
|
||||
@ -227,7 +227,7 @@ print "<tr class=\"liste_titre\">";
|
||||
print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"nom","",'&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);
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL == 2) print_liste_field_titre($langs->trans("OtherStatistics"),$_SERVER["PHP_SELF"],"","","",'align="center" width="20%"');
|
||||
print_liste_field_titre($langs->trans("OtherStatistics"),$_SERVER["PHP_SELF"],"","","",'align="center" width="20%"');
|
||||
print "</tr>\n";
|
||||
$var=true;
|
||||
|
||||
@ -288,14 +288,11 @@ if (sizeof($amount))
|
||||
print '<td align="right">'.($catotal > 0 ? round(100 * $amount[$key] / $catotal, 2).'%' : ' ').'</td>';
|
||||
|
||||
// Other stats
|
||||
if ($conf->global->MAIN_FEATURES_LEVEL == 2)
|
||||
{
|
||||
print '<td align="center">';
|
||||
if ($conf->commande->enabled && $key>0) print ' <a href="'.DOL_URL_ROOT.'/commande/stats/index.php?userid='.$key.'">'.img_picto($langs->trans("OrderStats"),"stats").'</a> ';
|
||||
if ($conf->facture->enabled && $key>0) print ' <a href="'.DOL_URL_ROOT.'/compta/facture/stats/index.php?userid='.$key.'">'.img_picto($langs->trans("InvoiceStats"),"stats").'</a> ';
|
||||
if ($conf->propal->enabled && $key>0) print ' <a href="'.DOL_URL_ROOT.'/comm/propal/stats/index.php?userid='.$key.'">'.img_picto($langs->trans("ProposalStats"),"stats").'</a> ';
|
||||
print '</td>';
|
||||
}
|
||||
print '<td align="center">';
|
||||
if ($conf->propal->enabled && $key>0) print ' <a href="'.DOL_URL_ROOT.'/comm/propal/stats/index.php?userid='.$key.'">'.img_picto($langs->trans("ProposalStats"),"stats").'</a> ';
|
||||
if ($conf->commande->enabled && $key>0) print ' <a href="'.DOL_URL_ROOT.'/commande/stats/index.php?userid='.$key.'">'.img_picto($langs->trans("OrderStats"),"stats").'</a> ';
|
||||
if ($conf->facture->enabled && $key>0) print ' <a href="'.DOL_URL_ROOT.'/compta/facture/stats/index.php?userid='.$key.'">'.img_picto($langs->trans("InvoiceStats"),"stats").'</a> ';
|
||||
print '</td>';
|
||||
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
@ -303,7 +300,7 @@ if (sizeof($amount))
|
||||
|
||||
// Total
|
||||
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 '<td> </td>';
|
||||
print '</tr>';
|
||||
|
||||
$db->free($result);
|
||||
|
||||
@ -521,7 +521,7 @@ class FormCompany
|
||||
$sql .= " ORDER BY nom ASC";
|
||||
|
||||
//print $sql;
|
||||
$resql = $object->db->query($sql);
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
if ($conf->use_javascript_ajax && $conf->global->COMPANY_USE_SEARCH_TO_SELECT)
|
||||
@ -564,13 +564,13 @@ class FormCompany
|
||||
{
|
||||
$javaScript = "window.location='./contact.php?".$var_id."=".$object->id."&".$htmlname."=' + form.".$htmlname.".options[form.".$htmlname.".selectedIndex].value;";
|
||||
print '<select class="flat" id="'.$htmlname.'" name="'.$htmlname.'" onChange="'.$javaScript.'">';
|
||||
$num = $object->db->num_rows($resql);
|
||||
$num = $this->db->num_rows($resql);
|
||||
$i = 0;
|
||||
if ($num)
|
||||
{
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $object->db->fetch_object($resql);
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
if ($i == 0) $firstCompany = $obj->rowid;
|
||||
$disabled=0;
|
||||
if (is_array($limitto) && sizeof($limitto) && ! in_array($obj->rowid,$limitto)) $disabled=1;
|
||||
@ -596,7 +596,7 @@ class FormCompany
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($object->db);
|
||||
dol_print_error($this->db);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user