1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751 |
- <?php
- /**
- * @author darkredz
- */
- class HumanResourceController extends DooController {
- public $data;
- public function beforeRun($resource, $action) {
- $this->data ['exempt'] = false;
-
- Doo::loadModel ( 'staff' );
- $staff = new staff ();
- $detail = $staff->getStaffBySid ( $_COOKIE ["staff"] );
-
- // 拥有豁免权限
- if ($action == 'appliedEntry' || $action == 'appliedDimission' || $action == 'appliedRegular'|| $action == 'reentryApprovals' || $detail ['sid'] == superHR) {
- return '';
- }
-
- // 全员权限判定
- $accessModular = 'HR';
- if (empty ( $detail ['cldAccessArray'] )) {
- $flag = false;
- } else {
- if (in_array ( $accessModular, $detail ['cldAccessArray'] )) {
- if (Doo::acl ()->isAllowed ( $accessModular, $resource, $action )) {
- $flag = true;
- } else {
- $flag = false;
- }
- } else {
- $flag = false;
- }
- }
-
- // 个别审批人临时访问首页权限
- if (! $flag) {
- $list = $staff->getApprovalData ( $detail ['sid'] );
- // $staff->find ( array (
- // 'asc' => 'sid',
- // 'where' => "(pendStatus= '2' or pendStatus='3' or pendStatus='5') and ( pendingApprovalsLeave='" . $detail ['sid'] . "' or pendingApprovals='" . $detail ['sid'] . "') ",
- // 'asArray' => TRUE
- // ) );
- $isVisit = count ( $list );
- if ($isVisit > 0) { // 未做强制不能访问
-
- if ($action == 'hrEmployee' || $action == 'position' || $action == 'employeeApprovals') {
- die ( 'illegal request' );
- }
-
- $this->data ['exempt'] = true;
- return '';
- } else
- die ( 'illegal request' );
- }
- }
- 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->cldAccess='["INFORMATION","DIRECTORIES","LOCK","RECEIPTS","INVOICE"]';
-
- if ($staffDetail ['nature'] == 2)
- $staff->practiceDate = date ( "Y-m-d H:i:s" );
- if ($staffDetail ['nature'] == 3)
- $staff->probationaryDate = date ( "Y-m-d H:i:s" );
-
- // 发送短信
- $passwork = mt_rand ( 100000, 999999 );
- $staff->passwork = md5 ( $passwork );
-
- if (! empty ( $staffDetail ['telephone'] ) && is_numeric ( $staffDetail ['telephone'] )) {
- Doo::loadClass ( 'Human.func' );
- $msg = $staffDetail ['username'] . ',' . $passwork;
- send_sms ( 17280, $staffDetail ['telephone'], '{"%msg%":"' . $msg . '"}' );
- }
-
- // 操作日志
- Doo::loadModel ( 'staffOperationLog' );
- $staffOperationLog = new staffOperationLog ();
- $nature = '';
- if ($staffDetail ['nature'] == 2) {
- $nature = '实习';
- } elseif ($staffDetail ['nature'] == 3) {
- $nature = '试用';
- }
-
- $item = array (
- 'date' => date ( "Y-m-d H:i:s" ),
- 'operation' => "员工 入职审批通过",
- 'status' => 3,
- 'img' => $this->staff ['avatar'],
- 'username' => $this->staff ['username'],
- 'uid' => $staffDetail ['sid'],
- 'category' => $this->staff ['category'],
- 'sid' => $this->staff ['sid']
- );
-
- $staffOperationLog->setInvoiceOperationLog ( $item );
-
- // 发送微信抄送
- $msg = '[抄送]' . $staffDetail ['category'] . '-' . $staffDetail ['username'] . '申请入职成功\n入职时间:' . $staffDetail ['hiredate'];
-
- $cidmode = $staffDetail ['cid'];
- if (! empty ( $staffDetail ['departmentID'] ))
- $cidmode = $staffDetail ['cid'] . '-' . $staffDetail ['departmentID'];
- $InductionCC = $staffManage->getStaffManageByCid ( $cidmode );
- $InductionCC = json_decode ( $InductionCC ['CC'], true );
-
- foreach ( $InductionCC as $value ) {
- $this->setWXMsg ( $value [0], $msg );
- }
- }
-
- $staff->updateDate = date ( "Y-m-d H:i:s" );
- $staff->update ( array (
- 'where' => 'sid=' . $sid
- ) );
-
- // 权限跳转
- $staff = new staff ();
- $CAAdetail = $staff->getStaffBySid ( $_COOKIE ["staff"] );
- $accessModular = 'HR';
- if (in_array ( $accessModular, $CAAdetail ['cldAccessArray'] )) {
- return '/hr';
- } else {
- $list = $staff->getApprovalData ( $CAAdetail ['sid'] );
-
- $isVisit = count ( $list );
- if ($isVisit > 0) { // 未做强制不能访问
- return '/hr';
- } else {
- header ( 'Content-Type:text/html;charset=utf-8' );
- echo "审批成功 <a href='/'>点击跳转首页</a>";
- die ();
- }
- }
- }
-
- /**
- * 员工再入职审批
- */
- function employeeReentryApprovals() {
- Doo::loadModel ( 'staff' );
- $staff = new staff ();
- Doo::loadClass ( 'XDeode' );
- $XDeode = new XDeode ( 5 );
- Doo::loadModel ( 'reentryManage' );
- $staffManage = new reentryManage ();
-
- $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=7 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 )) {
- // 确认再入职
- // Doo::loadClass ( 'XDeode' );
- // $XDeode = new XDeode ( 5 );
- // Doo::loadModel ( 'staff' );
- // $staff = new staff ();
-
- // $sid = $XDeode->decode ( $sidKey );
-
- // $detail = $staff->getStaffBySid ( $sid );
-
- $staffDetail;
- $staff2 = new staff ();
-
- // 工龄记录
- $seniorityFormula = json_decode ( $staffDetail ['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" ) ,
- 'cldAccess'=>'["INFORMATION","DIRECTORIES","LOCK","RECEIPTS","INVOICE"]',
- );
- $staff2->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] );
-
- // 发送短信
- $passwork = mt_rand ( 100000, 999999 );
- $staff->passwork = md5 ( $passwork );
-
- if (! empty ( $staffDetail ['telephone'] ) && is_numeric ( $staffDetail ['telephone'] )) {
- Doo::loadClass ( 'Human.func' );
- $msg = $staffDetail ['username'] . ',' . $passwork;
- send_sms ( 17280, $staffDetail ['telephone'], '{"%msg%":"' . $msg . '"}' );
- }
-
- // 操作日志
- Doo::loadModel ( 'staffOperationLog' );
- $staffOperationLog = new staffOperationLog ();
-
- $item = array (
- 'date' => date ( "Y-m-d H:i:s" ),
- 'operation' => "员工 再入职审批通过",
- 'status' => 3,
- 'img' => $this->staff ['avatar'],
- 'username' => $this->staff ['username'],
- 'uid' => $staffDetail ['sid'],
- 'category' => $this->staff ['category'],
- 'sid' => $this->staff ['sid']
- );
- $staffOperationLog->setInvoiceOperationLog ( $item );
-
- // 发送微信抄送
- $msg = '[抄送]' . $staffDetail ['category'] . '-' . $staffDetail ['username'] . '申请 再入职成功\n入职时间:' . date ( "Y-m-d" );
-
- $cidmode = $staffDetail ['cid'];
- if (! empty ( $staffDetail ['departmentID'] ))
- $cidmode = $staffDetail ['cid'] . '-' . $staffDetail ['departmentID'];
- $InductionCC = $staffManage->getStaffManageByCid ( $cidmode );
- $InductionCC = json_decode ( $InductionCC ['CC'], true );
-
- foreach ( $InductionCC as $value ) {
- $this->setWXMsg ( $value [0], $msg );
- }
- }
-
- $staff->updateDate = date ( "Y-m-d H:i:s" );
- $staff->update ( array (
- 'where' => 'sid=' . $sid
- ) );
-
- // 权限跳转
- $staff = new staff ();
- $CAAdetail = $staff->getStaffBySid ( $_COOKIE ["staff"] );
- $accessModular = 'HR';
- if (in_array ( $accessModular, $CAAdetail ['cldAccessArray'] )) {
- return '/hr';
- } else {
- $list = $staff->getApprovalData ( $CAAdetail ['sid'] );
-
- $isVisit = count ( $list );
- if ($isVisit > 0) { // 未做强制不能访问
- return '/hr';
- } else {
- header ( 'Content-Type:text/html;charset=utf-8' );
- echo "审批成功 <a href='/'>点击跳转首页</a>";
- die ();
- }
- }
- }
-
- /**
- * 离职人员审批
- */
- 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->nature=4;//离职后需要在人员页面确认离职不用在这改状态
- // $staff->dimissionDate = date ( "Y-m-d" );
- $staff->pendingApprovalsLeave = 0;
-
- // 操作日志
- Doo::loadModel ( 'staffOperationLog' );
- $staffOperationLog = new staffOperationLog ();
- $item = array (
- 'date' => date ( "Y-m-d H:i:s" ),
- 'operation' => "员工 离职审批通过",
- 'status' => 2,
- 'img' => $this->staff ['avatar'],
- 'username' => $this->staff ['username'],
- 'uid' => $staffDetail ['sid'],
- 'category' => $this->staff ['category'],
- 'sid' => $this->staff ['sid']
- );
- $staffOperationLog->setInvoiceOperationLog ( $item );
- }
-
- $staff->updateDate = date ( "Y-m-d H:i:s" );
- $staff->update ( array (
- 'where' => 'sid=' . $sid
- ) );
-
- // 权限跳转
- $staff = new staff ();
- $CAAdetail = $staff->getStaffBySid ( $_COOKIE ["staff"] );
- $accessModular = 'HR';
- if (in_array ( $accessModular, $CAAdetail ['cldAccessArray'] )) {
- return '/hr';
- } else {
- $list = $staff->getApprovalData ( $CAAdetail ['sid'] );
-
- $isVisit = count ( $list );
- if ($isVisit > 0) { // 未做强制不能访问
- return '/hr';
- } else {
- header ( 'Content-Type:text/html;charset=utf-8' );
- echo "审批成功 <a href='/'>点击跳转首页</a>";
- die ();
- }
- }
- }
-
- /**
- * 转正审批
- */
- function employeeRegularApprovals() {
- Doo::loadModel ( 'staff' );
- $staff = new staff ();
- Doo::loadClass ( 'XDeode' );
- $XDeode = new XDeode ( 5 );
- Doo::loadModel ( 'staffRegularManage' );
- $staffLeaveManage = new staffRegularManage ();
-
- $sidKey = $this->get_args ( 'sidKey' ) ? $this->get_args ( 'sidKey' ) : "";
- $sid = $XDeode->decode ( $sidKey );
- if (! is_numeric ( $sid ) || empty ( $sid ))
- die ( 'illegal request' );
-
- $staffDetail = $staff->getOne ( array (
- 'where' => 'pendStatus=5 and sid=' . $sid . ' and pendingApprovalsLeave=' . $this->staff ['sid'],
- 'asArray' => true
- ) );
-
- if (empty ( $staffDetail ))
- die ( 'illegal request' );
-
- $processApprovals = json_decode ( $staffDetail ['processApprovalsLeave'], true );
- $invoiceManage = json_decode ( $staffDetail ['staffManageLeave'], true );
-
- $staff = new staff ();
- if (empty ( $processApprovals )) {
- $processApprovals = array (
- $this->staff ['sid'] => array (
- 'date' => date ( "Y-m-d H:i:s" )
- )
- );
- $nextInvoiceManage = next ( $invoiceManage );
-
- if ($nextInvoiceManage !== false)
- $staff->pendingApprovalsLeave = $nextInvoiceManage [0];
- $staff->processApprovalsLeave = json_encode ( $processApprovals );
- } else {
- $processApprovals [$this->staff ['sid']] = array (
- 'date' => date ( "Y-m-d H:i:s" )
- );
-
- $pendingApprovals = 0;
- foreach ( $invoiceManage as $key => $value ) {
- if ($value [0] == $this->staff ['sid']) {
- if (isset ( $invoiceManage [$key + 1] ))
- $pendingApprovals = $invoiceManage [$key + 1] [0];
- break;
- }
- }
-
- if (! empty ( $pendingApprovals ))
- $staff->pendingApprovalsLeave = $pendingApprovals;
- $staff->processApprovalsLeave = json_encode ( $processApprovals );
- }
-
- if (count ( $processApprovals ) == count ( $invoiceManage )) {
- $staff->pendStatus = 0;
- $staff->nature = 1;
- // 工号
- // 生成工号
- $jobNumber = $this->createJobNumber ();
- $staff->jobNumber = $jobNumber ['regularStaff'];
- // $staff->dimissionDate = date ( "Y-m-d" );
- $staff->pendingApprovalsLeave = 0;
-
- // 操作日志
- Doo::loadModel ( 'staffOperationLog' );
- $staffOperationLog = new staffOperationLog ();
- $item = array (
- 'date' => date ( "Y-m-d H:i:s" ),
- 'operation' => "员工 转正审批通过",
- 'status' => 2,
-
- 'img' => $this->staff ['avatar'],
- 'username' => $this->staff ['username'],
- 'uid' => $staffDetail ['sid'],
- 'category' => $this->staff ['category'],
- 'sid' => $this->staff ['sid']
- );
- $staffOperationLog->setInvoiceOperationLog ( $item );
- }
-
- $staff->updateDate = date ( "Y-m-d H:i:s" );
- $staff->update ( array (
- 'where' => 'sid=' . $sid
- ) );
-
- // 权限跳转
- $staff = new staff ();
- $CAAdetail = $staff->getStaffBySid ( $_COOKIE ["staff"] );
- $accessModular = 'HR';
- if (in_array ( $accessModular, $CAAdetail ['cldAccessArray'] )) {
- return '/hr';
- } else {
- $list = $staff->getApprovalData ( $CAAdetail ['sid'] );
-
- $isVisit = count ( $list );
- if ($isVisit > 0) { // 未做强制不能访问
- return '/hr';
- } else {
- header ( 'Content-Type:text/html;charset=utf-8' );
- echo "审批成功 <a href='/'>点击跳转首页</a>";
- die ();
- }
- }
- }
-
- /**
- * 员工晋升审批
- */
- function employeePromoteApprovals() {
- 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=6 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 );
- }
-
- $appliedPromote = $staffDetail ['appliedPromote'];
- $appliedPromote = explode ( '_', $appliedPromote );
- if (count ( $processApprovals ) == count ( $invoiceManage )) {
- $staff->pendStatus = 0;
- $staff->pendingApprovalsLeave = 0;
- // 岗位薪资调整
-
- $appliedPromote [4];
-
- $staff->baseWage = $appliedPromote [2];
- $staff->postWage = $appliedPromote [3];
- $staff->achievementBonus = $appliedPromote [4];
- $staff->positionId = $XDeode->decode ( $appliedPromote [0] );
-
- // 发送微信抄送
-
- $msg = '[抄送]' . $staffDetail ['category'] . '-' . $staffDetail ['username'] . '申请晋升成功\n晋升时间:' . date ( "Y-m-d" );
-
- $cidmode = $staffDetail ['cid'];
- if (! empty ( $staffDetail ['departmentID'] ))
- $cidmode = $staffDetail ['cid'] . '-' . $staffDetail ['departmentID'];
- $InductionCC = $staffManage->getStaffManageByCid ( $cidmode );
- $InductionCC = json_decode ( $InductionCC ['CC'], true );
-
- foreach ( $InductionCC as $value ) {
- $this->setWXMsg ( $value [0], $msg );
- }
-
- // 操作日志
- Doo::loadModel ( 'staffOperationLog' );
- $staffOperationLog = new staffOperationLog ();
- $nature = $appliedPromote [1];
-
- $item = array (
- 'date' => date ( "Y-m-d H:i:s" ),
- 'operation' => "员工 晋升审批通过",
- 'status' => 3,
-
- 'img' => $this->staff ['avatar'],
- 'username' => $this->staff ['username'],
- 'uid' => $staffDetail ['sid'],
- 'category' => $this->staff ['category'],
- 'sid' => $this->staff ['sid']
- );
-
- $staffOperationLog->setInvoiceOperationLog ( $item );
- }
-
- $staff->updateDate = date ( "Y-m-d H:i:s" );
- $staff->update ( array (
- 'where' => 'sid=' . $sid
- ) );
-
- // 权限跳转
- $staff = new staff ();
- $CAAdetail = $staff->getStaffBySid ( $_COOKIE ["staff"] );
- $accessModular = 'HR';
- if (in_array ( $accessModular, $CAAdetail ['cldAccessArray'] )) {
- return '/hr';
- } else {
- $list = $staff->getApprovalData ( $CAAdetail ['sid'] );
-
- $isVisit = count ( $list );
- if ($isVisit > 0) { // 未做强制不能访问
- return '/hr';
- } else {
- header ( 'Content-Type:text/html;charset=utf-8' );
- echo "审批成功 <a href='/'>点击跳转首页</a>";
- die ();
- }
- }
- }
-
- /**
- * 员工信息
- */
- function hrEmployee() {
-
- // $passwork=mt_rand(100000, 999999);
- // //$staff->passwork = md5 ( $passwork );
- // $staffDetail['telephone']='13750039378';
- // $staffDetail['username']='欧桃珍';
-
- // if (!empty($staffDetail['telephone'])&&is_numeric($staffDetail['telephone'])){
- // Doo::loadClass ( 'Human.func' );
- // $msg=$staffDetail['username'].','.$passwork;
- // send_sms(17280,$staffDetail['telephone'],'{"%msg%":"'.$msg.'"}');
- // }
- $pendStatus = $this->get_args ( 'pendStatus' ) ? $this->get_args ( 'pendStatus' ) : "ALL";
- $nature = $this->get_args ( 'nature' ) ? $this->get_args ( 'nature' ) : 'ALL';
- $cid_did = $this->get_args ( 'cid_did' ) ? $this->get_args ( 'cid_did' ) : 'ALL';
- $MebSea = $this->get_args ( 'MebSea' ) ? $this->get_args ( 'MebSea' ) : '';
- // $this->send_sms();
- Doo::loadClass ( 'XDeode' );
- $XDeode = new XDeode ( 5 );
-
- $con = ' username != "admin" ';
- if ($pendStatus == 'ALL')
- $con .= ' ';
- elseif ($pendStatus == 'OTJOB')
- $con .= ' and pendStatus=0 ';
- elseif ($pendStatus == 'LVJOB')
- $con .= ' and pendStatus=4 ';
-
- if ($nature == 'ALL')
- $con .= ' and (nature=1 or nature=2 or nature=3 or nature=4) ';
- elseif ($nature == 'FORMAL')
- $con .= ' and nature=1';
- elseif ($nature == 'TRIAL')
- $con .= ' and nature=3';
- elseif ($nature == 'PRACTICE')
- $con .= ' and nature=2';
-
- if ($cid_did != 'ALL') {
- $department = explode ( '_', $cid_did );
- $cid = $XDeode->decode ( $department [0] );
- $departmentID = false;
- if (! empty ( $department [1] )) {
- $departmentID = $XDeode->decode ( $department [1] );
- }
- if (is_numeric ( $cid ) && is_numeric ( $departmentID ))
- $con .= ' and cid=' . $cid . ' and departmentID=' . $departmentID;
- elseif (is_numeric ( $cid ) && ! is_numeric ( $departmentID ))
- $con .= ' and cid=' . $cid;
- }
-
- if (! empty ( $MebSea ))
- $con .= ' and ( username like "%' . $MebSea . '%" or jobNumber like "%' . $MebSea . '%" )';
- // echo $con;
- Doo::loadModel ( 'staff' );
- $staff = new staff ();
- Doo::loadModel ( 'L_category' );
- $L_category = new L_category ();
- Doo::loadModel ( 'position' );
- $position = new position ();
-
- $stafflist = $staff->getStaffByCondition ( $con );
-
- // print_r($stafflist);
-
- /*
- * foreach ($stafflist as $key=>$value){ $staff = new staff (); $staff->sid=$value['sid']; $seniorityFormula = array (); array_push ( $seniorityFormula, array ( 'InductionDate' =>$value['hiredate'] , 'dimissionDate' => '' ) ); if (empty($value['seniorityFormula'])){ $staff->seniorityFormula = json_encode ( $seniorityFormula ); //$staff->update(); } }
- */
- $monthstart = date ( 'Y-m-d 00:00:00', mktime ( 0, 0, 0, date ( 'm' ), 1, date ( 'Y' ) ) );
- $monthend = date ( 'Y-m-d 23:59:59', mktime ( 0, 0, 0, date ( 'm' ) + 1, 0, date ( 'Y' ) ) );
-
- // 本月在职 入职 离职人员数量
- $onJobCount = $staff->count ( array (
- 'where' => 'pendStatus=0 and username!="admin"'
- ) );
- $inJobCount = $staff->count ( array (
- 'where' => 'pendStatus=0 and username!="admin" and (InductionDate>="' . $monthstart . '" and InductionDate<="' . $monthend . '" )'
- ) );
- $leaveJobCount = $staff->count ( array (
- 'where' => 'pendStatus=4 and username!="admin" and (dimissionDate>="' . $monthstart . '" and dimissionDate<="' . $monthend . '" )'
- ) );
-
- // 生成工号
- $jobNumber = $this->createJobNumber ();
- // 获得办事和部门
- $categoryList = $L_category->getCategoryDepartment ();
- // 获得岗位
- $listPosition = $position->getPositionByAll ();
-
- $monthstart = date ( 'm.d', mktime ( 0, 0, 0, date ( 'm' ), 1, date ( 'Y' ) ) );
- $monthend = date ( 'm.d', mktime ( 0, 0, 0, date ( 'm' ) + 1, 0, date ( 'Y' ) ) );
-
- $this->data ['listPosition'] = $listPosition;
- $this->data ['onJobCount'] = $onJobCount;
- $this->data ['inJobCount'] = $inJobCount;
- $this->data ['leaveJobCount'] = $leaveJobCount;
-
- $this->data ['monthstart'] = $monthstart;
- $this->data ['monthend'] = $monthend;
-
- $this->data ['pendStatus'] = $pendStatus;
- $this->data ['nature'] = $nature;
- $this->data ['MebSea'] = $MebSea;
- $this->data ['cid_did'] = $cid_did;
- // print_r($stafflist[43]);
- $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 )) {
-
- Doo::loadClass ( 'XDeode' );
- $XDeode = new XDeode ( 5 );
- Doo::loadModel ( 'staff' );
- $staff = new staff ();
- Doo::loadModel ( 'L_category' );
- $L_category = new L_category ();
- Doo::loadModel ( 'tag' );
- Doo::loadModel ( 'holidaystaff' );
- Doo::loadModel ( 'staffManage' );
- $staffManage = new staffManage ();
-
- // 用户名检测
- $detailStaff = $staff->getStaffByName ( $username );
- // print_r($detailStaff);
- if (! empty ( $detailStaff ))
- die ( 'illegal request3' );
-
- $staff->username = $username;
- $staff->hiredate = $hiredate;
- $staff->nature = $nature;
-
- $position = explode ( '_', $position );
-
- $staff->position = $position [1];
- $staff->positionId = $XDeode->decode ( $position [0] );
-
- $department = explode ( '_', $cid_did );
-
- $cid = $XDeode->decode ( $department [0] );
- // 加入默认总部分类
- if (! is_numeric ( $cid ))
- die ( 'illegal request1' );
- $cagegory = $L_category->getCategoryById ( $cid );
- // 部门
- if (! empty ( $department [1] )) {
- $did = $XDeode->decode ( $department [1] );
- if (! is_numeric ( $did ))
- die ( 'illegal request' );
- $staff->departmentID = $did;
- }
-
- // 生成工号
- $jobNumber = $this->createJobNumber ();
- if ($nature == 1)
- $staff->jobNumber = $jobNumber ['regularStaff'];
- else {
- $staff->jobNumber = $jobNumber ['internStaff'];
- $staff->pendStatus = 1;
- }
-
- $staff->cid = $cagegory [0] ['cid'];
- $staff->category = $cagegory [0] ['title'];
-
- $staff->telephone = $telephone;
- $staff->baseWage = $baseWage;
- $staff->postWage = $postWage;
- $staff->achievementBonus = $achievementBonus;
- $staff->gender = $gender;
- // 审批组
- // 获得该办事处的审批组
- $approvalKey = explode ( '_', $cid_did );
- $cidMode = array ();
- foreach ( $approvalKey as $value ) {
- if (! empty ( $value )) {
- $cid = $XDeode->decode ( $value );
- array_push ( $cidMode, $cid );
- }
- }
- $cidMode = implode ( '_', $cidMode );
- $staffManageDetail = $staffManage->getStaffManageByCid ( $cidMode );
- if (empty ( $staffManageDetail ))
- die ( 'illegal request2' );
-
- $pendingApprovalsSid = current ( $staffManageDetail ['staffList'] ) [0];
- $staff->pendingApprovals = $pendingApprovalsSid;
- $staff->staffManage = $staffManageDetail ['staff'];
-
- // 抄送组
- $staff->processCC = $staffManageDetail ['CC'];
- // 工龄记录
- $seniorityFormula = array ();
- array_push ( $seniorityFormula, array (
- 'InductionDate' => $hiredate,
- 'dimissionDate' => ''
- ) );
- $staff->seniorityFormula = json_encode ( $seniorityFormula );
-
- $id = $staff->insert ();
-
- // 更新假期相关信息
- Doo::loadModel ( 'holidaystaff' );
- $holidaystaff = new HStaff ();
- $holidaystaff->uid = $id;
- $holidaystaff->insert ();
- $staff = new staff ();
-
- $staffmsg = $staff->getUserById ( $id );
- $this->updateAnnualLeave ( $staffmsg [0] );
-
- // 标签更新
- for($i = 1; $i <= 7; $i ++) {
- $tag = new tag ();
- $tag->name = "个人标签";
- $tag->sid = $id;
- $tag->colorid = $i;
- $tag->insert ();
- }
-
- // 操作日志
- Doo::loadModel ( 'staffOperationLog' );
- $staffOperationLog = new staffOperationLog ();
- $item = array (
- 'date' => date ( "Y-m-d H:i:s" ),
- 'status' => 1,
- 'img' => '/global/img/avtra',
- 'username' => $this->staff ['username'],
- 'uid' => $id,
- 'sid' => $this->staff ['sid'],
- 'operation' => "添加新员工",
- 'category' => $this->staff ['category']
- );
- $staffOperationLog->setInvoiceOperationLog ( $item );
-
- if (! empty ( $telephone ) && is_numeric ( $telephone )) {
- Doo::loadClass ( 'Human.func' );
- send_sms ( 17279, $telephone, '{"%name%":"' . $username . '"}' );
- }
- }
- return '/hrEmployee';
- }
-
- /**
- * 员工转职
- */
- function staffTransfer() {
- $sidKey = $this->get_args ( 'sidKey' ) ? $this->get_args ( 'sidKey' ) : "";
- $nature = $this->get_args ( 'nature' ) ? $this->get_args ( 'nature' ) : '';
-
- if (! empty ( $sidKey ) && ! empty ( $nature )) {
- Doo::loadClass ( 'XDeode' );
- $XDeode = new XDeode ( 5 );
- Doo::loadModel ( 'staff' );
- $staff = new staff ();
-
- $sid = $XDeode->decode ( $sidKey );
- $staffDetail = $staff->getStaffBySid ( $sid );
-
- $item = array (
- 'sid' => $sid
- );
- if ($nature == 'TRIAL')
- $item += array (
- // 试用
- 'nature' => 3,
- 'probationaryDate' => date ( "Y-m-d H:i:s" )
- );
- if ($nature == 'REGULARS') {
- // 生成工号
- $jobNumber = $this->createJobNumber ();
- $item += array (
- // 正式
- 'nature' => 1,
- 'jobNumber' => $jobNumber ['regularStaff'],
- 'regularsDate' => date ( "Y-m-d H:i:s" )
- );
-
- // 发送微信抄送
- Doo::loadModel ( 'staffRegularManage' );
- $staffLeaveManage = new staffRegularManage ();
- $msg = '[抄送]' . $staffDetail ['category'] . '-' . $staffDetail ['username'] . '申请转正成功\n转正时间:' . date ( "Y-m-d" );
-
- $cidmode = $staffDetail ['cid'];
- if (! empty ( $staffDetail ['departmentID'] ))
- $cidmode = $staffDetail ['cid'] . '-' . $staffDetail ['departmentID'];
- $InductionCC = $staffLeaveManage->getStaffManageByCid ( $cidmode );
- $InductionCC = json_decode ( $InductionCC ['CC'], true );
-
- foreach ( $InductionCC as $value ) {
- $this->setWXMsg ( $value [0], $msg );
- }
- }
- $staff->setStaffByCondition ( $item );
-
- // 操作日志
- Doo::loadModel ( 'staffOperationLog' );
- $staffOperationLog = new staffOperationLog ();
- $item = array (
- 'date' => date ( "Y-m-d H:i:s" ),
- 'status' => 1,
- 'img' => $this->staff ['avatar'],
- 'username' => $this->staff ['username'],
- 'uid' => $staffDetail ['sid'],
- 'category' => $this->staff ['category'],
- 'sid' => $this->staff ['sid']
- );
- if ($nature == 'TRIAL')
- $item += array (
- // 试用
- 'operation' => "员工 实习转试用"
- );
- if ($nature == 'REGULARS')
- $item += array (
- // 正式
- 'operation' => "员工 试用转正式"
- );
- $staffOperationLog->setInvoiceOperationLog ( $item );
-
- return '/hrEmployee';
- }
- die ( 'illegal request' );
- }
-
- /**
- * 申请入职
- */
- function appliedEntry() {
- $sidKey = $this->get_args ( 'sidKey' ) ? $this->get_args ( 'sidKey' ) : "";
- $telephone = $this->get_args ( 'telephone' ) ? $this->get_args ( 'telephone' ) : '';
- $qq = $this->get_args ( 'qq' ) ? $this->get_args ( 'qq' ) : '';
-
- $wecat = $this->get_args ( 'wecat' ) ? $this->get_args ( 'wecat' ) : '';
- $email = $this->get_args ( 'email' ) ? $this->get_args ( 'email' ) : '';
-
- $phone = $this->get_args ( 'phone' ) ? $this->get_args ( 'phone' ) : '';
- $gender = $this->get_args ( 'gender' ) ? $this->get_args ( 'gender' ) : '';
-
- $birthday = $this->get_args ( 'birthday' ) ? $this->get_args ( 'birthday' ) : '';
- $qualifications = $this->get_args ( 'qualifications' ) ? $this->get_args ( 'qualifications' ) : '';
- $marriage = $this->get_args ( 'marriage' ) ? $this->get_args ( 'marriage' ) : '0';
- $nativePlace = $this->get_args ( 'nativePlace' ) ? $this->get_args ( 'nativePlace' ) : '';
-
- $emergencyContacts = $this->get_args ( 'emergencyContacts' ) ? $this->get_args ( 'emergencyContacts' ) : '';
- $living = $this->get_args ( 'living' ) ? $this->get_args ( 'living' ) : '';
-
- $nation = $this->get_args ( 'nation' ) ? $this->get_args ( 'nation' ) : '';
- $graduateInstitutions = $this->get_args ( 'graduateInstitutions' ) ? $this->get_args ( 'graduateInstitutions' ) : '';
- $major = $this->get_args ( 'major' ) ? $this->get_args ( 'major' ) : '';
- $education = $this->get_args ( 'education' ) ? $this->get_args ( 'education' ) : '';
- $graduationTime = $this->get_args ( 'graduationTime' ) ? $this->get_args ( 'graduationTime' ) : '';
- $registeredResidence = $this->get_args ( 'registeredResidence' ) ? $this->get_args ( 'registeredResidence' ) : '';
- $householdRegistrationType = $this->get_args ( 'householdRegistrationType' ) ? $this->get_args ( 'householdRegistrationType' ) : '';
- $IDcardsValidity = $this->get_args ( 'IDcardsValidity' ) ? $this->get_args ( 'IDcardsValidity' ) : '';
- $IDcards = $this->get_args ( 'IDcards' ) ? $this->get_args ( 'IDcards' ) : '';
-
- // && ! empty ( $wecat ) && ! empty ( $email )
- if (! empty ( $sidKey ) && ! empty ( $telephone ) && ! empty ( $qq ) && ! empty ( $phone ) && ! empty ( $gender ) && ! empty ( $birthday ) && ! empty ( $qualifications ) && ! empty ( $nativePlace ) && ! empty ( $emergencyContacts ) && ! empty ( $living )) {
- Doo::loadClass ( 'XDeode' );
- $XDeode = new XDeode ( 5 );
- Doo::loadModel ( 'staff' );
- $staff = new staff ();
-
- $sid = $XDeode->decode ( $sidKey );
-
- $item = array (
- 'sid' => $sid,
- 'qq' => $qq,
- 'wecat' => $wecat,
- 'phone' => $phone,
- 'email' => $email,
-
- 'gender' => $gender,
- 'birthday' => $birthday,
- 'qualifications' => $qualifications,
- 'marriage' => $marriage,
-
- 'nativePlace' => $nativePlace,
- 'emergencyContacts' => $emergencyContacts,
- 'living' => $living,
-
- 'nation' => $nation,
- 'graduateInstitutions' => $graduateInstitutions,
- 'major' => $major,
- 'education' => $education,
- 'graduationTime' => $graduationTime,
- 'registeredResidence' => $registeredResidence,
- 'householdRegistrationType' => $householdRegistrationType,
- 'IDcardsValidity' => $IDcardsValidity,
- 'IDcards' => $IDcards,
-
- // 状态改成入职申请
- 'pendStatus' => 2
- );
- $staff->setStaffByCondition ( $item );
- // 操作日志
- $staffDetail = $staff->getStaffBySid ( $sid );
- Doo::loadModel ( 'staffOperationLog' );
- $staffOperationLog = new staffOperationLog ();
- $item = array (
- 'date' => date ( "Y-m-d H:i:s" ),
- 'status' => 2,
-
- 'operation' => "申请入职",
-
- 'img' => $staffDetail ['avatar'],
- 'username' => $staffDetail ['username'],
- 'uid' => $staffDetail ['sid'],
- 'category' => $staffDetail ['category'],
- 'sid' => $staffDetail ['sid']
- );
- $staffOperationLog->setInvoiceOperationLog ( $item );
-
- return '/login';
- }
- die ( 'illegal request' );
- }
-
- /**
- * 申请离职
- */
- function appliedDimission() {
- $dimissionReason = $this->get_args ( 'dimissionReason' ) ? $this->get_args ( 'dimissionReason' ) : '';
- $applyLeaveDate = $this->get_args ( 'applyLeaveDate' ) ? $this->get_args ( 'applyLeaveDate' ) : '';
-
-
- if (empty ( $dimissionReason )||empty($applyLeaveDate))
- die ( 'illegal request' );
- Doo::loadModel ( 'staff' );
- $staff = new staff ();
- Doo::loadModel ( 'staffLeaveManage' );
- $staffLeaveManage = new staffLeaveManage ();
-
- $item = array (
- 'sid' => $this->staff ['sid'],
- 'dimissionReason' => $dimissionReason,
- // 状态改成离职申请
- 'pendStatus' => 3
- );
- $staff->setStaffByCondition ( $item );
-
- // 离职审批组
- // 获得审批组KEY
- $staff = new staff ();
- $cidMode = $this->staff ['cid'];
- if (! empty ( $this->staff ['departmentID'] ))
- $cidMode = $this->staff ['cid'] . '_' . $this->staff ['departmentID'];
-
- $staffManageDetail = $staffLeaveManage->getStaffManageByCid ( $cidMode );
- if (empty ( $staffManageDetail ))
- die ( 'illegal request ' );
-
- $pendingApprovalsSid = current ( $staffManageDetail ['staffList'] ) [0];
- if (empty ( $pendingApprovalsSid ))
- die ( 'illegal request ' );
- $staff->pendingApprovalsLeave = $pendingApprovalsSid;
- $staff->staffManageLeave = $staffManageDetail ['staff'];
- $staff->processApprovalsLeave = '';
- $staff->sid = $this->staff ['sid'];
- $staff->applyLeaveDate=$applyLeaveDate;
- // 抄送组
- $staff->processLeaveCC = $staffManageDetail ['CC'];
- $staff->update ();
-
- // 操作日志
- Doo::loadModel ( 'staffOperationLog' );
- $staffOperationLog = new staffOperationLog ();
- $item = array (
- 'date' => date ( "Y-m-d H:i:s" ),
- 'status' => 3,
- 'img' => $this->staff ['avatar'],
- 'username' => $this->staff ['username'],
- 'operation' => "申请离职",
- 'uid' => $this->staff ['sid'],
- 'category' => $this->staff ['category'],
-
- 'sid' => $this->staff ['sid']
- );
- $staffOperationLog->setInvoiceOperationLog ( $item );
-
- return '/settingEmployeeInfo';
- }
-
- /**
- * 确认离职
- */
- function employeeDismiss() {
-
- //include Doo::conf ()->BASE_PATH . 'diagnostic/debug.php';
- $sidKey = $this->get_args ( 'sidKey' ) ? $this->get_args ( 'sidKey' ) : "";
- $applyLeaveDate = $this->get_args ( 'applyLeaveDate' ) ? $this->get_args ( 'applyLeaveDate' ) : "";
-
-
- if (! empty ( $sidKey )&&!empty($applyLeaveDate)) {
-
- Doo::loadClass ( 'XDeode' );
- $XDeode = new XDeode ( 5 );
- Doo::loadModel ( 'staff' );
- $staff = new staff ();
-
- $sid = $XDeode->decode ( $sidKey );
-
- $detail = $staff->getStaffBySid ( $sid );
- if (empty ( $detail ))
- die ( 'illegal request' );
-
- // 工龄记录
- $seniorityFormula = json_decode ( $detail ['seniorityFormula'], true );
- $arr = array_keys ( $seniorityFormula );
- $key = end ( $arr );
-
- if (isset ( $seniorityFormula [$key] ['dimissionDate'] ) || empty ( $seniorityFormula [$key] ['dimissionDate'] ))
- $seniorityFormula [$key] ['dimissionDate'] = $applyLeaveDate;//date ( "Y-m-d" );
- else
- die ( 'illegal request' );
-
- // $staff->seniorityFormula = json_encode ( $seniorityFormula );
- // 计算工龄天数
- // echo $staff->seniorityFormula;
- $day = $this->getSeniority ( $seniorityFormula );
- $dimissionDate = $applyLeaveDate;//date ( "Y-m-d " );
- $item = array (
- 'sid' => $sid,
- 'nature' => 4,
- 'pendStatus' => 4,
- 'seniorityFormula' => json_encode ( $seniorityFormula ),
- 'hireBiasDate' => $day,
- 'applyLeaveDate'=>$dimissionDate,
- 'dimissionDate' => $dimissionDate
- );
- $staff->setStaffByCondition ( $item );
-
- // 发送微信抄送
- Doo::loadModel ( 'staffLeaveManage' );
- $staffLeaveManage = new staffLeaveManage ();
- $msg = '[抄送]' . $detail ['category'] . '-' . $detail ['username'] . '申请离职成功\n离职时间:' . $dimissionDate;
-
- $cidmode = $detail ['cid'];
- if (! empty ( $detail ['departmentID'] ))
- $cidmode = $detail ['cid'] . '-' . $detail ['departmentID'];
- $InductionCC = $staffLeaveManage->getStaffManageByCid ( $cidmode );
- $InductionCC = json_decode ( $InductionCC ['CC'], true );
-
- foreach ( $InductionCC as $value ) {
- $this->setWXMsg ( $value [0], $msg );
- }
-
- return '/hrEmployee';
- }
- die ( 'illegal request' );
- }
-
- /**
- * 申请转正
- */
- function appliedRegular() {
- Doo::loadModel ( 'staff' );
- $staff = new staff ();
- Doo::loadModel ( 'staffRegularManage' );
- $staffLeaveManage = new staffRegularManage ();
-
- $item = array (
- 'sid' => $this->staff ['sid'],
- // 状态改成离职申请
- 'pendStatus' => 5
- );
- $staff->setStaffByCondition ( $item );
-
- // 离职审批组
- // 获得审批组KEY
- $staff = new staff ();
- $cidMode = $this->staff ['cid'];
- if (! empty ( $this->staff ['departmentID'] ))
- $cidMode = $this->staff ['cid'] . '_' . $this->staff ['departmentID'];
-
- $staffManageDetail = $staffLeaveManage->getStaffManageByCid ( $cidMode );
- if (empty ( $staffManageDetail ))
- die ( 'illegal request ' );
-
- $pendingApprovalsSid = current ( $staffManageDetail ['staffList'] ) [0];
- if (empty ( $pendingApprovalsSid ))
- die ( 'illegal request ' );
-
- $staff->pendingApprovalsLeave = $pendingApprovalsSid;
- $staff->staffManageLeave = $staffManageDetail ['staff'];
- $staff->processApprovalsLeave = '';
- $staff->sid = $this->staff ['sid'];
-
- // 抄送组
- $staff->processLeaveCC = $staffManageDetail ['CC'];
- $staff->update ();
-
- // 操作日志
- Doo::loadModel ( 'staffOperationLog' );
- $staffOperationLog = new staffOperationLog ();
- $item = array (
- 'date' => date ( "Y-m-d H:i:s" ),
- 'status' => 3,
- 'img' => $this->staff ['avatar'],
- 'username' => $this->staff ['username'],
- 'operation' => "申请转正",
- 'uid' => $this->staff ['sid'],
- 'category' => $this->staff ['category'],
-
- 'sid' => $this->staff ['sid']
- );
- $staffOperationLog->setInvoiceOperationLog ( $item );
-
- return '/settingEmployeeInfo';
- }
-
- /**
- * 申请晋升
- */
- function appliedPromote() {
- $sidKey = $this->get_args ( 'sidKey' ) ? $this->get_args ( 'sidKey' ) : "";
-
- $position = $this->get_args ( 'position' ) ? $this->get_args ( 'position' ) : '';
-
- $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;
-
- Doo::loadModel ( 'staff' );
- $staff = new staff ();
- Doo::loadModel ( 'promoteManage' );
- $staffLeaveManage = new promoteManage ();
-
- Doo::loadClass ( 'XDeode' );
- $XDeode = new XDeode ( 5 );
-
- $sid = $XDeode->decode ( $sidKey );
-
- $detail = $staff->getStaffBySid ( $sid );
-
- // 离职审批组
- // 获得审批组KEY
-
- $cidMode = $detail ['cid'];
- if (! empty ( $detail ['departmentID'] ))
- $cidMode = $detail ['cid'] . '_' . $detail ['departmentID'];
-
- $staffManageDetail = $staffLeaveManage->getStaffManageByCid ( $cidMode );
- if (empty ( $staffManageDetail ['staffList'] ))
- die ( 'illegal request ' );
-
- $pendingApprovalsSid = current ( $staffManageDetail ['staffList'] ) [0];
- if (empty ( $pendingApprovalsSid ))
- die ( 'illegal request ' );
-
- $item = array (
- 'sid' => $sid,
- 'appliedPromote' => $position . '_' . $baseWage . '_' . $postWage . '_' . $achievementBonus,
- // 状态改成申请晋升
- 'pendStatus' => 6
- );
- $staff->setStaffByCondition ( $item );
-
- $staff = new staff ();
- $staff->pendingApprovalsLeave = $pendingApprovalsSid;
- $staff->staffManageLeave = $staffManageDetail ['staff'];
- $staff->processApprovalsLeave = '';
- $staff->sid = $sid;
-
- // 抄送组
- $staff->processLeaveCC = $staffManageDetail ['CC'];
- $staff->update ();
-
- $pDetail = explode ( '_', $position );
-
- // 操作日志
- Doo::loadModel ( 'staffOperationLog' );
- $staffOperationLog = new staffOperationLog ();
- $item = array (
- 'date' => date ( "Y-m-d H:i:s" ),
- 'status' => 3,
-
- 'operation' => "申请晋升" . $pDetail [1],
-
- 'img' => $this->staff ['avatar'],
- 'username' => $this->staff ['username'],
- 'uid' => $detail ['sid'],
- 'category' => $this->staff ['category'],
- 'sid' => $this->staff ['sid']
- );
- $staffOperationLog->setInvoiceOperationLog ( $item );
-
- return '/hrEmployee';
- }
-
- /**
- * 再入职申请
- */
- function employeeReentryApply() {
- $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 ();
- Doo::loadModel ( 'reentryManage' );
- $reentryManage = new reentryManage ();
-
- $sid = $XDeode->decode ( $sidKey );
-
- $detail = $staff->getStaffBySid ( $sid );
- if (empty ( $detail ))
- die ( 'illegal request' );
-
- $item = array (
- 'sid' => $sid,
- 'pendStatus' => 7
- );
- $staff->setStaffByCondition ( $item );
-
- // 离职审批组
- // 获得审批组KEY
- $staff = new staff ();
- $cidMode = $detail ['cid'];
- if (! empty ( $detail ['departmentID'] ))
- $cidMode = $detail ['cid'] . '_' . $detail ['departmentID'];
-
- $staffManageDetail = $reentryManage->getStaffManageByCid ( $cidMode );
- if (empty ( $staffManageDetail ))
- die ( 'illegal request ' );
-
- $pendingApprovalsSid = current ( $staffManageDetail ['staffList'] ) [0];
- if (empty ( $pendingApprovalsSid ))
- die ( 'illegal request ' );
- $staff->pendingApprovals = $pendingApprovalsSid;
- $staff->staffManage = $staffManageDetail ['staff'];
- $staff->processApprovals = '';
- $staff->sid = $detail ['sid'];
-
- // 抄送组
- $staff->processCC = $staffManageDetail ['CC'];
- $staff->update ();
-
- // 操作日志
- Doo::loadModel ( 'staffOperationLog' );
- $staffOperationLog = new staffOperationLog ();
- $item = array (
- 'date' => date ( "Y-m-d H:i:s" ),
- 'status' => 3,
- 'img' => $detail ['avatar'],
- 'username' => $detail ['username'],
- 'operation' => "申请再入职",
- 'uid' => $detail ['sid'],
- 'category' => $detail ['category'],
-
- 'sid' => $detail ['sid']
- );
- $staffOperationLog->setInvoiceOperationLog ( $item );
-
- return '/hrEmployee';
- }
- die ( 'illegal request' );
- }
-
- /**
- * 确认在入职
- */
- function employeeReentry() {
- $sidKey = $this->get_args ( 'sidKey' ) ? $this->get_args ( 'sidKey' ) : "";
-
- if (! empty ( $sidKey )) {
- Doo::loadClass ( 'XDeode' );
- $XDeode = new XDeode ( 5 );
- Doo::loadModel ( 'staff' );
- $staff = new staff ();
-
- $sid = $XDeode->decode ( $sidKey );
-
- $detail = $staff->getStaffBySid ( $sid );
- if (empty ( $detail ))
- die ( 'illegal request' );
- // 工龄记录
- $seniorityFormula = json_decode ( $detail ['seniorityFormula'] );
-
- array_push ( $seniorityFormula, array (
- 'InductionDate' => date ( "Y-m-d H:i:s" ),
- 'dimissionDate' => ''
- ) );
-
- $item = array (
- 'sid' => $sid,
- 'nature' => 1,
- 'pendStatus' => 0,
- 'seniorityFormula' => json_encode ( $seniorityFormula ),
- 'hiredate' => date ( "Y-m-d" )
- );
- $staff->setStaffByCondition ( $item );
- // 更新假期相关信息
- Doo::loadModel ( 'holidaystaff' );
- $holidaystaff = new HStaff ();
- $holidaystaff->delete ( array (
- 'where' => 'uid=' . $sid
- ) );
- $holidaystaff = new HStaff ();
- $holidaystaff->uid = $sid;
- $holidaystaff->insert ();
- $staff = new staff ();
- $staffmsg = $staff->getUserById ( $sid );
- $this->updateAnnualLeave ( $staffmsg [0] );
-
- return '/hrEmployee';
- }
- die ( 'illegal request' );
- }
-
- /**
- * 员工再入职审批流程
- */
- function reentryApprovals() {
- Doo::loadModel ( 'staff' );
- $staff = new staff ();
- Doo::loadModel ( 'L_category' );
- $L_category = new L_category ();
- Doo::loadModel ( 'reentryManage' );
- $staffManage = new reentryManage ();
-
- // 获得办事和部门
- $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/reentryApprovals", $this->data );
- }
-
- /**
- * 添加员工审批人员
- */
- function reentryApprovalsAdd() {
- $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 ( "reentryManage" );
- $staffManage = new reentryManage ();
- 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 reentryManage ();
-
- $staffManage->cid = $cidMode;
- $staffManage->staff = json_encode ( $list );
-
- $staffManage->insert ();
- } else {
- $staffManage = new reentryManage ();
-
- $staffManage->staff = json_encode ( $list );
- $staffManage->update ( array (
- 'where' => 'icid = ' . $staffManageInfo ['icid']
- ) );
- }
- return '/reentryApprovals';
- }
- die ( 'illegal request' );
- }
-
- /**
- * 添加抄送员工,微信通知
- */
- function reentryCCAdd() {
- $cidKey = $this->get_args ( 'cidKey' ) ? $this->get_args ( 'cidKey' ) : "";
- $staff = $this->get_args ( 'staff' ) ? $this->get_args ( 'staff' ) : "";
- // && ! empty ( $staff )
- if (! empty ( $cidKey )) {
- Doo::loadModel ( "reentryManage" );
- $staffManage = new reentryManage ();
- 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 reentryManage ();
-
- $staffManage->cid = $cidMode;
- $staffManage->CC = json_encode ( $list );
-
- $staffManage->insert ();
- } else {
- $staffManage = new reentryManage ();
-
- $staffManage->CC = json_encode ( $list );
- $staffManage->update ( array (
- 'where' => 'icid = ' . $staffManageInfo ['icid']
- ) );
- }
- return '/reentryApprovals';
- }
- die ( 'illegal request' );
- }
-
- /**
- * 员工审批流程
- */
- function employeeApprovals() {
- Doo::loadModel ( 'staff' );
- $staff = new staff ();
- Doo::loadModel ( 'L_category' );
- $L_category = new L_category ();
- Doo::loadModel ( 'staffManage' );
- $staffManage = new staffManage ();
-
- // 获得办事和部门
- $categoryList = $L_category->getCategoryDepartment ();
-
- $staffManageList = $staffManage->find ( array (
- 'asArray' => true
- ) );
-
- foreach ( $staffManageList as $key => $value ) {
- // 审批人员
- $name = json_decode ( $value ['staff'] );
- $employeeApprovals = array ();
- if (count ( $name ) != 0) {
- foreach ( $name as $ve ) {
- array_push ( $employeeApprovals, $ve [1] );
- }
- }
- $employeeApprovals = implode ( '->', $employeeApprovals );
-
- // 抄送人员
- $name = json_decode ( $value ['CC'] );
- $CC = array ();
- if (count ( $name ) != 0) {
- foreach ( $name as $ve ) {
- array_push ( $CC, $ve [1] );
- }
- }
- $CC = implode ( ' ', $CC );
-
- foreach ( $categoryList as $k => $v ) {
- $cid = $v ['cid'];
- if (isset ( $v ['did'] ))
- $cid .= '_' . $v ['did'];
- if ($cid == $value ['cid']) { // echo $cid.'//';echo $value['cid'].'<br/>';
- $categoryList [$k] ['employeeApprovals'] = $employeeApprovals;
- $categoryList [$k] ['CC'] = $CC;
- break;
- }
- }
- }
- foreach ( $categoryList as $key => $value ) {
- if (! isset ( $value ['employeeApprovals'] ))
- $categoryList [$key] ['employeeApprovals'] = '';
- if (! isset ( $value ['CC'] ))
- $categoryList [$key] ['CC'] = '';
- }
-
- // print_r($categoryList);
- $stafflist = $staff->getStaff ( true );
-
- $this->data ['categoryList'] = $categoryList;
- $this->data ['staffList'] = $stafflist;
-
- $this->data ['memu'] = "HumanResource";
- $this->data ['hrMemu'] = "employeeApprovals";
-
- $this->render ( "/humanResource/employeeApprovals", $this->data );
- }
-
- /**
- * 添加员工审批人员
- */
- function employeeApprovalsAdd() {
- $cidKey = $this->get_args ( 'cidKey' ) ? $this->get_args ( 'cidKey' ) : "";
- $uidlist = $this->get_args ( 'uidlist' ) ? $this->get_args ( 'uidlist' ) : "";
- $uidlist = explode ( ",", $uidlist );
-
- if (! empty ( $cidKey ) && ! empty ( $uidlist )) {
- Doo::loadModel ( "staffManage" );
- $staffManage = new staffManage ();
- Doo::loadClass ( 'XDeode' );
- $XDeode = new XDeode ( 5 );
-
- // 获得抄送内容
- $approvalKey = explode ( '_', $cidKey );
- $cidMode = array ();
- foreach ( $approvalKey as $value ) {
- $cid = $XDeode->decode ( $value );
- array_push ( $cidMode, $cid );
- }
-
- $cidMode = implode ( '_', $cidMode );
- // echo $cidMode;die;
- $staffManageInfo = $staffManage->getOne ( array (
- 'where' => 'cid ="' . $cidMode . '" ',
- 'asArray' => true
- ) );
-
- // 审批人员
- $list = array ();
- foreach ( $uidlist as $key => $value ) {
- $info = explode ( ":", $value );
- array_push ( $list, $info );
- }
-
- if (empty ( $staffManageInfo )) {
- $staffManage = new staffManage ();
-
- $staffManage->cid = $cidMode;
- $staffManage->staff = json_encode ( $list );
-
- $staffManage->insert ();
- } else {
- $staffManage = new staffManage ();
-
- $staffManage->staff = json_encode ( $list );
- $staffManage->update ( array (
- 'where' => 'icid = ' . $staffManageInfo ['icid']
- ) );
- }
- return '/employeeApprovals';
- }
- die ( 'illegal request' );
- }
-
- /**
- * 添加抄送员工,微信通知
- */
- function employeeCCAdd() {
- $cidKey = $this->get_args ( 'cidKey' ) ? $this->get_args ( 'cidKey' ) : "";
- $staff = $this->get_args ( 'staff' ) ? $this->get_args ( 'staff' ) : "";
- // && ! empty ( $staff )
- if (! empty ( $cidKey )) {
- Doo::loadModel ( "staffManage" );
- $staffManage = new staffManage ();
- Doo::loadClass ( 'XDeode' );
- $XDeode = new XDeode ( 5 );
-
- // 获得抄送内容
- $approvalKey = explode ( '_', $cidKey );
- $cidMode = array ();
- foreach ( $approvalKey as $value ) {
- $cid = $XDeode->decode ( $value );
- array_push ( $cidMode, $cid );
- }
-
- $cidMode = implode ( '_', $cidMode );
- $staffManageInfo = $staffManage->getOne ( array (
- 'where' => 'cid ="' . $cidMode . '" ',
- 'asArray' => true
- ) );
-
- $list = array ();
- foreach ( $staff as $key => $value ) {
- $info = explode ( ":", $value );
- array_push ( $list, $info );
- }
-
- if (empty ( $staffManageInfo )) {
- $staffManage = new staffManage ();
-
- $staffManage->cid = $cidMode;
- $staffManage->CC = json_encode ( $list );
-
- $staffManage->insert ();
- } else {
- $staffManage = new staffManage ();
-
- $staffManage->CC = json_encode ( $list );
- $staffManage->update ( array (
- 'where' => 'icid = ' . $staffManageInfo ['icid']
- ) );
- }
- return '/employeeApprovals';
- }
- die ( 'illegal request' );
- }
-
- /**
- * 离职审批流程设置
- */
- function leaveOfficeApprovals() {
- Doo::loadModel ( 'staff' );
- $staff = new staff ();
- Doo::loadModel ( 'L_category' );
- $L_category = new L_category ();
- Doo::loadModel ( 'staffLeaveManage' );
- $staffManage = new staffLeaveManage ();
-
- // 获得办事和部门
- $categoryList = $L_category->getCategoryDepartment ();
-
- $staffManageList = $staffManage->find ( array (
- 'asArray' => true
- ) );
-
- foreach ( $staffManageList as $key => $value ) {
- // 审批人员
- $name = json_decode ( $value ['staff'] );
- $employeeApprovals = array ();
- if (count ( $name ) != 0) {
- foreach ( $name as $ve ) {
- array_push ( $employeeApprovals, $ve [1] );
- }
- }
- $employeeApprovals = implode ( '->', $employeeApprovals );
-
- // 抄送人员
- $name = json_decode ( $value ['CC'] );
- $CC = array ();
- if (count ( $name ) != 0) {
- foreach ( $name as $ve ) {
- array_push ( $CC, $ve [1] );
- }
- }
- $CC = implode ( ' ', $CC );
-
- foreach ( $categoryList as $k => $v ) {
- $cid = $v ['cid'];
- if (isset ( $v ['did'] ))
- $cid .= '_' . $v ['did'];
- if ($cid == $value ['cid']) { // echo $cid.'//';echo $value['cid'].'<br/>';
- $categoryList [$k] ['employeeApprovals'] = $employeeApprovals;
- $categoryList [$k] ['CC'] = $CC;
- break;
- }
- }
- }
- foreach ( $categoryList as $key => $value ) {
- if (! isset ( $value ['employeeApprovals'] ))
- $categoryList [$key] ['employeeApprovals'] = '';
- if (! isset ( $value ['CC'] ))
- $categoryList [$key] ['CC'] = '';
- }
-
- // print_r($categoryList);
- $stafflist = $staff->getStaff ( true );
-
- $this->data ['categoryList'] = $categoryList;
- $this->data ['staffList'] = $stafflist;
-
- $this->data ['memu'] = "HumanResource";
- $this->data ['hrMemu'] = "employeeApprovals";
-
- $this->render ( "/humanResource/leaveOfficeApprovals", $this->data );
- }
-
- /**
- * 添加员工审批人员
- */
- function employeeleaveApprovalsAdd() {
- $cidKey = $this->get_args ( 'cidKey' ) ? $this->get_args ( 'cidKey' ) : "";
- $uidlist = $this->get_args ( 'uidlist' ) ? $this->get_args ( 'uidlist' ) : "";
- $uidlist = explode ( ",", $uidlist );
-
- if (! empty ( $cidKey ) && ! empty ( $uidlist )) {
- Doo::loadModel ( "staffLeaveManage" );
- $staffManage = new staffLeaveManage ();
- Doo::loadClass ( 'XDeode' );
- $XDeode = new XDeode ( 5 );
-
- // 获得抄送内容
- $approvalKey = explode ( '_', $cidKey );
- $cidMode = array ();
- foreach ( $approvalKey as $value ) {
- $cid = $XDeode->decode ( $value );
- array_push ( $cidMode, $cid );
- }
-
- $cidMode = implode ( '_', $cidMode );
- // echo $cidMode;die;
- $staffManageInfo = $staffManage->getOne ( array (
- 'where' => 'cid ="' . $cidMode . '" ',
- 'asArray' => true
- ) );
-
- // 审批人员
- $list = array ();
- foreach ( $uidlist as $key => $value ) {
- $info = explode ( ":", $value );
- array_push ( $list, $info );
- }
-
- if (empty ( $staffManageInfo )) {
- $staffManage = new staffLeaveManage ();
-
- $staffManage->cid = $cidMode;
- $staffManage->staff = json_encode ( $list );
-
- $staffManage->insert ();
- } else {
- $staffManage = new staffLeaveManage ();
-
- $staffManage->staff = json_encode ( $list );
- $staffManage->update ( array (
- 'where' => 'icid = ' . $staffManageInfo ['icid']
- ) );
- }
- return '/leaveOfficeApprovals';
- }
- die ( 'illegal request' );
- }
-
- /**
- * 添加抄送员工,微信通知
- */
- function employeeleaveCCAdd() {
- $cidKey = $this->get_args ( 'cidKey' ) ? $this->get_args ( 'cidKey' ) : "";
- $staff = $this->get_args ( 'staff' ) ? $this->get_args ( 'staff' ) : "";
-
- if (! empty ( $cidKey ) && ! empty ( $staff )) {
- Doo::loadModel ( "staffLeaveManage" );
- $staffManage = new staffLeaveManage ();
- Doo::loadClass ( 'XDeode' );
- $XDeode = new XDeode ( 5 );
-
- // 获得抄送内容
- $approvalKey = explode ( '_', $cidKey );
- $cidMode = array ();
- foreach ( $approvalKey as $value ) {
- $cid = $XDeode->decode ( $value );
- array_push ( $cidMode, $cid );
- }
-
- $cidMode = implode ( '_', $cidMode );
- $staffManageInfo = $staffManage->getOne ( array (
- 'where' => 'cid ="' . $cidMode . '" ',
- 'asArray' => true
- ) );
-
- $list = array ();
- foreach ( $staff as $key => $value ) {
- $info = explode ( ":", $value );
- array_push ( $list, $info );
- }
-
- if (empty ( $staffManageInfo )) {
- $staffManage = new staffLeaveManage ();
-
- $staffManage->cid = $cidMode;
- $staffManage->CC = json_encode ( $list );
-
- $staffManage->insert ();
- } else {
- $staffManage = new staffLeaveManage ();
-
- $staffManage->CC = json_encode ( $list );
- $staffManage->update ( array (
- 'where' => 'icid = ' . $staffManageInfo ['icid']
- ) );
- }
- return '/leaveOfficeApprovals';
- }
- die ( 'illegal request' );
- }
-
- /**
- * 转正审批流程设置
- */
- function regularApprovals() {
- Doo::loadModel ( 'staff' );
- $staff = new staff ();
- Doo::loadModel ( 'L_category' );
- $L_category = new L_category ();
- Doo::loadModel ( 'staffRegularManage' );
- $staffManage = new staffRegularManage ();
-
- // 获得办事和部门
- $categoryList = $L_category->getCategoryDepartment ();
-
- $staffManageList = $staffManage->find ( array (
- 'asArray' => true
- ) );
-
- foreach ( $staffManageList as $key => $value ) {
- // 审批人员
- $name = json_decode ( $value ['staff'] );
- $employeeApprovals = array ();
- if (count ( $name ) != 0) {
- foreach ( $name as $ve ) {
- array_push ( $employeeApprovals, $ve [1] );
- }
- }
- $employeeApprovals = implode ( '->', $employeeApprovals );
-
- // 抄送人员
- $name = json_decode ( $value ['CC'] );
- $CC = array ();
- if (count ( $name ) != 0) {
- foreach ( $name as $ve ) {
- array_push ( $CC, $ve [1] );
- }
- }
- $CC = implode ( ' ', $CC );
-
- foreach ( $categoryList as $k => $v ) {
- $cid = $v ['cid'];
- if (isset ( $v ['did'] ))
- $cid .= '_' . $v ['did'];
- if ($cid == $value ['cid']) { // echo $cid.'//';echo $value['cid'].'<br/>';
- $categoryList [$k] ['employeeApprovals'] = $employeeApprovals;
- $categoryList [$k] ['CC'] = $CC;
- break;
- }
- }
- }
- foreach ( $categoryList as $key => $value ) {
- if (! isset ( $value ['employeeApprovals'] ))
- $categoryList [$key] ['employeeApprovals'] = '';
- if (! isset ( $value ['CC'] ))
- $categoryList [$key] ['CC'] = '';
- }
-
- // print_r($categoryList);
- $stafflist = $staff->getStaff ( true );
-
- $this->data ['categoryList'] = $categoryList;
- $this->data ['staffList'] = $stafflist;
-
- $this->data ['memu'] = "HumanResource";
- $this->data ['hrMemu'] = "employeeApprovals";
-
- $this->render ( "/humanResource/regularApprovals", $this->data );
- }
-
- /**
- * 添加转正审批人员
- */
- function employeRegularApprovalsAdd() {
- $cidKey = $this->get_args ( 'cidKey' ) ? $this->get_args ( 'cidKey' ) : "";
- $uidlist = $this->get_args ( 'uidlist' ) ? $this->get_args ( 'uidlist' ) : "";
- $uidlist = explode ( ",", $uidlist );
-
- if (! empty ( $cidKey ) && ! empty ( $uidlist )) {
- Doo::loadModel ( "staffRegularManage" );
- $staffManage = new staffRegularManage ();
- Doo::loadClass ( 'XDeode' );
- $XDeode = new XDeode ( 5 );
-
- // 获得抄送内容
- $approvalKey = explode ( '_', $cidKey );
- $cidMode = array ();
- foreach ( $approvalKey as $value ) {
- $cid = $XDeode->decode ( $value );
- array_push ( $cidMode, $cid );
- }
-
- $cidMode = implode ( '_', $cidMode );
- // echo $cidMode;die;
- $staffManageInfo = $staffManage->getOne ( array (
- 'where' => 'cid ="' . $cidMode . '" ',
- 'asArray' => true
- ) );
-
- // 审批人员
- $list = array ();
- foreach ( $uidlist as $key => $value ) {
- $info = explode ( ":", $value );
- array_push ( $list, $info );
- }
-
- if (empty ( $staffManageInfo )) {
- $staffManage = new staffRegularManage ();
-
- $staffManage->cid = $cidMode;
- $staffManage->staff = json_encode ( $list );
-
- $staffManage->insert ();
- } else {
- $staffManage = new staffRegularManage ();
-
- $staffManage->staff = json_encode ( $list );
- $staffManage->update ( array (
- 'where' => 'icid = ' . $staffManageInfo ['icid']
- ) );
- }
- return '/regularApprovals';
- }
- die ( 'illegal request' );
- }
-
- /**
- * 添加抄送员工,微信通知
- */
- function employeRegularCCAdd() {
- $cidKey = $this->get_args ( 'cidKey' ) ? $this->get_args ( 'cidKey' ) : "";
- $staff = $this->get_args ( 'staff' ) ? $this->get_args ( 'staff' ) : "";
-
- if (! empty ( $cidKey ) && ! empty ( $staff )) {
- Doo::loadModel ( "staffRegularManage" );
- $staffManage = new staffRegularManage ();
- Doo::loadClass ( 'XDeode' );
- $XDeode = new XDeode ( 5 );
-
- // 获得抄送内容
- $approvalKey = explode ( '_', $cidKey );
- $cidMode = array ();
- foreach ( $approvalKey as $value ) {
- $cid = $XDeode->decode ( $value );
- array_push ( $cidMode, $cid );
- }
-
- $cidMode = implode ( '_', $cidMode );
- $staffManageInfo = $staffManage->getOne ( array (
- 'where' => 'cid ="' . $cidMode . '" ',
- 'asArray' => true
- ) );
-
- $list = array ();
- foreach ( $staff as $key => $value ) {
- $info = explode ( ":", $value );
- array_push ( $list, $info );
- }
-
- if (empty ( $staffManageInfo )) {
- $staffManage = new staffRegularManage ();
-
- $staffManage->cid = $cidMode;
- $staffManage->CC = json_encode ( $list );
-
- $staffManage->insert ();
- } else {
- $staffManage = new staffRegularManage ();
-
- $staffManage->CC = json_encode ( $list );
- $staffManage->update ( array (
- 'where' => 'icid = ' . $staffManageInfo ['icid']
- ) );
- }
- return '/regularApprovals';
- }
- die ( 'illegal request' );
- }
-
- /**
- * 晋升流程设置
- */
- function promoteApprovals() {
- Doo::loadModel ( 'staff' );
- $staff = new staff ();
- Doo::loadModel ( 'L_category' );
- $L_category = new L_category ();
- Doo::loadModel ( 'promoteManage' );
- $staffManage = new promoteManage ();
-
- // 获得办事和部门
- $categoryList = $L_category->getCategoryDepartment ();
-
- $staffManageList = $staffManage->find ( array (
- 'asArray' => true
- ) );
-
- foreach ( $staffManageList as $key => $value ) {
- // 审批人员
- $name = json_decode ( $value ['staff'] );
- $employeeApprovals = array ();
- if (count ( $name ) != 0) {
- foreach ( $name as $ve ) {
- array_push ( $employeeApprovals, $ve [1] );
- }
- }
- $employeeApprovals = implode ( '->', $employeeApprovals );
-
- // 抄送人员
- $name = json_decode ( $value ['CC'] );
- $CC = array ();
- if (count ( $name ) != 0) {
- foreach ( $name as $ve ) {
- array_push ( $CC, $ve [1] );
- }
- }
- $CC = implode ( ' ', $CC );
-
- foreach ( $categoryList as $k => $v ) {
- $cid = $v ['cid'];
- if (isset ( $v ['did'] ))
- $cid .= '_' . $v ['did'];
- if ($cid == $value ['cid']) { // echo $cid.'//';echo $value['cid'].'<br/>';
- $categoryList [$k] ['employeeApprovals'] = $employeeApprovals;
- $categoryList [$k] ['CC'] = $CC;
- break;
- }
- }
- }
- foreach ( $categoryList as $key => $value ) {
- if (! isset ( $value ['employeeApprovals'] ))
- $categoryList [$key] ['employeeApprovals'] = '';
- if (! isset ( $value ['CC'] ))
- $categoryList [$key] ['CC'] = '';
- }
-
- // print_r($categoryList);
- $stafflist = $staff->getStaff ( true );
-
- $this->data ['categoryList'] = $categoryList;
- $this->data ['staffList'] = $stafflist;
-
- $this->data ['memu'] = "HumanResource";
- $this->data ['hrMemu'] = "employeeApprovals";
-
- $this->render ( "/humanResource/promoteApprovals", $this->data );
- }
-
- /**
- * 添加晋升审批人员
- */
- function promoteApprovalsAdd() {
- $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 ( "promoteManage" );
- $staffManage = new promoteManage ();
- 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 promoteManage ();
-
- $staffManage->cid = $cidMode;
- $staffManage->staff = json_encode ( $list );
-
- $staffManage->insert ();
- } else {
- $staffManage = new promoteManage ();
-
- $staffManage->staff = json_encode ( $list );
- $staffManage->update ( array (
- 'where' => 'icid = ' . $staffManageInfo ['icid']
- ) );
- }
- return '/promoteApprovals';
- }
- die ( 'illegal request' );
- }
-
- /**
- * 添加抄送员工,微信通知
- */
- function promoteApprovalsCCAdd() {
- $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 ( "promoteManage" );
- $staffManage = new promoteManage ();
- 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 promoteManage ();
-
- $staffManage->cid = $cidMode;
- $staffManage->CC = json_encode ( $list );
-
- $staffManage->insert ();
- } else {
- $staffManage = new promoteManage ();
-
- $staffManage->CC = json_encode ( $list );
- $staffManage->update ( array (
- 'where' => 'icid = ' . $staffManageInfo ['icid']
- ) );
- }
- return '/promoteApprovals';
- }
- die ( 'illegal request' );
- }
-
- /**
- * 员工权限管理
- */
- function hrEmployeeApprovalsSetting() {
- $pendStatus = $this->get_args ( 'pendStatus' ) ? $this->get_args ( 'pendStatus' ) : "ALL";
- $nature = $this->get_args ( 'nature' ) ? $this->get_args ( 'nature' ) : 'ALL';
- $cid_did = $this->get_args ( 'cid_did' ) ? $this->get_args ( 'cid_did' ) : 'ALL';
- $MebSea = $this->get_args ( 'MebSea' ) ? $this->get_args ( 'MebSea' ) : '';
-
- Doo::loadClass ( 'XDeode' );
- $XDeode = new XDeode ( 5 );
-
- $con = ' username != "admin" ';
- if ($pendStatus == 'ALL')
- $con .= ' ';
- elseif ($pendStatus == 'OTJOB')
- $con .= ' and pendStatus=0 ';
- elseif ($pendStatus == 'LVJOB')
- $con .= ' and pendStatus=4 ';
-
- if ($nature == 'ALL')
- $con .= ' and (nature=1 or nature=2 or nature=3 or nature=4) ';
- elseif ($nature == 'FORMAL')
- $con .= ' and nature=1';
- elseif ($nature == 'TRIAL')
- $con .= ' and nature=2';
- elseif ($nature == 'PRACTICE')
- $con .= ' and nature=3';
-
- if ($cid_did != 'ALL') {
- $department = explode ( '_', $cid_did );
- $cid = $XDeode->decode ( $department [0] );
- $departmentID = false;
- if (! empty ( $department [1] )) {
- $departmentID = $XDeode->decode ( $department [1] );
- }
- if (is_numeric ( $cid ) && is_numeric ( $departmentID ))
- $con .= ' and cid=' . $cid . ' and departmentID=' . $departmentID;
- elseif (is_numeric ( $cid ) && ! is_numeric ( $departmentID ))
- $con .= ' and cid=' . $cid;
- }
-
- if (! empty ( $MebSea ))
- $con .= ' and ( username like "%' . $MebSea . '%" or jobNumber like "%' . $MebSea . '%" )';
-
- Doo::loadModel ( 'staff' );
- $staff = new staff ();
- Doo::loadModel ( 'L_category' );
- $L_category = new L_category ();
-
- $stafflist = $staff->getStaffByCondition ( $con );
-
- //print_r($stafflist);
-
- $monthstart = date ( 'Y-m-d 00:00:00', mktime ( 0, 0, 0, date ( 'm' ), 1, date ( 'Y' ) ) );
- $monthend = date ( 'Y-m-d 23:59:59', mktime ( 0, 0, 0, date ( 'm' ) + 1, 0, date ( 'Y' ) ) );
-
- // 本月在职 入职 离职人员数量
- $onJobCount = $staff->count ( array (
- 'where' => 'pendStatus=0 and username!="admin"'
- ) );
- $inJobCount = $staff->count ( array (
- 'where' => 'pendStatus=0 and username!="admin" and (InductionDate>="' . $monthstart . '" and InductionDate<="' . $monthend . '" )'
- ) );
- $leaveJobCount = $staff->count ( array (
- 'where' => 'pendStatus=4 and username!="admin" and (dimissionDate>="' . $monthstart . '" and dimissionDate<="' . $monthend . '" )'
- ) );
-
- // 生成工号
- $jobNumber = $this->createJobNumber ();
- // 获得办事和部门
- $categoryList = $L_category->getCategoryDepartment ();
-
- $monthstart = date ( 'm.d', mktime ( 0, 0, 0, date ( 'm' ), 1, date ( 'Y' ) ) );
- $monthend = date ( 'm.d', mktime ( 0, 0, 0, date ( 'm' ) + 1, 0, date ( 'Y' ) ) );
-
- // 员工可选的
- Doo::loadModel ( 'district' );
- $district = new district ();
- $this->data ['districtList'] = $district->get_lv ( 1 );
-
- $this->data ['onJobCount'] = $onJobCount;
- $this->data ['inJobCount'] = $inJobCount;
- $this->data ['leaveJobCount'] = $leaveJobCount;
-
- $this->data ['monthstart'] = $monthstart;
- $this->data ['monthend'] = $monthend;
-
- $this->data ['pendStatus'] = $pendStatus;
- $this->data ['nature'] = $nature;
- $this->data ['MebSea'] = $MebSea;
- $this->data ['cid_did'] = $cid_did;
-
- $this->data ['categoryList'] = $categoryList;
- $this->data ['jobNumber'] = $jobNumber;
- $this->data ['stafflist'] = $stafflist;
-
- $this->data ['memu'] = "HumanResource";
- $this->data ['hrMemu'] = "hrEmployeeInfo";
-
- $this->render ( "/humanResource/hrEmployeeApprovalsSetting", $this->data );
- }
-
- /**
- * 设置员工访问CLD权限
- */
- function hrEmployeeAccess() {
- $sidKey = $this->get_args ( 'sidKey' ) ? $this->get_args ( 'sidKey' ) : '';
- $access = $this->get_args ( 'access' ) ? $this->get_args ( 'access' ) : "";
-
- if (! empty ( $sidKey )) {
- Doo::loadClass ( 'XDeode' );
- $XDeode = new XDeode ( 5 );
- Doo::loadModel ( 'staff' );
- $staff = new staff ();
-
- $sid = $XDeode->decode ( $sidKey );
- $detail = $staff->getStaffBySid ( $sid );
-
- $access = json_encode ( $access );
-
- $staff->cldAccess = $access;
- $staff->update ( array (
- 'where' => 'sid=' . $sid
- ) );
-
- return '/hrEmployeeApprovalsSetting';
- }
-
- die ( 'illegal request' );
- }
-
- /**
- * 添加浏览省份的权限
- */
- function addUserDistrictAuthor() {
- $didKey = $this->get_args ( 'didKey' ) ? $this->get_args ( 'didKey' ) : array ();
- $sidKey = $this->get_args ( 'sidKey' ) ? $this->get_args ( 'sidKey' ) : array ();
-
- if (! empty ( $didKey ) && ! empty ( $sidKey )) {
- Doo::loadModel ( 'staff' );
- $staff = new staff ();
- Doo::loadClass ( 'XDeode' );
- $XDeode = new XDeode ( 5 );
-
- $sid = $XDeode->decode ( $sidKey );
- $sDetail = $staff->getStaffBySid ( $sid );
-
- $sDidList = explode ( ',', $sDetail ['did'] );
-
- $staff->did = implode ( ',', $didKey );
- $staff->sid = $sid;
- $staff->update ();
- return '/hrEmployeeApprovalsSetting';
- }
- die ( 'illegal request' );
- }
-
- /**
- * 岗位设置
- */
- function position() {
- Doo::loadModel ( 'position' );
- $position = new position ();
-
- $listPosition = $position->getPositionByAll ();
-
- $this->data ['listPosition'] = $listPosition;
-
- $this->data ['memu'] = "HumanResource";
- $this->data ['hrMemu'] = "position";
-
- $this->render ( "/humanResource/position", $this->data );
- }
-
- /**
- * 添加岗位设置
- * @return string
- */
- function positionAdd() {
- $positionName = $this->get_args ( 'positionName' ) ? $this->get_args ( 'positionName' ) : "";
- $positionDescribe = $this->get_args ( 'positionDescribe' ) ? $this->get_args ( 'positionDescribe' ) : "";
- $baseWage = is_numeric ( $this->get_args ( 'baseWage' ) ) ? $this->get_args ( 'baseWage' ) : 0;
- $postWage = is_numeric ( $this->get_args ( 'postWage' ) ) ? $this->get_args ( 'postWage' ) : 0;
- $achievementBonus = is_numeric ( $this->get_args ( 'achievementBonus' ) ) ? $this->get_args ( 'achievementBonus' ) : 0;
- // && ! empty ( $postWage ) && ! empty ( $achievementBonus )
- if (! empty ( $positionName ) && ! empty ( $positionDescribe ) && ! empty ( $baseWage )) {
-
- Doo::loadClass ( 'XDeode' );
- $XDeode = new XDeode ( 5 );
- Doo::loadModel ( 'position' );
- $position = new position ();
-
- $position->positionName = $positionName;
- $position->positionDescribe = $positionDescribe;
- $position->baseWage = $baseWage;
- $position->postWage = $postWage;
- $position->achievementBonus = $achievementBonus;
-
- $position->insert ();
- }
- return '/position';
- }
-
- /**
- * 添加岗位设置
- * @return string
- */
- function positionUpdate() {
- $pidkey = $this->get_args ( 'pidkey' ) ? $this->get_args ( 'pidkey' ) : "";
-
- $positionName = $this->get_args ( 'positionName' ) ? $this->get_args ( 'positionName' ) : "";
- $positionDescribe = $this->get_args ( 'positionDescribe' ) ? $this->get_args ( 'positionDescribe' ) : "";
- $baseWage = is_numeric ( $this->get_args ( 'baseWage' ) ) ? $this->get_args ( 'baseWage' ) : 0;
- $postWage = is_numeric ( $this->get_args ( 'postWage' ) ) ? $this->get_args ( 'postWage' ) : 0;
- $achievementBonus = is_numeric ( $this->get_args ( 'achievementBonus' ) ) ? $this->get_args ( 'achievementBonus' ) : 0;
- // && ! empty ( $postWage ) && ! empty ( $achievementBonus )
- if (! empty ( $pidkey ) && ! empty ( $positionName ) && ! empty ( $positionDescribe ) && ! empty ( $baseWage )) {
-
- Doo::loadClass ( 'XDeode' );
- $XDeode = new XDeode ( 5 );
- Doo::loadModel ( 'position' );
- $position = new position ();
-
- $pid = $XDeode->decode ( $pidkey );
-
- $position->positionName = $positionName;
- $position->positionDescribe = $positionDescribe;
- $position->baseWage = $baseWage;
- $position->postWage = $postWage;
- $position->achievementBonus = $achievementBonus;
-
- $position->update ( array (
- 'where' => ' pid=' . $pid
- ) );
- // 更新用户岗位信息
- Doo::loadModel ( 'staff' );
- $staff = new staff ();
-
- $staff->position = $positionName;
- $staff->update ( array (
- 'where' => ' positionId=' . $pid
- ) );
- }
- return '/position';
- }
-
- /**
- * 删除单位
- */
- function positionDelete() {
- $pidkey = $this->get_args ( 'pidkey' ) ? $this->get_args ( 'pidkey' ) : "";
-
- if (! empty ( $pidkey )) {
- Doo::loadClass ( 'XDeode' );
- $XDeode = new XDeode ( 5 );
- Doo::loadModel ( 'position' );
- $position = new position ();
- Doo::loadModel ( 'staff' );
- $staff = new staff ();
-
- $pid = $XDeode->decode ( $pidkey );
-
- $staffCount = $staff->count ( array (
- 'where' => 'positionId = "' . $pid . '"'
- ) );
- if ($staffCount != 0)
- die ( 'illegal request' );
- $position->delete ( array (
- 'where' => ' pid=' . $pid
- ) );
- }
- return '/position';
- }
-
- /**
- * 获得岗位下所有的用户
- */
- function ajaxGetStaffByPid() {
- $pidkey = $this->get_args ( 'pidkey' ) ? $this->get_args ( 'pidkey' ) : "";
- if (empty ( $pidkey )) {
- echo json_encode ( array (
- 'status' => 2,
- 'msg' => 'illegal request'
- ) );
- die ();
- }
- Doo::loadClass ( 'XDeode' );
- $XDeode = new XDeode ( 5 );
- Doo::loadModel ( 'staff' );
- $staff = new staff ();
-
- Doo::loadModel ( 'position' );
- $position = new position ();
-
- $detail = $position->getPositionByPid ( $pidkey );
-
- $list = $staff->getStaffByPositionId ( $pidkey );
- $html = '<tr><th class="taC">办事处</th><th class="taC">姓名</th><th class="taC">入职时间</th></tr>';
- foreach ( $list as $key => $value ) {
-
- // seniorityFormula
- $seniorityFormula = json_decode ( $value ['seniorityFormula'], true );
- if (! isset ( $seniorityFormula [0] ))
- $seniorityFormula [0] ['InductionDate'] = 0;
- $html .= '<tr>
- <td>' . $value ['category'] . '</td><td>' . $value ['username'] . '</td><td>' . $seniorityFormula [0] ['InductionDate'] . '</td>
- </tr>';
- }
- echo json_encode ( array (
- 'status' => 1,
- 'positionName' => $detail ['positionName'],
- 'html' => $html
- ) );
- die ();
- }
-
- /**
- * 获取岗位信息
- */
- function ajaxGetPositionByPid() {
- $pidkey = $this->get_args ( 'pidkey' ) ? $this->get_args ( 'pidkey' ) : "";
- if (empty ( $pidkey )) {
- echo json_encode ( array (
- 'status' => 2,
- 'msg' => 'illegal request'
- ) );
- die ();
- }
-
- Doo::loadModel ( 'position' );
- $position = new position ();
-
- $detail = $position->getPositionByPid ( $pidkey );
-
- echo json_encode ( array (
- 'status' => 1,
- 'detail' => $detail
- ) );
- die ();
- }
-
- /**
- * 获得员工信息(未编写html)
- */
- function ajaxGetStaffInfoBySid() {
- $serial = $this->get_args ( 'serial' ) ? $this->get_args ( 'serial' ) : "";
- if (empty ( $serial )) {
- echo json_encode ( array (
- 'status' => 2,
- 'msg' => 'illegal request'
- ) );
- die ();
- }
-
- Doo::loadClass ( 'XDeode' );
- $XDeode = new XDeode ( 5 );
- Doo::loadModel ( 'staff' );
- $staff = new staff ();
-
- $sid = $XDeode->decode ( $serial );
- $detail = $staff->getStaffBySid ( $sid );
-
- echo json_encode ( array (
- 'status' => 1,
- 'detail' => $detail
- ) );
- die ();
- }
-
- /**
- * 获得员工信息
- */
- function ajaxGetStaffInfoByType() {
- $type = $this->get_args ( 'type' ) ? $this->get_args ( 'type' ) : "";
- $serial = $this->get_args ( 'serial' ) ? $this->get_args ( 'serial' ) : "";
- // $loss = $this->get_args ( 'loss' ) ? $this->get_args ( 'loss' ) : false;
-
- if (empty ( $serial )) {
- echo json_encode ( array (
- 'status' => 2,
- 'msg' => 'illegal request'
- ) );
- die ();
- }
-
- Doo::loadClass ( 'XDeode' );
- $XDeode = new XDeode ( 5 );
-
- if ($type == 'STAFF') {
- Doo::loadModel ( 'staff' );
- $staff = new staff ();
- Doo::loadModel ( 'staffOperationLog' );
- $staffOperationLog = new staffOperationLog ();
-
- $sid = $XDeode->decode ( $serial );
- $detail = $staff->getStaffBySid ( $sid );
-
- // 获得操作日志
- $SOPL = $staffOperationLog->getInvoiceOperationLogByUid ( $sid, 'desc' );
- if (empty ( $detail ))
- $html = '';
- else {
- $html = '
- <div class="modal-body saeaList">
- <div class="fL staff-detail-con">
- <table class="table table-bordered table-condensed">
- <tbody>
- <tr>
- <th class="taC" width="150">工号</th><td width="210">' . $detail ['jobNumber'] . '</td>
- <th class="taC" width="150">姓名</th><td width="210">' . $detail ['username'] . '</td>
- </tr>
- <tr>
- <th class="taC" width="150">办事处/部门</th><td>' . $detail ['category'] . '/' . $detail ['department'] ['departmentName'] . '</td>
- <th class="taC" width="150">岗位</th><td>' . $detail ['position'] . '</td>
- </tr>
- <tr>
- <th class="taC" width="150">入职日期</th><td>' . $detail ['hiredate'] . '</td>
- <th class="taC" width="150">手机</th><td>' . $detail ['telephone'] . '</td>
- </tr>
- <tr>
- <th class="taC">QQ</th><td>' . $detail ['qq'] . '</td>
- <th class="taC">微信</th><td>' . $detail ['wecat'] . '</td>
- </tr>
- <tr>
- <th class="taC">电话</th><td>' . $detail ['phone'] . '</td>
- <th class="taC">邮箱</th><td>' . $detail ['email'] . '</td>
- </tr>
- </tbody>
- </table>';
-
- if($detail ['pendStatus']!=3){
- $html .= '<table class="table table-bordered table-condensed">
- <tbody><tr>
- <th class="taC" width="150">性别</th><td width="210">' . $detail ['gender'] . '</td>
- <th class="taC" width="150">出生日期</th><td>' . $detail ['birthday'] . '</td>
- </tr>
- <tr>
- <th class="taC" width="150">最高学历</th><td>' . $detail ['qualifications'] . '</td>
- <th class="taC" width="150">婚姻状况</th><td>
-
- ';
-
- if ($detail ['marriage'] == 0)
- $html .= '未婚';
- elseif ($detail ['marriage'] == 1)
- $html .= '已婚';
-
- $html .= '
- </td>
- </tr>
- <tr>
- <th class="taC" width="150">籍贯</th><td colspan="3">' . $detail ['nativePlace'] . '</td>
- </tr>
- <tr>
- <th class="taC" width="150">现居住地址</th><td colspan="3">' . $detail ['living'] . '</td>
- </tr>
- </tbody>
- </table>
- <table class="table table-bordered table-condensed">
- <tbody><tr>
- <th class="taC" width="150">基本工资</th><td width="210">' . $detail ['baseWage'] . '</td>
- <th class="taC" width="150">岗位工资</th><td>' . $detail ['postWage'] . '</td>
- </tr>
- <tr>
- <th class="taC" width="150">绩效奖金</th><td>' . $detail ['achievementBonus'] . '</td>
- <th class="taC" width="150"></th><td></td>
- </tr>
- </tbody>
- </table>';
-
- }
-
-
-
-
- if($detail ['pendStatus']==3){
- $html .= '<table class="table table-bordered table-condensed">
- <tbody>
- <tr>
- <th class="taC" width="150">离职原因</th><td>'.$detail ['dimissionReason'].'</td>
- </tr>
- <tr>
- <th class="taC" width="150">离职时间</th><td>'.$detail ['applyLeaveDate'].'</td>
- </tr>
- </tbody>
- </table> ';
- }
-
-
-
- $html .= '</div>
-
- <div class="fL staff-detail-side">
- <!--入职试用 & 离职后再入职试用-->
- ';
-
- foreach ( $SOPL as $key => $value ) {
- $html .= '<div class="infoFlowList">
- <div class="dateTitle">
- <em class="month"><span class="num">' . date ( 'm', strtotime ( $value ['date'] ) ) . '</span><span class="text">-' . date ( 'd', strtotime ( $value ['date'] ) ) . '</span></em>
- <span class="year">' . date ( 'Y', strtotime ( $value ['date'] ) ) . '</span>
- </div>
- <ul class="flowList">
- <li class="item colGray">' . $value ['category'] . '-' . $value ['username'] . '</li>
- <li class="item">' . $value ['operation'] . '</li>
- </ul>
- </div>';
- }
-
- $html .= '
-
- </div>
-
-
- </div>
-
- ';
- }
- echo json_encode ( array (
- 'status' => 1,
- 'sidKey' => $serial,
- 'html' => $html
- ) );
- die ();
- } elseif ($type == 'EMPLOYEE') {
-
- Doo::loadModel ( 'staff' );
- $staff = new staff ();
- Doo::loadModel ( 'L_category' );
- $L_category = new L_category ();
- Doo::loadModel ( 'staffOperationLog' );
- $staffOperationLog = new staffOperationLog ();
-
- Doo::loadModel ( 'position' );
- $position = new position ();
-
- // 获得办事和部门
- $categoryList = $L_category->getCategoryDepartment ();
- // 获得岗位
- $listPosition = $position->getPositionByAll ();
-
- $sid = $XDeode->decode ( $serial );
- $detail = $staff->getStaffBySid ( $sid );
- // 获得操作日志
- $SOPL = $staffOperationLog->getInvoiceOperationLogByUid ( $sid, 'desc' );
-
- if (empty ( $detail ))
- $html = '';
- else {
- $html = '
-
- <div class="modal-header">
- <h3>员工详情</h3>
- </div>
- <div class="modal-body saeaList" style="overflow:hidden;margin:0">
- <div class="fL staff-detail-con">
- <table class="table table-bordered table-condensed">
- <tbody>
- <tr>
- <th class="taC" width="150">工号</th><td width="210">' . $detail ['jobNumber'] . '</td>
- <th class="taC" width="150">姓名</th><td>' . $detail ['username'] . '</td>
- </tr>
- <tr>
- <th class="taC" width="150">办事处/部门</th><td>
-
- <select name="cid_did" id="cid_did">
- ';
-
- foreach ( $categoryList as $key => $value ) {
- $html .= '<option value="' . $value ['cidKey'];
- if (! empty ( $value ['did'] ))
- $html .= '_' . $value ['didKey'];
- $html .= '" ';
-
- if (isset ( $value ['did'] )) {
- if ($detail ['cid'] == $value ['cid'] && $detail ['departmentID'] == $value ['did'])
- $html .= 'selected';
- } else {
- if ($detail ['cid'] == $value ['cid'])
- $html .= 'selected';
- }
-
- $html .= '>' . $value ['title'];
- if (! empty ( $value ['did'] ))
- $html .= '/' . $value ['departmentName'] . '</option>';
- }
-
- $html .= ' </select>
- </td>
- <th class="taC " width="150">岗位</th><td >
- <select name="position_disabled" disabled id="position">
- ';
-
- foreach ( $listPosition as $key => $value ) {
-
- $positionPid = $XDeode->decode ( $value ['pidKey'] );
- if ($detail ['positionId'] == $positionPid) {
- $html .= '<option selected value="' . $value ['pidKey'] . '_' . $value ['positionName'] . '">' . $value ['positionName'] . '</option>';
- } else {
- $html .= '<option value="' . $value ['pidKey'] . '_' . $value ['positionName'] . '">' . $value ['positionName'] . '</option>';
- }
- }
-
- $html .= '
- </select>
- </td>
- </tr>
- <tr>
- <th class="taC" width="150">入职日期</th><td><input type="date" name="hiredate" id="hiredate" value="' . $detail ['hiredate'] . '"></td>
- <th class="taC" width="150">手机</th><td><input type="text" name="telephone" id="telephone" value="' . $detail ['telephone'] . '"></td>
- </tr>
- <tr>
- <th class="taC">QQ</th><td><input type="text" name="qq" id="qq" value="' . $detail ['qq'] . '"></td>
- <th class="taC">微信</th><td><input type="text" name="wecat" id="wecat" value="' . $detail ['wecat'] . '"></td>
- </tr>
- <tr>
- <th class="taC">电话</th><td><input type="text" name="phone" id="phone" value="' . $detail ['phone'] . '"></td>
- <th class="taC">邮箱</th><td><input type="text" name="email" id="email" value="' . $detail ['email'] . '"></td>
- </tr>
- </tbody>
- </table>
- <table class="table table-bordered table-condensed">
- <tr>
- <th class="taC" width="150">性别</th><td width="210">
- <label class="radio inline"><input type="radio" name="gender" ';
- if ($detail ['gender'] == '男')
- $html .= 'checked';
- $html .= ' value="男" data-rule="checked" >男</label>
- <label class="radio inline"><input type="radio" name="gender" ';
- if ($detail ['gender'] == '女')
- $html .= 'checked';
- $html .= ' value="女" >女</label>
- </td>
- <th class="taC" width="150">出生日期</th><td><input type="date" name="birthday" id="birthday" value="' . $detail ['birthday'] . '"></td>
- </tr>
- <tr>
-
-
- <th class="taC" width="150">民族</th><td><input type="text" name="nation" id="nation" value="' . $detail ['nation'] . '"></td>
-
-
- <th class="taC" width="150">婚姻状况</th>
- <td>
- <select name="marriage" id="marriage">
- <option ';
- if ($detail ['marriage'] == '')
- $html .= 'selected';
- $html .= ' value="">请选择</option>
- <option ';
- if ($detail ['marriage'] == '1')
- $html .= 'selected';
- $html .= ' value="1">已婚</option>
- <option ';
- if ($detail ['marriage'] == '0')
- $html .= 'selected';
- $html .= ' value="0">未婚</option>
- </select>
- </td>
- </tr>
-
-
- <tr>
- <th class="taC" width="150">身份证</th>
- <td><input type="text" name="IDcards" id="IDcards" value="' . $detail ['IDcards'] . '"></td>
-
- <th class="taC" width="150">身份证有效期</th><td colspan="3">
- <input type="date" name="IDcardsValidity" id="IDcardsValidity" value="' . $detail ['IDcardsValidity'] . '"></td>
- </tr>
-
- <tr>
-
- <th class="taC" width="150">身份证扫描件</th>
- <td>
- <a href="' . $detail ['IDcardsImgA'] . '"
- target="_blank">正面(国徽)</a>
- <a href="' . $detail ['IDcardsImgB'] . '"
- target="_blank">反面(照片)</a>
- </td>
-
- <th class="taC" width="150">籍贯</th>
- <td width="210"><input type="text" name="nativePlace" id="nativePlace" value="' . $detail ['nativePlace'] . '"></td>
- </tr>
-
- <tr>
- <th class="taC" width="150">户口所在地</th><td><input type="text" name="registeredResidence" id="registeredResidence" value="' . $detail ['registeredResidence'] . '" ></td>
- <th class="taC" width="150">户籍类型</th><td>
- <select name="householdRegistrationType" id="householdRegistrationType">
-
- <option ';
- if ($detail ['householdRegistrationType'] == '')
- $html .= 'selected';
- $html .= ' value="">请选择</option>
- <option ';
- if ($detail ['householdRegistrationType'] == '城镇户口')
- $html .= 'selected';
- $html .= ' value="城镇户口">城镇户口</option>
- <option ';
- if ($detail ['householdRegistrationType'] == '农业户口')
- $html .= 'selected';
- $html .= ' value="农业户口">农业户口</option>
-
- </select></td>
- </tr>
-
- <tr>
- <th class="taC" width="150">现居住地</th>
- <td colspan="3"><input type="text" name="living" id="living" value="' . $detail ['living'] . '" style="width:500px"></td>
- </tr>
-
- <tr>
-
- <th class="taC" width="150">紧急联系人</th>
- <td><input type="text" name="emergencyContacts" id="emergencyContacts" value="' . $detail ['emergencyContacts'] . '"></td>
- </tr>
-
-
- </table>
- <table class="table table-bordered table-condensed">
-
- <tr>
- <th class="taC" width="150">毕业院校</th><td width="210">
- <input type="text" name="graduateInstitutions" id="graduateInstitutions" value="' . $detail ['graduateInstitutions'] . '"></td>
- <th class="taC" width="150">所学专业</th><td>
- <input type="text" name="major" id="major" value="' . $detail ['major'] . '"></td>
- </tr>
-
- <tr><th class="taC" width="150">毕业学历</th>
- <td><select name="education" id="education">
-
- <option ';
- if ($detail ['education'] == '')
- $html .= 'selected';
- $html .= ' value="">请选择</option>
- <option ';
- if ($detail ['education'] == '初中')
- $html .= 'selected';
- $html .= ' value="初中">初中</option>
- <option ';
- if ($detail ['education'] == '高中')
- $html .= 'selected';
- $html .= ' value="高中">高中</option>
- <option ';
- if ($detail ['education'] == '中专')
- $html .= 'selected';
- $html .= ' value="中专">中专</option>
- <option ';
- if ($detail ['education'] == '大专')
- $html .= 'selected';
- $html .= ' value="大专">大专</option>
- <option ';
- if ($detail ['education'] == '本科')
- $html .= 'selected';
- $html .= ' value="本科">本科</option>
- <option ';
- if ($detail ['education'] == '硕士')
- $html .= 'selected';
- $html .= ' value="硕士">硕士</option>
-
-
-
-
- </select>
- </td>
- <th class="taC" width="150">毕业时间</th>
- <td><input type="date" name="graduationTime" id="graduationTime" value="' . $detail ['graduationTime'] . '"></td>
- </tr>
-
- <tr>
- <th class="taC" width="150">毕业证书</th>
- <td width="210">';
-
- foreach ( $detail ['certificateArray'] as $key => $value ) {
- $html .= '<a href="' . $detail ['webSite'] . $value . '" target="_blank">毕业证书</a> ';
- }
-
- $html .= '</td>
- <th class="taC" width="150">学位证书</th>
- <td>';
- foreach ( $detail ['diplomaArray'] as $key => $value ) {
- $html .= '<a href="' . $detail ['webSite'] . $value . '" target="_blank">学位证书</a> ';
- }
-
- $html .= ' </td>
- </tr>
- <tr>
- <th class="taC" width="150">职称</th>
- <td >';
- foreach ( $detail ['professionalTitleArray'] as $key => $value ) {
- $html .= '<a href="' . $detail ['webSite'] . $value . '" target="_blank">证书</a> ';
- }
- $html .= '</td>
- <th class="taC" width="150">最高学历</th><td>
- <select name="qualifications" id="qualifications">
- <option ';
- if ($detail ['qualifications'] == '初中')
- $html .= 'selected';
- $html .= ' value="初中">初中</option>
- <option ';
- if ($detail ['qualifications'] == '高中')
- $html .= 'selected';
- $html .= ' value="高中">高中</option>
- <option ';
- if ($detail ['qualifications'] == '中专')
- $html .= 'selected';
- $html .= ' value="中专">中专</option>
- <option ';
- if ($detail ['qualifications'] == '大专')
- $html .= 'selected';
- $html .= ' value="大专">大专</option>
- <option ';
- if ($detail ['qualifications'] == '本科')
- $html .= 'selected';
- $html .= ' value="本科">本科</option>
- <option ';
- if ($detail ['qualifications'] == '硕士')
- $html .= 'selected';
- $html .= ' value="硕士">硕士</option>
- </select>
- </td>
- </tr>
- </table>
-
-
- <table class="table table-bordered table-condensed">
- <tr><th class="taC" colspan="4">报销收款帐号</th></tr>
- <tr>
- <th class="taC" width="150">汇款人户名</th>
- <td width="210"><input type="text" name="remittanceName" id="remittanceName" value="' . $detail ['remittanceName'] . '"></td>
- <th class="taC" width="150">联行号</th>
- <td colspan="3"><input type="text" name="coupletNumber" id="coupletNumber" value="' . $detail ['coupletNumber'] . '"></td>
- </tr>
- <tr>
- <th class="taC" width="150">汇款开户银行名称</th>
- <td width="210">
- <input type="text" name="bankName" id="bankName" value="' . $detail ['bankName'] . '">
- </td>
- <th class="taC" width="150">汇款帐号</th>
- <td><input type="text" name="bankNumber" id="bankNumber" value="' . $detail ['bankNumber'] . '"></td>
- </tr>
-
- </table>
-
- <table class="table table-bordered table-condensed">
- <tr><th class="taC" colspan="4">工资卡</th></tr>
- <tr>
- <th class="taC" width="150">银行卡号</th>
- <td width="210"><input name="salaryCard" id="salaryCard" value="' . $detail ['salaryCard'] . '" type="text"></td>
- <th class="taC" width="150">开户行</th>
- <td><input name="salaryBank" id="salaryBank" value="' . $detail ['salaryBank'] . '" type="text"></td>
- </tr>
- </table>
-
-
-
- </div>
-
-
-
- <div class="fL staff-detail-side">
- <!--入职试用 & 离职后再入职试用-->
- ';
-
- foreach ( $SOPL as $key => $value ) {
- $html .= '<div class="infoFlowList">
- <div class="dateTitle">
- <em class="month"><span class="num">' . date ( 'm', strtotime ( $value ['date'] ) ) . '</span><span class="text">-' . date ( 'd', strtotime ( $value ['date'] ) ) . '</span></em>
- <span class="year">' . date ( 'Y', strtotime ( $value ['date'] ) ) . '</span>
- </div>
- <ul class="flowList">
- <li class="item colGray">' . $value ['category'] . '-' . $value ['username'] . '</li>
- <li class="item">' . $value ['operation'] . '</li>
- </ul>
- </div>';
- }
-
- $html .= '
-
- </div>
- </div>
-
- ';
- }
-
- echo json_encode ( array (
- 'status' => 1,
- 'sidKey' => $serial,
- 'html' => $html
- ) );
- die ();
- } elseif ($type == 'IRTC') {
-
- Doo::loadModel ( 'invoice' );
- $invoice = new invoice ();
- Doo::loadModel ( 'invoiceOperationLog' );
- $invoiceOperationLog = new invoiceOperationLog ();
- Doo::loadModel ( 'invoiceReceivables' );
- $invoiceReceivables = new invoiceReceivables ();
-
- $detail = $invoice->getInvoiceByIsid ( $serial, $this->staff [0] ['sid'] );
- $invoiceOperationLogList = $invoiceOperationLog->getInvoiceOperationLogByIid ( $detail ['iid'] );
-
- if (empty ( $detail ))
- $html = '';
- else {
-
- $receivablesPriceedHtml = '';
- $receivablesPrice = $detail ['invoicePrice'];
- if (! empty ( $detail ['irid'] )) {
-
- $irList = $invoiceReceivables->getInvoiceReceivablesInIridString ( $detail ['irid'] );
-
- if (empty ( $irList ))
- $irList [0] ['sumPrice'] = 0;
-
- $balance = $detail ['invoicePrice'] - $irList [0] ['sumPrice'];
-
- $receivablesPriceedHtml = '<table class="table table-bordered table-condensed"><tbody><tr>
-
- <th class="taC">已入账金额</th><td><b class="colGreen" style="font-size:18px">¥' . $irList [0] ['sumPrice'] . '</b></td>
- <th class="taC">剩余入账金额</th><td><b class="colRed" style="font-size:18px">¥' . $balance . '</b></td>
-
- </tr></tbody></table>';
- $receivablesPrice = $balance;
- }
-
- if ($loss)
- $detail ['invoicePrice'] = - $detail ['invoicePrice'];
- $html = $receivablesPriceedHtml . '
- <table class="table table-bordered table-condensed"><tbody>
- <tr>
- <th class="taC" width="150">开票流水号</th><td>' . $detail ['invoiceSerial'] . '</td>
- <th class="taC" width="150">提交时间</th><td>' . $detail ['date'] . '</td>
- </tr>
- <tr>
- <th class="taC" width="150">所在办事处</th><td>' . $detail ['categoryName'] . '(' . $detail ['userName'] . ')</td>
- <th class="taC" width="150">开票内容</th><td>' . $detail ['invoiceElement'] . '</td>
- </tr>
-
- <tr>
- <th class="taC" width="150">发票备注</th><td colspan="3">' . $detail ['remark'] . '</td>
- </tr>
-
- <tr>
- <th class="taC" width="150">数量</th><td><b>' . $detail ['invoiceQuantity'] . '</b></td>
- <th class="taC">单价</th><td><b>¥' . $detail ['invoiceUnitPrice'] . '</b></td>
- </tr>
-
- <tr>
- <th class="taC">开票金额</th><td colspan="3"><b class="colOrange" style="font-size:18px">¥' . $detail ['invoicePrice'] . '</b></td>
-
- </tr></tbody></table>';
-
- if ($detail ['invoiceType'] == 0) {
- $html .= '<table class="table table-bordered table-condensed"><tbody>
- <tr><th colspan="4" class="taC">增值税普通发票</th></tr><tr>
- <th class="taC" width="150">发票抬头</th><td >' . $detail ['invoiceTitle'] . '</td>
- <th class="taC" width="150">纳税人识别码</th><td>' . $detail ['TIN'] . '</td>
- </tr>';
- $receivablesMessage = $detail ['invoiceTitle'];
- } else {
- $html .= '<table class="table table-bordered table-condensed"><tbody>
- <tr><th colspan="4" class="taC">增值税专用发票</th></tr><tr>
- <th class="taC" width="150">单位名称</th><td>' . $detail ['invoiceCompany'] . '</td>
- <th class="taC" width="150">纳税人识别码</th><td>' . $detail ['TIN'] . '</td></tr>
-
- ';
- $receivablesMessage = $detail ['invoiceCompany'];
- }
- $html .= '<tr>
- <th class="taC">注册地址</th><td>' . $detail ['address'] . '</td>
- <th class="taC">注册电话</th><td>' . $detail ['phone'] . '</td>
- </tr>
- <tr>
- <th class="taC">开户银行</th><td>' . $detail ['bankAccount'] . '</td>
- <th class="taC">银行账号</th><td>' . $detail ['bank'] . '</td>
- </tr></tbody></table>';
-
- if ($detail ['doPost'] == 1)
- $html .= '<table class="table table-bordered table-condensed"><tbody><tr><th colspan="4" class="taC">邮寄信息</th></tr><tr>
- <th class="taC" width="150">收件人</th><td>' . $detail ['recipients'] . '</td>
- <th class="taC" width="150">收件人手机/电话</th><td>' . $detail ['recipientsPhone'] . '</td>
- </tr><tr>
- <th class="taC" width="150">收件地址</th><td colspan="3">' . $detail ['recipientsAddress'] . '</td>
- </tr><tr>
- <th class="taC" width="150">邮寄物品</th><td colspan="3">' . $detail ['mailItems'] . '</td>
- </tr></tbody></table>';
- if (! empty ( $invoiceOperationLogList )) {
- $html .= '<table class="table table-bordered table-condensed"><tbody><tr><th width="60%" class="taC">审批流程</th></tr><tr><td>';
- foreach ( $invoiceOperationLogList as $key => $value ) {
- if ($value ['status'] == 1 || $value ['status'] == 2 || $value ['status'] == 3 || $value ['status'] == 4) {
- $html .= '<blockquote><p><span class="colGray">' . $value ['date'] . '</span>
- ' . $value ['category'] . '-' . $value ['username'] . ' ';
- if ($value ['status'] == 2) {
- $html .= '<span class="colGreen">同意</span>';
- } elseif ($value ['status'] == 3) {
- $html .= '<span class="colOrange">退回</span>';
- } elseif ($value ['status'] == 5) {
- $html .= '<span class="colGreen">打印</span>';
- }
- $html .= $value ['operation'] . '</p></blockquote>';
- }
- }
- $html .= '</td></tr></tbody></table>';
- }
- }
-
- echo json_encode ( array (
- 'status' => 1,
- 'html' => $html,
- 'receivablesPrice' => $receivablesPrice,
- 'receivablesMessage' => $receivablesMessage,
- 'receivablesDate' => date ( "Y-m-d" ),
- 'iidKey' => $serial
- ) );
- die ();
- }
- }
-
- /**
- * 获得客户地区
- */
- function ajaxGetDistrictByLv1() {
- $serial = $this->get_args ( 'serial' ) ? $this->get_args ( 'serial' ) : "";
-
- if (empty ( $serial )) {
- echo json_encode ( array (
- 'status' => 2,
- 'msg' => 'illegal request'
- ) );
- die ();
- }
-
- Doo::loadClass ( 'XDeode' );
- $XDeode = new XDeode ( 5 );
- Doo::loadModel ( 'staff' );
- $staff = new staff ();
-
- $sid = $XDeode->decode ( $serial );
- $detail = $staff->getStaffBySid ( $sid );
-
- // 员工可选的
- Doo::loadModel ( 'district' );
- $district = new district ();
- $districtList = $district->get_lv ( 1 );
-
- $did = explode ( ',', $detail ['did'] );
-
- $html = '<label class="checkbox inline"> <input type="checkbox" id="clickALL" >全选</label>';
- foreach ( $districtList as $key => $value ) {
- $falg = true;
- foreach ( $did as $k => $v ) {
- if ($value ['didKey'] == $v) {
- $html .= '<label class="checkbox inline">
- <input type="checkbox" name="didKey[]" checked value="' . $value ['didKey'] . '">' . $value ['name'] . '
- </label>';
- unset ( $did [$k] );
- $falg = false;
- break;
- }
- }
-
- if ($falg)
- $html .= '<label class="checkbox inline">
- <input type="checkbox" name="didKey[]" value="' . $value ['didKey'] . '">' . $value ['name'] . '
- </label>';
- }
- $html .='
- <script type="text/javascript">
- $(function() {
- $(\'input[id="clickALL"]\').click(function(){
-
- //console.log(this.checked);
- if(this.checked){
- $(\'input[name="didKey[]"]\').each(function(){
- //此处如果用attr,会出现第三次失效的情况
- $(this).prop("checked",true);
- });
- }else{
- $(\'input[name="didKey[]"]\').each(function(){
- $(this).removeAttr("checked",false);
- });
- }
-
- });
- })
- </script>
- ';
-
-
- echo json_encode ( array (
- 'status' => 1,
- 'html' => $html
- ) );
- }
-
- /**
- */
- function ajaxGetPromotionStaffByPid() {
- $sidkey = $this->get_args ( 'sidkey' ) ? $this->get_args ( 'sidkey' ) : "";
-
- Doo::loadModel ( 'staff' );
- $staff = new staff ();
- Doo::loadModel ( 'position' );
- $position = new position ();
-
- $listPosition = $position->getPositionByAll ();
- $detail = $staff->getStaffBySid ( $sidkey );
-
- // print_r($deta);
- $html = '<table class="table table-bordered table-condensed">
- <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'];
-
- if (! empty ( $detail ['department'] ))
- $html .= '/' . $detail ['department'] ['departmentName'];
-
- $html .= ' </td>
- <th class="taC" width="150">岗位</th><td>' . $detail ['positionDetail'] ['positionName'] . '</td>
- </tr>
- <tr>
- <th class="taC" width="150">入职日期</th><td>' . $detail ['hiredate'] . ' <span class="colGray">已入职' . $detail ['workforce'] . '天</span></td>
- <th class="taC" width="150">试用日期</th><td>2013-07-01</td>
- </tr>
- <tr>
- <th class="taC" width="150">基本工资</th><td>' . $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>';
- echo json_encode ( array (
- 'status' => 1,
- 'detail' => $detail,
- 'html' => $html
- ) );
- }
-
- /**
- * 生成工号
- */
- function createJobNumber() {
- Doo::loadModel ( 'staff' );
- $staff = new staff ();
-
- $regularStaff = $staff->getStaffJobNumberByNature ( 1 );
- $internStaff = $staff->getStaffJobNumberByInformal ();
-
- if (empty ( $regularStaff ['jobNumber'] ))
- $regularStaffJobNumber = 'Z0001';
- else {
- $jobNumber = preg_replace ( '/[^\.0123456789]/s', '', $regularStaff ['jobNumber'] );
- $regularStaffJobNumber = 'Z' . sprintf ( "%04d", $jobNumber + 1 );
- }
-
- $internStaffJobNumber = $internStaff ['jobNumber'];
- if (empty ( $internStaff ['jobNumber'] ))
- $internStaffJobNumber = 'C0001';
- else {
- $jobNumber = preg_replace ( '/[^\.0123456789]/s', '', $internStaff ['jobNumber'] );
- $internStaffJobNumber = 'C' . sprintf ( "%04d", $jobNumber + 1 );
- }
- $list = array (
- 'regularStaff' => $regularStaffJobNumber,
- 'internStaff' => $internStaffJobNumber
- );
- return $list;
- }
-
- /**
- * 微信抄送功能
- * @param unknown $rid
- * @param string $typeMsg
- */
- function setWXMsg($sid, $msg = '', $msgtype = 'text') {
- Doo::loadModel ( 'staff' );
- $staff = new staff ();
- $staffmsg = $staff->getOne ( array (
- 'where' => "sid='" . $sid . "'",
- 'asArray' => TRUE
- ) );
-
- if (! empty ( $staffmsg ['wxid'] )) {
- require_once (SITE_PATH . '/protected/class/client.php');
- $client = new client ( 'http://m.cld.smartcost.com.cn/' );
- $user = $staffmsg ['wxid'];
-
- $result = $client->SendMsg ( $user, $msg, $msgtype );
- }
- }
-
- /**
- * 获取get或者POST值
- *
- * @param string $name 属性名称
- * @return fixed 值
- */
- function get_args($name) {
- if (isset ( $_GET [$name] )) {
- if (is_array ( $_GET [$name] ))
- return $_GET [$name];
- else
- return addslashes ( $_GET [$name] );
- } elseif (isset ( $_POST [$name] )) {
- if (is_array ( $_POST [$name] ))
- return $_POST [$name];
- else
- return addslashes ( $_POST [$name] );
- } else
- return false;
- }
-
- // 检查年假是否过期并更新年假
- private function updateAnnualLeave($staff) {
- Doo::loadModel ( 'holidaystaff' );
- $hstaff = new HStaff ();
- $hstaffmsg = $hstaff->getOne ( array (
- 'where' => 'uid=' . $staff ['sid'],
- 'asArray' => TRUE
- ) );
-
- $hiredate = $staff ['hiredate'];
- $hadyear = intval ( (time () - strtotime ( $hiredate )) / (86400 * 365) );
- if ($hadyear != $hstaffmsg ['hadyear']) {
- $hstaff->uid = $staff ['sid'];
- $hstaff->hadyear = $hadyear;
- $hstaff->yearnum = $hadyear == 0 ? 0 : (($hadyear < 10 && $hadyear >= 1) ? 5 : (($hadyear >= 10 && $hadyear < 20) ? 10 : 15));
- $hstaff->update ();
- }
- }
-
- /**
- * 计算工龄
- * @param string $seniorityFormula
- */
- function getSeniority($seniorityFormula = '') {
- if (! empty ( $seniorityFormula )) {
- $Days = 0;
- foreach ( $seniorityFormula as $key => $value ) {
- $Date_1 = $value ['InductionDate'];
- $Date_2 = $value ['dimissionDate'];
- $d1 = strtotime ( $Date_1 );
- $d2 = strtotime ( $Date_2 );
- $D = round ( ($d2 - $d1) / 3600 / 24 );
- $Days += $D;
- }
- return $Days;
- }
- return 0;
- }
-
- /**
- * 员工主访问权限
- */
- function isEmployeeVisit($employee = array()) {
- Doo::loadModel ( 'staff' );
- $staff = new staff ();
-
- $staff->getStaffBySid ( $this->staff ['sid'] );
-
- $access = explode ( ',', $employee ['access'] );
- }
- }
- ?>
|