Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dolibarr
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Software_Artifact_Infrastructure_Repository
dolibarr
Commits
66740071
Commit
66740071
authored
12 years ago
by
Laurent Destailleur
Browse files
Options
Downloads
Patches
Plain Diff
Fix: Use order date for stats, not valid date.
parent
a1bd60a6
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
htdocs/commande/class/commandestats.class.php
+11
-12
11 additions, 12 deletions
htdocs/commande/class/commandestats.class.php
with
11 additions
and
12 deletions
htdocs/commande/class/commandestats.class.php
+
11
−
12
View file @
66740071
...
...
@@ -28,8 +28,7 @@ include_once DOL_DOCUMENT_ROOT . "/fourn/class/fournisseur.commande.class.php";
/**
* \class CommandeStats
* \brief Classe permettant la gestion des stats des commandes
* Class to manage order statistics
*/
class
CommandeStats
extends
Stats
{
...
...
@@ -66,7 +65,7 @@ class CommandeStats extends Stats
$this
->
from
=
MAIN_DB_PREFIX
.
$object
->
table_element
.
" as c"
;
$this
->
from
.
=
", "
.
MAIN_DB_PREFIX
.
"societe as s"
;
$this
->
field
=
'total_ht'
;
$this
->
where
.
=
" c.fk_statut > 0"
;
$this
->
where
.
=
" c.fk_statut > 0"
;
// Not draft and not cancelled
}
if
(
$mode
==
'supplier'
)
{
...
...
@@ -74,7 +73,7 @@ class CommandeStats extends Stats
$this
->
from
=
MAIN_DB_PREFIX
.
$object
->
table_element
.
" as c"
;
$this
->
from
.
=
", "
.
MAIN_DB_PREFIX
.
"societe as s"
;
$this
->
field
=
'total_ht'
;
$this
->
where
.
=
" c.fk_statut > 0"
;
$this
->
where
.
=
" c.fk_statut > 0"
;
// Not draft and not cancelled
}
$this
->
where
.
=
" AND c.fk_soc = s.rowid AND c.entity = "
.
$conf
->
entity
;
...
...
@@ -97,10 +96,10 @@ class CommandeStats extends Stats
global
$conf
;
global
$user
;
$sql
=
"SELECT date_format(c.date_
valid
,'%m') as dm, count(*) nb"
;
$sql
=
"SELECT date_format(c.date_
commande
,'%m') as dm, count(*) nb"
;
$sql
.
=
" FROM "
.
$this
->
from
;
if
(
!
$user
->
rights
->
societe
->
client
->
voir
&&
!
$this
->
socid
)
$sql
.
=
", "
.
MAIN_DB_PREFIX
.
"societe_commerciaux as sc"
;
$sql
.
=
" WHERE date_format(c.date_
valid
,'%Y') = '"
.
$year
.
"'"
;
$sql
.
=
" WHERE date_format(c.date_
commande
,'%Y') = '"
.
$year
.
"'"
;
$sql
.
=
" AND "
.
$this
->
where
;
$sql
.
=
" GROUP BY dm"
;
$sql
.
=
$this
->
db
->
order
(
'dm'
,
'DESC'
);
...
...
@@ -119,7 +118,7 @@ class CommandeStats extends Stats
global
$conf
;
global
$user
;
$sql
=
"SELECT date_format(c.date_
valid
,'%Y') as dm, count(*), sum(c."
.
$this
->
field
.
")"
;
$sql
=
"SELECT date_format(c.date_
commande
,'%Y') as dm, count(*), sum(c."
.
$this
->
field
.
")"
;
$sql
.
=
" FROM "
.
$this
->
from
;
if
(
!
$user
->
rights
->
societe
->
client
->
voir
&&
!
$this
->
socid
)
$sql
.
=
", "
.
MAIN_DB_PREFIX
.
"societe_commerciaux as sc"
;
$sql
.
=
" WHERE "
.
$this
->
where
;
...
...
@@ -140,10 +139,10 @@ class CommandeStats extends Stats
global
$conf
;
global
$user
;
$sql
=
"SELECT date_format(c.date_
valid
,'%m') as dm, sum(c."
.
$this
->
field
.
")"
;
$sql
=
"SELECT date_format(c.date_
commande
,'%m') as dm, sum(c."
.
$this
->
field
.
")"
;
$sql
.
=
" FROM "
.
$this
->
from
;
if
(
!
$user
->
rights
->
societe
->
client
->
voir
&&
!
$this
->
socid
)
$sql
.
=
", "
.
MAIN_DB_PREFIX
.
"societe_commerciaux as sc"
;
$sql
.
=
" WHERE date_format(c.date_
valid
,'%Y') = '"
.
$year
.
"'"
;
$sql
.
=
" WHERE date_format(c.date_
commande
,'%Y') = '"
.
$year
.
"'"
;
$sql
.
=
" AND "
.
$this
->
where
;
$sql
.
=
" GROUP BY dm"
;
$sql
.
=
$this
->
db
->
order
(
'dm'
,
'DESC'
);
...
...
@@ -162,10 +161,10 @@ class CommandeStats extends Stats
global
$conf
;
global
$user
;
$sql
=
"SELECT date_format(c.date_
valid
,'%m') as dm, avg(c."
.
$this
->
field
.
")"
;
$sql
=
"SELECT date_format(c.date_
commande
,'%m') as dm, avg(c."
.
$this
->
field
.
")"
;
$sql
.
=
" FROM "
.
$this
->
from
;
if
(
!
$user
->
rights
->
societe
->
client
->
voir
&&
!
$this
->
socid
)
$sql
.
=
", "
.
MAIN_DB_PREFIX
.
"societe_commerciaux as sc"
;
$sql
.
=
" WHERE date_format(c.date_
valid
,'%Y') = '"
.
$year
.
"'"
;
$sql
.
=
" WHERE date_format(c.date_
commande
,'%Y') = '"
.
$year
.
"'"
;
$sql
.
=
" AND "
.
$this
->
where
;
$sql
.
=
" GROUP BY dm"
;
$sql
.
=
$this
->
db
->
order
(
'dm'
,
'DESC'
);
...
...
@@ -182,7 +181,7 @@ class CommandeStats extends Stats
{
global
$user
;
$sql
=
"SELECT date_format(c.date_
valid
,'%Y') as year, count(*) as nb, sum(c."
.
$this
->
field
.
") as total, avg("
.
$this
->
field
.
") as avg"
;
$sql
=
"SELECT date_format(c.date_
commande
,'%Y') as year, count(*) as nb, sum(c."
.
$this
->
field
.
") as total, avg("
.
$this
->
field
.
") as avg"
;
$sql
.
=
" FROM "
.
$this
->
from
;
if
(
!
$user
->
rights
->
societe
->
client
->
voir
&&
!
$this
->
socid
)
$sql
.
=
", "
.
MAIN_DB_PREFIX
.
"societe_commerciaux as sc"
;
$sql
.
=
" WHERE "
.
$this
->
where
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment