dolibarr 20.0.2
Stats Class Reference

Parent class of statistics class. More...

Inheritance diagram for Stats:

Public Member Functions

 getNbByMonthWithPrevYear ($endyear, $startyear, $cachedelay=0, $format=0, $startmonth=1)
 Return nb of elements by month for several years.
 
 getAmountByMonthWithPrevYear ($endyear, $startyear, $cachedelay=0, $format=0, $startmonth=1)
 Return amount of elements by month for several years.
 
 getAverageByMonthWithPrevYear ($endyear, $startyear)
 Return average of entity by month for several years.
 
 getAllByProductEntry ($year, $cachedelay=0, $limit=10)
 Return count, and sum of products.
 

Protected Member Functions

 getNbByMonth ($year, $format=0)
 
 getAmountByMonth ($year, $format=0)
 
 getAverageByMonth ($year)
 
 _getNbByYear ($sql)
 Return nb of elements by year.
 
 _getAllByYear ($sql)
 Return nb of elements, total amount and avg amount each year.
 
 _getNbByMonth ($year, $sql, $format=0)
 Renvoie le nombre de documents par mois pour une annee donnee Return number of documents per month for a given year.
 
 _getAmountByMonth ($year, $sql, $format=0)
 Return the amount per month for a given year.
 
 _getAverageByMonth ($year, $sql, $format=0)
 Return the amount average par month for a given year.
 
 _getAllByProduct ($sql, $limit=10)
 Return number or total of product refs.
 
 _getAmountByYear ($sql)
 Returns the summed amounts per year for a given number of past years ending now.
 

Detailed Description

Parent class of statistics class.

Definition at line 31 of file stats.class.php.

Member Function Documentation

◆ _getAllByProduct()

Stats::_getAllByProduct ( $sql,
$limit = 10 )
protected

Return number or total of product refs.

Parameters
string$sqlSQL
int$limitLimit
Returns
array<int<0,11>,array{0:int<1,12>,1:int|float}> Array of total of product refs each month

Definition at line 656 of file stats.class.php.

References dol_print_error(), and dol_syslog().

Referenced by CommandeStats\getAllByProduct(), FactureStats\getAllByProduct(), FichinterStats\getAllByProduct(), and PropaleStats\getAllByProduct().

◆ _getAllByYear()

◆ _getAmountByMonth()

Stats::_getAmountByMonth ( $year,
$sql,
$format = 0 )
protected

Return the amount per month for a given year.

Parameters
int$yearYear
string$sqlSQL
int$format0=Label of abscissa is a translated text, 1=Label of abscissa is month number, 2=Label of abscissa is first letter of month
Returns
array<int<0,11>,array{0:int<1,12>,1:int|float}> Array of nb each month

Definition at line 542 of file stats.class.php.

References dol_print_error(), and dol_syslog().

Referenced by AdherentStats\getAmountByMonth(), CommandeStats\getAmountByMonth(), DeplacementStats\getAmountByMonth(), DonationStats\getAmountByMonth(), ExpeditionStats\getAmountByMonth(), ExpenseReportStats\getAmountByMonth(), FactureStats\getAmountByMonth(), FichinterStats\getAmountByMonth(), ProjectStats\getAmountByMonth(), PropaleStats\getAmountByMonth(), ReceptionStats\getAmountByMonth(), SalariesStats\getAmountByMonth(), TicketStats\getAmountByMonth(), and ProjectStats\getWeightedAmountByMonth().

◆ _getAmountByYear()

Stats::_getAmountByYear ( $sql)
protected

Returns the summed amounts per year for a given number of past years ending now.

Parameters
string$sqlSQL
Returns
array<int,array{0:int,1:int}> Array of sum of amounts

Definition at line 695 of file stats.class.php.

Referenced by FactureStats\getAmountByYear().

◆ _getAverageByMonth()

Stats::_getAverageByMonth ( $year,
$sql,
$format = 0 )
protected

Return the amount average par month for a given year.

Parameters
int$yearYear
string$sqlSQL
int$format0=Label of abscissa is a translated text, 1=Label of abscissa is month number, 2=Label of abscissa is first letter of month
Returns
array<int<0,11>,array{0:int<1,12>,1:int|float}> Array of average each month

Definition at line 599 of file stats.class.php.

References dol_print_error(), and dol_syslog().

Referenced by AdherentStats\getAverageByMonth(), CommandeStats\getAverageByMonth(), DeplacementStats\getAverageByMonth(), DonationStats\getAverageByMonth(), ExpeditionStats\getAverageByMonth(), ExpenseReportStats\getAverageByMonth(), FactureStats\getAverageByMonth(), FichinterStats\getAverageByMonth(), ProjectStats\getAverageByMonth(), PropaleStats\getAverageByMonth(), ReceptionStats\getAverageByMonth(), SalariesStats\getAverageByMonth(), TaskStats\getAverageByMonth(), and TicketStats\getAverageByMonth().

◆ _getNbByMonth()

Stats::_getNbByMonth ( $year,
$sql,
$format = 0 )
protected

Renvoie le nombre de documents par mois pour une annee donnee Return number of documents per month for a given year.

Parameters
int$yearYear
string$sqlSQL
int$format0=Label of abscissa is a translated text, 1=Label of abscissa is month number, 2=Label of abscissa is first letter of month
Returns
array<int<0,11>,array{0:int<1,12>,1:int}> Array of nb each month

Definition at line 485 of file stats.class.php.

References dol_print_error(), and dol_syslog().

Referenced by AdherentStats\getNbByMonth(), CommandeStats\getNbByMonth(), DeplacementStats\getNbByMonth(), DonationStats\getNbByMonth(), ExpeditionStats\getNbByMonth(), ExpenseReportStats\getNbByMonth(), FactureStats\getNbByMonth(), FichinterStats\getNbByMonth(), ProjectStats\getNbByMonth(), PropaleStats\getNbByMonth(), ReceptionStats\getNbByMonth(), SalariesStats\getNbByMonth(), TaskStats\getNbByMonth(), TicketStats\getNbByMonth(), and ProjectStats\getTransformRateByMonth().

◆ _getNbByYear()

◆ getAllByProductEntry()

Stats::getAllByProductEntry ( $year,
$cachedelay = 0,
$limit = 10 )

Return count, and sum of products.

Parameters
int$yearYear
int$cachedelayDelay we accept for cache file (0=No read, no save of cache, -1=No read but save)
int$limitLimit
Returns
array<int<0,11>,array{0:int<1,12>,1:int|float}> Array of values

@phpstan-ignore-next-line

Definition at line 327 of file stats.class.php.

References dol_filemtime(), dol_is_dir(), dol_mkdir(), dol_now(), dol_syslog(), and dolChmod().

◆ getAmountByMonth()

Stats::getAmountByMonth ( $year,
$format = 0 )
abstractprotected
Parameters
int$yearyear number
int$format0=Label of abscissa is a translated text, 1=Label of abscissa is month number, 2=Label of abscissa is first letter of month
Returns
array<int<0,11>,array{0:int<1,12>,1:int|float}> Array of values by month

Reimplemented in AdherentStats, CommandeStats, DeplacementStats, DonationStats, ExpeditionStats, ExpenseReportStats, FactureStats, FichinterStats, ProjectStats, PropaleStats, ReceptionStats, SalariesStats, TaskStats, and TicketStats.

Referenced by getAmountByMonthWithPrevYear().

◆ getAmountByMonthWithPrevYear()

Stats::getAmountByMonthWithPrevYear ( $endyear,
$startyear,
$cachedelay = 0,
$format = 0,
$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.

Parameters
int$endyearStart year
int$startyearEnd year
int$cachedelayDelay we accept for cache file (0=No read, no save of cache, -1=No read but save)
int$format0=Label of abscissa is a translated text, 1=Label of abscissa is month number, 2=Label of abscissa is first letter of month
int$startmonthmonth of the fiscal year start min 1 max 12 ; if 1 = january
Returns
array<int<0,11>,array<string|int|float>> Array of values

Definition at line 197 of file stats.class.php.

References dol_filemtime(), dol_is_dir(), dol_mkdir(), dol_now(), dol_syslog(), dolChmod(), and getAmountByMonth().

◆ getAverageByMonth()

Stats::getAverageByMonth ( $year)
abstractprotected
Parameters
int$yearyear number
Returns
array<int<0,11>,array{0:int<1,12>,1:int|float}> Array of values

Reimplemented in AdherentStats, CommandeStats, DeplacementStats, DonationStats, ExpeditionStats, ExpenseReportStats, FactureStats, FichinterStats, ProjectStats, PropaleStats, ReceptionStats, SalariesStats, TaskStats, and TicketStats.

Referenced by getAverageByMonthWithPrevYear().

◆ getAverageByMonthWithPrevYear()

Stats::getAverageByMonthWithPrevYear ( $endyear,
$startyear )

Return average of entity by month for several years.

Parameters
int$endyearStart year
int$startyearEnd year
Returns
array<array<int|float>> Array of values

Definition at line 292 of file stats.class.php.

References getAverageByMonth().

◆ getNbByMonth()

Stats::getNbByMonth ( $year,
$format = 0 )
abstractprotected
Parameters
int$yearnumber
int$format0=Label of abscissa is a translated text, 1=Label of abscissa is month number, 2=Label of abscissa is first letter of month
Returns
array<int<0,11>,array{0:int<1,12>,1:int}> Array of nb each month

Reimplemented in AdherentStats, CommandeStats, DeplacementStats, DonationStats, ExpeditionStats, ExpenseReportStats, FactureStats, FichinterStats, ProjectStats, PropaleStats, ReceptionStats, SalariesStats, TaskStats, and TicketStats.

Referenced by getNbByMonthWithPrevYear().

◆ getNbByMonthWithPrevYear()

Stats::getNbByMonthWithPrevYear ( $endyear,
$startyear,
$cachedelay = 0,
$format = 0,
$startmonth = 1 )

Return nb of elements by month for several years.

Parameters
int$endyearStart year
int$startyearEnd year
int$cachedelayDelay we accept for cache file (0=No read, no save of cache, -1=No read but save)
int$format0=Label of abscissa is a translated text, 1=Label of abscissa is month number, 2=Label of abscissa is first letter of month
int$startmonthmonth of the fiscal year start min 1 max 12 ; if 1 = january
Returns
array<int<0,11>,array{0:int<1,12>,1:int}> Array of values

Definition at line 95 of file stats.class.php.

References dol_filemtime(), dol_is_dir(), dol_mkdir(), dol_now(), dol_syslog(), dolChmod(), and getNbByMonth().


The documentation for this class was generated from the following file: