示例#1
0
 /**
  * 列出学生综合成绩单
  * @author FuRongxin
  * @date    2016-02-05
  * @version 2.0
  * @return  JSON 学生成绩单
  */
 public function listing()
 {
     $scores = Score::with(['term' => function ($query) {
         $query->select('dm', 'mc');
     }])->with(['platform' => function ($query) {
         $query->select('dm', 'mc');
     }])->with(['property' => function ($query) {
         $query->select('dm', 'mc');
     }])->with(['mode' => function ($query) {
         $query->select('dm', 'mc');
     }])->with(['exstatus' => function ($query) {
         $query->select('dm', 'mc');
     }])->with(['course' => function ($query) {
         $query->select('kch', 'kcmc');
     }])->whereXh(Auth::user()->xh)->orderBy('nd', 'desc')->orderBy('xq', 'desc')->orderBy('kch', 'asc');
     return Datatables::of($scores)->editColumn('kcmc', function ($score) {
         return '<a href="' . url('score', $score->kch) . '">' . $score->course->kcmc . '</a>';
     })->setRowClass(function ($score) {
         return $score->cj < config('constants.score.passline') ? 'danger' : '';
     })->make(true);
 }
示例#2
0
 /**
  * 显示可录入成绩学生名单
  * @author FuRongxin
  * @date    2016-03-19
  * @version 2.0
  * @param  	string $kcxh 12位课程序号
  * @return  \Illuminate\Http\Response 学生名单
  */
 public function edit($kcxh)
 {
     $course = Mjcourse::whereNd(session('year'))->whereXq(session('term'))->whereKcxh($kcxh)->firstOrFail();
     $task = Task::whereKcxh($kcxh)->whereNd(session('year'))->whereXq(session('term'))->whereJsgh(Auth::user()->jsgh)->firstOrFail();
     $ratios = [];
     $items = Ratio::whereFs($task->cjfs)->orderBy('id')->get();
     foreach ($items as $ratio) {
         $ratios[] = ['id' => $ratio->id, 'name' => $ratio->idm, 'value' => $ratio->bl];
     }
     $exists = Score::whereNd(session('year'))->whereXq(session('term'))->whereKcxh($course->kcxh)->whereTjzt(config('constants.score.uncommitted'))->exists();
     $statuses = Status::orderBy('dm')->get()->filter(function ($status) {
         return config('constants.score.deferral') != $status->dm && config('constants.score.retake') != $status->dm;
     });
     $noScoreStudents = Selcourse::whereNd(session('year'))->whereXq(session('term'))->whereKcxh($kcxh)->whereNotExists(function ($query) {
         $query->from('cj_web')->whereRaw('t_cj_web.nd = t_xk_xkxx.nd AND t_cj_web.xq = t_xk_xkxx.xq AND t_cj_web.kcxh = t_xk_xkxx.kcxh AND t_cj_web.xh = t_xk_xkxx.xh');
     })->get();
     if (count($noScoreStudents)) {
         foreach ($noScoreStudents as $student) {
             $score = new Score();
             $score->xh = $student->xh;
             $score->xm = $student->xm;
             $score->kcxh = $student->kcxh;
             $score->kcpt = $student->pt;
             $score->kcxz = $student->xz;
             $score->xl = $student->xl;
             $score->nd = $student->nd;
             $score->xq = $student->xq;
             $score->kh = $course->plan->kh;
             $score->zpcj = 0;
             $score->kszt = 0;
             // 考试状态:正常
             $score->zy = $student->zy;
             $score->tjzt = 0;
             // 提交状态:未提交
             $score->kkxy = $student->kkxy;
             for ($i = 1; $i <= 6; ++$i) {
                 $score->{'cj' . $i} = 0;
             }
             $score->save();
         }
     }
     $scoreNoStudents = Score::whereNd(session('year'))->whereXq(session('term'))->whereKcxh($kcxh)->whereNotExists(function ($query) {
         $query->from('xk_xkxx')->whereRaw('t_xk_xkxx.nd = t_cj_web.nd AND t_xk_xkxx.xq = t_cj_web.xq AND t_xk_xkxx.kcxh = t_cj_web.kcxh AND t_xk_xkxx.xh = t_cj_web.xh');
     })->select('nd', 'xq', 'xh', 'kcxh')->get();
     if (count($scoreNoStudents)) {
         foreach ($scoreNoStudents as $student) {
             $student->delete();
         }
     }
     $students = Score::with('status')->wherend(session('year'))->whereXq(session('term'))->whereKcxh($kcxh)->orderBy('xh')->get();
     $title = $course->college->mc . $course->nd . '年度' . $course->term->mc . '学期' . $course->kcxh . $course->plan->course->kcmc . '课程';
     return view('score.edit')->withTitle($title . '成绩录入')->withRatios($ratios)->withStudents($students)->withCourse($course)->withExists($exists)->withStatuses($statuses);
 }
示例#3
0
 /**
  * 列出选课情况交叉比较信息
  * @author FuRongxin
  * @date    2016-05-13
  * @version 2.1
  * @return  \Illuminate\Http\Response 选课交叉比较信息
  */
 public function match()
 {
     $credits = [];
     $plan_total = 0;
     $selected_total = 0;
     $score_total = 0;
     // 获取教学计划学分
     $plans = Plan::with(['course' => function ($query) {
         $query->select('kch', 'kcmc', 'kcywmc');
     }])->whereNj(Auth::user()->profile->nj)->whereZy(Auth::user()->profile->zy)->whereZsjj(Auth::user()->profile->zsjj)->orderBy('kch', 'asc')->get();
     foreach ($plans as $plan) {
         $credits[$plan->kch] = ['kch' => $plan->kch, 'kcmc' => $plan->course->kcmc, 'plan_credit' => $plan->zxf, 'selected_credit' => 0, 'score_credit' => 0];
         $plan_total += $plan->zxf;
     }
     // 获取选课学分
     $selects = Selcourse::with(['course' => function ($query) {
         $query->select('kch', 'kcmc', 'kcywmc');
     }])->whereXh(Auth::user()->xh)->orderBy('kch', 'asc')->get();
     foreach ($selects as $select) {
         if (array_key_exists($select->kch, $credits)) {
             $credits[$select->kch]['selected_credit'] = $select->xf;
         } else {
             $credits[$select->kch] = ['kch' => $select->kch, 'kcmc' => $select->course->kcmc, 'plan_credit' => 0, 'selected_credit' => $select->xf, 'score_credit' => 0];
         }
         $selected_total += $select->xf;
     }
     // 获取成绩学分
     $scores = Score::with(['course' => function ($query) {
         $query->select('kch', 'kcmc', 'kcywmc');
     }])->whereXh(Auth::user()->xh)->orderBy('kch', 'asc')->get();
     foreach ($scores as $score) {
         if (array_key_exists($score->kch, $credits)) {
             $credits[$score->kch]['score_credit'] = $score->xf;
         } else {
             $credits[$select->kch] = ['kch' => $score->kch, 'kcmc' => $score->course->kcmc, 'plan_credit' => 0, 'selected_credit' => 0, 'score_credit' => $score->xf];
         }
         $score_total += $score->xf;
     }
     $title = '选课学分交叉对比表';
     return view('course.match', compact('title', 'credits', 'plan_total', 'selected_total', 'score_total'));
 }