|
@@ -118,7 +118,7 @@ class TicketStats extends Stats
|
|
|
*/
|
|
*/
|
|
|
public function getAmountByMonth($year, $format = 0)
|
|
public function getAmountByMonth($year, $format = 0)
|
|
|
{
|
|
{
|
|
|
- $sql = "SELECT date_format(datec,'%m') as dm, sum(".$this->field.")";
|
|
|
|
|
|
|
+ $sql = "SELECT date_format(datec,'%m') as dm, sum(".$this->field."::numeric)";
|
|
|
$sql .= " FROM ".$this->from;
|
|
$sql .= " FROM ".$this->from;
|
|
|
$sql .= " WHERE date_format(datec,'%Y') = '".$this->db->escape($year)."'";
|
|
$sql .= " WHERE date_format(datec,'%Y') = '".$this->db->escape($year)."'";
|
|
|
$sql .= " AND ".$this->where;
|
|
$sql .= " AND ".$this->where;
|
|
@@ -138,7 +138,7 @@ class TicketStats extends Stats
|
|
|
*/
|
|
*/
|
|
|
public function getAverageByMonth($year)
|
|
public function getAverageByMonth($year)
|
|
|
{
|
|
{
|
|
|
- $sql = "SELECT date_format(datec,'%m') as dm, avg(".$this->field.")";
|
|
|
|
|
|
|
+ $sql = "SELECT date_format(datec,'%m') as dm, avg(".$this->field."::numeric)";
|
|
|
$sql .= " FROM ".$this->from;
|
|
$sql .= " FROM ".$this->from;
|
|
|
$sql .= " WHERE date_format(datec,'%Y') = '".$this->db->escape($year)."'";
|
|
$sql .= " WHERE date_format(datec,'%Y') = '".$this->db->escape($year)."'";
|
|
|
$sql .= " AND ".$this->where;
|
|
$sql .= " AND ".$this->where;
|
|
@@ -155,7 +155,7 @@ class TicketStats extends Stats
|
|
|
*/
|
|
*/
|
|
|
public function getAllByYear()
|
|
public function getAllByYear()
|
|
|
{
|
|
{
|
|
|
- $sql = "SELECT date_format(datec,'%Y') as year, count(*) as nb, sum(".$this->field.") as total, avg(".$this->field.") as avg";
|
|
|
|
|
|
|
+ $sql = "SELECT date_format(datec,'%Y') as year, count(*) as nb, sum(".$this->field."::numeric) as total, avg(".$this->field."::numeric) as avg";
|
|
|
$sql .= " FROM ".$this->from;
|
|
$sql .= " FROM ".$this->from;
|
|
|
$sql .= " WHERE ".$this->where;
|
|
$sql .= " WHERE ".$this->where;
|
|
|
$sql .= " GROUP BY year";
|
|
$sql .= " GROUP BY year";
|