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
|
<?php $sub_menu = "300400"; include("./_common.php"); include("./auth_check.php"); // 관리자 권한 체크 include($j3_adm_path."/shop_header.php");
$click_edit = "click_edit";
if($order_key==''){ if($_COOKIE['ok_stock']!=''){ $_COOKIE['ok_stock'] = str_replace("%20"," ",$_COOKIE['ok_stock']); $order_key = $_COOKIE['ok_stock']; } else { $order_key = 'a.code1 desc'; } }
$where = " and a.code > 1 ";
$stx = urldecode($stx);
if($stx!=''){ $where .= " and {$sti} like '%{$stx}%' "; }
if($stc!=''){ $where .= " and prod_cate_code_s = '{$stc}' "; }
if($stpc!=''){ $where .= " and prod_cate_code2 = '{$stpc}' "; }
$sql = "select count(*) as cnt from product_m a left join product_d b on a.code = b.pcode inner join product_s e on a.code = e.pcode inner join product_category_s d on e.prod_cate_code_s = d.code WHERE 1=1 {$where} and ocode = '{$configshop['office_code']}' and a.shop_hidden<>1 "; $result = mysql_query($sql,$connect_j3); $row = mysql_fetch_array($result); $total_count = $row['cnt'];
$list_num = $config['page_line']; 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.*,b.*, e.*, d.name as cate_name, f.qty as begin_qty from product_m a left join product_d b on a.code = b.pcode left join product_s e on a.code = e.pcode inner join product_category_s d on e.prod_cate_code_s = d.code left join stock_begin f on a.code = f.pcode and f.ocode = '{$configshop['office_code']}' WHERE 1=1 $where and b.ocode = '{$configshop['office_code']}' and a.shop_hidden<>1 order by $order_key limit $from_record, $list_num "; $result = mysql_query($sql,$connect_j3);
//_pr($sql); $pcode_list = ""; while($cus_info=mysql_fetch_array($result)){ $pcode_list .= $cus_info['code'].","; // 개별 제고 가져오는 방식 대신에 한꺼번에 재고 가져와서 넣는방식으로 변경 $list_array[] = $cus_info; }
$pcode_list = substr($pcode_list,0,strlen($pcode_list)-1); $jego_array = product_jego_list_get($pcode_list); // 개별 제고 가져오는 방식 대신에 한꺼번에 재고 가져와서 넣는방식으로 변경 foreach($list_array as $key=>$pinfo){ $pcode = $pinfo['code']; $jego = $jego_array[$pcode]['jego'];
if($pinfo['set_yn']=='0'){ $list_array[$key]['jego'] = $jego; } else if($pinfo['set_yn']=='2'){ $sql = "select box_qty as jego from ({$jego_get_box_sql}) bbb where bbb.parent_pcode = '{$pcode}' "; $jego_info = sql_fetch($sql,$j3['connect_j3']); $list_array[$key]['jego'] = $jego_info['jego']; } else if($pinfo['set_yn']=='1'){ $list_array[$key]['jego'] = get_set_jego($pcode); } else { $list_array[$key]['jego'] = 9999; } }
$qstr = $_SERVER['QUERY_STRING'];
// 분류명 가져오기 $sql = "select a.* from product_category_s a where 1=1 and lv = 2 "; $result = mysql_query($sql,$connect_j3); while($cus_info=mysql_fetch_array($result)){ $cate_array[] = $cus_info; }
// 상품그룹 가져오기 /*$sql = "select a.* from product_category2 a where 1=1 order by code"; $result = mysql_query($sql,$connect_j3); while($cus_info=mysql_fetch_array($result)){ $cate2_array[] = $cus_info; }*/ ?> <!--<div id="contents" style="background:#999"><img src="http://placehold.it/960x150" alt="롤링배너"></div>-->
<div id="wrap" class='container_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='product_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"> <select name='order_key' class='order_key_class'> <option value='a.code1 desc' <?php if($order_key=='a.code1 desc'){?>selected<?php }?>>코드순</option> <option value='a.name' <?php if($order_key=='a.name'){?>selected<?php }?>>상품명순</option> </select> <input type='hidden' name='order_key_key' class='order_key_key' value='ok_stock'><!-- 오더키가 중복 안되게 shop_header.php에 있는 js에 해당 키를 선택하게 해주는 필드 --> <!--<a class="lignt-blue-btn" id='btn_order_new'>신규등록</a>--><a class="blue-btn" id='sel_edit'>선택수정</a><!--<a class="blue-btn">주문복사</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=''>--분류선택--</option> <?php foreach($cate_array as $key=>$val){ if($stc==$val['code']){ $sel = " selected"; } else { $sel = ""; } echo " <option value='{$val['code']}' {$sel}>{$val['name']}</option> "; } ?> </select> <select name='sti'> <option value='a.name' <?php if($sti=='a.name'){?>selected<?php }?>>상품명</option> <option value='a.code1' <?php if($sti=='a.code1'){?>selected<?php }?>>코드</option> <option value='a.norm' <?php if($sti=='a.norm'){?>selected<?php }?>>규격</option> <option value='a.pce_bcode1' <?php if($sti=='a.pce_bcode1'){?>selected<?php }?>>바코드</option> </select> <input type='text' id='stx' name='stx' size='' value='<?php echo $stx;?>' class="stx_class"> <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>재고조정 관리</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"> <caption class="screen_out">매입처 원장 조회<caption> <colgroup> <col style="width:30px;"> <col style="width:60px;"><col style="width:100px;"><col style="width:60px;"> <col style="width:200px;"><col style="width:100px;"> <!--<col style="width:60px;">--><col style="width:80px;"><col style="width:80px;"> <col style="width:80px;"><col style="width:80px;"> </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">상품명</th><th scope="col">규격</th> <th scope="col">매출단가</th><th scope="col">매입단가</th> <th scope="col">기초재고</th><th scope="col">현재고</th> </tr> </thead> <tbody class='change_check_class'> <?php 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['code'];?>'> <input type='hidden' name='pname[]' value='<?php echo $info['name'];?>'> </td> <td class="linetxt <?php echo $click_edit;?> padd_5px"><img src='<?php echo $thumb_file = get_it_thumbnail($info['code'],$info['pic1'],50,50);?>' width=50></td> <td class="linetxt "> <?php echo $info['cate_name'];?> </td> <td class="tcenter <?php echo $click_edit;?> cursor_p"><?php echo $info['code1'];?></td> <td class="linetxt <?php echo $click_edit;?> cursor_p"> <?php echo $info['name'];?> </td> <td class="linetxt "> <?php echo $info['norm'];?> </td> <!--<td class="cost "><?php echo number_format($info['packqty']);?></td>--> <td class="linetxt "> <?php echo $info['saleprice'];?> </td> <td class="linetxt "> <?php echo $info['buyprice'];?> </td> <td class="tcenter "> <input type='text' name='qty[]' class='width_60 number_class' value='<?php echo number_format($info['begin_qty'])?>'> </td> <td class="tcenter "> <?php if($info['opt_yn']=='1'){ echo "옵션상품"; } else { //echo number_format(product_jego_get($info['code'])); echo $info['jego']; } ?> </td> </tr> <?php } ?> </tbody> </table> </div> </div> </form> <span class='help_info'>재고 9999개는 쇼핑몰 무한재고입니다. 정확한 천년재고는 천년에서 확인하세요.</span>
<div class='pg_wrap' style='padding-top:0px;'> <?php echo get_paging($list_num, $page, $total_page, "?$qstr");?> </div>
</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="./product_stock.php"; } else { document.location.href="./product_stock_edit.php"; } });
$(".click_edit").css("cursor","pointer").click(function(){ // 상품 수정 var code = $(this).closest("tr").find("input[name='codes[]']").val(); document.location.href="product_reg.php?code="+code; });
$(".check_all_class").click(function(){ // 전체선택 전체선택 해제 if($(this).is(":checked")){ $("input[name='code_idx[]']").prop("checked",true); } else { $("input[name='code_idx[]']").prop("checked",false); } });
$(document).on("change",".change_check_class input, .change_check_class select",function(){ // input이나 select값이 변경되면 해당 라인을 체크해줌 $tr_obj = $(this).closest("tr"); $tr_obj.find(".code_idx_calss").prop("checked",true); });
$("#sel_edit").click(function(){ // 선택수정 var ck_cnt = 0; var v = $("input[name='code_idx[]']").each(function(){ if($(this).is(":checked")){ ck_cnt++; } }); if(ck_cnt==0){ alert('수정하실 상품을 선택하세요.'); return; } if(confirm('정말로 선택하신 '+ck_cnt+'개의 상품을 수정하시겠습니까?')){ $("input[name='sel_del']").val("EDIT"); var form_data = $("form[name='product_list_form']").serialize();
$.ajax({type:"post", url:"ajax.product_stock_process.php", data:form_data, async:false, 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(); if(v_mode_ok!='Y'){ alert(v_msg); } else { //$(".code_idx_calss").prop("checked",false); document.location.href='?<?php echo $qstr."&time=".time();?>'; } }, error:function(rtn,status,error){ alert(error); } }); } });
$("#xls_down").click(function(){ // 엑셀다운로드 alert('준비중입니다.'); return; document.product_search_form.action='product_xls_down.php'; document.product_search_form.target = '_blank'; document.product_search_form.submit(); document.product_search_form.action='?'; document.product_search_form.target = ''; });
$("#search_btn_press").click(function(){ // 검색버튼 누를때 document.product_search_form.action='?'; document.product_search_form.target = ''; document.product_search_form.submit(); });
});
</script> <script src="http://dmaps.daum.net/map_js_init/postcode.v2.js"></script> <?php //_pr($_COOKIE['qstr']); include($j3_adm_path."/shop_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>
|