| Line 117... |
Line 117... |
| 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();
|
120 |
$creditKeyArray = array();
|
| 121 |
$creditValueArray = array();
|
121 |
$creditValueArray = array();
|
| 122 |
|
- |
|
| - |
|
122 |
$total_credited_amount = 0;
|
| 123 |
if(!empty($creditedCashbacks)){
|
123 |
if(!empty($creditedCashbacks)){
|
| 124 |
foreach ($creditedCashbacks['data'] as $key => $value) {
|
124 |
foreach ($creditedCashbacks['data'] as $key => $value) {
|
| 125 |
$creditedAmount += $value['userAmount'];
|
125 |
$creditedAmount += $value['userAmount'];
|
| 126 |
$data = array('subOrders.batchId'=>$value['batch']);
|
126 |
$data = array('subOrders.batchId'=>$value['batch']);
|
| 127 |
$jsonVar = json_encode($data);
|
127 |
$jsonVar = json_encode($data);
|
| 128 |
$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";
|
| 129 |
$creditedOrders[$value['batch']] = $this->make_request($url,null);
|
129 |
$creditedOrders[$value['batch']] = $this->make_request($url,null);
|
| 130 |
|
130 |
|
| 131 |
$creditValueArray['amount'] = $value['userAmount'];
|
131 |
$creditValueArray['amount'] = $value['userAmount'];
|
| - |
|
132 |
$total_credited_amount =$total_credited_amount + $value['userAmount'];
|
| 132 |
$creditValueArray['type'] = 'Order';
|
133 |
$creditValueArray['type'] = 'Order';
|
| 133 |
$creditValueArray['fortbatchid'] = $value['batch'];
|
134 |
$creditValueArray['fortbatchid'] = $value['batch'];
|
| 134 |
$creditKeyArray[date('Y-m-d',strtotime($value['timestamp']))] = $creditValueArray;
|
135 |
$creditKeyArray[date('Y-m-d',strtotime($value['timestamp']))] = $creditValueArray;
|
| 135 |
// debug($creditedOrders);
|
136 |
// debug($creditedOrders);
|
| 136 |
}
|
137 |
}
|
| Line 186... |
Line 187... |
| 186 |
|
187 |
|
| 187 |
$url = $this->apihost.'appUserBatchDrillDown/'.$userId.'/'.$value['fortnightOfYear'].'/'.$value['yearVal'];
|
188 |
$url = $this->apihost.'appUserBatchDrillDown/'.$userId.'/'.$value['fortnightOfYear'].'/'.$value['yearVal'];
|
| 188 |
$creditedFortnight[$value['fortnightOfYear']] = $this->make_request($url,null);
|
189 |
$creditedFortnight[$value['fortnightOfYear']] = $this->make_request($url,null);
|
| 189 |
|
190 |
|
| 190 |
$creditValueArray['amount'] = $value['amount'];
|
191 |
$creditValueArray['amount'] = $value['amount'];
|
| - |
|
192 |
$total_credited_amount = $total_credited_amount + $value['amount'];
|
| 191 |
$creditValueArray['type'] = 'App';
|
193 |
$creditValueArray['type'] = 'App';
|
| 192 |
$creditValueArray['fortbatchid'] = $value['fortnightOfYear'];
|
194 |
$creditValueArray['fortbatchid'] = $value['fortnightOfYear'];
|
| 193 |
$creditKeyArray[$value['creditedDate']] = $creditValueArray;
|
195 |
$creditKeyArray[$value['creditedDate']] = $creditValueArray;
|
| 194 |
// echo $url;
|
196 |
// echo $url;
|
| 195 |
}
|
197 |
}
|
| Line 197... |
Line 199... |
| 197 |
// debug($creditedFortnight);
|
199 |
// debug($creditedFortnight);
|
| 198 |
|
200 |
|
| 199 |
|
201 |
|
| 200 |
ksort($creditKeyArray);
|
202 |
ksort($creditKeyArray);
|
| 201 |
// debug($creditKeyArray);
|
203 |
// debug($creditKeyArray);
|
| 202 |
$this->set(compact('getcredited','creditedFortnight','creditKeyArray'));
|
204 |
$this->set(compact('getcredited','creditedFortnight','creditKeyArray','total_credited_amount'));
|
| 203 |
// debug($creditedFortnight);
|
205 |
// debug($creditedFortnight);
|
| 204 |
// App Credit End
|
206 |
// App Credit End
|
| 205 |
|
207 |
|
| 206 |
|
208 |
|
| 207 |
foreach ($fortnightIds AS $fortnightId){
|
209 |
foreach ($fortnightIds AS $fortnightId){
|