|
@@ -62,7 +62,6 @@ class HumanResourceController extends DooController {
|
|
|
Doo::loadModel ( 'staffManage' );
|
|
|
$staffManage = new staffManage ();
|
|
|
|
|
|
-
|
|
|
$sidKey = $this->get_args ( 'sidKey' ) ? $this->get_args ( 'sidKey' ) : "";
|
|
|
|
|
|
$sid = $XDeode->decode ( $sidKey );
|
|
@@ -118,14 +117,16 @@ class HumanResourceController extends DooController {
|
|
|
}
|
|
|
|
|
|
$staff->updateDate = date ( "Y-m-d H:i:s" );
|
|
|
- // $staff->update ( array ('where' => 'sid=' . $sid ) );
|
|
|
+ $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'],
|
|
|
+ 'operation' => $this->staff ['username'] . "入职 审批通过" . $staffDetail ['username'],
|
|
|
'status' => 1,
|
|
|
'img' => $staffDetail ['avatar'],
|
|
|
'username' => $staffDetail ['username'],
|
|
@@ -138,21 +139,176 @@ class HumanResourceController extends DooController {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * 离职人员审批
|
|
|
+ */
|
|
|
+ function employeeDimissionApprovals() {
|
|
|
+ Doo::loadModel ( 'staff' );
|
|
|
+ $staff = new staff ();
|
|
|
+ Doo::loadClass ( 'XDeode' );
|
|
|
+ $XDeode = new XDeode ( 5 );
|
|
|
+ Doo::loadModel ( 'staffLeaveManage' );
|
|
|
+ $staffLeaveManage = new staffLeaveManage ();
|
|
|
+
|
|
|
+ $sidKey = $this->get_args ( 'sidKey' ) ? $this->get_args ( 'sidKey' ) : "";
|
|
|
+ $sid = $XDeode->decode ( $sidKey );
|
|
|
+ if (! is_numeric ( $sid ) || empty ( $sid ))
|
|
|
+ die ( 'illegal request' );
|
|
|
+
|
|
|
+ $staffDetail = $staff->getOne ( array (
|
|
|
+ 'where' => 'pendStatus=3 and sid=' . $sid . ' and pendingApprovalsLeave=' . $this->staff ['sid'],
|
|
|
+ 'asArray' => true
|
|
|
+ ) );
|
|
|
+
|
|
|
+ if (empty ( $staffDetail ))
|
|
|
+ die ( 'illegal request' );
|
|
|
+
|
|
|
+ $processApprovals = json_decode ( $staffDetail ['processApprovalsLeave'], true );
|
|
|
+ $invoiceManage = json_decode ( $staffDetail ['staffManageLeave'], true );
|
|
|
+
|
|
|
+ $staff = new staff ();
|
|
|
+ if (empty ( $processApprovals )) {
|
|
|
+ $processApprovals = array (
|
|
|
+ $this->staff ['sid'] => array (
|
|
|
+ 'date' => date ( "Y-m-d H:i:s" )
|
|
|
+ )
|
|
|
+ );
|
|
|
+ $nextInvoiceManage = next ( $invoiceManage );
|
|
|
+
|
|
|
+ if ($nextInvoiceManage !== false)
|
|
|
+ $staff->pendingApprovalsLeave = $nextInvoiceManage [0];
|
|
|
+ $staff->processApprovalsLeave = json_encode ( $processApprovals );
|
|
|
+ } else {
|
|
|
+ $processApprovals [$this->staff ['sid']] = array (
|
|
|
+ 'date' => date ( "Y-m-d H:i:s" )
|
|
|
+ );
|
|
|
+
|
|
|
+ $pendingApprovals = 0;
|
|
|
+ foreach ( $invoiceManage as $key => $value ) {
|
|
|
+ if ($value [0] == $this->staff ['sid']) {
|
|
|
+ if (isset ( $invoiceManage [$key + 1] ))
|
|
|
+ $pendingApprovals = $invoiceManage [$key + 1] [0];
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (! empty ( $pendingApprovals ))
|
|
|
+ $staff->pendingApprovalsLeave = $pendingApprovals;
|
|
|
+ $staff->processApprovalsLeave = json_encode ( $processApprovals );
|
|
|
+ }
|
|
|
+
|
|
|
+ if (count ( $processApprovals ) == count ( $invoiceManage )) {
|
|
|
+ $staff->pendStatus = 4;
|
|
|
+ $staff->pendingApprovalsLeave = 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ $staff->updateDate = date ( "Y-m-d H:i:s" );
|
|
|
+ $staff->update ( array (
|
|
|
+ 'where' => 'sid=' . $sid
|
|
|
+ ) );
|
|
|
+
|
|
|
+ // 操作日志
|
|
|
+ Doo::loadModel ( 'staffOperationLog' );
|
|
|
+ $staffOperationLog = new staffOperationLog ();
|
|
|
+ $item = array (
|
|
|
+ 'date' => date ( "Y-m-d H:i:s" ),
|
|
|
+ 'operation' => $this->staff ['username'] . "离职 审批通过" . $staffDetail ['username'],
|
|
|
+ 'status' => 2,
|
|
|
+ 'img' => $staffDetail ['avatar'],
|
|
|
+ 'username' => $staffDetail ['username'],
|
|
|
+ 'uid' => $staffDetail ['sid'],
|
|
|
+ 'category' => $staffDetail ['category']
|
|
|
+ );
|
|
|
+ $staffOperationLog->setInvoiceOperationLog ( $item );
|
|
|
+
|
|
|
+ return '/hr';
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
* 员工信息
|
|
|
*/
|
|
|
function hrEmployee() {
|
|
|
+ $pendStatus = $this->get_args ( 'pendStatus' ) ? $this->get_args ( 'pendStatus' ) : "ALL";
|
|
|
+ $nature = $this->get_args ( 'nature' ) ? $this->get_args ( 'nature' ) : 'ALL';
|
|
|
+ $cid_did = $this->get_args ( 'cid_did' ) ? $this->get_args ( 'cid_did' ) : 'ALL';
|
|
|
+ $MebSea = $this->get_args ( 'MebSea' ) ? $this->get_args ( 'MebSea' ) : '';
|
|
|
+
|
|
|
+ Doo::loadClass ( 'XDeode' );
|
|
|
+ $XDeode = new XDeode ( 5 );
|
|
|
+
|
|
|
+ $con = ' username != "admin" ';
|
|
|
+ if ($pendStatus == 'ALL')
|
|
|
+ $con .= ' and (pendStatus=0 or pendStatus=4) ';
|
|
|
+ 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->getStaff ( true );
|
|
|
+ $stafflist = $staff->getStaffByCondition ( $con );
|
|
|
+
|
|
|
+ $monthstart = date ( 'Y-m-d 00:00:00', mktime ( 0, 0, 0, date ( 'm' ), 1, date ( 'Y' ) ) );
|
|
|
+ $monthend = date ( 'Y-m-d 23:59:59', mktime ( 0, 0, 0, date ( 'm' ) + 1, 0, date ( 'Y' ) ) );
|
|
|
+
|
|
|
+ // 本月在职 入职 离职人员数量
|
|
|
+ $onJobCount = $staff->count ( array (
|
|
|
+ 'where' => 'pendStatus=0 and username!="admin"'
|
|
|
+ ) );
|
|
|
+ $inJobCount = $staff->count ( array (
|
|
|
+ 'where' => 'pendStatus=0 and username!="admin" and (InductionDate>="' . $monthstart . '" and InductionDate<="' . $monthend . '" )'
|
|
|
+ ) );
|
|
|
+ $leaveJobCount = $staff->count ( array (
|
|
|
+ 'where' => 'pendStatus=4 and username!="admin" and (dimissionDate>="' . $monthstart . '" and dimissionDate<="' . $monthend . '" )'
|
|
|
+ ) );
|
|
|
|
|
|
// 生成工号
|
|
|
$jobNumber = $this->createJobNumber ();
|
|
|
// 获得办事和部门
|
|
|
$categoryList = $L_category->getCategoryDepartment ();
|
|
|
|
|
|
+ $monthstart = date ( 'm.d', mktime ( 0, 0, 0, date ( 'm' ), 1, date ( 'Y' ) ) );
|
|
|
+ $monthend = date ( 'm.d', mktime ( 0, 0, 0, date ( 'm' ) + 1, 0, date ( 'Y' ) ) );
|
|
|
+
|
|
|
+ $this->data ['onJobCount'] = $onJobCount;
|
|
|
+ $this->data ['inJobCount'] = $inJobCount;
|
|
|
+ $this->data ['leaveJobCount'] = $leaveJobCount;
|
|
|
+
|
|
|
+ $this->data ['monthstart'] = $monthstart;
|
|
|
+ $this->data ['monthend'] = $monthend;
|
|
|
+
|
|
|
+ $this->data ['pendStatus'] = $pendStatus;
|
|
|
+ $this->data ['nature'] = $nature;
|
|
|
+ $this->data ['MebSea'] = $MebSea;
|
|
|
+ $this->data ['cid_did'] = $cid_did;
|
|
|
+
|
|
|
$this->data ['categoryList'] = $categoryList;
|
|
|
$this->data ['jobNumber'] = $jobNumber;
|
|
|
$this->data ['stafflist'] = $stafflist;
|
|
@@ -245,6 +401,14 @@ class HumanResourceController extends DooController {
|
|
|
|
|
|
// 抄送组
|
|
|
$staff->processCC = $staffManageDetail ['CC'];
|
|
|
+ // 工龄记录
|
|
|
+ $seniorityFormula = array ();
|
|
|
+ array_push ( $seniorityFormula, array (
|
|
|
+ 'InductionDate' => $hiredate,
|
|
|
+ 'dimissionDate' => ''
|
|
|
+ ) );
|
|
|
+ $staff->seniorityFormula = json_encode ( $seniorityFormula );
|
|
|
+
|
|
|
$id = $staff->insert ();
|
|
|
|
|
|
// 更新假期相关信息
|
|
@@ -278,9 +442,9 @@ class HumanResourceController extends DooController {
|
|
|
$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;
|
|
|
+ // $baseWage = is_numeric ( $this->get_args ( 'baseWage' ) ) ? $this->get_args ( 'baseWage' ) : 0;
|
|
|
+ // $postWage = is_numeric ( $this->get_args ( 'postWage' ) ) ? $this->get_args ( 'postWage' ) : 0;
|
|
|
+ // $achievementBonus = is_numeric ( $this->get_args ( 'achievementBonus' ) ) ? $this->get_args ( 'achievementBonus' ) : 0;
|
|
|
$gender = $this->get_args ( 'gender' ) ? $this->get_args ( 'gender' ) : '';
|
|
|
|
|
|
$qq = is_numeric ( $this->get_args ( 'qq' ) ) ? $this->get_args ( 'qq' ) : 0;
|
|
@@ -301,9 +465,12 @@ class HumanResourceController extends DooController {
|
|
|
$bankName = $this->get_args ( 'bankName' ) ? $this->get_args ( 'bankName' ) : '';
|
|
|
$bankNumber = $this->get_args ( 'bankNumber' ) ? $this->get_args ( 'bankNumber' ) : '';
|
|
|
|
|
|
+ $salaryCard = $this->get_args ( 'salaryCard' ) ? $this->get_args ( 'salaryCard' ) : '';
|
|
|
+ $salaryBank = $this->get_args ( 'salaryBank' ) ? $this->get_args ( 'salaryBank' ) : '';
|
|
|
+
|
|
|
$employeeInfo = $this->get_args ( 'employeeInfo' ) ? $this->get_args ( 'employeeInfo' ) : 'employeeInfo';
|
|
|
|
|
|
- if (! empty ( $sidKey ) ) {
|
|
|
+ if (! empty ( $sidKey )) {
|
|
|
|
|
|
Doo::loadClass ( 'XDeode' );
|
|
|
$XDeode = new XDeode ( 5 );
|
|
@@ -317,23 +484,23 @@ class HumanResourceController extends DooController {
|
|
|
$staffManage = new staffManage ();
|
|
|
|
|
|
// 用户名检测
|
|
|
- if(!empty($username)){
|
|
|
- $detail=$staff->getStaffByName($username);
|
|
|
- if (empty($detail))
|
|
|
+ if (! empty ( $username )) {
|
|
|
+ $detail = $staff->getStaffByName ( $username );
|
|
|
+ if (empty ( $detail ))
|
|
|
die ( 'illegal request' );
|
|
|
}
|
|
|
- $detail=$staff->getStaffBySid($sidKey);
|
|
|
- if (empty($detail))
|
|
|
+ $detail = $staff->getStaffBySid ( $sidKey );
|
|
|
+ if (empty ( $detail ))
|
|
|
die ( 'illegal request' );
|
|
|
+ // if (!empty($username))
|
|
|
+ // $staff->username = $username;
|
|
|
+ if (! empty ( $hiredate ))
|
|
|
+ $staff->hiredate = $hiredate;
|
|
|
+ if (! empty ( $position ))
|
|
|
+ $staff->position = $position;
|
|
|
|
|
|
- $staff->username = $username;
|
|
|
- if (!empty($hiredate))
|
|
|
- $staff->hiredate = $hiredate;
|
|
|
- if (!empty($position))
|
|
|
- $staff->position = $position;
|
|
|
-
|
|
|
- //办事处-部门
|
|
|
- if (!empty($cid_did)){
|
|
|
+ // 办事处-部门
|
|
|
+ if (! empty ( $cid_did )) {
|
|
|
$department = explode ( '_', $cid_did );
|
|
|
$cid = $XDeode->decode ( $department [0] );
|
|
|
// 加入默认总部分类
|
|
@@ -351,58 +518,64 @@ class HumanResourceController extends DooController {
|
|
|
$staff->category = $cagegory [0] ['title'];
|
|
|
}
|
|
|
|
|
|
- if (!empty($telephone))
|
|
|
- $staff->telephone = $telephone;
|
|
|
-// if (!empty($baseWage))
|
|
|
-// $staff->baseWage = $baseWage;
|
|
|
-// if (!empty($postWage))
|
|
|
-// $staff->postWage = $postWage;
|
|
|
-// if (!empty($achievementBonus))
|
|
|
-// $staff->achievementBonus = $achievementBonus;
|
|
|
- if (!empty($gender))
|
|
|
- $staff->gender = $gender;
|
|
|
+ if (! empty ( $telephone ))
|
|
|
+ $staff->telephone = $telephone;
|
|
|
+ // if (!empty($baseWage))
|
|
|
+ // $staff->baseWage = $baseWage;
|
|
|
+ // if (!empty($postWage))
|
|
|
+ // $staff->postWage = $postWage;
|
|
|
+ // if (!empty($achievementBonus))
|
|
|
+ // $staff->achievementBonus = $achievementBonus;
|
|
|
+ if (! empty ( $gender ))
|
|
|
+ $staff->gender = $gender;
|
|
|
+
|
|
|
+ if (! empty ( $qq ))
|
|
|
+ $staff->qq = $qq;
|
|
|
+ if (! empty ( $phone ))
|
|
|
+ $staff->phone = $phone;
|
|
|
+ if (! empty ( $wecat ))
|
|
|
+ $staff->wecat = $wecat;
|
|
|
+ if (! empty ( $email ))
|
|
|
+ $staff->email = $email;
|
|
|
+ if (! empty ( $birthday ))
|
|
|
+ $staff->birthday = $birthday;
|
|
|
+ if (! empty ( $$qualifications ))
|
|
|
+ $staff->qualifications = $qualifications;
|
|
|
+ if (! empty ( $marriage ))
|
|
|
+ $staff->marriage = $marriage;
|
|
|
+ if (! empty ( $IDcards ))
|
|
|
+ $staff->IDcards = $IDcards;
|
|
|
+ if (! empty ( $living ))
|
|
|
+ $staff->living = $living;
|
|
|
+ if (! empty ( $nativePlace ))
|
|
|
+ $staff->nativePlace = $nativePlace;
|
|
|
+ if (! empty ( $emergencyContacts ))
|
|
|
+ $staff->emergencyContacts = $emergencyContacts;
|
|
|
+ if (! empty ( $coupletNumber ))
|
|
|
+ $staff->coupletNumber = $coupletNumber;
|
|
|
+ if (! empty ( $bankName ))
|
|
|
+ $staff->bankName = $bankName;
|
|
|
+ if (! empty ( $bankNumber ))
|
|
|
+ $staff->bankNumber = $bankNumber;
|
|
|
+ if (! empty ( $remittanceName ))
|
|
|
+ $staff->remittanceName = $remittanceName;
|
|
|
|
|
|
- if (!empty($qq))
|
|
|
- $staff->qq = $qq;
|
|
|
- if (!empty($phone))
|
|
|
- $staff->phone = $phone;
|
|
|
- if (!empty($wecat))
|
|
|
- $staff->wecat = $wecat;
|
|
|
- if (!empty($email))
|
|
|
- $staff->email = $email;
|
|
|
- if (!empty($birthday))
|
|
|
- $staff->birthday = $birthday;
|
|
|
- if (!empty($$qualifications))
|
|
|
- $staff->qualifications = $qualifications;
|
|
|
- if (!empty($marriage))
|
|
|
- $staff->marriage = $marriage;
|
|
|
- if (!empty($IDcards))
|
|
|
- $staff->IDcards = $IDcards;
|
|
|
- if (!empty($living))
|
|
|
- $staff->living = $living;
|
|
|
- if (!empty($nativePlace))
|
|
|
- $staff->nativePlace = $nativePlace;
|
|
|
- if (!empty($emergencyContacts))
|
|
|
- $staff->emergencyContacts = $emergencyContacts;
|
|
|
- if (!empty($coupletNumber))
|
|
|
- $staff->coupletNumber = $coupletNumber;
|
|
|
- if (!empty($bankName))
|
|
|
- $staff->bankName = $bankName;
|
|
|
- if (!empty($bankNumber))
|
|
|
- $staff->bankNumber = $bankNumber;
|
|
|
- if (!empty($remittanceName))
|
|
|
- $staff->remittanceName = $remittanceName;
|
|
|
+ if (! empty ( $salaryCard ))
|
|
|
+ $staff->salaryCard = $salaryCard;
|
|
|
+ if (! empty ( $salaryBank ))
|
|
|
+ $staff->salaryBank = $salaryBank;
|
|
|
|
|
|
$staff->update ( array (
|
|
|
- 'where' => 'sid=' . $detail['sid']
|
|
|
+ 'where' => 'sid=' . $detail ['sid']
|
|
|
) );
|
|
|
|
|
|
- if($employeeInfo=='employeeInfo'){
|
|
|
+ if ($employeeInfo == 'employeeInfo') {
|
|
|
return '/hr';
|
|
|
- }elseif($employeeInfo=='settingEmployeeInfo'){
|
|
|
+ } elseif ($employeeInfo == 'settingEmployeeInfo') {
|
|
|
return '/settingEmployeeInfo';
|
|
|
+ } elseif ($employeeInfo == 'settingFinanceInfo') {
|
|
|
+ return '/settingFinanceInfo';
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
die ( 'illegal request' );
|
|
|
}
|
|
@@ -410,36 +583,36 @@ class HumanResourceController extends DooController {
|
|
|
/**
|
|
|
* 员工转职
|
|
|
*/
|
|
|
- function staffTransfer(){
|
|
|
+ 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)){
|
|
|
+ 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 );
|
|
|
+ $staffDetail = $staff->getStaffBySid ( $sid );
|
|
|
|
|
|
$item = array (
|
|
|
- 'sid' => $sid
|
|
|
+ 'sid' => $sid
|
|
|
);
|
|
|
- if ($nature=='TRIAL')
|
|
|
+ if ($nature == 'TRIAL')
|
|
|
$item += array (
|
|
|
// 试用
|
|
|
'nature' => 3,
|
|
|
- 'probationaryDate' => date ( "Y-m-d H:i:s" )
|
|
|
+ 'probationaryDate' => date ( "Y-m-d H:i:s" )
|
|
|
);
|
|
|
- if($nature=='REGULARS'){
|
|
|
+ if ($nature == 'REGULARS') {
|
|
|
// 生成工号
|
|
|
$jobNumber = $this->createJobNumber ();
|
|
|
$item += array (
|
|
|
- //正式
|
|
|
+ // 正式
|
|
|
'nature' => 1,
|
|
|
- 'jobNumber'=>$jobNumber ['regularStaff'],
|
|
|
- 'regularsDate' => date ( "Y-m-d H:i:s" )
|
|
|
+ 'jobNumber' => $jobNumber ['regularStaff'],
|
|
|
+ 'regularsDate' => date ( "Y-m-d H:i:s" )
|
|
|
);
|
|
|
}
|
|
|
$staff->setStaffByCondition ( $item );
|
|
@@ -453,17 +626,17 @@ class HumanResourceController extends DooController {
|
|
|
'img' => $staffDetail ['avatar'],
|
|
|
'username' => $staffDetail ['username'],
|
|
|
'uid' => $staffDetail ['sid'],
|
|
|
- 'category' => $staffDetail ['category']
|
|
|
+ 'category' => $staffDetail ['category']
|
|
|
);
|
|
|
- if ($nature=='TRIAL')
|
|
|
+ if ($nature == 'TRIAL')
|
|
|
$item += array (
|
|
|
// 试用
|
|
|
- 'operation' => "员工 实习转试用",
|
|
|
+ 'operation' => "员工 实习转试用"
|
|
|
);
|
|
|
- if($nature=='REGULARS')
|
|
|
+ if ($nature == 'REGULARS')
|
|
|
$item += array (
|
|
|
- //正式
|
|
|
- 'operation' => "员工 试用转正式",
|
|
|
+ // 正式
|
|
|
+ 'operation' => "员工 试用转正式"
|
|
|
);
|
|
|
$staffOperationLog->setInvoiceOperationLog ( $item );
|
|
|
|
|
@@ -519,6 +692,19 @@ class HumanResourceController extends DooController {
|
|
|
'pendStatus' => 2
|
|
|
);
|
|
|
$staff->setStaffByCondition ( $item );
|
|
|
+ // 操作日志
|
|
|
+ Doo::loadModel ( 'staffOperationLog' );
|
|
|
+ $staffOperationLog = new staffOperationLog ();
|
|
|
+ $item = array (
|
|
|
+ 'date' => date ( "Y-m-d H:i:s" ),
|
|
|
+ 'status' => 3,
|
|
|
+ 'img' => $this->staf ['avatar'],
|
|
|
+ 'username' => $this->staf ['username'],
|
|
|
+ 'operation' => "申请入职",
|
|
|
+ 'uid' => $this->staf ['sid'],
|
|
|
+ 'category' => $this->staf ['category']
|
|
|
+ );
|
|
|
+ $staffOperationLog->setInvoiceOperationLog ( $item );
|
|
|
|
|
|
return '/login';
|
|
|
}
|
|
@@ -526,6 +712,158 @@ class HumanResourceController extends DooController {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * 申请离职
|
|
|
+ */
|
|
|
+ function appliedDimission() {
|
|
|
+ $dimissionReason = $this->get_args ( 'dimissionReason' ) ? $this->get_args ( 'dimissionReason' ) : '';
|
|
|
+ if (empty ( $dimissionReason ))
|
|
|
+ die ( 'illegal request' );
|
|
|
+ Doo::loadModel ( 'staff' );
|
|
|
+ $staff = new staff ();
|
|
|
+ Doo::loadModel ( 'staffLeaveManage' );
|
|
|
+ $staffLeaveManage = new staffLeaveManage ();
|
|
|
+
|
|
|
+ $item = array (
|
|
|
+ 'sid' => $this->staff ['sid'],
|
|
|
+ 'dimissionReason' => $dimissionReason,
|
|
|
+ // 状态改成离职申请
|
|
|
+ 'pendStatus' => 3
|
|
|
+ );
|
|
|
+ $staff->setStaffByCondition ( $item );
|
|
|
+ // 操作日志
|
|
|
+ Doo::loadModel ( 'staffOperationLog' );
|
|
|
+ $staffOperationLog = new staffOperationLog ();
|
|
|
+ $item = array (
|
|
|
+ 'date' => date ( "Y-m-d H:i:s" ),
|
|
|
+ 'status' => 3,
|
|
|
+ 'img' => $this->staff ['avatar'],
|
|
|
+ 'username' => $this->staff ['username'],
|
|
|
+ 'operation' => "申请离职",
|
|
|
+ 'uid' => $this->staff ['sid'],
|
|
|
+ 'category' => $this->staff ['category']
|
|
|
+ );
|
|
|
+ $staffOperationLog->setInvoiceOperationLog ( $item );
|
|
|
+
|
|
|
+ // 离职审批组
|
|
|
+ // 获得审批组KEY
|
|
|
+ $staff = new staff ();
|
|
|
+ $cidMode = $this->staff ['cid'];
|
|
|
+ if (! empty ( $this->staff ['departmentID'] ))
|
|
|
+ $cidMode = $this->staff ['cid'] . '_' . $this->staff ['departmentID'];
|
|
|
+
|
|
|
+ $staffManageDetail = $staffLeaveManage->getStaffManageByCid ( $cidMode );
|
|
|
+ if (empty ( $staffManageDetail ))
|
|
|
+ die ( 'illegal request' );
|
|
|
+
|
|
|
+ $pendingApprovalsSid = current ( $staffManageDetail ['staffList'] ) [0];
|
|
|
+ $staff->pendingApprovalsLeave = $pendingApprovalsSid;
|
|
|
+ $staff->staffManageLeave = $staffManageDetail ['staff'];
|
|
|
+ $staff->sid = $this->staff ['sid'];
|
|
|
+
|
|
|
+ // 抄送组
|
|
|
+ $staff->processLeaveCC = $staffManageDetail ['CC'];
|
|
|
+ $staff->update ();
|
|
|
+
|
|
|
+ return '/settingEmployeeInfo';
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 确认离职
|
|
|
+ */
|
|
|
+ function employeeDismiss() {
|
|
|
+ $sidKey = $this->get_args ( 'sidKey' ) ? $this->get_args ( 'sidKey' ) : "";
|
|
|
+
|
|
|
+ if (! empty ( $sidKey )) {
|
|
|
+
|
|
|
+ Doo::loadClass ( 'XDeode' );
|
|
|
+ $XDeode = new XDeode ( 5 );
|
|
|
+ Doo::loadModel ( 'staff' );
|
|
|
+ $staff = new staff ();
|
|
|
+
|
|
|
+ $sid = $XDeode->decode ( $sidKey );
|
|
|
+
|
|
|
+ $detail = $staff->getStaffBySid ( $sid );
|
|
|
+ if (empty ( $detail ))
|
|
|
+ die ( 'illegal request' );
|
|
|
+
|
|
|
+ //工龄记录
|
|
|
+ $seniorityFormula=json_decode($detail['seniorityFormula']);
|
|
|
+ $arr = array_keys($seniorityFormula);
|
|
|
+ $key=end($arr);
|
|
|
+
|
|
|
+ if (empty($seniorityFormula[$key]['dimissionDate']))
|
|
|
+ $seniorityFormula[$key]['dimissionDate']=date ( "Y-m-d H:i:s" );
|
|
|
+ else
|
|
|
+ die ( 'illegal request' );
|
|
|
+
|
|
|
+ $staff->seniorityFormula = json_encode ( $seniorityFormula );
|
|
|
+
|
|
|
+ $item = array (
|
|
|
+ 'sid' => $sid,
|
|
|
+ 'nature' => 4,
|
|
|
+ 'pendStatus' => 4,
|
|
|
+ 'seniorityFormula'=>json_encode($seniorityFormula),
|
|
|
+ 'dimissionDate' => date ( "Y-m-d H:i:s" )
|
|
|
+ );
|
|
|
+ $staff->setStaffByCondition ( $item );
|
|
|
+
|
|
|
+ return '/hrEmployee';
|
|
|
+ }
|
|
|
+ die ( 'illegal request' );
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 确认在入职
|
|
|
+ */
|
|
|
+ function employeeReentry() {
|
|
|
+ $sidKey = $this->get_args ( 'sidKey' ) ? $this->get_args ( 'sidKey' ) : "";
|
|
|
+
|
|
|
+ if (! empty ( $sidKey )) {
|
|
|
+ Doo::loadClass ( 'XDeode' );
|
|
|
+ $XDeode = new XDeode ( 5 );
|
|
|
+ Doo::loadModel ( 'staff' );
|
|
|
+ $staff = new staff ();
|
|
|
+
|
|
|
+ $sid = $XDeode->decode ( $sidKey );
|
|
|
+
|
|
|
+ $detail = $staff->getStaffBySid ( $sid );
|
|
|
+ if (empty ( $detail ))
|
|
|
+ die ( 'illegal request' );
|
|
|
+ //工龄记录
|
|
|
+ $seniorityFormula=json_decode($detail['seniorityFormula']);
|
|
|
+
|
|
|
+ array_push ( $seniorityFormula, array (
|
|
|
+ 'InductionDate' => date ( "Y-m-d H:i:s" ) ,
|
|
|
+ 'dimissionDate' => ''
|
|
|
+ ) );
|
|
|
+
|
|
|
+ $item = array (
|
|
|
+ 'sid' => $sid,
|
|
|
+ 'nature' => 1,
|
|
|
+ 'pendStatus' => 0,
|
|
|
+ 'seniorityFormula'=>json_encode($seniorityFormula),
|
|
|
+ 'hiredate' => date ( "Y-m-d H:i:s" )
|
|
|
+ );
|
|
|
+ $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() {
|
|
@@ -884,12 +1222,12 @@ class HumanResourceController extends DooController {
|
|
|
/**
|
|
|
* 获得员工信息(未编写html)
|
|
|
*/
|
|
|
- function ajaxGetStaffInfoBySid(){
|
|
|
+ function ajaxGetStaffInfoBySid() {
|
|
|
$serial = $this->get_args ( 'serial' ) ? $this->get_args ( 'serial' ) : "";
|
|
|
if (empty ( $serial )) {
|
|
|
echo json_encode ( array (
|
|
|
'status' => 2,
|
|
|
- 'msg' => 'illegal request'
|
|
|
+ 'msg' => 'illegal request'
|
|
|
) );
|
|
|
die ();
|
|
|
}
|
|
@@ -904,7 +1242,7 @@ class HumanResourceController extends DooController {
|
|
|
|
|
|
echo json_encode ( array (
|
|
|
'status' => 1,
|
|
|
- 'detail' => $detail
|
|
|
+ 'detail' => $detail
|
|
|
) );
|
|
|
die ();
|
|
|
}
|
|
@@ -941,9 +1279,7 @@ class HumanResourceController extends DooController {
|
|
|
else {
|
|
|
$html = '
|
|
|
|
|
|
- <div class="modal-header">
|
|
|
- <h3>员工入职审批</h3>
|
|
|
- </div>
|
|
|
+
|
|
|
<div class="modal-body saeaList">
|
|
|
<div class="fL staff-detail-con">
|
|
|
<table class="table table-bordered table-condensed">
|
|
@@ -1076,7 +1412,7 @@ class HumanResourceController extends DooController {
|
|
|
<tbody>
|
|
|
<tr>
|
|
|
<th class="taC" width="150">工号</th><td width="210">' . $detail ['jobNumber'] . '</td>
|
|
|
- <th class="taC" width="150">姓名</th><td><input type="text" name="username" id="username" value="' . $detail ['username'] . '"></td>
|
|
|
+ <th class="taC" width="150">姓名</th><td>' . $detail ['username'] . '</td>
|
|
|
</tr>
|
|
|
<tr>
|
|
|
<th class="taC" width="150">办事处/部门</th><td>
|
|
@@ -1262,6 +1598,7 @@ class HumanResourceController extends DooController {
|
|
|
|
|
|
echo json_encode ( array (
|
|
|
'status' => 1,
|
|
|
+ 'sidKey' => $serial,
|
|
|
'html' => $html
|
|
|
) );
|
|
|
die ();
|