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

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

11
adm/fg_admin/README.md Normal file
View File

@ -0,0 +1,11 @@
# 퍼스트가든 내부 관리프로그램
- VIP 명단 관리
- 연간회원 관리
## VIP 관리
VIP 등록, 명단 관리
## 연간회원 관리
연간회원 등록 및 관리
## 페이지
각 페이지명 뒤에 `.`을 구분으로 기능이 나뉨

18
adm/fg_admin/_common.php Normal file
View File

@ -0,0 +1,18 @@
<?php
define('G5_IS_ADMIN', true);
define('G5_IS_SHOP_ADMIN_PAGE', true);
require_once '../../common.php';
include_once 'config.php';
include_once 'lib/lib.php';
require_once G5_ADMIN_PATH . '/admin.lib.php';
include_once G5_ADMIN_PATH . '/shop_admin/admin.shop.lib.php';
if (isset($token)) {
$token = @htmlspecialchars(strip_tags($token), ENT_QUOTES);
}
run_event('admin_common');
check_order_inicis_tmps();

View File

@ -0,0 +1,12 @@
<?php
define('G5_IS_ADMIN', true);
include_once ('../../../common.php');
include_once(G5_ADMIN_PATH.'/admin.lib.php');
include_once('./admin.shop.lib.php');
run_event('admin_common');
// FG
include_once '../config.php';
include_once '../lib/lib.php';

View 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>

View 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";

View 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);
}
}

View 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);

View 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";

View 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);

View 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);
}
}

View 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);
}
}

View 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";

View 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);
}
}

View 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);

View 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">&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(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";

View 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);

View 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";

View 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);

View 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);

View 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
adm/fg_admin/adm/static.php Normal file
View 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();

View 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";

View File

@ -0,0 +1,12 @@
<?php
define('G5_IS_ADMIN', true);
include_once ('../../../common.php');
include_once(G5_ADMIN_PATH.'/admin.lib.php');
include_once('./admin.shop.lib.php');
run_event('admin_common');
// FG
include_once '../config.php';
include_once '../lib/lib.php';

View File

@ -0,0 +1,35 @@
<?php
$sub_menu = "998310";
include_once('./_common.php');
check_demo();
//auth_check_menu($auth, $sub_menu, "w");
check_admin_token();
// POST로 가져온 값 정리
$ca_id = trim($_POST['idx']);
// log 기록
// 그룹명 가져와서 담기
$query = "SELECT * FROM {$fg['annual_category_table']} WHERE ca_id='{$ca_id}'";
$org_data = sql_fetch($query);
$time = date("Y-m-d H:i:s");
$work = "연간회원 구분 삭제";
$work_detail = "구분 : ".$org_data['name'].", 처리자 : ".$_SESSION['user_name'];
log_update($work, $work_detail, $_SESSION['user_id'], $time);
// 삭제실행
$query = "DELETE FROM {$fg['annual_category_table']} WHERE ca_id='{$ca_id}'";
$result = sql_query($query);
goto_url("./annual_member_category.php");
/*
$data = array("isSuccess" => $result);
header("Content-Type: application/json");
echo json_encode($data);
*/

View File

@ -0,0 +1,66 @@
<?php
$sub_menu = "998310";
include_once('./_common.php');
check_demo();
//auth_check_menu($auth, $sub_menu, "w");
check_admin_token();
$ca_id = trim($_POST['ca_id']);
$ca_name = trim($_POST['ca_name']);
$ca_used = trim($_POST['ca_used']);
$ca_info = trim($_POST['ca_info']);
$table = $fg['annual_category_table'];
// 업데이트 전 정보 불러오기
$q = "SELECT * FROM {$table} WHERE ca_id = '{$ca_id}'";
$org_data = sql_fetch($q);
// 변경된 정보 넣어주기
$w1 = "정보수정";
$w2 = "";
if($org_data['name'] != $ca_name) {
$w1 .= "/이름변경";
$w2 .= $org_data['name']."->".$ca_name;
}
if($org_data['used'] != $ca_used) {
if(!empty($w1)) {
$w1 .= ", ";
$w2 .= ", ";
}
if($org_data['used'] == 1) {
$w2 .= "사용 -> 미사용";
} else {
$w2 .= "미사용 -> 사용";
}
}
if($org_data['info'] != $ca_info) {
if(!empty($w1)) {
$w1 .= ", ";
$w2 .= ", ";
}
$w2 .= $org_data['info']."->".$ca_info;
}
// DB에 업데이트
$query = "UPDATE {$table} SET ca_name = '{$ca_name}', ca_used = '{$ca_used}', ca_info = '{$ca_info}'";
$query .= " WHERE ca_id = '{$ca_id}'";
$result = sql_query($query);
if ( $result ) {
$work_detail = $w2.", 처리자 : ".$_SESSION['user_name'];
$time = date("Y-m-d H:i:s");
log_update($w1, $work_detail, $_SESSION['user_id'], $time);
goto_url("./annual_member_category.php");
/*
$data = array("isSuccess" => $result);
header("Content-Type: application/json");
echo json_encode($data);
*/
}

View File

@ -0,0 +1,132 @@
<?php
$sub_menu = "998320";
require_once './_common.php';
auth_check_menu($auth, $sub_menu, 'r');
if (!$is_admin) {
alert('관리자만 접근 가능합니다.');
}
$g5['title'] = '연간회원 구분 관리';
require_once G5_ADMIN_PATH . '/admin.head.php';
$table = $fg['annual_category_table'];
$record_count = get_num_rows($table);
$ord_by = " ORDER BY ca_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="80px">
<col width="200px">
<col />
<col width="150px">
</colgroup>
<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($R as $R){?>
<tr class="<?=(($R['ca_used'] != 1) ? "unused" : "")?>">
<td class="text-center"><?=$R['ca_id']?></td>
<td class="text-center"><?=$R['ca_name']?></td>
<td class="text-center"><?=nl2br($R['ca_info'])?></td>
<td class="text-center">
<!-- 수정 버튼 -->
<button class="btn btn-success btn-xs" data-bs-toggle="modal" data-bs-target="#modify_modal_<?=$R['ca_id']?>"><i class="fa-solid fa-pen-to-square"></i></button>
<!-- 삭제버튼 -->
<?php if ($_SESSION['user_lv'] = "4"){ ?>
<form class="del" action="annual_member_category.delete.php" method="post">
<input type="hidden" id="idx_<?=$R['ca_id']?>" name="idx" readonly value="<?=$R['ca_id']?>">
<button type="submit" class="btn btn-danger btn-xs">삭제</button>
</form>
<!--<a class="btn btn-danger btn-xs" href="javascript:deleteItem('<?=$R['ca_id']?>')" role="button"><i class="fa-solid fa-trash-can"></i></a>-->
<?php } ?>
<!-- 삭제버튼 끝 -->
<!-- 수정 모달 -->
<div id="modify_modal_<?=$R['ca_id']?>" class="modal fade">
<div class="modal-dialog">
<div class="modal-content">
<form class="modify" action="annual_member_category.modify.php" method="post">
<input type="hidden" id="ca_id_<?=$R['ca_id']?>" name="ca_id" readonly value="<?=$R['ca_id']?>">
<input type="hidden" id="name_<?=$R['ca_id']?>" name="ca_name" readonly value="<?=$R['ca_name']?>">
<div class="modal-header">
<h4 class="modal-title"><?=$R['ca_name']?> 정보 수정</h4>
</div>
<div class="modal-body">
<div class="mb-3">
<input type="radio" class="btn-check" name="ca_used" id="used_<?=$R['ca_id']?>_1" value="1" <?=($R['ca_used'] == 1) ? "checked" : "" ?> required>
<label class="btn btn-outline-primary" for="used_<?=$R['ca_id']?>_1">활성</label>
<input type="radio" class="btn-check" name="ca_used" id="used_<?=$R['ca_id']?>_0" value="0" <?=($R['ca_used'] != 1) ? "checked" : "" ?> required>
<label class="btn btn-outline-primary" for="used_<?=$R['ca_id']?>_0">비활성</label>
</div>
<div class="input-group mb-3">
<span class="input-group-text col-md-2" id="ca_info">정보</span>
<textarea class="form-control" name="ca_info" id="ca_info"><?=$R['ca_info']?></textarea>
</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>
<?php } ?>
</tbody>
<!-- 추가버튼 위치 -->
<tfoot>
<tr>
<td colspan="4" 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="add" action="annual_member_category.update.php" method="post">
<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-2" id="ca_name">구분명</span>
<input type="text" class="form-control" id="ca_name" name="ca_name" value="" required>
</div>
<div class="input-group mb-1">
<span class="input-group-text col-md-2" id="ca_info">정보</span>
<textarea class="form-control" name="ca_info" id="ca_info"></textarea>
</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>
</td>
</tr>
</tfoot>
</table>
</div>
<?
include_once G5_ADMIN_PATH."/fg_admin/tail.php";
include_once (G5_ADMIN_PATH.'/admin.tail.php');

View File

@ -0,0 +1,35 @@
<?php
$sub_menu = "998310";
include_once('./_common.php');
check_demo();
//auth_check_menu($auth, $sub_menu, "w");
check_admin_token();
// 변수 선언
$ca_name = trim($_POST['ca_name']);
$ca_info = trim($_POST['ca_info']);
$ca_used = 1;
// update query
$query = "INSERT INTO {$fg['annual_category_table']}(ca_name, ca_info, ca_used)";
$query .= "VALUES('{$ca_name}', '{$ca_info}', '1') ";
// update
$result = sql_query($query);
// log 기록
$work = '연간회원/구분추가';
$work_detail = "구분명 : ".$ca_name.", 내용 : ".$ca_info.", 처리자 : ".$_SESSION['user_name'];
$time = date("Y-m-d H:i:s");
log_update($work, $work_detail, $_SESSION['user_id'], $time);
goto_url("./annual_member_category.php");
/*
$data = array("isSuccess" => $result);
header("Content-Type: application/json");
echo json_encode($data);
*/

View File

@ -0,0 +1,175 @@
<?php
if( !isset($_POST['it_id']) && !$isDebug ) exit; // 디버그 중이거나 POST로 넘어온 값이 없다면 종료
include_once "_common.php";
$isDebug = false;
// 주문권종이 다를 수 있으므로 it_id를 저장함
function getAnnuOrder($od_id) {
global $g5;
$query = "SELECT it_id, ct_qty FROM {$g5['g5_shop_cart_table']} WHERE od_id = '$od_id'";
$result = sql_query($query);
$R = array();
while($row=sql_fetch_array($result)) { // 전체 배열에 저장
array_push($R, $row);
}
return $R;
}
// 상품별로 판매되므로 상품 ID에 따라 상품을 설정해줌
function getAnnuCaID($it_id) {
if ($it_id == "1730361152" ) {
$result['ca_id'] = 3;
$result['ca_name'] = "일반";
} else if ($it_id == "1728373753") {
$result['ca_id'] = 5;
$result['ca_name'] = "빅5";
}
return $result;
}
// it_id 갯수(주문수)
function getOrdCnt($od_id) {
global $g5;
$query = "SELECT COUNT(it_id) AS it_id_cnt FROM {$g5['g5_shop_cart_table']} WHERE od_id = '$od_id'";
$result = sql_fetch($query);
return $result;
}
// POST로 넘어온 데이터 처리
$od_id = trim($_POST['od_id']);
//$od_qty = trim($_POST['od_qty']);
// 주문수량 확인(종류)
$query = "SELECT it_id FROM {$g5['g5_shop_cart_table']} WHERE od_id = '$od_id'";
$od_cnt_query = sql_query($query);
$od_cnt = sql_num_rows($od_cnt_query);
// DB에 동일한 주문건이 있는지 확인
$chk = "SELECT od_id, ca_id FROM {$fg['annual_member_table']} WHERE od_id = '{$od_id}'";
$chk = sql_num_rows(sql_query($chk));
if ( $isDebug ) { // 디버깅 중인 경우 넘어온 값을 모두 출력함
var_dump($_REQUEST);
echo "<br><br>";
var_dump(getAnnuOrder($od_id));
}
if ( $od_cnt > $chk ) { // 입력 수량이 주문 수량보다 적을 때 진행
// POST로 넘어온 데이터 처리
$no = trim($_POST['no']);
$it_id = trim($_POST['it_id']);
$sdate = trim($_POST['sdate']);
$name = trim($_POST['name']);
$tel = trim($_POST['tel']);
$addr = trim($_POST['addr']);
$od_cnt = getOrdCnt($od_id);
$od_cnt = $od_cnt['it_id_cnt']
?>
<html>
<head>
<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://t1.daumcdn.net/mapjsapi/bundle/postcode/prod/postcode.v2.js"></script>
<script>
function execDaumPostcode(targetId) {
new daum.Postcode({
oncomplete: function(data) {
var addr = ''; // 주소 변수
if (data.userSelectedType === 'R') { // 사용자가 도로명 주소를 선택했을 경우
addr = data.roadAddress;
} else { // 사용자가 지번 주소를 선택했을 경우
addr = data.jibunAddress;
}
document.getElementById(targetId).value = addr;
}
}).open();
}
</script>
</head>
<body>
<section class="container-sm my-5" style="max-width:800px;">
<div class="header mb-3">
<h3 class="title">퍼스트가든 연간회원 정보입력</h3>
</div>
<form action="annual_member_insert.update.php" method="POST" enctype="multipart/form-data">
<input type="hidden" name="it_id_cnt" id="it_id_cnt" value="<?=$od_cnt?>" readonly>
<input type="hidden" name="od_id" id="od_id" value="<?=$od_id?>" readonly>
<input type="hidden" name="rep_name" id="rep_name" value="<?=$name?>" readonly>
<!--
<div>
약관이 출력될 부분
</div>
약관체크
<input type="hidden" name="rep_name" id="rep_name" value="<?=$name?>" readonly>
-->
<?php // 주문 수량만큼 출력함
$i = 0;
foreach (getAnnuOrder($od_id) as $row) { // 주문 종류
$ca = getAnnuCaID($row['it_id']);
//echo '<H4>' . $i+1 .'. '.$ca['ca_name'] . '</H4>';
$ct_qty = $row['ct_qty']; // 품목별 주문수량
for ($j = 0; $j < $ct_qty; $j++) {
?>
<div class="body text-left mb-3">
<label class="form-label"><?=$ca['ca_name'] . ' - ' . $j+1?></label>
<input type="hidden" name="it_id_<?=$i.$j?>" id="it_id_<?=$i.$j?>" value="<?=$row['it_id']?>" readonly>
<input type="hidden" name="sdate_<?=$i.$j?>" id="sdate_<?=$i.$j?>" value="<?=$sdate?>" readonly>
<input type="hidden" name="ca_id_<?=$i.$j?>" id="ca_id_<?=$i.$j?>" value="<?=$ca['ca_id']?>" readonly>
<input type="hidden" name="od_qty_<?=$i.$j?>" id="od_qty_<?=$i.$j?>" value="<?=$od_qty?>" readonly>
<input type="hidden" name="ct_qty_<?=$i.$j?>" id="ct_qty_<?=$i.$j?>" value="<?=$ct_qty?>" readonly>
<!-- 아래 input은 약관동의 체크용
<input type="hidden" name="ct_qty_<?=$i.$j?>" id="ct_qty_<?=$i.$j?>" value="<?=$ct_qty?>" readonly>
-->
<div class="input-group mb-1">
<span class="input-group-text col-md-3" id="label_name_<?=$i.$j?>">성명</span>
<input type="text" class="form-control" id="name_<?=$i.$j?>" name="name_<?=$i.$j?>" value="<?=(($i == 0 && $j == 0) || $isDebug) ? $name : "" ?>" required>
<input type="radio" class="btn-check" name="gender_<?=$i.$j?>" id="gender_male_<?=$i.$j?>" value="남" checked required >
<label class="btn btn-outline-primary" for="gender_male_<?=$i.$j?>">남</label>
<input type="radio" class="btn-check" name="gender_<?=$i.$j?>" id="gender_female_<?=$i.$j?>" value="여" required>
<label class="btn btn-outline-primary" for="gender_female_<?=$i.$j?>">여</label>
</div>
<div class="input-group mb-1">
<span class="input-group-text col-md-3" id="tel">연락처</span>
<input type="text" class="form-control" name="tel_<?=$i.$j?>" id="tel_<?=$i.$j?>" maxlength="11" value="<?=(($i == 0 && $j == 0) || $isDebug) ? $tel : "" ?>" required>
<span class="input-group-text col-md-3" id="birth_<?=$i.$j?>">생년월일</span>
<input type="date" class="form-control" name="birth_<?=$i.$j?>" id="birth_<?=$i.$j?>" max="9999-12-31" value="<?=($isDebug) ? "9999-12-31" : ""?>" required>
</div>
<div class="input-group mb-1">
<span class="input-group-text col-md-3" id="email">이메일</span>
<input type="email" class="form-control" name="email_<?=$i.$j?>" id="email_<?=$i.$j?>" value="<?php echo $email ?>" >
</div>
<div class="input-group mb-1">
<span class="input-group-text col-md-3" id="addr">주소</span>
<input type="text" class="form-control" name="addr_<?=$i.$j?>" id="addr_<?=$i.$j?>" value="<?php echo $addr ?>" >
<button type="button" class="btn btn-primary" onclick="execDaumPostcode('addr_<?=$i.$j?>')">주소검색</button>
</div>
<div class="input-group mb-1">
<span class="input-group-text col-md-3" id="photofile_<?=$i.$j?>">사진첨부</span>
<input type="file" class="form-control" name="photofile_<?=$i.$j?>" id="photofile_<?=$i.$j?>" <?=($isDebug) ? "" : "required"?>>
</div>
</div>
<?php
} // endfor
$i++;
} // endforeach
?>
<div class="footer">
<div class="d-grid gap-2">
<button type="submit" id="add_submit" class="btn btn-primary">추가</button>
</div>
</div>
</form>
</section>
</body>
</html>
<?php
} else {
alert('이미 모두 입력했습니다.');
}
?>

View File

@ -0,0 +1,168 @@
<?php
include_once '_common.php';
if(!isset($_SESSION['user_id']) && !isset($_POST['app_id'])) exit; // 관리자가 입력하거나 온라인 주문이 아닌 경우 exit
if(isset($_POST['app_id'])) {
$app_id = trim($_POST['app_id']); // 접수자, 온라인 주문의 경우 온라인으로 처리
} else {
$user_name = $user_id = "온라인 자동입력"; // 온라인 주문인 경우 log에 온라인 자동입력임을 넣어줌
$app_id = "온라인";
}
$isDebug = false;
if ($isDebug) {
var_dump($_REQUEST);
echo "<br>";
}
/*
파일 업로드를 하므로 uploadDir 경로의 권한이 777이어야 함
*/
// 기본 변수 선언
$last_editdate = $datetime = date("Y-m-d H:i:s"); // 현재시간
if(isset($_POST['od_id'])) { // 온라인 주문인 경우 자동으로 넣어줄 값
$status = "검토대기";
$od_id = trim($_POST['od_id']); // 주문 ID
$rep_name = trim($_POST['rep_name']); // 대표자 이름
} else {
$status = "정상";
$od_id = $rep_name = "";
}
// 파일 업로드 설정
$dir = "/data/annual_member_photo/"; // 업로드 디렉토리
$uploadDir = FG_MANAGER_PATH . $dir; // 업로드 디렉토리 절대경로
$maxFileSize = 10 * 1024 * 1024; // 10MB
$allowedExtensions = ["jpg", "jpeg", "png", "gif"]; // 허용되는 파일 확장자
// 주문 수량만큼 처리
$od_qty = trim($_POST['it_id_cnt']);
if ($isDebug) echo "주문건수 : " . $od_qty . "<br>";
for ($i = 0; $i < $od_qty; $i++) {
$ct_qty = $_POST['ct_qty_' . $i . '0'];
if ($isDebug) {
echo '$i : ' . $i . "<br>";
echo "주문수량 : " . $ct_qty . "<br>";
}
for ($j = 0; $j < $ct_qty; $j++) {
// 개별 변수 선언
$ca_id = trim($_POST['ca_id_' . $i . $j]);
$mem_no = isset($_POST['mem_no_' . $i . $j]) ? trim($_POST['mem_no_' . $i . $j]) : ""; // 회원번호
$mem_name = trim($_POST['name_' . $i . $j]); // 성명
$mem_gender = trim($_POST['gender_' . $i . $j]); // 성별
$mem_tel = addTelHyphen(trim($_POST['tel_' . $i . $j])); // 연락처
$mem_birth = trim($_POST['birth_' . $i . $j]); // 생일
$mem_email = trim($_POST['email_' . $i . $j]); // 이메일
$mem_addr = trim($_POST['addr_' . $i . $j]); // 주소
$mem_memo = isset($_POST['memo_' . $i . $j]) ? trim($_POST['memo_' . $i . $j]) : ""; // 메모
$mem_sdate = trim($_POST['sdate_' . $i . $j]); // 시작일
$mem_edate = getAnnualEdate($mem_sdate); // 종료일 만들어주기
// 파일 업로드 처리
$fileName = $_FILES["photofile_" . $i . $j]["name"];
$fileTmpName = $_FILES["photofile_" . $i . $j]["tmp_name"];
$fileSize = $_FILES["photofile_" . $i . $j]["size"];
$fileExtension = strtolower(pathinfo($fileName, PATHINFO_EXTENSION));
if (in_array($fileExtension, $allowedExtensions) && $fileSize <= $maxFileSize) {
$newFileName = uniqid() . "." . $fileExtension;
$uploadPath = $uploadDir . $newFileName;
$utf8TmpFileName = mb_convert_encoding($fileTmpName, 'UTF-8', 'auto');
if (move_uploaded_file($utf8TmpFileName, $uploadPath)) {
$photo_url = FG_MANAGER_URL . $dir . $newFileName;
$photo_name = $fileName;
} else {
alert("파일 업로드 실패.");
}
} else if (!$isDebug) {
alert("지원하지 않는 파일 형식이거나 파일 크기가 너무 큽니다. jpg, jpeg, png, gif 파일만 허용되며 최대 파일 크기는 " . ($maxFileSize / (1024 * 1024)) . "MB입니다.");
}
if ($isDebug) $photo_url = $photo_name = '';
// DB에 입력
$query = "INSERT INTO {$fg['annual_member_table']} (
mem_no,
status,
ca_id,
app_id,
name,
memo,
birth,
email,
addr,
tel,
gender,
sdate,
edate,
photo_url,
photo_name,
join_datetime,
last_edit_date,
last_edit_id,
last_ent_date,
ent_count,
od_id,
rep_name
) VALUES (
'{$mem_no}',
'{$status}',
'{$ca_id}',
'{$app_id}',
'{$mem_name}',
'{$mem_memo}',
'{$mem_birth}',
'{$mem_email}',
'{$mem_addr}',
'{$mem_tel}',
'{$mem_gender}',
'{$mem_sdate}',
'{$mem_edate}',
'{$photo_url}',
'{$photo_name}',
'{$last_editdate}',
'{$last_editdate}',
'{$user_id}',
'0000-00-00 00:00:00',
0,
'{$od_id}',
'{$rep_name}'
)";
if ($isDebug) {
print_r($query); // 디버깅인 경우 출력
echo "<br>";
$result = false;
} else {
$result = sql_query($query);
}
if ($result) {
// log 기록
$work = "연간회원등록";
$work_detail = "번호 : " . $mem_no . " 처리자 : " . $user_name;
log_update($work, $work_detail, $user_id, $datetime);
} else if (!$isDebug) {
alert("저장 실패");
}
}
}
if (isset($result) && $result) { // 저장이 성공했다면
// 상태를 완료처리
$update_query = "UPDATE {$g5['g5_shop_cart_table']} SET od_status = '완료' WHERE od_id = '{$od_id}'";
$result = sql_query($update_query); // 업데이트
alert("저장 완료", false);
}

View File

@ -0,0 +1,169 @@
<?php
include_once '_common.php';
if(!isset($_SESSION['user_id']) && !isset($_POST['app_id'])) exit; // 관리자가 입력하거나 온라인 주문이 아닌 경우 exit
if(isset($_POST['app_id'])) {
$app_id = trim($_POST['app_id']); // 접수자
} else {
// 온라인 주문의 경우 온라인으로 처리하므로, app_id가 존재하지 않음.
$user_name = $user_id = "온라인 자동입력"; // 온라인 주문인 경우 log에 온라인 자동입력임을 넣어줌
$app_id = "온라인";
}
$isDebug = false;
if ($isDebug) {
var_dump($_REQUEST);
echo "<br>";
}
/*
파일 업로드를 하므로 uploadDir 경로의 권한이 777이어야 함
*/
// 기본 변수 선언
$last_editdate = $datetime = date("Y-m-d H:i:s"); // 현재시간
if(isset($_POST['od_id'])) { // 온라인 주문인 경우 자동으로 넣어줄 값
$status = "검토대기";
$od_id = trim($_POST['od_id']); // 주문 ID
$rep_name = trim($_POST['rep_name']); // 대표자 이름
} else {
$status = "정상";
$od_id = $rep_name = "";
}
// 파일 업로드 설정
$dir = "/data/annual_member_photo/"; // 업로드 디렉토리
$uploadDir = FG_MANAGER_PATH . $dir; // 업로드 디렉토리 절대경로
$maxFileSize = 10 * 1024 * 1024; // 10MB
$allowedExtensions = ["jpg", "jpeg", "png", "gif"]; // 허용되는 파일 확장자
// 주문 수량만큼 처리
$od_qty = trim($_POST['it_id_cnt']);
if ($isDebug) echo "주문건수 : " . $od_qty . "<br>";
for ($i = 0; $i < $od_qty; $i++) {
$ct_qty = $_POST['ct_qty_' . $i . '0'];
if ($isDebug) {
echo '$i : ' . $i . "<br>";
echo "주문수량 : " . $ct_qty . "<br>";
}
for ($j = 0; $j < $ct_qty; $j++) {
// 개별 변수 선언
$ca_id = trim($_POST['ca_id_' . $i . $j]);
$mem_no = isset($_POST['mem_no_' . $i . $j]) ? trim($_POST['mem_no_' . $i . $j]) : ""; // 회원번호
$mem_name = trim($_POST['name_' . $i . $j]); // 성명
$mem_gender = trim($_POST['gender_' . $i . $j]); // 성별
$mem_tel = addTelHyphen(trim($_POST['tel_' . $i . $j])); // 연락처
$mem_birth = trim($_POST['birth_' . $i . $j]); // 생일
$mem_email = trim($_POST['email_' . $i . $j]); // 이메일
$mem_addr = trim($_POST['addr_' . $i . $j]); // 주소
$mem_memo = isset($_POST['memo_' . $i . $j]) ? trim($_POST['memo_' . $i . $j]) : ""; // 메모
$mem_sdate = trim($_POST['sdate_' . $i . $j]); // 시작일
$mem_edate = getAnnualEdate($mem_sdate); // 종료일 만들어주기
// 파일 업로드 처리
$fileName = $_FILES["photofile_" . $i . $j]["name"];
$fileTmpName = $_FILES["photofile_" . $i . $j]["tmp_name"];
$fileSize = $_FILES["photofile_" . $i . $j]["size"];
$fileExtension = strtolower(pathinfo($fileName, PATHINFO_EXTENSION));
if (in_array($fileExtension, $allowedExtensions) && $fileSize <= $maxFileSize) {
$newFileName = uniqid() . "." . $fileExtension;
$uploadPath = $uploadDir . $newFileName;
$utf8TmpFileName = mb_convert_encoding($fileTmpName, 'UTF-8', 'auto');
if (move_uploaded_file($utf8TmpFileName, $uploadPath)) {
$photo_url = FG_MANAGER_URL . $dir . $newFileName;
$photo_name = $fileName;
} else {
alert("파일 업로드 실패.");
}
} else if (!$isDebug) {
alert("지원하지 않는 파일 형식이거나 파일 크기가 너무 큽니다. jpg, jpeg, png, gif 파일만 허용되며 최대 파일 크기는 " . ($maxFileSize / (1024 * 1024)) . "MB입니다.");
}
if ($isDebug) $photo_url = $photo_name = '';
// DB에 입력
$query = "INSERT INTO {$fg['annual_member_table']} (
mem_no,
status,
ca_id,
app_id,
name,
memo,
birth,
email,
addr,
tel,
gender,
sdate,
edate,
photo_url,
photo_name,
join_datetime,
last_edit_date,
last_edit_id,
last_ent_date,
ent_count,
od_id,
rep_name
) VALUES (
'{$mem_no}',
'{$status}',
'{$ca_id}',
'{$app_id}',
'{$mem_name}',
'{$mem_memo}',
'{$mem_birth}',
'{$mem_email}',
'{$mem_addr}',
'{$mem_tel}',
'{$mem_gender}',
'{$mem_sdate}',
'{$mem_edate}',
'{$photo_url}',
'{$photo_name}',
'{$last_editdate}',
'{$last_editdate}',
'{$user_id}',
'0000-00-00 00:00:00',
0,
'{$od_id}',
'{$rep_name}'
)";
if ($isDebug) {
print_r($query); // 디버깅인 경우 출력
echo "<br>";
$result = false;
} else {
$result = sql_query($query);
}
if ($result) {
// log 기록
$work = "연간회원등록";
$work_detail = "번호 : " . $mem_no . " 처리자 : " . $user_name;
log_update($work, $work_detail, $user_id, $datetime);
} else if (!$isDebug) {
alert("저장 실패");
}
}
}
if (isset($result) && $result) { // 저장이 성공했다면
// 상태를 완료처리
$update_query = "UPDATE {$g5['g5_shop_cart_table']} SET od_status = '완료' WHERE od_id = '{$od_id}'";
$result = sql_query($update_query); // 업데이트
alert("저장 완료");
}

View File

@ -0,0 +1,175 @@
<?php
// 수동 입력 페이지. od_id가 없다면 생성할 수 없음.
// if( !isset($_POST['it_id']) && !$isDebug ) exit; // 디버그 중이거나 POST로 넘어온 값이 없다면 종료
include_once "_common.php";
$isDebug = false;
// 주문권종이 다를 수 있으므로 it_id를 저장함
function getAnnuOrder($od_id) {
global $g5;
$query = "SELECT it_id, ct_qty FROM {$g5['g5_shop_cart_table']} WHERE od_id = '$od_id'";
$result = sql_query($query);
$R = array();
while($row=sql_fetch_array($result)) { // 전체 배열에 저장
array_push($R, $row);
}
return $R;
}
// 상품별로 판매되므로 상품 ID에 따라 상품을 설정해줌
function getAnnuCaID($it_id) {
if ($it_id == "1730361152" ) {
$result['ca_id'] = 3;
$result['ca_name'] = "일반";
} else if ($it_id == "1728373753") {
$result['ca_id'] = 5;
$result['ca_name'] = "빅5";
}
return $result;
}
// it_id 갯수(주문수)
function getOrdCnt($od_id) {
global $g5;
$query = "SELECT COUNT(it_id) AS it_id_cnt FROM {$g5['g5_shop_cart_table']} WHERE od_id = '$od_id'";
$result = sql_fetch($query);
return $result;
}
// GET으로 데이터가 넘어왔다면..
if (isset($_GET['od_id'])) $od_id = $_GET['od_id'];
// POST로 넘어온 데이터 처리
else if(isset($_POST['od_id'])) $od_id = trim($_POST['od_id']);
else alert('주문번호 없음',false);
// 주문수량 확인(종류)
$query = "SELECT it_id FROM {$g5['g5_shop_cart_table']} WHERE od_id = '$od_id'";
$od_cnt_query = sql_query($query);
$od_cnt = sql_num_rows($od_cnt_query);
if ($od_cnt < 1) alert('주문 내역이 없습니다.');
// DB에 동일한 주문건이 있는지 확인
$chk = "SELECT od_id, ca_id FROM {$fg['annual_member_table']} WHERE od_id = '{$od_id}'";
$chk = sql_num_rows(sql_query($chk));
if ( $isDebug ) { // 디버깅 중인 경우 넘어온 값을 모두 출력함
var_dump($_REQUEST);
echo "<br><br>";
var_dump(getAnnuOrder($od_id));
}
if ( $od_cnt > $chk && !$isDebug) { // 입력 수량이 주문 수량보다 적을 때 진행
$no = $name = $tel = $addr = $email = '';
$od_cnt = getOrdCnt($od_id);
$od_cnt = $od_cnt['it_id_cnt']
?>
<html>
<head>
<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://t1.daumcdn.net/mapjsapi/bundle/postcode/prod/postcode.v2.js"></script>
<script>
function execDaumPostcode(targetId) {
new daum.Postcode({
oncomplete: function(data) {
var addr = ''; // 주소 변수
if (data.userSelectedType === 'R') { // 사용자가 도로명 주소를 선택했을 경우
addr = data.roadAddress;
} else { // 사용자가 지번 주소를 선택했을 경우
addr = data.jibunAddress;
}
document.getElementById(targetId).value = addr;
}
}).open();
}
</script>
</head>
<body>
<section class="container-sm my-5" style="max-width:800px;">
<div class="header mb-3">
<h3 class="title">퍼스트가든 연간회원 정보입력</h3>
</div>
<form action="annual_member_insert.update.php" method="POST" enctype="multipart/form-data">
<input type="hidden" name="it_id_cnt" id="it_id_cnt" value="<?=$od_cnt?>" readonly>
<input type="hidden" name="od_id" id="od_id" value="<?=$od_id?>" readonly>
<input type="hidden" name="rep_name" id="rep_name" value="<?=$name?>" readonly>
<!--
<div>
약관이 출력될 부분
</div>
약관체크
<input type="hidden" name="rep_name" id="rep_name" value="<?=$name?>" readonly>
-->
<?php // 주문 수량만큼 출력함
$i = 0;
foreach (getAnnuOrder($od_id) as $row) { // 주문 종류
$ca = getAnnuCaID($row['it_id']);
//echo '<H4>' . $i+1 .'. '.$ca['ca_name'] . '</H4>';
$ct_qty = $row['ct_qty']; // 품목별 주문수량
for ($j = 0; $j < $ct_qty; $j++) {
?>
<div class="body text-left mb-3">
<label class="form-label"><?=$ca['ca_name'] . ' - ' . $j+1?></label>
<input type="hidden" name="it_id_<?=$i.$j?>" id="it_id_<?=$i.$j?>" value="<?=$row['it_id']?>" readonly>
<input type="hidden" name="sdate_<?=$i.$j?>" id="sdate_<?=$i.$j?>" value="<?=$sdate?>" readonly>
<input type="hidden" name="ca_id_<?=$i.$j?>" id="ca_id_<?=$i.$j?>" value="<?=$ca['ca_id']?>" readonly>
<input type="hidden" name="od_qty_<?=$i.$j?>" id="od_qty_<?=$i.$j?>" value="<?=$od_qty?>" readonly>
<input type="hidden" name="ct_qty_<?=$i.$j?>" id="ct_qty_<?=$i.$j?>" value="<?=$ct_qty?>" readonly>
<!-- 아래 input은 약관동의 체크용
<input type="hidden" name="ct_qty_<?=$i.$j?>" id="ct_qty_<?=$i.$j?>" value="<?=$ct_qty?>" readonly>
-->
<div class="input-group mb-1">
<span class="input-group-text col-md-3" id="label_name_<?=$i.$j?>">성명</span>
<input type="text" class="form-control" id="name_<?=$i.$j?>" name="name_<?=$i.$j?>" value="<?=(($i == 0 && $j == 0) || $isDebug) ? $name : "" ?>" required>
<input type="radio" class="btn-check" name="gender_<?=$i.$j?>" id="gender_male_<?=$i.$j?>" value="남" checked required >
<label class="btn btn-outline-primary" for="gender_male_<?=$i.$j?>">남</label>
<input type="radio" class="btn-check" name="gender_<?=$i.$j?>" id="gender_female_<?=$i.$j?>" value="여" required>
<label class="btn btn-outline-primary" for="gender_female_<?=$i.$j?>">여</label>
</div>
<div class="input-group mb-1">
<span class="input-group-text col-md-3" id="tel">연락처</span>
<input type="text" class="form-control" name="tel_<?=$i.$j?>" id="tel_<?=$i.$j?>" maxlength="11" value="<?=(($i == 0 && $j == 0) || $isDebug) ? $tel : "" ?>" required>
<span class="input-group-text col-md-3" id="birth_<?=$i.$j?>">생년월일</span>
<input type="date" class="form-control" name="birth_<?=$i.$j?>" id="birth_<?=$i.$j?>" max="9999-12-31" value="<?=($isDebug) ? "9999-12-31" : ""?>" required>
</div>
<div class="input-group mb-1">
<span class="input-group-text col-md-3" id="email">이메일</span>
<input type="email" class="form-control" name="email_<?=$i.$j?>" id="email_<?=$i.$j?>" value="<?php echo $email ?>" >
</div>
<div class="input-group mb-1">
<span class="input-group-text col-md-3" id="addr">주소</span>
<input type="text" class="form-control" name="addr_<?=$i.$j?>" id="addr_<?=$i.$j?>" value="<?php echo $addr ?>" >
<button type="button" class="btn btn-primary" onclick="execDaumPostcode('addr_<?=$i.$j?>')">주소검색</button>
</div>
<div class="input-group mb-1">
<span class="input-group-text col-md-3" id="photofile_<?=$i.$j?>">사진첨부</span>
<input type="file" class="form-control" name="photofile_<?=$i.$j?>" id="photofile_<?=$i.$j?>" <?=($isDebug) ? "" : "required"?>>
</div>
</div>
<?php
} // endfor
$i++;
} // endforeach
?>
<div class="footer">
<div class="d-grid gap-2">
<button type="submit" id="add_submit" class="btn btn-primary">추가</button>
</div>
</div>
</form>
</section>
</body>
</html>
<?php
} else {
echo '이미 모두 입력했습니다.';
}
?>

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'];
$logquery = "INSERT INTO {$fg['log_table']} (work, work_detail, id, date) VALUES ('{$work}', '{$work_detail}', '{$_SESSION['user_id']}', '{$tday}')";
$result = sql_query($logquery);
$data = array("isSuccess" => $result);
header("Content-Type: application/json");
echo json_encode($data);

View File

@ -0,0 +1,106 @@
<?php
include_once '_common.php';
if(!$_SESSION['user_id']) exit;
if ($_SERVER["REQUEST_METHOD"] == "POST") { // POST로 넘어온 값이 있다면
// 변수 선언
$ca_id = trim($_POST['ca_id']); // 권종구분
$mem_no = trim($_POST['mem_no']); // 회원번호
$name = trim($_POST['name']); // 성명
$status = trim($_POST['status']); // 상태
$gender = trim($_POST['gender']); // 성별
$tel = addTelHyphen(trim($_POST['tel'])); // 연락처
$birth = trim($_POST['birth']); // 생일
$email = trim($_POST['email']); // 이메일
$addr = trim($_POST['addr']); // 주소
$sdate = trim($_POST['sdate']); // 시작일
$edate = trim($_POST['edate']); // 종료일
$memo = trim($_POST['memo']); // 메모
$last_editdate = $datetime = date("Y-m-d H:i:s"); // 현재시간
// 기존 정보 가져오기
$q1 = "SELECT * FROM {$fg['annual_member_table']} WHERE mem_no = '{$mem_no}'";
$r = sql_fetch($q1);
// 시작일이 변경된 경우
if (isset($sdate) && $sdate != $r['sdate']) {
$edate = getAnnualEdate($sdate); // 연간회원권이므로 종료일은 1년 후로 지정한다.
}
// 파일 업로드 처리
$dir = "/data/annual_member_photo/"; // 업로드 디렉토리
$uploadDir = FG_MANAGER_PATH . $dir; // 업로드 디렉토리 절대경로
$maxFileSize = 10 * 1024 * 1024; // 10MB
$allowedExtensions = ["jpg", "jpeg", "png", "gif"]; // 허용되는 파일 확장자
$photo_url = $r['photo_url']; // 기존 파일 URL 유지
if (!empty($_FILES['photofile']['name'])) {
$fileName = $_FILES['photofile']['name'];
$fileTmpName = $_FILES['photofile']['tmp_name'];
$fileSize = $_FILES['photofile']['size'];
$fileExtension = strtolower(pathinfo($fileName, PATHINFO_EXTENSION));
if (in_array($fileExtension, $allowedExtensions) && $fileSize <= $maxFileSize) {
$newFileName = uniqid() . "." . $fileExtension;
$uploadPath = $uploadDir . $newFileName;
if (move_uploaded_file($fileTmpName, $uploadPath)) {
$photo_url = FG_MANAGER_URL . $dir . $newFileName;
} else {
alert("파일 업로드 실패");
}
} else {
alert("지원하지 않는 파일 형식이거나 파일 크기가 너무 큽니다. jpg, jpeg, png, gif 파일만 허용되며 최대 파일 크기는 " . ($maxFileSize / (1024 * 1024)) . "MB입니다.");
}
}
// 변수 값을 DB에 업데이트
$query = "UPDATE {$fg['annual_member_table']} SET
ca_id = '{$ca_id}',
status = '{$status}',
sdate = '{$sdate}',
edate = '{$edate}',
name = '{$name}',
tel = '{$tel}',
email = '{$email}',
birth = '{$birth}',
addr = '{$addr}',
memo = '{$memo}',
gender = '{$gender}',
last_edit_id = '{$_SESSION['user_id']}',
last_edit_date = '{$datetime}',
photo_url = '{$photo_url}'";
$query .= " WHERE mem_no='{$mem_no}'";
$result = sql_query($query);
if ($result) { // DB 업데이트가 완료되면 로그를 기록한다.
// log 기록
$work = "연간회원수정";
$work_detail = "번호 : " . $mem_no . " 처리자 : " . $_SESSION['user_name'];
$work_detail .= "수정내역 : ";
if ($r['name'] != $name) $work_detail .= $r['name'] . ' -> ' . $name . ', ';
if ($r['tel'] != $tel) $work_detail .= $r['tel'] . ' -> ' . $tel . ', ';
if ($r['email'] != $email) $work_detail .= $r['email'] . ' -> ' . $email . ', ';
if ($r['birth'] != $birth) $work_detail .= $r['birth'] . ' -> ' . $birth . ', ';
if ($r['addr'] != $addr) $work_detail .= $r['addr'] . ' -> ' . $addr . ', ';
if ($r['memo'] != $memo) $work_detail .= $r['memo'] . ' -> ' . $memo . ', ';
if ($r['gender'] != $gender) $work_detail .= $r['gender'] . ' -> ' . $gender . ', ';
if ($r['ca_id'] != $ca_id) $work_detail .= $r['ca_id'] . ' -> ' . $ca_id . ', ';
if ($r['status'] != $status) $work_detail .= $r['status'] . ' -> ' . $status . ', ';
if ($r['sdate'] != $sdate) $work_detail .= $r['sdate'] . ' -> ' . $sdate . ', ';
// log 기록
$logResult = log_update($work, $work_detail, $_SESSION['user_id'], $datetime);
if ($logResult) {
//$data = array("isSuccess" => $result);
alert("데이터 저장 성공");
} else {
alert("로그 저장 실패");
}
} else {
alert("DB 업데이트 실패");
}
} else {
alert("잘못된 접근입니다");
}

View File

@ -0,0 +1,510 @@
<?php
$sub_menu = "998310";
require_once './_common.php';
auth_check_menu($auth, $sub_menu, 'r');
if (!$is_admin) {
alert('관리자만 접근 가능합니다.');
}
$g5['title'] = '연간회원 관리';
require_once G5_ADMIN_PATH . '/admin.head.php';
// 언젠가는 DB에 저장할 수 있도록 해야함
$set_annual_status = array("정상", "검토대기", "만료");
$table = "{$fg['annual_member_table']} AS a LEFT JOIN {$fg['annual_category_table']} AS b ON a.ca_id = b.ca_id ";
// 검색 변수 초기화, 검색 관련
$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 .= " (a.name LIKE '%$search_word%' OR a.tel LIKE '%$search_word%' OR a.mem_no LIKE '%$search_word%') ";
if ($search_cat) {
if ($search_word) $search .= "AND";
$search .= " a.ca_id = $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($table, $where); // 검색 결과 수 구하기
}
// 검색 쿼리 만들기 끝
$record_count = get_num_rows($table); // 전체 갯수 구하기
$ord_by = "ORDER BY a.sdate DESC "; // 시작일 기준 내림차순
$R = get_result($table, $ord_by, $query_limit, $where);
?>
<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>
<?php
$annual_group = getAnnualGroup();
foreach ($annual_group as $row) { // 회원구분 가져와서 뿌리기
?>
<input type="radio" name="search_cat" id="search_cat_<?=$row['ca_id']?>" class="btn-check" value="<?=$row['ca_id']?>" <?php if ($search_cat === $row['ca_id']) echo "checked" ?>>
<label class="btn btn-outline-primary" for="search_cat_<?=$row['ca_id']?>"><?=$row['ca_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">
<?php //class="signup" ?>
<form action="annual_member_list.update.php" method="POST" enctype="multipart/form-data" > <!-- 폼 이름을 알려줌 -->
<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="ca_id">구분</span>
<?php foreach($annual_group as $row){
if ($row['ca_used'] != 1) continue ?>
<input type="radio" class="btn-check" name="ca_id" id="ca_id_<?=$row['ca_id']?>" value="<?=$row['ca_id']?>" required>
<label class="btn btn-outline-info" for="ca_id_<?=$row['ca_id']?>"><?=$row['ca_name']?></label>
<?php } ?>
</div>
<input type="hidden" id="app_id" name="app_id" value="<?=$_SESSION['user_id']?>" required>
<div class="input-group mb-1">
<span class="input-group-text col-md-3" id="mem_no">회원번호</span>
<input type="text" class="form-control" oninput="checkDupAnnuNo(this.value)" id="mem_no" name="mem_no" placeholder="카드 번호" value="" required>
</div>
<div class="input-group mb-1 checkdup">
<span id="duplicate-no-warning"></span>
</div>
<div class="input-group mb-1">
<span class="input-group-text col-md-3" id="sdate">가입일</span>
<input type="date" class="form-control" name="sdate" id="sdate" max="9999-12-31" onchange="value_reload()" required>
</div>
<div class="input-group mb-1">
<span class="input-group-text col-md-3" id="name">성명</span>
<input type="text" class="form-control" id="name" name="name" value="" required>
<input type="radio" class="btn-check" name="gender" id="gender_male" value="남" <?php if($gender ==="남") echo "checked" ?>>
<label class="btn btn-outline-primary" for="gender_male">남</label>
<input type="radio" class="btn-check" name="gender" id="gender_female" value="여" <?php if($gender ==="여") echo "checked" ?>>
<label class="btn btn-outline-primary" for="gender_female">여</label>
</div>
<div class="input-group mb-1">
<span class="input-group-text col-md-3" id="tel">연락처</span>
<input type="text" class="form-control" oninput="checkDupAnnuTel(this.value)" name="tel" name="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-3" id="email">이메일</span>
<input type="text" class="form-control" name="email" id="email" value="" >
</div>
<div class="input-group mb-1">
<span class="input-group-text col-md-3" id="addr">주소</span>
<input type="text" class="form-control" name="addr" id="addr" value="" >
</div>
<div class="input-group mb-1">
<span class="input-group-text col-md-3" id="birth">생년월일</span>
<input type="date" class="form-control" name="birth" id="birth" max="9999-12-31" required>
</div>
<div class="input-group mb-1">
<span class="input-group-text col-md-3" id="photofile">사진첨부</span>
<input type="file" class="form-control" name="photofile" id="photofile" >
</div>
<div class="input-group mb-1">
<span class="input-group-text col-md-3" id="memo">메모</span>
<textarea class="form-control" name="memo" id="memo"></textarea>
</div>
<div id="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 } // endif ?>
</div>
</div>
<div class="text-center">
<table class="table table-striped align-middle table-hover">
<colgroup>
<col width="70px">
<col width="50px">
<col width="70px">
<col width="120px">
<col width="100px">
<col width="100px">
<col width="100px">
<col width="50px">
<col width="90px">
<col width="120px">
</colgroup>
<thead>
<tr class="align-middle">
<th class="text-center">회원<br>번호</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">이용<br>횟수</th>
<th class="text-center">최종<br>이용일</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" data-bs-toggle="modal" data-bs-target="#modify_modal_<?=$R['mem_no']?>"><?=$R['mem_no']?></td>
<td class="text-center" data-bs-toggle="modal" data-bs-target="#modify_modal_<?=$R['mem_no']?>"><?=$R['status']?></td>
<td class="text-center" data-bs-toggle="modal" data-bs-target="#modify_modal_<?=$R['mem_no']?>"><?=$R['name']?></td>
<td class="text-center" data-bs-toggle="modal" data-bs-target="#modify_modal_<?=$R['mem_no']?>"><?=$R['tel']?></td>
<td class="text-center" data-bs-toggle="modal" data-bs-target="#modify_modal_<?=$R['mem_no']?>"><?=$R['birth']?></td>
<td class="text-center" data-bs-toggle="modal" data-bs-target="#modify_modal_<?=$R['mem_no']?>"><?=$R['sdate']?></td>
<td class="text-center" data-bs-toggle="modal" data-bs-target="#modify_modal_<?=$R['mem_no']?>"><?=$R['edate']?></td>
<td class="text-center" data-bs-toggle="modal" data-bs-target="#modify_modal_<?=$R['mem_no']?>"><?=$R['ent_count']?></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 ($R['status'] == '정상' || $R['status'] == '검토대기') { ?>
<a class="btn btn-danger btn-xs" href="javascript:entMem('<?=$R['mem_no']?>')" role="button"><i class="fas fa-sign-in-alt"></i></a>
<?php } else { ?>
<i class="fas fa-times"></i>
<?php } ?>
<!-- 입장처리 끝 -->
<?php if($_SESSION['user_lv'] > "1"){ ?>
<!-- 수정 모달 -->
<div id="modify_modal_<?=$R['mem_no']?>" class="modal fade" tabindex="-1" aria-labelledby="modify_modal_<?=$R['mem_no']?>" aria-hidden="true">
<div class="modal-dialog modal modal-dialog-centered">
<div class="modal-content">
<form action="annual_member_list.modify.php" id="modify_<?=$R['mem_no']?>" method="POST" enctype="multipart/form-data" > <!-- 폼 이름을 알려줌 -->
<!--<form class="modify" id="modify_<?=$R['mem_no']?>">-->
<div class="modal-header">
<h5 class="modal-title">정보 보기/수정</h5>
</div>
<div class="modal-body text-start">
<div class="row mb-2">
<img class="img-fluid col-md-5" src="<?=$R['photo_url']?>" >
<div class="col-md-7">
<div class="input-group mb-1">
<span class="input-group-text col-md-5" id="rep_name_<?=$R['mem_no']?>">대표자명</span>
<input type="text" class="form-control" id="rep_name_<?=$R['mem_no']?>" name="rep_name" value="<?=$R['rep_name'] ?>" readonly>
</div>
<div class="input-group mb-1">
<span class="input-group-text col-md-5" id="mem_no_<?=$R['mem_no']?>">회원번호</span>
<input type="text" class="form-control" id="mem_no_<?=$R['mem_no']?>" name="mem_no" value="<?=$R['mem_no'] ?>" readonly>
</div>
<div class="input-group mb-1">
<span class="input-group-text col-md-5" id="ca_id_<?=$R['mem_no']?>">권종구분</span>
<?php
foreach($annual_group as $row){
if ($row['ca_used'] != 1) continue ?>
<input type="radio" class="btn-check" name="ca_id" id="ca_id_<?=$R['mem_no']?>_<?=$row['ca_id']?>" value="<?=$row['ca_id']?>" <?php if( $R['ca_id'] == $row['ca_id'] ) echo "checked" ?> required>
<label class="btn btn-outline-info" for="ca_id_<?=$R['mem_no']?>_<?=$row['ca_id']?>"><?=$row['ca_name']?></label>
<?php } ?>
</div>
<div class="input-group mb-1">
<span class="input-group-text col-md-5" id="status_<?=$R['mem_no']?>">상태</span>
<select class="form-select" id="status_<?=$R['mem_no']?>" name="status">
<option vaule="<?=$R['status']?>"><?=$R['status']?></option>
<?php
foreach( $set_annual_status as $row ) {
if ( $R['status'] == $row ) continue;
?>
<option vaule="<?=$row?>"><?=$row?></option>
<?php } ?>
</select>
</div>
<div class="input-group mb-1">
<span class="input-group-text col-md-5" id="sdate_<?=$R['mem_no']?>">시작일</span>
<input type="text" class="form-control" id="sdate_<?=$R['mem_no']?>" name="sdate" value="<?=$R['sdate'] ?>" >
</div>
<div class="input-group mb-1">
<span class="input-group-text col-md-5" id="edate_<?=$R['mem_no']?>">종료일</span>
<input type="text" class="form-control" id="edate_<?=$R['mem_no']?>" name="edate" value="<?=$R['edate']?>" readonly>
</div>
</div>
</div>
<div class="input-group mb-1">
<span class="input-group-text col-md-2" id="name_<?=$R['mem_no']?>">성명</span>
<input type="text" class="form-control" id="name_<?=$R['mem_no']?>" name="name" value="<?=$R['name']?>" required <?=$ro?>>
<input type="radio" class="btn-check" name="gender" id="gender_<?=$R['mem_no']?>_male" value="남" <?php if($R['gender'] == "남") echo "checked" ?> required>
<label class="btn btn-outline-primary" for="gender_<?=$R['mem_no']?>_male">남</label>
<input type="radio" class="btn-check" name="gender" id="gender_<?=$R['mem_no']?>_female" value="여" <?php if($R['gender'] =="여") echo "checked" ?> required>
<label class="btn btn-outline-primary" for="gender_<?=$R['mem_no']?>_female">여</label>
<?php } ?>
</div>
<div class="input-group mb-1">
<span class="input-group-text col-md-2" id="tel_<?=$R['mem_no']?>">연락처</span>
<input type="text" onkeydown='return onlyNumber(event)' onkeyup='removeChar(event)' class="form-control" id="tel_<?=$R['mem_no']?>" name="tel" value="<?=$R['tel'] ?>" required <?=$ro?>>
<span class="input-group-text col-md-2" id="birth_<?=$R['mem_no']?>">생일</span>
<input type="date" class="form-control" id="birth_<?=$R['mem_no']?>" name="birth" value="<?=$R['birth']?>" <?=$ro?>>
</div>
<div class="input-group mb-1">
<span class="input-group-text col-md-2" id="email_<?=$R['mem_no']?>">E-Mail</span>
<input type="text" class="form-control" id="email_<?=$R['mem_no']?>" name="email" value="<?=$R['email'] ?>" <?=$ro?>>
</div>
<div class="input-group mb-1">
<span class="input-group-text col-md-2" id="addr_<?=$R['mem_no']?>">주소</span>
<input type="text" class="form-control" id="addr_<?=$R['mem_no']?>" name="addr" value="<?=$R['addr']?>" <?=$ro?>>
</div>
<div class="input-group mb-1">
<span class="input-group-text col-md-3" id="photofile">사진첨부(변경시에만 입력)</span>
<input type="file" class="form-control" name="photofile" id="photofile" >
</div>
<div class="input-group mb-1">
<span class="input-group-text col-md-2" id="memo_<?=$R['mem_no']?>">메모</span>
<textarea class="form-control" id="memo_<?=$R['mem_no']?>" name="memo" <?=$ro?>><?=$R['memo']?></textarea>
</div>
<?php if($R['last_edit_id']) { ?>
<div class="input-group mb-1">
<span class="input-group-text col-md-2" id="last_edit_date_<?=$R['mem_no']?>">수정일</span>
<input type="text" class="form-control" id="last_edit_date_<?=$R['mem_no']?>" name="last_edit_date" value="<?=$R['last_edit_date'] ?>" disabled>
<span class="input-group-text col-md-2" id="last_edit_id_<?=$R['mem_no']?>">수정</span>
<input type="text" class="form-control" id="last_edit_id_<?=$R['mem_no']?>" name="last_edit_id" value="<?=$R['last_edit_id'] ?>" disabled>
</div>
<?php } ?>
</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['mem_no']?>">닫기</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['mem_no']?>"><i class="fa-solid fa-pen-to-square"></i></button>
<!-- 폐기나 재발급은 관리자만 -->
<?php if( $_SESSION['user_lv'] === "4" ) { ?>
<!-- 재발급 버튼 -->
<?php if ( $R['status'] === "정상" ) { ?>
<button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#renew_modal_<?=$R['mem_no']?>"><i class="fa-solid fa-repeat"></i></button>
<div id="renew_modal_<?=$R['mem_no']?>" class="modal fade text-center ">
<div class="modal-dialog">
<div class="modal-content">
<form class="renew" id="renew_<?=$R['mem_no']?>">
<input type="hidden" id="mem_no_<?=$R['mem_no']?>" name="mem_no" value="<?=$R['mem_no']?>" readonly>
<input type="hidden" id="last_edit_id_<?=$R['mem_no']?>" name="last_edit_id" 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['mem_no']?>">재발급 카드번호</span>
<input type="number" class="form-control" oninput="checkDupRc(this.value)" id="rc_no_<?=$R['mem_no']?>" 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['mem_no']?>">닫기</button>
</div>
</form>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div>
<?php } ?>
<!-- 재발급 버튼 -->
<a class="btn btn-danger" href="javascript:deleteItem('<?=$R['mem_no']?>')" role="button"><?=($R['status'] == '정상')? '<i class="fa-solid fa-trash-can"></i>' : '<i class="fa-solid fa-trash-can-arrow-up"></i>'?></a>
<?php } // end if ?>
</td>
</tr>
<? } // end foreach ?>
</tbody>
</table>
</div>
<script>
// 삭제
function deleteItem(idx)
{
if(confirm("삭제 후 복구가 불가능합니다. 정말 삭제하시겠습니까?"))
{
var delete_url = "annual_member_list.delete.php";
var formData = {
idx: idx
}
$.post(delete_url, formData, function(json)
{
if(json != undefined && json.isSuccess)
{
alert("처리가 완료되었습니다.");
location.reload();
}
else
{
alert("처리중 에러가 발생하였습니다. ");
location.reload();
}
});
}
}
// 입장처리
function entMem(idx)
{
var url = "annual_member_list.ent.php";
var formData = {
idx: idx,
mode: "enter"
}
$.post(url, formData, function(json)
{
if(json != undefined && json.isSuccess)
{
alert("처리가 완료되었습니다.");
location.reload();
}
else
{
alert("처리중 에러가 발생하였습니다. ");
location.reload();
}
});
}
$(function()
{
// 추가
$(".signup").on("submit", function()
{
var f = $(this).get(0);
// 등록 프로세스
var url = "annual_member_list.update.php";
var formData = $(this).serialize();
$.post(url, formData, function(json)
{
if(json != undefined && json.isSuccess)
{
alert("등록이 완료되었습니다.");
location.reload();
}
else
{
alert("등록중 에러가 발생하였습니다.");
location.reload();
}
});
return false;
});
// 수정
$(".modify").on("submit", function()
{
var f = $(this).get(0);
// 등록 프로세스
var modify_url = "annual_member_list.modify.php";
var formData = $(this).serialize();
$.post(modify_url, formData, function(json)
{
console.log(json);
if(json != undefined && json.isSuccess)
{
alert("수정이 완료되었습니다.");
location.reload();
}
else
{
alert("수정중 에러가 발생하였습니다.");
location.reload();
}
});
return false;
});
// 재발급
$(".renew").on("submit", function()
{
var f = $(this).get(0);
// 등록 프로세스
var renew_url = "annual_member_list.renew.php";
var formData = $(this).serialize();
$.post(renew_url, formData, function(json)
{
console.log(json);
if(json != undefined && json.isSuccess == "dup")
{
alert("입력한 카드번호가 이미 있습니다.")
//location.reload();
}
else if(json != undefined && json.isSuccess)
{
alert("재발급이 완료되었습니다.");
location.reload();
}
else
{
alert("처리중 에러가 발생하였습니다.");
location.reload();
}
});
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 = $_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['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_detail = "기존카드번호 : ".$r['vip_card_no']." |신규카드번호 : ".$rc_no." |처리자 : ".$_SESSION['user_name'];
// log 기록
$logquery = "INSERT INTO {$fg['log_table']} (work, work_detail, id, date) VALUES ('재발급', '{$work_detail}', '{$_SESSION['user_id']}', '{$time}')";
$logresult = sql_query($logquery);
$data = array("isSuccess" => $result);
}
header("Content-Type: application/json");
echo json_encode($data);

View File

@ -0,0 +1,163 @@
<?php
include_once '_common.php';
if(!isset($_SESSION['user_id']) && !isset($_POST['app_id'])) exit; // 관리자가 업력하거나 온라인 주문이 아닌 경우 exit
if(isset($_POST['app_id'])) $user_name = $user_id = "온라인 자동입력"; // 온라인 주문인 경우 log에 온라인 자동입력임을 넣어줌
/*
파일 업로드를 하므로 uploadDir 경로의 권한이 777이어야 함
*/
// 변수 선언
$ca_id = trim($_POST['ca_id']); // 회원구분
$app_id = trim($_POST['app_id']); // 접수자, 온라인 주문의 경우 온라인으로 처리
$mem_no = isset($_POST['mem_no']) ? trim($_POST['mem_no']) : ""; // 회원번호
$mem_name = trim($_POST['name']); // 성명
$mem_gender = trim($_POST['gender']); // 성별
$mem_tel = addTelHyphen(trim($_POST['tel'])); // 연락처
$mem_birth = trim($_POST['birth']); // 생일
$mem_email = trim($_POST['email']); // 이메일
$mem_addr = trim($_POST['addr']); // 주소
$mem_memo = trim($_POST['memo']); // 메모
$mem_sdate = trim($_POST['sdate']); // 시작일
$mem_edate = getAnnualEdate($mem_sdate); // 종료일 만들어주기
$last_editdate = $datetime = date("Y-m-d H:i:s"); // 현재시간
if( isset($_POST['od_id']) ) { // 온라인 주문인 경우 자동으로 넣어줄 값
// 온라인 주문이므로 관리자가 한번 더 확인해야 함
$status = "검토대기";
// 주문정보
$od_qty = trim($_POST['od_qty']);
$od_id = trim($_POST['od_id']);
// 주문자 이름이 대표자명이 됨
$rep_name = trim($_POST['rep_name']);
} else {
// 관리자가 입력하는 경우
$status = "정상";
// 온라인 정보 없음
$od_qty = $od_id = $rep_name = "";
}
// 파일 업로드
if (isset($_FILES)) {
// 업로드 디렉토리를 설정
$dir = "/data/annual_member_photo/"; // 업로드 디렉토리
$uploadDir = FG_MANAGER_PATH.$dir; // 업로드 디렉토리 절대경로
$maxFileSize = 10 * 1024 * 1024; // 10MB
// 업로드된 파일의 정보 가져오기
$fileName = $_FILES["photofile"]["name"];
$fileTmpName = $_FILES["photofile"]["tmp_name"];
$fileSize = $_FILES["photofile"]["size"];
// 파일 확장자를 체크하고 허용되는 확장자를 지정
$allowedExtensions = ["jpg", "jpeg", "png", "gif"];
$fileExtension = strtolower(pathinfo($fileName, PATHINFO_EXTENSION));
if (in_array($fileExtension, $allowedExtensions)) {
// 파일 크기를 체크하고 원하는 크기로 제한
if ($fileSize <= $maxFileSize) {
// 새로운 파일 이름을 생성
$newFileName = uniqid() . "." . $fileExtension;
$uploadPath = $uploadDir . $newFileName;
// 임시 파일의 경로를 UTF-8로 변환
$utf8TmpFileName = mb_convert_encoding($fileTmpName, 'UTF-8', 'auto');
// 파일을 이동
if (move_uploaded_file($utf8TmpFileName, $uploadPath)) {
$photo_url = FG_MANAGER_URL.$dir.$newFileName;
$photo_name = $fileName;
} else {
alert("파일 업로드 실패.");
}
} else {
alert("파일 크기가 너무 큽니다. 최대 파일 크기는 " . ($maxFileSize / (1024 * 1024)) . "MB입니다.");
}
} else {
alert("지원하지 않는 파일 형식입니다. jpg, jpeg, png, gif 파일만 허용됩니다.");
}
} else if ($_SESSION['user_id'] != 'abc') {
alert("파일이 존재하지 않습니다");
}
// 파일 업로드 끝
// DB에 입력
// DB에 넣을 쿼리문 작성
$query = "INSERT INTO {$fg['annual_member_table']} (
mem_no,
status,
ca_id,
app_id,
name,
memo,
birth,
email,
addr,
tel,
gender,
sdate,
edate,
photo_url,
photo_name,
join_datetime,
last_edit_date,
last_edit_id,
last_ent_date,
ent_count,
od_id,
od_qty,
rep_name
)";
// 값 지정
$query .= "VALUES(
'{$mem_no}',
'{$status}',
'{$ca_id}',
'{$app_id}',
'{$mem_name}',
'{$mem_memo}',
'{$mem_birth}',
'{$mem_email}',
'{$mem_addr}',
'{$mem_tel}',
'{$mem_gender}',
'{$mem_sdate}',
'{$mem_edate}',
'{$photo_url}',
'{$photo_name}',
'{$last_editdate}',
'{$last_editdate}',
'{$user_id}',
'0000-00-00 00:00:00',
0,
'{$od_id}',
'{$od_qty}',
'{$rep_name}'
) ";
// 쿼리실행
$result = sql_query($query);
/*
// 전체 재고 DB에 업데이트
$memo = $mem_no.' 불출, 처리자 : '.$_SESSION['user_name'];
$update_query = "INSERT INTO {$fg['card_stock_table']} (status, output, date, memo) VALUES('출고', '1','{$time}','{$memo}')";
$update = sql_query($update_query);
*/
if ( $result ) { // DB 업데이트가 완료되면 로그를 기록한다.
// log 기록
$work = "연간회원등록";
$work_detail = "번호 : ".$mem_no." 처리자 : ".$user_name;
$logquery = "INSERT INTO {$fg['log_table']} (work, work_detail, id, date) VALUES ('카드불출', '{$work_detail}', '{$user_id}', '{$datetime}')";
$logResult = log_update($work, $work_detail, $user_id, $datetime);
if ( $logResult ) {
if( $status == "검토대기" ) { // 온라인 주문의 경우 마이페이지로 넘겨줌
alert("저장 완료", "/firstgarden/shop/mypage.php");
}
alert("저장 완료", false);
} else {
alert("로그 저장 실패");
}
} else {
alert("저장 실패");
}

View File

@ -0,0 +1,33 @@
<?php
include_once ('./_common.php');
if(!$_SESSION['user_id']) exit;
if(isset($_POST['mode']) && trim($_POST['mode']) === "enter") {
$mem_no = trim($_POST['idx']);
$getItemQuery = "SELECT * FROM {$fg['annual_member_table']} WHERE mem_no='{$mem_no}'";
$list = sql_fetch($getItemQuery);
$ent_count = ++$list['ent_count']; // 입장처리시 방문카운트 증가
$date = date("Y-m-d");
$datetime = date("Y-m-d H:i:s");
// 리스트 DB에 최종사용일자 업데이트
$updateQuery = "UPDATE {$fg['annual_member_table']} SET last_ent_date='{$date}', ent_count='{$ent_count}' WHERE mem_no='{$mem_no}'";
$update = sql_query($updateQuery);
// 사용처리 목록 DB에 업데이트
$entQuery = "INSERT INTO {$fg['enter_table']} (cat_name, mem_no, ent_datetime, adm)
VALUES('연간회원', '{$list['mem_no']}', '{$datetime}','{$_SESSION['user_id']}')";
$entUpdate = sql_query($entQuery);
// log 기록
$work = "연간회원입장";
$work_detail = "회원번호 : ".$list['mem_no']." 처리자 : ".$_SESSION['user_name'];
log_update($work, $work_detail, $_SESSION['user_id'], $datetime);
$data = array("isSuccess" => $update);
}
header("Content-Type: application/json");
echo json_encode($data);

View File

@ -0,0 +1,95 @@
<?php
// 연간회원 입장처리 페이지
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['annual_member_table']} AS a LEFT JOIN {$fg['annual_category_table']} AS b ON a.ca_id = b.ca_id ";
$search = "name LIKE '%$search_word%' OR tel LIKE '%$search_word%' OR mem_no LIKE '%$search_word%'";
$where = "WHERE {$search}";
$ord_by = "ORDER BY 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 table-hover">
<colgroup>
<col width="10%">
<col width="5%">
<col width="12%">
<col width="13%">
<col width="12%">
<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">만료일</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['mem_no'])?></td>
<td class="text-center"><?=$R['status']?></td>
<td class="text-center"><?=$R['ca_name']?></td>
<td class="text-center"><?=$R['rep_name']?></td>
<td class="text-center"><?=$R['name']?></td>
<td class="text-center"><?=$R['tel']?></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['edate']; ?>
</td>
<td class="text-center">
<?php if ($R['status'] == '정상' || $R['status'] == '검토대기') { ?>
<a class="btn btn-danger btn-xs" href="javascript:entMem('<?=$R['mem_no']?>')" 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";

View File

@ -0,0 +1,17 @@
<?php
define('G5_IS_ADMIN', true);
define('G5_IS_SHOP_ADMIN_PAGE', true);
include_once ('../../../common.php');
include_once(G5_ADMIN_PATH.'/admin.lib.php');
include_once G5_ADMIN_PATH . '/shop_admin/admin.shop.lib.php';
run_event('admin_common');
check_order_inicis_tmps();
// FG
include_once '../config.php';
include_once '../lib/lib.php';

View File

@ -0,0 +1,65 @@
<?php
include_once "_common.php";
// 테이블 존재 유무 확인 쿼리
$query_check_table = "SHOW TABLES LIKE '{$fg['bakery_product_table']}'";
$result_check_table = sql_query($query_check_table);
echo "테이블 존재 확인 쿼리 실행 결과...................." . json_encode($result_check_table) . "<br>";
if (sql_num_rows($result_check_table) == 0) {
$query_create_table = "CREATE TABLE {$fg['bakery_product_table']} (
idx INT AUTO_INCREMENT PRIMARY KEY,
product_name VARCHAR(255) NOT NULL,
barcode INT NOT NULL UNIQUE,
used TINYINT(1) DEFAULT 1
)";
$result_create_table = sql_query($query_create_table);
echo "테이블 생성 쿼리 실행 결과...................." . json_encode($result_create_table) . "<br>";
} else {
echo "테이블이 이미 존재합니다.<br>";
}
// 중복을 제외하고 업데이트하는 쿼리 이전에 존재하는 데이터의 카운트를 가져옴
$query_count_inventory = "SELECT COUNT(*) as total FROM {$fg['bakery_inventory_table']}";
$result_count_inventory = sql_query($query_count_inventory);
$row_count_inventory = sql_fetch_array($result_count_inventory);
echo "{$fg['bakery_inventory_table']}에서 존재하는 데이터의 총 수...................." . $row_count_inventory['total'] . "<br>";
// 중복을 제외하고 업데이트하는 쿼리를 실행
$query_update = "INSERT IGNORE INTO fg_manager_bakery_product_info (product_name, barcode, used)
SELECT DISTINCT product_name, barcode, 1
FROM fg_manager_bakery_inventory AS inv
WHERE NOT EXISTS (
SELECT 1
FROM fg_manager_bakery_product_info AS prod
WHERE prod.barcode = inv.barcode
)";
$result_update = sql_query($query_update);
if ($result_update) {
echo "중복을 제외하고 업데이트 쿼리 실행 성공" . "<br>";
// 필드명을 변경하는 쿼리 추가
$query_alter_table = "ALTER TABLE {$fg['bakery_inventory_table']} CHANGE product_name product_name_old VARCHAR(255) NOT NULL";
$result_alter_table = sql_query($query_alter_table);
echo "'{$fg['bakery_inventory_table']}'의 'product_name' 필드명이 'product_name_old'로 변경되었습니다.<br>";
// INSERT된 데이터의 수를 가져옴
$query_count_inserted = "SELECT COUNT(*) as total FROM {$fg['bakery_product_table']} WHERE used = 1";
$result_count_inserted = sql_query($query_count_inserted);
$row_count_inserted = sql_fetch_array($result_count_inserted);
echo "{$fg['bakery_product_table']}에 삽입된 데이터의 수...................." . $row_count_inserted['total'] . "<br>";
// 중복 데이터를 제거한 데이터의 수
$inserted_rows = $row_count_inserted['total'] - $row_count_inventory['total'];
echo "중복을 제거한 후 기록된 데이터의 수...................." . max($inserted_rows, 0) . "<br>";
} else {
echo "업데이트에 실패했습니다. 종료합니다.<br>";
// 업데이트가 실패했다면 디버깅을 위해 쿼리를 출력함함
print_r($query_update);
echo "<br>";
}

View File

@ -0,0 +1,21 @@
<?php
include_once "_common.php";
if(!$_SESSION['user_id']) exit; // 로그인되어있지 않으면 확인 불가
$product_name = isset($_POST['product_name']) ? trim($_POST['product_name']) : exit;
$barcode = isset($_POST['barcode']) ? trim($_POST['barcode']) : exit;
$used = isset($_POST['used']) ? trim($_POST['used']) : exit;
// 데이터베이스에 입력하는 쿼리
$query = "INSERT INTO {$fg['bakery_product_table']} (product_name, barcode, used)
VALUES ('{$product_name}', '{$barcode}', '{$used}')";
$result = sql_query($query);
header("Content-Type: application/json");
if ($result) {
echo json_encode(["isSuccess" => true]);
} else {
echo json_encode(["isSuccess" => false, "message" => "추가에 실패하였습니다."]);
}
?>

View File

@ -0,0 +1,18 @@
<?php
include_once "_common.php";
if(!$_SESSION['user_id']) exit; // 로그인 되어있지 않으면 확인 불가
// 기본적인 보안 조치로 모든 데이터는 필터링하여 보관됩니다.
$idx = isset($_POST['idx']) ? intval($_POST['idx']) : exit;
// 데이터 행 삭제 쿼리
$query = "DELETE FROM {$fg['bakery_product_table']} WHERE idx = $idx";
// 쿼리 실행
$result = sql_query($query);
header("Content-Type: application/json");
if ($result) {
echo json_encode(["isSuccess" => true]);
} else {
echo json_encode(["isSuccess" => false]);
}

View File

@ -0,0 +1,34 @@
<?php
include_once "_common.php";
if(!$_SESSION['user_id']) exit; // 로그인되어있지 않으면 확인 불가
$product_name = isset($_POST['product_name']) ? trim($_POST['product_name']) : exit;
$barcode = isset($_POST['barcode']) ? trim($_POST['barcode']) : exit;
$used = isset($_POST['used']) ? trim($_POST['used']) : exit;
// bakery_stock.php에서는 idx가 넘어오지 않음.
if (isset($_POST['idx'])) {
$idx = intval($_POST['idx']);
} else {
$searchQuery = "SELECT idx FROM {$fg['bakery_product_table']} WHERE barcode = '{$barcode}'";
$searchResult = sql_fetch($searchQuery);
$idx = $searchResult['idx'];
}
// 업데이트 쿼리
$query = "UPDATE {$fg['bakery_product_table']}
SET product_name = '$product_name', barcode = '$barcode', used = $used
WHERE idx = $idx";
$result = sql_query($query);
header("Content-Type: application/json");
if ($result) {
echo json_encode(["isSuccess" => true]);
} else {
echo json_encode(["isSuccess" => false, "message" => "수정에 실패하였습니다."]);
}
?>

View File

@ -0,0 +1,163 @@
<?php
$sub_menu = "998020";
require_once './_common.php';
auth_check_menu($auth, $sub_menu, 'r');
if (!$is_admin) {
alert('관리자만 접근 가능합니다.');
}
$g5['title'] = '베이커리 목록관리';
require_once G5_ADMIN_PATH . '/admin.head.php';
// 검색 변수 초기화
!isset($search) ?? "";
!isset($where) ?? "";
!isset($search_count) ?? "";
$is_debug = false; // 디버깅 시 true로 변경
// ord_by 로 넘어온 값이 있으면 반영
$ord_by = isset($_REQUEST["ord_by"]) ? $_REQUEST["ord_by"] : "ASC";
// 제품 목록 불러오기
$productList = getBakeryProductList($ord_by);
$totalCountQuery = "SELECT COUNT(*) as cnt FROM {$fg['bakery_product_table']}";
$totalCountResult = sql_query($totalCountQuery);
$totalCount = sql_fetch_array($totalCountResult)['cnt'];
$usedCountQuery = "SELECT COUNT(*) as cnt FROM {$fg['bakery_product_table']} WHERE used = 1";
$usedCountResult = sql_query($usedCountQuery);
$usedCount = sql_fetch_array($usedCountResult)['cnt'];
?>
<style>
.bakery tfoot {
font-weight: 600;
}
.sort-icon {
margin-left: 5px;
font-size: 12px;
vertical-align: middle;
}
</style>
<h2 class="mb-3">베이커리 제품목록</h2>
<div class="d-flex justify-content-between my-1 mb-3">
<div>
<p>전체 품목 수 : <?=$totalCount?> | 활성 품목 수 : <?=$usedCount?></p>
</div>
<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 modal-dialog-centered" style="width:800px;">
<div class="modal-content">
<?php //class="signup" ?>
<form class="add" action="bakery_product_list.add.php" method="POST" enctype="multipart/form-data" > <!-- 폼 이름을 알려줌 -->
<div class="modal-header">
<h4 class="modal-title">추가</h4>
</div>
<div class="modal-body text-start">
<div class="input-group mb-1">
<span class="input-group-text col-md-2" id="product_name">품명</span>
<input type="text" class="form-control" id="product_name" name="product_name" value="">
<input type="radio" class="btn-check" name="used" id="used_1" value="1" checked required>
<label class="btn btn-outline-primary" for="used_1">사용</label>
<input type="radio" class="btn-check" name="used" id="used_0" value="0" required>
<label class="btn btn-outline-primary" for="used_0">미사용</label>
</div>
<div class="input-group mb-1">
<span class="input-group-text col-md-2" id="barcode">바코드</span>
<input type="text" class="form-control" id="barcode" name="barcode" value="" required>
</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>
</div>
<table class="table table-striped align-middle table-hover bakery" id="bakeryTable">
<colgroup>
<col width="30px">
<col width="150px">
<col width="70px">
<col width="70px">
<col width="50px">
</colgroup>
<!-- 테이블 제목 -->
<thead class="table-light">
<tr class="align-middle">
<th class="text-center no-click">No.</th>
<th class="text-center" data-column="product_name" data-order="asc">품목 <span class="sort-icon" data-column="product_name"></span></th>
<th class="text-center" data-column="barcode" data-order="asc">바코드 <span class="sort-icon" data-column="barcode"></span></th>
<th class="text-center" data-column="current_stock" data-order="asc">사용 <span class="sort-icon" data-column="current_stock"></span></th>
<th class="text-center no-click">관리</th>
</tr>
</thead>
<!-- 테이블 데이터 -->
<tbody class="table-group-divider" id="bakeryTableBody">
<?php
// 제품목록 반복문
$i = 1;
foreach ($productList as $row) {
?>
<tr id="row-<?=$row['barcode']?>">
<td class="text-center"><?=$i?></td>
<td class="text-center"><?=$row['product_name']?></td>
<td class="text-center"><?=$row['barcode']?></td>
<td class="text-center"><?=($row['used'] == 1) ? '활성' : '비활성' ?></td>
<td class="text-center">
<button type="button" class="btn btn-success" data-bs-toggle="modal" data-bs-target="#modify_modal_<?=$row['idx']?>"><i class="fa-solid fa-pen-to-square"></i></button>
<a class="btn btn-danger" href="javascript:void(0);" role="button" onclick="confirmDelete('<?=$row['idx']?>')"><i class="fa-solid fa-trash-can"></i></a>
</td>
</tr>
<!-- 수정 모달 -->
<div id="modify_modal_<?=$row['idx']?>" class="modal fade" tabindex="-1" aria-labelledby="modify_modal_<?=$row['idx']?>" aria-hidden="true">
<div class="modal-dialog modal modal-dialog-centered">
<div class="modal-content">
<form class="modify" id="modify_<?=$row['idx']?>" name="modify_<?=$row['idx']?>" >
<input type="hidden" name="idx" id="idx_<?=$row['idx']?>" value="<?=$row['idx']?>">
<div class="modal-header">
<h5 class="modal-title">정보 보기/수정</h5>
</div>
<div class="modal-body text-start">
<div class="input-group mb-1">
<span class="input-group-text col-md-2" id="product_name_<?=$row['idx']?>">품명</span>
<input type="text" class="form-control" id="product_name_<?=$row['idx']?>" name="product_name" value="<?=$row['product_name'] ?>">
<input type="radio" class="btn-check" name="used" id="used_<?=$row['idx']?>_1" value="1" <?=$row['used'] == "1" ? "checked": "" ?> required>
<label class="btn btn-outline-primary" for="used_<?=$row['idx']?>_1">사용</label>
<input type="radio" class="btn-check" name="used" id="used_<?=$row['idx']?>_0" value="0" <?=$row['used'] =="0" ? "checked" : "" ?> required>
<label class="btn btn-outline-primary" for="used_<?=$row['idx']?>_0">미사용</label>
</div>
<div class="input-group mb-1">
<span class="input-group-text col-md-2" id="barcode_<?=$row['idx']?>">바코드</span>
<input type="text" class="form-control" id="barcode_<?=$row['idx']?>" name="barcode" value="<?=$row['barcode']?>" required>
</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_<?=$row['idx']?>">닫기</button>
</div>
</form>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div>
<!-- 수정 모달 끝 -->
<?php $i++; } ?>
</tbody>
</table>
<?php
include_once "tail.sub.php";
//include_once FG_MANAGER_PATH."/tail.php";
include_once G5_ADMIN_PATH.'/admin.tail.php';

View File

@ -0,0 +1,26 @@
<?php
include_once '_common.php';
if(!$_SESSION['user_id']) exit; // 로그인 되어있지 않으면 확인 불가
if ($_SERVER["REQUEST_METHOD"] == "POST") { // POST로 넘어온 값이 있다면
// 변수 선언
$date = trim($_POST["searchDate"]);
$worker = trim($_POST['worker']);
$author = trim($_POST['author']);
// update query
$query = "INSERT INTO {$fg['bakery_author_table']} (date, worker, author) ";
$query .= "VALUES('{$date}', '{$worker}', '{$author}') ";
// 이미 값이 있는 경우 업데이트함
$query .= "ON DUPLICATE KEY UPDATE worker = '{$worker}', author = '{$author}' ";
$result = sql_query($query);
if ($result) {
echo json_encode(array('success' => true));
} else {
echo json_encode(array('success' => false, 'message' => 'Database error'));
}
} else {
echo json_encode(array('success' => false, 'message' => 'Invalid request method'));
}

View File

@ -0,0 +1,46 @@
<?php
include_once '_common.php';
if(!$_SESSION['user_id']) exit; // 로그인 되어있지 않으면 확인 불가
if ($_SERVER["REQUEST_METHOD"] == "POST") { // POST로 넘어온 값을 처리
$searchDate = $_POST['searchDate'];
// 임시 배열 생성
$updates = [];
// POST 데이터 처리
foreach ($_POST as $key => $value) {
if (preg_match('/^(.*)-(\d+)$/', $key, $matches)) {
$name = $matches[1];
$barcode = $matches[2];
// 중복된 barcode에 대한 값들을 배열에 저장
if (!isset($updates[$barcode])) {
$updates[$barcode] = [];
}
$updates[$barcode][$name] = $value;
}
}
// 쿼리 생성
foreach ($updates as $barcode => $fields) {
$setClauses = [];
foreach ($fields as $name => $value) {
$setClauses[] = "{$name} = '{$value}'";
}
$setClause = implode(', ', $setClauses);
$query = "UPDATE {$fg['bakery_inventory_table']} SET {$setClause} WHERE date = '{$searchDate}' AND barcode = '{$barcode}'";
// 쿼리 실행
$result = sql_query($query);
}
if ($result) {
echo json_encode(array('status' => 'success'));
} else {
echo json_encode(array('status' => 'error', 'message' => 'Database error'));
}
} else {
echo json_encode(array('status' => 'error', 'message' => 'Invalid request method'));
}

View File

@ -0,0 +1,18 @@
<?php
include_once "_common.php";
if(!$_SESSION['user_id']) exit; // 로그인 되어있지 않으면 확인 불가
// 기본적인 보안 조치로 모든 데이터는 필터링하여 보관됩니다.
$idx = isset($_POST['idx']) ? intval($_POST['idx']) : 0;
// 데이터 행 삭제 쿼리
$query = "DELETE FROM {$fg['bakery_inventory_table']} WHERE idx = $idx";
// 쿼리 실행
$result = sql_query($query);
header("Content-Type: application/json");
if ($result) {
echo json_encode(["isSuccess" => true]);
} else {
echo json_encode(["isSuccess" => false]);
}

View File

@ -0,0 +1,45 @@
<?php
include_once "_common.php";
if(!$_SESSION['user_id']) exit; // 로그인 되어있지 않으면 확인 불가
// POST 데이터 받아오기
$searchDate = isset($_POST['searchDate']) ? $_POST['searchDate'] : '';
$ord_by = isset($_POST['ord_by']) ? $_POST['ord_by'] : 'product_name ASC';
// getBakeryInvenData 함수 호출
$results = getBakeryInvenData($searchDate, $ord_by);
// 데이터 출력
$output = '';
$i = 1;
foreach ($results as $row) {
// 재고 점검 후 일치하지 않으면 업데이트
// 전날 재고
$previous_stock = intval(getPrevStock($searchDate, $row['barcode']));
// 현재고
$current_stock = $previous_stock + $row['production'] - $row['inhouse_use'] - $row['recycling'] - $row['disposal'] - $row['sales'];
$output .= '<tr>';
$output .= '<td class="text-center">' . htmlspecialchars($i) . '</td>';
$output .= '<td class="text-center">' . htmlspecialchars($row['product_name']) . '</td>';
$output .= '<td class="text-center">' . htmlspecialchars($row['barcode']) . '</td>';
$output .= '<td class="text-end">' . number_format($previous_stock) . '</td>';
$output .= '<td class="text-end"><span class="value">' . htmlspecialchars($row['production']) . '</span>';
$output .= '<input class="form-control text-end d-none" type="text" value="' . htmlspecialchars($row['production']) . '" id="production-' . htmlspecialchars($row['barcode']) . '" product_name="' . htmlspecialchars($row['product_name']) . '" aria-label="production" readonly></td>';
$output .= '<td class="text-end"><span class="value">' . htmlspecialchars($row['inhouse_use']) . '</span>';
$output .= '<input class="form-control text-end d-none" type="text" value="' . htmlspecialchars($row['inhouse_use']) . '" id="inhouse_use-' . htmlspecialchars($row['barcode']) . '" product_name="' . htmlspecialchars($row['product_name']) . '" aria-label="inhouse_use" readonly></td>';
$output .= '<td class="text-end"><span class="value">' . htmlspecialchars($row['recycling']) . '</span>';
$output .= '<input class="form-control text-end d-none" type="text" value="' . htmlspecialchars($row['recycling']) . '" id="recycling-' . htmlspecialchars($row['barcode']) . '" product_name="' . htmlspecialchars($row['product_name']) . '" aria-label="recycling" readonly></td>';
$output .= '<td class="text-end"><span class="value">' . htmlspecialchars($row['disposal']) . '</span>';
$output .= '<input class="form-control text-end d-none" type="text" value="' . htmlspecialchars($row['disposal']) . '" id="disposal-' . htmlspecialchars($row['barcode']) . '" product_name="' . htmlspecialchars($row['product_name']) . '" aria-label="disposal" readonly></td>';
$output .= '<td class="text-end">' . number_format($row['sales']) . '</td>';
$output .= '<td class="text-end">' . number_format($row['sales_amount']) . '</td>';
$output .= '<td class="text-end">' . number_format($row['menu_discount']) . '</td>';
$output .= '<td class="text-end">' . number_format($row['payment_amount']) . '</td>';
$output .= '<td class="text-end">' . number_format($current_stock) . '</td>';
$output .= '</tr>';
$i++;
}
echo $output;

View File

@ -0,0 +1,140 @@
<?php
include_once '_common.php';
if (!isset($_SESSION['user_id'])) exit; // 로그인 되어있지 않으면 로그인 페이지로 보냄
// cafe24 절대경로
// /firstgarden/www/
$is_debug = false; // 디버깅 시 true로 변경
$is_test = false; // 상품별(분류별상품)으로 바코드 업데이트 시킬때
$is_dataForceInsert = false; // 강제로 데이터 맞출때 씀
// 추후 table 생성하여 대/중/소분류에 들어갈 값을 넣도록 수정해야 함
// 값을 추출할 소분류 설정
$chkMajCat = array('보스코');
$chkMidCat = array();
$chkSmallCat = array(
'보스코 베이커리'
);
// 제외항목
// $excludeBarcode = array('900014', '900015');
// 라이브러리 로드
require_once $_SERVER['DOCUMENT_ROOT'].'/vendor/autoload.php';
use PhpOffice\PhpSpreadsheet\IOFactory;
use Shuchkin\SimpleXLSX;
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_FILES['file'])) {
if ($is_debug) var_dump($_FILES['file']);
// 변수 만들기
$date = trim($_POST['searchDate']);
$file = $_FILES['file'];
$datetime = date('Y-m-d H:i:s');
$uploadDir = 'uploads/';
$uploadFile = $uploadDir . basename($file['name']);
$newXlsxFile = $uploadDir . pathinfo($file['name'], PATHINFO_FILENAME) . '.xlsx';
// 디렉토리가 없는 경우 생성
if (!is_dir($uploadDir)) {
mkdir($uploadDir, 0777, true);
}
// 데이터 처리
if (move_uploaded_file($file['tmp_name'], $uploadFile)) {
if ($is_debug) echo "파일 업로드 성공: " . htmlspecialchars(basename($file['name'])) . "<br>" . PHP_EOL;
try {
// 파일 형식에 따라 변환
$fileType = pathinfo($uploadFile, PATHINFO_EXTENSION);
if ($fileType == 'xls') {
// PHPSpreadsheet로 .xls 파일을 .xlsx 파일로 변환
$spreadsheet = IOFactory::load($uploadFile);
$writer = IOFactory::createWriter($spreadsheet, 'Xlsx');
$writer->save($newXlsxFile);
// 업로드된 파일을 새로운 .xlsx 파일로 설정
$uploadFile = $newXlsxFile;
}
// SimpleXLSX로 파일 읽기
$xlsx = SimpleXLSX::parse($uploadFile);
if ($xlsx && !$is_test) {
$data = [];
foreach ($xlsx->rows() as $row) {
// 대분류 열이 보스코일 때
if (in_array($row[1], $chkMajCat)) {
// 소분류 체크
if (in_array($row[3], $chkSmallCat)) {
// 바코드 체크
if (!empty($row[4])) {
// 데이터 설정
$date = $date;
$product_name = $row[6] ?? ''; // 품명
$barcode = $row[4] ?? ''; // 바코드
$sales = $row[7] ?? ''; // 판매
$sales_amount = $row[8] ?? ''; // 판매금액
$menu_discount = $row[9] ?? ''; // 할인액
$payment_amount = $row[10] ?? ''; // 매출액
// `bakery_product_table`에 바코드가 있는지 확인
$checkQuery = "SELECT used FROM {$fg['bakery_product_table']} WHERE barcode = '{$barcode}'";
$checkResult = sql_query($checkQuery);
$rowCount = sql_num_rows($checkResult);
if ($rowCount > 0) {
$used = sql_fetch_array($checkResult)['used'];
// 바코드가 존재하지만 used 값이 0인 경우 continue
if ($used == 0) continue;
} else {
// 바코드가 없는 경우 추가
$insertQuery = "INSERT INTO {$fg['bakery_product_table']} (product_name, barcode, used) VALUES ('{$product_name}', '{$barcode}', 1)";
sql_query($insertQuery);
}
// 바코드가 신규로 들어간 경우에는 used값이 항상 1이고, 기존 0인 경우는 이미 continue 처리가 되어있음
// 데이터 삽입
$query = "INSERT INTO {$fg['bakery_inventory_table']} (date, barcode, sales, sales_amount, menu_discount, payment_amount, edit_datetime) ";
$query .= " VALUES ('{$date}', '{$barcode}', '{$sales}', '{$sales_amount}', '{$menu_discount}', '{$payment_amount}', '{$datetime}') ";
// 이미 값이 있는 경우 업데이트
$query .= " ON DUPLICATE KEY UPDATE
sales = '{$sales}',
sales_amount = '{$sales_amount}',
menu_discount = '{$menu_discount}',
payment_amount = '{$payment_amount}',
edit_datetime = '{$datetime}'
";
$result = sql_query($query);
// 점검용, Query Print
if ($is_debug) {
print_r($query);
echo "<br>" . PHP_EOL;
}
}
}
}
}
} else {
echo SimpleXLSX::parseError();
}
} catch (Exception $e) {
echo '엑셀 파일 읽기 오류: ', $e->getMessage();
}
// 파일 삭제
if (file_exists($uploadFile)) {
unlink($uploadFile);
if ($is_debug) echo "파일 삭제 완료." . PHP_EOL;
}
} else {
echo "파일 업로드 실패";
}
} else {
echo "잘못된 요청";
}

View File

@ -0,0 +1,290 @@
<?php
// 베이커리 재고관리
$sub_menu = "998020";
require_once './_common.php';
auth_check_menu($auth, $sub_menu, 'r');
if (!$is_admin) {
alert('관리자만 접근 가능합니다.');
}
$g5['title'] = '베이커리 재고관리';
require_once G5_ADMIN_PATH . '/admin.head.php';
// 검색 변수 초기화
!isset($search) ?? "";
!isset($where) ?? "";
!isset($search_count) ?? "";
$is_debug = false; // 디버깅 시 true로 변경
// ord_by 로 넘어온 값이 있으면 반영
$ord_by = isset($_REQUEST["ord_by"]) ? $_REQUEST["ord_by"] : "product_name ASC";
// 날짜로 검색한 경우 해당 날짜를 사용하고, 아닌 경우 오늘 날짜를 사용함
$searchDate = isset($_REQUEST["searchDate"]) ? $_REQUEST["searchDate"] : date("Y-m-d"); // 검색일
$prevDate = date("Y-m-d", strtotime("-1 day", strtotime($searchDate))); // 검색 전일
$edit_datetime = date('Y-m-d H:i:s'); // 최종 수정 시간 업데이트
// 베이커리 계정인지 확인하고, 오늘 이후 날짜인 경우 생산-결제금액란을 공란으로 출력하기 위한 변수
$is_bakery = ( $_SESSION['user_id'] == "bakery" ) ? true : false;
$is_bakery_input = ( strtotime($searchDate) >= strtotime(date("Y-m-d")) ) ? true : false;
// 합계 변수 선언
$t_prev_stock = $t_production = $t_inhouse_use = $t_recycling = $t_disposal = $t_sales = $t_sales_amount = $t_menu_discount = $t_payment_amount = $t_current_stock = 0;
/*
$chkQuery = "SELECT * FROM {$fg['bakery_product_table']} WHERE used = 1 ";
$cheQueryResult = sql_query($chkQuery);
$a=1;
while ($row = sql_fetch_array($cheQueryResult)) {
echo $a;
print_r($row);
echo "<br>";
$a++;
}
echo "여기까지 테스트";
*/
bakeryPreUpdate($searchDate, $edit_datetime);
$authInfo = getAuthorInfo($searchDate);
if (!$authInfo) {
$authInfo = ['worker' => '', 'author' => ''];
}
?>
<style>
/* 베이커리용 CSS */
.bakery tfoot {
font-weight: 600;
}
.sort-icon {
margin-left: 5px;
font-size: 12px;
vertical-align: middle;
}
/* 틀 고정
.tableWrapper {
overflow: auto;
height: 700px;
width: 100%;
}
#bakeryTable th {
position: sticky;
top: 0px;
}
*/
</style>
<h2 class="mb-3">베이커리 일일현황</h2>
<div class="d-flex justify-content-between">
<div class="row align-items-start flex-nowrap">
<div class="col-auto input-group">
<span class="input-group-text">날짜선택</span>
<input type="date" class="form-control" id="searchDateInput" name="searchDate" max="9999-12-31" value="<?= $searchDate ?>">
</div>
<div class="col-auto">
<form>
<input type="hidden" id="hiddenSearchDate" name="searchDate" value="<?= date("Y-m-d") ?>">
<button type="submit" class="btn btn-primary mb-3">오늘</button>
</form>
</div>
</div>
<div>
<input type="file" id="inventoryFileInput" style="display:none;" accept=".xls,.xlsx" />
<div class="btn-group" role="group" aria-label="bakery-button">
<?php if(!bakeryChkDate($searchDate, $_SESSION['user_id'])) {?>
<button type="button" class="btn btn-primary" id="editButton" onclick="toggleEditMode()" >수정</button>
<button type="button" class="btn btn-primary d-none" id="confirmButton" onclick="confirmEditMode()">확인</button>
<?php } ?>
<button type="button" class="btn btn-secondary" id="uploadInventoryButton">파일첨부</button>
<button type="button" class="btn btn-success" id="exportExcelButton">엑셀변환</button>
<?php if ($is_bakery || $is_admin) { ?>
<button type="button" class="btn btn-success" id="print">양식출력</button>
<?php } ?>
</div>
</div>
</div>
<div class="mb-3" style="max-width:600px;">
<form class="form-group" id="author" name="author" >
<input type="hidden" name="searchDate" id="searchDate" value="<?=$searchDate?>">
<div class="input-group">
<span class="input-group-text" id="worker">근무자</span>
<input style="width: 250px;" type="text" class="form-control" name="worker" id="worker" value="<?=$authInfo['worker']?>" required>
<span class="input-group-text" id="author">작성자</span>
<input style="width: 100px;" type="text" class="form-control" name="author" id="author" value="<?=$authInfo['author']?>" required>
</div>
</form>
</div>
<div class="tableWrapper">
<table class="table table-striped align-middle table-hover bakery" id="bakeryTable">
<colgroup>
<col width="30px">
<col width="150px">
<col width="70px">
<col width="70px">
<col width="70px">
<col width="70px">
<col width="70px">
<col width="70px">
<col width="70px">
<col width="70px">
<col width="70px">
<col width="70px">
<col width="70px">
<col width="70px">
</colgroup>
<!-- 테이블 제목 -->
<thead class="table-light">
<tr class="align-middle">
<th class="text-center no-click">No.</th>
<th class="text-center" data-column="product_name" data-order="asc">품목 <span class="sort-icon" data-column="product_name"></span></th>
<th class="text-center" data-column="barcode" data-order="asc">바코드 <span class="sort-icon" data-column="barcode"></span></th>
<th class="text-center" data-column="previous_stock" data-order="asc">전일재고 <span class="sort-icon" data-column="previous_stock"></span></th>
<th class="text-center" data-column="production" data-order="asc">생산 <span class="sort-icon" data-column="production"></span></th>
<th class="text-center" data-column="inhouse_use" data-order="asc">업장사용 <span class="sort-icon" data-column="inhouse_use"></span></th>
<th class="text-center" data-column="recycling" data-order="asc">재활용 <span class="sort-icon" data-column="recycling"></span></th>
<th class="text-center" data-column="disposal" data-order="asc">폐기 <span class="sort-icon" data-column="disposal"></span></th>
<th class="text-center" data-column="sales" data-order="asc">판매수량 <span class="sort-icon" data-column="sales"></span></th>
<th class="text-center" data-column="unit_price" data-order="asc">단가 <span class="sort-icon" data-column="unit_price"></span></th>
<th class="text-center" data-column="sales_amount" data-order="asc">판매금액 <span class="sort-icon" data-column="sales_amount"></span></th>
<th class="text-center" data-column="menu_discount" data-order="asc">메뉴별할인 <span class="sort-icon" data-column="menu_discount"></span></th>
<th class="text-center" data-column="payment_amount" data-order="asc">결제금액 <span class="sort-icon" data-column="payment_amount"></span></th>
<th class="text-center" data-column="current_stock" data-order="asc">현재고 <span class="sort-icon" data-column="current_stock"></span></th>
</tr>
</thead>
<!-- 테이블 데이터 -->
<tbody class="table-group-divider" id="bakeryTableBody">
<?php
// 데이터 가져와서 뿌리기
$i = 1; // number 표시를 위한 변수
foreach (getBakeryInvenData($searchDate, $ord_by) as $row) {
// 전일자 현재고 가져오기, 없으면 0을 반환함
$previous_stock = getPrevStock($searchDate, $row['barcode']) ;
// 현재고
$current_stock = $previous_stock + $row['production'] - $row['inhouse_use'] - $row['recycling'] - $row['disposal'] - $row['sales'];
// 계산된 값과 DB에 저장된 값이 일치하지 않으면 업데이트
if ( $row['current_stock'] != $current_stock ) bakeryCurrentStockUpdate($searchDate, $row['barcode'], $current_stock);
// 단가 만들기
$unit_price = 0;
if ( $row['sales_amount'] != 0 || $row['sales'] != 0 ) {
$unit_price = $row['sales_amount'] / $row['sales'];
}
// 합계값 만들기, 전일재고와 현재고는 DB의 값을 사용하지 않음
$t_prev_stock += $previous_stock;
$t_production += $row['production'];
$t_inhouse_use += $row['inhouse_use'];
$t_recycling += $row['recycling'];
$t_disposal += $row['disposal'];
$t_sales += $row['sales'];
$t_sales_amount += $row['sales_amount'];
$t_menu_discount += $row['menu_discount'];
$t_payment_amount += $row['payment_amount'];
$t_current_stock += $current_stock;
?>
<tr id="row-<?=$row['barcode']?>">
<td class="text-center"><?=$i?></td>
<td class="text-center">
<a data-bs-toggle="modal" data-bs-target="#modify_modal_<?=$row['idx']?>">
<?=htmlspecialchars($row['product_name'])?>
</a>
</td>
<td class="text-center"><?=$row['barcode']?></td>
<td class="text-end"><?=number_format($previous_stock)?></td>
<td class="text-end"><span class="value"><?=number_format($row['production'])?></span>
<input class="form-control text-end d-none" type="text" value="<?=$row['production']?>" id="production-<?=$row['barcode']?>" product_name="<?=$row['product_name']?>" aria-label="production" readonly>
</td>
<td class="text-end"><span class="value"><?=number_format($row['inhouse_use'])?></span>
<input class="form-control text-end d-none" type="text" value="<?=$row['inhouse_use']?>" id="inhouse_use-<?=$row['barcode']?>" product_name="<?=$row['product_name']?>" aria-label="inhouse_use" readonly>
</td>
<td class="text-end"><span class="value"><?=number_format($row['recycling'])?></span>
<input class="form-control text-end d-none" type="text" value="<?=$row['recycling']?>" id="recycling-<?=$row['barcode']?>" product_name="<?=$row['product_name']?>" aria-label="recycling" readonly>
</td>
<td class="text-end"><span class="value"><?=number_format($row['disposal'])?></span>
<input class="form-control text-end d-none" type="text" value="<?=$row['disposal']?>" id="disposal-<?=$row['barcode']?>" product_name="<?=$row['product_name']?>" aria-label="disposal" readonly>
</td>
<td class="text-end"><?=number_format($row['sales'])?></td>
<td class="text-end"><?=number_format($unit_price)?></td>
<td class="text-end"><?=number_format($row['sales_amount'])?></td>
<td class="text-end"><?=number_format($row['menu_discount'])?></td>
<td class="text-end"><?=number_format($row['payment_amount'])?></td>
<td class="text-end"><?=number_format($current_stock)?></td>
</tr>
<!-- 수정 모달 -->
<div id="modify_modal_<?=$row['idx']?>" class="modal fade" tabindex="-1" aria-labelledby="modify_modal_<?=$row['idx']?>" aria-hidden="true">
<div class="modal-dialog modal modal-dialog-centered">
<div class="modal-content">
<form class="modify" id="modify_<?=$row['idx']?>" name="modify_<?=$row['idx']?>">
<div class="modal-header">
<h5 class="modal-title">정보 보기/수정</h5>
</div>
<div class="modal-body text-start">
<div class="input-group mb-1">
<span class="input-group-text col-md-2" id="product_name_<?=$row['idx']?>">품명</span>
<input type="text" class="form-control" id="product_name_<?=$row['idx']?>" name="product_name" value="<?=$row['product_name'] ?>">
<input type="radio" class="btn-check" name="used" id="used_<?=$row['idx']?>_1" value="1" <?=$row['used'] == "1" ? "checked": "" ?> required>
<label class="btn btn-outline-primary" for="used_<?=$row['idx']?>_1">사용</label>
<input type="radio" class="btn-check" name="used" id="used_<?=$row['idx']?>_0" value="0" <?=$row['used'] =="0" ? "checked" : "" ?> required>
<label class="btn btn-outline-primary" for="used_<?=$row['idx']?>_0">미사용</label>
</div>
<div class="input-group mb-1">
<span class="input-group-text col-md-2" id="barcode_<?=$row['idx']?>">바코드</span>
<input type="text" class="form-control" id="barcode_<?=$row['idx']?>" name="barcode" value="<?=$row['barcode']?>" required>
</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_<?=$row['idx']?>">닫기</button>
</div>
</form>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div>
<!-- 수정 모달 끝 -->
<?php $i++;
} // endforeach
?>
</tbody>
<!-- 합계 데이터 출력 -->
<tfoot>
<tr>
<td colspan="3" class="text-center">합계</th>
<td class="text-end" id="total_prev_stock"><?=number_format($t_prev_stock)?></th>
<td class="text-end" id="total_production"><?=number_format($t_production)?></th>
<td class="text-end" id="total_inhouse_use"><?=number_format($t_inhouse_use)?></th>
<td class="text-end" id="total_recycling"><?=number_format($t_recycling)?></th>
<td class="text-end" id="total_disposal"><?=number_format($t_disposal)?></th>
<td class="text-end" id="total_sales"><?=number_format($t_sales)?></th>
<td class="text-end" id="total_unit_price"></th>
<td class="text-end" id="total_sales_amount"><?=number_format($t_sales_amount)?></th>
<td class="text-end" id="total_menu_discount"><?=number_format($t_menu_discount)?></th>
<td class="text-end" id="total_payment_amount"><?=number_format($t_payment_amount)?></th>
<td class="text-end" id="total_current_stock"><?=number_format($t_current_stock)?></th>
</tr>
</tfoot>
</table>
</div>
<?php
include_once "tail.sub.php";
include_once FG_MANAGER_PATH."/tail.php";
include_once (G5_ADMIN_PATH.'/admin.tail.php');

View File

@ -0,0 +1,34 @@
<?php
include_once '_common.php';
if(!$_SESSION['user_id']) exit; // 로그인 되어있지 않으면 확인 불가
if ($_SERVER["REQUEST_METHOD"] == "POST") { // POST로 넘어온 값이 있다면
// 변수 선언
$product_name = trim($_POST["product_name"]);
$barcode = trim($_POST['barcode']);
$date = trim($_POST['searchDate']);
$id = trim($_POST['id']);
$value = trim($_POST['value']);
$edit_datetime = date('Y-m-d H:i:s', strtotime($date)); // 최종 수정 시간 업데이트
// 리스트에서 product name을 가지고 와야 함, 사전에 post로 전달받거나 품목 테이블에서 가져와야함
// 기존에 동일한 date, barcode를 가진 값이 있는 경우 insert가 아닌 update 로 처리해야 함
// update query
$query = "INSERT INTO {$fg['bakery_inventory_table']} (date, barcode, {$id}, edit_datetime) ";
$query .= "VALUES('{$date}', '{$barcode}', '{$value}', '{$edit_datetime}') ";
$query .= "ON DUPLICATE KEY UPDATE
{$id} = '{$value}',
edit_datetime = '{$edit_datetime}'
"; // 이미 값이 있는 경우 업데이트함
$result = sql_query($query);
if ($result) {
echo json_encode(array('status' => 'success'));
} else {
echo json_encode(array('status' => 'error', 'message' => 'Database error'));
}
} else {
echo json_encode(array('status' => 'error', 'message' => 'Invalid request method'));
}

View File

@ -0,0 +1,291 @@
<?php
// 베이커리 재고관리
$sub_menu = "998010";
require_once './_common.php';
auth_check_menu($auth, $sub_menu, 'r');
if (!$is_admin) {
alert('관리자만 접근 가능합니다.');
}
$g5['title'] = '베이커리 재고관리';
require_once G5_ADMIN_PATH . '/admin.head.php';
// 검색 변수 초기화
!isset($search) ?? "";
!isset($where) ?? "";
!isset($search_count) ?? "";
$is_debug = false; // 디버깅 시 true로 변경
if ($is_debug) echo "debug...";
// ord_by 로 넘어온 값이 있으면 반영
$ord_by = isset($_REQUEST["ord_by"]) ? $_REQUEST["ord_by"] : "product_name ASC";
// 날짜로 검색한 경우 해당 날짜를 사용하고, 아닌 경우 오늘 날짜를 사용함
$searchDate = isset($_REQUEST["searchDate"]) ? $_REQUEST["searchDate"] : date("Y-m-d"); // 검색일
$prevDate = date("Y-m-d", strtotime("-1 day", strtotime($searchDate))); // 검색 전일
$edit_datetime = date('Y-m-d H:i:s'); // 최종 수정 시간 업데이트
// 베이커리 계정인지 확인하고, 오늘 이후 날짜인 경우 생산-결제금액란을 공란으로 출력하기 위한 변수
$is_bakery = ( $_SESSION['user_id'] == "bakery" ) ? true : false;
$is_bakery_input = ( strtotime($searchDate) >= strtotime(date("Y-m-d")) ) ? true : false;
// 합계 변수 선언
$t_prev_stock = $t_production = $t_inhouse_use = $t_recycling = $t_disposal = $t_sales = $t_sales_amount = $t_menu_discount = $t_payment_amount = $t_current_stock = 0;
if ($is_debug && $is_print = false ) {
$chkQuery = "SELECT * FROM {$fg['bakery_product_table']} WHERE used = 1 ";
$cheQueryResult = sql_query($chkQuery);
$a=1;
while ($row = sql_fetch_array($cheQueryResult)) {
echo $a;
print_r($row);
echo "<br>";
$a++;
}
}
bakeryPreUpdate($searchDate, $edit_datetime);
$authInfo = getAuthorInfo($searchDate);
if (!$authInfo) {
$authInfo = ['worker' => '', 'author' => ''];
}
?>
<style>
/* 베이커리용 CSS */
.bakery tfoot {
font-weight: 600;
}
.sort-icon {
margin-left: 5px;
font-size: 12px;
vertical-align: middle;
}
/* 틀 고정
.tableWrapper {
overflow: auto;
height: 700px;
width: 100%;
}
#bakeryTable th {
position: sticky;
top: 0px;
}
*/
</style>
<h2 class="mb-3">베이커리 일일현황</h2>
<div class="d-flex justify-content-between">
<div class="row align-items-start flex-nowrap">
<div class="col-auto input-group">
<span class="input-group-text">날짜선택</span>
<input type="date" class="form-control" id="searchDateInput" name="searchDate" max="9999-12-31" value="<?= $searchDate ?>">
</div>
<div class="col-auto">
<form>
<input type="hidden" id="hiddenSearchDate" name="searchDate" value="<?= date("Y-m-d") ?>">
<button type="submit" class="btn btn-primary mb-3">오늘</button>
</form>
</div>
</div>
<div>
<input type="file" id="inventoryFileInput" style="display:none;" accept=".xls,.xlsx" />
<div class="btn-group" role="group" aria-label="bakery-button">
<?php if(!bakeryChkDate($searchDate, $_SESSION['user_id'])) {?>
<button type="button" class="btn btn-primary" id="editButton" onclick="toggleEditMode()" >수정</button>
<button type="button" class="btn btn-primary d-none" id="confirmButton" onclick="confirmEditMode()">확인</button>
<?php } ?>
<button type="button" class="btn btn-secondary" id="uploadInventoryButton">파일첨부</button>
<button type="button" class="btn btn-success" id="exportExcelButton">엑셀변환</button>
<?php if ($is_bakery || $is_admin) { ?>
<button type="button" class="btn btn-success" id="print">양식출력</button>
<?php } ?>
</div>
</div>
</div>
<div class="mb-3" style="max-width:600px;">
<form class="form-group" id="author" name="author" >
<input type="hidden" name="searchDate" id="searchDate" value="<?=$searchDate?>">
<div class="input-group">
<span class="input-group-text" id="worker">근무자</span>
<input style="width: 250px;" type="text" class="form-control" name="worker" id="worker" value="<?=$authInfo['worker']?>" required>
<span class="input-group-text" id="author">작성자</span>
<input style="width: 100px;" type="text" class="form-control" name="author" id="author" value="<?=$authInfo['author']?>" required>
</div>
</form>
</div>
<div class="tableWrapper">
<table class="table table-striped align-middle table-hover bakery" id="bakeryTable">
<colgroup>
<col width="30px">
<col width="150px">
<col width="70px">
<col width="70px">
<col width="70px">
<col width="70px">
<col width="70px">
<col width="70px">
<col width="70px">
<col width="70px">
<col width="70px">
<col width="70px">
<col width="70px">
<col width="70px">
</colgroup>
<!-- 테이블 제목 -->
<thead class="table-light">
<tr class="align-middle">
<th class="text-center no-click">No.</th>
<th class="text-center" data-column="product_name" data-order="asc">품목 <span class="sort-icon" data-column="product_name"></span></th>
<th class="text-center" data-column="barcode" data-order="asc">바코드 <span class="sort-icon" data-column="barcode"></span></th>
<th class="text-center" data-column="previous_stock" data-order="asc">전일재고 <span class="sort-icon" data-column="previous_stock"></span></th>
<th class="text-center" data-column="production" data-order="asc">생산 <span class="sort-icon" data-column="production"></span></th>
<th class="text-center" data-column="inhouse_use" data-order="asc">업장사용 <span class="sort-icon" data-column="inhouse_use"></span></th>
<th class="text-center" data-column="recycling" data-order="asc">재활용 <span class="sort-icon" data-column="recycling"></span></th>
<th class="text-center" data-column="disposal" data-order="asc">폐기 <span class="sort-icon" data-column="disposal"></span></th>
<th class="text-center" data-column="sales" data-order="asc">판매수량 <span class="sort-icon" data-column="sales"></span></th>
<th class="text-center" data-column="unit_price" data-order="asc">단가 <span class="sort-icon" data-column="unit_price"></span></th>
<th class="text-center" data-column="sales_amount" data-order="asc">판매금액 <span class="sort-icon" data-column="sales_amount"></span></th>
<th class="text-center" data-column="menu_discount" data-order="asc">메뉴별할인 <span class="sort-icon" data-column="menu_discount"></span></th>
<th class="text-center" data-column="payment_amount" data-order="asc">결제금액 <span class="sort-icon" data-column="payment_amount"></span></th>
<th class="text-center" data-column="current_stock" data-order="asc">현재고 <span class="sort-icon" data-column="current_stock"></span></th>
</tr>
</thead>
<!-- 테이블 데이터 -->
<tbody class="table-group-divider" id="bakeryTableBody">
<?php
// 데이터 가져와서 뿌리기
$i = 1; // number 표시를 위한 변수
foreach (getBakeryInvenData($searchDate, $ord_by) as $row) {
// 전일자 현재고 가져오기, 없으면 0을 반환함
$previous_stock = getPrevStock($searchDate, $row['barcode']) ;
// 현재고
$current_stock = $previous_stock + $row['production'] - $row['inhouse_use'] - $row['recycling'] - $row['disposal'] - $row['sales'];
// 계산된 값과 DB에 저장된 값이 일치하지 않으면 업데이트
if ( $row['current_stock'] != $current_stock ) bakeryCurrentStockUpdate($searchDate, $row['barcode'], $current_stock);
// 단가 만들기
$unit_price = 0;
if ( $row['sales_amount'] != 0 || $row['sales'] != 0 ) {
$unit_price = $row['sales_amount'] / $row['sales'];
}
// 합계값 만들기, 전일재고와 현재고는 DB의 값을 사용하지 않음
$t_prev_stock += $previous_stock;
$t_production += $row['production'];
$t_inhouse_use += $row['inhouse_use'];
$t_recycling += $row['recycling'];
$t_disposal += $row['disposal'];
$t_sales += $row['sales'];
$t_sales_amount += $row['sales_amount'];
$t_menu_discount += $row['menu_discount'];
$t_payment_amount += $row['payment_amount'];
$t_current_stock += $current_stock;
?>
<tr id="row-<?=$row['barcode']?>">
<td class="text-center"><?=$i?></td>
<td class="text-center">
<a data-bs-toggle="modal" data-bs-target="#modify_modal_<?=$row['idx']?>">
<?=htmlspecialchars($row['product_name'])?>
</a>
</td>
<td class="text-center"><?=$row['barcode']?></td>
<td class="text-end"><?=number_format($previous_stock)?></td>
<td class="text-end"><span class="value"><?=number_format($row['production'])?></span>
<input class="form-control text-end d-none" type="text" value="<?=$row['production']?>" id="production-<?=$row['barcode']?>" product_name="<?=$row['product_name']?>" aria-label="production" readonly>
</td>
<td class="text-end"><span class="value"><?=number_format($row['inhouse_use'])?></span>
<input class="form-control text-end d-none" type="text" value="<?=$row['inhouse_use']?>" id="inhouse_use-<?=$row['barcode']?>" product_name="<?=$row['product_name']?>" aria-label="inhouse_use" readonly>
</td>
<td class="text-end"><span class="value"><?=number_format($row['recycling'])?></span>
<input class="form-control text-end d-none" type="text" value="<?=$row['recycling']?>" id="recycling-<?=$row['barcode']?>" product_name="<?=$row['product_name']?>" aria-label="recycling" readonly>
</td>
<td class="text-end"><span class="value"><?=number_format($row['disposal'])?></span>
<input class="form-control text-end d-none" type="text" value="<?=$row['disposal']?>" id="disposal-<?=$row['barcode']?>" product_name="<?=$row['product_name']?>" aria-label="disposal" readonly>
</td>
<td class="text-end"><?=number_format($row['sales'])?></td>
<td class="text-end"><?=number_format($unit_price)?></td>
<td class="text-end"><?=number_format($row['sales_amount'])?></td>
<td class="text-end"><?=number_format($row['menu_discount'])?></td>
<td class="text-end"><?=number_format($row['payment_amount'])?></td>
<td class="text-end"><?=number_format($current_stock)?></td>
</tr>
<!-- 수정 모달 -->
<div id="modify_modal_<?=$row['idx']?>" class="modal fade" tabindex="-1" aria-labelledby="modify_modal_<?=$row['idx']?>" aria-hidden="true">
<div class="modal-dialog modal modal-dialog-centered">
<div class="modal-content">
<form class="modify" id="modify_<?=$row['idx']?>" name="modify_<?=$row['idx']?>">
<div class="modal-header">
<h5 class="modal-title">정보 보기/수정</h5>
</div>
<div class="modal-body text-start">
<div class="input-group mb-1">
<span class="input-group-text col-md-2" id="product_name_<?=$row['idx']?>">품명</span>
<input type="text" class="form-control" id="product_name_<?=$row['idx']?>" name="product_name" value="<?=$row['product_name'] ?>">
<input type="radio" class="btn-check" name="used" id="used_<?=$row['idx']?>_1" value="1" <?=$row['used'] == "1" ? "checked": "" ?> required>
<label class="btn btn-outline-primary" for="used_<?=$row['idx']?>_1">사용</label>
<input type="radio" class="btn-check" name="used" id="used_<?=$row['idx']?>_0" value="0" <?=$row['used'] =="0" ? "checked" : "" ?> required>
<label class="btn btn-outline-primary" for="used_<?=$row['idx']?>_0">미사용</label>
</div>
<div class="input-group mb-1">
<span class="input-group-text col-md-2" id="barcode_<?=$row['idx']?>">바코드</span>
<input type="text" class="form-control" id="barcode_<?=$row['idx']?>" name="barcode" value="<?=$row['barcode']?>" required>
</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_<?=$row['idx']?>">닫기</button>
</div>
</form>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div>
<!-- 수정 모달 끝 -->
<?php $i++;
} // endforeach
?>
</tbody>
<!-- 합계 데이터 출력 -->
<tfoot>
<tr>
<td colspan="3" class="text-center">합계</th>
<td class="text-end" id="total_prev_stock"><?=number_format($t_prev_stock)?></th>
<td class="text-end" id="total_production"><?=number_format($t_production)?></th>
<td class="text-end" id="total_inhouse_use"><?=number_format($t_inhouse_use)?></th>
<td class="text-end" id="total_recycling"><?=number_format($t_recycling)?></th>
<td class="text-end" id="total_disposal"><?=number_format($t_disposal)?></th>
<td class="text-end" id="total_sales"><?=number_format($t_sales)?></th>
<td class="text-end" id="total_unit_price"></th>
<td class="text-end" id="total_sales_amount"><?=number_format($t_sales_amount)?></th>
<td class="text-end" id="total_menu_discount"><?=number_format($t_menu_discount)?></th>
<td class="text-end" id="total_payment_amount"><?=number_format($t_payment_amount)?></th>
<td class="text-end" id="total_current_stock"><?=number_format($t_current_stock)?></th>
</tr>
</tfoot>
</table>
</div>
<?php
include_once "tail.sub.php";
//include_once FG_MANAGER_PATH."/tail.php";
require_once G5_ADMIN_PATH . '/admin.tail.php';

View File

@ -0,0 +1,96 @@
<?php
// 설정 파일 포함
include_once('_common.php');
if(!$_SESSION['user_id']) exit; // 로그인 되어있지 않으면 확인 불가
// 검색 날짜
$searchDate = $_POST['searchDate'];
$ord_by = $_POST['ordBy'];
$result = getBakeryInvenData($searchDate, $ord_by);
// UTF-8 BOM 추가
echo "\xEF\xBB\xBF";
// 헤더 설정
header("Content-Type: application/vnd.ms-excel; charset=utf-8");
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>
<th class="tit">현재고</th>
</tr>
</thead>
<tbody>
<?php
$t_prev_stock = $t_production = $t_inhouse_use = $t_recycling = $t_disposal = $t_sales = $t_sales_amount = $t_menu_discount = $t_payment_amount = $t_current_stock = 0;
// 데이터 출력
foreach ( $result as $row) {
?>
<tr>
<td><?=$row['product_name']?></td>
<td><?=$row['barcode']?></td>
<td><?=number_format(getPrevStock($searchDate, $row['barcode']))?></td>
<td><?=number_format($row['production'])?></td>
<td><?=number_format($row['inhouse_use'])?></td>
<td><?=number_format($row['recycling'])?></td>
<td><?=number_format($row['disposal'])?></td>
<td><?=number_format($row['sales'])?></td>
<td><?=($row['sales'] != 0 && $row['sales_amount'] != 0) ? number_format($row['sales_amount']/$row['sales']) : 0 ?></td>
<td><?=number_format($row['sales_amount'])?></td>
<td><?=number_format($row['menu_discount'])?></td>
<td><?=number_format($row['payment_amount'])?></td>
<td><?=number_format($row['current_stock'])?></td>
</tr>
<?php
// 합계 함수 처리
$t_prev_stock += $row['previous_stock'];
$t_production += $row['production'];
$t_inhouse_use += $row['inhouse_use'];
$t_recycling += $row['recycling'];
$t_disposal += $row['disposal'];
$t_sales += $row['sales'];
$t_sales_amount += $row['sales_amount'];
$t_menu_discount += $row['menu_discount'];
$t_payment_amount += $row['payment_amount'];
$t_current_stock += $row['current_stock'];
}
?>
</tbody>
<tfoot class="table-group-divider">
<tr class="bakery_total">
<td>합계</td>
<td></td>
<td><?=number_format($t_prev_stock) ?></td>
<td><?=number_format($t_production) ?></td>
<td><?=number_format($t_inhouse_use) ?></td>
<td><?=number_format($t_recycling) ?></td>
<td><?=number_format($t_disposal) ?></td>
<td><?=number_format($t_sales) ?></td>
<td></td>
<td><?=number_format($t_sales_amount) ?></td>
<td><?=number_format($t_menu_discount) ?></td>
<td><?=number_format($t_payment_amount) ?></td>
<td><?=number_format($t_current_stock) ?></td>
</tr>
</tfoot>
</table>

View File

@ -0,0 +1,102 @@
<?php
// 베이커리팀용 양식출력 파일
// 베이커리 재고관리
include_once "_common.php";
if(!$_SESSION['user_id']) exit;
// 검색 변수 초기화
!isset($search) ?? "";
!isset($where) ?? "";
!isset($search_count) ?? "";
$is_debug = false; // 디버깅 시 true로 변경
// 날짜로 검색한 경우 해당 날짜를 사용하고, 아닌 경우 오늘 날짜를 사용함
$searchDate = isset($_REQUEST["searchDate"]) ? $_REQUEST["searchDate"] : date("Y-m-d"); // 검색일
$prevDate = date("Y-m-d", strtotime("-1 day", strtotime($searchDate))); // 검색 전일
$edit_datetime = date('Y-m-d H:i:s'); // 최종 수정 시간 업데이트
bakeryPreUpdate($searchDate, $edit_datetime);
?>
<style>
@page {
margin-left: 2cm;
margin-right: 2cm;
}
.container { width: "100%"}
.bakery tfoot {
font-weight: 600;
}
.sort-icon {
margin-left: 5px;
font-size: 12px;
vertical-align: middle;
}
</style>
<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>
</head>
<body>
<h2 class="mb-3 text-center">베이커리 일일현황</h2>
<div class="d-flex justify-content-end mb-3">
<div class="col-auto">
날짜 : <?= $searchDate ?>
</div>
</div>
<table class="table table-striped align-middle table-hover bakery" id="bakeryTable">
<colgroup>
<col width="30px">
<col width="150px">
<col width="70px">
<col width="70px">
<col width="70px">
<col width="70px">
<col width="70px">
<col width="70px">
</colgroup>
<!-- 테이블 제목 -->
<thead class="table-light">
<tr class="align-middle">
<th class="text-center no-click">No.</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>
</tr>
</thead>
<!-- 테이블 데이터 -->
<tbody class="table-group-divider" id="bakeryTableBody">
<?php
// 데이터 가져와서 뿌리기
$i = 1; // number 표시를 위한 변수
foreach (getBakeryInvenData($searchDate) as $row) {
if($is_debug) var_dump($row);
// 전일자 현재고 가져오기, 없으면 0을 반환함
$previous_stock = getPrevStock($searchDate, $row['barcode']) ;
// 현재고
$current_stock = $previous_stock + $row['production'] - $row['inhouse_use'] - $row['recycling'] - $row['disposal'] - $row['sales'];
?>
<tr id="row-<?=$row['barcode']?>">
<td class="text-center"><?=$i?></td>
<td class="text-center"><?=htmlspecialchars($row['product_name'])?></td>
<td class="text-center"><?=$previous_stock?></td>
<td class="text-end"><input class="form-control text-end" type="text" value=""></td>
<td class="text-end"><input class="form-control text-end" type="text" value=""></td>
<td class="text-end"><input class="form-control text-end" type="text" value=""></td>
<td class="text-end"><input class="form-control text-end" type="text" value=""></td>
<td class="text-center"><?=$current_stock?></td>
</tr>
<?php $i++;
}
?>
</tbody>
</table>
</body>
</html>

View File

@ -0,0 +1,264 @@
<script>
$(document).ready(function() {
var ordBy = <?php echo json_encode(isset($ord_by) ? $ord_by : ''); ?>;
var searchDate = <?php echo json_encode(isset($searchDate) ? $searchDate : ''); ?>;
// 삭제 확인 및 처리 함수
window.confirmDelete = function(idx) {
if (confirm('정말 삭제하시겠습니까? 삭제한 후 복원할 수 없습니다.')) {
var delete_url = 'bakery_product_list.ajax.delete.php';
var formData = {
idx: idx
};
$.post(delete_url, formData, function(json) {
if (json !== undefined && json.isSuccess) {
alert('처리가 완료되었습니다.');
location.reload();
} else {
alert('처리중 에러가 발생하였습니다: ' + (json || '알 수 없는 오류'));
}
});
}
};
// 수정 폼 전송 및 처리 함수 추가
$('.modify').on('submit', function(event) {
event.preventDefault(); // 기본 제출 동작 방지
var form = $(this);
var formData = form.serialize(); // 폼 데이터 직렬화
$.post('bakery_product_list.ajax.update.php', formData, function(json) {
console.log(json); // 반환된 데이터를 확인하기 위한 로그
if (json !== undefined && json.isSuccess) {
alert('수정이 완료되었습니다.');
location.reload();
} else if(json !== undefined && !json.isSuccess) {
alert('수정 중 에러가 발생하였습니다: ' + (json.message || '알 수 없는 오류'));
} else {
alert('수정 중 에러가 발생하였습니다. JSON 데이터가 정의되지 않았습니다.');
}
}).fail(function() {
alert('AJAX 요청 실패.');
});
});
// 추가 폼 전송 및 처리 함수 추가
$('.add').on('submit', function(event) {
event.preventDefault(); // 기본 제출 동작 방지
var form = $(this);
var formData = form.serialize(); // 폼 데이터 직렬화
$.post('bakery_product_list.ajax.add.php', formData, function(json) {
console.log(json); // 반환된 데이터를 확인하기 위한 로그
if (json !== undefined && json.isSuccess) {
alert('품목 추가가 완료되었습니다.');
location.reload();
} else if(json !== undefined && !json.isSuccess) {
alert('추가 중 에러가 발생하였습니다: ' + (json.message || '알 수 없는 오류'));
} else {
alert('추가 중 에러가 발생하였습니다. JSON 데이터가 정의되지 않았습니다.');
}
}).fail(function() {
alert('AJAX 요청 실패.');
});
});
function attachThClickEvent() {
$('table').off('click', 'th'); // 기존 이벤트 제거
$('table').on('click', 'th', function() {
if ($(this).hasClass('no-click')) {
return; // no-click 클래스를 가진 th 요소는 클릭 이벤트를 무시하고 이후 코드 실행 안함
}
console.log('th clicked:', $(this).data('column')); // 로그 추가
const column = $(this).data('column');
let order = $(this).data('order') || 'asc'; // 기본값 'asc'
order = order === 'asc' ? 'desc' : 'asc';
$(this).data('order', order);
sortTable(column, order); // 테이블 정렬 함수 호출
});
}
function sortTable(column, order) {
const tbody = $('#bakeryTable tbody');
const rows = tbody.find('tr').toArray();
rows.sort((a, b) => {
const aValue = $(a).find(`td:eq(${getColumnIndex(column)})`).text();
const bValue = $(b).find(`td:eq(${getColumnIndex(column)})`).text();
if (order === 'asc') {
return aValue.localeCompare(bValue, undefined, {numeric: true});
} else {
return bValue.localeCompare(aValue, undefined, {numeric: true});
}
});
$.each(rows, (index, row) => {
tbody.append(row);
// 정렬 후 No. 열의 값을 재설정
$(row).find('td').eq(0).text(index + 1);
});
}
function getColumnIndex(column) {
return $(`#bakeryTable th[data-column="${column}"]`).index();
}
attachThClickEvent();
// 날짜 입력값 변경 시 페이지 전체 갱신
$('#searchDateInput').on('change', function() {
const searchDate = $(this).val();
const url = new URL(window.location.href);
url.searchParams.set('searchDate', searchDate);
window.location.href = url.toString();
});
// 수정 버튼 클릭 시
window.toggleEditMode = function() {
document.querySelectorAll('tbody .value').forEach(span => {
span.classList.toggle('d-none');
});
document.querySelectorAll('tbody input.form-control').forEach(input => {
input.classList.toggle('d-none');
if (input.hasAttribute('readonly')) {
input.removeAttribute('readonly');
} else {
input.setAttribute('readonly', 'readonly');
}
});
document.getElementById('editButton').classList.toggle('d-none');
document.getElementById('confirmButton').classList.toggle('d-none');
}
// 확인 버튼 클릭 시 데이터 업데이트 및 합계 갱신
window.confirmEditMode = function() {
var formData = new FormData();
document.querySelectorAll('tbody input.form-control').forEach(input => {
formData.append(input.id, input.value);
});
formData.append('searchDate', $('#searchDate').val());
$.ajax({
url: 'bakery_stock.ajax.confirm.update.php',
type: 'POST',
data: formData,
processData: false,
contentType: false,
success: function(response) {
console.log('Data updated successfully'); // 로그 추가
toggleEditMode();
// updateTableBody({ ord_by: ordBy, searchDate: $('#searchDate').val() }); // 불필요한 호출 제거
updateTotal(); // 합계 갱신
// location.reload();
},
error: function(xhr, status, error) {
console.error('Error: ' + error);
}
});
}
// 파일 업로드 버튼 클릭 시 파일 선택 창 열기
$('#uploadInventoryButton').on('click', function() {
$('#inventoryFileInput').click();
});
// 파일 선택 시 AJAX로 파일 업로드
$('#inventoryFileInput').on('change', function() {
var file = $('#inventoryFileInput')[0].files[0];
if (isValidExcelFile(file)) {
var formData = new FormData();
formData.append('file', file);
formData.append('searchDate', $('#searchDate').val());
$.ajax({
url: 'bakery_stock.ajax.upload_inventory.php',
type: 'POST',
data: formData,
contentType: false,
processData: false,
success: function(response) {
alert('파일 업로드 완료');
location.reload(); // 파일 업로드 후 페이지 새로고침
},
error: function() {
alert('파일 업로드 실패');
}
});
} else {
alert('엑셀 파일만 업로드할 수 있습니다.');
}
});
function isValidExcelFile(file) {
const validExtensions = ['.xls', '.xlsx'];
const fileName = file.name.toLowerCase();
return validExtensions.some(ext => fileName.endsWith(ext));
}
// 엑셀변환 ajax
document.getElementById('exportExcelButton').addEventListener('click', function() {
$.ajax({
url: 'bakery_stock_excel.php',
type: 'POST',
data: { searchDate: $('#searchDate').val(), ordBy: ordBy },
xhrFields: {
responseType: 'blob'
},
success: function(data) {
var blob = new Blob([data], { type: 'application/vnd.ms-excel' });
var link = document.createElement('a');
link.href = window.URL.createObjectURL(blob);
link.download = 'bakery_data_' + $('#searchDate').val() + '.xls';
link.click();
},
error: function(jqXHR, textStatus, errorThrown) {
console.error('엑셀 파일 다운로드 실패:', textStatus, errorThrown);
}
});
});
// author 업데이트
$('#author input').on('blur', function(event) {
var formData = new FormData(document.getElementById('author')); // 폼 데이터 직렬화
console.log("Form Data:", formData); // 직렬화된 데이터 로그 확인
$.ajax({
type: 'POST',
url: 'bakery_stock.ajax.author.update.php',
data: formData,
processData: false,
contentType: false,
success: function(response) {
if (response.success) {
console.log('데이터가 성공적으로 저장되었습니다.');
} else {
console.error('데이터 저장에 실패하였습니다: ' + response.message);
}
},
error: function(xhr, status, error) {
console.error('AJAX 호출 중 오류가 발생하였습니다: ' + error);
}
});
});
// 출력 버튼 클릭 이벤트 추가
$('#print').on('click', function() {
var searchDate = $('#searchDate').val(); // searchDate 값을 가져옴
var printWindow = window.open('bakery_stock_print.php?searchDate=' + searchDate, '_blank', 'width=800,height=600');
printWindow.onload = function() {
printWindow.print();
};
});
});
</script>

151
adm/fg_admin/config.php Normal file
View File

@ -0,0 +1,151 @@
<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://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<link rel="stylesheet"href="<?=FG_MANAGER_URL?>/css/vip.css">
<script src="<?=FG_MANAGER_URL?>/js/list.js"></script>
<script src="<?=FG_MANAGER_URL?>/js/ajax.js"></script>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.17.2/xlsx.full.min.js"></script>
<!-- 폰트어썸 -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.1.0/css/all.min.css" integrity="sha512-10/jx2EXwxxWqCLX/hHth/vu2KY3jCF70dCQB8TSgNjbCVAC/8vai53GfMDrO2Emgwccf2pJqxct9ehpzG+MTw==" crossorigin="anonymous" referrerpolicy="no-referrer" />
<?php
// 기본 환경 설정
// 데이터베이스 설정
// 테이블 이름
define('FG_TABLE_PREFIX', 'fg_manager_');
// VIP
$fg['vip_list_table'] = FG_TABLE_PREFIX.'vip_list'; // VIP LIST 테이블
$fg['vip_category_table'] = FG_TABLE_PREFIX.'vip_category'; // VIP 구분 테이블
// 사용자
$fg['member_table'] = FG_TABLE_PREFIX.'member'; // 사용자 테이블
$fg['member_group_table'] = FG_TABLE_PREFIX.'member_group'; // 사용자 그룹 테이블
// 재고
$fg['vip_card_stock_table'] = FG_TABLE_PREFIX.'vip_card_stock'; // 카드 재고 테이블vipfg_manager_
$fg['card_stock_new_table'] = FG_TABLE_PREFIX.'stock_new'; // 카드번호로 관리하는 카드 재고 테이블
$fg['log_table'] = FG_TABLE_PREFIX.'log'; // LOG 테이블
$fg['menu_table'] = FG_TABLE_PREFIX.'menu'; // 메뉴 테이블 필요없는듯
// 연간회원
$fg['annual_category_table'] = FG_TABLE_PREFIX.'annual_category'; // 연간회원 구분
$fg['annual_member_table'] = FG_TABLE_PREFIX.'annual_member'; // 연간회원 목록
$fg['enter_table'] = FG_TABLE_PREFIX.'enter'; // 연간회원 입장기록 테이블
// 베이커리
$fg['bakery_inventory_table'] = FG_TABLE_PREFIX.'bakery_inventory';
$fg['bakery_product_table'] = FG_TABLE_PREFIX.'bakery_product_info';
$fg['bakery_author_table'] = FG_TABLE_PREFIX.'bakery_author_info';
// 매표소
$fg['visitor_category_table'] = FG_TABLE_PREFIX.'visitor_category';
$fg['visitor_data_table'] = FG_TABLE_PREFIX.'visitor_data';
// 기본 변수 선언
// GET으로 페이지가 넘어오지 않은 경우 페이지 넘버는 1로 고정함
$p = isset($_GET['p']) ? $_GET['p'] : 1;
$recnum = 15; // 출력할 아이템 수
$pagenum = 20; // 한 페이지에 출력할 페이지 수
$query_limit = "LIMIT ".(($p - 1) * $recnum).",".$recnum; // 출력할 아이템 수 만큼만 가져오기
// page 설정
// 페이지가 많지 않기 때문에 수동으로 배열을 만들었지만, 페이지가 많아지면 DB를 이용하는것이 편함
// 1차배열의 index 순으로 출력함. 특정 메뉴가 상단에 출력되게 하고 싶다면 순서를 바꿔줄 것
/*
pid : 파일명
pgroup : 메뉴그룹
pname : 메뉴이름
pauth : 권한(0은 전체, 숫자가 높을수록 높은 권한, 4까지)
purl : 페이지 주소
*/
$setpage = array(
array('pid' => 'dashboard',
'pgroup' => 'home',
'pname' => '대시보드',
'pauth' => 4,
'purl' => FG_MANAGER_URL.'/adm/dashboard.php'
),
array('pid' => 'vip_list_ent',
'pgroup' => '입장처리',
'pname' => 'VIP입장',
'pauth' => 0,
'purl' => FG_MANAGER_URL.'/vip/vip_list_ent.php'
),
array('pid' => 'annual_member_list_ent',
'pgroup' => '입장처리',
'pname' => '연간회원입장',
'pauth' => 0,
'purl' => FG_MANAGER_URL.'/annual_member/annual_member_list_ent.php'
),
array('pid' => 'vip_list',
'pgroup' => '목록',
'pname' => 'VIP관리',
'pauth' => 0,
'purl' => FG_MANAGER_URL.'/vip/vip_list.php'
),
array('pid' => 'annual_member_list',
'pgroup' => '목록',
'pname' => '연간회원',
'pauth' => 3,
'purl' => FG_MANAGER_URL.'/annual_member/annual_member_list.php'
),
array('pid' => 'annual_member_category',
'pgroup' => '관리',
'pname' => '연간회원 구분관리',
'pauth' => 2,
'purl' => FG_MANAGER_URL.'/annual_member/annual_member_category.php'
),
array('pid' => 'adm_vip_list_category',
'pgroup' => '관리',
'pname' => 'VIP구분관리',
'pauth' => 2,
'purl' => FG_MANAGER_URL.'/vip/vip_list_category.php'
),
array('pid' => 'adm_member',
'pgroup' => '관리',
'pname' => '계정관리',
'pauth' => 0,
'purl' => FG_MANAGER_URL.'/adm/adm_member.php'
),
array('pid' => 'adm_member_group',
'pgroup' => '관리',
'pname' => '부서관리',
'pauth' => 2,
'purl' => FG_MANAGER_URL.'/adm/adm_member_group.php'
),
array('pid' => 'ent_list',
'pgroup' => '관리',
'pname' => '입장목록',
'pauth' => 0,
'purl' => FG_MANAGER_URL.'/adm/ent_list.php'
),
array('pid' => 'visitor_list',
'pgroup' => '관리',
'pname' => '방문객',
'pauth' => 4,
'purl' => FG_MANAGER_URL.'/adm/visitor_list.php'
),
array('pid' => 'visitor_input',
'pgroup' => '관리',
'pname' => '방문객입력',
'pauth' => 4,
'purl' => FG_MANAGER_URL.'/adm/visitor_input.php'
),
array('pid' => 'adm_log',
'pgroup' => '관리',
'pname' => 'log',
'pauth' => 4,
'purl' => FG_MANAGER_URL.'/adm/adm_log.php'
),
array('pid' => 'bakery_stock',
'pgroup' => '베이커리리',
'pname' => '베이커리',
'pauth' => 3,
'purl' => FG_MANAGER_URL.'/bakery/bakery_stock.php'
)
);

442
adm/fg_admin/css/common.css Normal file
View File

@ -0,0 +1,442 @@
@charset "utf-8";
/* reset */
body,p,h1,h2,h3,h4,h5,h6,ul,ol,li,.side_cate,dt,dd,table,th,td,form,fieldset,legend,input,textarea,button,blockquote{margin:0;padding:0; -webkit-text-size-adjust:none; word-break: keep-all;word-wrap: break-word;}
body,table{font-size: 13px;font-family: 'Noto Sans Korean', sans-serif; color:#333;letter-spacing:0em;vertical-align: middle;}
*{box-sizing: border-box;word-break: keep-all;word-wrap: break-word;}
body{background:#fff;-webkit-text-size-adjust:none;width: 100%; height: 100%;}
fieldset,img,iframe,frame{border:0}
legend,caption{overflow:hidden;position:absolute;font-size:0;line-height:0;visibility:hidden}
h1,h2,h3,h4,h5,h6{font-size:1em}
img{-webkit-tap-highlight-color: rgba(0,0,0,0);-webkit-tap-highlight-color: transparent;}
img,input,textarea,fieldset{border:0 none;outline:none}
ul,ol,dl,li,dt,dd{list-style:none;margin:0;padding:0;}
em,address{font-style:normal}
a{color:#373e40;text-decoration:none;outline: none;}
a:link,a:visited,a:hover,a:active{text-decoration:none;outline: none;}
strong{font-weight:bold}
legend,hr,caption{display:none}
table{border-spacing:0; text-align: center;}
input,textarea,button,select,option{font-family: inherit; text-decoration: none;letter-spacing:0em; outline: 0;-webkit-tap-highlight-color:transparent;vertical-align: middle;}
article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section{display:block;}
select{text-indent:5px;}
ul{text-decoration:none;}
figure{margin:0;padding:0;}
html{width: 100%; height: 100%;}
/* layout */
.innopay{width: 100%; height: 100%;}
.popup_notice{width: 100%;height: 100%;display: none;position: fixed; top: 0;left: 0;}
.popup_notice .dim{background: #888; opacity: 0.94;width: 100%; height: 100%;position: fixed;top: 0;left: 0;vertical-align: middle;z-index: 100;}
.popup_notice .text{padding:0;color: #fff;text-align: center;position: fixed;top: 50%;width: 100%;z-index: 1000;}
.popup_notice p{padding:0 20px;color: #fff;text-align: center;font-size: 30px; width: 100%;font-weight: 500;width: 100%;line-height: 1.3;}
.popup_notice span{padding:0 30px;color: #fff;font-size: 20px;text-align: center;font-weight: normal;line-height: 28px;width: 100%;display: block;}
.innopay_wrap{width:680px;}
.contents{background: #f0f1f2;}
.contents:after{content:"";display:block;clear:both;}
.con_wrap{padding:24px 30px; width: 460px; height: 600px;float: left;position: relative; }
.con_wrap:after{content:"";display:block;clear:both;}
.float_wrap{width: 100%; height: 100%; position: absolute; top: 0; left: 0;}
.receipt_wrap{width: 500px;position: relative;background: #f0f1f2;}
.receipt_wrap:after{content:"";display:block;clear:both;}
.notice{color: #999; font-size: 12px;padding:6px 0px 0px 0px;line-height: 16px;float: left;}
/* form common */
input{width: 100%; height: 30px;padding-left: 15px; line-height: 13px; border:none;-webkit-appearance:none;border-radius:0 3px 3px 0;font-weight: 500;font-size: 13px;vertical-align: middle;}
::-webkit-input-placeholder{ color: #999;font-weight: normal;}:-moz-placeholder {color: #999;font-weight: normal;}::-moz-placeholder { color: #999;font-weight: normal;}:-ms-input-placeholder { color: #999;font-weight: normal;}
::-ms-clear {display: none;}
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
-webkit-appearance: none;
margin: 0;
}
input.security{-webkit-text-security:disc;}
/*check*/
.checks {line-height: 15px;padding:5px 0;float: right;font-weight: 500;-webkit-appearance:none;-webkit-tap-highlight-color:transparent;}
.checks input[type="checkbox"] { /* 실제 체크박스는 화면에서 숨김 */ position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip:rect(0,0,0,0); border: 0 }
.checks input[type="checkbox"] + label { display: inline-block; position: relative; padding-left: 32px; /* 글자와 체크박스 사이의 간격을 변경 */ cursor: pointer; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; }
.checks input[type="checkbox"] + label:before { /* 가짜 체크박스 */ content: ''; position: absolute; left: 0; top: -5px; /* 이 값을 변경해서 글자와의 정렬 */ width: 24px; height: 24px;line-height: 24px; text-align: center; background: #fff; border: 1px solid #ccc; border-radius : 3px;}
.checks:hover input[type="checkbox"] + label:before { /* 가짜 체크박스 */ border: 1px solid #6e91d2;}
.checks input[type="checkbox"] + label:active:before, .checks input[type="checkbox"]:checked + label:active:before { box-shadow: 0 1px 2px rgba(0,0,0,0.05), inset 0px 1px 3px rgba(0,0,0,0.1); }
.checks input[type="checkbox"]:checked + label:before { /* 체크박스를 체크했을때 */ content: '';background: #1e5dd2; border-color: #1e5dd2; background-image: url('../images/check.png'); background-repeat: no-repeat; background-size: 14px 14px; -webkit-background-size: 14px 14px; background-position: center center;}
/* select */
select::-ms-expand {display: none;}
.select_type1{position:relative;height: 30px;}
.select_type1 select{z-index: 2;position: absolute; top: 0; background-color: rgba(255, 255, 255, 0);font-weight: 500;width:100%;height: 30px;padding: 0px 0 0px 10px;border:none;border-radius:0 3px 3px 0;font-size:13px;color:#222;font-family: 'Noto Sans Korean', sans-serif;-webkit-appearance:none;appearance: none;vertical-align: middle;}
.select_type1:after{z-index: 1; content:"";display:block;position:absolute;right:10px;top:11px;width:14px;height:8px;background: url(../images/arrow_b_gray.png) no-repeat 0 0px;background-size:14px 8px;}
/*btn*/
a.btn{font-size: 16px;height: 40px; line-height: 38px; text-align: center; display: inline-block;border:none; border-radius: 3px;font-weight: 500; -webkit-tap-highlight-color:transparent;color: #fff; width: 100%;vertical-align: middle;}
a.btn_s{font-size: 14px;height: 32px; line-height: 30px; text-align: center; display: inline-block;border:none; border-radius: 3px;font-weight: 500; -webkit-tap-highlight-color:transparent;color: #fff; width: 18%;vertical-align: middle;margin-left: 2%;}
.btn_blue{background-color: #1e5dd2;}
.btn_gray{background-color: #9e9fa1;}
.btn_blue:hover{background-color: #0d47b4;}
.btn_gray:hover{background-color: #7e7f81;}
.btn_blue:active{background-color: #0d47b4;}
.btn_gray:active{background-color: #7e7f81;}
.btn_blue:focus{background-color: #0d47b4;}
.btn_gray:focus{background-color: #7e7f81;}
.btn_black{background-color: #222;}
.btn_black:hover{background-color: #111;}
.btn_black:active{background-color: #111;}
.btn_black:focus{background-color: #111;}
.btn_wrap{padding: 0 30px 30px 30px;width: 100%; position: absolute; bottom: 0; right: 0;}
.btn_wrap:after{content:"";display:block;clear:both;}
.btn_wrap div{margin: 0 auto;width: 50%;}
.btn_wrap_multi{padding: 0 30px 30px 30px;width: 100%; position: absolute; bottom: 0; right: 0;}
.btn_wrap_multi:after{content:"";display:block;clear:both;}
.btn_wrap_multi div{margin: 0 auto;}
.btn_wrap_multi a:first-child{margin-right:3%;}
.btn_wrap_multi a{float:left;display: inline-block;width:48.5%;}
/*layer_popup*/
.terms1, .terms2, .terms3, .terms4{display: none;}
.pop_dim{width: 100%; height: 100%; background-color:#333; opacity: 0; position: fixed; z-index: 100; top: 0; left: 0;}
a.pop_btn_close{ width: 20px; height: 20px; padding: 15px;position: fixed; right: 0; top: 0; z-index: 1000; background: url('../images/btn_layer_close.png') no-repeat 15px 15px; background-size: 20px 20px;}
a.btn_close.pop_close{width: 50px; height: 50px; position: absolute;top: 0; right: 0;background:url('../images/i_x.png') no-repeat center center;}
a.btn_close.pop_close:hover{background:url('../images/i_x_on.png') no-repeat center center;}
a.btn_close.pop_close:active{background:url('../images/i_x_on.png') no-repeat center center;}
a.btn_close.pop_close:focus{background:url('../images/i_x_on.png') no-repeat center center;}
.popup{width: 400px; height: 490px;position:absolute; z-index: 1000; top:50%; left:50%;margin:0; background-color: #fff; border-radius: 3px; overflow: hidden;}
.popup:after{content:"";display:block;clear:both;}
.popup h3.popup_title{font-size: 14px; color: #222; font-weight: 500; line-height: 14px; width: 100%;padding:18px 0 18px 30px;z-index: 1000; background-color:#fff; border-bottom: 1px solid #0d47b4;}
.popup .popup_cont{width: 100%;}
.popup .popup_cont .popup_scroll{width: 100%; height: 439px; overflow: auto;}
.popup.conditions_text .popup_cont .popup_scroll_in{padding: 30px 30px 80px 30px;max-width:640px;margin:0 auto; }
.popup.conditions_text p{font-size: 12px; color: #666; font-weight: normal; line-height: 18px;z-index: 1000; margin-bottom: 20px;}
.popup_btn_wrap{position: absolute; bottom: 0;width: 100%;padding:15px 0; background-color: #fff;padding: 20px 20px;height: 80px; background:url('../images/btn_area.png') repeat-x 0 0; background-size: 10px 80px; }
.popup_btn_wrap .btn{font-size: 14px; line-height: 40px;height: 40px;margin: 0 auto;}
.card_frame{ display: none; }
/*카드사 팝업*/
.popup.card_pay{width: auto; height:auto;position:absolute; z-index: 1000; top:50%; left:50%;background-color: #fff; border-radius: 3px; overflow: hidden;padding: 24px 0 0 0;}
.popup.card_pay a.btn_close.pop_close{width: 24px; height: 24px; position: absolute;top: 0; right: 0;background:url('../images/i_x.png') no-repeat center center;}
.popup.card_pay a.btn_close.pop_close:hover{background:url('../images/i_x_on.png') no-repeat center center;}
.popup.card_pay a.btn_close.pop_close:active{background:url('../images/i_x_on.png') no-repeat center center;}
.popup.card_pay a.btn_close.pop_close:focus{background:url('../images/i_x_on.png') no-repeat center center;}
.popup.card_pay iframe{border-top: 1px solid #eee;width: 200px;height: 200px;}
/*gnb*/
.gnb{width: 100%; height: 50px;background-color:#fff;}
.gnb:after{content:"";display:block;clear:both;}
.gnb .logo{padding-top:13px; padding-left: 30px;float: left;}
.gnb .logo img{height: 26px; width: auto;}
.gnb .kind{line-height:50px; font-size: 14px; font-weight: normal; color:#1e5dd2; padding-right: 30px; text-align: center;float: right;}
/*contents*/
h2{font-size: 14px; line-height: 26px; color:#444; font-weight: 500;padding-bottom: 6px;float: left;}
.footer{font-size: 11px; color: #fff; position: absolute; bottom: 30px; left: 30px; opacity: 0.5; letter-spacing:0.1em;}
/*결제요청셈플*/
/**
article h2{display: block;width: 100%;font-size: 16px;}
form{}
form table{padding:20px 0 0 0px;width: 100%;}
form td{padding:0 0px 5px 0;text-align: left;}
form td.title{width: 150px;}
form input{border: 1px solid #aaa;border-radius: 0;padding-left: 10px;width: 100%;}
form .btn_submit{width: 100%; border-radius: 4px; padding: 0; margin: 20px 0;height: 40px;background-color: #1e5dd2;border: none;color: #fff;font-weight: bold;}
**/
/*주문정보*/
.order_info{width:220px; background: #1e5dd2; color: #fff;height: 600px;float: left;}
.order_info .step{width:220px;font-size: 12px; font-weight: normal;border-bottom: 1px solid;border-color: rgba(255,255,255,0.15);background-image: url('../images/arrow_r_white.png'), url('../images/arrow_r_white.png');background-repeat: no-repeat; background-size: auto 40px;background-position: 33.3% 0, 66.6% 0;}
.order_info .step:after{content:"";display:block;clear:both;}
.order_info .step li{float: left; width: 33.3%;text-align: center;line-height: 40px;opacity: 0.3;}
.order_info .step li.on{opacity: 1;}
.order_info .product_info{padding: 38px 30px 0 30px;}
.order_info .product_info:after{content:"";display:block;clear:both;}
.order_info .product_info li{display: table;width: 100%;}
.order_info .product_info li.company_name{font-size: 12px; font-weight: 500;color: #fff;line-height:16px;}
.order_info .product_info li.product_name{font-size: 12px; font-weight: 500;color: #fff;line-height:16px;word-break: keep-all;margin-top: 12px;}
.order_info .product_info li.price{font-size: 18px; line-height: 18px; color:#ffa800; font-weight: bold;margin-top: 12px;}
.order_info .product_info li.price span{font-size: 13px; line-height: 20px;color:#ffa800;font-weight: 500;}
.order_info .product_info li.term{font-size: 12px; font-weight: normal;color: #fff;line-height:18px;padding-top: 12px;}
.order_info .product_info li div{display: table-cell;}
.order_info .product_info div.info_title{font-size: 12px; font-weight: 200;color: #fff;opacity: 0.5;width: 54px!important;text-align: left;}
/*약과동의*/
.terms{float: left; width: 100%;}
.terms > ul{float: left;width: 100%;padding:18px 24px;background: #fff; border-radius:3px; }
.terms > ul li{float: left; width: 100%;padding-bottom: 8px;}
.terms > ul li:last-child{padding-bottom: 0;}
.terms > ul li > span{float: left;line-height: 15px;font-size: 13px; color: #666;padding:5px 0; }
.terms > ul li > a{opacity: 0.7; line-height: 13px;padding:6px 0;margin-right: 10px; color: #1e5dd2; padding-right:10px; float:right; background: url(../images/arrow_r_blue.png) no-repeat right 8px; background-size: 6px 10px;-webkit-tap-highlight-color:transparent;}
.terms > ul li > a:hover{opacity: 1;}
/*결제 정보 입력*/
.payment_input{float: left; width: 100%;margin-top: 24px}
.payment_input > div{float: left;width: 100%;}
.payment_input .input_section{width:100%;display: table;margin-bottom: 6px; border:1px solid #ddd; border-radius: 3px;background: #fff;}
.payment_input .input_section:last-child{margin-bottom: 0;}
.payment_input .input_title{display: table-cell;width: 96px; height: 30px; line-height: 13px; padding: 8px 0 8px 12px; font-size: 13px; border-right: 1px solid #eee;color:#666; }
.payment_input .input_section .card_num{color: #999;padding-left: 10px;}
.payment_input .input_section .card_num input{width: 40px;padding: 0px;text-align: center;}
.payment_input .input_section .card_num input.security{width: 54px;}
.payment_input .select_type1{display: table-cell;}
.payment_input .input_type1{display: table-cell;position: relative;}
.payment_input .input_type1 input:-ms-input-placeholder { color: #999; }
.payment_input .input_type1 input::-webkit-input-placeholder { color: #999; }
.payment_input .input_type1 input::-moz-placeholder { color: #999; }
.payment_input .input_type1 input.e_mail {}
.payment_input .input_section .input_type_split{color: #999;}
.payment_input .input_section .input_type_split{padding-left: 10px;}
.payment_input .input_section .input_type_split input{width: 42px;padding: 0 5px;text-align: center;}
.payment_input .s3{display: none;}
.payment_input .s4{display: none;}
/*install_notice*/
.install_notice{display: none;}
.install_notice .popup_cont{position: absolute;width: 100%; z-index: 1000; top: 0; left: 0;text-align: center; padding-top: 220px;}
.install_notice .dim_blue{display: block;width: 100%; height: 100%; background-color:#1e5dd2; opacity: 0.96; position: absolute; z-index: 100; top: 0; left: 0;}
.install_notice p{font-size: 16px; color: #fff; font-weight: normal; line-height: 24px; text-align: center; padding-top: 26px;word-break: keep-all; word-wrap:normal; }
.install_mpi_notice{display: none;}
.install_mpi_notice .popup_cont{position: absolute;width: 100%; z-index: 1000; top: 0; left: 0;text-align: center; padding-top: 220px;}
.install_mpi_notice .dim_blue{display: block;width: 100%; height: 100%; background-color:#1e5dd2; opacity: 0.96; position: absolute; z-index: 100; top: 0; left: 0;}
.install_mpi_notice p{font-size: 16px; color: #fff; font-weight: normal; line-height: 24px; text-align: center; padding-top: 26px;word-break: keep-all; word-wrap:normal; }
/*모바일ISP*/
.ips_notice{float: left; width: 100%;margin: 20px 0 15px 0;color:#666;font-size:14px;line-height: 22px; text-align: center;}
.ips_notice b{color:#1e5dd2; }
.ips_notice .title{font-size: 16px; font-weight: 500; color: #222;margin-bottom: 10px;}
.ips_notice .btn_wrap{text-align: center;padding: 15px 0 0 0;position: static;}
.ips_notice .btn_black.btn{border-radius: 18px; width: 180px;font-size: 14px; height: 36px;line-height: 34px;}
/*결제확인*/
.payment_info{float: left; width: 100%;}
.payment_info ul{float: left;width: 100%;padding:20px 30px;background: #fff; border-radius:3px;}
.payment_info ul li{display:table;margin-bottom:6px;width: 100%;}
.payment_info ul li:last-child{margin-bottom:0px;}
.payment_info ul div{display:table-cell;font-size: 13px; line-height: 20px; color:#222; font-weight: 500;}
.payment_info ul div.info_title{font-size: 13px; line-height: 20px; color:#999; font-weight: normal;width: 70px;}
.confirm_notice{float: left; width: 100%;margin: 60px 0 0 0;color:#666;font-size:14px;line-height: 22px; text-align: center;}
.confirm_notice.small{float: left; width: 100%;margin: 20px 0 0 0;color:#666;font-size:14px;line-height: 22px; text-align: center;}
.confirm_notice.small p{word-break: keep-all;}
.confirm_notice b{color:#1e5dd2; }
/*결제완료*/
.success_notice{float: left; width: 100%;text-align: center;}
.success_notice > div{width: 170px; height: 50px; background: #fff; border-radius: 25px;margin: 0 auto; text-align: center;}
.success_notice > div > div{display: inline-block;margin-top: 13px;}
.success_notice > div > div:after{content:"";display:block;clear:both;}
.success_notice img{float: left; width: 20px; height: auto;}
.success_notice p{ font-size: 16px; float: left;color: #222; font-weight: 500;line-height: 20px; padding-left: 12px;}
.complete_info{float: left; width: 100%;margin: 20px 0 0 0;}
.complete_info ul{float: left;width: 100%;padding:20px 30px;background: #fff; border-radius:0 0 3px 3px;}
.complete_info ul.top_info{float: left;width: 100%;padding:20px 30px;background: #fff; border-radius:3px 3px 0 0;border-bottom: 1px solid #eee;word-break: keep-all;}
.complete_info ul li{display:table;margin-bottom:6px;width: 100%;}
.complete_info ul li:last-child{margin-bottom:0px;}
.complete_info ul li div.price{font-size: 20px; line-height: 20px; color:#1e5dd2; font-weight: bold;}
.complete_info ul li div.price > span {font-size: 13px; line-height: 20px;color:#1e5dd2;font-weight: 500;}
.complete_info ul div{display:table-cell;font-size: 13px; line-height: 20px; color:#666; font-weight: normal;}
.complete_info ul div.blue{color:#1e5dd2;}
.complete_info ul div.red{color: #ee6a71;}
.complete_info ul.top_info div{color:#222; font-weight: 500;}
.complete_info ul div.info_title{font-size: 13px; line-height: 20px; color:#999; font-weight: normal;width: 70px;}
/*영수증*/
.receipt_wrap .receipt{padding: 30px 30px 0 30px;background: #f1f2f3;font-size: 12px; line-height: 18px;}
.receipt .info{width:100%; padding: 30px 24px 34px 24px; margin:0 auto;
background: url('../images/receipt_bg_top.png'), url('../images/receipt_bg_bottom.png'), url('../images/receipt_bg_middle.png');
background-repeat: no-repeat, no-repeat, repeat-y;
background-position: 0 0, bottom left, 0 0;
background-size: 440px auto;
position: relative;
height: 600px;
}
.receipt .info h3{color: #6e91d2;font-weight: 500;padding-bottom: 10px;}
.receipt .info ul{padding-bottom: 14px; border-bottom: 1px solid #eee; margin-bottom:14px;position: relative;}
.receipt .info ul:after{content:"";display:block;clear:both;}
.receipt .info ul:last-child{padding-bottom:0; border-bottom:none; margin-bottom:0px;}
.receipt .info ul li{display:table;margin:0 10px 4px 0;width: 175px;float: left;}
.receipt .info ul li:last-child{margin-bottom:0px;}
.receipt .info ul li div{display:table-cell;font-weight: 500;color: #222;}
.receipt .info ul.top{padding-bottom: 0; border-bottom: none;}
.receipt .info ul.top:after{content:"";display:block;clear:both;}
.receipt .info ul.top li{width: 100%;}
.receipt .info ul.top .price_wrap{width: 100%; padding: 16px 30px;float: left;margin-top: 12px;background: #f4f4f4;border: 2px solid #f4f4f4;}
.receipt .info ul.top .price_wrap:after{content:"";display:block;clear:both;}
.receipt .info ul.top div.time{font-size: 12px; margin-bottom: 0;}
.receipt .info ul.top div.time.blue{color: #6e91d2;}
.receipt .info ul.top div.time.red{color: #ee6a71;}
.receipt .info ul.top div.p_name{font-size: 16px; font-weight: 500;margin-bottom: 10px;color: #222;}
.receipt .info ul.top div.price_detail{font-size: 16px; line-height: 20px; color:#222; font-weight: 500;text-align: right;}
.receipt .info ul.top div.price_detail span{font-size: 12px; line-height: 20px; color:#222; font-weight: 500;}
.receipt .info ul.top li.price_sum div.price{font-size: 24px; line-height: 20px; color:#0d47b4; font-weight: bold;text-align: right;}
.receipt .info ul.top li.price_sum div.price > span {margin-left: 2px; font-size: 14px; line-height: 20px;color:#0d47b4;font-weight: 500;}
.receipt .info ul.bottom li div{font-weight: normal;color: #666;}
.receipt .info ul li div.info_title{color:#aaa; font-weight: normal;width: 66px;vertical-align: top;font-size: 12px;}
.receipt .info .price_wrap div.info_title{vertical-align: bottom;color: #666;}
.receipt_wrap .notice{color: #999; font-size: 12px;padding:6px 30px 20px 30px;line-height: 16px;}
.receipt_wrap .btn_wrap_multi{position: static;}
.receipt_wrap .payment_input{margin-top: 0;padding: 0 30px;}
.receipt_wrap .payment_input:after{content:"";display:block;clear:both;}
.receipt_wrap .payment_input > div{margin-bottom: 20px; padding: 0px; background: none;}
.receipt_wrap .payment_input .input_section{width: 80%;float: left;margin: 0;}
.receipt_wrap .payment_input .input_section .input_title{width: 70px;}
.stamp{position: absolute;top: 30px; right: 0px;width: 100px; height: auto;opacity: 0.8;}
/*프린트*/
.print_bg{display: none;}
@media print {
.receipt_wrap, .receipt_con { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.btn_wrap_multi{display: none;}
.gnb{border:1px solid #ddd;}
.print_bg{position: absolute; top: 0; left: 0; z-index: 100;display: block;}
.receipt_wrap{position: absolute; top: 0; left: 0; z-index: 1000;}
.receipt_wrap .payment_input{display: none;}
}
.receipt .info.h500{height: 500px;}
/*error*/
.btn_wrap_fl{padding: 50px 30% 0;width: 100%;}
.error_notice .popup_cont{position: absolute;width: 100%; z-index: 1000; top: 50%; left: 50%;text-align: center;}
.error_notice img{text-align: center;}
.error_notice p{font-size: 16px; color: #222; font-weight: 500; line-height: 24px; text-align: center; padding-top: 26px;word-break: keep-all; word-wrap:normal; }
/**************************************************************************************************************/
/*모바일* */
@media screen
and (max-device-width : 736px){
.select_type1{position:relative;height: 40px;}
.select_type1 select{height: 40px;}
.select_type1:after{right:10px;top:16px;width:14px;height:8px;background-size:14px 8px;}
input{height: 20px;line-height: 20px;top: 10px;}
/* layout */
.innopay{width: 100%; height: 100%;background: #f1f2f3;}
.innopay_wrap{width:100%;position: static;margin:0;height: auto;}
.con_wrap{padding:24px 15px 0 15px; width: 100%; height: auto;}
.con_wrap:after{content:"";display:block;clear:both;}
.float_wrap{width: 100%; height: 100%; position: fixed; top: 0; left: 0;z-index: 1000;}
/*btn*/
.btn_wrap_multi{position: static;float: left;padding: 30px 0;height: auto;}
.btn_wrap_multi div:after{content:"";display:block;clear:both;}
/*layer_popup*/
.pop_dim{width: 100%; height: 100%;position: fixed;opacity: 0;}
.popup{width: 90%;top: 50px;left: 5%; height: auto;position: absolute;margin: 0;}
/*gnb*/
.gnb{position: fixed;top: 0;border-bottom: 0.16mm solid rgba(30,93,210,0.5);z-index: 100;}
.gnb .logo{padding-left: 15px;float: left;}
.gnb .kind{padding-right: 15px;}
/*contents*/
.footer{position: static;width: 100%;float: left;padding-bottom: 12px;color: #999;text-align: center;opacity: 1;line-height: 11px;}
/*주문정보*/
.order_info{width:100%;height: auto;}
.order_info .step{width:100%;margin-top: 50px;}
.order_info .product_info{padding: 30px 40px 30px 40px;}
.order_info .product_info li.product_name{font-size: 14px;line-height:18px;}
.order_info .product_info div.info_title{font-weight: 300;width: 70px!important;}
/*약과동의*/
/*결제 정보 입력*/
.payment_input .input_title{display: table-cell;width: 86px; height: 14px; line-height: 13px; padding: 13px 0 13px 12px; font-size: 13px; border-right: 1px solid #eee;color:#666;box-sizing:content-box;}
/*install_notice*/
.install_notice .popup_cont{width: 330px; top: 50%; left: 50%; margin-left: -165px; padding-top: 0; margin-top: -100px;}
/*결제확인*/
.confirm_notice{margin: 50px 0 25px;}
/*결제완료*/
.btn_wrap{padding: 30px 0px 30px 0px;width: 100%; position: static; bottom: 0; right: 0;float: left;}
.btn_wrap div{width: 100%;}
/*영수증*/
.receipt_wrap{margin:0 auto;width: 100%;}
.receipt_wrap .receipt_con{width: 500px;margin: 0 auto;}
.receipt_wrap .gnb{position: relative;border-bottom:none;width: 100%;}
.receipt_wrap .gnb .logo{ padding-left: 30px;}
.receipt_wrap .gnb .kind{ padding-right: 30px;}
.receipt_wrap .btn_wrap_multi{position: relative;padding:0 30px 30px 30px;width: 100%;}
.receipt_wrap .payment_input > div{padding: 0px; background: none;}
.receipt_wrap a.btn_s{height: 42px; line-height: 40px; }
form{width: 100%;}
}/*(max-width : 736px)*/
@media screen
and (max-device-width : 499px){
/*영수증*/
.receipt_wrap{width: 100%;}
.receipt_wrap .receipt_con{width: 100%;margin: 0 auto;}
.receipt_wrap .gnb{position: fixed;top: 0;border-bottom: 0.16mm solid rgba(30,93,210,0.5);z-index: 100;}
.receipt_wrap .gnb .logo{padding-left: 15px;float: left;}
.receipt_wrap .gnb .kind{padding-right: 15px;}
.receipt{margin-top: 50px;padding: 30px 0 0 0;}
.receipt .info{width:280px; padding: 30px 20px 40px 20px; margin:0 auto;
background: url('../images/receipt_bg_top_m.png'), url('../images/receipt_bg_bottom_m.png'), url('../images/receipt_bg_middle_m.png');
background-repeat: no-repeat, no-repeat, repeat-y;
background-position: 0 0, bottom left, 0 0;
background-size: 280px auto;
position: relative;
height: auto;
}
.receipt .info.h500{height: auto;}
.receipt .info ul li{display:table;margin:0 0 5px 0;width: 100%;float: left;}
.receipt .info ul.top .price_wrap{padding: 20px 16px;}
.receipt_wrap .btn_wrap_multi{position: relative;padding:0 30px 30px 30px;width: 100%;}
.receipt_wrap .notice{margin: 0 auto;float: none;width: 280px;padding: 6px 0 30px 0;}
}/*(max-width : 499px)*/
@media screen
and (max-device-width : 400px){
/*약과동의*/
.terms > ul{float: left;width: 100%;padding:18px 20px;background: #fff; border-radius:3px; }
.terms > ul li{height: 50px;position: relative; border-bottom: 1px solid #eee;margin-bottom: 10px;padding-bottom: 12px;}
.terms > ul li:after{content:"";display:block;clear:both;}
.terms > ul li:last-child{padding-bottom: 0;margin-bottom: 0;border-bottom: none;}
.terms > ul li > span{line-height: 15px;font-size: 13px; color: #666;padding:5px 0 20px 0; }
.terms > ul li > a{position: absolute; left: 0; top: 18px;}
.terms > ul li .checks {margin-top: 8px;}
}/*(max-width : 390px)*/
@media screen
and (max-device-width : 360px){
.terms > ul{padding:18px 16px;}
.order_info .product_info{padding: 30px 34px 30px 34px;}
.select_type1 select{padding:2px;}
input{padding-left: 4px;}
.payment_input .input_section .card_num{padding-left: 4px;}
.payment_input .input_section .card_num input{width: 36px;padding: 0;text-align: center;}
.payment_input .input_section .card_num input.security{width: 36px;}
.payment_input .input_section .input_type_split{padding-left: 2px;}
.payment_input .input_section .input_type1{padding-left: 2px;}
.install_notice .popup_cont{width: 260px; margin-left: -130px; margin-top: -120px;}
.payment_info ul{padding:20px;}
.complete_info ul.top_info{padding:20px;}
.complete_info ul{padding:20px;}
}/*(max-width : 350px)*/
@media screen
and (max-device-width : 320px){
.terms > ul{padding:18px 14px;}
.receipt_wrap .receipt{padding: 30px 20px 0 20px;}
.receipt_wrap .payment_input{padding: 0 20px;}
.receipt_wrap .btn_wrap_multi{padding:0 20px 30px 20px;}
}/*(max-width : 320px)*/
.excel {position:relative;float:right;top:0}

76
adm/fg_admin/css/font.css Normal file
View File

@ -0,0 +1,76 @@
@font-face {
font-family: 'Noto Sans Korean';
font-style: normal;
font-weight: 100;
src: local('Noto Sans Thin'), local('NotoSans-Thin'),
url(../../fonts/eot/NotoSansKR-Thin-Hestia.eot),
url(../fonts/eot/NotoSansKR-Thin-Hestia.eot?#iefix) format('embedded-opentype'),
url(../fonts/woff/NotoSansKR-Thin-Hestia.woff) format('woff'),
url(../fonts/otf/NotoSansKR-Thin-Hestia.otf) format('opentype');
}
@font-face {
font-family: 'Noto Sans Korean';
font-style: normal;
font-weight: 300;
src: local('Noto Sans Light'), local('NotoSans-Light'),
url(../fonts/eot/NotoSansKR-Light-Hestia.eot),
url(../fonts/eot/NotoSansKR-Light-Hestia.eot?#iefix) format('embedded-opentype'),
url(../fonts/woff/NotoSansKR-Light-Hestia.woff) format('woff'),
url(../fonts/otf/NotoSansKR-Light-Hestia.otf) format('opentype');
}
@font-face {
font-family: 'Noto Sans Korean';
font-style: normal;
font-weight: 350;
src: local('Noto Sans DemiLight'), local('NotoSans-DemiLight'),
url(../fonts/eot/NotoSansKR-DemiLight-Hestia.eot),
url(../fonts/eot/NotoSansKR-DemiLight-Hestia.eot?#iefix) format('embedded-opentype'),
url(../fonts/woff/NotoSansKR-DemiLight-Hestia.woff) format('woff'),
url(../fonts/otf/NotoSansKR-DemiLight-Hestia.otf) format('opentype');
}
@font-face {
font-family: 'Noto Sans Korean';
font-style: normal;
font-weight: 400;
src: local('Noto Sans Regular'), local('NotoSans-Regular'),
url(../fonts/eot/NotoSansKR-Regular-Hestia.eot),
url(../fonts/eot/NotoSansKR-Regular-Hestia.eot?#iefix) format('embedded-opentype'),
url(../fonts/woff/NotoSansKR-Regular-Hestia.woff) format('woff'),
url(../fonts/otf/NotoSansKR-Regular-Hestia.otf) format('opentype');
}
@font-face {
font-family: 'Noto Sans Korean';
font-style: normal;
font-weight: 500;
src: local('Noto Sans Medium'), local('NotoSans-Medium'),
url(../fonts/eot/NotoSansKR-Medium-Hestia.eot),
url(../fonts/eot/NotoSansKR-Medium-Hestia.eot?#iefix) format('embedded-opentype'),
url(../fonts/woff/NotoSansKR-Medium-Hestia.woff) format('woff'),
url(../fonts/otf/NotoSansKR-Medium-Hestia.otf) format('opentype');
}
@font-face {
font-family: 'Noto Sans Korean';
font-style: normal;
font-weight: 700;
src: local('Noto Sans Bold'), local('NotoSans-Bold'),
url(../fonts/eot/NotoSansKR-Bold-Hestia.eot),
url(../fonts/eot/NotoSansKR-Bold-Hestia.eot?#iefix) format('embedded-opentype'),
url(../fonts/woff/NotoSansKR-Bold-Hestia.woff) format('woff'),
url(../fonts/otf/NotoSansKR-Bold-Hestia.otf) format('opentype');
}
@font-face {
font-family: 'Noto Sans Korean';
font-style: normal;
font-weight: 900;
src: local('Noto Sans Black'), local('NotoSans-Black'),
url(../fonts/eot/NotoSansKR-Black-Hestia.eot),
url(../fonts/eot/NotoSansKR-Black-Hestia.eot?#iefix) format('embedded-opentype'),
url(../fonts/woff/NotoSansKR-Black-Hestia.woff) format('woff'),
url(../fonts/otf/NotoSansKR-Black-Hestia.otf) format('opentype');
}

File diff suppressed because it is too large Load Diff

115
adm/fg_admin/css/list.css Normal file
View File

@ -0,0 +1,115 @@
@import url(//fonts.googleapis.com/earlyaccess/notosanskr.css);
/*
* Base structure
*/
/* Move down content because we have a fixed navbar that is 50px tall */
body {
padding-top: 50px;
font-family: "Noto Sans KR", sans-serif;
}
/*
* Global add-ons
*/
.sub-header {
padding-bottom: 10px;
border-bottom: 1px solid #eee;
}
/*
* Top navigation
* Hide default border to remove 1px line.
*/
.navbar-fixed-top {
border: 0;
}
/*
* Sidebar
*/
/* Hide for mobile, show later */
.sidebar {
display: none;
}
@media (min-width: 768px) {
.sidebar {
position: fixed;
top: 51px;
bottom: 0;
left: 0;
z-index: 1000;
display: block;
padding: 20px;
overflow-x: hidden;
overflow-y: auto; /* Scrollable contents if viewport is shorter than content. */
background-color: #f5f5f5;
border-right: 1px solid #eee;
}
}
/* Sidebar navigation */
.nav-sidebar {
margin-right: -21px; /* 20px padding + 1px border */
margin-bottom: 20px;
margin-left: -20px;
}
.nav-sidebar > li > a {
padding-right: 20px;
padding-left: 20px;
}
.nav-sidebar > .active > a,
.nav-sidebar > .active > a:hover,
.nav-sidebar > .active > a:focus {
color: #fff;
background-color: #428bca;
}
/*
* Main content
*/
.main {
padding: 20px;
}
@media (min-width: 768px) {
.main {
padding-right: 40px;
padding-left: 40px;
}
}
.main .page-header {
margin-top: 0;
}
/*
* Placeholder dashboard ideas
*/
.placeholders {
margin-bottom: 30px;
text-align: center;
}
.placeholders h4 {
margin-bottom: 0;
}
.placeholder {
margin-bottom: 20px;
}
.placeholder img {
display: inline-block;
border-radius: 50%;
}
.msg_column {
width: 500px;
}
.msg_column img {
width: 450px;
}

View File

@ -0,0 +1,40 @@
body {
padding-top: 40px;
padding-bottom: 40px;
background-color: #eee;
}
.form-signin {
max-width: 330px;
padding: 15px;
margin: 0 auto;
}
.form-signin .form-signin-heading,
.form-signin .checkbox {
margin-bottom: 10px;
}
.form-signin .checkbox {
font-weight: normal;
}
.form-signin .form-control {
position: relative;
height: auto;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
padding: 10px;
font-size: 16px;
}
.form-signin .form-control:focus {
z-index: 2;
}
.form-signin input[type="email"] {
margin-bottom: -1px;
border-bottom-right-radius: 0;
border-bottom-left-radius: 0;
}
.form-signin input[type="password"] {
margin-bottom: 10px;
border-top-left-radius: 0;
border-top-right-radius: 0;
}

17
adm/fg_admin/css/vip.css Normal file
View File

@ -0,0 +1,17 @@
/* 전역 */
body {padding-top: 5em; font-size: 0.9em;}
/* 사이드바 폭 */
.offcanvas.show,.offcanvas.showing,.offcanvas.hiding {width: 250px; }
/* 로그인 */
.container-login button {margin-top: 20px; width: 100%;}
.container-login h2 {text-align: center;}
/* viplist 전체숫자 */
.viplist_head {}
.mod-label {width:200px;}
.unused td {color:gray !important}
/* 중복체크 */
.checkdup {height: 25px; text-align: right;}

View File

@ -0,0 +1,172 @@
/* login */
/*body {
padding-top: 40px;
padding-bottom: 40px;
background-color: #eee;
}
*/
.center {
text-align: center;
}
.form-signin {
max-width: 500px;
padding: 15px;
margin: 0 auto;
display: flex;
flex-direction: column;
}
.form-signin .form-signin-heading,
.form-signin .checkbox {
margin-bottom: 10px;
}
.form-signin .checkbox {
font-weight: normal;
}
.form-signin .form-control {
position: relative;
height: auto;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
padding: 10px;
font-size: 16px;
}
.form-signin .form-control:focus {
z-index: 2;
}
.form-signin input[type="email"] {
margin-bottom: -1px;
border-bottom-right-radius: 0;
border-bottom-left-radius: 0;
}
.form-signin input[type="password"] {
margin-bottom: 10px;
border-top-left-radius: 0;
border-top-right-radius: 0;
}
/* list */
@import url(//fonts.googleapis.com/earlyaccess/notosanskr.css);
/*
* Base structure
*/
/* Move down content because we have a fixed navbar that is 50px tall */
/*body {
padding-top: 50px;
font-family: "Noto Sans KR", sans-serif;
}
*/
/*
* Global add-ons
*/
.sub-header {
padding-bottom: 10px;
border-bottom: 1px solid #eee;
}
/*
* Top navigation
* Hide default border to remove 1px line.
*/
.navbar-fixed-top {
border: 0;
}
/*
* Sidebar
*/
/* Hide for mobile, show later */
.sidebar {
display: none;
}
@media (min-width: 768px) {
.sidebar {
position: fixed;
top: 51px;
bottom: 0;
left: 0;
z-index: 1000;
display: block;
padding: 20px;
overflow-x: hidden;
overflow-y: auto; /* Scrollable contents if viewport is shorter than content. */
background-color: #f5f5f5;
border-right: 1px solid #eee;
}
}
/* Sidebar navigation */
.nav-sidebar {
margin-right: -21px; /* 20px padding + 1px border */
margin-bottom: 20px;
margin-left: -20px;
}
.nav-sidebar > li > a {
padding-right: 20px;
padding-left: 20px;
}
.nav-sidebar > .active > a,
.nav-sidebar > .active > a:hover,
.nav-sidebar > .active > a:focus {
color: #fff;
background-color: #428bca;
}
/*
* Main content
*/
.main {
padding: 20px;
}
@media (min-width: 768px) {
.main {
padding-right: 40px;
padding-left: 40px;
}
}
.main .page-header {
margin-top: 0;
}
/*
* Placeholder dashboard ideas
*/
.placeholders {
margin-bottom: 30px;
text-align: center;
}
.placeholders h4 {
margin-bottom: 0;
}
.placeholder {
margin-bottom: 20px;
}
.placeholder img {
display: inline-block;
border-radius: 50%;
}
.msg_column {
width: 500px;
}
.msg_column img {
width: 450px;
}
/* list */
.gr_id{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; }
.searchform .search_tit{width:80px; }
.searchform .search_group{margin : 0 10px; display: inline-block; height:30px;}
.user_lv{display: inline-block;margin: 0 20px 0 0;}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

120
adm/fg_admin/head.php Normal file
View File

@ -0,0 +1,120 @@
<?php
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
// 관리자 계정 할당
if (isset($_SESSION['user_id']) && $_SESSION['user_id'] === 'abc') $is_admin = true;
// 현재 접속자
// 게시판 제목에 ' 포함되면 오류 발생
$g5['lo_location'] = addslashes($g5['title']);
if (!$g5['lo_location'])
$g5['lo_location'] = addslashes(clean_xss_tags($_SERVER['REQUEST_URI']));
$g5['lo_url'] = addslashes(clean_xss_tags($_SERVER['REQUEST_URI']));
if (strstr($g5['lo_url'], '/'.G5_ADMIN_DIR.'/') || $is_admin == 'super') $g5['lo_url'] = '';
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<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://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<link rel="stylesheet"href="<?=FG_MANAGER_URL?>/css/vip.css">
<script src="<?=FG_MANAGER_URL?>/js/list.js"></script>
<script src="<?=FG_MANAGER_URL?>/js/ajax.js"></script>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.17.2/xlsx.full.min.js"></script>
<!-- 폰트어썸 -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.1.0/css/all.min.css" integrity="sha512-10/jx2EXwxxWqCLX/hHth/vu2KY3jCF70dCQB8TSgNjbCVAC/8vai53GfMDrO2Emgwccf2pJqxct9ehpzG+MTw==" crossorigin="anonymous" referrerpolicy="no-referrer" />
</head>
<body>
<?php
if (isset($_SESSION['user_id'])) { // 로그인 한 경우에만 상단 nav를 출력함
$page = basename($_SERVER['PHP_SELF'], '.php'); // 로그인 했다면 현재 페이지 이름 구함
?>
<!-- 내비게이션 시작 -->
<nav class="navbar navbar-expand-lg bg-body-tertiary fixed-top d-flex p-2">
<div class="container-fluid">
<a class="navbar-brand" href="<?=FG_MANAGER_URL?>">퍼스트가든 관리페이지</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbar" aria-controls="navbar" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbar">
<ul class="navbar-nav me-auto mb-2 mb-lg-0 justify-content-end">
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">
입장처리
</a>
<ul class="dropdown-menu">
<li><a class="dropdown-item" href="<?=FG_MANAGER_URL.'/vip/vip_list_ent.php'?>">VIP</a></li>
<li><a class="dropdown-item" href="<?=FG_MANAGER_URL.'/annual_member/annual_member_list_ent.php'?>">연간회원</a></li>
</ul>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">
명단관리
</a>
<ul class="dropdown-menu">
<li><a class="dropdown-item" href="<?=FG_MANAGER_URL.'/vip/vip_list.php'?>">VIP 명단관리</a></li>
<li><a class="dropdown-item" href="<?=FG_MANAGER_URL.'/annual_member/annual_member_list.php'?>">연간회원 명단관리</a></li>
<li><hr class="dropdown-divider"></li>
<li><a class="dropdown-item" href="<?=FG_MANAGER_URL.'/vip/vip_list_category.php'?>">VIP 구분관리</a></li>
<li><a class="dropdown-item" href="<?=FG_MANAGER_URL.'/annual_member/annual_member_category.php'?>">연간회원 구분관리</a></li>
</ul>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">
베이커리
</a>
<ul class="dropdown-menu">
<li class="nav-item">
<a class="nav-link" href="<?=FG_MANAGER_URL.'/bakery/bakery_stock.php'?>">일일현황</a>
<a class="nav-link" href="<?=FG_MANAGER_URL.'/bakery/bakery_product_list.php'?>">제품목록관리</a>
</li>
</ul>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">
관리자
</a>
<ul class="dropdown-menu">
<li><a class="dropdown-item" href="<?=FG_MANAGER_URL.'/adm/adm_member.php'?>">계정관리</a></li>
<li><a class="dropdown-item" href="<?=FG_MANAGER_URL.'/adm/adm_member_group.php'?>">부서관리</a></li>
<li><a class="dropdown-item" href="<?=FG_MANAGER_URL.'/adm/ent_list.php'?>">입장목록</a></li>
<li><a class="dropdown-item" href="<?=FG_MANAGER_URL.'/adm/adm_log.php'?>">LOG</a></li>
</ul>
</li>
<?php if ($is_admin) { ?>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">
테스트
</a>
<ul class="dropdown-menu">
<li><a class="dropdown-item" href="<?=FG_MANAGER_URL.'/ticket'?>">매표소 업무일지</a></li>
<li><a class="dropdown-item" href="<?=FG_MANAGER_URL.'/ticket/adm_category.php'?>">항목관리</a></li>
</ul>
</li>
<?php } ?>
<!--
<li class="nav-item">
<a class="nav-link disabled" aria-disabled="true">Disabled</a>
</li>
-->
</ul>
<span class="navbar-text pe-3">
<b>로그인 정보</b><br> 부서 : <?php echo $_SESSION['user_team']; ?> / 성명 : <?php echo $_SESSION['user_name']; ?>
</span>
<form class="d-flex mt-3" action="<?=FG_MANAGER_URL?>/proc/logout.php">
<button class="btn btn-outline-success" type="submit">LOGOUT</button>
</form>
</div>
</div>
</nav>
<?php } ?>
<!-- 내비게이션 끝 -->
<div class="container pt-3">

View File

172
adm/fg_admin/install.php Normal file
View File

@ -0,0 +1,172 @@
<?php
include_once '_common.php'; // 그누보드 설정 파일 불러오기
include_once 'head.php';
include_once 'head.sub.php';
/*
초기 세팅을 위한 데이터베이스 생성
table name은 config.php 를 참조하여 생성한다.
table name의 접두어를 바꾸고 싶은 경우 해당 파일을 수정할 것
*/
// LOG
$query[] = "CREATE TABLE `{$fg['log_table']}` (
`idx` INT UNSIGNED NOT NULL AUTO_INCREMENT,
`work` VARCHAR(50) NOT NULL,
`work_detail` TEXT NOT NULL,
`id` VARCHAR(50) NOT NULL,
`date` DATETIME NOT NULL,
PRIMARY KEY (`idx`)
)
COMMENT='계정구분(부서)' COLLATE='utf8mb4_general_ci' DEFAULT CHARSET='utf8';
";
// 사용자 계정 구분
$query[] = "CREATE TABLE `{$fg['member_group_table']}` (
`tid` INT UNSIGNED NOT NULL AUTO_INCREMENT,
`tname` VARCHAR(50) NOT NULL,
`tauth` TINYINT(1) NOT NULL,
`tused` TINYINT(1) NOT NULL,
`memo` VARCHAR(255) NULL,
PRIMARY KEY (`tid`),
UNIQUE INDEX `tname` (`tname`)
)
COMMENT='계정구분(부서)'
COLLATE='utf8mb4_general_ci'
DEFAULT CHARSET='utf8';
";
// 사용자 계정
$query[] = "CREATE TABLE `{$fg['member_table']}` (
`idx` INT UNSIGNED NOT NULL AUTO_INCREMENT,
`user_id` VARCHAR(50) NOT NULL,
`user_pw` VARCHAR(256) NOT NULL,
`user_name` VARCHAR(10) NULL,
`tid` INT NULL,
`user_lv` TINYINT(2) NULL,
`used` TINYINT(1) NOT NULL,
`memo` VARCHAR(255) NULL,
`join_datetime` DATETIME NOT NULL,
`last_login_time` DATETIME NULL DEFAULT 0000-00-00 00:00:00,
PRIMARY KEY (`idx`),
UNIQUE INDEX `user_id` (`user_id`),
CONSTRAINT `FK_member_group` FREIGN KEY (`tid`) REFERENCES `{$fg['member_group_table']}` (`member_id`)
)
COMMENT='계정(직원)'
COLLATE='utf8mb4_general_ci'
DEFAULT CHARSET='utf8'
;
";
// VIP 구분 테이블
$query[] = "CREATE TABLE `{$fg['vip_category_table']}` (
`gr_id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
`gr_name` VARCHAR(50) NOT NULL,
`gr_lv` VARCHAR(2) NOT NULL,
`gr_used` TINYINT(2) NOT NULL,
`gr_date` DATE NOT NULL,
PRIMARY KEY (`gr_id`),
UNIQUE INDEX `gr_name` (`gr_name`)
)
COMMENT='VIP 구분'
COLLATE='utf8mb4_general_ci'
DEFAULT CHARSET='utf8'
;
";
// VIP LIST
$query[] = "CREATE TABLE `{$fg['vip_list_table']}` (
`idx` INT UNSIGNED NOT NULL AUTO_INCREMENT,
`vip_card_no` INT(6) NOT NULL,
`status` VARCHAR(10) NOT NULL,
`gr_id` TINYINT(3) NOT NULL,
`rec_team` VARCHAR(20) NOT NULL,
`app_name` VARCHAR(20) NOT NULL,
`vip_name` VARCHAR(20) NOT NULL,
`vip_memo` VARCHAR(255) NOT NULL,
`vip_birth` DATE NOT NULL,
`vip_email` VARCHAR(255) NOT NULL,
`vip_addr` VARCHAR(255) NOT NULL,
`vip_tel` VARCHAR(20) NOT NULL,
`vip_gender` VARCHAR(10) NOT NULL,
`vip_date` DATE NOT NULL,
`rec_name` VARCHAR(50) NOT NULL,
`join_datetime` DATAETIME NOT NULL,
`last_edit_date` DATETIME NOT NULL,
`last_edit_name` VARCHAR(50) NOT NULL,
`last_ent_date` DATETIME NOT NULL,
`ent_count` INT(11) NOT NULL,
PRIMARY KEY (`idx`),
UNIQUE INDEX `vip_card_no` (`vip_card_no`),
UNIQUE INDEX `vip_tel` (`vip_tel`)
)
COMMENT='VIP 회원 목록'
COLLATE='utf8mb4_general_ci'
DEFAULT CHARSET='utf8'
;
";
// VIP 입장기록
$query[] = "CREATE TABLE `{$fg['vip_ent_table']}` (
`idx` INT UNSIGNED NOT NULL AUTO_INCREMENT,
`vip_card_no` INT(6) NOT NULL,
`ent_date` DATETIME NOT NULL,
`adm` VARCHAR(50) NOT NULL,
PRIMARY KEY (`idx`)
)
COMMENT='VIP 입장기록'
COLLATE='utf8mb4_general_ci'
DEFAULT CHARSET='utf8'
;
";
// 연간회원 카테고리
$query[] = "CREATE TABLE `{$fg['annual_category_table']}` (
`ca_id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
`ca_name` VARCHAR(50) NOT NULL,
`ca_used` TINYINT(2) NOT NULL,
`ca_info` VARCHAR(255) NOT NULL,
`ca_code` INT NOT NULL
)
COMMENT='연간회원 구분'
COLLATE='utf8mb4_general_ci'
DEFAULT CHARSET='utf8'
;
";
// 연간회원 리스트
$query[] = "CREATE TABLE `{$fg['annual_member_table']}` (
`mem_no` INT UNSIGNED NOT NULL AUTO_INCREMENT,
`status` VARCHAR(10) NOT NULL,
`ca_id` TINYINT(3) NOT NULL,
`app_id` VARCHAR(20) NOT NULL,
`name` VARCHAR(20) NOT NULL,
`memo` VARCHAR(255) NOT NULL,
`birth` DATE NOT NULL,
`email` VARCHAR(255) NOT NULL,
`addr` VARCHAR(255) NOT NULL,
`tel` VARCHAR(20) NOT NULL,
`gender` VARCHAR(10) NOT NULL,
`sdate` DATE NOT NULL,
`edate` DATE NOT NULL,
`photo_url` VARCHAR(255) NOT NULL,
`photo_name` VARCHAR(255) NOT NULL,
`last_edit_date` DATETIME NOT NULL,
`last_edit_id` VARCHAR(50) NOT NULL,
`last_ent_date` DATETIME NOT NULL,
`ent_count` INT(11) NOT NULL,
PRIMARY KEY (`mem_no`),
UNIQUE INDEX `mem_no` (`mem_no`)
)
COMMENT='연간회원 목록'
COLLATE='utf8mb4_general_ci'
DEFAULT CHARSET='utf8'
;
";
foreach($query as $row) {
sql_query($row);
}
goto_url(FG_MANAGER_URL);
include_once 'tail.php';

98
adm/fg_admin/js/ajax.js Normal file
View File

@ -0,0 +1,98 @@
// FG URL 선언
var fg_manager_url = "/firstgarden/manager";
// AJAX 요청을 보내서 중복 여부를 확인하는 등의 작업을 수행합니다.
function checkDupAnnuNo(value) {
$.ajax({
type: "POST",
url: fg_manager_url + "/lib/ajax.check_duplicate.php",
data: "mode=annuno&value="+value,
success: function(req){
if (req != 0) {
var msg = "<font color='red'>사용중인 회원번호입니다.</font>";
$('#add_submit').prop("disabled", true);
} else {
var msg = "사용가능한 번호입니다.";
$('#add_submit').prop("disabled", false);
}
$("#duplicate-no-warning").hide().html(msg).fadeIn(100);
}});
}
function checkDupAnnuTel(value) {
$.ajax({
type: "POST",
url: fg_manager_url + "/lib/ajax.check_duplicate.php",
data: "mode=annutel&value="+value,
success: function(req){
if (req != 0) {
var msg = "<font color='red'>동일한 연락처가 이미 있습니다.</font>";
$('#add_submit').prop("disabled", true);
} else {
var msg = "사용가능한 번호입니다.";
$('#add_submit').prop("disabled", false);
}
$("#duplicate-tel-warning").hide().html(msg).fadeIn(100);
}});
}
function checkDupTel(value,mode) {
$.ajax({
type: "POST",
url: fg_manager_url + "/lib/ajax.check_duplicate.php",
data: "mode=vip_tel&value="+value,
success: function(req){
if (req != 0) {
var msg = "<font color='red'>동일한 연락처가 이미 있습니다.</font>";
$('#add_submit').prop("disabled", true);
} else {
var msg = "사용가능한 번호입니다.";
$('#add_submit').prop("disabled", false);
}
$("#duplicate-tel-warning").hide().html(msg).fadeIn(100);
}});
}
function checkDupNo(value) {
$.ajax({
type: "POST",
url: fg_manager_url + "/lib/ajax.check_duplicate.php",
data: "mode=vip_card_no&value="+value,
success: function(req){
if (req != 0) {
var msg = "<font color='red'>사용중인 카드번호입니다.</font>";
$('#add_submit').prop("disabled", true);
} else {
var msg = "사용가능한 카드입니다.";
$('#add_submit').prop("disabled", false);
}
$("#duplicate-no-warning").hide().html(msg).fadeIn(100);
}});
}
function checkDupRc(value) {
$.ajax({
type: "POST",
url: fg_manager_url + "/lib/ajax.check_duplicate.php",
data: "mode=rc_no&value="+value,
success: function(req){
if (req != 0) {
var msg = "<font color='red'>사용중인 카드번호입니다.</font>";
$('#renew_submit').prop("disabled", true);
} else {
var msg = "사용가능한 카드입니다.";
$('#renew_submit').prop("disabled", false);
}
$("#duplicate-rc-warning").hide().html(msg).fadeIn(100);
}});
}
function checkDupID(value) {
$.ajax({
type: "POST",
url: fg_manager_url + "/lib/ajax.check_duplicate.php",
data: "mode=idchk&value="+value,
success: function(req){
if (req != 0) {
var msg = "<font color='red'>동일한 ID가 이미 있습니다.</font>";
} else {
var msg = "사용가능한 ID입니다.";
}
$("#duplicate-id-warning").hide().html(msg).fadeIn(100);
}});
}

4
adm/fg_admin/js/jquery-2.1.4.min.js vendored Normal file

File diff suppressed because one or more lines are too long

21
adm/fg_admin/js/list.js Normal file
View File

@ -0,0 +1,21 @@
// 숫자만 입력받기
function onlyNumber(event){
event = event || window.event;
var keyID = (event.which) ? event.which : event.keyCode;
if ( (keyID >= 48 && keyID <= 57) || (keyID >= 96 && keyID <= 105) || keyID == 8 || keyID == 46 || keyID == 37 || keyID == 39 )
return;
else
return false;
}
function removeChar(event) {
event = event || window.event;
var keyID = (event.which) ? event.which : event.keyCode;
if ( keyID == 8 || keyID == 46 || keyID == 37 || keyID == 39 )
return;
else
event.target.value = event.target.value.replace(/[^0-9]/g, "");
}

View File

@ -0,0 +1,2 @@
<?php
include_once '../common.php';

View File

@ -0,0 +1,49 @@
<?php
include_once '_common.php';
include_once 'lib.php';
//if(!$_SESSION['user_id']) exit;
if ( isset($mode) ) {
switch($mode) {
case "vip_tel":
$value = addTelHyphen($value);
$field = "vip_tel";
$table = $fg['vip_list_table'];
break;
case "vip_card_no":
$field = "vip_card_no";
$table = $fg['vip_list_table'];
break;
case "rc_no":
$field = "vip_card_no";
$table = $fg['vip_list_table'];
break;
case "annuno":
$field = "mem_no";
$table = $fg['annual_member_table'];
break;
case "annutel":
$value = addTelHyphen($value);
$field = "tel";
$table = $fg['annual_member_table'];
break;
case "idchk":
$field = "user_id";
$table = $fg['member_table'];
$query = "SELECT {$field} FROM {$table} WHERE {$field} LIKE '{$value}'";
break;
default:
echo "error";
break;
}
if ( isset($field) && isset($table) ) {
if ( !isset($query) ) $query = "SELECT {$field} FROM {$table} WHERE {$field} LIKE '%{$value}%'";
$result = sql_query($query);
echo sql_num_rows($result);
}
}

View File

@ -0,0 +1,2 @@
<?php
$conn=mysqli_connect($DB['host'],$DB['user'],$DB['pass'],$DB['name']);

494
adm/fg_admin/lib/lib.php Normal file
View File

@ -0,0 +1,494 @@
<?php
////////////////// 퍼스트가든 VIP 관리툴 함수들 //////////////////
// 행 갯수 구하기
function get_num_rows($table, $where="") {
$sql_common = sql_query("SELECT * FROM {$table} {$where}");
$result = sql_num_rows($sql_common);
return $result;
}
// 결과 가져오기
function get_result($table, $ord_by="", $query_limit="", $where="") {
$query = "SELECT * FROM {$table} {$where} {$ord_by} {$query_limit}";
$result = sql_query($query);
$R = array();
while($row=sql_fetch_array($result)) { // 전체 배열에 저장
array_push($R, $row);
}
return $R;
}
// 페이지 아이템 갯수 구하기
function get_item_count($table) {
$t_query = sql_query("SELECT * FROM {$table}"); // 전체 숫자 구함
$result = sql_num_rows($t_query);
return $result;
}
// 페이지 이름 가져오기
function get_page_name($page, $setpage) {
$page_name = array_search($page, array_column($setpage, 'pid'));
return $setpage[$page_name]['pname'];
}
// 테이블 내 필드 수 구하기
function get_total_count($db_name) {
$t_query = sql_query("SELECT * FROM {$db_name}"); // 전체 숫자 구함
$result = sql_num_rows($t_query);
return $result;
}
// 연간회원권
// 시작일 기준 종료일 만들기
function getAnnualEdate($date) {
$date = new DateTime($date);
$date->modify('+1 Year');
$date->modify('-1 Day');
return $date->format('Y-m-d');
}
// 연간회원 권종구분 가져오기
function getAnnualGroup($used = 0){
global $fg;
$query = "SELECT * FROM {$fg['annual_category_table']}";
if ($used == 1){ // 사용하는 카테고리만
$query .= " WHERE used = '{$used}'";
}
$result = sql_query($query);
$gr = array();
while($category=sql_fetch_array($result)){
array_push($gr,$category);
}
return $gr;
}
// 회원 상태 가져오기
function getAnnualStatus($mem_no){
global $fg;
$query = "SELECT status FROM {$fg['annual_member_table']}";
$query .= " WHERE mem_no = '{$mem_no}'";
$result = sql_fetch($query);
$result = $result['status'];
/* $gr = array();
while($category=sql_fetch_array($result)){
array_push($gr,$category);
}
*/
return $result;
}
// 계정관련(직원)
// 부서 정보 가져오기
function getTeamName($used = 0){
global $fg;
$where = ""; // $where 초기화
if ($used == 1) $where = " WHERE tused = '{$used}'";
$query = "SELECT * FROM {$fg['member_group_table']} {$where} ORDER BY tname";
$r = sql_query($query);
$result = array();
while($row=sql_fetch_array($r)){
array_push($result,$row);
}
return $result;
}
// 구성원 수 구하기
function getMemberCount($team){
global $fg;
$where = " WHERE tid = '{$team}'";
$query = "SELECT * FROM {$fg['member_table']} {$where}";
$row = sql_query($query);
$result = sql_num_rows($row);
return $result;
}
// 멤버정보 가져오기
function getMemberInfo($id){
global $fg;
$where = " WHERE user_id = '{$id}'";
$query = "SELECT * FROM {$fg['member_table']} {$where}";
$result = sql_fetch($query);
return $result;
}
// VIP카드 관련
// VIP관련
// 카테고리명 가져오기
function getVipCatName($used = 0){
global $fg;
$query = "SELECT * FROM {$fg['vip_category_table']}";
if ($used == 1){
$query .= " WHERE ca_use = '{$used}'";
}
$result = sql_query($query);
$gr = array();
while($category=sql_fetch_array($result)){
array_push($gr,$category);
}
return $gr;
}
// VIP그룹별 유효기간 가져오기
function getVipMemberLimit($gr_id){
global $fg;
$query = "SELECT * FROM {$fg['vip_category_table']} WHERE gr_id = '{$gr_id}'";
$getdate = sql_fetch($query);
$result = $getdate['gr_date'];
return $result;
}
// 재고
/*
VIP카드 재고 등록
개별 등록 또는 순차 등록만 허용함
등록 전 해당 번호 구간에 대해 이미 있는지 확인하고 있다면 오류를 반환, 없다면 등록함
해당 카드에 대해 추적하고 수량 관리를 하기 위함
*/
function get_vip_stock(){
global $fg;
$query = "SELECT * FROM {$fg['vip_card_stock_table']} ";
$r=sql_query($query);
$result = array();
while($row=sql_fetch_array($r)){
array_push($result,$row);
}
return $result;
}
// 상태별 값 가져오기
function get_qty($status){
global $fg;
$input = array('입고');
$dispo = array('폐기', '복구');
switch ($status) {
case '입고' :
$sel = 'input';
break;
case '출고' :
$sel = 'output';
break;
case in_array($status,$dispo) :
$sel = 'dispo';
break;
}
if (in_array($status, $dispo)) {
$where = " WHERE status = '폐기' OR status = '복구'";
} else {
$where = " WHERE status = '{$status}'";
}
$query = "SELECT sum({$sel}) FROM {$fg['vip_card_stock_table']} ".$where;
$result = sql_fetch($query);
$fname = 'sum('.$sel.')'; // sql_fetch를 사용하면 sum(필드명)으로 나오기 때문에
$result = $result[$fname]; // 배열을 값으로 변경
return $result;
}
// 그룹 출고수량 가져오기
function get_gr_qty($gid = 0, $status = ""){
global $fg;
if($gid > 0 && $status) {
$where = " WHERE gr_id='{$gid}' AND status='{$status}'";
} else if($gid > 0) {
$where = " WHERE gr_id='{$gid}'";
} else if($status) {
$where = " WHERE status='{$status}'";
} else {
$where = "";
}
$query = "SELECT * FROM {$fg['vip_list_table']} ".$where;
$result = sql_num_rows(sql_query($query));
return $result;
}
// 팀 재고 가져오기
function get_team_qty($tid = 0, $status = ""){
global $fg;
if($tid != 0 || $status) $where = " WHERE ";
if($tid != 0) $where .= "rec_team = '{$tid}' ";
if($tid != 0 && $status) $where .= "AND ";
if($status) $where .= "status = '{$status}' ";
$query = "SELECT * FROM {$fg['vip_list_table']} ".$where;
$item_qty = sql_num_rows(sql_query($query));
return $item_qty;
}
// log 기록
function log_update($work, $work_detail, $userid, $time) {
global $fg;
$result = sql_query("INSERT INTO {$fg['log_table']} (work, work_detail, id, date) VALUES ('{$work}', '{$work_detail}', '{$userid}', '{$time}')");
return $result;
}
// 베이커리 관련
// 작성자 불러오기
function getAuthorInfo($date) {
global $fg;
$query = "SELECT * FROM {$fg['bakery_author_table']} WHERE date = '{$date}'";
$result = sql_fetch($query);
if ($result) {
return $result;
} else {
return false;
}
}
// 값이 있는지 확인
function getBakeryInvenRow($date) {
global $fg;
$query = "SELECT * FROM {$fg['bakery_inventory_table']} WHERE date = '{$date}'";
$result = sql_num_rows(sql_query($query));
return $result;
}
// 상품 데이터 불러오기
function getBakeryInvenData($date, $ord_by = "product_name ASC") {
global $fg;
// LEFT JOIN을 사용하여 bakery_product_table과 연결하고 used가 1인 데이터만 불러옴
$query = "SELECT a.*, b.used, b.product_name
FROM {$fg['bakery_inventory_table']} AS a
LEFT JOIN {$fg['bakery_product_table']} AS b
ON a.barcode = b.barcode
WHERE b.used = 1 AND a.date = '{$date}'
ORDER BY {$ord_by}
";
error_log($query);
$result = sql_query($query);
$R = array();
while ($row = sql_fetch_array($result)) {
array_push($R, $row);
}
return $R;
}
// 전체 품명 불러오기
function getBakeryProductList($ord_by = "ASC") {
global $fg;
$query = "SELECT * FROM {$fg['bakery_product_table']} ORDER BY product_name {$ord_by}";
$result = sql_query($query);
$R = array();
while($row=sql_fetch_array($result)) { // 전체 배열에 저장
array_push($R, $row);
}
return $R;
}
// 어제자 최종재고 불러오기
function getPrevStock($date, $barcode) {
global $fg;
$prev_date = date("Y-m-d", strtotime("-1 day", strtotime($date)));
// 바코드를 기준으로 어제자 값을 가져옴
$query = "SELECT current_stock FROM {$fg['bakery_inventory_table']} WHERE date = '{$prev_date}' AND barcode = '{$barcode}'";
$result = sql_fetch($query);
if ($result) {
return $result['current_stock'];
} else {
return 0;
}
}
// 데이터가 있는지 확인
function getBakeryRowData($barcode, $searchDate) {
global $fg;
$query = "SELECT * FROM {$fg['bakery_inventory_table']} WHERE barcode = '$barcode' AND date = '$searchDate'";
$result = sql_fetch($query);
if ($result) {
return $result;
} else {
return false;
}
}
// 계정에 따른 수정 가능 처리
function bakeryChkDate($date, $userid) {
$today = new DateTime(); // 오늘 날짜
if ( $userid == "bakery" ) { // 베이커리 계정은 7일 전까지의 데이터만 수정 가능
$dateChk = $today->modify('-7 days');
} else { // 나머지 계정은 14일 전
$dateChk = $today->modify('-14 days');
}
// 비교를 위해 입력 날짜를 DateTime 객체로 변환
$inputDate = new DateTime($date);
// 날짜 비교
return $inputDate <= $dateChk;
}
// DB 현재고 업데이트 함수
function bakeryCurrentStockUpdate($searchDate, $barcode, $current_stock) {
global $fg;
$query = "UPDATE {$fg['bakery_inventory_table']} SET current_stock = {$current_stock} WHERE date = '{$searchDate}' AND barcode = '{$barcode}'";
$result = sql_query($query);
return $result;
}
// 사전 목록 생성
function bakeryPreUpdate($searchDate, $edit_datetime) {
global $fg;
$result = false;
$isDebug = true;
$prevDate = date("Y-m-d", strtotime("$searchDate -1 day")); // 하루 전 날짜 구하기
$today = new DateTime();
$searchDateObj = new DateTime($searchDate);
if ($isDebug) error_log("bakeryPreUpdate started for searchDate: $searchDate, edit_datetime: $edit_datetime, prevDate: $prevDate");
// 오늘자 데이터 갯수와 어제자 데이터 갯수가 다르면 업데이트(페이지가 로딩될 때마다 업데이트 하는것을 방지)
$cntRecordQuery = "SELECT COUNT(*) as cnt FROM `{$fg['bakery_product_table']}`;";
$cntRecordResult = sql_query($cntRecordQuery);
$cntRecord = sql_fetch_array($cntRecordResult)['cnt'];
$searchDateRow = getBakeryInvenRow($searchDate);
if ($searchDateRow != getBakeryInvenRow($prevDate) || ($today <= $searchDateObj && $searchDateRow != $cntRecord) ) {
if ($isDebug) error_log("Inventory row difference detected.");
/*
// 어제 날짜의 데이터를 가져옴
$chkQuery = "SELECT a.date, a.barcode, b.product_name
FROM {$fg['bakery_inventory_table']} AS a
LEFT JOIN {$fg['bakery_product_table']} AS b
ON a.barcode = b.barcode
WHERE a.date = '{$prevDate}' AND b.used = 1";
*/
// product_table에서 used = 1인 product_name과 barcode를 가지고 옴
$chkQuery = "SELECT * FROM {$fg['bakery_product_table']} WHERE used = 1";
$chkResult = sql_query($chkQuery);
if ($isDebug) error_log("chkQuery: $chkQuery");
// chkResult 출력 확인
if (!$chkResult) {
if ($isDebug) error_log("chkResult is empty.");
return false;
}
if ($isDebug) error_log("chkResult obtained.");
// 업데이트
while ($row = sql_fetch_array($chkResult)) {
if ($isDebug) error_log("Processing row: " . print_r($row, true));
// `bakery_product_table`에 바코드가 없는 경우 추가
$checkQuery = "SELECT COUNT(*) as cnt FROM {$fg['bakery_product_table']} WHERE barcode = '{$row['barcode']}'";
$checkResult = sql_query($checkQuery);
$count = sql_fetch_array($checkResult)['cnt'];
if ($isDebug) error_log("Barcode count for {$row['barcode']} is $count");
if ($count == 0) {
if ($isDebug) error_log("Inserting new product with barcode: {$row['barcode']}");
$insertQuery = "INSERT INTO {$fg['bakery_product_table']} (product_name, barcode, used) VALUES ('{$row['product_name']}', '{$row['barcode']}', 1)";
sql_query($insertQuery);
}
// LEFT JOIN을 통해 `used`가 1인 항목만 업데이트
$updateQuery = "INSERT IGNORE INTO {$fg['bakery_inventory_table']} (date, barcode, edit_datetime)
VALUES ('{$searchDate}', '{$row['barcode']}', '{$edit_datetime}')";
/*
SELECT '{$searchDate}', b.barcode, '{$edit_datetime}'
FROM {$fg['bakery_inventory_table']} AS a
LEFT JOIN {$fg['bakery_product_table']} AS b
ON a.barcode = b.barcode
WHERE b.used = 1 AND a.date = '{$prevDate}'";
*/
if ($isDebug) error_log("Executing updateQuery: $updateQuery");
$result = sql_query($updateQuery);
}
}
if ($isDebug) error_log("bakeryPreUpdate completed with result: " . ($result ? 'true' : 'false'));
return $result;
}
// 기타
// 하이픈 넣기
function addTelHyphen($tel)
{
$tel = preg_replace("/[^0-9]/", "", $tel);
if (substr($tel,0,2)=='02')
return preg_replace("/([0-9]{2})([0-9]{3,4})([0-9]{4})$/", "\\1-\\2-\\3", $tel);
else if (strlen($tel)=='8' && (substr($tel,0,2)=='15' || substr($tel,0,2)=='16' || substr($tel,0,2)=='18'))
return preg_replace("/([0-9]{4})([0-9]{4})$/", "\\1-\\2", $tel);
else
return preg_replace("/([0-9]{3})([0-9]{3,4})([0-9]{4})$/", "\\1-\\2-\\3", $tel);
}
/*
// 브라우저 캐시 초기화
function clearBrowserCache() {
header("Pragma: no-cache");
header("Cache: no-cache");
header("Cache-Control: no-cache, must-revalidate");
header("Expires:Mon, 26 Jul 1997 05:00:00 GMT");
}
*/

View File

@ -0,0 +1,20 @@
<?php
$doc = isset($_GET['doc']) ? clean_xss_tags($_GET['doc'], 1, 1) : '';
$sort1 = (isset($_GET['sort1']) && in_array($_GET['sort1'], array('od_id', 'od_cart_price', 'od_receipt_price', 'od_cancel_price', 'od_misu', 'od_cash'))) ? $_GET['sort1'] : '';
$sort2 = (isset($_GET['sort2']) && in_array($_GET['sort2'], array('desc', 'asc'))) ? $_GET['sort2'] : 'desc';
$sel_field = (isset($_GET['sel_field']) && in_array($_GET['sel_field'], array('od_id', 'mb_id', 'od_name', 'od_tel', 'od_hp', 'od_b_name', 'od_b_tel', 'od_b_hp', 'od_deposit_name', 'od_invoice')) ) ? $_GET['sel_field'] : '';
$od_status = isset($_GET['od_status']) ? get_search_string($_GET['od_status']) : '';
$search = isset($_GET['search']) ? get_search_string($_GET['search']) : '';
$fr_date = (isset($_GET['fr_date']) && preg_match("/^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$/", $_GET['fr_date'])) ? $_GET['fr_date'] : '';
$to_date = (isset($_GET['to_date']) && preg_match("/^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])$/", $_GET['to_date'])) ? $_GET['to_date'] : '';
$od_misu = isset($_GET['od_misu']) ? preg_replace('/[^0-9a-z]/i', '', $_GET['od_misu']) : '';
$od_cancel_price = isset($_GET['od_cancel_price']) ? preg_replace('/[^0-9a-z]/i', '', $_GET['od_cancel_price']) : '';
$od_refund_price = isset($_GET['od_refund_price']) ? preg_replace('/[^0-9a-z]/i', '', $_GET['od_refund_price']) : '';
$od_receipt_point = isset($_GET['od_receipt_point']) ? preg_replace('/[^0-9a-z]/i', '', $_GET['od_receipt_point']) : '';
$od_coupon = isset($_GET['od_coupon']) ? preg_replace('/[^0-9a-z]/i', '', $_GET['od_coupon']) : '';
$od_settle_case = isset($_GET['od_settle_case']) ? clean_xss_tags($_GET['od_settle_case'], 1, 1) : '';
$od_escrow = isset($_GET['od_escrow']) ? clean_xss_tags($_GET['od_escrow'], 1, 1) : '';
$tot_itemcount = $tot_orderprice = $tot_receiptprice = $tot_ordercancel = $tot_misu = $tot_couponprice = 0;

View File

@ -0,0 +1,158 @@
<script>
$(function(){
$("#fr_date, #to_date").datepicker({ changeMonth: true, changeYear: true, dateFormat: "yy-mm-dd", showButtonPanel: true, yearRange: "c-99:c+99", maxDate: "+0d" });
// 주문상품보기
$(".orderitem").on("click", function() {
var $this = $(this);
var od_id = $this.text().replace(/[^0-9]/g, "");
if($this.next("#orderitemlist").size())
return false;
$("#orderitemlist").remove();
$.post(
"./ajax.orderitem.php",
{ od_id: od_id },
function(data) {
$this.after("<div id=\"orderitemlist\"><div class=\"itemlist\"></div></div>");
$("#orderitemlist .itemlist")
.html(data)
.append("<div id=\"orderitemlist_close\"><button type=\"button\" id=\"orderitemlist-x\" class=\"btn_frmline\">닫기</button></div>");
}
);
return false;
});
// 상품리스트 닫기
$(".orderitemlist-x").on("click", function() {
$("#orderitemlist").remove();
});
$("body").on("click", function() {
$("#orderitemlist").remove();
});
// 엑셀배송처리창
$("#order_delivery").on("click", function() {
var opt = "width=600,height=450,left=10,top=10";
window.open(this.href, "win_excel", opt);
return false;
});
});
function set_date(today)
{
<?php
$date_term = date('w', G5_SERVER_TIME);
$week_term = $date_term + 7;
$last_term = strtotime(date('Y-m-01', G5_SERVER_TIME));
?>
if (today == "오늘") {
document.getElementById("fr_date").value = "<?php echo G5_TIME_YMD; ?>";
document.getElementById("to_date").value = "<?php echo G5_TIME_YMD; ?>";
} else if (today == "어제") {
document.getElementById("fr_date").value = "<?php echo date('Y-m-d', G5_SERVER_TIME - 86400); ?>";
document.getElementById("to_date").value = "<?php echo date('Y-m-d', G5_SERVER_TIME - 86400); ?>";
} else if (today == "이번주") {
document.getElementById("fr_date").value = "<?php echo date('Y-m-d', strtotime('-'.$date_term.' days', G5_SERVER_TIME)); ?>";
document.getElementById("to_date").value = "<?php echo date('Y-m-d', G5_SERVER_TIME); ?>";
} else if (today == "이번달") {
document.getElementById("fr_date").value = "<?php echo date('Y-m-01', G5_SERVER_TIME); ?>";
document.getElementById("to_date").value = "<?php echo date('Y-m-d', G5_SERVER_TIME); ?>";
} else if (today == "지난주") {
document.getElementById("fr_date").value = "<?php echo date('Y-m-d', strtotime('-'.$week_term.' days', G5_SERVER_TIME)); ?>";
document.getElementById("to_date").value = "<?php echo date('Y-m-d', strtotime('-'.($week_term - 6).' days', G5_SERVER_TIME)); ?>";
} else if (today == "지난달") {
document.getElementById("fr_date").value = "<?php echo date('Y-m-01', strtotime('-1 Month', $last_term)); ?>";
document.getElementById("to_date").value = "<?php echo date('Y-m-t', strtotime('-1 Month', $last_term)); ?>";
} else if (today == "전체") {
document.getElementById("fr_date").value = "";
document.getElementById("to_date").value = "";
}
}
</script>
<script>
function forderlist_submit(f)
{
if (!is_checked("chk[]")) {
alert(document.pressed+" 하실 항목을 하나 이상 선택하세요.");
return false;
}
var change_status = f.od_status.value;
if (f.od_status.checked == false) {
alert("주문상태 변경에 체크하세요.");
return false;
}
var chk = document.getElementsByName("chk[]");
for (var i=0; i<chk.length; i++)
{
if (chk[i].checked)
{
var k = chk[i].value;
var current_settle_case = f.elements['current_settle_case['+k+']'].value;
var current_status = f.elements['current_status['+k+']'].value;
switch (change_status)
{
case "입금" :
if (!(current_status == "주문" && current_settle_case == "무통장")) {
alert("'주문' 상태의 '무통장'(결제수단)인 경우에만 '입금' 처리 가능합니다.");
return false;
}
break;
case "준비" :
if (current_status != "입금") {
alert("'입금' 상태의 주문만 '준비'로 변경이 가능합니다.");
return false;
}
break;
case "배송" :
if (current_status != "준비") {
alert("'준비' 상태의 주문만 '배송'으로 변경이 가능합니다.");
return false;
}
var invoice = f.elements['od_invoice['+k+']'];
var invoice_time = f.elements['od_invoice_time['+k+']'];
var delivery_company = f.elements['od_delivery_company['+k+']'];
if ($.trim(invoice_time.value) == '') {
alert("배송일시를 입력하시기 바랍니다.");
invoice_time.focus();
return false;
}
if ($.trim(delivery_company.value) == '') {
alert("배송업체를 입력하시기 바랍니다.");
delivery_company.focus();
return false;
}
if ($.trim(invoice.value) == '') {
alert("운송장번호를 입력하시기 바랍니다.");
invoice.focus();
return false;
}
break;
}
}
}
if (!confirm("선택하신 주문서의 주문상태를 '"+change_status+"'상태로 변경하시겠습니까?"))
return false;
f.action = "./orderlistupdate_ticket.php";
return true;
}
</script>

View File

@ -0,0 +1,421 @@
<?php
$sub_menu = '998412';
include_once('./_common.php');
auth_check($auth[$sub_menu], "r");
$g5['title'] = '관리자 주문 확인';
include_once (G5_ADMIN_PATH.'/admin.head.php');
include_once(G5_PLUGIN_PATH.'/jquery-ui/datepicker.php');
$where = array();
// 퍼스트가든용
// $od_status = '입금'; //입금처리 된것만 출력한다.
// 특정 카테고리만 노출
$ca_id = "10"; // 특정 카테고리 선택
$sel_ca_id = " NOT ca_id = $ca_id "; // 특정 카테고리 노출만 하려면 NOT을 지운다.
$where[] = "$sel_ca_id"; // 배열에 검색문을 넣어준다
$tot_ct_qty = 0;
// 검색날짜 설정
$fr_date = "2024-04-01";
$to_date = "2024-04-30";
// 퍼스트가든용 끝
include_once ('orderlist.head.php');
$sql_search = "";
if ($search != "") {
if ($sel_field != "") {
$where[] = " $sel_field like '%$search%' ";
}
if ($save_search != $search) {
$page = 1;
}
}
if ($od_status) {
switch($od_status) {
case '전체취소':
$where[] = " a.od_status = '취소' ";
break;
case '부분취소':
$where[] = " a.od_status IN('주문', '입금', '준비', '배송', '완료') and a.od_cancel_price > 0 ";
break;
default:
$where[] = " a.od_status = '$od_status'";
break;
}
switch ($od_status) {
case '주문' :
$sort1 = "a.od_id";
$sort2 = "desc";
break;
case '입금' : // 결제완료
$sort1 = "a.od_receipt_time";
$sort2 = "desc";
break;
case '배송' : // 배송중
$sort1 = "a.od_invoice_time";
$sort2 = "desc";
break;
}
}
if ($od_settle_case) {
$where[] = " a.od_settle_case = '$od_settle_case' ";
}
if ($od_misu) {
$where[] = " a.od_misu != 0 ";
}
if ($od_cancel_price) {
$where[] = " a.od_cancel_price != 0 ";
}
if ($od_refund_price) {
$where[] = " a.od_refund_price != 0 ";
}
if ($od_receipt_point) {
$where[] = " a.od_receipt_point != 0 ";
}
if ($od_coupon) {
$where[] = " ( a.od_cart_coupon > 0 or a.od_coupon > 0 or a.od_send_coupon > 0 ) ";
}
if ($od_escrow) {
$where[] = " a.od_escrow = 1 ";
}
if ($fr_date && $to_date) {
$where[] = " a.od_time between '$fr_date 00:00:00' AND '$to_date 23:59:59' ";
}
if ($where) {
$sql_search = ' WHERE '.implode(' AND ', $where);
}
if ( empty($sel_field) ) $sel_field = "a.od_id";
if ( empty($sort1) ) $sort1 = "a.od_id";
if ( empty($sort2) ) $sort2 = "desc";
// 상품명, 단가, 수량, 카테고리를 불러오기 위해 DB를 합친다
$sql_common = " FROM {$g5['g5_shop_order_table']} AS a
LEFT JOIN {$g5['g5_shop_cart_table']} AS b ON a.od_id = b.od_id
LEFT JOIN {$g5['g5_shop_item_table']} AS c ON b.it_id = c.it_id
LEFT JOIN {$g5['g5_shop_item_option_table']} AS d ON c.it_id = d.it_id AND b.io_id = d.io_id
";
$sql_common .= $sql_search;
$sql = " SELECT count(a.od_id) AS cnt " . $sql_common ;
$row = sql_fetch($sql);
$total_count = $row['cnt'];
$rows = 100;
if( !isset($rows) ) $rows = $config['cf_page_rows'];
$total_page = ceil($total_count / $rows); // 전체 페이지 계산
if ($page < 1) { $page = 1; } // 페이지가 없으면 첫 페이지 (1 페이지)
$from_record = ($page - 1) * $rows; // 시작 열을 구함
// 상품명, 수량, 단가, 카테고리를 가져옴
$sql = " SELECT a.*,
(a.od_cart_coupon + a.od_coupon + a.od_send_coupon) as couponprice,
b.it_name,
b.ct_qty,
b.ct_price,
b.ct_option,
b.io_id,
c.ca_id,
c.it_1,
c.it_2,
d.io_price
$sql_common
ORDER BY $sort1 $sort2
LIMIT $from_record, $rows ";
$result = sql_query($sql);
$qstr1 = "od_status=".urlencode($od_status)."&amp;
od_settle_case=".urlencode($od_settle_case)."&amp;
od_misu=$od_misu&amp
;od_cancel_price=$od_cancel_price&amp;
od_refund_price=$od_refund_price&amp;
od_receipt_point=$od_receipt_point&amp;
od_coupon=$od_coupon&amp;
fr_date=$fr_date&amp;
to_date=$to_date&amp;
sel_field=$sel_field&amp;
search=$search&amp;
save_search=$search";
if($default['de_escrow_use'])
$qstr1 .= "&amp;od_escrow=$od_escrow";
$qstr = "$qstr1&amp;sort1=$sort1&amp;sort2=$sort2&amp;page=$page";
$listall = '<a href="'.$_SERVER['SCRIPT_NAME'].'" class="ov_listall">전체목록</a>';
// 주문삭제 히스토리 테이블 필드 추가
if(!sql_query(" SELECT mb_id FROM {$g5['g5_shop_order_delete_table']} LIMIT 1 ", false)) {
sql_query(" ALTER TABLE `{$g5['g5_shop_order_delete_table']}`
ADD `mb_id` varchar(20) NOT NULL DEFAULT '' AFTER `de_data`,
ADD `de_ip` varchar(255) NOT NULL DEFAULT '' AFTER `mb_id`,
ADD `de_datetime` datetime NOT NULL DEFAULT '0000-00-00 00:00:00' AFTER `de_ip` ", true);
}
?>
<form name="frmorderlist" class="local_sch01 local_sch">
<input type="hidden" name="doc" value="<?php echo $doc; ?>">
<input type="hidden" name="sort1" value="<?php echo $sort1; ?>">
<input type="hidden" name="sort2" value="<?php echo $sort2; ?>">
<input type="hidden" name="page" value="<?php echo $page; ?>">
<input type="hidden" name="save_search" value="<?php echo $search; ?>">
<!-- 엑셀저장 기능 구현 필요
<div class="list_excel">
<form method="post" action="orderlist_ex.php">
<input type="hidden" name="sql_common" value="<?=$sql_common?>">
<input type="hidden" name="sort1" value="<?=$sort1?>">
<input type="hidden" name="sort2" value="<?=$sort2?>">
<input type="hidden" name="from_record" value="<?=$from_record?>">
<input type="hidden" name="rows" value="<?=$rows?>" >
<input type="submit" value="엑셀저장" class="list_excel">
</form>
</div>
-->
<label for="sel_field" class="sound_only">검색대상</label>
<select name="sel_field" id="sel_field">
<option value="od_tel" <?php echo get_selected($sel_field, 'od_tel'); ?> selected>연락처</option>
<option value="od_name" <?php echo get_selected($sel_field, 'od_name'); ?>>주문자</option>
<option value="od_id" <?php echo get_selected($sel_field, 'od_id'); ?>>주문번호</option>
</select>
<label for="search" class="sound_only">검색어<strong class="sound_only"> 필수</strong></label>
<input type="text" name="search" value="<?php echo $search; ?>" id="search" required class="required frm_input" autocomplete="off">
<input type="submit" value="검색" class="btn_submit">
</form>
<form class="local_sch03 local_sch">
<div class="sch_last"">
<strong>주문일자</strong>
<input type="text" id="fr_date" name="fr_date" value="<?php echo $fr_date; ?>" class="frm_input" size="10" maxlength="10"> ~
<input type="text" id="to_date" name="to_date" value="<?php echo $to_date; ?>" class="frm_input" size="10" maxlength="10">
<button type="button" onclick="javascript:set_date('오늘');">오늘</button>
<button type="button" onclick="javascript:set_date('어제');">어제</button>
<button type="button" onclick="javascript:set_date('이번주');">이번주</button>
<button type="button" onclick="javascript:set_date('이번달');">이번달</button>
<button type="button" onclick="javascript:set_date('지난주');">지난주</button>
<button type="button" onclick="javascript:set_date('지난달');">지난달</button>
<button type="button" onclick="javascript:set_date('전체');">전체</button>
<input type="submit" value="검색" class="btn_submit">
</div>
</form>
<form name="forderlist" id="forderlist" onsubmit="return forderlist_submit(this);" method="post" autocomplete="off">
<input type="hidden" name="search_od_status" value="<?php echo $od_status; ?>">
<!-- 목록 시작 -->
<div class="tbl_head01 tbl_wrap">
<table id="sodr_list">
<caption>주문 내역 목록</caption>
<thead>
<tr>
<th scope="col" style="display:none">
<label for="chkall" class="sound_only">주문 전체</label>
<input type="checkbox" name="chkall" value="1" id="chkall" onclick="check_all(this.form)">
</th>
<!-- <th scope="col" id="th_ordnum" style="width:200px;"><a href="<?php echo title_sort("od_id", 1)."&amp;$qstr1"; ?>">주문번호</a></th>-->
<th scope="col" id="th_odrer">주문일</th>
<th scope="col" id="th_odrer" style="width:240px;">상품명</th>
<th scope="col" id="th_order" >옵션</th>
<th scope="col" id="th_odrer">주문자</th>
<th scope="col" id="th_odrertel">주문자전화</th>
<th scope="col" style="width:85px;">단가</th>
<th scope="col" style="width:62px;">수량</th>
<th scope="col" style="width:85px;">합계금액</th>
<!-- <th scope="col">입금합계</th>-->
<th scope="col" style="width:62px;">상태</th>
<th scope="col" style="width:61px;">상세</th>
</tr>
</thead>
<tbody>
<?php
for ($i=0; $row=sql_fetch_array($result); $i++)
{
// 결제 수단
$s_receipt_way = $s_br = "";
if ($row['od_settle_case'])
{
$s_receipt_way = $row['od_settle_case'];
$s_br = '<br />';
// 간편결제
if($row['od_settle_case'] == '간편결제') {
switch($row['od_pg']) {
case 'lg':
$s_receipt_way = 'PAYNOW';
break;
case 'inicis':
$s_receipt_way = 'KPAY';
break;
case 'kcp':
$s_receipt_way = 'PAYCO';
break;
default:
$s_receipt_way = $row['od_settle_case'];
break;
}
}
}
else
{
$s_receipt_way = '결제수단없음';
$s_br = '<br />';
}
if ($row['od_receipt_point'] > 0)
$s_receipt_way .= $s_br."포인트";
$mb_nick = get_sideview($row['mb_id'], get_text($row['od_name']), $row['od_email'], '');
$od_cnt = 0;
if ($row['mb_id'])
{
$sql2 = " select count(*) as cnt from {$g5['g5_shop_order_table']} where mb_id = '{$row['mb_id']}' ";
$row2 = sql_fetch($sql2);
$od_cnt = $row2['cnt'];
}
// 주문 번호에 device 표시
$od_mobile = '';
if($row['od_mobile'])
$od_mobile = '(M)';
// 주문번호에 - 추가
switch(strlen($row['od_id'])) {
case 16:
$disp_od_id = substr($row['od_id'],0,8).'-'.substr($row['od_id'],8);
break;
default:
$disp_od_id = substr($row['od_id'],0,6).'-'.substr($row['od_id'],6);
break;
}
// 주문 번호에 에스크로 표시
$od_paytype = '';
if($row['od_test'])
$od_paytype .= '<span class="list_test">테스트</span>';
if($default['de_escrow_use'] && $row['od_escrow'])
$od_paytype .= '<span class="list_escrow">에스크로</span>';
$uid = md5($row['od_id'].$row['od_time'].$row['od_ip']);
$invoice_time = is_null_time($row['od_invoice_time']) ? G5_TIME_YMDHIS : $row['od_invoice_time'];
$delivery_company = $row['od_delivery_company'] ? $row['od_delivery_company'] : $default['de_delivery_company'];
$bg = 'bg'.($i%2);
$td_color = 0;
if($row['od_cancel_price'] > 0) {
$bg .= 'cancel';
$td_color = 1;
}
?>
<!-- 목록 내용 시작 -->
<tr class="orderlist<?php echo ' '.$bg; ?>">
<td class="td_chk" style="display:none">
<input type="hidden" name="od_id[<?php echo $i ?>]" value="<?php echo $row['od_id'] ?>" id="od_id_<?php echo $i ?>">
<label for="chk_<?php echo $i; ?>" class="sound_only">주문번호 <?php echo $row['od_id']; ?></label>
<input type="checkbox" name="chk[]" value="<?php echo $i ?>" id="chk_<?php echo $i ?>">
</td>
<!--
<td headers="th_ordnum" class="td_odrnum2">
<?php if ($is_admin == 'super'){ ?>
<a href="<?php echo G5_SHOP_URL; ?>/orderinquiryview.php?od_id=<?php echo $row['od_id']; ?>&amp;uid=<?php echo $uid; ?>" class="orderitem"><?php echo $disp_od_id; ?></a>
<?php } else { echo $disp_od_id; }?>
<?php echo $od_mobile; ?>
<?php echo $od_paytype; ?>
</td>
-->
<td headers="th_ordnum" class="td_odrnum2"><?php echo substr($row['od_receipt_time'],0,10);?></td>
<td headers="th_ordnum" class="td_odrnum2"><?php echo $row['it_name'];?></td>
<td headers="th_ordnum" class="td_odrnum2"><?php echo ($row['io_id']) ? $row['io_id'] : ''; ?></td>
<td headers="th_odrer" class="td_name"><?php echo $mb_nick; ?></td>
<td headers="th_odrertel" class="td_tel" style="text-align:center;"><?php echo add_hyphen(get_text($row['od_tel'])); ?></td>
<td headers="th_odrcnt"><?php echo number_format($row['ct_price']+$row['io_price']);?></td>
<td headers="th_odrcnt"><?php echo $row['ct_qty']; ?></td>
<td class="td_num td_numsum">
<?php echo number_format(($row['ct_price'] + $row['io_price']) * $row['ct_qty']); ?>
<?php // echo number_format($row['od_cart_price'] + $row['od_send_cost'] + $row['od_send_cost2']); // 같은 승인번호의 결제건 여러개가 있는 경우 금액이 알아보기 불편함 ?></td>
<!-- <td class="td_num_right"><?php echo number_format($row['od_receipt_price']); ?></td>-->
<td class="td_mng td_mng_s">
<?php
echo $row['od_status'];
/* 사용처리사용안함
// 사용처리 버튼 출력을 위한 부분
if ($row['it_2'] && (substr($row['od_receipt_time'],0,10) == date('Y-m-d'))) { // 당일주문 사용불가 대상 & 당일주문 체크
echo '당일주문<br>사용불가';
} else if ($row['od_status'] == '입금' && $row['it_1'] >= date("ymd") || $row['it_1'] == "" ) { // 상태가 '입금' 이면서 유효기간이 지정되지 않았거나 지나지 않은 경우
?>
<a href="orderliveupdate.php?bo=u&it_id=<?php echo $row['od_id']; ?>&st=<?php echo $row['od_status'];?>" class="mng_mod btn btn_04"><span class="sound_only"><?php echo $row['od_id']; ?></span>사용</a>
<?php } else {
echo "사용불가<br>(유효일자:".$row['it_1'].")";
}
//사용처리 버튼 끝
*/
?>
</td>
<td class="td_mng td_mng_s">
<a href="./orderform.php?od_id=<?php echo $row['od_id']; ?>&amp;<?php echo $qstr; ?>" class="mng_mod btn btn_02"><span class="sound_only"><?php echo $row['od_id']; ?> </span>보기</a>
</td>
</tr>
<?php
$tot_itemcount += $row['od_cart_count'];
$tot_orderprice += (($row['ct_price'] + $row['io_price']) * $row['ct_qty']);
// $tot_orderprice += ($row['od_cart_price'] + $row['od_send_cost'] + $row['od_send_cost2']);
$tot_ordercancel += $row['od_cancel_price'];
$tot_receiptprice += $row['od_receipt_price'];
$tot_couponprice += $row['couponprice'];
$tot_ct_qty += $row['ct_qty'];
}
sql_free_result($result);
if ($i == 0)
echo '<tr><td colspan="11" class="empty_table">자료가 없습니다.</td></tr>';
?>
</tbody>
<tfoot>
<tr class="orderlist">
<th scope="row" colspan="6">합 계</th>
<td><?php echo $tot_ct_qty //number_format($tot_itemcount); ?>건</td>
<td><?php echo number_format($tot_orderprice); ?></td>
<!-- <td><?php echo number_format($tot_receiptprice); ?></td>-->
<td colspan="2"></td>
</tr>
</tfoot>
</table>
</div>
<div class="local_desc02 local_desc">
<p>
&lt;사용&gt;버튼을 클릭하면 티켓 사용처리가 완료됩니다. 부분사용, 부분취소가 불가능하므로 이용수량이 다른 경우 고객님께 꼭 확인해주시기 바랍니다.
</p>
</div>
</form>
<?php echo get_paging(G5_IS_MOBILE ? $config['cf_mobile_pages'] : $config['cf_write_pages'], $page, $total_page, "{$_SERVER['SCRIPT_NAME']}?$qstr&amp;page="); ?>
<?php
include_once ('orderlist_tail.php');
include_once (G5_ADMIN_PATH.'/admin.tail.php');
?>

View File

@ -0,0 +1,227 @@
<?php
$sub_menu = '998413';
include_once('./_common.php');
//auth_check($auth[$sub_menu], "r");
$g5['title'] = '월간 주문내역 합계';
include_once (G5_ADMIN_PATH.'/admin.head.php');
include_once(G5_PLUGIN_PATH.'/jquery-ui/datepicker.php');
$where = array();
// 퍼스트가든용
// $od_status = '입금'; //입금처리 된것만 출력한다.
// 특정 카테고리만 노출
$ca_id = "10"; // 특정 카테고리 선택
$sel_ca_id = " NOT ca_id = $ca_id "; // 특정 카테고리 노출만 하려면 NOT을 지운다.
$where[] = "$sel_ca_id"; // 배열에 검색문을 넣어준다
$tot_ct_qty = 0;
// 퍼스트가든용 끝
include_once (G5_ADMIN_PATH.'/fg_admin/orderlist.head.php');
$sql_search = "";
if ($search != "") {
if ($sel_field != "") {
$where[] = " $sel_field like '%$search%' ";
}
if ($save_search != $search) {
$page = 1;
}
}
// od_status가 입금, 완료인 것만 출력함
$where[] = " a.od_status IN('완료') ";
if ($od_settle_case) {
$where[] = " a.od_settle_case = '$od_settle_case' ";
}
if ($od_misu) {
$where[] = " a.od_misu != 0 ";
}
if ($od_cancel_price) {
$where[] = " a.od_cancel_price != 0 ";
}
if ($od_refund_price) {
$where[] = " a.od_refund_price != 0 ";
}
if ($od_receipt_point) {
$where[] = " a.od_receipt_point != 0 ";
}
if ($od_coupon) {
$where[] = " ( a.od_cart_coupon > 0 or a.od_coupon > 0 or a.od_send_coupon > 0 ) ";
}
if ($od_escrow) {
$where[] = " a.od_escrow = 1 ";
}
if ($fr_date && $to_date) {
$where[] = " a.od_time between '$fr_date 00:00:00' AND '$to_date 23:59:59' ";
}
if ($where) {
$sql_search = ' WHERE '.implode(' AND ', $where);
}
if ( empty($sel_field) ) $sel_field = "a.od_id";
if ( empty($sort1) ) $sort1 = "a.od_id";
if ( empty($sort2) ) $sort2 = "desc";
// 상품명, 단가, 수량, 카테고리를 불러오기 위해 DB를 합친다
$sql_common = " FROM {$g5['g5_shop_order_table']} AS a
LEFT JOIN {$g5['g5_shop_cart_table']} AS b ON a.od_id = b.od_id
LEFT JOIN {$g5['g5_shop_item_table']} AS c ON b.it_id = c.it_id
LEFT JOIN {$g5['g5_shop_item_option_table']} AS d ON c.it_id = d.it_id AND b.io_id = d.io_id
";
$sql_common .= $sql_search;
$sql = " SELECT count(a.od_id) AS cnt " . $sql_common ;
$row = sql_fetch($sql);
$total_count = $row['cnt'];
$rows = 100;
if( !isset($rows) ) $rows = $config['cf_page_rows'];
$total_page = ceil($total_count / $rows); // 전체 페이지 계산
if ($page < 1) { $page = 1; } // 페이지가 없으면 첫 페이지 (1 페이지)
$from_record = ($page - 1) * $rows; // 시작 열을 구함
// 상품명, 수량, 단가, 카테고리를 가져옴
$sql = " SELECT a.od_id,
b.it_name,
b.ct_qty,
b.ct_price,
b.ct_option,
b.io_id,
c.ca_id,
c.it_1,
c.it_2,
d.io_price
$sql_common
ORDER BY $sort1 $sort2
LIMIT $from_record, $rows ";
$result = sql_query($sql);
$qstr1 = "od_status=".urlencode($od_status)."&amp;
od_settle_case=".urlencode($od_settle_case)."&amp;
od_misu=$od_misu&amp
;od_cancel_price=$od_cancel_price&amp;
od_refund_price=$od_refund_price&amp;
od_receipt_point=$od_receipt_point&amp;
od_coupon=$od_coupon&amp;
fr_date=$fr_date&amp;
to_date=$to_date&amp;
sel_field=$sel_field&amp;
search=$search&amp;
save_search=$search";
if($default['de_escrow_use'])
$qstr1 .= "&amp;od_escrow=$od_escrow";
$qstr = "$qstr1&amp;sort1=$sort1&amp;sort2=$sort2&amp;page=$page";
$listall = '<a href="'.$_SERVER['SCRIPT_NAME'].'" class="ov_listall">전체목록</a>';
?>
<form name="frmorderlist" class="local_sch01 local_sch">
<input type="hidden" name="doc" value="<?php echo $doc; ?>">
<input type="hidden" name="sort1" value="<?php echo $sort1; ?>">
<input type="hidden" name="sort2" value="<?php echo $sort2; ?>">
<input type="hidden" name="page" value="<?php echo $page; ?>">
<input type="hidden" name="save_search" value="<?php echo $search; ?>">
<label for="sel_field" class="sound_only">검색대상</label>
<select name="sel_field" id="sel_field">
<option value="od_tel" <?php echo get_selected($sel_field, 'od_tel'); ?> selected>연락처</option>
<option value="od_name" <?php echo get_selected($sel_field, 'od_name'); ?>>주문자</option>
<option value="od_id" <?php echo get_selected($sel_field, 'od_id'); ?>>주문번호</option>
</select>
<label for="search" class="sound_only">검색어<strong class="sound_only"> 필수</strong></label>
<input type="text" name="search" value="<?php echo $search; ?>" id="search" required class="required frm_input" autocomplete="off">
<input type="submit" value="검색" class="btn_submit">
</form>
<form class="local_sch03 local_sch">
<div class="sch_last"">
<strong>주문일자</strong>
<input type="text" id="fr_date" name="fr_date" value="<?php echo $fr_date; ?>" class="frm_input" size="10" maxlength="10"> ~
<input type="text" id="to_date" name="to_date" value="<?php echo $to_date; ?>" class="frm_input" size="10" maxlength="10">
<button type="button" onclick="javascript:set_date('오늘');">오늘</button>
<button type="button" onclick="javascript:set_date('어제');">어제</button>
<button type="button" onclick="javascript:set_date('이번주');">이번주</button>
<button type="button" onclick="javascript:set_date('이번달');">이번달</button>
<button type="button" onclick="javascript:set_date('지난주');">지난주</button>
<button type="button" onclick="javascript:set_date('지난달');">지난달</button>
<button type="button" onclick="javascript:set_date('전체');">전체</button>
<input type="submit" value="검색" class="btn_submit">
</div>
</form>
<form name="forderlist" id="forderlist" onsubmit="return forderlist_submit(this);" method="post" autocomplete="off">
<input type="hidden" name="search_od_status" value="<?php echo $od_status; ?>">
<?php
// 총 수량과 총 금액을 저장할 배열 초기화
$total_items = array();
while ($row = sql_fetch_array($result)) {
$item_name = $row['it_name'];
$item_option = $row['ct_option'];
if (!isset($total_items[$item_name][$item_option])) {
$total_items[$item_name][$item_option]['quantity'] = 0;
$total_items[$item_name][$item_option]['total_price'] = 0;
}
if ( !isset($total_items[$item_name][$item_option]['price'] ) ) $total_items[$item_name][$item_option]['price'] = $row['ct_price'] + $row['io_price'];
$total_items[$item_name][$item_option]['quantity'] += $row['ct_qty'];
$total_items[$item_name][$item_option]['total_price'] += $row['ct_qty'] * ($row['ct_price'] + $row['io_price']);
}
// PHP 코드 블록 종료
?>
<div class="tbl_head01 tbl_wrap">
<table id="sodr_list">
<!-- 합계 표 출력 -->
<tr>
<th>상품명</th>
<th>옵션</th>
<th>단가</th>
<th>총 수량</th>
<th>총 금액</th>
</tr>
<?php foreach ($total_items as $item_name => $options): ?>
<?php foreach ($options as $option => $totals): ?>
<tr>
<td><?php echo $item_name; ?></td>
<td><?php echo $option; ?></td>
<td class="td_num"><?php echo number_format($totals['total_price'] / $totals['quantity']); ?></td>
<td class="th_odrcnt"><?php echo number_format($totals['quantity']); ?></td>
<td class="td_num td_numsum"><?php echo number_format($totals['total_price']); ?></td>
</tr>
<?php endforeach; ?>
<?php endforeach; ?>
</table>
</div>
<?php
include_once (G5_ADMIN_PATH.'/fg_admin/orderlist.tail.php');
include_once (G5_ADMIN_PATH.'/admin.tail.php');
?>

View File

@ -0,0 +1,603 @@
<?php
$sub_menu = '998431';
include_once('./_common.php');
auth_check($auth[$sub_menu], "r");
$g5['title'] = 'B2B 주문내역 확인';
include_once (G5_ADMIN_PATH.'/admin.head.php');
include_once(G5_PLUGIN_PATH.'/jquery-ui/datepicker.php');
$where = array();
// 퍼스트가든용
// $od_status = '입금'; //입금처리 된것만 출력한다.
// 특정 카테고리만 노출
$ca_id = "30"; // 특정 카테고리 선택
$sel_ca_id = " ca_id = $ca_id "; // 특정 카테고리 노출만 하려면 NOT을 지운다.
$where[] = "$sel_ca_id"; // 배열에 검색문을 넣어준다
$tot_ct_qty = 0;
// 퍼스트가든용 끝
include_once (G5_ADMIN_PATH.'/fg_admin/orderlist.head.php');
$sql_search = "";
if ($search != "") {
if ($sel_field != "") {
$where[] = " $sel_field like '%$search%' ";
}
if ($save_search != $search) {
$page = 1;
}
}
if ($od_status) {
switch($od_status) {
case '전체취소':
$where[] = " a.od_status = '취소' ";
break;
case '부분취소':
$where[] = " a.od_status IN('주문', '입금', '준비', '배송', '완료') AND a.od_cancel_price > 0 ";
break;
default:
$where[] = " a.od_status = '$od_status'";
break;
}
switch ($od_status) {
case '주문' :
$sort1 = "a.od_id";
$sort2 = "desc";
break;
case '입금' : // 결제완료
$sort1 = "a.od_receipt_time";
$sort2 = "desc";
break;
case '배송' : // 배송중
$sort1 = "a.od_invoice_time";
$sort2 = "desc";
break;
}
}
if ($od_settle_case) {
$where[] = " a.od_settle_case = '$od_settle_case' ";
}
if ($od_misu) {
$where[] = " a.od_misu != 0 ";
}
if ($od_cancel_price) {
$where[] = " a.od_cancel_price != 0 ";
}
if ($od_refund_price) {
$where[] = " a.od_refund_price != 0 ";
}
if ($od_receipt_point) {
$where[] = " a.od_receipt_point != 0 ";
}
if ($od_coupon) {
$where[] = " ( a.od_cart_coupon > 0 OR a.od_coupon > 0 OR a.od_send_coupon > 0 ) ";
}
if ($od_escrow) {
$where[] = " a.od_escrow = 1 ";
}
if ($fr_date && $to_date) {
$where[] = " a.od_time between '$fr_date 00:00:00' AND '$to_date 23:59:59' ";
}
if ($where) {
$sql_search = ' WHERE '.implode(' AND ', $where);
}
if ($sel_field == "") $sel_field = "a.od_id";
if ($sort1 == "") $sort1 = "a.od_id";
if ($sort2 == "") $sort2 = "desc";
// 상품명, 단가, 수량, 카테고리를 불러오기 위해 DB를 합친다
$sql_common = " FROM {$g5['g5_shop_order_table']} AS a
LEFT JOIN {$g5['g5_shop_cart_table']} AS b ON a.od_id = b.od_id
LEFT JOIN {$g5['g5_shop_item_table']} AS c ON b.it_id = c.it_id
LEFT JOIN {$g5['g5_shop_item_option_table']} AS d ON c.it_id = d.it_id AND b.io_id = d.io_id
";
$sql_common .= $sql_search;
$sql = " SELECT count(a.od_id) AS cnt " . $sql_common ;
$row = sql_fetch($sql);
$total_count = $row['cnt'];
$rows = $config['cf_page_rows'];
$total_page = ceil($total_count / $rows); // 전체 페이지 계산
if ($page < 1) { $page = 1; } // 페이지가 없으면 첫 페이지 (1 페이지)
$from_record = ($page - 1) * $rows; // 시작 열을 구함
// 상품명, 수량, 단가, 카테고리를 가져옴
$sql = " SELECT a.*,
(a.od_cart_coupon + a.od_coupon + a.od_send_coupon) as couponprice,
b.it_name,
b.ct_qty,
b.ct_price,
b.ct_option,
b.io_id,
c.ca_id,
c.it_1,
c.it_2,
d.io_price
$sql_common
ORDER BY $sort1 $sort2
LIMIT $from_record, $rows ";
$result = sql_query($sql);
$qstr1 = "od_status=".urlencode($od_status)."&amp;
od_settle_case=".urlencode($od_settle_case)."&amp;
od_misu=$od_misu&amp
;od_cancel_price=$od_cancel_price&amp;
od_refund_price=$od_refund_price&amp;
od_receipt_point=$od_receipt_point&amp;
od_coupon=$od_coupon&amp;
fr_date=$fr_date&amp;
to_date=$to_date&amp;
sel_field=$sel_field&amp;
search=$search&amp;
save_search=$search";
if($default['de_escrow_use'])
$qstr1 .= "&amp;od_escrow=$od_escrow";
$qstr = "$qstr1&amp;sort1=$sort1&amp;sort2=$sort2&amp;page=$page";
$listall = '<a href="'.$_SERVER['SCRIPT_NAME'].'" class="ov_listall">전체목록</a>';
// 주문삭제 히스토리 테이블 필드 추가
if(!sql_query(" SELECT mb_id FROM {$g5['g5_shop_order_delete_table']} LIMIT 1 ", false)) {
sql_query(" ALTER TABLE `{$g5['g5_shop_order_delete_table']}`
ADD `mb_id` varchar(20) NOT NULL DEFAULT '' AFTER `de_data`,
ADD `de_ip` varchar(255) NOT NULL DEFAULT '' AFTER `mb_id`,
ADD `de_datetime` datetime NOT NULL DEFAULT '0000-00-00 00:00:00' AFTER `de_ip` ", true);
}
?>
<div class="local_ov01 local_ov">
<?php echo $listall; ?>
<span class="btn_ov01"><span class="ov_txt">전체 주문내역</span><span class="ov_num"> <?php echo number_format($total_count); ?>건</span></span>
<?php if($od_status == '준비' && $total_count > 0) { ?>
<a href="./orderdelivery.php" id="order_delivery" class="ov_a">엑셀배송처리</a>
<?php } ?>
<div class="list_excel">
<form method="post" action="orderlist_ex.php">
<input type="hidden" name="sql_common" value="<?=$sql_common?>">
<input type="hidden" name="sort1" value="<?=$sort1?>">
<input type="hidden" name="sort2" value="<?=$sort2?>">
<input type="hidden" name="from_record" value="<?=$from_record?>">
<input type="hidden" name="rows" value="<?=$rows?>" >
<input type="submit" value="엑셀저장" class="list_excel">
</form>
</div>
</div>
<form name="frmorderlist" class="local_sch01 local_sch">
<input type="hidden" name="doc" value="<?php echo $doc; ?>">
<input type="hidden" name="sort1" value="<?php echo $sort1; ?>">
<input type="hidden" name="sort2" value="<?php echo $sort2; ?>">
<input type="hidden" name="page" value="<?php echo $page; ?>">
<input type="hidden" name="save_search" value="<?php echo $search; ?>">
<label for="sel_field" class="sound_only">검색대상</label>
<select name="sel_field" id="sel_field">
<option value="od_id" <?php echo get_selected($sel_field, 'od_id'); ?>>주문번호</option>
<option value="mb_id" <?php echo get_selected($sel_field, 'mb_id'); ?>>회원 ID</option>
<option value="od_name" <?php echo get_selected($sel_field, 'od_name'); ?>>주문자</option>
<option value="od_tel" <?php echo get_selected($sel_field, 'od_tel'); ?>>주문자전화</option>
<option value="od_hp" <?php echo get_selected($sel_field, 'od_hp'); ?>>주문자핸드폰</option>
<!--<option value="od_b_name" <?php echo get_selected($sel_field, 'od_b_name'); ?>>받는분</option>-->
<option value="od_b_tel" <?php echo get_selected($sel_field, 'od_b_tel'); ?>>받는분전화</option>
<option value="od_b_hp" <?php echo get_selected($sel_field, 'od_b_hp'); ?>>받는분핸드폰</option>
<option value="od_deposit_name" <?php echo get_selected($sel_field, 'od_deposit_name'); ?>>입금자</option>
<!-- <option value="od_invoice" <?php echo get_selected($sel_field, 'od_invoice'); ?>>운송장번호</option>-->
<option value="od_app_no" <?php echo get_selected($sel_field, 'od_app_no'); ?>>승인번호</option>
</select>
<label for="search" class="sound_only">검색어<strong class="sound_only"> 필수</strong></label>
<input type="text" name="search" value="<?php echo $search; ?>" id="search" required class="required frm_input" autocomplete="off">
<input type="submit" value="검색" class="btn_submit">
</form>
<form class="local_sch03 local_sch">
<div>
<strong>주문상태</strong>
<input type="radio" name="od_status" value="" id="od_status_all" <?php echo get_checked($od_status, ''); ?>>
<label for="od_status_all">전체</label>
<input type="radio" name="od_status" value="입금" id="od_status_income" <?php echo get_checked($od_status, '입금'); ?>>
<label for="od_status_income">결제완료</label>
<input type="radio" name="od_status" value="완료" id="od_status_done" <?php echo get_checked($od_status, '완료'); ?>>
<label for="od_status_done">사용완료</label>
<input type="radio" name="od_status" value="전체취소" id="od_status_cancel" <?php echo get_checked($od_status, '전체취소'); ?>>
<label for="od_status_cancel">취소</label>
</div>
<div class="sch_last">
<strong>주문일자</strong>
<input type="text" id="fr_date" name="fr_date" value="<?php echo $fr_date; ?>" class="frm_input" size="10" maxlength="10"> ~
<input type="text" id="to_date" name="to_date" value="<?php echo $to_date; ?>" class="frm_input" size="10" maxlength="10">
<button type="button" onclick="javascript:set_date('오늘');">오늘</button>
<button type="button" onclick="javascript:set_date('어제');">어제</button>
<button type="button" onclick="javascript:set_date('이번주');">이번주</button>
<button type="button" onclick="javascript:set_date('이번달');">이번달</button>
<button type="button" onclick="javascript:set_date('지난주');">지난주</button>
<button type="button" onclick="javascript:set_date('지난달');">지난달</button>
<button type="button" onclick="javascript:set_date('전체');">전체</button>
<input type="submit" value="검색" class="btn_submit">
</div>
</form>
<form name="forderlist" id="forderlist" onsubmit="return forderlist_submit(this);" method="post" autocomplete="off">
<input type="hidden" name="search_od_status" value="<?php echo $od_status; ?>">
<!-- 목록 시작 -->
<div class="tbl_head01 tbl_wrap">
<table id="sodr_list">
<caption>주문 내역 목록</caption>
<thead>
<tr>
<th scope="col">
<label for="chkall" class="sound_only">주문 전체</label>
<input type="checkbox" name="chkall" value="1" id="chkall" onclick="check_all(this.form)">
</th>
<!-- <th scope="col" id="th_ordnum" style="width:200px;"><a href="<?php echo title_sort("od_id", 1)."&amp;$qstr1"; ?>">주문번호</a></th>-->
<th scope="col" id="th_odrer">주문일</th>
<th scope="col" id="th_odrer" style="width:240px;">상품명<br>(옵션)</th>
<th scope="col" id="th_odrer">주문자</th>
<th scope="col" id="th_odrertel">주문자전화</th>
<th scope="col" style="width:85px;">단가<br>(옵션가)</th>
<th scope="col" style="width:62px;">주문수량</th>
<th scope="col" style="width:85px;">합계</th>
<!-- <th scope="col">입금합계</th>-->
<th scope="col" style="width:62px;">상태</th>
<th scope="col" style="width:61px;">상세</th>
</tr>
</thead>
<tbody>
<?php
for ($i=0; $row=sql_fetch_array($result); $i++)
{
// 결제 수단
$s_receipt_way = $s_br = "";
if ($row['od_settle_case'])
{
$s_receipt_way = $row['od_settle_case'];
$s_br = '<br />';
// 간편결제
if($row['od_settle_case'] == '간편결제') {
switch($row['od_pg']) {
case 'lg':
$s_receipt_way = 'PAYNOW';
break;
case 'inicis':
$s_receipt_way = 'KPAY';
break;
case 'kcp':
$s_receipt_way = 'PAYCO';
break;
default:
$s_receipt_way = $row['od_settle_case'];
break;
}
}
}
else
{
$s_receipt_way = '결제수단없음';
$s_br = '<br />';
}
if ($row['od_receipt_point'] > 0)
$s_receipt_way .= $s_br."포인트";
$mb_nick = get_sideview($row['mb_id'], get_text($row['od_name']), $row['od_email'], '');
$od_cnt = 0;
if ($row['mb_id'])
{
$sql2 = " select count(*) as cnt from {$g5['g5_shop_order_table']} where mb_id = '{$row['mb_id']}' ";
$row2 = sql_fetch($sql2);
$od_cnt = $row2['cnt'];
}
// 주문 번호에 device 표시
$od_mobile = '';
if($row['od_mobile'])
$od_mobile = '(M)';
// 주문번호에 - 추가
switch(strlen($row['od_id'])) {
case 16:
$disp_od_id = substr($row['od_id'],0,8).'-'.substr($row['od_id'],8);
break;
default:
$disp_od_id = substr($row['od_id'],0,6).'-'.substr($row['od_id'],6);
break;
}
// 주문 번호에 에스크로 표시
$od_paytype = '';
if($row['od_test'])
$od_paytype .= '<span class="list_test">테스트</span>';
if($default['de_escrow_use'] && $row['od_escrow'])
$od_paytype .= '<span class="list_escrow">에스크로</span>';
$uid = md5($row['od_id'].$row['od_time'].$row['od_ip']);
$invoice_time = is_null_time($row['od_invoice_time']) ? G5_TIME_YMDHIS : $row['od_invoice_time'];
$delivery_company = $row['od_delivery_company'] ? $row['od_delivery_company'] : $default['de_delivery_company'];
$bg = 'bg'.($i%2);
$td_color = 0;
if($row['od_cancel_price'] > 0) {
$bg .= 'cancel';
$td_color = 1;
}
?>
<!-- 목록 내용 시작 -->
<tr class="orderlist<?php echo ' '.$bg; ?>">
<td class="td_chk">
<input type="hidden" name="od_id[<?php echo $i ?>]" value="<?php echo $row['od_id'] ?>" id="od_id_<?php echo $i ?>">
<label for="chk_<?php echo $i; ?>" class="sound_only">주문번호 <?php echo $row['od_id']; ?></label>
<input type="checkbox" name="chk[]" value="<?php echo $i ?>" id="chk_<?php echo $i ?>">
</td>
<!--<?php /*
<td headers="th_ordnum" class="td_odrnum2">
<?php if ($is_admin == 'super'){ ?>
<a href="<?php echo G5_SHOP_URL; ?>/orderinquiryview.php?od_id=<?php echo $row['od_id']; ?>&amp;uid=<?php echo $uid; ?>" class="orderitem"><?php echo $disp_od_id; ?></a>
<?php } else { echo $disp_od_id; }?>
<?php echo $od_mobile; ?>
<?php echo $od_paytype; ?>
</td>
*/ ?> -->
<td headers="th_ordnum" class="td_odrnum2"><?php echo substr($row['od_receipt_time'],0,10);?></td>
<td headers="th_ordnum" class="td_odrnum2"><?php
echo $row['it_name'];
echo ($row['io_id']) ? '<br>('.$row['io_id'].')' : ''; ?></td>
<td headers="th_odrer" class="td_name"><?php echo $mb_nick; ?></td>
<td headers="th_odrertel" class="td_tel" style="text-align:center;"><?php echo add_hyphen(get_text($row['od_tel'])); ?></td>
<td headers="th_odrcnt"><?php echo number_format($row['ct_price']);
echo ($row['io_price'])? '<br>('.number_format($row['io_price']).')' : '';
?></td>
<td headers="th_odrcnt"><?php echo $row['ct_qty']; ?></td>
<td class="td_num td_numsum">
<?php echo number_format(($row['ct_price'] + $row['io_price']) * $row['ct_qty']); ?>
<?php // echo number_format($row['od_cart_price'] + $row['od_send_cost'] + $row['od_send_cost2']); // 같은 승인번호의 결제건 여러개가 있는 경우 금액이 알아보기 불편함 ?></td>
<!--<?php /* <td class="td_num_right"><?php echo number_format($row['od_receipt_price']); ?></td>*/?>-->
<td class="td_mng td_mng_s">
<?php
// 상태 출력
if ($row['it_2'] && (substr($row['od_receipt_time'],0,10) == date('Y-m-d'))) { // 당일주문 사용불가 대상 & 당일주문 체크
echo '<font color="red">당일주문<br>사용불가</font>';
} else if ($row['od_status'] == "입금") {
echo "결제완료<br>";
if ($row['od_status'] == '입금' && $row['it_1'] < date("ymd") || $row['it_1'] == "") { // 상태가 '입금' 이면서 유효기간이 지정되어있고 지난경우
echo '<font color="red">유효기간 종료</font><br>(유효일자:'.$row['it_1'].')';
}
} else if ($row['od_status'] == "완료" ) {
echo '<font color="#999">사용완료</font>';
// 완료처리 시간을 기록해야 할 듯
} else if ($row['od_status'] == "취소" ) {
echo '<font color="#ccc">취소</font>';
// 완료처리 시간을 기록해야 할 듯
}
//사용처리 버튼 끝
/* <a href="orderliveupdate.php?bo=u&it_id=<?php echo $row[od_id]; ?>&st=<?php echo $row[od_status];?>" class="mng_mod btn btn_04"><span class="sound_only"><?php echo $row['od_id']; ?></span>사용</a>*/
?>
</td>
<td class="td_mng td_mng_s">
<a href="./orderform.php?od_id=<?php echo $row['od_id']; ?>&amp;<?php echo $qstr; ?>" class="mng_mod btn btn_02"><span class="sound_only"><?php echo $row['od_id']; ?> </span>보기</a>
</td>
</tr>
<?php
$tot_itemcount += $row['od_cart_count'];
$tot_orderprice += (($row['ct_price'] + $row['io_price']) * $row['ct_qty']);
// $tot_orderprice += ($row['od_cart_price'] + $row['od_send_cost'] + $row['od_send_cost2']);
$tot_ordercancel += $row['od_cancel_price'];
$tot_receiptprice += $row['od_receipt_price'];
$tot_couponprice += $row['couponprice'];
}
sql_free_result($result);
if ($i == 0)
echo '<tr><td colspan="11" class="empty_table">자료가 없습니다.</td></tr>';
?>
</tbody>
<tfoot>
<tr class="orderlist">
<th scope="row" colspan="6">합 계</th>
<td><?php echo number_format($tot_itemcount); ?>건</td>
<td><?php echo number_format($tot_orderprice); ?></td>
<!-- <td><?php echo number_format($tot_receiptprice); ?></td>-->
<td colspan="2"></td>
</tr>
</tfoot>
</table>
</div>
<div class="local_desc02 local_desc">
<p>
<!--&lt;사용&gt;버튼을 클릭하면 티켓 사용처리가 완료됩니다. 부분사용, 부분취소가 불가능하므로 이용수량이 다른 경우 고객님께 꼭 확인해주시기 바랍니다.-->
</p>
</div>
</form>
<?php echo get_paging(G5_IS_MOBILE ? $config['cf_mobile_pages'] : $config['cf_write_pages'], $page, $total_page, "{$_SERVER['SCRIPT_NAME']}?$qstr&amp;page="); ?>
<script>
$(function(){
$("#fr_date, #to_date").datepicker({ changeMonth: true, changeYear: true, dateFormat: "yy-mm-dd", showButtonPanel: true, yearRange: "c-99:c+99", maxDate: "+0d" });
// 주문상품보기
$(".orderitem").on("click", function() {
var $this = $(this);
var od_id = $this.text().replace(/[^0-9]/g, "");
if($this.next("#orderitemlist").size())
return false;
$("#orderitemlist").remove();
$.post(
"./ajax.orderitem.php",
{ od_id: od_id },
function(data) {
$this.after("<div id=\"orderitemlist\"><div class=\"itemlist\"></div></div>");
$("#orderitemlist .itemlist")
.html(data)
.append("<div id=\"orderitemlist_close\"><button type=\"button\" id=\"orderitemlist-x\" class=\"btn_frmline\">닫기</button></div>");
}
);
return false;
});
// 상품리스트 닫기
$(".orderitemlist-x").on("click", function() {
$("#orderitemlist").remove();
});
$("body").on("click", function() {
$("#orderitemlist").remove();
});
// 엑셀배송처리창
$("#order_delivery").on("click", function() {
var opt = "width=600,height=450,left=10,top=10";
window.open(this.href, "win_excel", opt);
return false;
});
});
function set_date(today)
{
<?php
$date_term = date('w', G5_SERVER_TIME);
$week_term = $date_term + 7;
$last_term = strtotime(date('Y-m-01', G5_SERVER_TIME));
?>
if (today == "오늘") {
document.getElementById("fr_date").value = "<?php echo G5_TIME_YMD; ?>";
document.getElementById("to_date").value = "<?php echo G5_TIME_YMD; ?>";
} else if (today == "어제") {
document.getElementById("fr_date").value = "<?php echo date('Y-m-d', G5_SERVER_TIME - 86400); ?>";
document.getElementById("to_date").value = "<?php echo date('Y-m-d', G5_SERVER_TIME - 86400); ?>";
} else if (today == "이번주") {
document.getElementById("fr_date").value = "<?php echo date('Y-m-d', strtotime('-'.$date_term.' days', G5_SERVER_TIME)); ?>";
document.getElementById("to_date").value = "<?php echo date('Y-m-d', G5_SERVER_TIME); ?>";
} else if (today == "이번달") {
document.getElementById("fr_date").value = "<?php echo date('Y-m-01', G5_SERVER_TIME); ?>";
document.getElementById("to_date").value = "<?php echo date('Y-m-d', G5_SERVER_TIME); ?>";
} else if (today == "지난주") {
document.getElementById("fr_date").value = "<?php echo date('Y-m-d', strtotime('-'.$week_term.' days', G5_SERVER_TIME)); ?>";
document.getElementById("to_date").value = "<?php echo date('Y-m-d', strtotime('-'.($week_term - 6).' days', G5_SERVER_TIME)); ?>";
} else if (today == "지난달") {
document.getElementById("fr_date").value = "<?php echo date('Y-m-01', strtotime('-1 Month', $last_term)); ?>";
document.getElementById("to_date").value = "<?php echo date('Y-m-t', strtotime('-1 Month', $last_term)); ?>";
} else if (today == "전체") {
document.getElementById("fr_date").value = "";
document.getElementById("to_date").value = "";
}
}
</script>
<script>
function forderlist_submit(f)
{
if (!is_checked("chk[]")) {
alert(document.pressed+" 하실 항목을 하나 이상 선택하세요.");
return false;
}
var change_status = f.od_status.value;
if (f.od_status.checked == false) {
alert("주문상태 변경에 체크하세요.");
return false;
}
var chk = document.getElementsByName("chk[]");
for (var i=0; i<chk.length; i++)
{
if (chk[i].checked)
{
var k = chk[i].value;
var current_settle_case = f.elements['current_settle_case['+k+']'].value;
var current_status = f.elements['current_status['+k+']'].value;
switch (change_status)
{
case "입금" :
if (!(current_status == "주문" && current_settle_case == "무통장")) {
alert("'주문' 상태의 '무통장'(결제수단)인 경우에만 '입금' 처리 가능합니다.");
return false;
}
break;
case "준비" :
if (current_status != "입금") {
alert("'입금' 상태의 주문만 '준비'로 변경이 가능합니다.");
return false;
}
break;
case "배송" :
if (current_status != "준비") {
alert("'준비' 상태의 주문만 '배송'으로 변경이 가능합니다.");
return false;
}
var invoice = f.elements['od_invoice['+k+']'];
var invoice_time = f.elements['od_invoice_time['+k+']'];
var delivery_company = f.elements['od_delivery_company['+k+']'];
if ($.trim(invoice_time.value) == '') {
alert("배송일시를 입력하시기 바랍니다.");
invoice_time.focus();
return false;
}
if ($.trim(delivery_company.value) == '') {
alert("배송업체를 입력하시기 바랍니다.");
delivery_company.focus();
return false;
}
if ($.trim(invoice.value) == '') {
alert("운송장번호를 입력하시기 바랍니다.");
invoice.focus();
return false;
}
break;
}
}
}
if (!confirm("선택하신 주문서의 주문상태를 '"+change_status+"'상태로 변경하시겠습니까?"))
return false;
f.action = "./orderlistupdate_ticket.php";
return true;
}
</script>
<?php
include_once (G5_ADMIN_PATH.'/admin.tail.php');
?>

View File

@ -0,0 +1,262 @@
<?php
$sub_menu = '998413';
include_once('./_common.php');
auth_check($auth[$sub_menu], "r");
$g5['title'] = '완료주문확인';
include_once (G5_ADMIN_PATH.'/admin.head.php');
include_once(G5_PLUGIN_PATH.'/jquery-ui/datepicker.php');
$where = array();
// 퍼스트가든용
// 특정 카테고리만 노출 제외를 위한 부분
$ca_id = "20"; // 특정 카테고리 선택
$sel_ca_id = "NOT ca_id = $ca_id "; // 특정 카테고리 노출만 하려면 NOT을 지운다. 카테고리는 '분류관리'에서 확인, 최상위 카테고리 기준. 값을 추가할땐 or 을 사용하면 될듯.
$tot_ct_qty = 0;
$where[] = "$sel_ca_id"; // 배열에 검색문을 넣어준다
$od_status = '완료'; //입금처리 된것만 출력한다.
$where[] = " a.od_status = '{$od_status}' ";
// 퍼스트가든용 끝
include_once (G5_ADMIN_PATH.'/fg_admin/orderlist.head.php');
$sql_search = "";
if ($search != "") {
if ($sel_field != "") {
$where[] = " $sel_field like '%$search%' ";
}
if ($save_search != $search) {
$page = 1;
}
}
if ($where) {
$sql_search = ' WHERE '.implode(' AND ', $where);
}
if ($sel_field == "") $sel_field = "a.od_id";
if ($sort1 == "") $sort1 = "a.od_id";
if ($sort2 == "") $sort2 = "desc";
// 상품명, 단가, 수량, 카테고리를 불러오기 위해 DB를 합친다
$sql_common = " FROM {$g5['g5_shop_order_table']} AS a
LEFT JOIN {$g5['g5_shop_cart_table']} AS b ON a.od_id = b.od_id
LEFT JOIN {$g5['g5_shop_item_table']} AS c ON b.it_id = c.it_id
LEFT JOIN {$g5['g5_shop_item_option_table']} AS d ON c.it_id = d.it_id AND b.io_id = d.io_id
";
$sql_common .= $sql_search;
$sql = " SELECT count(a.od_id) AS cnt " . $sql_common ;
$row = sql_fetch($sql);
$total_count = $row['cnt'];
$rows = $config['cf_page_rows'];
$total_page = ceil($total_count / $rows); // 전체 페이지 계산
if ($page < 1) { $page = 1; } // 페이지가 없으면 첫 페이지 (1 페이지)
$from_record = ($page - 1) * $rows; // 시작 열을 구함
// 상품명, 수량, 단가, 카테고리를 가져옴
$sql = " SELECT a.*,
(a.od_cart_coupon + a.od_coupon + a.od_send_coupon) as couponprice,
b.it_name,
b.ct_qty,
b.ct_price,
b.ct_option,
b.io_id,
c.ca_id,
c.it_1,
c.it_2,
d.io_price
$sql_common
ORDER BY $sort1 $sort2
LIMIT $from_record, $rows ";
$result = sql_query($sql);
$qstr1 = "od_status=".urlencode($od_status)."&amp;
od_settle_case=".urlencode($od_settle_case)."&amp;
od_misu=$od_misu&amp
;od_cancel_price=$od_cancel_price&amp;
od_refund_price=$od_refund_price&amp;
od_receipt_point=$od_receipt_point&amp;
od_coupon=$od_coupon&amp;
fr_date=$fr_date&amp;
to_date=$to_date&amp;
sel_field=$sel_field&amp;
search=$search&amp;
save_search=$search";
if($default['de_escrow_use'])
$qstr1 .= "&amp;od_escrow=$od_escrow";
$qstr = "$qstr1&amp;sort1=$sort1&amp;sort2=$sort2&amp;page=$page";
$listall = '<a href="'.$_SERVER['SCRIPT_NAME'].'" class="ov_listall">전체목록</a>';
// 주문삭제 히스토리 테이블 필드 추가
if(!sql_query(" SELECT mb_id FROM {$g5['g5_shop_order_delete_table']} LIMIT 1 ", false)) {
sql_query(" ALTER TABLE `{$g5['g5_shop_order_delete_table']}`
ADD `mb_id` varchar(20) NOT NULL DEFAULT '' AFTER `de_data`,
ADD `de_ip` varchar(255) NOT NULL DEFAULT '' AFTER `mb_id`,
ADD `de_datetime` datetime NOT NULL DEFAULT '0000-00-00 00:00:00' AFTER `de_ip` ", true);
}
?>
<style>
#container { height: unset;}
</style>
<form name="frmorderlist" class="local_sch01 local_sch">
<input type="hidden" name="doc" value="<?php echo $doc; ?>">
<input type="hidden" name="sort1" value="<?php echo $sort1; ?>">
<input type="hidden" name="sort2" value="<?php echo $sort2; ?>">
<input type="hidden" name="page" value="<?php echo $page; ?>">
<input type="hidden" name="save_search" value="<?php echo $search; ?>">
<label for="sel_field" class="sound_only">검색대상</label>
<select name="sel_field" id="sel_field">
<option value="od_tel" <?php echo get_selected($sel_field, 'od_tel'); ?> selected>연락처</option>
<option value="od_name" <?php echo get_selected($sel_field, 'od_name'); ?>>주문자</option>
<option value="od_id" <?php echo get_selected($sel_field, 'od_id'); ?>>주문번호</option>
</select>
<label for="search" class="sound_only">검색어<strong class="sound_only"> 필수</strong></label>
<input type="text" name="search" value="<?php echo $search; ?>" id="search" class="frm_input" autocomplete="off">
<input type="submit" value="검색" class="btn_submit">
</form>
<form class="local_sch03 local_sch">
<!--
<div class="sch_last"">
<strong>주문일자</strong>
<input type="text" id="fr_date" name="fr_date" value="<?php echo $fr_date; ?>" class="frm_input" size="10" maxlength="10"> ~
<input type="text" id="to_date" name="to_date" value="<?php echo $to_date; ?>" class="frm_input" size="10" maxlength="10">
<button type="button" onclick="javascript:set_date('오늘');">오늘</button>
<button type="button" onclick="javascript:set_date('어제');">어제</button>
<button type="button" onclick="javascript:set_date('이번주');">이번주</button>
<button type="button" onclick="javascript:set_date('이번달');">이번달</button>
<button type="button" onclick="javascript:set_date('지난주');">지난주</button>
<button type="button" onclick="javascript:set_date('지난달');">지난달</button>
<button type="button" onclick="javascript:set_date('전체');">전체</button>
<input type="submit" value="검색" class="btn_submit">
</div>
</form>
-->
<div>
<form method="post" action="orderlist_chk_ex.php">
<input type="hidden" name="sql_common" value="<?=$sql_common?>">
<input type="hidden" name="sort1" value="<?=$sort1?>">
<input type="hidden" name="sort2" value="<?=$sort2?>">
<input type="hidden" name="from_record" value="<?=$from_record?>">
<input type="hidden" name="rows" value="<?=$rows?>" >
<button type="submit" class="list_excel" >엑셀</button>
<!-- <input type="submit" value="엑셀저장" class="list_excel">-->
</form>
</div>
<form name="forderlist" id="forderlist" onsubmit="return forderlist_submit(this);" method="post" autocomplete="off">
<input type="hidden" name="search_od_status" value="<?php echo $od_status; ?>">
<!-- 목록 시작 -->
<div class="tbl_head01 tbl_wrap">
<table id="sodr_list">
<caption>주문 내역 목록</caption>
<thead>
<tr>
<th scope="col">
<label for="chkall" class="sound_only">주문 전체</label>
<input type="checkbox" name="chkall" value="1" id="chkall" onclick="check_all(this.form)">
</th>
<!-- <th scope="col" id="th_ordnum" style="width:200px;"><a href="<?php echo title_sort("od_id", 1)."&amp;$qstr1"; ?>">주문번호</a></th>-->
<th scope="col" id="th_odrer">주문일</th>
<th scope="col" id="th_odrer" style="width:240px;">상품명</th>
<th scope="col" id="th_odrer">옵션</th>
<th scope="col" id="th_odrer">주문자</th>
<th scope="col" id="th_odrertel">주문자전화</th>
<th scope="col" style="width:85px;">단가</th>
<th scope="col" style="width:62px;">주문수량</th>
<th scope="col" style="width:85px;">합계</th>
<!-- <th scope="col">입금합계</th>-->
<th scope="col" style="min-width:62px;">상태</th>
<th scope="col" style="min-width:62px;">상세</th>
</tr>
</thead>
<tbody>
<?php
for ($i=0; $row=sql_fetch_array($result); $i++)
{
$mb_nick = get_sideview($row['mb_id'], get_text($row['od_name']), $row['od_email'], '');
?>
<!-- 목록 내용 시작 -->
<tr class="orderlist<?php echo ' '.$bg; ?>">
<td class="td_chk">
<input type="hidden" name="od_id[<?php echo $i ?>]" value="<?php echo $row['od_id'] ?>" id="od_id_<?php echo $i ?>">
<label for="chk_<?php echo $i; ?>" class="sound_only">주문번호 <?php echo $row['od_id']; ?></label>
<input type="checkbox" name="chk[]" value="<?php echo $i ?>" id="chk_<?php echo $i ?>">
</td>
<!--
<td headers="th_ordnum" class="td_odrnum2">
<?php if ($is_admin == 'super'){ ?>
<a href="<?php echo G5_SHOP_URL; ?>/orderinquiryview.php?od_id=<?php echo $row['od_id']; ?>&amp;uid=<?php echo $uid; ?>" class="orderitem"><?php echo $disp_od_id; ?></a>
<?php } else { echo $disp_od_id; }?>
<?php echo $od_mobile; ?>
<?php echo $od_paytype; ?>
</td>
-->
<td headers="th_ordnum" class="td_odrnum2"><?php echo substr($row['od_receipt_time'],0,10) ?></td>
<td headers="th_ordnum" class="td_odrnum2"><?php echo $row['it_name'] ?></td>
<td heardrs="th_ordnum" class="td_odrnum2"><?php echo ($row['io_id']) ? $row['io_id'] : '' ?> </td>
<td headers="th_odrer" class="td_name"><?php echo $mb_nick; ?></td>
<td headers="th_odrertel" class="td_tel" style="text-align:center;"><?php echo add_hyphen(get_text($row['od_tel'])); ?></td>
<td headers="th_odrcnt"><?php echo ($row['io_price']) ? number_format($row['ct_price']+$row['io_price']) : number_format($row['ct_price']) ?></td>
<td headers="th_odrcnt"><?php echo $row['ct_qty']; ?></td>
<td class="td_num td_numsum">
<?php echo number_format(($row['ct_price'] + $row['io_price']) * $row['ct_qty']); ?>
<?php // echo number_format($row['od_cart_price'] + $row['od_send_cost'] + $row['od_send_cost2']); // 같은 승인번호의 결제건 여러개가 있는 경우 금액이 알아보기 불편함 ?></td>
<!-- <td class="td_num_right"><?php echo number_format($row['od_receipt_price']); ?></td>-->
<td class="td_mng td_mng_s"><?php echo $row['od_status'] ?></td>
<td class="td_mng td_mng_s">
<a href="./orderform.php?od_id=<?php echo $row['od_id']; ?>&amp;<?php echo $qstr; ?>" class="mng_mod btn btn_02"><span class="sound_only"><?php echo $row['od_id']; ?> </span>보기</a>
</td>
</tr>
<?php
$tot_itemcount += $row['od_cart_count'];
$tot_orderprice += (($row['ct_price'] + $row['io_price']) * $row['ct_qty']);
// $tot_orderprice += ($row['od_cart_price'] + $row['od_send_cost'] + $row['od_send_cost2']);
$tot_ordercancel += $row['od_cancel_price'];
$tot_receiptprice += $row['od_receipt_price'];
$tot_couponprice += $row['couponprice'];
$tot_ct_qty += $row['ct_qty'];
}
sql_free_result($result);
if ($i == 0)
echo '<tr><td colspan="11" class="empty_table">자료가 없습니다.</td></tr>';
?>
</tbody>
<tfoot>
<tr class="orderlist">
<th scope="row" colspan="7">합 계</th>
<td><?php echo $tot_ct_qty //number_format($tot_itemcount); ?>건</td>
<td><?php echo number_format($tot_orderprice); ?></td>
<!-- <td><?php echo number_format($tot_receiptprice); ?></td>-->
<td colspan="2"></td>
</tr>
</tfoot>
</table>
</div>
<div class="local_desc02 local_desc">
<p>
&lt;사용&gt;버튼을 클릭하면 티켓 사용처리가 완료됩니다. 부분사용, 부분취소가 불가능하므로 이용수량이 다른 경우 고객님께 꼭 확인해주시기 바랍니다.
</p>
</div>
</form>
<?php echo get_paging(G5_IS_MOBILE ? $config['cf_mobile_pages'] : $config['cf_write_pages'], $page, $total_page, "{$_SERVER['SCRIPT_NAME']}?$qstr&amp;page="); ?>
<?php
include_once ('orderlist_tail.php');
include_once (G5_ADMIN_PATH.'/admin.tail.php');

Some files were not shown because too many files have changed in this diff Show More