buy_list.php 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277
  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 = "buy_list.php";
  5. $mp = "30"; //set top nav
  6. $PageNo = $_REQUEST['pageno'];
  7. $PageSize = $_REQUEST['PageSize'];
  8. if (empty($PageNo)) {$PageNo=1;}else{$PageNo=$PageNo;}
  9. if (empty($PageSize)) {
  10. $PageSize=10; //목록개수설정
  11. }else{$PageSize=$PageSize;}
  12. $pagestartpoint=($PageNo-1)*$PageSize;
  13. $sql = "where s.ds_delind='N'";
  14. $orderby = "order by s.dt_insert desc";
  15. $searchtype = $_REQUEST['searchtype'];
  16. $searchword = $_REQUEST['searchword'];
  17. $ds_usertype = $_REQUEST['ds_usertype'];
  18. $ds_status = $_REQUEST['ds_status'];
  19. $ds_type = "A0"; //A0 : 매입
  20. $sql = $sql. " and s.ds_type = '$ds_type' ";
  21. if($searchword != ""){
  22. if($searchtype=="" || $searchtype==null){
  23. $sql = $sql. " and (s.nm_name like '$searchword%' or a.nm_number like '$searchword%') ";
  24. }else{
  25. $sql = $sql. " and $searchtype like '$searchword%'";
  26. }
  27. }
  28. if($ds_usertype != ""){
  29. $sql = $sql. " and s.ds_usertype = '$ds_usertype'";
  30. }
  31. if($ds_status != ""){
  32. if($ds_status == "Z0"){
  33. $sql = $sql. " and s.ds_status in ('E0','F0','G0','Z0')";
  34. }else{
  35. $sql = $sql. " and s.ds_status in ('B0','C0','D0')";
  36. }
  37. }
  38. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  39. //관계사/지점 Setting
  40. $admin_ds_company_bp = $_SESSION['admin_ds_company_bp']; //관계사
  41. $admin_ds_branch = $_SESSION['admin_ds_branch']; //지점
  42. $admin_bp_ok = ($admin_ds_company_bp != "" || $admin_ds_branch != "") ? true : false; //admin_ds_company_bp 나 admin_ds_branch 값이 하나라도 있으면 관계사로 보고 권한 제한한다. $admin_bp_ok == true 이면 해당 관계사/지점 데이타만 확인 가능하다.
  43. //관계사 일 경우 해당 관계사/지점 데이타만 확인 가능하다.
  44. if($admin_bp_ok){
  45. if($admin_ds_company_bp != "" && $admin_ds_branch != ""){
  46. $sql = $sql. " and s.ds_company_bp = '$admin_ds_company_bp' and s.ds_branch = '$admin_ds_branch' ";
  47. }else{ //admin_ds_company_bp 나 admin_ds_branch 값이 하나라도 없으면 데이타 확인 안되게 한다.
  48. $sql = $sql. " and 1 = 2 ";
  49. }
  50. }
  51. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  52. $totalrows = @mysql_result(mysql_query("select count(*) from sale_master s inner join car_master a on ( s.cd_car = a.cd_car ) $sql"),0,0);
  53. ?>
  54. <? include("../inc/inc_top.php") ?>
  55. <? include("../inc/inc_header.php") ?>
  56. <section id="contents">
  57. <h2>매입통합 리스트</h2>
  58. <form id="frmSearch" name="frmSearch" method="post">
  59. <input type="hidden" id="PageSize" name="PageSize">
  60. <input type="hidden" id="searchtype" name="searchtype">
  61. <table class="tbl_search">
  62. <colgroup>
  63. <col width="10%">
  64. <col width="38%">
  65. <col width="10%">
  66. <col width="*">
  67. </colgroup>
  68. <tr>
  69. <th>검색어</th>
  70. <td colspan="3">
  71. <span class="select2" style="margin-right:5px;width:100px;" id="sel_searchtype">
  72. <select>
  73. <option value="">전체</option>
  74. <option value="s.nm_name"<? if($searchtype =="nm_name"){?> selected<?}?>>판매자</option>
  75. <option value="a.nm_number"<? if($searchtype =="nm_number"){?> selected<?}?>>차량번호</option>
  76. </select>
  77. </span>
  78. <input type="text" id="searchword" name="searchword" class="inp_txt" style="width:60%;">
  79. </td>
  80. </tr>
  81. <tr>
  82. <th>회원구분</th>
  83. <td>
  84. <div class="radio_chk">
  85. <span class="check_wrap"><input type="radio" name="ds_usertype" id="radio1" value=""><i></i><label for="radio1">전체</label></span>
  86. <span class="check_wrap"><input type="radio" name="ds_usertype" id="radio2" value="A0"<?if($ds_usertype=="A0"){?> checked="checked"<?}?>><i></i><label for="radio2">개인회원</label></span>
  87. <span class="check_wrap"><input type="radio" name="ds_usertype" id="radio3" value="B0"<?if($ds_usertype=="B0"){?> checked="checked"<?}?>><i></i><label for="radio3">사업자회원</label></span>
  88. <span class="check_wrap"><input type="radio" name="ds_usertype" id="radio4" value="C0"<?if($ds_usertype=="C0"){?> checked="checked"<?}?>><i></i><label for="radio4">비회원</label></span>
  89. </div>
  90. </td>
  91. <th>가입승인</th>
  92. <td>
  93. <div class="radio_chk">
  94. <span class="check_wrap"><input type="radio" name="ds_status" id="radio11" value=""><i></i><label for="radio11">전체</label></span>
  95. <span class="check_wrap"><input type="radio" name="ds_status" id="radio12" value="Z0"<?if($ds_status=="Z0"){?> checked="checked"<?}?>><i></i><label for="radio12">승인</label></span>
  96. <span class="check_wrap"><input type="radio" name="ds_status" id="radio13" value="A0"<?if($ds_status=="A0"){?> checked="checked"<?}?>><i></i><label for="radio13">미승인</label></span>
  97. </div>
  98. <input type="submit" class="rnd_btn ty3 gray" value="검색" title="검색">
  99. </td>
  100. </tr>
  101. </table>
  102. </form>
  103. <h3><em>▶</em> 매입통합관리</h3>
  104. <div class="tbl_wrap">
  105. <table class="tbl_list ty2">
  106. <colgroup>
  107. <col width="7%">
  108. <col width="11%">
  109. <col width="*">
  110. <col width="9%">
  111. <col width="11%">
  112. <col width="8%">
  113. <col width="8%">
  114. <col width="9%">
  115. <col width="5%">
  116. <col width="6%">
  117. <col width="13%">
  118. </colgroup>
  119. <thead>
  120. <tr>
  121. <th>번호</th>
  122. <th>판매자</th>
  123. <th>차종</th>
  124. <th>차량번호</th>
  125. <th>주행거리</th>
  126. <th>색상</th>
  127. <th>변속기</th>
  128. <th>판매지역</th>
  129. <th>판매상태</th>
  130. <th>판매시간</th>
  131. <th>등록일</th>
  132. </tr>
  133. </thead>
  134. <?
  135. if($totalrows>0) {
  136. $r = mysql_query("SELECT
  137. a.*
  138. , b.nm_model
  139. , c.nm_grade
  140. , d.nm_brand
  141. , e.nm_model_sub
  142. , getCode('car_master','ds_type',a.ds_type) as nm_type
  143. , getCode('car_master','ds_open',a.ds_open) as nm_open
  144. , getCode('car_master','ds_sales',a.ds_sales) as nm_sales
  145. , getCode('car_master','ds_transmission',a.ds_transmission) as nm_transmission
  146. , getCode('member_master','ds_area',s.ds_area) as nm_area
  147. , getCode('sale_master','ds_status',s.ds_status) as nm_status
  148. , s.cd_sale
  149. , s.nm_name nm_name_sale
  150. , s.ds_status ds_status_sale
  151. , case when s.ds_status in ('B0','C0') then '미승인' when s.ds_status in ('D0') then '반려' when s.ds_status in ('E0','F0') then '입찰중' when s.ds_status in ('G0') then '입찰마감' when s.ds_status in ('Z0') then '낙찰' when s.ds_status in ('ZS') then '구매확정' else '' end as nm_status_sale
  152. , getRemainTimeByPhase(".LIMIT_TIME_TENDER.", ".LIMIT_TIME_SELL.", s.dt_approve, now()) as time_limit_sell
  153. FROM sale_master s
  154. inner join car_master a
  155. on (s.cd_car = a.cd_car)
  156. left outer join car_model b
  157. on (a.cd_model = b.cd_model)
  158. left outer join car_grade c
  159. on (a.cd_grade = c.cd_grade)
  160. left outer join car_brand d
  161. on (a.cd_brand = d.cd_brand)
  162. left outer join car_model_sub e
  163. on (a.cd_model_sub = e.cd_model_sub)
  164. $sql $orderby LIMIT $pagestartpoint,$PageSize");
  165. $i=1;
  166. while($col = mysql_fetch_array($r)) {
  167. $tmpNum =$totalrows-($PageSize*($PageNo-1));
  168. $no = ($tmpNum - $i)+1;
  169. ?>
  170. <tr onclick="location.href='./buy_view.php?list_url=<?=$list_url?>&cd_sale=<?=$col[cd_sale]?>&ds_status_sale=<?=$col[ds_status_sale]?>&ListPageNo=<?=$PageNo?>';" style="cursor:pointer;">
  171. <td><?=$no?></td>
  172. <td><?=$col[nm_name_sale]?></td>
  173. <td><?=$col[nm_brand]." ".$col[nm_model]?></td>
  174. <td><?=$col[nm_number]?></td>
  175. <td><?=$col[nm_mileage]?>km</td>
  176. <td><?=$col[nm_color]?></td>
  177. <td><?=$col[nm_transmission]?></td>
  178. <td><?=$col[nm_area]?></td>
  179. <td><em class="txt_bold"><?=$col[nm_status]?></em></td>
  180. <td>
  181. <?=$col[time_limit_sell]?>
  182. </td>
  183. <td><?=$col[dt_insert]?></td>
  184. </tr>
  185. <?
  186. $i++;
  187. }
  188. }else{
  189. ?>
  190. <tr>
  191. <td colspan="11">등록된 정보가 없습니다.</td>
  192. </tr>
  193. <?
  194. }
  195. ?>
  196. </table>
  197. </div>
  198. <div class="paging">
  199. <?
  200. $url = "./$list_url?searchtype=$searchtype&searchword=$searchword&ds_status=$ds_status&ds_usertype=$ds_usertype";
  201. ListPg1($url ,$PageNo,$PageSize,10,$totalrows,$leftboard[1],$rootpath);
  202. ?>
  203. </div>
  204. </section>
  205. <script language="javascript" type="text/javascript">
  206. $(document).ready(function() {
  207. $("#btn_cal1").bind("click",function(){
  208. $("#dt_start").datepicker('show');
  209. });
  210. $("#btn_cal2").bind("click",function(){
  211. $("#dt_end").datepicker('show');
  212. });
  213. /*
  214. $("#selBox div.jq_sel ul li a").bind("click",function(){
  215. // alert(this.value);
  216. // alert($("#selBox option:selected").val());
  217. // alert($("#selBox option:selected").text());
  218. // $("#PageSize").val(this.value);
  219. $("#PageSize").val($("#selBox option:selected").val());
  220. $("#frmSearch").submit();
  221. });
  222. */
  223. $("#sel_searchtype div.jq_sel ul li a").bind("click",function(){
  224. $("#searchtype").val($("#sel_searchtype option:selected").val());
  225. });
  226. });
  227. function fnSearch(){
  228. if($("#searchtype").val()!="" && $("#searchword").val()==""){
  229. alert("검색어를 입력하세요");
  230. return false;
  231. }
  232. $("#frmSearch").submit();
  233. }
  234. </script>
  235. <? include("../inc/inc_footer.php") ?>
  236. <? include("../inc/inc_bottom.php") ?>
  237. <?
  238. mysql_close($connect);
  239. ?>