Current File : /home/obabain/khb_obaba_in/SupplierAdditem.jsp |
<%@include file="master.jsp" %>
<%@ include file="Connection.jsp" %>
<% String id=request.getParameter("Id");
session.setAttribute("sd_id",id);
//System.out.println(id);
%>
<%!
String clname=null; %>
<%Statement st=con.createStatement();
ResultSet rs= null;
id=request.getParameter("Id");
rs=st.executeQuery("select * from ip_suppliers where supplier_id="+id+"");
while(rs.next())
{
clname=rs.getString("supplier_name");
}
%>
<style type="text/css">
.highlight-error {
border-color: red;
}
.template { display: none; }
</style>
<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>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/js/bootstrap.min.js"></script>
<body >
<form action="SupplierItemDA.jsp" method="post">
<div class="row">
<div class="row" style="width:108%;">
<div class="col-md-9" style="background-color:white;">
<div class="panel panel-default" >
<div class="panel-heading main-color-bg" style="height:40px;">
<!-- <a href="Dashboard.jsp" style="color:white;"><b>Home /</b></a>
<a href="" style="color:white;"><b>Master /</b></a> -->
<a href="#" style="color:white;"><b> Supplier Product Edit</b></a>
<a class="btn btn-danger" style="margin-left:995px;margin-top:-25px;" href="ViewSupplier.jsp">View</a>
<div style="margin-top:-25px;margin-left:970px;">
<!-- <a style="background:" class="btn btn-danger" href="material_type.jsp">New</a> -->
</div></div></div>
<!-- <div align="right" >
<a style="background:#204b58;" class="btn btn-info" href="ViewCustomer.jsp">View</a>
</div> -->
<center> <h3> Supplier Name:<%=clname%></h3></center>
<input type="hidden" name="supplier" value="<%=clname%>">
<input type="hidden" name="supplierid" value="<%=id%>">
<div style="overflow-x:auto;width:100%;">
<table id="someTable" class="table table-bordered table-hover additionalMargin alignment">
<thead>
<tr class="success">
<th>Edit</th>
<th>Delete</th>
<th class="code">SL.No</th>
<!-- <th class="Cname">Country</th> -->
<th class="Product Name">Product Name</th>
<th class="Product Rate">Product Rate</th>
<th class="Product QTY">Product QTY</th>
<th class="Mode of Transport">HSN</th>
</tr>
</thead>
<tbody>
<%
try{
int zi=1;
String query="";
query="select tb.*,(select product_name from ip_products where product_id=tb.product)product1 from ip_supplier_product tb where supplier_id='"+id+"'";
ResultSet rs1=st.executeQuery(query);
while(rs1.next())
{
%>
<tr>
<td>
<a href="SupplierEdititem.jsp?Id=<%=rs1.getString("s_id") %>&proid=<%=rs1.getString("product")%>&supplierid=<%=id%>&productrate=<%=rs1.getString("s_product_rate")%>&productqty=<%=rs1.getString("s_pro_qty")%>&modeoftransport=<%=rs1.getString("mode_of_transport")%>"><span class="glyphicon glyphicon-pencil"></span></a>
</td>
<td>
<a href="SupplierDeleteitem.jsp?Id=<%=rs1.getString("s_id")%>" onclick = "if (! confirm('Are you Sure To Delete?')) { return false; }"><span class="glyphicon glyphicon-remove"></span></a>
</td>
<th><%=zi%></th>
<td> <%=rs1.getString("product1")%> </td>
<td> <%=rs1.getString("s_product_rate")%> </td>
<td> <%=rs1.getString("s_pro_qty")%> </td>
<td> <%=rs1.getString("mode_of_transport")%> </td>
<%
zi++; }
}
catch(Exception el){
System.out.println(el);
}
%>
</tr>
</tbody>
<!-- </thead> -->
</table>
</div>
<div class="panel-body" >
<hr>
<h3>Add Products:</h3>
<br>
<table class="table table-bordered table-hover additionalMargin alignment" id="table1">
<thead><tr class="info">
<th style="text-align:center ">Product Name:</th><th>Purchase Price</th><th>Products Quantity</th><th>Unit</th><th>HSN</th><th>Delete</th></tr></thead>
<tr class='template'>
<td style="width:32%;">
<select class=" form-control" name="product[]" id="ddlsname" style="width:100%;">
<option value="0">select</option>
<%
ResultSet rs1=st.executeQuery("select * from ip_products where branch_id="+loginid+" order by product_name");
while(rs1.next())
{
%>
<option value="<%=rs1.getString("product_id")%>"><%=rs1.getString("product_name") %></option>
<%} %>
</select>
</td>
<td>
<input type="text" name="prate[]" class="amt form-control" >
</td>
<td>
<input type="text" name="pqty[]" class="amt form-control" >
</td>
<td>
<select class=" form-control" name="unit[]" style="width:110%;">
<option value="">select</option>
<%
ResultSet rs2=st.executeQuery("select * from ip_units where branch_id="+loginid+"");
while(rs2.next())
{
%>
<option value="<%=rs2.getString("unit_id")%>"><%=rs2.getString("unit_name_plrl") %></option>
<%} %>
</select>
</td>
<td>
<input type="text" name="mtransport[]" class="amt form-control" >
</td>
<td><a href='#' onclick='deleteRow(this)'><i class='glyphicon glyphicon-trash'></a></td>
</tr>
</table>
<a id='add' style="margin-left:200px" class="pull-left btn btn-default">ADD</a><br>
<br>
<div class="modal-footer" id="contact_submit">
<input type="button" value="Back" style="background:#204b58;" class="pull-left btn btn-info" onclick="goBack()"/>
<a class="btn btn-default" href="#">Reset</a>
<button type="submit" style="background:#204b58" class="btn btn-info" >Save Changes</button>
</div>
</div>
</div>
</div>
</div>
</form>
<%@include file="footer.jsp" %>
</body>
<script src="http://cdn.ckeditor.com/4.6.1/standard/ckeditor.js"></script>
<script src="http://cdn.ckeditor.com/4.6.1/standard/ckeditor.js"></script>
<script src="https://code.jquery.com/jquery-1.11.1.min.js"></script>
<script src="https://cdn.jsdelivr.net/jquery.validation/1.16.0/jquery.validate.min.js"></script>
<script src="https://cdn.jsdelivr.net/jquery.validation/1.16.0/additional-methods.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.1/js/select2.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<script>
$(function() {
initThings();
$('#add').on('click', function() { add_row($('#table1')); });
});
function add_row($table) {
var tr_id = $table.find('tr').length - 1;
var $template = $table.find('tr.template');
var $tr = $template.clone().removeClass('template').prop('id', tr_id);
$tr.find(':input').each(function() {
if($(this).hasClass('hasDatepicker')) {
$(this).removeClass('hasDatepicker').removeData('datepicker');
}
var input_id = $(this).prop('id');
input_id = input_id + tr_id;
$(this).prop('id', input_id);
var new_name = $(this).prop('name');
new_name = new_name.replace('[0]', '['+ tr_id +']');
$(this).prop('name', new_name);
$(this).prop('value', '');
});
$table.find('tbody').append($tr);
$('.byto:last').val(1);
$(".dateControl", $tr).datepicker({
dateFormat: "dd-mm-yy"
});
$(".selectType", $tr).select2();
$(".qty", $tr).select2();
$(".selectType:last").val(0).trigger("change");
$(".qty:last").val(0).trigger("change");
}
function initThings() {
add_row($('#table1'));
}
</script>
<script langauge="JavaScript">
function deleteRow(btn) {
var row = btn.parentNode.parentNode;
row.parentNode.removeChild(row);
var sum = 0;
var sum2=0;
$(".amt").each(function(){
sum += +$(this).val();
});
$(".total").val(sum);
$(".amt2").each(function(){
sum2 += +$(this).val();
})
$(".total2").val(sum2);
};
</script>
<script type="text/javascript">
function goBack() {
window.history.back();
};
</script>
</html>