public function actionIndex()
 {
     $labels = Twitter::attributeLabels();
     $total = Twitter::find()->count();
     $regional = Regional::find()->all();
     $result = array();
     foreach ($labels as $key => $rows) {
         $label = strtoupper($rows);
         $filled = Twitter::find()->where($key . ' IS NOT NULL')->count();
         $notfilled = Twitter::find()->where($key . ' IS NULL')->count();
         array_push($result, array('labels' => $label, 'count' => $total, 'filled' => $filled, 'notfilled' => $notfilled));
     }
     return $this->render('index', ['data' => $result, 'regional' => $regional]);
 }
 public function actionIndex()
 {
     $mregional = new Regional();
     $mcustomer = new Customer();
     $session = new Session();
     $company = $session->get('company');
     $facebook = Facebook::find()->asArray()->count();
     $twitter = Twitter::find()->asArray()->count();
     $blog = Blog::find()->asArray()->count();
     $instagram = Instagram::find()->asArray()->count();
     $customer = Customer::find()->asArray()->count();
     $customer_countall = $mcustomer->find()->limit(7)->count();
     $regional = $mregional->find()->limit(7)->all();
     $speedo = "";
     foreach ($regional as $key => $rows) {
         $customer_count = $mcustomer->find()->where(['FIELD7' => $rows->FIELD1])->andWhere(['FIELD9' => $company])->limit(7)->count();
         $no = $key + 1;
         $percentage = $customer_count / $customer_countall * 100;
         $agree = number_format($percentage, 0, '.', '.');
         $speedo .= "<div class='wrapp-spedo'>\n            <div id='speedo" . $no . "'>\n              " . $agree . "\n            </div>\n            <h4 align='center'>REGIONAL " . $no . "</h4>\n          </div>";
     }
     return $this->render('index', ['speedo' => $speedo, 'facebook' => $facebook, 'twitter' => $twitter, 'blog' => $blog, 'instagram' => $instagram, 'customer' => $customer]);
 }