| Line 115... |
Line 115... |
| 115 |
$pendingCashbacks = $this->make_request($url,null);
|
115 |
$pendingCashbacks = $this->make_request($url,null);
|
| 116 |
//Get credited cashbacks
|
116 |
//Get credited cashbacks
|
| 117 |
$url = $this->apihost.'refund/user/'.$userId;
|
117 |
$url = $this->apihost.'refund/user/'.$userId;
|
| 118 |
$creditedCashbacks = $this->make_request($url,null);
|
118 |
$creditedCashbacks = $this->make_request($url,null);
|
| 119 |
|
119 |
|
| - |
|
120 |
$creditKeyArray = array();
|
| - |
|
121 |
$creditValueArray = array();
|
| - |
|
122 |
|
| 120 |
if(!empty($creditedCashbacks)){
|
123 |
if(!empty($creditedCashbacks)){
|
| 121 |
foreach ($creditedCashbacks['data'] as $key => $value) {
|
124 |
foreach ($creditedCashbacks['data'] as $key => $value) {
|
| 122 |
$creditedAmount += $value['userAmount'];
|
125 |
$creditedAmount += $value['userAmount'];
|
| 123 |
$data = array('subOrders.batchId'=>$value['batch']);
|
126 |
$data = array('subOrders.batchId'=>$value['batch']);
|
| 124 |
$jsonVar = json_encode($data);
|
127 |
$jsonVar = json_encode($data);
|
| 125 |
$url = $this->apihost."storeorder/user/".$this->Auth->User('id')."?page=1&window=50&searchMap=$jsonVar";
|
128 |
$url = $this->apihost."storeorder/user/".$this->Auth->User('id')."?page=1&window=50&searchMap=$jsonVar";
|
| 126 |
$creditedOrders[$value['batch']] = $this->make_request($url,null);
|
129 |
$creditedOrders[$value['batch']] = $this->make_request($url,null);
|
| - |
|
130 |
|
| - |
|
131 |
$creditValueArray['amount'] = $value['userAmount'];
|
| - |
|
132 |
$creditValueArray['type'] = 'Order';
|
| - |
|
133 |
$creditValueArray['fortbatchid'] = $value['batch'];
|
| - |
|
134 |
$creditKeyArray[date('Y-m-d',strtotime($value['timestamp']))] = $creditValueArray;
|
| 127 |
// debug($creditedOrders);
|
135 |
// debug($creditedOrders);
|
| 128 |
}
|
136 |
}
|
| 129 |
}
|
137 |
}
|
| 130 |
$storemapping = Configure::read('storemapping');
|
138 |
$storemapping = Configure::read('storemapping');
|
| 131 |
$activestores = Configure::read('activestores');
|
139 |
$activestores = Configure::read('activestores');
|
| Line 140... |
Line 148... |
| 140 |
}else{
|
148 |
}else{
|
| 141 |
$fortnightIds[] = 2*(date('m',time())-1);
|
149 |
$fortnightIds[] = 2*(date('m',time())-1);
|
| 142 |
$fortnightIds[] = 2*(date('m',time())-1)+1;
|
150 |
$fortnightIds[] = 2*(date('m',time())-1)+1;
|
| 143 |
}
|
151 |
}
|
| 144 |
$cashBacks = array();
|
152 |
$cashBacks = array();
|
| - |
|
153 |
|
| - |
|
154 |
// Approved Start
|
| - |
|
155 |
|
| 145 |
$url = $this->apihost.'appUserCashBack/'.$userId.'/Approved';
|
156 |
$url = $this->apihost.'appUserCashBack/'.$userId.'/Approved';
|
| 146 |
$getapproved = $this->make_request($url,null);
|
157 |
$getapproved = $this->make_request($url,null);
|
| 147 |
// debug($getapproved);
|
158 |
// debug($getapproved);
|
| 148 |
$fortnight = array();
|
159 |
$fortnight = array();
|
| 149 |
$fortnight_amount = array();
|
160 |
$fortnight_amount = array();
|
| Line 163... |
Line 174... |
| 163 |
// $url = $this->apihost.'appUserBatchDrillDown/1/16/2015';
|
174 |
// $url = $this->apihost.'appUserBatchDrillDown/1/16/2015';
|
| 164 |
// $approvedFortnight[] = $this->make_request($url,null);
|
175 |
// $approvedFortnight[] = $this->make_request($url,null);
|
| 165 |
}
|
176 |
}
|
| 166 |
|
177 |
|
| 167 |
$this->set(compact('fortnight','total_approved_amount','fortnight_amount','approvedFortnight'));
|
178 |
$this->set(compact('fortnight','total_approved_amount','fortnight_amount','approvedFortnight'));
|
| - |
|
179 |
// Approved End
|
| - |
|
180 |
|
| - |
|
181 |
// App Credit Start
|
| - |
|
182 |
$creditedFortnight = array();
|
| - |
|
183 |
$url = $this->apihost.'appUserCashBack/'.$userId.'/Credited';
|
| - |
|
184 |
$getcredited = $this->make_request($url,null);
|
| - |
|
185 |
foreach ($getcredited['UserAppCashBack'] as $key => $value) {
|
| - |
|
186 |
|
| - |
|
187 |
$url = $this->apihost.'appUserBatchDrillDown/'.$userId.'/'.$value['fortnightOfYear'].'/'.$value['yearVal'];
|
| - |
|
188 |
$creditedFortnight[$value['fortnightOfYear']] = $this->make_request($url,null);
|
| - |
|
189 |
|
| - |
|
190 |
$creditValueArray['amount'] = $value['amount'];
|
| - |
|
191 |
$creditValueArray['type'] = 'App';
|
| - |
|
192 |
$creditValueArray['fortbatchid'] = $value['fortnightOfYear'];
|
| - |
|
193 |
$creditKeyArray[$value['creditedDate']] = $creditValueArray;
|
| - |
|
194 |
// echo $url;
|
| - |
|
195 |
}
|
| - |
|
196 |
|
| - |
|
197 |
// debug($creditedFortnight);
|
| - |
|
198 |
|
| - |
|
199 |
|
| - |
|
200 |
ksort($creditKeyArray);
|
| - |
|
201 |
// debug($creditKeyArray);
|
| - |
|
202 |
$this->set(compact('getcredited','creditedFortnight','creditKeyArray'));
|
| - |
|
203 |
// debug($creditedFortnight);
|
| - |
|
204 |
// App Credit End
|
| 168 |
|
205 |
|
| 169 |
|
206 |
|
| 170 |
foreach ($fortnightIds AS $fortnightId){
|
207 |
foreach ($fortnightIds AS $fortnightId){
|
| 171 |
$appInstalls = array();
|
208 |
$appInstalls = array();
|
| 172 |
$options = array('conditions'=>array('fortnightOfYear'=>$fortnightId,'user_id'=>$this->Auth->User('id')),'fields'=>array('status','amount'));
|
209 |
$options = array('conditions'=>array('fortnightOfYear'=>$fortnightId,'user_id'=>$this->Auth->User('id')),'fields'=>array('status','amount'));
|