Browse Source

津补贴根据不同类型区分需要提交的数据

sugangqiang 1 year ago
parent
commit
69ae86cd4a

+ 38 - 12
app/admin/controller/TalentAllowance.php

@@ -192,6 +192,7 @@ class TalentAllowance extends AdminController {
         }
         $updCheck = [];
         $updCheck["id"] = $id;
+        $updCheck["type"] = $old["type"];
         /*         * 查询审核日志 */
         $log = TalentLogApi::getLastLogByStep($id, ProjectState::JBT, $process);
         if (!$log) {
@@ -1164,14 +1165,31 @@ class TalentAllowance extends AdminController {
         $unemploymentSet = $this->chkMonths($monthMap[AllowanceProjectEnum::PROJECT_SB_UNEMPLOYMENT], $info, "失业保险", "⑤");
         $medicaSet = $this->chkMonths($monthMap[AllowanceProjectEnum::PROJECT_SB_MEDICA], $info, "医疗保险", "⑥");
         $taxSet = $this->chkMonths($monthMap[AllowanceProjectEnum::PROJECT_TAX], $info, "个税", "⑦");
-        $set = array_intersect($set, $contractSet);
-        $set = array_intersect($set, $workdaySet);
-        $set = array_intersect($set, $wageSet);
-        $checkSet = $set;
-        $set = array_intersect($set, $pensionSet);
-        $set = array_intersect($set, $unemploymentSet);
-        $set = array_intersect($set, $medicaSet);
-        $set = array_intersect($set, $taxSet);
+        $str = "工作合同月份、考勤月份、工资发放月份";
+        if ($info["type"] == CommonConst::ENTERPRISE_WJ) {
+            $str = "工作合同月份、考勤月份";
+            $set = array_intersect($set, $contractSet);
+            $set = array_intersect($set, $workdaySet);
+            $checkSet = $set;
+            $set = array_intersect($set, $pensionSet);
+            $set = array_intersect($set, $taxSet);
+        } else if ($info["type"] == CommonConst::ENTERPRISE_GJ) {
+            $set = array_intersect($set, $contractSet);
+            $set = array_intersect($set, $workdaySet);
+            $set = array_intersect($set, $wageSet);
+            $checkSet = $set;
+            $set = array_intersect($set, $pensionSet);
+            $set = array_intersect($set, $taxSet);
+        } else {
+            $set = array_intersect($set, $contractSet);
+            $set = array_intersect($set, $workdaySet);
+            $set = array_intersect($set, $wageSet);
+            $checkSet = $set;
+            $set = array_intersect($set, $pensionSet);
+            $set = array_intersect($set, $unemploymentSet);
+            $set = array_intersect($set, $medicaSet);
+            $set = array_intersect($set, $taxSet);
+        }
         usort($set, function($a, $b) {
             return (int) $a - (int) $b;
         });
@@ -1179,7 +1197,7 @@ class TalentAllowance extends AdminController {
             if (count($checkSet) < 6) {
                 //如果全部满足6个月,但是重叠时间不满足6个月,开始检测是否符合交通补贴要求
                 $info["recommendAllowanceType"] = 2;
-                $info["recommendAllowanceMsg"] = $info["recommendAllowanceMsg"] . "\n上年度工作合同月份、考勤月份、工资发放月份交集月份不满足6个月(" . implode(",", $checkSet) . "),无法享受工作津贴(×)";
+                $info["recommendAllowanceMsg"] = $info["recommendAllowanceMsg"] . "\n上年度{$str}交集月份不满足6个月(" . implode(",", $checkSet) . "),无法享受工作津贴(×)";
             } else {
                 //检查连续缴纳月份是否满足6个月
                 $count = 1;
@@ -1198,7 +1216,7 @@ class TalentAllowance extends AdminController {
                 }
                 if ($count < 6) {
                     $info["recommendAllowanceType"] = 2;
-                    $info["recommendAllowanceMsg"] = $info["recommendAllowanceMsg"] . "\n上年度工作合同月份、考勤月份、工资发放月份不满足连续缴纳6个月(" . implode(",", $checkSet) . "),无法享受工作津贴(×)";
+                    $info["recommendAllowanceMsg"] = $info["recommendAllowanceMsg"] . "\n上年度{$str}不满足连续缴纳6个月(" . implode(",", $checkSet) . "),无法享受工作津贴(×)";
                 }
             }
         }
@@ -1256,6 +1274,10 @@ class TalentAllowance extends AdminController {
         $talentArrange = null;
         /*         * *********计算************* */
         $msgBulider = [];
+        $identifyExpiredName = "人才证书有效期";
+        if ($info["type"] == CommonConst::ENTERPRISE_JC) {
+            $identifyExpiredName = "认定条件有效期";
+        }
         switch ($info["recommendAllowanceType"]) {
             case 1:
                 foreach ($arrangeList as &$arrange) {
@@ -1279,7 +1301,7 @@ class TalentAllowance extends AdminController {
                     }
                 }unset($arrange);
                 $info["recommendMonths"] = implode(",", $recommendMonths);
-                $info["recommendAllowanceMsg"] = $info["recommendAllowanceMsg"] . "通过与人才证书有效期取交集得到最终可享受月份:" . implode(",", $recommendMonths) . "\n经过计算:人才津贴为" . $jobMoney . ";";
+                $info["recommendAllowanceMsg"] = $info["recommendAllowanceMsg"] . "通过与{$identifyExpiredName}取交集得到最终可享受月份:" . implode(",", $recommendMonths) . "\n经过计算:人才津贴为" . $jobMoney . ";";
                 $info["recommendMoney"] = $jobMoney;
                 $info["recommendMoneyDesc"] = implode("+", $msgBulider);
 
@@ -1328,7 +1350,11 @@ class TalentAllowance extends AdminController {
                 $set = $tmp;
             }
         }
-        if ($info["recommendAllowanceType"] == 1 && (!$set || count($set) < 6) && in_array($sort, ["①", "②", "③"])) {
+        $preCheckProjects = ["①", "②", "③"];
+        if ($info["type"] == CommonConst::ENTERPRISE_WJ) {
+            $preCheckProjects = ["①", "②"];
+        }
+        if ($info["recommendAllowanceType"] == 1 && (!$set || count($set) < 6) && in_array($sort, $preCheckProjects)) {
             $info["recommendAllowanceType"] = 2;
             $info["recommendAllowanceMsg"] = $info["recommendAllowanceMsg"] . $sort . $name . "不足6个月,无法享受工作津贴(×)";
         }

+ 37 - 12
app/common/api/TalentAllowanceApi.php

@@ -158,14 +158,31 @@ class TalentAllowanceApi {
         $unemploymentSet = self::chkMonths($monthMap[AllowanceProjectEnum::PROJECT_SB_UNEMPLOYMENT], $info, "失业保险", "⑤");
         $medicaSet = self::chkMonths($monthMap[AllowanceProjectEnum::PROJECT_SB_MEDICA], $info, "医疗保险", "⑥");
         $taxSet = self::chkMonths($monthMap[AllowanceProjectEnum::PROJECT_TAX], $info, "个税", "⑦");
-        $set = array_intersect($set, $contractSet);
-        $set = array_intersect($set, $workdaySet);
-        $set = array_intersect($set, $wageSet);
-        $checkSet = $set;
-        $set = array_intersect($set, $pensionSet);
-        $set = array_intersect($set, $unemploymentSet);
-        $set = array_intersect($set, $medicaSet);
-        $set = array_intersect($set, $taxSet);
+        $str = "工作合同月份、考勤月份、工资发放月份";
+        if ($info["type"] == CommonConst::ENTERPRISE_WJ) {
+            $str = "工作合同月份、考勤月份";
+            $set = array_intersect($set, $contractSet);
+            $set = array_intersect($set, $workdaySet);
+            $checkSet = $set;
+            $set = array_intersect($set, $pensionSet);
+            $set = array_intersect($set, $taxSet);
+        } else if ($info["type"] == CommonConst::ENTERPRISE_GJ) {
+            $set = array_intersect($set, $contractSet);
+            $set = array_intersect($set, $workdaySet);
+            $set = array_intersect($set, $wageSet);
+            $checkSet = $set;
+            $set = array_intersect($set, $pensionSet);
+            $set = array_intersect($set, $taxSet);
+        } else {
+            $set = array_intersect($set, $contractSet);
+            $set = array_intersect($set, $workdaySet);
+            $set = array_intersect($set, $wageSet);
+            $checkSet = $set;
+            $set = array_intersect($set, $pensionSet);
+            $set = array_intersect($set, $unemploymentSet);
+            $set = array_intersect($set, $medicaSet);
+            $set = array_intersect($set, $taxSet);
+        }
         usort($set, function($a, $b) {
             return (int) $a - (int) $b;
         });
@@ -173,7 +190,7 @@ class TalentAllowanceApi {
             if (count($checkSet) < 6) {
                 //如果全部满足6个月,但是重叠时间不满足6个月,开始检测是否符合交通补贴要求
                 $info["recommendAllowanceType"] = 2;
-                $info["recommendAllowanceMsg"][] = "上年度工作合同月份、考勤月份、工资发放月份交集月份不满足6个月(" . implode(",", $checkSet) . "),无法享受工作津贴(×)";
+                $info["recommendAllowanceMsg"][] = "上年度{$str}交集月份不满足6个月(" . implode(",", $checkSet) . "),无法享受工作津贴(×)";
             } else {
                 //检查连续缴纳月份是否满足6个月
                 $count = 1;
@@ -192,7 +209,7 @@ class TalentAllowanceApi {
                 }
                 if ($count < 6) {
                     $info["recommendAllowanceType"] = 2;
-                    $info["recommendAllowanceMsg"][] = "上年度工作合同月份、考勤月份、工资发放月份交集月份不满足连续缴纳6个月(" . implode(",", $checkSet) . "),无法享受工作津贴(×)";
+                    $info["recommendAllowanceMsg"][] = "上年度{$str}交集月份不满足连续缴纳6个月(" . implode(",", $checkSet) . "),无法享受工作津贴(×)";
                 }
             }
         }
@@ -250,6 +267,10 @@ class TalentAllowanceApi {
         $talentArrange = null;
         /*         * *********计算************* */
         $msgBulider = [];
+        $identifyExpiredName = "人才证书有效期";
+        if ($info["type"] == CommonConst::ENTERPRISE_JC) {
+            $identifyExpiredName = "认定条件有效期";
+        }
         switch ($info["recommendAllowanceType"]) {
             case 1:
                 foreach ($arrangeList as &$arrange) {
@@ -273,7 +294,7 @@ class TalentAllowanceApi {
                     }
                 }unset($arrange);
                 $info["recommendMonths"] = implode(",", $recommendMonths);
-                $info["recommendAllowanceMsg"][] = "通过与人才证书有效期取交集得到最终可享受月份:";
+                $info["recommendAllowanceMsg"][] = "通过与{$identifyExpiredName}取交集得到最终可享受月份:";
                 $info["recommendAllowanceMsg"][] = "<span style='color:red;font-weight:bold;'>" . implode(",", $recommendMonths) . "</span>;";
                 $info["recommendAllowanceMsg"][] = "经过计算:兑现月份" . count($recommendMonths) . "个月,人才津贴为<span style='color:red;font-weight:bold;'>" . $jobMoney . "</span>;";
                 $info["recommendMoney"] = $jobMoney;
@@ -324,7 +345,11 @@ class TalentAllowanceApi {
                 $set = $tmp;
             }
         }
-        if ($info["recommendAllowanceType"] == 1 && (!$set || count($set) < 6) && in_array($sort, ["①", "②", "③"])) {
+        $preCheckProjects = ["①", "②", "③"];
+        if ($info["type"] == CommonConst::ENTERPRISE_WJ) {
+            $preCheckProjects = ["①", "②"];
+        }
+        if ($info["recommendAllowanceType"] == 1 && (!$set || count($set) < 6) && in_array($sort, $preCheckProjects)) {
             $info["recommendAllowanceType"] = 2;
             $info["recommendAllowanceMsg"][] = $sort . $name . "不足6个月,无法享受工作津贴(×)";
         }

+ 29 - 0
app/common/state/AllowanceProjectEnum.php

@@ -91,4 +91,33 @@ class AllowanceProjectEnum {
         }
     }
 
+    static function getProjectsByEnterpriseType($type) {
+        $projects = [];
+        if ($type == CommonConst::ENTERPRISE_WJ) {
+            $projects = [
+                self::PROJECT_TAX,
+                self::PROJECT_ATTENDANCE,
+                self::PROJECT_SB_PENSION
+            ];
+        } else if ($type == CommonConst::ENTERPRISE_GJ) {
+            $projects = [
+                self::PROJECT_TAX,
+                self::PROJECT_WAGES,
+                self::PROJECT_ATTENDANCE,
+                self::PROJECT_SB_PENSION
+            ];
+        } else {
+            $projects = [
+                self::PROJECT_TAX,
+                self::PROJECT_WAGES,
+                self::PROJECT_ATTENDANCE,
+                self::PROJECT_SB_PENSION,
+                self::PROJECT_SB_UNEMPLOYMENT,
+                self::PROJECT_SB_MEDICA
+            ];
+        }
+
+        return $projects;
+    }
+
 }

+ 11 - 3
app/enterprise/controller/Talent.php

@@ -1691,10 +1691,14 @@ class Talent extends EnterpriseController {
         $whr[] = ["ti.enterprise_id", "=", $this->user["uid"]];
         $whr[] = ["e.type", "=", $this->user["type"]];
         $whr[] = ["ti.id", "not in", $ids];
-        $list = TalentModel::alias("ti")->leftJoin("un_enterprise e", "e.id=ti.enterprise_id")->field("ti.*")->order("identifyMonth desc")->where($whr)->select()->toArray();
+        $list = TalentModel::alias("ti")->leftJoin("un_enterprise e", "e.id=ti.enterprise_id")->field("ti.*,e.`type` as eType")->order("identifyMonth desc")->where($whr)->select()->toArray();
         foreach ($list as $info) {
             $info["enterpriseName"] = $this->user["name"];
-            if (strtotime($year . "-12-31") >= strtotime($info["identifyMonth"])) {
+            $identifyTime = $info["identifyMonth"];
+            if ($info["eType"] == CommonConst::ENTERPRISE_JC) {
+                $identifyTime = $info["identifyGetTime"] ?: $info["identifyMonth"];
+            }
+            if (strtotime($year . "-12-31") >= strtotime($identifyTime)) {
                 $res[] = $info;
             } else {
                 $whereTypeChange = [];
@@ -1703,7 +1707,11 @@ class Talent extends EnterpriseController {
                 $whereTypeChange[] = ["isPublic", "=", 6];
                 $typeChanges = \app\enterprise\model\TalentTypeChange::where($whereTypeChange)->select()->toArray();
                 foreach ($typeChanges as $typeChange) {
-                    if (strtotime($year . "-12-31") >= strtotime($typeChange["oldIdentifyMonth"])) {
+                    $oldIdentifyTime = $typeChange["oldIdentifyMonth"];
+                    if ($typeChange["type"] == CommonConst::ENTERPRISE_JC) {
+                        $oldIdentifyTime = $typeChange["oldIdentifyGetTime"] ?: $typeChange["oldIdentifyMonth"];
+                    }
+                    if (strtotime($year . "-12-31") >= strtotime($oldIdentifyTime)) {
                         $res[] = $info;
                         break;
                     }

+ 48 - 17
app/enterprise/controller/TalentAllowance.php

@@ -140,7 +140,31 @@ class TalentAllowance extends EnterpriseController {
                 return \StrUtil::back(new Response(Response::ERROR, sprintf("第%d行申请补贴类型错误,请仔细检查内容无误后再重新提交", $no)), "TalentAllowanceInfo.importCallBack");
             }
             if ($allowanceType == "工作津贴") {
+                $projects = AllowanceProjectEnum::getProjectsByEnterpriseType($info["type"]);
                 for ($i = 3; $i < 9; $i++) {
+                    $project = 1;
+                    switch ($i) {
+                        case 3:
+                            $project = AllowanceProjectEnum::PROJECT_TAX;
+                            break;
+                        case 4:
+                            $project = AllowanceProjectEnum::PROJECT_WAGES;
+                            break;
+                        case 5:
+                            $project = AllowanceProjectEnum::PROJECT_ATTENDANCE;
+                            break;
+                        case 6:
+                            $project = AllowanceProjectEnum::PROJECT_SB_PENSION;
+                            break;
+                        case 7:
+                            $project = AllowanceProjectEnum::PROJECT_SB_UNEMPLOYMENT;
+                            break;
+                        case 8:
+                            $project = AllowanceProjectEnum::PROJECT_SB_MEDICA;
+                            break;
+                    }
+                    if (!in_array($project, $projects))
+                        continue;
                     $monthstr = str_replace([" ", ","], ",", trim($row[$i]));
                     $months = array_filter(explode(",", $monthstr));
                     if (!$months)
@@ -288,7 +312,8 @@ class TalentAllowance extends EnterpriseController {
             "talentId" => $id,
             "year" => $year,
             "idCard" => $ti["card_number"],
-            "id" => getStringId()
+            "id" => getStringId(),
+            "type" => $ti["enterpriseType"]
         ];
         /*         * 1.获取上一年度的人才层次 */
         $arrangeList = $this->getLastYearTalentType($data, $ti);
@@ -373,11 +398,18 @@ class TalentAllowance extends EnterpriseController {
     private function getLastYearTalentType($info, $talentInfo) {
         $arrangeList = [];
         /*         * * 添加人才层次记录 */
+        $oldStartTimeField = "oldIdentifyMonth";
+        $newStartTimeField = "newIdentifyMonth";
+        if ($info["type"] == CommonConst::ENTERPRISE_JC) {
+            $oldStartTimeField = "oldIdentifyGetTime";
+            $newStartTimeField = "newIdentifyGetTime";
+        }
+
         $where = [];
         $where[] = ["idCard", "=", $info["idCard"]];
         $where[] = ["checkState", "=", MainState::PASS];
         $where[] = ["isPublic", ">=", 5];
-        $where[] = ["oldIdentifyMonth", "<=", $info["year"] . "-12-31"];
+        $where[] = [$oldStartTimeField, "<=", $info["year"] . "-12-31"];
         $typeList = TalentTypeChange::where($where)->field("oldTalentArrange,oldIdentifyCondition,oldIdentifyGetTime,oldIdentifyOutTime,oldIdentifyMonth,oldCertificateStartTime,oldCertificateOutTime,newIdentifyMonth")->order("createTime desc")->select()->toArray();
         $typeList[] = [
             "oldTalentArrange" => $talentInfo["talent_arrange"],
@@ -396,8 +428,8 @@ class TalentAllowance extends EnterpriseController {
         });
         $commonMonth = [];
         foreach ($typeList as $talentTypeChange) {
-            $startTime = $talentTypeChange["oldIdentifyMonth"];
-            $endTime = $talentTypeChange["newIdentifyMonth"];
+            $startTime = $talentTypeChange[$oldStartTimeField];
+            $endTime = $talentTypeChange[$newStartTimeField];
             $monthList = \DateUtil::getMonthBetweenDatesNotBegin($startTime, $endTime);
             if ($monthList) {
                 $monthList = array_intersect($monthList, $totalMonth);
@@ -499,16 +531,7 @@ class TalentAllowance extends EnterpriseController {
         $count = 0;
         foreach ($contractList as $detail) {
             $count++;
-            $projects = [
-                //AllowanceProjectEnum::PROJECT_CONTRACT,
-                AllowanceProjectEnum::PROJECT_TAX,
-                AllowanceProjectEnum::PROJECT_WAGES,
-                AllowanceProjectEnum::PROJECT_ATTENDANCE,
-                AllowanceProjectEnum::PROJECT_SB_PENSION,
-                AllowanceProjectEnum::PROJECT_SB_UNEMPLOYMENT,
-                AllowanceProjectEnum::PROJECT_SB_MEDICA,
-                    //AllowanceProjectEnum::PROJECT_WORKDAY,
-            ];
+            $projects = AllowanceProjectEnum::getProjectsByEnterpriseType($info["type"]);
             $list = [];
             foreach ($projects as $project) {
                 $months = "";
@@ -929,9 +952,13 @@ class TalentAllowance extends EnterpriseController {
             $whr[] = ["ti.enterprise_id", "=", $this->user["uid"]];
             $whr[] = ["e.type", "=", $this->user["type"]];
             $whr[] = ["ti.id", "not in", $ids];
-            $list = \app\enterprise\model\Talent::alias("ti")->leftJoin("un_enterprise e", "e.id=ti.enterprise_id")->field("ti.id,ti.name,ti.card_number as idCard,ti.cur_entry_time")->where($whr)->select()->toArray();
+            $list = \app\enterprise\model\Talent::alias("ti")->leftJoin("un_enterprise e", "e.id=ti.enterprise_id")->field("ti.id,ti.name,ti.card_number as idCard,ti.cur_entry_time,e.`type` as eType")->where($whr)->select()->toArray();
             foreach ($list as $info) {
-                if (strtotime($year . "-12-31") >= strtotime($info["identifyMonth"])) {
+                $identifyTime = $info["identifyMonth"];
+                if ($info["eType"] == CommonConst::ENTERPRISE_JC) {
+                    $identifyTime = $info["identifyGetTime"] ?: $info["identifyMonth"];
+                }
+                if (strtotime($year . "-12-31") >= strtotime($identifyTime)) {
                     $res[] = $info;
                 } else {
                     $whereTypeChange = [];
@@ -940,7 +967,11 @@ class TalentAllowance extends EnterpriseController {
                     $whereTypeChange[] = ["isPublic", "=", 6];
                     $typeChanges = TalentTypeChange::where($whereTypeChange)->select()->toArray();
                     foreach ($typeChanges as $typeChange) {
-                        if (strtotime($year . "-12-31") >= strtotime($typeChange["oldIdentifyMonth"])) {
+                        $oldIdentifyTime = $typeChange["oldIdentifyMonth"];
+                        if ($typeChange["type"] == CommonConst::ENTERPRISE_JC) {
+                            $oldIdentifyTime = $typeChange["oldIdentifyGetTime"] ?: $typeChange["oldIdentifyMonth"];
+                        }
+                        if (strtotime($year . "-12-31") >= strtotime($oldIdentifyTime)) {
                             $res[] = $info;
                             break;
                         }

+ 14 - 13
app/job/TalentAllowance.php

@@ -165,11 +165,18 @@ class TalentAllowance {
     private function getLastYearTalentType($info, $talentInfo) {
         $arrangeList = [];
         /*         * * 添加人才层次记录 */
+        $oldStartTimeField = "oldIdentifyMonth";
+        $newStartTimeField = "newIdentifyMonth";
+        if ($info["type"] == \app\common\state\CommonConst::ENTERPRISE_JC) {
+            $oldStartTimeField = "oldIdentifyGetTime";
+            $newStartTimeField = "newIdentifyGetTime";
+        }
+
         $where = [];
         $where[] = ["idCard", "=", $info["idCard"]];
         $where[] = ["checkState", "=", MainState::PASS];
         $where[] = ["isPublic", ">=", 5];
-        $where[] = ["oldIdentifyMonth", "<=", $info["year"] . "-12-31"];
+        $where[] = [$oldStartTimeField, "<=", $info["year"] . "-12-31"];
         $typeList = TalentTypeChange::where($where)->field("oldTalentArrange,oldIdentifyCondition,oldIdentifyGetTime,oldIdentifyOutTime,oldIdentifyMonth,oldCertificateStartTime,oldCertificateOutTime,newIdentifyMonth")->order("createTime desc")->select()->toArray();
         $typeList[] = [
             "oldTalentArrange" => $talentInfo["talent_arrange"],
@@ -188,8 +195,8 @@ class TalentAllowance {
         });
         $commonMonth = [];
         foreach ($typeList as $talentTypeChange) {
-            $startTime = $talentTypeChange["oldIdentifyMonth"];
-            $endTime = $talentTypeChange["newIdentifyMonth"];
+            $startTime = $talentTypeChange[$oldStartTimeField];
+            $endTime = $talentTypeChange[$newStartTimeField];
             $monthList = \DateUtil::getMonthBetweenDatesNotBegin($startTime, $endTime);
             if ($monthList) {
                 $monthList = array_intersect($monthList, $totalMonth);
@@ -291,16 +298,7 @@ class TalentAllowance {
         $count = 0;
         foreach ($contractList as $detail) {
             $count++;
-            $projects = [
-                //AllowanceProjectEnum::PROJECT_CONTRACT,
-                AllowanceProjectEnum::PROJECT_TAX,
-                AllowanceProjectEnum::PROJECT_WAGES,
-                AllowanceProjectEnum::PROJECT_ATTENDANCE,
-                AllowanceProjectEnum::PROJECT_SB_PENSION,
-                AllowanceProjectEnum::PROJECT_SB_UNEMPLOYMENT,
-                AllowanceProjectEnum::PROJECT_SB_MEDICA,
-                    //AllowanceProjectEnum::PROJECT_WORKDAY,
-            ];
+            $projects = AllowanceProjectEnum::getProjectsByEnterpriseType($info["type"]);
             $list = [];
             foreach ($projects as $project) {
                 $months = "";
@@ -322,6 +320,7 @@ class TalentAllowance {
 
     private function createAllowanceProject_m2($info, $contractList, $rowdata) {
         $count = 0;
+        $projects = AllowanceProjectEnum::getProjectsByEnterpriseType($info["type"]);
         foreach ($contractList as $detail) {
             $count++;
             $list = [];
@@ -348,6 +347,8 @@ class TalentAllowance {
                         $project = AllowanceProjectEnum::PROJECT_SB_MEDICA;
                         break;
                 }
+                if (!in_array($project, $projects))
+                    continue;
                 $months = "";
                 if ($count == count($contractList)) {
                     if ($info["allowanceType"] == 2 && $i == 5) {