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
4eab7b00
Commit
4eab7b00
authored
12 years ago
by
Charles Benke
Browse files
Options
Downloads
Patches
Plain Diff
Update htdocs/core/boxes/box_activity.php
new release with "last 2 year bills"
parent
4fe1ba33
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/core/boxes/box_activity.php
+49
-15
49 additions, 15 deletions
htdocs/core/boxes/box_activity.php
with
49 additions
and
15 deletions
htdocs/core/boxes/box_activity.php
+
49
−
15
View file @
4eab7b00
...
...
@@ -73,26 +73,69 @@ class box_activity extends ModeleBoxes
$propalstatic
=
new
Propal
(
$db
);
$commandestatic
=
new
Commande
(
$db
);
$textHead
=
$langs
->
trans
(
"Activity"
)
.
" "
.
date
(
"Y"
)
;
$textHead
=
$langs
->
trans
(
"Activity"
);
$this
->
info_box_head
=
array
(
'text'
=>
$textHead
,
'limit'
=>
dol_strlen
(
$textHead
));
// list the summary of the bills
if
(
!
empty
(
$conf
->
facture
->
enabled
)
&&
$user
->
rights
->
facture
->
lire
)
{
// compute the year limit to show
$tmpdate
=
dol_time_plus_duree
(
time
(),
-
2
,
"y"
);
// we select only the payed bill grouped by years
$sql
=
"SELECT DATE_FORMAT(f.datef,'%Y') as annee, f.paye, f.fk_statut, sum(f.total_ttc) as Mnttot, count(*) as nb"
;
$sql
.
=
" FROM ("
.
MAIN_DB_PREFIX
.
"societe as s,"
.
MAIN_DB_PREFIX
.
"facture as f)"
;
$sql
.
=
" WHERE f.fk_soc = s.rowid"
;
$sql
.
=
" AND s.entity = "
.
$conf
->
entity
;
$sql
.
=
" AND DATE_FORMAT(f.datef,'%Y') >= "
.
date
(
'Y'
,
$tmpdate
)
.
" and paye=1"
;
$sql
.
=
" GROUP BY f.paye, f.fk_statut "
;
$sql
.
=
" ORDER BY f.fk_statut DESC"
;
$result
=
$db
->
query
(
$sql
);
if
(
$result
)
{
$num
=
$db
->
num_rows
(
$result
);
$i
=
0
;
while
(
$i
<
$num
)
{
$this
->
info_box_contents
[
$i
][
0
]
=
array
(
'td'
=>
'align="left" width="16"'
,
'logo'
=>
'bill'
);
$objp
=
$db
->
fetch_object
(
$result
);
$this
->
info_box_contents
[
$i
][
1
]
=
array
(
'td'
=>
'align="left"'
,
'text'
=>
$langs
->
trans
(
"Bills"
)
.
" "
.
$facturestatic
->
LibStatut
(
$objp
->
paye
,
$objp
->
fk_statut
,
0
)
.
" "
.
$objp
->
annee
);
$billurl
=
"viewstatut=2&paye=1&year="
.
$objp
->
annee
;
$this
->
info_box_contents
[
$i
][
2
]
=
array
(
'td'
=>
'align="right"'
,
'text'
=>
$objp
->
nb
,
'url'
=>
DOL_URL_ROOT
.
"/compta/facture/liste.php?"
.
$billurl
.
"&mainmenu=accountancy&leftmenu=customers_bills"
);
$this
->
info_box_contents
[
$i
][
3
]
=
array
(
'td'
=>
'align="right"'
,
'text'
=>
dol_trunc
(
number_format
(
$objp
->
Mnttot
,
0
,
','
,
' '
),
40
)
.
" "
.
$langs
->
trans
(
"Currency"
.
$conf
->
currency
)
);
// We add only for the current year
if
(
$objp
->
annee
==
date
(
"Y"
))
{
$totalnb
+=
$objp
->
nb
;
$totalMnt
+=
$objp
->
Mnttot
;
}
$this
->
info_box_contents
[
$i
][
4
]
=
array
(
'td'
=>
'align="right" width="18"'
,
'text'
=>
$facturestatic
->
LibStatut
(
$objp
->
paye
,
$objp
->
fk_statut
,
3
)
);
$i
++
;
}
if
(
$num
==
0
)
$this
->
info_box_contents
[
$i
][
0
]
=
array
(
'td'
=>
'align="center"'
,
'text'
=>
$langs
->
trans
(
"NoRecordedInvoices"
));
}
$sql
=
"SELECT f.paye, f.fk_statut, sum(f.total_ttc) as Mnttot, count(*) as nb"
;
$sql
.
=
" FROM "
.
MAIN_DB_PREFIX
.
"societe as s,"
.
MAIN_DB_PREFIX
.
"facture as f"
;
$sql
.
=
" WHERE f.entity = "
.
$conf
->
entity
;
$sql
.
=
" AND f.fk_soc = s.rowid"
;
$sql
.
=
" AND
(DATE_FORMAT(f.datef,'%Y') = "
.
date
(
"Y"
)
.
" or
paye=0
)
"
;
$sql
.
=
" AND paye=0"
;
$sql
.
=
" GROUP BY f.paye, f.fk_statut "
;
$sql
.
=
" ORDER BY f.fk_statut DESC"
;
$result
=
$db
->
query
(
$sql
);
if
(
$result
)
{
$num
=
$db
->
num_rows
(
$result
);
$num
=
$db
->
num_rows
(
$result
)
+
$i
;
$now
=
dol_now
();
$i
=
0
;
while
(
$i
<
$num
)
{
...
...
@@ -103,16 +146,7 @@ class box_activity extends ModeleBoxes
$this
->
info_box_contents
[
$i
][
1
]
=
array
(
'td'
=>
'align="left"'
,
'text'
=>
$langs
->
trans
(
"Bills"
)
.
" "
.
$facturestatic
->
LibStatut
(
$objp
->
paye
,
$objp
->
fk_statut
,
0
));
if
(
$objp
->
fk_statut
==
0
)
{
// draft
$billurl
=
"viewstatut=0&paye=0"
;
}
elseif
(
$objp
->
fk_statut
==
1
)
{
// unpaid
$billurl
=
"viewstatut=1&paye=0"
;
}
else
{
// paid for current year
$billurl
=
"viewstatut=2&paye=1"
;
}
$billurl
=
"viewstatut="
.
$objp
->
fk_statut
.
"&paye=0"
;
$this
->
info_box_contents
[
$i
][
2
]
=
array
(
'td'
=>
'align="right"'
,
'text'
=>
$objp
->
nb
,
'url'
=>
DOL_URL_ROOT
.
"/compta/facture/list.php?"
.
$billurl
.
"&mainmenu=accountancy&leftmenu=customers_bills"
);
...
...
@@ -135,6 +169,7 @@ class box_activity extends ModeleBoxes
// list the summary of the orders
if
(
!
empty
(
$conf
->
commande
->
enabled
)
&&
$user
->
rights
->
commande
->
lire
)
{
$sql
=
"SELECT c.fk_statut,c.facture, sum(c.total_ttc) as Mnttot, count(*) as nb"
;
$sql
.
=
" FROM "
.
MAIN_DB_PREFIX
.
"societe as s, "
.
MAIN_DB_PREFIX
.
"commande as c"
;
$sql
.
=
" WHERE c.entity = "
.
$conf
->
entity
;
...
...
@@ -181,7 +216,6 @@ class box_activity extends ModeleBoxes
$sql
.
=
" FROM "
.
MAIN_DB_PREFIX
.
"societe as s, "
.
MAIN_DB_PREFIX
.
"propal as p"
;
$sql
.
=
" WHERE p.entity = "
.
$conf
->
entity
;
$sql
.
=
" AND p.fk_soc = s.rowid"
;
$sql
.
=
" AND DATE_FORMAT(p.datep,'%Y') = "
.
date
(
"Y"
);
$sql
.
=
" AND p.date_cloture IS NULL "
;
// just unclosed
$sql
.
=
" GROUP BY p.fk_statut"
;
$sql
.
=
" ORDER BY p.fk_statut DESC"
;
...
...
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