/home/mjc1/public_html/adm/vender/orderlist.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
<?php
$sub_menu 
'300100';
include_once(
'./_common.php');

auth_check($auth[$sub_menu], "r");

$g5['title'] = '주문내역';
if(
$od_status!=''){ $g5['title'] .= " ($od_status)"; }
include_once (
G5_ADMIN_PATH.'/vender/admin.head.php');
include_once(
G5_PLUGIN_PATH.'/jquery-ui/datepicker.php');

$where = array();

$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[] = " od_status = '취소' ";
            break;
        case 
'부분취소':
            
$where[] = " od_status IN('주문', '입금', '준비', '배송', '완료') and od_cancel_price > 0 ";
            break;
        default:
            
$where[] = " od_status = '$od_status' ";
            break;
    }

    switch (
$od_status) {
        case 
'주문' :
            
$sort1 "od_id";
            
$sort2 "desc";
            break;
        case 
'입금' :   // 결제완료
            
$sort1 "od_receipt_time";
            
$sort2 "desc";
            break;
        case 
'배송' :   // 배송중
            
$sort1 "od_invoice_time";
            
$sort2 "desc";
            break;
    }
}

if (
$od_settle_case) {
    
$where[] = " od_settle_case = '$od_settle_case' ";
}

if (
$od_misu) {
    
$where[] = " od_misu != 0 ";
}

if (
$od_cancel_price) {
    
$where[] = " od_cancel_price != 0 ";
}

if (
$od_refund_price) {
    
$where[] = " od_refund_price != 0 ";
}

if (
$od_receipt_point) {
    
$where[] = " od_receipt_point != 0 ";
}

if (
$od_coupon) {
    
$where[] = " od_coupon != 0 ";
}

if (
$od_escrow) {
    
$where[] = " od_escrow = 1 ";
}

if (
$fr_time && $to_time && $fr_date && $to_date) {
    
$where[] = " od_time between '$fr_date $fr_time:00:00' and '$to_date $to_time:59:59' ";
} else if(
$fr_date && $to_date) {
    
$where[] = " od_time between '$fr_date 00:00:00' and '$to_date 23:59:59' ";
}

if (
$where) {
    
$sql_search ' and '.implode(' and '$where);
}

if (
$sel_field == "")  $sel_field "od_id";
if (
$sort1 == ""$sort1 "od_id";
if (
$sort2 == ""$sort2 "desc";

$sql_common " from {$g5['g5_shop_order_table']} a $sql_order_list $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.*,
            (od_cart_coupon + od_coupon + od_send_coupon) as couponprice
           
$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";
$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?>
    전체 주문내역 <?php echo number_format($total_count); ?>
    <?php if($od_status == '준비' && $total_count 0) { ?>
    <a href="./orderdelivery.php" id="order_delivery" class="ov_a">엑셀배송처리</a>
    <?php ?>
</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>
</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_sch02 local_sch">
<div style='display:none'>
    <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_odr" <?php echo get_checked($od_status'주문'); ?>>
    <label for="od_status_odr">주문</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_rdy" <?php echo get_checked($od_status'준비'); ?>>
    <label for="od_status_rdy">준비</label>
    <input type="radio" name="od_status" value="배송" id="od_status_dvr" <?php echo get_checked($od_status'배송'); ?>>
    <label for="od_status_dvr">배송</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>
    <input type="radio" name="od_status" value="부분취소" id="od_status_pcancel" <?php echo get_checked($od_status'부분취소'); ?>>
    <label for="od_status_pcancel">부분취소</label>
</div>

<div>
    <strong>결제수단</strong>
    <input type="radio" name="od_settle_case" value="" id="od_settle_case01"        <?php echo get_checked($od_settle_case'');          ?>>
    <label for="od_settle_case01">전체</label>
    <input type="radio" name="od_settle_case" value="무통장" id="od_settle_case02"   <?php echo get_checked($od_settle_case'무통장');    ?>>
    <label for="od_settle_case02">무통장</label>
    <input type="radio" name="od_settle_case" value="가상계좌" id="od_settle_case03" <?php echo get_checked($od_settle_case'가상계좌');  ?>>
    <label for="od_settle_case03">가상계좌</label>
    <input type="radio" name="od_settle_case" value="계좌이체" id="od_settle_case04" <?php echo get_checked($od_settle_case'계좌이체');  ?>>
    <label for="od_settle_case04">계좌이체</label>
    <input type="radio" name="od_settle_case" value="휴대폰" id="od_settle_case05"   <?php echo get_checked($od_settle_case'휴대폰');    ?>>
    <label for="od_settle_case05">휴대폰</label>
    <input type="radio" name="od_settle_case" value="신용카드" id="od_settle_case06" <?php echo get_checked($od_settle_case'신용카드');  ?>>
    <label for="od_settle_case06">신용카드</label>
</div>

<div>
    <strong>기타선택</strong>
    <input type="checkbox" name="od_misu" value="Y" id="od_misu01" <?php echo get_checked($od_misu'Y'); ?>>
    <label for="od_misu01">미수금</label>
    <input type="checkbox" name="od_cancel_price" value="Y" id="od_misu02" <?php echo get_checked($od_cancel_price'Y'); ?>>
    <label for="od_misu02">반품,품절</label>
    <input type="checkbox" name="od_refund_price" value="Y" id="od_misu03" <?php echo get_checked($od_refund_price'Y'); ?>>
    <label for="od_misu03">환불</label>
    <input type="checkbox" name="od_receipt_point" value="Y" id="od_misu04" <?php echo get_checked($od_receipt_point'Y'); ?>>
    <label for="od_misu04">포인트주문</label>
    <input type="checkbox" name="od_coupon" value="Y" id="od_misu05" <?php echo get_checked($od_coupon'Y'); ?>>
    <label for="od_misu05">쿠폰</label>
    <?php if($default['de_escrow_use']) { ?>
    <input type="checkbox" name="od_escrow" value="Y" id="od_misu06" <?php echo get_checked($od_escrow'Y'); ?>>
    <label for="od_misu06">에스크로</label>
    <?php ?>
</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" placeholder="일자검색"> ~
    <input type="text" id="to_date"  name="to_date" value="<?php echo $to_date?>" class="frm_input" size="10" maxlength="10" placeholder="일자검색">
    &nbsp;&nbsp;&nbsp;
    <input type="text" id="fr_time"  name="fr_time" value="<?php echo $fr_time?>" class="frm_input" size="6" maxlength="2" placeholder="시간(00)">시 ~
    <input type="text" id="to_time"  name="to_time" value="<?php echo $to_time?>" class="frm_input" size="6" maxlength="2" placeholder="시간(24)">시
    <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?>">
<input type="hidden" name="id_11st" value="">
<input type="hidden" name="pw_11st" value="">
<input type="hidden" name="priority_11st" value="">
<input type="hidden" name="ktb_agent_11st" value="">

<div class="tbl_head02 tbl_wrap">
    <table id="sodr_list">
    <caption>주문 내역 목록</caption>
    <thead>
    <tr>
        <th scope="col" rowspan="3">
            <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_odrnum"><a href="<?php echo title_sort("od_id"1)."&amp;$qstr1"?>">주문번호</a></th> -->
        <th scope="col" id="th_odrnum" rowspan="2" colspan="2"><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_odrertel">주문자전화</th>
        <th scope="col" id="th_recvr">받는분</th>
        <th scope="col" rowspan="3">주문합계<br>선불배송비포함</th>
        <th scope="col" rowspan="3">입금합계</th>
        <th scope="col" rowspan="3">주문취소</th>
        <th scope="col" rowspan="3">쿠폰</th>
        <th scope="col" rowspan="3">등급할인</th>
        <th scope="col" rowspan="3">미수금</th>
        <th scope="col" rowspan="3">보기</th>
    </tr>
    <tr>
        <!-- <th scope="col" id="th_odrdate">주문일시</th> -->
        <!-- <th scope="col">결제수단</th> -->
        <!-- <th scope="col" id="th_odrid"><a href="<?php echo title_sort("mb_id")."&amp;$qstr1"?>">회원ID</a></th> -->
        <th scope="col" id="th_odrid">회원ID</th>
        <th scope="col" id="th_odrcnt">주문상품수</th>
        <th scope="col" id="th_odrall">누적주문수</th>
    </tr>
    <tr>
        <!-- <th scope="col">배송일시</th> -->
        <th scope="col" id="odrstat">주문상태</th>
        <th scope="col" id="odrpay">결제수단</th>
        <th scope="col" id="delino">운송장번호</th>
        <th scope="col" id="delicom">배송회사</th>
        <th scope="col" id="delidate">배송일시</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 />';
        }
        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(
$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 rowspan="3" 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 echo $od_mobile?>
            <a href="<?php echo G5_SHOP_URL?>/orderinquiryview.php?od_id=<?php echo $row['od_id']; ?>&amp;uid=<?php echo $uid?>"><?php echo $row['od_id']; ?></a><br>
        </td> -->
        <td headers="th_ordnum" class="td_odrnum2" rowspan="2" colspan="2">
            <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 echo $od_mobile?>
            <?php echo $od_paytype?>
        </td>
        <td headers="th_odrer" class="td_name"><?php echo $mb_nick?></td>
        <td headers="th_odrertel" class="td_tel"><?php echo get_text($row['od_tel']); ?></td>
        <td headers="th_recvr" class="td_name"><a href="<?php echo $_SERVER['SCRIPT_NAME']; ?>?sort1=<?php echo $sort1?>&amp;sort2=<?php echo $sort2?>&amp;sel_field=od_b_name&amp;search=<?php echo get_text($row['od_b_name']); ?>"><?php echo get_text($row['od_b_name']); ?></a></td>
        <td rowspan="3" class="td_numsum"><?php echo number_format($row['od_cart_price'] + $row['od_send_cost'] + $row['od_send_cost2']); ?></td>
        <td rowspan="3" class="td_numincome"><?php echo number_format($row['od_receipt_price']); ?></td>
        <td rowspan="3" class="td_numcancel<?php echo $td_color?>"><?php echo number_format($row['od_cancel_price']); ?></td>
        <td rowspan="3" class="td_numcoupon"><?php echo number_format($row['couponprice']); ?></td>
        <td rowspan="3" class="td_numincome"><?php echo number_format($row['od_dc_price']); ?></td>
        <td rowspan="3" class="td_numrdy"><?php echo number_format($row['od_misu']); ?></td>
        <td rowspan="3" class="td_mngsmall">
            <a href="./orderform.php?od_id=<?php echo $row['od_id']; ?>&amp;<?php echo $qstr?>" class="mng_mod"><span class="sound_only"><?php echo $row['od_id']; ?> </span>보기</a>
        </td>
    </tr>
    <tr class="<?php echo $bg?>">
        <!-- <td headers="th_odrdate"><span class="sound_only">주문일시 </span><?php echo $row['od_time']; ?></td> -->
        <!-- <td class="td_payby">
            <input type="hidden" name="current_settle_case[<?php echo $i ?>]" value="<?php echo $row['od_settle_case'?>">
            <?php echo $s_receipt_way?>
        </td> -->
        <!-- <td headers="th_odrid" class="td_name"><a href="<?php echo $_SERVER['SCRIPT_NAME']; ?>?sort1=<?php echo $sort1?>&amp;sort2=<?php echo $sort2?>&amp;sel_field=mb_id&amp;search=<?php echo $row['mb_id']; ?>"><?php echo $row['mb_id']; ?></a></td> -->
        <td headers="th_odrid">
            <?php if ($row['mb_id']) { ?>
            <a href="<?php echo $_SERVER['SCRIPT_NAME']; ?>?sort1=<?php echo $sort1?>&amp;sort2=<?php echo $sort2?>&amp;sel_field=mb_id&amp;search=<?php echo $row['mb_id']; ?>"><?php echo $row['mb_id']; ?></a>
            <?php } else { ?>
            비회원
            <?php ?>
        </td>
        <td headers="th_odrcnt"><?php echo $row['od_cart_count']; ?>건</td>
        <td headers="th_odrall"><?php echo $od_cnt?>건</td>
    </tr>
    <tr class="<?php echo $bg?>">
        <td headers="th_odrstat" class="td_odrstatus">
            <input type="hidden" name="current_status[<?php echo $i ?>]" value="<?php echo $row['od_status'?>">
            <?php echo $row['od_status']; ?>
        </td>
        <td headers="th_odrpay" class="td_payby">
            <input type="hidden" name="current_settle_case[<?php echo $i ?>]" value="<?php echo $row['od_settle_case'?>">
            <?php echo $s_receipt_way?>
        </td>
        <td headers="th_delino" class="td_delino">
            <?php if ($od_status == '준비') { ?>
                <input type="text" name="od_invoice[<?php echo $i?>]" value="<?php echo $row['od_invoice']; ?>" class="frm_input" size="10">
            <?php } else {
                echo (
$row['od_invoice'] ? $row['od_invoice'] : '-');
            } 
?>
        </td>
        <td headers="th_delicom">
            <?php if ($od_status == '준비') { ?>
                <select name="od_delivery_company[<?php echo $i?>]">
                    <?php echo get_delivery_company($delivery_company); ?>
                </select>
            <?php } else {
                echo (
$row['od_delivery_company'] ? $row['od_delivery_company'] : '-');
            } 
?>
        </td>
        <td headers="th_delidate">
            <?php if ($od_status == '준비') { ?>
                <input type="text" name="od_invoice_time[<?php echo $i?>]" value="<?php echo $invoice_time?>" class="frm_input" size="10" maxlength="19">
            <?php } else {
                echo (
is_null_time($row['od_invoice_time']) ? '-' substr($row['od_invoice_time'],2,14));
            } 
?>
        </td>
    </tr>
    <?php
        $tot_itemcount     
+= $row['od_cart_count'];
        
$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_dcprice            += $row['od_dc_price'];
        
$tot_misu          += $row['od_misu'];
    }
    
mysql_free_result($result);
    if (
$i == 0)
        echo 
'<tr><td colspan="12" class="empty_table">자료가 없습니다.</td></tr>';
    
?>
    </tbody>
    <tfoot>
    <tr class="orderlist">
        <th scope="row" colspan="3">&nbsp;</th>
        <td>&nbsp;</td>
        <td><?php echo number_format($tot_itemcount); ?>건</td>
        <th scope="row">합 계</th>
        <td><?php echo number_format($tot_orderprice); ?></td>
        <td><?php echo number_format($tot_receiptprice); ?></td>
        <td><?php echo number_format($tot_ordercancel); ?></td>
        <td><?php echo number_format($tot_couponprice); ?></td>
        <td><?php echo number_format($tot_dcprice); ?></td>
        <td><?php echo number_format($tot_misu); ?></td>
        <td></td>
    </tr>
    </tfoot>
    </table>
</div>

<div class="local_cmd01 local_cmd">
<?php if (($od_status == '' || $od_status == '완료' || $od_status == '전체취소' || $od_status == '부분취소') == false) {
    
// 검색된 주문상태가 '전체', '완료', '전체취소', '부분취소' 가 아니라면
?>
<?php 
if(!($od_status=='반품' || $od_status=='취소')){?>
    <label for="od_status" class="cmd_tit">주문상태 변경</label>
    <?php
    $change_status 
"";
    if (
$od_status == '주문'$change_status "입금";
    if (
$od_status == '입금'$change_status "준비";
    if (
$od_status == '준비'$change_status "배송";
    if (
$od_status == '배송'$change_status "완료";
    
?>
    <label><input type="checkbox" name="od_status" value="<?php echo $change_status?>"> '<?php echo $od_status ?>'상태에서 '<strong><?php echo $change_status ?></strong>'상태로 변경합니다.</label>
    <?php if($od_status == '주문' || $od_status == '준비') { ?>
    <input type="checkbox" name="od_send_mail" value="1" id="od_send_mail" checked="checked">
    <label for="od_send_mail"><?php echo $change_status?>안내 메일</label>
    <input type="checkbox" name="send_sms" value="1" id="od_send_sms" checked="checked">
    <label for="od_send_sms"><?php echo $change_status?>안내 SMS</label>
    <?php ?>
    <?php if($od_status == '준비') { ?>
    <input type="checkbox" name="send_escrow" value="1" id="od_send_escrow">
    <label for="od_send_escrow">에스크로배송등록</label>
    <?php ?>
    <input type="submit" value="선택수정" class="btn_submit" onclick="document.pressed=this.value">
<?php }?>
<?php 
?>
    <?php if ($od_status == '주문') { ?> <span>주문상태에서만 삭제가 가능합니다.</span> <input type="submit" value="선택삭제" class="btn_submit" onclick="document.pressed=this.value"><?php ?>
<?php 
if($od_status == '입금' || $od_status == '준비'){?>
    오픈마켓 상태 같이 적용하기 -> <input type='checkbox' name='otms_appy' value='1' style='border:0px;background:none;'>  
    <br><br>※ 오픈마켓 상태적용하기는 [준비]와 [배송]만 가능합니다. [배송]상태로 업데이트 할경우 아래의 송장내용(택배)이 입력된 상태로 처리해야해야 합니다.
    <br>※ 오픈마켓 상태를 적용하기위해서는 [준비]상태로 할경우 오픈마켓의 상태가 [입금]상태일때만 가능하며, [배송]상태로 할경우 오픈마켓의 상태가 [준비]일경우만 적용됩니다. 쇼핑몰 처림 임의로 상태를 변경할수 없습니다.
<?php ?>
</div>

<div class="local_desc02 local_desc">
<p>
    &lt;무통장&gt;인 경우에만 &lt;주문&gt;에서 &lt;입금&gt;으로 변경됩니다. 가상계좌는 입금시 자동으로 &lt;입금&gt;처리됩니다.<br>
    &lt;준비&gt;에서 &lt;배송&gt;으로 변경시 &lt;에스크로배송등록&gt;을 체크하시면 에스크로 주문에 한해 PG사에 배송정보가 자동 등록됩니다.<br>
    <strong>주의!</strong> 주문번호를 클릭하여 나오는 주문상세내역의 주소를 외부에서 조회가 가능한곳에 올리지 마십시오.
</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 type="text/javascript" src="https://www.11st.co.kr/js/common/rsa.js?noCache=<?php echo $microtime;?>"></script>
<script type="text/javascript" src="https://login.soffice.11st.co.kr/jsp/ktb/ktb.agent.jsp"></script>
<script>
$(function(){
    var xx = rsa.encrypt("<?php echo trim($default['de_otms_id_11st'])?>");
    var yy = rsa.encrypt("<?php echo trim($default['de_otms_pw_11st'])?>");
    $("input[name=id_11st]").val(xx);
    $("input[name=pw_11st]").val(yy);
    $("input[name=priority_11st]").val(priority);
    $("input[name=ktb_agent_11st]").val(ktb.getScanResult());

    setTimeout("ktb_set()",1000);

    $("#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 ktb_set(){
    $("input[name=ktb_agent_11st]").val(ktb.getScanResult());
    if($("input[name=ktb_agent_11st]").val()==''){
        setTimeout("ktb_set()",1000);
    }
}

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

    /*
    switch (f.od_status.value) {
        case "" :
            alert("변경하실 주문상태를 선택하세요.");
            return false;
        case '주문' :

        default :

    }
    */

    if(document.pressed == "선택삭제") {
        if(confirm("선택한 자료를 정말 삭제하시겠습니까?")) {
            f.action = "./orderlistdelete.php";
            return true;
        }
        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.php";
    return true;
}
</script>

<?php
echo $js_order_list;
include_once (
G5_ADMIN_PATH.'/admin.tail.php');
?>