Commit 7bfae4930c9c1ed926f7114d0ee7b93d199657b3

Authored by Administrator
1 parent 394e2db6

Importers CRUD

Showing 78 changed files with 2433 additions and 8 deletions   Show diff stats
backend/components/DatePicker.php 0 → 100644
  1 +<?php
  2 +/**
  3 + * Created by PhpStorm.
  4 + * User: vitaliy
  5 + * Date: 05.10.15
  6 + * Time: 16:18
  7 + */
  8 +
  9 +namespace backend\components;
  10 +use yii\base\Widget;
  11 +
  12 +
  13 +class DatePicker extends Widget
  14 +{
  15 + public $dateStyle= "dd-mm-yy";
  16 + public $name;
  17 + public $model;
  18 + public $form;
  19 +
  20 + public function init(){
  21 +
  22 + parent::init();
  23 +
  24 + }
  25 +
  26 +
  27 + public function run()
  28 + {
  29 +
  30 + return $this->render('image_sizer',
  31 + [
  32 + 'dateStyle'=>$this->dateStyle,
  33 + 'name' => $this->name,
  34 + 'model'=> $this->model,
  35 + 'form'=>$this->form
  36 + ]);
  37 +
  38 + }
  39 +}
0 40 \ No newline at end of file
... ...
backend/components/views/date_picker.php 0 → 100644
  1 +<?php
  2 +/**
  3 + * Created by PhpStorm.
  4 + * User: vitaliy
  5 + * Date: 05.10.15
  6 + * Time: 16:20
  7 + */
  8 +$this->registerCssFile('//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css');
  9 +$this->registerJsFile('//code.jquery.com/ui/1.11.4/jquery-ui.js');
  10 +?>
  11 +
  12 + <?= $form->field($model,$name)->hiddenInput(['id' => "{$name}_date_picker"]) ?>
  13 + <script>
  14 + $(function(){
  15 + $.datepicker.regional['ru'] = {
  16 + closeText: 'Закрыть',
  17 + prevText: '&#x3c;Пред',
  18 + nextText: 'След&#x3e;',
  19 + currentText: 'Сегодня',
  20 + monthNames: ['Январь','Февраль','Март','Апрель','Май','Июнь',
  21 + 'Июль','Август','Сентябрь','Октябрь','Ноябрь','Декабрь'],
  22 + monthNamesShort: ['Янв','Фев','Мар','Апр','Май','Июн',
  23 + 'Июл','Авг','Сен','Окт','Ноя','Дек'],
  24 + dayNames: ['воскресенье','понедельник','вторник','среда','четверг','пятница','суббота'],
  25 + dayNamesShort: ['вск','пнд','втр','срд','чтв','птн','сбт'],
  26 + dayNamesMin: ['Вс','Пн','Вт','Ср','Чт','Пт','Сб'],
  27 + dateFormat: 'dd.mm.yy',
  28 + firstDay: 1,
  29 + isRTL: false
  30 + };
  31 + $.datepicker.setDefaults($.datepicker.regional['ru']);
  32 +
  33 + $(<?= "{$name}_date_picker"?> ).datepicker({
  34 + dateFormat: <?= $dateStyle ?>
  35 + });
  36 + })
  37 + </script>
... ...
backend/controllers/CurrencyController.php 0 → 100644
  1 +<?php
  2 +
  3 +namespace backend\controllers;
  4 +
  5 +use Yii;
  6 +use common\models\Currency;
  7 +use common\models\CurrencySearch;
  8 +use yii\web\Controller;
  9 +use yii\web\NotFoundHttpException;
  10 +use yii\filters\VerbFilter;
  11 +
  12 +/**
  13 + * CurrencyController implements the CRUD actions for Currency model.
  14 + */
  15 +class CurrencyController extends Controller
  16 +{
  17 + public $layout = "/column";
  18 + public function behaviors()
  19 + {
  20 + return [
  21 + 'verbs' => [
  22 + 'class' => VerbFilter::className(),
  23 + 'actions' => [
  24 + 'delete' => ['post'],
  25 + ],
  26 + ],
  27 + ];
  28 + }
  29 +
  30 + /**
  31 + * Lists all Currency models.
  32 + * @return mixed
  33 + */
  34 + public function actionIndex()
  35 + {
  36 + $searchModel = new CurrencySearch();
  37 + $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
  38 +
  39 + return $this->render('index', [
  40 + 'searchModel' => $searchModel,
  41 + 'dataProvider' => $dataProvider,
  42 + ]);
  43 + }
  44 +
  45 + /**
  46 + * Displays a single Currency model.
  47 + * @param integer $id
  48 + * @return mixed
  49 + */
  50 + public function actionView($id)
  51 + {
  52 + return $this->render('view', [
  53 + 'model' => $this->findModel($id),
  54 + ]);
  55 + }
  56 +
  57 + /**
  58 + * Creates a new Currency model.
  59 + * If creation is successful, the browser will be redirected to the 'view' page.
  60 + * @return mixed
  61 + */
  62 + public function actionCreate()
  63 + {
  64 + $model = new Currency();
  65 +
  66 + if ($model->load(Yii::$app->request->post()) && $model->save()) {
  67 + return $this->redirect(['view', 'id' => $model->id]);
  68 + } else {
  69 + return $this->render('create', [
  70 + 'model' => $model,
  71 + ]);
  72 + }
  73 + }
  74 +
  75 + /**
  76 + * Updates an existing Currency model.
  77 + * If update is successful, the browser will be redirected to the 'view' page.
  78 + * @param integer $id
  79 + * @return mixed
  80 + */
  81 + public function actionUpdate($id)
  82 + {
  83 + $model = $this->findModel($id);
  84 +
  85 + if ($model->load(Yii::$app->request->post()) && $model->save()) {
  86 + return $this->redirect(['view', 'id' => $model->id]);
  87 + } else {
  88 + return $this->render('update', [
  89 + 'model' => $model,
  90 + ]);
  91 + }
  92 + }
  93 +
  94 + /**
  95 + * Deletes an existing Currency model.
  96 + * If deletion is successful, the browser will be redirected to the 'index' page.
  97 + * @param integer $id
  98 + * @return mixed
  99 + */
  100 + public function actionDelete($id)
  101 + {
  102 + $this->findModel($id)->delete();
  103 +
  104 + return $this->redirect(['index']);
  105 + }
  106 +
  107 + /**
  108 + * Finds the Currency model based on its primary key value.
  109 + * If the model is not found, a 404 HTTP exception will be thrown.
  110 + * @param integer $id
  111 + * @return Currency the loaded model
  112 + * @throws NotFoundHttpException if the model cannot be found
  113 + */
  114 + protected function findModel($id)
  115 + {
  116 + if (($model = Currency::findOne($id)) !== null) {
  117 + return $model;
  118 + } else {
  119 + throw new NotFoundHttpException('The requested page does not exist.');
  120 + }
  121 + }
  122 +}
... ...
backend/controllers/MarginsController.php 0 → 100644
  1 +<?php
  2 +
  3 +namespace backend\controllers;
  4 +
  5 +use Yii;
  6 +use common\models\Margins;
  7 +use common\models\MarginsSearch;
  8 +use yii\web\Controller;
  9 +use yii\web\NotFoundHttpException;
  10 +use yii\filters\VerbFilter;
  11 +
  12 +/**
  13 + * MarginsController implements the CRUD actions for Margins model.
  14 + */
  15 +class MarginsController extends Controller
  16 +{
  17 +
  18 + public $layout = "/column";
  19 + public function behaviors()
  20 + {
  21 + return [
  22 + 'verbs' => [
  23 + 'class' => VerbFilter::className(),
  24 + 'actions' => [
  25 + 'delete' => ['post'],
  26 + ],
  27 + ],
  28 + ];
  29 + }
  30 +
  31 + /**
  32 + * Lists all Margins models.
  33 + * @return mixed
  34 + */
  35 + public function actionIndex()
  36 + {
  37 + $searchModel = new MarginsSearch();
  38 + $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
  39 +
  40 + return $this->render('index', [
  41 + 'searchModel' => $searchModel,
  42 + 'dataProvider' => $dataProvider,
  43 + ]);
  44 + }
  45 +
  46 + /**
  47 + * Displays a single Margins model.
  48 + * @param integer $id
  49 + * @return mixed
  50 + */
  51 + public function actionView($id)
  52 + {
  53 + return $this->render('view', [
  54 + 'model' => $this->findModel($id),
  55 + ]);
  56 + }
  57 +
  58 + /**
  59 + * Creates a new Margins model.
  60 + * If creation is successful, the browser will be redirected to the 'view' page.
  61 + * @return mixed
  62 + */
  63 + public function actionCreate()
  64 + {
  65 + $model = new Margins();
  66 +
  67 + if ($model->load(Yii::$app->request->post()) && $model->save()) {
  68 + return $this->redirect(['view', 'id' => $model->id]);
  69 + } else {
  70 + return $this->render('create', [
  71 + 'model' => $model,
  72 + ]);
  73 + }
  74 + }
  75 +
  76 + /**
  77 + * Updates an existing Margins model.
  78 + * If update is successful, the browser will be redirected to the 'view' page.
  79 + * @param integer $id
  80 + * @return mixed
  81 + */
  82 + public function actionUpdate($id)
  83 + {
  84 + $model = $this->findModel($id);
  85 +
  86 + if ($model->load(Yii::$app->request->post()) && $model->save()) {
  87 + return $this->redirect(['view', 'id' => $model->id]);
  88 + } else {
  89 + return $this->render('update', [
  90 + 'model' => $model,
  91 + ]);
  92 + }
  93 + }
  94 +
  95 + /**
  96 + * Deletes an existing Margins model.
  97 + * If deletion is successful, the browser will be redirected to the 'index' page.
  98 + * @param integer $id
  99 + * @return mixed
  100 + */
  101 + public function actionDelete($id)
  102 + {
  103 + $this->findModel($id)->delete();
  104 +
  105 + return $this->redirect(['index']);
  106 + }
  107 +
  108 + /**
  109 + * Finds the Margins model based on its primary key value.
  110 + * If the model is not found, a 404 HTTP exception will be thrown.
  111 + * @param integer $id
  112 + * @return Margins the loaded model
  113 + * @throws NotFoundHttpException if the model cannot be found
  114 + */
  115 + protected function findModel($id)
  116 + {
  117 + if (($model = Margins::findOne($id)) !== null) {
  118 + return $model;
  119 + } else {
  120 + throw new NotFoundHttpException('The requested page does not exist.');
  121 + }
  122 + }
  123 +}
... ...
backend/controllers/MarginsGroupsController.php 0 → 100644
  1 +<?php
  2 +
  3 +namespace backend\controllers;
  4 +
  5 +use Yii;
  6 +use common\models\MarginsGroups;
  7 +use common\models\MarginsGroupsSearch;
  8 +use yii\web\Controller;
  9 +use yii\web\NotFoundHttpException;
  10 +use yii\filters\VerbFilter;
  11 +
  12 +/**
  13 + * MarginsGroupsController implements the CRUD actions for MarginsGroups model.
  14 + */
  15 +class MarginsGroupsController extends Controller
  16 +{
  17 +
  18 + public $layout = "/column";
  19 + public function behaviors()
  20 + {
  21 + return [
  22 + 'verbs' => [
  23 + 'class' => VerbFilter::className(),
  24 + 'actions' => [
  25 + 'delete' => ['post'],
  26 + ],
  27 + ],
  28 + ];
  29 + }
  30 +
  31 + /**
  32 + * Lists all MarginsGroups models.
  33 + * @return mixed
  34 + */
  35 + public function actionIndex()
  36 + {
  37 + $searchModel = new MarginsGroupsSearch();
  38 + $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
  39 +
  40 + return $this->render('index', [
  41 + 'searchModel' => $searchModel,
  42 + 'dataProvider' => $dataProvider,
  43 + ]);
  44 + }
  45 +
  46 + /**
  47 + * Displays a single MarginsGroups model.
  48 + * @param integer $id
  49 + * @return mixed
  50 + */
  51 + public function actionView($id)
  52 + {
  53 + return $this->render('view', [
  54 + 'model' => $this->findModel($id),
  55 + ]);
  56 + }
  57 +
  58 + /**
  59 + * Creates a new MarginsGroups model.
  60 + * If creation is successful, the browser will be redirected to the 'view' page.
  61 + * @return mixed
  62 + */
  63 + public function actionCreate()
  64 + {
  65 + $model = new MarginsGroups();
  66 +
  67 + if ($model->load(Yii::$app->request->post()) && $model->save()) {
  68 + return $this->redirect(['view', 'id' => $model->id]);
  69 + } else {
  70 + return $this->render('create', [
  71 + 'model' => $model,
  72 + ]);
  73 + }
  74 + }
  75 +
  76 + /**
  77 + * Updates an existing MarginsGroups model.
  78 + * If update is successful, the browser will be redirected to the 'view' page.
  79 + * @param integer $id
  80 + * @return mixed
  81 + */
  82 + public function actionUpdate($id)
  83 + {
  84 + $model = $this->findModel($id);
  85 +
  86 + if ($model->load(Yii::$app->request->post()) && $model->save()) {
  87 + return $this->redirect(['view', 'id' => $model->id]);
  88 + } else {
  89 + return $this->render('update', [
  90 + 'model' => $model,
  91 + ]);
  92 + }
  93 + }
  94 +
  95 + /**
  96 + * Deletes an existing MarginsGroups model.
  97 + * If deletion is successful, the browser will be redirected to the 'index' page.
  98 + * @param integer $id
  99 + * @return mixed
  100 + */
  101 + public function actionDelete($id)
  102 + {
  103 + $this->findModel($id)->delete();
  104 +
  105 + return $this->redirect(['index']);
  106 + }
  107 +
  108 + /**
  109 + * Finds the MarginsGroups model based on its primary key value.
  110 + * If the model is not found, a 404 HTTP exception will be thrown.
  111 + * @param integer $id
  112 + * @return MarginsGroups the loaded model
  113 + * @throws NotFoundHttpException if the model cannot be found
  114 + */
  115 + protected function findModel($id)
  116 + {
  117 + if (($model = MarginsGroups::findOne($id)) !== null) {
  118 + return $model;
  119 + } else {
  120 + throw new NotFoundHttpException('The requested page does not exist.');
  121 + }
  122 + }
  123 +}
... ...
backend/controllers/MarginsImportersController.php 0 → 100644
  1 +<?php
  2 +
  3 +namespace backend\controllers;
  4 +
  5 +use Yii;
  6 +use common\models\MarginsImporters;
  7 +use common\models\MarginsImportersSearch;
  8 +use yii\web\Controller;
  9 +use yii\web\NotFoundHttpException;
  10 +use yii\filters\VerbFilter;
  11 +
  12 +/**
  13 + * MarginsImportersController implements the CRUD actions for MarginsImporters model.
  14 + */
  15 +class MarginsImportersController extends Controller
  16 +{
  17 +
  18 +
  19 + public $layout = "/column";
  20 + public function behaviors()
  21 + {
  22 + return [
  23 + 'verbs' => [
  24 + 'class' => VerbFilter::className(),
  25 + 'actions' => [
  26 + 'delete' => ['post'],
  27 + ],
  28 + ],
  29 + ];
  30 + }
  31 +
  32 + /**
  33 + * Lists all MarginsImporters models.
  34 + * @return mixed
  35 + */
  36 + public function actionIndex()
  37 + {
  38 + $searchModel = new MarginsImportersSearch();
  39 + $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
  40 +
  41 + return $this->render('index', [
  42 + 'searchModel' => $searchModel,
  43 + 'dataProvider' => $dataProvider,
  44 + ]);
  45 + }
  46 +
  47 + /**
  48 + * Displays a single MarginsImporters model.
  49 + * @param integer $id
  50 + * @return mixed
  51 + */
  52 + public function actionView($id)
  53 + {
  54 + return $this->render('view', [
  55 + 'model' => $this->findModel($id),
  56 + ]);
  57 + }
  58 +
  59 + /**
  60 + * Creates a new MarginsImporters model.
  61 + * If creation is successful, the browser will be redirected to the 'view' page.
  62 + * @return mixed
  63 + */
  64 + public function actionCreate()
  65 + {
  66 + $model = new MarginsImporters();
  67 +
  68 + if ($model->load(Yii::$app->request->post()) && $model->save()) {
  69 + return $this->redirect(['view', 'id' => $model->id]);
  70 + } else {
  71 + return $this->render('create', [
  72 + 'model' => $model,
  73 + ]);
  74 + }
  75 + }
  76 +
  77 + /**
  78 + * Updates an existing MarginsImporters model.
  79 + * If update is successful, the browser will be redirected to the 'view' page.
  80 + * @param integer $id
  81 + * @return mixed
  82 + */
  83 + public function actionUpdate($id)
  84 + {
  85 + $model = $this->findModel($id);
  86 +
  87 + if ($model->load(Yii::$app->request->post()) && $model->save()) {
  88 + return $this->redirect(['view', 'id' => $model->id]);
  89 + } else {
  90 + return $this->render('update', [
  91 + 'model' => $model,
  92 + ]);
  93 + }
  94 + }
  95 +
  96 + /**
  97 + * Deletes an existing MarginsImporters model.
  98 + * If deletion is successful, the browser will be redirected to the 'index' page.
  99 + * @param integer $id
  100 + * @return mixed
  101 + */
  102 + public function actionDelete($id)
  103 + {
  104 + $this->findModel($id)->delete();
  105 +
  106 + return $this->redirect(['index']);
  107 + }
  108 +
  109 + /**
  110 + * Finds the MarginsImporters model based on its primary key value.
  111 + * If the model is not found, a 404 HTTP exception will be thrown.
  112 + * @param integer $id
  113 + * @return MarginsImporters the loaded model
  114 + * @throws NotFoundHttpException if the model cannot be found
  115 + */
  116 + protected function findModel($id)
  117 + {
  118 + if (($model = MarginsImporters::findOne($id)) !== null) {
  119 + return $model;
  120 + } else {
  121 + throw new NotFoundHttpException('The requested page does not exist.');
  122 + }
  123 + }
  124 +}
... ...
backend/controllers/MarginsImportersImportController.php 0 → 100644
  1 +<?php
  2 +
  3 +namespace backend\controllers;
  4 +
  5 +use Yii;
  6 +use common\models\MarginsImportersImport;
  7 +use common\models\MarginsImportersImportSearch;
  8 +use yii\web\Controller;
  9 +use yii\web\NotFoundHttpException;
  10 +use yii\filters\VerbFilter;
  11 +
  12 +/**
  13 + * MarginsImportersImportController implements the CRUD actions for MarginsImportersImport model.
  14 + */
  15 +class MarginsImportersImportController extends Controller
  16 +{
  17 +
  18 +
  19 + public $layout = "/column";
  20 + public function behaviors()
  21 + {
  22 + return [
  23 + 'verbs' => [
  24 + 'class' => VerbFilter::className(),
  25 + 'actions' => [
  26 + 'delete' => ['post'],
  27 + ],
  28 + ],
  29 + ];
  30 + }
  31 +
  32 + /**
  33 + * Lists all MarginsImportersImport models.
  34 + * @return mixed
  35 + */
  36 + public function actionIndex()
  37 + {
  38 + $searchModel = new MarginsImportersImportSearch();
  39 + $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
  40 +
  41 + return $this->render('index', [
  42 + 'searchModel' => $searchModel,
  43 + 'dataProvider' => $dataProvider,
  44 + ]);
  45 + }
  46 +
  47 + /**
  48 + * Displays a single MarginsImportersImport model.
  49 + * @param integer $id
  50 + * @return mixed
  51 + */
  52 + public function actionView($id)
  53 + {
  54 + return $this->render('view', [
  55 + 'model' => $this->findModel($id),
  56 + ]);
  57 + }
  58 +
  59 + /**
  60 + * Creates a new MarginsImportersImport model.
  61 + * If creation is successful, the browser will be redirected to the 'view' page.
  62 + * @return mixed
  63 + */
  64 + public function actionCreate()
  65 + {
  66 + $model = new MarginsImportersImport();
  67 +
  68 + if ($model->load(Yii::$app->request->post()) && $model->save()) {
  69 + return $this->redirect(['view', 'id' => $model->id]);
  70 + } else {
  71 + return $this->render('create', [
  72 + 'model' => $model,
  73 + ]);
  74 + }
  75 + }
  76 +
  77 + /**
  78 + * Updates an existing MarginsImportersImport model.
  79 + * If update is successful, the browser will be redirected to the 'view' page.
  80 + * @param integer $id
  81 + * @return mixed
  82 + */
  83 + public function actionUpdate($id)
  84 + {
  85 + $model = $this->findModel($id);
  86 +
  87 + if ($model->load(Yii::$app->request->post()) && $model->save()) {
  88 + return $this->redirect(['view', 'id' => $model->id]);
  89 + } else {
  90 + return $this->render('update', [
  91 + 'model' => $model,
  92 + ]);
  93 + }
  94 + }
  95 +
  96 + /**
  97 + * Deletes an existing MarginsImportersImport model.
  98 + * If deletion is successful, the browser will be redirected to the 'index' page.
  99 + * @param integer $id
  100 + * @return mixed
  101 + */
  102 + public function actionDelete($id)
  103 + {
  104 + $this->findModel($id)->delete();
  105 +
  106 + return $this->redirect(['index']);
  107 + }
  108 +
  109 + /**
  110 + * Finds the MarginsImportersImport model based on its primary key value.
  111 + * If the model is not found, a 404 HTTP exception will be thrown.
  112 + * @param integer $id
  113 + * @return MarginsImportersImport the loaded model
  114 + * @throws NotFoundHttpException if the model cannot be found
  115 + */
  116 + protected function findModel($id)
  117 + {
  118 + if (($model = MarginsImportersImport::findOne($id)) !== null) {
  119 + return $model;
  120 + } else {
  121 + throw new NotFoundHttpException('The requested page does not exist.');
  122 + }
  123 + }
  124 +}
... ...
backend/models/Details_old.php 0 → 100644
  1 +<?php
  2 +/**
  3 + * Created by PhpStorm.
  4 + * User: Cibermag
  5 + * Date: 15.09.2015
  6 + * Time: 16:49
  7 + */
  8 +
  9 +namespace backend\models;
  10 +
  11 +use yii\base\Model;
  12 +use Yii;
  13 +
  14 +class Details_old extends Model{
  15 + const KEY_COLUMN = ['IMPORT_ID','BRAND','ARTICLE'];
  16 + const BATCH = 500;
  17 +
  18 + private $mode;
  19 +
  20 + // обязательные поля модели
  21 + public $BRAND;
  22 + public $ARTICLE;
  23 + public $PRICE;
  24 + public $BOX;
  25 +
  26 + function __construct($mode)
  27 + {
  28 + $this->mode = $mode;
  29 + }
  30 +
  31 + public function rules()
  32 + {
  33 + return [
  34 + [['BRAND','ARTICLE', 'PRICE', 'BOX'], 'required' ],
  35 + ];
  36 + }
  37 +
  38 + public function formName()
  39 + {
  40 + return 'Details';
  41 + }
  42 +
  43 +
  44 + public static function tableName()
  45 + {
  46 + return '{{%details}}';
  47 + }
  48 +
  49 +// //@todo вероятно этой функции не место здесь
  50 +// public function prepareData ( $data, $configuration )
  51 +// {
  52 +// if ( isset($configuration['importer_id']) && $configuration['importer_id']) {
  53 +// $data = \Yii::$app->multiparser->addColumn( $data, 'IMPORT_ID', $configuration['importer_id'] );
  54 +// }
  55 +// // \common\components\CustomVarDamp::dumpAndDie($data);
  56 +// return $data;
  57 +// }
  58 +
  59 + /**
  60 + * @param $data - двумерный массив данных для записи в таблицу details
  61 + * @throws \yii\db\Exception
  62 + * вставляет записи с апдейтом при дубляже ключей
  63 + */
  64 + public function save ($data)
  65 + {
  66 + $table_name = self::tableName();
  67 + $keys_arr = array_keys( $data[0] );
  68 + // найдем те поля которые не являются ключами. Их нужно будет при дубляже апдейтить
  69 + $fields_arr_to_update = array_diff( $keys_arr, $this::KEY_COLUMN );
  70 +
  71 + $query_update = ' on duplicate key update ';
  72 + foreach ($fields_arr_to_update as $field) {
  73 + $query_update .= "{$field} = values({$field}),";
  74 + }
  75 + // удалим последнюю запятую
  76 + $query_update = substr($query_update, 0, strlen($query_update) - 1);
  77 +
  78 + // запросы будем выполнять пакетами
  79 + // размер пакета установлен в константе
  80 + // разобъем массив на пакеты и будем их проходить
  81 + $data = array_chunk($data, $this::BATCH );
  82 + foreach( $data as $current_batch_array ){
  83 +
  84 + //воспользуемся пакетной вставкой от фреймворка, плюс сразу с экранированием и защитой от инъекций
  85 + $query_insert = Yii::$app->db->createCommand()->batchInsert($table_name, $keys_arr, $current_batch_array)->sql;
  86 + // добавим фрагмент с апдейтом при дубляже
  87 + $query = "{$query_insert} {$query_update}";
  88 + // \common\components\CustomVarDamp::dumpAndDie($query);
  89 + $res = Yii::$app->db->createCommand($query)->execute();
  90 +
  91 + }
  92 +
  93 + }
  94 +}
  95 +
  96 +//
  97 +
  98 +//$q = " INSERT INTO {$table_name} ({$keys_string}) VALUES (";
  99 +
  100 +//$q .= " on duplicate key update `FULL_ARTICLE` = values (`FULL_ARTICLE`),
  101 +// `PRICE` = values (`PRICE`),
  102 +// `DESCR` = values(`DESCR`),
  103 +// `BOX` = values(`BOX`),
  104 +// `ADD_BOX` = values(`ADD_BOX`),
  105 +// `GROUP` = values(`GROUP`);";
  106 +
  107 +// INSERT INTO table (a,b,c) VALUES (1,2,3),(4,5,6)
  108 +// ON DUPLICATE KEY UPDATE c=VALUES(a)+VALUES(b);
  109 +
  110 +
  111 +
  112 +//INSERT INTO `books` (`UserId`, `BookId`, `Count`) VALUES (13, 1001, 3)
  113 +//ON DUPLICATE KEY UPDATE `Count` = `Count` + VALUES(`Count`);
  114 +
  115 +//$values_string = '';
  116 +//$keys_arr = array_keys( $data[0] );
  117 +//$keys_string = implode( ',', $keys_arr);
  118 +//$table_name = self::tableName();
  119 +//$current_batch = 0;
  120 +//for ($i = $current_batch; $i < $this::BATCH AND $i < count($data); $i++) {
  121 +// $values_string .= '(' . implode( ',', $data[$i]) . '),';
  122 +//}
  123 +// for ($current_batch = $this::BATCH; $current_batch<count($data); $current_batch + $this::BATCH )
  124 +//// удалим последнюю запятую
  125 +//$values_string = substr($values_string, 0, strlen($values_string) - 1) . ' ';
  126 +////\common\components\CustomVarDamp::dumpAndDie($values_string);
  127 +//// $query = "INSERT INTO {$table_name}({$keys_string}) VALUES {$values_string}";
  128 +//// on duplicate key update `PRICE` = values (`PRICE`),`DESCR` = values(`DESCR`),`BOX` = values(`BOX`)";
  129 +//$query_insert = Yii::$app->db->createCommand()->batchInsert($table_name, $keys_arr, $data)->sql;
  130 +//$query = "{$query_insert} on duplicate key update `PRICE` = values (`PRICE`),`DESCR` = values(`DESCR`),`BOX` = values(`BOX`)";
  131 +//$res = Yii::$app->db->createCommand($query)->execute();
  132 +
  133 +
  134 +
  135 +// Yii::$app->db->createCommand()->batchInsert($table_name, $keys_arr, $data)->sql execute();
0 136 \ No newline at end of file
... ...
backend/models/Importer.php 0 → 100644
  1 +<?php
  2 +
  3 +namespace backend\models;
  4 +
  5 +use Yii;
  6 +use backend\components\base\BaseActiveRecord;
  7 +
  8 +/**
  9 + * This is the model class for table "{{%importer}}".
  10 + *
  11 + * @property integer $id
  12 + * @property string $code
  13 + * @property string $name
  14 + * @property string $name_price
  15 + * @property string $currency_id
  16 + * @property string $delivery
  17 + * @property string $email
  18 + * @property string $info
  19 + * @property integer $active
  20 + * @property integer $PARSER_IS_ACTIVE
  21 + * @property string $PARSER_COLUMN_COUNT
  22 + * @property string $PARSER_FIELD_BRAND
  23 + * @property string $PARSER_FIELD_ARTICLE
  24 + * @property integer $PARSER_FIELD_ARTICLE_PREFIX
  25 + * @property string $PARSER_FIELD_PRICE
  26 + * @property string $PARSER_FIELD_DESCR
  27 + * @property string $PARSER_FIELD_BOX
  28 + * @property string $PARSER_FIELD_ADD_BOX
  29 + * @property string $PARSER_FIELD_GROUP_RG
  30 + * @property string $PARSER_FIELD_SIGN
  31 + * @property double $PARSER_FIELD_MULTIPLIER
  32 + * @property string $price_date_update
  33 + */
  34 +class Importer extends BaseActiveRecord
  35 +{
  36 + /**
  37 + * @inheritdoc
  38 + */
  39 + public static function tableName()
  40 + {
  41 + return '{{%importer}}';
  42 + }
  43 +
  44 + /**
  45 + * @inheritdoc
  46 + */
  47 + public function rules()
  48 + {
  49 + return [
  50 + [['code', 'name', 'currency_id', 'delivery', 'price_date_update'], 'required'],
  51 + [['name_price', 'email', 'PARSER_FIELD_SIGN', 'info'], 'safe'],
  52 + [['currency_id', 'active', 'PARSER_IS_ACTIVE', 'PARSER_COLUMN_COUNT', 'PARSER_FIELD_BRAND', 'PARSER_FIELD_ARTICLE', 'PARSER_FIELD_ARTICLE_PREFIX', 'PARSER_FIELD_PRICE', 'PARSER_FIELD_DESCR', 'PARSER_FIELD_BOX', 'PARSER_FIELD_ADD_BOX', 'PARSER_FIELD_GROUP_RG'], 'integer'],
  53 + [['info'], 'string'],
  54 + [['PARSER_FIELD_MULTIPLIER'], 'number'],
  55 + [['code', 'name', 'name_price', 'delivery', 'email'], 'string', 'max' => 254],
  56 + [['PARSER_FIELD_SIGN'], 'string', 'max' => 1],
  57 + // [['price_date_update'], 'string', 'max' => 15],
  58 + [['code'], 'unique'],
  59 + [['name'], 'unique']
  60 + ];
  61 + }
  62 +
  63 + /**
  64 + * @inheritdoc
  65 + */
  66 + public function attributeLabels()
  67 + {
  68 + return [
  69 + 'id' => Yii::t('app', 'ID'),
  70 + 'code' => Yii::t('app', 'Code'),
  71 + 'name' => Yii::t('app', 'Name'),
  72 + 'name_price' => Yii::t('app', 'Name Price'),
  73 + 'currency_id' => Yii::t('app', 'Currency ID'),
  74 + 'delivery' => Yii::t('app', 'Delivery'),
  75 + 'email' => Yii::t('app', 'Email'),
  76 + 'info' => Yii::t('app', 'Info'),
  77 + 'active' => Yii::t('app', 'Active'),
  78 + 'PARSER_IS_ACTIVE' => Yii::t('app', 'Parser Is Active'),
  79 + 'PARSER_COLUMN_COUNT' => Yii::t('app', 'Parser Column Count'),
  80 + 'PARSER_FIELD_BRAND' => Yii::t('app', 'Parser Field Brand'),
  81 + 'PARSER_FIELD_ARTICLE' => Yii::t('app', 'Parser Field Article'),
  82 + 'PARSER_FIELD_ARTICLE_PREFIX' => Yii::t('app', 'Parser Field Article Prefix'),
  83 + 'PARSER_FIELD_PRICE' => Yii::t('app', 'Parser Field Price'),
  84 + 'PARSER_FIELD_DESCR' => Yii::t('app', 'Parser Field Descr'),
  85 + 'PARSER_FIELD_BOX' => Yii::t('app', 'Parser Field Box'),
  86 + 'PARSER_FIELD_ADD_BOX' => Yii::t('app', 'Parser Field Add Box'),
  87 + 'PARSER_FIELD_GROUP_RG' => Yii::t('app', 'Parser Field Group Rg'),
  88 + 'PARSER_FIELD_SIGN' => Yii::t('app', 'Parser Field Sign'),
  89 + 'PARSER_FIELD_MULTIPLIER' => Yii::t('app', 'Parser Field Multiplier'),
  90 + 'price_date_update' => Yii::t('app', 'Price Date Update'),
  91 + ];
  92 + }
  93 +
  94 +
  95 +
  96 +}
... ...
backend/models/ImporterFiles.php 0 → 100644
  1 +<?php
  2 +
  3 +namespace backend\models;
  4 +
  5 +use common\components\CustomVarDamp;
  6 +use Yii;
  7 +
  8 +/**
  9 + * This is the model class for table "{{%importer_files}}".
  10 + *
  11 + * @property integer $id
  12 + * @property string $importer_id
  13 + * @property string $upload_time
  14 + * @property string $time_start
  15 + * @property string $time_end
  16 + */
  17 +class ImporterFiles extends \yii\db\ActiveRecord
  18 +{
  19 + /**
  20 + * @inheritdoc
  21 + */
  22 + public static function tableName()
  23 + {
  24 + return '{{%importer_files}}';
  25 + }
  26 +
  27 + /**
  28 + * @inheritdoc
  29 + */
  30 + public function rules()
  31 + {
  32 + return [
  33 + [['importer_id'], 'required'],
  34 + [['importer_id'], 'integer'],
  35 + [['upload_time', 'time_start', 'time_end'], 'safe']
  36 + ];
  37 + }
  38 +
  39 + public function getImporter ()
  40 + {
  41 + return $this->hasOne(Importer::className(), ['id' => 'importer_id'])->one()->name;
  42 + }
  43 +
  44 + /**
  45 + * @inheritdoc
  46 + */
  47 + public function attributeLabels()
  48 + {
  49 + return [
  50 + 'id' => Yii::t('app', 'ID'),
  51 + 'importer_id' => Yii::t('app', 'Importer ID'),
  52 + 'upload_time' => Yii::t('app', 'Upload Time'),
  53 + 'time_start' => Yii::t('app', 'Time Start'),
  54 + 'time_end' => Yii::t('app', 'Time End'),
  55 + ];
  56 + }
  57 +}
... ...
backend/views/currency/_form.php 0 → 100644
  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\Currency */
  8 +/* @var $form yii\widgets\ActiveForm */
  9 +?>
  10 +
  11 +<div class="currency-form">
  12 +
  13 + <?php $form = ActiveForm::begin(); ?>
  14 +
  15 + <?= $form->field($model, 'name')->textInput(['maxlength' => true]) ?>
  16 +
  17 + <?= $form->field($model, 'rate')->textInput() ?>
  18 +
  19 + <?= $form->field($model, 'is_default')->textInput() ?>
  20 +
  21 + <?= $form->field($model, 'timestamp')->textInput() ?>
  22 +
  23 + <div class="form-group">
  24 + <?= Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
  25 + </div>
  26 +
  27 + <?php ActiveForm::end(); ?>
  28 +
  29 +</div>
... ...
backend/views/currency/_search.php 0 → 100644
  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\CurrencySearch */
  8 +/* @var $form yii\widgets\ActiveForm */
  9 +?>
  10 +
  11 +<div class="currency-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, 'name') ?>
  21 +
  22 + <?= $form->field($model, 'rate') ?>
  23 +
  24 + <?= $form->field($model, 'is_default') ?>
  25 +
  26 + <?= $form->field($model, 'timestamp') ?>
  27 +
  28 + <div class="form-group">
  29 + <?= Html::submitButton('Search', ['class' => 'btn btn-primary']) ?>
  30 + <?= Html::resetButton('Reset', ['class' => 'btn btn-default']) ?>
  31 + </div>
  32 +
  33 + <?php ActiveForm::end(); ?>
  34 +
  35 +</div>
... ...
backend/views/currency/create.php 0 → 100644
  1 +<?php
  2 +
  3 +use yii\helpers\Html;
  4 +
  5 +
  6 +/* @var $this yii\web\View */
  7 +/* @var $model common\models\Currency */
  8 +
  9 +$this->title = 'Create Currency';
  10 +$this->params['breadcrumbs'][] = ['label' => 'Currencies', 'url' => ['index']];
  11 +$this->params['breadcrumbs'][] = $this->title;
  12 +?>
  13 +<div class="currency-create">
  14 +
  15 + <h1><?= Html::encode($this->title) ?></h1>
  16 +
  17 + <?= $this->render('_form', [
  18 + 'model' => $model,
  19 + ]) ?>
  20 +
  21 +</div>
... ...
backend/views/currency/index.php 0 → 100644
  1 +<?php
  2 +
  3 +use yii\helpers\Html;
  4 +use yii\grid\GridView;
  5 +
  6 +/* @var $this yii\web\View */
  7 +/* @var $searchModel common\models\CurrencySearch */
  8 +/* @var $dataProvider yii\data\ActiveDataProvider */
  9 +
  10 +$this->title = 'Currencies';
  11 +$this->params['breadcrumbs'][] = $this->title;
  12 +?>
  13 +<div class="currency-index">
  14 +
  15 + <h1><?= Html::encode($this->title) ?></h1>
  16 + <?php // echo $this->render('_search', ['model' => $searchModel]); ?>
  17 +
  18 + <p>
  19 + <?= Html::a('Create Currency', ['create'], ['class' => 'btn btn-success']) ?>
  20 + </p>
  21 +
  22 + <?= GridView::widget([
  23 + 'dataProvider' => $dataProvider,
  24 + 'filterModel' => $searchModel,
  25 + 'columns' => [
  26 + ['class' => 'yii\grid\SerialColumn'],
  27 +
  28 + 'id',
  29 + 'name',
  30 + 'rate',
  31 + 'is_default',
  32 + 'timestamp',
  33 +
  34 + ['class' => 'yii\grid\ActionColumn'],
  35 + ],
  36 + ]); ?>
  37 +
  38 +</div>
... ...
backend/views/currency/update.php 0 → 100644
  1 +<?php
  2 +
  3 +use yii\helpers\Html;
  4 +
  5 +/* @var $this yii\web\View */
  6 +/* @var $model common\models\Currency */
  7 +
  8 +$this->title = 'Update Currency: ' . ' ' . $model->name;
  9 +$this->params['breadcrumbs'][] = ['label' => 'Currencies', 'url' => ['index']];
  10 +$this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->id]];
  11 +$this->params['breadcrumbs'][] = 'Update';
  12 +?>
  13 +<div class="currency-update">
  14 +
  15 + <h1><?= Html::encode($this->title) ?></h1>
  16 +
  17 + <?= $this->render('_form', [
  18 + 'model' => $model,
  19 + ]) ?>
  20 +
  21 +</div>
... ...
backend/views/currency/view.php 0 → 100644
  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\Currency */
  8 +
  9 +$this->title = $model->name;
  10 +$this->params['breadcrumbs'][] = ['label' => 'Currencies', 'url' => ['index']];
  11 +$this->params['breadcrumbs'][] = $this->title;
  12 +?>
  13 +<div class="currency-view">
  14 +
  15 + <h1><?= Html::encode($this->title) ?></h1>
  16 +
  17 + <p>
  18 + <?= Html::a('Update', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
  19 + <?= Html::a('Delete', ['delete', 'id' => $model->id], [
  20 + 'class' => 'btn btn-danger',
  21 + 'data' => [
  22 + 'confirm' => '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 + 'name',
  33 + 'rate',
  34 + 'is_default',
  35 + 'timestamp',
  36 + ],
  37 + ]) ?>
  38 +
  39 +</div>
... ...
backend/views/layouts/column.php
... ... @@ -88,7 +88,7 @@ $this-&gt;beginContent(&#39;@app/views/layouts/main.php&#39;);
88 88 Reviewers
89 89 <small><i class="fa fa-clock-o"></i> 2 days</small>
90 90 </h4>
91   - <p>Why not buy a new awesome theme?</p>
  91 + <p>Why not buy a new awesome theme?</p>
92 92 </a>
93 93 </li>
94 94 </ul>
... ... @@ -297,13 +297,27 @@ $this-&gt;beginContent(&#39;@app/views/layouts/main.php&#39;);
297 297 ],
298 298 ],
299 299 ['label' => 'Ценообразование', 'url' => ['#'], 'items' => [
300   - ['label' => 'Курс', 'url' => ['accounts/index']],
301   - ['label' => 'Типы цен', 'url' => ['importers/index']],
302   - ['label' => 'Коэфициенты на поставщиков', 'url' => ['user/index']],
303   - ['label' => 'Коэфициенты на импорт поставщиков', 'url' => ['user/index']],
304   - ['label' => 'Коэфициенты на группы RG', 'url' => ['user/index']],
  300 + ['label' => 'Курс', 'url' => ['currency/index']],
  301 + ['label' => 'Типы цен', 'url' => ['margins/index']],
  302 + ['label' => 'Коэфициенты на поставщиков', 'url' => ['margins-importers/index']],
  303 + ['label' => 'Коэфициенты на импорт поставщиков', 'url' => ['margins-importers-import/index']],
  304 + ['label' => 'Коэфициенты на группы RG', 'url' => ['margins-groups/index']],
305 305 ],
306 306 ],
  307 +// Справочник
  308 +//Замены брендов
  309 +//Карточки товаров
  310 +//Товары поставщиков
  311 +//Кроссы
  312 +//Бренды
  313 +//Марки авто
  314 +//Статусы заказов
  315 +//Типы доставок
  316 +//Категории товаров
  317 +//Vin коды
  318 +//Запросы по номеру
  319 +//Офисы
  320 +
307 321 ],
308 322 'submenuTemplate' => "\n<ul class='treeview-menu'>\n{items}\n</ul>\n",
309 323 ]);
... ...
backend/views/margins-groups/_form.php 0 → 100644
  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\MarginsGroups */
  8 +/* @var $form yii\widgets\ActiveForm */
  9 +?>
  10 +
  11 +<div class="margins-groups-form">
  12 +
  13 + <?php $form = ActiveForm::begin(); ?>
  14 +
  15 + <?= $form->field($model, 'importer_id')->textInput() ?>
  16 +
  17 + <?= $form->field($model, 'margin_id')->textInput() ?>
  18 +
  19 + <?= $form->field($model, 'group')->textInput(['maxlength' => true]) ?>
  20 +
  21 + <?= $form->field($model, 'koef')->textInput() ?>
  22 +
  23 + <?= $form->field($model, 'timestamp')->textInput() ?>
  24 +
  25 + <div class="form-group">
  26 + <?= Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
  27 + </div>
  28 +
  29 + <?php ActiveForm::end(); ?>
  30 +
  31 +</div>
... ...
backend/views/margins-groups/_search.php 0 → 100644
  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\MarginsGroupsSearch */
  8 +/* @var $form yii\widgets\ActiveForm */
  9 +?>
  10 +
  11 +<div class="margins-groups-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, 'importer_id') ?>
  21 +
  22 + <?= $form->field($model, 'margin_id') ?>
  23 +
  24 + <?= $form->field($model, 'group') ?>
  25 +
  26 + <?= $form->field($model, 'koef') ?>
  27 +
  28 + <?php // echo $form->field($model, 'timestamp') ?>
  29 +
  30 + <div class="form-group">
  31 + <?= Html::submitButton('Search', ['class' => 'btn btn-primary']) ?>
  32 + <?= Html::resetButton('Reset', ['class' => 'btn btn-default']) ?>
  33 + </div>
  34 +
  35 + <?php ActiveForm::end(); ?>
  36 +
  37 +</div>
... ...
backend/views/margins-groups/create.php 0 → 100644
  1 +<?php
  2 +
  3 +use yii\helpers\Html;
  4 +
  5 +
  6 +/* @var $this yii\web\View */
  7 +/* @var $model common\models\MarginsGroups */
  8 +
  9 +$this->title = 'Create Margins Groups';
  10 +$this->params['breadcrumbs'][] = ['label' => 'Margins Groups', 'url' => ['index']];
  11 +$this->params['breadcrumbs'][] = $this->title;
  12 +?>
  13 +<div class="margins-groups-create">
  14 +
  15 + <h1><?= Html::encode($this->title) ?></h1>
  16 +
  17 + <?= $this->render('_form', [
  18 + 'model' => $model,
  19 + ]) ?>
  20 +
  21 +</div>
... ...
backend/views/margins-groups/index.php 0 → 100644
  1 +<?php
  2 +
  3 +use yii\helpers\Html;
  4 +use yii\grid\GridView;
  5 +
  6 +/* @var $this yii\web\View */
  7 +/* @var $searchModel common\models\MarginsGroupsSearch */
  8 +/* @var $dataProvider yii\data\ActiveDataProvider */
  9 +
  10 +$this->title = 'Margins Groups';
  11 +$this->params['breadcrumbs'][] = $this->title;
  12 +?>
  13 +<div class="margins-groups-index">
  14 +
  15 + <h1><?= Html::encode($this->title) ?></h1>
  16 + <?php // echo $this->render('_search', ['model' => $searchModel]); ?>
  17 +
  18 + <p>
  19 + <?= Html::a('Create Margins Groups', ['create'], ['class' => 'btn btn-success']) ?>
  20 + </p>
  21 +
  22 + <?= GridView::widget([
  23 + 'dataProvider' => $dataProvider,
  24 + 'filterModel' => $searchModel,
  25 + 'columns' => [
  26 + ['class' => 'yii\grid\SerialColumn'],
  27 +
  28 + 'id',
  29 + 'importer_id',
  30 + 'margin_id',
  31 + 'group',
  32 + 'koef',
  33 + // 'timestamp',
  34 +
  35 + ['class' => 'yii\grid\ActionColumn'],
  36 + ],
  37 + ]); ?>
  38 +
  39 +</div>
... ...
backend/views/margins-groups/update.php 0 → 100644
  1 +<?php
  2 +
  3 +use yii\helpers\Html;
  4 +
  5 +/* @var $this yii\web\View */
  6 +/* @var $model common\models\MarginsGroups */
  7 +
  8 +$this->title = 'Update Margins Groups: ' . ' ' . $model->id;
  9 +$this->params['breadcrumbs'][] = ['label' => 'Margins Groups', 'url' => ['index']];
  10 +$this->params['breadcrumbs'][] = ['label' => $model->id, 'url' => ['view', 'id' => $model->id]];
  11 +$this->params['breadcrumbs'][] = 'Update';
  12 +?>
  13 +<div class="margins-groups-update">
  14 +
  15 + <h1><?= Html::encode($this->title) ?></h1>
  16 +
  17 + <?= $this->render('_form', [
  18 + 'model' => $model,
  19 + ]) ?>
  20 +
  21 +</div>
... ...
backend/views/margins-groups/view.php 0 → 100644
  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\MarginsGroups */
  8 +
  9 +$this->title = $model->id;
  10 +$this->params['breadcrumbs'][] = ['label' => 'Margins Groups', 'url' => ['index']];
  11 +$this->params['breadcrumbs'][] = $this->title;
  12 +?>
  13 +<div class="margins-groups-view">
  14 +
  15 + <h1><?= Html::encode($this->title) ?></h1>
  16 +
  17 + <p>
  18 + <?= Html::a('Update', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
  19 + <?= Html::a('Delete', ['delete', 'id' => $model->id], [
  20 + 'class' => 'btn btn-danger',
  21 + 'data' => [
  22 + 'confirm' => '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 + 'importer_id',
  33 + 'margin_id',
  34 + 'group',
  35 + 'koef',
  36 + 'timestamp',
  37 + ],
  38 + ]) ?>
  39 +
  40 +</div>
... ...
backend/views/margins-importers-import/_form.php 0 → 100644
  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\MarginsImportersImport */
  8 +/* @var $form yii\widgets\ActiveForm */
  9 +?>
  10 +
  11 +<div class="margins-importers-import-form">
  12 +
  13 + <?php $form = ActiveForm::begin(); ?>
  14 +
  15 + <?= $form->field($model, 'importer_id')->textInput() ?>
  16 +
  17 + <?= $form->field($model, 'margin_id')->textInput() ?>
  18 +
  19 + <?= $form->field($model, 'koef')->textInput() ?>
  20 +
  21 + <?= $form->field($model, 'finish')->textInput() ?>
  22 +
  23 + <div class="form-group">
  24 + <?= Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
  25 + </div>
  26 +
  27 + <?php ActiveForm::end(); ?>
  28 +
  29 +</div>
... ...
backend/views/margins-importers-import/_search.php 0 → 100644
  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\MarginsImportersImportSearch */
  8 +/* @var $form yii\widgets\ActiveForm */
  9 +?>
  10 +
  11 +<div class="margins-importers-import-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, 'importer_id') ?>
  21 +
  22 + <?= $form->field($model, 'margin_id') ?>
  23 +
  24 + <?= $form->field($model, 'koef') ?>
  25 +
  26 + <?= $form->field($model, 'finish') ?>
  27 +
  28 + <div class="form-group">
  29 + <?= Html::submitButton('Search', ['class' => 'btn btn-primary']) ?>
  30 + <?= Html::resetButton('Reset', ['class' => 'btn btn-default']) ?>
  31 + </div>
  32 +
  33 + <?php ActiveForm::end(); ?>
  34 +
  35 +</div>
... ...
backend/views/margins-importers-import/create.php 0 → 100644
  1 +<?php
  2 +
  3 +use yii\helpers\Html;
  4 +
  5 +
  6 +/* @var $this yii\web\View */
  7 +/* @var $model common\models\MarginsImportersImport */
  8 +
  9 +$this->title = 'Create Margins Importers Import';
  10 +$this->params['breadcrumbs'][] = ['label' => 'Margins Importers Imports', 'url' => ['index']];
  11 +$this->params['breadcrumbs'][] = $this->title;
  12 +?>
  13 +<div class="margins-importers-import-create">
  14 +
  15 + <h1><?= Html::encode($this->title) ?></h1>
  16 +
  17 + <?= $this->render('_form', [
  18 + 'model' => $model,
  19 + ]) ?>
  20 +
  21 +</div>
... ...
backend/views/margins-importers-import/index.php 0 → 100644
  1 +<?php
  2 +
  3 +use yii\helpers\Html;
  4 +use yii\grid\GridView;
  5 +
  6 +/* @var $this yii\web\View */
  7 +/* @var $searchModel common\models\MarginsImportersImportSearch */
  8 +/* @var $dataProvider yii\data\ActiveDataProvider */
  9 +
  10 +$this->title = 'Margins Importers Imports';
  11 +$this->params['breadcrumbs'][] = $this->title;
  12 +?>
  13 +<div class="margins-importers-import-index">
  14 +
  15 + <h1><?= Html::encode($this->title) ?></h1>
  16 + <?php // echo $this->render('_search', ['model' => $searchModel]); ?>
  17 +
  18 + <p>
  19 + <?= Html::a('Create Margins Importers Import', ['create'], ['class' => 'btn btn-success']) ?>
  20 + </p>
  21 +
  22 + <?= GridView::widget([
  23 + 'dataProvider' => $dataProvider,
  24 + 'filterModel' => $searchModel,
  25 + 'columns' => [
  26 + ['class' => 'yii\grid\SerialColumn'],
  27 +
  28 + 'id',
  29 + 'importer_id',
  30 + 'margin_id',
  31 + 'koef',
  32 + 'finish',
  33 +
  34 + ['class' => 'yii\grid\ActionColumn'],
  35 + ],
  36 + ]); ?>
  37 +
  38 +</div>
... ...
backend/views/margins-importers-import/update.php 0 → 100644
  1 +<?php
  2 +
  3 +use yii\helpers\Html;
  4 +
  5 +/* @var $this yii\web\View */
  6 +/* @var $model common\models\MarginsImportersImport */
  7 +
  8 +$this->title = 'Update Margins Importers Import: ' . ' ' . $model->id;
  9 +$this->params['breadcrumbs'][] = ['label' => 'Margins Importers Imports', 'url' => ['index']];
  10 +$this->params['breadcrumbs'][] = ['label' => $model->id, 'url' => ['view', 'id' => $model->id]];
  11 +$this->params['breadcrumbs'][] = 'Update';
  12 +?>
  13 +<div class="margins-importers-import-update">
  14 +
  15 + <h1><?= Html::encode($this->title) ?></h1>
  16 +
  17 + <?= $this->render('_form', [
  18 + 'model' => $model,
  19 + ]) ?>
  20 +
  21 +</div>
... ...
backend/views/margins-importers-import/view.php 0 → 100644
  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\MarginsImportersImport */
  8 +
  9 +$this->title = $model->id;
  10 +$this->params['breadcrumbs'][] = ['label' => 'Margins Importers Imports', 'url' => ['index']];
  11 +$this->params['breadcrumbs'][] = $this->title;
  12 +?>
  13 +<div class="margins-importers-import-view">
  14 +
  15 + <h1><?= Html::encode($this->title) ?></h1>
  16 +
  17 + <p>
  18 + <?= Html::a('Update', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
  19 + <?= Html::a('Delete', ['delete', 'id' => $model->id], [
  20 + 'class' => 'btn btn-danger',
  21 + 'data' => [
  22 + 'confirm' => '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 + 'importer_id',
  33 + 'margin_id',
  34 + 'koef',
  35 + 'finish',
  36 + ],
  37 + ]) ?>
  38 +
  39 +</div>
... ...
backend/views/margins-importers/_form.php 0 → 100644
  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\MarginsImporters */
  8 +/* @var $form yii\widgets\ActiveForm */
  9 +?>
  10 +
  11 +<div class="margins-importers-form">
  12 +
  13 + <?php $form = ActiveForm::begin(); ?>
  14 +
  15 + <?= $form->field($model, 'importer_id')->textInput() ?>
  16 +
  17 + <?= $form->field($model, 'margin_id')->textInput() ?>
  18 +
  19 + <?= $form->field($model, 'koef')->textInput() ?>
  20 +
  21 + <div class="form-group">
  22 + <?= Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
  23 + </div>
  24 +
  25 + <?php ActiveForm::end(); ?>
  26 +
  27 +</div>
... ...
backend/views/margins-importers/_search.php 0 → 100644
  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\MarginsImportersSearch */
  8 +/* @var $form yii\widgets\ActiveForm */
  9 +?>
  10 +
  11 +<div class="margins-importers-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, 'importer_id') ?>
  21 +
  22 + <?= $form->field($model, 'margin_id') ?>
  23 +
  24 + <?= $form->field($model, 'koef') ?>
  25 +
  26 + <div class="form-group">
  27 + <?= Html::submitButton('Search', ['class' => 'btn btn-primary']) ?>
  28 + <?= Html::resetButton('Reset', ['class' => 'btn btn-default']) ?>
  29 + </div>
  30 +
  31 + <?php ActiveForm::end(); ?>
  32 +
  33 +</div>
... ...
backend/views/margins-importers/create.php 0 → 100644
  1 +<?php
  2 +
  3 +use yii\helpers\Html;
  4 +
  5 +
  6 +/* @var $this yii\web\View */
  7 +/* @var $model common\models\MarginsImporters */
  8 +
  9 +$this->title = 'Create Margins Importers';
  10 +$this->params['breadcrumbs'][] = ['label' => 'Margins Importers', 'url' => ['index']];
  11 +$this->params['breadcrumbs'][] = $this->title;
  12 +?>
  13 +<div class="margins-importers-create">
  14 +
  15 + <h1><?= Html::encode($this->title) ?></h1>
  16 +
  17 + <?= $this->render('_form', [
  18 + 'model' => $model,
  19 + ]) ?>
  20 +
  21 +</div>
... ...
backend/views/margins-importers/index.php 0 → 100644
  1 +<?php
  2 +
  3 +use yii\helpers\Html;
  4 +use yii\grid\GridView;
  5 +
  6 +/* @var $this yii\web\View */
  7 +/* @var $searchModel common\models\MarginsImportersSearch */
  8 +/* @var $dataProvider yii\data\ActiveDataProvider */
  9 +
  10 +$this->title = 'Margins Importers';
  11 +$this->params['breadcrumbs'][] = $this->title;
  12 +?>
  13 +<div class="margins-importers-index">
  14 +
  15 + <h1><?= Html::encode($this->title) ?></h1>
  16 + <?php // echo $this->render('_search', ['model' => $searchModel]); ?>
  17 +
  18 + <p>
  19 + <?= Html::a('Create Margins Importers', ['create'], ['class' => 'btn btn-success']) ?>
  20 + </p>
  21 +
  22 + <?= GridView::widget([
  23 + 'dataProvider' => $dataProvider,
  24 + 'filterModel' => $searchModel,
  25 + 'columns' => [
  26 + ['class' => 'yii\grid\SerialColumn'],
  27 +
  28 + 'id',
  29 + 'importer_id',
  30 + 'margin_id',
  31 + 'koef',
  32 +
  33 + ['class' => 'yii\grid\ActionColumn'],
  34 + ],
  35 + ]); ?>
  36 +
  37 +</div>
... ...
backend/views/margins-importers/update.php 0 → 100644
  1 +<?php
  2 +
  3 +use yii\helpers\Html;
  4 +
  5 +/* @var $this yii\web\View */
  6 +/* @var $model common\models\MarginsImporters */
  7 +
  8 +$this->title = 'Update Margins Importers: ' . ' ' . $model->id;
  9 +$this->params['breadcrumbs'][] = ['label' => 'Margins Importers', 'url' => ['index']];
  10 +$this->params['breadcrumbs'][] = ['label' => $model->id, 'url' => ['view', 'id' => $model->id]];
  11 +$this->params['breadcrumbs'][] = 'Update';
  12 +?>
  13 +<div class="margins-importers-update">
  14 +
  15 + <h1><?= Html::encode($this->title) ?></h1>
  16 +
  17 + <?= $this->render('_form', [
  18 + 'model' => $model,
  19 + ]) ?>
  20 +
  21 +</div>
... ...
backend/views/margins-importers/view.php 0 → 100644
  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\MarginsImporters */
  8 +
  9 +$this->title = $model->id;
  10 +$this->params['breadcrumbs'][] = ['label' => 'Margins Importers', 'url' => ['index']];
  11 +$this->params['breadcrumbs'][] = $this->title;
  12 +?>
  13 +<div class="margins-importers-view">
  14 +
  15 + <h1><?= Html::encode($this->title) ?></h1>
  16 +
  17 + <p>
  18 + <?= Html::a('Update', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
  19 + <?= Html::a('Delete', ['delete', 'id' => $model->id], [
  20 + 'class' => 'btn btn-danger',
  21 + 'data' => [
  22 + 'confirm' => '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 + 'importer_id',
  33 + 'margin_id',
  34 + 'koef',
  35 + ],
  36 + ]) ?>
  37 +
  38 +</div>
... ...
backend/views/margins/_form.php 0 → 100644
  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\Margins */
  8 +/* @var $form yii\widgets\ActiveForm */
  9 +?>
  10 +
  11 +<div class="margins-form">
  12 +
  13 + <?php $form = ActiveForm::begin(); ?>
  14 +
  15 + <?= $form->field($model, 'name')->textInput(['maxlength' => true]) ?>
  16 +
  17 + <?= $form->field($model, 'koef')->textInput() ?>
  18 +
  19 + <div class="form-group">
  20 + <?= Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
  21 + </div>
  22 +
  23 + <?php ActiveForm::end(); ?>
  24 +
  25 +</div>
... ...
backend/views/margins/_search.php 0 → 100644
  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\MarginsSearch */
  8 +/* @var $form yii\widgets\ActiveForm */
  9 +?>
  10 +
  11 +<div class="margins-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, 'name') ?>
  21 +
  22 + <?= $form->field($model, 'koef') ?>
  23 +
  24 + <div class="form-group">
  25 + <?= Html::submitButton('Search', ['class' => 'btn btn-primary']) ?>
  26 + <?= Html::resetButton('Reset', ['class' => 'btn btn-default']) ?>
  27 + </div>
  28 +
  29 + <?php ActiveForm::end(); ?>
  30 +
  31 +</div>
... ...
backend/views/margins/create.php 0 → 100644
  1 +<?php
  2 +
  3 +use yii\helpers\Html;
  4 +
  5 +
  6 +/* @var $this yii\web\View */
  7 +/* @var $model common\models\Margins */
  8 +
  9 +$this->title = 'Create Margins';
  10 +$this->params['breadcrumbs'][] = ['label' => 'Margins', 'url' => ['index']];
  11 +$this->params['breadcrumbs'][] = $this->title;
  12 +?>
  13 +<div class="margins-create">
  14 +
  15 + <h1><?= Html::encode($this->title) ?></h1>
  16 +
  17 + <?= $this->render('_form', [
  18 + 'model' => $model,
  19 + ]) ?>
  20 +
  21 +</div>
... ...
backend/views/margins/index.php 0 → 100644
  1 +<?php
  2 +
  3 +use yii\helpers\Html;
  4 +use yii\grid\GridView;
  5 +
  6 +/* @var $this yii\web\View */
  7 +/* @var $searchModel common\models\MarginsSearch */
  8 +/* @var $dataProvider yii\data\ActiveDataProvider */
  9 +
  10 +$this->title = 'Margins';
  11 +$this->params['breadcrumbs'][] = $this->title;
  12 +?>
  13 +<div class="margins-index">
  14 +
  15 + <h1><?= Html::encode($this->title) ?></h1>
  16 + <?php // echo $this->render('_search', ['model' => $searchModel]); ?>
  17 +
  18 + <p>
  19 + <?= Html::a('Create Margins', ['create'], ['class' => 'btn btn-success']) ?>
  20 + </p>
  21 +
  22 + <?= GridView::widget([
  23 + 'dataProvider' => $dataProvider,
  24 + 'filterModel' => $searchModel,
  25 + 'columns' => [
  26 + ['class' => 'yii\grid\SerialColumn'],
  27 +
  28 + 'id',
  29 + 'name',
  30 + 'koef',
  31 +
  32 + ['class' => 'yii\grid\ActionColumn'],
  33 + ],
  34 + ]); ?>
  35 +
  36 +</div>
... ...
backend/views/margins/update.php 0 → 100644
  1 +<?php
  2 +
  3 +use yii\helpers\Html;
  4 +
  5 +/* @var $this yii\web\View */
  6 +/* @var $model common\models\Margins */
  7 +
  8 +$this->title = 'Update Margins: ' . ' ' . $model->name;
  9 +$this->params['breadcrumbs'][] = ['label' => 'Margins', 'url' => ['index']];
  10 +$this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->id]];
  11 +$this->params['breadcrumbs'][] = 'Update';
  12 +?>
  13 +<div class="margins-update">
  14 +
  15 + <h1><?= Html::encode($this->title) ?></h1>
  16 +
  17 + <?= $this->render('_form', [
  18 + 'model' => $model,
  19 + ]) ?>
  20 +
  21 +</div>
... ...
backend/views/margins/view.php 0 → 100644
  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\Margins */
  8 +
  9 +$this->title = $model->name;
  10 +$this->params['breadcrumbs'][] = ['label' => 'Margins', 'url' => ['index']];
  11 +$this->params['breadcrumbs'][] = $this->title;
  12 +?>
  13 +<div class="margins-view">
  14 +
  15 + <h1><?= Html::encode($this->title) ?></h1>
  16 +
  17 + <p>
  18 + <?= Html::a('Update', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
  19 + <?= Html::a('Delete', ['delete', 'id' => $model->id], [
  20 + 'class' => 'btn btn-danger',
  21 + 'data' => [
  22 + 'confirm' => '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 + 'name',
  33 + 'koef',
  34 + ],
  35 + ]) ?>
  36 +
  37 +</div>
... ...
common/models/Currency.php 0 → 100644
  1 +<?php
  2 +
  3 +namespace common\models;
  4 +
  5 +use Yii;
  6 +
  7 +/**
  8 + * This is the model class for table "w_currency".
  9 + *
  10 + * @property integer $id
  11 + * @property string $name
  12 + * @property double $rate
  13 + * @property integer $is_default
  14 + * @property string $timestamp
  15 + */
  16 +class Currency extends \yii\db\ActiveRecord
  17 +{
  18 + /**
  19 + * @inheritdoc
  20 + */
  21 + public static function tableName()
  22 + {
  23 + return 'w_currency';
  24 + }
  25 +
  26 + /**
  27 + * @inheritdoc
  28 + */
  29 + public function rules()
  30 + {
  31 + return [
  32 + [['name', 'rate'], 'required'],
  33 + [['rate'], 'number'],
  34 + [['is_default'], 'integer'],
  35 + [['timestamp'], 'safe'],
  36 + [['name'], 'string', 'max' => 50],
  37 + [['name'], 'unique'],
  38 + [['is_default'], 'unique']
  39 + ];
  40 + }
  41 +
  42 + /**
  43 + * @inheritdoc
  44 + */
  45 + public function attributeLabels()
  46 + {
  47 + return [
  48 + 'id' => 'ID',
  49 + 'name' => 'Name',
  50 + 'rate' => 'Rate',
  51 + 'is_default' => 'Is Default',
  52 + 'timestamp' => 'Timestamp',
  53 + ];
  54 + }
  55 +}
... ...
common/models/CurrencySearch.php 0 → 100644
  1 +<?php
  2 +
  3 +namespace common\models;
  4 +
  5 +use Yii;
  6 +use yii\base\Model;
  7 +use yii\data\ActiveDataProvider;
  8 +use common\models\Currency;
  9 +
  10 +/**
  11 + * CurrencySearch represents the model behind the search form about `common\models\Currency`.
  12 + */
  13 +class CurrencySearch extends Currency
  14 +{
  15 + /**
  16 + * @inheritdoc
  17 + */
  18 + public function rules()
  19 + {
  20 + return [
  21 + [['id', 'is_default'], 'integer'],
  22 + [['name', 'timestamp'], 'safe'],
  23 + [['rate'], 'number'],
  24 + ];
  25 + }
  26 +
  27 + /**
  28 + * @inheritdoc
  29 + */
  30 + public function scenarios()
  31 + {
  32 + // bypass scenarios() implementation in the parent class
  33 + return Model::scenarios();
  34 + }
  35 +
  36 + /**
  37 + * Creates data provider instance with search query applied
  38 + *
  39 + * @param array $params
  40 + *
  41 + * @return ActiveDataProvider
  42 + */
  43 + public function search($params)
  44 + {
  45 + $query = Currency::find();
  46 +
  47 + $dataProvider = new ActiveDataProvider([
  48 + 'query' => $query,
  49 + ]);
  50 +
  51 + $this->load($params);
  52 +
  53 + if (!$this->validate()) {
  54 + // uncomment the following line if you do not want to return any records when validation fails
  55 + // $query->where('0=1');
  56 + return $dataProvider;
  57 + }
  58 +
  59 + $query->andFilterWhere([
  60 + 'id' => $this->id,
  61 + 'rate' => $this->rate,
  62 + 'is_default' => $this->is_default,
  63 + 'timestamp' => $this->timestamp,
  64 + ]);
  65 +
  66 + $query->andFilterWhere(['like', 'name', $this->name]);
  67 +
  68 + return $dataProvider;
  69 + }
  70 +}
... ...
common/models/Margins.php 0 → 100644
  1 +<?php
  2 +
  3 +namespace common\models;
  4 +
  5 +use Yii;
  6 +
  7 +/**
  8 + * This is the model class for table "w_margins".
  9 + *
  10 + * @property integer $id
  11 + * @property string $name
  12 + * @property double $koef
  13 + */
  14 +class Margins extends \yii\db\ActiveRecord
  15 +{
  16 + /**
  17 + * @inheritdoc
  18 + */
  19 + public static function tableName()
  20 + {
  21 + return 'w_margins';
  22 + }
  23 +
  24 + /**
  25 + * @inheritdoc
  26 + */
  27 + public function rules()
  28 + {
  29 + return [
  30 + [['name', 'koef'], 'required'],
  31 + [['koef'], 'number'],
  32 + [['name'], 'string', 'max' => 100],
  33 + [['name'], 'unique']
  34 + ];
  35 + }
  36 +
  37 + /**
  38 + * @inheritdoc
  39 + */
  40 + public function attributeLabels()
  41 + {
  42 + return [
  43 + 'id' => 'ID',
  44 + 'name' => 'Name',
  45 + 'koef' => 'Koef',
  46 + ];
  47 + }
  48 +}
... ...
common/models/MarginsGroups.php 0 → 100644
  1 +<?php
  2 +
  3 +namespace common\models;
  4 +
  5 +use Yii;
  6 +
  7 +/**
  8 + * This is the model class for table "w_margins_groups".
  9 + *
  10 + * @property integer $id
  11 + * @property integer $importer_id
  12 + * @property integer $margin_id
  13 + * @property string $group
  14 + * @property double $koef
  15 + * @property string $timestamp
  16 + */
  17 +class MarginsGroups extends \yii\db\ActiveRecord
  18 +{
  19 + /**
  20 + * @inheritdoc
  21 + */
  22 + public static function tableName()
  23 + {
  24 + return 'w_margins_groups';
  25 + }
  26 +
  27 + /**
  28 + * @inheritdoc
  29 + */
  30 + public function rules()
  31 + {
  32 + return [
  33 + [['importer_id', 'margin_id', 'group', 'koef'], 'required'],
  34 + [['importer_id', 'margin_id'], 'integer'],
  35 + [['koef'], 'number'],
  36 + [['timestamp'], 'safe'],
  37 + [['group'], 'string', 'max' => 200],
  38 + [['importer_id', 'margin_id', 'group'], 'unique', 'targetAttribute' => ['importer_id', 'margin_id', 'group'], 'message' => 'The combination of Importer ID, Margin ID and Group has already been taken.']
  39 + ];
  40 + }
  41 +
  42 + /**
  43 + * @inheritdoc
  44 + */
  45 + public function attributeLabels()
  46 + {
  47 + return [
  48 + 'id' => 'ID',
  49 + 'importer_id' => 'Importer ID',
  50 + 'margin_id' => 'Margin ID',
  51 + 'group' => 'Group',
  52 + 'koef' => 'Koef',
  53 + 'timestamp' => 'Timestamp',
  54 + ];
  55 + }
  56 +}
... ...
common/models/MarginsGroupsSearch.php 0 → 100644
  1 +<?php
  2 +
  3 +namespace common\models;
  4 +
  5 +use Yii;
  6 +use yii\base\Model;
  7 +use yii\data\ActiveDataProvider;
  8 +use common\models\MarginsGroups;
  9 +
  10 +/**
  11 + * MarginsGroupsSearch represents the model behind the search form about `common\models\MarginsGroups`.
  12 + */
  13 +class MarginsGroupsSearch extends MarginsGroups
  14 +{
  15 + /**
  16 + * @inheritdoc
  17 + */
  18 + public function rules()
  19 + {
  20 + return [
  21 + [['id', 'importer_id', 'margin_id'], 'integer'],
  22 + [['group', 'timestamp'], 'safe'],
  23 + [['koef'], 'number'],
  24 + ];
  25 + }
  26 +
  27 + /**
  28 + * @inheritdoc
  29 + */
  30 + public function scenarios()
  31 + {
  32 + // bypass scenarios() implementation in the parent class
  33 + return Model::scenarios();
  34 + }
  35 +
  36 + /**
  37 + * Creates data provider instance with search query applied
  38 + *
  39 + * @param array $params
  40 + *
  41 + * @return ActiveDataProvider
  42 + */
  43 + public function search($params)
  44 + {
  45 + $query = MarginsGroups::find();
  46 +
  47 + $dataProvider = new ActiveDataProvider([
  48 + 'query' => $query,
  49 + ]);
  50 +
  51 + $this->load($params);
  52 +
  53 + if (!$this->validate()) {
  54 + // uncomment the following line if you do not want to return any records when validation fails
  55 + // $query->where('0=1');
  56 + return $dataProvider;
  57 + }
  58 +
  59 + $query->andFilterWhere([
  60 + 'id' => $this->id,
  61 + 'importer_id' => $this->importer_id,
  62 + 'margin_id' => $this->margin_id,
  63 + 'koef' => $this->koef,
  64 + 'timestamp' => $this->timestamp,
  65 + ]);
  66 +
  67 + $query->andFilterWhere(['like', 'group', $this->group]);
  68 +
  69 + return $dataProvider;
  70 + }
  71 +}
... ...
common/models/MarginsSearch.php 0 → 100644
  1 +<?php
  2 +
  3 +namespace common\models;
  4 +
  5 +use Yii;
  6 +use yii\base\Model;
  7 +use yii\data\ActiveDataProvider;
  8 +use common\models\Margins;
  9 +
  10 +/**
  11 + * MarginsSearch represents the model behind the search form about `common\models\Margins`.
  12 + */
  13 +class MarginsSearch extends Margins
  14 +{
  15 + /**
  16 + * @inheritdoc
  17 + */
  18 + public function rules()
  19 + {
  20 + return [
  21 + [['id'], 'integer'],
  22 + [['name'], 'safe'],
  23 + [['koef'], 'number'],
  24 + ];
  25 + }
  26 +
  27 + /**
  28 + * @inheritdoc
  29 + */
  30 + public function scenarios()
  31 + {
  32 + // bypass scenarios() implementation in the parent class
  33 + return Model::scenarios();
  34 + }
  35 +
  36 + /**
  37 + * Creates data provider instance with search query applied
  38 + *
  39 + * @param array $params
  40 + *
  41 + * @return ActiveDataProvider
  42 + */
  43 + public function search($params)
  44 + {
  45 + $query = Margins::find();
  46 +
  47 + $dataProvider = new ActiveDataProvider([
  48 + 'query' => $query,
  49 + ]);
  50 +
  51 + $this->load($params);
  52 +
  53 + if (!$this->validate()) {
  54 + // uncomment the following line if you do not want to return any records when validation fails
  55 + // $query->where('0=1');
  56 + return $dataProvider;
  57 + }
  58 +
  59 + $query->andFilterWhere([
  60 + 'id' => $this->id,
  61 + 'koef' => $this->koef,
  62 + ]);
  63 +
  64 + $query->andFilterWhere(['like', 'name', $this->name]);
  65 +
  66 + return $dataProvider;
  67 + }
  68 +}
... ...
composer.json
... ... @@ -18,7 +18,8 @@
18 18 "yiisoft/yii2": ">=2.0.6",
19 19 "yiisoft/yii2-bootstrap": "*",
20 20 "yiisoft/yii2-swiftmailer": "*",
21   - "yiisoft/yii2-imagine": "*"
  21 + "yiisoft/yii2-imagine": "*",
  22 + "2amigos/yii2-date-picker-widget": "~1.0"
22 23 },
23 24 "require-dev": {
24 25 "yiisoft/yii2-codeception": "*",
... ...
composer.lock
... ... @@ -4,9 +4,70 @@
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": "54588d810c5a77b1e177db18875540d1",
  7 + "hash": "b50ff742692adc607b39491ed7ed3dd6",
8 8 "packages": [
9 9 {
  10 + "name": "2amigos/yii2-date-picker-widget",
  11 + "version": "1.0.5",
  12 + "source": {
  13 + "type": "git",
  14 + "url": "https://github.com/2amigos/yii2-date-picker-widget.git",
  15 + "reference": "89cd0d7f00785b608b4a9670016f2795f2e3984d"
  16 + },
  17 + "dist": {
  18 + "type": "zip",
  19 + "url": "https://api.github.com/repos/2amigos/yii2-date-picker-widget/zipball/89cd0d7f00785b608b4a9670016f2795f2e3984d",
  20 + "reference": "89cd0d7f00785b608b4a9670016f2795f2e3984d",
  21 + "shasum": ""
  22 + },
  23 + "require": {
  24 + "bower-asset/bootstrap-datepicker": "1.4.0",
  25 + "yiisoft/yii2": "~2.0.0",
  26 + "yiisoft/yii2-bootstrap": "~2.0.3"
  27 + },
  28 + "require-dev": {
  29 + "phpunit/phpunit": "4.*"
  30 + },
  31 + "type": "yii2-extension",
  32 + "extra": {
  33 + "branch-alias": {
  34 + "dev-master": "1.0-dev"
  35 + },
  36 + "asset-installer-paths": {
  37 + "bower-asset-library": "vendor/bower"
  38 + }
  39 + },
  40 + "autoload": {
  41 + "psr-4": {
  42 + "dosamigos\\datepicker\\": "src"
  43 + }
  44 + },
  45 + "notification-url": "https://packagist.org/downloads/",
  46 + "license": [
  47 + "BSD-3-Clause"
  48 + ],
  49 + "authors": [
  50 + {
  51 + "name": "2amigOS! Consulting Group",
  52 + "email": "hola@2amigos.us",
  53 + "homepage": "http://2amigos.us",
  54 + "role": "Developer"
  55 + }
  56 + ],
  57 + "description": "Bootstrap DatePicker widget for Yii2.",
  58 + "homepage": "http://yiiwheels.com/extension/bootstrap-datepicker",
  59 + "keywords": [
  60 + "2amigos",
  61 + "datepicker",
  62 + "extension",
  63 + "widget",
  64 + "yii",
  65 + "yii 2",
  66 + "yii2"
  67 + ],
  68 + "time": "2015-04-02 11:48:05"
  69 + },
  70 + {
10 71 "name": "bower-asset/bootstrap",
11 72 "version": "v3.3.5",
12 73 "source": {
... ... @@ -56,6 +117,37 @@
56 117 ]
57 118 },
58 119 {
  120 + "name": "bower-asset/bootstrap-datepicker",
  121 + "version": "v1.4.0",
  122 + "source": {
  123 + "type": "git",
  124 + "url": "https://github.com/eternicode/bootstrap-datepicker.git",
  125 + "reference": "e7ca6bb94dc483817f2ff10fc2b723b2b935e016"
  126 + },
  127 + "dist": {
  128 + "type": "zip",
  129 + "url": "https://api.github.com/repos/eternicode/bootstrap-datepicker/zipball/e7ca6bb94dc483817f2ff10fc2b723b2b935e016",
  130 + "reference": "e7ca6bb94dc483817f2ff10fc2b723b2b935e016",
  131 + "shasum": ""
  132 + },
  133 + "require": {
  134 + "bower-asset/bootstrap": ">=2.0.4,<4.0",
  135 + "bower-asset/jquery": ">=1.7.1"
  136 + },
  137 + "type": "bower-asset-library",
  138 + "extra": {
  139 + "bower-asset-main": [
  140 + "dist/css/bootstrap-datepicker.css",
  141 + "dist/css/bootstrap-datepicker3.css",
  142 + "js/bootstrap-datepicker.js"
  143 + ],
  144 + "bower-asset-ignore": []
  145 + },
  146 + "license": [
  147 + "Apache-2.0"
  148 + ]
  149 + },
  150 + {
59 151 "name": "bower-asset/jquery",
60 152 "version": "2.1.4",
61 153 "source": {
... ...
framework/css/GridField_print.css 0 → 100644
  1 +h3 { font-family: Arial, sans-serif; }
  2 +
  3 +table { border-collapse: collapse; font-family: Arial, sans-serif; color: #333; font-size: 12pt; }
  4 +table th { border-bottom: 2px solid #333; padding: 5px 10px; font-weight: bold; text-align: left; }
  5 +table th:first-child { padding-left: 0px; }
  6 +table td { border-top: 1px solid #aaa; border-bottom: 1px solid #aaa; text-align: left; padding: 5px 10px; }
  7 +table td:first-child { padding-left: 0px; }
... ...
frontend/assets/InternalAsset.php
... ... @@ -23,6 +23,7 @@ class InternalAsset extends AssetBundle
23 23 'css/style/selectize.css',
24 24 'css/perfect-scrollbar/css/perfect-scrollbar.css',
25 25 'js/TrackBar/trackbar.css',
  26 +
26 27 ];
27 28 public $js = [
28 29 'js/modal/watch.js',
... ... @@ -33,6 +34,7 @@ class InternalAsset extends AssetBundle
33 34 'js/select.js',
34 35 'js/validation/dist/jquery.validate.js',
35 36 'js/TrackBar/trackbar.js',
  37 +
36 38 ];
37 39 public $depends = [
38 40 'yii\web\YiiAsset',
... ...
frontend/views/site/cabinet.php
... ... @@ -3,6 +3,8 @@
3 3 $this->registerCssFile('/css/about_company.css');
4 4 $this->registerCssFile('/css/style/notepad.css');
5 5 $this->registerCssFile('/css/style/my_profile.css');
  6 +$this->registerCssFile('//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css');
  7 +$this->registerJsFile('//code.jquery.com/ui/1.11.4/jquery-ui.js');
6 8  
7 9 $this->params['breadcrumbs'][] = $this->title;
8 10 ?>
... ... @@ -330,3 +332,59 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $this-&gt;title;
330 332 </div>
331 333  
332 334  
  335 +
  336 +<script>
  337 + $(function() {
  338 + $( "#datepicker" ).datepicker();
  339 + $.datepicker.regional['ru'] = {
  340 + closeText: 'Закрыть',
  341 + prevText: '&#x3c;Пред',
  342 + nextText: 'След&#x3e;',
  343 + currentText: 'Сегодня',
  344 + monthNames: ['Январь','Февраль','Март','Апрель','Май','Июнь',
  345 + 'Июль','Август','Сентябрь','Октябрь','Ноябрь','Декабрь'],
  346 + monthNamesShort: ['Янв','Фев','Мар','Апр','Май','Июн',
  347 + 'Июл','Авг','Сен','Окт','Ноя','Дек'],
  348 + dayNames: ['воскресенье','понедельник','вторник','среда','четверг','пятница','суббота'],
  349 + dayNamesShort: ['вск','пнд','втр','срд','чтв','птн','сбт'],
  350 + dayNamesMin: ['Вс','Пн','Вт','Ср','Чт','Пт','Сб'],
  351 + dateFormat: 'dd.mm.yy',
  352 + firstDay: 1,
  353 + isRTL: false
  354 + };
  355 + $.datepicker.setDefaults($.datepicker.regional['ru']);
  356 +
  357 + $( "#datepicker" ).datepicker({
  358 + dateFormat: "dd-mm-yy"
  359 + });
  360 + });
  361 +
  362 +</script>
  363 +
  364 +<script>
  365 + $(function() {
  366 + $( "#datepicker1" ).datepicker();
  367 + $.datepicker.regional['ru'] = {
  368 + closeText: 'Закрыть',
  369 + prevText: '&#x3c;Пред',
  370 + nextText: 'След&#x3e;',
  371 + currentText: 'Сегодня',
  372 + monthNames: ['Январь','Февраль','Март','Апрель','Май','Июнь',
  373 + 'Июль','Август','Сентябрь','Октябрь','Ноябрь','Декабрь'],
  374 + monthNamesShort: ['Янв','Фев','Мар','Апр','Май','Июн',
  375 + 'Июл','Авг','Сен','Окт','Ноя','Дек'],
  376 + dayNames: ['воскресенье','понедельник','вторник','среда','четверг','пятница','суббота'],
  377 + dayNamesShort: ['вск','пнд','втр','срд','чтв','птн','сбт'],
  378 + dayNamesMin: ['Вс','Пн','Вт','Ср','Чт','Пт','Сб'],
  379 + dateFormat: 'dd.mm.yy',
  380 + firstDay: 1,
  381 + isRTL: false
  382 + };
  383 + $.datepicker.setDefaults($.datepicker.regional['ru']);
  384 +
  385 + $( "#datepicker1" ).datepicker({
  386 + dateFormat: "dd-mm-yy"
  387 + });
  388 + });
  389 +
  390 +</script>
333 391 \ No newline at end of file
... ...
storage/1d1ddd6734c119028f12799e154b3086/200x200.png 0 → 100644

62.3 KB

storage/1d1ddd6734c119028f12799e154b3086/original.png 0 → 100644

46.9 KB

storage/3182b2b494b1d15298baf57954c80fb0/200x200.jpg 0 → 100644

4.33 KB

storage/4929fc8db8a21618cafbaf3cf97e0558/200x200.jpg 0 → 100644

4.27 KB

storage/4929fc8db8a21618cafbaf3cf97e0558/x.jpg 0 → 100644

244 KB

storage/75426b23fbcf471ae0f5059f9ab3d824/200x200.png 0 → 100644

83.9 KB

storage/75426b23fbcf471ae0f5059f9ab3d824/original.png 0 → 100644

86.4 KB

storage/a62948dc31d3269c447bd64fc853ae3a/200x200.jpg 0 → 100644

213 KB

storage/a62948dc31d3269c447bd64fc853ae3a/original.jpg 0 → 100644

112 KB

storage/a62948dc31d3269c447bd64fc853ae3a/x.jpg 0 → 100644

112 KB

storage/a99080da55681122aa044b141e5d8d96/200x200.png 0 → 100644

73.3 KB

storage/a99080da55681122aa044b141e5d8d96/original.png 0 → 100644

58.9 KB

storage/af5cc0955fcf2bd15a56efa582ece550/200x200.jpg 0 → 100644

90.2 KB

storage/af5cc0955fcf2bd15a56efa582ece550/original.jpg 0 → 100644

75.5 KB

storage/b6456643a4e6e41ae8aee94327848b12/200x200.png 0 → 100644

80.9 KB

storage/b6456643a4e6e41ae8aee94327848b12/original.png 0 → 100644

404 KB

storage/bb909ae41e1a3b09c88ea402f74e2caa/200x200.png 0 → 100644

61.7 KB

storage/bb909ae41e1a3b09c88ea402f74e2caa/original.png 0 → 100644

44.7 KB

storage/c24c6caa693896710ec7a0934a911214/200x200.png 0 → 100644

157 KB

storage/c24c6caa693896710ec7a0934a911214/x.png 0 → 100644

299 KB

storage/d732764150f3c6f779d0aed7a35b551e/200x200.jpg 0 → 100644

305 KB

storage/d732764150f3c6f779d0aed7a35b551e/original.jpg 0 → 100644

161 KB

storage/dbd5c1a08753ca919151c7ac628e7df3/200x200.png 0 → 100644

334 KB

storage/dbd5c1a08753ca919151c7ac628e7df3/x.png 0 → 100644

334 KB

storage/ef776ce280114fb3a5aeb80da2692813/200x200.png 0 → 100644

87.5 KB

storage/ef776ce280114fb3a5aeb80da2692813/original.png 0 → 100644

103 KB