- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
static public function countHandled()
{
$criteria = new CDbCriteria;
$criteria->select .= ', SUM(`su`.`purchase_stage` = "in-progress") AS sum';
$criteria->having = '`sum` > 0';
$criteria->with = array(
'siteUser' => array(
'with' => array(
'interest'
),
'join' => 'LEFT JOIN `site_users` AS `su` ON '
.'IF(LENGTH(`siteUser`.`phone`) = 11, SUBSTR(`siteUser`.`phone`, 2, 10), `siteUser`.`phone`) = '
.'IF(LENGTH(`su`.`phone`) = 11, SUBSTR(`su`.`phone`, 2, 10), `su`.`phone`)'
)
);
$criteria->scopes = array(
'notDone'
);
$criteria->compare('siteUser.purchase_stage', SiteUsers::PURCHASE_STAGE_LOST);
$criteria->addNotInCondition('interest.reject_reason', array(
SiteUserInterest::REJECT_REASON_TEST,
SiteUserInterest::REJECT_REASON_SERVICE_TO
));
$criteria->addCondition('`su`.`date_modified` >= DATE_SUB(NOW(), INTERVAL 2 DAY)');
$criteria->group = '`t`.`site_users_return_id`';
return self::model()->count($criteria);
}
static public function countCopied()
{
$criteria = new CDbCriteria;
$criteria->select .= ', SUM(`su`.`purchase_stage` = "in-progress") AS sum';
$criteria->having = '`sum` > 0';
$criteria->with = array(
'siteUser' => array(
'with' => array(
'interest'
),
'join' => 'LEFT JOIN `site_users` AS `su` ON '
.'IF(LENGTH(`siteUser`.`phone`) = 11, SUBSTR(`siteUser`.`phone`, 2, 10), `siteUser`.`phone`) = '
.'IF(LENGTH(`su`.`phone`) = 11, SUBSTR(`su`.`phone`, 2, 10), `su`.`phone`)'
)
);
$criteria->scopes = array(
'notDone'
);
$criteria->compare('siteUser.purchase_stage', SiteUsers::PURCHASE_STAGE_LOST);
$criteria->addNotInCondition('interest.reject_reason', array(
SiteUserInterest::REJECT_REASON_TEST,
SiteUserInterest::REJECT_REASON_SERVICE_TO
));
$criteria->addCondition('`su`.`date_created` >= DATE_SUB(NOW(), INTERVAL 2 DAY)');
$criteria->group = '`t`.`site_users_return_id`';
return self::model()->count($criteria);
}
cpZFbWH 25.08.2021 02:56 # 0