public function actionLedger() { $data = Yii::$app->request->get(); $year = isset($data['year']) ? $data['year'] : 0; $month = isset($data['month']) ? $data['month'] : 0; if ($year != 0 && $month != 0) { $t = Helper::getFristAndLasttimeline($year, $month); $firstday = $t['firstday']; $lastday = $t['lastday']; var_dump($t); $orders = Orders::find()->where('created_at >= :start AND created_at < :end AND fac_no != 0 ', [':start' => $firstday, ':end' => $lastday]); $dataProvider = new ActiveDataProvider(['query' => $orders, 'pagination' => ['pagesize' => '20']]); return $this->render('ledger', ['model' => $orders, 'dataProvider' => $dataProvider, 'year' => $year, 'month' => $month, 'firstday' => $firstday, 'lastday' => $lastday]); } else { return $this->render('ledger', ['model' => null]); } }