퍼스트가든에서 사용하는 사용자 함수 및 관련파일 추가

This commit is contained in:
2025-07-02 14:14:02 +09:00
parent 68797db562
commit ec949b682d
265 changed files with 27086 additions and 0 deletions

4
manager/vip/_common.php Normal file
View File

@ -0,0 +1,4 @@
<?php
include_once '../../common.php';
include_once '../config.php';
include_once '../lib/lib.php';

View File

@ -0,0 +1,234 @@
<?php
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
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="container text-center">
<div class="row">
<div class="col">
<i class="fa-solid fa-user"></i>
VIP 조회
</div>
<div class="col">
<i class="fa-solid fa-user"></i>
연간회원 조회
</div>
<div class="col">
Column
</div>
</div>
</div>
<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">&times;</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(get_gr_name() 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(empty($tqty1)) {
$tqty1 = $qty1;
$tgqty1 = $gr_qty1;
} else {
$tqty1 = $tqty1 + $qty1;
$tgqty1 = $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>

258
manager/vip/vip_gr_edit.php Normal file
View File

@ -0,0 +1,258 @@
<?php
include_once "_common.php";
if (!isset($_SESSION['user_id'])) header( 'Location: FG_MANAGER_URL' ); // 로그인 되어있지 않으면 로그인 페이지로 보냄
include_once FG_MANAGER_PATH."/head.php";
?>
<style>
.user_lv{
display: inline-block;
margin: 0 20px 0 0;
}
.reg_team{
display: inline-block;
margin: 0 20px 0 0;
}
.gender{
display: inline-block;
}
.searchform{
margin: 5px 5px 20px 0;
}
</style>
<?php
$table = $fg['vip_category_table'];
$recnum = $_GET['recnum'] ? $_GET['recnum'] : 15;
$pagenum = 20;
$sqlnumrows = mysqli_query($conn, "SELECT * FROM {$table}");
$record_count = mysqli_num_rows($sqlnumrows);
$page_count = ceil($record_count / $recnum);
$prev_page = $p - $pagenum < 1 ? 1 : $p - $pagenum;
$next_page = $p + $pagenum > $page_count ? $page_count : $p + $pagenum;
$query = mysqli_query($conn, "SELECT * FROM {$table} ORDER BY gr_id ASC LIMIT ".(($p - 1) * $recnum).",".$recnum);
$R = array();
while($row=mysqli_fetch_array($query)) { // 전체 배열에 저장
array_push($R, $row);
}
?>
<div class="text-left">
전체 그룹 수 : <b><?php echo $record_count; ?></b>
</div>
<div class="text-center" style="width:700px;">
<table class="table table-striped">
<colgroup>
<col width="100px">
<col width="300px">
<col width="200px">
<col width="200px">
<col width="100px">
</colgroup>
<thead>
<tr>
<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>
<th class="text-center">삭제</th>
</tr>
</thead>
<tbody>
<?php for($i=0; $i < count($R); $i++):?>
<tr>
<td class="text-center"><?php echo $R[$i]['gr_id']?></td>
<td class="text-center"><?php echo $R[$i]['gr_name']?></td>
<td class="text-center"><?php echo $R[$i]['gr_date']?></td>
<td class="text-center"><?php
echo $R[$i]['gr_lv']
?>
</td>
<td class="text-center"><?php echo (($R[$i]['gr_used'] == 1)?"활성":"비활성");?></td>
<td class="text-center">
<!-- 수정 버튼 -->
<button class="btn btn-success btn-xs" data-toggle="modal" data-target="#modify_modal_<?php echo $R[$i]['gr_id']?>">수정/세부정보</button>
<div id="modify_modal_<?php echo $R[$i]['gr_id']?>" class="modal fade text-center ">
<div class="modal-dialog">
<div class="modal-content">
<form class="modify">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title">정보 수정</h4>
</div>
<div class="modal-body text-left">
<div class="form-group">
<label for="gr_id">고유번호</label>
<input type="text" class="form-control" id="gr_id" name="gr_id" readonly value="<?php echo $R[$i]['gr_id']?>">
</div>
<div class="form-group">
<label for="gr_lv">권한</label>
<input type="text" class="form-control" id="gr_lv" name="gr_lv" value="<?php echo $R[$i]['gr_lv']?>">
<input type="radio" id="gr_lv" name="gr_lv" value="1" <?php echo(($R[$i]['gr_lv'] == 1)?"checked":"") ?> ><label>1</label>
<input type="radio" id="gr_lv" name="gr_lv" value="2" <?php echo(($R[$i]['gr_lv'] == 2)?"checked":"") ?> ><label>2</label>
<input type="radio" id="gr_lv" name="gr_lv" value="3" <?php echo(($R[$i]['gr_lv'] == 3)?"checked":"") ?> ><label>3</label>
<input type="radio" id="gr_lv" name="gr_lv" value="4" <?php echo(($R[$i]['gr_lv'] == 4)?"checked":"") ?> ><label>4</label>
</div>
<div class="form-group">
<label for="gr_used">그룹명</label>
<input type="text" class="form-control" id="gr_used" name="gr_used" value="<?php echo $R[$i]['gr_used']?>">
<input type="radio" id="gr_used" name="gr_used" value="1" <?php echo(($R[$i]['gr_used'] == 1)?"checked":"") ?> ><label>활성</label>
<input type="radio" id="gr_used" name="gr_used" value="0" <?php echo(($R[$i]['gr_used'] == 0)?"checked":"") ?> ><label>비활성</label>
</div>
<div class="form-group">
<label for="gr_date">유효기간</label>
<input type="text" class="form-control" id="gr_date" name="gr_date" value="<?php echo $R[$i]['gr_date']?>">
</div>
</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>
</td>
<td class="text-center">
<?php if ($_SESSION['user_lv'] = "4"){ ?>
<a class="btn btn-danger btn-xs" href="javascript:deleteItem('<?php echo $R[$i]['gr_id']?>')" role="button">삭제</a>
<?php } ?>
</td>
</tr>
<?php endfor ?>
</tbody>
<!-- 추가버튼 위치 -->
<tfoot>
<tr>
<td colspan="9" class="text-right">
<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">&times;</span></button>
<h4 class="modal-title">그룹 추가</h4>
</div>
<div class="modal-body text-left">
<div class="form-group">
<label for="gr_name">그룹명</label>
<input type="text" class="form-control" id="gr_name" name="gr_name">
</div>
<div class="form-group">
<label for="gr_date">유효기간 설정</label>
<input type="date" class="form-control" id="gr_date" name="gr_date" value="9999-12-31">
<br> 평생 이용의 경우 기본값으로 지정
</div>
</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>
</td>
</tr>
</tfoot>
</table>
</div>
<!-- 페이지 번호 -->
<nav>
<ul class="pagination">
<li>
<a href="list.php?page=<?php echo $page?>&p=<?php echo $prev_page?>" aria-label="Previous">
<span aria-hidden="true">&laquo;</span>
</a>
</li>
<?php
$start_page = floor(($p - 1) / $pagenum) * $pagenum + 1;
$end_page = $start_page + ($pagenum - 1);
if($end_page > $page_count) $end_page = $page_count;
?>
<?php for($i=$start_page; $i<=$end_page; $i++):?>
<li<?php if($i==$p):?> class="active"<?php endif?>>
<a href="list.php?page=<?php echo $page?>&p=<?php echo $i?>"><?php echo $i?></a>
</li>
<?php endfor ?>
<li>
<a href="list.php?page=<?php echo $page?>&p=<?php echo $next_page?>" aria-label="Next">
<span aria-hidden="true">&raquo;</span>
</a>
</li>
</ul>
</nav>
<!-- 스크립트 부분 -->
<script type="text/javascript">
function deleteItem(gr_id)
{
if(confirm("정말 삭제하시겠습니까?"))
{
var formData = {
gr_id: gr_id
}
$.post("proc/gr_delete.php", formData, function(data)
{
alert("삭제되었습니다.");
location.reload();
});
}
}
$(function()
{
// 추가
$(".signup").on("submit", function()
{
var f = $(this).get(0);
// 등록 프로세스
var formData = $(this).serialize();
$.post("proc/gr_signup.php", formData, function(json)
{
if(json != undefined && json.isSuccess)
{
location.reload();
}
else
{
alert("등록중 에러가 발생하였습니다.");
}
});
return false;
});
// 수정
$(".modify").on("submit", function()
{
var f = $(this).get(0);
// 등록 프로세스
var formData = $(this).serialize();
$.post("proc/gr_modify.php", formData, function(json)
{
console.log(json);
if(json != undefined && json.isSuccess)
{
location.reload();
}
else
{
alert("수정중 에러가 발생하였습니다.");
}
});
return false;
});
});
</script>
<?php include_once FG_MANAGER_PATH."/tail.php";

View File

@ -0,0 +1,48 @@
<?php
include_once ('./_common.php');
if(!$_SESSION['user_id']) exit;
$idx = trim($_POST['idx']);
$squery = "SELECT * FROM {$fg['vip_list_table']} WHERE idx='{$idx}'";
$list = sql_fetch($squery);
$status = $list['status'];
$tday = date("Y-m-d H:i:s");
if ($status == "정상"){ // 상태가 정상이었다면
//log 변수
$work = "폐기";
$work_detail = "정상 -> 폐기 ";
// 상태 변경
$query = "UPDATE {$fg['vip_list_table']} SET status='폐기' WHERE idx='{$idx}'";
$result = sql_query($query);
// 전체 재고 DB에 업데이트
$memo = $list['vip_card_no'].' 폐기, 처리자 : '.$_SESSION['user_name'];
$query2 = "INSERT INTO vip_stock (status, dispo, date, memo)
VALUES('폐기', '1','{$tday}','{$memo}')";
$update = sql_query($query2);
} else if ($status == "폐기") { // 폐기였다면
//log 변수
$work = "복구";
$work_detail = "폐기 -> 정상 ";
// 상태 변경
$query = "UPDATE {$fg['vip_list_table']} SET status='정상' WHERE idx='{$idx}'";
$result = sql_query($query);
// 전체 재고 DB에 업데이트
$memo = $list['vip_card_no'].' 복구, 처리자 : '.$_SESSION['user_name'];
$query2 = "INSERT INTO vip_stock (status, dispo, date, memo)
VALUES('복구', '-1','{$tday}','{$memo}')";
$update = sql_query($query2);
}
// log 기록
$work_detail .= "카드번호 : ".$list['vip_card_no']." 처리자 : ".$_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);

View File

@ -0,0 +1,62 @@
<?php
//if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
include_once('_common.php');
include_once('../config.php');
$sql_common = "SELECT * FROM {$fg['vip_list_table']} AS a LEFT JOIN {$fg['vip_category_table']} AS b ON a.gr_id = b.gr_id LEFT JOIN {$fg['member_group_table']} AS c ON a.rec_team = c.tid";
$result = sql_query($sql_common);
$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: PHP Generated Data");
?>
<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>
<th class="tit">생년월일</th>
<th class="tit">고객메모</th>
<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="no-text"><?php echo $row['vip_card_no']; ?> </td>
<td class="no-text"><?php echo $row['gr_name']?> </td>
<td class="no-text"><?php echo $row['status']?> </td>
<td style="text-align:center"> <?php echo $row['vip_name']?> </td>
<td class="no-text"><?php echo get_text($row['vip_tel']); ?></td>
<td style="text-align:center"> <?php echo $row['vip_birth']?> </td>
<td style="text-align:center"> <?php echo $row['vip_memo'];?> </td>
<td style="text-align:center"> <?php echo date('Y-m-d H:i',strtotime($row['join_datetime']));?> </td>
<td style="text-align:center"> <?php echo ($row['vip_date'] == "9999-12-31")? "평생": $row['vip_date']?> </td>
<td class="no-text"><?php echo $row['tname']; ?> </td>
<td class="no-text"><?php echo $row['app_name']; ?> </td>
<td class="no-text"><?php echo $row['rec_name']; ?> </td>
</tr>
<?php } // 반복문 종료 ?>
</tbody>
</table>

View File

@ -0,0 +1,74 @@
<?php
include_once '_common.php';
if(!$_SESSION['user_id']) exit;
// 변수선언
$idx = trim($_POST['idx']);
$vip_name = trim($_POST['vip_name']);
$vip_birth = trim($_POST['vip_birth']);
$vip_tel = addTelHyphen(trim($_POST['vip_tel']));
$vip_email = trim($_POST['vip_email']);
$vip_addr = trim($_POST['vip_addr']);
$vip_memo = trim($_POST['vip_memo']);
$vip_gender = trim($_POST['vip_gender']);
$vip_date = trim($_POST['vip_date']);
$last_edit_name = trim($_POST['last_edit_name']);
// 현재 시간 저장
$time = date("Y-m-d H:i:s");
// 기존 카드 정보 가져오기
$q1 = "SELECT * FROM {$fg['vip_list_table']} WHERE idx = '{$idx}'";
$r = sql_fetch($q1);
// 변수 값을 DB에 업데이트
$query = "UPDATE {$fg['vip_list_table']} SET
vip_name = '{$vip_name}',
vip_tel = '{$vip_tel}',
vip_email = '{$vip_email}',
vip_birth = '{$vip_birth}',
vip_addr = '{$vip_addr}',
vip_memo = '{$vip_memo}',
vip_gender = '{$vip_gender}',
vip_date = '{$vip_date}',
last_edit_name = '{$last_edit_name}',
last_edit_date = '{$time}'";
$query .= " WHERE idx='{$idx}'";
$result = sql_query($query);
// log 만들기
$work = "VIP정보수정";
$work_detail = "카드번호 : ".$r['vip_card_no'].", 처리자 : ".$_SESSION['user_name'].', ';
$work_detail .= "수정내역 : ";
if($r['vip_name'] != $vip_name){
$work_detail .= $r['vip_name'].' -> '.$vip_name.', ';
}
if($r['vip_tel'] != $vip_tel){
$work_detail .= $r['vip_tel'].' -> '.$vip_tel.', ';
}
if($r['vip_email'] != $vip_email){
$work_detail .= $r['vip_email'].' -> '.$vip_email.', ';
}
if($r['vip_birth'] != $vip_birth){
$work_detail .= $r['vip_birth'].' -> '.$vip_birth.', ';
}
if($r['vip_addr'] != $vip_addr){
$work_detail .= $r['vip_addr'].' -> '.$vip_addr.', ';
}
if($r['vip_memo'] != $vip_memo){
$work_detail .= $r['vip_memo'].' -> '.$vip_memo.', ';
}
if($r['vip_gender'] != $vip_gender){
$work_detail .= $r['vip_gender'].' -> '.$vip_gender.', ';
}
if($r['vip_date'] != $vip_date){
$work_detail .= $r['vip_date'].' -> '.$vip_date.', ';
}
// log 기록
log_update($work, $work_detail, $_SESSION['user_id'], $time);
$data = array("isSuccess" => $result);
header("Content-Type: application/json");
echo json_encode($data);

341
manager/vip/vip_list.php Normal file
View File

@ -0,0 +1,341 @@
<?php
// VIP LIST 페이지
include_once "_common.php";
if (!isset($_SESSION['user_id'])) header( 'Location: FG_MANAGER_URL' ); // 로그인 되어있지 않으면 로그인 페이지로 보냄
include_once FG_MANAGER_PATH."/head.php";
// table 세팅
$table = "{$fg['vip_list_table']} AS a LEFT JOIN {$fg['vip_category_table']} AS b ON a.gr_id = b.gr_id LEFT JOIN {$fg['member_group_table']} AS c ON a.rec_team = c.tid ";
// 검색 변수 초기화, 검색 관련
$search_word = isset($search_word) ? $search_word : "";
$search_group = isset($search_group) ? $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 ($search_group == "") echo "checked" ?>>
<label class="btn btn-outline-primary" for="search_group_all">전체</label>
<?php
$group_name = getVipCatName();
foreach ($group_name as $row) { // VIP구분 가지고 와서 뿌려주기
?>
<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="vip_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="text" 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="남" checked required>
<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="여" required>
<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" max="9999-12-31" name="vip_birth" id="vip_birth" 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" >
</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" >
</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="50px">
<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>
<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 class="<?=($R['status'] != '정상') ? "unused" : "" ?>">
<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"><?=$R['ent_count']?></td>
<td class="text-center d-flex justify-content-center gap-1">
<?php if($_SESSION['user_lv'] > "1"){ ?>
<!-- 입장처리 버튼 -->
<?php if ($R['status'] == '정상') { ?>
<a class="btn btn-danger btn-xs" href="javascript:entMem('<?=$R['idx']?>')" role="button"><i class="fas fa-sign-in-alt"></i></a>
<?php } else { ?>
<i class="fas fa-times"></i>
<?php } ?>
<!-- 입장처리 버튼 끝 -->
<!-- 수정 모달 -->
<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)' maxlength="11" 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']?>" max="9999-12-31" 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" <?=$ro?> >수정</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";

View File

@ -0,0 +1,47 @@
<?php
include_once '_common.php';
if(!$_SESSION['user_id']) exit;
// 변수선언
$idx = $_POST['idx'];
$rc_no = trim($_POST['rc_no']);
$last_edit_name = trim($_POST['last_edit_name']);
// 현재 시간 저장
$time = date("Y-m-d H:i:s");
// 기존 카드 정보 가져오기
$q1 = "SELECT * FROM {$fg['vip_list_table']} WHERE idx = '{$idx}'";
$r = sql_fetch($q1);
if ($r) {
// 전체 재고 DB에 업데이트
$memo = $r['vip_card_no'].' 재발급, 처리자 : '.$_SESSION['user_name'];
$query2 = "INSERT INTO {$fg['vip_card_stock_table']} (status, output, date, memo)
VALUES('재발급', '1','{$time}','{$memo}')";
$update = sql_query($query2);
$vip_memo = $r['vip_memo'].' 재발급, 기존카드번호('.$r['vip_card_no'].')';
// 기존 카드 상태 변경
$query = "UPDATE {$fg['vip_list_table']} SET status='재발급' WHERE idx='{$idx}'";
$update = sql_query($query);
// DB에 넣을 쿼리문 작성
$query = "INSERT INTO {$fg['vip_list_table']} (vip_name, status, rec_team, rec_name, gr_id, vip_birth, vip_tel, vip_email, vip_addr, vip_memo, vip_card_no, app_name, vip_gender, vip_date, join_datetime)";
// 값 지정
$query .= " VALUES('{$r['vip_name']}', '정상', '{$_SESSION['user_team']}', '{$r['rec_name']}', '{$r['gr_id']}', '{$r['vip_birth']}', '{$r['vip_tel']}', '{$r['vip_email']}', '{$r['vip_addr']}', '{$vip_memo}', '{$rc_no}', '{$last_edit_name}', '{$r['vip_gender']}', '{$r['vip_date']}', '{$time}') ";
$result = sql_query($query);
// log 만들기
$work = "재발급";
$work_detail = "기존카드번호 : ".$r['vip_card_no']." |신규카드번호 : ".$rc_no." |처리자 : ".$_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);

View File

@ -0,0 +1,77 @@
<?php
include_once '_common.php';
if(!$_SESSION['user_id']) exit;
header("Content-Type: application/json");
$rec_team = trim($_POST['rec_team']); // 신청부서
$rec_name = trim($_POST['rec_name']); // 접수자
$app_name = trim($_POST['app_name']); // 신청자
$gr_id = trim($_POST['gr_id']); // 회원구분
$vip_card_no = trim($_POST['vip_card_no']); // VIP카드 번호
$vip_name = trim($_POST['vip_name']); // VIP 성명
$vip_gender = trim($_POST['vip_gender']); // VIP 성별
$vip_tel = addTelHyphen(trim($_POST['vip_tel'])); // VIP 연락처
$vip_birth = trim($_POST['vip_birth']); // VIP 생일
$vip_email = trim($_POST['vip_email']); // VIP 이메일
$vip_addr = trim($_POST['vip_addr']); // VIP 주소
$vip_memo = trim($_POST['vip_memo']); // VIP 메모
// $vip_date = trim($_POST['vip_date']); // VIP 기간(만료일)
$vip_date = '9999-12-31';
$vip_date = getVipMemberLimit($gr_id);
// DB에 입력
// 현재 시간 저장
$time = date("Y-m-d H:i:s");
// DB에 넣을 쿼리문 작성
$query = "INSERT INTO {$fg['vip_list_table']} (vip_name,
status,
rec_team,
rec_name,
gr_id,
vip_birth,
vip_tel,
vip_email,
vip_addr,
vip_memo,
vip_card_no,
app_name,
vip_gender,
vip_date,
join_datetime,
last_ent_date
)";
// 값 지정
$query .= "VALUES('{$vip_name}',
'정상',
'{$rec_team}',
'{$rec_name}',
'{$gr_id}',
'{$vip_birth}',
'{$vip_tel}',
'{$vip_email}',
'{$vip_addr}',
'{$vip_memo}',
'{$vip_card_no}',
'{$app_name}',
'{$vip_gender}',
'{$vip_date}',
'{$time}',
'0000-00-00 00:00:00'
) ";
// 쿼리실행
$result = sql_query($query);
// 전체 재고 DB에 업데이트
$memo = $vip_card_no.' 불출, 처리자 : '.$_SESSION['user_name'];
$update_query = "INSERT INTO {$fg['vip_card_stock_table']} (status, output, date, memo) VALUES('출고', '1','{$time}','{$memo}')";
$update = sql_query($update_query);
// log 기록
$work = "카드불출";
$work_detail = "카드번호 : ".$vip_card_no." 처리자 : ".$_SESSION['user_name'];
log_update($work, $work_detail, $_SESSION['user_id'], $time);
$data = array("isSuccess" => $result);
echo json_encode($data);

View File

@ -0,0 +1,28 @@
<?php
include_once '_common.php';
if(!$_SESSION['user_id']) exit;
// POST로 가져온 값 정리
$gr_id = trim($_POST['idx']);
$table = $fg['vip_category_table'];
// log 기록
// 그룹명 가져와서 담기
$query = "SELECT * FROM {$table} WHERE gr_id='{$gr_id}'";
$grname = sql_fetch($query);
$time = date("Y-m-d H:i:s");
$work = "구분삭제";
$work_detail = "구분 : ".$grname['gr_name'].", 처리자 : ".$_SESSION['user_name'];
log_update($work, $work_detail, $_SESSION['user_id'], $time);
// 삭제실행
$query = "DELETE FROM {$table} WHERE gr_id='{$gr_id}'";
$result = sql_query($query);
$data = array("isSuccess" => $result);
header("Content-Type: application/json");
echo json_encode($data);

View File

@ -0,0 +1,61 @@
<?php
include_once '_common.php';
if(!$_SESSION['user_id']) exit;
// 테이블 선택
$table = $fg['vip_category_table'];
// POST로 가져온 값을 변수에 넣어준다.
$gr_id = trim($_POST['gr_id']);
$gr_used = trim($_POST['gr_used']);
$gr_name = trim($_POST['gr_name']);
$gr_date = trim($_POST['gr_date']);
// log 기록
// 그룹명 가져와서 담기
$query = "SELECT * FROM {$table} WHERE gr_id='{$gr_id}'";
$gr = sql_fetch($query);
$w1 = "";
$w2 = "";
if($gr_name != $gr['gr_name']) {
$w1 .= '구분명 변경';
$w2 .= $gr['gr_name'].'->'.$gr_name;
}
if($gr_used != $gr['gr_used']) {
if(!empty($w1)) {
$w1 .= ', ';
$w2 .= ', ';
}
$w1 .= '구분출력변경';
if($gr_used == 1) {
$w2 .= '사용 -> 미사용';
} else {
$w2 .='미사용 -> 사용';
}
}
if($gr_date != $gr['gr_date']) {
if(!empty($w1)) {
$w1 .= ', ';
$w2 .= ', ';
}
$w1 .= '구분유효기간변경';
$w2 .= $gr['gr_date'].'->'.$gr_date;
}
$time = date("Y-m-d H:i:s");
$work_detail = $w2.", 처리자 : ".$_SESSION['user_name'];
log_update($w1, $work_detail, $_SESSION['user_id'], $time);
// log 기록 완료
// 변수 값을 DB에 업데이트
$query = "UPDATE {$table} SET gr_used = '{$gr_used}', gr_name = '{$gr_name}', gr_date = '{$gr_date}' ";
$query .= " WHERE gr_id = '{$gr_id}'";
$result = sql_query($query);
$data = array("isSuccess" => $result);
header("Content-Type: application/json");
echo json_encode($data);

View File

@ -0,0 +1,126 @@
<?php
// VIP 구분 관리
include_once "_common.php";
if (!isset($_SESSION['user_id'])) header( 'Location: FG_MANAGER_URL' ); // 로그인 되어있지 않으면 로그인 페이지로 보냄
include_once FG_MANAGER_PATH."/head.php";
$table = $fg['vip_category_table'];
$record_count = get_num_rows($table); // 전체 갯수 구하기
$ord_by = " ORDER BY gr_id ASC ";
$R = get_result($table, $ord_by, $query_limit);
?>
<div class="text-left">
전체 구분 수 : <b><?=$record_count?></b>
</div>
<div class="text-center">
<table class="table table-striped">
<colgroup>
<col width="200px">
<col />
<col />
<col />
<col width="200px">
<col width="100px">
</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>
<th class="text-center">삭제</th>
</tr>
</thead>
<tbody>
<?php foreach($R as $R){?>
<tr class="<?=($R['gr_used'] != 1) ? "unused" : "" ?>">
<td class="text-center"><?=$R['gr_id']?></td>
<td class="text-center"><?=$R['gr_name']?></td>
<td class="text-center"><?=$R['gr_date']?></td>
<td class="text-center"><?=(($R['gr_used'] == 1)?"활성":"비활성");?></td>
<td class="text-center">
<!-- 수정 버튼 -->
<button class="btn btn-success btn-xs" data-bs-toggle="modal" data-bs-target="#modify_modal_<?=$R['gr_id']?>">수정/세부정보</button>
<div id="modify_modal_<?=$R['gr_id']?>" class="modal fade text-center ">
<div class="modal-dialog">
<div class="modal-content">
<form class="modify">
<div class="modal-header">
<h4 class="modal-title">수정</h4>
</div>
<div class="modal-body text-left">
<div class="input-group mb-1">
<span class="input-group-text col-md-3" id="gr_id_<?=$R['gr_id']?>">고유번호</span>
<input type="text" class="form-control" id="gr_id_<?=$R['gr_id']?>" name="gr_id" readonly value="<?=$R['gr_id']?>">
</div>
<div class="input-group mb-1">
<span class="input-group-text col-md-3" id="gr_name_<?=$R['gr_id']?>">이름</span>
<input type="text" class="form-control" id="gr_name_<?=$R['gr_id']?>" name="gr_name" value="<?=$R['gr_name']?>">
<input type="radio" class="btn-check" id="gr_used_<?=$R['gr_id']?>_1" name="gr_used" value="1" <?=($R['gr_used'] == 1)?"checked":""?> >
<label class="btn btn-outline-primary" for="gr_used_<?=$R['gr_id']?>_1">활성</label>
<input type="radio" class="btn-check" id="gr_used_<?=$R['gr_id']?>_0" name="gr_used" value="0" <?=($R['gr_used'] == 0)?"checked":""?> >
<label class="btn btn-outline-primary" for="gr_used_<?=$R['gr_id']?>_0">비활성</label>
</div>
<div class="input-group mb-1">
<span class="input-group-text col-md-3" id="gr_date_<?=$R['gr_id']?>">유효기간</span>
<input type="text" class="form-control" id="gr_date_<?=$R['gr_id']?>" name="gr_date" value="<?=$R['gr_date']?>">
</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>
</td>
<td class="text-center">
<?php if ($_SESSION['user_lv'] = "4"){ ?>
<a class="btn btn-danger btn-xs" href="javascript:deleteItem('<?=$R['gr_id']?>')" role="button">삭제</a>
<?php } ?>
</td>
</tr>
<?php } ?>
</tbody>
<!-- 추가버튼 위치 -->
<tfoot>
<tr>
<td colspan="6" class="text-right">
<button type="button" class="btn btn-primary btn-sm" data-bs-toggle="modal" data-bs-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">
<h4 class="modal-title">구분 추가</h4>
</div>
<div class="modal-body">
<div class="input-group mb-1">
<span class="input-group-text col-md-3" id="gr_name">이름</span>
<input type="text" class="form-control" id="gr_name" name="gr_name" required>
</div>
<div class="input-group mb-1">
<span class="input-group-text col-md-3" id="gr_date">유효기간</span>
<input type="date" class="form-control" id="gr_date" name="gr_date" value="9999-12-31">
</div>
<div>평생 이용의 경우 기본값으로 지정</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>
</td>
</tr>
</tfoot>
</table>
</div>
<?php include_once FG_MANAGER_PATH."/tail.php";

View File

@ -0,0 +1,40 @@
<?php
include_once ('./_common.php');
if(!$_SESSION['user_id']) exit;
$isDebug = false; // 디버그 출력용 변수
if(isset($_POST['mode']) && trim($_POST['mode']) === "enter") {
$idx = trim($_POST['idx']);
$squery = "SELECT * FROM {$fg['vip_list_table']} WHERE idx='{$idx}'";
$list = sql_fetch($squery);
$ent_count = ++$list['ent_count']; // 입장처리시 방문카운트 증가
$date = date("Y-m-d");
$datetime = date("Y-m-d H:i:s");
// 리스트 DB에 최종사용일자 업데이트
$listquery = "UPDATE {$fg['vip_list_table']} SET last_ent_date='{$date}', ent_count='{$ent_count}' WHERE idx='{$idx}'";
$result = sql_query($listquery);
$data = array("isSuccess" => $result);
// 사용처리 목록 DB에 업데이트
$entQuery = "INSERT INTO {$fg['enter_table']} (cat_name, mem_no, ent_datetime, adm)
VALUES('VIP', '{$list['vip_card_no']}', '{$datetime}','{$_SESSION['user_id']}')";
$entQueryResult = sql_query($entQuery);
if ($isDebug && !$entQueryResult) echo "사용처리 목록 업데이트 실패\nquery : {$entQuery}";
// log 기록
$work = "VIP입장";
$work_detail = "카드번호 : ".$list['vip_card_no']." 처리자 : ".$_SESSION['user_name'];
$logUpdate = log_update($work, $work_detail, $_SESSION['user_id'], $datetime);
if ($isDebug && !$logUpdate) echo '로그 등록 실패\n';
}
header("Content-Type: application/json");
echo json_encode($data);

View File

@ -0,0 +1,96 @@
<?php
// VIP 입장 페이지
include_once "_common.php";
if (!isset($_SESSION['user_id'])) header( 'Location: FG_MANAGER_URL' ); // 로그인 되어있지 않으면 로그인 페이지로 보냄
include_once FG_MANAGER_PATH."/head.php";
?>
<div class="searchform">
<p>회원 검색은 성명/연락처/카드번호로만 가능합니다.</p>
<form class="vipsearch" method="get" action="">
<label for="search_word" class="form-label">회원검색</label>
<input type="text" name="search_word" class="form-control" placeholder="검색어를 입력하세요" style="width: 200px; display: inline-block; margin: 5px 10px 5px 10px; " value="<?=isset($search_word)?$search_word:""?>" autofocus >
<button type="submit" class="btn btn-primary" style="display: inline-block; margin: 0; ">검색</button>
</form>
</div>
<?php
if( isset($search_word) && $search_word ) { // 검색어가 있을때만 돌림
$table = "{$fg['vip_list_table']} AS a LEFT JOIN {$fg['vip_category_table']} AS b ON a.gr_id = b.gr_id ";
$search = "vip_name LIKE '%$search_word%' OR vip_tel LIKE '%$search_word%' OR vip_card_no LIKE '%$search_word%'";
$where = "WHERE {$search}";
$ord_by = "ORDER BY vip_name";
$record_count = get_num_rows($table, $where); // 전체 갯수 구하기
if ($record_count) { // 검색 결과가 있으면
$R = get_result($table, $ord_by, $query_limit, $where);
?>
<div>
<p>검색 회원 수 : <?=$record_count?></p>
</div>
<div class="text-center">
<table class="table table-striped align-middle">
<colgroup>
<col width="10%">
<col width="5%">
<col width="12%">
<col width="13%">
<col width="15%">
<col width="15%">
<col width="10%">
<col width="10%">
<col width="10%">
<col >
</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>
<th class="text-center">입장횟수</th>
<th class="text-center">최종입장일</th>
<th class="text-center">VIP만료일</th>
<th class="text-center">입장확인</th>
</tr>
</thead>
<tbody class="table-group-divider">
<?php foreach($R as $R) { ?>
<tr class="<?=($R['status'] != '정상') ? "unused" : "" ?>">
<td class="text-center"><?=sprintf("%06d",$R['vip_card_no'])?></td>
<td class="text-center"><?=$R['status']?></td>
<td class="text-center"><?=$R['gr_name']?></td>
<td class="text-center"><?=$R['vip_name']?></td>
<td class="text-center"><?=$R['vip_tel']?></td>
<td class="text-center"><?=date('Y-m-d',strtotime($R['join_datetime']));?></td>
<td class="text-center"><?=$R['ent_count']?></td>
<td class="text-center">
<?=($R['last_ent_date'] == '0000-00-00 00:00:00') ? '미이용' : date('Y-m-d',strtotime($R['last_ent_date'])); ?>
</td>
<td class="text-center">
<?=($R['vip_date'] == "9999-12-31") ? "평생" : $R['vip_date']; ?>
</td>
<td class="text-center">
<?php if ($R['status'] == '정상') { ?>
<a class="btn btn-danger btn-xs" href="javascript:entMem('<?=$R['idx']?>')" role="button"><i class="fas fa-sign-in-alt"></i></a>
<?php } else { ?>
<i class="fas fa-times"></i>
<?php } ?>
</td>
</tr>
<?php } // endforeach ?>
</tbody>
<tfoot>
</tfoot>
</table>
</div>
<?php } else { // 결과가 없으면 없다고 출력
echo '<h2 style="margin-top: 30px; text-align: center;">검색 결과가 없습니다.</h2>'.PHP_EOL;
}
}
include_once FG_MANAGER_PATH."/tail.php";