Merge remote-tracking branch 'origin/3.4' into develop

This commit is contained in:
Laurent Destailleur 2013-07-01 02:10:57 +02:00
commit 56676c925f
2 changed files with 10 additions and 4 deletions

View File

@ -95,7 +95,6 @@ class CommandeStats extends Stats
*/
function getNbByMonth($year)
{
global $conf;
global $user;
$sql = "SELECT date_format(c.date_commande,'%m') as dm, count(*) nb";
@ -117,7 +116,6 @@ class CommandeStats extends Stats
*/
function getNbByYear()
{
global $conf;
global $user;
$sql = "SELECT date_format(c.date_commande,'%Y') as dm, count(*), sum(c.".$this->field.")";
@ -138,7 +136,6 @@ class CommandeStats extends Stats
*/
function getAmountByMonth($year)
{
global $conf;
global $user;
$sql = "SELECT date_format(c.date_commande,'%m') as dm, sum(c.".$this->field.")";
@ -160,7 +157,6 @@ class CommandeStats extends Stats
*/
function getAverageByMonth($year)
{
global $conf;
global $user;
$sql = "SELECT date_format(c.date_commande,'%m') as dm, avg(c.".$this->field.")";

View File

@ -91,6 +91,8 @@ class FactureStats extends Stats
*/
function getNbByMonth($year)
{
global $user;
$sql = "SELECT MONTH(f.datef) as dm, COUNT(*)";
$sql.= " FROM ".$this->from;
if (!$user->rights->societe->client->voir && !$this->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
@ -112,6 +114,8 @@ class FactureStats extends Stats
*/
function getNbByYear()
{
global $user;
$sql = "SELECT YEAR(f.datef) as dm, COUNT(*)";
$sql.= " FROM ".$this->from;
if (!$user->rights->societe->client->voir && !$this->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
@ -131,6 +135,8 @@ class FactureStats extends Stats
*/
function getAmountByMonth($year)
{
global $user;
$sql = "SELECT date_format(datef,'%m') as dm, SUM(f.".$this->field.")";
$sql.= " FROM ".$this->from;
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
@ -152,6 +158,8 @@ class FactureStats extends Stats
*/
function getAverageByMonth($year)
{
global $user;
$sql = "SELECT date_format(datef,'%m') as dm, AVG(f.".$this->field.")";
$sql.= " FROM ".$this->from;
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
@ -170,6 +178,8 @@ class FactureStats extends Stats
*/
function getAllByYear()
{
global $user;
$sql = "SELECT date_format(datef,'%Y') as year, COUNT(*) as nb, SUM(f.".$this->field.") as total, AVG(f.".$this->field.") as avg";
$sql.= " FROM ".$this->from;
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";