likeku 8 gadi atpakaļ
vecāks
revīzija
9b09f0d2b1
1 mainītis faili ar 25 papildinājumiem un 110 dzēšanām
  1. 25 110
      protected/controller/AdminController.php

+ 25 - 110
protected/controller/AdminController.php

@@ -202,8 +202,10 @@ function adduser(){
 		$username=$this->get_args('username')?$this->get_args('username'):"";
 		$password=$this->get_args('password')?$this->get_args('password'):"";
 		$cid=is_numeric($this->get_args('cid'))?$this->get_args('cid'):0;
+		$hiredate=$this->get_args('hiredate')?$this->get_args('hiredate'):"";
+		$nature=is_numeric($this->get_args('nature'))?$this->get_args('nature'):1;
 
-		if(!empty($username)&&!empty($password)&&!empty($cid)){
+		if(!empty($username)&&!empty($password)&&!empty($cid)&&!empty($hiredate)&&!empty($nature)){
 
 			Doo::loadModel ( 'L_category' );
 			Doo::loadModel ( 'staff' );
@@ -224,6 +226,8 @@ function adduser(){
 			$staff->passwork=md5($password);
 			$staff->cid=$cagegory[0]['cid'];
 			$staff->category=$cagegory[0]['title'];
+			$staff->hiredate=$hiredate;
+			$staff->nature=$nature;
 			$id=$staff->insert();
 
 			for ($i=1;$i<=7;$i++){
@@ -296,7 +300,9 @@ function adminDoEdiUser(){
 		$telephone=$this->get_args('telephone')?$this->get_args('telephone'):"";
 		$email=$this->get_args('email')?$this->get_args('email'):"";
 		$username=$this->get_args('username')?$this->get_args('username'):"";
-		
+		$nature=$this->get_args('nature')?$this->get_args('nature'):"";
+		$hiredate=$this->get_args('hiredate')?$this->get_args('hiredate'):"";
+
 		if(!empty($sid)){
 			$msg="";
 
@@ -340,6 +346,11 @@ function adminDoEdiUser(){
 			else
 				$msg="邮箱不正确";
 
+			if(!empty($hiredate))
+				$staff->hiredate=$hiredate;
+
+			$staff->nature=$nature;
+
 			$staff->update();
 
 			return "/edi/user/".$sid."/".$msg;
@@ -755,114 +766,6 @@ function adminDeleteUser(){
 		return "/adminExecute";
 	}
 	
-	function adminInvoice(){
-		Doo::loadModel('staff');
-		$staff=new staff();
-		Doo::loadModel("invoiceManage");
-		$invoiceManage=new invoiceManage();
-		
-		$data['staffList']=$staff->find(array('select'=>'username,sid,avatar','asArray'=>true));
-		$list=$invoiceManage->find(array('asArray'=>true));
-		
-		$execute=array('收款管理'=>'','发票审批'=>'','发票打印'=>'','发票邮寄'=>'','公司汇总查阅'=>'');
-		foreach ($list as $key=>$value){
-			$name=json_decode($value['staff']);
-			$staffString="";
-			if (!empty($name)){
-				foreach ($name as $k=>$v){
-					
-					$staffString.="<span class='tagGroup'> ".$v[1].'<a href="javascript:if(window.confirm(\'确认删除?\'))window.location=\'/delInvoiceManage/'.$v[0].'/'.$value['iid'].'\'"  title="删除" class="icon-">k</a></span>';
-				}
-			}
-			foreach ($execute as $k=>$v){
-				if ($k==$value['mold']){
-					$execute[$k]=$name=$staffString;
-				}
-			}
-		}
-		
-		
-		
-		$data['invoice']=$execute;
-		$data['memu']="invoice";
-		$data['staff']=$this->staff;
-
-		$this->render ( "/admin/adminInvoice", $data );
-	}
-	
-	function addInvoiceManage(){
-		$mold=$this->get_args('mold')?$this->get_args('mold'):"";
-		$staff=$this->get_args('staff')?$this->get_args('staff'):"";
-
-		if(!empty($mold)&&!empty($staff)){
-			Doo::loadModel("invoiceManage");
-			$execute=new invoiceManage();
-			
-			$executeInfo=$execute->getOne(array('where'=>'mold ="'.$mold.'" ','asArray'=>true));
-			if (empty($executeInfo)){
-				
-				$list=array();
-				foreach ($staff as $key=>$value){
-					$info=explode(":", $value);
-					array_push($list, $info);
-				}
-				
-				$execute->mold=$mold;
-				$execute->staff=json_encode($list);
-			
-				$execute->insert();
-			}else{
-				$list=json_decode($executeInfo['staff'],true);
-				
-				foreach ($staff as $k=>$v){
-					$info=explode(":", $v);
-					foreach ($list as $key=>$value){
-						if($value[1]==$info[1]){
-							unset($staff[$k]);
-							break;
-						}
-					}
-				}
-				foreach ($staff as $k=>$v){
-					$info=explode(":", $v);
-					array_push($list, $info);
-				}
-				
-				$execute->staff=json_encode($list);
-				$execute->update(array('where'=>'iid = '.$executeInfo['iid']));
-			}
-		}
-		return "/adminInvoice";
-	}
-	
-	function delInvoiceManage(){
-		$uid=isset($this->params['uid'])&&is_numeric($this->params['uid'])?$this->params['uid']:0;	
-		$iid=isset($this->params['iid'])&&is_numeric($this->params['iid'])?$this->params['iid']:0;	
-		
-		if(!empty($uid)&&!empty($iid)){
-			Doo::loadModel("invoiceManage");
-			$execute=new invoiceManage();
-			
-			$executeInfo=$execute->getOne(array('where'=>'iid ="'.$iid.'" ','asArray'=>true));
-			if (empty($executeInfo))
-				return "/adminInvoice";
-			
-			$ini=array();
-			$list=json_decode($executeInfo['staff'],true);
-			foreach ($list as $k=>$v){
-				if ($v[0]==$uid){
-					$ini=$list[$k];
-					unset($list[$k]);break;
-				}
-			}	
-			
-			$execute->staff=json_encode($list);
-			$execute->update(array('where'=>'iid = '.$executeInfo['iid']));
-		}
-		
-		return "/adminInvoice";
-	}
-	
 	function ajaxRoleStaff(){
 		
 		$name=$this->get_args('name')?$this->get_args('name'):"";
@@ -1234,6 +1137,18 @@ function excelTime($date, $time = false)
 		return $result ['count'];
 	}
 
+	//录入用户假期信息
+	public function AddStaffHoliday(){
+		Doo::loadModel('staff');
+		$staff = new staff();
+		$stafflist = $staff->find(array('select' => 'sid,hiredate','where' => 'nature=1', 'asArray' => TRUE));
+		var_dump($stafflist);
+		exit;
+
+		Doo::loadModel('holidaystaff');
+
+	}
+
 
 }