18 include_once DOL_DOCUMENT_ROOT.
'/core/class/stats.class.php';
19 include_once DOL_DOCUMENT_ROOT.
'/core/lib/date.lib.php';
41 require_once
'task.class.php';
42 $this->task =
new Task($this->
db);
55 global $conf, $user, $langs;
60 $sql .=
" COUNT(t.rowid), t.priority";
61 $sql .=
" FROM ".MAIN_DB_PREFIX.
"projet_task as t INNER JOIN ".MAIN_DB_PREFIX.
"projet as p ON p.rowid = t.fk_projet";
62 if (!$user->rights->societe->client->voir && !$user->soc_id)
63 $sql .=
" INNER JOIN ".MAIN_DB_PREFIX.
"societe_commerciaux as sc ON sc.fk_soc=t.fk_soc AND sc.fk_user=".$user->id;
66 $sql .=
" GROUP BY t.priority";
71 dol_syslog(get_class($this).
'::'.__METHOD__.
"", LOG_DEBUG);
79 if ($i < $limit || $num == $limit)
85 }
else $other += $row[1];
90 $langs->transnoentitiesnoconv(
"Other"),
95 $this->error =
"Error ".$this->db->lasterror();
96 dol_syslog(get_class($this).
'::'.__METHOD__.
' '.$this->error, LOG_ERR);
110 global $conf, $user, $langs;
116 $sql =
"SELECT date_format(t.datec,'%Y') as year, COUNT(t.rowid) as nb";
117 $sql .=
" FROM ".MAIN_DB_PREFIX.
"projet_task as t INNER JOIN ".MAIN_DB_PREFIX.
"projet as p ON p.rowid = t.fk_projet";
118 if (!$user->rights->societe->client->voir && !$user->soc_id)
119 $sql .=
" INNER JOIN ".MAIN_DB_PREFIX.
"societe_commerciaux as sc ON sc.fk_soc=t.fk_soc AND sc.fk_user=".$user->id;
121 $sql .=
" GROUP BY year";
122 $sql .= $this->
db->order(
'year',
'DESC');
138 $sqlwhere[] =
' t.entity IN ('.getEntity(
'project').
')';
140 if (!empty($this->userid))
141 $sqlwhere[] =
' t.fk_user_resp='.$this->userid;
143 if (!empty($this->socid))
144 $sqlwhere[] =
' p.fk_soc='.$this->socid;
145 if (!empty($this->year) && empty($this->yearmonth))
146 $sqlwhere[] =
" date_format(t.datec,'%Y')='".$this->db->escape($this->year).
"'";
147 if (!empty($this->yearmonth))
150 if (!empty($this->status))
151 $sqlwhere[] =
" t.priority IN (".$this->priority.
")";
153 if (count($sqlwhere) > 0) {
154 $sqlwhere_str =
' WHERE '.implode(
' AND ', $sqlwhere);
157 return $sqlwhere_str;
171 $this->yearmonth = $year;
173 $sql =
"SELECT date_format(t.datec,'%m') as dm, COUNT(t.rowid) as nb";
174 $sql .=
" FROM ".MAIN_DB_PREFIX.
"projet_task as t INNER JOIN ".MAIN_DB_PREFIX.
"projet as p ON p.rowid = t.fk_projet";
175 if (!$user->rights->societe->client->voir && !$user->soc_id)
176 $sql .=
" INNER JOIN ".MAIN_DB_PREFIX.
"societe_commerciaux as sc ON sc.fk_soc=t.fk_soc AND sc.fk_user=".$user->id;
178 $sql .=
" GROUP BY dm";
179 $sql .= $this->
db->order(
'dm',
'DESC');
181 $this->yearmonth = 0;
getAllByYear()
Return count, and sum of products.
Parent class of statistics class.
__construct($db)
Constructor of the class.
dol_get_first_day($year, $month=1, $gm=false)
Return GMT time for first day of a month or year.
_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.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename= '', $restricttologhandler= '', $logcontext=null)
Write log message into outputs.
buildWhere()
Build the where part.
getAllTaskByStatus($limit=5)
Return all tasks grouped by status.
Class to manage statistics on project tasks.
_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.
if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) if(!empty($conf->don->enabled)&&$user->rights->don->lire) if(!empty($conf->tax->enabled)&&$user->rights->tax->charges->lire) if(!empty($conf->facture->enabled)&&!empty($conf->commande->enabled)&&$user->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) $resql
Social contributions to pay.
getNbByMonth($year, $format=0)
Return Task number by month for a year.