<?php
	include $_SERVER['DOCUMENT_ROOT'].'/common/lib/comm.php';
	include $_SERVER['DOCUMENT_ROOT'].'/common/dealer_chk.php';

?>
<!DOCTYPE html>
<HTML lang="ko">
<head>
<meta charset="utf-8">
<title>UPRO</title>
<meta name="viewport" content="user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, width=device-width">
<meta name="format-detection" content="telephone=no">
<link rel="stylesheet" type="text/css" href="/m/css/common.css">
<link rel="stylesheet" type="text/css" href="/m/css/sub.css">
<script type="text/javascript" charset="utf-8" src="/m/js/jquery-1.11.2.min.js"></script>
<script type="text/javascript" charset="utf-8" src="/m/js/ui.js"></script>
<script type="text/javascript" src="<?=JS_PATH?>"></script>
</head>

<body>
<!-- s : header -->
<? include("../inc/inc_header.php"); ?>
<!-- // e : header -->

<!-- s : container -->
<section id="container">
	<section id="visual" class="visual_mypage">
		<h2>마이페이지</h2>
		<p>쉽고 간편한 내차팔기, 견적산출,<br>최종 매각까지 어떤 수수료도 요구하지 않습니다.</p>
	</section>

	<section id="content">
   

<?
	$s_cd_dealer = $_SESSION['s_cd_dealer'];
	$s_cd_dealer_p = $_SESSION['s_cd_dealer_p'];
	$s_ds_type = $_SESSION['s_ds_type'];
	$s_ds_status_p = $_SESSION['s_ds_status_p'];

	if($s_ds_type == "D0"){	//딜러
		$sql_ds_type = " cd_dealer_p = '$s_cd_dealer' ";
	}else{	//딜러-관리자
		$sql_ds_type = " cd_dealer = '$s_cd_dealer' ";
	}

	$rq_ds_status = $_REQUEST['ds_status'];	//요청받은 상태값 : request ds_status	(naming request->rq, response->rs)

	if($rq_ds_status == "E0"){
		$nm_title = "입찰대기 리스트";
	}else if($rq_ds_status == "F0"){
		$nm_title = "입찰중 리스트";
	}else if($rq_ds_status == "Z0"){
		$nm_title = "낙찰 리스트";
	}else if($rq_ds_status == "ZS"){
		$nm_title = "구매확정 리스트";
	}

	$cd_sale = $_REQUEST["cd_sale"];

	$sql ="SELECT 
						a.* 
						, b.nm_model 
						, c.nm_grade 
						, d.nm_brand 
						, e.nm_model_sub 
						, getCode('car_master','ds_type',a.ds_type) as nm_type 
						, getCode('car_master','ds_year',a.ds_year) as nm_year 
						, getCode('car_master','ds_open',a.ds_open) as nm_open 
						, getCode('car_master','ds_sales',a.ds_sales) as nm_sales 
						, getCode('car_master','ds_transmission',a.ds_transmission) as nm_transmission 
						, getCode('car_master','ds_oil',a.ds_oil) as nm_oil 
						, getCode('car_master','ds_accident',a.ds_accident) as nm_accident 
						, getCode('sale_master','ds_usertype',s.ds_usertype) as nm_usertype 
						, getCode('member_master','ds_area',s.ds_area) as nm_area 
						, getCode('sale_master','ds_status',s.ds_status) as nm_status 
						, s.nm_name nm_name_sale 
						, s.ds_status ds_status_sale 
						, s.nm_hp nm_hp_sale 
						, s.nm_email nm_email_sale 
						, s.ds_area ds_area_sale 
						, s.nm_recommend nm_recommend_sale 
						, s.nm_cont_return nm_cont_return_sale 
						, getRemainTime(".LIMIT_TIME_TENDER.", s.dt_approve, now()) as time_limit_tender  
						FROM sale_master s 
							inner join car_master a 
							on (s.cd_car = a.cd_car) 
							left outer join car_model b 
							on (a.cd_model = b.cd_model)
							left outer join car_grade c 
							on (a.cd_grade = c.cd_grade) 
							left outer join car_brand d 
							on (a.cd_brand = d.cd_brand)
							left outer join car_model_sub e 
							on (a.cd_model_sub = e.cd_model_sub)
						WHERE s.cd_sale='$cd_sale' ";

	$col=mysql_fetch_array(mysql_query($sql));
	if (!empty($col[cd_car])){ 

		$cd_car = $col[cd_car];
		$cd_model = $col[cd_model];
		$cd_brand = $col[cd_brand];
		$ds_logo = $col[ds_logo];
		$cd_category = $col[cd_category];
		$cd_grade = $col[cd_grade];
		$ds_cate = $col[ds_cate];
		$ds_type = $col[ds_type];
		$ds_year = $col[ds_year];
		$nm_name = $col[nm_name];
		$nm_price = $col[nm_price];
		$nm_mileage = $col[nm_mileage];
		$ds_driving_system = $col[ds_driving_system];
		$ds_transmission = $col[ds_transmission];
		$nm_file_list = $col[nm_file_list];
		$nm_file_main = $col[nm_file_main];
		$nm_file_report = $col[nm_file_report];
		$nm_file_report_back = $col[nm_file_report_back];
		$nm_file_front = $col[nm_file_front];
		$nm_file_back = $col[nm_file_back];
		$nm_file_side1 = $col[nm_file_side1];
		$nm_file_side2 = $col[nm_file_side2];
		$nm_file_dashboard = $col[nm_file_dashboard];
		$ds_oil = $col[ds_oil];
		$nm_gearbox = $col[nm_gearbox];
		$nm_color = $col[nm_color];
		$nm_incolor = $col[nm_incolor];
		$ds_accident = $col[ds_accident];
		$nm_cont_accident  = $col[nm_cont_accident];
		$nm_regdate = $col[nm_regdate];
		$ds_sales = $col[ds_sales];
		$nm_btitle = $col[nm_btitle];
		$nm_stitle = $col[nm_stitle];
		$nm_ltitle = $col[nm_ltitle];
		$nm_cont = $col[nm_cont];
		$nm_guide = $col[nm_guide];
		$ds_open = $col[ds_open];
		$ds_status = $col[ds_status];
		$dt_insert = $col[dt_insert];
		$nm_insert = $col[nm_insert];
		$dt_update = $col[dt_update];
		$nm_update = $col[nm_update];
		$ds_delind = $col[ds_delind];
		$nm_number = $col[nm_number];
		$nm_cc = $col[nm_cc];
		$ds_trade = $col[ds_trade];
		$ds_main = $col[ds_main];
		$nm_regdate_yyyy = $col[nm_regdate_yyyy];
		$nm_regdate_mm = $col[nm_regdate_mm];
		$nm_regdate_dd = $col[nm_regdate_dd];

		$nm_brand = $col[nm_brand];
		$nm_model = $col[nm_model];
		$nm_model_sub = $col[nm_model_sub];
		$nm_grade = $col[nm_grade];

		$nm_year = $col[nm_year];
		$nm_type = $col[nm_type];
		$nm_open = $col[nm_open];
		$nm_sales = $col[nm_sales];
		$nm_transmission = $col[nm_transmission];
		$nm_oil = $col[nm_oil];
		$nm_usertype = $col[nm_usertype];
		$nm_accident = $col[nm_accident];
		$nm_area = $col[nm_area];
		$nm_name_sale = $col[nm_name_sale];
		$ds_status_sale = $col[ds_status_sale];
		$nm_hp_sale = $col[nm_hp_sale];
		$nm_email_sale = $col[nm_email_sale];
		$ds_area_sale = $col[ds_area_sale];
		$nm_recommend_sale = $col[nm_recommend_sale];
		$nm_cont_return_sale = $col[nm_cont_return_sale];

		$time_limit_tender = $col[time_limit_tender];

		//보험처리
		$nm_act_chgno = $col[nm_act_chgno];
		$nm_act_chgnm = $col[nm_act_chgnm];
		$nm_act_s1 = $col[nm_act_s1];
		$nm_act_s2 = $col[nm_act_s2];
		$nm_act_s3 = $col[nm_act_s3];
		$nm_act_s4 = $col[nm_act_s4];
		$nm_act_my = $col[nm_act_my];
		$nm_act_my_amt = $col[nm_act_my_amt];
		$nm_act_other = $col[nm_act_other];
		$nm_act_other_amt = $col[nm_act_other_amt];
		$nm_act_searchdt = $col[nm_act_searchdt];
		$nm_act_cnt = $col[nm_act_cnt];
		$nm_act_general_spec = $col[nm_act_general_spec];
		$nm_act_use_record = $col[nm_act_use_record];
		$nm_act_use_record_lend = $col[nm_act_use_record_lend];
		$nm_act_use_record_biz = $col[nm_act_use_record_biz];
		$nm_act_use_record_official = $col[nm_act_use_record_official];
		$nm_act_ins_loss = $col[nm_act_ins_loss];
		$nm_act_ins_wet = $col[nm_act_ins_wet];
		$nm_act_ins_robbery = $col[nm_act_ins_robbery];
		$nm_file_act = $col[nm_file_act];
		$nm_act_yn = $col[nm_act_yn];

		$ds_g1_01 = $col[ds_g1_01];
		$ds_g1_02 = $col[ds_g1_02];
		$ds_g1_03 = $col[ds_g1_03];
		$ds_g1_04 = $col[ds_g1_04];
		$ds_g1_05 = $col[ds_g1_05];
		$ds_g2_01 = $col[ds_g2_01];
		$ds_g2_02 = $col[ds_g2_02];
		$ds_g2_03 = $col[ds_g2_03];
		$ds_g2_04 = $col[ds_g2_04];
		$ds_g2_05 = $col[ds_g2_05];
		$ds_g3_01 = $col[ds_g3_01];
		$ds_g3_02 = $col[ds_g3_02];
		$ds_g3_03 = $col[ds_g3_03];
		$ds_g3_04 = $col[ds_g3_04];
		$ds_g3_05 = $col[ds_g3_05];
		$ds_g4_01 = $col[ds_g4_01];
		$ds_g4_02 = $col[ds_g4_02];
		$ds_g4_03 = $col[ds_g4_03];
		$ds_g4_04 = $col[ds_g4_04];
		$ds_g4_05 = $col[ds_g4_05];

/*
		$arr_nm_info1 = explode("-",$nm_info1);
		if(count($arr_nm_info1) == 3){
			$nm_info11 = $arr_nm_info1[0];
			$nm_info12 = $arr_nm_info1[1];
			$nm_info13 = $arr_nm_info1[2];
		}else{
			$nm_info11 = "";
			$nm_info12 = "";
			$nm_info13 = "";
		}

		$arr_nm_info3 = explode("@",$nm_info3);
		if(count($arr_nm_info3) == 2){
			$nm_info31 = $arr_nm_info3[0];
			$nm_info32 = $arr_nm_info3[1];
		}else{
			$nm_info31 = "";
			$nm_info32 = "";
		}
		$nm_info3 = $col[nm_info3];
*/

	}else{
			AlertBack("지정되지않은 요청입니다");
	}

?> 
        
        
        

		<h3>차량 기본정보</h3>
		<div class="car_model">
			<p><?=$col[nm_model]." ".$col[nm_model_sub]." ".$col[nm_grade]?></p>
            
            
            	<? if($ds_status_sale == "E0" || $ds_status_sale == "F0"){ ?>
		         
			<p>입찰 마감 시간 : <em><?=$time_limit_tender?></em><!--시간--></p>	<? } ?>
		</div>
		<table class="tbl_h">
			<colgroup>
				<col width="32%">
				<col width="*">
			</colgroup>
			<tr>
				<th>차량번호</th>
				<td><?=$nm_number?></td>
			</tr>
            	<tr>
				<th>제조사</th>
				<td><?=$nm_brand?></td>
			</tr>
			<tr>
				<th>모델</th>
				<td><?=$nm_model?></td>
			</tr>
            	<tr>
				<th>세부모델</th>
				<td><?=$nm_model_sub?></td>
			</tr>
            
               	<tr>
				<th>등급</th>
				<td><?=$nm_grade?></td>
			</tr>
			<tr>
				<th>연식(최초등록일)</th>
				<td><?=$nm_regdate_yyyy."년 ".$nm_regdate_mm."월"?></td>
			</tr>
			<tr>
				<th>형식연도</th>
				<td><?=$nm_year?>년</td>
			</tr>
			<tr>
				<th>배기량</th>
				<td><?=$nm_cc?>cc</td>
			</tr>
			<tr>
				<th>변속기</th>
				<td><?=$nm_transmission?></td>
			</tr>
			<tr>
				<th>연료</th>
				<td><?=$nm_oil?></td>
			</tr>
			<tr>
				<th>색상</th>
				<td><?=$nm_color?></td>
			</tr>
			<tr>
				<th>주행거리</th>
				<td><?=$nm_mileage?>km</td>
			</tr>
	<!--		<tr>
				<th>추천인</th>
				<td>없음</td>
			</tr>-->
			<tr>
				<th>사고유무</th>
				<td>
					<?=$nm_accident?><?=($ds_accident == "A0") ? " - ".$nm_cont_accident : "" ?>
				</td>
			</tr>
			<tr>
				<th>옵션</th>
				<td><?=$nm_cont?></td>
			</tr>
			<tr>
				<th>필수사진</th>
				<td>
					<ul class="photo_list">
						<li>
							<img src="<?=UPLOAD_PATH_CAR?>nm_file_main/<?=$nm_file_front?>" onclick="viewPhoto('<?=UPLOAD_PATH_CAR?>nm_file_main/<?=$nm_file_front?>')">
							<span>차량전면</span>
						</li>
						<li>
							<img src="<?=UPLOAD_PATH_CAR?>nm_file_main/<?=$nm_file_back?>" onclick="viewPhoto('<?=UPLOAD_PATH_CAR?>nm_file_main/<?=$nm_file_back?>')">
							<span>차량후면</span>
						</li>
						<li>
							<img src="<?=UPLOAD_PATH_CAR?>nm_file_main/<?=$nm_file_side1?>" onclick="viewPhoto('<?=UPLOAD_PATH_CAR?>nm_file_main/<?=$nm_file_side1?>')">
							<span>운전석 측면</span>
						</li>
						<li>
							<img src="<?=UPLOAD_PATH_CAR?>nm_file_main/<?=$nm_file_side2?>" onclick="viewPhoto('<?=UPLOAD_PATH_CAR?>nm_file_main/<?=$nm_file_side2?>')">
							<span>조수석 측면</span>
						</li>
						<li>
							<img src="<?=UPLOAD_PATH_CAR?>nm_file_main/<?=$nm_file_dashboard?>" onclick="viewPhoto('<?=UPLOAD_PATH_CAR?>nm_file_main/<?=$nm_file_dashboard?>')">
							<span>계기판</span>
						</li>
					</ul>
				</td>
			</tr>
			<tr>
				<th>추가사진</th>
				<td>
					<ul class="photo_list">
					<?
						if(!empty($col[cd_car])){
							$r = mysql_query("SELECT * FROM car_file WHERE cd_car = '$cd_car' and ds_type='' and ds_delind='N' Order by no_sort asc ,  cd_car ASC ");
							$i=1;
							while($imgs = mysql_fetch_array($r)) {
					?> 
						<li><img src="<?=UPLOAD_PATH_CAR?><?=$imgs[cd_car]?>_detail/<?=$imgs[nm_file]?>" onclick="viewPhoto('<?=UPLOAD_PATH_CAR?><?=$imgs[cd_car]?>_detail/<?=$imgs[nm_file]?>')"></li>
					<?	
							}
						}else{
					?>
					<?	
						}
					?>
                    
                    
					<!--	<li><img src="/admin/img/@img_car.jpg"></li>
						<li><img src="/admin/img/@img_car.jpg"></li>
						<li><img src="/admin/img/@img_car.jpg"></li>-->
					</ul>
				</td>
			</tr>
			<tr>
				<th>담당자코멘트</th>
				<td><?=$nm_guide?></td>
			</tr>
		</table>

		<h3>사고이력정보</h3>
		<ul class="accident_history">
			<li><span>차량번호 변경</span> <em><?=$nm_act_chgno?>회</em></li>
			<li><span>소유자 변경</span> <em><?=$nm_act_chgnm?> 회</em></li>
			<li><span>자동차 보험 특수 사고</span> <em>전손 : <?=$nm_act_s1?> 회 / 침수전손 :  <?=$nm_act_s2?> 회 / 침수분손 : <?=$nm_act_s3?> 회 / 도난 : <?=$nm_act_s4?> 회</em></li>
			<li><span>보험사고 (내차피해)</span> <em><?=$nm_act_my?> 회 (<?=$nm_act_my_amt?> 원)</em></li>
			<li><span>보험사고 (타차가해)</span> <em><?=$nm_act_other?>회 (<?=$nm_act_other_amt?>원)</em></li>
			<!--<li><span>사고이력 조회일</span> <em>2018-12-05</em></li>-->
		</ul>

		<div class="btn_center">
			<a href="#" class="button" onclick="openLayer('car'); return false;">사고이력 정보 조회 보기</a>
		</div>

	<!--	<div class="btn_center">
			<a href="#" class="button">목록가기</a>
		</div>-->

		<!-- layer popup -->
		<div class="layer_popup car_popup">
			<h3>중고차 보험처리 이력정보 보고서</h3>
			<p class="close">레이어팝업닫기</p>
			<div class="scr_cont">
				<h4>중고차 사고이력 요약 정보</h4>
				<table class="tbl_data">
					<colgroup>
						<col width="44%">
						<col width="*">
					</colgroup>
					<tr>
						<th>자동차 일반사양</th>
						<td><?=$nm_act_general_spec?></td>
					</tr>
					<tr>
						<th>자동차 용도이력</th>
						<td><?=$nm_act_use_record?></td>
					</tr>
					<tr>
						<th>자동차 번호 /<br>소유자 변경횟수</th>
						<td><?=$nm_act_chgno?>회 / <?=$nm_act_chgnm?>회</td>
					</tr>
					<tr>
						<th>자동차보험 특수<br>사고이력(전손, 침수, 도난)</th>
						<td>전손 : <?=$nm_act_s1?>, 도난 : <?=$nm_act_s4?>, 침수<br>(전손 : <?=$nm_act_s2?>, 분손 : <?=$nm_act_s3?>)</td>
					</tr>
					<tr>
						<th>보험사고이력(내차 피해)</th>
						<td><?=$nm_act_my?>회, <?=$nm_act_my_amt?>원</td>
					</tr>
					<tr>
						<th>보험사고이력(타차 피해)</th>
						<td><<?=$nm_act_other?> 회, <?=$nm_act_other_amt?> 원</td>
					</tr>
				</table>
				<p class="notice01">자동차보험 사고기록이 없었다고 해서 반드시 무사고라고 할 수는 없습니다.</p>

				<h5>1. 자동차 용도 이력정보</h5>
				<table class="tbl_data">
					<colgroup>
						<col width="35%">
						<col width="*">
					</colgroup>
					<tr>
						<th>대여용도 사용이력(렌터카)</th>
						<td><?=$nm_act_use_record_lend?></td>
					</tr>
					<tr>
						<th>영업용도 사용이력</th>
						<td><?=$nm_act_use_record_biz?></td>
					</tr>
					<tr>
						<th>관용용도 사용이력</th>
						<td><?=$nm_act_use_record_official?></td>
					</tr>
				</table>
				<p class="notice02">과거 자동차번호 변경기록을 모두 검색하여 제공하는 것으로 대여용(렌트카), 영업용(택시 등)으로 사용된 적이 있는지 확인할 수 있습니다.</p>

				<h5>2. 자동차보험 특수 사고 이력 정보</h5>
				<table class="tbl_data">
					<colgroup>
						<col width="35%">
						<col width="*">
					</colgroup>
					<tr>
						<th>전손 보험사고</th>
						<td><?=$nm_act_ins_loss?></td>
					</tr>
					<tr>
						<th>침수 보험사고</th>
						<td><?=$nm_act_ins_wet?></td>
					</tr>
					<tr>
						<th>도난 보험사고</th>
						<td><?=$nm_act_ins_robbery?></td>
					</tr>
				</table>

				<h5>3. 보험사고 이력정보 : 내차 피해</h5>
				<table class="tbl_data2">
					<colgroup>
						<col width="20%">
						<col width="20%">
						<col width="20%">
						<col width="20%">
						<col width="20%">
					</colgroup>
					<thead>
					<tr>
						<th>사고일자</th>
						<th>부품</th>
						<th>공임</th>
						<th>도장</th>
						<th>총 수리비용</th>
					</tr>
					</thead>
					<tbody>
					<tr>
						<th><?=$ds_g1_01?></th>
						<td><?=$ds_g1_02?>원</td>
						<td><?=$ds_g1_03?>원</td>
						<td><?=$ds_g1_04?>원</td>
						<td><?=$ds_g1_05?>원</td>
					</tr>
					<tr>
						<th><?=$ds_g2_01?></th>
						<td><?=$ds_g2_02?>원</td>
						<td><?=$ds_g2_03?>원</td>
						<td><?=$ds_g2_04?>원</td>
						<td><?=$ds_g2_05?>원</td>
					</tr>
                    <tr>
						<th><?=$ds_g3_01?></th>
						<td><?=$ds_g3_02?>원</td>
						<td><?=$ds_g3_03?>원</td>
						<td><?=$ds_g3_04?>원</td>
						<td><?=$ds_g3_05?>원</td>
					</tr>
					<tr>
						<th><?=$ds_g4_01?></th>
						<td><?=$ds_g4_02?>원</td>
						<td><?=$ds_g4_03?>원</td>
						<td><?=$ds_g4_04?>원</td>
						<td><?=$ds_g4_05?>원</td>
					</tr>
                    
					</tbody>
				</table>

			<!--	<h5>4. 보험사고 이력정보 : 타차 가해</h5>
				<table class="tbl_data2">
					<colgroup>
						<col width="20%">
						<col width="20%">
						<col width="20%">
						<col width="20%">
						<col width="20%">
					</colgroup>
					<thead>
					<tr>
						<th>사고일자</th>
						<th>부품</th>
						<th>공임</th>
						<th>도장</th>
						<th>총 수리비용</th>
					</tr>
					</thead>
					<tbody>
					<tr>
						<th>2017-05-27</th>
						<td>857,610원</td>
						<td>857,610원</td>
						<td>857,610원</td>
						<td>857,610원</td>
					</tr>
					<tr>
						<th>2017-05-27</th>
						<td>857,610원</td>
						<td>857,610원</td>
						<td>857,610원</td>
						<td>857,610원</td>
					</tr>
					</tbody>
				</table>-->
				<ul class="notice03">
					<li>중고차 사고 이력정보 서비스는 자동차 보험을 취급하는 14개 손해보험사의 자동차 보험수리비 지급기록(1996년 이후)에 근거하여 제공하고 있습니다.<br>
					따라서 다음과 같은 경우에는 중고차 사고 이력정보 서비스를 제공할 수 없습니다.</li>
					<li>
						<ol>
							<li>사고가 있었다하더라도 보험회사에 사전신고를 하지 않고 자비로 처리한 경우,<br>
							사고신고를 하였더라도 면책, 취소 등의 사유로 보험금이 지급되지 않은경우,<br>
							사고신고 후 자비로 처리한 경우입니다.</li>
							<li>사고가 있었다하더라도 종합보험, 즉 자기차량담보나 대물배상담보의 자동차 보험에 가입하지 않아서 자동차 보험으로 수리비용을 청구하지 못한 경우<br>
							(단, 이경우라도 타인 자동차보험에서 보상받은 경우에는 사고정보 제공가능)</li>
							<li>자동차보험이 아니 운수공제(택시공제, 화물공제, 버스공제 등)에 가입되어 운수공제로부터 자동차의 피해에 대한 손해를 보상받은 경우 등</li>
						</ol>
					</li>
					<li>본 중고차 사고이력정보는 중고차 품질확인을 위한 보조정보이며 결정적인 판단 자료로 사용되어서는 아니됩니다. 따라서 정밀한 중고차 품질확인을<br>
					원하시면 차량진단 전문업체의 진단을 받아보시기 바랍니다.</li>
					<li>※ 보험개발원(www.kidi.or.kr)은 보험입법 제 176조에 의하여 설립된 보험요율산출기관이며,<br>
					중고차사고이력정보서비스(www.carhistory.or.kr)는 보험업법시행령 제86조 제1호 근거하여 제공합니다. </li>
				</ul>
				<p class="sign"><img src="/m/img/img_sign.gif"></p>
			</div>
		</div>
		<!-- // layer popup -->
        
       <?

	$sql ="select count(*) cnt, max(case when ".$sql_ds_type." then nm_price else 0 end) nm_price_max from tender_master where cd_sale = $cd_sale ";

	$col1=mysql_fetch_array(mysql_query($sql));

?> 
        

		<div class="bidding_board" <? if($col1[nm_price_max]>0) { ?> ty2<? } ?>>
			<dl>
				<dt>입찰 진행 중</dt>
				<dd><strong><?=$col1[cnt]?></strong>명의 딜러가 입찰하였습니다.</dd>
			</dl>
            
            <?
		if($col1[nm_price_max]>0) {
?>
			<p>나의 입찰가는 <strong><?=$col1[nm_price_max]?></strong>만원입니다.</p>
            
    <?
		}
?>        
            
            
		</div>
<?
//select count(*) cnt_tender, sum(case when cd_dealer = '55' then 1 else 0 end) cnt_tender_dealer from tender_master where ds_delind ='N' and cd_sale = '73' and cd_dealer_p = '52'
//	$cd_tender = @mysql_result(mysql_query("select cd_tender from tender_master where ds_delind ='N' and cd_sale = '$cd_sale' and cd_dealer = '$s_cd_dealer' "),0,0);
	$cd_tender = mysql_fetch_array(mysql_query("select count(*) cnt_tender, sum(case when cd_dealer = '$s_cd_dealer' then 1 else 0 end) cnt_tender_dealer from tender_master where ds_delind ='N' and cd_sale = '$cd_sale' and cd_dealer_p = '$s_cd_dealer_p' "));

		//입찰하기 : 입찰대기건/부관리자/현재미입찰건(부관리자본인)
//		if($rq_ds_status == "E0" && $s_ds_type == "D1" && empty($cd_tender) && $time_limit_tender != "0분"){	//딜러-관리자
		//입찰하기 : 입찰대기건/부관리자/소속딜러입찰건1건이하일경우만(2건이상일경우제한)/현재미입찰건(부관리자본인)/소속총괄관리자 관리자에게 승인 받은 경우
		if($rq_ds_status == "E0" && $s_ds_type == "D1" && ($cd_tender[cnt_tender] < 2 && $cd_tender[cnt_tender_dealer] == 0) && $time_limit_tender != "0분" && $s_ds_status_p == "Z0"){	//딜러-관리자
?>
        

		<div class="btn_center">
			<a href="#" class="button" onclick="openLayer('price'); return false;">입찰하기</a>
		</div>

		<!-- layer_popup -->
		<div class="layer_popup price_popup">
			<div class="popup_wrap">
				<p class="msg">
					내 입찰금액은<br><input type="text" class="inp_txt" style="width:100%;" name="nm_price_pop" id="nm_price_pop"><br>만원입니다.
					<span class="sub_txt">(※ 입력 예시 : 1500만원일 경우 1500입력,  500만원일 경우 500입력)</span>
				</p>
				<div class="btn_center">
					<a href="#" class="button" id="btn_write">입찰하기</a>
				</div>
				<!-- p class="msg2"><em>내 입찰금액은</em><strong>2,500</strong>만원입니다.</p>
				<div class="btn_center">
					<a href="#" class="button">확인</a>
					<a href="#" class="button gray" onclick="closeLayer('price'); return false;">취소</a>
				</div -->
			</div>
			<div class="close">레이어팝업 닫기</div>
		</div>
		<!-- // layer_popup -->
      <form id="frmForm" name="frmForm" method="post" action="./dealer_proc.php">
	<input type="hidden" name="mode" id="mode" value="Tender"/>
	<input type="hidden" name="cd_sale" id="cd_sale" value="<?=$cd_sale?>"/>
	<input type="hidden" name="nm_price" id="nm_price"/>
</form>
<script language="javascript" type="text/javascript">
	
	var ds_mode ="<?=$mode?>";

	$(document).ready(function() {
		
		$("#btn_write").bind("click",function(){
			var fieldlist = [["nm_price_pop","입찰금액"]]
			if (!fnCheckForm(fieldlist)){
				return false;
			}

			$("#nm_price").val($("#nm_price_pop").val());

			var c = confirm("처리하시겠습니까?");
			if(c){
				$("#frmForm").submit();
			}else{
				return false;
			}
		});
		
	});
</script>
<?
		}
?>

		<!-- layer popup3 -->
		<div class="layer_popup photo_popup">
			<div class="popup_wrap">
				<img src="/img/sell/ic_car_photo1.png" id="photoBig">
			</div>
			<div class="close" onclick="closeLayer('photo');">레이어팝업 닫기</div>
		</div>
		<!-- // layer popup3 -->

	</div>

<script laguage="javascript" type="text/javascript">

	function viewPhoto(arg1){

		$("#photoBig").attr("src", arg1);

		openLayer('photo'); return false;

	}

</script>

	</section>
</section>
<!-- e : container -->

<!-- s : footer -->
<? include("../inc/inc_footer.html"); ?>
<!-- // e : footer -->

</body>
</html>
<?
mysql_close($connect);
?>
