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

//_pr($_POST); 

$ps_run false;

if(
$it['it_id']) {
    
$sql " select * from {$g5['g5_shop_item_option_table']} where io_type = '1' and it_id = '{$it['it_id']}' order by io_no asc ";
    
$result sql_query($sql);
    if(
mysql_num_rows($result))
        
$ps_run true;
} else if(!empty(
$_POST)) {
    
$subject_count count($_POST['subject']);
    
$supply_count count($_POST['supply']);
    
$supply_code_count count($_POST['supply_code']);

    if(!
$subject_count || !$supply_count || !$supply_code_count) {
        echo 
'추가옵션명과 추가옵션항목을 입력해 주십시오.';
        exit;
    }

    
$ps_run true;
}

$sql "select it_3 from {$g5['g5_shop_item_table']} where it_id = '{$it_id}' ";
$it_info sql_fetch($sql);

if(
$ps_run || 1==1) {
?>
<div class="sit_option_frm_wrapper" style='display:<?php if($ps_run){?><?php } else {?>none<?php ?>;'>
    <table>
    <caption>추가옵션 목록</caption>
    <thead>
    <tr>
        <th scope="col">
            <label for="spl_chk_all" class="sound_only">전체 추가옵션</label>
            <input type="checkbox" name="spl_chk_all" value="1">
        </th>
        <th scope="col">옵션명</th>
        <th scope="col">옵션항목</th>
        <th scope="col">상품금액</th>
        <th scope="col">상품구입가</th>
        <th scope="col">재고수량</th>
<?php if($default['de_cs_qty_use']=='1'){ ?>
        <th scope="col">천년수량</th>
<?php ?>
        <th scope="col">통보수량</th>
        <th scope="col">사용여부</th>
<?php if($it_info['it_3']=='2'){?>
        <th scope="col">재고비중</th>
<?php ?>
    </tr>
    </thead>
    <tbody>
    <?php
    
if($it['it_id']) {
        for(
$i=0$row=sql_fetch_array($result); $i++) {
            
$spl_id $row['io_id'];
            
$spl_val explode(chr(30), $spl_id);
            
$spl_subject $spl_val[0];
            
$spl $spl_val[1];
            for(
$x=2;$x<count($spl_val);$x++){
                
$spl $spl.chr(30).$spl_val[$x];
            }
            
$spl_price $row['io_price'];
            
$spl_buyprice $row['io_buyprice'];
            
$spl_stock_qty $row['io_stock_qty'];
            
$spl_noti_qty $row['io_noti_qty'];
            
$spl_use $row['io_use'];
            
$spl_qty_weight $row['io_qty_weight'];
            
$spl_code $row['spl_it_id'];
            if(
$row['spl_io_id']!=''){
                
$spl_code $spl_code."§".$row['spl_io_id'];
            }
            
$spl_cs_qty $row['io_cs_qty'];
    
?>
    <tr>
        <td class="td_chk">
            <input type="hidden" name="spl_id[]" value="<?php echo $spl_id?>">
            <input type="hidden" name="spl_code_id[]" value="<?php echo $spl_code?>">
            <label for="spl_chk_<?php echo $i?>" class="sound_only"><?php echo $spl_subject.' '.$spl?></label>
            <input type="checkbox" name="spl_chk[]" id="spl_chk_<?php echo $i?>" value="1">
        </td>
        <td class="spl-subject-cell"><?php echo $spl_subject?></td>
        <td class="spl-cell"><?php echo $spl?></td>
        <td class="td_numsmall">
            <label for="spl_price_<?php echo $i?>" class="sound_only">상품금액</label>
            <input type="text" name="spl_price[]" value="<?php echo $spl_price?>" id="spl_price_<?php echo $i?>" class="frm_input" size="9">
        </td>
        <td class="td_mng">
            <label for="spl_buyprice_<?php echo $i?>" class="sound_only">상품구입가</label>
            <input type="text" name="spl_buyprice[]" value="<?php echo $spl_buyprice?>" id="spl_buyprice_<?php echo $i?>" class="frm_input" size="9">
        </td>
        <td class="td_num">
            <label for="spl_stock_qty_<?php echo $i?>" class="sound_only">재고수량</label>
            <input type="text" name="spl_stock_qty[]" value="<?php echo $spl_stock_qty?>" id="spl_stock_qty_<?php echo $i?>" class="frm_input" size="5">
        </td>
<?php if($default['de_cs_qty_use']=='1'){ ?>
        <td class="td_num">
            <label for="opt_cs_qty_<?php echo $i?>" class="sound_only"></label>
            <?php echo $opt_cs_qty?>
        </td>
<?php ?>
        <input type="hidden" name="spl_cs_qty[]" value="<?php echo $spl_cs_qty?>" id="spl_cs_qty_<?php echo $i?>" class="frm_input" size="5">
        <td class="td_num">
            <label for="spl_noti_qty_<?php echo $i?>" class="sound_only">통보수량</label>
            <input type="text" name="spl_noti_qty[]" value="<?php echo $spl_noti_qty?>" id="spl_noti_qty_<?php echo $i?>" class="frm_input" size="5">
        </td>
        <td class="td_mng">
            <label for="spl_use_<?php echo $i?>" class="sound_only">사용여부</label>
            <select name="spl_use[]" id="spl_use_<?php echo $i?>">
                <option value="1" <?php echo get_selected('1'$spl_use); ?>>사용함</option>
                <option value="0" <?php echo get_selected('0'$spl_use); ?>>사용안함</option>
            </select>
        </td>
<?php if($it_info['it_3']=='2'){?>
        <td class="td_numsmall">
            <label for="spl_qty_weight_<?php echo $i?>" class="sound_only"></label>
            <input type="text" name="spl_qty_weight[]" value="<?php echo $spl_qty_weight?>" id="spl_qty_weight_<?php echo $i?>" class="frm_input" size="9">
        </td>
<?php ?>
    </tr>
    <?php
        
// for
    
} else {
        for(
$i=0$i<$subject_count$i++) {
            
$spl_subject preg_replace('/[\'\"]/'''trim(stripslashes($_POST['subject'][$i])));
            
$spl_val explode(','preg_replace('/[\'\"]/'''trim(stripslashes($_POST['supply'][$i]))));
            
$spl_code_val explode(','preg_replace('/[\'\"]/'''trim(stripslashes($_POST['supply_code'][$i]))));
            
$spl_qty_val explode(','preg_replace('/[\'\"]/'''trim(stripslashes($_POST['supply_qty'][$i]))));
            
$spl_price_val explode(','preg_replace('/[\'\"]/'''trim(stripslashes($_POST['supply_price'][$i]))));
            
$spl_buyprice_val explode(','preg_replace('/[\'\"]/'''trim(stripslashes($_POST['supply_buyprice'][$i]))));
            
$spl_count count($spl_val);

            for(
$j=0$j<$spl_count$j++) {
                
$spl strip_tags(trim($spl_val[$j]));
                
$spl_code strip_tags(trim($spl_code_val[$j]));
                
$spl_qty strip_tags(trim($spl_qty_val[$j]));
                
$spl_price strip_tags(trim($spl_price_val[$j]));
                
$spl_buyprice strip_tags(trim($spl_buyprice_val[$j]));
                if(
$spl_subject && strlen($spl)) {
                    
$spl_id $spl_subject.chr(30).$spl;
                    
$spl_price $spl_price*1;
                    
$spl_buyprice $spl_buyprice*1;
                    
$spl_stock_qty $spl_qty;
                    if(
$spl_stock_qty==''){ $spl_stock_qty 9999; }
                    
$spl_noti_qty 100;
                    
$spl_use 1;
                    
$spl_qty_weight 1;
                    
$opt_cs_qty 9999;

                    
// 기존에 설정된 값이 있는지 체크
                    
if($_POST['w'] == 'u') {
                        
$sql " select io_price, io_stock_qty, io_noti_qty, io_use, spl_it_id, spl_io_id, io_buyprice
                                    from 
{$g5['g5_shop_item_option_table']}
                                    where it_id = '
{$_POST['it_id']}'
                                      and io_id = '
$spl_id'
                                      and io_type = '1' "
;
                        
$row sql_fetch($sql);

                        if(
$row) {
                            
$spl_price = (int)$row['io_price'];
                            
$spl_buyprice = (int)$row['io_buyprice'];
                            
$spl_stock_qty = (int)$row['io_stock_qty'];
                            
$spl_noti_qty = (int)$row['io_noti_qty'];
                            
$spl_use = (int)$row['io_use'];
                            
$spl_qty_weight = (int)$row['io_qty_weight']*1;
                            
$spl_cs_qty = (int)$row['io_cs_qty'];
                            
$spl_code $row['spl_it_id'];
                            if(
$row['spl_io_id']!=''){ $spl_code $spl_code."§".$row['spl_io_id']; }
                        }
                    }
    
?>
    <tr>
        <td class="td_chk">
            <input type="hidden" name="spl_id[]" value="<?php echo $spl_id?>">
            <input type="hidden" name="spl_code_id[]" value="<?php echo $spl_code?>">
            <label for="spl_chk_<?php echo $i?>" class="sound_only"><?php echo $spl_subject.' '.$spl?></label>
            <input type="checkbox" name="spl_chk[]" id="spl_chk_<?php echo $i?>" value="1">
        </td>
        <td class="spl-subject-cell"><?php echo $spl_subject?></td>
        <td class="spl-cell"><?php echo $spl?></td>
        <td class="td_numsmall">
            <label for="spl_price_<?php echo $i?>" class="sound_only">상품금액</label>
            <input type="text" name="spl_price[]" value="<?php echo $spl_price?>" id="spl_price_<?php echo $i?>" class="frm_input" size="9">
        </td>
        <td class="td_mng">
            <label for="spl_buyprice_<?php echo $i?>" class="sound_only">상품구입가</label>
            <input type="text" name="spl_buyprice[]" value="<?php echo $spl_buyprice?>" id="spl_buyprice_<?php echo $i?>" class="frm_input" size="9">
        </td>
        <td class="td_num">
            <label for="spl_stock_qty_<?php echo $i?>" class="sound_only">재고수량</label>
            <input type="text" name="spl_stock_qty[]" value="<?php echo $spl_stock_qty?>" id="spl_stock_qty_<?php echo $i?>" class="frm_input" size="5">
        </td>
<?php if($default['de_cs_qty_use']=='1'){ ?>
        <td class="td_num">
            <label for="opt_cs_qty_<?php echo $i?>" class="sound_only"></label>
            <?php echo $opt_cs_qty?>
        </td>
<?php ?>
            <input type="hidden" name="spl_cs_qty[]" value="<?php echo $spl_cs_qty?>" id="spl_cs_qty_<?php echo $i?>" class="frm_input" size="5">
        <td class="td_num">
            <label for="spl_noti_qty_<?php echo $i?>" class="sound_only">통보수량</label>
            <input type="text" name="spl_noti_qty[]" value="<?php echo $spl_noti_qty?>" id="spl_noti_qty_<?php echo $i?>" class="frm_input" size="5">
        </td>
        <td class="td_mng">
            <label for="spl_use_<?php echo $i?>" class="sound_only">사용여부</label>
            <select name="spl_use[]" id="spl_use_<?php echo $i?>">
                <option value="1" <?php echo get_selected('1'$spl_use); ?>>사용함</option>
                <option value="0" <?php echo get_selected('0'$spl_use); ?>>사용안함</option>
            </select>
        </td>
<?php if($it_info['it_3']=='2'){?>
        <td class="td_mng">
            <label for="spl_qty_weight_<?php echo $i?>" class="sound_only">상품구입가</label>
            <input type="text" name="spl_qty_weight[]" value="<?php echo $spl_qty_weight?>" id="spl_qty_weight_<?php echo $i?>" class="frm_input" size="9">
        </td>
<?php ?>
    </tr>
    <?php
                
// if
            
// for
        
// for
    
}
    
?>
    </tbody>
    </table>
</div>
※ 추가옵션에서 상품금액은 상품 판매가격과는 상관없이 추가옵션상품의 절대치인 금액입니다. 추가옵션의 상품구입가도 마찬가지로 본상품의 구입가와는 상관없는 추가옵션상품의 절대치인 구입가격입니다.<br><br>
<div class="btn_list01 btn_list">
    <button type="button" id="sel_supply_delete">선택삭제</button>
</div>

<fieldset>
    <?php echo help('전체 추가 옵션의 상품금액, 재고/통보수량 및 사용여부를 일괄 적용할 수 있습니다.  단, 체크된 수정항목만 일괄 적용됩니다.'); ?>
    <label for="spl_com_price">상품금액</label>
    <label for="spl_com_price_chk" class="sound_only">상품금액일괄수정</label><input type="checkbox" name="spl_com_price_chk" value="1" id="spl_com_price_chk" class="spl_com_chk">
    <input type="text" name="spl_com_price" value="0" id="spl_com_price" class="frm_input" size="9">
    <label for="spl_com_price">상품구입가</label>
    <label for="spl_com_buyprice_chk" class="sound_only">상품금액일괄수정</label><input type="checkbox" name="spl_com_buyprice_chk" value="1" id="spl_com_buyprice_chk" class="spl_com_chk">
    <input type="text" name="spl_com_buyprice" value="0" id="spl_com_buyprice" class="frm_input" size="9">
    <label for="spl_com_stock">재고수량</label>
    <label for="spl_com_stock_chk" class="sound_only">재고수량일괄수정</label><input type="checkbox" name="spl_com_stock_chk" value="1" id="spl_com_stock_chk" class="spl_com_chk">
    <input type="text" name="spl_com_stock" value="0" id="spl_com_stock" class="frm_input" size="5">
    <label for="spl_com_noti">통보수량</label>
    <label for="spl_com_noti_chk" class="sound_only">통보수량일괄수정</label><input type="checkbox" name="spl_com_noti_chk" value="1" id="spl_com_noti_chk" class="spl_com_chk">
    <input type="text" name="spl_com_noti" value="0" id="spl_com_noti" class="frm_input" size="5">
    <label for="spl_com_use">사용여부</label>
    <label for="spl_com_use_chk" class="sound_only">사용여부일괄수정</label><input type="checkbox" name="spl_com_use_chk" value="1" id="spl_com_use_chk" class="spl_com_chk">
    <select name="spl_com_use" id="spl_com_use">
        <option value="1">사용함</option>
        <option value="0">사용안함</option>
    </select>
<?php if($it_info['it_3']=='2'){?>
    <label for="spl_com_qty_weight">재고비중</label>
    <label for="spl_com_qty_weight_chk" class="sound_only">추가금액일괄수정</label><input type="checkbox" name="spl_com_qty_weight_chk" value="1" id="spl_com_qty_weight_chk" class="spl_com_chk">
    <input type="text" name="spl_com_qty_weight" value="0" id="spl_com_qty_weight" class="frm_input" size="5">
<?php ?>
    <button type="button" id="spl_value_apply" class="btn_frmline">일괄적용</button>
</fieldset>
<?php
}
?>