diff --git a/GrocyPhpHelper.php b/GrocyPhpHelper.php index bb6b6e45..28c9015b 100644 --- a/GrocyPhpHelper.php +++ b/GrocyPhpHelper.php @@ -46,4 +46,15 @@ class GrocyPhpHelper return $returnArray; } + + public static function SumArrayValue($array, $propertyName) + { + $sum = 0; + foreach($array as $object) + { + $sum += $object->{$propertyName}; + } + + return $sum; + } } diff --git a/views/dashboard.php b/views/dashboard.php index 6d96c9e4..a126cf1c 100644 --- a/views/dashboard.php +++ b/views/dashboard.php @@ -2,7 +2,7 @@