class CustomStats extends Stats (View source)

CustomStats class

Properties

protected string $from
protected string $join
protected string $where
protected string $date_field
protected string $amount_field

Methods

__construct($table_name, $join = '', $where = '', $date_field = 'creation_date', $amount_field = '')

Constructor

array
getNbByMonth(int $year, int $format)

Return object number by month for a year

array
getNbByYear()

Return object number per year

array
getAllByYear()

Return nb, total and average

array
getAmountByMonth(int $year, int $format)

Return object amount by month for a year

array
getAverageByMonth(int $year, int $format)

Return object amount average by month for a year

Details

__construct($table_name, $join = '', $where = '', $date_field = 'creation_date', $amount_field = '')

Constructor

Parameters

$table_name Table name
$join Join clause (without ', ')
$where Where clause (without 'WHERE ' or 'AND ')
$date_field Date field name
$amount_field Amount field name

array getNbByMonth(int $year, int $format)

Return object number by month for a year

Parameters

int $year Year to scan
int $format 0=Label of absiss is a translated text, 1=Label of absiss is month number, 2=Label of absiss is first letter of month

Return Value

array Array with number by month

array getNbByYear()

Return object number per year

Return Value

array Array with number by year

array getAllByYear()

Return nb, total and average

Return Value

array Array of values

array getAmountByMonth(int $year, int $format)

Return object amount by month for a year

Parameters

int $year Year to scan
int $format 0=Label of absiss is a translated text, 1=Label of absiss is month number, 2=Label of absiss is first letter of month

Return Value

array Array with amount by month

array getAverageByMonth(int $year, int $format)

Return object amount average by month for a year

Parameters

int $year year for stats
int $format 0=Label of absiss is a translated text, 1=Label of absiss is month number, 2=Label of absiss is first letter of month

Return Value

array array with number by month