예제 #1
0
 public function actionIndex()
 {
     /**
      * fetch a count of customers
      */
     $custCount = Customers::find()->count();
     /**
      * fetch the orders for today
      */
     $orders = Orderstatuses::find()->where('StatusOrder = 1')->count();
     /**
      * fetch the visitor count from the ebsite
      */
     $vistors = 0;
     /**
      * fetch the profit year to date
      */
     $profitytd = Orderdetails::find()->all();
     /**
      * fetch todays profit
      */
     $todayprofit = Orders::find()->with(['orderdetails', 'orderStatus'])->where('OrderStatusId = 1')->all();
     /**
      * fetch the count of active campaigns
      */
     $campaigncount = Campaigns::find()->where('EndedOn = NULL')->count();
     /**
      * count of queued emails
      */
     $countQueued = Queuedemails::find()->where('SentOn <> NULL')->count();
     return $this->render('index', ['custCount' => $custCount, 'orders' => $orders, 'profitytd' => $profitytd, 'todayprofit' => $todayprofit, 'campaigncount' => $campaigncount, 'countQueued' => $countQueued]);
 }
예제 #2
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Orderdetails::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query->andFilterWhere(['OrderDetailId' => $this->OrderDetailId, 'OrderId' => $this->OrderId, 'ProductId' => $this->ProductId, 'Quantity' => $this->Quantity, 'Price' => $this->Price, 'Amount' => $this->Amount, 'DiscountedAmount' => $this->DiscountedAmount, 'TaxRate' => $this->TaxRate, 'TaxAmout' => $this->TaxAmout, 'ShippedOn' => $this->ShippedOn, 'pProductCategoryId' => $this->pProductCategoryId, 'pSupplierId' => $this->pSupplierId, 'pBrandId' => $this->pBrandId, 'pProductTypeId' => $this->pProductTypeId, 'pMarketPrice' => $this->pMarketPrice, 'pPriceFromSupplier' => $this->pPriceFromSupplier, 'pDiscountPercent' => $this->pDiscountPercent, 'pCommissionPercent' => $this->pCommissionPercent, 'pTaxPercent' => $this->pTaxPercent, 'pHasDifferentPriceForOptions' => $this->pHasDifferentPriceForOptions, 'deleted_at' => $this->deleted_at, 'created_by' => $this->created_by, 'LastUpdatedBy' => $this->LastUpdatedBy, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at]);
     $query->andFilterWhere(['like', 'pGender', $this->pGender])->andFilterWhere(['like', 'pName', $this->pName])->andFilterWhere(['like', 'pSupplierDescription', $this->pSupplierDescription])->andFilterWhere(['like', 'pDescription', $this->pDescription])->andFilterWhere(['like', 'pShortDescription', $this->pShortDescription])->andFilterWhere(['like', 'pHtmlDescription', $this->pHtmlDescription])->andFilterWhere(['like', 'pUrlName', $this->pUrlName])->andFilterWhere(['like', 'pBarcode', $this->pBarcode])->andFilterWhere(['like', 'Comment', $this->Comment]);
     return $dataProvider;
 }
예제 #3
0
 /**
  * Finds the Orderdetails model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Orderdetails the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Orderdetails::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
예제 #4
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getOrderdetails()
 {
     return $this->hasMany(Orderdetails::className(), ['OrderId' => 'OrderId']);
 }