<?php

use app\base\Common;
use app\models\Attandance;
use app\models\Registration;
use yii\data\ActiveDataProvider;
use yii\data\ArrayDataProvider;
use yii\data\SqlDataProvider;
use yii\db\Query;

$this->title = 'Dashboard\'s';

$today = strtotime(date("Y/m/d"));
$date = strtotime(date("Y/m/d"));

$query = Attandance::find()->with("registration")->where(["record_date" => $today]);
$dataProvider1 = new ActiveDataProvider(['query' => $query, 'sort' => false,'pagination' => ['pagesize' => 5]]);

$attntable = Attandance::tableName();
$query = Registration::find()->where("DATEDIFF(NOW(),FROM_UNIXTIME(record_date))>70")->andWhere("corfrm_pid IN (SELECT pid FROM $attntable WHERE visit_date between $date AND ".date('U'). " And out_interviewer IS NULL AND visit_out IS NULL)")->orderBy(["corfrm_pid" => SORT_ASC]);
$dataProvider4 = new ActiveDataProvider(['query' => $query, 'sort' => false,'pagination' => ['pagesize' => 5]]);


 
?>

<div class="row">
    <div class="col-md-12"><?= $this->render('attandance', ['dataProvider' => $dataProvider1]); ?></div>        
    <div class="col-md-12"><?= $this->render('moblienoupdate', ['dataProvider' => $dataProvider4]); ?></div>
    
</div>