Subversion Repositories SmartDukaan

Rev

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

Rev 22778 Rev 22846
Line 6... Line 6...
6
 * @property Retailer $Retailer
6
 * @property Retailer $Retailer
7
 * @property PaginatorComponent $Paginator
7
 * @property PaginatorComponent $Paginator
8
 */
8
 */
9
class RetailersController extends AppController {
9
class RetailersController extends AppController {
10
 
10
 
11
/**
11
	/**
12
 * Components
12
	 * Components
13
 *
13
	 *
14
 * @var array
14
	 * @var array
15
 */
15
	 */
16
	public $components = array('Paginator');
16
	public $components = array('Paginator');
17
 
17
 
18
/**
18
	/**
19
 * index method
19
	 * index method
20
 *
20
	 *
21
 * @return void
21
	 * @return void
22
 */
22
	 */
23
	public function index() {
23
	public function index() {
24
		$this->layout = 'ajax';
24
		$this->layout = 'ajax';
25
		$this->Retailer->recursive = 0;
25
		$this->Retailer->recursive = 0;
26
		$options = array('conditions'=>array('status' =>'new'));	
26
		$options = array('conditions'=>array('status' =>'new'));
27
		$result = $this->Retailer->find('first',$options);
27
		$result = $this->Retailer->find('first',$options);
28
		$this->set(array(
28
		$this->set(array(
29
		    'result' => $result,
29
		    'result' => $result,
30
		    '_serialize' => array('result')
30
		    '_serialize' => array('result')
31
		));
31
		));
32
		$this->render('/Elements/json');
32
		$this->render('/Elements/json');
33
	}
33
	}
34
public function notificationactive(){
34
	public function notificationactive(){
35
		$retailerId = $this->request->query('retailerid');
35
		$retailerId = $this->request->query('retailerid');
36
		$options = array('conditions' => array('id'=> $retailerId,'status'=>'new','expiresAt >'=>date('Y-m-d H:i:s',time())));
36
		$options = array('conditions' => array('id'=> $retailerId,'status'=>'new','expiresAt >'=>date('Y-m-d H:i:s',time())));
37
		$count = $this->NotificationCampaign->find('count',$options);
37
		$count = $this->NotificationCampaign->find('count',$options);
38
		
38
 
39
		if(!$count){
39
		if(!$count){
40
			$result = array('success'=>false);
40
			$result = array('success'=>false);
41
		}else{
41
		}else{
42
			$result = array('success'=>true);
42
			$result = array('success'=>true);
43
		}
43
		}
44
		
44
 
45
		$this->response->type('json');
45
		$this->response->type('json');
46
		$this->layout = 'ajax';
46
		$this->layout = 'ajax';
47
		$this->set(array(
47
		$this->set(array(
48
		    'result' => $result,
48
		    'result' => $result,
49
		    '_serialize' => array('result')
49
		    '_serialize' => array('result')
50
		));
50
		));
51
		$this->render('/Elements/json');
51
		$this->render('/Elements/json');
52
	}
52
	}
53
 
53
 
54
	/*public function index() {	
54
	/*public function index() {
55
		$this->layout = 'ajax';
55
		$this->layout = 'ajax';
56
		$t = $this->request->query('t');
56
		$t = $this->request->query('t');
57
		$retailer = $this->Mobileappsetting->find('one',$options);
57
		$retailer = $this->Mobileappsetting->find('one',$options);
58
		$options = array('fields'=>array("unix_timestamp(modified) t"),'order'=>array('modified'=>'desc'));
58
		$options = array('fields'=>array("unix_timestamp(modified) t"),'order'=>array('modified'=>'desc'));
59
		$lasttimestamp = $this->Mobileappsetting->find('first',$options);		
59
		$lasttimestamp = $this->Mobileappsetting->find('first',$options);
60
		$result = array('settings' => $settings,'t'=>$lasttimestamp[0]['t']);
60
		$result = array('settings' => $settings,'t'=>$lasttimestamp[0]['t']);
61
		$this->set(array(
61
		$this->set(array(
62
		    'result' => $result,
62
		'result' => $result,
63
		    '_serialize' => array('result')
63
		'_serialize' => array('result')
64
		));
64
		));
65
		$this->render('/Elements/json');
65
		$this->render('/Elements/json');
66
	}*/
66
		}*/
67
/**
67
	/**
68
 * view method
68
	 * view method
69
 *
69
	 *
70
 * @throws NotFoundException
70
	 * @throws NotFoundException
71
 * @param string $id
71
	 * @param string $id
72
 * @return void
72
	 * @return void
73
 */
73
	 */
74
	public function view($id = null) {
74
	public function view($id = null) {
75
		if (!$this->Retailer->exists($id)) {
75
		if (!$this->Retailer->exists($id)) {
76
			throw new NotFoundException(__('Invalid retailer'));
76
			throw new NotFoundException(__('Invalid retailer'));
77
		}
77
		}
78
		$options = array('conditions' => array('Retailer.' . $this->Retailer->primaryKey => $id));
78
		$options = array('conditions' => array('Retailer.' . $this->Retailer->primaryKey => $id));
79
		$this->set('retailer', $this->Retailer->find('first', $options));
79
		$this->set('retailer', $this->Retailer->find('first', $options));
80
	}
80
	}
81
 
81
 
82
/**
82
	/**
83
 * add method
83
	 * add method
84
 *
84
	 *
85
 * @return void
85
	 * @return void
86
 */
86
	 */
87
	public function add() {
87
	public function add() {
88
		if ($this->request->is('post')) {
88
		if ($this->request->is('post')) {
89
			$this->Retailer->create();
89
			$this->Retailer->create();
90
			if ($this->Retailer->save($this->request->data)) {
90
			if ($this->Retailer->save($this->request->data)) {
91
				$this->Session->setFlash(__('The retailer has been saved.'));
91
				$this->Session->setFlash(__('The retailer has been saved.'));
Line 94... Line 94...
94
				$this->Session->setFlash(__('The retailer could not be saved. Please, try again.'));
94
				$this->Session->setFlash(__('The retailer could not be saved. Please, try again.'));
95
			}
95
			}
96
		}
96
		}
97
	}
97
	}
98
 
98
 
99
/**
99
	/**
100
 * edit method
100
	 * edit method
101
 *
101
	 *
102
 * @throws NotFoundException
102
	 * @throws NotFoundException
103
 * @param string $id
103
	 * @param string $id
104
 * @return void
104
	 * @return void
105
 */
105
	 */
106
	public function edit($id = null) {
106
	public function edit($id = null) {
107
		if (!$this->Retailer->exists($id)) {
107
		if (!$this->Retailer->exists($id)) {
108
			throw new NotFoundException(__('Invalid retailer'));
108
			throw new NotFoundException(__('Invalid retailer'));
109
		}
109
		}
110
		if ($this->request->is(array('post', 'put'))) {
110
		if ($this->request->is(array('post', 'put'))) {
Line 118... Line 118...
118
			$options = array('conditions' => array('Retailer.' . $this->Retailer->primaryKey => $id));
118
			$options = array('conditions' => array('Retailer.' . $this->Retailer->primaryKey => $id));
119
			$this->request->data = $this->Retailer->find('first', $options);
119
			$this->request->data = $this->Retailer->find('first', $options);
120
		}
120
		}
121
	}
121
	}
122
 
122
 
123
/**
123
	/**
124
 * delete method
124
	 * delete method
125
 *
125
	 *
126
 * @throws NotFoundException
126
	 * @throws NotFoundException
127
 * @param string $id
127
	 * @param string $id
128
 * @return void
128
	 * @return void
129
 */
129
	 */
130
	public function delete($id = null) {
130
	public function delete($id = null) {
131
		$this->Retailer->id = $id;
131
		$this->Retailer->id = $id;
132
		if (!$this->Retailer->exists()) {
132
		if (!$this->Retailer->exists()) {
133
			throw new NotFoundException(__('Invalid retailer'));
133
			throw new NotFoundException(__('Invalid retailer'));
134
		}
134
		}
Line 139... Line 139...
139
			$this->Session->setFlash(__('The retailer could not be deleted. Please, try again.'));
139
			$this->Session->setFlash(__('The retailer could not be deleted. Please, try again.'));
140
		}
140
		}
141
		return $this->redirect(array('action' => 'index'));
141
		return $this->redirect(array('action' => 'index'));
142
	}
142
	}
143
 
143
 
144
/**
144
	/**
145
 * admin_index method
145
	 * admin_index method
146
 *
146
	 *
147
 * @return void
147
	 * @return void
148
 */
148
	 */
149
	public function admin_index() {
149
	public function admin_index() {
150
		$this->Retailer->recursive = 0;
150
		$this->Retailer->recursive = 0;
151
		$this->set('retailers', $this->Paginator->paginate());
151
		$this->set('retailers', $this->Paginator->paginate());
152
	}
152
	}
153
 
153
 
154
/**
154
	/**
155
 * admin_view method
155
	 * admin_view method
156
 *
156
	 *
157
 * @throws NotFoundException
157
	 * @throws NotFoundException
158
 * @param string $id
158
	 * @param string $id
159
 * @return void
159
	 * @return void
160
 */
160
	 */
161
	public function admin_view($id = null) {
161
	public function admin_view($id = null) {
162
		if (!$this->Retailer->exists($id)) {
162
		if (!$this->Retailer->exists($id)) {
163
			throw new NotFoundException(__('Invalid retailer'));
163
			throw new NotFoundException(__('Invalid retailer'));
164
		}
164
		}
165
		$options = array('conditions' => array('Retailer.' . $this->Retailer->primaryKey => $id));
165
		$options = array('conditions' => array('Retailer.' . $this->Retailer->primaryKey => $id));
166
		$this->set('retailer', $this->Retailer->find('first', $options));
166
		$this->set('retailer', $this->Retailer->find('first', $options));
167
	}
167
	}
168
 
168
 
169
/**
169
	/**
170
 * admin_add method
170
	 * admin_add method
171
 *
171
	 *
172
 * @return void
172
	 * @return void
173
 */
173
	 */
174
	public function admin_add() {
174
	public function admin_add() {
175
		if ($this->request->is('post')) {
175
		if ($this->request->is('post')) {
176
			$this->Retailer->create();
176
			$this->Retailer->create();
177
			if ($this->Retailer->save($this->request->data)) {
177
			if ($this->Retailer->save($this->request->data)) {
178
				$this->Session->setFlash(__('The retailer has been saved.'));
178
				$this->Session->setFlash(__('The retailer has been saved.'));
Line 181... Line 181...
181
				$this->Session->setFlash(__('The retailer could not be saved. Please, try again.'));
181
				$this->Session->setFlash(__('The retailer could not be saved. Please, try again.'));
182
			}
182
			}
183
		}
183
		}
184
	}
184
	}
185
 
185
 
186
/**
186
	/**
187
 * admin_edit method
187
	 * admin_edit method
188
 *
188
	 *
189
 * @throws NotFoundException
189
	 * @throws NotFoundException
190
 * @param string $id
190
	 * @param string $id
191
 * @return void
191
	 * @return void
192
 */
192
	 */
193
	public function admin_edit($id = null) {
193
	public function admin_edit($id = null) {
194
		if (!$this->Retailer->exists($id)) {
194
		if (!$this->Retailer->exists($id)) {
195
			throw new NotFoundException(__('Invalid retailer'));
195
			throw new NotFoundException(__('Invalid retailer'));
196
		}
196
		}
197
		if ($this->request->is(array('post', 'put'))) {
197
		if ($this->request->is(array('post', 'put'))) {
Line 205... Line 205...
205
			$options = array('conditions' => array('Retailer.' . $this->Retailer->primaryKey => $id));
205
			$options = array('conditions' => array('Retailer.' . $this->Retailer->primaryKey => $id));
206
			$this->request->data = $this->Retailer->find('first', $options);
206
			$this->request->data = $this->Retailer->find('first', $options);
207
		}
207
		}
208
	}
208
	}
209
 
209
 
210
/**
210
	/**
211
 * admin_delete method
211
	 * admin_delete method
212
 *
212
	 *
213
 * @throws NotFoundException
213
	 * @throws NotFoundException
214
 * @param string $id
214
	 * @param string $id
215
 * @return void
215
	 * @return void
216
 */
216
	 */
217
	public function admin_delete($id = null) {
217
	public function admin_delete($id = null) {
218
		$this->Retailer->id = $id;
218
		$this->Retailer->id = $id;
219
		if (!$this->Retailer->exists()) {
219
		if (!$this->Retailer->exists()) {
220
			throw new NotFoundException(__('Invalid retailer'));
220
			throw new NotFoundException(__('Invalid retailer'));
221
		}
221
		}
Line 227... Line 227...
227
		}
227
		}
228
		return $this->redirect(array('action' => 'index'));
228
		return $this->redirect(array('action' => 'index'));
229
	}
229
	}
230
 
230
 
231
	public function admin_pendingretailer(){
231
	public function admin_pendingretailer(){
232
// 		$options['conditions'] = array('status LIKE '=>"%$search%");
232
		// 		$options['conditions'] = array('status LIKE '=>"%$search%");
233
		$opt = array('conditions' => array('status'=> 'pending_verification'));
233
		$opt = array('conditions' => array('status'=> 'pending_verification'));
234
		$pending = $this->Retailer->find('all',$opt);
234
		$pending = $this->Retailer->find('all',$opt);
235
		$this->set(compact('pending'));
235
		$this->set(compact('pending'));
236
	}
236
	}
237
	
237
 
238
	public function admin_verifiedretailer(){
238
	public function admin_verifiedretailer(){
239
		$opt['conditions']= array('status' => 'retailer_verified');
239
		$opt['conditions']= array('status' => 'retailer_verified');
240
		$verified = $this->Retailer->find('all',$opt);
240
		$verified = $this->Retailer->find('all',$opt);
241
		$this->set(compact('verified'));
241
		$this->set(compact('verified'));
242
	}
242
	}
243
	
243
 
244
	public function admin_activate($id, $userid) {
244
	public function admin_activate($id, $userid) {
245
		$agentid = Configure::read('agentid');
245
		$agentid = Configure::read('agentid');
246
		$code = Configure::read('activation_code_crm');
246
		$code = Configure::read('activation_code_crm');
247
		$cur_date = date('Y-m-d H:i:s', time());
247
		$cur_date = date('Y-m-d H:i:s', time());
248
		$retailerlinks="insert into retailerlinks (retailer_id, agent_id, code, activated, user_id, created)
248
		$retailerlinks="insert into retailerlinks (retailer_id, agent_id, code, activated, user_id, created)
249
													values ($id, $agentid, '$code','$cur_date', $userid, '$cur_date')";
249
													values ($id, $agentid, '$code','$cur_date', $userid, '$cur_date')";
250
		$this->Retailer->query($retailerlinks);		
250
		$this->Retailer->query($retailerlinks);
251
		$activateuserquery = "update users set activated=1, referrer='$code' where id=$userid";
251
		$activateuserquery = "update users set activated=1, referrer='$code' where id=$userid";
252
		$this->Retailer->query($activateuserquery);		
252
		$this->Retailer->query($activateuserquery);
253
		$this->markUserActivated($userid);
253
		$this->markUserActivated($userid);
254
		
254
 
255
		$this->redirect("pendingretailer");
255
		$this->redirect("pendingretailer");
256
		
256
 
257
	}
257
	}
258
	
258
 
259
	public function admin_retailerverify($id,$tin){
259
	public function admin_retailerverify($id,$tin){
260
		$agentid = Configure::read('agentid');
260
		$agentid = Configure::read('agentid');
261
		if($this->request->is('post')){
261
		if($this->request->is('post')){
262
			$data = $this->request->data;
262
			$data = $this->request->data;
263
			$retId = $data['Retailer']['retId'];
263
			$retId = $data['Retailer']['retId'];
Line 267... Line 267...
267
				$retquery ="update retailers set status = 'retailer_verified' ,modified = '".$cur_date."' , isvalidated = 1  where id = ".$retId."";
267
				$retquery ="update retailers set status = 'retailer_verified' ,modified = '".$cur_date."' , isvalidated = 1  where id = ".$retId."";
268
				$this->Retailer->query($retquery);
268
				$this->Retailer->query($retquery);
269
			}elseif($data['type'] == "Cancel"){
269
			}elseif($data['type'] == "Cancel"){
270
				$retquery ="update retailers set status = 'not_verified' ,modified = '".$cur_date."' , comments = '".$data['Retailer']['text']."' where id = ".$retId."";
270
				$retquery ="update retailers set status = 'not_verified' ,modified = '".$cur_date."' , comments = '".$data['Retailer']['text']."' where id = ".$retId."";
271
				$this->Retailer->query($retquery);
271
				$this->Retailer->query($retquery);
272
				
272
 
273
				$callhistoryquery = "insert into callhistory 
273
				$callhistoryquery = "insert into callhistory
274
						(retailer_id,agent_id,mobile_number,call_type,sms_verified,call_time,duration_sec,
274
						(retailer_id,agent_id,mobile_number,call_type,sms_verified,call_time,duration_sec,
275
						last_fetch_time,call_disposition,disposition_description,disposition_comments,created) 
275
						last_fetch_time,call_disposition,disposition_description,disposition_comments,created) 
276
						values 
276
						values 
277
						(".$retId.",".$agentid.",'".$retcontact."','verification',0,'".$cur_date."',0,'".$cur_date."',
277
						(".$retId.",".$agentid.",'".$retcontact."','verification',0,'".$cur_date."',0,'".$cur_date."',
278
						'other','verification cancelled','".$data['Retailer']['text']."','".$cur_date."')";
278
						'other','verification cancelled','".$data['Retailer']['text']."','".$cur_date."')";
Line 302... Line 302...
302
				$this->set(compact('tinresult'));
302
				$this->set(compact('tinresult'));
303
			}
303
			}
304
		}
304
		}
305
		$this->set(compact('result'));
305
		$this->set(compact('result'));
306
	}
306
	}
307
	
307
 
308
	
308
 
309
	public function sendsms(){
309
	public function sendsms(){
310
		$this->autoRender = false;
310
		$this->autoRender = false;
311
		$this->request->onlyAllow('ajax');
311
		$this->request->onlyAllow('ajax');
312
		$agentid = Configure::read('agentid');
312
		$agentid = Configure::read('agentid');
313
		$contact = $this->request->query('contact');
313
		$contact = $this->request->query('contact');
314
		$retid = $this->request->query('retid');
314
		$retid = $this->request->query('retid');
315
		$url = Configure::read('pythonapihost')."sendTransSms/code/".$retid."/".$agentid;
315
		$url = Configure::read('pythonapihost')."sendTransSms/code/".$retid."/".$agentid;
316
// 		$url = "http://45.79.106.95:8057/sendTransSms/code/6836700/2";
316
		// 		$url = "http://45.79.106.95:8057/sendTransSms/code/6836700/2";
317
		if($contact != null || !empty($contact)){
317
		if($contact != null || !empty($contact)){
318
			$url = $url."?mobile_number=".$contact;
318
			$url = $url."?mobile_number=".$contact;
319
		}
319
		}
320
		$response = $this->make_request($url,'{}');
320
		$response = $this->make_request($url,'{}');
321
		
321
 
322
		return json_encode($response);
322
		return json_encode($response);
323
	}
323
	}
324
	
324
 
325
	public function admin_editretailer($id){
325
	public function admin_editretailer($id){
326
		if($this->request->is('post') || $this->request->is('put')){
326
		if($this->request->is('post') || $this->request->is('put')){
327
			$retdet = $this->request->data['Retailer'];
327
			$retdet = $this->request->data['Retailer'];
328
			$cur_date = date('Y-m-d H:i:s', time());
328
			$cur_date = date('Y-m-d H:i:s', time());
329
			if($retdet['tinNumber'] == '' || empty($retdet['tinNumber']))
329
			if($retdet['tinNumber'] == '' || empty($retdet['tinNumber']))
Line 331... Line 331...
331
				$upquery = "update retailers set title = '".$retdet['storeName']."' , address = '".$retdet['completeAddress']."',pin = ".$retdet['pin'].",tinnumber = NULL,city = '".$retdet['city']."',state='".$retdet['state']."' , modified='".$cur_date."' where id =".$retdet['id']."";
331
				$upquery = "update retailers set title = '".$retdet['storeName']."' , address = '".$retdet['completeAddress']."',pin = ".$retdet['pin'].",tinnumber = NULL,city = '".$retdet['city']."',state='".$retdet['state']."' , modified='".$cur_date."' where id =".$retdet['id']."";
332
			}
332
			}
333
			else{
333
			else{
334
				$upquery = "update retailers set title = '".$retdet['storeName']."' , address = '".$retdet['completeAddress']."',pin = ".$retdet['pin'].",tinnumber = ".$retdet['tinNumber'].",city = '".$retdet['city']."',state='".$retdet['state']."' , modified='".$cur_date."' where id =".$retdet['id']."";
334
				$upquery = "update retailers set title = '".$retdet['storeName']."' , address = '".$retdet['completeAddress']."',pin = ".$retdet['pin'].",tinnumber = ".$retdet['tinNumber'].",city = '".$retdet['city']."',state='".$retdet['state']."' , modified='".$cur_date."' where id =".$retdet['id']."";
335
			}
335
			}
336
			
336
				
337
			
337
				
338
			
338
				
339
			$this->Retailer->query($upquery);
339
			$this->Retailer->query($upquery);
340
			$this->redirect("retailerverify/".$retdet['id']."/".$retdet['tinNumber']);
340
			$this->redirect("retailerverify/".$retdet['id']."/".$retdet['tinNumber']);
341
		}
341
		}
342
		if($id !=null){
342
		if($id !=null){
343
			$opt['conditions'] = array('id' => $id);
343
			$opt['conditions'] = array('id' => $id);
344
			$retailer = $this->Retailer->find('first',$opt);
344
			$retailer = $this->Retailer->find('first',$opt);
345
			$this->set(compact('retailer'));
345
			$this->set(compact('retailer'));
346
			
346
				
347
		}
347
		}
348
	}
348
	}
349
	
349
 
350
	public function admin_filterretailer(){
350
	public function admin_filterretailer(){
351
		
351
 
352
		if($this->request->is('post')){
352
		if($this->request->is('post')){
353
			$filter = $this->request->data['Retailer']['searchReatailerBy'];
353
			$filter = $this->request->data['Retailer']['searchReatailerBy'];
354
// 			debug($retdet);
354
			// 			debug($retdet);
355
			if($filter == '0'){
355
			if($filter == '0'){
356
				$cnaquery ="select r.*, rl.code from retailers r join profitmandi_sms p on r.id=p.identifier join retailerlinks rl on r.id= rl.retailer_id and rl.user_id is not null order by r.id desc";
356
				$cnaquery ="select r.*, rl.code from retailers r join profitmandi_sms p on r.id=p.identifier join retailerlinks rl on r.id= rl.retailer_id and rl.user_id is not null order by r.id desc";
357
			}else if($filter == '1') {
357
			}else if($filter == '1') {
358
				$cnaquery ="select r.*, rl.code from retailers r join profitmandi_sms p on r.id=p.identifier join retailerlinks rl on r.id= rl.retailer_id and rl.user_id is null order by r.id desc";
358
				$cnaquery ="select r.*, rl.code from retailers r join profitmandi_sms p on r.id=p.identifier join retailerlinks rl on r.id= rl.retailer_id and rl.user_id is null order by r.id desc";
359
			}else if($filter == '2') {
359
			}else if($filter == '2') {
Line 361... Line 361...
361
			}
361
			}
362
 
362
 
363
			$result = $this->Retailer->query($cnaquery);;
363
			$result = $this->Retailer->query($cnaquery);;
364
			$this->set(compact('result'));
364
			$this->set(compact('result'));
365
		}
365
		}
366
	}		
366
	}
367
			
367
		
368
	public function admin_pendingretailer_new() {
368
	public function admin_pendingretailer_new() {
369
		if($this->request->is('get')) {
369
		if($this->request->is('get')) {
370
			$prquery = "select r.*,a.*, u.* from retailer r join user_accounts ua on (ua.account_key=r.id and ua.account_type='saholic') 
370
			$prquery = "select r.*,a.*, u.* from retailer r join user_accounts ua on (ua.account_key=r.id and ua.account_type='saholic')
-
 
371
			join users u on u.id=ua.user_id join retailer_registered_address rra on rra.retailer_id=r.id join user.address a on rra.address_id=a.id where u.created > '2017-11-03'";
371
			join users u on u.id=ua.user_id join retailer_registered_address rra on rra.retailer_id=r.id join user.address a on rra.address_id=a.id where (r.migrated=0 and r.active=0)";
372
			//join users u on u.id=ua.user_id join retailer_registered_address rra on rra.retailer_id=r.id join user.address a on rra.address_id=a.id where (r.migrated=0 and r.active=0)";
372
			$result = $this->Retailer->query($prquery);
373
			$result = $this->Retailer->query($prquery);
373
			$this->set(compact('result'));
374
			$this->set(compact('result'));
374
		}
375
		}
375
	}
376
	}
376
		
377
 
377
}
378
}