| Line 87... |
Line 87... |
| 87 |
$this->loadModel('User');
|
87 |
$this->loadModel('User');
|
| 88 |
$dbuser = $this->User->findById($userId);
|
88 |
$dbuser = $this->User->findById($userId);
|
| 89 |
$this->Auth->login($dbuser['User']);
|
89 |
$this->Auth->login($dbuser['User']);
|
| 90 |
}
|
90 |
}
|
| 91 |
$this->layout = "innerpages";
|
91 |
$this->layout = "innerpages";
|
| 92 |
$url = $this->apihost."storeorder/user/".$this->Auth->User('id')."?page=1&window=50";
|
92 |
$url = $this->apihost."storeorder/user/".$this->Auth->User('id')."?page=1&window=50&searchMap={%22subOrders.cashBackStatus%22:{%22\$in%22:[%22Approved%22,%22Pending%22]}}";
|
| 93 |
$response = $this->make_request($url,null);
|
93 |
$response = $this->make_request($url,null);
|
| 94 |
// debug($response);
|
94 |
// debug($response);
|
| 95 |
$creditedOrders = $pendingOrders = $approvedOrders = array();
|
95 |
$creditedOrders = $pendingOrders = $approvedOrders = array();
|
| 96 |
$creditedAmount = $pendingAmount = $approvedAmount = 0;
|
96 |
$creditedAmount = $pendingAmount = $approvedAmount = 0;
|
| 97 |
if(!empty($response['data'])){
|
97 |
if(!empty($response['data'])){
|
| Line 256... |
Line 256... |
| 256 |
}
|
256 |
}
|
| 257 |
|
257 |
|
| 258 |
public function usercashbacks($userId) {
|
258 |
public function usercashbacks($userId) {
|
| 259 |
$this->set('byUser',$userId);
|
259 |
$this->set('byUser',$userId);
|
| 260 |
$this->layout = "innerpages";
|
260 |
$this->layout = "innerpages";
|
| 261 |
$url = $this->apihost."storeorder/user/".$userId."?page=1&window=50";
|
261 |
$url = $this->apihost."storeorder/user/".$userId."?page=1&window=50&searchMap={%22subOrders.cashBackStatus%22:{%22\$in%22:[%22Approved%22,%22Pending%22]}}";
|
| 262 |
$response = $this->make_request($url,null);
|
262 |
$response = $this->make_request($url,null);
|
| 263 |
// debug($response);
|
263 |
// debug($response);
|
| 264 |
$creditedOrders = $pendingOrders = $approvedOrders = array();
|
264 |
$creditedOrders = $pendingOrders = $approvedOrders = array();
|
| 265 |
$creditedAmount = $pendingAmount = $approvedAmount = 0;
|
265 |
$creditedAmount = $pendingAmount = $approvedAmount = 0;
|
| 266 |
if(!empty($response['data'])){
|
266 |
if(!empty($response['data'])){
|
| Line 319... |
Line 319... |
| 319 |
if(!empty($creditedCashbacks)){
|
319 |
if(!empty($creditedCashbacks)){
|
| 320 |
foreach ($creditedCashbacks['data'] as $key => $value) {
|
320 |
foreach ($creditedCashbacks['data'] as $key => $value) {
|
| 321 |
$creditedAmount += $value['userAmount'];
|
321 |
$creditedAmount += $value['userAmount'];
|
| 322 |
$data = array('subOrders.batchId'=>$value['batch']);
|
322 |
$data = array('subOrders.batchId'=>$value['batch']);
|
| 323 |
$jsonVar = json_encode($data);
|
323 |
$jsonVar = json_encode($data);
|
| 324 |
// $url = $this->apihost."storeorder/user/".$this->Auth->User('id')."?page=1&window=50&searchMap=$jsonVar";
|
324 |
$url = $this->apihost."storeorder/user/".$this->Auth->User('id')."?page=1&window=50&searchMap=$jsonVar";
|
| 325 |
$url = $this->apihost."storeorder/user/".$userId."?page=1&window=50&searchMap=$jsonVar";
|
- |
|
| 326 |
$creditedOrders[$value['batch']] = $this->make_request($url,null);
|
325 |
$creditedOrders[$value['batch']] = $this->make_request($url,null);
|
| 327 |
$total_credited_amount =$total_credited_amount + $value['userAmount'];
|
326 |
$total_credited_amount =$total_credited_amount + $value['userAmount'];
|
| 328 |
if($value['type']== 'Order')
|
327 |
if($value['type']== 'Order')
|
| 329 |
{
|
328 |
{
|
| 330 |
$creditValueArray['amount'] = $value['userAmount'];
|
329 |
$creditValueArray['amount'] = $value['userAmount'];
|