Subversion Repositories SmartDukaan

Rev

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

Rev 16911 Rev 16943
Line 694... Line 694...
694
		}
694
		}
695
	}	
695
	}	
696
	$this->set('retailerId',$retailer_id)	;
696
	$this->set('retailerId',$retailer_id)	;
697
	$this->set('appTransactions',$approvedCounts)	;
697
	$this->set('appTransactions',$approvedCounts)	;
698
	}
698
	}
699
}
-
 
700
 
-
 
701
 
-
 
702
 
699
 
-
 
700
	public function admin_pricewise(){
-
 
701
		$this->AppTransaction->recursive = -1;
-
 
702
		$type = $this->request->query('date');
-
 
703
		$date_from = $this->request->query('date_from');
-
 
704
		$date_to = $this->request->query('date_to');
-
 
705
		if(!isset($type) && !isset($date_from) && !isset($date_to)){
-
 
706
			$date = date('Y-m-d',time());		
-
 
707
			$showDate=' for '.$date;
-
 
708
			$this->Paginator->settings = array(
-
 
709
	    	'fields' => array('sum(offer_price) as offer_price','sum(final_user_payout) as payout_amount'),
-
 
710
	    	'conditions' => array('Date(AppTransaction.transaction_time)'=>$date,'payout_description'=>'Approved'),
-
 
711
	    	);
-
 
712
		  	$approvedCounts =  $this->Paginator->paginate();
-
 
713
		}
-
 
714
		else if($type=='yesterday'){
-
 
715
			$date = date('Y-m-d',time()-86400);		
-
 
716
			$showDate=' for '.$date;
-
 
717
			$this->Paginator->settings = array(
-
 
718
	    	'fields' => array('sum(offer_price) as offer_price','sum(final_user_payout) as payout_amount'),
-
 
719
	    	'conditions' => array('Date(AppTransaction.transaction_time)'=>$date,'payout_description'=>'Approved'),
-
 
720
	  		);
-
 
721
		  	$approvedCounts =  $this->Paginator->paginate();
-
 
722
		}else if(isset($date_from) && isset($date_to)){
-
 
723
			$showDate='between '. $date_from.' & '.$date_to;
-
 
724
			$this->Paginator->settings = array(
-
 
725
	    	'fields' => array('sum(offer_price) as offer_price','sum(final_user_payout) as payout_amount'),
-
 
726
	    	'conditions' => array('Date(AppTransaction.transaction_time) BETWEEN ? AND ?' =>array($date_from, $date_to),'payout_description'=>'Approved'),
-
 
727
	    	);
-
 
728
		  	$approvedCounts =  $this->Paginator->paginate();
-
 
729
		}else{
-
 
730
			$date = date('Y-m-d',time());
-
 
731
			$showDate=' for '.$date;
-
 
732
			$this->Paginator->settings = array(
-
 
733
	    	'fields' => array('sum(offer_price) as offer_price','sum(final_user_payout) as payout_amount'),
-
 
734
	    	'conditions' => array('Date(AppTransaction.transaction_time)'=>$date,'payout_description'=>'Approved'),
-
 
735
	  		);
-
 
736
		  	$approvedCounts =  $this->Paginator->paginate();
-
 
737
		}
-
 
738
		$totalSum=$this->AppTransaction->find('all',array(
-
 
739
			'fields' => array('sum(offer_price) as total_offer_price','sum(final_user_payout)as total_payout_amount'),
-
 
740
	    	'conditions' => array('payout_description'=>'Approved')
-
 
741
	    ));		
-
 
742
		$this->set('date',$showDate);
-
 
743
		$this->set('datewiseTotal',$approvedCounts);
-
 
744
		$this->set('total',$totalSum);
-
 
745
	}
-
 
746
}
703
747