/home/mjc1/public_html/j3demo/adm/order_deli_xls_process.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
<?php
include_once('./_common.php');

// 상품이 많을 경우 대비 설정변경
set_time_limit );
ini_set('memory_limit''50M');

//_pr($_POST); exit;

function only_number($n)
{
    return 
preg_replace('/[^0-9]/'''$n);
}

if(
$_FILES['excelfile']['tmp_name']) {
    
$file $_FILES['excelfile']['tmp_name'];

    include_once(
$j3_lib_path.'/Excel/reader.php');

    
$data = new Spreadsheet_Excel_Reader();

    
// Set output Encoding.
    
$data->setOutputEncoding('UTF-8');

    
$data->read($file);

    
error_reporting(E_ALL E_NOTICE);

    
$dup_it_id = array();
    
$fail_it_id = array();
    
$dup_count 0;
    
$total_count 0;
    
$fail_count 0;
    
$succ_count 0;
    
$new_count 0;

    
//echo count($data->sheets[0]['numRows']); exit;

    
for ($i 3$i <= $data->sheets[0]['numRows']; $i++) {
        
$total_count++;

        
$j 1;

        
$od_id              addslashes($data->sheets[0]['cells'][$i][$j++]);
        
$deli_company              addslashes($data->sheets[0]['cells'][$i][$j++]);
        
$deli_num             addslashes($data->sheets[0]['cells'][$i][$j++]);

        
$sql "select s.midx from sale_ord_s s inner join sale_ord_m m on s.midx = m.midx where s.od_id = '{$od_id}' ";
        
$info sql_fetch($sql,$connect_j3);
        
        if((
$info['midx']*1)>0){
            if(
$ordstate=='2'){
                
$add_set ", ordstate = '{$ordstate}' ";
                
$ch_od_state $ordstate;
                
$his date("Ymd His",time())." 운송장번호 입력 : {$deli_company} {$deli_num} 주문상태변경 -> {$od_state_tit[$ch_od_state]} \n";
            } else {
                
$his date("Ymd His",time())." 운송장번호 입력 : {$deli_company} {$deli_num} \n";
            }
            
$add_set2 ",s_order_his = concat(s_order_his,'{$his}')";
            
$sql "update sale_ord_s set deli_company = '{$deli_company}{$add_set2} where midx = '{$info['midx']}' ";
            
mysql_query($sql,$connect_j3);
            
$sql "update sale_ord_m set tracking_number = '{$deli_num}{$add_set} where midx = '{$info['midx']}' ";
            
mysql_query($sql,$connect_j3);

            
// 아래 메일과 sms변경시 ajax.order_process.php쪽 부분도 확인하기 바랍니다.
            
if($s_mail=='Y' || $s_sms=='Y'){    $oinfo order_info_get($info['midx']);    }

            include(
"order_mail_sms.inc.php");

            
$dup_count++;
            
$dup_it_id[] = $od_id;
        } else {
            
$fail_count++;
            
$fail_it_id[] = $od_id;
        }

    }

}

include_once(
$j3_path."/header.sub.php");
?>

<link href="<?php echo $j3_adm_url;?>/css/admin.css" rel="stylesheet" />
<style>
    .cust_modal1, 
    .cust_modal2 { border:0px solid #e1e1e1; width:790px; padding:10px; font-size:13px }
    .cust_modal1 h4, 
    .cust_modal2 h4 { position:relative; top:-5px; font-size:14px; font-weight:bold; }
    .cust_modal2 { margin-top:0px; }
    .table-top-border tbody { border-top:1px solid #e1e1e1;}
    .cust_modal1 table tbody td,
    .cust_modal2 table tbody td { text-align:left; padding-left:5px;  }
    .cust_modal1 table tbody td input,
    .cust_modal2 table tbody td input{ border:1px solid #e9e9e9;  }
    .input_readonly {background:#E9E9E9; }
    .width_500 { width:500px !important; }
    .width_80 { width:80px !important; }
    .width_120 { width:120px !important; }
</style>

<div class='cust_modal1'>
    <h4>엑셀업로드 완료</h4>
    <table class="order-sheet table-top-border">
        <caption class="screen_out">엑셀업로드 완료</caption>
        <colgroup>
            <col style="width:100px;"><col style="width:500px;">
        </colgroup>

        <tbody>
        <tr>
            <th>총주문수</th>
            <td colspan=3><?php echo number_format($total_count); ?></td>
        </tr>
        <tr>
            <th>완료건수</th>
            <td colspan=3><?php echo number_format($dup_count); ?></td>
        </tr>
        <tr>
            <th>실패건수</th>
            <td colspan=3><?php echo number_format($fail_count); ?></td>
        </tr>
<?php if($fail_count 0) { ?>
        <tr>
            <th>실패상품코드</th>
            <td colspan=3><?php echo implode(', '$fail_it_id); ?></td>
        </tr>
<?php ?>
    </table>
</div>

<div id="sub-contents-area" style='padding-left:270px;padding-top:20px;'>
    <div class="sub-btn-area">
        <div class="sub-btn">
            <a class="gray-btn" id='btn_cancel_open'>닫기</a>
        </div>
    </div>
</div>

<script>
$(function(){
    $("#btn_cancel_open").click(function(){ // 닫기
        window.close();
    });
});
</script>