Go to the documentation of this file.
27 include_once DOL_DOCUMENT_ROOT.
'/core/class/stats.class.php';
28 include_once DOL_DOCUMENT_ROOT.
'/don/class/don.class.php';
29 include_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
40 public $table_element;
75 $this->socid = ($socid > 0 ? $socid : 0);
76 $this->userid = $userid;
77 $this->cachefilesuffix = $mode;
79 $object =
new Don($this->
db);
80 $this->from = MAIN_DB_PREFIX.$object->table_element.
" as d";
83 $this->where .=
" d.fk_statut > 0";
86 $this->where .=
" AND d.entity = ".$conf->entity;
87 if ($this->userid > 0) {
88 $this->where .=
' WHERE c.fk_user_author = '.((int) $this->userid);
103 $sql =
"SELECT date_format(d.datedon,'%m') as dm, COUNT(*) as nb";
104 $sql .=
" FROM ".$this->from;
106 $sql .=
" AND ".$this->where;
107 $sql .=
" GROUP BY dm";
108 $sql .= $this->
db->order(
'dm',
'DESC');
124 $sql =
"SELECT date_format(d.datedon,'%Y') as dm, COUNT(*) as nb, SUM(d.".$this->field.
")";
125 $sql .=
" FROM ".$this->from;
126 $sql .=
" WHERE ".$this->where;
127 $sql .=
" GROUP BY dm";
128 $sql .= $this->
db->order(
'dm',
'DESC');
142 $sql =
"SELECT date_format(d.datedon,'%Y') as year, COUNT(*) as nb, SUM(d.".$this->field.
") as total, AVG(".$this->field.
") as avg";
143 $sql .=
" FROM ".$this->from;
144 $sql .=
" WHERE ".$this->where;
145 $sql .=
" GROUP BY year";
146 $sql .= $this->
db->order(
'year',
'DESC');
$conf db
API class for accounts.
__construct($db, $socid, $mode, $userid=0)
Constructor.
Parent class of statistics class.
Class to manage donations.
_getNbByYear($sql)
Return nb of elements by year.
getAllByYear()
Return nb, total and average.
_getAllByYear($sql)
Return nb of elements, total amount and avg amount each year.
dol_get_first_day($year, $month=1, $gm=false)
Return GMT time for first day of a month or year.
dol_get_last_day($year, $month=12, $gm=false)
Return GMT time for last day of a month or year.
getNbByYear()
Return shipments number per year.
getNbByMonth($year, $format=0)
Return shipment number by month for a year.
_getNbByMonth($year, $sql, $format=0)
Renvoie le nombre de documents par mois pour une annee donnee Return number of documents per month fo...
Class to manage donations statistics.