파일을 직접수정하지 않고 hook을 사용해 관리자 메뉴 추가.

기존 shop_admin 에 포함되어있던 새 파일을 fg_admin 폴더 내부로 이동
관리자 월 정산용 페이지 오작동 문제 해결
This commit is contained in:
2025-12-11 10:40:20 +09:00
parent 8ea1ab51fc
commit d125d39965
18 changed files with 208 additions and 3186 deletions

View File

@ -1,9 +1,9 @@
<?php
$sub_menu = '998413';
include_once('./_common.php');
//auth_check($auth[$sub_menu], "r");
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');
@ -13,14 +13,33 @@ $where = array();
// 퍼스트가든용
// $od_status = '입금'; //입금처리 된것만 출력한다.
// 특정 카테고리만 노출
$ca_id = "10"; // 특정 카테고리 선택
$sel_ca_id = " NOT ca_id = $ca_id "; // 특정 카테고리 노출만 하려면 NOT을 지운다.
$where[] = "$sel_ca_id"; // 배열에 검색문을 넣어준다
#$ca_id = "30"; // 특정 카테고리 선택
#$sel_ca_id = " NOT ca_id = $ca_id "; // 특정 카테고리 노출만 하려면 NOT을 지운다.
$tot_ct_qty = 0;
// 기존: $where[] = "$sel_ca_id"; // 배열에 검색문을 넣어준다
// 변경: sel_ca_id가 비어있지 않을 때만 WHERE조건에 추가
if (!empty($sel_ca_id)) {
$where[] = $sel_ca_id;
}
//$od_status = '입금'; //입금처리 된것만 출력한다.
//$where[] = " a.od_status = '{$od_status}' ";
// 시작일이 설정되지 않았다면: 지난달 1일
if (!isset($fr_date)) {
$fr_date = date("Y-m-01", strtotime("first day of last month", G5_SERVER_TIME));
}
// 종료일이 설정되지 않았다면: 지난달 마지막 날
if (!isset($to_date)) {
$to_date = date("Y-m-t", strtotime("last month", G5_SERVER_TIME));
}
// 퍼스트가든용 끝
include_once (G5_ADMIN_PATH.'/fg_admin/orderlist.head.php');
include_once ('orderlist_head.php');
$sql_search = "";
if ($search != "") {
@ -35,8 +54,8 @@ if ($search != "") {
// od_status가 입금, 완료인 것만 출력함
$where[] = " a.od_status IN('완료') ";
$where[] = " a.od_status IN('입금','완료') ";
/*
if ($od_settle_case) {
$where[] = " a.od_settle_case = '$od_settle_case' ";
}
@ -64,7 +83,7 @@ if ($od_coupon) {
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' ";
}
@ -79,52 +98,57 @@ 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
";
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'];
// 기존: 페이징용 count 쿼리 및 LIMIT 처리로 인해 일부 결과만 집계되는 문제가 있어 전체 결과 조회로 변경
// $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'];
// $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; // 시작 열을 구함
// $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
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 ";
ORDER BY $sort1 $sort2 ";
$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";
// qstr 생성부가 불완전하게 작성되어 있어 안전하게 재작성
$qarr = array(
'od_status' => $od_status,
'od_settle_case' => $od_settle_case,
'od_misu' => $od_misu,
'od_cancel_price' => $od_cancel_price,
'od_refund_price' => $od_refund_price,
'od_receipt_point' => $od_receipt_point,
'od_coupon' => $od_coupon,
'fr_date' => $fr_date,
'to_date' => $to_date,
'sel_field' => $sel_field,
'search' => $search,
'save_search' => $search
);
// http_build_query로 생성 후 HTML용으로 & -> &amp; 변환
$qstr1 = str_replace('&', '&amp;', http_build_query($qarr));
if($default['de_escrow_use'])
$qstr1 .= "&amp;od_escrow=$od_escrow";
@ -135,6 +159,7 @@ $listall = '<a href="'.$_SERVER['SCRIPT_NAME'].'" class="ov_listall">전체목
?>
<!--
<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; ?>">
@ -153,8 +178,9 @@ $listall = '<a href="'.$_SERVER['SCRIPT_NAME'].'" class="ov_listall">전체목
<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"">
<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">
@ -209,7 +235,7 @@ $listall = '<a href="'.$_SERVER['SCRIPT_NAME'].'" class="ov_listall">전체목
<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="td_num"><?php echo number_format( $totals['quantity'] ? ($totals['total_price'] / $totals['quantity']) : 0 ); ?></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>
@ -222,6 +248,6 @@ $listall = '<a href="'.$_SERVER['SCRIPT_NAME'].'" class="ov_listall">전체목
<?php
include_once (G5_ADMIN_PATH.'/fg_admin/orderlist.tail.php');
include_once ('orderlist_tail.php');
include_once (G5_ADMIN_PATH.'/admin.tail.php');
?>