Current File : /home/obabain/khb_obaba_in/ViewInvoicePurchase.jsp
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
    <%@ include file="Connection.jsp" %>
    <%@include file="master.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;
    
    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;
    
    
    %>
 <%
Statement st1=con.createStatement();
    //ResultSet rsPagination = null;
    ResultSet rsRowCnt1 = null;
      

    
    %>
<!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">
<script src='https://code.jquery.com/jquery-3.3.1.js'></script>
<script src='https://cdn.datatables.net/1.10.19/js/jquery.dataTables.min.js'></script>
<script src="https://cdn.datatables.net/1.10.19/js/dataTables.bootstrap4.min.js" charset="utf-8"></script>
<link rel="stylesheet" href="https://cdn.datatables.net/1.10.19/css/dataTables.bootstrap4.min.css">
 
<title>Insert title here</title>
</head>
<body>
<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>
<form>


<div class="content">
<div class="row">
<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">Purchase Invoice</h3>
             
             
     <div class="headerbar-item pull-right" style="margin-top:-22px;"><a style="background:#204b58" class="btn btn-info"  onclick="goBack()">Back</a>
<a class="btn btn-info" style="background:#204b58" href="PurchaseInvoiceMain.jsp">New</a>
</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 table-bordered" id="datatable-responsive">
<thead>
<tr>
<!-- <th>Status</th> -->
<th>Date</th>
<th>Invoice No</th>
<th>Supplier</th>
<th>Amount</th>

<th>options</th>
<!-- <th>Product Specification</th>
 --></tr>
</thead>
<tbody>
<%
ResultSet rs=null;


 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.purchaseinv_status)stat  from ip_puchase_invoice tb order by invoice_date_created asc");


while(rs.next())
{
%>
<tr>
<%-- <td><%=rs.getString("stat") %></td> --%>
<td><%=rs.getString("invoice_date_created") %></td>
<td><a href="ViewInvoicePurchaseById.jsp?Id=<%=rs.getString("pinvoice_id") %>"><%=rs.getString("purchase_invoice_no") %></a></td>
<td><%=rs.getString("suppl") %></td>
<td><%=rs.getString("total") %></td>
<td>
<div class="options btn-group">
<a class="btn btn-default  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="#">
<span class="fontstyle">Edit</span>
</a>
</li> -->
<li>
<a href="pipdf.jsp?Id=<%=rs.getString("pinvoice_id")%>&type=Original copy for customer"><span class="fontstyle">Download PDF(Original)</span></a>
<a href="pipdf.jsp?Id=<%=rs.getString("pinvoice_id")%>&type=Duplicate copy for transporter"><span class="fontstyle">Download PDF(Duplicate)</span></a>
<a href="pipdf.jsp?Id=<%=rs.getString("pinvoice_id")%>&type=Triplicate copy for supplier"><span class="fontstyle">Download PDF(Triplicate)</span></a>
<a href="pipdf.jsp?Id=<%=rs.getString("pinvoice_id")%>&type=Extra copy"><span class="fontstyle">Download PDF(Extra)</span></a>

<!-- 
<li>
<a href="popdfduplicate.jsp?Id=<%=rs.getString("pinvoice_id")%>"><span class="fontstyle">Download PDF(Duplicate)</span></a>
-->
<a href="deletePurchaseInvoice.jsp?Id=<%=rs.getString("pinvoice_id")%>" onclick = "if (! confirm('Continue?')) { return false; }">
<span class="fontstyle" >Delete</span>
</a>
</li>
</ul>
</div>
</td>
<%-- <td><a href="ProductSpecification.jsp?id=<%=rs.getString("pono") %>&id2=<%= rs.getString("suppl")%>"><input class="btn btn-default" value="ProductSpecification" ></a></td>
 --%>
</tr>
<%} %>

</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")[3];
    if (td) {
      if (td.innerHTML.toUpperCase().indexOf(filter) > -1) {
        tr[i].style.display = "";
      } else {
        tr[i].style.display = "none";
      }
    }       
  }
}
</script>	

</body>
</html>