|
|
|
@ -384,7 +384,7 @@ class OtherController extends CommonController
|
|
|
|
switch ($export_type) {
|
|
|
|
switch ($export_type) {
|
|
|
|
case 'course_signs_invested':
|
|
|
|
case 'course_signs_invested':
|
|
|
|
// 被投企业明细 - 使用与coursesHome相同的算法
|
|
|
|
// 被投企业明细 - 使用与coursesHome相同的算法
|
|
|
|
$companies = CourseSign::yhInvestedTotal($start_date, $end_date, $course_ids, true);
|
|
|
|
$companies = CourseSign::yhInvestedTotal(CourseType::START_DATE, $end_date, $course_ids, true);
|
|
|
|
foreach ($companies as $company) {
|
|
|
|
foreach ($companies as $company) {
|
|
|
|
$data[] = [
|
|
|
|
$data[] = [
|
|
|
|
'company_name' => $company->company_name,
|
|
|
|
'company_name' => $company->company_name,
|
|
|
|
@ -516,20 +516,57 @@ class OtherController extends CommonController
|
|
|
|
// 课程分类明细 - 与coursesHome中的courseTypesSum逻辑保持一致
|
|
|
|
// 课程分类明细 - 与coursesHome中的courseTypesSum逻辑保持一致
|
|
|
|
$courseTypes = CourseType::whereIn('id', $course_type_id)->get();
|
|
|
|
$courseTypes = CourseType::whereIn('id', $course_type_id)->get();
|
|
|
|
foreach ($courseTypes as $courseType) {
|
|
|
|
foreach ($courseTypes as $courseType) {
|
|
|
|
$courses2 = Course::where('type', $courseType->id)->get();
|
|
|
|
// 获取课程 - 添加日期筛选逻辑
|
|
|
|
|
|
|
|
$courses2 = Course::where('type', $courseType->id)
|
|
|
|
|
|
|
|
->where(function ($query) use ($start_date, $end_date) {
|
|
|
|
|
|
|
|
// 开始结束日期的筛选。or查询
|
|
|
|
|
|
|
|
if ($start_date && $end_date) {
|
|
|
|
|
|
|
|
$query->whereBetween('start_date', [$start_date, $end_date])
|
|
|
|
|
|
|
|
->orWhereBetween('end_date', [$start_date, $end_date]);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
})->orderBy('start_date', 'asc')->get();
|
|
|
|
foreach ($courses2 as $course) {
|
|
|
|
foreach ($courses2 as $course) {
|
|
|
|
$data[] = [
|
|
|
|
$data[] = [
|
|
|
|
'course_type' => $courseType->name,
|
|
|
|
'course_type' => $courseType->name,
|
|
|
|
'course_name' => $course->name,
|
|
|
|
'course_name' => $course->name,
|
|
|
|
'course_type_signs_pass' => CourseSign::courseSignsTotal($start_date, $end_date, 1, $courses2->pluck('id')),
|
|
|
|
'course_type_signs_pass' => CourseSign::courseSignsTotal($start_date, $end_date, 1, $courses2->pluck('id'), false, false),
|
|
|
|
'course_type_signs_pass_unique' => CourseSign::courseSignsTotalByUnique($start_date, $end_date, 1, $courses2->pluck('id'), null),
|
|
|
|
'course_type_signs_pass_unique' => CourseSign::courseSignsTotalByUnique($start_date, $end_date, 1, $courses2->pluck('id'), false, false),
|
|
|
|
'course_signs_pass' => CourseSign::courseSignsTotal($start_date, $end_date, 1, [$course->id]),
|
|
|
|
'course_signs_pass' => CourseSign::courseSignsTotal($start_date, $end_date, 1, [$course->id], false, false),
|
|
|
|
'genban_total' => CourseSign::genban($start_date, $end_date, [$course->id]),
|
|
|
|
'genban_total' => CourseSign::genban($start_date, $end_date, [$course->id]),
|
|
|
|
'yh_invested_total' => CourseSign::yhInvested($start_date, $end_date, [$course->id]),
|
|
|
|
'yh_invested_total' => CourseSign::yhInvested($start_date, $end_date, [$course->id]),
|
|
|
|
'company_join_total' => CourseSign::companyJoin($start_date, $end_date, [$course->id]),
|
|
|
|
'company_join_total' => CourseSign::companyJoin($start_date, $end_date, [$course->id]),
|
|
|
|
];
|
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// 附加历史课程数据
|
|
|
|
|
|
|
|
$courseTypesHistory = CourseType::where('is_history', 1)->whereIn('id', $course_type_id)->get();
|
|
|
|
|
|
|
|
foreach ($courseTypesHistory as $historyCourse) {
|
|
|
|
|
|
|
|
$courses3 = HistoryCourse::whereHas('calendar', function ($query) {
|
|
|
|
|
|
|
|
$query->where('is_count_people', 1);
|
|
|
|
|
|
|
|
})->where(function ($query) use ($start_date, $end_date) {
|
|
|
|
|
|
|
|
// 开始结束日期的筛选。or查询
|
|
|
|
|
|
|
|
$query->whereBetween('start_time', [$start_date, $end_date])
|
|
|
|
|
|
|
|
->orWhereBetween('end_time', [$start_date, $end_date]);
|
|
|
|
|
|
|
|
})->where('type', $historyCourse->id)->get();
|
|
|
|
|
|
|
|
foreach ($courses3 as $course) {
|
|
|
|
|
|
|
|
$data[] = [
|
|
|
|
|
|
|
|
'course_type' => $historyCourse->name,
|
|
|
|
|
|
|
|
'course_name' => $course->course_name,
|
|
|
|
|
|
|
|
// 课程类型培养人数
|
|
|
|
|
|
|
|
'course_type_signs_pass' => $courses3->sum('course_type_signs_pass'),
|
|
|
|
|
|
|
|
// 课程类型去重培养人数
|
|
|
|
|
|
|
|
'course_type_signs_pass_unique' => $courses3->sum('course_type_signs_pass_unique'),
|
|
|
|
|
|
|
|
// 课程人数
|
|
|
|
|
|
|
|
'course_signs_pass' => $course->course_signs_pass,
|
|
|
|
|
|
|
|
// 跟班学员数量
|
|
|
|
|
|
|
|
'genban_total' => 0,
|
|
|
|
|
|
|
|
// 被投企业数
|
|
|
|
|
|
|
|
'yh_invested_total' => 0,
|
|
|
|
|
|
|
|
// 元禾同事数
|
|
|
|
|
|
|
|
'company_join_total' => 0,
|
|
|
|
|
|
|
|
];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
$fields = [
|
|
|
|
$fields = [
|
|
|
|
'course_type' => '课程体系',
|
|
|
|
'course_type' => '课程体系',
|
|
|
|
'course_name' => '课程名称',
|
|
|
|
'course_name' => '课程名称',
|
|
|
|
@ -844,7 +881,7 @@ class OtherController extends CommonController
|
|
|
|
// 年份范围内被投企业明细 - 所有年份范围内被投企业,关联学员、课程信息
|
|
|
|
// 年份范围内被投企业明细 - 所有年份范围内被投企业,关联学员、课程信息
|
|
|
|
// 数据结构:主表是公司,子数据是学员信息
|
|
|
|
// 数据结构:主表是公司,子数据是学员信息
|
|
|
|
// 导出时:公司信息只在第一行显示,后续行公司信息为空
|
|
|
|
// 导出时:公司信息只在第一行显示,后续行公司信息为空
|
|
|
|
$companiesData = CourseSign::companyInvestedYear($start_date, $end_date, $course_ids->toArray(), true);
|
|
|
|
$companiesData = CourseSign::companyInvestedYear($start_date, $end_date, $course_ids, true);
|
|
|
|
|
|
|
|
|
|
|
|
foreach ($companiesData as $item) {
|
|
|
|
foreach ($companiesData as $item) {
|
|
|
|
$company = $item['company'];
|
|
|
|
$company = $item['company'];
|
|
|
|
|