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
|
<?php $dir = "."; include_once($dir."/_common.php");
if($order_key==''){ if($_COOKIE['ok_customer']!=''){ $order_key = $_COOKIE['ok_customer']; } else { $order_key = 'comp_name'; } }
if($dealdate!=''){ $mode2 = "Y"; }
$where = " "; $where .= " and biztype = '1' and login_id <> '' and ocode = '{$configshop['office_code']}' ";
$left_join = ""; $where2= ""; if($sdate!='' && $edate!=''){ $left_join = "left join (select ccode, dealdate from {$date_table} group by ccode, dealdate) b on a.code = b.ccode"; $where2 = "and b.dealdate between '2017-08-01' and '2017-08-03'"; }
if($stx!=''){ $where .= " and comp_name like '%{$stx}%' "; }
if(Number($misu)>0){ if($biztype=='0'){ $where .= " and a.cur_arrear > $misu "; } else { $where .= " and a.cur_recvbl > $misu "; } }
if($mode2=='Y'){ $sql = "select count(*) as cnt from (select a.*,ifnull(b.cnt,0) as cnt from customers a left join (select ccode, count(*) as cnt from {$date_table} where dealdate > '2017-08-01' group by ccode, dealdate) b on a.code = b.ccode WHERE 1=1 ) c where c.cnt = 0 and (c.biztype = '1' || c.biztype = '2') $where "; } else { $sql = "select count(*) as cnt from customers a $left_join WHERE 1=1 $where $where2 "; } $result = mysql_query($sql,$connect_j3); $row = mysql_fetch_array($result); $total_count = $row['cnt'];
$list_num = 12; //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; // 시작 열을 구함
if($mode2=='Y'){ $sql = "select * from (select a.*,ifnull(b.cnt,0) as cnt from customers a left join (select ccode, count(*) as cnt from {$date_table} where dealdate > '2017-08-01' group by ccode, dealdate) b on a.code = b.ccode WHERE 1=1 ) c where c.cnt = 0 and (c.biztype = '1' || c.biztype = '2') $where order by $order_key limit $from_record, $list_num "; } else { $sql = "select distinct a.* from customers a $left_join WHERE 1=1 $where $where2 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']; //_pr($_GET); ?> <style> .container_wrap3 { font-size:0.9em; width:300px !important;} /*#sub-title { margin-top:0px; }*/ </style> <!--<div id="contents" style="background:#999"><img src="http://placehold.it/960x150" alt="롤링배너"></div>-->
<div id="wrap" class='container_wrap3'> <div id="sub-title" style='margin-top:5px;'> <h2>거래처검색</h2> </div> <form name='customer_list_form' method='post'> <input type='hidden' name='sel_del' value=''> <input type='hidden' name='modetype' value='<?php echo $modetype;?>'> <div class="div-list-area"> <div class="cust-list-area"> <table class="order-sheet2"> <caption class="screen_out">상품 검색 리스트<caption> <colgroup> <col style="width:20px;"> <col style="width:30px;"><col style="width:95px;"> <col style="width:65px;"> </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> </tr> </thead> <tbody> <?php for($i=0;$i<count($list_array);$i++){ $info = $list_array[$i]; ?> <tr class='tr_select_customer'> <input type='hidden' name='ccode' value='<?php echo $info['code'];?>'> <input type='hidden' name='code1' value='<?php echo $info['code1'];?>'> <input type='hidden' name='comp_name' value='<?php echo $info['comp_name'];?>'> <input type='hidden' name='telno' value='<?php echo $info['telno'];?>'> <input type='hidden' name='hpno' value='<?php echo $info['hpno'];?>'> <input type='hidden' name='faxno' value='<?php echo $info['faxno'];?>'> <input type='hidden' name='ceo_name' value='<?php echo $info['ceo_name'];?>'> <input type='hidden' name='vattype' value='<?php echo $info['vattype'];?>'> <input type='hidden' name='cur_arrear' value='<?php echo $info['cur_arrear'];?>'> <input type='hidden' name='cur_recvbl' value='<?php echo $info['cur_recvbl'];?>'> <td class="tcenter "> <input type='checkbox' name='code_idx[]' value='<?php echo $i;?>'> <input type='hidden' name='codes[]' value='<?php echo $info['code'];?>'> </td> <td class="linetxt "><?php echo $info['code1'];?></td> <td class="linetxt click_edit"><?php echo $info['comp_name'];?></td> <td class="tcenter "><?php echo $info['hpno'];?></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_sms_search('{$stx}',");?> </div>
</div><!--//wrap-->
<script> $(function(){ $(".click_edit").click(function(){ $tr_obj = $(this).closest("tr"); add_hp($tr_obj.find("input[name='hpno']").val()); });
$(".check_all_class").click(function(){ // 전체선택 전체선택 해제 if($(this).is(":checked")){ $("input[name='code_idx[]']").prop("checked",true); } else { $("input[name='code_idx[]']").prop("checked",false); } }); });
</script>
|