public function actionGet_order() { $blind = Blind::find()->where(['id' => $_GET['blId']])->one(); $materials = \backend\modules\supplies\models\Supplies::find()->where(['id' => $_GET['mtId']])->one(); $telephone = $_GET['tel']; $order = new Orders(); $order->blind = (string) $blind->name; $order->materials = (string) $materials->code; $order->telephone = (string) $telephone; $order->dt_add = time(); $order->save(); echo $order->id; $email = Options::find()->where(['key' => 'email_to_prod'])->one(); mail($email->value, "Заказ с вашего сайта", "С вашего сайта заказали:<br>Номер заказа: {$blind->id}<br>Название жалюзи: {$blind->name}<br>Код материала: {$materials->code}<br>Телефон для связ: {$telephone}", "Content-type: text/html; charset=UTF-8\r\n"); }
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 actionComplete() { $id = Yii::$app->request->get('id'); $model = Orders::findOne($id); if ($model->complite == 1) { $complite = 2; } else { $complite = 1; } $products = unserialize($model->product); foreach ($products as $key => $val) { $q = Data::find()->where(['title' => $val['title']])->one(); if ($complite == 2) { $q->quantity = $q->quantity - $val['quantity']; } else { $q->quantity = $q->quantity + $val['quantity']; } $q->update(); } $model->complite = $complite; $model->update(); }
<?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
/** * @return \yii\db\ActiveQuery */ public function getOrders() { return $this->hasMany(Orders::className(), ['PaymentId' => 'PaymentId']); }
public function actionFail() { $id = $_POST["InvId"]; $model = Orders::findOne($id); $notpay = "Отказ от оплаты!!!"; $this->SendMailAdmin($model, $notpay); $model->delete(); echo "Вы отказались то оплаты"; }
/** * @return \yii\db\ActiveQuery */ public function getOrders() { return $this->hasMany(Orders::className(), ['registered_to' => 'id']); }
/** * @return \yii\db\ActiveQuery */ public function getOrders() { return $this->hasMany(Orders::className(), ['OrderStatusId' => 'OrderStatusId']); }
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; }
/** * @return \yii\db\ActiveQuery */ public function getOrders() { return $this->hasMany(Orders::className(), ['lang_code' => 'code']); }
/** * @return \yii\db\ActiveQuery */ public function getOrder() { return $this->hasOne(Orders::className(), ['OrderId' => 'OrderId']); }
<?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
/** * @return \yii\db\ActiveQuery */ public function getOrder() { return $this->hasOne(Orders::className(), ['activity_id' => 'id']); }
/** * Finds the Orders model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param string $id * @return Orders the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Orders::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
/** * @return \yii\db\ActiveQuery */ public function getOrders() { return $this->hasMany(Orders::className(), ['process_id' => 'id']); }
/** * @return \yii\db\ActiveQuery */ public function getOrders0() { return $this->hasMany(Orders::className(), ['loc_id2' => 'id']); }
public function actionIndex() { $orders = Orders::find()->orderBy('dt_add DESC')->all(); return $this->render('index', ['orders' => $orders]); }