Current File : //home/obabain/ms_obaba_in/LedgerExchangeRates.jsp |
<%@include file="master.jsp" %>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@include file="Connection.jsp" %>
<%
ResultSet resultSet = null;
%>
<%@page import="java.sql.*,java.util.*"%>
<%@page import="java.sql.ResultSet"%>
<style type="text/css">
.highlight-error {
border-color: red;
}
.btn{
background: #ccc;
}
/** on active **/
.btn:focus{
background: red;
}
.active, .btn:hover {
background-color: #666;
color: white;
}
</style>
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<script src="http://code.jquery.com/jquery-2.1.1.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="js/jquery-2.1.0.min.js"></script>
<script src="js/tableEdit-0.1.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<body>
<script type="text/javascript">
function getqc(targetField,targetField1)
{
var w3=window.open('Productselect.jsp','_blank','top=80,left=70,width=1400,height=650,scrollbars=1')
w3.targetField=targetField;
w3.targetField1=targetField1;
w3.focus();
}
</script>
<script>
function setSearchRslt2(targetField,targetField1,returnvalue,returnvalue1)
{
targetField.value = returnvalue;
targetField1.value = returnvalue1;
window.focus();
}
</script>
<script type="text/javascript">
function getqc1(targetField,targetField1)
{
var w3=window.open('Productselect1.jsp','_blank','top=80,left=70,width=1400,height=650,scrollbars=1')
w3.targetField=targetField;
w3.targetField1=targetField1;
w3.focus();
}
</script>
<script type="text/javascript">
function setSearchRslt3(targetField,targetField1,returnvalue,returnvalue1)
{
targetField.value = returnvalue;
targetField1.value = returnvalue1;
window.focus();
}
</script>
<script type="text/javascript">
function editRecord(id){
var f=document.form;
f.method="post";
f.action='editbom.jsp?id='+id;
f.submit();
}
</script>
<script type="text/javascript">
$(document).ready(function () {
$("#showdiv").click(function () {
$("#hiddendiv").show();
});
});
</script>
<script type="text/javascript">
function div_show() {
document.getElementById('abc').style.display = "block";
}
function div_hide(){
document.getElementById('abc').style.display = "none";
}
</script>
<script type="text/javascript">
function Currency(){
y = document.getElementById("converter").value;
return y;
}
function Calculate(){
y = Currency();
x = document.getElementById("value1").value;
if(x == ""){
document.getElementById("value2").value = "";
}else{
switch(y){
case "Dollar":
document.getElementById("value2").value = x * 68.09;
break;
case "Rupees":
document.getElementById("value2").value = x * 1.00;
break;
case "Euro":
document.getElementById("value2").value = x * 63.84;
break;
case "Yen":
document.getElementById("value2").value = x * 0.49;
break;
case "Yuan":
document.getElementById("value2").value = x * 8.20;
break;
}
}
}
</script>
<div class="row">
<form action="" method="post" id="contact" name="form1">
<section id="main">
<div class="container">
<div class="row" style="width:110%">
<div class="col-md-10" >
<div class="panel panel-default" >
<div class="panel-heading main-color-bg">
<h3 class="panel-title">Account and Ledger "Exchange Rates":</h3>
</div>
<br><br><div class="panel-body" >
<div class="row" >
<!-- <label for="lastname" style="margin:5px;">manufacturingOrder:</label>
<input id="lastname" class=" input-group-lg reg_name" style="width:170px;margin:5px;" type="text"
title="Enter last name"
name="address" placeholder=""/> -->
<label for="lastname" style="margin-left:55px;float:left;">Select a Currency :</label>
<!-- <input id="lastname" class="input-group-lg reg_name" style="width:170px;margin-right:40px;float:left;" type="text"
name="address" placeholder=""/>-->
<!-- <select style="width:170px;margin-right:40px;float:left;height:25px;" ><option></option>
<option></option>
</select> -->
<select name="c_select"onchange="Currency(); Calculate()" class="" id="converter" style="width:17%;height:25px;">
<option value="Dollar" >Dollar</option>
<option value="Rupees">Rupees</option>
<option value="Euro">Euro</option>
<option value="Yen">Yen</option>
<option value="Yuan">Yuan</option>
</select>
</div>
<br>
<b></b>
<div class="row" >
<label for="lastname" style="margin-left:47px;">Date to Use From :</label>
<input id="lastname" style="width:170px;margin:5px;" type="date"
name="c_date" placeholder=""/>
</div>
<br>
<b></b>
<div class="row" >
<!-- <label for="lastname" style="margin-left:62px;float:left;">Exchange Rate :</label>
<input type="number" oninput="Calculate()" placeholder="Enter Amount" class="" style="width:160px;margin-right:680px;float:right;" id="value1"/>
<input type="number" class="" id="value2" disabled="disabled"style="width:170px;margin-right:540px;float:right;"placeholder="Result"/> -->
<label for="" style="margin-left:72px;float:left;">Exchange Rate :</label>
<input id="value1" class="" style="width:170px;float:left;" type="number" oninput="Calculate()" placeholder="Enter Amount"/>
<input name="c_exchange" style="width:170px;margin-right:480px;float:right;" type="text" id="value2"
placeholder="Result"/>
<div class="form-group col-xs-2">
<p> <label for="lastname" style="margin:5px;"> </label></p>
</div>
</div>
</div>
<div class="modal-footer" id="contact_submit">
<input type="button" value="Back" style="background:#204b58;margin-right:720px" class="btn btn-info" />
<a class="btn btn-default" href="">Reset</a>
<!-- <button type="submit" style="background:#204b58" class="btn btn-info" >Save Changes</button>-->
<input type="submit"style="background:#204b58;" class="btn btn-info" value="submit">
<strong></strong>
</div>
<%
String c_select=request.getParameter("c_select");
String c_date=request.getParameter("c_date");
String c_exchange=request.getParameter("c_exchange");
try
{
Statement st=con.createStatement();
int i=st.executeUpdate("insert into currency(c_select,c_date,c_exchange)values('"+c_select+"','"+c_date+"','"+c_exchange+"')");
out.println("");
}
catch(Exception e)
{
System.out.print(e);
e.printStackTrace();
}
%>
<b>View of Exchange Rate</b>
<br>
<div class="panel-body">
<table id="makeEditable" class="table table-bordered">
<tr>
<th>Date to Use From</th>
<th>Exchange Rate</th>
<th>Edit</th>
<th>Delete</th>
</tr>
<%
try{
Statement st=con.createStatement();
String sql ="select * from currency";
resultSet = st.executeQuery(sql);
while(resultSet.next()){
%>
<tbody>
<tr>
<td>
<%=resultSet.getString("c_date") %>
</td>
<td>
<%=resultSet.getString("c_exchange") %>
</td>
<td>
<%-- <input type="button" name="edit" value="Edit" onclick="editRecord(<%=r1.getString(1)%>);" ><i class="material-icons"></i>
--%>
<%-- <td><input type="button" name="edit" value="Edit" style="background-color:#49743D;font-weight:bold;color:#ffffff;" onclick="editRecord(<%=r1.getString("d_id")%>);" ></td>
--%>
<a href="#"><span class="glyphicon glyphicon-pencil"></span></a>
</td>
<td>
<!-- - <a href='#' onclick='deleteRow(this)'><i class='glyphicon glyphicon-trash'></i> </a>-->
<a href="LedgerExchangeRates.jsp?c_id=<%=resultSet.getString("c_id") %>"><button type="button" class="delete"><i class='glyphicon glyphicon-trash'></i></button></a>
</td>
</tr>
<%
}
} catch (Exception e) {
e.printStackTrace();
}
%>
</tbody>
</table>
</div>
<%
String id=request.getParameter("c_id");
try
{
Class.forName("com.mysql.jdbc.Driver");
Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/currency", "root", "root");
Statement st=conn.createStatement();
int i=st.executeUpdate("DELETE FROM currency WHERE c_id="+id);
out.println("");
}
catch(Exception e)
{
System.out.print(e);
e.printStackTrace();
}
%>
</div>
</div>
</div>
</section>
<%-- <% }else{
response.sendRedirect("login.jsp");
} %> --%>
</form>
</body>
</html>