From: Alexander Smirnov Date: Wed, 26 Jun 2024 12:53:43 +0000 (+0300) Subject: [ERP-69] метод для сбора данных по отработанным сменам из нового факта X-Git-Tag: 1.3~43^2 X-Git-Url: https://gitweb.erp-flowers.ru/?a=commitdiff_plain;h=604155205320b6420c83f7c00c983693158f9efd;p=erp24_rep%2Fyii-erp24%2F.git [ERP-69] метод для сбора данных по отработанным сменам из нового факта --- 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