:::: 개발 ::::/::: A S P :::

080501 작업 정리 (중계수수료(계산기능))

nayha 2009. 12. 28. 14:07
반응형

***  한페이지에서 처리

<!-- 인터페이스 가격체크 -->

<script language="JavaScript">
<!--
 function account(){

 var frm = document.frmReg;

  if ((frm.houseType[0].checked) == false && (frm.houseType[1].checked) == false)
  {
   alert('주택여부를 선택하여 주십시오');
   frm.houseType[0].focus();
   return;
  }

  if ((frm.goodType_code[0].checked) == false && (frm.goodType_code[1].checked) == false )
  {
   alert('거래종류를 선택하여 주십시오');
   frm.goodType_code[0].focus();
   return;
  }

   if(frm.price.value == ''){
    alert("거래금액을 입력하여 주십시오");
    frm.price.value = '';
    frm.price.focus();
    return;
   }else{
   if (!ChkNum(frm.price.value)) {
    alert("거래금액은 숫자만 입력 가능합니다!");
    frm.price.value = '';
    frm.price.focus();
    return;
   }
  }
  document.frmReg.action = 'Taxd.asp';
  document.frmReg.submit();
 }

 function ChkNum(Num) {
  var num ="0123456789";
  for (var i=0; i< Num.length; i++){
    if(-1 == num.indexOf(Num.charAt(i))){
     return false;
    }
  }
  return true;
 }

//-->
</script>

<!-- 변수 받아 계산처리 -->

<%
Dim houseType,houseTypeText
Dim goodType_code,goodTypeText '(1:매매,교환 2:임대, 전세)
Dim price,brokerage,brokerageText

houseType   = Request("houseType")
goodType_code = Request("goodType_code")
price     = Request("price")  * 10000

 Select Case houseType
  Case 1 : houseTypeText = "일반주택"
  Case 2 : houseTypeText = "주택외 비거주용 건물, 토지"
 End Select

 Select Case goodType_code
  Case 1 : goodTypeText = "매매, 교환"
  Case 2 : goodTypeText = "임대, 전세"
 End Select

 IF goodType_code = 1 Then '매매, 교환

  IF houseType  = 2 Then
   brokerage   = " ~ " & formatnumber(price * 0.009,0)
   brokerageText = "~ 0.9%"
  Else
   IF price < 50000000 Then
    brokerage   = price * 0.006
    brokerageText = "0.6%"
    IF brokerage > 250000 Then brokerage = 250000
   ElseIF price >= 50000000  and price <= 200000000 Then
    brokerage   = price * 0.005
    brokerageText = "0.5%"
    IF brokerage > 800000 Then brokerage = 800000
   Else
    brokerage   = price * 0.004
    brokerageText = "0.4%"
   End IF
    brokerage = formatnumber(brokerage,0)
  End IF

 Else '임대, 전세

  IF houseType  = 2 Then
   brokerage   = " ~ " & formatnumber(price * 0.009,0)
   brokerageText = "~ 0.9%"
  Else
   IF price < 50000000 Then
    brokerage   = price * 0.005
    brokerageText = "0.5%"
    IF brokerage > 200000 Then brokerage = 200000
   ElseIF price >= 50000000  and price <= 100000000 Then
    brokerage   = price * 0.004
    brokerageText = "0.4%"
    IF brokerage > 300000 Then brokerage = 300000
   Else
    brokerage   = price * 0.003
    brokerageText = "0.3%"
   End IF
    brokerage = formatnumber(brokerage,0)
  End IF

 End IF
%>

<!-- 체크값-->

<form name="frmReg" method="post">

                             <input type="radio" name="houseType" value=1 />
                              주택&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                              <input type="radio" name="houseType" value=2 />
                              주택 외 부동산 </td>

</form>

<a href="javascript:account();"><!-- 함수 호출 -->

반응형