/home/mjc1/public_html/j3demo/adm/intro.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
<?php
include("./_common.php");
include(
$j3_adm_path."/shop_header.php");


if(
$_SESSION['id_seller']=='Y'){

} else {

    
$f fopen($j3_path."/dbupdate.php","r"); // DB버젼 가져오기
    
for($i=0;$i<5;$i++){
        
$line fgets$f4096 );
        if(
substr($line,0,12)=='$shop_db_ver'){
            
$v explode("'",$line);
            
$new_db_ver $v[1];
        }
    }

    
/* 주문현황 그래프 프로그램 처리 */
    
$price_val[0] = 0;
    
$price_val[1] = 0;
    for(
$i=6;$i>=0;$i--){
        
$v date("Y-m-d",time()-(60*60*24*$i));
        
$day_list[$v] = $price_val;
    }

    
$sdate date("Y-m-d",time()-(60*60*24*6));
    
$edate date("Y-m-d",time());

    
$sql "select * from
        (select '0' as type, b.orddate, sum(cart_price+deli_price-dc_price-use_point) as sum_price
        from sale_ord_s a left join sale_ord_m b on a.midx = b.midx 
        where b.orddate >= '
{$sdate}'  and b.orddate <= '{$edate}' and a.ord_cancel = '0'
        group by b.orddate
        union
        select '1' as type, b.orddate, sum(cart_price+deli_price-dc_price-use_point)  as sum_price
        from sale_ord_s a left join sale_ord_m b on a.midx = b.midx 
        where b.orddate >= '
{$sdate}'  and b.orddate <= '{$edate}' and a.ord_cancel = '1'
        group by b.orddate) as aa
    order by orddate, type"
;

    
$res mysql_query($sql,$connect_j3);
    while(
$info mysql_fetch_array($res)){
        
$day_list[$info['orddate']][$info['type']] = $info['sum_price'];
    }

    foreach(
$day_list as $key=>$val){
        
$d1 .= $val[0].",";
        
$d2 .= $val[1].",";
        
$l1 .= "'".$key."',";
    }

    
$d1 "[".substr($d1,0,strlen($d1)-1)."]";
    
$d2 "[".substr($d2,0,strlen($d2)-1)."]";
    
$l1 "[".substr($l1,0,strlen($l1)-1)."]";

    
/* 주문현황 그래프 프로그램 처리 끝*/

    /* 처리할 주문 현황 */
    
$sql "select '미입금' as ord_state, count(*) as cnt, sum(cart_price+deli_price-dc_price-use_point) as sum_price
                from sale_ord_s a left join sale_ord_m b on a.midx = b.midx
                where b.ordstate = 0 and a.deposit = 0 and a.ord_cancel = 0
                union
                select '입금' as ord_state, count(*) as cnt, sum(cart_price+deli_price-dc_price-use_point) as sum_price
                from sale_ord_s a left join sale_ord_m b on a.midx = b.midx
                where b.ordstate = 0 and a.deposit = 1 and a.ord_cancel = 0
                union
                select '배송준비' as ord_state, count(*) as cnt, sum(cart_price+deli_price-dc_price-use_point) as sum_price
                from sale_ord_s a left join sale_ord_m b on a.midx = b.midx
                where b.ordstate = 1 and a.ord_cancel = 0
                union
                select '배송' as ord_state, count(*) as cnt, sum(cart_price+deli_price-dc_price-use_point) as sum_price
                from sale_ord_s a left join sale_ord_m b on a.midx = b.midx
                where b.ordstate = 2 and a.ord_cancel = 0"
;
    
$res mysql_query($sql,$connect_j3);
    
$cnt 0;
    while(
$info mysql_fetch_array($res)){
        
$ord_list[$cnt]['cnt'] = $info['cnt'];
        
$ord_list[$cnt]['sum_price'] = $info['sum_price'];
        
$cnt++;
    }
    
/* 처리할 주문 현황 끝 */

    /* 1:1문의 리스트 가져오기 */
    
$sql "select * from shop_qa where substring(reg_date,1,10) >= '{$sdate}' and qa_reply = '' order by reg_date desc limit 5";
    
$res mysql_query($sql,$connect_j3);
    while(
$info mysql_fetch_array($res)){
        
$qa_array[] = $info;
    }
    
/* 1:1문의 리스트 가져오기 */

    /* 상품문의 리스트 가져오기 끝 */
    
$sql "select * from shop_prod_qa where substring(iq_time,1,10) >= '{$sdate}' and iq_answer = '' order by iq_time desc limit 5";
    
$res mysql_query($sql,$connect_j3);
    while(
$info mysql_fetch_array($res)){
        
$pq_array[] = $info;
    }
    
/* 상품문의 리스트 가져오기 끝 */

    /* 사용후기 리스트 가져오기 끝 */
    
$sql "select * from shop_prod_use where substring(iu_time,1,10) >= '{$sdate}' and iu_view = '0' order by iu_time desc  limit 5";
    
$res mysql_query($sql,$connect_j3);
    while(
$info mysql_fetch_array($res)){
        
$pu_array[] = $info;
    }
    
/* 사용후기 리스트 가져오기 끝 */
    
?>
    <style>
        .gesi_table .gesi_table_td { vertical-align:top; width:32%; padding-left:10px; padding-right:10px; }
        #chart1 { margin-top:20px; }
    </style>
    <div id="wrap" class='container_wrap'>

    <?php if(1==1){ // 주문현황 그래프 처리?>
        <script type="text/javascript" src="<?php echo $j3_js_url;?>/jqplot/jquery.jqplot.min.js"></script>
        <script type="text/javascript" src="<?php echo $j3_js_url;?>/jqplot/plugins/jqplot.barRenderer.min.js"></script>
        <script type="text/javascript" src="<?php echo $j3_js_url;?>/jqplot/plugins/jqplot.pieRenderer.min.js"></script>
        <script type="text/javascript" src="<?php echo $j3_js_url;?>/jqplot/plugins/jqplot.categoryAxisRenderer.min.js"></script>
        <script type="text/javascript" src="<?php echo $j3_js_url;?>/jqplot/plugins/jqplot.pointLabels.min.js"></script>
        <link rel="stylesheet" type="text/css" href="<?php echo $j3_js_url;?>/jqplot/jquery.jqplot.min.css" />

        <div id='sub-title'>
            <h2 class=''>주문현황 그래프</h2>
        </div>
        <div class="jqPlot" id="chart1" style="width:100%; height:250px; "></div>
    <?php }?>

        <div id='sub-title'>
            <h2 class=''>처리 주문 현황</h2>
        </div>
        <div class="div-list-area">
            
            <div class="cust-list-area">
                <table class="order-sheet2">
                    <caption class="screen_out">주문 조회<caption>
                    <colgroup>
                    <col style="width:100px;"><col style="width:23%;"><col style="width:23%;">
                    <col style="width:23%;"><col style="width:23%;">
                    </colgroup>

                    <thead>
                        <tr>
                            <th scope="col">상태</th><th scope="col">미입금->입금</th><th scope="col">입금->배송준비</th>
                            <th scope="col">배송준비->배송</th><th scope="col">배송->배송완료</th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr>
                            <th class="tcenter ">건수</th>
                            <td class="tcenter "><a href='<?php echo $j3_adm_url;?>/order.php?ordstate_tab=00'><?php echo number_format($ord_list[0]['cnt']);?></a></td>
                            <td class="tcenter "><a href='<?php echo $j3_adm_url;?>/order.php?ordstate_tab=01'><?php echo number_format($ord_list[1]['cnt']);?></a></td>
                            <td class="tcenter"><a href='<?php echo $j3_adm_url;?>/order.php?ordstate_tab=1'><?php echo number_format($ord_list[2]['cnt']);?></a></td>
                            <td class="tcenter "><a href='<?php echo $j3_adm_url;?>/order.php?ordstate_tab=2'><?php echo number_format($ord_list[3]['cnt']);?></a></td>
                        </tr>
                        <tr>
                            <th class="tcenter ">금액</th>
                            <td class="tcenter "><a href='<?php echo $j3_adm_url;?>/order.php?ordstate_tab=00'><?php echo number_format($ord_list[0]['sum_price']);?></a></td>
                            <td class="tcenter "><a href='<?php echo $j3_adm_url;?>/order.php?ordstate_tab=01'><?php echo number_format($ord_list[1]['sum_price']);?></a></td>
                            <td class="tcenter"><a href='<?php echo $j3_adm_url;?>/order.php?ordstate_tab=1'><?php echo number_format($ord_list[2]['sum_price']);?></a></td>
                            <td class="tcenter "><a href='<?php echo $j3_adm_url;?>/order.php?ordstate_tab=2'><?php echo number_format($ord_list[3]['sum_price']);?></a></td>
                        </tr>
                    </tbody>
                </table>
            </div>
        </div>

        <table class='gesi_table'>
            <tr>
                <td class='gesi_table_td' >
                    <div id='sub-title'>
                        <h2 class=''>1:1문의 현황</h2>
                    </div>
                    <div class="div-list-area">
                        <div class="cust-list-area">
                            <table class="order-sheet2">
                                <caption class="screen_out">주문 조회<caption>
                                <colgroup>
                                <col style="width:15%;"><col style=""><col style="width:80px;">
                                </colgroup>

                                <thead>
                                    <tr>
                                        <th scope="col">성명</th><th scope="col">제목</th><th scope="col">날짜</th>
                                    </tr>
                                </thead>
                                <tbody>
                <?php
                    
foreach($qa_array as $key=>$info){
                
?>
                                    <tr>
                                        <td class="tcenter "><?php echo $info['qa_name']?></td>
                                        <td class="tcenter "><a href='<?php echo $j3_adm_url;?>/qa.php?idx=<?php echo $info['idx'];?>'><?php echo $info['qa_subject'];?></a></td>
                                        <td class="tcenter "><?php echo substr($info['reg_date'],0,10);?></td>
                                    </tr>
                <?php
                    
}
                
?>
                                </tbody>
                            </table>
                        </div>
                    </div>
                </td>
                <td class='gesi_table_td'>
                    <div id='sub-title'>
                        <h2 class=''>상품문의 현황</h2>
                        
                    </div>
                    <div class="div-list-area">
                        <div class="cust-list-area">
                            <table class="order-sheet2">
                                <caption class="screen_out">문의 조회<caption>
                                <colgroup>
                                <col style="width:15%;"><col style=""><col style="width:80px;">
                                </colgroup>

                                <thead>
                                    <tr>
                                        <th scope="col">성명</th><th scope="col">제목</th><th scope="col">날짜</th>
                                    </tr>
                                </thead>
                                <tbody>
                <?php
                    
foreach($pq_array as $key=>$info){
                
?>
                                    <tr>
                                        <td class="tcenter "><?php echo $info['iq_name']?></td>
                                        <td class="tcenter "><a href='<?php echo $j3_adm_url;?>/product_qa.php?idx=<?php echo $info['idx'];?>'><?php echo $info['iq_subject'];?></a></td>
                                        <td class="tcenter "><?php echo substr($info['iq_time'],0,10);?></td>
                                    </tr>
                <?php
                    
}
                
?>
                                </tbody>
                            </table>
                        </div>
                    </div>
                </td>
                <td class='gesi_table_td'>
                    <div id='sub-title'>
                        <h2 class=''>상품후기 현황</h2>
                        
                    </div>
                    <div class="div-list-area">
                        <div class="cust-list-area">
                            <table class="order-sheet2">
                                <caption class="screen_out">후기 조회<caption>
                                <colgroup>
                                <col style="width:15%;"><col style=""><col style="width:80px;">
                                </colgroup>

                                <thead>
                                    <tr>
                                        <th scope="col">성명</th><th scope="col">제목</th><th scope="col">날짜</th>
                                    </tr>
                                </thead>
                                <tbody>
                <?php
                    
foreach($pu_array as $key=>$info){
                
?>
                                    <tr>
                                        <td class="tcenter "><?php echo $info['iu_name']?></td>
                                        <td class="tcenter "><a href='<?php echo $j3_adm_url;?>/product_use.php?idx=<?php echo $info['idx'];?>'><?php echo $info['iu_subject'];?></a></td>
                                        <td class="tcenter "><?php echo substr($info['iu_time'],0,10);?></td>
                                    </tr>
                <?php
                    
}
                
?>
                                </tbody>
                            </table>
                        </div>
                    </div>
                </td>
            </tr>
            <tr>
                <td colspan=3 class='gesi_table_td'>
                    <span class='help_info' style='display:block;'> ◆ 1:1문의 : 최근 1주일 1:1문의 답변 없는것 5건까지 ◆ 상품문의 : 최근 1주일 상품문의 답변 없는것 5건까지 ◆ 상품후기 : 최근 1주일 상품후기 승인 없는것 5건까지 </span>
                </td>
            </tr>
        </table>

    </div>

    <script>
    $(function(){
        if('<?php echo $new_db_ver;?>'>'<?php echo $config['shop_db_ver'];?>'){
            if(confirm('DB버젼이 업데이트 되었습니다. DB를 업데이트 하시겠습니까?')){
                $.get("<?php echo $j3_url."/dbupdate.php";?>",function(rtn){
                    alert(rtn);
                });
            }
        } else {
            if('<?php echo $configshop['office_code'];?>'==''){
                alert('사업자설정이 되어 있지 않습니다. 쇼핑몰환경설정에서 사업자정보를 선택후 저장하시기 바랍니다.');
                document.location.href='config_shop.php';
            }
        }
        graph1('chart1','주문현황');
    });

    function graph1(chart_name,title){
        $.jqplot.config.enablePlugins = true;
        var s1 = <?php echo $d1;?>;
        var s2 = <?php echo $d2;?>;
        var ticks = <?php echo $l1;?>;
         
        plot1 = $.jqplot('chart1', [s1,s2], {
            // Only animate if we're not using excanvas (not in IE 7 or IE 8)..
            /*title: title+' 그래프', */
            series: [{ 
                label: '주문', 
                neighborThreshold: -1 ,
                lineWidth:2
            },
            { 
                label: '취소', 
                neighborThreshold: -1 ,
                lineWidth:2
            }
            ], 
            animate: !$.jqplot.use_excanvas,
            seriesColors:['#00749F', '#73C774', '#85802b', '#00749F', '#73C774', '#C7754C', '#17BDB8' ],
            seriesDefaults:{
                renderer:$.jqplot.BarRenderer,
                pointLabels: { show: true },
                rendererOptions: {
                // Set varyBarColor to tru to use the custom colors on the bars.
            }

            },
            axes: {
                xaxis: {
                    renderer: $.jqplot.CategoryAxisRenderer,
                    ticks: ticks
                },
                yaxis: {
                    tickOptions: {
                        formatString: "%'d"
                    },
                    rendererOptions: {
                        forceTickAt0: true
                    }
                }
            },
            highlighter: { show: true },
            cursor:{
                show: true, 
                zoom: true
            },
            legend:{ show: true }
        });
    }
    </script>
<?php
}
//_pr($app_id);
//_pr($app_dbname);
//_pr($_SESSION);
//_pr($_COOKIE);
//_pr($config);
//_pr($configshop);
include($j3_adm_path."/sql_log_del.inc.php"); // 테이블 업데이트 삭제 로그 관리 최근 3달만 보관
include($j3_adm_path."/shop_footer.php");
?>