|
@@ -921,6 +921,107 @@ class HolidayController extends DooController {
|
|
|
$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;
|