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
2cd86dfb
Commit
2cd86dfb
authored
20 years ago
by
Rodolphe Quiedeville
Browse files
Options
Downloads
Patches
Plain Diff
Nouveau fichiers
parent
12e385d1
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/telephonie/stats/clients/clients.month.class.php
+165
-0
165 additions, 0 deletions
htdocs/telephonie/stats/clients/clients.month.class.php
with
165 additions
and
0 deletions
htdocs/telephonie/stats/clients/clients.month.class.php
0 → 100644
+
165
−
0
View file @
2cd86dfb
<?PHP
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
* $Source$
*
*/
require_once
(
DOL_DOCUMENT_ROOT
.
"/telephonie/stats/graph/barmoy.class.php"
);
class
GraphClientsMonth
extends
GraphBarMoy
{
Function
GraphClientsMonth
(
$DB
,
$file
)
{
$this
->
db
=
$DB
;
$this
->
file
=
$file
;
$this
->
client
=
0
;
$this
->
titre
=
"Nouveaux clients par mois"
;
$this
->
barcolor
=
"blue"
;
$this
->
showframe
=
true
;
}
Function
GraphMakeGraph
(
$commercial
=
0
)
{
$num
=
0
;
$sql
=
"SELECT fk_client_comm, date_format(date_commande,'%Y%m')"
;
$sql
.
=
" FROM "
.
MAIN_DB_PREFIX
.
"telephonie_societe_ligne"
;
$sql
.
=
" WHERE date_commande IS NOT NULL "
;
if
(
$commercial
>
0
)
{
$sql
.
=
" AND fk_commercial = "
.
$commercial
;
}
$sql
.
=
" ORDER BY date_format(date_commande,'%Y%m') ASC"
;
$result
=
$this
->
db
->
query
(
$sql
);
if
(
$result
)
{
$num
=
$this
->
db
->
num_rows
();
$i
=
0
;
$j
=
0
;
$datas
=
array
();
$labels
=
array
();
$oldweek
=
0
;
$clients
=
array
();
while
(
$i
<
$num
)
{
$row
=
$this
->
db
->
fetch_row
();
if
(
$oldweek
==
0
)
{
$oldweek
=
$row
[
1
];
array_push
(
$clients
,
$row
[
0
]);
$datas
[
$j
]
=
1
;
$labels
[
$j
]
=
$row
[
1
];
}
else
{
if
(
$row
[
1
]
==
$labels
[
$j
])
{
if
(
!
in_array
(
$row
[
0
],
$clients
))
{
array_push
(
$clients
,
$row
[
0
]);
$datas
[
$j
]
++
;
}
}
else
{
$j
++
;
if
(
!
in_array
(
$row
[
0
],
$clients
))
{
array_push
(
$clients
,
$row
[
0
]);
$datas
[
$j
]
=
1
;
}
else
{
$datas
[
$j
]
=
0
;
}
$labels
[
$j
]
=
$row
[
1
];
}
}
$i
++
;
}
$this
->
db
->
free
();
}
else
{
print
$this
->
db
->
error
()
.
' '
.
$sql
;
}
$datas_new
=
array
();
$labels_new
=
array
();
$j
=
0
;
$datas_new
[
0
]
=
$datas
[
0
];
$labels_new
[
0
]
=
ceil
(
substr
(
$labels
[
0
],
-
2
));
for
(
$i
=
1
;
$i
<
sizeof
(
$labels
)
;
$i
++
)
{
if
(
substr
(
$labels
[
$i
],
-
2
)
-
substr
(
$labels
[
$i
-
1
],
-
2
)
>
1
)
{
for
(
$k
=
1
;
$k
<
(
$labels
[
$i
]
-
$labels
[
$i
-
1
])
;
$k
++
)
{
$datas_new
[
$i
+
$j
]
=
0
;
$labels_new
[
$i
+
$j
]
=
ceil
(
substr
(
$labels
[
$i
-
1
],
-
2
)
+
$k
)
;
// suppression du 0
$j
++
;
}
}
$datas_new
[
$i
+
$j
]
=
$datas
[
$i
];
$labels_new
[
$i
+
$j
]
=
ceil
(
substr
(
$labels
[
$i
],
-
2
));
}
$nbel
=
sizeof
(
$datas_new
);
$moys
=
array
();
$moys
[
0
]
=
$datas_new
[
0
];
$sum
=
$moys
[
0
];
for
(
$i
=
1
;
$i
<
$nbel
;
$i
++
)
{
$sum
=
$sum
+
$datas_new
[
$i
];
$moys
[
$i
]
=
(
$sum
/
(
$i
+
1
));
}
for
(
$i
=
0
;
$i
<
(
$nbel
-
9
)
;
$i
++
)
{
array_shift
(
$datas_new
);
array_shift
(
$labels_new
);
array_shift
(
$moys
);
}
$this
->
GraphDraw
(
$this
->
file
,
$datas_new
,
$labels_new
,
$moys
);
}
}
?>
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