Current File : //home/obabain/ms_obaba_in/SalesEnquiry.jsp |
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@ include file="Connection.jsp" %>
<%
Statement st=con.createStatement();
%>
<!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>Sales Enquiry</title>
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
</head>
<body>
<form method="post"name= "so">
<%@include file="master.jsp" %>
<div class="content">
<div class="row">
<div class="col-md-9" style="background-color:white;">
<div class="panel panel-success">
<div class="panel-heading main-color-bg">
<h3 class="panel-title">Sales Enquiry</h3>
</div>
<div class="panel-body">
<div class="col-md-6">
<div class="form-group">
Quote #.
<input type="text" readonly="true" class="form-control" name="Quoteno">
</div>
<div class="form-group">
Date
<input type="date" class="form-control" name="date">
</div>
<div class="form-group">
Expires
<input type="date" class="form-control" name="expdate">
</div>
<div class="form-group">
Status
<input type="text" class="form-control" name="status">
</div>
<div class="form-group">
Quote PDF Password(optional)
<input type="text" class="form-control" name="password">
</div>
</div>
</div>
<div class="panel-body">
<table id="myTable" class="table table-bordered">
<tr>
<th>Item</th>
<th>Item Description</th>
<th>Sku</th>
<th>Unit</th>
<th>Qty</th>
<th>Price</th>
<th>Tax rate</th>
<th>Subtotal</th>
<th></th>
</tr>
<tbody>
<tr>
<td>
<input type="hidden" name="itemid">
<input type="text" name="item" class="txtstyle">
</td>
<td>
<input type="text" name="desc">
</td>
<td><input type="text" name="sku" class="txtstyle">
</td>
<td>
<select>
<option>KG</option>
</select>
</td>
<td>
<input type="text" name="qty" class="txtstyle">
</td>
<td>
<input type="text" name="price" class="txtstyle">
</td>
<td>
<select> <option></option></select>
</td>
<td>
<input type="text" name="txttotal" class="txtstyle">
</td>
<td>
<a href="#" id="r" onclick="deleteRow(this)">
<i class="glyphicon glyphicon-trash"></i>
</a>
</td>
</tr>
<!--
<tr>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
Subtotal
</td>
<td>
Tax
</td>
<td>Total</td>
</tr> -->
</tbody>
</table>
</div>
<div class="panel-body">
<div class="col-md-7">
<a class="btn btn-default" href="javascript: addRow()"><li class="glyphicon glyphicon-plus"></li>Add new record</a>
<a class="btn btn-default" onClick="openwin(document.so.itemid,document.so.item,document.so.desc,document.so.sku,document.so.qty,document.so.price)"><li class="glyphicon glyphicon-shopping-cart"></li>Add Product</a>
</div>
<div>
<div class="col-md-5">
<table class="table table-bordered">
<tr>
<td align="right">Subtotal</td>
<td></td>
</tr>
<tr>
<td align="right">Discount</td>
<td align="right">
<input type="text" class="txtstylesmall" name="discper">
<input type="text" class="txtstylesmall" name="discamt"></td>
</tr>
<tr>
<td align="right">Packing/Forwarding Charges</td>
<td align="right"><input type="text" class="txtstylesmall"></td>
</tr>
<tr>
<td align="right">Total</td>
<td align="right"></td>
</tr>
</table>
</div>
</div>
</div>
<div class="panel-body">
<div class="col-md-6">
<div class="panel panel-success">
<div class="panel-heading main-color-bg">
<h3 class="panel-title">Shipping address</h3>
</div>
<div class="panel-body">
<div class="form-group">
<textarea rows="3" class="form-control"></textarea>
</div>
</div>
</div>
</div>
<div class="col-md-6">
<div class="panel panel-success">
<div class="panel-heading main-color-bg">
<h3 class="panel-title">Attachments</h3>
</div>
<div class="panel-body">
<div class="form-group">
<a class="btn btn-default"><li class="glyphicon glyphicon-plus"></li>Add Files</a>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<%
try{
Class.forName("com.mysql.jdbc.Driver");
// Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/erpdemo","root","");
// Statement st=con.createStatement();
String qtno=request.getParameter("quotno");
String pdate=request.getParameter("Quotedate");
String expdate=request.getParameter("expdate");
String status=request.getParameter("status");
String pdfpass=request.getParameter("PDFpassword");
String damt=request.getParameter("discamt");
String prodid=request.getParameter("itemid");
String iname=request.getParameter("item");
String descr=request.getParameter("desc");
String sku=request.getParameter("sku");
String iqty=request.getParameter("qty");
String price=request.getParameter("price");
String tax=request.getParameter("tax");
String chrg=request.getParameter("forwchrg");
Statement ss=con.createStatement();
ResultSet rr=ss.executeQuery("SELECT * FROM erpdemo.ip_tax_rates where tax_rate_id="+tax+"");
while(rr.next())
{
String m="";
Double ma=0.0;
m=rr.getString("tax_rate_percent");
String txname=rr.getString("tax_rate_name");
if(txname=="CGST")
ma=Double.parseDouble(m);
else
ma=Double.parseDouble(m)*2;
Double subtot=0.0;
Double tr=0.0;
tr=ma*2;
Double tp=0.0;
tp=Double.parseDouble(price)*Double.parseDouble(iqty)*ma/100;
subtot=(Double.parseDouble(price)*Double.parseDouble(iqty))+tp;
Double tot=0.0;
tot=subtot+(Double.parseDouble(damt))+(Double.parseDouble(chrg));
int i=st.executeUpdate("insert into ip_senquiry values(0,NOW(),"+expdate+","+status+",'aaa')");
Statement st2=con.createStatement();
int j=st2.executeUpdate("insert into ip_senquiry_items values(0,(SELECT MAX(porder_id) from ip_porders),0,"+prodid+",NOW(),'"+sku+"','"+iname+"','"+descr+"',"+iqty+","+price+","+damt+",1,'KG',1,"+subtot+")");
response.sendRedirect("ViewPorder.jsp");
}
}
catch(Exception el){}
%>
<div class="col-md-2"></div>
<div class="col-md-2">
<div class="panel-body">
<input type="submit" value="Save" class="btn btn-success">
<a class="btn btn-danger">Cancel</a></div>
</div>
</div>
</div>
<%@include file="footer.jsp" %>
</form>
<script type="text/javascript">
function openwin(targetField,targetField2,targetField3,targetField4,targetField5,targetField6){
var w1=window.open('SalesSelect.jsp','_blank','top=80,left=70,width=1400,height=650,scrollbars=1');
w1.targetField=targetField;
w1.targetField2=targetField2;
w1.targetField3=targetField3;
w1.targetField4=targetField4;
w1.targetField5=targetField5;
w1.targetField6=targetField6;
w1.focus();
};
</script>
<script>
function setSearchRslt(targetField,targetField2,targetField3,targetField4,targetField5,targetField6,returnvalue,returnvalue2,returnvalue3,returnvalue4,returnvalue5,returnvalue6)
{
var table = document.getElementById("myTable");
var lastRow = table.rows.length;
var row = table.insertRow(lastRow);
var cell1 = row.insertCell(0);
var cell2 = row.insertCell(1);
var cell3 = row.insertCell(2);
var cell4 = row.insertCell(3);
var cell5 = row.insertCell(4);
var cell6 = row.insertCell(5);
targetField.value=returnvalue;
targetField2.value=returnvalue2;
targetField3.value=returnvalue3;
targetField4.value=returnvalue4;
targetField5.value=returnvalue5;
targetField6.value=returnvalue6;
cell6.innerHTML = "<a href='#' onclick='deleteRow(this)'><i class='glyphicon glyphicon-trash'></i> </a>";
if(lastRow==2)
document.getElementById("myTable").deleteRow(2);
}
</script>
<script langauge="JavaScript">
function addRow()
{
var arrTables = document.getElementById('myTable1');
var oRows = arrTables.rows;
var numRows = oRows.length;
var newRow = document.getElementById('myTable1').insertRow( numRows );
var cell1 = newRow.insertCell(0);
var cell2 = newRow.insertCell(1);
var cell3 = newRow.insertCell(2);
var cell4 = newRow.insertCell(3);
var cell5 = newRow.insertCell(4);
cell1.innerHTML = "<input type='hidden' name='itemid'><input type='text' name='item' class='txtstyle'>"
cell2.innerHTML = "<input type='text' name='desc'>"
cell3.innerHTML = "<input type='text' name='sku' class='txtstyle'>"
cell4.innerHTML ="<select> <option>KG</option></select>"
cell5.innerHTML = "<input type='text' name='qty' class='txtstyle'>"
cell6.innerHTML ="<input type='text' name='price' class='txtstyle'>"
cell7.innerHTML = "<select> <option></option></select>"
cell9.innerHTML = "<a href='#' onclick='deleteRow(this)'><i class='glyphicon glyphicon-trash'></i> </a>"
cell8.innerHTML = "<input type='text' name='txttotal' class='txtstyle'>";
var t1=document.createElement("input");
};
</script>
<script langauge="JavaScript">
function deleteRow(btn) {
var row = btn.parentNode.parentNode;
row.parentNode.removeChild(row);
}
</script>
<script>
function Add(){ $("#myTable tbody").append( "<tr>"+ "<td><input type='text'/></td>"+ "<td><input type='text'/></td>"+ "<td><input type='text'/></td>"+ "<td><img src='images/disk.png' class='btnSave'><img src='images/delete.png' class='btnDelete'/></td>"+ "</tr>"); };
</script>
<script>
function total(){
var p=document.getElementById("price");
var q=document.getElementById("qty");
var t=document.getElementById("tax");
var ta=(p*q)*t/100;
var sub=(p*q)+ta;
alert(sub);
}
</script>
</body>
</html>