TicketStats
class TicketStats extends Stats (View source)
Class to manage the ticket stats
Properties
| protected DoliDB | $db | from Stats | |
| protected array<string, int> | $lastfetchdate | from Stats | |
| string | $cachefilesuffix | from Stats | |
| string | $from | from Stats | |
| string | $where | from Stats | |
| string | $from_line | from Stats | |
| string | $field_date | from Stats | |
| string | $field | from Stats | |
| string | $field_line | from Stats | |
| string | $error | from Stats | |
| int | $year | from Stats | |
| int | $month | from Stats | |
| string | $table_element | ||
| int | $socid | ||
| int | $userid |
Methods
Return the number of tickets per month for a given year
Return nb of elements by month for several years
Return the number of tickets for a month and a given year
Return amount of elements by month for several years.
Return average amount
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
Renvoie le nombre de tickets par annee
Return nb, total and average
Details
array<int<0, 11>, array{0: int<1, 12>, 1: int}>
getNbByMonth(int $year, int $format = 0)
Return the number of tickets per month for a given year
@param int $year Year to scan
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 number of tickets for a month and a given year
@param int $year Year to scan
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.
array<int<0, 11>, array{0: int<1, 12>, 1: int|float}>
getAverageByMonth(int $year)
Return average amount
@param int $year Year to scan
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
void
__construct(DoliDB $db, int $socid = 0, int|int[] $userid = 0)
Constructor
getNbByYear()
Renvoie le nombre de tickets par annee
@return array<array{0:int,1:int}> Array of values
getAllByYear()
Return nb, total and average
@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