From: Alexander Smirnov Date: Mon, 26 Aug 2024 11:04:45 +0000 (+0300) Subject: [ERP-142] Именованы константы X-Git-Tag: 1.4~27^2 X-Git-Url: https://gitweb.erp-flowers.ru/?a=commitdiff_plain;h=e5258e16434215e16f25645b4f2bd88dc7db558b;p=erp24_rep%2Fyii-erp24%2F.git [ERP-142] Именованы константы --- diff --git a/erp24/records/MotivationCostsItem.php b/erp24/records/MotivationCostsItem.php index 1f9de0be..925f8ab5 100644 --- a/erp24/records/MotivationCostsItem.php +++ b/erp24/records/MotivationCostsItem.php @@ -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 = 'Брак из-за поломки оборудования'; diff --git a/erp24/services/MotivationService.php b/erp24/services/MotivationService.php index ee005e07..660d498d 100644 --- a/erp24/services/MotivationService.php +++ b/erp24/services/MotivationService.php @@ -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); } }