/**
  * This is the default 'index' action that is invoked
  * when an action is not explicitly requested by users.
  */
 public function actionIndex()
 {
     $weeklySalesReport = new WeeklySalesReport();
     $thisWeeksSale = $weeklySalesReport->getCurrentWeekSales();
     $monthlySalesReport = new MonthlySalesReport();
     $wholeMonthSale = $monthlySalesReport->getThisMonthsReport();
     $annualReportObj = new AnnualReport();
     $annualMonthlyReport = $annualReportObj->getAnnualMonthlyReport();
     $productModel = new Product('search');
     $productModel->unsetAttributes();
     if (isset($_GET['Product'])) {
         $productModel->attributes = $_GET['Product'];
     }
     $materialModel = new Materials('search');
     $materialModel->unsetAttributes();
     if (isset($_GET['Materials'])) {
         $materialModel->attributes = $_GET['Materials'];
     }
     $this->render('index', compact('productModel', 'materialModel', 'thisWeeksSale', 'wholeWeekReport', 'wholeMonthSale', 'annualMonthlyReport'));
 }
 /**
  * Manages all models.
  */
 public function actionAdmin()
 {
     $this->layout = "materials";
     $model = new Materials('search');
     $model->unsetAttributes();
     // clear any default values
     if (isset($_GET['Materials'])) {
         $model->attributes = $_GET['Materials'];
     }
     $this->render('admin', array('model' => $model));
 }