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 = 'Брак из-за поломки оборудования';
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;
$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) {
->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);
}
}