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
bdb47921
Commit
bdb47921
authored
10 years ago
by
Laurent Destailleur
Browse files
Options
Downloads
Patches
Plain Diff
Fixed: Bad value for % increase for first year.
parent
22c27e87
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/compta/stats/index.php
+56
-53
56 additions, 53 deletions
htdocs/compta/stats/index.php
with
56 additions
and
53 deletions
htdocs/compta/stats/index.php
+
56
−
53
View file @
bdb47921
...
...
@@ -209,6 +209,8 @@ $maxyear=substr($maxyearmonth,0,4);
$nowyear
=
strftime
(
"%Y"
,
dol_now
());
$nowyearmonth
=
strftime
(
"%Y-%m"
,
dol_now
());
$maxyearmonth
=
max
(
$maxyearmonth
,
$nowyearmonth
);
$now
=
dol_now
();
$casenow
=
dol_print_date
(
$now
,
"%Y-%m"
);
// Loop on each month
$nb_mois_decalage
=
$conf
->
global
->
SOCIETE_FISCAL_MONTH_START
?
(
$conf
->
global
->
SOCIETE_FISCAL_MONTH_START
-
1
)
:
0
;
...
...
@@ -220,22 +222,37 @@ for ($mois = 1+$nb_mois_decalage ; $mois <= 12+$nb_mois_decalage ; $mois++)
print
"<tr "
.
$bc
[
$var
]
.
">"
;
print
"<td>"
.
dol_print_date
(
dol_mktime
(
12
,
0
,
0
,
$mois_modulo
,
1
,
2000
),
"%B"
)
.
"</td>"
;
for
(
$annee
=
$year_start
;
$annee
<=
$year_end
;
$annee
++
)
for
(
$annee
=
$year_start
-
1
;
$annee
<=
$year_end
;
$annee
++
)
// We start one year before to have data to be able to make delta
{
$now
=
dol_now
();
$annee_decalage
=
$annee
;
if
(
$mois
>
12
)
{
$annee_decalage
=
$annee
+
1
;}
$casenow
=
dol_print_date
(
$now
,
"%Y-%m"
);
$case
=
dol_print_date
(
dol_mktime
(
1
,
1
,
1
,
$mois_modulo
,
1
,
$annee_decalage
),
"%Y-%m"
);
$caseprev
=
dol_print_date
(
dol_mktime
(
1
,
1
,
1
,
$mois_modulo
,
1
,
$annee_decalage
-
1
),
"%Y-%m"
);
if
(
$modecompta
==
'CREANCES-DETTES'
)
{
// Valeur CA du mois w/o VAT
if
(
$annee
>=
$year_start
)
{
if
(
$modecompta
==
'CREANCES-DETTES'
)
{
// Valeur CA du mois w/o VAT
print
'<td align="right">'
;
if
(
$cum_ht
[
$case
])
{
$now_show_delta
=
1
;
// On a trouve le premier mois de la premiere annee generant du chiffre.
print
'<a href="casoc.php?year='
.
$annee_decalage
.
'&month='
.
$mois_modulo
.
(
$modecompta
?
'&modecompta='
.
$modecompta
:
''
)
.
'">'
.
price
(
$cum_ht
[
$case
],
1
)
.
'</a>'
;
}
else
{
if
(
$minyearmonth
<
$case
&&
$case
<=
max
(
$maxyearmonth
,
$nowyearmonth
))
{
print
'0'
;
}
else
{
print
' '
;
}
}
print
"</td>"
;
}
// Valeur CA du mois
print
'<td align="right">'
;
if
(
$cum
_ht
[
$case
])
if
(
$cum
[
$case
])
{
$now_show_delta
=
1
;
// On a trouve le premier mois de la premiere annee generant du chiffre.
print
'<a href="casoc.php?year='
.
$annee_decalage
.
'&month='
.
$mois_modulo
.
(
$modecompta
?
'&modecompta='
.
$modecompta
:
''
)
.
'">'
.
price
(
$cum
_ht
[
$case
],
1
)
.
'</a>'
;
print
'<a href="casoc.php?year='
.
$annee_decalage
.
'&month='
.
$mois_modulo
.
(
$modecompta
?
'&modecompta='
.
$modecompta
:
''
)
.
'">'
.
price
(
$cum
[
$case
],
1
)
.
'</a>'
;
}
else
{
...
...
@@ -243,60 +260,46 @@ for ($mois = 1+$nb_mois_decalage ; $mois <= 12+$nb_mois_decalage ; $mois++)
else
{
print
' '
;
}
}
print
"</td>"
;
}
// Valeur CA du mois
print
'<td align="right">'
;
if
(
$cum
[
$case
])
{
$now_show_delta
=
1
;
// On a trouve le premier mois de la premiere annee generant du chiffre.
print
'<a href="casoc.php?year='
.
$annee_decalage
.
'&month='
.
$mois_modulo
.
(
$modecompta
?
'&modecompta='
.
$modecompta
:
''
)
.
'">'
.
price
(
$cum
[
$case
],
1
)
.
'</a>'
;
}
else
{
if
(
$minyearmonth
<
$case
&&
$case
<=
max
(
$maxyearmonth
,
$nowyearmonth
))
{
print
'0'
;
}
else
{
print
' '
;
}
}
print
"</td>"
;
// Pourcentage du mois
if
(
$annee_decalage
>
$minyear
&&
$case
<=
$casenow
)
{
if
(
$cum
[
$caseprev
]
&&
$cum
[
$case
])
// Pourcentage du mois
if
(
$annee_decalage
>
$minyear
&&
$case
<=
$casenow
)
{
$percent
=
(
round
((
$cum
[
$case
]
-
$cum
[
$caseprev
])
/
$cum
[
$caseprev
],
4
)
*
100
);
//print "X $cum[$case] - $cum[$caseprev] - $cum[$caseprev] - $percent X";
print
'<td align="right" class="borderrightlight">'
.
(
$percent
>=
0
?
"+
$percent
"
:
"
$percent
"
)
.
'%</td>'
;
if
(
$cum
[
$caseprev
]
&&
$cum
[
$case
])
{
$percent
=
(
round
((
$cum
[
$case
]
-
$cum
[
$caseprev
])
/
$cum
[
$caseprev
],
4
)
*
100
);
//print "X $cum[$case] - $cum[$caseprev] - $cum[$caseprev] - $percent X";
print
'<td align="right" class="borderrightlight">'
.
(
$percent
>=
0
?
"+
$percent
"
:
"
$percent
"
)
.
'%</td>'
;
}
if
(
$cum
[
$caseprev
]
&&
!
$cum
[
$case
])
{
print
'<td align="right" class="borderrightlight">-100%</td>'
;
}
if
(
!
$cum
[
$caseprev
]
&&
$cum
[
$case
])
{
//print '<td align="right">+Inf%</td>';
print
'<td align="right" class="borderrightlight">-</td>'
;
}
if
(
isset
(
$cum
[
$caseprev
])
&&
!
$cum
[
$caseprev
]
&&
!
$cum
[
$case
])
{
print
'<td align="right" class="borderrightlight">+0%</td>'
;
}
if
(
!
isset
(
$cum
[
$caseprev
])
&&
!
$cum
[
$case
])
{
print
'<td align="right" class="borderrightlight">-</td>'
;
}
}
if
(
$cum
[
$caseprev
]
&&
!
$cum
[
$case
])
{
print
'<td align="right" class="borderrightlight">-100%</td>'
;
}
if
(
!
$cum
[
$caseprev
]
&&
$cum
[
$case
])
{
//print '<td align="right">+Inf%</td>';
print
'<td align="right" class="borderrightlight">-</td>'
;
}
if
(
isset
(
$cum
[
$caseprev
])
&&
!
$cum
[
$caseprev
]
&&
!
$cum
[
$case
])
{
print
'<td align="right" class="borderrightlight">+0%</td>'
;
}
if
(
!
isset
(
$cum
[
$caseprev
])
&&
!
$cum
[
$case
])
else
{
print
'<td align="right" class="borderrightlight">-</td>'
;
print
'<td align="right" class="borderrightlight">'
;
if
(
$minyearmonth
<=
$case
&&
$case
<=
$maxyearmonth
)
{
print
'-'
;
}
else
{
print
' '
;
}
print
'</td>'
;
}
}
else
{
print
'<td align="right" class="borderrightlight">'
;
if
(
$minyearmonth
<=
$case
&&
$case
<=
$maxyearmonth
)
{
print
'-'
;
}
else
{
print
' '
;
}
print
'</td>'
;
if
(
$annee_decalage
!=
$year_end
)
print
'<td width="15"> </td>'
;
}
$total_ht
[
$annee
]
+=!
empty
(
$cum_ht
[
$case
])
?
$cum_ht
[
$case
]
:
0
;;
$total
[
$annee
]
+=
$cum
[
$case
];
if
(
$annee_decalage
!=
$year_end
)
print
'<td width="15"> </td>'
;
}
print
'</tr>'
;
...
...
@@ -406,7 +409,7 @@ for ($annee = $year_start ; $annee <= $year_end ; $annee++)
}
if
(
!
$total
[
$annee
-
1
]
&&
$total
[
$annee
])
{
print
'<td align="right" class="borderrightlight">+
Inf
%</td>'
;
print
'<td align="right" class="borderrightlight">+
zzzz'
.
$total
[
$annee
-
1
]
.
$langs
->
trans
(
'Inf'
)
.
'
%</td>'
;
}
if
(
!
$total
[
$annee
-
1
]
&&
!
$total
[
$annee
])
{
...
...
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