| Line 194... |
Line 194... |
| 194 |
$this->Session->setFlash(__('The app transaction could not be deleted. Please, try again.'));
|
194 |
$this->Session->setFlash(__('The app transaction could not be deleted. Please, try again.'));
|
| 195 |
}
|
195 |
}
|
| 196 |
return $this->redirect(array('action' => 'index'));
|
196 |
return $this->redirect(array('action' => 'index'));
|
| 197 |
}
|
197 |
}
|
| 198 |
|
198 |
|
| 199 |
public function admin_retailer(){
|
199 |
public function admin_appwise(){
|
| 200 |
|
- |
|
| 201 |
$this->AppTransaction->recursive = -1;
|
200 |
$this->AppTransaction->recursive = -1;
|
| 202 |
#$data = $this->request->data;
|
201 |
$type = $this->request->query('date');
|
| - |
|
202 |
$date_from = $this->request->query('date_from');
|
| - |
|
203 |
$date_to = $this->request->query('date_to');
|
| - |
|
204 |
if(!isset($type) && !isset($date_from) && !isset($date_to)){
|
| - |
|
205 |
$date = date('Y-m-d',time());
|
| - |
|
206 |
$this->Paginator->settings = array(
|
| - |
|
207 |
'fields' => array('AppTransaction.app_id','retailer_id','app_name', 'COUNT(*) AS count'),
|
| - |
|
208 |
'conditions' => array('Date(AppTransaction.transaction_time)'=>$date),
|
| - |
|
209 |
'order' => 'count desc' ,
|
| - |
|
210 |
'group' => 'app_id'
|
| - |
|
211 |
);
|
| - |
|
212 |
$approvedCounts = $this->Paginator->paginate();
|
| - |
|
213 |
$sql="SELECT app_id,count(1) from app_transactions where date(transaction_time)='$date' and payout_description='Approved' group by app_id";
|
| - |
|
214 |
$approved = $this->AppTransaction->query($sql);
|
| - |
|
215 |
foreach ($approved as $key => $value1) {
|
| - |
|
216 |
$app_id=$value1['app_transactions']['app_id'];
|
| - |
|
217 |
$value22=$value1['0']['count(1)'];
|
| - |
|
218 |
foreach ($approvedCounts as $key2 => $value) {
|
| - |
|
219 |
if($app_id==$value['AppTransaction']['app_id']){
|
| - |
|
220 |
$approvedCounts[$key2]['AppTransaction']['approved'] = $value22;
|
| - |
|
221 |
$approvedCounts[$key2]['AppTransaction']['conversion_percentage']=ceil(($value22/$value[0]['count'])*100);
|
| - |
|
222 |
}
|
| - |
|
223 |
}
|
| - |
|
224 |
}
|
| - |
|
225 |
}
|
| - |
|
226 |
else if($type=='yesterday'){
|
| 203 |
#$date = date('Y-m-d',time()-86400);
|
227 |
$date = date('Y-m-d',time()-86400);
|
| 204 |
$this->Paginator->settings = array(
|
228 |
$this->Paginator->settings = array(
|
| 205 |
'fields' => array('AppTransaction.app_id','retailer_id','app_name', 'COUNT(*) AS count'),
|
229 |
'fields' => array('AppTransaction.app_id','retailer_id','app_name', 'COUNT(*) AS count'),
|
| 206 |
'conditions' => array('Date(AppTransaction.transaction_time)'=>'2015-08-28'),
|
230 |
'conditions' => array('Date(AppTransaction.transaction_time)'=>$date),
|
| - |
|
231 |
'order' => 'count desc' ,
|
| - |
|
232 |
'group' => 'app_id'
|
| - |
|
233 |
);
|
| - |
|
234 |
$approvedCounts = $this->Paginator->paginate();
|
| - |
|
235 |
$sql="SELECT app_id,count(1) from app_transactions where date(transaction_time)='$date' and payout_description='Approved' group by app_id";
|
| - |
|
236 |
$approved = $this->AppTransaction->query($sql);
|
| - |
|
237 |
foreach ($approved as $key => $value1) {
|
| - |
|
238 |
$app_id=$value1['app_transactions']['app_id'];
|
| - |
|
239 |
$value22=$value1['0']['count(1)'];
|
| - |
|
240 |
foreach ($approvedCounts as $key2 => $value) {
|
| - |
|
241 |
if($app_id==$value['AppTransaction']['app_id']){
|
| - |
|
242 |
$approvedCounts[$key2]['AppTransaction']['approved'] = $value22;
|
| - |
|
243 |
$approvedCounts[$key2]['AppTransaction']['conversion_percentage']=ceil(($value22/$value[0]['count'])*100);
|
| - |
|
244 |
}
|
| - |
|
245 |
}
|
| - |
|
246 |
}
|
| - |
|
247 |
}else if(isset($date_from) && isset($date_to)){
|
| - |
|
248 |
$this->Paginator->settings = array(
|
| - |
|
249 |
'fields' => array('AppTransaction.app_id','retailer_id','app_name', 'COUNT(*) AS count'),
|
| - |
|
250 |
'conditions' => array('Date(AppTransaction.transaction_time) BETWEEN ? AND ?' =>array($date_from, $date_to)),
|
| - |
|
251 |
'order' => 'count desc' ,
|
| 207 |
'group' => 'app_id'
|
252 |
'group' => 'app_id'
|
| 208 |
);
|
253 |
);
|
| 209 |
$approvedCounts = $this->Paginator->paginate();
|
254 |
$approvedCounts = $this->Paginator->paginate();
|
| 210 |
$sql="SELECT app_id,count(1) from app_transactions where date(transaction_time)='2015-08-28' and payout_description='Approved' group by app_id";
|
255 |
$sql="SELECT app_id,count(1) from app_transactions where date(transaction_time) BETWEEN '$date_from' and '$date_to' and payout_description='Approved' group by app_id";
|
| 211 |
$approved = $this->AppTransaction->query($sql);
|
256 |
$approved = $this->AppTransaction->query($sql);
|
| 212 |
#debug($approved);
|
- |
|
| 213 |
foreach ($approved as $key => $value1) {
|
257 |
foreach ($approved as $key => $value1) {
|
| 214 |
$app_id=$value1['app_transactions']['app_id'];
|
258 |
$app_id=$value1['app_transactions']['app_id'];
|
| 215 |
$value22=$value1['0']['count(1)'];
|
259 |
$value22=$value1['0']['count(1)'];
|
| 216 |
foreach ($approvedCounts as $key2 => $value) {
|
260 |
foreach ($approvedCounts as $key2 => $value) {
|
| 217 |
debug($value);
|
- |
|
| 218 |
if($app_id==$value['AppTransaction']['app_id']){
|
261 |
if($app_id==$value['AppTransaction']['app_id']){
|
| 219 |
$approvedCounts[$key2]['AppTransaction']['approved'] = $value22;
|
262 |
$approvedCounts[$key2]['AppTransaction']['approved'] = $value22;
|
| 220 |
$approvedCounts[$key2]['AppTransaction']['conversion_percentage']=ceil(($value22/$value['AppTransaction']['count'])*100);
|
263 |
$approvedCounts[$key2]['AppTransaction']['conversion_percentage']=ceil(($value22/$value[0]['count'])*100);
|
| - |
|
264 |
}
|
| - |
|
265 |
}
|
| - |
|
266 |
}
|
| 221 |
}else{
|
267 |
}else{
|
| - |
|
268 |
$date = date('Y-m-d',time());
|
| - |
|
269 |
$this->Paginator->settings = array(
|
| - |
|
270 |
'fields' => array('AppTransaction.app_id','retailer_id','app_name', 'COUNT(*) AS count'),
|
| - |
|
271 |
'conditions' => array('Date(AppTransaction.transaction_time)'=>$date),
|
| - |
|
272 |
'order' => 'count desc' ,
|
| - |
|
273 |
'group' => 'app_id'
|
| - |
|
274 |
);
|
| - |
|
275 |
$approvedCounts = $this->Paginator->paginate();
|
| - |
|
276 |
$sql="SELECT app_id,count(1) from app_transactions where date(transaction_time)='$date' and payout_description='Approved' group by app_id";
|
| - |
|
277 |
$approved = $this->AppTransaction->query($sql);
|
| - |
|
278 |
foreach ($approved as $key => $value1) {
|
| - |
|
279 |
$app_id=$value1['app_transactions']['app_id'];
|
| - |
|
280 |
$value22=$value1['0']['count(1)'];
|
| - |
|
281 |
foreach ($approvedCounts as $key2 => $value) {
|
| - |
|
282 |
if($app_id==$value['AppTransaction']['app_id']){
|
| 222 |
$approvedCounts[$key2]['AppTransaction']['approved'] = 0;
|
283 |
$approvedCounts[$key2]['AppTransaction']['approved'] = $value22;
|
| 223 |
$approvedCounts[$key2]['AppTransaction']['conversion_percentage']=0;
|
284 |
$approvedCounts[$key2]['AppTransaction']['conversion_percentage']=ceil(($value22/$value[0]['count'])*100);
|
| 224 |
}
|
285 |
}
|
| - |
|
286 |
}
|
| 225 |
}
|
287 |
}
|
| 226 |
#debug($value['AppTransaction']['app_name']);
|
- |
|
| 227 |
}
|
288 |
}
|
| 228 |
// $this->Paginator->settings = array(
|
289 |
$this->set('appTransactions', $approvedCounts);
|
| 229 |
// 'fields' => array('AppTransaction.app_id','retailer_id','app_name', 'COUNT(*) AS count'),
|
- |
|
| 230 |
// 'conditions' => array('AppTransaction.payout_description'=>'Approved','Date(AppTransaction.transaction_time)'=>$date),
|
- |
|
| 231 |
// 'group' => 'app_id'
|
- |
|
| 232 |
// );
|
290 |
}
|
| 233 |
|
291 |
|
| - |
|
292 |
public function admin_retailer(){
|
| - |
|
293 |
$this->AppTransaction->recursive = -1;
|
| - |
|
294 |
$type = $this->request->query('date');
|
| - |
|
295 |
$date_from = $this->request->query('date_from');
|
| - |
|
296 |
$date_to = $this->request->query('date_to');
|
| - |
|
297 |
if(!isset($type) && !isset($date_from) && !isset($date_to)){
|
| - |
|
298 |
$date = date('Y-m-d',time());
|
| - |
|
299 |
$this->Paginator->settings = array(
|
| - |
|
300 |
'fields' => array('AppTransaction.app_id','retailer_id','app_name', 'COUNT(*) AS count'),
|
| - |
|
301 |
'conditions' => array('Date(AppTransaction.transaction_time)'=>$date),
|
| - |
|
302 |
'order' => 'count desc' ,
|
| - |
|
303 |
'group' => 'retailer_id'
|
| - |
|
304 |
);
|
| - |
|
305 |
$approvedCounts = $this->Paginator->paginate();
|
| - |
|
306 |
$sql="SELECT retailer_id,count(1) from app_transactions where date(transaction_time)='$date' and payout_description='Approved' group by retailer_id";
|
| - |
|
307 |
$approved = $this->AppTransaction->query($sql);
|
| - |
|
308 |
foreach ($approved as $key => $value1) {
|
| - |
|
309 |
$app_id=$value1['app_transactions']['retailer_id'];
|
| - |
|
310 |
$value22=$value1['0']['count(1)'];
|
| - |
|
311 |
foreach ($approvedCounts as $key2 => $value) {
|
| - |
|
312 |
if($app_id==$value['AppTransaction']['retailer_id']){
|
| - |
|
313 |
$approvedCounts[$key2]['AppTransaction']['approved'] = $value22;
|
| - |
|
314 |
$approvedCounts[$key2]['AppTransaction']['conversion_percentage']=ceil(($value22/$value[0]['count'])*100);
|
| - |
|
315 |
}
|
| - |
|
316 |
}
|
| - |
|
317 |
}
|
| - |
|
318 |
}
|
| 234 |
// debug($approvedCounts);
|
319 |
else if($type=='yesterday'){
|
| - |
|
320 |
$date = date('Y-m-d',time()-86400);
|
| - |
|
321 |
$this->Paginator->settings = array(
|
| - |
|
322 |
'fields' => array('AppTransaction.app_id','retailer_id','app_name', 'COUNT(*) AS count'),
|
| - |
|
323 |
'conditions' => array('Date(AppTransaction.transaction_time)'=>$date),
|
| - |
|
324 |
'order' => 'count desc' ,
|
| - |
|
325 |
'group' => 'retailer_id'
|
| - |
|
326 |
);
|
| 235 |
#$this->set('items', $this->Paginator->paginate('Item'));
|
327 |
$approvedCounts = $this->Paginator->paginate();
|
| - |
|
328 |
$sql="SELECT retailer_id,count(1) from app_transactions where date(transaction_time)='$date' and payout_description='Approved' group by retailer_id";
|
| - |
|
329 |
$approved = $this->AppTransaction->query($sql);
|
| - |
|
330 |
foreach ($approved as $key => $value1) {
|
| - |
|
331 |
$app_id=$value1['app_transactions']['retailer_id'];
|
| - |
|
332 |
$value22=$value1['0']['count(1)'];
|
| - |
|
333 |
foreach ($approvedCounts as $key2 => $value) {
|
| - |
|
334 |
if($app_id==$value['AppTransaction']['retailer_id']){
|
| - |
|
335 |
$approvedCounts[$key2]['AppTransaction']['approved'] = $value22;
|
| - |
|
336 |
$approvedCounts[$key2]['AppTransaction']['conversion_percentage']=ceil(($value22/$value[0]['count'])*100);
|
| - |
|
337 |
}
|
| - |
|
338 |
}
|
| - |
|
339 |
}
|
| - |
|
340 |
}else if(isset($date_from) && isset($date_to)){
|
| - |
|
341 |
$this->Paginator->settings = array(
|
| 236 |
# $this->Paginator->paginate(array('AppTransaction.' . $this->AppTransaction.'payout_description'=>'Approved'))
|
342 |
'fields' => array('AppTransaction.app_id','retailer_id','app_name', 'COUNT(*) AS count'),
|
| - |
|
343 |
'conditions' => array('Date(AppTransaction.transaction_time) BETWEEN ? AND ?' =>array($date_from, $date_to)),
|
| - |
|
344 |
'order' => 'count desc' ,
|
| - |
|
345 |
'group' => 'retailer_id'
|
| - |
|
346 |
);
|
| - |
|
347 |
$approvedCounts = $this->Paginator->paginate();
|
| - |
|
348 |
$sql="SELECT retailer_id,count(1) from app_transactions where date(transaction_time) BETWEEN '$date_from' and '$date_to' and payout_description='Approved' group by retailer_id";
|
| - |
|
349 |
$approved = $this->AppTransaction->query($sql);
|
| - |
|
350 |
foreach ($approved as $key => $value1) {
|
| - |
|
351 |
$app_id=$value1['app_transactions']['retailer_id'];
|
| - |
|
352 |
$value22=$value1['0']['count(1)'];
|
| - |
|
353 |
foreach ($approvedCounts as $key2 => $value) {
|
| - |
|
354 |
if($app_id==$value['AppTransaction']['retailer_id']){
|
| - |
|
355 |
$approvedCounts[$key2]['AppTransaction']['approved'] = $value22;
|
| - |
|
356 |
$approvedCounts[$key2]['AppTransaction']['conversion_percentage']=ceil(($value22/$value[0]['count'])*100);
|
| - |
|
357 |
}
|
| - |
|
358 |
}
|
| - |
|
359 |
}
|
| - |
|
360 |
}else{
|
| - |
|
361 |
$date = date('Y-m-d',time());
|
| - |
|
362 |
$this->Paginator->settings = array(
|
| - |
|
363 |
'fields' => array('AppTransaction.app_id','retailer_id','app_name', 'COUNT(*) AS count'),
|
| - |
|
364 |
'conditions' => array('Date(AppTransaction.transaction_time)'=>$date),
|
| - |
|
365 |
'order' => 'count desc' ,
|
| - |
|
366 |
'group' => 'retailer_id'
|
| - |
|
367 |
);
|
| - |
|
368 |
$approvedCounts = $this->Paginator->paginate();
|
| - |
|
369 |
$sql="SELECT retailer_id,count(1) from app_transactions where date(transaction_time)='$date' and payout_description='Approved' group by retailer_id";
|
| - |
|
370 |
$approved = $this->AppTransaction->query($sql);
|
| - |
|
371 |
foreach ($approved as $key => $value1) {
|
| - |
|
372 |
$app_id=$value1['app_transactions']['retailer_id'];
|
| - |
|
373 |
$value22=$value1['0']['count(1)'];
|
| - |
|
374 |
foreach ($approvedCounts as $key2 => $value) {
|
| - |
|
375 |
if($app_id==$value['AppTransaction']['retailer_id']){
|
| - |
|
376 |
$approvedCounts[$key2]['AppTransaction']['approved'] = $value22;
|
| - |
|
377 |
$approvedCounts[$key2]['AppTransaction']['conversion_percentage']=ceil(($value22/$value[0]['count'])*100);
|
| - |
|
378 |
}
|
| - |
|
379 |
}
|
| - |
|
380 |
}
|
| - |
|
381 |
}
|
| 237 |
$this->set('appTransactions', $approvedCounts);
|
382 |
$this->set('appTransactions', $approvedCounts);
|
| 238 |
}
|
383 |
}
|
| 239 |
}
|
384 |
}
|
| 240 |
|
385 |
|