1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468 |
- <?php
- /**
- * @author darkredz
- */
- class HumanResourceController extends DooController {
- public function beforeRun($resource, $action) {
- }
- function __construct() {
- if (isset ( $_COOKIE ["staff"] )) {
- if (! empty ( $_COOKIE ["staff"] )) {
- Doo::loadModel ( 'staff' );
- $staff = new staff ();
-
- $this->staff = $staff->getStaffBySid ( $_COOKIE ["staff"] );
- return "/";
- }
- }
-
- Doo::loadCore ( 'uri/DooUriRouter' );
- $router = new DooUriRouter ();
- $routeRs = $router->execute ( Doo::app ()->route, Doo::conf ()->SUBFOLDER );
- if ($routeRs ['1'] != "appliedEntry") {
- if ($routeRs ['1'] != "login") {
- header ( 'Content-Type:text/html;charset=utf-8' );
- @header ( "Location: /login" );
- }
- }
- }
-
- /**
- * 人资首页
- */
- function hr() {
- Doo::loadModel ( 'staffManage' );
- $staffManage = new staffManage ();
- Doo::loadModel ( 'staff' );
- $staff = new staff ();
-
- // 获得当前账号需要审批的员工
- $staffList = $staff->getStaffByApplied ( $this->staff ['sid'] );
- $staffNew = $staff->getStaffByApprovals ();
-
- // print_r($staffList);
- $this->data ['staffList'] = $staffList;
- $this->data ['staffNew'] = $staffNew;
-
- $this->data ['memu'] = "HumanResource";
- $this->data ['hrMemu'] = "hr";
-
- $this->render ( "/humanResource/hr", $this->data );
- }
-
- /**
- * 员工入职审批
- */
- function employeeInductionApprovals() {
- Doo::loadModel ( 'staff' );
- $staff = new staff ();
- Doo::loadClass ( 'XDeode' );
- $XDeode = new XDeode ( 5 );
- Doo::loadModel ( 'staffManage' );
- $staffManage = new staffManage ();
-
-
- $sidKey = $this->get_args ( 'sidKey' ) ? $this->get_args ( 'sidKey' ) : "";
-
- $sid = $XDeode->decode ( $sidKey );
- if (! is_numeric ( $sid ) || empty ( $sid ))
- die ( 'illegal request' );
-
- $staffDetail = $staff->getOne ( array (
- 'where' => 'pendStatus=2 and sid=' . $sid . ' and pendingApprovals=' . $this->staff ['sid'],
- 'asArray' => true
- ) );
-
- if (empty ( $staffDetail ))
- die ( 'illegal request' );
-
- $processApprovals = json_decode ( $staffDetail ['processApprovals'], true );
- $invoiceManage = json_decode ( $staffDetail ['staffManage'], true );
-
- $staff = new staff ();
- if (empty ( $processApprovals )) {
- $processApprovals = array (
- $this->staff ['sid'] => array (
- 'date' => date ( "Y-m-d H:i:s" )
- )
- );
- $nextInvoiceManage = next ( $invoiceManage );
-
- if ($nextInvoiceManage !== false)
- $staff->pendingApprovals = $nextInvoiceManage [0];
- $staff->processApprovals = json_encode ( $processApprovals );
- } else {
- $processApprovals [$this->staff ['sid']] = array (
- 'date' => date ( "Y-m-d H:i:s" )
- );
-
- $pendingApprovals = 0;
- foreach ( $invoiceManage as $key => $value ) {
- if ($value [0] == $this->staff ['sid']) {
- if (isset ( $invoiceManage [$key + 1] ))
- $pendingApprovals = $invoiceManage [$key + 1] [0];
- break;
- }
- }
-
- if (! empty ( $pendingApprovals ))
- $staff->pendingApprovals = $pendingApprovals;
- $staff->processApprovals = json_encode ( $processApprovals );
- }
-
- if (count ( $processApprovals ) == count ( $invoiceManage )) {
- $staff->pendStatus = 0;
- $staff->pendingApprovals = 0;
- $staff->InductionDate = date ( "Y-m-d H:i:s" );
- }
-
- $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' => 1,
- 'img' => $staffDetail ['avatar'],
- 'username' => $staffDetail ['username'],
- 'uid' => $staffDetail ['sid'],
- 'category' => $staffDetail ['category']
- );
- $staffOperationLog->setInvoiceOperationLog ( $item );
-
- return '/hr';
- }
-
- /**
- * 员工信息
- */
- function hrEmployee() {
- Doo::loadModel ( 'staff' );
- $staff = new staff ();
- Doo::loadModel ( 'L_category' );
- $L_category = new L_category ();
-
- $stafflist = $staff->getStaff ( true );
-
- // 生成工号
- $jobNumber = $this->createJobNumber ();
- // 获得办事和部门
- $categoryList = $L_category->getCategoryDepartment ();
-
- $this->data ['categoryList'] = $categoryList;
- $this->data ['jobNumber'] = $jobNumber;
- $this->data ['stafflist'] = $stafflist;
-
- $this->data ['memu'] = "HumanResource";
- $this->data ['hrMemu'] = "hrEmployeeInfo";
-
- $this->render ( "/humanResource/hrEmployee", $this->data );
- }
- function staffAdd() {
- $username = $this->get_args ( 'username' ) ? $this->get_args ( 'username' ) : "";
- $nature = is_numeric ( $this->get_args ( 'nature' ) ) ? $this->get_args ( 'nature' ) : 0;
- $cid_did = $this->get_args ( 'cid_did' ) ? $this->get_args ( 'cid_did' ) : '';
- $position = $this->get_args ( 'position' ) ? $this->get_args ( 'position' ) : '';
- $hiredate = $this->get_args ( 'hiredate' ) ? $this->get_args ( 'hiredate' ) : '';
- $telephone = $this->get_args ( 'telephone' ) ? $this->get_args ( 'telephone' ) : '';
- $baseWage = is_numeric ( $this->get_args ( 'baseWage' ) ) ? $this->get_args ( 'baseWage' ) : 0;
- $postWage = is_numeric ( $this->get_args ( 'postWage' ) ) ? $this->get_args ( 'postWage' ) : 0;
- $achievementBonus = is_numeric ( $this->get_args ( 'achievementBonus' ) ) ? $this->get_args ( 'achievementBonus' ) : 0;
- $gender = $this->get_args ( 'gender' ) ? $this->get_args ( 'gender' ) : '';
-
- if (! empty ( $username ) && ! empty ( $nature ) && ! empty ( $cid_did ) && ! empty ( $position ) && ! empty ( $hiredate ) && ! empty ( $baseWage ) && ! empty ( $postWage ) && ! empty ( $achievementBonus )) {
-
- Doo::loadClass ( 'XDeode' );
- $XDeode = new XDeode ( 5 );
- Doo::loadModel ( 'staff' );
- $staff = new staff ();
- Doo::loadModel ( 'L_category' );
- $L_category = new L_category ();
- Doo::loadModel ( 'tag' );
- Doo::loadModel ( 'holidaystaff' );
- Doo::loadModel ( 'staffManage' );
- $staffManage = new staffManage ();
-
- // 用户名检测
- $staff->username = $username;
- $staff->hiredate = $hiredate;
- $staff->nature = $nature;
- $staff->position = $position;
- $department = explode ( '_', $cid_did );
-
- $cid = $XDeode->decode ( $department [0] );
- // 加入默认总部分类
- if (! is_numeric ( $cid ))
- die ( 'illegal request' );
- $cagegory = $L_category->getCategoryById ( $cid );
- // 部门
- if (! empty ( $department [1] )) {
- $did = $XDeode->decode ( $department [1] );
- if (! is_numeric ( $did ))
- die ( 'illegal request' );
- $staff->departmentID = $did;
- }
-
- // 生成工号
- $jobNumber = $this->createJobNumber ();
- if ($nature == 1)
- $staff->jobNumber = $jobNumber ['regularStaff'];
- else {
- $staff->jobNumber = $jobNumber ['internStaff'];
- $staff->pendStatus = 1;
- }
-
- $staff->cid = $cagegory [0] ['cid'];
- $staff->category = $cagegory [0] ['title'];
-
- $staff->telephone = $telephone;
- $staff->baseWage = $baseWage;
- $staff->postWage = $postWage;
- $staff->achievementBonus = $achievementBonus;
- $staff->gender = $gender;
- // 审批组
- // 获得该办事处的审批组
- $approvalKey = explode ( '_', $cid_did );
- $cidMode = array ();
- foreach ( $approvalKey as $value ) {
- if (! empty ( $value )) {
- $cid = $XDeode->decode ( $value );
- array_push ( $cidMode, $cid );
- }
- }
- $cidMode = implode ( '_', $cidMode );
- $staffManageDetail = $staffManage->getStaffManageByCid ( $cidMode );
- if (empty ( $staffManageDetail ))
- die ( 'illegal request' );
-
- $pendingApprovalsSid = current ( $staffManageDetail ['staffList'] ) [0];
- $staff->pendingApprovals = $pendingApprovalsSid;
- $staff->staffManage = $staffManageDetail ['staff'];
-
- // 抄送组
- $staff->processCC = $staffManageDetail ['CC'];
- $id = $staff->insert ();
-
- // 更新假期相关信息
- $holidaystaff = new HStaff ();
- $holidaystaff->uid = $id;
- $holidaystaff->insert ();
-
- $staffmsg = $staff->getUserById ( $id );
- $this->updateAnnualLeave ( $staffmsg [0] );
-
- // 标签更新
- for($i = 1; $i <= 7; $i ++) {
- $tag = new tag ();
- $tag->name = "个人标签";
- $tag->sid = $id;
- $tag->colorid = $i;
- $tag->insert ();
- }
- }
- return '/hrEmployee';
- }
-
- /**
- * 更新员工信息
- */
- function staffUpdate() {
- $sidKey = $this->get_args ( 'sidKey' ) ? $this->get_args ( 'sidKey' ) : "";
-
- $username = $this->get_args ( 'username' ) ? $this->get_args ( 'username' ) : "";
- $cid_did = $this->get_args ( 'cid_did' ) ? $this->get_args ( 'cid_did' ) : '';
- $position = $this->get_args ( 'position' ) ? $this->get_args ( 'position' ) : '';
- $hiredate = $this->get_args ( 'hiredate' ) ? $this->get_args ( 'hiredate' ) : '';
- $telephone = $this->get_args ( 'telephone' ) ? $this->get_args ( 'telephone' ) : '';
- // $baseWage = is_numeric ( $this->get_args ( 'baseWage' ) ) ? $this->get_args ( 'baseWage' ) : 0;
- // $postWage = is_numeric ( $this->get_args ( 'postWage' ) ) ? $this->get_args ( 'postWage' ) : 0;
- // $achievementBonus = is_numeric ( $this->get_args ( 'achievementBonus' ) ) ? $this->get_args ( 'achievementBonus' ) : 0;
- $gender = $this->get_args ( 'gender' ) ? $this->get_args ( 'gender' ) : '';
-
- $qq = is_numeric ( $this->get_args ( 'qq' ) ) ? $this->get_args ( 'qq' ) : 0;
- $phone = is_numeric ( $this->get_args ( 'phone' ) ) ? $this->get_args ( 'phone' ) : 0;
- $wecat = $this->get_args ( 'wecat' ) ? $this->get_args ( 'wecat' ) : '';
- $email = $this->get_args ( 'email' ) ? $this->get_args ( 'email' ) : '';
-
- $birthday = $this->get_args ( 'birthday' ) ? $this->get_args ( 'birthday' ) : '';
- $qualifications = $this->get_args ( 'qualifications' ) ? $this->get_args ( 'qualifications' ) : '';
- $marriage = $this->get_args ( 'marriage' ) ? $this->get_args ( 'marriage' ) : '';
- $IDcards = $this->get_args ( 'IDcards' ) ? $this->get_args ( 'IDcards' ) : '';
-
- $living = $this->get_args ( 'living' ) ? $this->get_args ( 'living' ) : '';
- $nativePlace = $this->get_args ( 'nativePlace' ) ? $this->get_args ( 'nativePlace' ) : '';
- $emergencyContacts = $this->get_args ( 'emergencyContacts' ) ? $this->get_args ( 'emergencyContacts' ) : '';
- $remittanceName = $this->get_args ( 'remittanceName' ) ? $this->get_args ( 'remittanceName' ) : '';
- $coupletNumber = $this->get_args ( 'coupletNumber' ) ? $this->get_args ( 'coupletNumber' ) : '';
- $bankName = $this->get_args ( 'bankName' ) ? $this->get_args ( 'bankName' ) : '';
- $bankNumber = $this->get_args ( 'bankNumber' ) ? $this->get_args ( 'bankNumber' ) : '';
-
- $employeeInfo = $this->get_args ( 'employeeInfo' ) ? $this->get_args ( 'employeeInfo' ) : 'employeeInfo';
-
- if (! empty ( $sidKey ) ) {
-
- Doo::loadClass ( 'XDeode' );
- $XDeode = new XDeode ( 5 );
- Doo::loadModel ( 'staff' );
- $staff = new staff ();
- Doo::loadModel ( 'L_category' );
- $L_category = new L_category ();
- Doo::loadModel ( 'tag' );
- Doo::loadModel ( 'holidaystaff' );
- Doo::loadModel ( 'staffManage' );
- $staffManage = new staffManage ();
-
- // 用户名检测
- if(!empty($username)){
- $detail=$staff->getStaffByName($username);
- if (empty($detail))
- die ( 'illegal request' );
- }
- $detail=$staff->getStaffBySid($sidKey);
- if (empty($detail))
- die ( 'illegal request' );
-
- $staff->username = $username;
- if (!empty($hiredate))
- $staff->hiredate = $hiredate;
- if (!empty($position))
- $staff->position = $position;
-
- //办事处-部门
- if (!empty($cid_did)){
- $department = explode ( '_', $cid_did );
- $cid = $XDeode->decode ( $department [0] );
- // 加入默认总部分类
- if (! is_numeric ( $cid ))
- die ( 'illegal request' );
- $cagegory = $L_category->getCategoryById ( $cid );
- // 部门
- if (! empty ( $department [1] )) {
- $did = $XDeode->decode ( $department [1] );
- if (! is_numeric ( $did ))
- die ( 'illegal request' );
- $staff->departmentID = $did;
- }
- $staff->cid = $cagegory [0] ['cid'];
- $staff->category = $cagegory [0] ['title'];
- }
-
- if (!empty($telephone))
- $staff->telephone = $telephone;
- // if (!empty($baseWage))
- // $staff->baseWage = $baseWage;
- // if (!empty($postWage))
- // $staff->postWage = $postWage;
- // if (!empty($achievementBonus))
- // $staff->achievementBonus = $achievementBonus;
- if (!empty($gender))
- $staff->gender = $gender;
-
- if (!empty($qq))
- $staff->qq = $qq;
- if (!empty($phone))
- $staff->phone = $phone;
- if (!empty($wecat))
- $staff->wecat = $wecat;
- if (!empty($email))
- $staff->email = $email;
- if (!empty($birthday))
- $staff->birthday = $birthday;
- if (!empty($$qualifications))
- $staff->qualifications = $qualifications;
- if (!empty($marriage))
- $staff->marriage = $marriage;
- if (!empty($IDcards))
- $staff->IDcards = $IDcards;
- if (!empty($living))
- $staff->living = $living;
- if (!empty($nativePlace))
- $staff->nativePlace = $nativePlace;
- if (!empty($emergencyContacts))
- $staff->emergencyContacts = $emergencyContacts;
- if (!empty($coupletNumber))
- $staff->coupletNumber = $coupletNumber;
- if (!empty($bankName))
- $staff->bankName = $bankName;
- if (!empty($bankNumber))
- $staff->bankNumber = $bankNumber;
- if (!empty($remittanceName))
- $staff->remittanceName = $remittanceName;
-
- $staff->update ( array (
- 'where' => 'sid=' . $detail['sid']
- ) );
-
- if($employeeInfo=='employeeInfo'){
- return '/hr';
- }elseif($employeeInfo=='settingEmployeeInfo'){
- return '/settingEmployeeInfo';
- }
-
- }
- die ( 'illegal request' );
- }
-
- /**
- * 员工转职
- */
- function staffTransfer(){
- $sidKey = $this->get_args ( 'sidKey' ) ? $this->get_args ( 'sidKey' ) : "";
- $nature = $this->get_args ( 'nature' ) ? $this->get_args ( 'nature' ) : '';
-
- if(!empty($sidKey)&&!empty($nature)){
- Doo::loadClass ( 'XDeode' );
- $XDeode = new XDeode ( 5 );
- Doo::loadModel ( 'staff' );
- $staff = new staff ();
-
- $sid = $XDeode->decode ( $sidKey );
- $staffDetail=$staff->getStaffBySid ( $sid );
-
- $item = array (
- 'sid' => $sid
- );
- if ($nature=='TRIAL')
- $item += array (
- // 试用
- 'nature' => 3,
- 'probationaryDate' => date ( "Y-m-d H:i:s" )
- );
- if($nature=='REGULARS'){
- // 生成工号
- $jobNumber = $this->createJobNumber ();
- $item += array (
- //正式
- 'nature' => 1,
- 'jobNumber'=>$jobNumber ['regularStaff'],
- 'regularsDate' => date ( "Y-m-d H:i:s" )
- );
- }
- $staff->setStaffByCondition ( $item );
-
- // 操作日志
- Doo::loadModel ( 'staffOperationLog' );
- $staffOperationLog = new staffOperationLog ();
- $item = array (
- 'date' => date ( "Y-m-d H:i:s" ),
- 'status' => 1,
- 'img' => $staffDetail ['avatar'],
- 'username' => $staffDetail ['username'],
- 'uid' => $staffDetail ['sid'],
- 'category' => $staffDetail ['category']
- );
- if ($nature=='TRIAL')
- $item += array (
- // 试用
- 'operation' => "员工 实习转试用",
- );
- if($nature=='REGULARS')
- $item += array (
- //正式
- 'operation' => "员工 试用转正式",
- );
- $staffOperationLog->setInvoiceOperationLog ( $item );
-
- return '/hrEmployee';
- }
- die ( 'illegal request' );
- }
-
- /**
- * 申请入职
- */
- function appliedEntry() {
- $sidKey = $this->get_args ( 'sidKey' ) ? $this->get_args ( 'sidKey' ) : "";
- $telephone = $this->get_args ( 'telephone' ) ? $this->get_args ( 'telephone' ) : '';
- $qq = $this->get_args ( 'qq' ) ? $this->get_args ( 'qq' ) : '';
- $wecat = $this->get_args ( 'wecat' ) ? $this->get_args ( 'wecat' ) : '';
- $phone = $this->get_args ( 'phone' ) ? $this->get_args ( 'phone' ) : '';
- $email = $this->get_args ( 'email' ) ? $this->get_args ( 'email' ) : '';
- $gender = $this->get_args ( 'gender' ) ? $this->get_args ( 'gender' ) : '';
-
- $birthday = $this->get_args ( 'birthday' ) ? $this->get_args ( 'birthday' ) : '';
- $qualifications = $this->get_args ( 'qualifications' ) ? $this->get_args ( 'qualifications' ) : '';
- $marriage = $this->get_args ( 'marriage' ) ? $this->get_args ( 'marriage' ) : '';
- $nativePlace = $this->get_args ( 'nativePlace' ) ? $this->get_args ( 'nativePlace' ) : '';
-
- $emergencyContacts = $this->get_args ( 'emergencyContacts' ) ? $this->get_args ( 'emergencyContacts' ) : '';
- $living = $this->get_args ( 'living' ) ? $this->get_args ( 'living' ) : '';
-
- if (! empty ( $sidKey ) && ! empty ( $telephone ) && ! empty ( $qq ) && ! empty ( $wecat ) && ! empty ( $phone ) && ! empty ( $email ) && ! empty ( $gender ) && ! empty ( $birthday ) && ! empty ( $qualifications ) && ! empty ( $marriage ) && ! empty ( $nativePlace ) && ! empty ( $emergencyContacts ) && ! empty ( $living )) {
- Doo::loadClass ( 'XDeode' );
- $XDeode = new XDeode ( 5 );
- Doo::loadModel ( 'staff' );
- $staff = new staff ();
-
- $sid = $XDeode->decode ( $sidKey );
-
- $item = array (
- 'sid' => $sid,
- 'qq' => $qq,
- 'wecat' => $wecat,
- 'phone' => $phone,
- 'email' => $email,
-
- 'gender' => $gender,
- 'birthday' => $birthday,
- 'qualifications' => $qualifications,
- 'marriage' => $marriage,
-
- 'nativePlace' => $nativePlace,
- 'emergencyContacts' => $emergencyContacts,
- 'living' => $living,
- // 状态改成入职申请
- 'pendStatus' => 2
- );
- $staff->setStaffByCondition ( $item );
-
- return '/login';
- }
- die ( 'illegal request' );
- }
-
- /**
- * 员工审批流程
- */
- function employeeApprovals() {
- Doo::loadModel ( 'staff' );
- $staff = new staff ();
- Doo::loadModel ( 'L_category' );
- $L_category = new L_category ();
- Doo::loadModel ( 'staffManage' );
- $staffManage = new staffManage ();
-
- // 获得办事和部门
- $categoryList = $L_category->getCategoryDepartment ();
-
- $staffManageList = $staffManage->find ( array (
- 'asArray' => true
- ) );
-
- foreach ( $staffManageList as $key => $value ) {
- // 审批人员
- $name = json_decode ( $value ['staff'] );
- $employeeApprovals = array ();
- if (count ( $name ) != 0) {
- foreach ( $name as $ve ) {
- array_push ( $employeeApprovals, $ve [1] );
- }
- }
- $employeeApprovals = implode ( '->', $employeeApprovals );
-
- // 抄送人员
- $name = json_decode ( $value ['CC'] );
- $CC = array ();
- if (count ( $name ) != 0) {
- foreach ( $name as $ve ) {
- array_push ( $CC, $ve [1] );
- }
- }
- $CC = implode ( ' ', $CC );
-
- foreach ( $categoryList as $k => $v ) {
- $cid = $v ['cid'];
- if (isset ( $v ['did'] ))
- $cid .= '_' . $v ['did'];
- if ($cid == $value ['cid']) { // echo $cid.'//';echo $value['cid'].'<br/>';
- $categoryList [$k] ['employeeApprovals'] = $employeeApprovals;
- $categoryList [$k] ['CC'] = $CC;
- break;
- }
- }
- }
- foreach ( $categoryList as $key => $value ) {
- if (! isset ( $value ['employeeApprovals'] ))
- $categoryList [$key] ['employeeApprovals'] = '';
- if (! isset ( $value ['CC'] ))
- $categoryList [$key] ['CC'] = '';
- }
-
- // print_r($categoryList);
- $stafflist = $staff->getStaff ( true );
-
- $this->data ['categoryList'] = $categoryList;
- $this->data ['staffList'] = $stafflist;
-
- $this->data ['memu'] = "HumanResource";
- $this->data ['hrMemu'] = "employeeApprovals";
-
- $this->render ( "/humanResource/employeeApprovals", $this->data );
- }
-
- /**
- * 添加员工审批人员
- */
- function employeeApprovalsAdd() {
- $cidKey = $this->get_args ( 'cidKey' ) ? $this->get_args ( 'cidKey' ) : "";
- $uidlist = $this->get_args ( 'uidlist' ) ? $this->get_args ( 'uidlist' ) : "";
- $uidlist = explode ( ",", $uidlist );
-
- if (! empty ( $cidKey ) && ! empty ( $uidlist )) {
- Doo::loadModel ( "staffManage" );
- $staffManage = new staffManage ();
- Doo::loadClass ( 'XDeode' );
- $XDeode = new XDeode ( 5 );
-
- // 获得抄送内容
- $approvalKey = explode ( '_', $cidKey );
- $cidMode = array ();
- foreach ( $approvalKey as $value ) {
- $cid = $XDeode->decode ( $value );
- array_push ( $cidMode, $cid );
- }
-
- $cidMode = implode ( '_', $cidMode );
- // echo $cidMode;die;
- $staffManageInfo = $staffManage->getOne ( array (
- 'where' => 'cid ="' . $cidMode . '" ',
- 'asArray' => true
- ) );
-
- // 审批人员
- $list = array ();
- foreach ( $uidlist as $key => $value ) {
- $info = explode ( ":", $value );
- array_push ( $list, $info );
- }
-
- if (empty ( $staffManageInfo )) {
- $staffManage = new staffManage ();
-
- $staffManage->cid = $cidMode;
- $staffManage->staff = json_encode ( $list );
-
- $staffManage->insert ();
- } else {
- $staffManage = new staffManage ();
-
- $staffManage->staff = json_encode ( $list );
- $staffManage->update ( array (
- 'where' => 'icid = ' . $staffManageInfo ['icid']
- ) );
- }
- return '/employeeApprovals';
- }
- die ( 'illegal request' );
- }
-
- /**
- * 添加抄送员工,微信通知
- */
- function employeeCCAdd() {
- $cidKey = $this->get_args ( 'cidKey' ) ? $this->get_args ( 'cidKey' ) : "";
- $staff = $this->get_args ( 'staff' ) ? $this->get_args ( 'staff' ) : "";
-
- if (! empty ( $cidKey ) && ! empty ( $staff )) {
- Doo::loadModel ( "staffManage" );
- $staffManage = new staffManage ();
- Doo::loadClass ( 'XDeode' );
- $XDeode = new XDeode ( 5 );
-
- // 获得抄送内容
- $approvalKey = explode ( '_', $cidKey );
- $cidMode = array ();
- foreach ( $approvalKey as $value ) {
- $cid = $XDeode->decode ( $value );
- array_push ( $cidMode, $cid );
- }
-
- $cidMode = implode ( '_', $cidMode );
- $staffManageInfo = $staffManage->getOne ( array (
- 'where' => 'cid ="' . $cidMode . '" ',
- 'asArray' => true
- ) );
-
- $list = array ();
- foreach ( $staff as $key => $value ) {
- $info = explode ( ":", $value );
- array_push ( $list, $info );
- }
-
- if (empty ( $staffManageInfo )) {
- $staffManage = new staffManage ();
-
- $staffManage->cid = $cidMode;
- $staffManage->CC = json_encode ( $list );
-
- $staffManage->insert ();
- } else {
- $staffManage = new staffManage ();
-
- $staffManage->CC = json_encode ( $list );
- $staffManage->update ( array (
- 'where' => 'icid = ' . $staffManageInfo ['icid']
- ) );
- }
- return '/employeeApprovals';
- }
- die ( 'illegal request' );
- }
-
- /**
- * 离职审批流程设置
- */
- function leaveOfficeApprovals() {
- Doo::loadModel ( 'staff' );
- $staff = new staff ();
- Doo::loadModel ( 'L_category' );
- $L_category = new L_category ();
- Doo::loadModel ( 'staffLeaveManage' );
- $staffManage = new staffLeaveManage ();
-
- // 获得办事和部门
- $categoryList = $L_category->getCategoryDepartment ();
-
- $staffManageList = $staffManage->find ( array (
- 'asArray' => true
- ) );
-
- foreach ( $staffManageList as $key => $value ) {
- // 审批人员
- $name = json_decode ( $value ['staff'] );
- $employeeApprovals = array ();
- if (count ( $name ) != 0) {
- foreach ( $name as $ve ) {
- array_push ( $employeeApprovals, $ve [1] );
- }
- }
- $employeeApprovals = implode ( '->', $employeeApprovals );
-
- // 抄送人员
- $name = json_decode ( $value ['CC'] );
- $CC = array ();
- if (count ( $name ) != 0) {
- foreach ( $name as $ve ) {
- array_push ( $CC, $ve [1] );
- }
- }
- $CC = implode ( ' ', $CC );
-
- foreach ( $categoryList as $k => $v ) {
- $cid = $v ['cid'];
- if (isset ( $v ['did'] ))
- $cid .= '_' . $v ['did'];
- if ($cid == $value ['cid']) { // echo $cid.'//';echo $value['cid'].'<br/>';
- $categoryList [$k] ['employeeApprovals'] = $employeeApprovals;
- $categoryList [$k] ['CC'] = $CC;
- break;
- }
- }
- }
- foreach ( $categoryList as $key => $value ) {
- if (! isset ( $value ['employeeApprovals'] ))
- $categoryList [$key] ['employeeApprovals'] = '';
- if (! isset ( $value ['CC'] ))
- $categoryList [$key] ['CC'] = '';
- }
-
- // print_r($categoryList);
- $stafflist = $staff->getStaff ( true );
-
- $this->data ['categoryList'] = $categoryList;
- $this->data ['staffList'] = $stafflist;
-
- $this->data ['memu'] = "HumanResource";
- $this->data ['hrMemu'] = "employeeApprovals";
-
- $this->render ( "/humanResource/leaveOfficeApprovals", $this->data );
- }
-
- /**
- * 添加员工审批人员
- */
- function employeeleaveApprovalsAdd() {
- $cidKey = $this->get_args ( 'cidKey' ) ? $this->get_args ( 'cidKey' ) : "";
- $uidlist = $this->get_args ( 'uidlist' ) ? $this->get_args ( 'uidlist' ) : "";
- $uidlist = explode ( ",", $uidlist );
-
- if (! empty ( $cidKey ) && ! empty ( $uidlist )) {
- Doo::loadModel ( "staffLeaveManage" );
- $staffManage = new staffLeaveManage ();
- Doo::loadClass ( 'XDeode' );
- $XDeode = new XDeode ( 5 );
-
- // 获得抄送内容
- $approvalKey = explode ( '_', $cidKey );
- $cidMode = array ();
- foreach ( $approvalKey as $value ) {
- $cid = $XDeode->decode ( $value );
- array_push ( $cidMode, $cid );
- }
-
- $cidMode = implode ( '_', $cidMode );
- // echo $cidMode;die;
- $staffManageInfo = $staffManage->getOne ( array (
- 'where' => 'cid ="' . $cidMode . '" ',
- 'asArray' => true
- ) );
-
- // 审批人员
- $list = array ();
- foreach ( $uidlist as $key => $value ) {
- $info = explode ( ":", $value );
- array_push ( $list, $info );
- }
-
- if (empty ( $staffManageInfo )) {
- $staffManage = new staffLeaveManage ();
-
- $staffManage->cid = $cidMode;
- $staffManage->staff = json_encode ( $list );
-
- $staffManage->insert ();
- } else {
- $staffManage = new staffLeaveManage ();
-
- $staffManage->staff = json_encode ( $list );
- $staffManage->update ( array (
- 'where' => 'icid = ' . $staffManageInfo ['icid']
- ) );
- }
- return '/leaveOfficeApprovals';
- }
- die ( 'illegal request' );
- }
-
- /**
- * 添加抄送员工,微信通知
- */
- function employeeleaveCCAdd() {
- $cidKey = $this->get_args ( 'cidKey' ) ? $this->get_args ( 'cidKey' ) : "";
- $staff = $this->get_args ( 'staff' ) ? $this->get_args ( 'staff' ) : "";
-
- if (! empty ( $cidKey ) && ! empty ( $staff )) {
- Doo::loadModel ( "staffLeaveManage" );
- $staffManage = new staffLeaveManage ();
- Doo::loadClass ( 'XDeode' );
- $XDeode = new XDeode ( 5 );
-
- // 获得抄送内容
- $approvalKey = explode ( '_', $cidKey );
- $cidMode = array ();
- foreach ( $approvalKey as $value ) {
- $cid = $XDeode->decode ( $value );
- array_push ( $cidMode, $cid );
- }
-
- $cidMode = implode ( '_', $cidMode );
- $staffManageInfo = $staffManage->getOne ( array (
- 'where' => 'cid ="' . $cidMode . '" ',
- 'asArray' => true
- ) );
-
- $list = array ();
- foreach ( $staff as $key => $value ) {
- $info = explode ( ":", $value );
- array_push ( $list, $info );
- }
-
- if (empty ( $staffManageInfo )) {
- $staffManage = new staffLeaveManage ();
-
- $staffManage->cid = $cidMode;
- $staffManage->CC = json_encode ( $list );
-
- $staffManage->insert ();
- } else {
- $staffManage = new staffLeaveManage ();
-
- $staffManage->CC = json_encode ( $list );
- $staffManage->update ( array (
- 'where' => 'icid = ' . $staffManageInfo ['icid']
- ) );
- }
- return '/leaveOfficeApprovals';
- }
- die ( 'illegal request' );
- }
-
- /**
- * 获得员工信息(未编写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 ();
-
- $sid = $XDeode->decode ( $serial );
- $detail = $staff->getStaffBySid ( $sid );
- // $invoiceOperationLogList = $invoiceOperationLog->getInvoiceOperationLogByIid ( $detail ['iid'] );
-
- if (empty ( $detail ))
- $html = '';
- 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">
- <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>' . $detail ['marriage'] . '</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">
- <div class="infoFlowList">
- <div class="dateTitle">
- <em class="month"><span class="num">12</span><span class="text">-03</span></em>
- <span class="year">2013</span>
- </div>
- <ul class="flowList">
- <li class="item colGray">总部-何银龄</li>
- <li class="item">审批通过</li>
- </ul>
- </div>
- <div class="infoFlowList">
- <div class="dateTitle">
- <em class="month"><span class="num">12</span><span class="text">-03</span></em>
- <span class="year">2013</span>
- </div>
- <ul class="flowList">
- <li class="item colGray">总部-张三</li>
- <li class="item">申请入职</li>
- </ul>
- </div>
- <div class="infoFlowList">
- <div class="dateTitle">
- <em class="month"><span class="num">12</span><span class="text">-02</span></em>
- <span class="year">2013</span>
- </div>
- <ul class="flowList">
- <li class="item colGray">总部-温秀娟</li>
- <li class="item">添加员工</li>
- </ul>
- </div>
- </div>
- </div>
-
- ';
- }
- echo json_encode ( array (
- 'status' => 1,
- 'sidKey' => $serial,
- 'html' => $html
- ) );
- die ();
- } elseif ($type == 'EMPLOYEE') {
-
- Doo::loadModel ( 'staff' );
- $staff = new staff ();
- Doo::loadModel ( 'L_category' );
- $L_category = new L_category ();
- Doo::loadModel ( 'staffOperationLog' );
- $staffOperationLog = new staffOperationLog ();
-
- // 获得办事和部门
- $categoryList = $L_category->getCategoryDepartment ();
-
- $sid = $XDeode->decode ( $serial );
- $detail = $staff->getStaffBySid ( $sid );
- // 获得操作日志
- $SOPL = $staffOperationLog->getInvoiceOperationLogByUid ( $sid, 'desc' );
-
- if (empty ( $detail ))
- $html = '';
- else {
- $html = '
-
-
- <div class="modal-header">
- <h3>员工详情</h3>
- </div>
- <div class="modal-body saeaList" style="overflow:hidden;margin:0">
- <div class="fL staff-detail-con">
- <table class="table table-bordered table-condensed">
- <tbody>
- <tr>
- <th class="taC" width="150">工号</th><td width="210">' . $detail ['jobNumber'] . '</td>
- <th class="taC" width="150">姓名</th><td><input type="text" name="username" id="username" value="' . $detail ['username'] . '"></td>
- </tr>
- <tr>
- <th class="taC" width="150">办事处/部门</th><td>
-
- <select name="cid_did" id="cid_did">
- ';
-
- foreach ( $categoryList as $key => $value ) {
- $html .= '<option value="' . $value ['cidKey'] . '_';
- if (! empty ( $value ['did'] ))
- $html .= $value ['didKey'];
- $html .= '">' . $value ['title'];
- if (! empty ( $value ['did'] ))
- $html .= '/' . $value ['departmentName'] . '</option>';
- }
-
- $html .= ' </select>
- </td>
- <th class="taC" width="150">岗位</th><td><input type="text" name="position" id="position" value="' . $detail ['position'] . '"></td>
- </tr>
- <tr>
- <th class="taC" width="150">入职日期</th><td><input type="date" name="hiredate" id="hiredate" value="' . $detail ['hiredate'] . '"></td>
- <th class="taC" width="150">手机</th><td><input type="text" name="telephone" id="telephone" value="' . $detail ['telephone'] . '"></td>
- </tr>
- <tr>
- <th class="taC">QQ</th><td><input type="text" name="qq" id="qq" value="' . $detail ['qq'] . '"></td>
- <th class="taC">微信</th><td><input type="text" name="wecat" id="wecat" value="' . $detail ['wecat'] . '"></td>
- </tr>
- <tr>
- <th class="taC">电话</th><td><input type="text" name="phone" id="phone" value="' . $detail ['phone'] . '"></td>
- <th class="taC">邮箱</th><td><input type="text" name="email" id="email" value="' . $detail ['email'] . '"></td>
- </tr>
- </tbody>
- </table>
- <table class="table table-bordered table-condensed">
- <tr>
- <th class="taC" width="150">性别</th><td width="210">
- <label class="radio inline"><input type="radio" name="gender" ';
- if ($detail ['gender'] == '男')
- $html .= 'checked';
- $html .= ' value="男" data-rule="checked" >男</label>
- <label class="radio inline"><input type="radio" name="gender" ';
- if ($detail ['gender'] == '女')
- $html .= 'checked';
- $html .= ' value="女" >女</label>
- </td>
- <th class="taC" width="150">出生日期</th><td><input type="date" name="birthday" id="birthday" value="' . $detail ['birthday'] . '"></td>
- </tr>
- <tr>
- <th class="taC" width="150">最高学历</th><td>
- <select name="qualifications" id="qualifications">
- <option ';
- if ($detail ['qualifications'] == '初中')
- $html .= 'selected';
- $html .= ' value="初中">初中</option>
- <option ';
- if ($detail ['qualifications'] == '高中')
- $html .= 'selected';
- $html .= ' value="高中">高中</option>
- <option ';
- if ($detail ['qualifications'] == '中专')
- $html .= 'selected';
- $html .= ' value="中专">中专</option>
- <option ';
- if ($detail ['qualifications'] == '大专')
- $html .= 'selected';
- $html .= ' value="大专">大专</option>
- <option ';
- if ($detail ['qualifications'] == '本科')
- $html .= 'selected';
- $html .= ' value="本科">本科</option>
- <option ';
- if ($detail ['qualifications'] == '硕士')
- $html .= 'selected';
- $html .= ' value="硕士">硕士</option>
- </select>
- </td>
-
- <th class="taC" width="150">婚姻状况</th>
- <td>
- <select name="marriage" id="marriage">
- <option ';
- if ($detail ['marriage'] == '')
- $html .= 'selected';
- $html .= ' value="">请选择</option>
- <option ';
- if ($detail ['marriage'] == '1')
- $html .= 'selected';
- $html .= ' value="1">已婚</option>
- <option ';
- if ($detail ['marriage'] == '0')
- $html .= 'selected';
- $html .= ' value="0">未婚</option>
- </select>
- </td>
- </tr>
-
-
- <tr>
- <th class="taC" width="150">身份证</th>
- <td><input type="text" name="IDcards" id="IDcards" value="' . $detail ['IDcards'] . '"></td>
- <th class="taC" width="150">身份证扫描件</th>
- <td>
- <a href="#" target="_blank">正面(国徽)</a>
- <a href="#" target="_blank">反面(照片)</a>
- </td>
- </tr>
- </table>
- <table class="table table-bordered table-condensed">
- <tr>
- <th class="taC" width="150">毕业证书</th>
- <td width="210">
- <a href="#" target="_blank">毕业证书</a>
- </td>
- <th class="taC" width="150">学位证书</th>
- <td>
- <a href="#" target="_blank">学位证书</a>
- </td>
- </tr>
- <tr>
- <th class="taC" width="150">职称</th><td colspan="3"><a href="#" target="_blank">证书1</a> <a href="#" target="#">证书2</a></td>
- </tr>
- </table>
-
-
- <table class="table table-bordered table-condensed">
- <tr>
- <th class="taC" width="150">现居住地</th>
- <td colspan="3"><input type="text" name="living" id="living" value="' . $detail ['living'] . '" style="width:500px"></td>
- </tr>
- <tr>
- <th class="taC" width="150">籍贯</th>
- <td width="210"><input type="text" name="nativePlace" id="nativePlace" value="' . $detail ['nativePlace'] . '"></td>
- <th class="taC" width="150">紧急联系人</th>
- <td><input type="text" name="emergencyContacts" id="emergencyContacts" value="' . $detail ['emergencyContacts'] . '"></td>
- </tr>
- </table>
- <table class="table table-bordered table-condensed">
- <tr>
- <th class="taC" width="150">汇款人户名</th>
- <td width="210"><input type="text" name="remittanceName" id="remittanceName" value="' . $detail ['remittanceName'] . '"></td>
- <th class="taC" width="150">联行号</th>
- <td colspan="3"><input type="text" name="coupletNumber" id="coupletNumber" value="' . $detail ['coupletNumber'] . '"></td>
- </tr>
- <tr>
- <th class="taC" width="150">汇款开户银行名称</th>
- <td width="210">
- <input type="text" name="bankName" id="bankName" value="' . $detail ['bankName'] . '">
- </td>
- <th class="taC" width="150">汇款帐号</th>
- <td><input type="text" name="bankNumber" id="bankNumber" value="' . $detail ['bankNumber'] . '"></td>
- </tr>
-
- </table>
- </div>
-
-
-
- <div class="fL staff-detail-side">
- <!--入职试用 & 离职后再入职试用-->
- ';
-
- foreach ( $SOPL as $key => $value ) {
- $html .= '<div class="infoFlowList">
- <div class="dateTitle">
- <em class="month"><span class="num">' . date ( 'm', strtotime ( $value ['date'] ) ) . '</span><span class="text">-' . date ( 'd', strtotime ( $value ['date'] ) ) . '</span></em>
- <span class="year">' . date ( 'Y', strtotime ( $value ['date'] ) ) . '</span>
- </div>
- <ul class="flowList">
- <li class="item colGray">' . $value ['category'] . '-' . $value ['username'] . '</li>
- <li class="item">' . $value ['operation'] . '</li>
- </ul>
- </div>';
- }
-
- $html .= '
-
- </div>
- </div>
-
- ';
- }
-
- echo json_encode ( array (
- 'status' => 1,
- 'html' => $html
- ) );
- die ();
- } elseif ($type == 'IRTC') {
-
- Doo::loadModel ( 'invoice' );
- $invoice = new invoice ();
- Doo::loadModel ( 'invoiceOperationLog' );
- $invoiceOperationLog = new invoiceOperationLog ();
- Doo::loadModel ( 'invoiceReceivables' );
- $invoiceReceivables = new invoiceReceivables ();
-
- $detail = $invoice->getInvoiceByIsid ( $serial, $this->staff [0] ['sid'] );
- $invoiceOperationLogList = $invoiceOperationLog->getInvoiceOperationLogByIid ( $detail ['iid'] );
-
- if (empty ( $detail ))
- $html = '';
- else {
-
- $receivablesPriceedHtml = '';
- $receivablesPrice = $detail ['invoicePrice'];
- if (! empty ( $detail ['irid'] )) {
-
- $irList = $invoiceReceivables->getInvoiceReceivablesInIridString ( $detail ['irid'] );
-
- if (empty ( $irList ))
- $irList [0] ['sumPrice'] = 0;
-
- $balance = $detail ['invoicePrice'] - $irList [0] ['sumPrice'];
-
- $receivablesPriceedHtml = '<table class="table table-bordered table-condensed"><tbody><tr>
-
- <th class="taC">已入账金额</th><td><b class="colGreen" style="font-size:18px">¥' . $irList [0] ['sumPrice'] . '</b></td>
- <th class="taC">剩余入账金额</th><td><b class="colRed" style="font-size:18px">¥' . $balance . '</b></td>
-
- </tr></tbody></table>';
- $receivablesPrice = $balance;
- }
-
- if ($loss)
- $detail ['invoicePrice'] = - $detail ['invoicePrice'];
- $html = $receivablesPriceedHtml . '
- <table class="table table-bordered table-condensed"><tbody>
- <tr>
- <th class="taC" width="150">开票流水号</th><td>' . $detail ['invoiceSerial'] . '</td>
- <th class="taC" width="150">提交时间</th><td>' . $detail ['date'] . '</td>
- </tr>
- <tr>
- <th class="taC" width="150">所在办事处</th><td>' . $detail ['categoryName'] . '(' . $detail ['userName'] . ')</td>
- <th class="taC" width="150">开票内容</th><td>' . $detail ['invoiceElement'] . '</td>
- </tr>
-
- <tr>
- <th class="taC" width="150">发票备注</th><td colspan="3">' . $detail ['remark'] . '</td>
- </tr>
-
- <tr>
- <th class="taC" width="150">数量</th><td><b>' . $detail ['invoiceQuantity'] . '</b></td>
- <th class="taC">单价</th><td><b>¥' . $detail ['invoiceUnitPrice'] . '</b></td>
- </tr>
-
- <tr>
- <th class="taC">开票金额</th><td colspan="3"><b class="colOrange" style="font-size:18px">¥' . $detail ['invoicePrice'] . '</b></td>
-
- </tr></tbody></table>';
-
- if ($detail ['invoiceType'] == 0) {
- $html .= '<table class="table table-bordered table-condensed"><tbody>
- <tr><th colspan="4" class="taC">增值税普通发票</th></tr><tr>
- <th class="taC" width="150">发票抬头</th><td >' . $detail ['invoiceTitle'] . '</td>
- <th class="taC" width="150">纳税人识别码</th><td>' . $detail ['TIN'] . '</td>
- </tr>';
- $receivablesMessage = $detail ['invoiceTitle'];
- } else {
- $html .= '<table class="table table-bordered table-condensed"><tbody>
- <tr><th colspan="4" class="taC">增值税专用发票</th></tr><tr>
- <th class="taC" width="150">单位名称</th><td>' . $detail ['invoiceCompany'] . '</td>
- <th class="taC" width="150">纳税人识别码</th><td>' . $detail ['TIN'] . '</td></tr>
-
- ';
- $receivablesMessage = $detail ['invoiceCompany'];
- }
- $html .= '<tr>
- <th class="taC">注册地址</th><td>' . $detail ['address'] . '</td>
- <th class="taC">注册电话</th><td>' . $detail ['phone'] . '</td>
- </tr>
- <tr>
- <th class="taC">开户银行</th><td>' . $detail ['bankAccount'] . '</td>
- <th class="taC">银行账号</th><td>' . $detail ['bank'] . '</td>
- </tr></tbody></table>';
-
- if ($detail ['doPost'] == 1)
- $html .= '<table class="table table-bordered table-condensed"><tbody><tr><th colspan="4" class="taC">邮寄信息</th></tr><tr>
- <th class="taC" width="150">收件人</th><td>' . $detail ['recipients'] . '</td>
- <th class="taC" width="150">收件人手机/电话</th><td>' . $detail ['recipientsPhone'] . '</td>
- </tr><tr>
- <th class="taC" width="150">收件地址</th><td colspan="3">' . $detail ['recipientsAddress'] . '</td>
- </tr><tr>
- <th class="taC" width="150">邮寄物品</th><td colspan="3">' . $detail ['mailItems'] . '</td>
- </tr></tbody></table>';
- if (! empty ( $invoiceOperationLogList )) {
- $html .= '<table class="table table-bordered table-condensed"><tbody><tr><th width="60%" class="taC">审批流程</th></tr><tr><td>';
- foreach ( $invoiceOperationLogList as $key => $value ) {
- if ($value ['status'] == 1 || $value ['status'] == 2 || $value ['status'] == 3 || $value ['status'] == 4) {
- $html .= '<blockquote><p><span class="colGray">' . $value ['date'] . '</span>
- ' . $value ['category'] . '-' . $value ['username'] . ' ';
- if ($value ['status'] == 2) {
- $html .= '<span class="colGreen">同意</span>';
- } elseif ($value ['status'] == 3) {
- $html .= '<span class="colOrange">退回</span>';
- } elseif ($value ['status'] == 5) {
- $html .= '<span class="colGreen">打印</span>';
- }
- $html .= $value ['operation'] . '</p></blockquote>';
- }
- }
- $html .= '</td></tr></tbody></table>';
- }
- }
-
- echo json_encode ( array (
- 'status' => 1,
- 'html' => $html,
- 'receivablesPrice' => $receivablesPrice,
- 'receivablesMessage' => $receivablesMessage,
- 'receivablesDate' => date ( "Y-m-d" ),
- 'iidKey' => $serial
- ) );
- die ();
- }
- }
-
- /**
- * 生成工号
- */
- function createJobNumber() {
- Doo::loadModel ( 'staff' );
- $staff = new staff ();
-
- $regularStaff = $staff->getStaffJobNumberByNature ( 1 );
- $internStaff = $staff->getStaffJobNumberByNature ( 2 );
-
- 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 ();
- }
- }
- }
- ?>
|