diff --git a/app/chengji/controller/Index.php b/app/chengji/controller/Index.php index 0aabdc47..0de1690b 100755 --- a/app/chengji/controller/Index.php +++ b/app/chengji/controller/Index.php @@ -391,7 +391,7 @@ class Index extends AdminBase $sheet->setCellValue($colname[$colBiankuang] . '11', $temp['cj']['all']['avg']); $sheet->mergeCells($colname[$colBiankuang] . '11:' . $colname[$colcnt - 1] . '11'); $sheet->setCellValue($colname[$colBiankuang - 1] . '12', '全科及格率%'); - $sheet->setCellValue($colname[$colBiankuang] . '12', $temp['cj']['all']['jige']); + $sheet->setCellValue($colname[$colBiankuang] . '12', $temp['cj']['all']['jigelv']); $sheet->mergeCells($colname[$colBiankuang] . '12:' . $colname[$colcnt - 1] . '12'); $sheet->getStyle($colname[$colBiankuang - 1] . '3:' . $colname[$colcnt - 1] . '12')->applyFromArray($styleArrayJZ); $sheet->getStyle($colname[$colBiankuang - 1] . '3:' . $colname[$colcnt - 1] . '12')->applyFromArray($styleArrayBK); diff --git a/app/chengji/model/Tongji.php b/app/chengji/model/Tongji.php index 6dcbdad4..9f1f950c 100755 --- a/app/chengji/model/Tongji.php +++ b/app/chengji/model/Tongji.php @@ -107,12 +107,14 @@ class Tongji extends BaseModel $temp['avg'] = round($temp['avg'], 2); $temp['max'] = max($cjcol); $temp['min'] = min($cjcol); - $temp['youxiu'] = null; - $temp['jige'] = $this->rateAll($cj, $subject); #全科及格率 + $temp['youxiu'] = $this->rateAll($cj, $subject, 'youxiu'); + $temp['jige'] = $this->rateAll($cj, $subject, 'jige'); #全科及格率 $temp['sifenwei'] = $this->myquartile($cjcol); $temp['zhongshu'] = $this->zhongshu($cjcol); $temp['zhongweishu'] = $this->zhongweishu($cjcol); $temp['defenlv'] = round($temp['defenlv'] * 100, 2); + $temp['youxiulv'] = round($temp['youxiu'] / $temp['xkcnt'] * 100, 2); + $temp['jigelv'] = round($temp['jige'] / $temp['xkcnt'] * 100, 2); } $data['cj']['all'] = $temp; @@ -134,7 +136,7 @@ class Tongji extends BaseModel // 全科及格率 - public function rateAll($cj = array(), $sbj = array()) + public function rateAll($cj = array(), $sbj = array(), $category = 'jige') { $jige = 0; # 总及格人数 $row = 0; #记录有成绩的学生数 @@ -146,7 +148,7 @@ class Tongji extends BaseModel // 开始循环这个学生的每个学科成绩 foreach ($sbj as $k => $val) { if (isset($value[$val['lieming']])) { - if ($value[$val['lieming']] >= $val['fenshuxian']['jige']) { + if ($value[$val['lieming']] >= $val['fenshuxian'][$category]) { $temjige ++; } if ($value[$val['lieming']] !== null) {