<?php
/**
 * @package		Ad Platform
 * @author		Uta Marian - Alexandru ( -uMarian- )
 * @license		http://codecanyon.net/licenses
 * @link		http://www.uta-marian.com
 * @version		Version 1.0
 */
require_once(dirname(__FILE__).'/../../config.php');
require_once(DIR_SYSTEM.'/admin/session.admin.php');




$withdrawals = $db->Query("SELECT `pub_withdrawal_type`, `pub_withdrawal_amount`, `pub_withdrawal_status` FROM publishers_withdrawals");



$PENDING	=	0;
$APPROVED	=	0;
$REJECTED	=	0;
$CANCELED	=	0;
$sts		=	array();

foreach ( $withdrawals as $withdrawal ) {

	if ( $withdrawal['pub_withdrawal_status'] == 0 ) {
		$PENDING = $PENDING + $withdrawal['pub_withdrawal_amount'];
	}

	if ( $withdrawal['pub_withdrawal_status'] == 1 ) {
		$APPROVED = $APPROVED + $withdrawal['pub_withdrawal_amount'];
	}

	if ( $withdrawal['pub_withdrawal_status'] == 2 ) {
		$REJECTED = $REJECTED + $withdrawal['pub_withdrawal_amount'];
	}

	if ( $withdrawal['pub_withdrawal_status'] == 3 ) {
		$CANCELED = $CANCELED + $withdrawal['pub_withdrawal_amount'];
	}

}

$sts['PENDING']		=	$PENDING;
$sts['APPROVED']	=	$APPROVED;
$sts['REJECTED']	=	$REJECTED;
$sts['CANCELED']	=	$CANCELED;

$view->sts	=	$sts;






//**DEFINE CUSTOM CSS/JS FILLES**//
$view->customCode = '<link href="'.HTTP_SERVER_WEBSITE.'templates/'.ADMIN_TEMPLATE.'/assets/css/dashboard.css" rel="stylesheet">';

/* set page title */
$view->title = $LANG["WBS_ADMIN_REQUESTS_STATS_SEO"];
$view->description = $LANG["WBS_ADMIN_REQUESTS_STATS_SEO"];
$view->keywords = $LANG["WBS_ADMIN_REQUESTS_STATS_SEO"];

$view->header = $view->render(DIR_TEMPLATE.ADMIN_TEMPLATE.'/header.php');
$view->footer = $view->render(DIR_TEMPLATE.ADMIN_TEMPLATE.'/footer.php');

echo $view->render(DIR_TEMPLATE.ADMIN_TEMPLATE.'/requests/statistics.php');
?>