
bill preperation

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@page import="java.sql.*" %>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>
<%
Connection con;
Statement st;
String id,dfee,mfee,rfee,sfee;
id=request.getParameter("id");
dfee=request.getParameter("dfee");
mfee=request.getParameter("mfee");
rfee=request.getParameter("rfee");
sfee=request.getParameter("sfee");
//if(id!=null && id!="")
{
// int id1=Integer.parseInt(id);
int dfee1=Integer.parseInt(dfee);
int mfee1=Integer.parseInt(mfee);
int rfee1=Integer.parseInt(rfee);
int sfee1=Integer.parseInt(sfee);
int tot=dfee1+mfee1+rfee1+sfee1;
try
{
String Url="jdbc:mysql://localhost:3306/mobile";
Class.forName("com.mysql.jdbc.Driver");
con=DriverManager.getConnection(Url,"root","root123");
st=con.createStatement();
st.executeUpdate("insert into bill(dfee,mfee,rfee,sfee,tot) values('"+dfee+"','"+mfee+"','"+rfee+"','"+sfee+"','"+tot+"');");
response.sendRedirect("http://localhost:8080/yahoo/billlfinal.jsp");
//out.print("Sucessfull!!!");
}catch(Exception e)
{
out.print(e);
}
}%>
</body>
</html>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@page import="java.sql.*" %>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>
<%
Connection con;
Statement st;
String id,dfee,mfee,rfee,sfee;
id=request.getParameter("id");
dfee=request.getParameter("dfee");
mfee=request.getParameter("mfee");
rfee=request.getParameter("rfee");
sfee=request.getParameter("sfee");
//if(id!=null && id!="")
{
// int id1=Integer.parseInt(id);
int dfee1=Integer.parseInt(dfee);
int mfee1=Integer.parseInt(mfee);
int rfee1=Integer.parseInt(rfee);
int sfee1=Integer.parseInt(sfee);
int tot=dfee1+mfee1+rfee1+sfee1;
try
{
String Url="jdbc:mysql://localhost:3306/mobile";
Class.forName("com.mysql.jdbc.Driver");
con=DriverManager.getConnection(Url,"root","root123");
st=con.createStatement();
st.executeUpdate("insert into bill(dfee,mfee,rfee,sfee,tot) values('"+dfee+"','"+mfee+"','"+rfee+"','"+sfee+"','"+tot+"');");
response.sendRedirect("http://localhost:8080/yahoo/billlfinal.jsp");
//out.print("Sucessfull!!!");
}catch(Exception e)
{
out.print(e);
}
}%>
</body>
</html>

<body>
<%@page import="java.sql.*" %>
<!DOCTYPE html>
<html>
<body>
<%
int newid=0;
Connection con;
Statement st;
ResultSet rs=null;
PreparedStatement pst=null;
try
{
String Url="jdbc:mysql://localhost:3306/mobile";
Class.forName("com.mysql.jdbc.Driver");
con=DriverManager.getConnection(Url,"root","root123");
st=con.createStatement();
rs=st.executeQuery("select * from bill order by id desc limit 1");
while(rs.next())
{
newid=rs.getInt(1);
}
pst=con.prepareStatement("select id,dfee,mfee,rfee,sfee,tot from bill where id=?");
pst.setInt(1,newid);
rs=pst.executeQuery();
}catch(Exception e)
{
out.print(e);
}
%>
<table>
<caption>Final Bill</caption>
<%
while(rs.next())
{
%>
<tr><td>Id</td><td><%=rs.getInt(1)%></td></tr>
<tr><td>Doctor fee</td><td><%=rs.getInt(2)%></td></tr>
<tr><td>Medicine fee</td><td><%=rs.getString(3)%></td>
<tr><td>Room Fee</td><td><%=rs.getString(4)%></td>
<tr><td>Special Fee</td><td><%=rs.getString(5)%></td>
<tr><td>Total Fees</td><td><%=rs.getString(6)%></td>
<%
}%>
</table>
<%
%>
</form>
</body>

<script lang="javascript">
function search()
{
window.location.href="search.jsp";
}
function valid()
{
//var uname=document.getElementById("u1");
var uname = document.myform.user.value;
//var pass=document.getElementById("p1");
var pass = document.myform.pass.value;
if(uname=="" || uname==null)
{
alert("Please Enter User Name");
uname.focus();
return false;
}
if(pass=="" || pass==null)
{
alert("Please Enter password");
pass.focus();
return false;
}
return true;
}
</script>
</head>
<body>
<form name="myform" action="Third.jsp" onsubmit="return valid()">
<table border="2" align="center">
<tr><td>username</td><td><input type="text" name="user" id="u1"/></td></tr>
<tr><td>password</td><td><input type="Password" name="pass" id="p1"/></td></tr>
<tr><td><input type="submit" value="submit"/></td><td><input type="button" value="search" onclick="search()"/></td></tr>
</table>
<label for="name">male</label>
</form>
</body>

<script lang="javascript">
function search()
{
window.location.href="search.jsp";
}
function valid()
{
//var uname=document.getElementById("u1");
var uname = document.myform.user.value;
//var pass=document.getElementById("p1");
var pass = document.myform.pass.value;
if(uname=="" || uname==null)
{
alert("Please Enter User Name");
uname.focus();
return false;
}
if(pass=="" || pass==null)
{
alert("Please Enter password");
pass.focus();
return false;
}
return true;
}
</script>
</head>
<body>
<form name="myform" action="Third.jsp" onsubmit="return valid()">
<table border="2" align="center">
<tr><td>username</td><td><input type="text" name="user" id="u1"/></td></tr>
<tr><td>password</td><td><input type="Password" name="pass" id="p1"/></td></tr>
<tr><td><input type="submit" value="submit"/></td><td><input type="button" value="search" onclick="search()"/></td></tr>
</table>
<label for="name">male</label>
</form>
</body>

</head>
<body>
<form name="myform" action="Third.jsp" onsubmit="return valid()">
<table border="2" align="center">
<tr><td>username</td><td><input type="text" name="user" id="u1"/></td></tr>
<tr><td>password</td><td><input type="Password" name="pass" id="p1"/></td></tr>
<tr><td><input type="submit" value="submit"/></td><td><input type="button" value="search" onclick="search()"/></td></tr>
</table>
<label for="name">male</label>
</form>
</body>

<script lang="javascript">
function search()
{
window.location.href="search.jsp";
}
function valid()
{
//var uname=document.getElementById("u1");
var uname = document.myform.user.value;
//var pass=document.getElementById("p1");
var pass = document.myform.pass.value;
if(uname=="" || uname==null)
{
alert("Please Enter User Name");
uname.focus();
return false;
}
if(pass=="" || pass==null)
{
alert("Please Enter password");
pass.focus();
return false;
}
return true;
}
</script>
</head>
<body>
<form name="myform" action="Third.jsp" onsubmit="return valid()">
<table border="2" align="center">
<tr><td>username</td><td><input type="text" name="user" id="u1"/></td></tr>
<tr><td>password</td><td><input type="Password" name="pass" id="p1"/></td></tr>
<tr><td><input type="submit" value="submit"/></td><td><input type="button" value="search" onclick="search()"/></td></tr>
</table>
<label for="name">male</label>
</form>
</body>

<script lang="javascript">
function search()
{
window.location.href="search.jsp";
}
function valid()
{
//var uname=document.getElementById("u1");
var uname = document.myform.user.value;
//var pass=document.getElementById("p1");
var pass = document.myform.pass.value;
if(uname=="" || uname==null)
{
alert("Please Enter User Name");
uname.focus();
return false;
}
if(pass=="" || pass==null)
{
alert("Please Enter password");
pass.focus();
return false;
}
return true;
}
</script>
</head>
<body>
<form name="myform" action="Third.jsp" onsubmit="return valid()">
<table border="2" align="center">
<tr><td>username</td><td><input type="text" name="user" id="u1"/></td></tr>
<tr><td>password</td><td><input type="Password" name="pass" id="p1"/></td></tr>
<tr><td><input type="submit" value="submit"/></td><td><input type="button" value="search" onclick="search()"/></td></tr>
</table>
<label for="name">male</label>
</form>
</body>

<body>
<form action="search.jsp">
Search by Idc
Id<input type="text" name="id"/>
Search by Id
Mobile<input type="text" name="mobile"/>
<input type="submit" value="Go" />
<%
Connection con;
Statement st;
ResultSet rs;
String id,mobile,qr;
int temp=0;
id=request.getParameter("id");
mobile=request.getParameter("mobile");
if(( id !=null && id!="") && (mobile != null && mobile!=""))
{
try
{
String Url="jdbc:mysql://localhost:3306/mobile";
Class.forName("com.mysql.jdbc.Driver");
con=DriverManager.getConnection(Url,"root","root123");
st=con.createStatement();
qr="select name from record where id='"+id+"'";
rs=st.executeQuery(qr);
%>
<table border="2" align="center">
<tr>
<th>Name</th>
</tr>
<%
while(rs.next())
{
%>
<tr >
<td><%=rs.getString(1)%></td>
</tr>
<%
}
%>
</table>
<%
}catch(Exception e)
{
out.println(e);
}
}
%>
</form>
</body>
</html>