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]); }
public function init() { parent::init(); $this->notify_new_count = Notify::find()->where('status=1')->count(); $this->notify_count = Notify::find()->count(); $this->callback_new_count = Callback::find()->where('status=1')->count(); $this->callback_count = Callback::find()->count(); $this->orders_count = Orders::find()->count(); $this->orders_new_count = Orders::find()->where('statusID=2')->count(); }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Orders::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); if (!($this->load($params) && $this->validate())) { return $dataProvider; } $query->andFilterWhere(['OrderId' => $this->OrderId, 'CustomerId' => $this->CustomerId, 'CampaignId' => $this->CampaignId, 'PaymentId' => $this->PaymentId, 'OrderStatusId' => $this->OrderStatusId, 'InvoicedOn' => $this->InvoicedOn, 'PaidAmount' => $this->PaidAmount, 'TotalDiscountAmount' => $this->TotalDiscountAmount, 'TaxAmount' => $this->TaxAmount, 'created_by' => $this->created_by, 'LastUpdatedBy' => $this->LastUpdatedBy, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at, 'deleted_at' => $this->deleted_at]); $query->andFilterWhere(['like', 'CustomerNote', $this->CustomerNote])->andFilterWhere(['like', 'InvoiceAddressText', $this->InvoiceAddressText])->andFilterWhere(['like', 'InvoicePerson', $this->InvoicePerson])->andFilterWhere(['like', 'InvoiceTaxNumber', $this->InvoiceTaxNumber])->andFilterWhere(['like', 'InvoiceTaxOffice', $this->InvoiceTaxOffice])->andFilterWhere(['like', 'Comment', $this->Comment]); return $dataProvider; }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Orders::find(); $query->joinWith(['activity', 'services']); $query->andFilterWhere(['activities.user_id' => Yii::$app->user->id]); $dataProvider = new ActiveDataProvider(['query' => $query]); // Important: here is how we set up the sorting // The key is the attribute name $dataProvider->sort->attributes['time_asc'] = ['asc' => ['activities.time' => SORT_ASC]]; $dataProvider->sort->attributes['time_desc'] = ['asc' => ['activities.time' => SORT_DESC]]; $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([ 'id' => $this->id, 'activity_id' => $this->activity_id, 'loc_id' => $this->loc_id, 'loc_id2' => $this->loc_id2, 'loc_within' => $this->loc_within, 'delivery_starts' => $this->delivery_starts, 'delivery_ends' => $this->delivery_ends, 'orders.validity' => $this->validity, 'update_time' => $this->update_time, 'registered_to' => $this->registered_to, 'phone_contact' => $this->phone_contact, 'turn_key' => $this->turn_key, 'process_id' => $this->process_id, 'success' => $this->success, 'success_time' => $this->success_time, 'hit_counter' => $this->hit_counter, ]); $query->andFilterWhere(['like', 'lang_code', $this->lang_code]) ->andFilterWhere(['like', 'class', $this->class]) ->andFilterWhere(['like', 'order_type', $this->order_type]);*/ $query->andFilterWhere(['like', 'cs_services.name', $this->service]); return $dataProvider; }
public function findOrder($id) { if ($activity = \common\models\Activities::find()->where(['activity' => 'order', 'user_id' => $id])->one()) { if ($order = \common\models\Orders::find()->where(['activity_id' => $activity->id])->one()) { return $order; } } return null; }
<?php use yii\helpers\Html; use yii\helpers\HtmlPurifier; use yii\helpers\Url; ?> <div class="card_container record-xl grid-item fadeInUp animated" id="card_container<?php echo $model->id; ?> " style="float:none;"> <?php switch ($model->activity) { case 'order': echo $this->render('/orders/_card_compact.php', ['model' => \common\models\Orders::find('activity=' . $model->id)->one()]); break; case 'promotion': echo $this->render('/promotions/_card_compact.php', ['model' => \common\models\Promotions::find('activity=' . $model->id)->one()]); break; case 'presentation': echo $this->render('/presentations/_card_compact.php', ['model' => \common\models\Presentations::find('activity=' . $model->id)->one()]); break; default: //echo $this->render('/orders/_card_compact.php', ['model'=>\common\models\Orders::findOne('activity='.$model->id)]); break; } if ($model->activity == 'order' && $model->bid) { ?> <div class="action-area normal-case"> <?php
/** * Lists all Orders models. * @return mixed */ public function actionIndex() { $dataProvider = new ActiveDataProvider(['query' => Orders::find()->orderBy('order_time desc')]); return $this->render('index', ['dataProvider' => $dataProvider]); }
<?php use yii\helpers\Html; use yii\bootstrap\ActiveForm; use yii\helpers\ArrayHelper; use common\models\Customers; use common\models\Orders; use common\models\Giftcards; /* @var $this yii\web\View */ /* @var $model common\models\Giftcardhistories */ /* @var $form yii\widgets\ActiveForm */ $dataCustomers = ArrayHelper::map(Customers::find()->asArray()->all(), 'CustomerId', 'UserId'); $dataOrders = ArrayHelper::map(Orders::find()->asArray()->all(), 'OrderID', 'Name'); $dataGiftCards = ArrayHelper::map(Giftcards::find()->asArray()->all(), 'GiftCardId', 'Name'); ?> <div class="giftcardhistories-form"> <?php $form = ActiveForm::begin(['layout' => 'horizontal']); ?> <?php echo $form->field($model, 'GiftCardID', ['horizontalCssClasses' => ['wrapper' => 'col-sm-4']])->dropDownList($dataGiftCards, ['prompt' => 'Choose']); ?> <?php echo $form->field($model, 'CustomerID', ['horizontalCssClasses' => ['wrapper' => 'col-sm-4']])->dropDownList($dataCustomers, ['prompt' => 'Choose']); ?> <?php
public function actionIndex() { $models = Orders::find()->orderBy(['complite' => SORT_ASC, 'id' => SORT_DESC])->all(); return $this->render('index', ['models' => $models]); }
public function actionIndex() { $orders = Orders::find()->orderBy('dt_add DESC')->all(); return $this->render('index', ['orders' => $orders]); }