= DATE_ADD(now(), INTERVAL '-".LIMIT_TIME_TENDER."' HOUR) "; if($s_ds_usertype == "B0"){ //kcar 딜러 $sql = $sql. " and ( ( s.ds_company_bp = '$s_ds_company_bp1' and ds_branch = '$s_ds_branch1' ) or ( s.ds_company_bp = '$s_ds_company_bp2' and ds_branch = '$s_ds_branch2' ) or ( s.ds_company_bp = '$s_ds_company_bp3' and ds_branch = '$s_ds_branch3' ) ) "; }else{ $sql = $sql. " and s.ds_area in ( select SUBSTRING_INDEX (SUBSTRING_INDEX(nm_area,',',numbers.n),',',-1) from (select 1 n union all select 2 union all select 3 union all select 4 union all select 5 union all select 6 union all select 7 union all select 8 union all select 9 union all select 10 union all select 11 union all select 12 union all select 13 union all select 14 union all select 15 union all select 16 union all select 17 union all select 18 union all select 19 union all select 20 ) numbers INNER JOIN dealer_master on CHAR_LENGTH ( nm_area ) - CHAR_LENGTH ( REPLACE ( nm_area , ',' , '' ))>= numbers . n-1 where cd_dealer = $s_cd_dealer_p ) "; } } if($s_ds_type == "D0"){ //딜러 $sql_ds_type = " and cd_dealer_p = '$s_cd_dealer' "; }else{ //딜러-관리자 $sql_ds_type = " and cd_dealer = '$s_cd_dealer' "; } if($searchword != ""){ if($searchtype=="" || $searchtype==null){ $sql = $sql. " and (s.nm_name like '$searchword%' or a.nm_number like '$searchword%') "; }else{ $sql = $sql. " and $searchtype like '$searchword%'"; } } if($ds_usertype != ""){ $sql = $sql. " and s.ds_usertype = '$ds_usertype'"; } if($ds_status == "E0"){ //딜러 업체 소속 입찰 건이 2건 보다 작을 시만 입찰 요청 건에 보이게 한다. //입찰하지 않은 판매건 $sql = $sql. " and s.ds_status in ('E0','F0')"; //딜러 업체 소속 입찰 건이 2건 보다 작을 시만 입찰 요청 건에 보이게 한다. $sql_from = $sql_from. " left outer join ( "; $sql_from = $sql_from. " select cd_sale from tender_master where ds_delind = 'N' and cd_dealer_p = '$s_cd_dealer_p' group by cd_sale having count(*) > 1) f "; $sql_from = $sql_from. " on (s.cd_sale = f.cd_sale) "; $sql = $sql. " and f.cd_sale is null "; //딜러 업체 소속 입찰 건이 2건 보다 작을 시만 입찰 요청 건에 보이게 한다. if($s_ds_type == "D1"){ //딜러-관리자 //본인 입찰 건 제외한 입찰 건 $sql_from = $sql_from. " left outer join ( "; $sql_from = $sql_from. " select cd_sale from tender_master where ds_delind = 'N' and cd_dealer = '$s_cd_dealer' group by cd_sale) g "; $sql_from = $sql_from. " on (s.cd_sale = g.cd_sale) "; $sql = $sql. " and g.cd_sale is null "; //본인 입찰 건 제외한 입찰 건 } }else{ if($ds_status == "F0"){ //입찰 중인 판매건 $sql = $sql. " and s.ds_status in ('E0','F0')"; // $sql = $sql. " and s.cd_sale in (select cd_sale from tender_master where ds_delind = 'N' ".$sql_ds_type." group by cd_sale)"; //20191001이전 지연 쿼리 $sql = $sql. " and exists(select cd_sale from tender_master where cd_sale = s.cd_sale and ds_delind = 'N' ".$sql_ds_type." )"; //20191001 cd_sale_cd_user_cd_dealer index 설정 후 쿼리 변경 }else if($ds_status == "Z0"){ //낙찰된 판매건 $sql = $sql. " and s.ds_status in ('Z0')"; $sql_from = $sql_from. " inner join ( "; $sql_from = $sql_from. " select cd_sale from tender_master where ds_delind = 'N' and ds_status in ('Z0') ".$sql_ds_type." group by cd_sale) h "; $sql_from = $sql_from. " on (s.cd_sale = h.cd_sale) "; // $sql = $sql. " and h.cd_sale is not null "; }else if($ds_status == "ZS"){ //구매 확정된 판매건 // $sql = $sql. " and s.ds_status in ('Z0')"; // $sql = $sql. " and s.ds_status_contract in ('Z0')"; $sql = $sql. " and s.ds_status in ('ZS')"; $sql_from = $sql_from. " inner join ( "; $sql_from = $sql_from. " select cd_sale from tender_master where ds_delind = 'N' and ds_status in ('Z0') ".$sql_ds_type." group by cd_sale) i "; $sql_from = $sql_from. " on (s.cd_sale = i.cd_sale) "; // $sql = $sql. " and i.cd_sale is not null "; }else if($ds_status == "ZE"){ //유찰 /* 관리자의 해약 리스트는 낙찰 상태의 거래 실패의 경우 리스트를 가져 오며, 사이트에서 유찰상태에 대한 정의가 딱히 정해 진게 없어서 아래의 조건에 해당되는 데이터를 가져온다 2020-02-02 관리자 해약 리스트 : and s.ds_status in ('Z0') and s.ds_status_contract in ('C0') 1. 낙찰상태로 변경됐으나 본인이 안된 경우 - sale_master.ds_status = 'Z0' and tender_master.ds_status = 'A0' 2. 낙찰상태로 변경 됐고 본인이 된 경우 1) 거래 실패 처리 할 경우 - sale_master.ds_status = 'Z0' and ds_status_contract = 'C0' 2) 견적 실수로 처리 할 경우 - sale_master.ds_status = 'ZE' 3. 입찰 시간 초과로 경매 종료 됐을 경우 - sale_master.ds_status = 'E0' and dt_approve + 낙찰시간 < 현재시간 */ $sql_from.= " inner join ( -- 낙찰상태로 변경됐으나 본인이 안된 경우 select s.cd_sale from sale_master s inner join ( select cd_sale from tender_master where ds_status = 'A0' $sql_ds_type group by cd_sale) i on (s.cd_sale = i.cd_sale) where s.ds_status = 'Z0' union -- 2. 낙찰상태로 변경 됐고 본인이 된 경우 -- 1) 거래 실패 처리 할 경우 -- 2) 견적 실수로 처리 할 경우 -- 3. 입찰 시간 초과로 경매 종료 됐을 경우 select s.cd_sale from sale_master s inner join ( select cd_sale from tender_master where ds_status = 'Z0' $sql_ds_type group by cd_sale) i on (s.cd_sale = i.cd_sale) where ((s.ds_status = 'Z0' and s.ds_status_contract = 'C0') or s.ds_status = 'ZE' or (s.ds_status = 'E0' and getRemainTimeByPhase('".LIMIT_TIME_TENDER."', '".LIMIT_TIME_SELL."', s.dt_approve, now()) = '0분')) ) sum_a on sum_a.cd_sale = s.cd_sale"; }else{ $sql = $sql. " and 1!=1 "; } } if($ds_status == "E0"){ $nm_title = "입찰대기 리스트"; }else if($ds_status == "F0"){ $nm_title = "입찰중 리스트"; }else if($ds_status == "Z0"){ $nm_title = "낙찰 리스트"; }else if($ds_status == "ZE"){ $nm_title = "유찰 리스트"; }else if($ds_status == "ZS"){ $nm_title = "구매확정 리스트"; } $totalrows = @mysql_result(mysql_query("select count(*) from sale_master s inner join car_master a on ( s.cd_car = a.cd_car ) $sql_from $sql"),0,0); ?>

마이페이지

쉽고 간편한 내차팔기, 견적산출, 최종 매각까지 어떤 수수료도 요구하지 않습니다.