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) $this->where .=
' WHERE c.fk_user_author = '.$this->userid;
101 $sql =
"SELECT date_format(d.datedon,'%m') as dm, COUNT(*) as nb";
102 $sql .=
" FROM ".$this->from;
104 $sql .=
" AND ".$this->where;
105 $sql .=
" GROUP BY dm";
106 $sql .= $this->
db->order(
'dm',
'DESC');
122 $sql =
"SELECT date_format(d.datedon,'%Y') as dm, COUNT(*) as nb, SUM(d.".$this->field.
")";
123 $sql .=
" FROM ".$this->from;
124 $sql .=
" WHERE ".$this->where;
125 $sql .=
" GROUP BY dm";
126 $sql .= $this->
db->order(
'dm',
'DESC');
140 $sql =
"SELECT date_format(d.datedon,'%Y') as year, COUNT(*) as nb, SUM(d.".$this->field.
") as total, AVG(".$this->field.
") as avg";
141 $sql .=
" FROM ".$this->from;
142 $sql .=
" WHERE ".$this->where;
143 $sql .=
" GROUP BY year";
144 $sql .= $this->
db->order(
'year',
'DESC');
Parent class of statistics class.
__construct($db, $socid, $mode, $userid=0)
Constructor.
getNbByYear()
Return shipments number per year.
getNbByMonth($year, $format=0)
Return shipment number by month for a year.
dol_get_first_day($year, $month=1, $gm=false)
Return GMT time for first day of a month or year.
getAllByYear()
Return nb, total and average.
_getNbByMonth($year, $sql, $format=0)
Renvoie le nombre de documents par mois pour une annee donnee Return number of documents per month fo...
$conf db
API class for accounts.
_getAllByYear($sql)
Return nb of elements, total amount and avg amount each year.
dol_get_last_day($year, $month=12, $gm=false)
Return GMT time for last day of a month or year.
Class to manage donations.
Class to manage donations statistics.
_getNbByYear($sql)
Return nb of elements by year.