| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010 | <?php/** * @author darkredz */class HumanResourceController extends DooController {	public function beforeRun($resource, $action) {	}	function __construct() {		if (isset ( $_COOKIE ["staff"] )) {			if (! empty ( $_COOKIE ["staff"] )) {				Doo::loadModel ( 'staff' );				$staff = new staff ();								$this->staff = $staff->getStaffBySid ( $_COOKIE ["staff"] );				return "/";			}		}				Doo::loadCore ( 'uri/DooUriRouter' );		$router = new DooUriRouter ();		$routeRs = $router->execute ( Doo::app ()->route, Doo::conf ()->SUBFOLDER );		if ($routeRs ['1'] != "appliedEntry") {			if ($routeRs ['1'] != "login") {				header ( 'Content-Type:text/html;charset=utf-8' );				@header ( "Location: /login" );			}		}	}		/**	 * 人资首页	 */	function hr() {		Doo::loadModel ( 'staffManage' );		$staffManage = new staffManage ();		Doo::loadModel ( 'staff' );		$staff = new staff ();				// 获得当前账号需要审批的员工		$staffList = $staff->getStaffByApplied ( $this->staff ['sid'] );		$staffNew = $staff->getStaffByApprovals ();				// print_r($staffList);		$this->data ['staffList'] = $staffList;		$this->data ['staffNew'] = $staffNew;				$this->data ['memu'] = "HumanResource";		$this->data ['hrMemu'] = "hr";				$this->render ( "/humanResource/hr", $this->data );	}		/**	 * 员工入职审批	 */	function employeeInductionApprovals() {		Doo::loadModel ( 'staff' );		$staff = new staff ();		Doo::loadClass ( 'XDeode' );		$XDeode = new XDeode ( 5 );		Doo::loadModel ( 'staffManage' );		$staffManage = new staffManage ();				$sidKey = $this->get_args ( 'sidKey' ) ? $this->get_args ( 'sidKey' ) : "";				$sid = $XDeode->decode ( $sidKey );		if (! is_numeric ( $sid ) || empty ( $sid ))			die ( 'illegal request' );				$staffDetail = $staff->getOne ( array (				'where' => 'pendStatus=2 and sid=' . $sid . ' and pendingApprovals=' . $this->staff ['sid'],				'asArray' => true 		) );				if (empty ( $staffDetail ))			die ( 'illegal request' );				$processApprovals = json_decode ( $staffDetail ['processApprovals'], true );		$invoiceManage = json_decode ( $staffDetail ['staffManage'], true );				$staff = new staff ();		if (empty ( $processApprovals )) {			$processApprovals = array (					$this->staff ['sid'] => array (							'date' => date ( "Y-m-d H:i:s" ) 					) 			);			$nextInvoiceManage = next ( $invoiceManage );						if ($nextInvoiceManage !== false)				$staff->pendingApprovals = $nextInvoiceManage [0];			$staff->processApprovals = json_encode ( $processApprovals );		} else {			$processApprovals [$this->staff ['sid']] = array (					'date' => date ( "Y-m-d H:i:s" ) 			);						$pendingApprovals = 0;			foreach ( $invoiceManage as $key => $value ) {				if ($value [0] == $this->staff ['sid']) {					if (isset ( $invoiceManage [$key + 1] ))						$pendingApprovals = $invoiceManage [$key + 1] [0];					break;				}			}						if (! empty ( $pendingApprovals ))				$staff->pendingApprovals = $pendingApprovals;			$staff->processApprovals = json_encode ( $processApprovals );		}				if (count ( $processApprovals ) == count ( $invoiceManage )) {			$staff->pendStatus = 0;			$staff->pendingApprovals = 0;			$staff->InductionDate = date ( "Y-m-d H:i:s" );			 			if($staffDetail['nature']==2)				$staffDetail->practiceDate= date ( "Y-m-d H:i:s" );			if($staffDetail['nature']==3)				$staffDetail->probationaryDate= date ( "Y-m-d H:i:s" );									$staff->passwork = 'e10adc3949ba59abbe56e057f20f883e';		}				$staff->updateDate = date ( "Y-m-d H:i:s" );		$staff->update ( array (				'where' => 'sid=' . $sid 		) );				// 操作日志		Doo::loadModel ( 'staffOperationLog' );		$staffOperationLog = new staffOperationLog ();		$nature='';		if($staffDetail['nature']==2){			$nature='实习';		}elseif($staffDetail['nature']==3){			$nature='试用';		}				$item = array (				'date' => date ( "Y-m-d H:i:s" ),				'operation' => $this->staff ['username'] . "  审批通过" . $staffDetail ['username'].$nature."入职",				'status' => 3,				'img' => $staffDetail ['avatar'],				'username' => $staffDetail ['username'],				'uid' => $staffDetail ['sid'],				'category' => $staffDetail ['category'] 		);								$staffOperationLog->setInvoiceOperationLog ( $item );				return '/hr';	}		/**	 * 离职人员审批	 */	function employeeDimissionApprovals() {		Doo::loadModel ( 'staff' );		$staff = new staff ();		Doo::loadClass ( 'XDeode' );		$XDeode = new XDeode ( 5 );		Doo::loadModel ( 'staffLeaveManage' );		$staffLeaveManage = new staffLeaveManage ();				$sidKey = $this->get_args ( 'sidKey' ) ? $this->get_args ( 'sidKey' ) : "";		$sid = $XDeode->decode ( $sidKey );		if (! is_numeric ( $sid ) || empty ( $sid ))			die ( 'illegal request' );				$staffDetail = $staff->getOne ( array (				'where' => 'pendStatus=3 and sid=' . $sid . ' and pendingApprovalsLeave=' . $this->staff ['sid'],				'asArray' => true 		) );				if (empty ( $staffDetail ))			die ( 'illegal request' );				$processApprovals = json_decode ( $staffDetail ['processApprovalsLeave'], true );		$invoiceManage = json_decode ( $staffDetail ['staffManageLeave'], true );				$staff = new staff ();		if (empty ( $processApprovals )) {			$processApprovals = array (					$this->staff ['sid'] => array (							'date' => date ( "Y-m-d H:i:s" ) 					) 			);			$nextInvoiceManage = next ( $invoiceManage );						if ($nextInvoiceManage !== false)				$staff->pendingApprovalsLeave = $nextInvoiceManage [0];			$staff->processApprovalsLeave = json_encode ( $processApprovals );		} else {			$processApprovals [$this->staff ['sid']] = array (					'date' => date ( "Y-m-d H:i:s" ) 			);						$pendingApprovals = 0;			foreach ( $invoiceManage as $key => $value ) {				if ($value [0] == $this->staff ['sid']) {					if (isset ( $invoiceManage [$key + 1] ))						$pendingApprovals = $invoiceManage [$key + 1] [0];					break;				}			}						if (! empty ( $pendingApprovals ))				$staff->pendingApprovalsLeave = $pendingApprovals;			$staff->processApprovalsLeave = json_encode ( $processApprovals );		}				if (count ( $processApprovals ) == count ( $invoiceManage )) {			$staff->pendStatus = 4;			$staff->pendingApprovalsLeave = 0;		}				$staff->updateDate = date ( "Y-m-d H:i:s" );		$staff->update ( array (				'where' => 'sid=' . $sid 		) );				// 操作日志		Doo::loadModel ( 'staffOperationLog' );		$staffOperationLog = new staffOperationLog ();		$item = array (				'date' => date ( "Y-m-d H:i:s" ),				'operation' => $this->staff ['username'] . "离职 审批通过" . $staffDetail ['username'],				'status' => 2,				'img' => $staffDetail ['avatar'],				'username' => $staffDetail ['username'],				'uid' => $staffDetail ['sid'],				'category' => $staffDetail ['category'] 		);		$staffOperationLog->setInvoiceOperationLog ( $item );				return '/hr';	}		/**	 * 员工信息	 */	function hrEmployee() {		$pendStatus = $this->get_args ( 'pendStatus' ) ? $this->get_args ( 'pendStatus' ) : "ALL";		$nature = $this->get_args ( 'nature' ) ? $this->get_args ( 'nature' ) : 'ALL';		$cid_did = $this->get_args ( 'cid_did' ) ? $this->get_args ( 'cid_did' ) : 'ALL';		$MebSea = $this->get_args ( 'MebSea' ) ? $this->get_args ( 'MebSea' ) : '';				Doo::loadClass ( 'XDeode' );		$XDeode = new XDeode ( 5 );				$con = '  username != "admin" ';		if ($pendStatus == 'ALL')			$con .= '  ';		elseif ($pendStatus == 'OTJOB')			$con .= ' and pendStatus=0 ';		elseif ($pendStatus == 'LVJOB')			$con .= ' and pendStatus=4 ';				if ($nature == 'ALL')			$con .= ' and (nature=1 or nature=2 or nature=3 or nature=4) ';		elseif ($nature == 'FORMAL')			$con .= ' and  nature=1';		elseif ($nature == 'TRIAL')			$con .= ' and  nature=2';		elseif ($nature == 'PRACTICE')			$con .= ' and  nature=3';				if ($cid_did != 'ALL') {			$department = explode ( '_', $cid_did );			$cid = $XDeode->decode ( $department [0] );			$departmentID = false;			if (! empty ( $department [1] )) {				$departmentID = $XDeode->decode ( $department [1] );			}			if (is_numeric ( $cid ) && is_numeric ( $departmentID ))				$con .= ' and  cid=' . $cid . ' and departmentID=' . $departmentID;			elseif (is_numeric ( $cid ) && ! is_numeric ( $departmentID ))				$con .= ' and  cid=' . $cid;		}				if (! empty ( $MebSea ))			$con .= ' and ( username like "%' . $MebSea . '%" or jobNumber like "%' . $MebSea . '%" )';			// echo $con;		Doo::loadModel ( 'staff' );		$staff = new staff ();		Doo::loadModel ( 'L_category' );		$L_category = new L_category ();				$stafflist = $staff->getStaffByCondition ( $con );				$monthstart = date ( 'Y-m-d 00:00:00', mktime ( 0, 0, 0, date ( 'm' ), 1, date ( 'Y' ) ) );		$monthend = date ( 'Y-m-d 23:59:59', mktime ( 0, 0, 0, date ( 'm' ) + 1, 0, date ( 'Y' ) ) );				// 本月在职 入职 离职人员数量		$onJobCount = $staff->count ( array (				'where' => 'pendStatus=0 and username!="admin"' 		) );		$inJobCount = $staff->count ( array (				'where' => 'pendStatus=0 and username!="admin" and (InductionDate>="' . $monthstart . '" and InductionDate<="' . $monthend . '" )' 		) );		$leaveJobCount = $staff->count ( array (				'where' => 'pendStatus=4 and username!="admin" and (dimissionDate>="' . $monthstart . '" and dimissionDate<="' . $monthend . '" )' 		) );				// 生成工号		$jobNumber = $this->createJobNumber ();		// 获得办事和部门		$categoryList = $L_category->getCategoryDepartment ();				$monthstart = date ( 'm.d', mktime ( 0, 0, 0, date ( 'm' ), 1, date ( 'Y' ) ) );		$monthend = date ( 'm.d', mktime ( 0, 0, 0, date ( 'm' ) + 1, 0, date ( 'Y' ) ) );				$this->data ['onJobCount'] = $onJobCount;		$this->data ['inJobCount'] = $inJobCount;		$this->data ['leaveJobCount'] = $leaveJobCount;				$this->data ['monthstart'] = $monthstart;		$this->data ['monthend'] = $monthend;				$this->data ['pendStatus'] = $pendStatus;		$this->data ['nature'] = $nature;		$this->data ['MebSea'] = $MebSea;		$this->data ['cid_did'] = $cid_did;				$this->data ['categoryList'] = $categoryList;		$this->data ['jobNumber'] = $jobNumber;		$this->data ['stafflist'] = $stafflist;				$this->data ['memu'] = "HumanResource";		$this->data ['hrMemu'] = "hrEmployeeInfo";				$this->render ( "/humanResource/hrEmployee", $this->data );	}	function staffAdd() {		$username = $this->get_args ( 'username' ) ? $this->get_args ( 'username' ) : "";		$nature = is_numeric ( $this->get_args ( 'nature' ) ) ? $this->get_args ( 'nature' ) : 0;		$cid_did = $this->get_args ( 'cid_did' ) ? $this->get_args ( 'cid_did' ) : '';		$position = $this->get_args ( 'position' ) ? $this->get_args ( 'position' ) : '';		$hiredate = $this->get_args ( 'hiredate' ) ? $this->get_args ( 'hiredate' ) : '';		$telephone = $this->get_args ( 'telephone' ) ? $this->get_args ( 'telephone' ) : '';		$baseWage = is_numeric ( $this->get_args ( 'baseWage' ) ) ? $this->get_args ( 'baseWage' ) : 0;		$postWage = is_numeric ( $this->get_args ( 'postWage' ) ) ? $this->get_args ( 'postWage' ) : 0;		$achievementBonus = is_numeric ( $this->get_args ( 'achievementBonus' ) ) ? $this->get_args ( 'achievementBonus' ) : 0;		$gender = $this->get_args ( 'gender' ) ? $this->get_args ( 'gender' ) : '';				if (! empty ( $username ) && ! empty ( $nature ) && ! empty ( $cid_did ) && ! empty ( $position ) && ! empty ( $hiredate ) && ! empty ( $baseWage ) && ! empty ( $postWage ) && ! empty ( $achievementBonus )) {						Doo::loadClass ( 'XDeode' );			$XDeode = new XDeode ( 5 );			Doo::loadModel ( 'staff' );			$staff = new staff ();			Doo::loadModel ( 'L_category' );			$L_category = new L_category ();			Doo::loadModel ( 'tag' );			Doo::loadModel ( 'holidaystaff' );			Doo::loadModel ( 'staffManage' );			$staffManage = new staffManage ();						// 用户名检测			$staff->username = $username;			$staff->hiredate = $hiredate;			$staff->nature = $nature;			$staff->position = $position;			$department = explode ( '_', $cid_did );						$cid = $XDeode->decode ( $department [0] );			// 加入默认总部分类			if (! is_numeric ( $cid ))				die ( 'illegal request' );			$cagegory = $L_category->getCategoryById ( $cid );			// 部门			if (! empty ( $department [1] )) {				$did = $XDeode->decode ( $department [1] );				if (! is_numeric ( $did ))					die ( 'illegal request' );				$staff->departmentID = $did;			}						// 生成工号			$jobNumber = $this->createJobNumber ();			if ($nature == 1)				$staff->jobNumber = $jobNumber ['regularStaff'];			else {				$staff->jobNumber = $jobNumber ['internStaff'];				$staff->pendStatus = 1;			}						$staff->cid = $cagegory [0] ['cid'];			$staff->category = $cagegory [0] ['title'];						$staff->telephone = $telephone;			$staff->baseWage = $baseWage;			$staff->postWage = $postWage;			$staff->achievementBonus = $achievementBonus;			$staff->gender = $gender;			// 审批组			// 获得该办事处的审批组			$approvalKey = explode ( '_', $cid_did );			$cidMode = array ();			foreach ( $approvalKey as $value ) {				if (! empty ( $value )) {					$cid = $XDeode->decode ( $value );					array_push ( $cidMode, $cid );				}			}			$cidMode = implode ( '_', $cidMode );			$staffManageDetail = $staffManage->getStaffManageByCid ( $cidMode );			if (empty ( $staffManageDetail ))				die ( 'illegal request' );						$pendingApprovalsSid = current ( $staffManageDetail ['staffList'] ) [0];			$staff->pendingApprovals = $pendingApprovalsSid;			$staff->staffManage = $staffManageDetail ['staff'];						// 抄送组			$staff->processCC = $staffManageDetail ['CC'];			// 工龄记录			$seniorityFormula = array ();			array_push ( $seniorityFormula, array (					'InductionDate' => $hiredate,					'dimissionDate' => '' 			) );			$staff->seniorityFormula = json_encode ( $seniorityFormula );						$id = $staff->insert ();						// 更新假期相关信息			$holidaystaff = new HStaff ();			$holidaystaff->uid = $id;			$holidaystaff->insert ();						$staffmsg = $staff->getUserById ( $id );			$this->updateAnnualLeave ( $staffmsg [0] );						// 标签更新			for($i = 1; $i <= 7; $i ++) {				$tag = new tag ();				$tag->name = "个人标签";				$tag->sid = $id;				$tag->colorid = $i;				$tag->insert ();			}						// 操作日志			Doo::loadModel ( 'staffOperationLog' );			$staffOperationLog = new staffOperationLog ();			$item = array (					'date' => date ( "Y-m-d H:i:s" ),					'status' => 1,					'img' => $staffmsg ['avatar'],					'username' => $staffmsg ['username'],					'uid' => $staffmsg ['sid'],					'operation' => "添加新员工",					'category' => $staffmsg ['category'] 			);			$staffOperationLog->setInvoiceOperationLog ( $item );		}		return '/hrEmployee';	}		/**	 * 更新员工信息	 */	function staffUpdate() {		$sidKey = $this->get_args ( 'sidKey' ) ? $this->get_args ( 'sidKey' ) : "";				$username = $this->get_args ( 'username' ) ? $this->get_args ( 'username' ) : "";		$cid_did = $this->get_args ( 'cid_did' ) ? $this->get_args ( 'cid_did' ) : '';		$position = $this->get_args ( 'position' ) ? $this->get_args ( 'position' ) : '';		$hiredate = $this->get_args ( 'hiredate' ) ? $this->get_args ( 'hiredate' ) : '';		$telephone = $this->get_args ( 'telephone' ) ? $this->get_args ( 'telephone' ) : '';		// $baseWage = is_numeric ( $this->get_args ( 'baseWage' ) ) ? $this->get_args ( 'baseWage' ) : 0;		// $postWage = is_numeric ( $this->get_args ( 'postWage' ) ) ? $this->get_args ( 'postWage' ) : 0;		// $achievementBonus = is_numeric ( $this->get_args ( 'achievementBonus' ) ) ? $this->get_args ( 'achievementBonus' ) : 0;		$gender = $this->get_args ( 'gender' ) ? $this->get_args ( 'gender' ) : '';				$qq = is_numeric ( $this->get_args ( 'qq' ) ) ? $this->get_args ( 'qq' ) : 0;		$phone = is_numeric ( $this->get_args ( 'phone' ) ) ? $this->get_args ( 'phone' ) : 0;		$wecat = $this->get_args ( 'wecat' ) ? $this->get_args ( 'wecat' ) : '';		$email = $this->get_args ( 'email' ) ? $this->get_args ( 'email' ) : '';				$birthday = $this->get_args ( 'birthday' ) ? $this->get_args ( 'birthday' ) : '';		$qualifications = $this->get_args ( 'qualifications' ) ? $this->get_args ( 'qualifications' ) : '';		$marriage = $this->get_args ( 'marriage' ) ? $this->get_args ( 'marriage' ) : '';		$IDcards = $this->get_args ( 'IDcards' ) ? $this->get_args ( 'IDcards' ) : '';				$living = $this->get_args ( 'living' ) ? $this->get_args ( 'living' ) : '';		$nativePlace = $this->get_args ( 'nativePlace' ) ? $this->get_args ( 'nativePlace' ) : '';		$emergencyContacts = $this->get_args ( 'emergencyContacts' ) ? $this->get_args ( 'emergencyContacts' ) : '';		$remittanceName = $this->get_args ( 'remittanceName' ) ? $this->get_args ( 'remittanceName' ) : '';		$coupletNumber = $this->get_args ( 'coupletNumber' ) ? $this->get_args ( 'coupletNumber' ) : '';		$bankName = $this->get_args ( 'bankName' ) ? $this->get_args ( 'bankName' ) : '';		$bankNumber = $this->get_args ( 'bankNumber' ) ? $this->get_args ( 'bankNumber' ) : '';				$salaryCard = $this->get_args ( 'salaryCard' ) ? $this->get_args ( 'salaryCard' ) : '';		$salaryBank = $this->get_args ( 'salaryBank' ) ? $this->get_args ( 'salaryBank' ) : '';				$employeeInfo = $this->get_args ( 'employeeInfo' ) ? $this->get_args ( 'employeeInfo' ) : 'employeeInfo';				if (! empty ( $sidKey )) {						Doo::loadClass ( 'XDeode' );			$XDeode = new XDeode ( 5 );			Doo::loadModel ( 'staff' );			$staff = new staff ();			Doo::loadModel ( 'L_category' );			$L_category = new L_category ();			Doo::loadModel ( 'tag' );			Doo::loadModel ( 'holidaystaff' );			Doo::loadModel ( 'staffManage' );			$staffManage = new staffManage ();						// 用户名检测			if (! empty ( $username )) {				$detail = $staff->getStaffByName ( $username );				if (empty ( $detail ))					die ( 'illegal request' );			}			$detail = $staff->getStaffBySid ( $sidKey );			if (empty ( $detail ))				die ( 'illegal request' );				// if (!empty($username))				// $staff->username = $username;			if (! empty ( $hiredate ))				$staff->hiredate = $hiredate;			if (! empty ( $position ))				$staff->position = $position;								// 办事处-部门			if (! empty ( $cid_did )) {				$department = explode ( '_', $cid_did );				$cid = $XDeode->decode ( $department [0] );				// 加入默认总部分类				if (! is_numeric ( $cid ))					die ( 'illegal request' );				$cagegory = $L_category->getCategoryById ( $cid );				// 部门				if (! empty ( $department [1] )) {					$did = $XDeode->decode ( $department [1] );					if (! is_numeric ( $did ))						die ( 'illegal request' );					$staff->departmentID = $did;				}				$staff->cid = $cagegory [0] ['cid'];				$staff->category = $cagegory [0] ['title'];			}						if (! empty ( $telephone ))				$staff->telephone = $telephone;				// if (!empty($baseWage))				// $staff->baseWage = $baseWage;				// if (!empty($postWage))				// $staff->postWage = $postWage;				// if (!empty($achievementBonus))				// $staff->achievementBonus = $achievementBonus;			if (! empty ( $gender ))				$staff->gender = $gender;						if (! empty ( $qq ))				$staff->qq = $qq;			if (! empty ( $phone ))				$staff->phone = $phone;			if (! empty ( $wecat ))				$staff->wecat = $wecat;			if (! empty ( $email ))				$staff->email = $email;			if (! empty ( $birthday ))				$staff->birthday = $birthday;			if (! empty ( $$qualifications ))				$staff->qualifications = $qualifications;			if (! empty ( $marriage ))				$staff->marriage = $marriage;			if (! empty ( $IDcards ))				$staff->IDcards = $IDcards;			if (! empty ( $living ))				$staff->living = $living;			if (! empty ( $nativePlace ))				$staff->nativePlace = $nativePlace;			if (! empty ( $emergencyContacts ))				$staff->emergencyContacts = $emergencyContacts;			if (! empty ( $coupletNumber ))				$staff->coupletNumber = $coupletNumber;			if (! empty ( $bankName ))				$staff->bankName = $bankName;			if (! empty ( $bankNumber ))				$staff->bankNumber = $bankNumber;			if (! empty ( $remittanceName ))				$staff->remittanceName = $remittanceName;						if (! empty ( $salaryCard ))				$staff->salaryCard = $salaryCard;			if (! empty ( $salaryBank ))				$staff->salaryBank = $salaryBank;						$staff->update ( array (					'where' => 'sid=' . $detail ['sid'] 			) );						if ($employeeInfo == 'employeeInfo') {				return '/hr';			} elseif ($employeeInfo == 'settingEmployeeInfo') {				return '/settingEmployeeInfo';			} elseif ($employeeInfo == 'settingFinanceInfo') {				return '/settingFinanceInfo';			}		}		die ( 'illegal request' );	}		/**	 * 员工转职	 */	function staffTransfer() {		$sidKey = $this->get_args ( 'sidKey' ) ? $this->get_args ( 'sidKey' ) : "";		$nature = $this->get_args ( 'nature' ) ? $this->get_args ( 'nature' ) : '';				if (! empty ( $sidKey ) && ! empty ( $nature )) {			Doo::loadClass ( 'XDeode' );			$XDeode = new XDeode ( 5 );			Doo::loadModel ( 'staff' );			$staff = new staff ();						$sid = $XDeode->decode ( $sidKey );			$staffDetail = $staff->getStaffBySid ( $sid );						$item = array (					'sid' => $sid 			);			if ($nature == 'TRIAL')				$item += array (						// 试用						'nature' => 3,						'probationaryDate' => date ( "Y-m-d H:i:s" ) 				);			if ($nature == 'REGULARS') {				// 生成工号				$jobNumber = $this->createJobNumber ();				$item += array (						// 正式						'nature' => 1,						'jobNumber' => $jobNumber ['regularStaff'],						'regularsDate' => date ( "Y-m-d H:i:s" ) 				);			}			$staff->setStaffByCondition ( $item );						// 操作日志			Doo::loadModel ( 'staffOperationLog' );			$staffOperationLog = new staffOperationLog ();			$item = array (					'date' => date ( "Y-m-d H:i:s" ),					'status' => 1,					'img' => $staffDetail ['avatar'],					'username' => $staffDetail ['username'],					'uid' => $staffDetail ['sid'],					'category' => $staffDetail ['category'] 			);			if ($nature == 'TRIAL')				$item += array (						// 试用						'operation' => "员工  实习转试用" 				);			if ($nature == 'REGULARS')				$item += array (						// 正式						'operation' => "员工  试用转正式" 				);			$staffOperationLog->setInvoiceOperationLog ( $item );						return '/hrEmployee';		}		die ( 'illegal request' );	}		/**	 * 申请入职	 */	function appliedEntry() {		$sidKey = $this->get_args ( 'sidKey' ) ? $this->get_args ( 'sidKey' ) : "";		$telephone = $this->get_args ( 'telephone' ) ? $this->get_args ( 'telephone' ) : '';		$qq = $this->get_args ( 'qq' ) ? $this->get_args ( 'qq' ) : '';		$wecat = $this->get_args ( 'wecat' ) ? $this->get_args ( 'wecat' ) : '';		$phone = $this->get_args ( 'phone' ) ? $this->get_args ( 'phone' ) : '';		$email = $this->get_args ( 'email' ) ? $this->get_args ( 'email' ) : '';		$gender = $this->get_args ( 'gender' ) ? $this->get_args ( 'gender' ) : '';				$birthday = $this->get_args ( 'birthday' ) ? $this->get_args ( 'birthday' ) : '';		$qualifications = $this->get_args ( 'qualifications' ) ? $this->get_args ( 'qualifications' ) : '';		$marriage = $this->get_args ( 'marriage' ) ? $this->get_args ( 'marriage' ) : '0';		$nativePlace = $this->get_args ( 'nativePlace' ) ? $this->get_args ( 'nativePlace' ) : '';				$emergencyContacts = $this->get_args ( 'emergencyContacts' ) ? $this->get_args ( 'emergencyContacts' ) : '';		$living = $this->get_args ( 'living' ) ? $this->get_args ( 'living' ) : '';				if (! empty ( $sidKey ) && ! empty ( $telephone ) && ! empty ( $qq ) && ! empty ( $wecat ) && ! empty ( $phone ) && ! empty ( $email ) && ! empty ( $gender ) && ! empty ( $birthday ) && ! empty ( $qualifications ) && ! empty ( $nativePlace ) && ! empty ( $emergencyContacts ) && ! empty ( $living )) {			Doo::loadClass ( 'XDeode' );			$XDeode = new XDeode ( 5 );			Doo::loadModel ( 'staff' );			$staff = new staff ();						$sid = $XDeode->decode ( $sidKey );						$item = array (					'sid' => $sid,					'qq' => $qq,					'wecat' => $wecat,					'phone' => $phone,					'email' => $email,										'gender' => $gender,					'birthday' => $birthday,					'qualifications' => $qualifications,					'marriage' => $marriage,										'nativePlace' => $nativePlace,					'emergencyContacts' => $emergencyContacts,					'living' => $living,					// 状态改成入职申请					'pendStatus' => 2 			);			$staff->setStaffByCondition ( $item );			// 操作日志			$staffDetail = $staff->getStaffBySid ( $sid );			Doo::loadModel ( 'staffOperationLog' );			$staffOperationLog = new staffOperationLog ();			$item = array (					'date' => date ( "Y-m-d H:i:s" ),					'status' => 2,					'img' => $staffDetail ['avatar'],					'username' => $staffDetail ['username'],					'operation' => "申请入职",					'uid' => $staffDetail ['sid'],					'category' => $staffDetail ['category'] 			);			$staffOperationLog->setInvoiceOperationLog ( $item );						return '/login';		}		die ( 'illegal request' );	}		/**	 * 申请离职	 */	function appliedDimission() {		$dimissionReason = $this->get_args ( 'dimissionReason' ) ? $this->get_args ( 'dimissionReason' ) : '';		if (empty ( $dimissionReason ))			die ( 'illegal request' );		Doo::loadModel ( 'staff' );		$staff = new staff ();		Doo::loadModel ( 'staffLeaveManage' );		$staffLeaveManage = new staffLeaveManage ();				$item = array (				'sid' => $this->staff ['sid'],				'dimissionReason' => $dimissionReason,				// 状态改成离职申请				'pendStatus' => 3 		);		$staff->setStaffByCondition ( $item );		// 操作日志		Doo::loadModel ( 'staffOperationLog' );		$staffOperationLog = new staffOperationLog ();		$item = array (				'date' => date ( "Y-m-d H:i:s" ),				'status' => 3,				'img' => $this->staff ['avatar'],				'username' => $this->staff ['username'],				'operation' => "申请离职",				'uid' => $this->staff ['sid'],				'category' => $this->staff ['category'] 		);		$staffOperationLog->setInvoiceOperationLog ( $item );				// 离职审批组		// 获得审批组KEY		$staff = new staff ();		$cidMode = $this->staff ['cid'];		if (! empty ( $this->staff ['departmentID'] ))			$cidMode = $this->staff ['cid'] . '_' . $this->staff ['departmentID'];				$staffManageDetail = $staffLeaveManage->getStaffManageByCid ( $cidMode );		if (empty ( $staffManageDetail ))			die ( 'illegal request' );				$pendingApprovalsSid = current ( $staffManageDetail ['staffList'] ) [0];		$staff->pendingApprovalsLeave = $pendingApprovalsSid;		$staff->staffManageLeave = $staffManageDetail ['staff'];		$staff->sid = $this->staff ['sid'];				// 抄送组		$staff->processLeaveCC = $staffManageDetail ['CC'];		$staff->update ();				return '/settingEmployeeInfo';	}		/**	 * 确认离职	 */	function employeeDismiss() {		$sidKey = $this->get_args ( 'sidKey' ) ? $this->get_args ( 'sidKey' ) : "";				if (! empty ( $sidKey )) {						Doo::loadClass ( 'XDeode' );			$XDeode = new XDeode ( 5 );			Doo::loadModel ( 'staff' );			$staff = new staff ();						$sid = $XDeode->decode ( $sidKey );						$detail = $staff->getStaffBySid ( $sid );			if (empty ( $detail ))				die ( 'illegal request' );								// 工龄记录			$seniorityFormula = json_decode ( $detail ['seniorityFormula'],true );			$arr = array_keys ( $seniorityFormula );			$key = end ( $arr );						if (isset($seniorityFormula [$key] ['dimissionDate'])||empty ( $seniorityFormula [$key] ['dimissionDate'] ))				$seniorityFormula [$key] ['dimissionDate'] = date ( "Y-m-d H:i:s" );			else				die ( 'illegal request' );						$staff->seniorityFormula = json_encode ( $seniorityFormula );						$item = array (					'sid' => $sid,					'nature' => 4,					'pendStatus' => 4,					'seniorityFormula' => json_encode ( $seniorityFormula ),					'dimissionDate' => date ( "Y-m-d H:i:s" ) 			);			$staff->setStaffByCondition ( $item );						return '/hrEmployee';		}		die ( 'illegal request' );	}		/**	 * 确认在入职	 */	function employeeReentry() {		$sidKey = $this->get_args ( 'sidKey' ) ? $this->get_args ( 'sidKey' ) : "";				if (! empty ( $sidKey )) {			Doo::loadClass ( 'XDeode' );			$XDeode = new XDeode ( 5 );			Doo::loadModel ( 'staff' );			$staff = new staff ();						$sid = $XDeode->decode ( $sidKey );						$detail = $staff->getStaffBySid ( $sid );			if (empty ( $detail ))				die ( 'illegal request' );				// 工龄记录			$seniorityFormula = json_decode ( $detail ['seniorityFormula'] );						array_push ( $seniorityFormula, array (					'InductionDate' => date ( "Y-m-d H:i:s" ),					'dimissionDate' => '' 			) );						$item = array (					'sid' => $sid,					'nature' => 1,					'pendStatus' => 0,					'seniorityFormula' => json_encode ( $seniorityFormula ),					'hiredate' => date ( "Y-m-d" ) 			);			$staff->setStaffByCondition ( $item );			// 更新假期相关信息			Doo::loadModel ( 'holidaystaff' );			$holidaystaff = new HStaff ();			$holidaystaff->delete ( array (					'where' => 'uid=' . $sid 			) );			$holidaystaff = new HStaff ();			$holidaystaff->uid = $sid;			$holidaystaff->insert ();			$staff = new staff ();			$staffmsg = $staff->getUserById ( $sid );			$this->updateAnnualLeave ( $staffmsg [0] );						return '/hrEmployee';		}		die ( 'illegal request' );	}		/**	 * 员工审批流程	 */	function employeeApprovals() {		Doo::loadModel ( 'staff' );		$staff = new staff ();		Doo::loadModel ( 'L_category' );		$L_category = new L_category ();		Doo::loadModel ( 'staffManage' );		$staffManage = new staffManage ();				// 获得办事和部门		$categoryList = $L_category->getCategoryDepartment ();				$staffManageList = $staffManage->find ( array (				'asArray' => true 		) );				foreach ( $staffManageList as $key => $value ) {			// 审批人员			$name = json_decode ( $value ['staff'] );			$employeeApprovals = array ();			if (count ( $name ) != 0) {				foreach ( $name as $ve ) {					array_push ( $employeeApprovals, $ve [1] );				}			}			$employeeApprovals = implode ( '->', $employeeApprovals );						// 抄送人员			$name = json_decode ( $value ['CC'] );			$CC = array ();			if (count ( $name ) != 0) {				foreach ( $name as $ve ) {					array_push ( $CC, $ve [1] );				}			}			$CC = implode ( ' ', $CC );						foreach ( $categoryList as $k => $v ) {				$cid = $v ['cid'];				if (isset ( $v ['did'] ))					$cid .= '_' . $v ['did'];				if ($cid == $value ['cid']) { // echo $cid.'//';echo $value['cid'].'<br/>';					$categoryList [$k] ['employeeApprovals'] = $employeeApprovals;					$categoryList [$k] ['CC'] = $CC;					break;				}			}		}		foreach ( $categoryList as $key => $value ) {			if (! isset ( $value ['employeeApprovals'] ))				$categoryList [$key] ['employeeApprovals'] = '';			if (! isset ( $value ['CC'] ))				$categoryList [$key] ['CC'] = '';		}				// print_r($categoryList);		$stafflist = $staff->getStaff ( true );				$this->data ['categoryList'] = $categoryList;		$this->data ['staffList'] = $stafflist;				$this->data ['memu'] = "HumanResource";		$this->data ['hrMemu'] = "employeeApprovals";				$this->render ( "/humanResource/employeeApprovals", $this->data );	}		/**	 * 添加员工审批人员	 */	function employeeApprovalsAdd() {		$cidKey = $this->get_args ( 'cidKey' ) ? $this->get_args ( 'cidKey' ) : "";		$uidlist = $this->get_args ( 'uidlist' ) ? $this->get_args ( 'uidlist' ) : "";		$uidlist = explode ( ",", $uidlist );				if (! empty ( $cidKey ) && ! empty ( $uidlist )) {			Doo::loadModel ( "staffManage" );			$staffManage = new staffManage ();			Doo::loadClass ( 'XDeode' );			$XDeode = new XDeode ( 5 );						// 获得抄送内容			$approvalKey = explode ( '_', $cidKey );			$cidMode = array ();			foreach ( $approvalKey as $value ) {				$cid = $XDeode->decode ( $value );				array_push ( $cidMode, $cid );			}						$cidMode = implode ( '_', $cidMode );			// echo $cidMode;die;			$staffManageInfo = $staffManage->getOne ( array (					'where' => 'cid ="' . $cidMode . '" ',					'asArray' => true 			) );						// 审批人员			$list = array ();			foreach ( $uidlist as $key => $value ) {				$info = explode ( ":", $value );				array_push ( $list, $info );			}						if (empty ( $staffManageInfo )) {				$staffManage = new staffManage ();								$staffManage->cid = $cidMode;				$staffManage->staff = json_encode ( $list );								$staffManage->insert ();			} else {				$staffManage = new staffManage ();								$staffManage->staff = json_encode ( $list );				$staffManage->update ( array (						'where' => 'icid = ' . $staffManageInfo ['icid'] 				) );			}			return '/employeeApprovals';		}		die ( 'illegal request' );	}		/**	 * 添加抄送员工,微信通知	 */	function employeeCCAdd() {		$cidKey = $this->get_args ( 'cidKey' ) ? $this->get_args ( 'cidKey' ) : "";		$staff = $this->get_args ( 'staff' ) ? $this->get_args ( 'staff' ) : "";				if (! empty ( $cidKey ) && ! empty ( $staff )) {			Doo::loadModel ( "staffManage" );			$staffManage = new staffManage ();			Doo::loadClass ( 'XDeode' );			$XDeode = new XDeode ( 5 );						// 获得抄送内容			$approvalKey = explode ( '_', $cidKey );			$cidMode = array ();			foreach ( $approvalKey as $value ) {				$cid = $XDeode->decode ( $value );				array_push ( $cidMode, $cid );			}						$cidMode = implode ( '_', $cidMode );			$staffManageInfo = $staffManage->getOne ( array (					'where' => 'cid ="' . $cidMode . '" ',					'asArray' => true 			) );						$list = array ();			foreach ( $staff as $key => $value ) {				$info = explode ( ":", $value );				array_push ( $list, $info );			}						if (empty ( $staffManageInfo )) {				$staffManage = new staffManage ();								$staffManage->cid = $cidMode;				$staffManage->CC = json_encode ( $list );								$staffManage->insert ();			} else {				$staffManage = new staffManage ();								$staffManage->CC = json_encode ( $list );				$staffManage->update ( array (						'where' => 'icid = ' . $staffManageInfo ['icid'] 				) );			}			return '/employeeApprovals';		}		die ( 'illegal request' );	}		/**	 * 离职审批流程设置	 */	function leaveOfficeApprovals() {		Doo::loadModel ( 'staff' );		$staff = new staff ();		Doo::loadModel ( 'L_category' );		$L_category = new L_category ();		Doo::loadModel ( 'staffLeaveManage' );		$staffManage = new staffLeaveManage ();				// 获得办事和部门		$categoryList = $L_category->getCategoryDepartment ();				$staffManageList = $staffManage->find ( array (				'asArray' => true 		) );				foreach ( $staffManageList as $key => $value ) {			// 审批人员			$name = json_decode ( $value ['staff'] );			$employeeApprovals = array ();			if (count ( $name ) != 0) {				foreach ( $name as $ve ) {					array_push ( $employeeApprovals, $ve [1] );				}			}			$employeeApprovals = implode ( '->', $employeeApprovals );						// 抄送人员			$name = json_decode ( $value ['CC'] );			$CC = array ();			if (count ( $name ) != 0) {				foreach ( $name as $ve ) {					array_push ( $CC, $ve [1] );				}			}			$CC = implode ( ' ', $CC );						foreach ( $categoryList as $k => $v ) {				$cid = $v ['cid'];				if (isset ( $v ['did'] ))					$cid .= '_' . $v ['did'];				if ($cid == $value ['cid']) { // echo $cid.'//';echo $value['cid'].'<br/>';					$categoryList [$k] ['employeeApprovals'] = $employeeApprovals;					$categoryList [$k] ['CC'] = $CC;					break;				}			}		}		foreach ( $categoryList as $key => $value ) {			if (! isset ( $value ['employeeApprovals'] ))				$categoryList [$key] ['employeeApprovals'] = '';			if (! isset ( $value ['CC'] ))				$categoryList [$key] ['CC'] = '';		}				// print_r($categoryList);		$stafflist = $staff->getStaff ( true );				$this->data ['categoryList'] = $categoryList;		$this->data ['staffList'] = $stafflist;				$this->data ['memu'] = "HumanResource";		$this->data ['hrMemu'] = "employeeApprovals";				$this->render ( "/humanResource/leaveOfficeApprovals", $this->data );	}		/**	 * 添加员工审批人员	 */	function employeeleaveApprovalsAdd() {		$cidKey = $this->get_args ( 'cidKey' ) ? $this->get_args ( 'cidKey' ) : "";		$uidlist = $this->get_args ( 'uidlist' ) ? $this->get_args ( 'uidlist' ) : "";		$uidlist = explode ( ",", $uidlist );				if (! empty ( $cidKey ) && ! empty ( $uidlist )) {			Doo::loadModel ( "staffLeaveManage" );			$staffManage = new staffLeaveManage ();			Doo::loadClass ( 'XDeode' );			$XDeode = new XDeode ( 5 );						// 获得抄送内容			$approvalKey = explode ( '_', $cidKey );			$cidMode = array ();			foreach ( $approvalKey as $value ) {				$cid = $XDeode->decode ( $value );				array_push ( $cidMode, $cid );			}						$cidMode = implode ( '_', $cidMode );			// echo $cidMode;die;			$staffManageInfo = $staffManage->getOne ( array (					'where' => 'cid ="' . $cidMode . '" ',					'asArray' => true 			) );						// 审批人员			$list = array ();			foreach ( $uidlist as $key => $value ) {				$info = explode ( ":", $value );				array_push ( $list, $info );			}						if (empty ( $staffManageInfo )) {				$staffManage = new staffLeaveManage ();								$staffManage->cid = $cidMode;				$staffManage->staff = json_encode ( $list );								$staffManage->insert ();			} else {				$staffManage = new staffLeaveManage ();								$staffManage->staff = json_encode ( $list );				$staffManage->update ( array (						'where' => 'icid = ' . $staffManageInfo ['icid'] 				) );			}			return '/leaveOfficeApprovals';		}		die ( 'illegal request' );	}		/**	 * 添加抄送员工,微信通知	 */	function employeeleaveCCAdd() {		$cidKey = $this->get_args ( 'cidKey' ) ? $this->get_args ( 'cidKey' ) : "";		$staff = $this->get_args ( 'staff' ) ? $this->get_args ( 'staff' ) : "";				if (! empty ( $cidKey ) && ! empty ( $staff )) {			Doo::loadModel ( "staffLeaveManage" );			$staffManage = new staffLeaveManage ();			Doo::loadClass ( 'XDeode' );			$XDeode = new XDeode ( 5 );						// 获得抄送内容			$approvalKey = explode ( '_', $cidKey );			$cidMode = array ();			foreach ( $approvalKey as $value ) {				$cid = $XDeode->decode ( $value );				array_push ( $cidMode, $cid );			}						$cidMode = implode ( '_', $cidMode );			$staffManageInfo = $staffManage->getOne ( array (					'where' => 'cid ="' . $cidMode . '" ',					'asArray' => true 			) );						$list = array ();			foreach ( $staff as $key => $value ) {				$info = explode ( ":", $value );				array_push ( $list, $info );			}						if (empty ( $staffManageInfo )) {				$staffManage = new staffLeaveManage ();								$staffManage->cid = $cidMode;				$staffManage->CC = json_encode ( $list );								$staffManage->insert ();			} else {				$staffManage = new staffLeaveManage ();								$staffManage->CC = json_encode ( $list );				$staffManage->update ( array (						'where' => 'icid = ' . $staffManageInfo ['icid'] 				) );			}			return '/leaveOfficeApprovals';		}		die ( 'illegal request' );	}		/**	 * 员工权限管理	 */	function hrEmployeeApprovalsSetting() {		$pendStatus = $this->get_args ( 'pendStatus' ) ? $this->get_args ( 'pendStatus' ) : "ALL";		$nature = $this->get_args ( 'nature' ) ? $this->get_args ( 'nature' ) : 'ALL';		$cid_did = $this->get_args ( 'cid_did' ) ? $this->get_args ( 'cid_did' ) : 'ALL';		$MebSea = $this->get_args ( 'MebSea' ) ? $this->get_args ( 'MebSea' ) : '';				Doo::loadClass ( 'XDeode' );		$XDeode = new XDeode ( 5 );				$con = '  username != "admin" ';		if ($pendStatus == 'ALL')			$con .= '  ';		elseif ($pendStatus == 'OTJOB')			$con .= ' and pendStatus=0 ';		elseif ($pendStatus == 'LVJOB')			$con .= ' and pendStatus=4 ';				if ($nature == 'ALL')			$con .= ' and (nature=1 or nature=2 or nature=3 or nature=4) ';		elseif ($nature == 'FORMAL')			$con .= ' and  nature=1';		elseif ($nature == 'TRIAL')			$con .= ' and  nature=2';		elseif ($nature == 'PRACTICE')			$con .= ' and  nature=3';				if ($cid_did != 'ALL') {			$department = explode ( '_', $cid_did );			$cid = $XDeode->decode ( $department [0] );			$departmentID = false;			if (! empty ( $department [1] )) {				$departmentID = $XDeode->decode ( $department [1] );			}			if (is_numeric ( $cid ) && is_numeric ( $departmentID ))				$con .= ' and  cid=' . $cid . ' and departmentID=' . $departmentID;			elseif (is_numeric ( $cid ) && ! is_numeric ( $departmentID ))				$con .= ' and  cid=' . $cid;		}				if (! empty ( $MebSea ))			$con .= ' and ( username like "%' . $MebSea . '%" or jobNumber like "%' . $MebSea . '%" )';				Doo::loadModel ( 'staff' );		$staff = new staff ();		Doo::loadModel ( 'L_category' );		$L_category = new L_category ();		Doo::loadModel ( 'district' );		$district = new district ();				$stafflist = $staff->getStaffByCondition ( $con );				// print_r($stafflist);				$monthstart = date ( 'Y-m-d 00:00:00', mktime ( 0, 0, 0, date ( 'm' ), 1, date ( 'Y' ) ) );		$monthend = date ( 'Y-m-d 23:59:59', mktime ( 0, 0, 0, date ( 'm' ) + 1, 0, date ( 'Y' ) ) );				// 本月在职 入职 离职人员数量		$onJobCount = $staff->count ( array (				'where' => 'pendStatus=0 and username!="admin"' 		) );		$inJobCount = $staff->count ( array (				'where' => 'pendStatus=0 and username!="admin" and (InductionDate>="' . $monthstart . '" and InductionDate<="' . $monthend . '" )' 		) );		$leaveJobCount = $staff->count ( array (				'where' => 'pendStatus=4 and username!="admin" and (dimissionDate>="' . $monthstart . '" and dimissionDate<="' . $monthend . '" )' 		) );				// 生成工号		$jobNumber = $this->createJobNumber ();		// 获得办事和部门		$categoryList = $L_category->getCategoryDepartment ();				$monthstart = date ( 'm.d', mktime ( 0, 0, 0, date ( 'm' ), 1, date ( 'Y' ) ) );		$monthend = date ( 'm.d', mktime ( 0, 0, 0, date ( 'm' ) + 1, 0, date ( 'Y' ) ) );				// 员工可选的		$this->data ['districtList'] = $district->get_lv ( 1 );				$this->data ['onJobCount'] = $onJobCount;		$this->data ['inJobCount'] = $inJobCount;		$this->data ['leaveJobCount'] = $leaveJobCount;				$this->data ['monthstart'] = $monthstart;		$this->data ['monthend'] = $monthend;				$this->data ['pendStatus'] = $pendStatus;		$this->data ['nature'] = $nature;		$this->data ['MebSea'] = $MebSea;		$this->data ['cid_did'] = $cid_did;				$this->data ['categoryList'] = $categoryList;		$this->data ['jobNumber'] = $jobNumber;		$this->data ['stafflist'] = $stafflist;				$this->data ['memu'] = "HumanResource";		$this->data ['hrMemu'] = "hrEmployeeInfo";				$this->render ( "/humanResource/hrEmployeeApprovalsSetting", $this->data );	}		/**	 * 设置员工访问CLD权限	 */	function hrEmployeeAccess() {		$sidKey = $this->get_args ( 'sidKey' ) ? $this->get_args ( 'sidKey' ) : '';		$access = $this->get_args ( 'access' ) ? $this->get_args ( 'access' ) : "";				if (! empty ( $sidKey )) {			Doo::loadClass ( 'XDeode' );			$XDeode = new XDeode ( 5 );			Doo::loadModel ( 'staff' );			$staff = new staff ();						$sid = $XDeode->decode ( $sidKey );			$detail = $staff->getStaffBySid ( $sid );						$access = json_encode ( $access );						$staff->cldAccess = $access;			$staff->update ( array (					'where' => 'sid=' . $sid 			) );						return '/hrEmployeeApprovalsSetting';		}				die ( 'illegal request' );	}		/**	 * 添加浏览省份的权限	 */	function addUserDistrictAuthor() {		$didKey = $this->get_args ( 'didKey' ) ? $this->get_args ( 'didKey' ) : array ();		$sidKey = $this->get_args ( 'sidKey' ) ? $this->get_args ( 'sidKey' ) : array ();				if (! empty ( $didKey ) && ! empty ( $sidKey )) {			Doo::loadModel ( 'staff' );			$staff = new staff ();			Doo::loadClass ( 'XDeode' );			$XDeode = new XDeode ( 5 );						$sid = $XDeode->decode ( $sidKey );			$sDetail = $staff->getStaffBySid ( $sid );						$sDidList = explode ( ',', $sDetail ['did'] );						$staff->did = implode ( ',', $didKey );			$staff->sid = $sid;			$staff->update ();			return '/hrEmployeeApprovalsSetting';		}		die ( 'illegal request' );	}		/**	 * 获得员工信息(未编写html)	 */	function ajaxGetStaffInfoBySid() {		$serial = $this->get_args ( 'serial' ) ? $this->get_args ( 'serial' ) : "";		if (empty ( $serial )) {			echo json_encode ( array (					'status' => 2,					'msg' => 'illegal request' 			) );			die ();		}				Doo::loadClass ( 'XDeode' );		$XDeode = new XDeode ( 5 );		Doo::loadModel ( 'staff' );		$staff = new staff ();				$sid = $XDeode->decode ( $serial );		$detail = $staff->getStaffBySid ( $sid );				echo json_encode ( array (				'status' => 1,				'detail' => $detail 		) );		die ();	}		/**	 * 获得员工信息	 */	function ajaxGetStaffInfoByType() {		$type = $this->get_args ( 'type' ) ? $this->get_args ( 'type' ) : "";		$serial = $this->get_args ( 'serial' ) ? $this->get_args ( 'serial' ) : "";		// $loss = $this->get_args ( 'loss' ) ? $this->get_args ( 'loss' ) : false;				if (empty ( $serial )) {			echo json_encode ( array (					'status' => 2,					'msg' => 'illegal request' 			) );			die ();		}				Doo::loadClass ( 'XDeode' );		$XDeode = new XDeode ( 5 );				if ($type == 'STAFF') {			Doo::loadModel ( 'staff' );			$staff = new staff ();			Doo::loadModel ( 'staffOperationLog' );			$staffOperationLog = new staffOperationLog ();						$sid = $XDeode->decode ( $serial );			$detail = $staff->getStaffBySid ( $sid );						// 获得操作日志			$SOPL = $staffOperationLog->getInvoiceOperationLogByUid ( $sid, 'desc' );			if (empty ( $detail ))				$html = '';			else {				$html = '				<div class="modal-body saeaList">					<div class="fL staff-detail-con">						<table class="table table-bordered table-condensed">						<tbody>							<tr>								<th class="taC" width="150">工号</th><td width="210">' . $detail ['jobNumber'] . '</td>								<th class="taC" width="150">姓名</th><td width="210">' . $detail ['username'] . '</td>							</tr>							<tr>								<th class="taC" width="150">办事处/部门</th><td>' . $detail ['category'] . '/' . $detail ['department'] ['departmentName'] . '</td>								<th class="taC" width="150">岗位</th><td>' . $detail ['position'] . '</td>							</tr>							<tr>								<th class="taC" width="150">入职日期</th><td>' . $detail ['hiredate'] . '</td>								<th class="taC" width="150">手机</th><td>' . $detail ['telephone'] . '</td>							</tr>							<tr>								<th class="taC">QQ</th><td>' . $detail ['qq'] . '</td>								<th class="taC">微信</th><td>' . $detail ['wecat'] . '</td>							</tr>							<tr>								<th class="taC">电话</th><td>' . $detail ['phone'] . '</td>								<th class="taC">邮箱</th><td>' . $detail ['email'] . '</td>							</tr>						</tbody>					</table>					<table class="table table-bordered table-condensed">							<tbody><tr>								<th class="taC" width="150">性别</th><td width="210">' . $detail ['gender'] . '</td>								<th class="taC" width="150">出生日期</th><td>' . $detail ['birthday'] . '</td>							</tr>							<tr>								<th class="taC" width="150">最高学历</th><td>' . $detail ['qualifications'] . '</td>								<th class="taC" width="150">婚姻状况</th><td>																				';														if ($detail ['marriage']==0) 				$html.='未婚';				elseif($detail ['marriage']==1)				$html.='已婚';																							$html.='												</td>							</tr>							<tr>								<th class="taC" width="150">籍贯</th><td colspan="3">' . $detail ['nativePlace'] . '</td>							</tr>							<tr>								<th class="taC" width="150">现居住地址</th><td colspan="3">' . $detail ['living'] . '</td>							</tr>						</tbody>					</table>					<table class="table table-bordered table-condensed">							<tbody><tr>								<th class="taC" width="150">基本工资</th><td width="210">' . $detail ['baseWage'] . '</td>								<th class="taC" width="150">岗位工资</th><td>' . $detail ['postWage'] . '</td>							</tr>							<tr>								<th class="taC" width="150">绩效奖金</th><td>' . $detail ['achievementBonus'] . '</td>								<th class="taC" width="150"></th><td></td>							</tr>						</tbody>					</table>					</div>																																			<div class="fL staff-detail-side">						<!--入职试用 & 离职后再入职试用-->						';								foreach ( $SOPL as $key => $value ) {					$html .= '<div class="infoFlowList">						 <div class="dateTitle">				<em class="month"><span class="num">' . date ( 'm', strtotime ( $value ['date'] ) ) . '</span><span class="text">-' . date ( 'd', strtotime ( $value ['date'] ) ) . '</span></em>							 <span class="year">' . date ( 'Y', strtotime ( $value ['date'] ) ) . '</span>						 </div>						 <ul class="flowList">							 <li class="item colGray">' . $value ['category'] . '-' . $value ['username'] . '</li>							 <li class="item">' . $value ['operation'] . '</li>						 </ul>						</div>';				}								$html .= '											</div>																								</div>										';			}			echo json_encode ( array (					'status' => 1,					'sidKey' => $serial,					'html' => $html 			) );			die ();		} elseif ($type == 'EMPLOYEE') {						Doo::loadModel ( 'staff' );			$staff = new staff ();			Doo::loadModel ( 'L_category' );			$L_category = new L_category ();			Doo::loadModel ( 'staffOperationLog' );			$staffOperationLog = new staffOperationLog ();						// 获得办事和部门			$categoryList = $L_category->getCategoryDepartment ();						$sid = $XDeode->decode ( $serial );			$detail = $staff->getStaffBySid ( $sid );			// 获得操作日志			$SOPL = $staffOperationLog->getInvoiceOperationLogByUid ( $sid, 'desc' );						if (empty ( $detail ))				$html = '';			else {				$html = '																		<div class="modal-header">					<h3>员工详情</h3>				</div>				<div class="modal-body saeaList" style="overflow:hidden;margin:0">					<div class="fL staff-detail-con">						<table class="table table-bordered table-condensed">						<tbody>						<tr>							<th class="taC" width="150">工号</th><td width="210">' . $detail ['jobNumber'] . '</td>							<th class="taC" width="150">姓名</th><td>' . $detail ['username'] . '</td>						</tr>						<tr>							<th class="taC" width="150">办事处/部门</th><td>																	<select name="cid_did" id="cid_did">									';								foreach ( $categoryList as $key => $value ) {					$html .= '<option value="' . $value ['cidKey'] . '_';					if (! empty ( $value ['did'] ))						$html .= $value ['didKey'];					$html .= '">' . $value ['title'];					if (! empty ( $value ['did'] ))						$html .= '/' . $value ['departmentName'] . '</option>';				}								$html .= '	</select>						</td>							<th class="taC" width="150">岗位</th><td><input type="text" name="position" id="position" value="' . $detail ['position'] . '"></td>						</tr>						<tr>							<th class="taC" width="150">入职日期</th><td><input type="date"  name="hiredate" id="hiredate" value="' . $detail ['hiredate'] . '"></td>							<th class="taC" width="150">手机</th><td><input type="text"  name="telephone" id="telephone" value="' . $detail ['telephone'] . '"></td>						</tr>						<tr>							<th class="taC">QQ</th><td><input type="text"  name="qq" id="qq" value="' . $detail ['qq'] . '"></td>							<th class="taC">微信</th><td><input type="text"  name="wecat" id="wecat" value="' . $detail ['wecat'] . '"></td>						</tr>						<tr>							<th class="taC">电话</th><td><input type="text"  name="phone" id="phone" value="' . $detail ['phone'] . '"></td>							<th class="taC">邮箱</th><td><input type="text"  name="email" id="email" value="' . $detail ['email'] . '"></td>						</tr>						</tbody>					</table>						<table class="table table-bordered table-condensed">							<tr>								<th class="taC" width="150">性别</th><td width="210">									<label class="radio inline"><input type="radio" name="gender" ';				if ($detail ['gender'] == '男')					$html .= 'checked';				$html .= ' value="男" data-rule="checked" >男</label> 									<label class="radio inline"><input type="radio" name="gender"  ';				if ($detail ['gender'] == '女')					$html .= 'checked';				$html .= '  value="女" >女</label>									</td>								<th class="taC" width="150">出生日期</th><td><input type="date"  name="birthday" id="birthday" value="' . $detail ['birthday'] . '"></td>							</tr>							<tr>								<th class="taC" width="150">最高学历</th><td>							<select name="qualifications" id="qualifications">							<option ';				if ($detail ['qualifications'] == '初中')					$html .= 'selected';				$html .= ' value="初中">初中</option>							<option ';				if ($detail ['qualifications'] == '高中')					$html .= 'selected';				$html .= ' value="高中">高中</option>							<option ';				if ($detail ['qualifications'] == '中专')					$html .= 'selected';				$html .= ' value="中专">中专</option>							<option ';				if ($detail ['qualifications'] == '大专')					$html .= 'selected';				$html .= ' value="大专">大专</option>							<option ';				if ($detail ['qualifications'] == '本科')					$html .= 'selected';				$html .= ' value="本科">本科</option>							<option ';				if ($detail ['qualifications'] == '硕士')					$html .= 'selected';				$html .= ' value="硕士">硕士</option>							</select>										</td>																	<th class="taC" width="150">婚姻状况</th>						<td>							<select name="marriage" id="marriage">							<option ';				if ($detail ['marriage'] == '')					$html .= 'selected';				$html .= ' value="">请选择</option>							<option ';				if ($detail ['marriage'] == '1')					$html .= 'selected';				$html .= ' value="1">已婚</option>							<option ';				if ($detail ['marriage'] == '0')					$html .= 'selected';				$html .= ' value="0">未婚</option>							</select>						</td>							</tr>																													<tr>								<th class="taC" width="150">身份证</th>								<td><input type="text"  name="IDcards" id="IDcards" value="' . $detail ['IDcards'] . '"></td>								<th class="taC" width="150">身份证扫描件</th>								<td>								<a href="#" target="_blank">正面(国徽)</a>								<a href="#" target="_blank">反面(照片)</a>								</td>							</tr>						</table>						<table class="table table-bordered table-condensed">							<tr>								<th class="taC" width="150">毕业证书</th>								<td width="210">								<a href="#" target="_blank">毕业证书</a>								</td>								<th class="taC" width="150">学位证书</th>								<td>								<a href="#" target="_blank">学位证书</a>								</td>							</tr>							<tr>								<th class="taC" width="150">职称</th><td colspan="3"><a href="#" target="_blank">证书1</a> <a href="#" target="#">证书2</a></td>							</tr>						</table>																										<table class="table table-bordered table-condensed">							<tr>								<th class="taC" width="150">现居住地</th>										<td colspan="3"><input type="text"  name="living" id="living" value="' . $detail ['living'] . '" style="width:500px"></td>							</tr>							<tr>								<th class="taC" width="150">籍贯</th>								<td width="210"><input type="text"  name="nativePlace" id="nativePlace" value="' . $detail ['nativePlace'] . '"></td>								<th class="taC" width="150">紧急联系人</th>								<td><input type="text"  name="emergencyContacts" id="emergencyContacts" value="' . $detail ['emergencyContacts'] . '"></td>							</tr>						</table>						<table class="table table-bordered table-condensed">							<tr>								<th class="taC" width="150">汇款人户名</th>								<td width="210"><input type="text"  name="remittanceName" id="remittanceName" value="' . $detail ['remittanceName'] . '"></td>								<th class="taC" width="150">联行号</th>								<td colspan="3"><input type="text"  name="coupletNumber" id="coupletNumber" value="' . $detail ['coupletNumber'] . '"></td>							</tr>							<tr>								<th class="taC" width="150">汇款开户银行名称</th>								<td width="210">									<input type="text"  name="bankName" id="bankName" value="' . $detail ['bankName'] . '">								</td>								<th class="taC" width="150">汇款帐号</th>								<td><input type="text"  name="bankNumber" id="bankNumber" value="' . $detail ['bankNumber'] . '"></td>							</tr>													</table>					</div>																																			<div class="fL staff-detail-side">						<!--入职试用 & 离职后再入职试用-->						';								foreach ( $SOPL as $key => $value ) {					$html .= '<div class="infoFlowList">						 <div class="dateTitle">				<em class="month"><span class="num">' . date ( 'm', strtotime ( $value ['date'] ) ) . '</span><span class="text">-' . date ( 'd', strtotime ( $value ['date'] ) ) . '</span></em>							 <span class="year">' . date ( 'Y', strtotime ( $value ['date'] ) ) . '</span>						 </div>						 <ul class="flowList">							 <li class="item colGray">' . $value ['category'] . '-' . $value ['username'] . '</li>							 <li class="item">' . $value ['operation'] . '</li>						 </ul>						</div>';				}								$html .= '											</div>				</div>												';			}						echo json_encode ( array (					'status' => 1,					'sidKey' => $serial,					'html' => $html 			) );			die ();		} elseif ($type == 'IRTC') {						Doo::loadModel ( 'invoice' );			$invoice = new invoice ();			Doo::loadModel ( 'invoiceOperationLog' );			$invoiceOperationLog = new invoiceOperationLog ();			Doo::loadModel ( 'invoiceReceivables' );			$invoiceReceivables = new invoiceReceivables ();						$detail = $invoice->getInvoiceByIsid ( $serial, $this->staff [0] ['sid'] );			$invoiceOperationLogList = $invoiceOperationLog->getInvoiceOperationLogByIid ( $detail ['iid'] );						if (empty ( $detail ))				$html = '';			else {								$receivablesPriceedHtml = '';				$receivablesPrice = $detail ['invoicePrice'];				if (! empty ( $detail ['irid'] )) {										$irList = $invoiceReceivables->getInvoiceReceivablesInIridString ( $detail ['irid'] );										if (empty ( $irList ))						$irList [0] ['sumPrice'] = 0;										$balance = $detail ['invoicePrice'] - $irList [0] ['sumPrice'];										$receivablesPriceedHtml = '<table class="table table-bordered table-condensed"><tbody><tr>								<th class="taC">已入账金额</th><td><b class="colGreen" style="font-size:18px">¥' . $irList [0] ['sumPrice'] . '</b></td>						<th class="taC">剩余入账金额</th><td><b class="colRed" style="font-size:18px">¥' . $balance . '</b></td>							</tr></tbody></table>';					$receivablesPrice = $balance;				}								if ($loss)					$detail ['invoicePrice'] = - $detail ['invoicePrice'];				$html = $receivablesPriceedHtml . '						<table class="table table-bordered table-condensed"><tbody>						<tr>							<th class="taC" width="150">开票流水号</th><td>' . $detail ['invoiceSerial'] . '</td>							<th class="taC" width="150">提交时间</th><td>' . $detail ['date'] . '</td>						</tr>						<tr>							<th class="taC" width="150">所在办事处</th><td>' . $detail ['categoryName'] . '(' . $detail ['userName'] . ')</td>							<th class="taC" width="150">开票内容</th><td>' . $detail ['invoiceElement'] . '</td>						</tr>								<tr>							<th class="taC" width="150">发票备注</th><td colspan="3">' . $detail ['remark'] . '</td>						</tr>								<tr>							<th class="taC" width="150">数量</th><td><b>' . $detail ['invoiceQuantity'] . '</b></td>							<th class="taC">单价</th><td><b>¥' . $detail ['invoiceUnitPrice'] . '</b></td>						</tr>											<tr>							<th class="taC">开票金额</th><td  colspan="3"><b class="colOrange" style="font-size:18px">¥' . $detail ['invoicePrice'] . '</b></td>										</tr></tbody></table>';								if ($detail ['invoiceType'] == 0) {					$html .= '<table class="table table-bordered table-condensed"><tbody>							<tr><th colspan="4" class="taC">增值税普通发票</th></tr><tr>							<th class="taC" width="150">发票抬头</th><td >' . $detail ['invoiceTitle'] . '</td>							<th class="taC" width="150">纳税人识别码</th><td>' . $detail ['TIN'] . '</td>									</tr>';					$receivablesMessage = $detail ['invoiceTitle'];				} else {					$html .= '<table class="table table-bordered table-condensed"><tbody>							<tr><th colspan="4" class="taC">增值税专用发票</th></tr><tr>							<th class="taC" width="150">单位名称</th><td>' . $detail ['invoiceCompany'] . '</td>							<th class="taC" width="150">纳税人识别码</th><td>' . $detail ['TIN'] . '</td></tr>											';					$receivablesMessage = $detail ['invoiceCompany'];				}				$html .= '<tr>							<th class="taC">注册地址</th><td>' . $detail ['address'] . '</td>							<th class="taC">注册电话</th><td>' . $detail ['phone'] . '</td>						</tr>						<tr>							<th class="taC">开户银行</th><td>' . $detail ['bankAccount'] . '</td>							<th class="taC">银行账号</th><td>' . $detail ['bank'] . '</td>						</tr></tbody></table>';								if ($detail ['doPost'] == 1)					$html .= '<table class="table table-bordered table-condensed"><tbody><tr><th colspan="4" class="taC">邮寄信息</th></tr><tr>							<th class="taC" width="150">收件人</th><td>' . $detail ['recipients'] . '</td>							<th class="taC" width="150">收件人手机/电话</th><td>' . $detail ['recipientsPhone'] . '</td>						</tr><tr>							<th class="taC" width="150">收件地址</th><td colspan="3">' . $detail ['recipientsAddress'] . '</td>						</tr><tr>							<th class="taC" width="150">邮寄物品</th><td colspan="3">' . $detail ['mailItems'] . '</td>						</tr></tbody></table>';				if (! empty ( $invoiceOperationLogList )) {					$html .= '<table class="table table-bordered table-condensed"><tbody><tr><th width="60%" class="taC">审批流程</th></tr><tr><td>';					foreach ( $invoiceOperationLogList as $key => $value ) {						if ($value ['status'] == 1 || $value ['status'] == 2 || $value ['status'] == 3 || $value ['status'] == 4) {							$html .= '<blockquote><p><span class="colGray">' . $value ['date'] . '</span> 							' . $value ['category'] . '-' . $value ['username'] . ' ';							if ($value ['status'] == 2) {								$html .= '<span class="colGreen">同意</span>';							} elseif ($value ['status'] == 3) {								$html .= '<span class="colOrange">退回</span>';							} elseif ($value ['status'] == 5) {								$html .= '<span class="colGreen">打印</span>';							}							$html .= $value ['operation'] . '</p></blockquote>';						}					}					$html .= '</td></tr></tbody></table>';				}			}						echo json_encode ( array (					'status' => 1,					'html' => $html,					'receivablesPrice' => $receivablesPrice,					'receivablesMessage' => $receivablesMessage,					'receivablesDate' => date ( "Y-m-d" ),					'iidKey' => $serial 			) );			die ();		}	}		/**	 * 生成工号	 */	function createJobNumber() {		Doo::loadModel ( 'staff' );		$staff = new staff ();				$regularStaff = $staff->getStaffJobNumberByNature ( 1 );		$internStaff = $staff->getStaffJobNumberByInformal ();				if (empty ( $regularStaff ['jobNumber'] ))			$regularStaffJobNumber = 'Z0001';		else {			$jobNumber = preg_replace ( '/[^\.0123456789]/s', '', $regularStaff ['jobNumber'] );			$regularStaffJobNumber = 'Z' . sprintf ( "%04d", $jobNumber + 1 );		}				$internStaffJobNumber = $internStaff ['jobNumber'];		if (empty ( $internStaff ['jobNumber'] ))			$internStaffJobNumber = 'C0001';		else {			$jobNumber = preg_replace ( '/[^\.0123456789]/s', '', $internStaff ['jobNumber'] );			$internStaffJobNumber = 'C' . sprintf ( "%04d", $jobNumber + 1 );		}		$list = array (				'regularStaff' => $regularStaffJobNumber,				'internStaff' => $internStaffJobNumber 		);		return $list;	}		/**	 * 获取get或者POST值	 *	 * @param string $name 属性名称	 * @return fixed 值	 */	function get_args($name) {		if (isset ( $_GET [$name] )) {			if (is_array ( $_GET [$name] ))				return $_GET [$name];			else				return addslashes ( $_GET [$name] );		} elseif (isset ( $_POST [$name] )) {			if (is_array ( $_POST [$name] ))				return $_POST [$name];			else				return addslashes ( $_POST [$name] );		} else			return false;	}		// 检查年假是否过期并更新年假	private function updateAnnualLeave($staff) {		Doo::loadModel ( 'holidaystaff' );		$hstaff = new HStaff ();		$hstaffmsg = $hstaff->getOne ( array (				'where' => 'uid=' . $staff ['sid'],				'asArray' => TRUE 		) );		$hiredate = $staff ['hiredate'];		$hadyear = intval ( (time () - strtotime ( $hiredate )) / (86400 * 365) );		if ($hadyear != $hstaffmsg ['hadyear']) {			$hstaff->uid = $staff ['sid'];			$hstaff->hadyear = $hadyear;			$hstaff->yearnum = $hadyear == 0 ? 0 : (($hadyear < 10 && $hadyear >= 1) ? 5 : (($hadyear >= 10 && $hadyear < 20) ? 10 : 15));			$hstaff->update ();		}	}		/**	 * 员工主访问权限	 */	function isEmployeeVisit($employee = array()) {		Doo::loadModel ( 'staff' );		$staff = new staff ();				$staff->getStaffBySid ( $this->staff ['sid'] );				$access = explode ( ',', $employee ['access'] );	}}?>
 |