Go to the documentation of this file.
25 include_once DOL_DOCUMENT_ROOT.
'/core/class/stats.class.php';
26 include_once DOL_DOCUMENT_ROOT.
'/compta/deplacement/class/deplacement.class.php';
36 public $table_element;
58 $this->socid = $socid;
59 $this->userid = $userid;
62 $this->from = MAIN_DB_PREFIX.$object->table_element;
65 $this->where =
" fk_statut > 0";
66 $this->where .=
" AND entity = ".$conf->entity;
67 if ($this->socid > 0) {
68 $this->where .=
" AND fk_soc = ".((int) $this->socid);
70 if (is_array($this->userid) && count($this->userid) > 0) {
71 $this->where .=
' AND fk_user IN ('.$this->db->sanitize(join(
',', $this->userid)).
')';
72 } elseif ($this->userid > 0) {
73 $this->where .=
' AND fk_user = '.((int) $this->userid);
85 $sql =
"SELECT YEAR(dated) as dm, count(*)";
86 $sql .=
" FROM ".$this->from;
87 $sql .=
" GROUP BY dm DESC";
88 $sql .=
" WHERE ".$this->where;
103 $sql =
"SELECT MONTH(dated) as dm, count(*)";
104 $sql .=
" FROM ".$this->from;
105 $sql .=
" WHERE YEAR(dated) = ".((int) $year);
106 $sql .=
" AND ".$this->where;
107 $sql .=
" GROUP BY dm";
108 $sql .= $this->db->order(
'dm',
'DESC');
125 $sql =
"SELECT date_format(dated,'%m') as dm, sum(".$this->field.
")";
126 $sql .=
" FROM ".$this->from;
127 $sql .=
" WHERE date_format(dated,'%Y') = '".$this->db->escape($year).
"'";
128 $sql .=
" AND ".$this->where;
129 $sql .=
" GROUP BY dm";
130 $sql .= $this->db->order(
'dm',
'DESC');
145 $sql =
"SELECT date_format(dated,'%m') as dm, avg(".$this->field.
")";
146 $sql .=
" FROM ".$this->from;
147 $sql .=
" WHERE date_format(dated,'%Y') = '".$this->db->escape($year).
"'";
148 $sql .=
" AND ".$this->where;
149 $sql .=
" GROUP BY dm";
150 $sql .= $this->db->order(
'dm',
'DESC');
162 $sql =
"SELECT date_format(dated,'%Y') as year, count(*) as nb, sum(".$this->field.
") as total, avg(".$this->field.
") as avg";
163 $sql .=
" FROM ".$this->from;
164 $sql .=
" WHERE ".$this->where;
165 $sql .=
" GROUP BY year";
166 $sql .= $this->db->order(
'year',
'DESC');
__construct($db, $socid=0, $userid=0)
Constructor.
getNbByYear()
Renvoie le nombre de facture par annee.
getAmountByMonth($year, $format=0)
Renvoie le montant de facture par mois pour une annee donnee.
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.
Classe permettant la gestion des stats des deplacements et notes de frais.
getAverageByMonth($year)
Return average amount.
getNbByMonth($year, $format=0)
Renvoie le nombre de facture par mois pour une annee donnee.
_getAllByYear($sql)
Return nb of elements, total amount and avg amount each year.
if(isModEnabled('facture') && $user->hasRight('facture', 'lire')) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') && $user->hasRight('don', 'lire')) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->hasRight("commande", "lire") &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $sql
Social contributions to pay.
_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 trips and working credit notes.
getAllByYear()
Return nb, total and average.
_getAverageByMonth($year, $sql, $format=0)
Renvoie le montant moyen par mois pour une annee donnee Return the amount average par month for a giv...