car_history.php 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  1. <?php
  2. include $_SERVER['DOCUMENT_ROOT'].'/common/lib/comm.php';
  3. include $_SERVER['DOCUMENT_ROOT'].ADMIN_PATH.'common/auth_chk.php';
  4. $list_url = "car_history.php";
  5. // $mp = "31"; //set top nav
  6. $mp = "60"; //set top nav 20190805
  7. $PageNo = $_REQUEST['pageno'];
  8. $PageSize = $_REQUEST['PageSize'];
  9. $PageSort = $_REQUEST['PageSort'];
  10. if (empty($PageNo)) {$PageNo=1;}else{$PageNo=$PageNo;}
  11. if (empty($PageSize)) {
  12. $PageSize=10; //목록개수설정
  13. }else{$PageSize=$PageSize;}
  14. $pagestartpoint=($PageNo-1)*$PageSize;
  15. $add_sql = " where s.ds_type = 'admin' and s.ds_delind='N' and cd_car = 0 ";
  16. if(empty($PageSort)) {
  17. $orderby = "order by s.dt_insert desc";
  18. }else {
  19. $sort = explode("|", $PageSort);
  20. $orderby = "order by $sort[0] $sort[1] ";
  21. }
  22. $searchtype = $_REQUEST['searchtype'];
  23. $searchword = $_REQUEST['searchword'];
  24. $ds_usertype = $_REQUEST['ds_usertype'];
  25. $ds_status = $_REQUEST['ds_status'];
  26. if($dt_start != "" && $dt_end != ""){
  27. $add_sql.= " and date(s.r001) between '$dt_start' and '$dt_end' ";
  28. }
  29. if($searchword != ""){
  30. if($searchtype=="" || $searchtype==null){
  31. $add_sql.= " and (s.nm_name like '$searchword%' or a.nm_number like '$searchword%') ";
  32. }else{
  33. $add_sql.= " and $searchtype like '$searchword%'";
  34. }
  35. }
  36. $sql = "select count(*) from car_history_master s $add_sql";
  37. // echo $sql;
  38. $totalrows = @mysql_result(mysql_query($sql),0,0);
  39. ?>
  40. <? include("../inc/inc_top.php") ?>
  41. <? include("../inc/inc_header.php") ?>
  42. <section id="contents">
  43. <h2>사고정보조회 리스트</h2>
  44. <form id="frmSearch" name="frmSearch" method="post">
  45. <input type="hidden" id="PageSort" name="PageSort">
  46. <input type="hidden" id="PageSize" name="PageSize">
  47. <input type="hidden" id="searchtype" name="searchtype" value="<?=$searchtype?>">
  48. <table class="tbl_search">
  49. <colgroup>
  50. <col width="10%">
  51. <col width="*">
  52. </colgroup>
  53. <tr>
  54. <th>차량번호</th>
  55. <td>
  56. <input type="text" id="nm_number" name="nm_number" class="inp_txt" style="width:30%;" value="" placeholder="차량번호를 입력하세요">
  57. <a href="#" class="rnd_btn ty2 black" id="btn_car_history" style="width:120px;">차량 정보 조회</a>
  58. </td>
  59. </tr>
  60. <tr>
  61. <th>검색어</th>
  62. <td>
  63. <span class="select2" style="margin-right:5px;width:100px;" id="sel_searchtype">
  64. <select>
  65. <option value="">전체</option>
  66. <option value="s.r002"<? if($searchtype =="s.r002"){?> selected<?}?>>차량번호</option>
  67. </select>
  68. </span>
  69. <input type="text" id="searchword" name="searchword" class="inp_txt" style="width:60%;" value="<?=$searchword?>">
  70. </td>
  71. </tr>
  72. <tr>
  73. <th>기간검색</th>
  74. <td>
  75. <input type="text" class="inp_txt" style="width:30%;" id="dt_start" name="dt_start" value="<?=$dt_start?>">
  76. <span class="btn_cal" id="btn_cal1">달력보기</span>
  77. ~
  78. <input type="text" class="inp_txt" style="width:30%;" id="dt_end" name="dt_end" value="<?=$dt_end?>">
  79. <span class="btn_cal" id="btn_cal2">달력보기</span>
  80. <div class="sel_period">
  81. <span onclick="setSearchDate('day',0)">오늘</span>
  82. <span onclick="setSearchDate('day',-7)">7일</span>
  83. <span onclick="setSearchDate('day',-15)">15일</span>
  84. <span onclick="setSearchDate('month',-1)">1개월</span>
  85. <span onclick="setSearchDate('month',-3)">3개월</span>
  86. <span onclick="setSearchDate('year',-1)">1년</span>
  87. </div>
  88. <input type="submit" class="rnd_btn ty3 gray" value="검색" title="검색">
  89. </td>
  90. </tr>
  91. </table>
  92. </form>
  93. <div class="tbl_wrap">
  94. <table class="tbl_list ty2">
  95. <colgroup>
  96. <col width="5%">
  97. <col width="16%">
  98. <col width="*">
  99. <col width="16%">
  100. <col width="16%">
  101. </colgroup>
  102. <thead>
  103. <tr>
  104. <th>번호</th>
  105. <th>차량번호</th>
  106. <th>차종</th>
  107. <th>조회일</th>
  108. <th>이력조회 보기</th>
  109. </tr>
  110. </thead>
  111. <?
  112. if($totalrows>0) {
  113. $r = mysql_query("SELECT
  114. s.*
  115. FROM car_history_master s
  116. $add_sql $orderby LIMIT $pagestartpoint,$PageSize");
  117. $i=1;
  118. while($col = mysql_fetch_array($r)) {
  119. $tmpNum =$totalrows-($PageSize*($PageNo-1));
  120. $no = ($tmpNum - $i)+1;
  121. ?>
  122. <tr>
  123. <td><?=$no?></td>
  124. <td><?=$col['r002']?></td>
  125. <td><?=$col['r005']?></td>
  126. <td><?=$col['dt_insert']?></td>
  127. <td><span class="btn_view" cd_car_history="<?=$col['cd_car_history']?>">보기</a></td>
  128. </tr>
  129. <?
  130. $i++;
  131. }
  132. }else{
  133. ?>
  134. <tr>
  135. <td colspan="5">등록된 정보가 없습니다.</td>
  136. </tr>
  137. <?
  138. }
  139. ?>
  140. </tr>
  141. </table>
  142. </div>
  143. <div class="paging">
  144. <?
  145. $url = "./$list_url?searchtype=$searchtype&searchword=$searchword&ds_status=$ds_status&ds_usertype=$ds_usertype&PageSort=$PageSort&dt_start=$dt_start&dt_end=$dt_end";
  146. ListPg1($url ,$PageNo,$PageSize,10,$totalrows,$leftboard[1],$rootpath);
  147. ?>
  148. </div>
  149. <!-- layer popup1 -->
  150. <div class="layer_popup history_popup">
  151. <div class="close">팝업닫기</div>
  152. <h3>중고차 보험처리 이력정보 보고서</h3>
  153. <div class="scr_cont" id="scr_cont">
  154. </div>
  155. </div>
  156. </section>
  157. <script language="javascript" type="text/javascript">
  158. function setSearchDate(arg1, arg2){
  159. var dtStart = getSearchDate(arg1, arg2);
  160. var dtEnd = getSearchDate("day", 0);
  161. $("#dt_start").val(dtStart);
  162. $("#dt_end").val(dtEnd);
  163. }
  164. $(document).ready(function() {
  165. $("#dt_start").datepicker({ dateFormat: 'yy-mm-dd' });
  166. $("#dt_end").datepicker({ dateFormat: 'yy-mm-dd' });
  167. $("#sel_searchtype div.jq_sel ul li a").bind("click",function(){
  168. $("#searchtype").val($("#sel_searchtype option:selected").val());
  169. });
  170. //차량정보 조회
  171. $("#btn_car_history").on("click", function() {
  172. var fieldlist = [["nm_number","차량번호"]] ;
  173. if (!fnCheckForm(fieldlist)){
  174. return false;
  175. }
  176. $.post("car_history.ajax.php", { mode: 'search', nm_number: $("#nm_number").val()},function(data) {
  177. var obj = JSON.parse(data); //JSON형식으로 리턴 받을 때
  178. console.log(data);
  179. var INFO = obj.INFO;
  180. if(obj.CODE != "0000"){ //정상이 아닐때
  181. alert(obj.MSG);
  182. return false;
  183. }
  184. fnSearch();
  185. });
  186. });
  187. });
  188. //차량이력정보 보기 팝업
  189. $(".btn_view").on("click", function() {
  190. $.get("car_history.ajax.php", { mode: 'view', cd_car_history: $(this).attr("cd_car_history")},function(data) {
  191. $("#scr_cont").html(data);
  192. viewPopup('history');
  193. });
  194. });
  195. function fnSearch(){
  196. $("#frmSearch").submit();
  197. }
  198. </script>
  199. <? include("../inc/inc_footer.php") ?>
  200. <? include("../inc/inc_bottom.php") ?>
  201. <?
  202. mysql_close($connect);
  203. ?>