주문 내역 확인 부분 출력되도록 수정

This commit is contained in:
2025-12-26 12:46:44 +09:00
parent 40c757ea36
commit 4479323b25
4 changed files with 138 additions and 180 deletions

View File

@ -106,26 +106,55 @@ if(!sql_query(" SELECT mb_id FROM {$g5['g5_shop_order_delete_table']} LIMIT 1 ",
?>
<style>
#container { height: unset;}
.search_and_export_wrap {
display: flex;
justify-content: space-between;
align-items: flex-start;
gap: 20px;
margin-bottom: 20px;
}
.search_and_export_wrap form {
flex: 1;
}
.export_btn_wrap {
display: flex;
gap: 10px;
align-items: flex-start;
}
.export_btn_wrap button {
white-space: nowrap;
}
</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; ?>">
<div class="search_and_export_wrap">
<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_hp" <?php echo get_selected($sel_field, 'od_hp'); ?> 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="sel_field" class="sound_only">검색대상</label>
<select name="sel_field" id="sel_field">
<option value="od_hp" <?php echo get_selected($sel_field, 'od_hp'); ?> 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>
<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>
<div class="export_btn_wrap">
<form method="post" action="orderlist_ticket_ex.php" target="_blank">
<input type="hidden" name="sql_common" value="<?php echo htmlspecialchars($sql_common); ?>">
<input type="hidden" name="sort1" value="<?php echo $sort1; ?>">
<input type="hidden" name="sort2" value="<?php echo $sort2; ?>">
<button type="submit" class="btn btn_submit" style="background-color: #4CAF50;">엑셀 다운로드</button>
</form>
</div>
</div>
<!--
<form class="local_sch03 local_sch">
<div class="sch_last"">

View File

@ -1,6 +1,13 @@
<?php
include_once('./_common.php');
auth_check($auth['998411'], "r");
// POST로 전달된 데이터 받기
$sql_common = isset($_POST['sql_common']) ? $_POST['sql_common'] : '';
$sort1 = isset($_POST['sort1']) ? $_POST['sort1'] : 'a.od_id';
$sort2 = isset($_POST['sort2']) ? $_POST['sort2'] : 'desc';
$file_name = "orderlist_".date("ymd")."_".date("His").".xls"; // 파일명지정
header("Content-Type: application/vnd.ms-excel");
@ -14,7 +21,11 @@ $sql = " SELECT a.*,
b.ct_qty,
b.ct_price,
b.ct_option,
c.ca_id
b.io_id,
c.ca_id,
c.it_1,
c.it_2,
d.io_price
$sql_common
ORDER BY $sort1 $sort2
";
@ -25,188 +36,85 @@ $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;}
table { border-collapse: collapse;}
th, td { border: 1px solid #000; padding: 0px; text-align: center; }
th { background-color: #D3D3D3; font-weight: bold; text-align: center; }
tr.bg0 { background-color: #FFFFFF; }
tr.bg1 { background-color: #F0F0F0; }
.empty_table { text-align: center; }
tfoot tr { background-color: #E8E8E8; font-weight: bold; }
.number { mso-number-format:\#\,\#\#0; , text-align: right; }
</style>
<table cellspacing="0" cellpadding="0" border="1">
<table cellspacing="0" cellpadding="0">
<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;">단가<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>
<th style="width: 120px;">주문일</th>
<th style="width: 100px;">주문자</th>
<th style="width: 200px;">주문자전화</th>
<th style="width: 400px;">상품명</th>
<th style="width: 150px;">옵션</th>
<th style="width: 100px;">단가</th>
<th style="width: 100px;">주문수량</th>
<th style="width: 200px;">총금액</th>
</tr>
</thead>
<tbody>
<?php
for ($i=0; $row=sql_fetch_array($result); $i++)
{
// '입금'인 것만 출력
if ($row['od_status'] != '입금') continue;
// 결제 수단
$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;
}
}
$tot_ct_qty = 0;
$tot_orderprice = 0;
$prev_od_id = '';
$bg_class = 'bg0';
for ($i=0; $row=sql_fetch_array($result); $i++) {
// 같은 주문번호 중 첫 번째 행만 출력
if ($row['od_id'] != $prev_od_id) {
$order_date = substr($row['od_receipt_time'], 0, 10);
$order_name = get_text($row['od_name']);
$order_tel = add_hyphen(get_text($row['od_hp']));
// 주문번호가 바뀔 때마다 배경색 토글
$bg_class = ($bg_class === 'bg0') ? 'bg1' : 'bg0';
} else {
$order_date = '';
$order_name = '';
$order_tel = '';
}
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;
}
$it_name = $row['it_name'];
$io_id = isset($row['io_id']) ? $row['io_id'] : '';
$unit_price = $row['io_price'] ? ($row['ct_price'] + $row['io_price']) : $row['ct_price'];
$qty = $row['ct_qty'];
$total_price = $unit_price * $qty;
$tot_ct_qty += $qty;
$tot_orderprice += $total_price;
$prev_od_id = $row['od_id'];
?>
<!-- 목록 내용 시작 -->
<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
// 사용처리
// 사용처리 버튼 출력을 위한 부분
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") && !isset($row['it_1']) || $row['od_status'] == '취소') {
echo "사용불가<br>(";
if( $row['od_status'] == '취소' ) echo "취소)"; // 취소라면
else echo "유효일자:".$row['it_1'].")"; // 유효일자가 지났다면
} else { // 위 조건에 해당하지 않으면 사용처리 버튼 출력
?>
<a href="orderliveupdate.php?bo=u&od_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 } //사용처리 버튼 끝 ?>
</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 class="<?php echo $bg_class; ?>">
<td><?php echo $order_date; ?></td>
<td><?php echo $order_name; ?></td>
<td><?php echo $order_tel; ?></td>
<td><?php echo $it_name; ?></td>
<td><?php echo $io_id; ?></td>
<td class="number"> <?php echo number_format($unit_price); ?></td>
<td style="text-align: center;"> <?php echo $qty; ?></td>
<td class="number"> <?php echo number_format($total_price); ?></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>';
echo '<tr class="bg0"><td colspan="8" 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>
<th colspan="6" style="text-align: center;">합 계</th>
<th style="text-align: center;"><?php echo $tot_ct_qty; ?></th>
<th class="number"><?php echo number_format($tot_orderprice); ?></th>
</tr>
</tfoot>
</table>

View File

@ -42,6 +42,11 @@ if(! function_exists('add_admin_menu_update') ) {
add_replace('admin_menu', 'add_admin_menu_update', 1, 1);
function add_admin_menu_update($menu) {
$menu['menu998'] = array();
array_push($menu['menu400'],
array('400411', '매표소주문확인', G5_ADMIN_URL.'/fg_admin/orderlist_ticket.php', 'firstgarden')
);
array_push($menu['menu998'],
array('998000', '퍼스트가든', G5_ADMIN_URL . '/fg_admin/orderlist_ticket.php', 'firstgarden'),
//array('998010', '베이커리 재고관리', G5_ADMIN_URL . '/fg_admin/bakery/bakery_stock_adm.php', 'firstgarden'),
@ -53,7 +58,7 @@ if(! function_exists('add_admin_menu_update') ) {
array('998411', '매표소주문확인', G5_ADMIN_URL.'/fg_admin/orderlist_ticket.php', 'firstgarden'),
//array('998421', '혜윰주문확인', G5_ADMIN_URL.'/fg_admin/orderlist_hy.php', 'firstgarden'),
//array('998431', 'B2B주문확인', G5_ADMIN_URL.'/fg_admin/orderlist_b2b.php', 'firstgarden'),
array('998412', '관리자주문확인', G5_ADMIN_URL . '/fg_admin/orderlist_admin.php', 'firstgarden'),
//array('998412', '관리자주문확인', G5_ADMIN_URL . '/fg_admin/orderlist_admin.php', 'firstgarden'),
array('998413', '관리자월정산용', G5_ADMIN_URL . '/fg_admin/orderlist_admin_sum.php', 'firstgarden'),
);
return $menu;

View File

@ -1,12 +1,27 @@
<!-- 주문 내역 목록 시작 { -->
<?php if (!$limit) { ?>총 <?php echo $cnt; ?> 건<?php } ?>
<?php
function get_item_name($od_id) {
global $g5;
$sql = " select *
from {$g5['g5_shop_cart_table']}
where od_id = {$od_id}
group by it_id
order by ct_id ";
//$result = sql_query($sql);
$result = sql_fetch($sql);
return $result['it_name'];
}
?>
<div class="tbl_head03 tbl_wrap">
<table>
<thead>
<tr>
<th scope="col">주문번호</th>
<th scope="col">주문일시</th>
<th scope="col">상품명</th>
<th scope="col">상품수</th>
<th scope="col">주문금액</th>
<!--
@ -48,13 +63,14 @@
$od_status = '<span class="status_06">주문취소</span>';
break;
}
?>
?>
<tr>
<td class="text-center">
<a href="<?php echo G5_SHOP_URL; ?>/orderinquiryview.php?od_id=<?php echo $row['od_id']; ?>&amp;uid=<?php echo $uid; ?>" class="font-B"><?php echo $row['od_id']; ?></a>
</td>
<td class="text-center"><?php echo substr($row['od_time'],2,14); ?> (<?php echo get_yoil($row['od_time']); ?>)</td>
<td class="td_name"><?php echo get_item_name($row['od_id']); ?></td>
<td class="td_numbig"><?php echo $row['od_cart_count']; ?></td>
<td class="td_numbig text_right"><?php echo display_price($row['od_cart_price'] + $row['od_send_cost'] + $row['od_send_cost2']); ?></td>
<!--