]> gitweb.erp-flowers.ru Git - erp24_rep/yii-erp24/.git/commitdiff
[ERP-142] Именованы константы origin/feature_smirnov_erp-142_personal_count
authorAlexander Smirnov <fredeom@mail.ru>
Mon, 26 Aug 2024 11:04:45 +0000 (14:04 +0300)
committerAlexander Smirnov <fredeom@mail.ru>
Mon, 26 Aug 2024 11:04:45 +0000 (14:04 +0300)
erp24/records/MotivationCostsItem.php
erp24/services/MotivationService.php

index 1f9de0bee65e93b06f5d8d14dfbb8cdfe54c111d..925f8ab5c19fb2d896050312ffcc68270e9d529c 100644 (file)
@@ -24,6 +24,8 @@ class MotivationCostsItem extends ActiveRecord
     const DATA_TYPE_FLOAT = 'float';
     const DATA_TYPE_STRING = 'string';
 
+    const CODE_EMPLOYEES_QUANTITY = 34;
+
     const ITEM_WRITE_OFF_OF_ILLIQUID_GOODS_SPOILAGE_EXPIRATION_OF_SHELF_LIFE = 'Списание неликвидного товара: порча, истечение срока годности';
     const ITEM_DEFECTIVE_DELIVERY = 'Брак с поставки';
     const ITEM_DEFECT_DUE_TO_EQUIPMENT_FAILURE = 'Брак из-за поломки оборудования';
index ee005e07a25cc2e75eb3c793f8d23fcf2ccc2ffc..660d498defaba95f21dbc627bbdc713755f1a3a9 100644 (file)
@@ -5,6 +5,7 @@ namespace yii_app\services;
 use Yii;
 use PhpOffice\PhpSpreadsheet\IOFactory;
 use yii\helpers\Json;
+use yii_app\records\AdminGroup;
 use yii_app\records\ExportImportTable;
 use yii\helpers\ArrayHelper;
 use yii_app\records\Motivation;
@@ -634,7 +635,7 @@ class MotivationService
 
         $motivation = Motivation::find()->where(['store_id' => $store_id, 'year' => $year, 'month' => $month])->one();
         foreach ($items as $code) {
-            if ($code == 34) { // Количество сотрудников считается в другой задаче
+            if ($code == MotivationCostsItem::CODE_EMPLOYEES_QUANTITY) { // Количество сотрудников считается в другой задаче
                 continue;
             }
             if ($motivation) {
@@ -689,14 +690,14 @@ class MotivationService
                     ->andWhere(['between', 'date_shift', $monthStart, $monthEnd])->groupBy(['admin_group_id'])->asArray()->one();
 
                 $norma = 15;
-                if ($timetableFactModel['admin_group_id'] != 45) {
+                if ($timetableFactModel['admin_group_id'] != AdminGroup::GROUP_WORKERS) {
                     $timetablePlan = Timetable::find()->select(['COUNT(*) as total'])->where(['store_id' => $store_id, 'admin_id' => $admin_id, 'tabel' => 0, 'slot_type_id' => Timetable::TIMESLOT_WORK])
                         ->andWhere(['between', 'date', $monthStart, $monthEnd])->asArray()->one();
                     $norma = $timetablePlan['total'];
                 }
                 $result += $norma == 0 ? 0 : $timetableFactModel['total'] / $norma;
             }
-            self::saveOrUpdateMotivationValue($motivation->id, 'fact', 34, 'float', $result);
+            self::saveOrUpdateMotivationValue($motivation->id, 'fact', MotivationCostsItem::CODE_EMPLOYEES_QUANTITY, 'float', $result);
         }
     }