|
@@ -626,6 +626,35 @@ class TalentAllowance extends EnterpriseController {
|
|
|
$response->msg = "不能重复提交审核";
|
|
|
return $response;
|
|
|
}
|
|
|
+ if (!$old["allowanceType"]) {
|
|
|
+ $response->msg = "没有明确津贴类型";
|
|
|
+ return $response;
|
|
|
+ }
|
|
|
+ //因为工作津贴和交通补贴两者的考勤分别记录的是月份和天数,如果没有手动修改值会导致数据不对口,如修改类型却未修改考勤记录,则手动改为空。
|
|
|
+ $where = [];
|
|
|
+ $where[] = ["project", "=", AllowanceProjectEnum::PROJECT_ATTENDANCE];
|
|
|
+ $where[] = ["mainId", "=", $data["id"]];
|
|
|
+ $attendanceList = \app\common\model\TalentAllowanceProject::where($where)->select()->toArray();
|
|
|
+ if ($old["allowanceType"] == \app\common\state\AllowanceTypeEnum::JBT_JT) {
|
|
|
+ //因为天数保存格式为 月份=天数 如 01=31,02=20,03=15,月份保存格式为01,02,03,所以可以从有没有=号判断是否有进行考勤的修改保存操作
|
|
|
+ foreach ($attendanceList as $a) {
|
|
|
+ //$a["months"]有值但是没有包含=号则一般可认为是类型修改为交通补贴而未修改考勤,此时的months字段数据是错误的,修改为空。
|
|
|
+ if ($a["months"] && strpos($a["months"], "=") === false) {
|
|
|
+ $_updProject["id"] = $a["id"];
|
|
|
+ $_updProject["months"] = "";
|
|
|
+ \app\common\model\TalentAllowanceProject::update($_updProject);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ foreach ($attendanceList as $a) {
|
|
|
+ //$a["months"]有值但是包含了=号则一般可认为是类型修改为工作津贴而未修改考勤,此时的months字段数据是错误的,修改为空。
|
|
|
+ if ($a["months"] && strpos($a["months"], "=") !== false) {
|
|
|
+ $_updProject["id"] = $a["id"];
|
|
|
+ $_updProject["months"] = "";
|
|
|
+ \app\common\model\TalentAllowanceProject::update($_updProject);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
$where = [];
|
|
|
$where[] = ["type", "=", $old["type"]];
|
|
|
$where[] = ["project", "=", ProjectState::JBT];
|
|
@@ -824,4 +853,72 @@ class TalentAllowance extends EnterpriseController {
|
|
|
return new Response(Response::SUCCESS, "", ["rows" => $res, "total" => count($res)]);
|
|
|
}
|
|
|
|
|
|
+ public function export() {
|
|
|
+ $obj["year"] = \StrUtil::getRequestDecodeParam($this->request, "year");
|
|
|
+ $obj["name"] = \StrUtil::getRequestDecodeParam($this->request, "name");
|
|
|
+ $obj["talentArrange"] = \StrUtil::getRequestDecodeParam($this->request, "talentArrange");
|
|
|
+ $obj["address"] = \StrUtil::getRequestDecodeParam($this->request, "address");
|
|
|
+ $obj["identifyCondition"] = \StrUtil::getRequestDecodeParam($this->request, "identifyCondition");
|
|
|
+ $where = [];
|
|
|
+ $where[] = ["ta.enterpriseId", "=", $this->user["uid"]];
|
|
|
+ if (\StrUtil::isNotEmpAndNull($obj["year"])) {
|
|
|
+ $where[] = ["ta.year", "like", "%" . $obj["year"] . "%"];
|
|
|
+ }
|
|
|
+ if (\StrUtil::isNotEmpAndNull($obj["name"])) {
|
|
|
+ $where[] = ["ta.name", "like", "%" . $obj["name"] . "%"];
|
|
|
+ }
|
|
|
+ if (\StrUtil::isNotEmpAndNull($obj["talentArrange"])) {
|
|
|
+ $where[] = ["ta.talentArrange", "=", $obj["talentArrange"]];
|
|
|
+ }
|
|
|
+ if (\StrUtil::isNotEmpAndNull($obj["address"])) {
|
|
|
+ $where[] = ["ta.address", "=", $obj["address"]];
|
|
|
+ }
|
|
|
+ if (\StrUtil::isNotEmpAndNull($obj["identifyCondition"])) {
|
|
|
+ $where[] = ["ta.identifyCondition", "=", $obj["identifyCondition"]];
|
|
|
+ }
|
|
|
+ $projects = [
|
|
|
+ AllowanceProjectEnum::PROJECT_TAX,
|
|
|
+ AllowanceProjectEnum::PROJECT_WAGES,
|
|
|
+ AllowanceProjectEnum::PROJECT_ATTENDANCE,
|
|
|
+ AllowanceProjectEnum::PROJECT_SB_PENSION,
|
|
|
+ AllowanceProjectEnum::PROJECT_SB_UNEMPLOYMENT,
|
|
|
+ AllowanceProjectEnum::PROJECT_SB_MEDICA,
|
|
|
+ ];
|
|
|
+ $months = [];
|
|
|
+ for ($m = 1; $m <= 12; $m++) {
|
|
|
+ $months[] = $m . "月";
|
|
|
+ }
|
|
|
+ $columns = [["年度", [1, 2]], ["所属镇街", [1, 2]], ["姓名", [1, 2]], ["性别", [1, 2]], ["证件号码", [1, 2]], ["人才层次", [1, 2]], ["认定条件", [1, 2]], ["认定条件取得时间", [1, 2]], ["认定条件名称", [1, 2]], ["公布入选月份", [1, 2]], ["津补贴类型", [1, 2]], ["兑现月份", [1, 2]], ["兑现金额", [1, 2]], ["金额说明", [1, 2]], ["审核状态", [1, 2]], ["缴纳单位", [1, 2]]];
|
|
|
+ $infoCols = count($columns);
|
|
|
+ for ($i = 0; $i < count($projects); $i++) {
|
|
|
+ $columns[] = [AllowanceProjectEnum::getProjectName($projects[$i]), $months];
|
|
|
+ }
|
|
|
+ $list = \app\common\model\TalentAllowanceProject::alias("pro")
|
|
|
+ ->field("ta.id,ta.year,ta.enterpriseId as curEnterpriseId,ta.address,ta.name,ta.sex,ta.idCard,ta.talentArrange,ta.identifyCondition,ta.identifyConditionName,ta.identifyMonth,ta.allowanceType,ta.months,ta.money,ta.moneyDesc,ta.checkState,pro.months as pre_months,con.enterpriseId,con.startTime,con.endTime,con.entryTime,con.quitTime,con.isQuit")
|
|
|
+ ->leftJoin("un_talent_allowance_info ta", "ta.id=pro.mainId")
|
|
|
+ ->leftJoin("un_talent_allowancecontract_detail con", "pro.baseId=con.id")
|
|
|
+ ->where($where)
|
|
|
+ ->order("ta.year desc,ta.createTime desc,pro.project asc")
|
|
|
+ ->select()->toArray();
|
|
|
+ $tmpList = [];
|
|
|
+ foreach ($list as $item) {
|
|
|
+
|
|
|
+ }
|
|
|
+ $cols = $infoCols + count($projects) * 12 - 1;
|
|
|
+ $settings = [
|
|
|
+ "background-color" => [[sprintf("A1:%s1", getExcelColumnByIndex($cols)), "0066CC"]],
|
|
|
+ "color" => [[sprintf("A1:%s1", getExcelColumnByIndex($cols)), "FFFFFF"]],
|
|
|
+ "border" => sprintf("A1:%s%d", getExcelColumnByIndex($cols), 2),
|
|
|
+ "wrap" => [sprintf("A2:%s%d", getExcelColumnByIndex($cols), 2)],
|
|
|
+ "align" => [[sprintf("A1:%s%d", getExcelColumnByIndex($cols), 2), "hCenter"], [sprintf("A1:%s%d", getExcelColumnByIndex($cols - 1), 2), "vCenter"]],
|
|
|
+ "height" => [18],
|
|
|
+ "freeze" => "D1"
|
|
|
+ ];
|
|
|
+ for ($i = 0; $i < count($projects) * 12; $i++) {
|
|
|
+ $settings["width"][] = [getExcelColumnByIndex($infoCols + $i), 6]; //批设置项目的宽度
|
|
|
+ }
|
|
|
+ $settings["background-color"][] = [sprintf("%s2:%s2", getExcelColumnByIndex($infoCols), getExcelColumnByIndex($cols)), "E1F1DE"];
|
|
|
+ export($columns, [], "津补贴申报名单", $settings);
|
|
|
+ }
|
|
|
+
|
|
|
}
|