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
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
|
<? include("./include/header.php"); ?>
<?php
$DB_HOST = "114.108.136.196"; $DB_USER = "mj_inhouse_web"; $DB_PWD = "m897461z"; $DB_NAME = "mj_inhouse";
include('../manage/category/class_db.php');
$connect_web = @mysql_connect($DB_HOST,$DB_USER,$DB_PWD); @mysql_select_db( $DB_NAME,$connect_web);
$today = date('Y-m-d'); $time = time(); $beforeyear = date("Y-m-d",strtotime("3month ago", $time));
$total_sql = "SELECT count(bb.sdate) as cnt FROM ( SELECT sdate FROM jangbu_tellist AS a LEFT JOIN jangbu_maechul AS b ON a.cname = b.name WHERE a.sdate BETWEEN '{$beforeyear}' AND '{$today}' AND a.stime > '09:00:00' GROUP BY cname ) bb;";
$cm_nCount = 30; $cm_item_nCount = 30;
$total_res = mysql_query($total_sql,$connect_web); $total_count = mysql_fetch_array($total_res); $nPage = ceil((int)$total_count['cnt'] / $cm_nCount);
// 글번호용 $idx = (int)$total_count['cnt']; if($pg != "" && $pg != 1) { $idx = $idx - (($pg - 1)*$cm_nCount); }
if ($pg == "") $pg = 1; $nFrom = ($pg - 1) * $cm_nCount;
$sql = "SELECT a.seq, a.sdate, min(a.stime) as stime, a.etime, a.cname, IFNULL(b.`status`,'도소매') AS status_r, IFNULL(b.item,'') AS item_r, a.sdam, a.bigo, a.complete FROM jangbu_tellist AS a LEFT JOIN jangbu_maechul AS b ON a.cname = b.name WHERE a.sdate BETWEEN '{$beforeyear}' AND '{$today}' AND a.stime > '09:00:00' AND a.stime NOT BETWEEN '12:00:00' AND '13:00:00' GROUP BY cname, sdate ORDER BY sdate DESC, stime DESC LIMIT $nFrom, $cm_nCount";
//echo $sql;
$res = mysql_query($sql,$connect_web);
if(!$res) { echo mysql_error(); }
while($info=mysql_fetch_array($res)){ $list_arr[] = $info; }
// 한페이지에 보여줄 행, 현재페이지, 총페이지수, URL function pageListing($cur_page, $total_page, $url , $cm_nCount ) { $retValue = "<div class='paging'>"; if ($cur_page > 1) {
$retValue .= "<a href='" . $url . ($cur_page-1) ."' class='page'><span class='next'>이전</span></a>"; } else { $retValue .= ""; $retValue .= ""; }
$retValue .= "";
$start_page = ( ( (int)( ($cur_page - 1 ) / 10 ) ) * 10 ) + 1;
$end_page = $start_page + 9; if ($end_page >= $total_page) $end_page = $total_page; if ($start_page > 1) $retValue .= "<a href='" . $url . ($start_page-1) . "' class='page'><span class='next10'>이전 10개</span></a>";
if ($total_page > 1) for ($k=$start_page;$k<=$end_page;$k++) if ($cur_page != $k) $retValue .= "<a href='$url$k'>$k</a>"; else $retValue .= "<a href='$url$k' class='on'>$k</a>";
if ($total_page > $end_page) $retValue .= "<a href='" . $url . ($end_page+1) . "' class='page'><span class='pro10'>다음 10개</span></a>";
$retValue .= "";
if ($cur_page < $total_page) { $retValue .= "<a href='$url" . ($cur_page+1) ."' class='page'><span class='pro'>다음</span></a>";
} else { $retValue .= ""; $retValue .= ""; }
$retValue .= "</div>"; return $retValue; }
?>
<style> tr { height: 40px; } /* td { border: 1px solid #eee; } */ th, td { text-align: center; }
.review_detail_tit{width: 100%;/* height:263px; */} .review_detail_tit img{width: 100%;} /* .review_detail_tit{background:url('./images/realtime_counsel/realtime_counsel_tit.png') center no-repeat;} */
#main_section{width: calc(100% - 20px);margin: 0 auto;padding: 40px 0;} #main_section > .paging{margin-top: 40px;} .counsel_tit{font-size: 32px;font-weight: 600;line-height: 32px;color: #424242;text-align: center;margin-bottom: 40px;}
#counsel_list_box_top li{display: flex;justify-content: space-between;}
#counsel_box #counsel_list_box_top li div{font-size: 12px;font-weight: 600;color: #fff;background: #424242;padding: 10px 0px;text-align: center;} #counsel_box #counsel_list_box_top li:nth-child(1) > div:first-child{border-radius: 12px 0px 0px 0px;} #counsel_box #counsel_list_box_top li:nth-child(1) > div:last-child{border-radius: 0px 12px 0px 0px;} #counsel_box #counsel_list_box_top li:nth-child(3) > div:first-child{border-radius: 0px 0px 0px 12px;} #counsel_box #counsel_list_box_top li:nth-child(3) > div:last-child{border-radius: 0px 0px 12px 0px;}
#counsel_list_box li > div{font-size:11px;box-sizing: border-box;padding: 5px;width: 25%;text-align: center;word-break: break-all;} .company_name{font-size: 13px;font-size: 600;} #counsel_list_box li > div:nth-child(1){width: 15%;} #counsel_list_box li > div:nth-child(2){width: 30%;font-weight: 600;} #counsel_list_box li > div:nth-child(3){width: 25%;} #counsel_list_box li > div:nth-child(4){width: 30%;} #counsel_list_box li > div:nth-child(5){width: 50%;} #counsel_list_box li > div:nth-child(6){width: 50%;} #counsel_list_box li > div:nth-child(7){width: 50%;} #counsel_list_box li > div:nth-child(8){width: 50%;} #counsel_list_box li{border-bottom: 1px dashed #e9e3e2;display: flex;justify-content: space-between;flex-wrap: wrap;} </style>
<h3 class="sec_tit" style="font-size:20px;font-weight:600;margin-top:52px;line-height:56px;padding: 0px 10px;">구매상담/서비스 처리현황</h3> <div class="review_detail_tit"><img src="./images/realtime_counsel/realtime_counsel_tit.png" alt="tit_image"></div> <div id="main_section" style="position: relative;"> <!-- <p class="counsel_tit">구매상담/서비스 처리현황</p> --> <!-- <span style="position: absolute;right: 30px;top: 105px;font-size: 16px;font-weight: 600;color: #424242;">최근 3개월 기준</span> --> <input type='hidden' name='etime_val' value=''> <input type='hidden' name='stime_val' value=''> <input type='hidden' name='idx' value=''> <div id="counsel_box" style="table-layout: fixed;width: 100%;"> <ul id="counsel_list_box_top" style="width: 100%"> <li style="width: 100%"> <div style="width:20%;">순번</div> <div style="width:40%;">상호</div> <div style="width:40%;">업종</div> </li> <li style="width: 100%"> <div style="width:40%;">상담내용</div> <div style="width:30%;">접수시간</div> <div style="width:30%;">완료시간</div> </li> <li style="width: 100%"> <div style="width:50%;">담당자</div> <div style="width:50%;">결과</div> </li> </ul> <ul id="counsel_list_box" class="counsel_list counsel_list_box"> <?php for($i=0; $i<count($list_arr); $i++){ $list = $list_arr[$i];
//상담내용 글자 수 줄이기 $bigo = mb_strimwidth($list['bigo'],0,60,"...","euc-kr");
//상호명 글자 수 줄이기 $sangho_leng = mb_strlen($list['cname'], 'utf-8'); $sangho_leng = ceil($sangho_leng/2);
$star = ""; for($s=0; $s<$sangho_leng; $s++){ $star .= "*"; }
$sangho = mb_substr($list['cname'], '0', $sangho_leng, 'euc-kr').$star;
// 상호명이 비어있는 경우 if($sangho == "") { $sangho = "사업자개설전"; } //담당자->팀으로 치환 $team = ""; switch($list['sdam']) { case "오상목": $team = "상담1팀"; break; case "권창규": $team = "상담2팀"; break; case "홍재원": $team = "상담3팀"; break; case "이승환": $team = "상담4팀"; break; case "여욱동": $team = "상담5팀"; break; case "황재현": $team = "상담6팀"; break; case "이수현": $team = "상담7팀"; break; case "황혜인": $team = "상담8팀"; break; case "박주현": $team = "상담9팀"; break; case "김태정": $team = "상담10팀"; break; case "한동진": $team = "상담11팀"; break; case "안재윤": $team = "상담12팀"; break; default: $team = "상담팀"; }
if($list['complete']=="1"){ $complete = "처리완료"; } else if($list['complete']=="0"){ $complete = "처리중"; } if($list['etime']=="00:00:00"){ $etime = ""; } else { $etime = $list['sdate']."-".substr($list['etime'],0,5); }
//두시간이 지나도 처리중일 경우 처리완료라고 표시하기 $str_date = strtotime($list['stime'].'+2 hours'); $twohours = $list['sdate']."-".date("H:i", $str_date); if(date("Y-m-d-H:i") > $twohours && $list['complete'] == "0"){ $complete = "처리완료"; $etime = $twohours; }
// 인코딩 $sangho = iconv("EUC-KR", "UTF-8", $sangho); // 상호 $list['status_r'] = iconv("EUC-KR", "UTF-8", $list['status_r']); // 업종
if($complete == "처리중"){$etime = "";} ?> <li id="<?php echo $list['seq'];?>" class="seqClass <?php echo $list['etime'];?> <?php echo $list['stime'];?>"> <div class="idx"><?php echo $idx;?></div> <div class="company_name"><?php echo $sangho;?></div> <div><?php echo $list['status_r'];?></div> <div>구매상담/서비스</div> <div><?php echo $list['sdate']."-".substr($list['stime'],0,5);?></div> <div><?php echo $etime;?></div> <div><?php echo $team;?></div> <div><?php echo $complete;?></div> </li> <?php $idx--; } ?> </ul> </div>
<?php echo pageListing($pg, $nPage, "realtime_counsel1.php?&pg=", $cm_nCount);?>
</div>
<script> $(function(){
//0.5초에 한번씩 realtimefunc() 함수를 실행한다. setInterval(function(){ realtimefunc(); }, 100);
});
function realtimefunc(){ var time_class = "";
var today = new Date(); // 초기 리스트에 아무것도 없을때에는 현재시간을 채워넣음
var hours = ('0' + today.getHours()).slice(-2); // 현재 시 var minutes = ('0' + today.getMinutes()).slice(-2); // 현재 분 var seconds = ('0' + today.getSeconds()).slice(-2); // 현재 초
var today_val = "<?php echo $today; ?>"; // 오늘 날짜
var cnt = "<?php echo $row['cnt']; ?>"; // 리스트 카운트 var seq2 = $(".seqClass").eq(0).attr("id"); // 글번호 if($(".seqClass").eq(0).attr("class")=="" || $(".seqClass").eq(0).attr("class") == undefined){ // 클래스가 아무것도 정의되어 있지 않을 때 time_class = hours + ':' + minutes + ':' + seconds; // 위에서 취득한 현재 시분초로 time_class를 정의 } else { time_class = $(".seqClass").eq(0).attr("class").split(' '); // 그게 아니면 클래스명으로 정의 } var etime_val = $("input[name='etime_val']").val(); // 종료시간취득 var page = "<?php echo $pg; ?>"; // 현재 페이지 취득
if(etime_val == ""){etime_val = time_class[1];} // 종료시간이 비어있다면 위에서 취득한 시간을 넣어줌(클래스가 정의되어있을때)
var stime_val = $("input[name='stime_val']").val(); // 시작시간취득 if(stime_val == ""){stime_val = time_class[2];} // 시작시간이 비어있다면 위에서 취득한 시간을 넣어줌(클래스가 정의되어있을때)
var idx = 0; if($("input[name='idx']").val() == "") { idx = parseInt($(".seqClass").eq(0).find(".idx").html()); idx = idx+1; } else { idx = parseInt($("input[name='idx']").val()); idx = idx+1; } var html = ""; var team = "";
$.ajax({ type:"post", url:"./ajax.realtime_counsel.php", data: { today: today_val, cnt: cnt, seq: seq2 }, cache : false, dataType: "json", success:function(result){
if(result!=""){ // 반환값이 비어있지 않을때 seq = result.seq; // 번호 stime = result.stime; // 시작시간 etime = result.etime; // 종료시간 cname = result.cname; // 고객사명 status_r = result.status_r; // 업종 sdam = result.sdam; // 담당자 bigo = result.bigo; // 내용 complete = result.complete; // 완료 if(complete == '1'){ complete_val = "처리완료"; $('.seqClass div:last-child:contains("처리완료")').css("color","#ff2020"); $('.seqClass div:last-child:contains("처리중")').css("color","#204eff"); } else if(complete == '0') { complete_val = "처리중"; $('.seqClass div:last-child:contains("처리완료")').css("color","#ff2020"); $('.seqClass div:last-child:contains("처리중")').css("color","#204eff"); } else {complete_val = "";} if(etime == '00:00:00'){etime_txt = "";} else {etime_txt = today_val+"-"+etime.substr(0,5);}
// 고객사명 *처리 sangho_leng = cname.length; sangho_leng = Math.ceil(sangho_leng / 2);
star = ""; for(var s=0; s<sangho_leng; s++){ star += "*"; } sangho = cname.substr('0', sangho_leng, 'euc-kr')+star;
switch(sdam) { case "오상목": team = "상담1팀"; break; case "권창규": team = "상담2팀"; break; case "홍재원": team = "상담3팀"; break; case "이승환": team = "상담4팀"; break; case "여욱동": team = "상담5팀"; break; case "황재현": team = "상담6팀"; break; case "이수현": team = "상담7팀"; break; case "황혜인": team = "상담8팀"; break; case "박주현": team = "상담9팀"; break; case "김태정": team = "상담10팀"; break; case "한동진": team = "상담11팀"; break; case "안재윤": team = "상담12팀"; break; default: team = "상담팀";
}
if(status_r==false || status_r=='false'){status_r = "도소매";}
if(stime_val != stime && page == "1") { // 현재페이지가 1일경우와 etime_val 의 값과 결과값으로 넘어온 종료시간이 같지 않을때 실행함
html += "<li id='"+seq+" clist' class='seqClass "+etime+" "+stime+"'>"; html += "<div>"+ idx +"</div>"; html += "<div>"+sangho+"</div>"; html += "<div>"+status_r+"</div>"; html += "<div>구매상담/서비스</div>"; html += "<div>"+today_val+"-"+stime.substr(0,5)+"</div>"; html += "<div>"+etime_txt+"</div>"; html += "<div>"+team+"</div>"; html += "<div>"+complete_val+"</div>"; html += "</li>";
$(html).insertBefore(".counsel_list li:eq(0)"); $("input[name='etime_val']").val(etime); $("input[name='stime_val']").val(stime); $("input[name='idx']").val(idx); } } }, error:function(rtn,status,error){ alert(error); } }); }
/* $(function(){ // 현재 화면상 tr 리스트 갯수 var list_length = $(".counsel_list_box > tr").length; //모자이크처리 반복 처리 for(var idx = 0; idx < list_length; idx++){ //각 인덱스에 맞는 상호명 선택 var $list = $(".counsel_list_box tr").eq(idx).children(".company_name"); //전체 문자열 갯수 var txt_length = $list.text().length; //모자이크처리 시작할 문자열 위치 var masking_start = Math.round(txt_length / 2); //모자이크처리할 문자열 추출 var txt = $list.text().slice(masking_start); //모자이크처리 안할 문자열 추출 var txt_front = $list.text().slice(0 , masking_start); //전체 문자열 추출 var txt_2 = $list.text(); //모자이크처리할 갯수만큼 *표시 var masking = "*".repeat(txt_length - masking_start); //모자이크 처리 안된 부분 + 모자이크 처리할 부분 $list.text(txt_front + masking); } //제일 최근 리스트의 상호명 내용이 변경되었을 경우 함수 실행 setInterval(function(){ console.log("상호명 변경") var $list = $(".counsel_list_box tr").eq(0).children(".company_name").children(".cell");//각 인덱스에 맞는 상호명 선택
var txt_length = $list.text().length;//전체 문자열 갯수 var masking_start = Math.round(txt_length / 2);//모자이크처리 시작할 문자열 위치 var txt = $list.text().slice(masking_start);//모자이크처리할 문자열 추출 var txt_front = $list.text().slice(0 , masking_start);//모자이크처리 안할 문자열 추출 var txt_2 = $list.text();//전체 문자열 추출 var masking = "*".repeat(txt_length - masking_start);//모자이크처리할 갯수만큼 *표시 $list.text(txt_front + masking);//모자이크 처리 안된 부분 + 모자이크 처리할 부분
console.log(txt_2); }, 2000); }) */ </script>
<? include("./include/footer.php"); ?>
|