inc_ViewTender.20230417.php 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287
  1. <?php
  2. //이 페이지는 2가지 상황에서 사용됨
  3. //입찰중, 거래중
  4. $cd_sale = $_REQUEST["cd_sale"];
  5. $PageNo = $_REQUEST['pageno'];
  6. $PageSize = $_REQUEST['PageSize'];
  7. if (empty($PageNo)) {$PageNo=1;}else{$PageNo=$PageNo;}
  8. if (empty($PageSize)) {
  9. $PageSize=10; //목록개수설정
  10. }else{$PageSize=$PageSize;}
  11. $pagestartpoint=($PageNo-1)*$PageSize;
  12. $OrderBy = $_REQUEST['OrderBy'];
  13. if ($OrderBy == "") $OrderBy = "cast(t.nm_price as unsigned) desc, t.cd_tender desc ";
  14. $sOrderBy = "ORDER BY ".$OrderBy;
  15. $add_sql = " WHERE d.ds_delind='N' ";
  16. //매물 상태별 처리
  17. $tender_list_title = "";
  18. switch($ds_status_sale) {
  19. //입찰중
  20. case 'F0':
  21. $tender_list_title = "입찰업체";
  22. $add_sql.= " ";
  23. break;
  24. //거래중
  25. case 'Z0':
  26. //낙찰한 상태이면
  27. if(empty($ds_status_contract_step1)) {
  28. $tender_list_title = "입찰업체";
  29. $add_sql.= " ";
  30. }else {
  31. $tender_list_title = "낙찰업체";
  32. $add_sql.= " AND t.ds_status = 'Z0' ";
  33. }
  34. break;
  35. }
  36. $sql = "SELECT count(*)
  37. FROM aap_master d
  38. inner join tender_master t on ( d.cd_dealer = t.cd_dealer_p and t.cd_sale = '$cd_sale' and t.ds_delind='N' )
  39. inner join sale_master s on t.cd_sale = s.cd_sale and s.cd_sale = $cd_sale AND s.ds_delind='N'
  40. $add_sql
  41. ";
  42. // echo $sql;
  43. // echo "select count(*) FROM ucaro_master d inner join tender_master t on (d.cd_dealer = t.cd_dealer_p and t.cd_sale = $cd_sale and t.ds_delind='N' $sql)";
  44. $totalrows = @mysql_result(mysql_query($sql),0,0);
  45. ?>
  46. <!-- 업체 리스트 -->
  47. <section>
  48. <div class="data--table--wrap mt-5">
  49. <div class="col-12 title--wrapper d-flex align-items-center justify-content-between">
  50. <h2><a name="tender_list"><?=$tender_list_title?> 리스트</a></h2>
  51. <div class="col-md-6 d-flex justify-content-end">
  52. <div>
  53. <select id="inputState" class="form-select" style="width:100px;">
  54. <option selected="">최근순</option>
  55. <option></option>
  56. </select>
  57. </div>
  58. </div>
  59. </div>
  60. <table class="table table-bordered mt-3">
  61. <colgroup>
  62. <col style="width:10%;">
  63. <col style="width:20%;">
  64. <col style="width:25%;">
  65. <col style="width:15%;">
  66. <col style="width:15%;">
  67. <col style="width:15%;">
  68. </colgroup>
  69. <thead>
  70. <tr>
  71. <th>
  72. <div class="d-flex justify-content-center">NO</div>
  73. </th>
  74. <th>
  75. <div class="d-flex justify-content-center">입찰업체</div>
  76. </th>
  77. <th>
  78. <div class="d-flex justify-content-center">입찰금액</div>
  79. </th>
  80. <th>
  81. <div class="d-flex justify-content-center">담당자</div>
  82. </th>
  83. <th>
  84. <div class="d-flex justify-content-center">연락처</div>
  85. </th>
  86. <th>
  87. <div class="d-flex justify-content-center">입찰일</div>
  88. </th>
  89. </tr>
  90. </thead>
  91. <tbody>
  92. <?php
  93. if($totalrows>0) {
  94. $sql = "SELECT t.*, d.nm_name nm_name_dealer, d.nm_name nm_name_dealer, s.ds_status ds_status_sale
  95. , getRemainTimeByPhase(".LIMIT_TIME_TENDER.", ".LIMIT_TIME_SELL.", s.dt_approve, now()) as time_limit_sell
  96. , d1.nm_name nm_name_dealer1
  97. , d1.nm_hp nm_hp_dealer1
  98. , s.nm_price_final
  99. FROM aap_master d
  100. inner join tender_master t on (d.cd_dealer = t.cd_dealer_p and t.cd_sale = '$cd_sale' and t.ds_delind='N')
  101. inner join aap_master d1 on (t.cd_dealer = d1.cd_dealer)
  102. inner join sale_master s on (t.cd_sale = s.cd_sale)
  103. $add_sql
  104. $sOrderBy
  105. LIMIT $pagestartpoint,$PageSize";
  106. // echo $sql;
  107. // exit;
  108. $r = mysql_query($sql);
  109. $i=1;
  110. $status_bid_success = array('Z0', 'ZS', 'ZE');
  111. $status_bid_fail = array('E0', 'F0');
  112. while($col = mysql_fetch_array($r)) {
  113. $tmpNum =$totalrows-($PageSize*($PageNo-1));
  114. $aapNum = ($tmpNum - $i)+1;
  115. ?>
  116. <tr>
  117. <td>
  118. <div class="d-flex justify-content-center"><?=$aapNum?></div>
  119. </td>
  120. <td>
  121. <div class="d-flex justify-content-center"><?=$col['nm_name_dealer']?></div>
  122. </td>
  123. <td>
  124. <div class="d-flex align-items-center justify-content-center">
  125. <input type="text" class="form-control" style="max-width:200px" value="<?=number_format($col['nm_price'])?>" />
  126. <label class="ms-3">만원</label>
  127. </div>
  128. </td>
  129. <td>
  130. <div class="d-flex align-items-center justify-content-center">
  131. <?=$col['nm_name_dealer1']?>
  132. <?php
  133. $btn_bid_proc = "";
  134. //낙찰이후 상태
  135. if(in_array($col['ds_status_sale'], $status_bid_success)) {
  136. if($col['ds_status_sale'] == "ZE"){
  137. $status_text = '거래실수';
  138. }else {
  139. if($col['ds_status'] == "Z0") {
  140. $status_text = '낙찰';
  141. }else {
  142. $status_text = '낙첨';
  143. }
  144. }
  145. }else {
  146. if(in_array($col['ds_status_sale'], $status_bid_fail)) {
  147. if($col['time_limit_sell']=="0분"){
  148. $status_text = '낙첨';
  149. }
  150. else {
  151. $status_text = '입찰중';
  152. $btn_bid_proc = "<button type='button' class='btn btn-primary ms-3 btn_bid_proc' cd_tender='{$col['cd_tender']}' nm_name_dealer='{$col['nm_name_dealer']}' nm_price='{$col['nm_price']}' value='{$col['cd_tender']}' >낙찰하기</button>";
  153. //<button class="button button_s_rnd ty2" type='button' onclick="selectTender('{$col['cd_tender']}','{$col['nm_name_dealer1'}','{$col['nm_price'}')" >판매완료</button>
  154. }
  155. }
  156. }
  157. ?>
  158. <?//$status_text?>
  159. <?=$btn_bid_proc?>
  160. <?/*<button class="button button_s_rnd ty2" type='button' onclick="selectTender('<?=$col[cd_tender]?>','<?=$col[nm_name_dealer1]?>','<?=$col[nm_price]?>')" >판매완료</button>*/?>
  161. </div>
  162. </td>
  163. <td>
  164. <div class="d-flex justify-content-center"><?=string_to_asterisk('phone', $col['nm_hp_dealer1'])?></div>
  165. </td>
  166. <td>
  167. <div class="d-flex justify-content-center"><?=$col['dt_insert']?></div>
  168. </td>
  169. </tr>
  170. <?php
  171. $i++;
  172. }
  173. }else{
  174. ?>
  175. <tr>
  176. <td colspan="6" align="center">데이터가 존재 하지 않습니다.</td>
  177. </tr>
  178. <?php
  179. }
  180. ?>
  181. </tbody>
  182. </table>
  183. </div>
  184. <div class="col-12 d-flex justify-content-center pagination--wrapper">
  185. <?php
  186. $url = "./$list_url?searchtype=$searchtype&searchword=$searchword&ds_status=$ds_status&ds_usertype=$ds_usertype&PageSort=$PageSort";
  187. ListPg($url ,$PageNo,$PageSize,10,$totalrows,$leftboard[1],$rootpath);
  188. ?>
  189. </div>
  190. <!-- <div class="btn--wrapper col-12 d-flex justify-content-center mt-5">
  191. <button type="button" class="btn btn-secondary list--btn" style="width:190px; height:65px;">목록</button>
  192. </div> -->
  193. </section>
  194. <form name="frmTenderForm" id="frmTenderForm" method="post" action="sa_proc.php">
  195. <input type="hidden" name="mode" value="TenderSuccessAAP">
  196. <input type="hidden" name="cd_sale" value="<?=$cd_sale?>">
  197. <input type="hidden" name="cd_tender" >
  198. <input type="hidden" name="nm_price" >
  199. </form>
  200. <script>
  201. $(function() {
  202. $(".btn_bid_proc").on("click", function() {
  203. var custom_opts = {
  204. title : '',
  205. btn_close_show : false,
  206. }
  207. var cd_tender = $(this).val();
  208. var nm_price = $(this).attr("nm_price");
  209. var nm_name_dealer = $(this).attr("nm_name_dealer");
  210. custom_opts.title = '입찰업체를 낙찰하시겠습니까?';
  211. custom_modal_confirm(custom_opts, function(confirm) {
  212. if(confirm) {
  213. $("#frmTenderForm input[name=cd_tender]").val(cd_tender);
  214. $("#frmTenderForm input[name=nm_price]").val(nm_price);
  215. $("#btn_bid_proc").hide();
  216. var data = $("#frmTenderForm").serialize();
  217. $.ajax({
  218. url : 'sa_proc.php',
  219. type: 'POST',
  220. dataType : 'json',
  221. data: data,
  222. success: function(res) {
  223. custom_modal_confirm_close();
  224. $("#btn_bid_proc").show();
  225. //세션 종료시 로그인 페이지로 이동
  226. if(res.CODE != "0000") {
  227. custom_opts.title = res.MSG;
  228. if(res.CODE == "4444") {
  229. window.location.href = res.DATAS.URL;
  230. }
  231. custom_modal_alert(custom_opts);
  232. return false;
  233. }
  234. custom_opts.title = '낙찰되었습니다.';
  235. custom_opts.event_esc_key = false;
  236. custom_modal_alert(custom_opts, function() {
  237. reload();
  238. });
  239. },
  240. error:function(request,status,error){
  241. $("#btn_bid_proc").show();
  242. custom_modal_confirm_close();
  243. alert("code:"+request.status+"\n"+"message:"+request.responseText+"\n"+"error:"+error);
  244. }
  245. });
  246. }else {
  247. $("#btn_bid_proc").show();
  248. return false;
  249. }
  250. });
  251. });
  252. })
  253. </script>