Current File : /home/obabain/ms_obaba_in/ViewInvoices22.jsp |
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@ include file="Connection.jsp" %>
<%!
public int nullIntconv(String str)
{
int conv=0;
if(str==null)
{
str="0";
}
else if((str.trim()).equals("null"))
{
str="0";
}
else if(str.equals(""))
{
str="0";
}
try{
conv=Integer.parseInt(str);
}
catch(Exception e)
{
}
return conv;
}
%>
<%
Statement st=con.createStatement();
//ResultSet rsPagination = null;
ResultSet rsRowCnt = null;
String id1=null;
rsRowCnt=st.executeQuery("select * from ip_porders22");
if(rsRowCnt.next())
{
id1=rsRowCnt.getString("supplier_id");
}
int iShowRows=10; // Number of records show on per page
int iTotalSearchRecords=10; // Number of pages index shown
int iTotalRows=nullIntconv(request.getParameter("iTotalRows"));
int iTotalPages=nullIntconv(request.getParameter("iTotalPages"));
int iPageNo=nullIntconv(request.getParameter("iPageNo"));
int cPageNo=nullIntconv(request.getParameter("cPageNo"));
String filt=request.getParameter("filter");
if(iPageNo==0)
{
iPageNo=0;
}
else{
iPageNo=Math.abs((iPageNo-1)*iShowRows);
}
int iStartResultNo=0;
int iEndResultNo=0;
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<style>
.dropbtn {
background-color: #4CAF50;
color: white;
padding: 12px;
font-size: 16px;
border: none;
cursor: pointer;
height:35px;
}
.dropdown {
position: relative;
display: inline-block;
}
.dropdown-content {
display: none;
position: absolute;
background-color: #f9f9f9;
min-width: 160px;
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
z-index: 1;
}
.dropdown-content a {
color: black;
padding: 12px 16px;
text-decoration: none;
display: block;
}
.dropdown-content a:hover {background-color: #f1f1f1}
.dropdown:hover .dropdown-content {
display: block;
}
.dropdown:hover .dropbtn {
background-color: #3e8e41;
}
</style>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<script type="text/javascript">
function printPDF()
{
if (navigator.appName == 'Microsoft Internet Explorer') {
//Wait until PDF is ready to print
if (typeof document.getElementById("pdfDocument").print == 'undefined') {
setTimeout(function(){printPDF("pdfDocument");}, 1000);
} else {
var x = document.getElementById("pdfDocument");
x.print();
}
} else{
PDFIframeLoad(); // for chrome
}
}
</script>
<title>Sales Invoice</title>
</head>
<body>
<%@include file="master.jsp" %>
<form>
<div class="col-md-9" style="background-color:white;">
<div class="panel panel-default" >
<div class="panel-heading main-color-bg">
<h3 class="panel-title">Sales Invoice 2021-22</h3>
<div class="headerbar-item pull-right" style="margin-top:-22px;">
<a class="btn btn-danger" style="margin-left:650px;" href="SalesInvoiceMain.jsp">Create New</a>
<a class="btn btn-info" style="background:#009191" href="Datewisepi.jsp">Datewise View</a>
<!-- <a style="background:" class="btn btn-danger" href="ViewPorder.jsp" > View All </a> -->
<a style="background:#204b58;" class="btn btn-info" onclick="goBack()">Back</a>
</div>
<br>
<br>
<br>
<div class="dropdown" style="margin-top:-32px;">
<button class="dropbtn" style="margin-left:745px;">View All</button>
<div class="dropdown-content" style="margin-left:775px;">
<a href="ViewInvoices.jsp">2019-20</a>
<a href="ViewInvoices.jsp">2020-21</a>
<a href="sales21.jsp">2021-22</a>
</div>
</div>
</div>
</div>
<div class="col-md-12" >
<input class="form-control" type="text" placeholder="Search Supplier Name Here..." name="filter" id="myInput" onkeyup="myFunction()">
</div>
<div>
<input type="hidden" name="iPageNo" value="<%=iPageNo%>">
<input type="hidden" name="cPageNo" value="<%=cPageNo%>">
<input type="hidden" name="iShowRows" value="<%=iShowRows%>">
<table class="table table-striped" id="datatable-responsive">
<thead>
<tr>
<!-- <th>Status</th> -->
<th>Date</th>
<th>Invoice No</th>
<th>Supplier</th>
<th>Amount</th>
<th>options</th>
</tr>
</thead>
<tbody>
<%-- <%
ResultSet rs=null;
if(filt==null)
{
rsRowCnt=st.executeQuery("select count(*)as cnt from ip_porders");
if(rsRowCnt.next())
{
iTotalRows=rsRowCnt.getInt("cnt");
}
rs=st.executeQuery("select tb.*,(select supplier_name from ip_suppliers where supplier_id=tb.supplier_id)suppl,(select description from ip_status where id=tb.porder_status_id)stat from ip_porders tb");
}
else
{
rsRowCnt=st.executeQuery("select count(*)as cnt from ip_porders where supplier_id in(select supplier_id from ip_suppliers where supplier_name like '%"+filt+"%') and year_id");
if(rsRowCnt.next())
{
iTotalRows=rsRowCnt.getInt("cnt");
}
rs=st.executeQuery("select tb.*,(select supplier_name from ip_suppliers where supplier_id=tb.supplier_id)suppl,(select description from ip_status where id=tb.porder_status_id)stat from ip_porders tb where tb.supplier_id in(select supplier_id from ip_suppliers where supplier_name like '"+filt+"%') order by porder_id asc limit "+iPageNo+","+iShowRows+"");
}
while(rs.next())
{
%> --%>
<%
Statement st1=con.createStatement();
ResultSet rs=st1.executeQuery("select tb.*,(select client_name from ip_clients where client_id=tb.client_id)cust from ip_sales_invoice2 tb where yrid=3");
while(rs.next()){
%>
<tr>
<%-- <td><%=rs.getString("stat") %></td> --%>
<td><%=rs.getString("invoice_date_created") %></td>
<td><a href="ViewSIbyNO1.jsp?Id=<%=rs.getString("sinvoice_id")%>"><%=rs.getString("sales_invoice_no") %></a></td>
<td><%=rs.getString("cust") %></td>
<td><%=rs.getString("total") %></td>
<td>
<div class="options btn-group">
<a class="btn btn-primary dropdown-toggle fontstyle" data-toggle="dropdown">
<li class="glyphicon glyphicon-cog"><span class="fontstyle">Options</span></li>
</a>
<ul class="dropdown-menu">
<%-- <li>
<a href="editPO.jsp?Id=<%=rs.getString("porder_id")%>">
<span class="fontstyle">Edit</span>
</a>
</li> --%>
<li>
<a href="sipdf3.jsp?Id=<%=rs.getString("sinvoice_id")%>&inv=<%=rs.getString("type")%>&type=Original Copy For Customer"><span class="fontstyle" style="color:blue;">Download PDF(Original)</span></a>
<a href="sipdf3.jsp?Id=<%=rs.getString("sinvoice_id")%>&inv=<%=rs.getString("type")%>&type=Duplicate Copy For Transporter"><span class="fontstyle">Download PDF(Duplicate)</span></a>
<a href="sipdf3.jsp?Id=<%=rs.getString("sinvoice_id")%>&inv=<%=rs.getString("type")%>&type=Triplicate Copy For Supplier"><span class="fontstyle">Download PDF(Triplicate)</span></a>
<a href="sipdf3.jsp?Id=<%=rs.getString("sinvoice_id")%>&inv=<%=rs.getString("type")%>&type=Extra copy"><span class="fontstyle">Download PDF(Extra)</span></a>
<%-- <a href="Edit_PO.jsp?Id=<%=rs11.getString("porder_id")%>&tid=<%=rs11.getString("tax_id")%>" > --%><!--
<span class="fontstyle" style="color:green;">Edit</span>
</a> -->
<a href="editsi22.jsp?Id=<%=rs.getString("sinvoice_id")%>"><span class="fontstyle">Edit</span></a>
<a href="deletesi22.jsp?Id=<%=rs.getString("sinvoice_id")%>" onclick = "if (! confirm('Continue?')) { return false; }">
<span class="fontstyle" style="color:red;">Delete</span>
</a>
</li>
</ul>
</div>
</td>
<%} %>
</tr>
<%
//// calculate next record start record and end record
try{
if(iTotalRows<(iPageNo+iShowRows))
{
iEndResultNo=iTotalRows;
}
else
{
iEndResultNo=(iPageNo+iShowRows);
}
iStartResultNo=(iPageNo+1);
iTotalPages=((int)(Math.ceil((double)iTotalRows/iShowRows)));
}
catch(Exception e)
{
e.printStackTrace();
}
%><tr>
<td colspan="5" align="center">
<div>
<%
//// index of pages
int i=0;
int cPage=0;
if(iTotalRows!=0)
{
cPage=((int)(Math.ceil((double)iEndResultNo/(iTotalSearchRecords*iShowRows))));
int prePageNo=(cPage*iTotalSearchRecords)-((iTotalSearchRecords-1)+iTotalSearchRecords);
if((cPage*iTotalSearchRecords)-(iTotalSearchRecords)>0)
{
%>
<a href="ViewInvoices22.jsp?iPageNo=<%=prePageNo%>&cPageNo=<%=prePageNo%>"> << Previous</a>
<%
}
for(i=((cPage*iTotalSearchRecords)-(iTotalSearchRecords-1));i<=(cPage*iTotalSearchRecords);i++)
{
if(i==((iPageNo/iShowRows)+1))
{
%>
<a href="ViewInvoices22.jsp?iPageNo=<%=i%>" style="cursor:pointer;color: red"><b><%=i%></b></a>
<%
}
else if(i<=iTotalPages)
{
%>
<a href="ViewInvoices22.jsp?iPageNo=<%=i%>"><%=i%></a>
<%
}
}
if(iTotalPages>iTotalSearchRecords && i<iTotalPages)
{
%>
<a href="ViewInvoices22.jsp?iPageNo=<%=i%>&cPageNo=<%=i%>"> >> Next</a>
<%
}
}
%>
<span style="margin-left:50px;"><b>Rows <%=iStartResultNo%> - <%=iEndResultNo%> Total Result <%=iTotalRows%> </b></span>
</tbody>
</table>
</div>
</div>
</div>
</div>
</form>
<script type="text/javascript">
function goBack() {
window.history.back();
};
</script>
<script>
function myFunction() {
var input, filter, table, tr, td, i;
input = document.getElementById("myInput");
filter = input.value.toUpperCase();
table = document.getElementById("datatable-responsive");
tr = table.getElementsByTagName("tr");
for (i = 0; i < tr.length; i++) {
td = tr[i].getElementsByTagName("td")[2];
if (td) {
if (td.innerHTML.toUpperCase().indexOf(filter) > -1) {
tr[i].style.display = "";
} else {
tr[i].style.display = "none";
}
}
}
}
</script>
</body>
</html>