<!--#include virtual="/includes/topofpage.asp"-->
<%
Dim Page 
Page = "57"

Dim State, Country, City, County, Tax_Rate_Type_ID

Dim Conn
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open Application("conn_string")


If (UCase(Request.ServerVariables("REQUEST_METHOD")) = "POST" And Request.Form("page") = Page) Then

	Dim SQL, Expire_Date, Effective_Date

	Expire_Date = Trim(Request("Expire_Date"))
	Effective_Date = Trim(Request("Effective_Date"))
	
	If Expire_Date = "" Then
		Expire_Date = "NULL"
	End If
	
	If Effective_Date = "" Then
		Effective_Date = Date()
	End If
	
	SQL = "Add_Tax_Rate @City='" & Request("City") & "', @State='" & Request("State") & "', @County='" & Request("County") & "', "
	SQL = SQL & "@Country='" & Request("Country") & "', @Tax_Rate_Type_ID='" & Request("Tax_Rate_Type_ID") & "', "
	SQL = SQL & "@Tax_Rate='" & Request("Tax_Rate") & "', @Effective_Date='" & Effective_Date & "', "
	SQL = SQL & "@Expire_Date=" & Expire_Date & ", @Verified='" & Request("Verified") & "'"
	
	'Response.Write SQL
	Conn.Execute(SQL)

    ' Linking to the next page
    If Request.Form("cont") = "1" Then Response.Redirect "default-lodging.asp"
    If Request.Form("cont") = "2" Then Response.Redirect ("tax-rates_admin.asp?State=" & Request("State") & "&City=" & Request("City") & "&County=" & Request("County") & "&Country=" & Request("Country"))

End If



If Trim(Request("State")) <> "" Then
	State = Request("State")
ElseIf Not Trim(Session("State_Abbr")) = "" Then
	State = Session("State_Abbr")
Else
	State = "FL"
End If

If Trim(Request("Country")) <> "" Then
	Country = Request("Country")
ElseIf Not Trim(Session("Country_Abbr")) = "" Then
	Country = Session("Country_Abbr")
Else
	Country="US"
End If

If Trim(Request("City")) <> "" Then
	City = Request("City")
ElseIf Not Trim(Session("City")) = "" Then
	City = Session("City")
Else
	City=""
End If

If Trim(Request("County")) <> "" Then
	County = Request("County")
ElseIf Not Trim(Session("County")) = "" Then
	County = Session("County")
Else
	County=""
End If

If Trim(Request("Tax_Rate_Type_ID")) <> "" Then
	Tax_Rate_Type_ID = Request("Tax_Rate_Type_ID")
ElseIF Not Trim(Session("Tax_Rate_Type_ID")) = "" Then
	Tax_Rate_Type_ID = Session("Tax_Rate_Type_ID")
Else
	Tax_Rate_Type_ID = ""
End If

	' Getting List of that Rate Types
	Dim SQLTaxTypes, RSTax_Types
	SQLTaxTypes = "Execute Get_Tax_Rate_Types @Tax_Rate_Type_ID='" & Tax_Rate_Type_ID & "'"
	Set RSTaxTypes = Conn.Execute(SQLTaxTypes)
	

%>
<html>
<STYLE>
BODY {SCROLLBAR-FACE-COLOR: #5e5ebe; SCROLLBAR-HIGHLIGHT-COLOR: #5e5ebe; SCROLLBAR-SHADOW-COLOR: #5e5ebe; SCROLLBAR-3DLIGHT-COLOR: #5e5ebe; SCROLLBAR-ARROW-COLOR:  #6666CC; SCROLLBAR-TRACK-COLOR: #E3E3E3; SCROLLBAR-DARKSHADOW-COLOR: #666666; }
</STYLE>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript">
<!--
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}

function Sub_Form (cont)
{
  if(!form1.Tax_Rate.value == '') {
    form1.cont.value=cont
    form1.submit();
  } else {
	alert('Please enter a tax rate.');
  }
}

//-->
</script>
<link rel="stylesheet" href="../Style-sheets/standard-input-form.css" type="text/css">
<link rel="stylesheet" href="/Style-sheets/headline.css" type="text/css">
<link rel="stylesheet" href="/Style-sheets/galley-text-indent.css" type="text/css">
</head>

<body bgcolor="#ffffff" text="#000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onLoad="MM_preloadImages('images/icon-return-to-main-2.gif','images/icon-submit-changes-2.gif','images/icon-continue-wizard-2.gif')">
<form name="form1" method="post" action="">
<INPUT type="hidden" id=page name=page value="<%=Page%>">
<INPUT type="hidden" id=cont name=cont >
<INPUT type="hidden" id=Tax_Rate_Type_ID name=Tax_Rate_Type_ID value="<%=Tax_Rate_Type_ID%>">
<INPUT type="hidden" id=Country name=Country value="<%=Trim(Country)%>">
<INPUT type="hidden" id=State name=State value="<%=Trim(State)%>">
<INPUT type="hidden" id=County name=County value="<%=Trim(County)%>">
<INPUT type="hidden" id=City name=City value="<%=Trim(City)%>">
  <table width="525" border="0" cellspacing="0" cellpadding="2" align="center">
    <tr> 
      <td width="338">&nbsp;</td>
      <td align="right" width="187">&nbsp;</td>
    </tr>
    <tr> 
      <td width="338" bgcolor="#5e5ebe" class="headline-ffffff" align="middle">Tax Rate Management</td>
      <td bgcolor="#5e5ebe" align="right" width="187"><A onmouseover="MM_swapImage('Image1','','images/icon-return-to-main-2.gif',1)" onmouseout=MM_swapImgRestore() href="default-lodging.asp"><IMG height=17 src="images/icon-return-to-main.gif" width=75 useMap=#returntomain border=0 name=Image1></a></td>
    </tr>
  </table>
  <table width="500" border="0" cellspacing="0" cellpadding="2" align="center">
    <tr> 
      <td width="45">&nbsp;</td>
      <td width="109">&nbsp;</td>
      <td width="334">&nbsp;</td>
    </tr>
    <tr> 
      <td>&nbsp;</td>
      <td colspan="2" class="manage-menu-bold">Add Tax Rate For:</td>
    </tr>
    <tr> 
      <td colspan="3">
	<table border="0" cellspacing="0" cellpadding="0" width="100%">
	<tr>
<% If Not County = "" Then %>
		<td class="manage-menu">County:</td>
<%  End If

	If Not City = "" Then %>		
		<td class="manage-menu">City:</td>
<%  End If

	If Not State = "" Then %>		

		<td class="manage-menu">State:</td>
<%  End If

	If Not Country = "" Then %>		
		<td class="manage-menu">Country:</td></tr>
<%	End If %>		
	<tr>
<% If Not County = "" Then %>
		<td><%= County %></td>
<%  End If

	If Not City = "" Then %>		
		<td><%= City %></td>
<%  End If

	If Not State = "" Then %>		

		<td><%= State %></td>
<%  End If

	If Not Country = "" Then %>		
		<td><%= Country %></td>
<%	End If %>		
	</tr>
	</table>
      </td>
    </tr>
    <tr> 
      <td width="45">&nbsp;</td>
      <td width="109">&nbsp;</td>
      <td width="334">&nbsp;</td>
    </tr>

	<% Do While Not RSTaxTypes.EOF	
'Set RSRate = Conn.Execute("Get_Tax_Rate_Locale @City='" & City & "', @State='" & State & "', @County='" & County & "', @")

%>
    <tr> 
      <td colspan="3"  height="16" class="manage-menu-bold"><%=RSTaxTypes("Tax_Type_Name")%></td>
    </tr>
    <tr> 
      <td width="45" class="manage-menu">&nbsp;</td>
      <td  width="109" class="manage-menu">Tax Rate:</td>
      <td  width="334" class="manage-menu">
        <input name="Tax_Rate" id="Tax_Rate" size="4" Value=""> &nbsp;&nbsp;(5.7% would be entered as 5.7)</td>
    </tr>
    <tr> 
      <td width="45">&nbsp;</td>
      <td width="109" class="manage-menu">Effective Date:</td>
      <td width="334" class="manage-menu">Expire Date:</td>
    </tr>
    <tr> 
      <td width="45">&nbsp;</td>
      <td width="109" align="right"><input type="text" name="effective_date" size="10"></td>
      <td width="334">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="text" name="expire_date" size="10"></td>
    </tr>
    <tr> 
      <td width="45">&nbsp;</td>
      <td width="109">&nbsp;</td>
      <td width="334">&nbsp;</td>
    </tr>
	
    <%	
	   RSTaxTypes.MoveNext
	   Loop 
	%>
    <tr> 
      <td colspan="2">&nbsp;</td>
      <td width="334" class="manage-menu">Active Tax Rate? &nbsp;<input type="checkbox" value="1" name="Verified"> Yes</td>
    </tr>
    <tr> 
      <td width="45">&nbsp;</td>
      <td width="109">&nbsp;</td>
      <td width="334">&nbsp;</td>
    </tr>
  </table>
  <table width="525" border="0" cellspacing="0" cellpadding="0" align="center">
    <tr bgcolor="#5e5ebe"> 
 <!-- -->
      <td align="right" width="49%" bgcolor="#5e5ebe">
		<a href="javascript:Sub_Form('1');" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('submitchanges','','images/icon-submit-changes-2.gif',1)">
			<img src="images/icon-submit-changes.gif" width="200" height="15" name="submitchanges" border="0">
		</a>
	  </td>
      <td width="51%">
		<a href="javascript:Sub_Form('2');" onmouseover="MM_swapImage('Image2','','images/icon-continue-wizard-2.gif',1)"  onmouseout=MM_swapImgRestore()>
			<img src="images/icon-continue-wizard.gif" width="150" height="15" usemap="#continue" border="0" name="Image2">
		</a>
	  </td>
 </tr>
  <tr> 
    <td width="49%">&nbsp;</td>
    <td width="51%">&nbsp;</td>
  </tr>
</table> 
</form>
</body>
</html>
<% Set Conn = Nothing %>