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
|
<?php include("./_common.php");
if($mode=='point'){ $screen_out = " screen_out "; $stm2 = "0"; $stm = "0"; $click_edit2 = " click_edit2"; } else if($mode=='search'){ $screen_out = " screen_out "; $stm2 = "0"; $stm = "0"; $click_edit2 = " click_edit3"; } else if($mode=='configshop'){ $screen_out = " screen_out "; $stm2 = "0"; $stm = "0"; $click_edit2 = " click_edit4"; } else { $click_edit = " click_edit"; }
if($order_key==''){ if($_COOKIE['ok_customer']!=''){ $order_key = $_COOKIE['ok_customer']; } else { $order_key = 'comp_name'; } }
if($stm==''){ $stm = '1'; } if($stm2==''){ $stm2 = '1'; }
$where = " and login_id <> '' and ocode = '{$configshop['office_code']}' "; //$where = " "; if($biztype=='' || $biztype=='1'){ $where .= " and biztype = '1' "; $biztype = "1"; } else if($biztype=='0'){ $where .= " and biztype = '0' "; } else if($biztype=='2'){ $where .= " and biztype = '2' "; }
if($stx!=''){ $where .= " and {$sti} like '%{$stx}%' "; }
if($stm=='1'){ $where .= " and a.user_define4 = '1' "; }
if($stm2=='1'){ $where .= " and a.email <> '' "; }
if($stc!=''){ $where .= " and a.comp_name like '%$stc%' "; }
$sql = "select count(*) as cnt from customers a WHERE 1=1 $where "; $result = mysql_query($sql,$connect_j3); $row = mysql_fetch_array($result); $total_count = $row['cnt'];
$list_num = 15; 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 * from customers a WHERE 1=1 $where order by $order_key limit $from_record, $list_num"; $result = mysql_query($sql,$connect_j3);
//_pr($sql); while($cus_info=mysql_fetch_array($result)){ $list_array[] = $cus_info; }
$qstr = $_SERVER['QUERY_STRING'];
?> <div id="wrap" class='container_wrap' style='width:900px;'> <!-- 검색영역 --> <form name='customer_search_form' method='get' onsubmit='return false;'> <input type='hidden' name='biztype' size='' value='<?php echo $biztype;?>'> <input type='hidden' name='mode' size='' value='<?php echo $mode;?>'> <div id="sub-contents-area"> <div class="sub-btn-area"> <div class="sub-btn sub-btn-search" style='margin-left:-200px;'> <select name='stm2' style='width:150px;' class='<?php echo $screen_out;?>'> <option value='1' <?php if($stm2=='1'){?>selected<?php }?>>이메일 있는 거래처</option> <option value='0' <?php if($stm2=='0'){?>selected<?php }?>>전체거래처</option> </select> <select name='stm' style='width:130px;' class='<?php echo $screen_out;?>'> <option value='1' <?php if($stm=='1'){?>selected<?php }?>>수신동의거래처</option> <option value='0' <?php if($stm=='0'){?>selected<?php }?>>전체거래처</option> </select> <select name='sti'> <option value='a.comp_name' <?php if($sti=='a.comp_name'){?>selected<?php }?>>상호명</option> <option value='a.login_id' <?php if($sti=='a.login_id'){?>selected<?php }?>>아이디</option> <option value='a.comp_sn' <?php if($sti=='a.comp_sn'){?>selected<?php }?>>사업자번호</option> <option value='a.ceo_name' <?php if($sti=='a.ceo_name'){?>selected<?php }?>>대표자</option> <option value='a.telno' <?php if($sti=='a.telno'){?>selected<?php }?>>전화번호</option> <option value='a.hpno' <?php if($sti=='a.hpno'){?>selected<?php }?>>핸드폰</option> <option value='a.email' <?php if($sti=='a.email'){?>selected<?php }?>>이메일</option> <option value='a.memo' <?php if($sti=='a.memo'){?>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 screen_out"> <div class="item_tab_navi"> <a value='0'><span>매입처 관리</span></a> <a value='1' class="on"><span>매출처 관리</span></a> <!--<a value='2'><span>매입.매출처 관리</span></a>--> </div> </div><!--//item_tab--> <!-- 탭 구분 영역 끝 -->
<form name='customer_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:80px;"><col style="width:120px;"><col style="width:140px;"> <col style="width:100px;"><col style="width:100px;"><col style="width:100px;"> <col style="width:110px;"><col style="width:100px;"> </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> </tr> </thead> <tbody> <?php for($i=0;$i<count($list_array);$i++){ $info = $list_array[$i]; ?> <tr> <td class="tcenter cust_search"> <input type='checkbox' name='code_idx[]' value='<?php echo $i;?>'> <input type='hidden' name='codes[]' value='<?php echo $info['code'];?>'> <input type='hidden' name='login_id[]' value='<?php echo $info['login_id'];?>'> <input type='hidden' name='email[]' value='<?php echo $info['email'];?>'> <input type='hidden' name='comp_name[]' value='<?php echo $info['comp_name'];?>'> </td> <td class="linetxt <?php echo $click_edit2;?> cursor_p"><?php echo $info['login_id'];?></td> <td class="linetxt <?php echo $click_edit2;?> cursor_p"><?php echo $info['comp_name'];?></td> <td class="linetxt <?php echo $click_edit;?>"><?php echo $info['email'];?></td> <td class="linetxt "><?php echo $info['telno'];?></td> <td class="linetxt "><?php echo $info['hpno'];?></td> <td class="linetxt "><?php echo $info['comp_sn'];?></td> <td class="cost "><?php echo number_format($info['cur_point']); ?></td> </tr> <?php } ?> </tbody> </table> </div> </div> </form>
<div class='pg_wrap' style='padding-top:0px;'> <?php echo get_paging2($list_num, $page, $total_page, "javascript:customer_search_inc('',");?> </div>
</div><!--//wrap-->
<script> $(function(){ $(".check_all_class").click(function(){ // 전체선택 전체선택 해제 if($(this).is(":checked")){ $(".cust_search input[name='code_idx[]']").prop("checked",true); } else { $(".cust_search input[name='code_idx[]']").prop("checked",false); } });
$("#stx").keyup(function(){ if(event.keyCode==13){ customer_search_inc('',1); } });
$("form[name='customer_search_form'] #search_btn_press").click(function(){ // 검색버튼 customer_search_inc('',1); });
$(".click_edit").css("cursor","point").click(function(){ // 단일 선택시 $tr_obj = $(this).closest("tr"); $val = $tr_obj.find("input[name='email[]']").val(); if($val!=''){ add_email($val); } });
$(".click_edit2").css("cursor","point").click(function(){ // 포인트단일 선택시 $tr_obj = $(this).closest("tr"); $codes = $tr_obj.find("input[name='codes[]']").val(); $login_id = $tr_obj.find("input[name='login_id[]']").val(); $("form[name='point_reg_form'] input[name='ccode']").val($codes); $("form[name='point_reg_form'] input[name='login_id']").val($login_id); $("#modal_member_box2").dialog("close"); });
$(".click_edit3").css("cursor","point").click(function(){ // 검색시 선택시 $form_name = $("#search_form_name").val(); $tr_obj = $(this).closest("tr"); $codes = $tr_obj.find("input[name='codes[]']").val(); $comp_name = $tr_obj.find("input[name='comp_name[]']").val(); $tg_form = $("form[name='"+$form_name+"']"); $tg_form.find("input[name='stc']").val($codes); $tg_form.find("input[name='stc_search']").val($comp_name); $("#modal_member_box").dialog("close"); });
$(".click_edit4").css("cursor","point").click(function(){ // 비회원 거래처 선택시 $tr_obj = $(this).closest("tr"); $codes = $tr_obj.find("input[name='codes[]']").val(); $cust_name = $tr_obj.find("input[name='comp_name[]']").val(); $login_id = $tr_obj.find("input[name='login_id[]']").val(); $("form[name='config_shop_form'] input[name='guest_ccode']").val($codes); $("form[name='config_shop_form'] input[name='guest_id']").val($login_id); $("form[name='config_shop_form'] input[name='guest_cname']").val($cust_name+"("+$codes+")"); $("#modal_member_box2").dialog("close"); }); });
function customer_search_inc(v_cn,v_page){ var form_data = $("form[name='customer_search_form']").serialize(); $.get("customer_list.inc.php?"+form_data+"&page="+v_page,function(rtn){ $("#modal_member_box<?php if($mode=='point'){ echo '2'; }?>").html(rtn).dialog({ resizable: true, height:700, width:1000, modal: true, title:"거래처 [검색]", buttons: { <?php if($mode!='point'){ ?> 선택: function() { email_sel_add(); }, <?php } ?> 닫기: function() { $( this ).dialog( "close" ); } } }); }); } </script>
|