public function task() { $loginService = D('Login', 'Service')->getuserInfo(); //user $staffUser = M('ScheduleStaff'); $attr = getdaykey(NOW_TIME); $staffname = $staffUser->where('area = "%s" and status = 1 and %s =1', $loginService['area'], $attr)->select(); $staffRegister = M('StaffRegister'); $staffreg = $staffRegister->where('time = "%s" and area = "%s"', date('Y-m-d', NOW_TIME), $loginService['area'])->select(); $reg_leave = count($staffname) - count($staffreg); $this->assign('reg_sum', $reg_leave); $reg_percent = round((1 - $reg_leave / count($staffname)) * 100); $this->assign('reg_percent', $reg_percent); $this->assign('reg_color', getpercentcolor($reg_percent)); $this->assign('reg_all', count($staffname)); $staffVacation = D('StaffVacationUserView'); $staffvac = $staffVacation->where('status = 0 and area = "%s"', $loginService['area'])->select(); $this->assign('vac_sum', count($staffvac)); $staffDimission = D('DimissionUserView'); $staffdim = $staffDimission->where('status = 0 and area = "%s"', $loginService['area'])->select(); $this->assign('dim_sum', count($staffdim)); $homeApply = D('ApplyView'); $homeapp = $homeApply->where('a_status = 0 and area = "%s"', $loginService['area'])->select(); $this->assign('app_sum', count($homeapp)); $this->assign('task_sum', $reg_leave + count($staffvac) + count($staffdim) + count($homeapp)); $this->display('QuickInfo:task'); }
public function task() { $loginService = D('Login', 'Service')->getuserInfo(); //user $staffUser = M('ScheduleStaff'); $attr = getdaykey(NOW_TIME); $staffname = $staffUser->where('uname = "%s" and area = "%s" and status = 1 and %s =1', $loginService['cname'], $loginService['area'], $attr)->select(); $staffRegister = M('StaffRegister'); $staffreg = $staffRegister->where('uname = "%s" and time = "%s"', $loginService['cname'], date('Y-m-d', NOW_TIME))->select(); $this->assign('reg_sum', count($staffname) - count($staffreg)); $this->assign('reg_info', $staffreg); $serviceCard = M('ServiceCard'); $servicecardinfo = $serviceCard->where('status = 0 and area = "%s"', $loginService['area'])->select(); $this->assign('service_sum', count($servicecardinfo)); $CardRepair = M('ServiceRepair'); $repairsum = 0; foreach ($servicecardinfo as $key => $value) { $repairsum += count($CardRepair->where('servicecard_id = %d and operator="%s"', $value['id'], $loginService['cname'])->select()); } $service_leave = count($servicecardinfo) - $repairsum; $this->assign('service_leave', $service_leave); $ser_percent = round((1 - $repairsum / count($servicecardinfo)) * 100); $this->assign('ser_percent', $ser_percent); $this->assign('ser_color', getpercentcolor($ser_percent)); $Suggest = M('Suggest'); $sug = $Suggest->where('status = 0 and area = "%s"', $loginService['area'])->select(); $this->assign('sug_sum', count($sug)); $this->assign('task_sum', $service_leave + count($staffname) - count($staffreg) + count($sug)); $this->display('QuickInfo:task'); }