purchase_list.php 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259
  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' AND t.ds_delind = 'N')
  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. <?php 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 colspan="3">
  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 =="s.nm_name"){ ?> selected<?}?>>업체명</option>
  74. <option value="s.nm_name"<? if($searchtype =="s.nm_name"){ ?> selected<?}?>>연락처</option>
  75. <option value="s.nm_name"<? if($searchtype =="nm_name"){ ?> selected<?}?>>지역</option>
  76. <!--option value="a.nm_number"<? if($searchtype =="nm_number"){ ?> selected<?}?>>차량번호</option-->
  77. </select>
  78. </span>
  79. <input type="text" id="searchword" name="searchword" class="inp_txt" style="width:60%;">
  80. </td>
  81. </tr>
  82. <tr>
  83. <th>검색어</th>
  84. <td>
  85. <!-- <span class="select2" style="margin-right:5px;width:100px;" id="sel_searchtype">
  86. <select>
  87. <option value="">전체</option>
  88. <option value="s.nm_name"<? if($searchtype =="s.nm_name"){ ?> selected<?}?>>업체명</option>
  89. <option value="s.nm_name"<? if($searchtype =="s.nm_name"){ ?> selected<?}?>>연락처</option>
  90. <option value="s.nm_name"<? if($searchtype =="nm_name"){ ?> selected<?}?>>지역</option>
  91. </select>
  92. </span>
  93. <span class="select2" style="margin-right:5px;width:100px;" id="sel_searchtype">
  94. <select>
  95. <option value="">전체</option>
  96. <option value="s.nm_name"<? if($searchtype =="s.nm_name"){ ?> selected<?}?>>업체명</option>
  97. <option value="s.nm_name"<? if($searchtype =="s.nm_name"){ ?> selected<?}?>>연락처</option>
  98. <option value="s.nm_name"<? if($searchtype =="nm_name"){ ?> selected<?}?>>지역</option>
  99. </select>
  100. </span> -->
  101. </td>
  102. <th>회원가입일</th>
  103. <td>
  104. <input type="text" class="inp_txt" style="width:30%;" id="dt_start" name="dt_start" value="<?//=$dt_start?>">
  105. <span class="btn_cal" id="btn_cal1">달력보기</span>
  106. ~
  107. <input type="text" class="inp_txt" style="width:30%;" id="dt_end" name="dt_end" value="<?//=$dt_end?>">
  108. <span class="btn_cal" id="btn_cal2">달력보기</span>
  109. <input type="submit" class="rnd_btn ty3 gray" value="검색" title="검색">
  110. <div class="btn_right" style="margin-top:-28px">
  111. <a href="javascript:;" id="btn_download_excel" class="rnd_btn black" style='width:110px;'>엑셀 다운로드</a>
  112. </div>
  113. </td>
  114. </tr>
  115. </table>
  116. </form>
  117. <div class="tbl_wrap">
  118. <table class="tbl_list">
  119. <colgroup>
  120. <col width="7%">
  121. <col width="20%">
  122. <col width="14%">
  123. <col width="*">
  124. <col width="18%">
  125. </colgroup>
  126. <thead>
  127. <tr>
  128. <th>번호</th>
  129. <th>업체명</th>
  130. <!-- <th>대표자</th> -->
  131. <th>연락처</th>
  132. <th>구매확정차량</th>
  133. <th>회원가입일</th>
  134. </tr>
  135. </thead>
  136. <?php
  137. if($totalrows>0) {
  138. $sql = "SELECT
  139. st.*
  140. , d.*
  141. , d.nm_hp as dealer_nm_hp
  142. , d.dt_insert as dealer_dt_insert
  143. from
  144. (
  145. select t.cd_dealer_p, count(*) cnt
  146. from sale_master s
  147. inner join tender_master t on (s.cd_sale = t.cd_sale and s.ds_status = 'ZS' and t.ds_status = 'Z0' AND t.ds_delind = 'N')
  148. $add_sql
  149. group by t.cd_dealer_p
  150. ) st
  151. inner join aap_master d on (st.cd_dealer_p = d.cd_dealer and d.ds_type = 'D0')
  152. $add_sql1
  153. $orderby
  154. LIMIT $pagestartpoint,$PageSize";
  155. $r = mysql_query($sql);
  156. $i=1;
  157. while($col = mysql_fetch_array($r)) {
  158. $tmpNum =$totalrows-($PageSize*($PageNo-1));
  159. $no = ($tmpNum - $i)+1;
  160. ?>
  161. <tr onclick="location.href='./purchase_view.php?list_url=<?=$list_url?>&cd_dealer=<?=$col['cd_dealer']?>&ListPageNo=<?=$PageNo?>';" style="cursor:pointer;">
  162. <td><?=$no?></td>
  163. <td><?=$col['nm_name']?></td>
  164. <td><?=$col['dealer_nm_hp']?></td>
  165. <!-- <td><?=$col['nm_deposit']?></td> -->
  166. <td><?=number_format($col['cnt'])?></td>
  167. <td><?=$col['dealer_dt_insert']?></td>
  168. </tr>
  169. <?php
  170. $i++;
  171. }
  172. }else{
  173. ?>
  174. <tr>
  175. <td colspan="5">등록된 정보가 없습니다.</td>
  176. </tr>
  177. <?php
  178. }
  179. ?>
  180. </table>
  181. </div>
  182. <div class="paging">
  183. <?php
  184. $url = "./$list_url?searchtype=$searchtype&searchword=$searchword&ds_status=$ds_status&ds_usertype=$ds_usertype";
  185. ListPg1($url ,$PageNo,$PageSize,10,$totalrows,$leftboard[1],$rootpath);
  186. ?>
  187. </div>
  188. </section>
  189. <form name="excelForm" id="excelForm" method="GET">
  190. <input type="hidden" name="searchtype" value="<?=$searchtype?>">
  191. <input type="hidden" name="searchword" value="<?=$searchword?>">
  192. <input type="hidden" name="ds_usertype" value="<?=$ds_usertype?>">
  193. <input type="hidden" name="dt_start" value="<?=$dt_start?>">
  194. <input type="hidden" name="dt_end" value="<?=$dt_end?>">
  195. </form>
  196. <script language="javascript" type="text/javascript">
  197. $("#dt_start").datepicker({ dateFormat: 'yy-mm-dd' });
  198. $("#dt_end").datepicker({ dateFormat: 'yy-mm-dd' });
  199. $(document).ready(function() {
  200. $("#btn_cal1").bind("click",function(){
  201. $("#dt_start").datepicker('show');
  202. });
  203. $("#btn_cal2").bind("click",function(){
  204. $("#dt_end").datepicker('show');
  205. });
  206. $("#btn_download_excel").click(function(e) {
  207. var url = "purchase_list_excel.php?"+$("#excelForm").serialize();
  208. window.open(url, "excelWin");
  209. });
  210. });
  211. function fnSearch(){
  212. if($("#searchtype").val()!="" && $("#searchword").val()==""){
  213. alert("검색어를 입력하세요");
  214. return false;
  215. }
  216. $("#frmSearch").submit();
  217. }
  218. </script>
  219. <? include("../inc/inc_footer.php") ?>
  220. <? include("../inc/inc_bottom.php") ?>
  221. <?
  222. mysql_close($connect);
  223. ?>