inc_ViewTender.20230417.php 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288
  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. <section class="mt-5 pt30">
  47. <div class="data--table--wrap">
  48. <div class="col-12 title--wrapper d-flex align-items-center justify-content-between">
  49. <h2><?=$tender_list_title?> 업체</h2>
  50. <div class="col-md-6 d-flex justify-content-end">
  51. <div>
  52. <select id="inputState" class="form-select" style="width:100px;">
  53. <option selected="">최근순</option>
  54. <option></option>
  55. </select>
  56. </div>
  57. </div>
  58. </div>
  59. <div class="table--m--wrap">
  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. <?php
  117. //SA는 입찰 업체 정보 안보이게 처리
  118. ?>
  119. <tr>
  120. <td>
  121. <div class="d-flex justify-content-center"><?=$aapNum?></div>
  122. </td>
  123. <td>
  124. <div class="d-flex justify-content-center"><?=$col['nm_name_dealer']?></div>
  125. </td>
  126. <td>
  127. <div class="d-flex align-items-center justify-content-center">
  128. <input type="text" class="form-control" style="max-width:200px" value="<?=number_format($col['nm_price'])?>" />
  129. <label class="ms-3">만원</label>
  130. </div>
  131. </td>
  132. <td>
  133. <div class="d-flex align-items-center justify-content-center">
  134. <?=$col['nm_name_dealer1']?>
  135. <?php
  136. $btn_bid_proc = "";
  137. //낙찰이후 상태
  138. if(in_array($col['ds_status_sale'], $status_bid_success)) {
  139. if($col['ds_status_sale'] == "ZE"){
  140. $status_text = '거래실수';
  141. }else {
  142. if($col['ds_status'] == "Z0") {
  143. $status_text = '낙찰';
  144. }else {
  145. $status_text = '낙첨';
  146. }
  147. }
  148. }else {
  149. if(in_array($col['ds_status_sale'], $status_bid_fail)) {
  150. if($col['time_limit_sell']=="0분"){
  151. $status_text = '낙첨';
  152. }
  153. else {
  154. $status_text = '입찰중';
  155. $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>";
  156. //<button class="button button_s_rnd ty2" type='button' onclick="selectTender('{$col['cd_tender']}','{$col['nm_name_dealer1'}','{$col['nm_price'}')" >판매완료</button>
  157. }
  158. }
  159. }
  160. ?>
  161. <?//$status_text?>
  162. <?=$btn_bid_proc?>
  163. <?/*<button class="button button_s_rnd ty2" type='button' onclick="selectTender('<?=$col[cd_tender]?>','<?=$col[nm_name_dealer1]?>','<?=$col[nm_price]?>')" >판매완료</button>*/?>
  164. </div>
  165. </td>
  166. <td>
  167. <div class="d-flex justify-content-center"><?=string_to_asterisk('phone', $col['nm_hp_dealer1'])?></div>
  168. </td>
  169. <td>
  170. <div class="d-flex justify-content-center"><?=$col['dt_insert']?></div>
  171. </td>
  172. </tr>
  173. <?php
  174. $i++;
  175. }
  176. }else{
  177. ?>
  178. <tr>
  179. <td colspan="6" align="center">데이터가 존재 하지 않습니다.</td>
  180. </tr>
  181. <?php
  182. }
  183. ?>
  184. </tbody>
  185. </table>
  186. </div>
  187. </div>
  188. <div class="col-12 d-flex justify-content-center pagination--wrapper">
  189. <?php
  190. $url = "./$list_url?searchtype=$searchtype&searchword=$searchword&ds_status=$ds_status&ds_usertype=$ds_usertype&PageSort=$PageSort";
  191. ListMobilePg($url ,$PageNo,$PageSize,10,$totalrows,$leftboard[1],$rootpath);
  192. ?>
  193. </div>
  194. </section>
  195. <form name="frmTenderForm" id="frmTenderForm" method="post" action="sa_proc.php">
  196. <input type="hidden" name="mode" value="TenderSuccessAAP">
  197. <input type="hidden" name="cd_sale" value="<?=$cd_sale?>">
  198. <input type="hidden" name="cd_tender" >
  199. <input type="hidden" name="nm_price" >
  200. </form>
  201. <script>
  202. $(function() {
  203. $(".btn_bid_proc").on("click", function() {
  204. var custom_opts = {
  205. title : '',
  206. btn_close_show : false,
  207. }
  208. var cd_tender = $(this).val();
  209. var nm_price = $(this).attr("nm_price");
  210. var nm_name_dealer = $(this).attr("nm_name_dealer");
  211. custom_opts.title = '입찰업체를 낙찰하시겠습니까?';
  212. custom_modal_confirm(custom_opts, function(confirm) {
  213. if(confirm) {
  214. $("#frmTenderForm input[name=cd_tender]").val(cd_tender);
  215. $("#frmTenderForm input[name=nm_price]").val(nm_price);
  216. $("#btn_bid_proc").hide();
  217. var data = $("#frmTenderForm").serialize();
  218. $.ajax({
  219. url : 'sa_proc.php',
  220. type: 'POST',
  221. dataType : 'json',
  222. data: data,
  223. success: function(res) {
  224. custom_modal_confirm_close();
  225. $("#btn_bid_proc").show();
  226. //세션 종료시 로그인 페이지로 이동
  227. if(res.CODE != "0000") {
  228. custom_opts.title = res.MSG;
  229. if(res.CODE == "4444") {
  230. window.location.href = res.DATAS.URL;
  231. }
  232. custom_modal_alert(custom_opts);
  233. return false;
  234. }
  235. custom_opts.title = '낙찰되었습니다.';
  236. custom_opts.event_esc_key = false;
  237. custom_modal_alert(custom_opts, function() {
  238. reload();
  239. });
  240. },
  241. error:function(request,status,error){
  242. $("#btn_bid_proc").show();
  243. custom_modal_confirm_close();
  244. alert("code:"+request.status+"\n"+"message:"+request.responseText+"\n"+"error:"+error);
  245. }
  246. });
  247. }else {
  248. $("#btn_bid_proc").show();
  249. return false;
  250. }
  251. });
  252. });
  253. })
  254. </script>