]> gitweb.erp-flowers.ru Git - erp24_rep/yii-erp24/.git/commitdiff
ERP-223 Добавить в /admin-person-bonuses/ строчку Переработка (сумма) feature_zozirova_erp-223_add_new_column origin/feature_zozirova_erp-223_add_new_column
authormarina <m.zozirova@gmail.com>
Tue, 22 Oct 2024 06:03:05 +0000 (09:03 +0300)
committermarina <m.zozirova@gmail.com>
Tue, 22 Oct 2024 06:03:05 +0000 (09:03 +0300)
erp24/migrations/m241018_051346_add_new_column_on_admin_person_bonus.php [new file with mode: 0644]
erp24/records/AdminPersonBonuses.php
erp24/services/CabinetService.php
erp24/views/admin_person_bonuses/_form.php
erp24/views/admin_person_bonuses/_update_form.php
erp24/views/admin_person_bonuses/index.php
erp24/views/admin_person_bonuses/view.php

diff --git a/erp24/migrations/m241018_051346_add_new_column_on_admin_person_bonus.php b/erp24/migrations/m241018_051346_add_new_column_on_admin_person_bonus.php
new file mode 100644 (file)
index 0000000..801b16b
--- /dev/null
@@ -0,0 +1,27 @@
+<?php
+
+use yii\db\Migration;
+
+/**
+ * Class m241018_051346_add_new_column_on_admin_person_bonus
+ */
+class m241018_051346_add_new_column_on_admin_person_bonus extends Migration
+{
+        public function safeUp()
+    {
+        if (!$this->db->schema->getTableSchema('admin_person_bonuses', true)->getColumn('overtime')) {
+            $this->addColumn('admin_person_bonuses', 'overtime', $this->float()->defaultValue(null));
+        }
+    }
+
+
+    /**
+     * {@inheritdoc}
+     */
+    public function safeDown()
+    {
+        if ($this->db->schema->getTableSchema('admin_person_bonuses', true)->getColumn('overtime')) {
+            $this->dropColumn('admin_person_bonuses', 'overtime');
+        }
+    }
+}
index 2f29d9f829b8a6d6160d287f36e5a49a775b257d..5d4bde7eefdc0e4f7edf071c83d752dce47fe535 100755 (executable)
@@ -24,6 +24,7 @@ use yii\db\ActiveQueryInterface;
  * @property int|null $part_time_job_hours
  * @property string $retention_comment
  * @property int $created_admin_id
+ * @property float overtime
  */
 class AdminPersonBonuses extends \yii\db\ActiveRecord
 {
@@ -58,6 +59,7 @@ class AdminPersonBonuses extends \yii\db\ActiveRecord
             ],
             [['date_time', 'retention_comment'], 'safe'],
             [['date'], 'string', 'max' => 100],
+            [['overtime'], 'number'],
         ];
     }
 
@@ -82,6 +84,7 @@ class AdminPersonBonuses extends \yii\db\ActiveRecord
             'prepaid_expense' => 'Аванс',
             'counting' => 'Подсчёт',
             'date_time' => 'Date Time',
+            'overtime' => 'Переработка',
         ];
     }
 
index 501d251e34b872fdb8966788e3355fde7913e301..f89daafe76f58f6b24eb08137075314579d5343d 100755 (executable)
@@ -2738,6 +2738,7 @@ class CabinetService
             ->one();
 
         $personBonuses = ArrayHelper::getValue($personBonusesArray, 'bonuses'); // Персональная премия
+        $overtime = ArrayHelper::getValue($personBonusesArray, 'overtime'); // Переработка
         $personColorRubleBonuses = ArrayHelper::getValue($personBonusesArray, 'color_ruble_bonuses'); // Персональная премия
         $personRetention = ArrayHelper::getValue($personBonusesArray, 'retention'); // Персональный вычет
         $personRetentionСomment = 'Персональный вычет';
@@ -2865,6 +2866,7 @@ class CabinetService
         $makeMatrix = ArrayHelper::getValue($premiumByMatrix, 'makeMatrix');
         $bonusMakeMatrix = ArrayHelper::getValue($premiumByMatrix, 'bonusMakeMatrix');
         $matrixPrime = ArrayHelper::getValue($premiumByMatrix, 'matrixPrime');
+        $overtimeMatrix =
 
         $consolidatedPremiumByStore = 0;
 
@@ -3036,6 +3038,13 @@ false
                 $arrayColumnWages = array_merge($arrayColumnWages, $personBonusesArrayInfo);
             }
 
+            if (!empty($overtime)) {
+                $personBonusesArrayInfo = [
+                    'Переработка' => (float) $overtime,
+                ];
+                $arrayColumnWages = array_merge($arrayColumnWages, $personBonusesArrayInfo);
+            }
+
             if (!empty($personPartTimeJobHoursPay)) {
                 $personBonusesArrayInfo = [
                     'Оплата подработок по часам' . ' ('. $personPartTimeJobHours . '*' . $hourPayment . ' руб/час из оклада)' => (int) $personPartTimeJobHoursPay,
@@ -3214,6 +3223,7 @@ false
                 'Премия за продажи не фокусной продукции (Другие товары)' => $userSalaryOtherItemsPremium,
                 'Премия за качество (' . $userQualityPercent . '%)' => $userQualityPremium,
                 'Командный бонус' => $teamBonusValue,
+//                'Переработка' =>
 
             );
 
@@ -3224,6 +3234,13 @@ false
                 $sumValuesFlorist = array_merge($personBonusesArrayInfo, $sumValuesFlorist);
             }
 
+            if (!empty($overtime)) {
+                $personBonusesArrayInfo = [
+                    'Переработка' => (float) $overtime,
+                ];
+                $sumValuesFlorist = array_merge($personBonusesArrayInfo, $sumValuesFlorist);
+            }
+
             if (!empty($personPremiumByStore)) {
                 $personBonusesArrayInfo = [
                     'Премия за продажу фокусных позиции в праздники' => $personPremiumByStore,
@@ -3318,6 +3335,12 @@ false
                 $bonusVariableByMonth = array_merge($personBonusesArrayInfo, $bonusVariableByMonth);
             }
 
+            if (!empty($overtime)) {
+                $personBonusesArrayInfo = [
+                    'Переработка' => (float) $overtime,
+                ];
+                $bonusVariableByMonth = array_merge($personBonusesArrayInfo, $bonusVariableByMonth);
+            }
 
             if (!empty($personPartTimeJobHoursPay)) {
                 $personBonusesArrayInfo = [
@@ -7146,6 +7169,13 @@ Group BY admin_id
             $arrayColumnWages = array_merge($arrayColumnWages, $personBonusesArrayInfo);
         }
 
+        if (!empty($overtime)) {
+            $personBonusesArrayInfo = [
+                'Переработка' => (float) $overtime,
+            ];
+            $arrayColumnWages = array_merge($arrayColumnWages, $personBonusesArrayInfo);
+        }
+
         if (!empty($personRetention)) {
             $personRetentionArrayInfo = [
                 'Персональный вычет' => $personRetention * (-1),
index 96205dbba3eff9e52e08e6d6008453c182aa7794..04c0c76953b0b8114163e67d220afe912df7770f 100755 (executable)
@@ -77,6 +77,8 @@ use yii_app\records\Admin;
 
     <?= $form->field($model, 'counting')->textInput() ?>
 
+    <?= $form->field($model, 'overtime')->textInput(['type' => 'number', 'step' => 'any']) ?>
+
     <div class="form-group">
         <?= Html::submitButton('Save', ['class' => 'btn btn-success']) ?>
     </div>
index 2ab320d4e455a1685a41d35ba681a1c8881e0513..f224a88125557a75a48d9cf53ee4fd8c14cf4a81 100755 (executable)
@@ -39,6 +39,8 @@ use yii_app\records\Admin;
 
     <?= $form->field($model, 'counting')->textInput() ?>
 
+    <?= $form->field($model, 'overtime')->textInput(['type' => 'number', 'step' => 'any']) ?>
+
     <div class="form-group">
         <?= Html::submitButton('Save', ['class' => 'btn btn-success']) ?>
     </div>
index 20031ace25946eee09dce1b5039f9c487a114ee2..a8cffb8c42a0ca50f024d71943e92756662df855 100755 (executable)
@@ -61,6 +61,7 @@ $this->params['breadcrumbs'][] = $this->title;
             'shift_correction',
             'prepaid_expense',
             'counting',
+            'overtime',
             //'date_time',
             [
                 'class' => ActionColumn::className(),
index acd456a1918862121f9626107e769d84e4602aa0..54f16711519bc7b1f4add5d2befe036f4ad2f81b 100755 (executable)
@@ -38,6 +38,7 @@ $this->params['breadcrumbs'][] = $this->title;
             'shift_correction',
             'prepaid_expense',
             'counting',
+            'overtime',
 //            'date_time',
         ],
     ]) ?>