Пример #1
0
} elseif (!empty($_REQUEST['timeframe'])) {
    $statsByType = $stats->getRevenueByType($_REQUEST);
    $gBitSmarty->assign_by_ref('statsByType', $statsByType);
    $statsByOption = $stats->getRevenueByOption($_REQUEST);
    foreach ($statsByOption as $stat) {
        @($statsByOptionTotalUnits[$stat['products_options_id']] += $stat['total_units']);
    }
    $gBitSmarty->assign('statsByOption', $statsByOption);
    $gBitSmarty->assign('statsByOptionTotalUnits', $statsByOptionTotalUnits);
    $gBitSmarty->assign('statsCustomers', $stats->getCustomerConversions($_REQUEST));
    $gBitSmarty->assign('valuableInterests', $stats->getMostValuableInterests($_REQUEST));
    $gBitSmarty->assign('valuableCustomers', $stats->getMostValuableCustomers($_REQUEST));
    $gBitSystem->display('bitpackage:bitcommerce/admin_revenue_timeframe.tpl', 'Revenue By Timeframe', array('display_mode' => 'admin'));
} else {
    $listHash['max_records'] = -1;
    $revStats = $stats->getAggregateRevenue($listHash);
    $gBitSmarty->assign('stats', $revStats);
    if (BitBase::getParameter($_REQUEST, 'display') == 'matrix') {
        switch (BitBase::getParameter($_REQUEST, 'period')) {
            case 'Y-':
                $headers = array('');
                break;
            case 'Y-\\QQ':
                $headers = array('Q1', 'Q2', 'Q3', 'Q4');
                break;
            case 'Y-m':
                $headers = array('01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12');
                break;
            case 'Y-\\WeekW':
            default:
                for ($i = 1; $i <= 53; $i++) {
Пример #2
0
<?php

require_once BITCOMMERCE_PKG_PATH . 'classes/CommerceStatistics.php';
$stats = new CommerceStatistics();
$listHash = array('period' => 'Y-m-d', 'max_records' => 8);
$statData = $stats->getAggregateRevenue($listHash);
$gBitSmarty->assign_by_ref('stats', $statData);
$gBitSmarty->assign('revenueTitle', 'Daily');
$gBitSmarty->assign('statPeriod', 'Y-m-d');
print '<div class="col-md-12 col-sm-6"><div class="well nopadding">' . $gBitSmarty->fetch('bitpackage:bitcommerce/admin_revenue_inc.tpl') . '</div></div>';
$listHash = array('period' => 'Y-\\WeekW', 'max_records' => 13);
$statData = $stats->getAggregateRevenue($listHash);
$gBitSmarty->assign_by_ref('stats', $statData);
$gBitSmarty->assign('revenueTitle', 'Weekly');
$gBitSmarty->assign('statPeriod', 'Y-\\WeekW');
print '<div class="col-md-12 col-sm-6"><div class="well nopadding">' . $gBitSmarty->fetch('bitpackage:bitcommerce/admin_revenue_inc.tpl') . '</div></div>';
$listHash = array('period' => 'Y-m', 'max_records' => 13);
$statData = $stats->getAggregateRevenue($listHash);
$gBitSmarty->assign_by_ref('stats', $statData);
$gBitSmarty->assign('revenueTitle', 'Monthly');
$gBitSmarty->assign('statPeriod', 'Y-m');
print '<div class="col-md-12 col-sm-6"><div class="well nopadding">' . $gBitSmarty->fetch('bitpackage:bitcommerce/admin_revenue_inc.tpl') . '</div></div>';
$listHash = array('period' => 'Y-\\QQ', 'max_records' => 5);
$statData = $stats->getAggregateRevenue($listHash);
$gBitSmarty->assign_by_ref('stats', $statData);
$gBitSmarty->assign('revenueTitle', 'Quarterly');
$gBitSmarty->assign('statPeriod', 'Y-\\QQ');
print '<div class="col-md-12 col-sm-6"><div class="well nopadding">' . $gBitSmarty->fetch('bitpackage:bitcommerce/admin_revenue_inc.tpl') . '</div></div>';
$listHash = array('period' => 'Y-', 'max_records' => 10);
$statData = $stats->getAggregateRevenue($listHash);
$gBitSmarty->assign_by_ref('stats', $statData);