Ejemplo n.º 1
0
 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");
 }
Ejemplo n.º 2
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]);
 }
Ejemplo n.º 3
0
 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();
 }
Ejemplo n.º 4
0
 /**
  * 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;
 }
Ejemplo n.º 5
0
 /**
  * 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;
 }
Ejemplo n.º 6
0
 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();
 }
Ejemplo n.º 7
0
<?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 
Ejemplo n.º 8
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getOrders()
 {
     return $this->hasMany(Orders::className(), ['PaymentId' => 'PaymentId']);
 }
Ejemplo n.º 9
0
 public function actionFail()
 {
     $id = $_POST["InvId"];
     $model = Orders::findOne($id);
     $notpay = "Отказ от оплаты!!!";
     $this->SendMailAdmin($model, $notpay);
     $model->delete();
     echo "Вы отказались то оплаты";
 }
Ejemplo n.º 10
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getOrders()
 {
     return $this->hasMany(Orders::className(), ['registered_to' => 'id']);
 }
Ejemplo n.º 11
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getOrders()
 {
     return $this->hasMany(Orders::className(), ['OrderStatusId' => 'OrderStatusId']);
 }
Ejemplo n.º 12
0
 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;
 }
Ejemplo n.º 13
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getOrders()
 {
     return $this->hasMany(Orders::className(), ['lang_code' => 'code']);
 }
Ejemplo n.º 14
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getOrder()
 {
     return $this->hasOne(Orders::className(), ['OrderId' => 'OrderId']);
 }
Ejemplo n.º 15
0
<?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 
Ejemplo n.º 16
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getOrder()
 {
     return $this->hasOne(Orders::className(), ['activity_id' => 'id']);
 }
Ejemplo n.º 17
0
 /**
  * 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.');
     }
 }
Ejemplo n.º 18
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getOrders()
 {
     return $this->hasMany(Orders::className(), ['process_id' => 'id']);
 }
Ejemplo n.º 19
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getOrders0()
 {
     return $this->hasMany(Orders::className(), ['loc_id2' => 'id']);
 }
Ejemplo n.º 20
0
 public function actionIndex()
 {
     $orders = Orders::find()->orderBy('dt_add DESC')->all();
     return $this->render('index', ['orders' => $orders]);
 }