add shipping rules

This commit is contained in:
Ludovic CANDELLIER
2023-07-16 14:45:42 +02:00
parent 72a7b270f9
commit 0879b0abf0
459 changed files with 6219 additions and 5416 deletions

View File

@@ -11,6 +11,7 @@ trait DateStats
{
$start = Carbon::now()->startOfMonth($prev);
$end = Carbon::now()->endOfMonth($prev);
return self::countByPeriod($start, $end);
}
@@ -23,12 +24,14 @@ trait DateStats
{
$start = Carbon::now()->startOfMonth($prev);
$end = Carbon::now()->endOfMonth($prev);
return self::avgByPeriod($start, $end, $field);
}
public static function avgByPeriod($start, $end, $field)
{
$c = self::countByPeriod($start, $end);
return $c ? round(self::sumByPeriod($start, $end, $field) / $c, 2) : 0;
}
@@ -36,6 +39,7 @@ trait DateStats
{
$start = Carbon::now()->startOfMonth($prev);
$end = Carbon::now()->endOfMonth($prev);
return self::sumByPeriod($start, $end, $field);
}