update tính năng thống kê chấm công và xuất dữ liệu chấm công
This commit is contained in:
@@ -41,6 +41,13 @@ class LogsGrid extends CommonGrid {
|
||||
};
|
||||
}
|
||||
|
||||
public static function code() {
|
||||
return function($model) {
|
||||
$staff = $model->staff;
|
||||
return $staff ? $staff->code : "";
|
||||
};
|
||||
}
|
||||
|
||||
public static function department($array) {
|
||||
return function($model) use ($array) {
|
||||
$staff = $model->staff;
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
namespace app\helpers;
|
||||
|
||||
use app\models\Logs;
|
||||
|
||||
class StaffGrid extends CommonGrid {
|
||||
|
||||
public static function department($array) {
|
||||
@@ -34,4 +36,41 @@ class StaffGrid extends CommonGrid {
|
||||
};
|
||||
}
|
||||
|
||||
public static function timeIn($logs) {
|
||||
return function($model) use ($logs) {
|
||||
return date("H:i:s d/m/Y", $logs[$model->id][0]);
|
||||
};
|
||||
}
|
||||
|
||||
public static function timeOut($logs) {
|
||||
return function($model) use ($logs) {
|
||||
if (count($logs[$model->id]) > 1)
|
||||
return date("H:i:s d/m/Y", $logs[$model->id][count($logs[$model->id]) - 1]);
|
||||
};
|
||||
}
|
||||
|
||||
public static function manHour($logs) {
|
||||
return function($model) use ($logs) {
|
||||
$begin = $logs[$model->id][0];
|
||||
if (count($logs[$model->id]) > 1) {
|
||||
$end = $logs[$model->id][count($logs[$model->id]) - 1];
|
||||
return number_format(($end - $begin) / (60 * 60), 2);
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public static function manDay($logs) {
|
||||
return function($model) use ($logs) {
|
||||
$begin = $logs[$model->id][0];
|
||||
if (count($logs[$model->id]) > 1) {
|
||||
$end = $logs[$model->id][count($logs[$model->id]) - 1];
|
||||
return number_format(($end - $begin) / (60 * 60) / 8, 2);
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user