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
6e5a8b67
Commit
6e5a8b67
authored
8 years ago
by
Laurent Destailleur
Browse files
Options
Downloads
Patches
Plain Diff
FIX Some statistics not compatible with multicompany module.
parent
b0ac0624
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
htdocs/commande/class/commandestats.class.php
+2
-1
2 additions, 1 deletion
htdocs/commande/class/commandestats.class.php
htdocs/expensereport/class/expensereportstats.class.php
+15
-12
15 additions, 12 deletions
htdocs/expensereport/class/expensereportstats.class.php
with
17 additions
and
13 deletions
htdocs/commande/class/commandestats.class.php
+
2
−
1
View file @
6e5a8b67
...
...
@@ -81,7 +81,8 @@ class CommandeStats extends Stats
$this
->
where
.
=
" c.fk_statut > 2"
;
// Only approved & ordered
}
//$this->where.= " AND c.fk_soc = s.rowid AND c.entity = ".$conf->entity;
$this
->
where
.
=
" AND c.entity = "
.
$conf
->
entity
;
$this
->
where
.
=
' AND c.entity IN ('
.
getEntity
(
'commande'
,
1
)
.
')'
;
if
(
!
$user
->
rights
->
societe
->
client
->
voir
&&
!
$this
->
socid
)
$this
->
where
.
=
" AND c.fk_soc = sc.fk_soc AND sc.fk_user = "
.
$user
->
id
;
if
(
$this
->
socid
)
{
...
...
This diff is collapsed.
Click to expand it.
htdocs/expensereport/class/expensereportstats.class.php
+
15
−
12
View file @
6e5a8b67
...
...
@@ -56,14 +56,17 @@ class ExpenseReportStats extends Stats
$this
->
userid
=
$userid
;
$object
=
new
ExpenseReport
(
$this
->
db
);
$this
->
from
=
MAIN_DB_PREFIX
.
$object
->
table_element
;
$this
->
from
=
MAIN_DB_PREFIX
.
$object
->
table_element
.
" as e"
;
$this
->
field
=
'total_ht'
;
$this
->
where
=
" fk_statut > 0 and date_valid > '2000-01-01'"
;
$this
->
where
=
" e.fk_statut > 0"
;
//$this->where.= " AND e.date_valid > '2000-01-01'"; // To filter only approved
$this
->
where
.
=
' AND e.entity IN ('
.
getEntity
(
'expensereport'
,
1
)
.
')'
;
//$this->where.= " AND entity = ".$conf->entity;
if
(
$this
->
socid
)
{
$this
->
where
.
=
" AND fk_soc = "
.
$this
->
socid
;
$this
->
where
.
=
" AND
e.
fk_soc = "
.
$this
->
socid
;
}
// Only me and subordinates
...
...
@@ -71,10 +74,10 @@ class ExpenseReportStats extends Stats
{
$childids
=
$user
->
getAllChildIds
();
$childids
[]
=
$user
->
id
;
$this
->
where
.
=
" AND fk_user_author IN ("
.
(
join
(
','
,
$childids
))
.
")"
;
$this
->
where
.
=
" AND
e.
fk_user_author IN ("
.
(
join
(
','
,
$childids
))
.
")"
;
}
if
(
$this
->
userid
>
0
)
$this
->
where
.
=
' AND fk_user_author = '
.
$this
->
userid
;
if
(
$this
->
userid
>
0
)
$this
->
where
.
=
' AND
e.
fk_user_author = '
.
$this
->
userid
;
}
...
...
@@ -102,9 +105,9 @@ class ExpenseReportStats extends Stats
*/
function
getNbByMonth
(
$year
)
{
$sql
=
"SELECT MONTH(date_valid) as dm, count(*)"
;
$sql
=
"SELECT MONTH(
e.
date_valid) as dm, count(*)"
;
$sql
.
=
" FROM "
.
$this
->
from
;
$sql
.
=
" WHERE YEAR(date_valid) = "
.
$year
;
$sql
.
=
" WHERE YEAR(
e.
date_valid) = "
.
$year
;
$sql
.
=
" AND "
.
$this
->
where
;
$sql
.
=
" GROUP BY dm"
;
$sql
.
=
$this
->
db
->
order
(
'dm'
,
'DESC'
);
...
...
@@ -123,9 +126,9 @@ class ExpenseReportStats extends Stats
*/
function
getAmountByMonth
(
$year
)
{
$sql
=
"SELECT date_format(date_valid,'%m') as dm, sum("
.
$this
->
field
.
")"
;
$sql
=
"SELECT date_format(
e.
date_valid,'%m') as dm, sum("
.
$this
->
field
.
")"
;
$sql
.
=
" FROM "
.
$this
->
from
;
$sql
.
=
" WHERE date_format(date_valid,'%Y') = '"
.
$year
.
"'"
;
$sql
.
=
" WHERE date_format(
e.
date_valid,'%Y') = '"
.
$year
.
"'"
;
$sql
.
=
" AND "
.
$this
->
where
;
$sql
.
=
" GROUP BY dm"
;
$sql
.
=
$this
->
db
->
order
(
'dm'
,
'DESC'
);
...
...
@@ -143,9 +146,9 @@ class ExpenseReportStats extends Stats
*/
function
getAverageByMonth
(
$year
)
{
$sql
=
"SELECT date_format(date_valid,'%m') as dm, avg("
.
$this
->
field
.
")"
;
$sql
=
"SELECT date_format(
e.
date_valid,'%m') as dm, avg("
.
$this
->
field
.
")"
;
$sql
.
=
" FROM "
.
$this
->
from
;
$sql
.
=
" WHERE date_format(date_valid,'%Y') = '"
.
$year
.
"'"
;
$sql
.
=
" WHERE date_format(
e.
date_valid,'%Y') = '"
.
$year
.
"'"
;
$sql
.
=
" AND "
.
$this
->
where
;
$sql
.
=
" GROUP BY dm"
;
$sql
.
=
$this
->
db
->
order
(
'dm'
,
'DESC'
);
...
...
@@ -160,7 +163,7 @@ class ExpenseReportStats extends Stats
*/
function
getAllByYear
()
{
$sql
=
"SELECT date_format(date_valid,'%Y') as year, count(*) as nb, sum("
.
$this
->
field
.
") as total, avg("
.
$this
->
field
.
") as avg"
;
$sql
=
"SELECT date_format(
e.
date_valid,'%Y') as year, count(*) as nb, sum("
.
$this
->
field
.
") as total, avg("
.
$this
->
field
.
") as avg"
;
$sql
.
=
" FROM "
.
$this
->
from
;
$sql
.
=
" WHERE "
.
$this
->
where
;
$sql
.
=
" GROUP BY year"
;
...
...
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