$sub_menu = '400420';
include_once('./_common.php');
auth_check($auth[$sub_menu], "r");
$g4['title'] = '주문서관리';
include_once (G4_ADMIN_PATH.'/admin.head.php');
$where = " where ";
$sql_search = "";
if ($search != "")
{
if ($sel_field != "")
{
$sql_search .= " $where $sel_field like '%$search%' ";
$where = " and ";
}
if ($save_search != $search)
$page = 1;
}
if ($sel_field == "") $sel_field = "od_id";
if ($sort1 == "") $sort1 = "od_id";
if ($sort2 == "") $sort2 = "desc";
$sql_common = " from {$g4['yc4_order_table']} a
left join {$g4['yc4_cart_table']} b on (a.uq_id=b.uq_id)
$sql_search ";
// 테이블의 전체 레코드수만 얻음
$row = sql_fetch("select count(od_id) as cnt from {$g4['yc4_order_table']} $sql_search ");
$total_count = $row['cnt'];
$rows = $config['cf_page_rows'];
$total_page = ceil($total_count / $rows); // 전체 페이지 계산
if ($page == "") { $page = 1; } // 페이지가 없으면 첫 페이지 (1 페이지)
$from_record = ($page - 1) * $rows; // 시작 열을 구함
$sql = " select a.od_id,
a.*, "._MISU_QUERY_."
$sql_common
group by a.od_id
order by $sort1 $sort2
limit $from_record, $rows ";
$result = sql_query($sql);
//$qstr1 = "sel_ca_id=$sel_ca_id&sel_field=$sel_field&search=$search";
$qstr1 = "sel_ca_id=$sel_ca_id&sel_field=$sel_field&search=$search&save_search=$search";
$qstr = "$qstr1&sort1=$sort1&sort2=$sort2&page=$page";
?>
|
| 주문번호 |
주문자 |
회원ID |
건수 |
주문합계 |
주문취소 |
DC |
입금합계 |
입금취소 |
미수금 |
결제수단 |
수정 삭제 |
|
상품명 |
판매가 |
수량 |
포인트 |
상태 |
소계 |
|
|
|
$tot_itemcnt = 0;
$tot_orderamount = 0;
$tot_ordercancel = 0;
$tot_dc_amount = 0;
$tot_receiptamount = 0;
$tot_receiptcancel = 0;
$tot_misuamount = 0;
for ($i=0; $row=mysql_fetch_array($result); $i++)
{
// 결제 수단
$s_receipt_way = $s_br = "";
if ($row['od_settle_case'])
{
$s_receipt_way = $row['od_settle_case'];
$s_br = '
';
}
else
{
if ($row['od_temp_bank'] > 0 || $row['od_receipt_bank'] > 0)
{
//$s_receipt_way = "무통장입금";
$s_receipt_way = cut_str($row['od_bank_account'],8,"");
$s_br = "
";
}
if ($row['od_temp_card'] > 0 || $row['od_receipt_card'] > 0)
{
// 미수금이 없고 카드결제를 하지 않았다면 카드결제를 선택후 무통장 입금한 경우임
if ($row['misuamount'] <= 0 && $row['od_receipt_card'] == 0)
; // 화면 출력하지 않음
else
{
$s_receipt_way .= $s_br."카드";
if ($row['od_receipt_card'] == 0)
$s_receipt_way .= "(미승인)";
$s_br = "
";
}
}
}
if ($row['od_receipt_point'] > 0)
$s_receipt_way .= $s_br."포인트";
$s_mod = icon("수정", "./orderform.php?od_id={$row['od_id']}&$qstr");
$s_del = icon("삭제", "javascript:del('./orderdelete.php?od_id={$row['od_id']}&uq_id={$row['uq_id']}&mb_id={$row['mb_id']}&$qstr&list=2');");
if ($i>0)
echo " |
";
$list = $i%2;
echo "
| {$row['od_id']} |
".cut_str($row['od_name'],30,"")." |
{$row['mb_id']} |
{$row['itemcount']}건 |
".number_format($row['orderamount'])." |
".number_format($row['ordercancel'])." |
".number_format($row['od_dc_amount'])." |
".number_format($row['receiptamount'])." |
".number_format($row['receiptcancel'])." |
".number_format($row['misu'])." |
$s_receipt_way |
$s_mod $s_del |
";
$tot_itemcount += $row['itemcount'];
$tot_orderamount += $row['orderamount'];
$tot_ordercancel += $row['ordercancel'];
$tot_dc_amount += $row['od_dc_amount'];
$tot_receiptamount += $row['receiptamount'];
$tot_receiptcancel += $row['receiptcancel'];
$tot_misu += $row['misu'];
// 상품개별출력
$sql2 = " select c.it_name,
b.*
from {$g4['yc4_order_table']} a
left join {$g4['yc4_cart_table']} b on (a.uq_id = b.uq_id)
left join {$g4['yc4_item_table']} c on (b.it_id = c.it_id)
where od_id = '{$row['od_id']}' ";
$result2 = sql_query($sql2);
for ($k=0; $row2=sql_fetch_array($result2); $k++)
{
$href = G4_SHOP_URL."/item.php?it_id={$row2['it_id']}";
$it_name = "".cut_str($row2['it_name'],35)."
";
$it_name .= print_item_options($row2['it_id'], $row2['it_opt1'], $row2['it_opt2'], $row2['it_opt3'], $row2['it_opt4'], $row2['it_opt5'], $row2['it_opt6']);
$sub_amount = $row2['ct_qty'] * $row2['ct_amount'];
$sub_point = $row2['ct_qty'] * $row2['ct_point'];
echo "
|
|
".number_format($row2['ct_amount'])." |
".$row2['ct_qty']." |
".number_format($sub_point)." |
".$row2['ct_status']." |
".number_format($sub_amount)." |
|
|
";
}
}
if ($i == 0)
echo "| 자료가 한건도 없습니다. |
\n";
?>
|
| 합 계 |
=(int)$tot_itemcount?>건 |
=number_format($tot_orderamount)?> |
=number_format($tot_ordercancel)?> |
=number_format($tot_dc_amount)?> |
=number_format($tot_receiptamount)?> |
=number_format($tot_receiptcancel)?> |
=number_format($tot_misu)?> |
|
|