Commit f68e7edd732f179a8b4eb39a3ba0ce8b2dc4dbd8
1 parent
8e7f5c9b
add bills models, views, migrations
Showing
27 changed files
with
1290 additions
and
310 deletions
Show diff stats
1 | +<?php | |
2 | + | |
3 | +namespace backend\controllers; | |
4 | + | |
5 | +use Yii; | |
6 | +use common\models\CartBillsView; | |
7 | +use common\models\CartBillsSearch; | |
8 | +use backend\components\base\BaseController; | |
9 | +use yii\web\NotFoundHttpException; | |
10 | +use yii\filters\VerbFilter; | |
11 | + | |
12 | +/** | |
13 | + * CartController implements the CRUD actions for CartBills model. | |
14 | + */ | |
15 | +class CartController extends BaseController | |
16 | +{ | |
17 | + public $layout = "/column"; | |
18 | + | |
19 | + /** | |
20 | + * Lists all CartBills models. | |
21 | + * @return mixed | |
22 | + */ | |
23 | + public function actionIndex() | |
24 | + { | |
25 | + $searchModel = new CartBillsSearch(); | |
26 | + $dataProvider = $searchModel->search(Yii::$app->request->queryParams); | |
27 | + | |
28 | + return $this->render('index', [ | |
29 | + 'searchModel' => $searchModel, | |
30 | + 'dataProvider' => $dataProvider, | |
31 | + ]); | |
32 | + } | |
33 | + | |
34 | + /** | |
35 | + * Displays a single CartBills model. | |
36 | + * @param string $id | |
37 | + * @return mixed | |
38 | + */ | |
39 | + public function actionView($id) | |
40 | + { | |
41 | + return $this->render('view', [ | |
42 | + 'model' => $this->findModel($id), | |
43 | + ]); | |
44 | + } | |
45 | + | |
46 | + | |
47 | + /** | |
48 | + * Finds the CartBills model based on its primary key value. | |
49 | + * If the model is not found, a 404 HTTP exception will be thrown. | |
50 | + * @param string $id | |
51 | + * @return CartBills the loaded model | |
52 | + * @throws NotFoundHttpException if the model cannot be found | |
53 | + */ | |
54 | + protected function findModel($id) | |
55 | + { | |
56 | + if (($model = CartBillsView::findById($id)) !== null) { | |
57 | + return $model; | |
58 | + } else { | |
59 | + throw new NotFoundHttpException('The requested page does not exist.'); | |
60 | + } | |
61 | + } | |
62 | +} | ... | ... |
backend/controllers/Check_priceController.php deleted
1 | -<?php | |
2 | -namespace backend\controllers; | |
3 | - | |
4 | -use Yii; | |
5 | -use yii\bootstrap\Modal; | |
6 | -use yii\data\ActiveDataProvider; | |
7 | -use yii\filters\AccessControl; | |
8 | -use backend\components\base\BaseController; | |
9 | -use yii\filters\VerbFilter; | |
10 | -use backend\models\UploadFileParsingForm; | |
11 | -use yii\web\UploadedFile; | |
12 | -use yii\data\ArrayDataProvider; | |
13 | -use yii\multiparser\DynamicFormHelper; | |
14 | -use backend\components\parsers\CustomParserConfigurator; | |
15 | -use backend\models\Details; | |
16 | -use backend\models\ImporterFiles; | |
17 | -use backend\models\Importer; | |
18 | -use yii\base\ErrorException; | |
19 | -use yii\db\Query; | |
20 | - | |
21 | -use common\components\CustomVarDamp; | |
22 | - | |
23 | -/** | |
24 | - * Parser controller | |
25 | - */ | |
26 | -class Check_priceController extends BaseController | |
27 | -{ | |
28 | - public $layout = "/column"; | |
29 | - | |
30 | - /** | |
31 | - * @inheritdoc | |
32 | - */ | |
33 | - public function behaviors() | |
34 | - { | |
35 | - return [ | |
36 | - 'access' => [ | |
37 | - 'class' => AccessControl::className(), | |
38 | - 'rules' => [ | |
39 | - [ | |
40 | - 'actions' => ['index', 'view'], | |
41 | - 'allow' => true, | |
42 | - 'roles' => ['@'], | |
43 | - ], | |
44 | - ], | |
45 | - ], | |
46 | -// 'verbs' => [ | |
47 | -// 'class' => VerbFilter::className(), | |
48 | -// 'actions' => [ | |
49 | -// 'logout' => ['post'], | |
50 | -// ], | |
51 | -// ], | |
52 | - ]; | |
53 | - } | |
54 | - | |
55 | - /** | |
56 | - * @inheritdoc | |
57 | - */ | |
58 | - public function actions() | |
59 | - { | |
60 | - return [ | |
61 | - 'error' => [ | |
62 | - 'class' => 'yii\web\ErrorAction', | |
63 | - ], | |
64 | - ]; | |
65 | - } | |
66 | - | |
67 | - | |
68 | - public function actionIndex() | |
69 | - { | |
70 | - | |
71 | - if(Yii::$app->request->isAjax){ | |
72 | - CustomVarDamp::dumpAndDie(1); | |
73 | - } | |
74 | - | |
75 | - //$query = (new Query())->select('*')->from('{{%importer_files}}')->where(['not', ['time_end' => null]])->orderBy(['upload_time' => SORT_DESC]); | |
76 | - $query = Importer::find()->where(['active' => true])->orderBy(['price_date_update' => SORT_DESC]); | |
77 | - | |
78 | - $provider = new ActiveDataProvider([ | |
79 | - 'query' => $query, | |
80 | - 'pagination' => [ | |
81 | - 'pageSize' => 10, | |
82 | - ], | |
83 | - ]); | |
84 | - return $this->render('index', | |
85 | - [ | |
86 | - 'dataProvider' => $provider, | |
87 | - ]); | |
88 | - } | |
89 | - | |
90 | - | |
91 | - public function actionView ($id) | |
92 | - { | |
93 | - | |
94 | - | |
95 | - | |
96 | - | |
97 | - $query = Details::find()->where(['IMPORT_ID' => $id])->orderBy(['timestamp' => SORT_DESC]); | |
98 | - | |
99 | - $provider = new ActiveDataProvider([ | |
100 | - 'query' => $query, | |
101 | - 'pagination' => [ | |
102 | - 'pageSize' => 16, | |
103 | - ], | |
104 | - ]); | |
105 | - return $this->render('view', | |
106 | - ['dataProvider' => $provider]); | |
107 | - } | |
108 | -} |
1 | +<?php | |
2 | + | |
3 | +use yii\helpers\Html; | |
4 | +use yii\widgets\ActiveForm; | |
5 | + | |
6 | +/* @var $this yii\web\View */ | |
7 | +/* @var $model common\models\CartBills */ | |
8 | +/* @var $form yii\widgets\ActiveForm */ | |
9 | +?> | |
10 | + | |
11 | +<div class="cart-bills-form"> | |
12 | + | |
13 | + <?php $form = ActiveForm::begin(); ?> | |
14 | + | |
15 | + <?= $form->field($model, 'account_id')->textInput(['maxlength' => true]) ?> | |
16 | + | |
17 | + <?= $form->field($model, 'manager_id')->textInput(['maxlength' => true]) ?> | |
18 | + | |
19 | + <?= $form->field($model, 'office_id')->textInput(['maxlength' => true]) ?> | |
20 | + | |
21 | + <?= $form->field($model, 'status')->textInput(['maxlength' => true]) ?> | |
22 | + | |
23 | + <?= $form->field($model, 'f1')->textInput(['maxlength' => true]) ?> | |
24 | + | |
25 | + <?= $form->field($model, 'f2')->textInput(['maxlength' => true]) ?> | |
26 | + | |
27 | + <?= $form->field($model, 'f3')->textInput(['maxlength' => true]) ?> | |
28 | + | |
29 | + <?= $form->field($model, 'message')->textarea(['rows' => 6]) ?> | |
30 | + | |
31 | + <?= $form->field($model, 'safe_bill')->textInput() ?> | |
32 | + | |
33 | + <?= $form->field($model, 'delivery')->textInput(['maxlength' => true]) ?> | |
34 | + | |
35 | + <?= $form->field($model, 'delivery_price')->textInput() ?> | |
36 | + | |
37 | + <?= $form->field($model, 'timestamp')->textInput() ?> | |
38 | + | |
39 | + <div class="form-group"> | |
40 | + <?= Html::submitButton($model->isNewRecord ? Yii::t('app', 'Create') : Yii::t('app', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> | |
41 | + </div> | |
42 | + | |
43 | + <?php ActiveForm::end(); ?> | |
44 | + | |
45 | +</div> | ... | ... |
1 | +<?php | |
2 | + | |
3 | +use yii\helpers\Html; | |
4 | +use yii\widgets\ActiveForm; | |
5 | + | |
6 | +/* @var $this yii\web\View */ | |
7 | +/* @var $model common\models\CartBillsSearch */ | |
8 | +/* @var $form yii\widgets\ActiveForm */ | |
9 | +?> | |
10 | + | |
11 | +<div class="cart-bills-search"> | |
12 | + | |
13 | + <?php $form = ActiveForm::begin([ | |
14 | + 'action' => ['index'], | |
15 | + 'method' => 'get', | |
16 | + ]); ?> | |
17 | + | |
18 | + <?= $form->field($model, 'id') ?> | |
19 | + | |
20 | + <?= $form->field($model, 'account_id') ?> | |
21 | + | |
22 | + <?= $form->field($model, 'manager_id') ?> | |
23 | + | |
24 | + <?= $form->field($model, 'office_id') ?> | |
25 | + | |
26 | + <?= $form->field($model, 'status')->dropDownList(\yii\helpers\ArrayHelper::map( \common\models\DicStatuses::find()->where(['active' =>1])->all(), 'id','name' )) ?> | |
27 | + | |
28 | + <?php // echo $form->field($model, 'f1') ?> | |
29 | + | |
30 | + <?php // echo $form->field($model, 'f2') ?> | |
31 | + | |
32 | + <?php // echo $form->field($model, 'f3') ?> | |
33 | + | |
34 | + <?php // echo $form->field($model, 'message') ?> | |
35 | + | |
36 | + <?php // echo $form->field($model, 'safe_bill') ?> | |
37 | + | |
38 | + <?php // echo $form->field($model, 'delivery') ?> | |
39 | + | |
40 | + <?php // echo $form->field($model, 'delivery_price') ?> | |
41 | + | |
42 | + <?php // echo $form->field($model, 'timestamp') ?> | |
43 | + | |
44 | + <div class="form-group"> | |
45 | + <?= Html::submitButton(Yii::t('app', 'Search'), ['class' => 'btn btn-primary']) ?> | |
46 | + <?= Html::resetButton(Yii::t('app', 'Reset'), ['class' => 'btn btn-default']) ?> | |
47 | + </div> | |
48 | + | |
49 | + <?php ActiveForm::end(); ?> | |
50 | + | |
51 | +</div> | ... | ... |
1 | +<?php | |
2 | + | |
3 | +use yii\helpers\Html; | |
4 | +use yii\grid\GridView; | |
5 | +use kartik\date\DatePicker; | |
6 | + | |
7 | +/* @var $this yii\web\View */ | |
8 | +/* @var $searchModel common\models\CartBillsSearch */ | |
9 | +/* @var $dataProvider yii\data\ActiveDataProvider */ | |
10 | + | |
11 | +$this->title = Yii::t('app', 'Заказы'); | |
12 | +$this->params['breadcrumbs'][] = $this->title; | |
13 | +?> | |
14 | +<div class="cart-bills-index"> | |
15 | + | |
16 | + <h1><?= Html::encode($this->title) ?></h1> | |
17 | + <?php // echo $this->render('_search', ['model' => $searchModel]); ?> | |
18 | + | |
19 | + | |
20 | + <?= GridView::widget([ | |
21 | + 'dataProvider' => $dataProvider, | |
22 | + 'filterModel' => $searchModel, | |
23 | + 'columns' => [ | |
24 | + ['class' => 'yii\grid\SerialColumn'], | |
25 | + | |
26 | + 'id', | |
27 | + 'account_id', | |
28 | + 'sum', | |
29 | + [ | |
30 | + 'label' =>'Статус', | |
31 | + 'attribute' => 'status', | |
32 | + 'filter' => \yii\helpers\ArrayHelper::map( \common\models\DicStatuses::find()->where(['active' =>1])->all(), 'id','name' ), | |
33 | + ], | |
34 | + 'manager_name', | |
35 | + [ | |
36 | + 'label' =>'Дата', | |
37 | + 'attribute' => 'dt', | |
38 | + 'filter' => DatePicker::widget([ | |
39 | + 'name' => 'data1', | |
40 | + // 'value' => '01-Feb-2015', | |
41 | + 'type' => DatePicker::TYPE_RANGE, | |
42 | + 'name2' => 'data2', | |
43 | + // 'value2' => '27-Feb-2015', | |
44 | + 'pluginOptions' => [ | |
45 | + 'autoclose'=>true, | |
46 | + 'format' => 'dd-M-yyyy' | |
47 | + ] | |
48 | + ]), | |
49 | + ], | |
50 | + | |
51 | + ], | |
52 | + ]); ?> | |
53 | + | |
54 | +</div> | ... | ... |
1 | +<?php | |
2 | + | |
3 | +use yii\helpers\Html; | |
4 | +use yii\widgets\DetailView; | |
5 | + | |
6 | +/* @var $this yii\web\View */ | |
7 | +/* @var $model common\models\CartBills */ | |
8 | + | |
9 | +$this->title = $model->id; | |
10 | +$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Cart Bills'), 'url' => ['index']]; | |
11 | +$this->params['breadcrumbs'][] = $this->title; | |
12 | +?> | |
13 | +<div class="cart-bills-view"> | |
14 | + | |
15 | + <h1><?= Html::encode($this->title) ?></h1> | |
16 | + | |
17 | + <p> | |
18 | + <?= Html::a(Yii::t('app', 'Update'), ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?> | |
19 | + <?= Html::a(Yii::t('app', 'Delete'), ['delete', 'id' => $model->id], [ | |
20 | + 'class' => 'btn btn-danger', | |
21 | + 'data' => [ | |
22 | + 'confirm' => Yii::t('app', 'Are you sure you want to delete this item?'), | |
23 | + 'method' => 'post', | |
24 | + ], | |
25 | + ]) ?> | |
26 | + </p> | |
27 | + | |
28 | + <?= DetailView::widget([ | |
29 | + 'model' => $model, | |
30 | + 'attributes' => [ | |
31 | + 'id', | |
32 | + 'account_id', | |
33 | + 'manager_id', | |
34 | + 'office_id', | |
35 | + 'status', | |
36 | + 'f1', | |
37 | + 'f2', | |
38 | + 'f3', | |
39 | + 'message:ntext', | |
40 | + 'safe_bill', | |
41 | + 'delivery', | |
42 | + 'delivery_price', | |
43 | + 'timestamp', | |
44 | + ], | |
45 | + ]) ?> | |
46 | + | |
47 | +</div> | ... | ... |
backend/views/check_price/index.php deleted
1 | -<?php | |
2 | -use yii\helpers\Html; | |
3 | -use yii\grid\GridView; | |
4 | -use yii\grid\SerialColumn; | |
5 | -use yii\grid\ActionColumn; | |
6 | -use yii\widgets\Pjax; | |
7 | - | |
8 | - | |
9 | -/* @var $this yii\web\View */ | |
10 | -/* @var $searchModel backend\models\CatalogSearch */ | |
11 | -/* @var $dataProvider yii\data\ActiveDataProvider */ | |
12 | - | |
13 | -$this->title = 'Проверка прайсов'; | |
14 | -$this->params['breadcrumbs'][] = $this->title; | |
15 | -?> | |
16 | -<div class="catalog-index"> | |
17 | - | |
18 | - <h1><?= Html::encode($this->title) ?></h1> | |
19 | - | |
20 | - | |
21 | - <?= GridView::widget( ['dataProvider' => $dataProvider, | |
22 | - 'columns' => [['class' => SerialColumn::className()], | |
23 | - [ | |
24 | - 'class' => ActionColumn::className(), | |
25 | - 'template'=>'{view}', | |
26 | - 'contentOptions' => function ($model, $key, $index, $column){ | |
27 | - return ['data' => ['id' => $model->id, 'date' => $model->price_date_update]]; | |
28 | - } | |
29 | - ], | |
30 | - [ | |
31 | - 'label' =>'Поставщик', | |
32 | - 'value' => function ($data) { | |
33 | - return '№ ' .$data->id . ' ' . $data->name; | |
34 | - }, | |
35 | - ], | |
36 | - ['label' =>'Дата обновления', | |
37 | - 'attribute' => 'price_date_update' ], | |
38 | - ['label' => 'Кол-во дней', | |
39 | - 'value' => function ($data) { | |
40 | - $date1 = new DateTime("now"); | |
41 | - $date2 = new DateTime( $data->price_date_update ); | |
42 | - $quo_days = $date2->diff($date1)->format('%R%a'); | |
43 | - // уберем первый символ - там знак "+" | |
44 | - $quo_days = substr( $quo_days, 1, strlen($quo_days) ); | |
45 | - $quo_days = (int) $quo_days; | |
46 | - | |
47 | - if($quo_days > 15) | |
48 | - $quo_days = '>15'; | |
49 | - | |
50 | - return $quo_days; | |
51 | - } | |
52 | - ], | |
53 | - ]] );?> | |
54 | - | |
55 | - | |
56 | - | |
57 | - | |
58 | -</div> | |
59 | 0 | \ No newline at end of file |
backend/views/check_price/view.php deleted
1 | -<?php | |
2 | -use yii\helpers\Html; | |
3 | -use yii\grid\GridView; | |
4 | -use yii\grid\SerialColumn; | |
5 | -use yii\bootstrap\Modal; | |
6 | - | |
7 | - | |
8 | -/* @var $this yii\web\View */ | |
9 | -/* @var $searchModel backend\models\CatalogSearch */ | |
10 | -/* @var $dataProvider yii\data\ActiveDataProvider */ | |
11 | - | |
12 | -$this->title = 'Проверка прайсов'; | |
13 | -$this->params['breadcrumbs'][] = $this->title; | |
14 | - | |
15 | -?> | |
16 | -<div class="catalog-index"> | |
17 | - | |
18 | - <h1><?= Html::encode($this->title) ?></h1> | |
19 | - | |
20 | - <?= GridView::widget( ['dataProvider' => $dataProvider, | |
21 | - | |
22 | - ] ); | |
23 | - | |
24 | - | |
25 | - ?> | |
26 | - | |
27 | - | |
28 | - | |
29 | -</div> | |
30 | -<?php | |
31 | - | |
32 | -?> | |
33 | 0 | \ No newline at end of file |
backend/views/layouts/column.php
... | ... | @@ -282,6 +282,7 @@ $this->beginContent('@app/views/layouts/main.php'); |
282 | 282 | echo Menu::widget([ |
283 | 283 | 'options' => ['class' => 'sidebar-menu'], |
284 | 284 | 'items' => [ |
285 | + ['label' => 'Заказы', 'url' => ['cart/index']], | |
285 | 286 | ['label' => "Загрузка файлов", 'url' => ['#'], 'items' => [ |
286 | 287 | ['label' => 'Кросс файлы', 'url' => ['crossing-upload/index']], |
287 | 288 | ['label' => 'Группы RG', 'url' => ['rg-grup/index']], |
... | ... | @@ -319,10 +320,7 @@ $this->beginContent('@app/views/layouts/main.php'); |
319 | 320 | ['label' => 'Vin коды', 'url' => ['currency/index']], |
320 | 321 | ['label' => 'Запросы по номеру', 'url' => ['currency/index']], |
321 | 322 | ['label' => 'Офисы', 'url' => ['offices/index']], |
322 | - ], | |
323 | - ], | |
324 | - ['label' => 'Справочник', 'url' => ['#'], 'items' => [ | |
325 | - ['label' => 'Замены брендов', 'url' => ['currency/index']], | |
323 | + ['label' => 'Валюты', 'url' => ['currency/index']], | |
326 | 324 | ], |
327 | 325 | ], |
328 | 326 | ... | ... |
common/components/debug/CustomVarDamp.php deleted
1 | -<?php | |
2 | -/** | |
3 | - * Created by PhpStorm. | |
4 | - * User: Cibermag | |
5 | - * Date: 27.08.2015 | |
6 | - * Time: 16:47 | |
7 | - */ | |
8 | -namespace common\components\debug; | |
9 | -use yii\helpers\BaseVarDumper; | |
10 | - | |
11 | -class CustomVarDamp extends BaseVarDumper { | |
12 | - | |
13 | - public static function dumpAndDie($var, $depth = 10, $highlight = false) | |
14 | - { | |
15 | - echo "<pre>"; | |
16 | - echo static::dumpAsString($var, $depth, $highlight); | |
17 | - echo "</pre>"; | |
18 | - die; | |
19 | - } | |
20 | -} | |
21 | 0 | \ No newline at end of file |
1 | +<?php | |
2 | + | |
3 | +namespace common\models; | |
4 | + | |
5 | +use Yii; | |
6 | + | |
7 | +/** | |
8 | + * This is the model class for table "{{%cart}}". | |
9 | + * | |
10 | + * @property string $bill_id | |
11 | + * @property string $account_id | |
12 | + * @property string $count | |
13 | + * @property double $price | |
14 | + * @property double $price_purchase | |
15 | + * @property integer $status | |
16 | + * @property string $article | |
17 | + * @property string $brand | |
18 | + * @property string $descr | |
19 | + * @property string $import_id | |
20 | + * @property string $timestamp | |
21 | + */ | |
22 | +class Cart extends \backend\components\base\BaseActiveRecord | |
23 | +{ | |
24 | + /** | |
25 | + * @inheritdoc | |
26 | + */ | |
27 | + public static function tableName() | |
28 | + { | |
29 | + return '{{%cart}}'; | |
30 | + } | |
31 | + | |
32 | + /** | |
33 | + * @inheritdoc | |
34 | + */ | |
35 | + public function rules() | |
36 | + { | |
37 | + return [ | |
38 | + [['bill_id', 'account_id', 'count', 'price', 'price_purchase', 'article', 'brand', 'descr', 'import_id'], 'required'], | |
39 | + [['bill_id', 'account_id', 'count', 'status', 'import_id'], 'integer'], | |
40 | + [['price', 'price_purchase'], 'number'], | |
41 | + [['timestamp'], 'safe'], | |
42 | + [['article', 'brand'], 'string', 'max' => 100], | |
43 | + [['descr'], 'string', 'max' => 254] | |
44 | + ]; | |
45 | + } | |
46 | + | |
47 | + /** | |
48 | + * @inheritdoc | |
49 | + */ | |
50 | + public function attributeLabels() | |
51 | + { | |
52 | + return [ | |
53 | + 'bill_id' => Yii::t('app', 'Bill ID'), | |
54 | + 'account_id' => Yii::t('app', 'Account ID'), | |
55 | + 'count' => Yii::t('app', 'Count'), | |
56 | + 'price' => Yii::t('app', 'Price'), | |
57 | + 'price_purchase' => Yii::t('app', 'Price Purchase'), | |
58 | + 'status' => Yii::t('app', 'Status'), | |
59 | + 'article' => Yii::t('app', 'Article'), | |
60 | + 'brand' => Yii::t('app', 'Brand'), | |
61 | + 'descr' => Yii::t('app', 'Descr'), | |
62 | + 'import_id' => Yii::t('app', 'Import ID'), | |
63 | + 'timestamp' => Yii::t('app', 'Timestamp'), | |
64 | + ]; | |
65 | + } | |
66 | +} | ... | ... |
1 | +<?php | |
2 | + | |
3 | +namespace common\models; | |
4 | + | |
5 | +use Yii; | |
6 | + | |
7 | +/** | |
8 | + * This is the model class for table "{{%cart_bills}}". | |
9 | + * | |
10 | + * @property string $id | |
11 | + * @property string $account_id | |
12 | + * @property string $manager_id | |
13 | + * @property string $office_id | |
14 | + * @property string $status | |
15 | + * @property string $f1 | |
16 | + * @property string $f2 | |
17 | + * @property string $f3 | |
18 | + * @property string $message | |
19 | + * @property integer $safe_bill | |
20 | + * @property string $delivery | |
21 | + * @property double $delivery_price | |
22 | + * @property string $timestamp | |
23 | + */ | |
24 | +class CartBills extends \backend\components\base\BaseActiveRecord | |
25 | +{ | |
26 | + /** | |
27 | + * @inheritdoc | |
28 | + */ | |
29 | + public static function tableName() | |
30 | + { | |
31 | + return '{{%cart_bills}}'; | |
32 | + } | |
33 | + | |
34 | + /** | |
35 | + * @inheritdoc | |
36 | + */ | |
37 | + public function rules() | |
38 | + { | |
39 | + return [ | |
40 | + [['account_id', 'office_id', 'f1', 'f2', 'f3', 'message', 'delivery'], 'required'], | |
41 | + [['account_id', 'manager_id', 'office_id', 'status', 'safe_bill'], 'integer'], | |
42 | + [['message'], 'string'], | |
43 | + [['delivery_price'], 'number'], | |
44 | + [['timestamp'], 'safe'], | |
45 | + [['f1', 'f3'], 'string', 'max' => 150], | |
46 | + [['f2'], 'string', 'max' => 50], | |
47 | + [['delivery'], 'string', 'max' => 100] | |
48 | + ]; | |
49 | + } | |
50 | + | |
51 | + /** | |
52 | + * @inheritdoc | |
53 | + */ | |
54 | + public function attributeLabels() | |
55 | + { | |
56 | + return [ | |
57 | + 'id' => Yii::t('app', 'ID'), | |
58 | + 'account_id' => Yii::t('app', 'Account ID'), | |
59 | + 'manager_id' => Yii::t('app', 'Manager ID'), | |
60 | + 'office_id' => Yii::t('app', 'Office ID'), | |
61 | + 'status' => Yii::t('app', 'Status'), | |
62 | + 'f1' => Yii::t('app', 'F1'), | |
63 | + 'f2' => Yii::t('app', 'F2'), | |
64 | + 'f3' => Yii::t('app', 'F3'), | |
65 | + 'message' => Yii::t('app', 'Message'), | |
66 | + 'safe_bill' => Yii::t('app', 'Safe Bill'), | |
67 | + 'delivery' => Yii::t('app', 'Delivery'), | |
68 | + 'delivery_price' => Yii::t('app', 'Delivery Price'), | |
69 | + 'timestamp' => Yii::t('app', 'Timestamp'), | |
70 | + ]; | |
71 | + } | |
72 | +} | ... | ... |
1 | +<?php | |
2 | + | |
3 | +namespace common\models; | |
4 | + | |
5 | +use common\components\CustomVarDamp; | |
6 | +use Yii; | |
7 | +use yii\base\Model; | |
8 | +use yii\data\ActiveDataProvider; | |
9 | +use common\models\CartBillsView; | |
10 | + | |
11 | +/** | |
12 | + * CartBillsSearch represents the model behind the search form about `common\models\CartBills`. | |
13 | + */ | |
14 | +class CartBillsSearch extends CartBillsView | |
15 | +{ | |
16 | + | |
17 | + /** | |
18 | + * @inheritdoc | |
19 | + */ | |
20 | + public function rules() | |
21 | + { | |
22 | + return [ | |
23 | + [['id', 'account_id', 'status'], 'integer'], | |
24 | + [['data1,data2'], 'safe'], | |
25 | + ]; | |
26 | + } | |
27 | + | |
28 | + /** | |
29 | + * @inheritdoc | |
30 | + */ | |
31 | + public function scenarios() | |
32 | + { | |
33 | + // bypass scenarios() implementation in the parent class | |
34 | + return Model::scenarios(); | |
35 | + } | |
36 | + | |
37 | + /** | |
38 | + * Creates data provider instance with search query applied | |
39 | + * | |
40 | + * @param array $params | |
41 | + * | |
42 | + * @return ActiveDataProvider | |
43 | + */ | |
44 | + public function search($params) | |
45 | + { | |
46 | + $query = CartBillsView::find(); | |
47 | + | |
48 | + $dataProvider = new ActiveDataProvider([ | |
49 | + 'query' => $query, | |
50 | + ]); | |
51 | + | |
52 | + $this->load($params); | |
53 | + //$timestamp= mktime($hours,$minutes,$seconds,$month,$day,$year); | |
54 | + CustomVarDamp::dumpAndDie(date_timestamp_get($params['data1'])); | |
55 | + if (!$this->validate()) { | |
56 | + // uncomment the following line if you do not want to return any records when validation fails | |
57 | + // $query->where('0=1'); | |
58 | + return $dataProvider; | |
59 | + } | |
60 | + | |
61 | + $query->andFilterWhere([ | |
62 | + 'id' => $this->id, | |
63 | + 'account_id' => $this->account_id, | |
64 | + 'timestamp' => $this->dt, | |
65 | + 'status_id' => $this->status, | |
66 | + ]); | |
67 | + | |
68 | +// $query->andFilterWhere(['like', 'f1', $this->f1]) | |
69 | +// ->andFilterWhere(['like', 'f2', $this->f2]) | |
70 | +// ->andFilterWhere(['like', 'f3', $this->f3]) | |
71 | +// ->andFilterWhere(['like', 'message', $this->message]) | |
72 | +// ->andFilterWhere(['like', 'delivery', $this->delivery]); | |
73 | + | |
74 | + return $dataProvider; | |
75 | + } | |
76 | +} | ... | ... |
1 | +<?php | |
2 | + | |
3 | +namespace common\models; | |
4 | + | |
5 | +use Yii; | |
6 | + | |
7 | +/** | |
8 | + * This is the model class for table "w_cart_bills_view". | |
9 | + * | |
10 | + * @property string $id | |
11 | + * @property string $account_id | |
12 | + * @property string $manager_name | |
13 | + * @property string $dt | |
14 | + * @property string $name | |
15 | + * @property string $phone | |
16 | + * @property string $email | |
17 | + * @property string $delivery | |
18 | + * @property string $status_id | |
19 | + * @property string $status | |
20 | + * @property string $message | |
21 | + * @property integer $safe_bill | |
22 | + * @property string $sum | |
23 | + * @property string $scode | |
24 | + */ | |
25 | +class CartBillsView extends \backend\components\base\BaseActiveRecord | |
26 | +{ | |
27 | + /** | |
28 | + * @inheritdoc | |
29 | + */ | |
30 | + public static function tableName() | |
31 | + { | |
32 | + return 'w_cart_bills_view'; | |
33 | + } | |
34 | + | |
35 | + /** | |
36 | + * @inheritdoc | |
37 | + */ | |
38 | + public function rules() | |
39 | + { | |
40 | + return [ | |
41 | + [['id', 'account_id', 'dt', 'status_id', 'safe_bill', 'scode'], 'integer'], | |
42 | + [['account_id', 'name', 'phone', 'email', 'delivery', 'status', 'message'], 'required'], | |
43 | + [['message'], 'string'], | |
44 | + [['sum'], 'number'], | |
45 | + [['manager_name'], 'string', 'max' => 255], | |
46 | + [['name', 'email'], 'string', 'max' => 150], | |
47 | + [['phone', 'status'], 'string', 'max' => 50], | |
48 | + [['delivery'], 'string', 'max' => 100] | |
49 | + ]; | |
50 | + } | |
51 | + | |
52 | + /** | |
53 | + * @inheritdoc | |
54 | + */ | |
55 | + public function attributeLabels() | |
56 | + { | |
57 | + return [ | |
58 | + 'id' => Yii::t('app', '№ заказа'), | |
59 | + 'account_id' => Yii::t('app', '№ клиента'), | |
60 | + 'manager_name' => Yii::t('app', 'Менеджер'), | |
61 | + 'dt' => Yii::t('app', 'Дата'), | |
62 | + 'name' => Yii::t('app', 'Name'), | |
63 | + 'phone' => Yii::t('app', 'Phone'), | |
64 | + 'email' => Yii::t('app', 'Email'), | |
65 | + 'delivery' => Yii::t('app', 'Delivery'), | |
66 | + 'status_id' => Yii::t('app', 'Status ID'), | |
67 | + 'status' => Yii::t('app', 'Статус'), | |
68 | + 'message' => Yii::t('app', 'Message'), | |
69 | + 'safe_bill' => Yii::t('app', 'Safe Bill'), | |
70 | + 'sum' => Yii::t('app', 'Сумма'), | |
71 | + 'scode' => Yii::t('app', 'Scode'), | |
72 | + ]; | |
73 | + } | |
74 | + | |
75 | + public static function findById($id){ | |
76 | + | |
77 | + } | |
78 | +} | ... | ... |
1 | +<?php | |
2 | + | |
3 | +namespace common\models; | |
4 | + | |
5 | +use Yii; | |
6 | + | |
7 | +/** | |
8 | + * This is the model class for table "{{%cart_view}}". | |
9 | + * | |
10 | + * @property string $id | |
11 | + * @property string $account_id | |
12 | + * @property string $dt | |
13 | + * @property string $user_name | |
14 | + * @property string $user_mail | |
15 | + * @property integer $status_id | |
16 | + * @property string $status | |
17 | + * @property string $article | |
18 | + * @property string $brand | |
19 | + * @property string $descr | |
20 | + * @property string $importer | |
21 | + * @property string $count | |
22 | + * @property double $price | |
23 | + * @property string $import_id | |
24 | + */ | |
25 | +class CartView extends \backend\components\base\BaseActiveRecord | |
26 | +{ | |
27 | + /** | |
28 | + * @inheritdoc | |
29 | + */ | |
30 | + public static function tableName() | |
31 | + { | |
32 | + return '{{%cart_view}}'; | |
33 | + } | |
34 | + | |
35 | + /** | |
36 | + * @inheritdoc | |
37 | + */ | |
38 | + public function rules() | |
39 | + { | |
40 | + return [ | |
41 | + [['id', 'account_id', 'dt', 'status_id', 'count', 'import_id'], 'integer'], | |
42 | + [['account_id', 'user_name', 'user_mail', 'status', 'article', 'brand', 'descr', 'importer', 'count', 'price', 'import_id'], 'required'], | |
43 | + [['price'], 'number'], | |
44 | + [['user_name', 'user_mail'], 'string', 'max' => 150], | |
45 | + [['status'], 'string', 'max' => 50], | |
46 | + [['article', 'brand'], 'string', 'max' => 100], | |
47 | + [['descr', 'importer'], 'string', 'max' => 254] | |
48 | + ]; | |
49 | + } | |
50 | + | |
51 | + /** | |
52 | + * @inheritdoc | |
53 | + */ | |
54 | + public function attributeLabels() | |
55 | + { | |
56 | + return [ | |
57 | + 'id' => Yii::t('app', 'ID'), | |
58 | + 'account_id' => Yii::t('app', 'Account ID'), | |
59 | + 'dt' => Yii::t('app', 'Dt'), | |
60 | + 'user_name' => Yii::t('app', 'User Name'), | |
61 | + 'user_mail' => Yii::t('app', 'User Mail'), | |
62 | + 'status_id' => Yii::t('app', 'Status ID'), | |
63 | + 'status' => Yii::t('app', 'Status'), | |
64 | + 'article' => Yii::t('app', 'Article'), | |
65 | + 'brand' => Yii::t('app', 'Brand'), | |
66 | + 'descr' => Yii::t('app', 'Descr'), | |
67 | + 'importer' => Yii::t('app', 'Importer'), | |
68 | + 'count' => Yii::t('app', 'Count'), | |
69 | + 'price' => Yii::t('app', 'Price'), | |
70 | + 'import_id' => Yii::t('app', 'Import ID'), | |
71 | + ]; | |
72 | + } | |
73 | +} | ... | ... |
composer.json
... | ... | @@ -19,7 +19,10 @@ |
19 | 19 | "yiisoft/yii2-bootstrap": "*", |
20 | 20 | "yiisoft/yii2-swiftmailer": "*", |
21 | 21 | "artweb/yii2-multiparser": "dev-master", |
22 | - "yiisoft/yii2-imagine": "*" | |
22 | + "yiisoft/yii2-imagine": "*", | |
23 | + "kartik-v/yii2-widget-datepicker": "^1.3", | |
24 | + "kartik-v/yii2-field-range": "^1.3", | |
25 | + "kartik-v/yii2-datecontrol": "dev-master" | |
23 | 26 | }, |
24 | 27 | "require-dev": { |
25 | 28 | "yiisoft/yii2-codeception": "*", | ... | ... |
composer.lock
... | ... | @@ -4,8 +4,8 @@ |
4 | 4 | "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", |
5 | 5 | "This file is @generated automatically" |
6 | 6 | ], |
7 | - "hash": "c82a0b48e9d917d19deff3e70988e9e1", | |
8 | - "content-hash": "91acdf28733394f58a82e0550d685d7d", | |
7 | + "hash": "2d5c03f681f1c72d09f36e10af144465", | |
8 | + "content-hash": "4c8b69eb2733ca32596e438952d2f182", | |
9 | 9 | "packages": [ |
10 | 10 | { |
11 | 11 | "name": "artweb/yii2-multiparser", |
... | ... | @@ -415,6 +415,244 @@ |
415 | 415 | "time": "2013-07-10 17:25:36" |
416 | 416 | }, |
417 | 417 | { |
418 | + "name": "kartik-v/php-date-formatter", | |
419 | + "version": "v1.3.1", | |
420 | + "source": { | |
421 | + "type": "git", | |
422 | + "url": "https://github.com/kartik-v/php-date-formatter.git", | |
423 | + "reference": "7d3dc3495dd10bd1909c0dfdecd673967019cc21" | |
424 | + }, | |
425 | + "dist": { | |
426 | + "type": "zip", | |
427 | + "url": "https://api.github.com/repos/kartik-v/php-date-formatter/zipball/7d3dc3495dd10bd1909c0dfdecd673967019cc21", | |
428 | + "reference": "7d3dc3495dd10bd1909c0dfdecd673967019cc21", | |
429 | + "shasum": "" | |
430 | + }, | |
431 | + "type": "library", | |
432 | + "autoload": { | |
433 | + "psr-4": { | |
434 | + "kartik\\plugins\\dateformatter\\": "" | |
435 | + } | |
436 | + }, | |
437 | + "notification-url": "https://packagist.org/downloads/", | |
438 | + "license": [ | |
439 | + "BSD-3-Clause" | |
440 | + ], | |
441 | + "authors": [ | |
442 | + { | |
443 | + "name": "Kartik Visweswaran", | |
444 | + "email": "kartikv2@gmail.com", | |
445 | + "homepage": "http://www.krajee.com/" | |
446 | + } | |
447 | + ], | |
448 | + "description": "A JQuery datetime formatting and manipulation library using PHP date-time formats in javascript.", | |
449 | + "homepage": "https://github.com/kartik-v/php-date-formatter", | |
450 | + "keywords": [ | |
451 | + "date", | |
452 | + "datetime", | |
453 | + "formatter", | |
454 | + "javascript", | |
455 | + "jquery", | |
456 | + "php", | |
457 | + "php-date-formatter.js", | |
458 | + "time" | |
459 | + ], | |
460 | + "time": "2015-06-18 15:14:51" | |
461 | + }, | |
462 | + { | |
463 | + "name": "kartik-v/yii2-datecontrol", | |
464 | + "version": "dev-master", | |
465 | + "source": { | |
466 | + "type": "git", | |
467 | + "url": "https://github.com/kartik-v/yii2-datecontrol.git", | |
468 | + "reference": "4e858b5cd38130c37739b2f582b66a044f77c95c" | |
469 | + }, | |
470 | + "dist": { | |
471 | + "type": "zip", | |
472 | + "url": "https://api.github.com/repos/kartik-v/yii2-datecontrol/zipball/4e858b5cd38130c37739b2f582b66a044f77c95c", | |
473 | + "reference": "4e858b5cd38130c37739b2f582b66a044f77c95c", | |
474 | + "shasum": "" | |
475 | + }, | |
476 | + "require": { | |
477 | + "kartik-v/php-date-formatter": ">1.3", | |
478 | + "kartik-v/yii2-krajee-base": "~1.7" | |
479 | + }, | |
480 | + "type": "yii2-extension", | |
481 | + "autoload": { | |
482 | + "psr-4": { | |
483 | + "kartik\\datecontrol\\": "" | |
484 | + } | |
485 | + }, | |
486 | + "notification-url": "https://packagist.org/downloads/", | |
487 | + "license": [ | |
488 | + "BSD-3-Clause" | |
489 | + ], | |
490 | + "authors": [ | |
491 | + { | |
492 | + "name": "Kartik Visweswaran", | |
493 | + "email": "kartikv2@gmail.com", | |
494 | + "homepage": "http://www.krajee.com/" | |
495 | + } | |
496 | + ], | |
497 | + "description": "Date control module allowing separation of formats for View and Model for Yii Framework 2.0", | |
498 | + "homepage": "https://github.com/kartik-v/yii2-datecontrol", | |
499 | + "keywords": [ | |
500 | + "control", | |
501 | + "date", | |
502 | + "extension", | |
503 | + "format", | |
504 | + "yii", | |
505 | + "yii2" | |
506 | + ], | |
507 | + "time": "2015-07-30 18:30:18" | |
508 | + }, | |
509 | + { | |
510 | + "name": "kartik-v/yii2-field-range", | |
511 | + "version": "v1.3.0", | |
512 | + "source": { | |
513 | + "type": "git", | |
514 | + "url": "https://github.com/kartik-v/yii2-field-range.git", | |
515 | + "reference": "095d260eecb86ff2e78a70775011cec00a75df98" | |
516 | + }, | |
517 | + "dist": { | |
518 | + "type": "zip", | |
519 | + "url": "https://api.github.com/repos/kartik-v/yii2-field-range/zipball/095d260eecb86ff2e78a70775011cec00a75df98", | |
520 | + "reference": "095d260eecb86ff2e78a70775011cec00a75df98", | |
521 | + "shasum": "" | |
522 | + }, | |
523 | + "require": { | |
524 | + "kartik-v/yii2-krajee-base": "*" | |
525 | + }, | |
526 | + "type": "yii2-extension", | |
527 | + "autoload": { | |
528 | + "psr-4": { | |
529 | + "kartik\\field\\": "" | |
530 | + } | |
531 | + }, | |
532 | + "notification-url": "https://packagist.org/downloads/", | |
533 | + "license": [ | |
534 | + "BSD 3-Clause" | |
535 | + ], | |
536 | + "authors": [ | |
537 | + { | |
538 | + "name": "Kartik Visweswaran", | |
539 | + "email": "kartikv2@gmail.com", | |
540 | + "homepage": "http://www.krajee.com/" | |
541 | + } | |
542 | + ], | |
543 | + "description": "Easily manage Yii 2 ActiveField ranges (from/to) with Bootstrap 3 addons markup and more", | |
544 | + "homepage": "https://github.com/kartik-v/yii2-field-range", | |
545 | + "keywords": [ | |
546 | + "addon", | |
547 | + "bootstrap", | |
548 | + "bootstrap 3", | |
549 | + "date", | |
550 | + "extension", | |
551 | + "field-range", | |
552 | + "from", | |
553 | + "range", | |
554 | + "to", | |
555 | + "widget", | |
556 | + "yii2" | |
557 | + ], | |
558 | + "time": "2014-11-25 08:52:00" | |
559 | + }, | |
560 | + { | |
561 | + "name": "kartik-v/yii2-krajee-base", | |
562 | + "version": "v1.7.7", | |
563 | + "source": { | |
564 | + "type": "git", | |
565 | + "url": "https://github.com/kartik-v/yii2-krajee-base.git", | |
566 | + "reference": "c0adff9d9762f4fd3bf0e7cd0000fcab0bf00f19" | |
567 | + }, | |
568 | + "dist": { | |
569 | + "type": "zip", | |
570 | + "url": "https://api.github.com/repos/kartik-v/yii2-krajee-base/zipball/c0adff9d9762f4fd3bf0e7cd0000fcab0bf00f19", | |
571 | + "reference": "c0adff9d9762f4fd3bf0e7cd0000fcab0bf00f19", | |
572 | + "shasum": "" | |
573 | + }, | |
574 | + "require": { | |
575 | + "yiisoft/yii2-bootstrap": "@dev" | |
576 | + }, | |
577 | + "type": "yii2-extension", | |
578 | + "autoload": { | |
579 | + "psr-4": { | |
580 | + "kartik\\base\\": "" | |
581 | + } | |
582 | + }, | |
583 | + "notification-url": "https://packagist.org/downloads/", | |
584 | + "license": [ | |
585 | + "BSD-3-Clause" | |
586 | + ], | |
587 | + "authors": [ | |
588 | + { | |
589 | + "name": "Kartik Visweswaran", | |
590 | + "email": "kartikv2@gmail.com", | |
591 | + "homepage": "http://www.krajee.com/" | |
592 | + } | |
593 | + ], | |
594 | + "description": "Base library and foundation components for all Yii2 Krajee extensions.", | |
595 | + "homepage": "https://github.com/kartik-v/yii2-krajee-base", | |
596 | + "keywords": [ | |
597 | + "base", | |
598 | + "extension", | |
599 | + "foundation", | |
600 | + "krajee", | |
601 | + "widget", | |
602 | + "yii2" | |
603 | + ], | |
604 | + "time": "2015-06-16 05:19:57" | |
605 | + }, | |
606 | + { | |
607 | + "name": "kartik-v/yii2-widget-datepicker", | |
608 | + "version": "v1.3.3", | |
609 | + "source": { | |
610 | + "type": "git", | |
611 | + "url": "https://github.com/kartik-v/yii2-widget-datepicker.git", | |
612 | + "reference": "368b181ef658c05707fe41dd16eee4d9ffd9da38" | |
613 | + }, | |
614 | + "dist": { | |
615 | + "type": "zip", | |
616 | + "url": "https://api.github.com/repos/kartik-v/yii2-widget-datepicker/zipball/368b181ef658c05707fe41dd16eee4d9ffd9da38", | |
617 | + "reference": "368b181ef658c05707fe41dd16eee4d9ffd9da38", | |
618 | + "shasum": "" | |
619 | + }, | |
620 | + "require": { | |
621 | + "kartik-v/yii2-krajee-base": "~1.7" | |
622 | + }, | |
623 | + "type": "yii2-extension", | |
624 | + "autoload": { | |
625 | + "psr-4": { | |
626 | + "kartik\\date\\": "" | |
627 | + } | |
628 | + }, | |
629 | + "notification-url": "https://packagist.org/downloads/", | |
630 | + "license": [ | |
631 | + "BSD-3-Clause" | |
632 | + ], | |
633 | + "authors": [ | |
634 | + { | |
635 | + "name": "Kartik Visweswaran", | |
636 | + "email": "kartikv2@gmail.com", | |
637 | + "homepage": "http://www.krajee.com/" | |
638 | + } | |
639 | + ], | |
640 | + "description": "Enhanced Yii2 wrapper for the bootstrap datepicker plugin (sub repo split from yii2-widgets).", | |
641 | + "homepage": "https://github.com/kartik-v/yii2-widget-datepicker", | |
642 | + "keywords": [ | |
643 | + "date", | |
644 | + "extension", | |
645 | + "form", | |
646 | + "jquery", | |
647 | + "picker", | |
648 | + "plugin", | |
649 | + "select2", | |
650 | + "widget", | |
651 | + "yii2" | |
652 | + ], | |
653 | + "time": "2015-07-19 04:49:03" | |
654 | + }, | |
655 | + { | |
418 | 656 | "name": "swiftmailer/swiftmailer", |
419 | 657 | "version": "v5.4.1", |
420 | 658 | "source": { |
... | ... | @@ -1061,7 +1299,8 @@ |
1061 | 1299 | "aliases": [], |
1062 | 1300 | "minimum-stability": "stable", |
1063 | 1301 | "stability-flags": { |
1064 | - "artweb/yii2-multiparser": 20 | |
1302 | + "artweb/yii2-multiparser": 20, | |
1303 | + "kartik-v/yii2-datecontrol": 20 | |
1065 | 1304 | }, |
1066 | 1305 | "prefer-stable": false, |
1067 | 1306 | "prefer-lowest": false, | ... | ... |
console/migrations/m150915_125129_addDetails.php deleted
1 | -<?php | |
2 | - | |
3 | -use yii\db\Schema; | |
4 | -use yii\db\Migration; | |
5 | - | |
6 | -class m150915_125129_addDetails extends Migration | |
7 | -{ | |
8 | - public function up() | |
9 | - { | |
10 | - $this->execute('CREATE TABLE `details` ( | |
11 | - `ID` int(10) unsigned NOT NULL AUTO_INCREMENT, | |
12 | - `IMPORT_ID` int(6) unsigned NOT NULL, | |
13 | - `BRAND` varchar(100) NOT NULL, | |
14 | - `ARTICLE` varchar(100) NOT NULL, | |
15 | - `FULL_ARTICLE` varchar(150) NOT NULL, | |
16 | - `PRICE` float(15,2) unsigned NOT NULL, | |
17 | - `DESCR` varchar(200) NOT NULL, | |
18 | - `BOX` int(6) unsigned NOT NULL, | |
19 | - `ADD_BOX` int(6) unsigned NOT NULL DEFAULT 0, | |
20 | - `GROUP` varchar(200) NOT NULL DEFAULT \'\', | |
21 | - `timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, | |
22 | - PRIMARY KEY (`ARTICLE`,`BRAND`,`IMPORT_ID`), | |
23 | - UNIQUE KEY `ID_delete` (`ID`), | |
24 | - KEY `timestamp` (`timestamp`), | |
25 | - KEY `ARTICLE` (`ARTICLE`,`BRAND`,`BOX`), | |
26 | - KEY `BRAND` (`BRAND`,`ARTICLE`), | |
27 | - KEY `ARTICLE_2` (`ARTICLE`,`BRAND`,`ADD_BOX`), | |
28 | - KEY `IMPORT_ID` (`IMPORT_ID`,`ARTICLE`), | |
29 | - KEY `IMPORT_ID_2` (`IMPORT_ID`,`timestamp`) | |
30 | - ) ENGINE=InnoDB DEFAULT CHARSET=utf8'); | |
31 | - | |
32 | - } | |
33 | - | |
34 | - public function down() | |
35 | - { | |
36 | - $this->dropTable('{{%details}}'); | |
37 | - | |
38 | - } | |
39 | - | |
40 | -} |
console/migrations/m150922_094313_change_key_ImportFiles.php deleted
1 | -<?php | |
2 | - | |
3 | -use yii\db\Schema; | |
4 | -use yii\db\Migration; | |
5 | - | |
6 | -class m150922_094313_change_key_ImportFiles extends Migration | |
7 | -{ | |
8 | - //@todo вероятно что эта миграция ненужна - посмотреть ближе к концу проекта на ключи которые используются - остальные удалить. | |
9 | - public function up() | |
10 | - { | |
11 | - $this->dropIndex('importer_id', '{{%importer_files}}'); | |
12 | - $this->createIndex('importer_id', '{{%importer_files}}', 'importer_id, upload_time', false); | |
13 | - } | |
14 | - | |
15 | - public function down() | |
16 | - { | |
17 | - $this->dropIndex('importer_id', '{{%importer_files}}'); | |
18 | - $this->createIndex('importer_id', '{{%importer_files}}', 'importer_id, time_start', false); | |
19 | - } | |
20 | - | |
21 | - | |
22 | -} |
console/migrations/m150922_144040_change_Importer_dataPrice.php deleted
1 | -<?php | |
2 | - | |
3 | -use yii\db\Schema; | |
4 | -use yii\db\Migration; | |
5 | - | |
6 | -class m150922_144040_change_Importer_dataPrice extends Migration | |
7 | -{ | |
8 | - public function up() | |
9 | - { | |
10 | - $this->alterColumn('{{%importer}}','price_date_update','TIMESTAMP' ); | |
11 | - $this->createIndex('price_date', '{{%importer}}', 'price_date_update', false); | |
12 | - } | |
13 | - | |
14 | - public function down() | |
15 | - { | |
16 | - $this->alterColumn('{{%importer}}','price_date','varchar(15)' ); | |
17 | - $this->dropIndex('price_date', '{{%importer}}'); | |
18 | - } | |
19 | - | |
20 | - | |
21 | -} |
console/migrations/m151016_144435_addViewDetailsCurrency.php
console/migrations/m151030_121905_addSumBillFunction.php
0 → 100644
1 | +<?php | |
2 | + | |
3 | +use yii\db\Migration; | |
4 | + | |
5 | +/** | |
6 | + * Class m151030_121905_addSumBillFunction | |
7 | + * добавляем функцию расчета суммы заказа | |
8 | + */ | |
9 | +class m151030_121905_addSumBillFunction extends Migration | |
10 | +{ | |
11 | + | |
12 | + public function safeUp() | |
13 | + { | |
14 | + $sum_count = <<< MySQL | |
15 | + CREATE FUNCTION SumBill(p_bill_id int) RETURNS DECIMAL(12,2) | |
16 | + BEGIN | |
17 | + DECLARE _sum DECIMAL(12,2); | |
18 | + | |
19 | + select round(sum(`count`*`price`),2) into _sum From w_cart where bill_id = p_bill_id; | |
20 | + | |
21 | + RETURN (_sum); | |
22 | + END | |
23 | +MySQL; | |
24 | + | |
25 | + $this->execute($sum_count); | |
26 | + | |
27 | + } | |
28 | + | |
29 | + public function safedown() | |
30 | + { | |
31 | + | |
32 | + $sum_count = <<< MySQL | |
33 | + drop FUNCTION SumBill; | |
34 | +MySQL; | |
35 | + | |
36 | + $this->execute($sum_count); | |
37 | + | |
38 | + } | |
39 | + | |
40 | + | |
41 | +} | |
0 | 42 | \ No newline at end of file | ... | ... |
console/migrations/m151030_123511_addCartBillsView.php
0 → 100644
1 | +<?php | |
2 | + | |
3 | +use yii\db\Migration; | |
4 | + | |
5 | + | |
6 | +class m151030_123511_addCartBillsView extends Migration | |
7 | +{ | |
8 | + public function up() | |
9 | + { | |
10 | + | |
11 | + $view = <<< MySQL | |
12 | + create view w_cart_bills_view as | |
13 | + select `w_cart_bills`.`id` as `id`, | |
14 | + `w_cart_bills`.`account_id`, | |
15 | + `w__user`.`name` as `manager_name`, | |
16 | + unix_timestamp(`w_cart_bills`.`timestamp`) as `dt`, | |
17 | + `w_cart_bills`.`f1` as `name`, | |
18 | + `w_cart_bills`.`f2` as `phone`, | |
19 | + `w_cart_bills`.`f3` as `email`, | |
20 | + `w_cart_bills`.`delivery`, | |
21 | + `w_cart_bills`.`status` as `status_id`, | |
22 | + `w_dic_statuses`.`name` as `status`, | |
23 | + `w_cart_bills`.`message`,`w_cart_bills`.`safe_bill`, | |
24 | + SumBill(`w_cart_bills`.`id`) as `sum`, | |
25 | + `w_accounts`.`scode` | |
26 | + from `w_cart_bills` | |
27 | + left join `w_accounts` on `w_accounts`.`id` = `w_cart_bills`.`account_id` | |
28 | + left join `w__user` on `w__user`.`id` = `w_cart_bills`.`manager_id` | |
29 | + inner join `w_dic_statuses` on `w_dic_statuses`.`id` = `w_cart_bills`.`status`; | |
30 | +MySQL; | |
31 | + | |
32 | + $this->execute($view); | |
33 | + | |
34 | + } | |
35 | + | |
36 | + public function down() | |
37 | + { | |
38 | + // вернем все как было | |
39 | + $drop_view = 'drop view if exists w_cart_bills_view'; | |
40 | + | |
41 | + $this->execute($drop_view); | |
42 | + | |
43 | + } | |
44 | +} | |
45 | + | |
46 | + | |
47 | + | ... | ... |
1 | +<?php | |
2 | + | |
3 | +use yii\db\Migration; | |
4 | + | |
5 | +class m151030_133110_addCartView extends Migration | |
6 | +{ | |
7 | + public function up() | |
8 | + { | |
9 | + | |
10 | + $view = <<< MySQL | |
11 | + create view w_cart_view as | |
12 | + select `w_cart_bills`.`id`, | |
13 | + `w_cart_bills`.`account_id`, | |
14 | + unix_timestamp(`w_cart_bills`.`timestamp`) as `dt`, | |
15 | + `w_cart_bills`.`f1` as `user_name`, | |
16 | + `w_cart_bills`.`f3` as `user_mail`, | |
17 | + `w_cart`.`status` as `status_id`, | |
18 | + `w_dic_statuses`.`name` as `status`, | |
19 | + `w_cart`.`article`,`w_cart`.`brand`,`w_cart`.`descr`, | |
20 | + `w_importers`.`name` as `importer`, | |
21 | + `w_cart`.`count`,`w_cart`.`price`, | |
22 | + `w_cart`.`import_id` | |
23 | + from `w_cart` | |
24 | + inner join `w_importers` on `w_importers`.`id` = `w_cart`.`import_id` | |
25 | + inner join `w_cart_bills` on `w_cart_bills`.`id` = `w_cart`.`bill_id` | |
26 | + inner join `w_dic_statuses` on `w_dic_statuses`.`id` = `w_cart`.`status`; | |
27 | +MySQL; | |
28 | + | |
29 | + $this->execute($view); | |
30 | + | |
31 | + } | |
32 | + | |
33 | + public function down() | |
34 | + { | |
35 | + // вернем все как было | |
36 | + $drop_view = 'drop view if exists w_cart_view'; | |
37 | + | |
38 | + $this->execute($drop_view); | |
39 | + | |
40 | + } | |
41 | +} | ... | ... |
vendor/composer/autoload_psr4.php
... | ... | @@ -16,6 +16,11 @@ return array( |
16 | 16 | 'yii\\codeception\\' => array($vendorDir . '/yiisoft/yii2-codeception'), |
17 | 17 | 'yii\\bootstrap\\' => array($vendorDir . '/yiisoft/yii2-bootstrap'), |
18 | 18 | 'yii\\' => array($vendorDir . '/yiisoft/yii2'), |
19 | + 'kartik\\plugins\\dateformatter\\' => array($vendorDir . '/kartik-v/php-date-formatter'), | |
20 | + 'kartik\\field\\' => array($vendorDir . '/kartik-v/yii2-field-range'), | |
21 | + 'kartik\\datecontrol\\' => array($vendorDir . '/kartik-v/yii2-datecontrol'), | |
22 | + 'kartik\\date\\' => array($vendorDir . '/kartik-v/yii2-widget-datepicker'), | |
23 | + 'kartik\\base\\' => array($vendorDir . '/kartik-v/yii2-krajee-base'), | |
19 | 24 | 'cebe\\markdown\\' => array($vendorDir . '/cebe/markdown'), |
20 | 25 | 'Faker\\' => array($vendorDir . '/fzaninotto/faker/src/Faker'), |
21 | 26 | ); | ... | ... |
vendor/composer/installed.json
... | ... | @@ -1090,5 +1090,253 @@ |
1090 | 1090 | "xml", |
1091 | 1091 | "yii2" |
1092 | 1092 | ] |
1093 | + }, | |
1094 | + { | |
1095 | + "name": "kartik-v/yii2-krajee-base", | |
1096 | + "version": "v1.7.7", | |
1097 | + "version_normalized": "1.7.7.0", | |
1098 | + "source": { | |
1099 | + "type": "git", | |
1100 | + "url": "https://github.com/kartik-v/yii2-krajee-base.git", | |
1101 | + "reference": "c0adff9d9762f4fd3bf0e7cd0000fcab0bf00f19" | |
1102 | + }, | |
1103 | + "dist": { | |
1104 | + "type": "zip", | |
1105 | + "url": "https://api.github.com/repos/kartik-v/yii2-krajee-base/zipball/c0adff9d9762f4fd3bf0e7cd0000fcab0bf00f19", | |
1106 | + "reference": "c0adff9d9762f4fd3bf0e7cd0000fcab0bf00f19", | |
1107 | + "shasum": "" | |
1108 | + }, | |
1109 | + "require": { | |
1110 | + "yiisoft/yii2-bootstrap": "@dev" | |
1111 | + }, | |
1112 | + "time": "2015-06-16 05:19:57", | |
1113 | + "type": "yii2-extension", | |
1114 | + "installation-source": "dist", | |
1115 | + "autoload": { | |
1116 | + "psr-4": { | |
1117 | + "kartik\\base\\": "" | |
1118 | + } | |
1119 | + }, | |
1120 | + "notification-url": "https://packagist.org/downloads/", | |
1121 | + "license": [ | |
1122 | + "BSD-3-Clause" | |
1123 | + ], | |
1124 | + "authors": [ | |
1125 | + { | |
1126 | + "name": "Kartik Visweswaran", | |
1127 | + "email": "kartikv2@gmail.com", | |
1128 | + "homepage": "http://www.krajee.com/" | |
1129 | + } | |
1130 | + ], | |
1131 | + "description": "Base library and foundation components for all Yii2 Krajee extensions.", | |
1132 | + "homepage": "https://github.com/kartik-v/yii2-krajee-base", | |
1133 | + "keywords": [ | |
1134 | + "base", | |
1135 | + "extension", | |
1136 | + "foundation", | |
1137 | + "krajee", | |
1138 | + "widget", | |
1139 | + "yii2" | |
1140 | + ] | |
1141 | + }, | |
1142 | + { | |
1143 | + "name": "kartik-v/yii2-widget-datepicker", | |
1144 | + "version": "v1.3.3", | |
1145 | + "version_normalized": "1.3.3.0", | |
1146 | + "source": { | |
1147 | + "type": "git", | |
1148 | + "url": "https://github.com/kartik-v/yii2-widget-datepicker.git", | |
1149 | + "reference": "368b181ef658c05707fe41dd16eee4d9ffd9da38" | |
1150 | + }, | |
1151 | + "dist": { | |
1152 | + "type": "zip", | |
1153 | + "url": "https://api.github.com/repos/kartik-v/yii2-widget-datepicker/zipball/368b181ef658c05707fe41dd16eee4d9ffd9da38", | |
1154 | + "reference": "368b181ef658c05707fe41dd16eee4d9ffd9da38", | |
1155 | + "shasum": "" | |
1156 | + }, | |
1157 | + "require": { | |
1158 | + "kartik-v/yii2-krajee-base": "~1.7" | |
1159 | + }, | |
1160 | + "time": "2015-07-19 04:49:03", | |
1161 | + "type": "yii2-extension", | |
1162 | + "installation-source": "dist", | |
1163 | + "autoload": { | |
1164 | + "psr-4": { | |
1165 | + "kartik\\date\\": "" | |
1166 | + } | |
1167 | + }, | |
1168 | + "notification-url": "https://packagist.org/downloads/", | |
1169 | + "license": [ | |
1170 | + "BSD-3-Clause" | |
1171 | + ], | |
1172 | + "authors": [ | |
1173 | + { | |
1174 | + "name": "Kartik Visweswaran", | |
1175 | + "email": "kartikv2@gmail.com", | |
1176 | + "homepage": "http://www.krajee.com/" | |
1177 | + } | |
1178 | + ], | |
1179 | + "description": "Enhanced Yii2 wrapper for the bootstrap datepicker plugin (sub repo split from yii2-widgets).", | |
1180 | + "homepage": "https://github.com/kartik-v/yii2-widget-datepicker", | |
1181 | + "keywords": [ | |
1182 | + "date", | |
1183 | + "extension", | |
1184 | + "form", | |
1185 | + "jquery", | |
1186 | + "picker", | |
1187 | + "plugin", | |
1188 | + "select2", | |
1189 | + "widget", | |
1190 | + "yii2" | |
1191 | + ] | |
1192 | + }, | |
1193 | + { | |
1194 | + "name": "kartik-v/yii2-field-range", | |
1195 | + "version": "v1.3.0", | |
1196 | + "version_normalized": "1.3.0.0", | |
1197 | + "source": { | |
1198 | + "type": "git", | |
1199 | + "url": "https://github.com/kartik-v/yii2-field-range.git", | |
1200 | + "reference": "095d260eecb86ff2e78a70775011cec00a75df98" | |
1201 | + }, | |
1202 | + "dist": { | |
1203 | + "type": "zip", | |
1204 | + "url": "https://api.github.com/repos/kartik-v/yii2-field-range/zipball/095d260eecb86ff2e78a70775011cec00a75df98", | |
1205 | + "reference": "095d260eecb86ff2e78a70775011cec00a75df98", | |
1206 | + "shasum": "" | |
1207 | + }, | |
1208 | + "require": { | |
1209 | + "kartik-v/yii2-krajee-base": "*" | |
1210 | + }, | |
1211 | + "time": "2014-11-25 08:52:00", | |
1212 | + "type": "yii2-extension", | |
1213 | + "installation-source": "dist", | |
1214 | + "autoload": { | |
1215 | + "psr-4": { | |
1216 | + "kartik\\field\\": "" | |
1217 | + } | |
1218 | + }, | |
1219 | + "notification-url": "https://packagist.org/downloads/", | |
1220 | + "license": [ | |
1221 | + "BSD 3-Clause" | |
1222 | + ], | |
1223 | + "authors": [ | |
1224 | + { | |
1225 | + "name": "Kartik Visweswaran", | |
1226 | + "email": "kartikv2@gmail.com", | |
1227 | + "homepage": "http://www.krajee.com/" | |
1228 | + } | |
1229 | + ], | |
1230 | + "description": "Easily manage Yii 2 ActiveField ranges (from/to) with Bootstrap 3 addons markup and more", | |
1231 | + "homepage": "https://github.com/kartik-v/yii2-field-range", | |
1232 | + "keywords": [ | |
1233 | + "addon", | |
1234 | + "bootstrap", | |
1235 | + "bootstrap 3", | |
1236 | + "date", | |
1237 | + "extension", | |
1238 | + "field-range", | |
1239 | + "from", | |
1240 | + "range", | |
1241 | + "to", | |
1242 | + "widget", | |
1243 | + "yii2" | |
1244 | + ] | |
1245 | + }, | |
1246 | + { | |
1247 | + "name": "kartik-v/php-date-formatter", | |
1248 | + "version": "v1.3.1", | |
1249 | + "version_normalized": "1.3.1.0", | |
1250 | + "source": { | |
1251 | + "type": "git", | |
1252 | + "url": "https://github.com/kartik-v/php-date-formatter.git", | |
1253 | + "reference": "7d3dc3495dd10bd1909c0dfdecd673967019cc21" | |
1254 | + }, | |
1255 | + "dist": { | |
1256 | + "type": "zip", | |
1257 | + "url": "https://api.github.com/repos/kartik-v/php-date-formatter/zipball/7d3dc3495dd10bd1909c0dfdecd673967019cc21", | |
1258 | + "reference": "7d3dc3495dd10bd1909c0dfdecd673967019cc21", | |
1259 | + "shasum": "" | |
1260 | + }, | |
1261 | + "time": "2015-06-18 15:14:51", | |
1262 | + "type": "library", | |
1263 | + "installation-source": "dist", | |
1264 | + "autoload": { | |
1265 | + "psr-4": { | |
1266 | + "kartik\\plugins\\dateformatter\\": "" | |
1267 | + } | |
1268 | + }, | |
1269 | + "notification-url": "https://packagist.org/downloads/", | |
1270 | + "license": [ | |
1271 | + "BSD-3-Clause" | |
1272 | + ], | |
1273 | + "authors": [ | |
1274 | + { | |
1275 | + "name": "Kartik Visweswaran", | |
1276 | + "email": "kartikv2@gmail.com", | |
1277 | + "homepage": "http://www.krajee.com/" | |
1278 | + } | |
1279 | + ], | |
1280 | + "description": "A JQuery datetime formatting and manipulation library using PHP date-time formats in javascript.", | |
1281 | + "homepage": "https://github.com/kartik-v/php-date-formatter", | |
1282 | + "keywords": [ | |
1283 | + "date", | |
1284 | + "datetime", | |
1285 | + "formatter", | |
1286 | + "javascript", | |
1287 | + "jquery", | |
1288 | + "php", | |
1289 | + "php-date-formatter.js", | |
1290 | + "time" | |
1291 | + ] | |
1292 | + }, | |
1293 | + { | |
1294 | + "name": "kartik-v/yii2-datecontrol", | |
1295 | + "version": "dev-master", | |
1296 | + "version_normalized": "9999999-dev", | |
1297 | + "source": { | |
1298 | + "type": "git", | |
1299 | + "url": "https://github.com/kartik-v/yii2-datecontrol.git", | |
1300 | + "reference": "4e858b5cd38130c37739b2f582b66a044f77c95c" | |
1301 | + }, | |
1302 | + "dist": { | |
1303 | + "type": "zip", | |
1304 | + "url": "https://api.github.com/repos/kartik-v/yii2-datecontrol/zipball/4e858b5cd38130c37739b2f582b66a044f77c95c", | |
1305 | + "reference": "4e858b5cd38130c37739b2f582b66a044f77c95c", | |
1306 | + "shasum": "" | |
1307 | + }, | |
1308 | + "require": { | |
1309 | + "kartik-v/php-date-formatter": ">1.3", | |
1310 | + "kartik-v/yii2-krajee-base": "~1.7" | |
1311 | + }, | |
1312 | + "time": "2015-07-30 18:30:18", | |
1313 | + "type": "yii2-extension", | |
1314 | + "installation-source": "dist", | |
1315 | + "autoload": { | |
1316 | + "psr-4": { | |
1317 | + "kartik\\datecontrol\\": "" | |
1318 | + } | |
1319 | + }, | |
1320 | + "notification-url": "https://packagist.org/downloads/", | |
1321 | + "license": [ | |
1322 | + "BSD-3-Clause" | |
1323 | + ], | |
1324 | + "authors": [ | |
1325 | + { | |
1326 | + "name": "Kartik Visweswaran", | |
1327 | + "email": "kartikv2@gmail.com", | |
1328 | + "homepage": "http://www.krajee.com/" | |
1329 | + } | |
1330 | + ], | |
1331 | + "description": "Date control module allowing separation of formats for View and Model for Yii Framework 2.0", | |
1332 | + "homepage": "https://github.com/kartik-v/yii2-datecontrol", | |
1333 | + "keywords": [ | |
1334 | + "control", | |
1335 | + "date", | |
1336 | + "extension", | |
1337 | + "format", | |
1338 | + "yii", | |
1339 | + "yii2" | |
1340 | + ] | |
1093 | 1341 | } |
1094 | 1342 | ] | ... | ... |
vendor/yiisoft/extensions.php
... | ... | @@ -75,4 +75,40 @@ return array ( |
75 | 75 | '@yii/imagine' => $vendorDir . '/yiisoft/yii2-imagine', |
76 | 76 | ), |
77 | 77 | ), |
78 | + 'kartik-v/yii2-krajee-base' => | |
79 | + array ( | |
80 | + 'name' => 'kartik-v/yii2-krajee-base', | |
81 | + 'version' => '1.7.7.0', | |
82 | + 'alias' => | |
83 | + array ( | |
84 | + '@kartik/base' => $vendorDir . '/kartik-v/yii2-krajee-base', | |
85 | + ), | |
86 | + ), | |
87 | + 'kartik-v/yii2-widget-datepicker' => | |
88 | + array ( | |
89 | + 'name' => 'kartik-v/yii2-widget-datepicker', | |
90 | + 'version' => '1.3.3.0', | |
91 | + 'alias' => | |
92 | + array ( | |
93 | + '@kartik/date' => $vendorDir . '/kartik-v/yii2-widget-datepicker', | |
94 | + ), | |
95 | + ), | |
96 | + 'kartik-v/yii2-field-range' => | |
97 | + array ( | |
98 | + 'name' => 'kartik-v/yii2-field-range', | |
99 | + 'version' => '1.3.0.0', | |
100 | + 'alias' => | |
101 | + array ( | |
102 | + '@kartik/field' => $vendorDir . '/kartik-v/yii2-field-range', | |
103 | + ), | |
104 | + ), | |
105 | + 'kartik-v/yii2-datecontrol' => | |
106 | + array ( | |
107 | + 'name' => 'kartik-v/yii2-datecontrol', | |
108 | + 'version' => '9999999-dev', | |
109 | + 'alias' => | |
110 | + array ( | |
111 | + '@kartik/datecontrol' => $vendorDir . '/kartik-v/yii2-datecontrol', | |
112 | + ), | |
113 | + ), | |
78 | 114 | ); | ... | ... |