| Line 141... |
Line 141... |
| 141 |
$fortnightIds[] = 2*(date('m',time())-1)+1;
|
141 |
$fortnightIds[] = 2*(date('m',time())-1)+1;
|
| 142 |
$fortnightIds[] = 2*(date('m',time())-1)+2;
|
142 |
$fortnightIds[] = 2*(date('m',time())-1)+2;
|
| 143 |
}
|
143 |
}
|
| 144 |
$cashBacks = array();
|
144 |
$cashBacks = array();
|
| 145 |
foreach ($fortnightIds AS $fortnightId){
|
145 |
foreach ($fortnightIds AS $fortnightId){
|
| - |
|
146 |
$appInstalls = array();
|
| 146 |
$options = array('conditions'=>array('fortnightOfYear'=>$fortnightId,'user_id'=>$this->Auth->User('id')),'fields'=>array('status','amount'));
|
147 |
$options = array('conditions'=>array('fortnightOfYear'=>$fortnightId,'user_id'=>$this->Auth->User('id')),'fields'=>array('status','amount'));
|
| 147 |
$temp = $this->UserAppCashback->find('first',$options);
|
148 |
$temp = $this->UserAppCashback->find('first',$options);
|
| 148 |
if(isset($temp) && !empty($temp)){
|
149 |
if(isset($temp) && !empty($temp)){
|
| 149 |
$cashBacks[$temp['UserAppCashback']['status']]['amount'] = $temp['UserAppCashback']['amount'];
|
150 |
$cashBacks[$temp['UserAppCashback']['status']]['amount'] = $temp['UserAppCashback']['amount'];
|
| - |
|
151 |
$cashBacks[$temp['UserAppCashback']['status']]['fortnightOfYear'] = $fortnightId;
|
| - |
|
152 |
// debug($fortnightId);
|
| 150 |
$options = array('conditions'=>array('fortnightOfYear'=>$fortnightId,'user_id'=>$this->Auth->User('id')),'fields'=>array('sum(payoutAmount) AS amount','sum(installCount) AS installs','transaction_date'),'group'=>'transaction_date');
|
153 |
$options = array('conditions'=>array('fortnightOfYear'=>$fortnightId,'user_id'=>$this->Auth->User('id')),'fields'=>array('sum(payoutAmount) AS amount','sum(installCount) AS installs','transaction_date'),'group'=>'transaction_date');
|
| 151 |
$installs = $this->UserAppInstall->find('all',$options);
|
154 |
$installs = $this->UserAppInstall->find('all',$options);
|
| 152 |
if(!empty($installs)){
|
155 |
if(!empty($installs)){
|
| 153 |
foreach ($installs as $key => $value) {
|
156 |
foreach ($installs as $key => $value) {
|
| 154 |
$appInstalls[$value['UserAppInstall']['transaction_date']] = $value[0];
|
157 |
$appInstalls[$value['UserAppInstall']['transaction_date']] = $value[0];
|