Explorar o código

3.15holiday完成提交

likeku %!s(int64=8) %!d(string=hai) anos
pai
achega
3fc709e2e0

+ 17 - 1
protected/config/routes.conf.php

@@ -366,7 +366,8 @@ $route['*']['/holidaygroup'] = array('AdminController', 'holidayGroup');
 $route['*']['/addholidayapprover'] = array('AdminController', 'addHolidayApprover');
 $route['*']['/delholidaygroup'] = array('AdminController', 'delHolidayGroup');
 $route['*']['/hcsgroup'] = array('AdminController', 'holidayCSGroup');
-$route['*']['/getstaffcategory'] = array('AdminController', 'getStaffCategory');
+$route['*']['/getstaffcategory'] = array('HolidayController', 'getStaffCategory');
+$route['*']['/getholidaystaff'] = array('HolidayController', 'getHolidayStaff');
 $route['*']['/addhcsgroup'] = array('AdminController', 'addHolidayCS');
 $route['*']['/delhcsgroup'] = array('AdminController', 'delHolidayCS');
 
@@ -376,5 +377,20 @@ $route['*']['/holidayallList/type/:type'] = array('HolidayController', 'allList'
 $route['*']['/holidayallList/page/:pindex'] = array('HolidayController', 'allList');
 $route['*']['/holidayallList/type/:type/page/:pindex'] = array('HolidayController', 'allList');
 
+$route['*']['/holidayclose'] = array('HolidayController', 'holidayClose');
+$route['*']['/holidayclose/year/:year/month/:month'] = array('HolidayController', 'holidayClose');
+$route['*']['/holidayclose2'] = array('HolidayController', 'holidayClose2');
+$route['*']['/holidayclose2/year/:year/month/:month'] = array('HolidayController', 'holidayClose2');
+
+$route['*']['/holidayovertime'] = array('HolidayController', 'holidayOvertime');
+$route['*']['/holidayovertime/:cid/year/:year/month/:month'] = array('HolidayController', 'holidayOvertime');
+$route['*']['/holidayovertime/year/:year/month/:month'] = array('HolidayController', 'holidayOvertime');
+$route['*']['/addholiday'] = array('HolidayController', 'addHoliday');
+$route['*']['/addholiday2'] = array('HolidayController', 'addHoliday2');
+
+$route['*']['/holidayvacation'] = array('HolidayController', 'holidayVacation');
+$route['*']['/holidayvacation/:cid'] = array('HolidayController', 'holidayVacation');
+$route['*']['/setstaffholiday'] = array('HolidayController', 'setStaffHoliday');
+
 
 ?>

+ 28 - 0
protected/controller/AdminController.php

@@ -1407,6 +1407,9 @@ class AdminController extends DooController {
 		}
 		Doo::loadModel('holidayacman');
 		$acman = new HACMan();
+		$idname = $acman->getOne(array('where' => 'id='.$_POST['approvalid'], 'asArray' => TRUE));
+		$idname = explode(',', $idname['idname']);
+
 		$acman->id = $_POST['approvalid'];
 		$acman->delete();
 
@@ -1414,6 +1417,31 @@ class AdminController extends DooController {
 		$acman2->type = $_POST['approvalid'];
 		$acman2->delete();
 
+		//删除管理员资格
+		$acman3 = new HACMan();
+		foreach($idname as $k => $v){
+			$same = 0;
+			$approverlist = $acman3->find(array('where' => 'idname like "%'.$v.'%" and type=0', 'asArray' => TRUE));
+			if(!empty($approverlist)){
+				foreach($approverlist as $ak => $av){
+					$aidname = explode(',', $av['idname']);
+					foreach($aidname as $ik => $iv){
+						if($iv == $v){
+							$same = 1;
+							break;
+						}
+					}
+				}
+			}
+			if($same == 0){
+				Doo::loadModel('holidaystaff');
+				$hstaff = new HStaff();
+				$hstaff->uid = $v;
+				$hstaff->isadmin = 0;
+				$hstaff->update();
+			}
+		}
+
 		return '/holidaygroup';
 	}
 

+ 584 - 14
protected/controller/HolidayController.php

@@ -31,20 +31,74 @@ class HolidayController extends DooController {
 
 	public function myList(){
 		Doo::loadModel('holidayday');
+		Doo::loadModel('holiday');
+		Doo::loadModel('holidaystaff');
 		$hday = new HDay();
-		$thisyear = date('Y',1572624000);
+		$holiday = new Holiday();
+		$hstaff = new HStaff();
+
+		$thisyear = date('Y',time());
+//		$thisyear = date('Y',1546358400);
 		$num = intval($thisyear)-2017;
 		$html = '';
+		$yearnum = isset($this->params['yearnum']) && is_numeric($this->params['yearnum']) ? $this->params['yearnum'] : '';
 		for($i = $num; $i >= 0; $i--){
-			$html .= '<option value="'.(2017+$i).'">'.(2017+$i).'</option>';
+			if($yearnum == (2017+$i)){
+				$html .= '<option value="'.(2017+$i).'" selected>'.(2017+$i).'</option>';
+			}else{
+				$html .= '<option value="'.(2017+$i).'">'.(2017+$i).'</option>';
+			}
 		}
 		$data['option'] = $html;
 		$yeartime = isset($this->params['yearnum']) && is_numeric($this->params['yearnum']) ? $this->getYearMonthTime($this->params['yearnum']) : $this->getYearMonthTime($thisyear);
-		$holidaymsg = array('shijia'=> array(), 'bingjia' => array(), 'jiaban' => array(), 'zhiban' => array(), 'buxiu' => array(), 'tiaoxiu' => array());
-		foreach(array(1,2,4,5,10,11) as $k => $v){
-			
+		//记录事,病,旷,加,值,补,调的信息
+		$holidaymsg = array('1'=> array(), '2' => array(), '3' => array(), '4' => array(), '5' => array(), '10' => array(), '11' => array());
+		foreach(array(1,2,3,4,5,10,11) as $k => $v){
+			$all = 0;
+			for($i = 0; $i < 12; $i++){
+				if($v == 11){
+					$typeholiday = $holiday->find(array('where' => 'status=1 and type='.$v.' and uid='.$this->staff[0]['sid'].' and addtime between '.$yeartime[$i]['starttime'].' and '.$yeartime[$i]['endtime'],'asArray' => TRUE));
+					$holidaymsg[$v][$i+1] = 0;
+					if(!empty($typeholiday)){
+						foreach($typeholiday as $tk => $tv){
+							$holidaymsg[$v][$i+1] += floatval($tv['daynum']);
+							$all += floatval($tv['daynum']);
+						}
+					}
+					$holidaymsg[$v][$i+1] = $holidaymsg[$v][$i+1] != 0 ? $holidaymsg[$v][$i+1] : '';
+				}else{
+					$typeholiday = $hday->find(array('where' => 'type='.$v.' and uid='.$this->staff[0]['sid'].' and UNIX_TIMESTAMP(daytime) between '.$yeartime[$i]['starttime'].' and '.$yeartime[$i]['endtime'],'asArray' => TRUE));
+					$holidaymsg[$v][$i+1] = 0;
+					if(!empty($typeholiday)){
+						foreach($typeholiday as $tk => $tv){
+							$holidaymsg[$v][$i+1] += floatval($tv['daymsg']);
+							$all += floatval($tv['daymsg']);
+						}
+					}
+					$holidaymsg[$v][$i+1] = $holidaymsg[$v][$i+1] != 0 ? $holidaymsg[$v][$i+1] : '';
+				}
+			}
+			$holidaymsg[$v]['all'] = $all != 0 ? $all : '';
 		}
 
+		$hstaffmsg = $hstaff->getOne(array('where' => 'uid='.$this->staff[0]['sid'], 'asArray' => TRUE));
+		$data['yearnum'] = floatval($hstaffmsg['yearnum']);
+		$data['overtimetnum'] = floatval($holidaymsg[4]['all'])+floatval($holidaymsg[5]['all']);
+		$data['addnum'] = floatval($hstaffmsg['addnum']);
+		$data['hunjianum'] = floatval($hstaffmsg['hunjianum']);
+		$data['chanjianum'] = floatval($hstaffmsg['chanjianum']);
+		$data['sangjianum'] = floatval($hstaffmsg['sangjianum']);
+		$data['gongjianum'] = floatval($hstaffmsg['gongjianum']);
+
+		$data['yearround'] = $this->getYearRoundtime($hstaffmsg['hadyear'],$this->staff[0]['hiredate']);
+
+
+
+//		var_dump($holidaymsg);
+//		exit;
+
+		$data['holidaymsg'] = $holidaymsg;
+
 		$data ['memu'] = 'holiday';
 		$data ['holidaymenu'] = 'mylist';
 		$data ['staff'] = $this->staff;
@@ -56,9 +110,8 @@ class HolidayController extends DooController {
 		Doo::loadModel('holidayday');
 		Doo::loadModel('holidaystaff');
 		Doo::loadModel('holidaytype');
-		$lastmonthstart = strtotime(date("Y-m-01",strtotime("last month")));
-		$lastmonthend = strtotime(date('Y-m-01',time()))-1;
-		$data['countmonth'] = date("Y年m月",strtotime("last month"));
+		$thismonth = $this->getMonthTime(date('Y-m-d',time()));
+		$data['countmonth'] = date("Y年m月",time());
 
 		$holiday = new Holiday();
 		$hday  = new HDay();
@@ -66,8 +119,8 @@ class HolidayController extends DooController {
 		$type = new HType();
 
 		$holidaycount =array();
-		foreach(array(1,2,4,5) as $k => $v){
-			$typeholiday = $hday->find(array('where' => 'type='.$v.' and uid='.$this->staff[0]['sid'].' and UNIX_TIMESTAMP(daytime) between '.$lastmonthstart.' and '.$lastmonthend,'asArray' => TRUE));
+		foreach(array(1,2,3,4,5) as $k => $v){
+			$typeholiday = $hday->find(array('where' => 'type='.$v.' and uid='.$this->staff[0]['sid'].' and UNIX_TIMESTAMP(daytime) between '.$thismonth['start'].' and '.$thismonth['end'],'asArray' => TRUE));
 			$holidaycount[$k] = 0;
 			if(!empty($typeholiday)){
 				foreach($typeholiday as $tk => $tv){
@@ -77,8 +130,8 @@ class HolidayController extends DooController {
 		}
 
 		$hstaffmsg = $hstaff->getOne(array('where' => 'uid='.$this->staff[0]['sid'], 'asArray' => TRUE));
-		$holidaycount[4] = floatval($hstaffmsg['yearnum']);
-		$holidaycount[5] = floatval($hstaffmsg['addnum']);
+		$holidaycount[5] = floatval($hstaffmsg['yearnum']);
+		$holidaycount[6] = floatval($hstaffmsg['addnum']);
 
 		$data['holidaycount'] = $holidaycount;
 
@@ -135,7 +188,7 @@ class HolidayController extends DooController {
 			if($this->params['type'] == 4 ){//加班、值班
 				$sql = ' and (type=4 or type=5)';
 			}elseif($this->params['type'] == 6){//其他长假
-				$sql = ' and type in(6,7,8,9)';
+				$sql = ' and type in(3,6,7,8,9,12,13)';
 			}else{
 				$sql = ' and type='.$this->params['type'];
 			}
@@ -184,8 +237,10 @@ class HolidayController extends DooController {
 						}
 						$msg = substr($msg,0,strlen($msg)-1);
 					}
-				}else{
+				}elseif(in_array($v['type'],array(6,7,8,9))){
 					$msg .= $v['starttime']. ' 至 '.$v['endtime'];
+				}elseif(in_array($v['type'],array(13,14))){
+					$msg .= date('Y-m-d H:i:s',$v['addtime']);
 				}
 				$holidaymsg[$k]['daymsg'] = $msg;
 			}
@@ -198,6 +253,499 @@ class HolidayController extends DooController {
 		$this->render ( "/holiday-allList", $data );
 	}
 
+	public function holidayClose(){
+	//获取办事处列表
+		Doo::loadModel('staff');
+		Doo::loadModel('holidaystaff');
+		Doo::loadModel('holidayday');
+		Doo::loadModel('holiday');
+		$staff = new staff();
+		$hstaff = new HStaff();
+		$hday = new HDay();
+		$holiday = new Holiday();
+
+		$sql = 'SELECT `CLD_L_category`.cid,`CLD_L_category`.title,count(`CLD_staff`.sid) as count FROM `CLD_L_category` left join `CLD_staff` on `CLD_L_category`.cid=`CLD_staff`.cid where `CLD_staff`.nature=1 group by `CLD_staff`.cid HAVING count(`CLD_staff`.sid)>0 order by count(`CLD_staff`.sid) desc';
+		$query = Doo::db ()->query ( $sql );
+		$result = $query->fetchAll ();
+		$data['category'] = $result;
+
+
+		$thisyear = date('Y',time());
+//		$thisyear = date('Y',1546358400);
+		$data['thismonth'] = intval(date('m',time()));
+		$num = intval($thisyear)-2017;
+		$html = '';
+		$yearnum = isset($this->params['year']) && is_numeric($this->params['year']) ? $this->params['year'] : '';
+		for($i = $num; $i >= 0; $i--){
+			if($yearnum == (2017+$i)){
+				$html .= '<option value="'.(2017+$i).'" selected>'.(2017+$i).'</option>';
+			}else{
+				$html .= '<option value="'.(2017+$i).'">'.(2017+$i).'</option>';
+			}
+		}
+		$data['option'] = $html;
+		if(isset($this->params['year']) && isset($this->params['month'])){
+			$month = intval($this->params['month']) < 10 ? '0'.$this->params['month'] : $this->params['month'];
+			$date = $this->params['year'].'-'.$month.'-01';
+			$thismonth = $this->getMonthTime($date);
+			$data['thismonth'] = $this->params['month'];
+		}else{
+			$thismonth = $this->getMonthTime(date('Y-m-d',time()));
+		}
+
+		foreach($result as $k => $v){
+			$stafflist[$k]['categoryname'] = $v['title'];
+			$stafflist[$k]['count'] = $v['count'];
+			$cidstafflist = $staff->find(array('where' => 'cid='.$v['cid'].' and nature=1', 'asArray' => TRUE));
+			foreach($cidstafflist as $ck => $cv) {
+				foreach (array(1, 2, 3) as $tk => $tv) {
+					$typeholiday = $hday->find(array('where' => 'type=' . $tv . ' and uid=' . $cv['sid'] . ' and UNIX_TIMESTAMP(daytime) between ' . $thismonth['start'] . ' and ' . $thismonth['end'], 'asArray' => TRUE));
+					$cidstafflist[$ck][$tv] = 0;
+					if (!empty($typeholiday)) {
+						foreach ($typeholiday as $thk => $thv) {
+							$cidstafflist[$ck][$tv] += floatval($thv['daymsg']);
+						}
+					}
+					$cidstafflist[$ck][$tv] = $cidstafflist[$ck][$tv] != 0 ? $cidstafflist[$ck][$tv] : '';
+				}
+				$cidstafflist[$ck]['first'] = $ck == 0 ? 1 : ''; // 是否第一个
+			}
+			$stafflist[$k]['cidstafflist'] = $cidstafflist;
+		}
+
+		$data['stafflist'] = $stafflist;
+
+		$zongbu = $staff->find(array('where' => 'cid=12 and nature=1', 'asArray' => TRUE));
+		$data['zongbu'] = $zongbu;
+
+		$data ['memu'] = 'holiday';
+		$data ['holidaymenu'] = 'close';
+		$data ['staff'] = $this->staff;
+		$this->render ( "/holiday-close", $data );
+	}
+
+	public function holidayClose2(){
+		//获取办事处列表
+		Doo::loadModel('staff');
+		Doo::loadModel('holidaystaff');
+		Doo::loadModel('holidayday');
+		Doo::loadModel('holiday');
+		$staff = new staff();
+		$hstaff = new HStaff();
+		$hday = new HDay();
+		$holiday = new Holiday();
+
+		$sql = 'SELECT `CLD_L_category`.cid,`CLD_L_category`.title,count(`CLD_staff`.sid) as count FROM `CLD_L_category` left join `CLD_staff` on `CLD_L_category`.cid=`CLD_staff`.cid where `CLD_staff`.nature=2 group by `CLD_staff`.cid HAVING count(`CLD_staff`.sid)>0 order by count(`CLD_staff`.sid) desc';
+		$query = Doo::db ()->query ( $sql );
+		$result = $query->fetchAll ();
+		$data['category'] = $result;
+
+		$thisyear = date('Y',time());
+//		$thisyear = date('Y',1546358400);
+		$data['thismonth'] = intval(date('m',time()));
+		$num = intval($thisyear)-2017;
+		$html = '';
+		$yearnum = isset($this->params['year']) && is_numeric($this->params['year']) ? $this->params['year'] : '';
+		for($i = $num; $i >= 0; $i--){
+			if($yearnum == (2017+$i)){
+				$html .= '<option value="'.(2017+$i).'" selected>'.(2017+$i).'</option>';
+			}else{
+				$html .= '<option value="'.(2017+$i).'">'.(2017+$i).'</option>';
+			}
+		}
+		$data['option'] = $html;
+		if(isset($this->params['year']) && isset($this->params['month'])){
+			$month = intval($this->params['month']) < 10 ? '0'.$this->params['month'] : $this->params['month'];
+			$date = $this->params['year'].'-'.$month.'-01';
+			$thismonth = $this->getMonthTime($date);
+			$data['thismonth'] = $this->params['month'];
+		}else{
+			$thismonth = $this->getMonthTime(date('Y-m-d',time()));
+		}
+
+		$stafflist = array();
+		foreach($result as $k => $v){
+			$stafflist[$k]['categoryname'] = $v['title'];
+			$stafflist[$k]['count'] = $v['count'];
+			$cidstafflist = $staff->find(array('where' => 'cid='.$v['cid'].' and nature=2', 'asArray' => TRUE));
+			foreach($cidstafflist as $ck => $cv) {
+				foreach (array(1, 2, 3, 14) as $tk => $tv) {
+					if($tv == 14){
+						$typeholiday = $holiday->getOne(array('where' => 'status=1 and type='.$tv.' and uid='.$cv['sid'].' and starttime="'.$thismonth['start'].'" and endtime="'.$thismonth['end'].'"', 'desc' => 'id', 'asArray' => TRUE));
+						$cidstafflist[$ck][$tv] = $typeholiday['daynum'] != 0 ? floatval($typeholiday['daynum']) : '';
+					}else{
+						$typeholiday = $hday->find(array('where' => 'type=' . $tv . ' and uid=' . $cv['sid'] . ' and UNIX_TIMESTAMP(daytime) between ' . $thismonth['start'] . ' and ' . $thismonth['end'], 'asArray' => TRUE));
+						$cidstafflist[$ck][$tv] = 0;
+						if (!empty($typeholiday)) {
+							foreach ($typeholiday as $thk => $thv) {
+								$cidstafflist[$ck][$tv] += floatval($thv['daymsg']);
+							}
+						}
+						$cidstafflist[$ck][$tv] = $cidstafflist[$ck][$tv] != 0 ? $cidstafflist[$ck][$tv] : '';
+					}
+				}
+				$cidstafflist[$ck]['first'] = $ck == 0 ? 1 : ''; // 是否第一个
+			}
+			$stafflist[$k]['cidstafflist'] = $cidstafflist;
+		}
+
+		$data['stafflist'] = $stafflist;
+
+		$data['internstafflist'] = $staff->find(array('where' => 'nature=2', 'asArray' => TRUE));
+
+		$data ['memu'] = 'holiday';
+		$data ['holidaymenu'] = 'close';
+		$data ['staff'] = $this->staff;
+		$this->render ( "/holiday-close2", $data );
+	}
+
+	public function addHoliday2(){
+		if(isset($_POST['uid']) && is_numeric($_POST['uid']) && isset($_POST['type']) && is_numeric($_POST['type'])){
+			Doo::loadModel('holiday');
+			$holiday = new Holiday();
+			if(in_array($_POST['type'],array(1,2,3))){
+				$day = $_POST['day'];
+				$dayjson = array('holiday' => [$day.'_1']);
+				$holiday->uid = $_POST['uid'];
+				$holiday->type = $_POST['type'];
+				$holiday->dayjson = json_encode($dayjson);
+				$holiday->daynum = 1.0;
+				$holiday->status = 1;
+				$holiday->addtime = time();
+				$holiday->approvetime = time();
+				$holiday->description = $_POST['description'];
+				$id = $holiday->insert();
+
+				Doo::loadModel('holidayday');
+				$hday = new HDay();
+				$hday->hid = $id;
+				$hday->uid = $_POST['uid'];
+				$hday->type = $_POST['type'];
+				$hday->daytime = $day;
+				$hday->daymsg = 1.0;
+				$hday->insert();
+				if(isset($_POST['close2'])){
+					return '/holidayclose2';
+				}else{
+					return '/holidayclose';
+				}
+			}elseif($_POST['type'] == 14){
+				$thismonth = $this->getMonthTime(date('Y-m-d',time()));
+				$holiday->uid = $_POST['uid'];
+				$holiday->type = $_POST['type'];
+				$holiday->starttime = $thismonth['start'];
+				$holiday->endtime = $thismonth['end'];
+				$holiday->daynum = $_POST['daynum'];
+				$holiday->status = 1;
+				$holiday->addtime = time();
+				$holiday->approvetime = time();
+				$holiday->description = $_POST['description'];
+				$holiday->insert();
+				return '/holidayclose2';
+			}
+		}
+		exit('添加事病假、旷工出错');
+	}
+
+	public function holidayOvertime(){
+		//获取办事处列表
+		Doo::loadModel('staff');
+		Doo::loadModel('holidaystaff');
+		Doo::loadModel('holidayday');
+		Doo::loadModel('holiday');
+		$staff = new staff();
+		$hstaff = new HStaff();
+		$hday = new HDay();
+		$holiday = new Holiday();
+
+		$sql = 'SELECT `CLD_L_category`.cid,`CLD_L_category`.title,count(`CLD_staff`.sid) as count FROM `CLD_L_category` left join `CLD_staff` on `CLD_L_category`.cid=`CLD_staff`.cid group by `CLD_staff`.cid HAVING count(`CLD_staff`.sid)>0 order by count(`CLD_staff`.sid) desc';
+		$query = Doo::db ()->query ( $sql );
+		$result = $query->fetchAll ();
+		$data['category'] = $result;
+
+		$thisyear = date('Y',time());
+//		$thisyear = date('Y',1546358400);
+		$data['thismonth'] = intval(date('m',time()));
+		$num = intval($thisyear)-2017;
+		$html = '';
+		$yearnum = isset($this->params['year']) && is_numeric($this->params['year']) ? $this->params['year'] : '';
+		for($i = $num; $i >= 0; $i--){
+			if($yearnum == (2017+$i)){
+				$html .= '<option value="'.(2017+$i).'" selected>'.(2017+$i).'</option>';
+			}else{
+				$html .= '<option value="'.(2017+$i).'">'.(2017+$i).'</option>';
+			}
+		}
+		$data['option'] = $html;
+		if(isset($this->params['year']) && isset($this->params['month'])){
+			$month = intval($this->params['month']) < 10 ? '0'.$this->params['month'] : $this->params['month'];
+			$date = $this->params['year'].'-'.$month.'-01';
+			$thismonth = $this->getMonthTime($date);
+			$data['thismonth'] = $this->params['month'];
+		}else{
+			$thismonth = $this->getMonthTime(date('Y-m-d',time()));
+		}
+
+		$stafflist = array();
+		if(isset($this->params['cid']) && is_numeric($this->params['cid'])){
+			$data['thiscid'] = $this->params['cid'];
+			foreach($result as $k => $v){
+				if($this->params['cid'] == $v['cid']){
+					$stafflist[0]['categoryname'] = $v['title'];
+					$stafflist[0]['count'] = $v['count'];
+					$cidstafflist = $staff->getStaffByCid($v['cid']);
+					foreach($cidstafflist as $ck => $cv){
+						$hstaffmsg = $hstaff->getOne(array('where' => 'uid='.$cv['sid'], 'asArray' => TRUE));
+						$cidstafflist[$ck]['addnum'] = $hstaffmsg['addnum'] != 0.0 ? floatval($hstaffmsg['addnum']) : '';
+						foreach(array(4,5,10,11) as $tk => $tv){
+							if($tv == 11){
+								$typeholiday = $holiday->find(array('where' => 'status=1 and type='.$tv.' and uid='.$cv['sid'].' and addtime between '.$thismonth['start'].' and '.$thismonth['end'],'asArray' => TRUE));
+								$cidstafflist[$ck][$tv] = 0;
+								if(!empty($typeholiday)){
+									foreach($typeholiday as $thk => $thv){
+										$cidstafflist[$ck][$tv] += floatval($thv['daynum']);
+									}
+								}
+								$cidstafflist[$ck][$tv] = $cidstafflist[$ck][$tv] != 0 ? $cidstafflist[$ck][$tv] : '';
+							}else{
+								$typeholiday = $hday->find(array('where' => 'type='.$tv.' and uid='.$cv['sid'].' and UNIX_TIMESTAMP(daytime) between '.$thismonth['start'].' and '.$thismonth['end'],'asArray' => TRUE));
+								$cidstafflist[$ck][$tv] = 0;
+								if(!empty($typeholiday)){
+									foreach($typeholiday as $thk => $thv){
+										$cidstafflist[$ck][$tv] += floatval($thv['daymsg']);
+									}
+								}
+								$cidstafflist[$ck][$tv] = $cidstafflist[$ck][$tv] != 0 ? $cidstafflist[$ck][$tv] : '';
+							}
+						}
+						$cidstafflist[$ck]['countnum'] = floatval($cidstafflist[$ck][4])+floatval($cidstafflist[$ck][5]) != 0 ? floatval($cidstafflist[$ck][4]) + floatval($cidstafflist[$ck][5]) : '';
+						$cidstafflist[$ck]['first'] = $ck == 0 ? 1 : ''; // 是否第一个
+					}
+					$stafflist[0]['cidstafflist'] = $cidstafflist;
+					break;
+				}
+			}
+		}else{
+			foreach($result as $k => $v){
+				$stafflist[$k]['categoryname'] = $v['title'];
+				$stafflist[$k]['count'] = $v['count'];
+				$cidstafflist = $staff->getStaffByCid($v['cid']);
+				foreach($cidstafflist as $ck => $cv) {
+					$hstaffmsg = $hstaff->getOne(array('where' => 'uid=' . $cv['sid'], 'asArray' => TRUE));
+					$cidstafflist[$ck]['addnum'] = $hstaffmsg['addnum'] != 0.0 ? floatval($hstaffmsg['addnum']) : '';
+					foreach (array(4, 5, 10, 11) as $tk => $tv) {
+						if ($tv == 11) {
+							$typeholiday = $holiday->find(array('where' => 'status=1 and type=' . $tv . ' and uid=' . $cv['sid'] . ' and addtime between ' . $thismonth['start'] . ' and ' . $thismonth['end'], 'asArray' => TRUE));
+							$cidstafflist[$ck][$tv] = 0;
+							if (!empty($typeholiday)) {
+								foreach ($typeholiday as $thk => $thv) {
+									$cidstafflist[$ck][$tv] += floatval($thv['daynum']);
+								}
+							}
+							$cidstafflist[$ck][$tv] = $cidstafflist[$ck][$tv] != 0 ? $cidstafflist[$ck][$tv] : '';
+						} else {
+							$typeholiday = $hday->find(array('where' => 'type=' . $tv . ' and uid=' . $cv['sid'] . ' and UNIX_TIMESTAMP(daytime) between ' . $thismonth['start'] . ' and ' . $thismonth['end'], 'asArray' => TRUE));
+							$cidstafflist[$ck][$tv] = 0;
+							if (!empty($typeholiday)) {
+								foreach ($typeholiday as $thk => $thv) {
+									$cidstafflist[$ck][$tv] += floatval($thv['daymsg']);
+								}
+							}
+							$cidstafflist[$ck][$tv] = $cidstafflist[$ck][$tv] != 0 ? $cidstafflist[$ck][$tv] : '';
+						}
+					}
+					$cidstafflist[$ck]['countnum'] = floatval($cidstafflist[$ck][4])+floatval($cidstafflist[$ck][5]) != 0 ? floatval($cidstafflist[$ck][4]) + floatval($cidstafflist[$ck][5]) : '';
+					$cidstafflist[$ck]['first'] = $ck == 0 ? 1 : ''; // 是否第一个
+				}
+				$stafflist[$k]['cidstafflist'] = $cidstafflist;
+			}
+		}
+
+		$data['stafflist'] = $stafflist;
+
+		$zongbu = $staff->getStaffByCid(12);
+		$data['zongbu'] = $zongbu;
+
+		$data ['memu'] = 'holiday';
+		$data ['holidaymenu'] = 'overtime';
+		$data ['staff'] = $this->staff;
+		$this->render ( "/holiday-overtime", $data );
+	}
+
+	public function addHoliday(){
+		if(isset($_POST['uid']) && is_numeric($_POST['uid']) && isset($_POST['type']) && is_numeric($_POST['type'])){
+			Doo::loadModel('holidaystaff');
+			Doo::loadModel('holiday');
+			$holiday = new Holiday();
+			$hstaff = new HStaff();
+			$hstaffmsg = $hstaff->getOne(array('where' => 'uid='.$_POST['uid'], 'asArray' => TRUE));
+			if($_POST['type'] == 4 || $_POST['type'] == 5){
+				$day = $_POST['day'];
+				$hstaff->uid = $_POST['uid'];
+				$hstaff->addnum = floatval($hstaffmsg['addnum'])+1;
+				$result = $hstaff->update();
+				if($result){
+					$dayjson = array('holiday' => [$day.'_1']);
+					$holiday->uid = $_POST['uid'];
+					$holiday->type = $_POST['type'];
+					$holiday->dayjson = json_encode($dayjson);
+					$holiday->daynum = 1.0;
+					$holiday->status = 1;
+					$holiday->addtime = time();
+					$holiday->approvetime = time();
+					$holiday->description = $_POST['description'];
+					$id = $holiday->insert();
+
+					Doo::loadModel('holidayday');
+					$hday = new HDay();
+					$hday->hid = $id;
+					$hday->uid = $_POST['uid'];
+					$hday->type = $_POST['type'];
+					$hday->daytime = $day;
+					$hday->daymsg = 1.0;
+					$hday->insert();
+
+					return '/holidayovertime';
+				}else{
+					exit('添加到holidaystaff出错');
+				}
+			}elseif($_POST['type'] == 13){
+				$daynum = $_POST['tixian'];
+				if($daynum > $hstaffmsg['addnum']){
+					exit('提现天数超过存假天数了');
+				}else{
+					$hstaff->uid = $_POST['uid'];
+					$hstaff->addnum = $hstaffmsg['addnum']-$daynum;
+					$result = $hstaff->update();
+					if($result){
+						$holiday->uid = $_POST['uid'];
+						$holiday->type = 13;
+						$holiday->daynum = $daynum;
+						$holiday->status = 1;
+						$holiday->addtime = time();
+						$holiday->approvetime = 1;
+						$holiday->description = $_POST['description'];
+						$holiday->insert();
+
+						return '/holidayovertime';
+					}else{
+						exit('添加到holidaystaff出错');
+					}
+				}
+			}
+		}
+		exit('添加加值班或提现出错');
+	}
+
+	public function holidayVacation(){
+
+		//获取办事处列表
+		Doo::loadModel('staff');
+		Doo::loadModel('holidaystaff');
+		$staff = new staff();
+		$hstaff = new HStaff();
+
+		$sql = 'SELECT `CLD_L_category`.cid,`CLD_L_category`.title,count(`CLD_staff`.sid) as count FROM `CLD_L_category` left join `CLD_staff` on `CLD_L_category`.cid=`CLD_staff`.cid group by `CLD_staff`.cid HAVING count(`CLD_staff`.sid)>0 order by count(`CLD_staff`.sid) desc';
+		$query = Doo::db ()->query ( $sql );
+		$result = $query->fetchAll ();
+		$data['category'] = $result;
+
+		$stafflist = array();
+		if(isset($this->params['cid']) && is_numeric($this->params['cid'])){
+			$data['thiscid'] = $this->params['cid'];
+			foreach($result as $k => $v){
+				if($this->params['cid'] == $v['cid']){
+					$stafflist[0]['categoryname'] = $v['title'];
+					$stafflist[0]['count'] = $v['count'];
+					$cidstafflist = $staff->getStaffByCid($v['cid']);
+					foreach($cidstafflist as $ck => $cv){
+						$hstaffmsg = $hstaff->getOne(array('where' => 'uid='.$cv['sid'], 'asArray' => TRUE));
+						$cidstafflist[$ck]['yearnum'] = $hstaffmsg['yearnum'] != 0.0 ? floatval($hstaffmsg['yearnum']) : '';
+						$cidstafflist[$ck]['addnum'] = $hstaffmsg['addnum'] != 0.0 ? floatval($hstaffmsg['addnum']) : '';
+						$cidstafflist[$ck]['hunjianum'] = $hstaffmsg['hunjianum'] != 0.0 ? floatval($hstaffmsg['hunjianum']) : '';
+						$cidstafflist[$ck]['chanjianum'] = $hstaffmsg['chanjianum'] != 0.0 ? floatval($hstaffmsg['chanjianum']) : '';
+						$cidstafflist[$ck]['sangjianum'] = $hstaffmsg['sangjianum'] != 0.0 ? floatval($hstaffmsg['sangjianum']) : '';
+						$cidstafflist[$ck]['gongjianum'] = $hstaffmsg['gongjianum'] != 0.0 ? floatval($hstaffmsg['gongjianum']) : '';
+						$cidstafflist[$ck]['yearround'] = $this->getYearRoundtime($hstaffmsg['hadyear'],$cv['hiredate']);
+						$cidstafflist[$ck]['first'] = $ck == 0 ? 1 : ''; // 是否第一个
+					}
+					$stafflist[0]['cidstafflist'] = $cidstafflist;
+					break;
+				}
+			}
+		}else{
+			foreach($result as $k => $v){
+				$stafflist[$k]['categoryname'] = $v['title'];
+				$stafflist[$k]['count'] = $v['count'];
+				$cidstafflist = $staff->getStaffByCid($v['cid']);
+				foreach($cidstafflist as $ck => $cv){
+					$hstaffmsg = $hstaff->getOne(array('where' => 'uid='.$cv['sid'], 'asArray' => TRUE));
+					$cidstafflist[$ck]['yearnum'] = $hstaffmsg['yearnum'] != 0.0 ? floatval($hstaffmsg['yearnum']) : '';
+					$cidstafflist[$ck]['addnum'] = $hstaffmsg['addnum'] != 0.0 ? floatval($hstaffmsg['addnum']) : '';
+					$cidstafflist[$ck]['hunjianum'] = $hstaffmsg['hunjianum'] != 0.0 ? floatval($hstaffmsg['hunjianum']) : '';
+					$cidstafflist[$ck]['chanjianum'] = $hstaffmsg['chanjianum'] != 0.0 ? floatval($hstaffmsg['chanjianum']) : '';
+					$cidstafflist[$ck]['sangjianum'] = $hstaffmsg['sangjianum'] != 0.0 ? floatval($hstaffmsg['sangjianum']) : '';
+					$cidstafflist[$ck]['gongjianum'] = $hstaffmsg['gongjianum'] != 0.0 ? floatval($hstaffmsg['gongjianum']) : '';
+					$cidstafflist[$ck]['yearround'] = $this->getYearRoundtime($hstaffmsg['hadyear'],$cv['hiredate']);
+					$cidstafflist[$ck]['first'] = $ck == 0 ? 1 : ''; // 是否第一个
+				}
+				$stafflist[$k]['cidstafflist'] = $cidstafflist;
+			}
+		}
+
+		$zongbu = $staff->getStaffByCid(12);
+		$data['zongbu'] = $zongbu;
+		$hstaff2 = new HStaff();
+		$hstaffmsg2 = $hstaff2->getOne(array('select' => 'yearnum', 'where' => 'uid='.$zongbu[0]['sid'], 'asArray' => TRUE));
+		$data['thisnum'] = floatval($hstaffmsg2['yearnum']);
+
+		$data['stafflist'] = $stafflist;
+
+		$data ['memu'] = 'holiday';
+		$data ['holidaymenu'] = 'vacation';
+		$data ['staff'] = $this->staff;
+		$this->render ( "/holiday-vacation", $data );
+	}
+
+	public function setStaffHoliday(){
+		if(isset($_POST['uid']) && is_numeric($_POST['uid']) && isset($_POST['typeholiday']) && isset($_POST['addnum'])){
+			Doo::loadModel('holidaystaff');
+			$hstaff = new HStaff();
+			$hstaffmsg = $hstaff->getOne(array('where' => 'uid='.$_POST['uid'], 'asArray' => TRUE));
+			$hstaff->uid = $_POST['uid'];
+			$hstaff->$_POST['typeholiday'] = $hstaffmsg[$_POST['typeholiday']]+$_POST['addnum'];
+			$hstaff->update();
+			return '/holidayvacation';
+		}else{
+			exit('增加出错');
+		}
+
+	}
+
+	public function getStaffCategory(){
+		if(isset($_POST['cid']) && is_numeric($_POST['cid'])){
+			Doo::loadModel('staff');
+			$staff = new staff();
+			$stafflist = $staff->getStaffByCid($_POST['cid']);
+			Doo::loadModel('holidaystaff');
+			$hstaff = new HStaff();
+			$hstaffmsg = $hstaff->getOne(array('select' => 'yearnum', 'where' => 'uid='.$stafflist[0]['sid'], 'asArray' => TRUE));
+			exit(json_encode(array('code' => 200, 'stafflist' => $stafflist, 'thisnum' => floatval($hstaffmsg['yearnum']))));
+		}
+		exit(json_encode(array('code' => 400)));
+	}
+
+	public function getHolidayStaff(){
+		if(isset($_POST['uid']) && is_numeric($_POST['uid']) && isset($_POST['type'])){
+			Doo::loadModel('holidaystaff');
+			$hstaff = new HStaff();
+			$staffmsg = $hstaff->getOne(array('select' => $_POST['type'], 'where' => 'uid='.$_POST['uid'], 'asArray' => TRUE));
+			exit(json_encode(array('code' => 200, 'thisnum' => floatval($staffmsg[$_POST['type']]))));
+		}
+		exit(json_encode(array('code' => 400)));
+	}
+
+
 	private function geyDayMsg($dayjson){
 		$holidayday = array();
 		foreach($dayjson as $dk => $dv){
@@ -210,6 +758,13 @@ class HolidayController extends DooController {
 		return $holidayday;
 	}
 
+	//获取某日期的月初月末时间戳
+	private function getMonthTime($time){
+		$starttime = strtotime(date('Y-m-01',strtotime($time)));
+		$endtime = strtotime("+1 months", strtotime(date('Y-m-01',strtotime($time))))-1;
+		return array('start' => $starttime, 'end' => $endtime);
+	}
+
 
 	//获取本年的每个月的时间戳
 	private function getYearMonthTime($thisyear){
@@ -225,6 +780,21 @@ class HolidayController extends DooController {
 		return $monthdata;
 	}
 
+	//获取本年当事人的年假周期
+	private function getYearRoundtime($hadyear,$hiredate){
+		$month = date('m', strtotime($hiredate));
+		$date = date('d', strtotime($hiredate));
+		$monthday = intval($month).'月'.intval($date).'日';
+		$year = date('Y',time());
+		if(strtotime($hiredate)+(86400*365*$hadyear) < time()){
+			$lastyear = intval($year)-1;
+			return intval($lastyear).'年'.$monthday.'~'.intval($year).'年'.$monthday;
+		}else{
+			$nextyear = intval($year)+1;
+			return intval($year).'年'.$monthday.'~'.intval($nextyear).'年'.$monthday;
+		}
+	}
+
 }
 
 ?>

+ 1 - 1
protected/model/holidaystaff.php

@@ -13,7 +13,7 @@ class HStaff extends DooModel {
 
 	public $_table = 'holiday_staff';
 	public $_primarykey = 'uid';
-	public $_fields = array ('uid', 'yearnum', 'hadyear', 'addnum', 'othernum', 'isadmin');
+	public $_fields = array ('uid', 'yearnum', 'hadyear', 'addnum', 'hunjianum', 'chanjianum', 'sangjianum', 'gongjianum', 'isadmin');
 
 	public function __construct() {
 		parent::setupModel(__CLASS__);

+ 4 - 4
protected/view/holiday-borad.html

@@ -20,7 +20,7 @@
 			<div class="adminContent autoHeight" style="height: 821px;">
 				<div class="saea-borad">
 					<div class="borad-menu">
-						<a href="invoice-addn.html" class="holiday">请假申请</a>
+						<a href="javascript:;" class="holiday" style="cursor: no-drop" disabled>请假申请</a>
 					</div>
 					<div class="borad-news">
 						<div class="saeaList">
@@ -28,9 +28,9 @@
 								<table class="table table-bordered table-condensed">
 									<tbody>
 									<tr><th class="taC" colspan="6">{{countmonth}}</th></tr>
-									<tr><th class="taC" width="120">事假</th><td>{{holidaycount.0}}</td><th class="taC" width="120">加班</th><td>{{holidaycount.2}}</td><th class="taC" width="120">年假(可用)</th><td>{{holidaycount.4}}</td></tr>
-									<tr><th class="taC">病假</th><td>{{holidaycount.1}}</td><th class="taC">值班</th><td>{{holidaycount.3}}</td><th class="taC">存假(可用)</th><td>{{holidaycount.5}}</td></tr>
-									<tr><th class="taC">旷工</th><td>0</td><th class="taC"> </th><td> </td><th class="taC"> </th><td> </td></tr>
+									<tr><th class="taC" width="120">事假</th><td>{{holidaycount.0}}</td><th class="taC" width="120">加班</th><td>{{holidaycount.3}}</td><th class="taC" width="120">年假(可用)</th><td>{{holidaycount.5}}</td></tr>
+									<tr><th class="taC">病假</th><td>{{holidaycount.1}}</td><th class="taC">值班</th><td>{{holidaycount.4}}</td><th class="taC">存假(可用)</th><td>{{holidaycount.6}}</td></tr>
+									<tr><th class="taC">旷工</th><td>{{holidaycount.2}}</td><th class="taC"> </th><td> </td><th class="taC"> </th><td> </td></tr>
 									</tbody>
 								</table>
 							</div>

+ 171 - 0
protected/view/holiday-close.html

@@ -0,0 +1,171 @@
+<!-- include 'header' -->
+<body>
+	<div class="mainLayout">
+		<div class="mainMenu">
+			<div class="menuItem">
+				<a href="#" class="mLogo">CLD</a>
+				<ul>
+					<!-- include 'menu' -->
+				</ul>
+			</div>
+		</div>
+		<div class="warpContent">
+			<div class="subMenu fL">
+				<div class="menuItem">
+					<ul>
+						<!-- include 'holiday_menu' -->
+					</ul>
+				</div>
+			</div>
+			<div class="adminContent autoHeight" style="height: 821px;">
+				<legend><div class="fR"><a class="button" href="#addClose" data-toggle="modal">结算登记</a></div>请假结算</legend>
+				<div class="demandCate">
+					<ul class="cateList">
+						<li><a href="/holidayclose" class="now">正式员工</a><a href="/holidayclose2">实习生</a></li>
+						<li>
+							<select id="year">
+								{{option}}
+							</select>
+							<select id="month">
+								<option value="1" <!-- if {{thismonth}} == 1 -->selected<!-- endif -->>1月</option>
+								<option value="2" <!-- if {{thismonth}} == 2 -->selected<!-- endif -->>2月</option>
+								<option value="3" <!-- if {{thismonth}} == 3 -->selected<!-- endif -->>3月</option>
+								<option value="4" <!-- if {{thismonth}} == 4 -->selected<!-- endif -->>4月</option>
+								<option value="5" <!-- if {{thismonth}} == 5 -->selected<!-- endif -->>5月</option>
+								<option value="6" <!-- if {{thismonth}} == 6 -->selected<!-- endif -->>6月</option>
+								<option value="7" <!-- if {{thismonth}} == 7 -->selected<!-- endif -->>7月</option>
+								<option value="8" <!-- if {{thismonth}} == 8 -->selected<!-- endif -->>8月</option>
+								<option value="9" <!-- if {{thismonth}} == 9 -->selected<!-- endif -->>9月</option>
+								<option value="10" <!-- if {{thismonth}} == 10 -->selected<!-- endif -->>10月</option>
+								<option value="11" <!-- if {{thismonth}} == 11 -->selected<!-- endif -->>11月</option>
+								<option value="12" <!-- if {{thismonth}} == 12 -->selected<!-- endif -->>12月</option>
+							</select>
+						</li>
+					</ul>
+	  			</div>
+				<div class="saeaList">
+					<div class="entry">
+						<table class="table table-bordered table-condensed table-hover">
+							<tbody>
+							<tr><th class="taC" width="50"></th><th class="taC">员工</th><th class="taC">事假</th><th class="taC">病假</th><th class="taC">旷工</th></tr>
+							<!-- loop stafflist -->
+							<!-- loop stafflist' value.cidstafflist -->
+							<tr>
+								<!-- if !empty({{stafflist' cidstafflist' value.first}}) -->
+								<th rowspan="{{stafflist' value.count}}">{{stafflist' value.categoryname}}</th>
+								<!-- endif -->
+								<th>{{stafflist' cidstafflist' value.username}}</th>
+								<td class="taC">{{stafflist' cidstafflist' value.1}}</td>
+								<td class="taC">{{stafflist' cidstafflist' value.2}}</td>
+								<td class="taC">{{stafflist' cidstafflist' value.3}}</td>
+							</tr>
+							<!-- endloop -->
+							<!-- endloop -->
+							</tbody>
+						</table>
+					</div>
+				</div>
+			</div>
+		</div>
+	</div>
+	<!--弹出-->
+<div class="modal hide fade" id="addClose">
+	<div class="modal-dialog ">
+		<div class="modal-content">
+	    <div class="modal-header">
+	    	<h3>结算登记</h3>
+	    </div>
+			<form method="post" action="/addholiday2" onsubmit="return addholiday();">
+				<div class="modal-body saeaList">
+					<table class="table table-bordered table-condensed">
+						<tbody>
+						<tr>
+							<th class="taC" width="100"><span class="colRed">*</span>员工</th>
+							<td>
+								<select disabled><option>正式员工</option></select>
+								<select id="category">
+									<!-- loop category -->
+									<option value="{{category' value.cid}}">{{category' value.title}}</option>
+									<!-- endloop -->
+								</select>
+								<select id="cidstaff" name="uid">
+									<!-- loop zongbu -->
+									<option value="{{zongbu' value.sid}}">{{zongbu' value.username}}</option>
+									<!-- endloop -->
+								</select>
+							</td>
+						</tr>
+						<tr>
+							<th class="taC" width="100"><span class="colRed">*</span>登记类型</th>
+							<td>
+								<select id="selecttype" name="type">
+									<option value="1">事假</option>
+									<option value="2">病假</option>
+									<option value="3">旷工</option>
+								</select>
+							</td>
+						</tr>
+						<tr>
+							<th class="taC" width="100"><span class="colRed">*</span><span id="holidaytype">事假</span>日期</th><td>
+							<input type="date" name="day" id="holidayday"></td>
+						</tr>
+						<tr>
+							<th class="taC" width="100">备注</th><td><textarea class="span4" name="description" placeholder="选填"></textarea></td>
+						</tr>
+						</tbody>
+					</table>
+				</div>
+				<div class="modal-footer">
+					<a href="#" class="button btn-gray" data-dismiss="modal" aria-hidden="true">取消</a>
+					<button type="submit" class="button">确定</button>
+				</div>
+			</form>
+		</div>
+	</div>
+</div>
+    <!--弹出内容-->
+<script type="text/javascript">autoFlashHeight();</script>
+<script>
+	$(function() {
+		$('#year').change(function(){
+			var html = '/year/'+$(this).val()+'/month/'+$('#month').val();
+			window.location.href = '/holidayclose' + html;
+		});
+
+		$('#month').change(function(){
+			var html = '/year/'+$('#year').val()+'/month/'+$(this).val();
+			window.location.href = '/holidayclose' + html;
+		});
+
+		$('#category').change(function(){
+			$.ajax({
+				type: 'post',
+				url: '/getstaffcategory',
+				data: {cid:$(this).val()},
+				dataType: 'json',
+				success: function(result){
+					if(result.code == 200){
+						$('#cidstaff').html('');
+						var html = '';
+						$.each(result.stafflist,function(k,v){
+							html +='<option value="'+v.sid+'">'+v.username+'</option>';
+						});
+						$('#cidstaff').html(html);
+					}
+				}
+			})
+		});
+		$('#selecttype').change(function(){
+			$('#holidaytype').text($(this).find("option:selected").text());
+		})
+	});
+
+	function addholiday(){
+		if($('#holidayday').val() == ''){
+			alert('请选择日期');
+			return false;
+		}
+	}
+</script>
+</body>
+</html>

+ 167 - 0
protected/view/holiday-close2.html

@@ -0,0 +1,167 @@
+<!-- include 'header' -->
+<body xmlns="http://www.w3.org/1999/html">
+	<div class="mainLayout">
+		<div class="mainMenu">
+			<div class="menuItem">
+				<a href="#" class="mLogo">CLD</a>
+				<ul>
+					<!-- include 'menu' -->
+				</ul>
+			</div>
+		</div>
+		<div class="warpContent">
+			<div class="subMenu fL">
+				<div class="menuItem">
+					<ul>
+						<!-- include 'holiday_menu' -->
+					</ul>
+				</div>
+			</div>
+			<div class="adminContent autoHeight" style="height: 821px;">
+				<legend><div class="fR"><a class="button" href="#addClose" data-toggle="modal">结算登记</a></div>请假结算</legend>
+				<div class="demandCate">
+					<ul class="cateList">
+	  					<li><a href="/holidayclose">正式员工</a><a href="/holidayclose2" class="now">实习生</a></li>
+						<li>
+							<select id="year">
+								{{option}}
+							</select>
+							<select id="month">
+								<option value="1" <!-- if {{thismonth}} == 1 -->selected<!-- endif -->>1月</option>
+								<option value="2" <!-- if {{thismonth}} == 2 -->selected<!-- endif -->>2月</option>
+								<option value="3" <!-- if {{thismonth}} == 3 -->selected<!-- endif -->>3月</option>
+								<option value="4" <!-- if {{thismonth}} == 4 -->selected<!-- endif -->>4月</option>
+								<option value="5" <!-- if {{thismonth}} == 5 -->selected<!-- endif -->>5月</option>
+								<option value="6" <!-- if {{thismonth}} == 6 -->selected<!-- endif -->>6月</option>
+								<option value="7" <!-- if {{thismonth}} == 7 -->selected<!-- endif -->>7月</option>
+								<option value="8" <!-- if {{thismonth}} == 8 -->selected<!-- endif -->>8月</option>
+								<option value="9" <!-- if {{thismonth}} == 9 -->selected<!-- endif -->>9月</option>
+								<option value="10" <!-- if {{thismonth}} == 10 -->selected<!-- endif -->>10月</option>
+								<option value="11" <!-- if {{thismonth}} == 11 -->selected<!-- endif -->>11月</option>
+								<option value="12" <!-- if {{thismonth}} == 12 -->selected<!-- endif -->>12月</option>
+							</select>
+						</li>
+	  				</ul>
+	  			</div>
+				<div class="saeaList">
+					<div class="entry">
+						<table class="table table-bordered table-condensed table-hover">
+							<tbody>
+							<tr><th class="taC" width="50"></th><th class="taC">实习生</th><th class="taC">上班</th><th class="taC">事假</th><th class="taC">病假</th><th class="taC">旷工</th></tr>
+							<!-- loop stafflist -->
+							<!-- loop stafflist' value.cidstafflist -->
+							<tr>
+								<!-- if !empty({{stafflist' cidstafflist' value.first}}) -->
+								<th rowspan="{{stafflist' value.count}}">{{stafflist' value.categoryname}}</th>
+								<!-- endif -->
+								<th>{{stafflist' cidstafflist' value.username}}</th>
+								<td class="taC">{{stafflist' cidstafflist' value.14}}</td>
+								<td class="taC">{{stafflist' cidstafflist' value.1}}</td>
+								<td class="taC">{{stafflist' cidstafflist' value.2}}</td>
+								<td class="taC">{{stafflist' cidstafflist' value.3}}</td>
+							</tr>
+							<!-- endloop -->
+							<!-- endloop -->
+							</tbody>
+						</table>
+					</div>
+				</div>
+			</div>
+		</div>
+	</div>
+	<!--弹出-->
+<div class="modal hide fade" id="addClose">
+	<div class="modal-dialog ">
+		<div class="modal-content">
+	    <div class="modal-header">
+	    	<h3>结算登记</h3>
+	    </div>
+			<form method="post" action="/addholiday2" onsubmit="return addholiday();">
+				<div class="modal-body saeaList">
+					<table class="table table-bordered table-condensed">
+						<tbody>
+						<tr>
+							<th class="taC" width="100"><span class="colRed">*</span>员工</th>
+							<td>
+								<select disabled><option>实习生</option></select>
+								<select id="cidstaff" name="uid">
+									<!-- loop internstafflist -->
+									<option value="{{internstafflist' value.sid}}">{{internstafflist' value.username}}</option>
+									<!-- endloop -->
+								</select>
+							</td>
+						</tr>
+						<tr>
+							<th class="taC" width="100"><span class="colRed">*</span>登记类型</th>
+							<td>
+								<select id="selecttype" name="type">
+									<option value="14">上班</option>
+									<option value="1">事假</option>
+									<option value="2">病假</option>
+									<option value="3">旷工</option>
+								</select>
+							</td>
+						</tr>
+						<tr id="tr_all" class="changetr" style="display: none">
+							<th class="taC" width="100"><span class="colRed">*</span><span id="holidaytype">事假</span>天数</th><td>
+							<input type="date" name="day" id="holidayday" disabled="true"></td>
+						</tr>
+						<tr id="tr_14" class="changetr">
+							<th class="taC" width="100"><span class="colRed">*</span>上班天数</th><td><input placeholder="请输入本月上班天数" id="daynum" name="daynum" type="number" step="0.5"></td>
+						</tr>
+						<tr>
+							<th class="taC" width="100">备注</th><td><textarea class="span4" name="description" placeholder="选填"></textarea></td>
+						</tr>
+						</tbody>
+					</table>
+				</div>
+				<div class="modal-footer">
+					<a href="#" class="button btn-gray" data-dismiss="modal" aria-hidden="true">取消</a>
+					<button type="submit" class="button" name="close2">确定</button>
+				</div>
+			</form>
+		</div>
+	</div>
+</div>
+    <!--弹出内容-->
+<script type="text/javascript">autoFlashHeight();</script>
+<script>
+	$(function() {
+		$('#year').change(function(){
+			var html = '/year/'+$(this).val()+'/month/'+$('#month').val();
+			window.location.href = '/holidayclose2' + html;
+		});
+
+		$('#month').change(function(){
+			var html = '/year/'+$('#year').val()+'/month/'+$(this).val();
+			window.location.href = '/holidayclose2' + html;
+		});
+
+		$('#selecttype').change(function(){
+			$('.changetr').hide();
+			$('.changetr input').attr('disabled',true);
+			if($(this).val() != 14){
+				$('#tr_all').show();
+				$('#tr_all input').removeAttr('disabled');
+				$('#holidaytype').text($(this).find("option:selected").text());
+			}else{
+				$('#tr_14').show();
+				$('#tr_14 input').removeAttr('disabled');
+			}
+		})
+	});
+	function addholiday(){
+		if($('#selecttype').val() != 14){
+			if($('#holidayday').val() == ''){
+				alert('请选择日期');
+				return false;
+			}
+		}else {
+			if ($('#daynum').val() == '') {
+				alert('请输入本月上班天数');
+				return false;
+			}
+		}
+	}
+</script>
+</body>

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 35 - 28
protected/view/holiday-myList.html


A diferenza do arquivo foi suprimida porque é demasiado grande
+ 217 - 0
protected/view/holiday-overtime.html


+ 203 - 0
protected/view/holiday-vacation.html

@@ -0,0 +1,203 @@
+<!-- include 'header' -->
+<body>
+	<div class="mainLayout">
+		<div class="mainMenu">
+			<div class="menuItem">
+				<a href="#" class="mLogo">CLD</a>
+				<ul>
+					<!-- include 'menu' -->
+				</ul>
+			</div>
+		</div>
+		<div class="warpContent">
+			<div class="subMenu fL">
+				<div class="menuItem">
+					<ul>
+						<!-- include 'holiday_menu' -->
+					</ul>
+				</div>
+			</div>
+			<div class="adminContent autoHeight" style="height: 821px;">
+				<legend><div class="fR"><a class="button" href="#addVacation" data-toggle="modal">休假登记</a></div>休假管理</legend>
+				<div class="demandCate">
+					<ul class="cateList">
+						<li>
+							<select id="selectcid">
+								<option value="all">所有办事处</option>
+								<!-- loop category -->
+								<option value="{{category' value.cid}}" <!-- if isset({{thiscid}}) && {{category' value.cid}} == {{thiscid}} -->selected<!-- endif -->>{{category' value.title}}</option>
+								<!-- endloop -->
+							</select>
+						</li>
+						<!--<li><select><option>2017</option></select> <select><option>1月</option><option>2月</option></select></li>-->
+	  				</ul>
+	  			</div>
+				<div class="saeaList">
+					<div class="entry">
+						<table class="table table-bordered table-condensed table-hover">
+							<tbody>
+							<tr>
+								<th class="taC" width="50"></th>
+								<th class="taC">员工</th>
+								<th class="taC">年假周期</th>
+								<th class="taC">年假<sub>(可用)</sub></th>
+								<th class="taC">婚假<sub>(可用)</sub></th>
+								<th class="taC">产假<sub>(可用)</sub></th>
+								<!--<th class="taC">存假<sub>(可用)</sub></th>-->
+								<th class="taC">丧假<sub>(可用)</sub></th>
+								<th class="taC">工伤假<sub>(可用)</sub></th>
+							</tr>
+							<!-- loop stafflist -->
+							<!-- loop stafflist' value.cidstafflist -->
+							<tr>
+								<!-- if !empty({{stafflist' cidstafflist' value.first}}) -->
+								<th rowspan="{{stafflist' value.count}}">{{stafflist' value.categoryname}}</th>
+								<!-- endif -->
+								<th>{{stafflist' cidstafflist' value.username}}</th>
+								<td class="taC">{{stafflist' cidstafflist' value.yearround}}</td>
+								<td class="taC">{{stafflist' cidstafflist' value.yearnum}}</td>
+								<td class="taC">{{stafflist' cidstafflist' value.hunjianum}}</td>
+								<td class="taC">{{stafflist' cidstafflist' value.chanjianum}}</td>
+								<td class="taC">{{stafflist' cidstafflist' value.sangjianum}}</td>
+								<td class="taC">{{stafflist' cidstafflist' value.gongjianum}}</td>
+								<!--<td class="taC">{{stafflist' cidstafflist' value.username}}</td>-->
+							</tr>
+							<!-- endloop -->
+							<!-- endloop -->
+							</tbody>
+						</table>
+					</div>
+				</div>
+			</div>
+		</div>
+	</div>
+	<!--弹出-->
+<div class="modal hide fade" id="addVacation">
+	<div class="modal-dialog ">
+		<div class="modal-content">
+			<div class="modal-header">
+				<h3>休假登记</h3>
+			</div>
+			<form action="/setstaffholiday" method="post" onsubmit="return setholidaynum();">
+			<div class="modal-body saeaList">
+				<table class="table table-bordered table-condensed">
+					<tbody>
+					<tr>
+						<th class="taC" width="100"><span class="colRed">*</span>员工</th>
+						<td>
+							<select id="category">
+								<!-- loop category -->
+								<option value="{{category' value.cid}}">{{category' value.title}}</option>
+								<!-- endloop -->
+							</select>
+							<select id="cidstaff" name="uid">
+								<!-- loop zongbu -->
+								<option value="{{zongbu' value.sid}}">{{zongbu' value.username}}</option>
+								<!-- endloop -->
+							</select>
+						</td>
+					</tr>
+					<tr>
+						<th class="taC" width="100"><span class="colRed">*</span>登记类型</th>
+						<td>
+							<select id="selectholiday" name="typeholiday">
+								<option value="yearnum">年假</option>
+								<option value="hunjianum">婚假</option>
+								<option value="chanjianum">产假</option>
+								<option value="sangjianum">丧假</option>
+								<option value="gongjianum">工伤假</option>
+							</select>
+						</td>
+					</tr>
+					<tr>
+						<th class="taC" width="100">当前天数</th><td><span id="thisnum">{{thisnum}}</span> 天</td>
+					</tr>
+					<tr>
+						<th class="taC" width="100"><span class="colRed">*</span>增加天数</th><td><input placeholder="请输入天数" id="addnum" name="addnum" type="number" step="0.5"></td>
+					</tr>
+					<tr>
+						<th class="taC" width="100">备注</th><td><textarea class="span4" placeholder="选填"></textarea></td>
+					</tr>
+					</tbody>
+				</table>
+			</div>
+			<div class="modal-footer">
+				<a href="#" class="button btn-gray" data-dismiss="modal" aria-hidden="true">取消</a>
+				<button type="submit" class="button">确定</button>
+			</div>
+			</form>
+		</div>
+	</div>
+</div>
+    <!--弹出内容-->
+<script type="text/javascript">autoFlashHeight();</script>
+<script>
+	$(function(){
+		$('#selectcid').change(function(){
+			var html = '';
+			if($(this).val() != 'all'){
+				html += '/'+$(this).val();
+			}
+			window.location.href = '/holidayvacation'+html;
+		});
+
+		$('#category').change(function(){
+			$.ajax({
+				type: 'post',
+				url: '/getstaffcategory',
+				data: {cid:$(this).val()},
+				dataType: 'json',
+				success: function(result){
+					if(result.code == 200){
+						$('#cidstaff').html('');
+						var html = '';
+						$.each(result.stafflist,function(k,v){
+							html +='<option value="'+v.sid+'">'+v.username+'</option>';
+						});
+						$('#cidstaff').html(html);
+						$('#selectholiday option[value="yearnum"]').prop('selected',true);
+						$('#thisnum').text(result.thisnum);
+					}
+				}
+			})
+		});
+
+		$('#cidstaff').change(function(){
+			$.ajax({
+				type: 'post',
+				url: '/getholidaystaff',
+				data: {uid:$(this).val(),type:$('#selectholiday').val()},
+				dataType: 'json',
+				success: function(result){
+					if(result.code == 200){
+						$('#thisnum').text(0);
+						$('#thisnum').text(result.thisnum);
+					}
+				}
+			})
+		});
+
+		$('#selectholiday').change(function(){
+			$.ajax({
+				type: 'post',
+				url: '/getholidaystaff',
+				data: {uid:$('#cidstaff').val(),type:$(this).val()},
+				dataType: 'json',
+				success: function(result){
+					if(result.code == 200){
+						$('#thisnum').text(0);
+						$('#thisnum').text(result.thisnum);
+					}
+				}
+			})
+		});
+	});
+	function setholidaynum(){
+		if($('#addnum').val() == ''){
+			alert('请输入增加天数');
+			return false;
+		}
+	}
+</script>
+</body>
+</html>

+ 0 - 8
protected/view/holiday_menu.html

@@ -1,8 +0,0 @@
-<li class="holidayTitle">假期管理</li>
-<li><a href="/holidayborad" <!-- if {{holidaymenu}} == 'borad' -->class="selected"<!-- endif -->>公布板</a></li>
-<li><a href="/myList" <!-- if {{holidaymenu}} == 'mylist' -->class="selected"<!-- endif -->>我的假期</a></li>
-<!--<li class="topLine"><a href="holiday-reportList.html">请假审批</a></li>-->
-<!--<li><a href="holiday-copy.html">请假抄送</a></li>-->
-<li class="topLine"><a href="holiday-close.html">请假结算</a></li>
-<li><a href="holiday-overtime.html">加班管理</a></li>
-<li><a href="holiday-vacation.html">休假管理</a></li>