Magento Module: Resource Planning System

A series of resource planning tools for internal use.

Details

This module was developed to provide specific reports on utilization of development hours. It was built as a Magento admin panel feature. Although never finished, its intention was to leverage utilization reporting to automatically schedule resources to tasks on a weekly basis.

Screenshots

Viewing a utilization report for a range of time

Technical Features

N/A

Code Sample

protected function _prepareChart()
{
    $this->setChartType('BarChart')
        ->setOption('hAxis', new Khill\Lavacharts\Configs\HorizontalAxis(array('format' => '#%')));

    $api            = Mage::getSingleton('harvest/api_adapter')->setJoinClientFlag(true);
    $clients        = $api->getClients();
    $clientData     = array();
    $viewSize       = is_numeric($this->getFilterData('view_size')) ? $this->getFilterData('view_size') : self::DEFAULT_VIEW_SIZE;
    $dataTable      = $this->getDataTable();

    $dataTable->addStringColumn($this->__('Client'))
        ->addNumberColumn('Usage');

    foreach ($clients as $client) {
        $projects       = $api->getClientProjects($client->getId());
        $targetProject  = $projects->getItemByColumnValue('name', self::PROJECT_NAME);

        if ($targetProject) {
            $totalAvailable     = $this->calculateTotalBudget($targetProject);
            $amountUsed         = $this->getBudgetUsage($targetProject);
            $percentUsed        = $totalAvailable ? round( ( $amountUsed / $totalAvailable ), 1 ) : 0;

            $clientData[$client->getId()] = $percentUsed;

            continue;
        }
    }

    arsort($clientData);
    $view = $viewSize > 0 ? array_slice($clientData, 0, $viewSize, true) : $clientData;

    foreach ($view as $clientId => $percentUsed) {
        $dataTable->addRow(array($clients->getItemById($clientId)->getName(), $percentUsed));
    }

    return $this;
}

Static Analysis