From 604155205320b6420c83f7c00c983693158f9efd Mon Sep 17 00:00:00 2001 From: Alexander Smirnov Date: Wed, 26 Jun 2024 15:53:43 +0300 Subject: [PATCH] =?utf8?q?[ERP-69]=20=D0=BC=D0=B5=D1=82=D0=BE=D0=B4=20?= =?utf8?q?=D0=B4=D0=BB=D1=8F=20=D1=81=D0=B1=D0=BE=D1=80=D0=B0=20=D0=B4?= =?utf8?q?=D0=B0=D0=BD=D0=BD=D1=8B=D1=85=20=D0=BF=D0=BE=20=D0=BE=D1=82?= =?utf8?q?=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D0=B0=D0=BD=D0=BD=D1=8B=D0=BC=20?= =?utf8?q?=D1=81=D0=BC=D0=B5=D0=BD=D0=B0=D0=BC=20=D0=B8=D0=B7=20=D0=BD?= =?utf8?q?=D0=BE=D0=B2=D0=BE=D0=B3=D0=BE=20=D1=84=D0=B0=D0=BA=D1=82=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- erp24/records/TimetableFactModel.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/erp24/records/TimetableFactModel.php b/erp24/records/TimetableFactModel.php index 4410c12e..fa9dc159 100644 --- a/erp24/records/TimetableFactModel.php +++ b/erp24/records/TimetableFactModel.php @@ -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 -- 2.39.5