$authority = $_SESSION[SESSION_GROUP_CD]; $department_cd = $_SESSION[SESSION_USER_DEPARTMENT_CD]; $division_cd = $_SESSION[SESSION_USER_DIVISION_CD]; $param['id'] = $id; $param['date'] = $date; $param['name'] = $name; $param['authority'] = $authority; // 未記入のアラートのための処理 if (in_array(ACCOUNT_TRAINER, $authority) || in_array(ACCOUNT_ADMIN, $authority)) { // 未記入週報のアラートのため、現在の期間IDを取得 $current_term = getTermId($date); $term = $current_term["id"] - 1; // 未記入ヒアリングシートのアラートのため、前月を取得 $last_month = $month - 1; // 前月最終日を取得(紐付き期間内のもののみ、ヒアリングシートのアラート) // 20150623 ADD R.Kumabe $end_of_last_month = getYYYYMMDD($year, $last_month, "end_of_month"); // 未記入月報のアラートのため、前月の期間IDの最大・最小値を取得 $start = getMonthStart($last_month, $year); $end = getMonthEnd($last_month, $year); // OJT期間前のデータに対してアラートを出さないようにする if ($current_term["id"] < START_TERM) { $w_t_no_data_name = array(); $w_a_no_data_name = array(); } if ($month < START_MONTH) { $m_t_no_data_name = array(); $m_a_no_data_name = array(); $hearing_no_data = false; } } //新入社員
function makeDispArray(&$dispArray, $tmpArray, $arrayPeriod, $targetMonth, $targetYear, $breakid, $breakname, $breakcd, $breakmail, $name) { if (empty($tmpArray) || count($tmpArray) == 0) { return 0; } $makeArray = array(); $makeName = array(); foreach ($name as $key => $val) { foreach ($val as $key_1 => $val_1) { if (empty($makeName[$key])) { $makeName[$key] = ""; } $makeName[$key] .= ' / ' . $val_1; } } // 対象の責任者月のみ初期配列を作成 foreach ($arrayPeriod as $key => $val) { // 月指定検索の場合、該当月分のみ初期配列を作成する if (!empty($targetMonth) && isset($targetMonth) && $targetMonth != $val) { continue; } $makeArray[$breakid][$targetYear][$val]["staff_cd"] = $breakcd; $makeArray[$breakid][$targetYear][$val]["name"] = $breakname; //$makeArray[$breakid][$targetYear][$val]["mail"] = ""; //DEL R. Kumabe 20150710 $makeArray[$breakid][$targetYear][$val]["mail"] = $breakmail; //ADD R. Kumabe 20150710 $makeArray[$breakid][$targetYear][$val]["retire_flg"] = ""; $makeArray[$breakid][$targetYear][$val]["target_date"] = ""; $makeArray[$breakid][$targetYear][$val]["hearing_id"] = ""; $makeArray[$breakid][$targetYear][$val]["EmpName"] = $makeName[$val]; } foreach ($tmpArray as $key => $val) { if (empty($val["hearing_id"]) || is_null($val["hearing_id"])) { $start_month = ""; $end_month = ""; // 責任者として関連が有るが、ヒアリングシートがまだ作成されていない場合 $start_month = (int) substr($val['start_date'], 4, 2); $end_month = (int) substr($val['end_date'], 4, 2); // $val['end_date']に月末を含んでいなければ$end_monthを-1する(月末まで担当している場合にヒアリングシートを記入するため) $year_of_end_date = getYear($val['end_date']); $month_of_end_date = getMonth($val['end_date']); $end_of_end_date = getYYYYMMDD($year_of_end_date, $month_of_end_date, "end_of_month"); if ($val['end_date'] < $end_of_end_date) { $end_month = $end_month - 1; } for ($i = $start_month; $i <= $end_month; $i++) { // 月指定検索の場合、該当月分のみ初期配列を作成する if (!empty($targetMonth) && isset($targetMonth) && $targetMonth != $i) { continue; } $makeArray[$breakid][$targetYear][$i]["staff_cd"] = $val["staff_cd"]; $makeArray[$breakid][$targetYear][$i]["name"] = $val["name"]; $makeArray[$breakid][$targetYear][$i]["mail"] = $val["mail"]; $makeArray[$breakid][$targetYear][$i]["retire_flg"] = $val["retire_flg"]; $makeArray[$breakid][$targetYear][$i]["target_date"] = getYYYYMMDD($targetYear, $i, "target_date"); $makeArray[$breakid][$targetYear][$i]["hearing_id"] = $val["hearing_id"]; // $makeArray[$breakid][$targetYear][$i]["EmpName"] .= ', ' . $val["new_emp_name"]; } } else { $makeArray[$breakid][$targetYear][$val['target_month']]["staff_cd"] = $val["staff_cd"]; $makeArray[$breakid][$targetYear][$val['target_month']]["name"] = $val["name"]; $makeArray[$breakid][$targetYear][$val['target_month']]["mail"] = $val["mail"]; $makeArray[$breakid][$targetYear][$val['target_month']]["retire_flg"] = $val["retire_flg"]; $makeArray[$breakid][$targetYear][$val['target_month']]["target_date"] = getYYYYMMDD($targetYear, $val['target_month'], "target_date"); $makeArray[$breakid][$targetYear][$val['target_month']]["hearing_id"] = $val["hearing_id"]; // 現在設定されている期間外でのヒアリングシートが存在すると、初期化で未作成の為に // noticeが出る事有るので存在チェックを行う 文字列結合しようとしている為初期化されていないと // noticeが出る if (empty($makeArray[$breakid][$targetYear][$val['target_month']]["EmpName"])) { $makeArray[$breakid][$targetYear][$val['target_month']]["EmpName"] = ""; } // $makeArray[$breakid][$targetYear][$val['target_month']]["EmpName"] .= ', ' . $val["new_emp_name"]; } } //var_dump ($tmpArray); $work = array(); foreach ($makeArray as $key => $val) { foreach ($val as $key_1 => $val_1) { foreach ($val_1 as $key_2 => $val_2) { $work["id"] = $key; $work["staff_cd"] = $val_2["staff_cd"]; $work["targetYear"] = $key_1; $work["targetMonth"] = $key_2; $work["name"] = $val_2["name"]; $work["mail"] = $val_2["mail"]; $work["retire_flg"] = $val_2["retire_flg"]; $work["target_date"] = $val_2["target_date"]; $work["hearing_id"] = $val_2["hearing_id"]; $work["EmpName"] = ltrim($val_2["EmpName"], " / "); array_push($dispArray, $work); } } } }