ProjectStats
class ProjectStats extends Stats (View source)
Class to manage statistics on projects
Properties
| protected DoliDB | $db | from Stats | |
| protected array<string, int> | $lastfetchdate | from Stats | |
| string | $cachefilesuffix | from Stats | |
| string | $from | ||
| string | $where | ||
| string | $from_line | from Stats | |
| string | $field_date | from Stats | |
| string | $field | ||
| string | $field_line | from Stats | |
| string | $error | from Stats | |
| int | $year | from Stats | |
| int | $month | from Stats | |
| int | $userid | ||
| int | $socid | ||
| int | $status | ||
| string | $opp_status |
Methods
Return Project number by month for a year
Return nb of elements by month for several years
Return the Project amount by month for a year
Return amount of elements by month for several years.
Return average of entity by month
Return average of entity by month for several years
Return count, and sum of products
Renvoie le nombre de documents par mois pour une annee donnee Return number of documents per month for a given year
Return the amount per month for a given year
Return the amount average par month for a given year
Return number or total of product refs
Returns the summed amounts per year for a given number of past years ending now
Return nb, amount of predefined product for year
Return all leads grouped by opportunity status.
Return count, and sum of products
Build the where part
Return amount of elements by month for several years
Return the Project weighted opp amount by month for a year.
Return amount of elements by month for several years
Return the Project transformation rate by month for a year
Details
array<int<0, 11>, array{0: int<1, 12>, 1: int}>
getNbByMonth(int $year, int $format = 0)
Return Project number by month for a year
in
Stats at line 106
array<int<0, 11>, array{0: int<1, 12>, 1: int}>
getNbByMonthWithPrevYear(int $endyear, int $startyear, int $cachedelay = 0, int $format = 0, int $startmonth = 1)
Return nb of elements by month for several years
array<int<0, 11>, array{0: int<1, 12>, 1: int|float}>
getAmountByMonth(int $year, int $format = 0)
Return the Project amount by month for a year
in
Stats at line 208
array<int<0, 11>, array<string|int|float>>
getAmountByMonthWithPrevYear(int $endyear, int $startyear, int $cachedelay = 0, int $format = 0, int $startmonth = 1)
Return amount of elements by month for several years.
Criteria used to build request are defined into the constructor of parent class into xxx/class/xxxstats.class.php The caller of class can add more filters into sql request by adding criteris into the $stats->where property just after calling constructor.
protected array<int<0, 11>, array{0: int<1, 12>, 1: int|float}>
getAverageByMonth(int $year)
Return average of entity by month
in
Stats at line 303
array<array<int|float>>
getAverageByMonthWithPrevYear(int $endyear, int $startyear)
Return average of entity by month for several years
in
Stats at line 338
array<int<0, 11>, array{0: int<1, 12>, 1: int|float}>
getAllByProductEntry(int $year, int $cachedelay = 0, int $limit = 10)
Return count, and sum of products
in
Stats at line 408
protected array<array{0: int, 1: int}>
_getNbByYear(string $sql)
Return nb of elements by year
in
Stats at line 437
protected
_getAllByYear(string $sql)
Return nb of elements, total amount and avg amount each year
in
Stats at line 494
protected array<int<0, 11>, array{0: int<1, 12>, 1: int}>
_getNbByMonth(int $year, string $sql, int<0, 2> $format = 0)
Renvoie le nombre de documents par mois pour une annee donnee Return number of documents per month for a given year
in
Stats at line 551
protected array<int<0, 11>, array{0: int<1, 12>, 1: int|float}>
_getAmountByMonth(int $year, string $sql, int<0, 2> $format = 0)
Return the amount per month for a given year
in
Stats at line 608
protected array<int<0, 11>, array{0: int<1, 12>, 1: int|float}>
_getAverageByMonth($year, string $sql, $format = 0)
Return the amount average par month for a given year
@param int $year Year
in
Stats at line 665
protected array<int<0, 11>, array{0: int<1, 12>, 1: int|float}>
_getAllByProduct($sql, int $limit = 10)
Return number or total of product refs
@param string $sql SQL
in
Stats at line 704
protected array<int, array{0: int, 1: int}>
_getAmountByYear($sql)
Returns the summed amounts per year for a given number of past years ending now
@param string $sql SQL
in
Stats at line 732
array<int<0, 11>, array{0: int<1, 12>, 1: int|float}>
getAllByProduct(int $year, $limit = 0)
Return nb, amount of predefined product for year
__construct(DoliDB $db)
Constructor
array<array{0: string, 1: float}>|int<-1, -1>
getAllProjectByStatus(int $limit = 5)
Return all leads grouped by opportunity status.
Warning: There is no filter on WON/LOST because we want this for statistics.
getAllByYear()
Return count, and sum of products
@return array<array{year:string,nb:string,nb_diff:float,total?:float,avg?:float,weighted?:float,total_diff?:float,avg_diff?:float,avg_weighted?:float}> Array of values
string
buildWhere()
Build the where part
int<-1, -1>|array<int<0, 11>, array{0: string, 1: int, 2?: int, 3?: int, 4?: int}>
getWeightedAmountByMonthWithPrevYear(int $endyear, int $startyear, int $cachedelay = 0, int $wonlostfilter = 1)
Return amount of elements by month for several years
array<int<0, 11>, array{0: int<1, 12>, 1: int|float}>
getWeightedAmountByMonth(int $year, int $wonlostfilter = 1)
Return the Project weighted opp amount by month for a year.
array<int<0, 11>, array<string|float>>|int<-1, -1>
getTransformRateByMonthWithPrevYear(int $endyear, int $startyear, int $cachedelay = 0)
Return amount of elements by month for several years
array<int<0, 11>, array{0: int<1, 12>, 1: int|float}>
getTransformRateByMonth(int $year, int $format = 0)
Return the Project transformation rate by month for a year