123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741 |
- <?php
- Doo::loadCore ( 'db/DooModel' );
- class staff extends DooModel {
-
-
-
- public $sid;
- public $username;
- public $passwork;
- public $staffManage;
- public $isadmin;
- public $cid;
- public $othercid;
- public $category;
- public $othercategory;
- public $gender;
- public $qq;
- public $phone;
- public $telephone;
- public $email;
- public $birthday;
- public $position;
- public $avatar;
- public $appDate;
- public $hiredate;
- public $hireBiasDate;
- public $wxid;
- public $wecat;
- public $nature;
- public $remittanceName;
- public $bankName;
- public $bankNumber;
- public $coupletNumber;
- public $remittanceBankType;
-
- public $living;
- public $nativePlace;
- public $emergencyContacts;
-
- public $did;
- public $didName;
- public $jobNumber;
- public $baseWage;
- public $postWage;
- public $achievementBonus;
- public $pendingApprovals;
- public $processApprovals;
- public $processCC;
-
- public $InductionDate;
- public $pendStatus;
- public $updateDate;
-
- public $probationaryDate;
- public $regularsDate;
-
- public $qualifications;
- public $marriage;
-
- public $salaryCard;
- public $salaryBank;
-
- public $pendingApprovalsLeave;
- public $processApprovalsLeave;
- public $processLeaveCC;
- public $staffManageLeave;
- public $dimissionDate;
- public $dimissionReason;
- public $seniorityFormula;
-
- public $practiceDate;
-
- public $cldAccess;
-
- public $IDcards;
- public $IDcardsImgA;
- public $certificate;
- public $diploma;
- public $professionalTitle;
- public $IDcardsImgB;
-
- public $nation;
- public $graduateInstitutions;
- public $major;
- public $education;
- public $graduationTime;
- public $registeredResidence;
- public $householdRegistrationType;
- public $IDcardsValidity;
- public $positionId;
-
- public $appliedPromote;
- public $departmentID;
- public $applyLeaveDate;
-
- public $_table = 'CLD_staff';
- public $_primarykey = 'sid';
- public $_fields = array (
-
- 'nation',
- 'graduateInstitutions',
- 'major',
- 'education',
- 'graduationTime',
- 'registeredResidence',
- 'householdRegistrationType',
- 'IDcardsValidity',
-
- 'IDcards',
- 'IDcardsImgA',
- 'IDcardsImgB',
- 'certificate',
- 'diploma',
- 'professionalTitle',
-
- 'sid',
- 'username',
- 'staffManage',
- 'birthday',
- 'position',
- 'passwork',
- 'isadmin',
- 'cid',
- 'othercid',
- 'appDate',
- 'category',
- 'othercategory',
- 'gender',
- 'qq',
- 'phone',
- 'telephone',
- 'email',
- 'avatar',
- 'hiredate',
- 'hireBiasDate',
- 'wxid',
- 'nature',
- 'remittanceName',
- 'bankName',
- 'bankNumber',
- 'remittanceBankType',
- 'coupletNumber',
- 'did',
- 'jobNumber',
- 'baseWage',
- 'postWage',
- 'achievementBonus',
- 'pendingApprovals',
- 'processApprovals',
- 'processCC',
-
-
- 'pendingApprovalsLeave',
- 'processApprovalsLeave',
- 'processLeaveCC',
- 'staffManageLeave',
-
- 'InductionDate',
- 'pendStatus',
- 'wecat',
- 'updateDate',
-
- 'dimissionReason',
-
- 'salaryCard',
- 'salaryBank',
- 'qualifications',
- 'marriage',
-
- 'living',
- 'nativePlace',
- 'emergencyContacts',
-
- 'practiceDate',
- 'probationaryDate',
- 'regularsDate',
- 'dimissionDate',
- 'seniorityFormula',
- 'cldAccess',
- 'departmentID',
-
- 'didName',
- 'positionId',
- 'appliedPromote',
-
- 'applyLeaveDate',
- );
- public function checkUser($uid, $passwork) {
- return $this->find ( array (
- 'select' => 'position,birthday,sid,username,isadmin,cid,othercid,category,othercategory,gender,qq,phone,telephone,email,avatar,hiredate,nature',
- 'where' => "username= '" . $uid . "' and passwork = '" . md5 ( $passwork ) . "' and nature!=4",
- 'asArray' => TRUE
- ) );
- }
- public function getStaffByName($username = '') {
-
- if (empty($username))
- return array();
- $detail=$this->getOne ( array (
- 'asc' => 'sid',
- 'where' => "username= '" . $username . "'",
- 'asArray' => TRUE
- ) );
-
- if (empty($detail))
- return array();
- Doo::loadModel ( 'department' );
- $department = new department ();
- $detail ['departmentName']=array();
- if($detail['departmentID']!=0){
- $detail ['departmentName'] =$department->getDepartmentByDid($detail['departmentID']);
- }
-
- Doo::loadClass ( 'XDeode' );
- $XDeode = new XDeode ( 5 );
- if (!empty($detail))
- $detail['sidKey'] = $XDeode->encode ( $detail ['sid'] );
- return $detail;
- }
-
-
-
- /**
- * @return string
- */
- public function getStaff($admin=false) {
- Doo::loadClass ( 'XDeode' );
- $XDeode = new XDeode ( 5 );
- Doo::loadModel ( 'department' );
- $department = new department ();
- Doo::loadModel ( 'position' );
- $position = new position ();
-
- $condition = array (
- 'desc' => 'jobNumber',
- 'asArray' => TRUE
- );
-
- if ($admin)
- $condition += array (
- 'where' => "username != 'admin' and nature !=4",
- );
-
- $list = $this->find ( $condition);
- foreach ( $list as $key => $value ) {
- $list [$key] ['departmentName'] ='';
- if($value['departmentID']!=0){
- $list [$key] ['departmentName'] =$department->getDepartmentByDid($value['departmentID']);
- }
-
- $list [$key] ['sidKey'] = $XDeode->encode ( $value ['sid'] );
- $list [$key] ['cidKey'] = $XDeode->encode ( $value ['cid'] );
- $list [$key] ['didKey'] = '';
- if (!empty($value ['departmentID']))
- $list [$key] ['didKey'] = $XDeode->encode ( $value ['departmentID'] );
-
- $list [$key] ['position'] ='';
- $pdetail=$position->getPositionByPid($value['positionId']);
- if (!empty($pdetail))
- $list [$key] ['position'] =$pdetail['positionName'];
-
- }
-
- return $list;
- }
-
- /**
- * 根据条件获得查询内容
- * @param string $con
- * @return string
- */
- public function getStaffByCondition($con=''){
- if ( empty ( $con ))
- return array ();
-
- Doo::loadClass ( 'XDeode' );
- $XDeode = new XDeode ( 5 );
- Doo::loadModel ( 'department' );
- $department = new department ();
-
- Doo::loadModel ( 'position' );
- $position = new position ();
-
- $list = $this->find ( array (
- 'where' => $con,
- 'desc' => 'jobNumber',
- 'asArray' => TRUE
- ) );
- foreach ( $list as $key => $value ) {
-
- $list [$key] ['position'] ='';
- $pdetail=$position->getPositionByPid($value['positionId']);
- if (!empty($pdetail))
- $list [$key] ['position'] =$pdetail['positionName'];
-
-
- $list [$key] ['departmentName'] ='';
- if($value['departmentID']!=0){
- $list [$key] ['departmentName'] =$department->getDepartmentByDid($value['departmentID']);
- }
-
- $list [$key] ['didArray']=array();
- if (!empty($value['did']))
- $list [$key] ['didArray']=explode(',', $value['did']);
-
- $list [$key] ['cldAccessArray'] = json_decode($value['cldAccess']);
- $list [$key] ['sidKey'] = $XDeode->encode ( $value ['sid'] );
- $list [$key] ['cidKey'] = $XDeode->encode ( $value ['cid'] );
- $list [$key] ['didKey'] = '';
- if (!empty($value ['departmentID']))
- $list [$key] ['didKey'] = $XDeode->encode ( $value ['departmentID'] );
- }
- return $list;
- }
-
- public function getStaffInCid($cid = '') {
- if (empty ( $cid ))
- return array ();
- $list = $this->find ( array (
- 'asc' => 'sid',
- 'where' => "cid in(" . $cid . ")",
- 'asArray' => TRUE
- ) );
- Doo::loadClass ( 'XDeode' );
- $XDeode = new XDeode ( 5 );
- foreach ( $list as $key => $value ) {
- $list [$key] ['sidKey'] = $XDeode->encode ( $value ['sid'] );
- }
-
- return $list;
- }
-
- /**
- * 获得单位下所有的员工
- * @param number $pid
- */
- public function getStaffByPositionId($pid=0){
-
- Doo::loadClass ( 'XDeode' );
- $XDeode = new XDeode ( 5 );
-
- if (! is_numeric ( $pid ))
- $pid = $XDeode->decode ( $pid );
-
- $list = $this->find ( array (
- 'where' => "positionId= '" . $pid . "' and username!='admin'",
- 'asArray' => TRUE
- ) );
- // Doo::loadClass ( 'XDeode' );
- // $XDeode = new XDeode ( 5 );
- // foreach ( $list as $key => $value ) {
- // $list [$key] ['sidKey'] = $XDeode->encode ( $value ['sid'] );
- // }
-
- return $list;
- }
-
- public function getStaffByCid($cid = 0) {
- $list = $this->find ( array (
- 'asc' => 'sid',
- 'where' => "cid= '" . $cid . "' and nature !=4 ",
- 'asArray' => TRUE
- ) );
- Doo::loadClass ( 'XDeode' );
- $XDeode = new XDeode ( 5 );
- Doo::loadModel ( 'position' );
- $position = new position ();
-
- foreach ( $list as $key => $value ) {
- $list [$key] ['sidKey'] = $XDeode->encode ( $value ['sid'] );
-
- $list [$key] ['position'] ='';
- $pdetail=$position->getPositionByPid($value['positionId']);
- if (!empty($pdetail))
- $list [$key] ['position'] =$pdetail['positionName'];
-
- }
- return $list;
- }
-
- public function getStaffByCidAll($cid = 0){
- $list = $this->find ( array (
- 'asc' => 'sid',
- 'where' => "cid= '" . $cid . "' ",
- 'asArray' => TRUE
- ) );
- Doo::loadClass ( 'XDeode' );
- $XDeode = new XDeode ( 5 );
- Doo::loadModel ( 'position' );
- $position = new position ();
-
- foreach ( $list as $key => $value ) {
- $list [$key] ['sidKey'] = $XDeode->encode ( $value ['sid'] );
-
- $list [$key] ['position'] ='';
- $pdetail=$position->getPositionByPid($value['positionId']);
- if (!empty($pdetail))
- $list [$key] ['position'] =$pdetail['positionName'];
-
- }
- return $list;
- }
-
- /**
- * 获得审批中员工
- */
- public function getStaffByApplied($sid=0){
-
- $where="(pendStatus= '2' or pendStatus='3' or pendStatus='5' or pendStatus='6' or pendStatus='7') ";
- if(!empty($sid)){
- $where.=" and (pendingApprovals ='" . $sid . "' or pendingApprovalsLeave='" . $sid . "')";
- }
-
-
- $list = $this->find ( array (
- 'asc' => 'sid',
- 'where' => $where,
- 'asArray' => TRUE
- ) );
- Doo::loadClass ( 'XDeode' );
- $XDeode = new XDeode ( 5 );
- Doo::loadModel ( 'position' );
- $position = new position ();
- foreach ( $list as $key => $value ) {
- $list [$key] ['sidKey'] = $XDeode->encode ( $value ['sid'] );
-
- $list [$key] ['position'] ='';
- $pdetail=$position->getPositionByPid($value['positionId']);
- if (!empty($pdetail))
- $list [$key] ['position'] =$pdetail['positionName'];
-
- }
-
- return $list;
- }
-
- /**
- * 进行中
- * @param number $sid
- */
- public function getStaffByProcessing($sid=0){
- $where="(pendStatus= '2' or pendStatus='3' or pendStatus='5' or pendStatus='6' or pendStatus='7') ";
- if(!empty($sid)){
- $where.=" and (pendingApprovals !='" . $sid . "' or pendingApprovalsLeave !='" . $sid . "')";
- }
-
- $list = $this->find ( array (
- 'asc' => 'sid',
- 'where' => $where,
- 'asArray' => TRUE
- ) );
- Doo::loadClass ( 'XDeode' );
- $XDeode = new XDeode ( 5 );
- Doo::loadModel ( 'position' );
- $position = new position ();
- foreach ( $list as $key => $value ) {
- $list [$key] ['sidKey'] = $XDeode->encode ( $value ['sid'] );
-
- $list [$key] ['position'] ='';
- $pdetail=$position->getPositionByPid($value['positionId']);
- if (!empty($pdetail))
- $list [$key] ['position'] =$pdetail['positionName'];
-
- }
-
- return $list;
- }
-
- /**
- * 获得最近审批通过的员工
- * @return string
- */
- public function getStaffByApprovals(){
- $list = $this->find ( array (
- 'asc' => 'InductionDate',
- 'where' => "username!= 'admin' and pendStatus=0 and InductionDate!=0",
- 'limit' => 10,
- 'asArray' => TRUE
- ) );
- Doo::loadClass ( 'XDeode' );
- $XDeode = new XDeode ( 5 );
- foreach ( $list as $key => $value ) {
- $list [$key] ['sidKey'] = $XDeode->encode ( $value ['sid'] );
- }
-
- return $list;
- }
-
- /**
- * 获得最近更新的员工
- */
- public function getStaffByUpdateDate(){
- $list = $this->find ( array (
- 'asc' => 'updateDate',
- 'where' => "username!= 'admin'",
- 'limit' => 10,
- 'asArray' => TRUE
- ) );
- Doo::loadClass ( 'XDeode' );
- $XDeode = new XDeode ( 5 );
- foreach ( $list as $key => $value ) {
- $list [$key] ['sidKey'] = $XDeode->encode ( $value ['sid'] );
- }
-
- return $list;
- }
-
- public function getUserById($sid = 0) {
-
- $list =$this->find ( array (
- 'asc' => 'sid',
- 'where' => "sid= '" . $sid . "'",
- 'asArray' => TRUE
- ) );
-
- Doo::loadClass ( 'XDeode' );
- $XDeode = new XDeode ( 5 );
- foreach ( $list as $key => $value ) {
- $list [$key] ['sidKey'] = $XDeode->encode ( $value ['sid'] );
- }
-
- return $list;
- }
- public function getUserByIdList($puid) {
- Doo::loadClass ( 'XDeode' );
- $XDeode = new XDeode ( 5 );
-
- $puid = $XDeode->decode ( $puid );
- $list=$this->find ( array (
- 'where' => "sid= '" . $puid . "'",
- 'asArray' => TRUE
- ) );
-
- foreach ($list as $key=>$value){
- $list[$key]['sidKey']=$XDeode->encode ( $value ['sid'] );
- }
-
- return $list;
- }
-
- /**
- * 检查信息是否填写完整
- * @param unknown $sid
- * @return string
- */
- public function checkStaffInfoIsComplete($sid){
- Doo::loadClass ( 'XDeode' );
- $XDeode = new XDeode ( 5 );
-
- if (!is_numeric($sid)){
- $sid = $XDeode->decode ( $sid );
- }
-
- $detail=$this->getOne ( array (//or wecat='' or email='' or coupletNumber=''
- 'where' => "sid= '" . $sid . "' and (telephone='' or qq='' or phone='' or birthday='' or marriage='' or living='' or nativePlace='' or emergencyContacts='' or IDcards=''
- or IDcardsImgA='' or IDcardsImgB='' or remittanceName='' or bankName='' or bankNumber='' or salaryCard='' or salaryBank='' )",
- 'asArray' => TRUE
- ) );
-
- return $detail;
- }
-
-
- /**
- * 根据参数字段更新相应字段(主键ID必须传)
- * @param array $item 相关需要更新的字段信息
- * @return number 返回员工ID
- */
- public function setStaffByCondition($item = array()) {
- $lid = 0;
- if (is_array ( $item ) && ! empty ( $item )) {
- foreach ( $item as $key => $value ) {
- $this->$key = $value;
- }
- $lid = $this->update ();
- }
- return $lid;
- }
-
- /**
- *
- * @param number $nature
- */
- public function getStaffJobNumberByNature($nature=1){
- $detail=$this->getOne ( array (
- 'where' => "nature= '" . $nature . "'",
- 'desc' => 'jobNumber',
- 'asArray' => TRUE
- ) );
-
- return $detail;
- }
-
- /**
- *
- * @param number $nature
- */
- public function getStaffJobNumberByInformal(){
- $detail=$this->getOne ( array (
- 'where' => "nature= '2' or nature ='3'",
- 'desc' => 'jobNumber',
- 'asArray' => TRUE
- ) );
-
- return $detail;
- }
-
- /**
- * 根据用户ID获取相关信息
- * @param number $sid 用户ID
- */
- public function getStaffBySid($sid = 0) {
- Doo::loadClass ( 'XDeode' );
- $XDeode = new XDeode ( 5 );
- if (!is_numeric($sid)&&!empty($sid)){
- $sid = $XDeode->decode ( $sid );
- }
-
- $detail = array ();
- if (! empty ( $sid )){
- $detail = $this->getOne ( array (
- 'where' => "sid= '" . $sid . "'",
- 'asArray' => TRUE
- ) );
-
- $detail['sidKey']=$XDeode->encode ( $detail ['sid'] );
-
- Doo::loadModel ( 'department' );
- $department = new department ();
- $detail ['department'] =$department->getDepartmentByDid($detail['departmentID']);
-
- //获得岗位信息
- Doo::loadModel ( 'position' );
- $position = new position ();
-
- $positionIdKey=$XDeode->encode ( $detail ['positionId'] );
- $detail ['positionIdKey']=$positionIdKey;
- $positionDetail=$position->getPositionByPid($detail ['positionId']);
- //print_r('/'.$detail ['positionId'].'/');
-
- if(empty($positionDetail)){
- $positionDetail['baseWage']=0;
- $positionDetail['postWage']=0;
- $positionDetail['achievementBonus']=0;
- $positionDetail['positionName']='';
- }
- $detail ['positionDetail'] =$positionDetail;
-
-
- $d1 = strtotime($detail['hiredate']);//过去的某天,你来设定
- $d2 = 1 + ceil((time()-$d1)/60/60/24);
- $detail['workforce']=$d2;
-
- $d1 = strtotime($detail['dimissionDate']);//离职到今天
- $d2 = 1 + ceil((time()-$d1)/60/60/24);
- $detail['workforceDimission']=$d2;
-
- $detail ['cldAccessArray'] =array();
- if (!empty($detail['cldAccess']))
- $detail ['cldAccessArray'] =json_decode($detail['cldAccess']);
-
- $detail['sidKey']=$XDeode->encode ( $detail ['sid'] );
-
-
- $webSite=WEB_SITE.'/upload/credentialInfo/';
- $detail['webSite']=$webSite;
- $detail['certificateArray']=array();
- if(!empty($detail['certificate'])){
- $certificate=json_decode($detail['certificate']);
- if(!empty($certificate)){
- foreach ($certificate as $key=>$value){
- $certificate[$key]=$value;
- }
- $detail['certificateArray']=$certificate;
- }
- }
- $detail['diplomaArray']=array();
- if(!empty($detail['diploma'])){
- $certificate=json_decode($detail['diploma']);
- if(!empty($certificate)){
- foreach ($certificate as $key=>$value){
- $certificate[$key]=$value;
- }
- $detail['diplomaArray']=$certificate;
- }
- }
- $detail['professionalTitleArray']=array();
- if(!empty($detail['professionalTitle'])){
- $certificate=json_decode($detail['professionalTitle']);
- if(!empty($certificate)){
- foreach ($certificate as $key=>$value){
- $certificate[$key]=$value;
- }
- $detail['professionalTitleArray']=$certificate;
- }
- }
-
- }
- return $detail;
- }
-
- public function getApprovalData($sid=0){
- $list = $this->find ( array (
- 'asc' => 'sid',
- 'where' => "(pendStatus= '2' or pendStatus='3' or pendStatus='5' or pendStatus='6') and ( pendingApprovalsLeave='" . $sid . "' or pendingApprovals='" . $sid . "') ",
- 'asArray' => TRUE
- ) );
- return $list;
- }
-
- public function getStaffByWxid($wxid = '') {
- // echo "wxid in ( " . $wxid . ")";
- if (empty ( $wxid ))
- return array ();
- return $this->find ( array (
- 'select' => 'sid,wxid',
- 'where' => "wxid in ( " . $wxid . ")",
- 'asArray' => TRUE
- ) );
- }
- // 建筑获取办事处人员部分信息
- public function getStaffByCidOnBuilding($cid = 0) {
- $list = $this->find ( array (
- 'select' => 'sid,username,cid,departmentID,category,qq,phone,telephone',
- 'asc' => 'sid',
- 'where' => "cid= '" . $cid . "'",
- 'asArray' => TRUE
- ) );
- return $list;
- }
-
-
-
- }
- ?>
|