prepare($sql); $stmh->bindValue(1,$num,PDO::PARAM_STR); $stmh->execute(); $count = $stmh->rowCount(); $row = $stmh->fetch(PDO::FETCH_ASSOC); // $row 배열로 DB 정보를 불러온다. include 'rowDBask.php'; }catch (PDOException $Exception) { print "오류: ".$Exception->getMessage(); } // end of if // 배열로 기본정보 불러옴 require_once($_SERVER['DOCUMENT_ROOT'] . "/almember/load_DB.php"); // holiday 테이블에서 휴일 목록 불러오기 $holidayDates = []; try { $holidaySql = "SELECT startdate, enddate FROM " . $DB . ".holiday WHERE is_deleted IS NULL"; $holidayStmt = $pdo->query($holidaySql); $holidayRows = $holidayStmt->fetchAll(PDO::FETCH_ASSOC); foreach ($holidayRows as $holidayRow) { $startdate = $holidayRow['startdate']; $enddate = $holidayRow['enddate']; // enddate가 '0000-00-00'이거나 비어있으면 startdate만 휴일 if (empty($enddate) || $enddate === '0000-00-00' || $enddate === null) { $holidayDates[] = $startdate; } else { // 기간 내의 모든 날짜를 배열에 추가 $start = new DateTime($startdate); $end = new DateTime($enddate); $end->modify('+1 day'); // 종료일 포함 $period = new DatePeriod($start, new DateInterval('P1D'), $end); foreach ($period as $date) { $holidayDates[] = $date->format('Y-m-d'); } } } } catch (PDOException $e) { // 오류 발생 시 빈 배열 유지 error_log("Holiday 데이터 로드 오류: " . $e->getMessage()); } if($num=='') { $registdate = date("Y-m-d H:i:s"); $al_askdatefrom=date("Y-m-d"); $al_askdateto=date("Y-m-d"); // 신규데이터인 경우 $al_usedday = abs(strtotime($al_askdateto) - strtotime($al_askdatefrom)) + 1; // 날짜 빼기 계산 $al_item='연차'; $status='send'; $statusstr='결재요청'; $author= $_SESSION["name"]; $author_id= $user_id; // DB에서 al_part 찾아서 넣어주기 // 전 직원 배열로 계산 후 사용일수 남은일수 값 넣기 for($i=0;$igetMessage(); } ?>

(연차)신청

"대표 신동조", "date" => $formattedDate), // 더 많은 결재권자가 있을 수 있음... ); } } else { $approver_ids = explode('!', $e_confirm_id); $approver_details = explode('!', $e_confirm); $approvals = array(); foreach($approver_ids as $index => $id) { if (isset($approver_details[$index])) { // Use regex to match the pattern (name title date time) // The pattern looks for any character until it hits a series of digits that resemble a date followed by a time preg_match("/^(.+ \d{4}-\d{2}-\d{2}) (\d{2}:\d{2}:\d{2})$/", $approver_details[$index], $matches); // Ensure that the full pattern and the two capturing groups are present if (count($matches) === 3) { $nameWithTitle = $matches[1]; // This is the name and title $time = $matches[2]; // This is the time $date = substr($nameWithTitle, -10); // Extract date from the end of the 'nameWithTitle' string $nameWithTitle = trim(str_replace($date, '', $nameWithTitle)); // Remove the date from the 'nameWithTitle' to get just the name and title $formattedDate = date("m/d H:i:s", strtotime("$date $time")); // Combining date and time $approvals[] = array("name" => $nameWithTitle, "date" => $formattedDate); } } } // // Now $approvals contains the necessary details // foreach ($approvals as $approval) { // echo "Approver: " . $approval['name'] . ", Date: " . $approval['date'] . "
"; // } } if($status === 'end') { ?>
결재
성명     부서 " . $item_arr[$i] . "   "; else print " " . $item_arr[$i] . "   "; if($i%2 == 0) print "
"; } ?>
신청시작일 신청종료일 신청 기간 산출 연차 잔여일수

0 and $statusstr!=='결재완료') { print ''; } else if( $statusstr!=='결재완료') { print ''; } ?> 0 and $statusstr!=='결재완료') { ?>