Files
firstgarden-web-gnu/adm/fg_admin/orderlist_ticket_ex.php

213 lines
9.2 KiB
PHP

<?php
include_once('./_common.php');
$file_name = "orderlist_".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 = " 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,
c.ca_id
$sql_common
ORDER BY $sort1 $sort2
";
$sql= stripslashes($sql);
$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">
<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>
</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;
}
}
}
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>
<!--
<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>
<?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>