}
}
-
-
return $this->render('index', [
'model' => $model,
'links' => $dates,
if ($type === 'call') {
$userData['name'] = $user['name'];
$userData['memorable_date_count'] = $memorableDateCount;
- $userData['memorable_date'] = $memorableDateExists;
+ // $userData['memorable_date'] = $memorableDateExists;
$userData['last_date'] = $lastDate;
$userData['deals_count'] = $dealsCount;
$userData['total_sum'] = $totalSum;
'last_date',
'deals_count',
'total_sum',
- 'memorable_date_count',
+ // 'memorable_date_count',
'memorable_date',
'name',
]);
$userData['last_date'] = $lastDate;
$userData['deals_count'] = $dealsCount;
$userData['total_sum'] = $totalSum;
- $userData['memorable_date_count'] = $memorableDateCount;
+ // $userData['memorable_date_count'] = $memorableDateCount;
$userData['memorable_date'] = $memorableDateExists;
$userData['name'] = $user['name'];
}
{
$startDate = $startDate ?? date('Y-m-d');
- // $endDate = $endDate ?? date('Y-m-d', strtotime($startDate . ' +7 days'));
- $dateThreeYearsAgo = date('Y-m-d', strtotime("$startDate -3 years"));
+ $monthDay = date('m-d', strtotime($startDate));
+
$salesPhone = Sales::find()
- ->where(['>=', 'date', "$dateThreeYearsAgo 00:00:00"])
- ->andWhere(['<=', 'date', "$dateThreeYearsAgo 23:59:59"])
+ ->where(new \yii\db\Expression("TO_CHAR(date, 'MM-DD') = :monthDay", [':monthDay' => $monthDay]))
+ ->andWhere(new \yii\db\Expression("date >= NOW() - INTERVAL '3 years'"))
->distinct('phone')
->select('phone')
->column();
$memorableDate = UsersEvents::find()
- ->where(['>=', 'date', "$dateThreeYearsAgo 00:00:00"])
- ->andWhere(['<=', 'date', "$dateThreeYearsAgo 23:59:59"])
+ ->where(new \yii\db\Expression("TO_CHAR(date, 'MM-DD') = :monthDay", [':monthDay' => $monthDay]))
->distinct('phone')
->select('phone')
->column();