purchase_list.20230323.php 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  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 = "purchase_list.php";
  5. $mp = "40"; //set top nav
  6. $searchtype = $_REQUEST['searchtype'];
  7. $searchword = $_REQUEST['searchword'];
  8. $ds_usertype = $_REQUEST['ds_usertype'];
  9. $ds_status = $_REQUEST['ds_status'];
  10. $dt_start = $_REQUEST['dt_start'];
  11. $dt_end = $_REQUEST['dt_end'];
  12. $PageNo = $_REQUEST['pageno'];
  13. $PageSize = $_REQUEST['PageSize'];
  14. if (empty($PageNo)) {$PageNo=1;}else{$PageNo=$PageNo;}
  15. if (empty($PageSize)) {
  16. $PageSize=10; //목록개수설정
  17. }else{$PageSize=$PageSize;}
  18. $pagestartpoint=($PageNo-1)*$PageSize;
  19. $add_sql = "where s.ds_delind='N'";
  20. $add_sql1 = "where 1=1";
  21. $ds_type = "A0"; //A0 : 매입
  22. $add_sql.= " AND s.ds_type = '$ds_type' ";
  23. if($searchword != ""){
  24. if($searchtype=="" || $searchtype==null){
  25. $add_sql.= " AND (s.nm_name like '$searchword%' or s.nm_name like '$searchword%') ";
  26. }else{
  27. $add_sql.= " AND $searchtype like '$searchword%'";
  28. }
  29. }
  30. if($dt_start != "" && $dt_end != ""){
  31. $sql1 = $sql1. " AND d.dt_insert between '$dt_start' and '$dt_end' ";
  32. }
  33. if($ds_usertype != ""){
  34. $add_sql.= " AND s.ds_usertype = '$ds_usertype'";
  35. }
  36. $add_sql.= " AND s.ds_status in ('ZS') ";
  37. $orderby = "order by st.cnt desc";
  38. $sql = "select count(*)
  39. from
  40. (
  41. select t.cd_dealer_p, count(*) cnt
  42. from sale_master s
  43. inner join tender_master t on (s.cd_sale = t.cd_sale and s.ds_status = 'ZS' and t.ds_status = 'Z0')
  44. $add_sql
  45. group by t.cd_dealer_p
  46. ) st
  47. inner join aap_master d on (st.cd_dealer_p = d.cd_dealer and d.ds_type = 'D0')
  48. $add_sql1 ";
  49. // echo $sql;
  50. // exit;
  51. $totalrows = @mysql_result(mysql_query($sql),0,0);
  52. ?>
  53. <? include("../inc/inc_top.php") ?>
  54. <? include("../inc/inc_header.php") ?>
  55. <section id="contents">
  56. <h2>구매확정 리스트</h2>
  57. <form id="frmSearch" name="frmSearch" method="post">
  58. <input type="hidden" id="PageSize" name="PageSize">
  59. <input type="hidden" id="searchtype" name="searchtype">
  60. <table class="tbl_search">
  61. <colgroup>
  62. <col width="10%">
  63. <col width="35%">
  64. <col width="10%">
  65. <col width="*">
  66. </colgroup>
  67. <tr>
  68. <th>검색어</th>
  69. <td>
  70. <span class="select2" style="margin-right:5px;width:100px;" id="sel_searchtype">
  71. <select>
  72. <option value="">전체</option>
  73. <option value="s.nm_name"<? if($searchtype =="nm_name"){ ?> selected<?}?>>판매자</option>
  74. <!--option value="a.nm_number"<? if($searchtype =="nm_number"){ ?> selected<?}?>>차량번호</option-->
  75. </select>
  76. </span>
  77. <input type="text" id="searchword" name="searchword" class="inp_txt" style="width:60%;">
  78. </td>
  79. <th>회원가입일</th>
  80. <td>
  81. <input type="text" class="inp_txt" style="width:30%;" id="dt_start" name="dt_start" value="<?//=$dt_start?>">
  82. <span class="btn_cal" id="btn_cal1">달력보기</span>
  83. ~
  84. <input type="text" class="inp_txt" style="width:30%;" id="dt_end" name="dt_end" value="<?//=$dt_end?>">
  85. <span class="btn_cal" id="btn_cal2">달력보기</span>
  86. <input type="submit" class="rnd_btn ty3 gray" value="검색" title="검색">
  87. </td>
  88. </tr>
  89. </table>
  90. </form>
  91. <div class="tbl_wrap">
  92. <table class="tbl_list">
  93. <colgroup>
  94. <col width="7%">
  95. <col width="20%">
  96. <col width="14%">
  97. <col width="*">
  98. <col width="18%">
  99. </colgroup>
  100. <thead>
  101. <tr>
  102. <th>번호</th>
  103. <th>업체</th>
  104. <th>낙찰횟수</th>
  105. <th>회원가입일</th>
  106. <th>마일리지</th>
  107. </tr>
  108. </thead>
  109. <?php
  110. if($totalrows>0) {
  111. $sql = "SELECT
  112. st.*
  113. , d.*
  114. from
  115. (
  116. select t.cd_dealer_p, count(*) cnt
  117. from sale_master s
  118. inner join tender_master t on (s.cd_sale = t.cd_sale and s.ds_status = 'ZS' and t.ds_status = 'Z0')
  119. $add_sql
  120. group by t.cd_dealer_p
  121. ) st
  122. inner join aap_master d on (st.cd_dealer_p = d.cd_dealer and d.ds_type = 'D0')
  123. $add_sql1
  124. $orderby
  125. LIMIT $pagestartpoint,$PageSize";
  126. $r = mysql_query($sql);
  127. $i=1;
  128. while($col = mysql_fetch_array($r)) {
  129. $tmpNum =$totalrows-($PageSize*($PageNo-1));
  130. $no = ($tmpNum - $i)+1;
  131. ?>
  132. <tr onclick="location.href='./purchase_view.php?list_url=<?=$list_url?>&cd_dealer=<?=$col['cd_dealer']?>&ListPageNo=<?=$PageNo?>';" style="cursor:pointer;">
  133. <td><?=$no?></td>
  134. <td><?=$col['nm_name']?></td>
  135. <td><?=$col['cnt']?></td>
  136. <td><?=$col['dt_insert']?></td>
  137. <td><?=$col['nm_deposit']?></td>
  138. </tr>
  139. <?php
  140. $i++;
  141. }
  142. }else{
  143. ?>
  144. <tr>
  145. <td colspan="5">등록된 정보가 없습니다.</td>
  146. </tr>
  147. <?php
  148. }
  149. ?>
  150. </table>
  151. </div>
  152. <div class="paging">
  153. <?
  154. $url = "./$list_url?searchtype=$searchtype&searchword=$searchword&ds_status=$ds_status&ds_usertype=$ds_usertype";
  155. ListPg1($url ,$PageNo,$PageSize,10,$totalrows,$leftboard[1],$rootpath);
  156. ?>
  157. </div>
  158. </section>
  159. <script language="javascript" type="text/javascript">
  160. $("#dt_start").datepicker({ dateFormat: 'yy-mm-dd' });
  161. $("#dt_end").datepicker({ dateFormat: 'yy-mm-dd' });
  162. $(document).ready(function() {
  163. $("#btn_cal1").bind("click",function(){
  164. $("#dt_start").datepicker('show');
  165. });
  166. $("#btn_cal2").bind("click",function(){
  167. $("#dt_end").datepicker('show');
  168. });
  169. });
  170. function fnSearch(){
  171. if($("#searchtype").val()!="" && $("#searchword").val()==""){
  172. alert("검색어를 입력하세요");
  173. return false;
  174. }
  175. $("#frmSearch").submit();
  176. }
  177. </script>
  178. <? include("../inc/inc_footer.php") ?>
  179. <? include("../inc/inc_bottom.php") ?>
  180. <?
  181. mysql_close($connect);
  182. ?>