diff --git a/htdocs/comm/propal/stats/index.php b/htdocs/comm/propal/stats/index.php index 527a5593d25..1aba0a311aa 100644 --- a/htdocs/comm/propal/stats/index.php +++ b/htdocs/comm/propal/stats/index.php @@ -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 ''; print '
'; +// Show filter box +print '
'; +print ''; +print ''; +print ''; +print ''; +print ''; +print '
'.$langs->trans("Filter").'
'.$langs->trans("ThirdParty").''; +$filter='s.client in (1,2,3)'; +print $form->select_company($socid,'socid',$filter,1); +print '
'.$langs->trans("User").''; +print $form->select_users($userid,'userid',1); +print '
'; +print '
'; +print '

'; + // Show array $data = $stats->getAllByYear(); diff --git a/htdocs/commande/index.php b/htdocs/commande/index.php index 0293a033649..f345caec515 100644 --- a/htdocs/commande/index.php +++ b/htdocs/commande/index.php @@ -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 = ''; diff --git a/htdocs/commande/stats/index.php b/htdocs/commande/stats/index.php index 7e15ba15a86..8e39c38d886 100644 --- a/htdocs/commande/stats/index.php +++ b/htdocs/commande/stats/index.php @@ -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 ''; print '
'; +// Show filter box +print '
'; +print ''; +print ''; +print ''; +print ''; +print ''; +print '
'.$langs->trans("Filter").'
'.$langs->trans("ThirdParty").''; +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 '
'.$langs->trans("User").''; +print $form->select_users($userid,'userid',1); +print '
'; +print '
'; +print '

'; + // Show array $data = $stats->getAllByYear(); diff --git a/htdocs/compta/deplacement/stats/index.php b/htdocs/compta/deplacement/stats/index.php index 5f68a5101e9..20619e32e11 100755 --- a/htdocs/compta/deplacement/stats/index.php +++ b/htdocs/compta/deplacement/stats/index.php @@ -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 ''; print '
'; +// Show filter box +print '
'; +print ''; +print ''; +print ''; +print ''; +print ''; +print '
'.$langs->trans("Filter").'
'.$langs->trans("ThirdParty").''; +$filter=''; +print $form->select_company($socid,'socid',$filter,1,1); +print '
'.$langs->trans("User").''; +print $form->select_users($userid,'userid',1); +print '
'; +print '
'; +print '

'; + // Show array $data = $stats->getAllByYear(); diff --git a/htdocs/compta/facture/stats/index.php b/htdocs/compta/facture/stats/index.php index 96f4c04e4de..4b38bac4a47 100644 --- a/htdocs/compta/facture/stats/index.php +++ b/htdocs/compta/facture/stats/index.php @@ -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 ''; 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); -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 "\n"; $var=true; @@ -281,14 +281,11 @@ if (sizeof($amount)) print ''; // Other stats - if ($conf->global->MAIN_FEATURES_LEVEL == 2) - { - print ''; - } + print ''; print "\n"; $i++; @@ -296,7 +293,7 @@ if (sizeof($amount)) // Total print ''; - if ($conf->commande->enabled && $conf->global->MAIN_FEATURES_LEVEL == 2) print ''; + print ''; print ''; $db->free($result); diff --git a/htdocs/compta/stats/casoc.php b/htdocs/compta/stats/casoc.php index 5c45f3c74f8..4084f84b63b 100644 --- a/htdocs/compta/stats/casoc.php +++ b/htdocs/compta/stats/casoc.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2010 Laurent Destailleur + * Copyright (C) 2004-2011 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2007 Franky Van Liedekerke * @@ -227,7 +227,7 @@ print ""; 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 "\n"; $var=true; @@ -288,14 +288,11 @@ if (sizeof($amount)) print ''; // Other stats - if ($conf->global->MAIN_FEATURES_LEVEL == 2) - { - print ''; - } + print ''; print "\n"; $i++; @@ -303,7 +300,7 @@ if (sizeof($amount)) // Total print ''; - if ($conf->global->MAIN_FEATURES_LEVEL == 2) print ''; + print ''; print ''; $db->free($result); diff --git a/htdocs/core/class/html.formcompany.class.php b/htdocs/core/class/html.formcompany.class.php index a6f3476ce19..a8c1fadfcd4 100644 --- a/htdocs/core/class/html.formcompany.class.php +++ b/htdocs/core/class/html.formcompany.class.php @@ -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 '
'; +// Show filter box +print '
'; +print ''; +print ''; +print ''; +print ''; +print ''; +print '
'.$langs->trans("Filter").'
'.$langs->trans("ThirdParty").''; +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 '
'.$langs->trans("User").''; +print $form->select_users($userid,'userid',1); +print '
'; +print '
'; +print '

'; + // Show array $data = $stats->getAllByYear(); diff --git a/htdocs/compta/stats/cabyuser.php b/htdocs/compta/stats/cabyuser.php index 859c3e9c6ba..1800c65575b 100644 --- a/htdocs/compta/stats/cabyuser.php +++ b/htdocs/compta/stats/cabyuser.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2010 Laurent Destailleur + * Copyright (C) 2004-2011 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin * * This program is free software; you can redistribute it and/or modify @@ -221,7 +221,7 @@ print "
'.($catotal > 0 ? round(100 * $amount[$key] / $catotal,2).'%' : ' ').''; - if ($conf->commande->enabled && $key>0) print ' '.img_picto($langs->trans("OrderStats"),"stats").' '; - if ($conf->facture->enabled && $key>0) print ' '.img_picto($langs->trans("InvoiceStats"),"stats").' '; - if ($conf->propal->enabled && $key>0) print ' '.img_picto($langs->trans("ProposalStats"),"stats").' '; - print ''; + if ($conf->propal->enabled && $key>0) print ' '.img_picto($langs->trans("ProposalStats"),"stats").' '; + if ($conf->commande->enabled && $key>0) print ' '.img_picto($langs->trans("OrderStats"),"stats").' '; + if ($conf->facture->enabled && $key>0) print ' '.img_picto($langs->trans("InvoiceStats"),"stats").' '; + print '
'.$langs->trans("Total").''.price($catotal).'   
'.($catotal > 0 ? round(100 * $amount[$key] / $catotal, 2).'%' : ' ').''; - if ($conf->commande->enabled && $key>0) print ' '.img_picto($langs->trans("OrderStats"),"stats").' '; - if ($conf->facture->enabled && $key>0) print ' '.img_picto($langs->trans("InvoiceStats"),"stats").' '; - if ($conf->propal->enabled && $key>0) print ' '.img_picto($langs->trans("ProposalStats"),"stats").' '; - print ''; + if ($conf->propal->enabled && $key>0) print ' '.img_picto($langs->trans("ProposalStats"),"stats").' '; + if ($conf->commande->enabled && $key>0) print ' '.img_picto($langs->trans("OrderStats"),"stats").' '; + if ($conf->facture->enabled && $key>0) print ' '.img_picto($langs->trans("InvoiceStats"),"stats").' '; + print '
'.$langs->trans("Total").''.price($catotal).'