|
@@ -186,6 +186,94 @@ class HolidayController extends DooController {
|
|
|
$data ['holidaymenu'] = 'borad';
|
|
|
$data ['staff'] = $this->staff;
|
|
|
$data['noindexjs'] = 'noindexjs';
|
|
|
+
|
|
|
+ //公司每日考勤内容
|
|
|
+ if($hstaffmsg['isadmin'] == 1 || $hstaffmsg['iscc'] == 1){
|
|
|
+ $data['youcantseeme'] = 0;
|
|
|
+ //今日请假人员,区分总部和办事处
|
|
|
+ Doo::loadModel('staff');
|
|
|
+ $staff = new staff();
|
|
|
+ $headquarters = $branch = $leaves = array();
|
|
|
+ $today = date('Y-m-d',time());
|
|
|
+ $data['today'] = date('m月d日',time());
|
|
|
+ //短假的
|
|
|
+ $hdayarr = $hday->find(array('where' => 'daytime=?', 'param' => array($today), 'asArray' => TRUE));
|
|
|
+ if(!empty($hdayarr)){
|
|
|
+ foreach($hdayarr as $hk => $hv){
|
|
|
+ $onearr = array();
|
|
|
+ $onehmsg = $holiday->getOne(array('where' => 'id=?', 'param' => array($hv['hid']), 'asArray' => TRUE));
|
|
|
+ $staffmsg = $staff->getOne(array('where' => 'sid=?', 'param' => array($hv['uid']), 'asArray' => TRUE));
|
|
|
+ $onearr['type'] = $type->getTypeNamebyid($onehmsg['type']);
|
|
|
+ $onearr['staff'] = $staffmsg['username'];
|
|
|
+ $onearr['day'] = floatval($onehmsg['daynum']);
|
|
|
+ if($staffmsg['cid'] == 12){
|
|
|
+ array_push($headquarters,$onearr);
|
|
|
+ }else{
|
|
|
+ array_push($branch,$onearr);
|
|
|
+ }
|
|
|
+ array_push($leaves,$hv['uid']);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //长假的
|
|
|
+ $hdayarr2 = $holiday->find(array('where' => 'status=1 and type in (6,7,8,9) and UNIX_TIMESTAMP(starttime)<=UNIX_TIMESTAMP(?) and UNIX_TIMESTAMP(endtime)>=UNIX_TIMESTAMP(?)', 'param' => array($today,$today), 'asArray' => TRUE));
|
|
|
+ if(!empty($hdayarr2)){
|
|
|
+ foreach($hdayarr2 as $hk2 => $hv2){
|
|
|
+ $onearr = array();
|
|
|
+ $staffmsg = $staff->getOne(array('where' => 'sid=?', 'param' => array($hv2['uid']), 'asArray' => TRUE));
|
|
|
+ $onearr['type'] = $type->getTypeNamebyid($hv2['type']);
|
|
|
+ $onearr['staff'] = $staffmsg['username'];
|
|
|
+ $onearr['day'] = floatval($hv2['daynum']);
|
|
|
+ if($staffmsg['cid'] == 12){
|
|
|
+ array_push($headquarters,$onearr);
|
|
|
+ }else{
|
|
|
+ array_push($branch,$onearr);
|
|
|
+ }
|
|
|
+ array_push($leaves,$hv2['uid']);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $data['headquarters'] = $headquarters;
|
|
|
+ $data['branch'] = $branch;
|
|
|
+
|
|
|
+ //今天在勤人员名单
|
|
|
+ $hqstaffarr = $staff->find(array('where' => 'cid=12 and departmentID=0', 'asArray' => TRUE));
|
|
|
+ $onlinehq = array();
|
|
|
+ foreach($hqstaffarr as $hqk => $hqv){
|
|
|
+ if(!in_array($hqv['sid'],$leaves)){
|
|
|
+ array_push($onlinehq,$hqv['username']);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $onlinebr = array();
|
|
|
+ Doo::loadModel('L_category');
|
|
|
+ $lcate = new L_category();
|
|
|
+ $catearr = $lcate->find(array('where' => 'cid!=34', 'asArray' => TRUE));
|
|
|
+ foreach($catearr as $ck => $cv){
|
|
|
+ if($cv['cid'] == 12){
|
|
|
+ $brstaffarr = $staff->find(array('where' => 'cid=? and departmentID=1', 'param' => array($cv['cid']), 'asArray' => TRUE));
|
|
|
+ }else{
|
|
|
+ $brstaffarr = $staff->find(array('where' => 'cid=?', 'param' => array($cv['cid']), 'asArray' => TRUE));
|
|
|
+ }
|
|
|
+ $brsarr = array();
|
|
|
+ if(!empty($brstaffarr)){
|
|
|
+ foreach($brstaffarr as $brk => $brv){
|
|
|
+ if(!in_array($brv['sid'],$leaves)) {
|
|
|
+ array_push($brsarr, $brv['username']);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $brstaffstr = !empty($brsarr) ? implode('、', $brsarr) : '';
|
|
|
+ $title = $cv['cid'] == 12 ? '总部-造价研究中心' : $cv['title'];
|
|
|
+ $onebrarr = array('title' => $title,'online' => $brstaffstr);
|
|
|
+ array_push($onlinebr,$onebrarr);
|
|
|
+ }
|
|
|
+// var_dump($onlinebr);
|
|
|
+// $brstaffarr = $staff->find(array('where' => ''));
|
|
|
+ $data['onlineheadquarters'] = implode('、',$onlinehq);
|
|
|
+ $data['onlinebranch'] = $onlinebr;
|
|
|
+
|
|
|
+// var_dump(array_unique($leaves));
|
|
|
+ }else{
|
|
|
+ $data['youcantseeme'] = 1;
|
|
|
+ }
|
|
|
$this->render ( "/holiday-borad", $data );
|
|
|
}
|
|
|
|
|
@@ -827,6 +915,120 @@ class HolidayController extends DooController {
|
|
|
exit(json_encode(array('code' => 400)));
|
|
|
}
|
|
|
|
|
|
+ public function holidayAttendance(){
|
|
|
+ $checkadmin = $this->checkisadmin();
|
|
|
+ if($checkadmin){
|
|
|
+ $data['cansee'] = 1;
|
|
|
+ }
|
|
|
+
|
|
|
+ Doo::loadModel('holidayday');
|
|
|
+ Doo::loadModel('holiday');
|
|
|
+ Doo::loadModel('holidaystaff');
|
|
|
+ Doo::loadModel('holidaytype');
|
|
|
+ Doo::loadModel('staff');
|
|
|
+ $hday = new HDay();
|
|
|
+ $holiday = new Holiday();
|
|
|
+ $hstaff = new HStaff();
|
|
|
+ $type = new HType();
|
|
|
+ $staff = new staff();
|
|
|
+
|
|
|
+ $sqlstr = '';
|
|
|
+ $pagestr = '';
|
|
|
+ if(isset($this->params['day'])){
|
|
|
+ $today = $this->params['day'];
|
|
|
+ $todayarr = explode('~',$today);
|
|
|
+ if(count($todayarr) != 2){
|
|
|
+ $sqlstr .= ' and ((UNIX_TIMESTAMP(starttime)<=UNIX_TIMESTAMP("'.$todayarr[0].'") and UNIX_TIMESTAMP(endtime)>=UNIX_TIMESTAMP("'.$todayarr[0].'")) OR (id in (select hid From `holiday_day` where daytime="'.$todayarr[0].'")))';
|
|
|
+ }else{
|
|
|
+ $sqlstr .= ' and ((UNIX_TIMESTAMP(starttime)<=UNIX_TIMESTAMP("'.$todayarr[0].'") and UNIX_TIMESTAMP(endtime)>=UNIX_TIMESTAMP("'.$todayarr[0].'")) OR (UNIX_TIMESTAMP(starttime)<=UNIX_TIMESTAMP("'.$todayarr[1].'") and UNIX_TIMESTAMP(endtime)>=UNIX_TIMESTAMP("'.$todayarr[1].'")) OR (id in (select hid From `holiday_day` where UNIX_TIMESTAMP(daytime) between UNIX_TIMESTAMP("'.$todayarr[0].'") and UNIX_TIMESTAMP("'.$todayarr[1].'"))))';
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ $today = date('Y-m-d',time());
|
|
|
+ $sqlstr .= ' and ((UNIX_TIMESTAMP(starttime)<=UNIX_TIMESTAMP("'.$today.'") and UNIX_TIMESTAMP(endtime)>=UNIX_TIMESTAMP("'.$today.'")) OR (id in (select hid from `holiday_day` where daytime="'.$today.'")))';
|
|
|
+ }
|
|
|
+ $pagestr .= '/day/'.$today;
|
|
|
+ $data['today'] = $today;
|
|
|
+
|
|
|
+ if(isset($this->params['cate'])){
|
|
|
+ $cate = 'headquarters';
|
|
|
+ $pagestr .= '/cate/'.$cate;
|
|
|
+ $data['cate'] = 1;
|
|
|
+ $sqlstr .= ' and uid in (select sid from `CLD_staff` where cid=12 and departmentID=0)';
|
|
|
+ }else{
|
|
|
+ $data['cate'] = 0;
|
|
|
+ }
|
|
|
+ $data['typeurl'] = $pagestr;
|
|
|
+ if(isset($this->params['type'])){
|
|
|
+ $data['type'] = $this->params['type'];
|
|
|
+ $pagestr .= '/type/'.$this->params['type'];
|
|
|
+ if($this->params['type'] == 4 ){//加班、值班
|
|
|
+ $sqlstr .= ' and (type=4 or type=5)';
|
|
|
+ }elseif($this->params['type'] == 6){//其他长假
|
|
|
+ $sqlstr .= ' and type in(3,6,7,8,9)';
|
|
|
+ }else{
|
|
|
+ $sqlstr .= ' and type='.$this->params['type'];
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ $data['type'] = '';
|
|
|
+ }
|
|
|
+
|
|
|
+ Doo::loadHelper('DooPager');
|
|
|
+ $totalArchive = $holiday->count(array('where' => 'status=1'.$sqlstr, 'asArray' => TRUE));
|
|
|
+ $pager = new DooPager(Doo::conf()->APP_URL . "holidayattendance".$pagestr."/page", $totalArchive, 10, 10);
|
|
|
+ if (isset($this->params['pindex']))
|
|
|
+ $pager->paginate(intval($this->params['pindex']));
|
|
|
+ else
|
|
|
+ $pager->paginate(1);
|
|
|
+ if ($pager->limit != ' -10,10')
|
|
|
+ $holidaymsg = $holiday->find(array('where' => 'status=1'.$sqlstr, 'limit' => $pager->limit, 'asArray' => TRUE));
|
|
|
+ if(isset($holidaymsg) && !empty($holidaymsg)){
|
|
|
+ foreach($holidaymsg as $k => $v){
|
|
|
+ $staffmsg = $staff->getOne(array('where' => 'sid=?', 'param' => array($v['uid']), 'asArray' => TRUE));
|
|
|
+ $holidaymsg[$k]['username'] = $staffmsg['username'];
|
|
|
+ $holidaymsg[$k]['category'] = $staffmsg['cid'] == 12 && $staffmsg['departmentID'] == 1 ? '总部(造价研究中心)' : $staffmsg['category'];
|
|
|
+ $holidaymsg[$k]['typename'] = $type->getTypeNamebyid($v['type']);
|
|
|
+ $holidaymsg[$k]['daynum'] = floatval($v['daynum']);
|
|
|
+ $holidaymsg[$k]['approvetime'] = !empty($v['approvetime']) ? date('Y-m-d H:i:s',$v['approvetime']) : '';
|
|
|
+ $msg = '';
|
|
|
+ if(in_array($v['type'],array(1,2,3,4,5,10,11,12))){
|
|
|
+ $dayjson = json_decode($v['dayjson']);
|
|
|
+ if($v['type'] != 11){
|
|
|
+ $holidaydays = $this->geyDayMsg($dayjson->holiday);
|
|
|
+ foreach($holidaydays as $hk => $hv){
|
|
|
+ $msg .= $hv['daytime'].' '.$hv['daymsg'].',';
|
|
|
+ }
|
|
|
+ $msg = substr($msg,0,strlen($msg)-1);
|
|
|
+ }else{
|
|
|
+ $msg .= '休假时间:';
|
|
|
+ $holidaydays = $this->geyDayMsg($dayjson->holiday);
|
|
|
+ foreach($holidaydays as $hk => $hv){
|
|
|
+ $msg .= $hv['daytime'].' '.$hv['daymsg'].',';
|
|
|
+ }
|
|
|
+ $msg = substr($msg,0,strlen($msg)-1);
|
|
|
+ $msg .= '<br>加班时间:';
|
|
|
+ $overtimedays = $this->geyDayMsg($dayjson->overtime);
|
|
|
+ foreach($overtimedays as $ok => $ov){
|
|
|
+ $msg .= $ov['daytime'].' '.$ov['daymsg'].',';
|
|
|
+ }
|
|
|
+ $msg = substr($msg,0,strlen($msg)-1);
|
|
|
+ }
|
|
|
+ }elseif(in_array($v['type'],array(6,7,8,9))){
|
|
|
+ $msg .= $v['starttime']. ' 至 '.$v['endtime'];
|
|
|
+ }elseif(in_array($v['type'],array(13,14,15,16,17,18,19))){
|
|
|
+ $msg .= date('Y-m-d H:i:s',$v['addtime']);
|
|
|
+ }
|
|
|
+ $holidaymsg[$k]['daymsg'] = $msg;
|
|
|
+ }
|
|
|
+ $data['holidaylist'] = $holidaymsg;
|
|
|
+ }
|
|
|
+ $data['pager'] = $pager->output;
|
|
|
+ $data ['memu'] = 'holiday';
|
|
|
+ $data ['holidaymenu'] = 'borad';
|
|
|
+ $data ['staff'] = $this->staff;
|
|
|
+ $data['noindexjs'] = 'noindexjs';
|
|
|
+ $this->render ( "/holiday-allList2", $data );
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
private function geyDayMsg($dayjson){
|
|
|
$holidayday = array();
|