/home/mjc1/public_html/otms_old/order.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
<?php
$dir 
".";
include_once(
$dir."/_common.php");
include(
'./header.php'); 

if(
$eid==''){
    
alert('로그인 후에 이용가능합니다.',"index.php"); exit;
}

if(
$order_key==''){ 
    if(
$_COOKIE['ok_product']!=''){
        
$_COOKIE['ok_product'] = str_replace("%20"," ",$_COOKIE['ok_product']);
        
$order_key $_COOKIE['ok_product']; 
    } else {
        
$order_key 'a.om_site, a.ord_date desc'
    }
}

$where " ";

if(
$stx!=''){
    
$where .= " and {$sti} like '%{$stx}%' ";
}

if(
$stc!=''){
    
$where .= " and a.c_depth = '{$stc}' ";
}

if(
$stpc!=''){
    
$where .= " and a.om_site = '{$stpc}' ";
}

$sql  =   "select count(*) as cnt from zom_prod_qa a WHERE 1=1 {$where} ";
$result      =    mysql_query($sql,$connect_om);
$row mysql_fetch_array($result);
$total_count $row['cnt'];

$list_num 30;
if(
$_COOKIE['page_line']!=''){ $list_num $_COOKIE['page_line']; }
$total_page  ceil($total_count $list_num);  // 전체 페이지 계산
if ($page 1) { $page 1; } // 페이지가 없으면 첫 페이지 (1 페이지)
$from_record = ($page 1) * $list_num// 시작 열을 구함

$sql "select a.* from zom_order a left join zom_product b on a.p_code = b.p_code and a.om_site = b.om_site WHERE 1=1 $where order by $order_key limit $from_record$list_num ";
$result      =    mysql_query($sql,$connect_om);

//_pr($sql);
while($cus_info=mysql_fetch_array($result)){
    
$list_array[] = $cus_info;
}

$qstr $_SERVER['QUERY_STRING'];

$sql "select * from zom_base_cont where om_site = '11' and base_key = 'ordPrdStat' order by seq, idx"// 주문상태코드 선택옵션들 가져옴
$res mysql_query($sql,$connect_om);
while(
$info=mysql_fetch_array($res)){
    
$ordPrdStat[$info['base_cont_no']] = $info['base_cont_name'];
}
?>

<!--<div id="contents" style="background:#999"><img src="http://placehold.it/960x150" alt="롤링배너"></div>-->
<div id="contents" style="height:2px;border-bottom:1px solid #eee;background:#2f6ba9">
    <span class="screen_out">header 하단 선</span>
</div>

<div id="wrap">
    <div id="sub-title">
        <h2>주문 관리</h2>
        <div class="sub-location">
            <a href="./index.php" class="home"><span class="screen_out">홈</span></a>
            <span class="location-gt"></span>
            <a>주문 관리</a>
            <span class="location-gt"></span>
            <a>주문 관리</a>
        </div>
    </div>
<form name='category_search_form' method='get'>
    <input type='hidden' name='biztype' size='' value='<?php echo $biztype;?>'>
    <div id="sub-contents-area">
        <div class="sub-btn-area">
            <div class="sub-btn">
                <a class="lignt-blue-btn" id='btn_new_rdy_11' style='width:160px;'>11번가 주문대기/완료GET </a>
                <a class="lignt-blue-btn" id='btn_new_can_11' style='width:130px;'>11번가 주문취소GET </a>
                <a class="lignt-blue-btn" id='btn_new_cmp_11' style='width:130px;'>11번가 배송완료GET </a>
                <a class="lignt-blue-btn" id='btn_new_gcp_11' style='width:130px;'>11번가 수취완료GET </a>
                <a class="lignt-blue-btn" id='btn_new_bck_11' style='width:130px;'>11번가 반품GET </a>
                <!--<a class="blue-btn" id='cate_prod_move'>분류상품이동</a><?php if($Orow['ordstate']==0){ ?><a class="black-btn">전체삭제</a><?php }?><a class="gray-btn" id='buy_print'>인쇄</a>--><!--<a class="gray-btn" id='xls_down'>엑셀</a><a class="black-btn" id='sel_delete'>선택삭제</a>-->
            </div>
        </div>
        <div class="sub-btn-area">
            <div class="sub-btn sub-btn-search">
                <!--<select name='stc'>
                    <option value='' <?php if($stc==''){ echo "selected"; }?>>-분류차수-</option>
                    <option value='1' <?php if($stc=='1'){ echo "selected"; }?>>1차만</option>
                    <option value='2' <?php if($stc=='2'){ echo "selected"; }?>>2차만</option>
                    <option value='3' <?php if($stc=='3'){ echo "selected"; }?>>3차만</option>
                    <option value='4' <?php if($stc=='4'){ echo "selected"; }?>>4차만</option>
                </select>-->
                <select name='sti'>
                    <option value='a.ord_no' <?php if($sti=='a.ord_no'){?>width:160px<?php }?>>주문번호</option>
                    <option value='a.o_name' <?php if($sti=='a.o_name'){?>selected<?php }?>>주문자명</option>
                    <option value='a.mem_id' <?php if($sti=='a.mem_id'){?>selected<?php }?>>주문자아이디</option>
                    <option value='a.p_name' <?php if($sti=='a.p_name'){?>selected<?php }?>>상품명</option>
                    <option value='a.o_hp' <?php if($sti=='a.o_hp'){?>selected<?php }?>>주문자핸드폰</option>
                </select>
                <input type='text' id='stx' name='stx' size='' value='<?php echo $stx;?>' class="stx_class">&nbsp;<a href="#" class="black-btn" id='search_btn_press'>검색</a>
            </div>
        </div>
    </div>
</form>
    <div class="item_tab">
        <div class="item_tab_navi">
            <a value='0' class="on"><span>전체</span></a>
            <a value='1'><span>11번가</span></a>
            <a value='9'><span>주문매핑</span></a>
        </div>
    </div>

<form name='product_list_form' method='post'>
<input type='hidden' name='sel_del' value=''>
    <div class="div-list-area">
        <div class="cust-list-area">
            <table class="order-sheet2" style='font-size:0.9em;'>
                <caption class="screen_out">매입처 원장 조회<caption>
                <colgroup>
                <col style="width:30px;">
                <col style="width:60px;"><col style="width:120px;"><col style="width:60px;">
                <col style="width:90px;"><col style="width:100px;"><col style="width:200px;">
                <col style="width:60px;"><col style="width:100px;"><col style="width:120px;">
                <col style="width:120px;">
                </colgroup>

                <thead>
                    <tr>
                        <th scope="col"><input type='checkbox' name='ck_all' class='check_all_class'></th>
                        <th scope="col">사이트</th><th scope="col">주문코드</th><th scope="col">주문순번</th>
                        <th scope="col">회원ID</th><th scope="col">상품코드</th><th scope="col">상품명</th>
                        <th scope="col">상품수량</th><th scope="col">결제예정금액</th><th scope="col">주문자핸드폰</th>
                        <th scope="col">상태</th><th scope="col">주문일자</th>
                    </tr>
                </thead>
                <tbody>
<?php 
    $num 
$total_count - ($page 1) * $list_num;
    for(
$i=0;$i<count($list_array);$i++){ 
        
$info $list_array[$i];
?>
                    <tr>
                        <td class="tcenter ">
                            <input type='checkbox' name='code_idx[]' value='<?php echo $i;?>' class='code_idx_calss'>
                            <input type='hidden' name='codes[]' value='<?php echo $info['idx'];?>'>
                            <input type='hidden' name='p_codes[]' value='<?php echo $info['p_code'];?>'>
                        </td>
                        <td class="tcenter "><?php echo $info['om_site'];?></td>
                        <td class="tcenter click_edit">    <?php echo $info['ord_no'];?></td>
                        <td class="tcenter click_edit">    <?php echo $info['ord_seq'];?></td>
                        <td class="linetxt "><?php echo $info['mem_id'];?></td>
                        <td class="tcenter click_prod"><?php echo $info['p_code'];?></td>
                        <td class="linetxt click_prod"><?php echo $info['p_name'];?></td>
                        <td class="tcenter "><?php echo $info['p_qty'];?></td>
                        <td class="cost "><?php echo number_format($info['ordpay_amt']);?></td>
                        <td class="tcenter "><?php echo $info['o_hp'];?></td>
                        <td class="tcenter "><?php echo $ordPrdStat[$info['ord_state']];?></td>
                        <td class="tcenter "><?php echo $info['ord_date'];?></td>
                    </tr>
<?php 
        $num
--;
    } 
?>
                </tbody>
            </table>
        </div>
    </div>
</form>

    <div class='pg_wrap' style='padding-top:0px;'>
        <?php echo get_paging(10$page$total_page"?$qstr");?>
    </div>

<span class='help_info'></span>

</div><!--//wrap-->

<script>
var qstr = '<?php echo $qstr;?>';
$(function(){
    $(".item_tab_navi a").click(function(){ //네비게이션 탭 처리
        v = $(this).attr("value");
        if(v==0){
            document.location.href="order.php?";
        } else if(v==9){
            document.location.href="order_map.php";
        } else {
            document.location.href="order.php?stpc=11";
        }
    });

    $(".check_all_class").click(function(){ // 전체선택 전체선택 해제
        if($(this).is(":checked")){
            $("input[name='code_idx[]']").prop("checked",true);
        } else {
            $("input[name='code_idx[]']").prop("checked",false);            
        }
    });

    $(".click_prod").click(function(){
        $code = $(this).closest("tr").find("input[name='p_codes[]']").val();
        setsave("qstr",qstr,1);
        document.location.href='product_view.php?code='+$code;
    });

    $(".click_edit").click(function(){
        $code = $(this).closest("tr").find("input[name='codes[]']").val();
        setsave("qstr",qstr,1);
        document.location.href='order_view.php?idx='+$code;
    });

    $("#btn_new_rdy_11").click(function(){
        if(confirm('11번가의 주문대기정보를 가져오시겠습니까?')){
            $("#modal_member_box").dialog({
                resizable: true, height:480, width:500, modal: true, title: "주문 [가져오기]"
            });

            setTimeout(function(){
                $.ajax({type:"post", url:"ajax.11.order_process.php?sel_del=order_ready_get", async:true, dataType : "xml", 
                    success:function(xml){    
                        var v_mode = $(xml).find("mode").text();
                        var v_mode_ok = $(xml).find("mode_ok").text();
                        var v_msg = $(xml).find("msg").text();
                        var v_prd_cnt = $(xml).find("prd_cnt").text();
                        var v_use_time = $(xml).find("use_time").text();
                        if(v_mode_ok!='Y'){
                            alert(v_msg);
                            $("#modal_member_box").dialog("close");
                        } else {
                            alert(v_prd_cnt+'개의 주문 갱신이 완료 되었습니다.'+v_use_time+'초');
                            document.location.reload();
                        }
                    },
                    error:function(rtn,status,error){    alert(error);        }
                });                
            },1000);
        }
    });

    $("#btn_new_inc_11").click(function(){
        if(confirm('11번가의 주문완료정보를 가져오시겠습니까?')){
            $("#modal_member_box").dialog({
                resizable: true, height:480, width:500, modal: true, title: "주문 [가져오기]"
            });

            setTimeout(function(){
                $.ajax({type:"post", url:"ajax.11.order_process.php?sel_del=order_income_get", async:true, dataType : "xml", 
                    success:function(xml){    
                        var v_mode = $(xml).find("mode").text();
                        var v_mode_ok = $(xml).find("mode_ok").text();
                        var v_msg = $(xml).find("msg").text();
                        var v_prd_cnt = $(xml).find("prd_cnt").text();
                        var v_use_time = $(xml).find("use_time").text();
                        if(v_mode_ok!='Y'){
                            alert(v_msg);
                            $("#modal_member_box").dialog("close");
                        } else {
                            alert(v_prd_cnt+'개의 주문 갱신이 완료 되었습니다.'+v_use_time+'초');
                            document.location.reload();
                        }
                    },
                    error:function(rtn,status,error){    alert(error);        }
                });                
            },1000);
        }
    });

    $("#btn_new_can_11").click(function(){
        if(confirm('11번가의 주문취소정보를 가져오시겠습니까?')){
            $("#modal_member_box").dialog({
                resizable: true, height:480, width:500, modal: true, title: "주문 [가져오기]"
            });

            setTimeout(function(){
                $.ajax({type:"post", url:"ajax.11.order_process.php?sel_del=order_cancel_get", async:true, dataType : "xml", 
                    success:function(xml){    
                        var v_mode = $(xml).find("mode").text();
                        var v_mode_ok = $(xml).find("mode_ok").text();
                        var v_msg = $(xml).find("msg").text();
                        var v_prd_cnt = $(xml).find("prd_cnt").text();
                        var v_use_time = $(xml).find("use_time").text();
                        if(v_mode_ok!='Y'){
                            alert(v_msg);
                            $("#modal_member_box").dialog("close");
                        } else {
                            alert(v_prd_cnt+'개의 주문 갱신이 완료 되었습니다.'+v_use_time+'초');
                            document.location.reload();
                        }
                    },
                    error:function(rtn,status,error){    alert(error);        }
                });                
            },1000);
        }
    });

    $("#btn_new_cmp_11").click(function(){
        if(confirm('11번가의 배송완료 정보를 가져오시겠습니까?')){
            $("#modal_member_box").dialog({
                resizable: true, height:480, width:500, modal: true, title: "주문 [가져오기]"
            });

            setTimeout(function(){
                $.ajax({type:"post", url:"ajax.11.order_process.php?sel_del=order_comp_get", async:true, dataType : "xml", 
                    success:function(xml){    
                        var v_mode = $(xml).find("mode").text();
                        var v_mode_ok = $(xml).find("mode_ok").text();
                        var v_msg = $(xml).find("msg").text();
                        var v_prd_cnt = $(xml).find("prd_cnt").text();
                        var v_use_time = $(xml).find("use_time").text();
                        if(v_mode_ok!='Y'){
                            alert(v_msg);
                            $("#modal_member_box").dialog("close");
                        } else {
                            alert(v_prd_cnt+'개의 주문 갱신이 완료 되었습니다.'+v_use_time+'초');
                            document.location.reload();
                        }
                    },
                    error:function(rtn,status,error){    alert(error);        }
                });                
            },1000);
        }
    });

    $("#btn_new_gcp_11").click(function(){
        if(confirm('11번가의 수취완료 정보를 가져오시겠습니까?')){
            $("#modal_member_box").dialog({
                resizable: true, height:480, width:500, modal: true, title: "주문 [가져오기]"
            });

            setTimeout(function(){
                $.ajax({type:"post", url:"ajax.11.order_process.php?sel_del=order_gcmp_get", async:true, dataType : "xml", 
                    success:function(xml){    
                        var v_mode = $(xml).find("mode").text();
                        var v_mode_ok = $(xml).find("mode_ok").text();
                        var v_msg = $(xml).find("msg").text();
                        var v_prd_cnt = $(xml).find("prd_cnt").text();
                        var v_use_time = $(xml).find("use_time").text();
                        if(v_mode_ok!='Y'){
                            alert(v_msg);
                            $("#modal_member_box").dialog("close");
                        } else {
                            alert(v_prd_cnt+'개의 주문 갱신이 완료 되었습니다.'+v_use_time+'초');
                            document.location.reload();
                        }
                    },
                    error:function(rtn,status,error){    alert(error);        }
                });                
            },1000);
        }
    });

    $("#btn_new_bck_11").click(function(){
        if(confirm('11번가의 반품 정보를 가져오시겠습니까?')){
            $("#modal_member_box").dialog({
                resizable: true, height:480, width:500, modal: true, title: "주문 [가져오기]"
            });

            setTimeout(function(){
                $.ajax({type:"post", url:"ajax.11.order_process.php?sel_del=order_back_get", async:true, dataType : "xml", 
                    success:function(xml){    
                        var v_mode = $(xml).find("mode").text();
                        var v_mode_ok = $(xml).find("mode_ok").text();
                        var v_msg = $(xml).find("msg").text();
                        var v_prd_cnt = $(xml).find("prd_cnt").text();
                        var v_use_time = $(xml).find("use_time").text();
                        if(v_mode_ok!='Y'){
                            alert(v_msg);
                            $("#modal_member_box").dialog("close");
                        } else {
                            alert(v_prd_cnt+'개의 주문 갱신이 완료 되었습니다.'+v_use_time+'초');
                            document.location.reload();
                        }
                    },
                    error:function(rtn,status,error){    alert(error);        }
                });                
            },1000);
        }
    });

    $("#xls_down").click(function(){ // 엑셀다운로드
        document.category_search_form.action='category_xls_down.php';
        document.category_search_form.target = '_blank';
        document.category_search_form.submit();
    });

    $("#search_btn_press").click(function(){
        document.category_search_form.action='?';
        document.category_search_form.target = '';
        document.category_search_form.submit();
    });

});
</script>
<?php include('./footer.php'); ?>
<div id="modal_member_box" title="거래처수정" style="display:none;width:100%; height:100%; padding-top:3px;padding-left:3px;background-color:#FFFFFF;position:relative;">
    <div style='font-size:16px;line-height:30px;'>
        상품 Q&A정보를 가져오는중입니다. 잠시만 기다려 주세요. <br>
        가져오기가 완료되면 자동으로 화면이 변경됩니다.<br>
        <p style='padding-left:100px;padding-top:30px;'><img src='./images/common/process_ani.gif' width=300></p>
    </div>
</div>