퍼스트가든에서 사용하는 사용자 함수 및 관련파일 추가
This commit is contained in:
4
manager/adm/_common.php
Normal file
4
manager/adm/_common.php
Normal file
@ -0,0 +1,4 @@
|
||||
<?php
|
||||
include_once '../../common.php';
|
||||
include_once '../config.php';
|
||||
include_once '../lib/lib.php';
|
||||
48
manager/adm/adm_log.excel.php
Normal file
48
manager/adm/adm_log.excel.php
Normal file
@ -0,0 +1,48 @@
|
||||
<?php
|
||||
include_once('_common.php');
|
||||
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
|
||||
|
||||
$file_name = "viplist_".date("ymd")."_".date("His").".xls"; // 파일명지정
|
||||
|
||||
header("Content-Type: application/vnd.ms-excel");
|
||||
header('Content-Type: application/vnd.ms-excel; charset=utf-8');
|
||||
header("Content-Disposition: attachment; filename=$file_name");
|
||||
header("Content-Description: PHP5 Generated Data");
|
||||
|
||||
$sql = stripslashes($sql_common);
|
||||
$result = sql_query($sql);
|
||||
|
||||
?>
|
||||
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
|
||||
|
||||
<style type="text/css">
|
||||
.tit {background-color:#C0C0C0; height:30px; }
|
||||
.no-text {mso-number-format:'\@'; text-align:center;}
|
||||
</style>
|
||||
|
||||
<table cellspacing="0" cellpadding="0" border="1">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="tit">번호</th>
|
||||
<th class="tit">작업구분</th>
|
||||
<th class="tit">작업내용</th>
|
||||
<th class="tit">작업자</th>
|
||||
<th class="tit">작업일시</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
for ($i=0; $row=sql_fetch_array($result); $i++) { // 반복문 시작
|
||||
?>
|
||||
<tr>
|
||||
<td class="text-align:center"><?php echo $row['idx']?> </td>
|
||||
<td class="text-align:center"><?php echo $row['work']?> </td>
|
||||
<td style="no-text"> <?php echo $row['work_detail']?> </td>
|
||||
<td class="text-align:center"><?php echo $row['id']?> </td>
|
||||
<td style="text-align:center"> <?php echo date('Y-m-d H:i',strtotime($row['date']));?> </td>
|
||||
</tr>
|
||||
<?php } // 반복문 종료 ?>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
81
manager/adm/adm_log.php
Normal file
81
manager/adm/adm_log.php
Normal file
@ -0,0 +1,81 @@
|
||||
<?php
|
||||
// LOG
|
||||
include_once "_common.php";
|
||||
if (!isset($_SESSION['user_id'])) header( 'Location: FG_MANAGER_URL' ); // 로그인 되어있지 않으면 로그인 페이지로 보냄
|
||||
include_once FG_MANAGER_PATH."/head.php";
|
||||
|
||||
// 검색을 위한 부분
|
||||
$where = "";
|
||||
if (isset($_REQUEST["search_word"])) {
|
||||
$search_word = $_REQUEST["search_word"];
|
||||
$where = "WHERE work LIKE '%$search_word%' OR work_detail LIKE '%$search_word%'";
|
||||
}
|
||||
|
||||
$record_count = get_num_rows($fg['log_table']); // 전체 갯수 구하기
|
||||
$query = "SELECT * FROM {$fg['log_table']} {$where} ORDER BY idx DESC {$query_limit}";
|
||||
$result = sql_query($query);
|
||||
$R = array();
|
||||
while($row=sql_fetch_array($result)) { // 전체 배열에 저장
|
||||
array_push($R, $row);
|
||||
}
|
||||
?>
|
||||
<style>
|
||||
.excel {position:relative;float:right;top:0}
|
||||
</style>
|
||||
<div class="searchform">
|
||||
<form class="vipsearch" method="get" action="">
|
||||
<div>
|
||||
<div>
|
||||
<label class="search_tit">검색</label>
|
||||
<input type="text" name="search_word" class="form-control" placeholder="검색어를 입력하세요" style="width: 200px; display: inline-block; margin: 5px 10px 5px 10px; " autofocus >
|
||||
<button type="submit" class="btn btn-primary" style="display: inline-block; margin: 0; ">검색</button>
|
||||
</div>
|
||||
</form>
|
||||
작업구분, 작업내용에서 일치하는 검색어를 찾습니다.
|
||||
</div>
|
||||
|
||||
<div class="text-left">
|
||||
전체 로그 수 : <b><?=$record_count; ?></b>
|
||||
<div class="excel">
|
||||
<form method="post" action="vip_log.excel.php">
|
||||
<input type="hidden" name="sql_common" value="<?=$query?>">
|
||||
<!--<input type="submit" value="엑셀저장" class="list_excel">-->
|
||||
<button type="submit" class="btn btn-primary" style="display: inline-block; margin: 0; ">엑셀변환</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="text-center">
|
||||
<table class="table table-striped">
|
||||
<colgroup>
|
||||
<col width="100px">
|
||||
<col width="100px">
|
||||
<col>
|
||||
<col width="100px">
|
||||
<col width="200px">
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="text-center">번호</th>
|
||||
<th class="text-center">작업구분</th>
|
||||
<th class="text-left">작업내용</th>
|
||||
<th class="text-center">작업자</th>
|
||||
<th class="text-center">작업일시</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach($R as $R) { ?>
|
||||
<tr>
|
||||
<td class="text-center"><?=$R['idx']?></td>
|
||||
<td class="text-center"><?=$R['work']?></td>
|
||||
<td class="text-left"><?=$R['work_detail']?></td>
|
||||
<td class="text-center"><?=$R['id']?></td>
|
||||
<td class="text-center"><?=$R['date']?></td>
|
||||
</tr>
|
||||
<?php } // endforeach ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
include_once FG_MANAGER_PATH."/tail.php";
|
||||
27
manager/adm/adm_member.delete.php
Normal file
27
manager/adm/adm_member.delete.php
Normal file
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
include_once ('./_common.php');
|
||||
if(!$_SESSION['user_id']) exit;
|
||||
|
||||
if ( isset($_POST['idx']) ) ) {
|
||||
$idx = trim($_POST['idx']);
|
||||
|
||||
// log 기록을 위한 데이터 불러와서 변수 저장하기
|
||||
$query = "SELECT * FROM {$fg['log_table']} WHERE idx='{$idx}'";
|
||||
$log = sql_fetch($query);
|
||||
// 삭제실행
|
||||
$query = "DELETE FROM {$fg['member_table']} WHERE idx='{$idx}'";
|
||||
$result = sql_query($query);
|
||||
|
||||
if (isset($result) && $result) {
|
||||
|
||||
$time = date("Y-m-d H:i:s");
|
||||
$work_detail = "ID : ".$log['user_id'].", 처리자 : ".$_SESSION['user_name'];
|
||||
$work = "사용자삭제";
|
||||
log_update($work, $work_detail, $_SESSION['user_id'], $time);
|
||||
// log 기록 끝
|
||||
|
||||
$data = array("isSuccess" => $result);
|
||||
header("Content-Type: application/json");
|
||||
echo json_encode($data);
|
||||
}
|
||||
}
|
||||
72
manager/adm/adm_member.modify.php
Normal file
72
manager/adm/adm_member.modify.php
Normal file
@ -0,0 +1,72 @@
|
||||
<?php
|
||||
include_once ('./_common.php');
|
||||
if(!$_SESSION['user_id']) exit;
|
||||
|
||||
|
||||
$idx = trim($_POST['idx']);
|
||||
|
||||
// 수정 전 데이터 불러오기
|
||||
$orgdata = $log = sql_fetch("SELECT * FROM {$fg['member_table']} WHERE idx='{$idx}'");
|
||||
|
||||
// 권한이 상위 권한이거나 관리자인 경우에는 패스워드 일치여부와 관계없이 수정.
|
||||
// 입력한 패스워드가 일치하는 경우에만 수정 진행한다.
|
||||
// 본인 계정을 수정하는경우 패스워드 점검
|
||||
if ( $_SESSION['user_id'] === $orgdata['user_id'] ) {
|
||||
$user_pw = trim($_POST['user_pw']);
|
||||
} else { // 본인 계정이 아닌 경우 $_POST['user_pw'] 값이 없으므로 기존값을 넣어줌
|
||||
$user_pw = "";
|
||||
}
|
||||
if ( password_verify($user_pw, $orgdata['user_pw']) || $_SESSION['user_lv'] > $orgdata['user_lv'] || $_SESSION['user_lv'] == 4 ) {
|
||||
if ( $_POST['user_pw_new'] ) { // 패스워드 변경이 있다면
|
||||
$user_pw = password_hash(trim($_POST['user_pw_new']), PASSWORD_DEFAULT); // 바꿀 패스워드 암호화 처리
|
||||
}
|
||||
|
||||
$user_id = trim($_POST['user_id']); // 로그인 ID
|
||||
$tid = trim($_POST['tid']); // 부서 ID
|
||||
$user_name = trim($_POST['user_name']); // 사용자이름
|
||||
$user_lv = trim($_POST['user_lv']); // 권한
|
||||
$used = trim($_POST['used']); // 사용여부
|
||||
$memo = trim($_POST['memo']); // 메모
|
||||
|
||||
// 변수 값을 DB에 업데이트 하기위한 부분
|
||||
$update = "UPDATE {$fg['member_table']} SET
|
||||
user_id='{$user_id}',
|
||||
tid='{$tid}',
|
||||
user_name='{$user_name}',
|
||||
user_lv='{$user_lv}',
|
||||
used='{$used}',
|
||||
memo='{$memo}'
|
||||
";
|
||||
if( $user_pw != "" ) $update .= ", user_pw='{$user_pw}'"; // 패스워드가 변경되는 경우에만 업데이트
|
||||
|
||||
$where = " WHERE idx='{$idx}'";
|
||||
$query = $update.$where;
|
||||
|
||||
// 데이터 입력 쿼리
|
||||
$result = sql_query($query);
|
||||
}
|
||||
|
||||
// log 기록
|
||||
$work = "사용자수정";
|
||||
$w2 = "대상 ID : ".$log['user_id'];
|
||||
if($log['user_id'] != $user_id) $w2 .= ', ID변경 : '.$log['user_id'].' -> '.$user_id;
|
||||
if($log['user_pw'] != $user_pw) $w2 .= ', PW변경';
|
||||
if($log['tid'] != $tid) $w2 .= ', 부서변경 : '.$log['tid'].' -> '.$tid;
|
||||
if($log['user_lv'] != $user_lv) $w2 .= ', 권한변경 : '.$log['user_lv'].' -> '.$user_lv;
|
||||
if($log['used'] != $used) {
|
||||
$w2 .= ', ';
|
||||
if( $log['used'] == 0 ) $w2 .= '활성화';
|
||||
if( $log['used'] == 1 ) $w2 .= '비활성화';
|
||||
|
||||
}
|
||||
if($log['user_lv'] != $user_lv) $w2 .= '권한변경 : '.$log['user_lv'].' -> '.$user_lv;
|
||||
if($log['memo'] != $memo) $w2 .= ', 메모수정 : '.$log['memo'].' -> '.$memo;
|
||||
|
||||
$time = date("Y-m-d H:i:s");
|
||||
$work_detail = $w2.", 처리자 : ".$_SESSION['user_name'];
|
||||
|
||||
log_update($work, $work_detail, $_SESSION['user_id'], $time);
|
||||
|
||||
$data = array("isSuccess" => $result);
|
||||
header("Content-Type: application/json");
|
||||
echo json_encode($data);
|
||||
231
manager/adm/adm_member.php
Normal file
231
manager/adm/adm_member.php
Normal file
@ -0,0 +1,231 @@
|
||||
<?php
|
||||
include_once "_common.php";
|
||||
if (!isset($_SESSION['user_id'])) header( 'Location: FG_MANAGER_URL' ); // 로그인 되어있지 않으면 로그인 페이지로 보냄
|
||||
|
||||
include_once FG_MANAGER_PATH."/head.php";
|
||||
|
||||
$table = "{$fg['member_table']} AS a LEFT JOIN {$fg['member_group_table']} AS b ON a.tid = b.tid";
|
||||
if ( $_SESSION['user_lv'] == 4 ) { // 시스템관리자는 모든 계정 열람 가능함
|
||||
$where = "";
|
||||
} else { // 아닌경우 로그인 계정과 동일 부서이면서 낮은 등급의 계정만 처리가능
|
||||
$where = "WHERE user_lv < '{$_SESSION['user_lv']}' AND tname = '{$_SESSION['user_team']}' OR user_id = '{$_SESSION['user_id']}'";
|
||||
}
|
||||
$record_count = get_num_rows($table);
|
||||
$ord_by = " ORDER BY idx ASC ";
|
||||
$R = get_result($table, $ord_by, $query_limit, $where);
|
||||
?>
|
||||
<div class="d-flex justify-content-between align-items-center">
|
||||
<p>전체 계정 수 : <b><?=$record_count; ?></b></p>
|
||||
<button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#add_modal">추가</button>
|
||||
</div>
|
||||
<div class="text-center">
|
||||
<table class="table table-striped align-middle">
|
||||
<colgroup>
|
||||
<!-- <col width="70px">-->
|
||||
<col width="150px">
|
||||
<col width="100px">
|
||||
<col width="100px">
|
||||
<col>
|
||||
<col width="200px">
|
||||
<col width="200px">
|
||||
<col width="200px">
|
||||
<col width="110px">
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
<!--<th class="text-center">번호</th>-->
|
||||
<th class="text-center">부서</th>
|
||||
<th class="text-center">이름</th>
|
||||
<th class="text-center">ID</th>
|
||||
<th class="text-center">설명</th>
|
||||
<th class="text-center">최종 로그인</th>
|
||||
<th class="text-center">계정 생성일</th>
|
||||
<th class="text-center">권한</th>
|
||||
<th class="text-center">관리</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<!-- 목록 출력 -->
|
||||
<tbody>
|
||||
<?php foreach($R as $R){ ?>
|
||||
<tr class="<?=($R['used'] == 1) ? "" : "unused"?>">
|
||||
<!--<td class="text-center"><?=$R['idx']?></td>-->
|
||||
<td class="text-center align-middle"><?=$R['tname']?></td>
|
||||
<td class="text-center"><?=$R['user_name']?></td>
|
||||
<td class="text-center"><?=$R['user_id']?></td>
|
||||
<td class="text-center"><?=nl2br($R['memo'])?></td>
|
||||
<td class="text-center"><?=$R['last_login_time']?></td>
|
||||
<td class="text-center"><?=$R['join_datetime']?></td>
|
||||
<td class="text-center">
|
||||
<?php
|
||||
// 레벨 확인하여 권한 확인
|
||||
if($R['user_lv'] == 1){
|
||||
echo "읽기전용";
|
||||
} else if($R['user_lv'] == 2){
|
||||
echo "읽기/VIP추가";
|
||||
} else if($R['user_lv'] == 3){
|
||||
echo "읽기/VIP관리/계정추가";
|
||||
} else if($R['user_lv'] == 4){
|
||||
echo "시스템관리자";
|
||||
}
|
||||
?></td>
|
||||
<td class="text-center">
|
||||
<!-- 수정 페이지 -->
|
||||
<div id="modify_modal_<?=$R['idx']?>" class="modal fade center ">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<form class="modify">
|
||||
<input type="hidden" id="idx" name="idx" value="<?=$R['idx']?>" readonly>
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title">정보 수정</h4>
|
||||
</div>
|
||||
<div class="modal-body text-left">
|
||||
<div class="input-group mb-3">
|
||||
<span class="input-group-text col-md-2" id="user_id_<?=$R['idx']?>">ID</span>
|
||||
<input type="text" class="form-control" oninput="checkDupID(this.value)" id="user_id_<?=$R['idx']?>" name="user_id" value="<?=$R['user_id']?>">
|
||||
</div>
|
||||
<div class="input-group mb-1 checkdup">
|
||||
<span id="duplicate-id-warning"></span>
|
||||
</div>
|
||||
<?php if ($_SESSION['user_id'] === $R['user_id'] ) { // 자기계정인 경우 패스워드 물어봄 ?>
|
||||
<div class="input-group mb-1">
|
||||
기존 패스워드 입력
|
||||
</div>
|
||||
<div class="input-group mb-3">
|
||||
<span class="input-group-text col-md-2" id="user_pw_<?=$R['idx']?>">PW</span>
|
||||
<input type="text" class="form-control" id="user_pw_<?=$R['idx']?>" name="user_pw" value="">
|
||||
</div>
|
||||
<?php } ?>
|
||||
<div class="input-group mb-1">
|
||||
공란으로 두는경우 변경안함
|
||||
</div>
|
||||
<div class="input-group mb-3">
|
||||
<span class="input-group-text col-md-2" id="user_pw_new_<?=$R['idx']?>">변경PW</span>
|
||||
<input type="text" class="form-control" id="user_pw_new_<?=$R['idx']?>" name="user_pw_new" value="">
|
||||
</div>
|
||||
<div class="input-group mb-3">
|
||||
<span class="input-group-text col-md-2" id="tid_<?=$R['idx']?>">부서</span>
|
||||
<select id="tid" name="tid" class="form-select">
|
||||
<option value="<?=$R['tid']?>" selected><?=$R['tname']?></option>
|
||||
<?php
|
||||
foreach (getTeamName() as $row) {
|
||||
if ($row['tid'] === $R['tid']) continue;
|
||||
?>
|
||||
<option value="<?=$row['tid']?>"><?=$row['tname']?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="input-group mb-3">
|
||||
<span class="input-group-text col-md-2" id="user_name_<?=$R['idx']?>">성명</span>
|
||||
<input type="text" class="form-control" id="user_name_<?=$R['idx']?>" name="user_name" value="<?=$R['user_name']?>" ><br>
|
||||
</div>
|
||||
<div class="input-group mb-3">
|
||||
<span class="input-group-text col-md-2" id="user_lv_<?=$R['idx']?>">권한</span>
|
||||
|
||||
<input type="radio" class="btn-check" name="user_lv" id="user_lv_<?=$R['idx']?>_1" value="1" <?=($R['user_lv'] == 1) ? "checked" : "" ?> required>
|
||||
<label class="btn btn-outline-info" for="user_lv_<?=$R['idx']?>_1">읽기</label>
|
||||
<?php if($_SESSION['user_lv'] >= 3){ ?>
|
||||
<input type="radio" class="btn-check" name="user_lv" id="user_lv_<?=$R['idx']?>_2" value="2" <?=($R['user_lv'] == 2) ? "checked" : "" ?> required>
|
||||
<label class="btn btn-outline-info" for="user_lv_<?=$R['idx']?>_2">VIP추가</label>
|
||||
<?php } if($_SESSION['user_lv'] >= 4){ ?>
|
||||
<input type="radio" class="btn-check" name="user_lv" id="user_lv_<?=$R['idx']?>_3" value="3" <?=($R['user_lv'] == 3) ? "checked" : "" ?> required>
|
||||
<label class="btn btn-outline-info" for="user_lv_<?=$R['idx']?>_3">사용자추가</label>
|
||||
<input type="radio" class="btn-check" name="user_lv" id="user_lv_<?=$R['idx']?>_4" value="4" <?=($R['user_lv'] == 4) ? "checked" : "" ?> required>
|
||||
<label class="btn btn-outline-info" for="user_lv_<?=$R['idx']?>_4">시스템관리자</label>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<?php if($_SESSION['user_lv'] == 4 || $_SESSION['user_lv'] > $R['user_lv'] ){ ?>
|
||||
<div class="input-group mb-3">
|
||||
<span class="input-group-text col-md-2" id="used_<?=$R['idx']?>">활성화</span>
|
||||
<input type="radio" class="btn-check" name="used" id="used_<?=$R['idx']?>_1" value="1" <?=($R['used'] == 1) ? "checked" : "" ?> required>
|
||||
<label class="btn btn-outline-info" for="used_<?=$R['idx']?>_1">활성화</label>
|
||||
<input type="radio" class="btn-check" name="used" id="used_<?=$R['idx']?>_0" value="0" <?=($R['used'] != 1) ? "checked" : "" ?> required>
|
||||
<label class="btn btn-outline-info" for="used_<?=$R['idx']?>_0">비활성화</label>
|
||||
</div>
|
||||
<?php } else { ?>
|
||||
<input type="hidden" name="used" id="used_<?=$R['idx']?> value ="<?=$R['used']?>">
|
||||
<?php } // 계정 활성화 체크 끝 ?>
|
||||
<div class="input-group mb-1">
|
||||
<span class="input-group-text col-md-2" id="memo_<?=$R['idx']?>">메모</span>
|
||||
<textarea class="form-control" id="memo_<?=$R['idx']?>" name="memo" ><?=$R['memo']?></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="submit" class="btn btn-primary">수정</button>
|
||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">닫기</button>
|
||||
</div>
|
||||
</form>
|
||||
</div><!-- /.modal-content -->
|
||||
</div><!-- /.modal-dialog -->
|
||||
</div>
|
||||
<!-- 수정 버튼 -->
|
||||
<button class="btn btn-success btn-xs" data-bs-toggle="modal" data-bs-target="#modify_modal_<?=$R['idx']?>"><i class="fa-solid fa-pen-to-square"></i></button>
|
||||
<a class="btn btn-danger btn-xs" href="javascript:deleteItem('<?=$R['idx']?>')" role="button"><i class="fa-solid fa-trash-can"></i></a>
|
||||
</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- 추가 페이지 -->
|
||||
<div id="add_modal" class="modal fade text-center"">
|
||||
<div class="modal-dialog" style="width:800px;">
|
||||
<div class="modal-content">
|
||||
<form class="signup">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title">사용자 추가</h4>
|
||||
</div>
|
||||
<div class="modal-body text-left">
|
||||
<div class="input-group mb-3">
|
||||
<span class="input-group-text col-md-2" id="user_id">ID</span>
|
||||
<input type="text" class="form-control" id="user_id" name="user_id">
|
||||
</div>
|
||||
<div class="input-group mb-3">
|
||||
<span class="input-group-text col-md-2" id="user_pw">PW</span>
|
||||
<input type="text" class="form-control" id="user_pw" name="user_pw">
|
||||
</div>
|
||||
<div class="input-group mb-3">
|
||||
<span class="input-group-text col-md-2" id="tid">부서</span>
|
||||
<option value="">부서선택</option>
|
||||
<select id="tid" name="tid" class="form-select">
|
||||
<?php
|
||||
foreach (getTeamName() as $row) {
|
||||
?>
|
||||
<option value="<?=$row['tid']?>"><?=$row['tname']?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="input-group mb-3">
|
||||
<span class="input-group-text col-md-2" id="user_name">성명</span>
|
||||
<input type="text" class="form-control" id="user_name" name="user_name">
|
||||
</div>
|
||||
<div class="input-group mb-3">
|
||||
<span class="input-group-text col-md-2" id="user_lv">권한</span>
|
||||
<?php if($_SESSION > 2) { ?>
|
||||
<input type="radio" class="btn-check" name="user_lv" id="user_lv_1" value="1" checked required>
|
||||
<label class="btn btn-outline-info" for="user_lv_1">읽기</label>
|
||||
<input type="radio" class="btn-check" name="user_lv" id="user_lv_2" value="2" required>
|
||||
<label class="btn btn-outline-info" for="user_lv_2">VIP추가</label>
|
||||
<?php } if($_SESSION['user_lv'] == "4"){ ?>
|
||||
<input type="radio" class="btn-check" name="user_lv" id="user_lv_3" value="3" required>
|
||||
<label class="btn btn-outline-info" for="user_lv_3">사용자추가</label>
|
||||
<input type="radio" class="btn-check" name="user_lv" id="user_lv_4" value="4" required>
|
||||
<label class="btn btn-outline-info" for="user_lv_4">시스템관리자</label>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<div class="input-group mb-1">
|
||||
<span class="input-group-text col-md-2" id="memo">메모</span>
|
||||
<textarea class="form-control" name="memo" id="memo"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="submit" class="btn btn-primary">추가</button>
|
||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">닫기</button>
|
||||
</div>
|
||||
</form>
|
||||
</div><!-- /.modal-content -->
|
||||
</div><!-- /.modal-dialog -->
|
||||
</div>
|
||||
|
||||
<?php include_once FG_MANAGER_PATH."/tail.php";
|
||||
28
manager/adm/adm_member.update.php
Normal file
28
manager/adm/adm_member.update.php
Normal file
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
include_once ('./_common.php');
|
||||
if(!$_SESSION['user_id']) exit;
|
||||
|
||||
// 변수 선언
|
||||
$user_id = trim($_POST['user_id']);
|
||||
$user_pw = password_hash(trim($_POST['user_pw']), PASSWORD_DEFAULT); // 패스워드 암호화
|
||||
$tid = trim($_POST['tid']);
|
||||
$user_name = trim($_POST['user_name']);
|
||||
$memo = trim($_POST['memo']);
|
||||
$user_lv = trim($_POST['user_lv']);
|
||||
$time = date("Y-m-d H:i:s");
|
||||
|
||||
// 쿼리
|
||||
$query = "INSERT INTO {$fg['member_table']} (user_id, user_pw, tid, user_name, user_lv, join_datetime, used, memo)";
|
||||
$query .= "VALUES('{$user_id}', '{$user_pw}', '{$tid}', '{$user_name}', '{$user_lv}', '{$time}', 1, '{$memo}') ";
|
||||
|
||||
$result = sql_query($query);
|
||||
|
||||
// log 기록
|
||||
$work = "사용자등록";
|
||||
$work_detail = "ID : ".$user_id.", 처리자 : ".$_SESSION['user_name'];
|
||||
|
||||
log_update($work, $work_detail, $_SESSION['user_id'], $time);
|
||||
|
||||
$data = array("isSuccess" => $result);
|
||||
header("Content-Type: application/json");
|
||||
echo json_encode($data);
|
||||
26
manager/adm/adm_member_group.delete.php
Normal file
26
manager/adm/adm_member_group.delete.php
Normal file
@ -0,0 +1,26 @@
|
||||
<?php
|
||||
include_once '_common.php';
|
||||
if(!$_SESSION['user_id']) exit;
|
||||
|
||||
if ( isset($_POST['idx'] )) {
|
||||
$idx = trim($_POST['idx']);
|
||||
|
||||
// log 기록을 위한 데이터 불러오기
|
||||
$query = "SELECT * FROM {$fg['member_group_table']} WHERE tid='{$idx}'";
|
||||
$log = sql_fetch($query);
|
||||
|
||||
// 데이터 삭제
|
||||
$query = "DELETE FROM {$fg['member_group_table']} WHERE tid='{$idx}'";
|
||||
$result = sql_query($query);
|
||||
if ( $result ) { // 삭제가 성공하면 로그 기록함
|
||||
$time = date("Y-m-d H:i:s");
|
||||
$work_detail = "부서명 : ".$log['tname'].", 처리자 : ".$_SESSION['user_name'];
|
||||
$logquery = "INSERT INTO {$fg['log_table']} (work, work_detail, id, date) VALUES ('부서삭제', '{$work_detail}', '{$_SESSION['user_id']}', '{$time}')";
|
||||
$result = sql_query($logquery);
|
||||
// log 기록 끝
|
||||
|
||||
$data = array("isSuccess" => $result);
|
||||
header("Content-Type: application/json");
|
||||
echo json_encode($data);
|
||||
}
|
||||
}
|
||||
51
manager/adm/adm_member_group.modify.php
Normal file
51
manager/adm/adm_member_group.modify.php
Normal file
@ -0,0 +1,51 @@
|
||||
<?php
|
||||
include_once '_common.php';
|
||||
if(!$_SESSION['user_id']) exit;
|
||||
|
||||
if ( isset($_POST['tid']) && isset($_POST['tname']) && isset($_POST['tused']) ) {
|
||||
$tid = trim($_POST['tid']);
|
||||
$tname = trim($_POST['tname']);
|
||||
$tused = trim($_POST['tused']);
|
||||
|
||||
// 업데이트 전 정보 불러오기
|
||||
$q = "SELECT * FROM {$fg['member_group_table']} WHERE tid = '{$tid}'";
|
||||
$team = sql_fetch($q);
|
||||
|
||||
// 변경된 정보 넣어주기
|
||||
$w1 = "";
|
||||
$w2 = "";
|
||||
if($team['tname'] != $tname) {
|
||||
$w1 .= "부서명 변경";
|
||||
$w2 .= $team['tname']."->".$tname;
|
||||
}
|
||||
if($team['tused'] != $tused) {
|
||||
if(!empty($w1)) {
|
||||
$w1 .= ", ";
|
||||
$w2 .= ", ";
|
||||
}
|
||||
$w1 .= "부서출력 변경";
|
||||
if($team['tused'] == 1) {
|
||||
$w2 .= "사용 -> 미사용";
|
||||
} else {
|
||||
$w2 .= "미사용 -> 사용";
|
||||
}
|
||||
}
|
||||
|
||||
// DB에 업데이트
|
||||
$query = "UPDATE {$fg['member_group_table']} SET tname = '{$tname}', tused = '{$tused}'";
|
||||
$query .= " WHERE tid = '{$tid}'";
|
||||
|
||||
$result = sql_query($query);
|
||||
|
||||
if ( $result ) {
|
||||
$work_detail = $w2.", 처리자 : ".$_SESSION['user_name'];
|
||||
$time = date("Y-m-d H:i:s");
|
||||
$logquery = "INSERT INTO {$fg['log_table']} (work, work_detail, id, date) VALUES ('{$w1}', '{$work_detail}', '{$_SESSION['user_id']}', '{$time}')";
|
||||
// log 쿼리 실행
|
||||
$result = sql_query($logquery);
|
||||
|
||||
$data = array("isSuccess" => $result);
|
||||
header("Content-Type: application/json");
|
||||
echo json_encode($data);
|
||||
}
|
||||
}
|
||||
105
manager/adm/adm_member_group.php
Normal file
105
manager/adm/adm_member_group.php
Normal file
@ -0,0 +1,105 @@
|
||||
<?php
|
||||
// 부서관리
|
||||
include_once "_common.php";
|
||||
if (!isset($_SESSION['user_id'])) header( 'Location: FG_MANAGER_URL' ); // 로그인 되어있지 않으면 로그인 페이지로 보냄
|
||||
|
||||
include_once FG_MANAGER_PATH."/head.php";
|
||||
|
||||
$table = $fg['member_group_table'];
|
||||
$record_count = get_num_rows($table); // 전체 갯수 가져오기
|
||||
$ord_by = " ORDER BY tid ASC ";
|
||||
$R = get_result($table, $ord_by, $query_limit);
|
||||
?>
|
||||
|
||||
<div class="d-flex justify-content-between align-items-center">
|
||||
<p>전체 부서 수 : <b><?=$record_count?></b></p>
|
||||
<button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#add_modal">추가</button>
|
||||
</div>
|
||||
|
||||
<table class="table table-striped align-middle">
|
||||
<colgroup>
|
||||
<col width="80px">
|
||||
<col />
|
||||
<col />
|
||||
<col width="200px">
|
||||
<col width="120px">
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="text-center">ID</th>
|
||||
<th class="text-center">부서명</th>
|
||||
<th class="text-center">구성원 수</th>
|
||||
<th class="text-center">노출</th>
|
||||
<th class="text-center">관리</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($R as $R){?>
|
||||
<tr>
|
||||
<td class="text-center"><?=$R['tid']?></td>
|
||||
<td class="text-center"><?=$R['tname']?></td>
|
||||
<td class="text-center"><?php echo getMemberCount($R['tid'])?></td>
|
||||
<td class="text-center"><?php echo ($R['tused'] === '1') ? "활성" : "비활성";?></td>
|
||||
<td class="text-center">
|
||||
<!-- 수정 -->
|
||||
<div id="modify_modal_<?=$R['tid']?>" class="modal fade text-center ">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<form class="modify" id="modify_modal_<?=$R['tid']?>">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title">정보 수정</h4>
|
||||
</div>
|
||||
<div class="modal-body text-left">
|
||||
<input type="hidden" class="form-control" id="tid_<?=$R['tid']?>" name="tid" value="<?=$R['tid']?>">
|
||||
<div class="input-group mb-3">
|
||||
<span class="input-group-text col-md-2" id="tname_<?=$R['tid']?>">부서명</span>
|
||||
<input type="text" class="form-control" id="tname_<?=$R['tid']?>" name="tname" value="<?=$R['tname']?>">
|
||||
<input type="radio" class="btn-check" id="tused_<?=$R['tid']?>_on" name="tused" value="1" autocomplete="off" <?php echo(($R['tused'] == 1)?"checked":"") ?> >
|
||||
<label class="btn btn-outline-primary" for="tused_<?=$R['tid']?>_on">활성</label>
|
||||
<input type="radio" class="btn-check" id="tused_<?=$R['tid']?>_off" name="tused" value="0" autocomplete="off" <?php echo(($R['tused'] == 0)?"checked":"") ?> >
|
||||
<label class="btn btn-outline-primary" for="tused_<?=$R['tid']?>_off">비활성</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="submit" class="btn btn-primary">수정</button>
|
||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">닫기</button>
|
||||
</div>
|
||||
</form>
|
||||
</div><!-- /.modal-content -->
|
||||
</div><!-- /.modal-dialog -->
|
||||
</div>
|
||||
<button class="btn btn-success btn-xs" data-bs-toggle="modal" data-bs-target="#modify_modal_<?=$R['tid']?>"><i class="fa-solid fa-pen-to-square"></i></button>
|
||||
<?php if ($_SESSION['user_lv'] = "4"){ ?>
|
||||
<a class="btn btn-danger btn-xs" href="javascript:deleteItem('<?=$R['tid']?>')" role="button"><i class="fa-solid fa-trash-can"></i></a>
|
||||
<?php } ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<!-- 추가 버튼을 누르면 출력한다. -->
|
||||
<div id="add_modal" class="modal fade center"">
|
||||
<div class="modal-dialog" style="width:800px;">
|
||||
<div class="modal-content">
|
||||
<form class="signup">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title">팀 추가</h4>
|
||||
</div>
|
||||
<div class="modal-body text-left">
|
||||
<div class="input-group">
|
||||
<span class="input-group-text col-md-2" id="tname">팀이름</span>
|
||||
<input type="text" class="form-control" id="tname" name="tname">
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="submit" class="btn btn-primary">추가</button>
|
||||
<button type="button" class="btn btn-default" data-bs-dismiss="modal">닫기</button>
|
||||
</div>
|
||||
</form>
|
||||
</div><!-- /.modal-content -->
|
||||
</div><!-- /.modal-dialog -->
|
||||
</div>
|
||||
|
||||
<?php
|
||||
include_once FG_MANAGER_PATH."/tail.php";
|
||||
23
manager/adm/adm_member_group.update.php
Normal file
23
manager/adm/adm_member_group.update.php
Normal file
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
include_once '_common.php';
|
||||
if(!$_SESSION['user_id']) exit;
|
||||
|
||||
if ( isset($_POST['tname'])) {
|
||||
$tname = trim($_POST['tname']);
|
||||
// 데이터 입력
|
||||
$query = "INSERT INTO {$fg['member_group_table']} (tname, tused) VALUES('{$tname}', '1') "; // 기본값은 활성
|
||||
$result = sql_query($query);
|
||||
if ($result) {
|
||||
// log 기록
|
||||
$work_detail = "부서명 : ".$tname.", 처리자 : ".$_SESSION['user_name'];
|
||||
$time = date("Y-m-d H:i:s");
|
||||
|
||||
$logquery = "INSERT INTO {$fg['log_table']} (work, work_detail, id, date) VALUES ('부서추가', '{$work_detail}', '{$_SESSION['user_id']}', '{$time}')";
|
||||
$result = sql_query($logquery);
|
||||
//log 기록 완료
|
||||
|
||||
$data = array("isSuccess" => $result);
|
||||
header("Content-Type: application/json");
|
||||
echo json_encode($data);
|
||||
}
|
||||
}
|
||||
28
manager/adm/adm_vip_list_category.update.php
Normal file
28
manager/adm/adm_vip_list_category.update.php
Normal file
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
include_once '_common.php';
|
||||
if(!$_SESSION['user_id']) exit;
|
||||
|
||||
// 테이블 선택
|
||||
$table = $fg['vip_category_table'];
|
||||
|
||||
// 변수 선언
|
||||
$gr_name = trim($_POST['gr_name']);
|
||||
$gr_date = trim($_POST['gr_date']);
|
||||
|
||||
// update query
|
||||
$query = "INSERT INTO {$table}(gr_name, gr_date, gr_used)";
|
||||
$query .= "VALUES('{$gr_name}', '{$gr_date}', '1') ";
|
||||
|
||||
$result = sql_query($query);
|
||||
|
||||
// log 기록
|
||||
$work = '구분추가';
|
||||
$time = date("Y-m-d H:i:s");
|
||||
|
||||
$work_detail = "구분명 : ".$gr_name.", 유효기간 : ".$gr_date.", 처리자 : ".$_SESSION['user_name'];
|
||||
|
||||
log_update($work, $work_detail, $_SESSION['user_id'], $time);
|
||||
|
||||
$data = array("isSuccess" => $result);
|
||||
header("Content-Type: application/json");
|
||||
echo json_encode($data);
|
||||
216
manager/adm/dashboard.php
Normal file
216
manager/adm/dashboard.php
Normal file
@ -0,0 +1,216 @@
|
||||
<?php
|
||||
include_once "_common.php";
|
||||
if (!isset($_SESSION['user_id'])) header( 'Location: FG_MANAGER_URL' ); // 로그인 되어있지 않으면 로그인 페이지로 보냄
|
||||
include_once FG_MANAGER_PATH."/head.php";
|
||||
|
||||
// 입고수량 가져오기
|
||||
$iqty = get_qty('입고');
|
||||
$oqty = get_qty('출고');
|
||||
// $rqty = get_qty('재발급');
|
||||
$dqty = get_qty('폐기');
|
||||
|
||||
?>
|
||||
<div class="text-center">
|
||||
<h3>전체재고</h3>
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="text-center" style="width:20%">총 입고</th>
|
||||
<th class="text-center" style="width:20%">정상</th>
|
||||
<th class="text-center" style="width:20%">폐기</th>
|
||||
<th class="text-center" style="width:20%">총 출고</th>
|
||||
<th class="text-center" style="width:20%">출고가능수량</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="text-center">
|
||||
<?=$iqty?>
|
||||
</td>
|
||||
<td class="text-center">
|
||||
<?=$oqty-$dqty?>
|
||||
</td>
|
||||
<td class="text-center">
|
||||
<?=$dqty?>
|
||||
</td>
|
||||
<td class="text-center">
|
||||
<?=$oqty?>
|
||||
</td>
|
||||
<td class="text-center" style="font-weight:600">
|
||||
<?=$iqty - $oqty?>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="7" class="text-right">
|
||||
<?php if($_SESSION['user_lv'] == 4){ ?>
|
||||
<button type="button" class="btn btn-primary btn-sm" data-toggle="modal" data-target="#add_modal">재고추가</button>
|
||||
<!-- 추가 버튼을 누르면 출력한다. -->
|
||||
<div id="add_modal" class="modal fade text-center">
|
||||
<div class="modal-dialog" style="width:800px;">
|
||||
<div class="modal-content">
|
||||
<form class="signup" > <!-- 폼 이름을 알려줌 -->
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||
<h4 class="modal-title">재고 추가</h4>
|
||||
</div>
|
||||
<div class="modal-body text-left">
|
||||
<table class="table table-striped" >
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="text-center" colspan="2">카드입고</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th class="text-center">수량입력</th>
|
||||
<td class="text-left">
|
||||
<div class="form-group">
|
||||
<div class="input"><input type="text" name="input" id="input" value="" onkeydown='return onlyNumber(event)' onkeyup='removeChar(event)' checked></div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="submit" class="btn btn-primary">추가</button>
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">닫기</button>
|
||||
</div>
|
||||
</form>
|
||||
</div><!-- /.modal-content -->
|
||||
</div><!-- /.modal-dialog -->
|
||||
</div>
|
||||
<?php } ?>
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="text-center col-xs-6">
|
||||
<h3>그룹별 출고수량</h3>
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="text-center">구분</th>
|
||||
<th class="text-center">정상</th>
|
||||
<th class="text-center">사용불가</th>
|
||||
<th class="text-center">합계</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
foreach(getVipCatName() as $row) {
|
||||
$qty1 = get_gr_qty($row['gr_id']);
|
||||
$gr_qty1 = get_gr_qty($row['gr_id'],'정상');
|
||||
$dqty1 = get_gr_qty($row['gr_id'],'폐기');
|
||||
$gname = $row['gr_name'];
|
||||
|
||||
if($qty1 == 0) continue; // 합계수량이 0이면 출력안함
|
||||
|
||||
if( isset($tqty1) && $tqty1 ) { // tgty1이 비어있지 않다면
|
||||
$tqty1 = $tqty1 + $qty1;
|
||||
$tgqty1 = $tgqty1 + $gr_qty1;
|
||||
} else { // 비어있다면
|
||||
$tqty1 = $qty1;
|
||||
$tgqty1 = $gr_qty1;
|
||||
}
|
||||
?>
|
||||
<tr>
|
||||
<td class="text-center">
|
||||
<?=$gname?>
|
||||
</td>
|
||||
<td class="text-center">
|
||||
<?=$gr_qty1?>
|
||||
</td>
|
||||
<td class="text-center">
|
||||
<?=$dqty1?>
|
||||
</td>
|
||||
<td class="text-center">
|
||||
<?=$qty1?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
<tr>
|
||||
<td class="text-center">
|
||||
합계
|
||||
</td>
|
||||
<td class="text-center">
|
||||
<?=$tgqty1?>
|
||||
</td>
|
||||
<td class="text-center">
|
||||
<?=$tqty1-$tgqty1?>
|
||||
</td>
|
||||
<td class="text-center">
|
||||
<?=$tqty1?>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="text-center col-xs-6">
|
||||
<h3>부서별 출고수량</h3>
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="text-center">부서명</th>
|
||||
<th class="text-center">정상</th>
|
||||
<th class="text-center">사용불가</th>
|
||||
<th class="text-center">합계</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
foreach(getTeamName() as $row) {
|
||||
$qty2 = get_team_qty($row['tid']);
|
||||
$t_qty2 = get_team_qty($row['tid'],'정상');
|
||||
$tname = $row['tname'];
|
||||
|
||||
if($qty2 == 0) continue; // 합계수량이 0이면 출력안함
|
||||
|
||||
if(empty($tqty2)) {
|
||||
$tqty2 = $qty2;
|
||||
$tgqty2 = $t_qty2;
|
||||
} else {
|
||||
$tqty2 = $tqty2 + $qty2;
|
||||
$tgqty2 = $tgqty2 + $t_qty2;
|
||||
}
|
||||
?>
|
||||
<tr>
|
||||
<td class="text-center">
|
||||
<?=$tname?>
|
||||
</td>
|
||||
<td class="text-center">
|
||||
<?=$t_qty2?>
|
||||
</td>
|
||||
<td class="text-center">
|
||||
<?=$qty2-$t_qty2?>
|
||||
</td>
|
||||
<td class="text-center">
|
||||
<?=$qty2?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
<tr>
|
||||
<td class="text-center">
|
||||
합계
|
||||
</td>
|
||||
<td class="text-center">
|
||||
<?=$tgqty2?>
|
||||
</td>
|
||||
<td class="text-center">
|
||||
<?=$tqty2-$tgqty2?>
|
||||
</td>
|
||||
<td class="text-center">
|
||||
<?=$tqty2?>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
include_once FG_MANAGER_PATH."/tail.php";
|
||||
25
manager/adm/dashboard_update.php
Normal file
25
manager/adm/dashboard_update.php
Normal file
@ -0,0 +1,25 @@
|
||||
<?php
|
||||
if(!$_SESSION['user_id']) exit;
|
||||
include_once '_common.php';
|
||||
include_once 'lib/lib.php';
|
||||
|
||||
// 변수 선언
|
||||
$input = trim($_POST['input']); // 신청부서
|
||||
$date = date("Y-m-d H:i:s"); // 작업일시
|
||||
$memo = $vip_card_no.' 입고, 처리자 : '.$_SESSION['user_name']; // memo
|
||||
|
||||
// DB에 넣을 쿼리문 작성
|
||||
$query = "INSERT INTO {$fg['card_stock_table']} (status, input, memo, date)";
|
||||
$query .= "VALUES('입고', '{$input}', '{$memo}', '{$date}') ";
|
||||
$result = sql_query($query);
|
||||
|
||||
// log 기록
|
||||
$time = date("Y-m-d H:i:s");
|
||||
|
||||
$work_detail = "수량 : ".$input."EA, 처리자 : ".$_SESSION['user_name'];
|
||||
$logquery = "INSERT INTO {$fg['log_table']} (work, work_detail, id, date) VALUES ('입고', '{$work_detail}', '{$_SESSION['user_id']}', '{$time}')";
|
||||
$result = sql_query($logquery);
|
||||
|
||||
$data = array("isSuccess" => $result);
|
||||
header("Content-Type: application/json");
|
||||
echo json_encode($data);
|
||||
100
manager/adm/ent_list.php
Normal file
100
manager/adm/ent_list.php
Normal file
@ -0,0 +1,100 @@
|
||||
<?php
|
||||
// annual_member.php 연간회원권
|
||||
include_once "_common.php";
|
||||
if (!isset($_SESSION['user_id'])) header( 'Location: FG_MANAGER_URL' ); // 로그인 되어있지 않으면 로그인 페이지로 보냄
|
||||
include_once FG_MANAGER_PATH."/head.php";
|
||||
|
||||
// 검색 변수 초기화, 검색 관련
|
||||
$search_word = isset($_REQUEST["search_word"]) ? $_REQUEST["search_word"] : ""; // 검색어
|
||||
$search_cat = isset($_REQUEST["search_cat"]) ? $_REQUEST["search_cat"] : ""; // 카테고리
|
||||
$search_sdate = isset($_REQUEST["search_sdate"]) ? $_REQUEST["search_sdate"] : "";
|
||||
$search_edate = isset($_REQUEST["search_edate"]) ? $_REQUEST["search_edate"] : "";
|
||||
$search = $where = $search_count = "";
|
||||
if ($search_word) $search .= " ( mem_no LIKE '%$search_word%' ) ";
|
||||
if ($search_cat) {
|
||||
if ($search_word) $search .= "AND";
|
||||
$search .= " cat_name = '{$search_cat}'";
|
||||
}
|
||||
if ($search_sdate) {
|
||||
if ($search_word || $search_cat) $search .= "AND";
|
||||
$search .= " exp_sdate >= $search_sdate";
|
||||
}
|
||||
if ($search_edate) {
|
||||
if ($search_word || $search_cat || $search_edate) $search .= "AND";
|
||||
$search .= " exp_edate =< $search_edate";
|
||||
}
|
||||
if ($search) {
|
||||
$where = "WHERE {$search}";
|
||||
$search_count = get_num_rows($fg['enter_table'], $where); // 검색 결과 수 구하기
|
||||
}
|
||||
// 검색 쿼리 만들기 끝
|
||||
$record_count = get_num_rows($fg['enter_table']); // 전체 갯수 구하기
|
||||
$query = "SELECT * FROM {$fg['enter_table']} {$where} ORDER BY ent_datetime DESC {$query_limit}";
|
||||
$result = sql_query($query);
|
||||
$R = array();
|
||||
while($row=sql_fetch_array($result)) { // 전체 배열에 저장
|
||||
array_push($R, $row);
|
||||
}
|
||||
|
||||
?>
|
||||
<script>
|
||||
document.getElementById('sdate').value = new Date().toISOString().substring(0, 10);
|
||||
</script>
|
||||
<!-- 검색폼 시작 -->
|
||||
|
||||
<div class="d-flex flex-column mb-3">
|
||||
<p>검색은 구분/성명/연락처/회원번호로만 가능합니다.</p>
|
||||
<form class="search" method="get" action="">
|
||||
<div class="d-flex flex-row flex-wrap gap-2 mb-3">
|
||||
<input type="radio" name="search_cat" id="search_cat_all" class="btn-check" value="" <?php if (empty($search_cat)) echo "checked" ?>>
|
||||
<label class="btn btn-outline-primary" for="search_cat_all">전체</label>
|
||||
<input type="radio" name="search_cat" id="search_cat_vip" class="btn-check" value="VIP" <?php if ($search_cat === $R['cat_name']) echo "checked" ?>>
|
||||
<label class="btn btn-outline-primary" for="search_cat_vip">VIP</label>
|
||||
<input type="radio" name="search_cat" id="search_cat_annu" class="btn-check" value="연간" <?php if ($search_cat === $R['cat_name']) echo "checked" ?>>
|
||||
<label class="btn btn-outline-primary" for="search_cat_annu">연간</label>
|
||||
</div>
|
||||
<div class="input-group col-md-6">
|
||||
<span class="input-group-text" id="search_word">회원검색</span>
|
||||
<input type="text" name="search_word" class="form-control" id="search_word" aria-describedby="search_word" placeholder="검색어를 입력하세요" autofocus value="<?=$search_word ?>">
|
||||
<button type="submit" class="btn btn-secondary">검색</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<!-- 검색폼 끝 -->
|
||||
<div class="d-flex justify-content-between my-1">
|
||||
<div>
|
||||
<p>전체 : <b><?=$record_count?></b> 건 | 검색 결과 : <?=$search_count ? $search_count : $record_count?> 건</p>
|
||||
</div>
|
||||
<!--
|
||||
<div class="d-flex flex-row-reverse column-gap-2">
|
||||
<form method="post" action="inc/annual_member_list_excel.php">
|
||||
<button type="submit" class="btn btn-secondary" >엑셀저장</button>
|
||||
</form>
|
||||
</div>
|
||||
-->
|
||||
</div>
|
||||
|
||||
<table class="table table-striped align-middle table-hover">
|
||||
<colgroup>
|
||||
<col width="">
|
||||
<col width="">
|
||||
<col width="">
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr class="align-middle">
|
||||
<th class="text-center">구분</th>
|
||||
<th class="text-center">회원번호</th>
|
||||
<th class="text-center">방문일시</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="table-group-divider">
|
||||
<?php foreach($R as $r) {
|
||||
echo '<tr>';
|
||||
echo '<td class="text-center">' . ($r['cat_name'] ?? '') . '</td>';
|
||||
echo '<td class="text-center">' . $r['mem_no'] . '</td>';
|
||||
echo '<td class="text-center">' . $r['ent_datetime'] . '</td>';
|
||||
echo '</tr>';
|
||||
} ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php include_once FG_MANAGER_PATH."/tail.php";
|
||||
13
manager/adm/gr.delete.php
Normal file
13
manager/adm/gr.delete.php
Normal file
@ -0,0 +1,13 @@
|
||||
<?php
|
||||
include_once ('./_common.php');
|
||||
include_once ()'lib/lib.php');
|
||||
if(!$_SESSION['user_id']) exit();
|
||||
|
||||
$gr_id = trim($_POST['gr_id']);
|
||||
|
||||
$query = "DELETE FROM {$fg['group_table']} WHERE gr_id='{$gr_id}'";
|
||||
$result = sql_query($query);
|
||||
|
||||
$data = array("isSuccess" => $result);
|
||||
header("Content-Type: application/json");
|
||||
echo json_encode($data);
|
||||
20
manager/adm/gr.modify.php
Normal file
20
manager/adm/gr.modify.php
Normal file
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
include_once ('./_common.php');
|
||||
if(!$_SESSION['user_id']) exit();
|
||||
|
||||
// POST로 가져온 값을 변수에 넣어준다.
|
||||
$gr_id = $_POST['gr_id'];
|
||||
$gr_used = trim($_POST['gr_used']);
|
||||
$gr_name = trim($_POST['gr_name']);
|
||||
$gr_date = trim($_POST['gr_date']);
|
||||
$gr_lv = trim($_POST['gr_lv']);
|
||||
|
||||
// 변수 값을 DB에 업데이트
|
||||
$where = " WHERE gr_id = '{$gr_id}'";
|
||||
$query = "UPDATE {$fg['group_table']} SET gr_used = '{$gr_used}', gr_name = '{$gr_name}', gr_date = '{$gr_date}', gr_lv = '{$gr_lv}'".$where;
|
||||
|
||||
$result = sql_query($query);
|
||||
|
||||
$data = array("isSuccess" => $result);
|
||||
header("Content-Type: application/json");
|
||||
echo json_encode($data);
|
||||
18
manager/adm/gr.signup.php
Normal file
18
manager/adm/gr.signup.php
Normal file
@ -0,0 +1,18 @@
|
||||
<?php
|
||||
include_once ('./_common.php');
|
||||
if(!$_SESSION['user_id']) exit();
|
||||
|
||||
// 변수 선언
|
||||
$gr_name = trim($_POST['gr_name']);
|
||||
$gr_date = trim($_POST['gr_date']);
|
||||
|
||||
// 쿼리 만든다
|
||||
$query = "INSERT INTO {$fg['group_table']} (gr_name, gr_date, gr_used, gr_lv)";
|
||||
$query .= "VALUES('{$gr_name}', '{$gr_date}', '1', '1') ";
|
||||
|
||||
|
||||
$result = sql_query($query);
|
||||
|
||||
$data = array("isSuccess" => $result);
|
||||
header("Content-Type: application/json");
|
||||
echo json_encode($data);
|
||||
788
manager/adm/static.php
Normal file
788
manager/adm/static.php
Normal file
@ -0,0 +1,788 @@
|
||||
<?php
|
||||
// 데이터베이스 연결 설정
|
||||
$server = "100.80.3.6";
|
||||
$user = "firstgarden";
|
||||
$pass = "Fg9576861!";
|
||||
$db = "firstgarden";
|
||||
|
||||
// MySQLi 연결 생성
|
||||
$conn = new mysqli($server, $user, $pass, $db);
|
||||
|
||||
// 연결 확인
|
||||
if ($conn->connect_error) {
|
||||
die("연결 실패: " . $conn->connect_error);
|
||||
}
|
||||
|
||||
|
||||
// 선택한 날짜 가져오기
|
||||
$date = isset($_GET['date']) ? $_GET['date'] : date('Y-m-d');
|
||||
|
||||
// 어제 날짜 계산
|
||||
$yesterday = date('Y-m-d', strtotime($date . ' -1 day'));
|
||||
|
||||
// SQL 쿼리 실행
|
||||
$sql = "SELECT category_name, product_name, option_name, qty FROM product_quantities WHERE date = '$date'";
|
||||
$result = $conn->query($sql);
|
||||
|
||||
// 어제 데이터 가져오기
|
||||
$sql_yesterday = "SELECT category_name, product_name, option_name, qty FROM product_quantities WHERE date = '$yesterday'";
|
||||
$result_yesterday = $conn->query($sql_yesterday);
|
||||
|
||||
// 데이터 초기화
|
||||
$data = [
|
||||
'홈페이지' => [
|
||||
'1부' => [
|
||||
'R석' => [
|
||||
'대인' => 0, '소인' => 0, '36개월미만' => 0
|
||||
],
|
||||
'S석' => [
|
||||
'대인' => 0, '소인' => 0, '36개월미만' => 0
|
||||
],
|
||||
'A석' => [
|
||||
'대인' => 0, '소인' => 0, '36개월미만' => 0
|
||||
]
|
||||
],
|
||||
'2부' => [
|
||||
'R석' => [
|
||||
'대인' => 0, '소인' => 0, '36개월미만' => 0
|
||||
],
|
||||
'S석' => [
|
||||
'대인' => 0, '소인' => 0, '36개월미만' => 0
|
||||
],
|
||||
'A석' => [
|
||||
'대인' => 0, '소인' => 0, '36개월미만' => 0
|
||||
]
|
||||
]
|
||||
],
|
||||
'큐패스' => [
|
||||
'1부' => [
|
||||
'R석' => [
|
||||
'대인' => 0, '소인' => 0, '36개월 미만' => 0
|
||||
],
|
||||
'S석' => [
|
||||
'대인' => 0, '소인' => 0, '36개월 미만' => 0
|
||||
],
|
||||
'A석' => [
|
||||
'대인' => 0, '소인' => 0, '36개월 미만' => 0
|
||||
]
|
||||
],
|
||||
'2부' => [
|
||||
'R석' => [
|
||||
'대인' => 0, '소인' => 0, '36개월 미만' => 0
|
||||
],
|
||||
'S석' => [
|
||||
'대인' => 0, '소인' => 0, '36개월 미만' => 0
|
||||
],
|
||||
'A석' => [
|
||||
'대인' => 0, '소인' => 0, '36개월 미만' => 0
|
||||
]
|
||||
]
|
||||
]
|
||||
];
|
||||
$y_data = [
|
||||
'홈페이지' => [
|
||||
'1부' => [
|
||||
'R석' => [
|
||||
'대인' => 0, '소인' => 0, '36개월미만' => 0
|
||||
],
|
||||
'S석' => [
|
||||
'대인' => 0, '소인' => 0, '36개월미만' => 0
|
||||
],
|
||||
'A석' => [
|
||||
'대인' => 0, '소인' => 0, '36개월미만' => 0
|
||||
]
|
||||
],
|
||||
'2부' => [
|
||||
'R석' => [
|
||||
'대인' => 0, '소인' => 0, '36개월미만' => 0
|
||||
],
|
||||
'S석' => [
|
||||
'대인' => 0, '소인' => 0, '36개월미만' => 0
|
||||
],
|
||||
'A석' => [
|
||||
'대인' => 0, '소인' => 0, '36개월미만' => 0
|
||||
]
|
||||
]
|
||||
],
|
||||
'큐패스' => [
|
||||
'1부' => [
|
||||
'R석' => [
|
||||
'대인' => 0, '소인' => 0, '36개월 미만' => 0
|
||||
],
|
||||
'S석' => [
|
||||
'대인' => 0, '소인' => 0, '36개월 미만' => 0
|
||||
],
|
||||
'A석' => [
|
||||
'대인' => 0, '소인' => 0, '36개월 미만' => 0
|
||||
]
|
||||
],
|
||||
'2부' => [
|
||||
'R석' => [
|
||||
'대인' => 0, '소인' => 0, '36개월 미만' => 0
|
||||
],
|
||||
'S석' => [
|
||||
'대인' => 0, '소인' => 0, '36개월 미만' => 0
|
||||
],
|
||||
'A석' => [
|
||||
'대인' => 0, '소인' => 0, '36개월 미만' => 0
|
||||
]
|
||||
]
|
||||
]
|
||||
];
|
||||
|
||||
// 데이터를 변환하는 로직
|
||||
if ($result->num_rows > 0) {
|
||||
// 각 행 데이터 처리
|
||||
while ($row = $result->fetch_assoc()) {
|
||||
if (preg_match('/\[(.+?)\](.+?)\s(.+)/', $row['option_name'], $matches)) {
|
||||
$part = $matches[1]; // 예: '1부'
|
||||
$seat = $matches[2]; // 예: 'R석'
|
||||
$option = $matches[3]; // 예: '대인'
|
||||
}
|
||||
|
||||
// $data[$row['category_name']][$row['product_name']][$part][$seat][$option] = $row['qty'];
|
||||
$data[$row['category_name']][$part][$seat][$option] = $row['qty'];
|
||||
}
|
||||
}
|
||||
|
||||
if ($result_yesterday->num_rows > 0) {
|
||||
// 어제 각 행 데이터 처리
|
||||
while ($row = $result_yesterday->fetch_assoc()) {
|
||||
if (preg_match('/\[(.+?)\](.+?)\s(.+)/', $row['option_name'], $matches)) {
|
||||
$part = $matches[1]; // 예: '1부'
|
||||
$seat = $matches[2]; // 예: 'R석'
|
||||
$option = $matches[3]; // 예: '대인'
|
||||
}
|
||||
// $y_data[$row['category_name']][$row['product_name']][$part][$seat][$option] = $row['qty'];
|
||||
$y_data[$row['category_name']][$part][$seat][$option] = $row['qty'];
|
||||
}
|
||||
}
|
||||
|
||||
function totalView($data) {
|
||||
$result = sprintf("%+d", $data);
|
||||
return $result;
|
||||
}
|
||||
|
||||
// 합계 초기화
|
||||
$web_part1 = $web_part2 = $qpos_part1 = $qpos_part2 = 0;
|
||||
|
||||
function catSum($is_web, $option, $data) {
|
||||
$sum = 0;
|
||||
if ( isset($data[$is_web][$option]) && is_array($data[$is_web][$option]) ) {
|
||||
foreach ($data[$is_web][$option] as $seat => $option) {
|
||||
foreach ($option as $row) {
|
||||
$sum += $row;
|
||||
|
||||
}
|
||||
}
|
||||
return $sum;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// 합계 데이터 저장
|
||||
$web_part1 = catSum('홈페이지', '1부', $data);
|
||||
$web_part2 = catSum('홈페이지', '2부', $data);
|
||||
$qpos_part1 = catSum('큐패스', '1부', $data);
|
||||
$qpos_part2 = catSum('큐패스', '2부', $data);
|
||||
|
||||
$y_web_part1 = catSum('홈페이지', '1부', $y_data);
|
||||
$y_web_part2 = catSum('홈페이지', '2부', $y_data);
|
||||
$y_qpos_part1 = catSum('큐패스', '1부', $y_data);
|
||||
$y_qpos_part2 = catSum('큐패스', '2부', $y_data);
|
||||
|
||||
$web_total = $web_part1 + $web_part2;
|
||||
$qpos_total = $qpos_part1 + $qpos_part2;
|
||||
|
||||
$y_web_total = $y_web_part1 + $y_web_part2;
|
||||
$y_qpos_total = $y_qpos_part1 + $y_qpos_part2;
|
||||
$y_grand_total = $y_web_total + $y_qpos_total;
|
||||
|
||||
$sub_total1 = $web_part1 + $qpos_part1;
|
||||
$sub_total2 = $web_part2 + $qpos_part2;
|
||||
|
||||
$grand_total = $web_total + $qpos_total;
|
||||
|
||||
$y_sub_total1 = $y_web_part1 + $y_qpos_part1;
|
||||
$y_sub_total2 = $y_web_part2 + $y_qpos_part2;
|
||||
|
||||
$y_grand_total = $y_web_total + $y_qpos_total;
|
||||
|
||||
// 최종 업데이트 시간 알려주기
|
||||
// 현재 서버의 시간대를 설정 (+9 시간, 한국 표준시)
|
||||
date_default_timezone_set('Asia/Seoul');
|
||||
|
||||
// 현재 시각 가져오기
|
||||
$currentDateTime = new DateTime();
|
||||
|
||||
// 현재 분을 확인하여 조정
|
||||
if ((int)$currentDateTime->format('i') < 3) {
|
||||
// 현재 분이 3보다 작으면 1시간 전으로 이동
|
||||
$currentDateTime->modify('-1 hour');
|
||||
}
|
||||
|
||||
// 03분으로 설정
|
||||
$currentDateTime->setTime((int)$currentDateTime->format('H'), 3, 0);
|
||||
|
||||
$data['w'] = [
|
||||
0 => ['today' => $data['홈페이지']['1부']['R석']['대인'] + $data['홈페이지']['2부']['R석']['대인'],
|
||||
'yesterday' => $y_data['홈페이지']['1부']['R석']['대인'] + $y_data['홈페이지']['2부']['R석']['대인']],
|
||||
1 => ['today' => $data['홈페이지']['1부']['R석']['소인'] + $data['홈페이지']['2부']['R석']['소인'],
|
||||
'yesterday' => $y_data['홈페이지']['1부']['R석']['소인'] + $y_data['홈페이지']['2부']['R석']['소인']],
|
||||
2 => ['today' => $data['홈페이지']['1부']['R석']['36개월미만'] + $data['홈페이지']['2부']['R석']['36개월미만'],
|
||||
'yesterday' => $y_data['홈페이지']['1부']['R석']['36개월미만'] + $y_data['홈페이지']['2부']['R석']['36개월미만']],
|
||||
3 => ['today' => $data['홈페이지']['1부']['S석']['대인'] + $data['홈페이지']['2부']['S석']['대인'],
|
||||
'yesterday' => $y_data['홈페이지']['1부']['S석']['대인'] + $y_data['홈페이지']['2부']['S석']['대인']],
|
||||
4 => ['today' => $data['홈페이지']['1부']['S석']['소인'] + $data['홈페이지']['2부']['S석']['소인'],
|
||||
'yesterday' => $y_data['홈페이지']['1부']['S석']['소인'] + $y_data['홈페이지']['2부']['S석']['소인']],
|
||||
5 => ['today' => $data['홈페이지']['1부']['S석']['36개월미만'] + $data['홈페이지']['2부']['S석']['36개월미만'],
|
||||
'yesterday' => $y_data['홈페이지']['1부']['S석']['36개월미만'] + $y_data['홈페이지']['2부']['S석']['36개월미만']],
|
||||
6 => ['today' => $data['홈페이지']['1부']['A석']['대인'] + $data['홈페이지']['2부']['A석']['대인'],
|
||||
'yesterday' => $y_data['홈페이지']['1부']['A석']['대인'] + $y_data['홈페이지']['2부']['A석']['대인']],
|
||||
7 => ['today' => $data['홈페이지']['1부']['A석']['소인'] + $data['홈페이지']['2부']['A석']['소인'],
|
||||
'yesterday' => $y_data['홈페이지']['1부']['A석']['소인'] + $y_data['홈페이지']['2부']['A석']['소인']],
|
||||
8 => ['today' => $data['홈페이지']['1부']['A석']['36개월미만'] + $data['홈페이지']['2부']['A석']['36개월미만'],
|
||||
'yesterday' => $y_data['홈페이지']['1부']['A석']['36개월미만'] + $y_data['홈페이지']['2부']['A석']['36개월미만']]
|
||||
];
|
||||
|
||||
$data['q'] = [
|
||||
0 => ['today' => $data['큐패스']['1부']['R석']['대인'] + $data['큐패스']['2부']['R석']['대인'],
|
||||
'yesterday' => $y_data['큐패스']['1부']['R석']['대인'] + $y_data['큐패스']['2부']['R석']['대인']],
|
||||
1 => ['today' => $data['큐패스']['1부']['R석']['소인'] + $data['큐패스']['2부']['R석']['소인'],
|
||||
'yesterday' => $y_data['큐패스']['1부']['R석']['소인'] + $y_data['큐패스']['2부']['R석']['소인']],
|
||||
2 => ['today' => $data['큐패스']['1부']['R석']['36개월 미만'] + $data['큐패스']['2부']['R석']['36개월 미만'],
|
||||
'yesterday' => $y_data['큐패스']['1부']['R석']['36개월 미만'] + $y_data['큐패스']['2부']['R석']['36개월 미만']],
|
||||
3 => ['today' => $data['큐패스']['1부']['S석']['대인'] + $data['큐패스']['2부']['S석']['대인'],
|
||||
'yesterday' => $y_data['큐패스']['1부']['S석']['대인'] + $y_data['큐패스']['2부']['S석']['대인']],
|
||||
4 => ['today' => $data['큐패스']['1부']['S석']['소인'] + $data['큐패스']['2부']['S석']['소인'],
|
||||
'yesterday' => $y_data['큐패스']['1부']['S석']['소인'] + $y_data['큐패스']['2부']['S석']['소인']],
|
||||
5 => ['today' => $data['큐패스']['1부']['S석']['36개월 미만'] + $data['큐패스']['2부']['S석']['36개월 미만'],
|
||||
'yesterday' => $y_data['큐패스']['1부']['S석']['36개월 미만'] + $y_data['큐패스']['2부']['S석']['36개월 미만']],
|
||||
6 => ['today' => $data['큐패스']['1부']['A석']['대인'] + $data['큐패스']['2부']['A석']['대인'],
|
||||
'yesterday' => $y_data['큐패스']['1부']['A석']['대인'] + $y_data['큐패스']['2부']['A석']['대인']],
|
||||
7 => ['today' => $data['큐패스']['1부']['A석']['소인'] + $data['큐패스']['2부']['A석']['소인'],
|
||||
'yesterday' => $y_data['큐패스']['1부']['A석']['소인'] + $y_data['큐패스']['2부']['A석']['소인']],
|
||||
8 => ['today' => $data['큐패스']['1부']['A석']['36개월 미만'] + $data['큐패스']['2부']['A석']['36개월 미만'],
|
||||
'yesterday' => $y_data['큐패스']['1부']['A석']['36개월 미만'] + $y_data['큐패스']['2부']['A석']['36개월 미만']]
|
||||
];
|
||||
|
||||
// 각 항목별 합계를 저장할 배열 초기화
|
||||
$web_totals = [];
|
||||
$qpos_totals = [];
|
||||
|
||||
// 홈페이지 합계 계산
|
||||
foreach ($data['w'] as $key => $row) {
|
||||
$web_totals[$key]['today'] = $row['today'];
|
||||
$web_totals[$key]['yesterday'] = $row['yesterday'];
|
||||
}
|
||||
|
||||
// 큐패스 합계 계산
|
||||
foreach ($data['q'] as $key => $row) {
|
||||
$qpos_totals[$key]['today'] = $row['today'];
|
||||
$qpos_totals[$key]['yesterday'] = $row['yesterday'];
|
||||
}
|
||||
|
||||
// 전체 합계
|
||||
$grand_totals = [];
|
||||
foreach ($web_totals as $key => $value) {
|
||||
$grand_totals[$key]['today'] = $web_totals[$key]['today'] + $qpos_totals[$key]['today'];
|
||||
$grand_totals[$key]['yesterday'] = $web_totals[$key]['yesterday'] + $qpos_totals[$key]['yesterday'];
|
||||
}
|
||||
|
||||
$web_total = array_sum(array_column($data['w'], 'today'));
|
||||
$y_web_total = array_sum(array_column($data['w'], 'yesterday'));
|
||||
$qpos_total = array_sum(array_column($data['q'], 'today'));
|
||||
$y_qpos_total = array_sum(array_column($data['q'], 'yesterday'));
|
||||
$grand_total = $web_total + $qpos_total;
|
||||
$y_grand_total = $y_web_total + $y_qpos_total;
|
||||
|
||||
?>
|
||||
|
||||
<style>
|
||||
h2 {margin-top: 30px !important;}
|
||||
.table {font-weight: 200;}
|
||||
.sum {font-weight: 500;}
|
||||
.tsum {font-weight: 600;}
|
||||
.chart {
|
||||
border: 2px solid #333333;
|
||||
border-radius: 3px;
|
||||
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
|
||||
margin: 20px auto;
|
||||
background-color: #f8f9fa;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>데이터 조회</title>
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz" crossorigin="anonymous"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<section class="container mt-3" style="max-width:1200px">
|
||||
<div>
|
||||
<form method="get">
|
||||
<div class="input-group mb-3" style="max-width:200px;">
|
||||
<input class="form-control" type="date" name="date" value="<?php echo htmlspecialchars($date); ?>">
|
||||
<input class="btn btn-primary" type="submit" value="조회">
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="text-end">
|
||||
최종 업데이트 : <?=$currentDateTime->format('Y-m-d H:i')?>
|
||||
</div>
|
||||
<?php if ($result->num_rows > 0) { ?>
|
||||
|
||||
|
||||
<h2>구매고객</h2>
|
||||
<table class="table table-bordered table-hover text-center align-middle">
|
||||
<colgroup>
|
||||
<col style="width: 100px";>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
<col style="width:150px;">
|
||||
</colgroup>
|
||||
<thead class="table-primary">
|
||||
<tr>
|
||||
<th class="align-middle" rowspan="2">구분</th>
|
||||
<th class="align-middle" colspan="3">R석</th>
|
||||
<th class="align-middle" colspan="3">S석</th>
|
||||
<th class="align-middle" colspan="3">A석</th>
|
||||
<th class="align-middle" rowspan="2">합계</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="align-middle">대인</th>
|
||||
<th class="align-middle">소인</th>
|
||||
<th class="align-middle">유아</th>
|
||||
<th class="align-middle">대인</th>
|
||||
<th class="align-middle">소인</th>
|
||||
<th class="align-middle">유아</th>
|
||||
<th class="align-middle">대인</th>
|
||||
<th class="align-middle">소인</th>
|
||||
<th class="align-middle">유아</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th class="align-middle">홈페이지</th>
|
||||
<?php foreach ($data['w'] as $row) { ?>
|
||||
<td class="align-middle">
|
||||
<?=$row['today']?>
|
||||
<span class='text-muted'>(<?=totalView($row['today'] - $row['yesterday'])?>)</span>
|
||||
</td>
|
||||
<?php } ?>
|
||||
<td class="align-middle tsum">
|
||||
<?=$web_total?>
|
||||
<span class='text-muted'>(<?=totalView($web_total - $y_web_total)?>)</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="align-middle">큐패스</th>
|
||||
<?php foreach ($data['q'] as $row) { ?>
|
||||
<td class="align-middle">
|
||||
<?=$row['today']?>
|
||||
<span class='text-muted'>(<?=totalView($row['today'] - $row['yesterday'])?>)</span>
|
||||
</td>
|
||||
<?php } ?>
|
||||
<td class="align-middle tsum">
|
||||
<?=$qpos_total?>
|
||||
<span class='text-muted'>(<?=totalView($qpos_total - $y_qpos_total)?>)</span>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<!-- 합계 행 -->
|
||||
<tfoot class="table-info">
|
||||
<tr class="sum">
|
||||
<th class="align-middle">합계</th>
|
||||
<?php foreach ($grand_totals as $totals) { ?>
|
||||
<td class="align-middle tsum">
|
||||
<?=$totals['today']?>
|
||||
<span class='text-muted'>(<?=totalView($totals['today'] - $totals['yesterday'])?>)</span>
|
||||
</td>
|
||||
<?php } ?>
|
||||
<td class="align-middle tsum">
|
||||
<?=$grand_total?>
|
||||
<span class='text-muted'>(<?=totalView($grand_total - $y_grand_total)?>)</span>
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
|
||||
<?php } else { ?>
|
||||
<p>결과가 없습니다.</p>
|
||||
<?php } ?>
|
||||
</section>
|
||||
|
||||
|
||||
<?php
|
||||
// 데이터 가져오기
|
||||
$query = "
|
||||
SELECT
|
||||
DATE(date) as order_date,
|
||||
category_name,
|
||||
product_name,
|
||||
IF(option_name IN ('36개월 미만', '36개월미만'), '유아', REPLACE(option_name, '[1부]', '')) as option_name,
|
||||
qty
|
||||
FROM product_quantities
|
||||
WHERE product_name = '어린이날'
|
||||
ORDER BY order_date, option_name;
|
||||
";
|
||||
|
||||
$result = $conn->query($query);
|
||||
|
||||
// 데이터 처리
|
||||
$data = [];
|
||||
$previousData = []; // 전일 데이터를 저장
|
||||
|
||||
while ($row = $result->fetch_assoc()) {
|
||||
$date = $row['order_date'];
|
||||
$date = date('m/d', strtotime($date));
|
||||
$option = trim($row['option_name']);
|
||||
$todayQty = (int)$row['qty'];
|
||||
$category = $row['category_name'];
|
||||
|
||||
// 데이터 정리 (홈페이지, 큐패스별)
|
||||
if (!isset($data[$date])) {
|
||||
$data[$date] = [
|
||||
'homepage' => 0,
|
||||
'qpass' => 0,
|
||||
'total' => 0,
|
||||
'options' => []
|
||||
];
|
||||
}
|
||||
|
||||
if ($category === "홈페이지") {
|
||||
$data[$date]['homepage'] += $todayQty;
|
||||
} else if ($category === "큐패스") {
|
||||
$data[$date]['qpass'] += $todayQty;
|
||||
}
|
||||
$data[$date]['total'] += $todayQty;
|
||||
|
||||
// 옵션명에서 [2부] 텍스트 제거
|
||||
$option = str_replace('[2부]', '', $option);
|
||||
|
||||
// 옵션별 수량 저장
|
||||
if (!isset($data[$date]['options'][$option])) {
|
||||
$data[$date]['options'][$option] = 0;
|
||||
}
|
||||
|
||||
$data[$date]['options'][$option] += $todayQty;}
|
||||
|
||||
$dates = array_keys($data); // 날짜 목록 가져오기
|
||||
|
||||
$previousData = $data;
|
||||
|
||||
foreach ($dates as $index => $date) {
|
||||
if ($index === 0) {
|
||||
// 첫 번째 날짜는 전날 데이터가 없으므로 그대로 유지
|
||||
continue;
|
||||
}
|
||||
|
||||
$previousDate = $dates[$index - 1]; // 전날 날짜
|
||||
|
||||
// 현재 날짜 데이터를 처리
|
||||
foreach ($data[$date]['options'] as $option => $qty) {
|
||||
// 전날 데이터가 있는 경우 값을 차감
|
||||
$data[$date]['options'][$option] -= $previousData[$previousDate]['options'][$option] ?? 0;
|
||||
}
|
||||
|
||||
// 홈페이지 및 큐패스 데이터 수정
|
||||
$data[$date]['homepage'] -= $previousData[$previousDate]['homepage'] ?? 0;
|
||||
$data[$date]['qpass'] -= $previousData[$previousDate]['qpass'] ?? 0;
|
||||
|
||||
// 총합 데이터 수정
|
||||
$data[$date]['total'] -= $previousData[$previousDate]['total'] ?? 0;
|
||||
}
|
||||
|
||||
// JSON 데이터 출력 (JavaScript에서 사용)
|
||||
echo "<script>const processedData = " . json_encode($data) . ";</script>";
|
||||
|
||||
?>
|
||||
<section class="container mt-3" style="max-width:1200px">
|
||||
<h2>날짜별 주문수량</h2>
|
||||
|
||||
<?php
|
||||
// 데이터 가져오기
|
||||
$query = "
|
||||
SELECT
|
||||
DATE(date) as order_date,
|
||||
category_name,
|
||||
option_name,
|
||||
qty
|
||||
FROM product_quantities
|
||||
WHERE product_name = '어린이날'
|
||||
ORDER BY order_date, category_name, option_name;
|
||||
";
|
||||
|
||||
$result = $conn->query($query);
|
||||
if (!$result) {
|
||||
die("Query failed: " . $conn->error);
|
||||
}
|
||||
|
||||
// 데이터 처리
|
||||
$data = [];
|
||||
|
||||
while ($row = $result->fetch_assoc()) {
|
||||
$date = $row['order_date'];
|
||||
$category = $row['category_name'];
|
||||
$option = trim($row['option_name']);
|
||||
$qty = (int)$row['qty'];
|
||||
|
||||
if (!isset($data[$date])) {
|
||||
$data[$date] = [
|
||||
'homepage' => ['R' => 0, 'S' => 0, 'A' => 0, '계' => 0],
|
||||
'qpass' => ['R' => 0, 'S' => 0, 'A' => 0, '계' => 0],
|
||||
'합계' => 0
|
||||
];
|
||||
}
|
||||
|
||||
if ($row['option_name'] == "[1부]R석 대인" ||
|
||||
$row['option_name'] == "[1부]R석 소인" ||
|
||||
$row['option_name'] == "[1부]R석 36개월미만" ||
|
||||
$row['option_name'] == "[1부]R석 36개월 미만" ||
|
||||
$row['option_name'] == "[2부]R석 대인" ||
|
||||
$row['option_name'] == "[2부]R석 소인" ||
|
||||
$row['option_name'] == "[2부]R석 36개월미만" ||
|
||||
$row['option_name'] == "[2부]R석 36개월 미만"
|
||||
) $option = "R";
|
||||
|
||||
if ($row['option_name'] == "[1부]S석 대인" ||
|
||||
$row['option_name'] == "[1부]S석 소인" ||
|
||||
$row['option_name'] == "[1부]S석 36개월미만" ||
|
||||
$row['option_name'] == "[1부]S석 36개월 미만" ||
|
||||
$row['option_name'] == "[2부]S석 대인" ||
|
||||
$row['option_name'] == "[2부]S석 소인" ||
|
||||
$row['option_name'] == "[2부]S석 36개월미만" ||
|
||||
$row['option_name'] == "[2부]S석 36개월 미만"
|
||||
) $option = "S";
|
||||
|
||||
if ($row['option_name'] == "[1부]A석 대인" ||
|
||||
$row['option_name'] == "[1부]A석 소인" ||
|
||||
$row['option_name'] == "[1부]A석 36개월미만" ||
|
||||
$row['option_name'] == "[1부]A석 36개월 미만" ||
|
||||
$row['option_name'] == "[2부]A석 대인" ||
|
||||
$row['option_name'] == "[2부]A석 소인" ||
|
||||
$row['option_name'] == "[2부]A석 36개월미만" ||
|
||||
$row['option_name'] == "[2부]A석 36개월 미만"
|
||||
) $option = "A";
|
||||
|
||||
// 옵션별 수량 저장
|
||||
if ($category === "홈페이지") {
|
||||
if (isset($data[$date]['homepage'][$option])) {
|
||||
$data[$date]['homepage'][$option] += $qty;
|
||||
}
|
||||
$data[$date]['homepage']['계'] += $qty;
|
||||
} elseif ($category === "큐패스") {
|
||||
if (isset($data[$date]['qpass'][$option])) {
|
||||
$data[$date]['qpass'][$option] += $qty;
|
||||
}
|
||||
$data[$date]['qpass']['계'] += $qty;
|
||||
}
|
||||
|
||||
// 전체 합계
|
||||
$data[$date]['합계'] += $qty;
|
||||
|
||||
}
|
||||
$prev_data = $data;
|
||||
?>
|
||||
|
||||
<table class='table table-bordered table-hover text-center align-middle'>
|
||||
<colgroup>
|
||||
<col style="width:100px;">
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
<col>
|
||||
<col style="width:150px;">
|
||||
</colgroup>
|
||||
<thead class='table-primary'>
|
||||
<tr>
|
||||
<th class='align-middle' rowspan='2'>구분</th>
|
||||
<th class='align-middle' colspan='4'>홈페이지</th>
|
||||
<th class='align-middle' colspan='4'>큐패스</th>
|
||||
<th class='align-middle' rowspan='2'>합계</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class='align-middle'>R</th>
|
||||
<th class='align-middle'>S</th>
|
||||
<th class='align-middle'>A</th>
|
||||
<th class='align-middle'>계</th>
|
||||
<th class='align-middle'>R</th>
|
||||
<th class='align-middle'>S</th>
|
||||
<th class='align-middle'>A</th>
|
||||
<th class='align-middle'>계</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<?php
|
||||
$dates = array_keys($data); // 날짜 목록 가져오기
|
||||
|
||||
foreach ($dates as $index => $date) {
|
||||
$categories = $data[$date];
|
||||
|
||||
// 전일자 가져오기 (첫 번째 날짜는 전일자가 없음)
|
||||
if ($index === 0) {
|
||||
$web_r = $categories['homepage']['R'];
|
||||
$web_s = $categories['homepage']['S'];
|
||||
$web_a = $categories['homepage']['A'];
|
||||
$web_tot = $categories['homepage']['계'];
|
||||
$q_r = $categories['qpass']['R'];
|
||||
$q_s = $categories['qpass']['S'];
|
||||
$q_a = $categories['qpass']['A'];
|
||||
$q_tot = $categories['qpass']['계'];
|
||||
$total = $categories['합계'];
|
||||
}
|
||||
|
||||
if ($index != 0) {
|
||||
$previousDate = $dates[$index - 1]; // 전일 날짜
|
||||
$previousCategories = $data[$previousDate]; // 전일 데이터 가져오기
|
||||
|
||||
// 현재 날짜의 값에서 전일자 값 빼기
|
||||
$web_r = $categories['homepage']['R'] - ($previousCategories['homepage']['R'] ?? 0);
|
||||
$web_s = $categories['homepage']['S'] - ($previousCategories['homepage']['S'] ?? 0);
|
||||
$web_a = $categories['homepage']['A'] - ($previousCategories['homepage']['A'] ?? 0);
|
||||
$web_tot = $categories['homepage']['계'] - ($previousCategories['homepage']['계'] ?? 0);
|
||||
$q_r = $categories['qpass']['R'] - ($previousCategories['qpass']['R'] ?? 0);
|
||||
$q_s = $categories['qpass']['S'] - ($previousCategories['qpass']['S'] ?? 0);
|
||||
$q_a = $categories['qpass']['A'] - ($previousCategories['qpass']['A'] ?? 0);
|
||||
$q_tot = $categories['qpass']['계'] - ($previousCategories['qpass']['계'] ?? 0);
|
||||
$total = $categories['합계'] - ($previousCategories['합계'] ?? 0);
|
||||
}
|
||||
|
||||
?>
|
||||
<tr>
|
||||
<th class="align-middle"><?=date('m/d', strtotime($date))?></th>
|
||||
<td class="align-middle"><?= $web_r === 0 ? '-' : $web_r ?></td>
|
||||
<td class="align-middle"><?= $web_s === 0 ? '-' : $web_s ?></td>
|
||||
<td class="align-middle"><?= $web_a === 0 ? '-' : $web_a ?></td>
|
||||
<td class="align-middle" style="font-weight: 600; "><?= $web_tot === 0 ? '-' : $web_tot ?></td>
|
||||
<td class="align-middle"><?= $q_r === 0 ? '-' : $q_r ?></td>
|
||||
<td class="align-middle"><?= $q_s === 0 ? '-' : $q_s ?></td>
|
||||
<td class="align-middle"><?= $q_a === 0 ? '-' : $q_a ?></td>
|
||||
<td class="align-middle" style="font-weight: 600;"><?= $q_tot === 0 ? '-' : $q_tot ?></td>
|
||||
<td class="align-middle" style="font-weight: 600;"><?= $total === 0 ? '-' : $total ?></td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
</table>
|
||||
</section>
|
||||
|
||||
<section class="container mt-3" style="max-width:1200px">
|
||||
<h2>Chart</h2>
|
||||
<div class="chart-wrap">
|
||||
<canvas class="chart" id="chart1" width="1000px"></canvas>
|
||||
<canvas class="chart" id="chart2" width="1000px"></canvas>
|
||||
<canvas class="chart" id="chart3" width="1000px"></canvas>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<script>
|
||||
// 1. 홈페이지/큐패스 날짜별 주문수량
|
||||
const homepageData = [];
|
||||
const qpassData = [];
|
||||
const labels = [];
|
||||
const totalData = [];
|
||||
const optionsData = {}; // 옵션별 데이터
|
||||
|
||||
for (const [date, details] of Object.entries(processedData)) {
|
||||
labels.push(date);
|
||||
homepageData.push(details.homepage);
|
||||
qpassData.push(details.qpass);
|
||||
totalData.push(details.total);
|
||||
|
||||
for (const [option, qty] of Object.entries(details.options)) {
|
||||
if (!optionsData[option]) {
|
||||
optionsData[option] = [];
|
||||
}
|
||||
optionsData[option].push(qty);
|
||||
}
|
||||
}
|
||||
|
||||
const ctx1 = document.getElementById('chart1').getContext('2d');
|
||||
new Chart(ctx1, {
|
||||
type: 'bar',
|
||||
data: {
|
||||
labels: labels,
|
||||
datasets: [
|
||||
{ label: '홈페이지', data: homepageData, backgroundColor: '#4CAF50' },
|
||||
{ label: '큐패스', data: qpassData, backgroundColor: '#FF9800' }
|
||||
]
|
||||
},
|
||||
options: {
|
||||
responsive: true,
|
||||
plugins: {
|
||||
title: {
|
||||
display: true,
|
||||
text: '홈페이지 및 큐패스 날짜별 주문수량'
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// 2. 날짜별 총 주문수량
|
||||
const ctx2 = document.getElementById('chart2').getContext('2d');
|
||||
new Chart(ctx2, {
|
||||
type: 'bar',
|
||||
data: {
|
||||
labels: labels,
|
||||
datasets: [{ label: '총 주문수량', data: totalData, backgroundColor: '#2196F3' }]
|
||||
},
|
||||
options: {
|
||||
responsive: true,
|
||||
plugins: {
|
||||
title: {
|
||||
display: true,
|
||||
text: '날짜별 총 주문수량'
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// 3. 날짜-옵션별 총 주문수량
|
||||
const datasets = Object.keys(optionsData).map(option => ({
|
||||
label: option,
|
||||
data: optionsData[option],
|
||||
backgroundColor: getRandomColor()
|
||||
}));
|
||||
|
||||
const ctx3 = document.getElementById('chart3').getContext('2d');
|
||||
new Chart(ctx3, {
|
||||
type: 'bar',
|
||||
data: {
|
||||
labels: labels,
|
||||
datasets: datasets
|
||||
},
|
||||
options: {
|
||||
responsive: true,
|
||||
plugins: {
|
||||
title: {
|
||||
display: true,
|
||||
text: '날짜-옵션별 총 주문수량'
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// 유틸리티 함수: 랜덤 색상 생성
|
||||
function getRandomColor() {
|
||||
return `#${Math.floor(Math.random() * 16777215).toString(16)}`;
|
||||
}
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
<?php $conn->close();
|
||||
331
manager/adm/visitor_list.php
Normal file
331
manager/adm/visitor_list.php
Normal file
@ -0,0 +1,331 @@
|
||||
<?php
|
||||
// 방문객리스트
|
||||
include_once "_common.php";
|
||||
if (!isset($_SESSION['user_id'])) header( 'Location: FG_MANAGER_URL' ); // 로그인 되어있지 않으면 로그인 페이지로 보냄
|
||||
include_once FG_MANAGER_PATH."/head.php";
|
||||
|
||||
$table = "{$fg['vip_list_table']} AS a LEFT JOIN {$fg['vip_group_table']} AS b ON a.gr_id = b.gr_id LEFT JOIN {$fg['team_table']} AS c ON a.rec_team = c.tid ";
|
||||
|
||||
// 검색 변수 초기화, 검색 관련
|
||||
$search_word = isset($_REQUEST["search_word"]) ? $_REQUEST["search_word"] : "";
|
||||
$search_group = isset($_REQUEST["search_group"]) ? $_REQUEST["search_group"] : "";
|
||||
$search = $where = $search_count = "";
|
||||
if (!empty($search_word)) $search .= " (vip_name LIKE '%$search_word%' OR vip_tel LIKE '%$search_word%' OR vip_card_no LIKE '%$search_word%') ";
|
||||
if (!empty($search_group)) {
|
||||
if (!empty($search_word)) $search .= "AND";
|
||||
$search .= " a.gr_id = $search_group";
|
||||
}
|
||||
if (!empty($search)) {
|
||||
$where = "WHERE {$search}";
|
||||
$search_count = get_num_rows($table, $where);
|
||||
}
|
||||
// 검색 쿼리 끝
|
||||
|
||||
$record_count = get_num_rows($table); // 전체 갯수 구하기
|
||||
$ord_by = "ORDER BY join_datetime DESC"; // 회원 가입일 기준 정렬
|
||||
$R = get_result($table, $ord_by, $query_limit, $where);
|
||||
?>
|
||||
<!-- 검색폼 시작 -->
|
||||
<div class="d-flex flex-column mb-3">
|
||||
<p>검색은 구분/성명/연락처/회원번호로만 가능합니다.</p>
|
||||
<form class="vipsearch" method="post" action="">
|
||||
<div class="d-flex flex-row flex-wrap gap-2 mb-3">
|
||||
<input type="radio" name="search_group" id="search_group_all" class="btn-check" value="" <?php if (empty($search_group)) echo "checked" ?>>
|
||||
<label class="btn btn-outline-primary" for="search_group_all">전체</label>
|
||||
<?php
|
||||
$annual_group = getAnnualGroup();
|
||||
foreach ($annual_group as $row) { // 회원구분 가져와서 뿌리기
|
||||
?>
|
||||
<input type="radio" name="search_group" id="search_group_<?=$row['gr_id']?>" class="btn-check" value="<?=$row['gr_id']?>" <?php if ($search_group === $row['gr_id']) echo "checked" ?>>
|
||||
<label class="btn btn-outline-primary" for="search_group_<?=$row['gr_id']?>"><?=$row['gr_name']?></label>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<div class="input-group col-md-6">
|
||||
<span class="input-group-text" id="search_word">회원검색</span>
|
||||
<input type="text" name="search_word" class="form-control" id="search_word" aria-describedby="search_word" placeholder="검색어를 입력하세요" autofocus value="<?=$search_word ?>">
|
||||
<button type="submit" class="btn btn-secondary">검색</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<!-- 검색폼 끝 -->
|
||||
<div class="d-flex justify-content-between my-1">
|
||||
<div>
|
||||
<p>전체 회원 수 : <b><?=$record_count?></b> | 검색 회원 수 : <?=$search_count ? $search_count : $record_count?></p>
|
||||
</div>
|
||||
<div class="d-flex flex-row-reverse column-gap-2">
|
||||
<form method="post" action="inc/annual_member_list_excel.php">
|
||||
<button type="submit" class="btn btn-secondary" >엑셀저장</button>
|
||||
</form>
|
||||
|
||||
<?php // 추가
|
||||
if($_SESSION['user_lv'] > "1"){
|
||||
?>
|
||||
<button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#add_modal">추가</button>
|
||||
<!-- 추가 버튼을 누르면 출력한다. -->
|
||||
<div id="add_modal" class="modal fade">
|
||||
<div class="modal-dialog" style="width:800px;">
|
||||
<div class="modal-content">
|
||||
<form class="signup" > <!-- 폼 이름을 알려줌 -->
|
||||
<input type="hidden" name="rec_name" class="form-control" readonly value="<?=$_SESSION['user_name']?>">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title">VIP 추가</h4>
|
||||
</div>
|
||||
<div class="modal-body text-left">
|
||||
<h5 class="modal-title my-3">발급정보</h5>
|
||||
<div class="input-group mb-1">
|
||||
<span class="input-group-text col-md-2" id="gr_id">구분</span>
|
||||
<?php foreach($group_name as $row){
|
||||
if ($row['gr_used'] == 0) continue ?>
|
||||
<input type="radio" class="btn-check" name="gr_id" id="gr_id_<?=$row['gr_id']?>" value="<?=$row['gr_id']?>"<?php if ($row['gr_id'] == 2) echo "checked" ?> required>
|
||||
<label class="btn btn-outline-info" for="gr_id_<?=$row['gr_id']?>"><?=$row['gr_name']?></label>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<div class="input-group mb-1">
|
||||
<span class="input-group-text col-md-2" id="rec_team">부서</span>
|
||||
<?php
|
||||
$team_name = getTeamName(1);
|
||||
foreach($team_name as $row){
|
||||
?>
|
||||
<input type="radio" class="btn-check" name="rec_team" id="rec_team_<?=$row['tid']?>" value="<?=$row['tid']?>" <?php /*if($_SESSION['user_team'] == $row['tname']) if ($row['tid'] === "1") */echo "checked" ?> required>
|
||||
<label class="btn btn-outline-info" for="rec_team_<?=$row['tid']?>"><?=$row['tname']?></label>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<div class="input-group mb-1">
|
||||
<span class="input-group-text col-md-2" id="app_name">접수자</span>
|
||||
<input type="text" class="form-control" id="app_name" name="app_name" placeholder="서류 접수자 성명" value="" required>
|
||||
</div>
|
||||
<div class="input-group mb-1">
|
||||
<span class="input-group-text col-md-2" id="vip_card_no">번호</span>
|
||||
<input type="number" class="form-control" oninput="checkDupNo(this.value)" id="vip_card_no" name="vip_card_no" maxlength="6" placeholder="발급한 VIP카드 번호" value="" required>
|
||||
</div>
|
||||
<div class="input-group mb-1 checkdup">
|
||||
<span id="duplicate-no-warning"></span>
|
||||
</div>
|
||||
<h5 class="modal-title my-3">고객정보</h5>
|
||||
<div class="input-group mb-1">
|
||||
<span class="input-group-text col-md-2" id="vip_name">성명</span>
|
||||
<input type="text" class="form-control" id="vip_name" name="vip_name" value="" required>
|
||||
<input type="radio" class="btn-check" name="vip_gender" id="vip_gender_male" value="남" <?php if($gender ==="남") echo "checked" ?>>
|
||||
<label class="btn btn-outline-primary" for="vip_gender_male">남</label>
|
||||
<input type="radio" class="btn-check" name="vip_gender" id="vip_gender_female" value="여" <?php if($gender ==="여") echo "checked" ?>>
|
||||
<label class="btn btn-outline-primary" for="vip_gender_female">여</label>
|
||||
</div>
|
||||
<div class="input-group mb-1">
|
||||
<span class="input-group-text col-md-2" id="vip_tel">연락처</span>
|
||||
<input type="number" class="form-control" oninput="checkDupTel(this.value)" name="vip_tel" name="vip_tel" maxlength="11" value="" required>
|
||||
</div>
|
||||
<div class="input-group mb-1 checkdup">
|
||||
<span id="duplicate-tel-warning"></span>
|
||||
</div>
|
||||
<div class="input-group mb-1">
|
||||
<span class="input-group-text col-md-2" id="vip_birth">생일</span>
|
||||
<input type="date" class="form-control" name="vip_birth" id="vip_birth" value="" required>
|
||||
</div>
|
||||
<div class="input-group mb-1">
|
||||
<span class="input-group-text col-md-2" id="vip_email">이메일</span>
|
||||
<input type="text" class="form-control" name="vip_email" id="vip_email" value="" >
|
||||
</div>
|
||||
<div class="input-group mb-1">
|
||||
<span class="input-group-text col-md-2" id="vip_addr">주소</span>
|
||||
<input type="text" class="form-control" name="vip_addr" id="vip_addr" value="" >
|
||||
</div>
|
||||
<div class="input-group mb-1">
|
||||
<span class="input-group-text col-md-2" id="vip_memo">메모</span>
|
||||
<textarea class="form-control" name="vip_memo" id="vip_memo"></textarea>
|
||||
</div>
|
||||
<div id="vip_memo" class="form-text">
|
||||
기타 메모 및 발급사유를 입력합니다.
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="submit" id="add_submit" class="btn btn-primary">추가</button>
|
||||
<button type="button" class="btn btn-default" data-bs-dismiss="modal">닫기</button>
|
||||
</div>
|
||||
</form>
|
||||
</div><!-- /.modal-content -->
|
||||
</div><!-- /.modal-dialog -->
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="text-center">
|
||||
<table class="table table-striped align-middle">
|
||||
<colgroup>
|
||||
<col width="70px">
|
||||
<col width="70px">
|
||||
<col width="100px">
|
||||
<col width="130px">
|
||||
<col width="100px">
|
||||
<col width="90px">
|
||||
<col width="100px">
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr class="align-middle">
|
||||
<th class="text-center">카드번호</th>
|
||||
<th class="text-center">상태</th>
|
||||
<th class="text-center">성명</th>
|
||||
<th class="text-center">연락처</th>
|
||||
<th class="text-center">생년월일</th>
|
||||
<th class="text-center">최종이용일</th>
|
||||
<?php if($_SESSION['user_lv'] > "1"){ ?>
|
||||
<th class="text-center">작업</th>
|
||||
<?php } ?>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="table-group-divider">
|
||||
<?php foreach($R as $R) {?>
|
||||
<tr>
|
||||
<td class="text-center"><?=$R['vip_card_no']?></td>
|
||||
<td class="text-center"><?=$R['status']?></td>
|
||||
<td class="text-center"><?=$R['vip_name']?></td>
|
||||
<td class="text-center"><?=$R['vip_tel']?></td>
|
||||
<td class="text-center"><?=$R['vip_birth']?></td>
|
||||
<td class="text-center">
|
||||
<?php
|
||||
$edate = $R['last_ent_date'];
|
||||
echo ($edate == '0000-00-00 00:00:00')? '미이용' : date('Y-m-d',strtotime($edate));
|
||||
?></td>
|
||||
<td class="text-center d-flex justify-content-center gap-1">
|
||||
<?php if($_SESSION['user_lv'] > "1"){ ?>
|
||||
<!-- 수정 모달 -->
|
||||
<div id="modify_modal_<?=$R['idx']?>" class="modal fade" tabindex="-1" aria-labelledby="modify_modal_<?=$R['idx']?>" aria-hidden="true">
|
||||
<div class="modal-dialog modal modal-dialog-centered">
|
||||
<div class="modal-content">
|
||||
<form class="modify" id="modify_<?=$R['idx']?>">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">정보 보기/수정</h5>
|
||||
</div>
|
||||
<div class="modal-body text-start">
|
||||
<input type="hidden" id="idx_<?=$R['idx']?>" name="idx" value="<?=$R['idx']?>" readonly>
|
||||
<input type="hidden" id="last_edit_name" name="last_edit_name" value="<?=$_SESSION['user_name']?>" readonly>
|
||||
<?php
|
||||
// 폐기된 카드의 경우 수정을 하면 안되므로 수정할 수 없게 함
|
||||
$ro = "";
|
||||
if($R['status'] != "정상") {
|
||||
$ro = "disabled";
|
||||
echo "<p>폐기된 카드는 수정할 수 없습니다.</p>";
|
||||
;
|
||||
}
|
||||
?>
|
||||
<div class="input-group mb-1">
|
||||
<span class="input-group-text col-md-2" id="vip_card_no_<?=$R['idx']?>">번호</span>
|
||||
<input type="text" class="form-control" id="vip_card_no_<?=$R['idx']?>" name="vip_card_no" value="<?=$R['vip_card_no'] ?>" disabled>
|
||||
</div>
|
||||
<div class="input-group mb-1">
|
||||
<span class="input-group-text col-md-2" id="team_name_<?=$R['idx']?>">부서</span>
|
||||
<input type="text" class="form-control" id="team_name_<?=$R['idx']?>" name="team_name" value="<?=$R['tname'] ?>" disabled >
|
||||
<span class="input-group-text col-md-2" id="gr_name_<?=$R['idx']?>">사유</span>
|
||||
<input type="text" class="form-control" id="gr_name_<?=$R['idx']?>" name="gr_name_" value="<?=$R['gr_name'] ?>" disabled>
|
||||
</div>
|
||||
<div class="input-group mb-1">
|
||||
<span class="input-group-text col-md-2" id="app_name_<?=$R['idx']?>">접수</span>
|
||||
<input type="text" class="form-control" id="app_name_<?=$R['idx']?>" name="app_name" value="<?=$R['app_name'] ?>" disabled>
|
||||
<span class="input-group-text col-md-2" id="rec_name_<?=$R['idx']?>">등록</span>
|
||||
<input type="text" class="form-control" id="rec_name_<?=$R['idx']?>" name="rec_name" value="<?=$R['rec_name'] ?>" disabled>
|
||||
</div>
|
||||
<div class="input-group mb-1">
|
||||
<span class="input-group-text col-md-2" id="join_datetime_<?=$R['idx']?>">등록일</span>
|
||||
<input type="text" class="form-control" id="join_datetime_<?=$R['idx']?>" name="join_datetime" value="<?=$R['join_datetime'] ?>" disabled>
|
||||
</div>
|
||||
<div class="input-group mb-1">
|
||||
<span class="input-group-text col-md-2" id="vip_date_<?=$R['idx']?>">만료일</span>
|
||||
<input type="text" class="form-control" id="vip_date_<?=$R['idx']?>" name="vip_date" value="<?=$R['vip_date']?>" <?php echo ($_SESSION['user_lv'] != "4") ? "disabled" : "" ?>>
|
||||
</div>
|
||||
<?php if($R['last_edit_name']) { ?>
|
||||
<div class="input-group mb-1">
|
||||
<span class="input-group-text col-md-2" id="last_edit_date_<?=$R['idx']?>">수정일</span>
|
||||
<input type="text" class="form-control" id="last_edit_date_<?=$R['idx']?>" name="last_edit_date" value="<?=$R['last_edit_date'] ?>" disabled>
|
||||
<span class="input-group-text col-md-2" id="last_edit_name_<?=$R['idx']?>">수정</span>
|
||||
<input type="text" class="form-control" id="last_edit_name_<?=$R['idx']?>" name="last_edit_name" value="<?=$R['last_edit_name'] ?>" disabled>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<div class="input-group mb-1">
|
||||
<span class="input-group-text col-md-2" id="vip_name_<?=$R['idx']?>">고객명</span>
|
||||
<input type="text" class="form-control" id="vip_name_<?=$R['idx']?>" name="vip_name" value="<?=$R['vip_name']?>" required <?=$ro?>>
|
||||
<? // DB에서 성별값을 불러온다.
|
||||
if($R['status'] == "정상") { // 정상 상태가 아니면 성별도 필요없음
|
||||
$gender = $R['vip_gender']
|
||||
?>
|
||||
<!-- 불러온 성별에 따라 라디오버튼 선택하도록 -->
|
||||
<input type="radio" class="btn-check" name="vip_gender" id="vip_gender_<?=$R['idx']?>_male" value="남" <?php if($gender == "남") echo "checked" ?> required>
|
||||
<label class="btn btn-outline-primary" for="vip_gender_<?=$R['idx']?>_male">남</label>
|
||||
<input type="radio" class="btn-check" name="vip_gender" id="vip_gender_<?=$R['idx']?>_female" value="여" <?php if($gender =="여") echo "checked" ?> required>
|
||||
<label class="btn btn-outline-primary" for="vip_gender_<?=$R['idx']?>_female">여</label>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<div class="input-group mb-1">
|
||||
<span class="input-group-text col-md-2" id="vip_tel_<?=$R['idx']?>">연락처</span>
|
||||
<input type="text" onkeydown='return onlyNumber(event)' onkeyup='removeChar(event)' class="form-control" id="vip_tel_<?=$R['idx']?>" name="vip_tel" value="<?=$R['vip_tel'] ?>" required <?=$ro?>>
|
||||
<span class="input-group-text col-md-2" id="vip_birth_<?=$R['idx']?>">생일</span>
|
||||
<input type="date" class="form-control" id="vip_birth_<?=$R['idx']?>" name="vip_birth" value="<?=$R['vip_birth']?>" <?=$ro?>>
|
||||
</div>
|
||||
<div class="input-group mb-1">
|
||||
<span class="input-group-text col-md-2" id="vip_email_<?=$R['idx']?>">E-Mail</span>
|
||||
<input type="text" class="form-control" id="vip_email_<?=$R['idx']?>" name="vip_email" value="<?=$R['vip_email'] ?>" <?=$ro?>>
|
||||
</div>
|
||||
<div class="input-group mb-1">
|
||||
<span class="input-group-text col-md-2" id="vip_addr_<?=$R['idx']?>">주소</span>
|
||||
<input type="text" class="form-control" id="vip_addr_<?=$R['idx']?>" name="vip_addr" value="<?=$R['vip_addr']?>" <?=$ro?>>
|
||||
</div>
|
||||
<div class="input-group mb-1">
|
||||
<span class="input-group-text col-md-2" id="vip_memo_<?=$R['idx']?>">메모</span>
|
||||
<textarea class="form-control" id="vip_memo_<?=$R['idx']?>" name="vip_memo" <?=$ro?>><?=$R['vip_memo']?></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="submit" class="btn btn-primary">수정</button>
|
||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal" aria-label="Close" data-bs-target="#modify_modal_<?=$R['idx']?>">닫기</button>
|
||||
</div>
|
||||
</form>
|
||||
</div><!-- /.modal-content -->
|
||||
</div><!-- /.modal-dialog -->
|
||||
</div>
|
||||
<!-- 수정 모달 끝 -->
|
||||
<!-- 수정 버튼 -->
|
||||
<button type="button" class="btn btn-success" data-bs-toggle="modal" data-bs-target="#modify_modal_<?=$R['idx']?>"><i class="fa-solid fa-pen-to-square"></i></button>
|
||||
<!-- 재발급 버튼 -->
|
||||
<?php if ( $R['status'] === "정상" ) { ?>
|
||||
<button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#renew_modal_<?=$R['idx']?>"><i class="fa-solid fa-repeat"></i></button>
|
||||
<div id="renew_modal_<?=$R['idx']?>" class="modal fade text-center ">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<form class="renew" id="renew_<?=$R['idx']?>">
|
||||
<input type="hidden" id="idx_<?=$R['idx']?>" name="idx" value="<?=$R['idx']?>" readonly>
|
||||
<input type="hidden" id="last_edit_name_<?=$R['idx']?>" name="last_edit_name" value="<?=$_SESSION['user_name']?>" readonly>
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">재발급</h4>
|
||||
</div>
|
||||
<div class="modal-body text-start">
|
||||
<div class="input-group">
|
||||
<span class="input-group-text col-md-4" id="re_no_<?=$R['idx']?>">재발급 카드번호</span>
|
||||
<input type="number" class="form-control" oninput="checkDupRc(this.value)" id="rc_no_<?=$R['idx']?>" name="rc_no" maxlength="6" value="" required>
|
||||
</div>
|
||||
<div class="input-group checkdup">
|
||||
<span id="duplicate-rc-warning"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="submit" id="renew_submit" class="btn btn-primary">확인</button>
|
||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal" aria-label="Close" data-bs-target="#renew_modal_<?=$R['idx']?>">닫기</button>
|
||||
</div>
|
||||
</form>
|
||||
</div><!-- /.modal-content -->
|
||||
</div><!-- /.modal-dialog -->
|
||||
</div>
|
||||
<?php } ?>
|
||||
<!-- 폐기는 관리자만 -->
|
||||
<?php if($_SESSION['user_lv'] === "4" && $R['status'] != "재발급"){ ?>
|
||||
<a class="btn btn-danger" href="javascript:deleteItem('<?=$R['idx']?>')" role="button"><?=($R['status'] == '정상')? '<i class="fa-solid fa-trash-can"></i>' : '<i class="fa-solid fa-trash-can-arrow-up"></i>'?></a>
|
||||
<?php }
|
||||
} ?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<?php } ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<?php include_once FG_MANAGER_PATH."/tail.php";
|
||||
Reference in New Issue
Block a user