/home/mjc1/public_html/shop/orderinquiryview.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
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
<?php
include_once('./_common.php');

if (
G5_IS_MOBILE) {
    include_once(
G5_MSHOP_PATH.'/orderinquiryview.php');
    return;
}

// 불법접속을 할 수 없도록 세션에 아무값이나 저장하여 hidden 으로 넘겨서 다음 페이지에서 비교함
$token md5(uniqid(rand(), true));
set_session("ss_token"$token);

if (!
$is_member) {
    if (
get_session('ss_orderview_uid') != $_GET['uid'])
        
alert("직접 링크로는 주문서 조회가 불가합니다.\\n\\n주문조회 화면을 통하여 조회하시기 바랍니다."G5_SHOP_URL);
}

$sql "select * from {$g5['g5_shop_order_table']} where od_id = '$od_id' ";
$od sql_fetch($sql);
if (!
$od['od_id'] || (!$is_member && md5($od['od_id'].$od['od_time'].$od['od_ip']) != get_session('ss_orderview_uid'))) {
    
alert("조회하실 주문서가 없습니다."G5_SHOP_URL);
}

$ovd explode(",",$od['od_vender_deliinfo']);
foreach(
$ovd as $key => $val){
    if(
trim($val)!=''){
        
$v explode("^",$val);
        
$ovd_array[$v[0]] = $v[1];
    }
}

// 결제방법
$settle_case $od['od_settle_case'];

$g5['title'] = '주문상세내역';
include_once(
'./_head.php');

// LG 현금영수증 JS
if($od['od_pg'] == 'lg') {
    if(
$default['de_card_test']) {
    echo 
'<script language="JavaScript" src="http://pgweb.uplus.co.kr:7085/WEB_SERVER/js/receipt_link.js"></script>'.PHP_EOL;
    } else {
        echo 
'<script language="JavaScript" src="http://pgweb.uplus.co.kr/WEB_SERVER/js/receipt_link.js"></script>'.PHP_EOL;
    }
}
?>

<!-- 주문상세내역 시작 { -->
<div id="sod_fin">

    <div id="sod_fin_no">주문번호 <strong><?php echo $od_id?></strong></div>

    <section id="sod_fin_list">
        <h2>주문하신 상품</h2>
            <div class="tbl_head02 tbl_wrap">
                <table>
                <thead>
                <tr>
<?php if($default['de_vender_use']=='1'){ //벤더 사용시 ?>
                    <th scope="col" rowspan=2>벤더</th>
<?php ?>
                    <th scope="col" rowspan="2">이미지</th>
                    <th scope="col" colspan="7" id="th_itname">상품명</th>
                </tr>
                <tr>
                    <th scope="col" id="th_itopt">옵션명</th>
                    <th scope="col" id="th_itqty">수량</th>
                    <th scope="col" id="th_itprice">판매가</th>
                    <th scope="col" id="th_itsum">소계</th>
                    <th scope="col" id="th_itpt">포인트</th>
                    <th scope="col" id="th_itst">상태</th>
                    <th scope="col" id="th_itpt">배송비</th>
                </tr>
                </thead>
                <tbody>

        <?php
        $st_count1 
$st_count2 0;
        
$custom_cancel false;

if(
$default['de_vender_use']==1){ // 벤더 사용
        
$sql "select vm_id from {$g5['g5_shop_cart_table']} where 1=1 and od_id = '$od_id' group by vm_id";
        
$resv sql_query($sql);

        while(
$vm_group=mysql_fetch_array($resv)){

            
$sql " select vm_id,it_id, it_name, ct_send_cost, it_sc_type
                        from 
{$g5['g5_shop_cart_table']}
                        where od_id = '
$od_id' and vm_id = '{$vm_group['vm_id']}'
                        group by it_id
                        order by ct_id "
;
            
$result sql_query($sql);

            
// 해당 벤더 상품이 몇개인지 계산
            
$sql "select count(a.it_id) as cnt from (select it_id from {$g5['g5_shop_cart_table']} where vm_id = '{$vm_group['vm_id']}' and od_id = '{$od_id}' group by it_id) a";
            
$io1_info sql_fetch($sql);
            
// 해당 벤더 선택옵션 몇개인지 계산
            
$sql "select count(*) as cnt from {$g5['g5_shop_cart_table']} where vm_id = '{$vm_group['vm_id']}' and od_id = '{$od_id}' and io_type=0";
            
$io2_info sql_fetch($sql);
            
// 해당 벤더 추가옵션 몇개인지 계산
            
$sql "select count(*) as cnt from {$g5['g5_shop_cart_table']} where vm_id = '{$vm_group['vm_id']}' and od_id = '{$od_id}' and io_type=1";
            
$io3_info sql_fetch($sql);

            
$row_nums $io1_info['cnt']+$io2_info['cnt']+$io3_info['cnt']; // (아이템갯수+선택옵션갯수+추가옵션 : 선택옵션은 1상품에서 여러개붙기때문)
            
?>
            
                <?php
                
for($i=0$row=sql_fetch_array($result); $i++) {
                    
$image get_it_image($row['it_id'], 7070);

                    
$sql " select ct_id, it_name, ct_option, ct_qty, ct_price, ct_point, ct_status, io_type, io_price
                                from 
{$g5['g5_shop_cart_table']}
                                where od_id = '
$od_id'
                                  and it_id = '
{$row['it_id']}'
                                order by io_type asc, ct_id asc "
;
                    
$res sql_query($sql);
                    
$rowspan mysql_num_rows($res) + 1;

                    
// 합계금액 계산
                    
$sql " select SUM(IF(io_type = 1, (io_price * ct_qty), ((ct_price + io_price) * ct_qty))) as price,
                                    SUM(ct_qty) as qty
                                from 
{$g5['g5_shop_cart_table']}
                                where it_id = '
{$row['it_id']}'
                                  and od_id = '
$od_id' ";
                    
$sum sql_fetch($sql);

                    
// 배송비
                    
switch($row['ct_send_cost'])
                    {
                        case 
1:
                            
$ct_send_cost '착불';
                            break;
                        case 
2:
                            
$ct_send_cost '무료';
                            break;
                        default:
                            
$ct_send_cost '선불';
                            break;
                    }

                    
// 조건부무료
                    
if($row['it_sc_type'] == 2) {
                        
$sendcost get_item_sendcost($row['it_id'], $sum['price'], $sum['qty'], $od_id);

                        if(
$sendcost == 0)
                            
$ct_send_cost '무료';
                    }

                    
$sql "select vm_user_id, vm_name from {$g5['vender_member']} where vm_id = '{$row['vm_id']}' ";
                    
$res2 sql_query($sql);
                    
$vm_info mysql_fetch_array($res2);

                    for(
$k=0$opt=sql_fetch_array($res); $k++) {
                        if(
$opt['io_type'])
                            
$opt_price $opt['io_price'];
                        else
                            
$opt_price $opt['ct_price'] + $opt['io_price'];

                        
$sell_price $opt_price $opt['ct_qty'];
                        
$point $opt['ct_point'] * $opt['ct_qty'];

                        if(
$k == 0) {
                
?>
                <tr>
    <?php if($i==0){?>
                <td class="td_num" rowspan=<?php echo $row_nums?>>
                <?php 
                    
if($vm_info['vm_user_id']!=''){
                        echo 
$vm_info['vm_name']." <br>({$vm_info['vm_user_id']})"
                    } else {
                        echo 
"본사"
                    }
                
?>
                </td>
    <?php }?>
                    <td rowspan="<?php echo $rowspan?>" class="td_imgsmall"><?php echo $image?></td>
                    <td headers="th_itname" colspan="6"><a href="./item.php?it_id=<?php echo $row['it_id']; ?>"><b><?php echo $row['it_name']; ?></b></a></td>
    <?php if($i==0){?>
                    <td class="td_numbig" rowspan=<?php echo $row_nums?>><?php echo $ct_send_cost?><br>(<?php echo number_format($ovd_array[$row['vm_id']])?>)</td>
    <?php }?>
                </tr>
                <?php ?>
                <tr>
                    <td headers="th_itopt"><?php echo $opt['ct_option']; ?></td>
                    <td headers="th_itqty" class="td_mngsmall"><?php echo number_format($opt['ct_qty']); ?></td>
                    <td headers="th_itprice" class="td_numbig"><?php echo number_format($opt_price); ?></td>
                    <td headers="th_itsum" class="td_numbig"><?php echo number_format($sell_price); ?></td>
                    <td headers="th_itpt" class="td_num"><?php echo number_format($point); ?></td>
                    <td headers="th_itst" class="td_mngsmall"><?php echo $opt['ct_status']; ?></td>
                    <!--<td headers="th_itpt" class="td_dvr"><?php echo $ct_send_cost?></td>-->
                </tr>
                <?php
                        $tot_point       
+= $point;

                        
$st_count1++;
                        if(
$opt['ct_status'] == '주문' || $opt['ct_status'] == '입금')
                            
$st_count2++;
                    }
                }
        }
// 벤더 while 끝
} else {

        
$sql " select it_id, it_name, ct_send_cost, it_sc_type
                    from 
{$g5['g5_shop_cart_table']}
                    where od_id = '
$od_id'
                    group by it_id
                    order by ct_id "
;
        
$result sql_query($sql);
        
?>
            <?php
            
for($i=0$row=sql_fetch_array($result); $i++) {
                
$image get_it_image($row['it_id'], 7070);

                
$sql " select ct_id, it_name, ct_option, ct_qty, ct_price, ct_point, ct_status, io_type, io_price
                            from 
{$g5['g5_shop_cart_table']}
                            where od_id = '
$od_id'
                              and it_id = '
{$row['it_id']}'
                            order by io_type asc, ct_id asc "
;
                
$res sql_query($sql);
                
$rowspan mysql_num_rows($res) + 1;

                
// 합계금액 계산
                
$sql " select SUM(IF(io_type = 1, (io_price * ct_qty), ((ct_price + io_price) * ct_qty))) as price,
                                SUM(ct_qty) as qty
                            from 
{$g5['g5_shop_cart_table']}
                            where it_id = '
{$row['it_id']}'
                              and od_id = '
$od_id' ";
                
$sum sql_fetch($sql);

                
// 배송비
                
switch($row['ct_send_cost'])
                {
                    case 
1:
                        
$ct_send_cost '착불';
                        break;
                    case 
2:
                        
$ct_send_cost '무료';
                        break;
                    default:
                        
$ct_send_cost '선불';
                        break;
                }

                
// 조건부무료
                
if($row['it_sc_type'] == 2) {
                    
$sendcost get_item_sendcost($row['it_id'], $sum['price'], $sum['qty'], $od_id);

                    if(
$sendcost == 0)
                        
$ct_send_cost '무료';
                }

                for(
$k=0$opt=sql_fetch_array($res); $k++) {
                    if(
$opt['io_type'])
                        
$opt_price $opt['io_price'];
                    else
                        
$opt_price $opt['ct_price'] + $opt['io_price'];

                    
$sell_price $opt_price $opt['ct_qty'];
                    
$point $opt['ct_point'] * $opt['ct_qty'];

                    if(
$k == 0) {
            
?>
            <tr>
                <td rowspan="<?php echo $rowspan?>" class="td_imgsmall"><?php echo $image?></td>
                <td headers="th_itname" colspan="7"><a href="./item.php?it_id=<?php echo $row['it_id']; ?>"><b><?php echo $row['it_name']; ?></b></a></td>
            </tr>
            <?php ?>
            <tr>
                <td headers="th_itopt"><?php echo $opt['ct_option']; ?></td>
                <td headers="th_itqty" class="td_mngsmall"><?php echo number_format($opt['ct_qty']); ?></td>
                <td headers="th_itprice" class="td_numbig"><?php echo number_format($opt_price); ?></td>
                <td headers="th_itsum" class="td_numbig"><?php echo number_format($sell_price); ?></td>
                <td headers="th_itpt" class="td_num"><?php echo number_format($point); ?></td>
                <td headers="th_itpt" class="td_dvr"><?php echo $ct_send_cost?></td>
                <td headers="th_itst" class="td_mngsmall"><?php echo $opt['ct_status']; ?></td>
            </tr>
            <?php
                    $tot_point       
+= $point;

                    
$st_count1++;
                    if(
$opt['ct_status'] == '주문' || $opt['ct_status'] == '입금')
                        
$st_count2++;
                }
            }
// 벤더사용 if 끝 

            // 주문 상품의 상태가 모두 주문이면 고객 취소 가능
            
if($st_count1 && $st_count1 == $st_count2)
                
$custom_cancel true;
            
?>
            </tbody>
            </table>
        </div>

        <div id="sod_sts_wrap">
            <span class="sound_only">상품 상태 설명</span>
            <button type="button" id="sod_sts_explan_open" class="btn_frmline">상태설명보기</button>
            
            
<style>
#sod_fin_legend {padding:10px 15px;border:1px solid #e9e9e9;text-align:left;zoom:1}
#sod_fin_legend:after {display:block;visibility:hidden;clear:both;content:''}
#sod_fin_legend li {float:left;padding:10px 39px 10px 0;text-align:center}
#sod_fin_legend li:last-child {padding:10px 0;background:none}
#sod_fin_legend li span {display:block;margin-top:10px}
#sod_fin_legend li span.title {font-weight:600}

#sod_fin_legend li {background:url('<?php echo G5_SHOP_URL?>/img/delivery_arr.png') right top no-repeat}
</style>
            <div id="sod_sts_explan">
                <ul id="sod_fin_legend">
                    <li>
                        <img src="<?php echo G5_SHOP_URL?>/img/delivery_step1.png" alt="주문">
                        <span class="title">주문접수</span>
                        <span>입금미완료 시 주문 취소됩니다.</span>
                    </li>
                    <li>
                        <img src="<?php echo G5_SHOP_URL?>/img/delivery_step2.png" alt="입금">
                        <span class="title">입금완료</span>
                        <span>입금 내역이 확인되었습니다.</span>
                    </li>
                    <li>
                        <img src="<?php echo G5_SHOP_URL?>/img/delivery_step3.png" alt="준비">
                        <span class="title">상품준비</span>
                        <span>고객님께 발송할 상품을 준비중입니다.</span>
                    </li>
                    <li>
                        <img src="<?php echo G5_SHOP_URL?>/img/delivery_step4.png" alt="배송">
                        <span class="title">상품배송</span>
                        <span>택배사로 상품이 전달되었습니다.</span>
                    </li>
                    <li>
                        <img src="<?php echo G5_SHOP_URL?>/img/delivery_step5.png" alt="완료">
                        <span class="title">배송완료</span>
                        <span>고객님께 상품배송이 완료되었습니다.</span>
                    </li>
                </ul>
                <button type="button" id="sod_sts_explan_close" class="btn_frmline">상태설명닫기</button>
            </div>
        </div>

        <?php
        
// 총계 = 주문상품금액합계 + 배송비 - 상품할인 - 결제할인 - 배송비할인
        
$tot_price $od['od_cart_price'] + $od['od_send_cost'] + $od['od_send_cost2']
                        - 
$od['od_cart_coupon'] - $od['od_coupon'] - $od['od_send_coupon']
                        - 
$od['od_cancel_price'];
        
?>

        <dl id="sod_bsk_tot">
            <dt class="sod_bsk_dvr">주문총액</dt>
            <dd class="sod_bsk_dvr"><strong><?php echo number_format($od['od_cart_price']); ?> 원</strong></dd>

            <?php if($od['od_cart_coupon'] > 0) { ?>
            <dt class="sod_bsk_dvr">개별상품 쿠폰할인</dt>
            <dd class="sod_bsk_dvr"><strong><?php echo number_format($od['od_cart_coupon']); ?> 원</strong></dd>
            <?php ?>

            <?php if($od['od_coupon'] > 0) { ?>
            <dt class="sod_bsk_dvr">주문금액 쿠폰할인</dt>
            <dd class="sod_bsk_dvr"><strong><?php echo number_format($od['od_coupon']); ?> 원</strong></dd>
            <?php ?>

            <?php if ($od['od_send_cost'] > 0) { ?>
            <dt class="sod_bsk_dvr">배송비</dt>
            <dd class="sod_bsk_dvr"><strong><?php echo number_format($od['od_send_cost']); ?> 원</strong></dd>
            <?php ?>

            <?php if($od['od_send_coupon'] > 0) { ?>
            <dt class="sod_bsk_dvr">배송비 쿠폰할인</dt>
            <dd class="sod_bsk_dvr"><strong><?php echo number_format($od['od_send_coupon']); ?> 원</strong></dd>
            <?php ?>

            <?php if ($od['od_send_cost2'] > 0) { ?>
            <dt class="sod_bsk_dvr">추가배송비</dt>
            <dd class="sod_bsk_dvr"><strong><?php echo number_format($od['od_send_cost2']); ?> 원</strong></dd>
            <?php ?>

            <?php if ($od['od_cancel_price'] > 0) { ?>
            <dt class="sod_bsk_dvr">취소금액</dt>
            <dd class="sod_bsk_dvr"><strong><?php echo number_format($od['od_cancel_price']); ?> 원</strong></dd>
            <?php ?>

            <dt class="sod_bsk_cnt">총계</dt>
            <dd class="sod_bsk_cnt"><strong><?php echo number_format($tot_price); ?> 원</strong></dd>

            <dt class="sod_bsk_point">포인트</dt>
            <dd class="sod_bsk_point"><strong><?php echo number_format($tot_point); ?> 점</strong></dd>
        </dl>
    </section>





    <div id="sod_fin_view" style="height:305px;">
        <h2>주문자/배송지 정보</h2>
        <section id="sod_fin_orderer">
            <h3>주문자정보</h3>

            <div class="tbl_head02 tbl_wrap">
                <table>
                <colgroup>
                    <col class="grid_3">
                    <col>
                </colgroup>
                <tbody>
                <tr>
                    <th scope="row">이 름</th>
                    <td><?php echo get_text($od['od_name']); ?></td>
                </tr>
                <tr>
                    <th scope="row">전화번호</th>
                    <td><?php echo get_text($od['od_tel']); ?></td>
                </tr>
                <tr>
                    <th scope="row">핸드폰</th>
                    <td><?php echo get_text($od['od_hp']); ?></td>
                </tr>
                <tr>
                    <th scope="row">주 소</th>
                    <td><?php echo get_text(sprintf("(%s-%s)"$od['od_zip1'], $od['od_zip2']).' '.print_address($od['od_addr1'], $od['od_addr2'], $od['od_addr3'], $od['od_addr_jibeon'])); ?></td>
                </tr>
                <tr>
                    <th scope="row">E-mail</th>
                    <td><?php echo get_text($od['od_email']); ?></td>
                </tr>
                </tbody>
                </table>
            </div>
        </section>

        <section id="sod_fin_receiver">
            <h3>배송지정보</h3>

            <div class="tbl_head02 tbl_wrap">
                <table>
                <colgroup>
                    <col class="grid_3">
                    <col>
                </colgroup>
                <tbody>
                <tr>
                    <th scope="row">이 름</th>
                    <td><?php echo get_text($od['od_b_name']); ?></td>
                </tr>
                <tr>
                    <th scope="row">전화번호</th>
                    <td><?php echo get_text($od['od_b_tel']); ?></td>
                </tr>
                <tr>
                    <th scope="row">핸드폰</th>
                    <td><?php echo get_text($od['od_b_hp']); ?></td>
                </tr>
                <tr>
                    <th scope="row">주 소</th>
                    <td><?php echo get_text(sprintf("(%s-%s)"$od['od_b_zip1'], $od['od_b_zip2']).' '.print_address($od['od_b_addr1'], $od['od_b_addr2'], $od['od_b_addr3'], $od['od_b_addr_jibeon'])); ?></td>
                </tr>
                <?php
                
// 희망배송일을 사용한다면
                
if ($default['de_hope_date_use'])
                {
                
?>
                <tr>
                    <th scope="row">희망배송일</th>
                    <td><?php echo substr($od['od_hope_date'],0,10).' ('.get_yoil($od['od_hope_date']).')' ;?></td>
                </tr>
                <?php }
                if (
$od['od_memo'])
                {
                
?>
                <tr>
                    <th scope="row">남기는 말</th>
                    <td><?php echo cut_str(conv_content($od['od_memo'], 0),200?></td>
                </tr>
                <?php ?>
                </tbody>
                </table>
            </div>
        </section>
    </div><!-- //sod_fin_view -->
        
        
    <div id="sod_fin_view">
        <h2>결제/배송 정보</h2>
        <?php
        $receipt_price  
$od['od_receipt_price']
                        + 
$od['od_receipt_point'];
        
$cancel_price   $od['od_cancel_price'];
        
$od_dc_price $od['od_dc_price'];

        
$misu true;
        
$misu_price $tot_price $receipt_price $cancel_price $od_dc_price;

        if (
$misu_price == && ($od['od_cart_price'] > $od['od_cancel_price'])) {
            
$wanbul " (완불)";
            
$misu false// 미수금 없음
        
}
        else
        {
            
$wanbul display_price($receipt_price);
        }

        
// 결제정보처리
        
if($od['od_receipt_price'] > 0)
            
$od_receipt_price display_price($od['od_receipt_price']);
        else
            
$od_receipt_price '아직 입금되지 않았거나 입금정보를 입력하지 못하였습니다.';

        
$app_no_subj '';
        
$disp_bank true;
        
$disp_receipt false;
        if(
$od['od_settle_case'] == '신용카드') {
            
$app_no_subj '승인번호';
            
$app_no $od['od_app_no'];
            
$disp_bank false;
            
$disp_receipt true;
        } else if(
$od['od_settle_case'] == '휴대폰') {
            
$app_no_subj '휴대폰번호';
            
$app_no $od['od_bank_account'];
            
$disp_bank false;
            
$disp_receipt true;
        } else if(
$od['od_settle_case'] == '가상계좌' || $od['od_settle_case'] == '계좌이체') {
            
$app_no_subj '거래번호';
            
$app_no $od['od_tno'];
        }
        
?>
        
        <section id="sod_fin_pay">
            <h3>결제정보</h3>

            <div class="tbl_head01 tbl_wrap">
                <table>
                <colgroup>
                    <col class="grid_3">
                    <col>
                </colgroup>
                <tbody>
                <tr>
                    <th scope="row">주문번호</th>
                    <td class="alignL"><?php echo $od_id?></td>
                </tr>
                <tr>
                    <th scope="row">주문일시</th>
                    <td class="alignL"><?php echo $od['od_time']; ?></td>
                </tr>
                <tr>
                    <th scope="row">결제방식</th>
                    <td class="alignL"><?php echo $od['od_settle_case']; ?></td>
                </tr>
                <tr>
                    <th scope="row">결제금액</th>
                    <td class="alignL"><?php echo $od_receipt_price?></td>
                </tr>
                <?php
                
if($od['od_receipt_price'] > 0)
                {
                
?>
                <tr>
                    <th scope="row">결제일시</th>
                    <td class="alignL"><?php echo $od['od_receipt_time']; ?></td>
                </tr>
                <?php
                
}

                
// 승인번호, 휴대폰번호, 거래번호
                
if($app_no_subj)
                {
                
?>
                <tr>
                    <th scope="row"><?php echo $app_no_subj?></th>
                    <td class="alignL"><?php echo $app_no?></td>
                </tr>
                <?php
                
}

                
// 계좌정보
                
if($disp_bank)
                {
                
?>
                <tr>
                    <th scope="row">입금자명</th>
                    <td class="alignL"><?php echo get_text($od['od_deposit_name']); ?></td>
                </tr>
                <tr>
                    <th scope="row">입금계좌</th>
                    <td class="alignL"><?php echo get_text($od['od_bank_account']); ?></td>
                </tr>
                <?php
                
}

                if(
$disp_receipt) {
                
?>
                <tr>
                    <th scope="row">영수증</th>
                    <td class="alignL">
                        <?php
                        
if($od['od_settle_case'] == '휴대폰')
                        {
                            if(
$od['od_pg'] == 'lg') {
                                require_once 
G5_SHOP_PATH.'/settle_lg.inc.php';
                                
$LGD_TID      $od['od_tno'];
                                
$LGD_MERTKEY  $config['cf_lg_mert_key'];
                                
$LGD_HASHDATA md5($LGD_MID.$LGD_TID.$LGD_MERTKEY);

                                
$hp_receipt_script 'showReceiptByTID(\''.$LGD_MID.'\', \''.$LGD_TID.'\', \''.$LGD_HASHDATA.'\');';
                            } else if(
$od['od_pg'] == 'inicis') {
                                
$hp_receipt_script 'window.open(\'https://iniweb.inicis.com/DefaultWebApp/mall/cr/cm/mCmReceipt_head.jsp?noTid='.$od['od_tno'].'&noMethod=1\',\'receipt\',\'width=430,height=700\');';
                            } else if(
$od['od_pg'] == 'nicepay') {
                                
$hp_receipt_script 'window.open(\'https://www.nicepay.co.kr/homepg/card_inquiry.jsp\',\'receipt\',\'width=900,height=700,scrollbars=yes\');';
                            } else {
                                
$hp_receipt_script 'window.open(\''.G5_BILL_RECEIPT_URL.'mcash_bill&tno='.$od['od_tno'].'&order_no='.$od['od_id'].'&trade_mony='.$od['od_receipt_price'].'\', \'winreceipt\', \'width=500,height=690,scrollbars=yes,resizable=yes\');';
                            }
                        
?>
                        <a href="javascript:;" onclick="<?php echo $hp_receipt_script?>">영수증 출력</a>
                        <?php
                        
}

                        if(
$od['od_settle_case'] == '신용카드')
                        {
                            if(
$od['od_pg'] == 'lg') {
                                require_once 
G5_SHOP_PATH.'/settle_lg.inc.php';
                                
$LGD_TID      $od['od_tno'];
                                
$LGD_MERTKEY  $config['cf_lg_mert_key'];
                                
$LGD_HASHDATA md5($LGD_MID.$LGD_TID.$LGD_MERTKEY);

                                
$card_receipt_script 'showReceiptByTID(\''.$LGD_MID.'\', \''.$LGD_TID.'\', \''.$LGD_HASHDATA.'\');';
                            } else if(
$od['od_pg'] == 'inicis') {
                                
$card_receipt_script 'window.open(\'https://iniweb.inicis.com/DefaultWebApp/mall/cr/cm/mCmReceipt_head.jsp?noTid='.$od['od_tno'].'&noMethod=1\',\'receipt\',\'width=430,height=700\');';
                            } else if(
$od['od_pg'] == 'nicepay') {
                                
$card_receipt_script 'window.open(\'https://www.nicepay.co.kr/homepg/card_inquiry.jsp\',\'receipt\',\'width=900,height=700,scrollbars=yes\');';
                            } else {
                                
$card_receipt_script 'window.open(\''.G5_BILL_RECEIPT_URL.'card_bill&tno='.$od['od_tno'].'&order_no='.$od['od_id'].'&trade_mony='.$od['od_receipt_price'].'\', \'winreceipt\', \'width=470,height=815,scrollbars=yes,resizable=yes\');';
                            }
                        
?>
                        <a href="javascript:;" onclick="<?php echo $card_receipt_script?>">영수증 출력</a>
                        <?php
                        
}
                        
?>
                    <td>
                    </td>
                </tr>
                <?php
                
}

                if (
$od['od_receipt_point'] > 0)
                {
                
?>
                <tr>
                    <th scope="row">포인트사용</th>
                    <td class="alignL"><?php echo display_point($od['od_receipt_point']); ?></td>
                </tr>

                <?php
                
}

                if (
$od['od_refund_price'] > 0)
                {
                
?>
                <tr>
                    <th scope="row">환불 금액</th>
                    <td class="alignL"><?php echo display_price($od['od_refund_price']); ?></td>
                </tr>
                <?php
                
}

                
// 현금영수증 발급을 사용하는 경우에만
                
if ($default['de_taxsave_use']) {
                    
// 미수금이 없고 현금일 경우에만 현금영수증을 발급 할 수 있습니다.
                    
if ($misu_price == && $od['od_receipt_price'] && ($od['od_settle_case'] == '무통장' || $od['od_settle_case'] == '계좌이체' || $od['od_settle_case'] == '가상계좌')) {
                
?>
                <tr>
                    <th scope="row">현금영수증</th>
                    <td class="alignL">
                    <?php
                    
if ($od['od_cash'])
                    {
                        if(
$od['od_pg'] == 'lg') {
                            require_once 
G5_SHOP_PATH.'/settle_lg.inc.php';

                            switch(
$od['od_settle_case']) {
                                case 
'계좌이체':
                                    
$trade_type 'BANK';
                                    break;
                                case 
'가상계좌':
                                    
$trade_type 'CAS';
                                    break;
                                default:
                                    
$trade_type 'CR';
                                    break;
                            }
                            
$cash_receipt_script 'javascript:showCashReceipts(\''.$LGD_MID.'\',\''.$od['od_id'].'\',\''.$od['od_casseqno'].'\',\''.$trade_type.'\',\''.$CST_PLATFORM.'\');';
                        } else if(
$od['od_pg'] == 'inicis') {
                            
$cash unserialize($od['od_cash_info']);
                            
$cash_receipt_script 'window.open(\'https://iniweb.inicis.com/DefaultWebApp/mall/cr/cm/Cash_mCmReceipt.jsp?noTid='.$cash['TID'].'&clpaymethod=22\',\'showreceipt\',\'width=380,height=540,scrollbars=no,resizable=no\');';
                        } else if(
$od['od_pg'] == 'nicepay') {
                                
$card_receipt_script 'window.open(\'https://www.nicepay.co.kr/homepg/cash.jsprcptId\',\'receipt\',\'width=900,height=700,scrollbars=yes\');';
                        } else {
                            require_once 
G5_SHOP_PATH.'/settle_kcp.inc.php';

                            
$cash unserialize($od['od_cash_info']);
                            
$cash_receipt_script 'window.open(\''.G5_CASH_RECEIPT_URL.$default['de_kcp_mid'].'&orderid='.$od_id.'&bill_yn=Y&authno='.$cash['receipt_no'].'\', \'taxsave_receipt\', \'width=360,height=647,scrollbars=0,menus=0\');';
                        }
                    
?>
                        <a href="javascript:;" onclick="<?php echo $cash_receipt_script?>" class="btn_frmline">현금영수증 확인하기</a>
                    <?php
                    
}
                    else
                    {
                    
?>
                        <a href="javascript:;" onclick="window.open('<?php echo G5_SHOP_URL?>/taxsave.php?od_id=<?php echo $od_id?>', 'taxsave', 'width=550,height=400,scrollbars=1,menus=0');" class="btn_frmline">현금영수증을 발급하시려면 클릭하십시오.</a>
                    <?php ?>
                    </td>
                </tr>
                <?php
                    
}
                }
                
?>
                </tbody>
                </table>
            </div>
        </section>
        
        <section id="sod_fin_dvr">
            <h3>배송정보</h3>

            <div class="tbl_head01 tbl_wrap">
                <table>
                <colgroup>
                    <col class="grid_3">
                    <col>
                </colgroup>
                <tbody>
                <?php
                
if ($od['od_invoice'] && $od['od_delivery_company'])
                {
                        
$sql "select ct_delivery_company, ct_invoice from  {$g5['g5_shop_cart_table']} where od_id = '{$od_id}' group by ct_delivery_company, ct_invoice  ";
                        
$resx sql_query($sql);
                        
$ct_invoce_cnt mysql_num_rows($resx);
                
?>
                <tr>
                    <th scope="row">배송회사 / 운송장번호</th>
                    <td>
                    <?php
                        
if($ct_invoce_cnt==1){
                    
?>
                        <?php echo $od['od_delivery_company']; ?> <?php echo get_delivery_inquiry($od['od_delivery_company'], $od['od_invoice'], 'dvr_link'); ?>
                        &nbsp;/&nbsp;<?php echo $od['od_invoice']; ?>
                    <?php
                        
} else {
                            while(
$infox=mysql_fetch_array($resx)){
                    
?>
                        <?php echo $infox['ct_delivery_company']; ?> <?php echo get_delivery_inquiry($infox['ct_delivery_company'], $infox['ct_invoice'], 'dvr_link'); ?>
                        &nbsp;/&nbsp;<?php echo $infox['ct_invoice']; ?><br>
                    <?php
                            
}
                        }
                    
?>
                    </td>
                </tr>
                <tr>
                    <th scope="row">배송일시</th>
                    <td><?php echo $od['od_invoice_time']; ?></td>
                </tr>
                <?php
                
}
                else
                {
                
?>
                <tr>
                    <td class="empty_table">아직 배송하지 않았거나 배송정보를 입력하지 못하였습니다.</td>
                </tr>
                <?php
                
}
                
?>
                </tbody>
                </table>
            </div>
        </section>
    </div>

    <section id="sod_fin_tot">
        <h2>결제합계</h2>

        <ul>
            <li>
                총 구매액
                <strong><?php echo display_price($tot_price); ?></strong>
            </li>
            <?php
            
if ($od_dc_price 0) {
            echo 
'<li>';
            echo 
'등급할인금액'.PHP_EOL;
            echo 
'<strong>'.display_price($od_dc_price).'</strong>';
            echo 
'</li>';
            }
            
?>
            <?php
            
if ($misu_price 0) {
            echo 
'<li>';
            echo 
'미결제액'.PHP_EOL;
            echo 
'<strong>'.display_price($misu_price).'</strong>';
            echo 
'</li>';
            }
            
?>
            <li id="alrdy">
                결제액
                <strong><?php echo $wanbul?></strong>
            </li>
        </ul>
    </section>

    <section id="sod_fin_cancel">
        <h2>주문취소</h2>
        <?php
        
// 취소한 내역이 없다면
        
if ($cancel_price == 0) {
            if (
$custom_cancel) {
        
?>
        <button type="button" onclick="document.getElementById('sod_fin_cancelfrm').style.display='block';" class="btn_submit">주문 취소하기</button>

        <div id="sod_fin_cancelfrm">
            <form method="post" action="./orderinquirycancel.php" onsubmit="return fcancel_check(this);">
            <input type="hidden" name="od_id"  value="<?php echo $od['od_id']; ?>">
            <input type="hidden" name="token"  value="<?php echo $token?>">

            <label for="cancel_memo">취소사유</label>
            <input type="text" name="cancel_memo" id="cancel_memo" required class="frm_input required" size="40" maxlength="100">
            <input type="submit" value="확인" class="btn01">

            </form>
        </div>
        <?php
            
}
        } else {
        
?>
        <p>주문 취소, 반품, 품절된 내역이 있습니다.</p>
        <?php ?>
    </section>

    <?php if ($od['od_settle_case'] == '가상계좌' && $od['od_misu'] > && $default['de_card_test'] && $is_admin && $od['od_pg'] == 'kcp') {
    
preg_match("/\s{1}([^\s]+)\s?/"$od['od_bank_account'], $matchs);
    
$deposit_no trim($matchs[1]);
    
?>
    <p>관리자가 가상계좌 테스트를 한 경우에만 보입니다.</p>
    <div class="tbl_frm01 tbl_wrap">
        <form method="post" action="http://devadmin.kcp.co.kr/Modules/Noti/TEST_Vcnt_Noti_Proc.jsp" target="_blank">
        <table>
        <caption>모의입금처리</caption>
        <colgroup>
            <col class="grid_3">
            <col>
        </colgroup>
        <tbody>
        <tr>
            <th scope="col"><label for="e_trade_no">KCP 거래번호</label></th>
            <td><input type="text" name="e_trade_no" value="<?php echo $od['od_tno']; ?>"></td>
        </tr>
        <tr>
            <th scope="col"><label for="deposit_no">입금계좌</label></th>
            <td><input type="text" name="deposit_no" value="<?php echo $deposit_no?>"></td>
        </tr>
        <tr>
            <th scope="col"><label for="req_name">입금자명</label></th>
            <td><input type="text" name="req_name" value="<?php echo $od['od_deposit_name']; ?>"></td>
        </tr>
        <tr>
            <th scope="col"><label for="noti_url">입금통보 URL</label></th>
            <td><input type="text" name="noti_url" value="<?php echo G5_SHOP_URL?>/settle_kcp_common.php"></td>
        </tr>
        </tbody>
        </table>
        <div id="sod_fin_test" class="btn_confirm">
            <input type="submit" value="입금통보 테스트" class="btn_submit">
        </div>
        </form>
    </div>
    <?php ?>

</div>
<!-- } 주문상세내역 끝 -->

<script>
$(function() {
    $("#sod_sts_explan_open").on("click", function() {
        var $explan = $("#sod_sts_explan");
        if($explan.is(":animated"))
            return false;

        if($explan.is(":visible")) {
            $explan.slideUp(200);
            $("#sod_sts_explan_open").text("상태설명보기");
        } else {
            $explan.slideDown(200);
            $("#sod_sts_explan_open").text("상태설명닫기");
        }
    });

    $("#sod_sts_explan_close").on("click", function() {
        var $explan = $("#sod_sts_explan");
        if($explan.is(":animated"))
            return false;

        $explan.slideUp(200);
        $("#sod_sts_explan_open").text("상태설명보기");
    });
});

function fcancel_check(f)
{
    if(!confirm("주문을 정말 취소하시겠습니까?"))
        return false;

    var memo = f.cancel_memo.value;
    if(memo == "") {
        alert("취소사유를 입력해 주십시오.");
        return false;
    }

    return true;
}
</script>

<?php
include_once('./_tail.php');
?>