]> gitweb.erp-flowers.ru Git - erp24_rep/yii-erp24/.git/commitdiff
[ERP-69] метод для сбора данных по отработанным сменам из нового факта
authorAlexander Smirnov <fredeom@mail.ru>
Wed, 26 Jun 2024 12:53:43 +0000 (15:53 +0300)
committerAlexander Smirnov <fredeom@mail.ru>
Wed, 26 Jun 2024 12:53:43 +0000 (15:53 +0300)
erp24/records/TimetableFactModel.php

index 4410c12e9b3c5b6f55cbcdf54925261058fe29d0..fa9dc1592403d479932985c3496af321ef5b77cf 100644 (file)
@@ -206,4 +206,17 @@ class TimetableFactModel extends ActiveRecord
     {
         return $this->hasOne(AdminGroup::class, ['id' => 'admin_group_id']);
     }
+
+    public static function getClosedShiftData($admin_id, $date_start, $date_end) {
+        $timetableFactModels = TimetableFactModel::find()->where([
+                'admin_id' => $admin_id,
+                'status' => AdminCheckin::TYPE_END,
+                'date_start' => date('Y-m-d', strtotime($date_start)),
+                'date_end' => date('Y-m-d', strtotime($date_end))
+            ])
+            ->andWhere(['<=', 'date_start', date('Y-m-d', strtotime($date_start))])
+            ->andWhere(['>=', 'date_end', date('Y-m-d', strtotime($date_end))])
+            ->all();
+        return $timetableFactModels;
+    }
 }
\ No newline at end of file