protected function initAllSubAffStats() {
		$statParams = new Pap_Stats_Params();
		$statParams->initFrom($this->filters);
		$statParams->setType(Pap_Common_Constants::TYPE_SALE . ',' . Pap_Common_Constants::TYPE_CLICK);
		
		$transactionStats = new Pap_Stats_Computer_TransactionsStatsBuilder($statParams, Pap_Db_Table_Transactions::USER_ID, Pap_Db_Table_Transactions::USERID, false);				      
		$transactionStats->getTransactionsWhereClause()->add(Pap_Db_Table_Transactions::PARRENT_TRANSACTION_ID, '!=', null);
		$transactionStats->getTransactionsWhereClause()->add(Pap_Db_Table_Transactions::PARRENT_TRANSACTION_ID, '<>', '');				
		$allSubStats = $transactionStats->getStatsSelect();
		
		try {
			$allSubStatsRow = $allSubStats->getOneRow();
			$this->subAffCommissions = $allSubStatsRow->get(Pap_Db_Table_Transactions::COMMISSION);
			$this->subAffSaleCount = $allSubStatsRow->get('count');
		} catch (Gpf_DbEngine_NoRowException $e) {			
			$this->subAffCommissions = 0;
			$this->subAffSaleCount = 0;
		}
	}
 /**
  * @param Pap_Stats_Params $statParams
  * @return Gpf_SqlBuilder_SelectBuilder
  */
 protected function getTransactionStatsSelect(Pap_Stats_Params $statParams) {
     $this->columnsToDatabaseNames['referrerurl'] = Pap_Common_StatsGrid::GROUP_COLUMN_ALIAS;
     $transactionStats = new Pap_Stats_Computer_TransactionsStatsBuilder($statParams, $this->groupColumn, Pap_Common_StatsGrid::GROUP_COLUMN_ALIAS);
     $transactionStats->getTransactionsWhereClause()->add(Pap_Db_Table_Transactions::R_TYPE, '=', Pap_Common_Constants::TYPE_SALE);
     $transactionStats->getTransactionsWhereClause()->add($this->groupColumn, 'is not', 'NULL', 'AND', false);
     $transactionStatsSelect = $transactionStats->getStatsSelect();
     $transactionStatsSelect->orderBy->add($this->columnsToDatabaseNames[$this->_sortColumn], $this->_sortAsc);
     if (!$this->isCSVFileRequest) {
         $this->initLimit();
         $transactionStatsSelect->limit->set($this->offset, $this->limit);
     }
     return $transactionStatsSelect;
 }
示例#3
0
 /**
  * @param Pap_Stats_Params $statParams
  * @return Gpf_SqlBuilder_SelectBuilder
  */
 protected function getTransactionStatsSelect(Pap_Stats_Params $statParams) {
     $transactionStats = new Pap_Stats_Computer_TransactionsStatsBuilder($statParams, $this->groupColumn, self::GROUP_COLUMN_ALIAS);
     $transactionStats->getTransactionsWhereClause()->add(Pap_Db_Table_Transactions::R_TYPE, '=', Pap_Common_Constants::TYPE_SALE);
     return $transactionStats->getStatsSelect();
 }