Current File : /home/obabain/anms_obaba_in/purchaseinvoicedatwisereport22.jsp
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
    <%@ include file="Connection.jsp" %>
     <% String from=request.getParameter("from");
     String to=request.getParameter("to");
     
     String pid=request.getParameter("pid");
     Statement st=con.createStatement();
     %>
    <%!
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 stt=con.createStatement();
    //ResultSet rsPagination = null;
    ResultSet rsRowCnt = null;
    
    int iShowRows=25;  // 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>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>


<style>
.dropbtn {
  background-color: #009191;
  color: white;
  padding: 5px;
  font-size: 13px;
  border: none;
}

.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-content {
  display: none;
  position: absolute;
  background-color: #f1f1f1;
  min-width: 120px;
  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: #ddd;}

.dropdown:hover .dropdown-content {display: block;}

.dropdown:hover .dropbtn {background-color: #009191;}

</style>

</head>
<body>
<%@include file="master.jsp" %>
<form>


<div class="content">
<div class="row">
<div class="col-md-9"  style="background-color:#eae9e9;width:80%;">
<div class="panel panel-default" >
       <div class="panel-heading main-color-bg">
        <h3 class="panel-title">Purchase Invoice</h3>
              </div>
              
             </div>
             
             <div class="col-md-4" >
                          <input class="form-control" type="text" placeholder="Search Invoice..." name="filter" >
                      </div>

<div class="headerbar-item pull-right" style="margin-top:10px;"><a style="background:#009191" class="btn btn-info"  onclick="goBack()">Back</a>
<a class="btn btn-info" style="background:#009191" href="PurchaseInvoiceMainn.jsp">New</a>

</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=stt.executeQuery("select count(*)as cnt from ip_puchase_invoice2");
    if(rsRowCnt.next())
    {
       iTotalRows=rsRowCnt.getInt("cnt");
    }
 rs=stt.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_invoice2 tb where invoice_date_created 	 between '"+from+"' and '"+to+"'");
}
else
{
	rsRowCnt=stt.executeQuery("select count(*)as cnt from ip_puchase_invoice2 where supplier_id in(select supplier_id from ip_suppliers where supplier_name like '%"+filt+"%')");
	if(rsRowCnt.next())
    {
       iTotalRows=rsRowCnt.getInt("cnt");
    }
	rs=stt.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_invoice2 tb where supplier_id in(select supplier_id from ip_suppliers where supplier_name like '"+filt+"%')  where invoice_date_created 	 between '"+from+"' and '"+to+"'");
	
}
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 style="text-align: right;"><%=rs.getString("total") %></td>


<td>
<div class="dropdown">
  <button class="dropbtn">Options</button>
  <div class="dropdown-content">
   <a href="pipdff.jsp?Id=<%=rs.getString("pinvoice_id")%>&type=Original copy for customer"><span class="fontstyle">Download PDF(Original)</span></a>
<a href="pipdff.jsp?Id=<%=rs.getString("pinvoice_id")%>&type=Duplicate copy for transporter"><span class="fontstyle">Download PDF(Duplicate)</span></a>
<a href="pipdff.jsp?Id=<%=rs.getString("pinvoice_id")%>&type=Triplicate copy for supplier"><span class="fontstyle">Download PDF(Triplicate)</span></a>
<a href="pipdff.jsp?Id=<%=rs.getString("pinvoice_id")%>&type=Extra copy"><span class="fontstyle">Download PDF(Extra)</span></a>
<a href="InwardFromPurchaseInvoicee.jsp?pino=<%=rs.getString("pinvoice_id")%>">Add Stock</a>
<a href="deletePurchaseInvoicee.jsp?Id=<%=rs.getString("pinvoice_id")%>" onclick = "if (! confirm('Continue?')) { return false; }">
<span class="fontstyle" >Delete</span>
  </div>
</div>

</td>




</tr>
<%} %>

</tbody>
<tr>           
       
           <td></td>
              <td></td>
                 <td></td>
                                      
                                      
                      
                             
              <td style="text-align: center;">  <label>Total&nbsp;Net&nbsp;Amount</label></td>
             
              <% 
              ResultSet re=null;
              if(from==null){
                re=st.executeQuery ("select IFNULL(sum(total),0)sqty from  ip_puchase_invoice2 tb where invoice_date_created   between '"+from+"' and '"+to+"'  ");
 }else{
                  
                   re=st.executeQuery("select IFNULL(sum(total),0)sqty from  ip_puchase_invoice2 tb where invoice_date_created   between '"+from+"' and '"+to+"'   ");
      }    
            while(re.next())
             {
            %> 
           <td style="text-align: center;">  <b> <input style="text-align: center;width:150px;margin-left:0px; " class="form-control" type="text" value="<%=re.getString("sqty")%>" readonly ></b>
               </td>
              <%} %>
              
                   
                  </tr>
</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>