Go to the documentation of this file.
26 include_once DOL_DOCUMENT_ROOT.
'/core/class/stats.class.php';
27 include_once DOL_DOCUMENT_ROOT.
'/adherents/class/subscription.class.php';
38 public $table_element;
61 $this->socid = $socid;
62 $this->userid = $userid;
66 $this->from = MAIN_DB_PREFIX.$object->table_element.
" as p";
67 $this->from .=
", ".MAIN_DB_PREFIX.
"adherent as m";
69 $this->field =
'subscription';
71 $this->where .=
" m.statut != -1";
72 $this->where .=
" AND p.fk_adherent = m.rowid AND m.entity IN (".getEntity(
'adherent').
")";
74 if ($this->memberid) {
75 $this->where .=
" AND m.rowid = ".((int) $this->memberid);
92 $sql =
"SELECT date_format(p.dateadh,'%m') as dm, count(*)";
93 $sql .=
" FROM ".$this->from;
95 $sql .=
" WHERE ".dolSqlDateFilter(
'p.dateadh', 0, 0, (
int) $year, 1);
96 $sql .=
" AND ".$this->where;
97 $sql .=
" GROUP BY dm";
98 $sql .= $this->
db->order(
'dm',
'DESC');
112 $sql =
"SELECT date_format(p.dateadh,'%Y') as dm, count(*)";
113 $sql .=
" FROM ".$this->from;
115 $sql .=
" WHERE ".$this->where;
116 $sql .=
" GROUP BY dm";
117 $sql .= $this->
db->order(
'dm',
'DESC');
133 $sql =
"SELECT date_format(p.dateadh,'%m') as dm, sum(p.".$this->field.
")";
134 $sql .=
" FROM ".$this->from;
136 $sql .=
" WHERE ".dolSqlDateFilter(
'p.dateadh', 0, 0, (
int) $year, 1);
137 $sql .=
" AND ".$this->where;
138 $sql .=
" GROUP BY dm";
139 $sql .= $this->
db->order(
'dm',
'DESC');
154 $sql =
"SELECT date_format(p.dateadh,'%m') as dm, avg(p.".$this->field.
")";
155 $sql .=
" FROM ".$this->from;
157 $sql .=
" WHERE ".dolSqlDateFilter(
'p.dateadh', 0, 0, (
int) $year, 1);
158 $sql .=
" AND ".$this->where;
159 $sql .=
" GROUP BY dm";
160 $sql .= $this->
db->order(
'dm',
'DESC');
175 $sql =
"SELECT date_format(p.dateadh,'%Y') as year, count(*) as nb, sum(".$this->field.
") as total, avg(".$this->field.
") as avg";
176 $sql .=
" FROM ".$this->from;
178 $sql .=
" WHERE ".$this->where;
179 $sql .=
" GROUP BY year";
180 $sql .= $this->
db->order(
'year',
'DESC');
$conf db
API class for accounts.
getAllByYear()
Return nb, total and average.
getAverageByMonth($year)
Return average amount each month.
getNbByYear()
Return the number of subscriptions by year.
Parent class of statistics class.
_getNbByYear($sql)
Return nb of elements by year.
_getAmountByMonth($year, $sql, $format=0)
Return the amount per month for a given year.
getAmountByMonth($year, $format=0)
Return the number of subscriptions by month for a given year.
Class to manage statistics of members.
_getAllByYear($sql)
Return nb of elements, total amount and avg amount each year.
Class to manage subscriptions of foundation members.
__construct($db, $socid=0, $userid=0)
Constructor.
_getNbByMonth($year, $sql, $format=0)
Renvoie le nombre de documents par mois pour une annee donnee Return number of documents per month fo...
getNbByMonth($year, $format=0)
Return the number of proposition by month for a given year.
_getAverageByMonth($year, $sql, $format=0)
Renvoie le montant moyen par mois pour une annee donnee Return the amount average par month for a giv...