Beispiel #1
0
        if ($pos) {
            $yearData = $this->pdo->query('Select c.Id as id, SUM(UnitsInStock)as Quantity, CategoryName from Product as p, Category as c where c.Id = p.CategoryId group by CategoryName order by Quantity DESC LIMIT 3;');
        } else {
            $yearData = $this->pdo->query('Select c.Id as id, SUM(UnitsInStock)as Quantity, CategoryName from Product as p, Category as c where c.Id = p.CategoryId group by CategoryName order by Quantity LIMIT 3;');
        }
        return $yearData->fetchAll(PDO::FETCH_ASSOC);
    }
    public function get_stock()
    {
        $yearData = $this->pdo->query('Select Product.Id, ProductName, CategoryName, UnitPrice, UnitsInStock from Product, Category where Product.Categoryid = Category.Id and Product.UnitsInStock > 0;');
        return $yearData->fetchAll(PDO::FETCH_ASSOC);
    }
    public function get_category()
    {
        $yearData = $this->pdo->query('Select CategoryName from Category group by CategoryName;');
        return $yearData->fetchAll(PDO::FETCH_ASSOC);
    }
}
class SampleDashboard extends TabbedDashboard
{
    public function buildDashboard()
    {
        $sales = new SalesDashboard();
        $stock = new StockDashboard();
        $this->addDashboardTab($sales);
        $this->addDashboardTab($stock);
    }
}
$tabbed = new SampleDashboard();
$tabbed->setStaticRoot("razorflow_php/static/rf/");
$tabbed->renderStandalone();