| Line 190... |
Line 190... |
| 190 |
$date_from = $this->request->query('date_from');
|
190 |
$date_from = $this->request->query('date_from');
|
| 191 |
$date_to = $this->request->query('date_to');
|
191 |
$date_to = $this->request->query('date_to');
|
| 192 |
if(!empty($date_to)||!empty($date_from)){
|
192 |
if(!empty($date_to)||!empty($date_from)){
|
| 193 |
$otherSql="SELECT a.name, COUNT( r.id ) AS count FROM `retailerlinks` r LEFT JOIN agents a ON r.agent_id = a.id join users u on r.user_id=u.id WHERE DATE( r.activated ) BETWEEN '$date_from' AND '$date_to' and r.user_id is not null and date(u.activation_time)=BETWEEN '$date_from' AND '$date_to' GROUP BY a.id";
|
193 |
$otherSql="SELECT a.name, COUNT( r.id ) AS count FROM `retailerlinks` r LEFT JOIN agents a ON r.agent_id = a.id join users u on r.user_id=u.id WHERE DATE( r.activated ) BETWEEN '$date_from' AND '$date_to' and r.user_id is not null and date(u.activation_time)=BETWEEN '$date_from' AND '$date_to' GROUP BY a.id";
|
| 194 |
|
194 |
|
| 195 |
$sql = "SELECT DATE( created ) AS date, utm_campaign,referrer , COUNT( id ) AS count FROM users WHERE DATE(created) BETWEEN '$date_from' AND '$date_to' AND (utm_campaign IS NOT NULL OR referrer IS NOT NULL) GROUP BY DATE( created) ,utm_campaign,referrer";
|
195 |
$sql = "SELECT DATE( created ) AS date, utm_campaign,referrer , COUNT( id ) AS count FROM users WHERE DATE(activation_time) BETWEEN '$date_from' AND '$date_to' AND (utm_campaign IS NOT NULL OR referrer IS NOT NULL) GROUP BY DATE( created) ,utm_campaign,referrer";
|
| 196 |
} else{
|
196 |
} else{
|
| 197 |
$otherSql="SELECT a.name, COUNT( r.id ) AS count FROM `retailerlinks` r LEFT JOIN agents a ON r.agent_id = a.id join users u on r.user_id=u.id WHERE DATE( r.activated ) = CURDATE( ) and r.user_id is not null and date(u.activation_time)=curdate() GROUP BY a.id";
|
197 |
$otherSql="SELECT a.name, COUNT( r.id ) AS count FROM `retailerlinks` r LEFT JOIN agents a ON r.agent_id = a.id join users u on r.user_id=u.id WHERE DATE( r.activated ) = CURDATE( ) and r.user_id is not null and date(u.activation_time)=curdate() GROUP BY a.id";
|
| 198 |
$sql = "SELECT DATE( created ) AS date, utm_campaign,referrer , COUNT( id ) AS count FROM users WHERE DATE( created ) = CURDATE() AND (utm_campaign IS NOT NULL OR referrer IS NOT NULL) GROUP BY DATE( created) ,utm_campaign,referrer";
|
198 |
$sql = "SELECT DATE( created ) AS date, utm_campaign,referrer , COUNT( id ) AS count FROM users WHERE DATE(activation_time) = CURDATE() AND (utm_campaign IS NOT NULL OR referrer IS NOT NULL) GROUP BY DATE( created) ,utm_campaign,referrer";
|
| 199 |
}
|
199 |
}
|
| 200 |
$this->loadModel('User');
|
200 |
$this->loadModel('User');
|
| 201 |
$activations = $this->User->query($sql);
|
201 |
$activations = $this->User->query($sql);
|
| 202 |
foreach ($activations as $key => $value) {
|
202 |
foreach ($activations as $key => $value) {
|
| 203 |
if(isset($value['users']['utm_campaign'])){
|
203 |
if(isset($value['users']['utm_campaign'])){
|