Current File : /home/obabain/khb_obaba_in/AddTax.jsp
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
    <%@ include file="Connection.jsp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>

</head>
<body>
<%@include file="master.jsp" %>
<form action="" method="post">


<div class="content">
<div class="row">
<div class="col-md-9"  style="width:50%;background-color:white;">
<div class="panel panel-default" >
       <div class="panel-heading main-color-bg">
        <h3 class="panel-title">Add Tax Rate</h3>
              </div>
             </div>
             <div class="headerbar-item pull-right">
 
<a href="ViewTax.jsp" style="background:#204b58" class="btn btn-info">View</a>
</div>
              <div class="panel-body">
              Tax Rate Name
           <input type="text" name="trname" class="trname form-control txtstylesmall">

              
</div>
 <div class="panel-body">
              Tax Rate Percentage
           <input type="text" name="trperc" class="trperc form-control txtstylesmall">

              
</div>
<div class="modal-footer" id="contact_submit">
<a style="background:#204b58" class="btn btn-info pull-left"  onclick="goBack()">Back</a>
<a class="btn btn-default" href="AddTax.jsp">Reset</a>
<input type="submit" value="Save Changes" class="save btn btn-info" style="background:#204b58">

</div>
</div>



<%
try
{
	
	Statement st=con.createStatement();
	String trname=request.getParameter("trname");
	String trperc=request.getParameter("trperc");
	if(trname.equals("") || trperc.equals("") )
	{
		response.sendRedirect("AddTax.jsp");
	}
	else
	{
	int i=st.executeUpdate("insert into ip_tax_rates values(0,upper('"+trname+"'),"+trperc+","+loginid+")");
	response.sendRedirect("ViewTax.jsp");
	}
}
catch(Exception el){}
%>
</div>
</div>
<script type="text/javascript">
function goBack() {
    window.history.back();
   
};
</script>
<script>
$(document).on("click",".save", function(){
	if($(".trname").val()=="")
		{
		alert("Please enter Tax Rate Name");
		}
	if($(".trperc").val()=="")
	{
	alert("Please enter Tax Rate Percentage");
	}
})
</script>
</form>

</body>
</html>