]> gitweb.erp-flowers.ru Git - erp24_rep/yii-erp24/.git/commitdiff
[ERP-241] передача смены
authorAlexander Smirnov <fredeom@mail.ru>
Mon, 18 Nov 2024 08:28:22 +0000 (11:28 +0300)
committerAlexander Smirnov <fredeom@mail.ru>
Mon, 18 Nov 2024 08:28:22 +0000 (11:28 +0300)
erp24/controllers/ShiftTransferController.php [new file with mode: 0644]
erp24/migrations/m241114_093632_create_table_shift_transfer.php [new file with mode: 0755]
erp24/records/ShiftRemains.php [new file with mode: 0644]
erp24/records/ShiftTransfer.php [new file with mode: 0644]
erp24/views/shift-transfer/index.php [new file with mode: 0644]
erp24/views/shift-transfer/update.php [new file with mode: 0644]
erp24/views/shift-transfer/view.php [new file with mode: 0644]

diff --git a/erp24/controllers/ShiftTransferController.php b/erp24/controllers/ShiftTransferController.php
new file mode 100644 (file)
index 0000000..ecac714
--- /dev/null
@@ -0,0 +1,103 @@
+<?php
+
+namespace app\controllers;
+
+use Yii;
+use yii\helpers\ArrayHelper;
+use yii\web\Controller;
+use yii_app\records\Admin;
+use yii_app\records\MultipleModel;
+use yii_app\records\ShiftRemains;
+use yii_app\records\ShiftTransfer;
+use yii_app\services\TaskService;
+
+class ShiftTransferController extends Controller
+{
+    public function actionIndex() {
+        $shiftTransfers = ShiftTransfer::find()->all();
+
+        $storeNameById = TaskService::getEntitiesByAlias('store');
+
+        $admins = ArrayHelper::map(Admin::find()->all(), 'id', 'name');
+
+        return $this->render('index', compact('shiftTransfers', 'storeNameById', 'admins'));
+    }
+
+    public function actionCreate() {
+        $shiftTransfer = new ShiftTransfer;
+
+        $isCreate = true;
+
+        $storeNameById = TaskService::getEntitiesByAlias('store');
+
+        $adminArr = [];
+        foreach (\yii_app\records\Admin::find()->with('adminGroup')->all() as $admin) {
+            if ($admin->group_id > 0) {
+                $adminArr[] = ['id' => $admin->id, 'name' => $admin->name, 'groupName' => $admin->adminGroup->name ?? "Другие"];
+            }
+        }
+        $admins = ArrayHelper::map($adminArr, 'id', 'name', 'groupName');
+
+        return $this->render('update', compact('shiftTransfer', 'isCreate', 'storeNameById',
+            'admins'));
+    }
+
+    public function actionUpdate($id = null) {
+        $shiftTransfer = ShiftTransfer::findOne($id);
+
+        if (!$shiftTransfer) {
+            $shiftTransfer = new ShiftTransfer;
+        }
+        if ($shiftTransfer->load(Yii::$app->request->post()) && $shiftTransfer->validate()) {
+            $shiftTransfer->save();
+            //echo "<pre>"; var_dump(Yii::$app->request->post()); echo "</pre>"; die;
+            ShiftRemains::deleteAll(['shift_transfer_id' => $shiftTransfer->id]);
+            $modelsShiftRemains = MultipleModel::createMultipleModel(ShiftRemains::class,
+                'ShiftTransfer', 'shiftRemains');
+            $postShiftTransfer = Yii::$app->request->post('ShiftTransfer');
+            $loadDataShiftRemains = ArrayHelper::getValue($postShiftTransfer, 'shiftRemains');
+            if (!empty($loadDataShiftRemains)) {
+                MultipleModel::loadMultipleFromArray($modelsShiftRemains, $loadDataShiftRemains , '',[]);
+            }
+            foreach ($modelsShiftRemains as $key => $modelsShiftRemain) {
+                $modelsShiftRemain->shift_transfer_id = $shiftTransfer->id;
+                if ($modelsShiftRemain->validate()) {
+                    $modelsShiftRemain->save();
+                }
+            }
+            return $this->redirect(['/shift-transfer/view', 'id' => $shiftTransfer->id]);
+        }
+
+        $isCreate = false;
+
+        $storeNameById = TaskService::getEntitiesByAlias('store');
+
+        $adminArr = [];
+        foreach (\yii_app\records\Admin::find()->with('adminGroup')->all() as $admin) {
+            if ($admin->group_id > 0) {
+                $adminArr[] = ['id' => $admin->id, 'name' => $admin->name, 'groupName' => $admin->adminGroup->name ?? "Другие"];
+            }
+        }
+        $admins = ArrayHelper::map($adminArr, 'id', 'name', 'groupName');
+
+        return $this->render('update', compact('shiftTransfer', 'isCreate', 'storeNameById',
+            'admins'));
+    }
+
+    public function actionView($id) {
+        $shiftTransfer = ShiftTransfer::findOne($id);
+
+        $storeNameById = TaskService::getEntitiesByAlias('store');
+
+        $admins = ArrayHelper::map(Admin::find()->all(), 'id', 'name');
+
+        return $this->render('view',
+            compact('shiftTransfer', 'storeNameById', 'admins'));
+    }
+
+    public function actionDelete($id) {
+        ShiftTransfer::deleteAll(['id' => $id]);
+
+        return $this->redirect(['/shift-transfer']);
+    }
+}
\ No newline at end of file
diff --git a/erp24/migrations/m241114_093632_create_table_shift_transfer.php b/erp24/migrations/m241114_093632_create_table_shift_transfer.php
new file mode 100755 (executable)
index 0000000..cf6f3b8
--- /dev/null
@@ -0,0 +1,73 @@
+<?php
+
+use yii\db\Migration;
+
+/**
+ * Class m241114_093632_create_table_shift_transfer
+ */
+class m241114_093632_create_table_shift_transfer extends Migration
+{
+//    const TABLE_NAME = 'erp24.shift_status';
+    const TABLE_NAME2 = 'erp24.shift_transfer';
+    const TABLE_NAME3 = 'erp24.shift_remains';
+
+    /**
+     * {@inheritdoc}
+     */
+    public function safeUp()
+    {
+//        $this->createTable(self::TABLE_NAME, [
+//            'id' => $this->primaryKey(),
+//            'name' => $this->string(40)->notNull()->comment('наименование статуса')
+//        ]);
+//
+//        $this->batchInsert(self::TABLE_NAME, ['id', 'name'], [
+//            [1, 'Ввод фактических остатков'],
+//            [2, 'Действия по замене'],
+//            [3, 'Готова к принятию'],
+//            [4, 'Принято'],
+//        ]);
+
+        $this->createTable(self::TABLE_NAME2, [
+            'id' => $this->primaryKey(),
+            'status_id' => $this->tinyInteger()->notNull()->comment('ID статуса'),
+            'date' => $this->string(36)->notNull()->comment('дата передачи смены'),
+            'date_start' => $this->dateTime()->notNull()->comment('время старта процедуры'),
+            'date_end' => $this->dateTime()->null()->comment('время принятия смены'),
+            'store_guid' => $this->string(36)->notNull()->comment("GUID магазина"),
+            'end_shift_admin_id' => $this->integer()->notNull()->comment('ID сотрудника, передающего смену'),
+            'start_shift_admin_id' => $this->integer()->notNull()->comment('ID сотрудника, принимающего смену'),
+            'goods_transfer_summ' => $this->float()->null()->comment('Сумма, полученная в результате действий по замене товара'),
+            'goods_transfer_count' => $this->float()->null()->comment('Количество замен общее, шт.'),
+            'discrepancy_pieces' => $this->float()->null()->comment('Расхождение факта, шт.'),
+            'discrepancy_rubles' => $this->float()->null()->comment('Расхождение факта, руб.'),
+            'comment' => $this->text()->null()->comment('Комментарий принимающей стороны'),
+            'report' => $this->text()->null()->comment('в формате HTML или TXT или JSON внешний вид всех данных при приеме')
+        ]);
+
+        $this->createTable(self::TABLE_NAME3, [
+            'id' => $this->primaryKey(),
+            'shift_transfer_id' => $this->integer()->notNull()->comment('ID смены по передаче'),
+            'group_label' => $this->string(40)->null()
+                ->comment('ID группы или алиас групп товаров (срезка, горшечка и тд.) potted, wrap, matrix'),
+            'product_guid' => $this->string(36)->notNull()->comment('GUID продукта'),
+            'retail_price' => $this->float()->notNull()->comment('Цена розничная'),
+            'self_cost' =>  $this->float()->notNull()->comment('Себестоимость'),
+            'remains_summ' => $this->float()->notNull()->comment('Сумма остатков (недостача или излишек)'),
+            'remains_count' => $this->float()->notNull()->comment('Фактические остатки кол-во'),
+            'fact_and_1c_diff' => $this->float()->notNull()
+                ->comment('Разница факт и по программе 1с может быть и минус (- недостача, + излишек) 0 - соответствие.'),
+            'remains_1c' => $this->float()->notNull()->comment('остатки по 1с (текущие)'),
+        ]);
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function safeDown()
+    {
+        $this->dropTable(self::TABLE_NAME3);
+        $this->dropTable(self::TABLE_NAME2);
+//        $this->dropTable(self::TABLE_NAME);
+    }
+}
diff --git a/erp24/records/ShiftRemains.php b/erp24/records/ShiftRemains.php
new file mode 100644 (file)
index 0000000..467167b
--- /dev/null
@@ -0,0 +1,64 @@
+<?php
+
+namespace yii_app\records;
+
+use Yii;
+
+/**
+ * This is the model class for table "shift_remains".
+ *
+ * @property int $id
+ * @property int $shift_transfer_id ID смены по передаче
+ * @property string|null $group_label ID группы или алиас групп товаров (срезка, горшечка и тд.) potted, wrap, matrix
+ * @property string $product_guid GUID продукта
+ * @property float $retail_price Цена розничная
+ * @property float $self_cost Себестоимость
+ * @property float $remains_summ Сумма остатков (недостача или излишек)
+ * @property float $remains_count Фактические остатки кол-во
+ * @property float $fact_and_1c_diff Разница факт и по программе 1с может быть и минус (- недостача, + излишек) 0 - соответствие.
+ * @property float $remains_1c остатки по 1с (текущие)
+ */
+class ShiftRemains extends \yii\db\ActiveRecord
+{
+    /**
+     * {@inheritdoc}
+     */
+    public static function tableName()
+    {
+        return 'shift_remains';
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function rules()
+    {
+        return [
+            [['shift_transfer_id', 'product_guid', 'retail_price', 'self_cost', 'remains_summ', 'remains_count', 'fact_and_1c_diff', 'remains_1c'], 'required'],
+            [['shift_transfer_id'], 'default', 'value' => null],
+            [['shift_transfer_id'], 'integer'],
+            [['retail_price', 'self_cost', 'remains_summ', 'remains_count', 'fact_and_1c_diff', 'remains_1c'], 'number'],
+            [['group_label'], 'string', 'max' => 40],
+            [['product_guid'], 'string', 'max' => 36],
+        ];
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function attributeLabels()
+    {
+        return [
+            'id' => 'ID',
+            'shift_transfer_id' => 'Shift Transfer ID',
+            'group_label' => 'Group Label',
+            'product_guid' => 'Product Guid',
+            'retail_price' => 'Retail Price',
+            'self_cost' => 'Self Cost',
+            'remains_summ' => 'Remains Summ',
+            'remains_count' => 'Remains Count',
+            'fact_and_1c_diff' => 'Fact And 1c Diff',
+            'remains_1c' => 'Remains 1c',
+        ];
+    }
+}
diff --git a/erp24/records/ShiftTransfer.php b/erp24/records/ShiftTransfer.php
new file mode 100644 (file)
index 0000000..49589dc
--- /dev/null
@@ -0,0 +1,91 @@
+<?php
+
+namespace yii_app\records;
+
+use Yii;
+
+/**
+ * This is the model class for table "shift_transfer".
+ *
+ * @property int $id
+ * @property int $status_id ID статуса
+ * @property string $date дата передачи смены
+ * @property string $date_start время старта процедуры
+ * @property string|null $date_end время принятия смены
+ * @property string $store_guid GUID магазина
+ * @property int $end_shift_admin_id ID сотрудника, передающего смену
+ * @property int $start_shift_admin_id ID сотрудника, принимающего смену
+ * @property float|null $goods_transfer_summ Сумма, полученная в результате действий по замене товара
+ * @property float|null $goods_transfer_count Количество замен общее, шт.
+ * @property float|null $discrepancy_pieces Расхождение факта, шт.
+ * @property float|null $discrepancy_rubles Расхождение факта, руб.
+ * @property string|null $comment Комментарий принимающей стороны
+ * @property string|null $report в формате HTML или TXT или JSON внешний вид всех данных при приеме
+ */
+class ShiftTransfer extends \yii\db\ActiveRecord
+{
+    const STATUS_ID_INPUT_FACT_REMAINS = 1;
+    const STATUS_ID_TRANSFER_ACTIONS = 2;
+    const STATUS_ID_READY_TO_ACCEPT = 3;
+    const STATUS_ID_ACCEPTED = 4;
+
+    public static function statusNames() {
+        return [
+            self::STATUS_ID_INPUT_FACT_REMAINS => 'Ввод фактических остатков',
+            self::STATUS_ID_TRANSFER_ACTIONS => 'Действия по замене',
+            self::STATUS_ID_READY_TO_ACCEPT => 'Готова к принятию',
+            self::STATUS_ID_ACCEPTED => 'Принято',
+        ];
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public static function tableName()
+    {
+        return 'shift_transfer';
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function rules()
+    {
+        return [
+            [['status_id', 'date', 'date_start', 'store_guid', 'end_shift_admin_id', 'start_shift_admin_id'], 'required'],
+            [['status_id', 'end_shift_admin_id', 'start_shift_admin_id'], 'default', 'value' => null],
+            [['status_id', 'end_shift_admin_id', 'start_shift_admin_id'], 'integer'],
+            [['date_start', 'date_end'], 'safe'],
+            [['goods_transfer_summ', 'goods_transfer_count', 'discrepancy_pieces', 'discrepancy_rubles'], 'number'],
+            [['comment', 'report'], 'string'],
+            [['date', 'store_guid'], 'string', 'max' => 36],
+        ];
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function attributeLabels()
+    {
+        return [
+            'id' => 'ID',
+            'status_id' => 'Статус',
+            'date' => 'Дата',
+            'date_start' => 'Дата начала',
+            'date_end' => 'Дата конца',
+            'store_guid' => 'Магазин',
+            'end_shift_admin_id' => 'Передающий смену сотрудник',
+            'start_shift_admin_id' => 'Принимающий смену сотрудник',
+            'goods_transfer_summ' => 'Сумма полученная в результате действий по замене товара',
+            'goods_transfer_count' => 'Количество замен общее',
+            'discrepancy_pieces' => 'Расхождения факта, шт.',
+            'discrepancy_rubles' => 'Расхождение факта, руб.',
+            'comment' => 'Комментарий',
+            'report' => 'Отчёт',
+        ];
+    }
+
+    public function getShiftRemains() {
+        return $this->hasMany(ShiftRemains::class, ['shift_transfer_id' => 'id']);
+    }
+}
diff --git a/erp24/views/shift-transfer/index.php b/erp24/views/shift-transfer/index.php
new file mode 100644 (file)
index 0000000..603ea03
--- /dev/null
@@ -0,0 +1,70 @@
+<?php
+
+use yii\helpers\Html;
+use yii\grid\GridView;
+use yii_app\records\ShiftTransfer;
+use yii\data\ArrayDataProvider;
+use yii\grid\ActionColumn;
+use yii\helpers\Url;
+
+/* @var $shiftTransfers ShiftTransfer */
+/* @var $storeNameById array */
+/* @var $admins array */
+
+?>
+
+<div class="shiftTransferIndex m-5">
+
+    <h1>Передачи смен</h1>
+
+    <?= Html::a('Создать новую передачу смен', '/shift-transfer/create', ['class' => 'btn btn-success']) ?>
+
+    <?= GridView::widget([
+        'dataProvider' => new ArrayDataProvider([
+            'allModels' => $shiftTransfers
+        ]),
+        'columns' => [
+            ['class' => 'yii\grid\SerialColumn'],
+            [
+                'attribute' => 'status_id',
+                'value' => function ($model) {
+                    return ShiftTransfer::statusNames()[$model['status_id']];
+                }
+            ],
+            'date',
+            'date_start',
+            'date_end',
+            [
+                'attribute' => 'store_guid',
+                'value' => function ($model) use ($storeNameById) {
+                    return $storeNameById[$model['store_guid']];
+                }
+            ],
+            [
+                'attribute' => 'end_shift_admin_id',
+                'value' => function ($model) use ($admins) {
+                    return $admins[$model['end_shift_admin_id']];
+                }
+            ],
+            [
+                'attribute' => 'start_shift_admin_id',
+                'value' => function ($model) use ($admins) {
+                    return $admins[$model['start_shift_admin_id']];
+                }
+            ],
+            'goods_transfer_summ',
+            'goods_transfer_count',
+            'discrepancy_pieces',
+            'discrepancy_rubles',
+            'comment',
+            'report',
+            [
+                'class' => ActionColumn::class,
+                'urlCreator' => function ($action, ShiftTransfer $model, $key, $index, $column) {
+                    return Url::toRoute([$action, 'id' => $model->id]);
+                }
+            ],
+        ]
+    ]) ?>
+
+</div>
diff --git a/erp24/views/shift-transfer/update.php b/erp24/views/shift-transfer/update.php
new file mode 100644 (file)
index 0000000..b807fad
--- /dev/null
@@ -0,0 +1,267 @@
+<?php
+
+use unclead\multipleinput\components\BaseColumn;
+use unclead\multipleinput\MultipleInput;
+
+use yii\helpers\Html;
+use yii\widgets\ActiveForm;
+
+use kartik\select2\Select2;
+use dosamigos\datetimepicker\DateTimePicker;
+use yii_app\records\ShiftTransfer;
+
+/* @var $isCreate bool */
+/* @var $shiftTransfer ShiftTransfer */
+/* @var $storeNameById array */
+/* @var $admins array */
+
+
+$this->registerCss('
+    .multiple-input-list__btn.js-input-plus.btn.btn-success {
+        display: block !important;
+        width: 40px;
+    }
+');
+?>
+
+<div class="shiftTransferCreate m-5">
+
+    <?= Html::a('Назад', '/shift-transfer', ['class' => 'btn btn-secondary']) ?>
+
+    <h1><?= $isCreate ? 'Создание' : 'Обновление' ?> передачи смены</h1>
+
+    <?php $form = ActiveForm::begin([
+        'action' => ['/shift-transfer/update', 'id' => Yii::$app->request->get('id')],
+    ]) ?>
+
+    <?= $form->field($shiftTransfer, 'id')->hiddenInput()->label(false) ?>
+
+    <div class="row">
+        <div class="col-6">
+            <?= $form->field($shiftTransfer, 'status_id')->dropDownList(ShiftTransfer::statusNames()) ?>
+        </div>
+    </div>
+    <div class="row">
+        <div class="col-6">
+            <?= $form->field($shiftTransfer, 'store_guid')->dropDownList($storeNameById) ?>
+        </div>
+        <div class="col-6">
+            <?= $form->field($shiftTransfer, 'date')->widget(DateTimePicker::class, [
+                'language' => 'ru',
+                'template' => '{input}',
+                'clientOptions' => [
+                    'autoclose' => true,
+                    'format' => 'Y-m-d',
+                    'todayBtn' => true
+                ],
+            ]) ?>
+        </div>
+    </div>
+    <div class="row">
+        <div class="col-6">
+            <?= $form->field($shiftTransfer, 'date_start')->widget(DateTimePicker::class, [
+                'language' => 'ru',
+                'template' => '{input}',
+                'clientOptions' => [
+                    'autoclose' => true,
+                    'format' => 'Y-m-d H:i:s',
+                    'todayBtn' => true
+                ],
+            ]) ?>
+        </div>
+        <div class="col-6">
+            <?= $form->field($shiftTransfer, 'date_end')->widget(DateTimePicker::class, [
+                'language' => 'ru',
+                'template' => '{input}',
+                'clientOptions' => [
+                    'autoclose' => true,
+                    'format' => 'Y-m-d H:i:s',
+                    'todayBtn' => true
+                ],
+            ]) ?>
+        </div>
+    </div>
+    <div class="row">
+        <div class="col-6">
+            <?= $form->field($shiftTransfer, 'end_shift_admin_id')->widget(Select2::class, [
+                'data' => $admins,
+                'language' => 'ru',
+                'options' => ['placeholder' => 'Сотрудник...'],
+                'pluginOptions' => [
+                    'allowClear' => true
+                ],
+            ]) ?>
+        </div>
+        <div class="col-6">
+            <?= $form->field($shiftTransfer, 'start_shift_admin_id')->widget(Select2::class, [
+                'data' => $admins,
+                'language' => 'ru',
+                'options' => ['placeholder' => 'Сотрудник...'],
+                'pluginOptions' => [
+                    'allowClear' => true
+                ],
+            ]) ?>
+        </div>
+    </div>
+    <div class="row">
+        <div class="col-6">
+            <?= $form->field($shiftTransfer, 'goods_transfer_summ')->textInput(['type' => 'number', 'step' => 0.01]) ?>
+        </div>
+        <div class="col-6">
+            <?= $form->field($shiftTransfer, 'goods_transfer_count')->textInput(['type' => 'number', 'step' => 0.01]) ?>
+        </div>
+    </div>
+    <div class="row">
+        <div class="col-6">
+            <?= $form->field($shiftTransfer, 'discrepancy_pieces')->textInput(['type' => 'number', 'step' => 0.01]) ?>
+        </div>
+        <div class="col-6">
+            <?= $form->field($shiftTransfer, 'discrepancy_rubles')->textInput(['type' => 'number', 'step' => 0.01]) ?>
+        </div>
+    </div>
+    <div class="row">
+        <div class="col-6">
+            <?= $form->field($shiftTransfer, 'comment')->textarea(['rows' => 6]) ?>
+        </div>
+        <div class="col-6">
+            <?= $form->field($shiftTransfer, 'report')->textarea(['rows' => 6]) ?>
+        </div>
+    </div>
+
+    <div class="row">
+        <div class="col-12">
+        <?= $form->field($shiftTransfer, 'shiftRemains')->widget(MultipleInput::class, [
+            'min' => 0,
+            'max' => 100,
+            'columns' => [
+//                [
+//                    'name'  => 'id',
+//                    'type'  => BaseColumn::TYPE_HIDDEN_INPUT,
+//                    'value' => function($data) {
+//                        return $data['id'] ?? '';
+//                    },
+//                ],
+//                [
+//                    'name'  => 'shift_transfer_id',
+//                    'type'  => BaseColumn::TYPE_HIDDEN_INPUT,
+//                    'value' => function($data) {
+//                        return $data['shift_transfer_id'] ?? '';
+//                    },
+//                ],
+                [
+                    'name'  => 'group_label',
+                    'title' => 'Название группы',
+                    'type'  => BaseColumn::TYPE_DROPDOWN,
+                    'items' => ["wrap"=>"Упаковка","potted"=>"Горшечка", "services"=>"Услуги",
+                        "services_delivery"=>"Услуги по доставке", "salut"=>"Пиротехника",
+                        "matrix"=>"Матрица", "marketplace" => "Товары для маркетплейсов",
+                        "marketplace_additional" => "Доп. товары для маркетплейсов", "related"=>"Сопутка",
+                        "other_items"=>"Номенклатура 1%"],
+                    'value' => function($data) {
+                        return $data['group_label'] ?? '';
+                    },
+                    'headerOptions' => [
+                        'style' => 'width: 70px;',
+                    ]
+                ],
+                [
+                    'name'  => 'product_guid',
+                    'title' => 'GUID продукта',
+                    'type'  => BaseColumn::TYPE_TEXT_INPUT,
+                    'value' => function($data) {
+                        return $data['product_guid'] ?? '';
+                    },
+                    'headerOptions' => [
+                        'style' => 'width: 70px;',
+                    ]
+                ],
+                [
+                    'name'  => 'retail_price',
+                    'title' => 'Розничная цена',
+                    'type'  => BaseColumn::TYPE_TEXT_INPUT,
+                    'options' => ['type' => 'number', 'step' => 0.01],
+                    'value' => function($data) {
+                        return $data['retail_price'] ?? '';
+                    },
+                    'headerOptions' => [
+                        'style' => 'width: 70px;',
+                    ]
+                ],
+                [
+                    'name'  => 'self_cost',
+                    'title' => 'Себестоимость',
+                    'type'  => BaseColumn::TYPE_TEXT_INPUT,
+                    'options' => ['type' => 'number', 'step' => 0.01],
+                    'value' => function($data) {
+                        return $data['self_cost'] ?? '';
+                    },
+                    'headerOptions' => [
+                        'style' => 'width: 70px;',
+                    ]
+                ],
+                [
+                    'name'  => 'remains_summ',
+                    'title' => 'Сумма остатков (недостача или излишек)',
+                    'type'  => BaseColumn::TYPE_TEXT_INPUT,
+                    'options' => ['type' => 'number', 'step' => 0.01],
+                    'value' => function($data) {
+                        return $data['remains_summ'] ?? '';
+                    },
+                    'headerOptions' => [
+                        'style' => 'width: 70px;',
+                    ]
+                ],
+                [
+                    'name'  => 'remains_count',
+                    'title' => 'Фактические остатки кол-во',
+                    'type'  => BaseColumn::TYPE_TEXT_INPUT,
+                    'options' => ['type' => 'number', 'step' => 0.01],
+                    'value' => function($data) {
+                        return $data['remains_count'] ?? '';
+                    },
+                    'headerOptions' => [
+                        'style' => 'width: 70px;',
+                    ]
+                ],
+                [
+                    'name'  => 'fact_and_1c_diff',
+                    'title' => 'Разница факт и по программе 1с',
+                    'type'  => BaseColumn::TYPE_TEXT_INPUT,
+                    'options' => ['type' => 'number', 'step' => 0.01],
+                    'value' => function($data) {
+                        return $data['fact_and_1c_diff'] ?? '';
+                    },
+                    'headerOptions' => [
+                        'style' => 'width: 70px;',
+                    ]
+                ],
+                [
+                    'name'  => 'remains_1c',
+                    'title' => 'Остатки по 1с',
+                    'type'  => BaseColumn::TYPE_TEXT_INPUT,
+                    'options' => ['type' => 'number', 'step' => 0.01],
+                    'value' => function($data) {
+                        return $data['remains_1c'] ?? '';
+                    },
+                    'headerOptions' => [
+                        'style' => 'width: 70px;',
+                    ]
+                ],
+            ],
+            'addButtonPosition' => MultipleInput::POS_FOOTER,
+            'addButtonOptions' => [
+                'class' => 'btn btn-success visible-md',
+                'style' => 'display:block; width: 250px;',
+            ],
+            'iconSource'=> 'fa',
+        ])->label(false);?>
+        </div>
+    </div>
+
+    <div class="form-group">
+        <?= Html::submitButton('Сохранить', ['class' => 'btn btn-success']) ?>
+    </div>
+
+    <?php ActiveForm::end() ?>
+
+</div>
diff --git a/erp24/views/shift-transfer/view.php b/erp24/views/shift-transfer/view.php
new file mode 100644 (file)
index 0000000..58c7ab0
--- /dev/null
@@ -0,0 +1,59 @@
+<?php
+
+use yii\helpers\Html;
+use yii\widgets\DetailView;
+use yii_app\records\ShiftTransfer;
+
+/* @var $shiftTransfer ShiftTransfer */
+/* @var $storeNameById array */
+/* @var $admins array */
+
+?>
+
+<div class="shiftTransferView m-5">
+
+    <?= Html::a('Назад', '/shift-transfer', ['class' => 'btn btn-secondary']) ?>
+    <?= Html::a('Редактировать', ['/shift-transfer/update', 'id' => Yii::$app->request->get('id')], ['class' => 'btn btn-primary']) ?>
+
+    <h1>Просмотр передачи смены</h1>
+
+    <?= DetailView::widget([
+        'model' => $shiftTransfer,
+        'attributes' => [
+            [
+                'attribute' => 'status_id',
+                'value' => function ($model) {
+                    return ShiftTransfer::statusNames()[$model['status_id']];
+                }
+            ],
+            'date',
+            'date_start',
+            'date_end',
+            [
+                'attribute' => 'store_guid',
+                'value' => function ($model) use ($storeNameById) {
+                    return $storeNameById[$model['store_guid']];
+                }
+            ],
+            [
+                'attribute' => 'end_shift_admin_id',
+                'value' => function ($model) use ($admins) {
+                    return $admins[$model['end_shift_admin_id']];
+                }
+            ],
+            [
+                'attribute' => 'start_shift_admin_id',
+                'value' => function ($model) use ($admins) {
+                    return $admins[$model['start_shift_admin_id']];
+                }
+            ],
+            'goods_transfer_summ',
+            'goods_transfer_count',
+            'discrepancy_pieces',
+            'discrepancy_rubles',
+            'comment',
+            'report'
+        ]
+    ]) ?>
+
+</div>