Subversion Repositories SmartDukaan

Rev

Rev 17104 | Rev 17110 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 17104 Rev 17109
Line 125... Line 125...
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
 
-
 
131
				$creditValueArray['amount'] = $value['userAmount'];
-
 
132
				$total_credited_amount =$total_credited_amount + $value['userAmount'];
130
				$total_credited_amount =$total_credited_amount + $value['userAmount'];
-
 
131
				if($value['type']== 'Order')
-
 
132
				{
-
 
133
					$creditValueArray['amount'] = $value['userAmount'];
133
				$creditValueArray['type'] = 'Order';
134
					$creditValueArray['type'] = $value['type'];
134
				$creditValueArray['fortbatchid'] = $value['batch'];
135
					$creditValueArray['fortbatchid'] = $value['batch'];
-
 
136
					$creditValueArray['creditedDate'] = date('Y-m-d',strtotime($value['timestamp']));
135
				$creditKeyArray[date('Y-m-d',strtotime($value['timestamp']))] = $creditValueArray;
137
					// $creditKeyArray[date('Y-m-d',strtotime($value['timestamp']))] = $creditValueArray;
136
				// debug($creditedOrders);
138
					$creditKeyArray[date('Y-m-d',strtotime($value['timestamp'])).$value['type']] = $creditValueArray;
-
 
139
				}
-
 
140
				
137
			}
141
			}
138
		}
142
		}
139
		$storemapping = Configure::read('storemapping');
143
		$storemapping = Configure::read('storemapping');
140
		$activestores = Configure::read('activestores');
144
		$activestores = Configure::read('activestores');
141
		//App related cashbacks
145
		//App related cashbacks
Line 154... Line 158...
154
 
158
 
155
		// Approved Start
159
		// Approved Start
156
 
160
 
157
		$url = $this->apihost.'appUserCashBack/'.$userId.'/Approved';
161
		$url = $this->apihost.'appUserCashBack/'.$userId.'/Approved';
158
		$getapproved = $this->make_request($url,null);
162
		$getapproved = $this->make_request($url,null);
159
		// debug($getapproved);
-
 
160
		$fortnight = array();
163
		$fortnight = array();
161
		$fortnight_amount = array();
164
		$fortnight_amount = array();
162
		$counter = 0;
165
		$counter = 0;
163
		$total_approved_amount = 0;
166
		$total_approved_amount = 0;
164
		$current_date =  date("Y");
167
		$current_date =  date("Y");
Line 181... Line 184...
181
 
184
 
182
	// App Credit Start
185
	// App Credit Start
183
		$creditedFortnight = array();
186
		$creditedFortnight = array();
184
		$url = $this->apihost.'appUserCashBack/'.$userId.'/Credited';
187
		$url = $this->apihost.'appUserCashBack/'.$userId.'/Credited';
185
		$getcredited = $this->make_request($url,null);
188
		$getcredited = $this->make_request($url,null);
-
 
189
		debug($getcredited);
186
		foreach ($getcredited['UserAppCashBack'] as $key => $value) {
190
		foreach ($getcredited['UserAppCashBack'] as $key => $value) {
187
 
191
 
-
 
192
 
-
 
193
 
188
			$url = $this->apihost.'appUserBatchDrillDown/'.$userId.'/'.$value['fortnightOfYear'].'/'.$value['yearVal'];
194
			$url = $this->apihost.'appUserBatchDrillDown/'.$userId.'/'.$value['fortnightOfYear'].'/'.$value['yearVal'];
189
			$creditedFortnight[$value['fortnightOfYear']] = $this->make_request($url,null);
195
			$creditedFortnight[$value['fortnightOfYear']] = $this->make_request($url,null);
190
 
196
 
191
			$creditValueArray['amount'] = $value['amount'];
197
			$creditValueArray['amount'] = $value['amount'];
192
			// $total_credited_amount = $total_credited_amount + $value['amount'];
198
			// $total_credited_amount = $total_credited_amount + $value['amount'];
193
			$creditValueArray['type'] = 'App';
199
			$creditValueArray['type'] = 'App';
194
			$creditValueArray['fortbatchid'] = $value['fortnightOfYear'];
200
			$creditValueArray['fortbatchid'] = $value['fortnightOfYear'];
-
 
201
			$creditValueArray['creditedDate'] = $value['creditedDate'];
195
			$creditKeyArray[$value['creditedDate']] = $creditValueArray;
202
			$creditKeyArray[$value['creditedDate'].'App'] = $creditValueArray;
-
 
203
			// echo "total credit",$total_credited_amount;
196
			// echo $url;
204
			// echo $url;
197
		}
205
		}
198
		
206
		
199
		// debug($creditedFortnight);
-
 
200
		
-
 
201
 
-
 
202
		ksort($creditKeyArray);
207
		ksort($creditKeyArray);
203
		// debug($creditKeyArray);
-
 
204
		$this->set(compact('getcredited','creditedFortnight','creditKeyArray','total_credited_amount'));
208
		$this->set(compact('getcredited','creditedFortnight','creditKeyArray','total_credited_amount'));
205
		// debug($creditedFortnight);
209
		// debug($creditedFortnight);
206
	// App Credit End
210
	// App Credit End
207
 
211
 
208
 
212