public function actionIndex() { $searchModel = new UdashboardSearch(); $dataProvider = $searchModel->search(Yii::$app->request->queryParams); $countSaleorder = \backend\models\Saleorder::find()->count(); $countInvoice = \backend\models\Saleorderinvoice::find()->count(); return $this->render('index', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider, 'salecount' => $countSaleorder, 'invoicecount' => $countInvoice]); }
public function actionIndex() { $searchModel = new UdashboardSearch(); $dataProvider = $searchModel->search(Yii::$app->request->queryParams); $countSaleorder = \backend\models\Saleorder::find()->count(); $countInvoice = \backend\models\Saleorderinvoice::find()->count(); $lastSale = \backend\models\Saleorder::find()->orderBy('createdate DESC')->limit(10)->all(); $lastInv = \backend\models\Saleorderinvoice::find()->orderBy('createdate DESC')->limit(10)->all(); return $this->render('index', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider, 'salecount' => $countSaleorder, 'invoicecount' => $countInvoice, 'lastsale' => $lastSale, 'lastinv' => $lastInv]); }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Saleorder::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); $this->load($params); if (!$this->validate()) { // uncomment the following line if you do not want to return any records when validation fails // $query->where('0=1'); return $dataProvider; } // $query->andFilterWhere([ // 'recid' => $this->recid, // 'saledate' => $this->saledate, // 'shipdate' => $this->shipdate, // 'currencyrate' => $this->currencyrate, // 'createdate' => $this->createdate, // ]); $query->orFilterWhere(['like', 'saleno', $this->globalSearch])->orFilterWhere(['like', 'customer', $this->globalSearch])->orFilterWhere(['like', 'saleman', $this->globalSearch])->orFilterWhere(['like', 'refno', $this->globalSearch])->orFilterWhere(['like', 'description', $this->globalSearch])->orFilterWhere(['like', 'shipfrom', $this->globalSearch])->orFilterWhere(['like', 'shipto', $this->globalSearch])->orFilterWhere(['like', 'paymentterm', $this->globalSearch])->orFilterWhere(['like', 'currency', $this->globalSearch]); return $dataProvider; }
public function actionIndex() { $count = Saleorder::find()->count(); $model = Saleorder::find()->all(); return $this->renderAjax('index', ['model' => $model, 'rowcount' => $count]); }
/** * Finds the Saleorder model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Saleorder the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Saleorder::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
public function getSaleorder() { return $this->hasOne(\backend\models\Saleorder::className(), ['recid' => 'salerefid']); }