Преглед на файлове

修改高教津补贴判断和计算方法

sugangqiang преди 7 месеца
родител
ревизия
120bdb5baf
променени са 2 файла, в които са добавени 129 реда и са изтрити 60 реда
  1. 63 28
      app/admin/controller/TalentAllowance.php
  2. 66 32
      app/common/api/TalentAllowanceApi.php

+ 63 - 28
app/admin/controller/TalentAllowance.php

@@ -1258,21 +1258,11 @@ class TalentAllowance extends AdminController {
             //$set = array_intersect($set, $taxSet);
         } else if ($info["type"] == CommonConst::ENTERPRISE_GJ) {
             if ($info["backWork"] == 1) {
-                $str = "工资发放月份、个税缴交月份";
+                $set = array_intersect($set, $workdaySet);
                 $set = array_intersect($set, $wageSet);
-                $set = array_intersect($set, $taxSet);
-                $checkSet = $set;
-                //$set = array_intersect($set, $contractSet);
-                //$set = array_intersect($set, $pensionSet);
-                //$set = array_intersect($set, $workdaySet);
             } else {
-                $str = "养老保险缴交月份、工资发放月份、个税缴交月份";
-                $set = array_intersect($set, $pensionSet);
+                $set = array_intersect($set, $workdaySet);
                 $set = array_intersect($set, $wageSet);
-                $set = array_intersect($set, $taxSet);
-                $checkSet = $set;
-                //$set = array_intersect($set, $contractSet);
-                //$set = array_intersect($set, $workdaySet);
             }
         } else {
             $set = array_intersect($set, $contractSet);
@@ -1288,29 +1278,74 @@ class TalentAllowance extends AdminController {
             return (int) $a - (int) $b;
         });
         if ($info["recommendAllowanceType"] == 1) {
-            if (count($checkSet) < 6) {
-                //如果全部满足6个月,但是重叠时间不满足6个月,开始检测是否符合交通补贴要求
-                $info["recommendAllowanceType"] = 3;
-                $info["recommendAllowanceMsg"] = $info["recommendAllowanceMsg"] . "\n上年度{$str}交集月份不满足6个月(" . implode(",", $checkSet) . "),无法享受工作津贴(×)";
-            } else {
-                //检查连续缴纳月份是否满足6个月
-                $count = 1;
-                foreach ($checkSet as $s) {
+            if ($info["type"] == CommonConst::ENTERPRISE_GJ) {
+                //高教另外判断                
+                $taxCount = 1;
+                foreach ($taxSet as $s) {
                     $currentVal = intval($s);
                     $nextVal = $currentVal + 1;
                     $nextKey = str_pad($nextVal, 2, "0", STR_PAD_LEFT);
-                    if (in_array($nextKey, $checkSet)) {
-                        $count++;
-                        if ($count >= 6) {
+                    if (in_array($nextKey, $taxSet)) {
+                        $taxCount++;
+                        if ($taxCount >= 2) {
                             break;
                         }
                     } else {
-                        $count = 1;
+                        $taxCount = 1;
+                    }
+                }
+                if ($info["backWork"] == 1) {
+                    //需要判断缴税有没有连续两个月以上
+                    if ($taxCount < 2) {
+                        $info["recommendAllowanceType"] = 3;
+                        $info["recommendAllowanceMsg"][] = "上年度个税缴纳月份不满足连续缴纳2个月(" . implode(",", $taxSet) . "),无法享受工作津贴(×)";
+                    }
+                } else {
+                    //需要判断缴税或者养老有没有连续两个月以上
+                    $pensionCount = 1;
+                    foreach ($pensionSet as $s) {
+                        $currentVal = intval($s);
+                        $nextVal = $currentVal + 1;
+                        $nextKey = str_pad($nextVal, 2, "0", STR_PAD_LEFT);
+                        if (in_array($nextKey, $pensionSet)) {
+                            $pensionCount++;
+                            if ($pensionCount >= 2) {
+                                break;
+                            }
+                        } else {
+                            $pensionCount = 1;
+                        }
+                    }
+                    if ($taxCount < 2 && $pensionCount < 2) {
+                        $info["recommendAllowanceType"] = 3;
+                        $info["recommendAllowanceMsg"][] = "上年度个税缴纳月份(" . implode(",", $taxSet) . ")与养老保险缴纳月份(" . implode(",", $pensionSet) . ")均不满足连续缴纳2个月,无法享受工作津贴(×)";
                     }
                 }
-                if ($count < 6) {
+            } else {
+                if (count($checkSet) < 6) {
+                    //如果全部满足6个月,但是重叠时间不满足6个月,开始检测是否符合交通补贴要求
                     $info["recommendAllowanceType"] = 3;
-                    $info["recommendAllowanceMsg"] = $info["recommendAllowanceMsg"] . "\n上年度{$str}不满足连续缴纳6个月(" . implode(",", $checkSet) . "),无法享受工作津贴(×)";
+                    $info["recommendAllowanceMsg"] = $info["recommendAllowanceMsg"] . "\n上年度{$str}交集月份不满足6个月(" . implode(",", $checkSet) . "),无法享受工作津贴(×)";
+                } else {
+                    //检查连续缴纳月份是否满足6个月
+                    $count = 1;
+                    foreach ($checkSet as $s) {
+                        $currentVal = intval($s);
+                        $nextVal = $currentVal + 1;
+                        $nextKey = str_pad($nextVal, 2, "0", STR_PAD_LEFT);
+                        if (in_array($nextKey, $checkSet)) {
+                            $count++;
+                            if ($count >= 6) {
+                                break;
+                            }
+                        } else {
+                            $count = 1;
+                        }
+                    }
+                    if ($count < 6) {
+                        $info["recommendAllowanceType"] = 3;
+                        $info["recommendAllowanceMsg"] = $info["recommendAllowanceMsg"] . "\n上年度{$str}不满足连续缴纳6个月(" . implode(",", $checkSet) . "),无法享受工作津贴(×)";
+                    }
                 }
             }
         }
@@ -1457,9 +1492,9 @@ class TalentAllowance extends AdminController {
         }
         if ($info["type"] == CommonConst::ENTERPRISE_GJ) {
             if ($info["backWork"] == 1) {
-                $preCheckProjects = ["③", "⑦"];
+                $preCheckProjects = ["②", "③"];
             } else {
-                $preCheckProjects = ["③", "④", "⑦"];
+                $preCheckProjects = ["②", "③"];
             }
         }
         if ($info["recommendAllowanceType"] == 1 && (!$set || count($set) < 6) && in_array($sort, $preCheckProjects)) {

+ 66 - 32
app/common/api/TalentAllowanceApi.php

@@ -230,7 +230,7 @@ class TalentAllowanceApi {
             $info["recommendAllowanceMsg"][] = "<span style='color:red;font-weight:bold;'>一次性交通补贴</span>;";
         if ($info["recommendAllowanceType"] == 3)
             $info["recommendAllowanceMsg"][] = "<span style='color:red;font-weight:bold;'>不予兑现</span>;";
-        usort($set, function($a, $b) {
+        usort($set, function ($a, $b) {
             return (int) $a - (int) $b;
         });
         $info["recommendMonths"] = implode(",", $set);
@@ -261,21 +261,11 @@ class TalentAllowanceApi {
             //$set = array_intersect($set, $taxSet);
         } else if ($info["type"] == CommonConst::ENTERPRISE_GJ) {
             if ($info["backWork"] == 1) {
-                $str = "工资发放月份、个税缴交月份";
+                $set = array_intersect($set, $workdaySet);
                 $set = array_intersect($set, $wageSet);
-                $set = array_intersect($set, $taxSet);
-                $checkSet = $set;
-                //$set = array_intersect($set, $contractSet);
-                //$set = array_intersect($set, $pensionSet);
-                //$set = array_intersect($set, $workdaySet);
             } else {
-                $str = "养老保险缴交月份、工资发放月份、个税缴交月份";
-                $set = array_intersect($set, $pensionSet);
+                $set = array_intersect($set, $workdaySet);
                 $set = array_intersect($set, $wageSet);
-                $set = array_intersect($set, $taxSet);
-                $checkSet = $set;
-                //$set = array_intersect($set, $contractSet);
-                //$set = array_intersect($set, $workdaySet);
             }
         } else {
             $set = array_intersect($set, $contractSet);
@@ -287,33 +277,78 @@ class TalentAllowanceApi {
             $set = array_intersect($set, $medicaSet);
             $set = array_intersect($set, $taxSet);
         }
-        usort($set, function($a, $b) {
+        usort($set, function ($a, $b) {
             return (int) $a - (int) $b;
         });
         if ($info["recommendAllowanceType"] == 1) {
-            if (count($checkSet) < 6) {
-                //如果全部满足6个月,但是重叠时间不满足6个月,开始检测是否符合交通补贴要求
-                $info["recommendAllowanceType"] = 3;
-                $info["recommendAllowanceMsg"][] = "上年度{$str}交集月份不满足6个月(" . implode(",", $checkSet) . "),无法享受工作津贴(×)";
-            } else {
-                //检查连续缴纳月份是否满足6个月
-                $count = 1;
-                foreach ($checkSet as $s) {
+            if ($info["type"] == CommonConst::ENTERPRISE_GJ) {
+                //高教另外判断                
+                $taxCount = 1;
+                foreach ($taxSet as $s) {
                     $currentVal = intval($s);
                     $nextVal = $currentVal + 1;
                     $nextKey = str_pad($nextVal, 2, "0", STR_PAD_LEFT);
-                    if (in_array($nextKey, $checkSet)) {
-                        $count++;
-                        if ($count >= 6) {
+                    if (in_array($nextKey, $taxSet)) {
+                        $taxCount++;
+                        if ($taxCount >= 2) {
                             break;
                         }
                     } else {
-                        $count = 1;
+                        $taxCount = 1;
+                    }
+                }
+                if ($info["backWork"] == 1) {
+                    //需要判断缴税有没有连续两个月以上
+                    if ($taxCount < 2) {
+                        $info["recommendAllowanceType"] = 3;
+                        $info["recommendAllowanceMsg"][] = "上年度个税缴纳月份不满足连续缴纳2个月(" . implode(",", $taxSet) . "),无法享受工作津贴(×)";
+                    }
+                } else {
+                    //需要判断缴税或者养老有没有连续两个月以上
+                    $pensionCount = 1;
+                    foreach ($pensionSet as $s) {
+                        $currentVal = intval($s);
+                        $nextVal = $currentVal + 1;
+                        $nextKey = str_pad($nextVal, 2, "0", STR_PAD_LEFT);
+                        if (in_array($nextKey, $pensionSet)) {
+                            $pensionCount++;
+                            if ($pensionCount >= 2) {
+                                break;
+                            }
+                        } else {
+                            $pensionCount = 1;
+                        }
+                    }
+                    if ($taxCount < 2 && $pensionCount < 2) {
+                        $info["recommendAllowanceType"] = 3;
+                        $info["recommendAllowanceMsg"][] = "上年度个税缴纳月份(" . implode(",", $taxSet) . ")与养老保险缴纳月份(" . implode(",", $pensionSet) . ")均不满足连续缴纳2个月,无法享受工作津贴(×)";
                     }
                 }
-                if ($count < 6) {
+            } else {
+                if (count($checkSet) < 6) {
+                    //如果全部满足6个月,但是重叠时间不满足6个月,开始检测是否符合交通补贴要求
                     $info["recommendAllowanceType"] = 3;
-                    $info["recommendAllowanceMsg"][] = "上年度{$str}交集月份不满足连续缴纳6个月(" . implode(",", $checkSet) . "),无法享受工作津贴(×)";
+                    $info["recommendAllowanceMsg"][] = "上年度{$str}交集月份不满足6个月(" . implode(",", $checkSet) . "),无法享受工作津贴(×)";
+                } else {
+                    //检查连续缴纳月份是否满足6个月
+                    $count = 1;
+                    foreach ($checkSet as $s) {
+                        $currentVal = intval($s);
+                        $nextVal = $currentVal + 1;
+                        $nextKey = str_pad($nextVal, 2, "0", STR_PAD_LEFT);
+                        if (in_array($nextKey, $checkSet)) {
+                            $count++;
+                            if ($count >= 6) {
+                                break;
+                            }
+                        } else {
+                            $count = 1;
+                        }
+                    }
+                    if ($count < 6) {
+                        $info["recommendAllowanceType"] = 3;
+                        $info["recommendAllowanceMsg"][] = "上年度{$str}交集月份不满足连续缴纳6个月(" . implode(",", $checkSet) . "),无法享受工作津贴(×)";
+                    }
                 }
             }
         }
@@ -385,7 +420,7 @@ class TalentAllowanceApi {
                         $jobMoney += $total;
                         $msgBulider[] = sprintf("%d(%s)x%s(第%d层次)", count($levelList), $levelList ? implode(",", $levelList) : "", $arrange["jobMoney"], $arrange["talentArrange"]);
                         $recommendMonths = array_merge($recommendMonths, $levelList);
-                        usort($recommendMonths, function($a, $b) {
+                        usort($recommendMonths, function ($a, $b) {
                             return (int) $a - (int) $b;
                         });
                         $arrange["months"] = implode(",", $levelList);
@@ -473,9 +508,9 @@ class TalentAllowanceApi {
         }
         if ($info["type"] == CommonConst::ENTERPRISE_GJ) {
             if ($info["backWork"] == 1) {
-                $preCheckProjects = ["③", "⑦"];
+                $preCheckProjects = ["②", "③"];
             } else {
-                $preCheckProjects = ["③", "④", "⑦"];
+                $preCheckProjects = ["②", "③"];
             }
         }
         if ($info["recommendAllowanceType"] == 1 && (!$set || count($set) < 6) && in_array($sort, $preCheckProjects)) {
@@ -577,5 +612,4 @@ class TalentAllowanceApi {
         }
         return $map;
     }
-
 }