| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763 | <?php/** * @author darkredz */class HumanResourceController extends DooController {	public $data;	public function beforeRun($resource, $action) {		$this->data ['isHR'] = false;		$this->data ['isALLHR'] = false;				if ($action == 'appliedEntry' || $action == 'appliedDimission') {			return '';		}				Doo::loadModel ( "staffManage" );		$staffManage = new staffManage ();		$smList = $staffManage->getInvoiceCMByStaff ( $_COOKIE ["staff"] );		if (! empty ( $smList )) {			$this->data ['isHR'] = true;		}				Doo::loadModel ( 'staff' );		$staff = new staff ();		$detail = $staff->getStaffBySid ( $_COOKIE ["staff"] );				if ($detail ['sid'] != superHR) {			$accessModular = 'HR';$flag = true;			if (empty ( $detail ['cldAccessArray'] ))				die ( 'illegal request1' );			else {								if (in_array ( $accessModular, $detail ['cldAccessArray'] )) {					if (Doo::acl ()->isAllowed ( $accessModular, $resource, $action )) {						$flag = true;						$this->data ['isALLHR'] = true;					} else {						$flag = false;					}				} else {					if ($this->data ['isHR'])						return '';					else						die ( 'illegal request2' );				}			}						if ( $flag)				die ( 'illegal request3' );		} else {			$this->data ['isALLHR'] = true;		}	}	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" );						$passwork = mt_rand ( 100000, 999999 );			$staff->passwork = md5 ( $passwork );						if (! empty ( $staffDetail ['telephone'] ) && is_numeric ( $staffDetail ['telephone'] )) {				Doo::loadClass ( 'Human.func' );				$msg = $staffDetail ['username'] . ',' . $passwork;				send_sms ( 17280, $staffDetail ['telephone'], '{"%msg%":"' . $msg . '"}' );			}		}				$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->dimissionDate = date ( "Y-m-d" );			$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 employeeRegularApprovals() {		Doo::loadModel ( 'staff' );		$staff = new staff ();		Doo::loadClass ( 'XDeode' );		$XDeode = new XDeode ( 5 );		Doo::loadModel ( 'staffRegularManage' );		$staffLeaveManage = new staffRegularManage ();				$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=5 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 = 0;			// $staff->dimissionDate = date ( "Y-m-d" );			$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() {				// $passwork=mt_rand(100000, 999999);		// //$staff->passwork = md5 ( $passwork );		// $staffDetail['telephone']='13750039378';		// $staffDetail['username']='欧桃珍';				// if (!empty($staffDetail['telephone'])&&is_numeric($staffDetail['telephone'])){		// Doo::loadClass ( 'Human.func' );		// $msg=$staffDetail['username'].','.$passwork;		// send_sms(17280,$staffDetail['telephone'],'{"%msg%":"'.$msg.'"}');		// }		$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' ) : '';		// $this->send_sms();		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 ();		Doo::loadModel ( 'position' );		$position = new position ();				$stafflist = $staff->getStaffByCondition ( $con );				// print_r($stafflist);				/*		 * foreach ($stafflist as $key=>$value){ $staff = new staff (); $staff->sid=$value['sid']; $seniorityFormula = array (); array_push ( $seniorityFormula, array ( 'InductionDate' =>$value['hiredate'] , 'dimissionDate' => '' ) ); if (empty($value['seniorityFormula'])){ $staff->seniorityFormula = json_encode ( $seniorityFormula ); //$staff->update(); } }		 */		$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 ();		//获得岗位		$listPosition = $position->getPositionByAll ();								$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 ['listPosition'] = $listPosition;		$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 )) {						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 ();						// 用户名检测			$detailStaff = $staff->getStaffByName ( $username );			// print_r($detailStaff);			if (! empty ( $detailStaff ))				die ( 'illegal request3' );						$staff->username = $username;			$staff->hiredate = $hiredate;			$staff->nature = $nature;						$position = explode ( '_', $position );						$staff->position = $position[1];			$staff->positionId = $position[0];						$department = explode ( '_', $cid_did );						$cid = $XDeode->decode ( $department [0] );			// 加入默认总部分类			if (! is_numeric ( $cid ))				die ( 'illegal request1' );			$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 request2' );						$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 ();						// 更新假期相关信息			Doo::loadModel ( 'holidaystaff' );			$holidaystaff = new HStaff ();			$holidaystaff->uid = $id;			$holidaystaff->insert ();			$staff = new staff ();						$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' => '/global/img/avtra',					'username' => $username,					'uid' => $id,					'operation' => "添加新员工",					'category' => $cagegory [0] ['title'] 			);			$staffOperationLog->setInvoiceOperationLog ( $item );						if (! empty ( $telephone ) && is_numeric ( $telephone )) {				Doo::loadClass ( 'Human.func' );				send_sms ( 17279, $telephone, '{"%name%":"' . $username . '"}' );			}		}		return '/hrEmployee';	}		/**	 * 员工转职	 */	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' ) : '';		$email = $this->get_args ( 'email' ) ? $this->get_args ( 'email' ) : '';				$phone = $this->get_args ( 'phone' ) ? $this->get_args ( 'phone' ) : '';		$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' ) : '';				$nation = $this->get_args ( 'nation' ) ? $this->get_args ( 'nation' ) : '';		$graduateInstitutions = $this->get_args ( 'graduateInstitutions' ) ? $this->get_args ( 'graduateInstitutions' ) : '';		$major = $this->get_args ( 'major' ) ? $this->get_args ( 'major' ) : '';		$education = $this->get_args ( 'education' ) ? $this->get_args ( 'education' ) : '';		$graduationTime = $this->get_args ( 'graduationTime' ) ? $this->get_args ( 'graduationTime' ) : '';		$registeredResidence = $this->get_args ( 'registeredResidence' ) ? $this->get_args ( 'registeredResidence' ) : '';		$householdRegistrationType = $this->get_args ( 'householdRegistrationType' ) ? $this->get_args ( 'householdRegistrationType' ) : '';		$IDcardsValidity = $this->get_args ( 'IDcardsValidity' ) ? $this->get_args ( 'IDcardsValidity' ) : '';		$IDcards = $this->get_args ( 'IDcards' ) ? $this->get_args ( 'IDcards' ) : '';				// && ! empty ( $wecat ) && ! empty ( $email )		if (! empty ( $sidKey ) && ! empty ( $telephone ) && ! empty ( $qq ) && ! empty ( $phone ) && ! 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,										'nation' => $nation,					'graduateInstitutions' => $graduateInstitutions,					'major' => $major,					'education' => $education,					'graduationTime' => $graduationTime,					'registeredResidence' => $registeredResidence,					'householdRegistrationType' => $householdRegistrationType,					'IDcardsValidity' => $IDcardsValidity,					'IDcards' => $IDcards,										// 状态改成入职申请					'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 );				// 离职审批组		// 获得审批组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];		if (empty ( $pendingApprovalsSid ))			die ( 'illegal request ' );		$staff->pendingApprovalsLeave = $pendingApprovalsSid;		$staff->staffManageLeave = $staffManageDetail ['staff'];		$staff->processApprovalsLeave = '';		$staff->sid = $this->staff ['sid'];				// 抄送组		$staff->processLeaveCC = $staffManageDetail ['CC'];		$staff->update ();				// 操作日志		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 );				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" );			else				die ( 'illegal request' );								// $staff->seniorityFormula = json_encode ( $seniorityFormula );				// 计算工龄天数				// echo $staff->seniorityFormula;			$day = $this->getSeniority ( $seniorityFormula );						$item = array (					'sid' => $sid,					'nature' => 4,					'pendStatus' => 4,					'seniorityFormula' => json_encode ( $seniorityFormula ),					'hireBiasDate' => $day,					'dimissionDate' => date ( "Y-m-d H:i:s" ) 			);			$staff->setStaffByCondition ( $item );						return '/hrEmployee';		}		die ( 'illegal request' );	}		/**	 * 申请转正	 */	function appliedRegular() {		Doo::loadModel ( 'staff' );		$staff = new staff ();		Doo::loadModel ( 'staffRegularManage' );		$staffLeaveManage = new staffRegularManage ();				$item = array (				'sid' => $this->staff ['sid'],				// 状态改成离职申请				'pendStatus' => 5 		);		$staff->setStaffByCondition ( $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];		if (empty ( $pendingApprovalsSid ))			die ( 'illegal request ' );				$staff->pendingApprovalsLeave = $pendingApprovalsSid;		$staff->staffManageLeave = $staffManageDetail ['staff'];		$staff->processApprovalsLeave = '';		$staff->sid = $this->staff ['sid'];				// 抄送组		$staff->processLeaveCC = $staffManageDetail ['CC'];		$staff->update ();				// 操作日志		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 );				return '/settingEmployeeInfo';	}		/**	 * 确认在入职	 */	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' ) : "";		// && ! empty ( $staff )		if (! empty ( $cidKey )) {			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 regularApprovals() {		Doo::loadModel ( 'staff' );		$staff = new staff ();		Doo::loadModel ( 'L_category' );		$L_category = new L_category ();		Doo::loadModel ( 'staffRegularManage' );		$staffManage = new staffRegularManage ();				// 获得办事和部门		$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/regularApprovals", $this->data );	}		/**	 * 添加转正审批人员	 */	function employeRegularApprovalsAdd() {		$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 ( "staffRegularManage" );			$staffManage = new staffRegularManage ();			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 staffRegularManage ();								$staffManage->cid = $cidMode;				$staffManage->staff = json_encode ( $list );								$staffManage->insert ();			} else {				$staffManage = new staffRegularManage ();								$staffManage->staff = json_encode ( $list );				$staffManage->update ( array (						'where' => 'icid = ' . $staffManageInfo ['icid'] 				) );			}			return '/regularApprovals';		}		die ( 'illegal request' );	}		/**	 * 添加抄送员工,微信通知	 */	function employeRegularCCAdd() {		$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 ( "staffRegularManage" );			$staffManage = new staffRegularManage ();			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 staffRegularManage ();								$staffManage->cid = $cidMode;				$staffManage->CC = json_encode ( $list );								$staffManage->insert ();			} else {				$staffManage = new staffRegularManage ();								$staffManage->CC = json_encode ( $list );				$staffManage->update ( array (						'where' => 'icid = ' . $staffManageInfo ['icid'] 				) );			}			return '/regularApprovals';		}		die ( 'illegal request' );	}		/**	 * 晋升流程设置	 */	function promoteApprovals(){		Doo::loadModel ( 'staff' );		$staff = new staff ();		Doo::loadModel ( 'L_category' );		$L_category = new L_category ();		Doo::loadModel ( 'promoteManage' );		$staffManage = new promoteManage ();				// 获得办事和部门		$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/promoteApprovals", $this->data );	}		/**	 * 员工权限管理	 */	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 ();				$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' ) ) );				// 员工可选的		Doo::loadModel ( 'district' );		$district = new district ();		$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' );	}		/**	 * 岗位设置	 */	function position() {		Doo::loadModel ( 'position' );		$position = new position ();				$listPosition = $position->getPositionByAll ();				$this->data ['listPosition'] = $listPosition;				$this->data ['memu'] = "HumanResource";		$this->data ['hrMemu'] = "position";				$this->render ( "/humanResource/position", $this->data );	}		/**	 * 添加岗位设置	 * @return string	 */	function positionAdd() {		$positionName = $this->get_args ( 'positionName' ) ? $this->get_args ( 'positionName' ) : "";		$positionDescribe = $this->get_args ( 'positionDescribe' ) ? $this->get_args ( 'positionDescribe' ) : "";		$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;				if (! empty ( $positionName ) && ! empty ( $positionDescribe ) && ! empty ( $baseWage ) && ! empty ( $postWage ) && ! empty ( $achievementBonus )) {						Doo::loadClass ( 'XDeode' );			$XDeode = new XDeode ( 5 );			Doo::loadModel ( 'position' );			$position = new position ();						$position->positionName = $positionName;			$position->positionDescribe = $positionDescribe;			$position->baseWage = $baseWage;			$position->postWage = $postWage;			$position->achievementBonus = $achievementBonus;						$position->insert ();		}		return '/position';	}		/**	 * 添加岗位设置	 * @return string	 */	function positionUpdate() {		$pidkey = $this->get_args ( 'pidkey' ) ? $this->get_args ( 'pidkey' ) : "";				$positionName = $this->get_args ( 'positionName' ) ? $this->get_args ( 'positionName' ) : "";		$positionDescribe = $this->get_args ( 'positionDescribe' ) ? $this->get_args ( 'positionDescribe' ) : "";		$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;				if (! empty ( $pidkey ) && ! empty ( $positionName ) && ! empty ( $positionDescribe ) && ! empty ( $baseWage ) && ! empty ( $postWage ) && ! empty ( $achievementBonus )) {						Doo::loadClass ( 'XDeode' );			$XDeode = new XDeode ( 5 );			Doo::loadModel ( 'position' );			$position = new position ();						$pid = $XDeode->decode ( $pidkey );						$position->positionName = $positionName;			$position->positionDescribe = $positionDescribe;			$position->baseWage = $baseWage;			$position->postWage = $postWage;			$position->achievementBonus = $achievementBonus;						$position->update ( array (					'where' => ' pid=' . $pid 			) );			// 更新用户岗位信息			Doo::loadModel ( 'staff' );			$staff = new staff ();						$staff->position = $positionName;			$staff->update ( array (					'where' => ' positionId=' . $pid 			) );		}		return '/position';	}		/**	 * 删除单位	 */	function positionDelete() {		$pidkey = $this->get_args ( 'pidkey' ) ? $this->get_args ( 'pidkey' ) : "";				if (! empty ( $pidkey )) {			Doo::loadClass ( 'XDeode' );			$XDeode = new XDeode ( 5 );			Doo::loadModel ( 'position' );			$position = new position ();			Doo::loadModel ( 'staff' );			$staff = new staff ();						$pid = $XDeode->decode ( $pidkey );						$staffCount = $staff->count ( array (					'where' => 'positionId = "' . $pid . '"' 			) );			if ($staffCount != 0)				die ( 'illegal request' );			$position->delete ( array (					'where' => ' pid=' . $pid 			) );		}		return '/position';	}		/**	 * 获得岗位下所有的用户	 */	function ajaxGetStaffByPid() {		$pidkey = $this->get_args ( 'pidkey' ) ? $this->get_args ( 'pidkey' ) : "";		if (empty ( $pidkey )) {			echo json_encode ( array (					'status' => 2,					'msg' => 'illegal request' 			) );			die ();		}		Doo::loadClass ( 'XDeode' );		$XDeode = new XDeode ( 5 );		Doo::loadModel ( 'staff' );		$staff = new staff ();		$list = $staff->getStaffByPositionId ();		$html ='<tr><th class="taC">办事处</th><th class="taC">姓名</th><th class="taC">入职时间</th></tr>';		foreach ( $list as $key => $value ) {						// seniorityFormula			$seniorityFormula = json_decode ( $value ['seniorityFormula'], true );			if (!isset($seniorityFormula[0]))				$seniorityFormula[0]['InductionDate']=0;			$html .= '<tr>				<td>' . $value ['category'] . '</td><td>' . $value ['username'] . '</td><td>' . $seniorityFormula[0]['InductionDate'] . '</td>			</tr>';					}		echo json_encode ( array (				'status' => 1,				'html' => $html		) );		die ();	}		/**	 * 获取岗位信息	 */	function ajaxGetPositionByPid() {		$pidkey = $this->get_args ( 'pidkey' ) ? $this->get_args ( 'pidkey' ) : "";		if (empty ( $pidkey )) {			echo json_encode ( array (					'status' => 2,					'msg' => 'illegal request' 			) );			die ();		}				Doo::loadModel ( 'position' );		$position = new position ();				$detail = $position->getPositionByPid ( $pidkey );				echo json_encode ( array (				'status' => 1,				'detail' => $detail 		) );		die ();	}		/**	 * 获得员工信息(未编写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 ();						Doo::loadModel ( 'position' );			$position = new position ();						// 获得办事和部门			$categoryList = $L_category->getCategoryDepartment ();			//获得岗位			$listPosition = $position->getPositionByAll ();						$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 >						<select name="position" id="position">						';												foreach ($listPosition as $key=>$value){														$positionPid=$XDeode->decode ( $value ['pidKey'] );							if($detail['positionId']==$positionPid){								$html .='<option selected value="'.$value['pidKey'].'_'.$value['positionName'].'">'.$value['positionName'].'</option>';							}else{								$html .='<option value="'.$value['pidKey'].'_'.$value['positionName'].'">'.$value['positionName'].'</option>';							}													}																$html .= '								</select>								</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><input type="text" name="nation" id="nation" value="' . $detail ['nation'] . '"></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 colspan="3">										<input type="date"  name="IDcardsValidity" id="IDcardsValidity" value="' . $detail ['IDcardsValidity'] . '"></td>									</tr>														<tr>								<th class="taC" width="150">身份证扫描件</th>								<td>								<a href="' . $detail ['IDcardsImgA'] . '" target="_blank">正面(国徽)</a>								<a href="' . $detail ['IDcardsImgB'] . '" target="_blank">反面(照片)</a>								</td>																		<th class="taC" width="150">籍贯</th>								<td width="210"><input type="text"  name="nativePlace" id="nativePlace" value="' . $detail ['nativePlace'] . '"></td>							</tr>																					<tr>								<th class="taC" width="150">户口所在地</th><td><input type="text" name="registeredResidence" id="registeredResidence" value="' . $detail ['registeredResidence'] . '" ></td>								<th class="taC" width="150">户籍类型</th><td>										<select name="householdRegistrationType" id="householdRegistrationType">																				<option ';				if ($detail ['householdRegistrationType'] == '')					$html .= 'selected';				$html .= ' value="">请选择</option>							<option ';				if ($detail ['householdRegistrationType'] == '城镇户口')					$html .= 'selected';				$html .= ' value="城镇户口">城镇户口</option>							<option ';				if ($detail ['householdRegistrationType'] == '农业户口')					$html .= 'selected';				$html .= ' value="农业户口">农业户口</option>																				</select></td>							</tr>																		<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><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="graduateInstitutions" id="graduateInstitutions" value="' . $detail ['graduateInstitutions'] . '"></td>								<th class="taC" width="150">所学专业</th><td>										<input type="text" name="major" id="major" value="' . $detail ['major'] . '"></td>							</tr>																		<tr><th class="taC" width="150">毕业学历</th>							<td><select name="education" id="education">																				<option ';				if ($detail ['education'] == '')					$html .= 'selected';				$html .= ' value="">请选择</option>							<option ';				if ($detail ['education'] == '初中')					$html .= 'selected';				$html .= ' value="初中">初中</option>							<option ';				if ($detail ['education'] == '高中')					$html .= 'selected';				$html .= ' value="高中">高中</option>											<option ';				if ($detail ['education'] == '中专')					$html .= 'selected';				$html .= ' value="中专">中专</option>						<option ';				if ($detail ['education'] == '大专')					$html .= 'selected';				$html .= ' value="大专">大专</option>						<option ';				if ($detail ['education'] == '本科')					$html .= 'selected';				$html .= ' value="本科">本科</option>						<option ';				if ($detail ['education'] == '硕士')					$html .= 'selected';				$html .= ' value="硕士">硕士</option>																																																						</select>												</td>								<th class="taC" width="150">毕业时间</th>								<td><input type="date" name="graduationTime" id="graduationTime" value="' . $detail ['graduationTime'] . '"></td>							</tr>																								<tr>								<th class="taC" width="150">毕业证书</th>								<td width="210">';								foreach ( $detail ['certificateArray'] as $key => $value ) {					$html .= '<a href="' . $detail ['webSite'] . $value . '" target="_blank">毕业证书</a> ';				}								$html .= '</td>								<th class="taC" width="150">学位证书</th>								<td>';				foreach ( $detail ['diplomaArray'] as $key => $value ) {					$html .= '<a href="' . $detail ['webSite'] . $value . '" target="_blank">学位证书</a> ';				}								$html .= '	</td>							</tr>							<tr>								<th class="taC" width="150">职称</th>								<td >';				foreach ( $detail ['professionalTitleArray'] as $key => $value ) {					$html .= '<a href="' . $detail ['webSite'] . $value . '" target="_blank">证书</a> ';				}				$html .= '</td>						<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>							</tr>						</table>																							<table class="table table-bordered table-condensed">						<tr><th class="taC" colspan="4">报销收款帐号</th></tr>							<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>																<table class="table table-bordered table-condensed">							<tr><th class="taC" colspan="4">工资卡</th></tr>							<tr>								<th class="taC" width="150">银行卡号</th>								<td width="210"><input name="salaryCard" id="salaryCard" value="' . $detail ['salaryCard'] . '" type="text"></td>								<th class="taC" width="150">开户行</th>								<td><input name="salaryBank" id="salaryBank" value="' . $detail ['salaryBank'] . '" type="text"></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 ajaxGetDistrictByLv1() {		$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 );				// 员工可选的		Doo::loadModel ( 'district' );		$district = new district ();		$districtList = $district->get_lv ( 1 );				$did = explode ( ',', $detail ['did'] );				$html = '';		foreach ( $districtList as $key => $value ) {			$falg = true;			foreach ( $did as $k => $v ) {				if ($value ['didKey'] == $v) {					$html .= '<label class="checkbox inline">					  <input type="checkbox" name="didKey[]" checked value="' . $value ['didKey'] . '">' . $value ['name'] . '					</label>';					unset ( $did [$k] );					$falg = false;					break;				}			}						if ($falg)				$html .= '<label class="checkbox inline">					  <input type="checkbox" name="didKey[]"  value="' . $value ['didKey'] . '">' . $value ['name'] . '					</label>';		}		echo json_encode ( array (				'status' => 1,				'html' => $html 		) );	}		/**	 * 生成工号	 */	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 ();		}	}		/**	 * 计算工龄	 * @param string $seniorityFormula	 */	function getSeniority($seniorityFormula = '') {		if (! empty ( $seniorityFormula )) {			$Days = 0;			foreach ( $seniorityFormula as $key => $value ) {				$Date_1 = $value ['InductionDate'];				$Date_2 = $value ['dimissionDate'];				$d1 = strtotime ( $Date_1 );				$d2 = strtotime ( $Date_2 );				$D = round ( ($d2 - $d1) / 3600 / 24 );				$Days += $D;			}			return $Days;		}		return 0;	}		/**	 * 员工主访问权限	 */	function isEmployeeVisit($employee = array()) {		Doo::loadModel ( 'staff' );		$staff = new staff ();				$staff->getStaffBySid ( $this->staff ['sid'] );				$access = explode ( ',', $employee ['access'] );	}}?>
 |