|
@@ -419,6 +419,14 @@ class HolidayController extends DooController {
|
|
|
|
|
|
$data['internstafflist'] = $staff->find(array('where' => 'nature=2', 'asArray' => TRUE));
|
|
|
|
|
|
+ //获取上月和本月,录用 实习生上班天数
|
|
|
+ $nowmonth = intval(date('m',time()));
|
|
|
+ $nowday = date('Y-m-d',time());
|
|
|
+ $lastmonth = intval(date('m',strtotime("-1 month")));
|
|
|
+ $lastmonthday = date('Y-m-d',strtotime("-1 month"));
|
|
|
+ $data['monthlist'] = '<option value="0">选择月份</option><option value="'.$lastmonthday.'">'.$lastmonth.'月</option><option value="'.$nowday.'">'.$nowmonth.'月</option>';
|
|
|
+
|
|
|
+
|
|
|
$data ['memu'] = 'holiday';
|
|
|
$data ['holidaymenu'] = 'close';
|
|
|
$data ['staff'] = $this->staff;
|
|
@@ -457,7 +465,7 @@ class HolidayController extends DooController {
|
|
|
return '/holidayclose';
|
|
|
}
|
|
|
}elseif($_POST['type'] == 14){
|
|
|
- $thismonth = $this->getMonthTime(date('Y-m-d',time()));
|
|
|
+ $thismonth = $this->getMonthTime($_POST['monthselect']);
|
|
|
$holiday->uid = $_POST['uid'];
|
|
|
$holiday->type = $_POST['type'];
|
|
|
$holiday->starttime = $thismonth['start'];
|
|
@@ -697,7 +705,8 @@ class HolidayController extends DooController {
|
|
|
$cidstafflist = $staff->getStaffByCid($v['cid']);
|
|
|
foreach($cidstafflist as $ck => $cv){
|
|
|
$hstaffmsg = $hstaff->getOne(array('where' => 'uid='.$cv['sid'], 'asArray' => TRUE));
|
|
|
- $cidstafflist[$ck]['yearnum'] = $cv['nature'] == 1 ? ($hstaffmsg['yearnum'] != 0.0 ? floatval($hstaffmsg['yearnum']) : '') : '';
|
|
|
+ $yearnum = $this->CheckAnnualLeave($cv);
|
|
|
+ $cidstafflist[$ck]['yearnum'] = floatval($yearnum) != 0 ? floatval($yearnum) : '';
|
|
|
$cidstafflist[$ck]['addnum'] = $hstaffmsg['addnum'] != 0.0 ? floatval($hstaffmsg['addnum']) : '';
|
|
|
$cidstafflist[$ck]['hunjianum'] = $hstaffmsg['hunjianum'] != 0.0 ? floatval($hstaffmsg['hunjianum']) : '';
|
|
|
$cidstafflist[$ck]['chanjianum'] = $hstaffmsg['chanjianum'] != 0.0 ? floatval($hstaffmsg['chanjianum']) : '';
|
|
@@ -717,7 +726,8 @@ class HolidayController extends DooController {
|
|
|
$cidstafflist = $staff->getStaffByCid($v['cid']);
|
|
|
foreach($cidstafflist as $ck => $cv){
|
|
|
$hstaffmsg = $hstaff->getOne(array('where' => 'uid='.$cv['sid'], 'asArray' => TRUE));
|
|
|
- $cidstafflist[$ck]['yearnum'] = $cv['nature'] == 1 ? ($hstaffmsg['yearnum'] != 0.0 ? floatval($hstaffmsg['yearnum']) : '') : '';
|
|
|
+ $yearnum = $this->CheckAnnualLeave($cv);
|
|
|
+ $cidstafflist[$ck]['yearnum'] = floatval($yearnum) != 0 ? floatval($yearnum) : '';
|
|
|
$cidstafflist[$ck]['addnum'] = $hstaffmsg['addnum'] != 0.0 ? floatval($hstaffmsg['addnum']) : '';
|
|
|
$cidstafflist[$ck]['hunjianum'] = $hstaffmsg['hunjianum'] != 0.0 ? floatval($hstaffmsg['hunjianum']) : '';
|
|
|
$cidstafflist[$ck]['chanjianum'] = $hstaffmsg['chanjianum'] != 0.0 ? floatval($hstaffmsg['chanjianum']) : '';
|
|
@@ -879,6 +889,31 @@ class HolidayController extends DooController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ //检查年假是否过期并更新年假
|
|
|
+ private function CheckAnnualLeave($staff){
|
|
|
+ if($staff['nature'] == 2){
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ $hiredate = $staff['hiredate'];
|
|
|
+ if($hiredate == ''){
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ Doo::loadModel('holidaystaff');
|
|
|
+ $hstaff = new HStaff();
|
|
|
+ $hstaffmsg = $hstaff->getOne(array('where' => 'uid='.$staff['sid'],'asArray' => TRUE));
|
|
|
+ $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();
|
|
|
+ $daynum = $hadyear == 0 ? 0 : (($hadyear < 10 && $hadyear >= 1) ? 5 : (($hadyear >= 10 && $hadyear < 20) ? 10 : 15));
|
|
|
+ }else{
|
|
|
+ $daynum = $hstaffmsg['yearnum'];
|
|
|
+ }
|
|
|
+ return $daynum;
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
?>
|