Current File : //home/obabain/khb_obaba_in/waste2.jsp
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
     <%@include file="Connection.jsp" %>
    <%Statement st=con.createStatement();
    ResultSet rs=null;
    String id=request.getParameter("Id");
    if(id.equals("0"))
    {
    	//String type=request.getParameter("type");
    	rs=st.executeQuery("select * from account_ledger");
    	supplname="All";
    }
    else
    {
    rs=st.executeQuery("select * from account_ledger where l_id="+id+"");
    while(rs.next())
    {
    	typ=rs.getString("type");
    	ref_id=rs.getString("ref_id");
    	supplname=rs.getString("ledger_name");
    }
    }
    %>
    <%!
    String ref_id=null;
    String typ=null;
    String supplname=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">
<style>
tbody div{
    overflow:scroll;
    height:350px;
}
.borderless table {
    border-top-style: none;
    border-left-style: none;
    border-right-style: none;
    border-bottom-style: none;
}
.viewtable>thead>tr>th
{
width:10%;
}

</style>
<title>Reports</title>
</head>
<body>
<%@include file="master.jsp" %>
<div class="content">
 <div class="row">
    <div class="col-md-9" >
       <div class="panel panel-default" >
       <div class="panel-heading main-color-bg">
        <h3 class="panel-title">Payables</h3>
    </div>
<div class="panel-body">
<div style="width:80%;" align="center"><span style="color:Green; font-size:large;""><b><u><%=supplname %></u></b></span></div>

<table class="table">

<thead>
<tr>

<th style="width:10%;">Date</th>

<th style="width:10%;">Invoice No.</th>
 <th style="text-align:right; width:10%;">Invoice Amount</th>
<th style="text-align:right;width:10%; padding-right:35px;">Pending Amount</th>
</tr>
</thead>
<tbody>
<tr>
<td colspan="6">
 <div class="scrollit">
 <table class="viewtable table-borderless viewtable-hover">
<%
double debittot=0;
double credittot=0;
String deb=null;
String cred=null;
String itemname=null;
String itemdes=null;
String itemqty=null;
String itemprice=null;
String unit=null;
if(!id.equals("0"))
{
if(typ.equals("2"))
{
	
	rs=st.executeQuery("select tb.*,(select supplier_name from ip_suppliers where supplier_id=tb.supplier_id)suppl,(tb.total-tb.paid_amt) as pending from ip_puchase_invoice tb where supplier_id="+ref_id+" and (tb.total-tb.paid_amt)>0 order by invoice_date_created asc");
}
else if(typ.equals("1"))
{
	rs=st.executeQuery("select tb.created_date as invoice_date_created,tb.journal_no as purchase_invoice_no,(tb.credit-tb.paid_amt)as pending from journalentry tb where particulars="+id+" and type=2 and (tb.credit-tb.paid_amt)>0");
}
}
else
{
	rs=st.executeQuery("select tb.*,(select supplier_name from ip_suppliers where supplier_id=tb.supplier_id)suppl,(tb.total-tb.paid_amt) as pending from ip_puchase_invoice tb where (tb.total-tb.paid_amt)>0 order by invoice_date_created asc");
}
while(rs.next())
{
	debittot=debittot+Double.parseDouble(rs.getString("total"));
	 deb = String.format("%.2f", debittot);
	credittot=credittot+Double.parseDouble(rs.getString("pending"));
	 cred = String.format("%.2f", credittot);
%>
<tr>

<td><%=rs.getString("invoice_date_created") %></td>
<td><%=rs.getString("purchase_invoice_no") %></td>
<td align="right"><%=rs.getString("total") %></td> 
<td align="right" style="padding-right: 10px;"><%=rs.getString("pending") %></td>
</tr>
<%} %>


</table>
</div>
</td>
</tr>
<tr>
<td colspan="3" align="right" style="padding-right: 25px;"><b><%=deb %></b></td>
<td align="right" style="padding-right: 35px;"><b><%=cred %></b></td>
</tr>
</tbody>

</table >
<hr>
<div class="panel-body">
<table class="table">
<thead>
<tr>
<th>Item Name</th>
<th>Item Description</th>
<th>Item Quantity </th>
<th>Item Price</th>
<th>Unit </th>
</tr>
</thead>
<div class="scrollit">
 <table >
<tbody>
<tr>
 <%
 Statement st1=con.createStatement();
    ResultSet rs1=null;
    
    rs1=st1.executeQuery("select * from  ip_purchase_invoice_item  ");
    while(rs1.next())
    {
    	 %>
    	 <td> <%=rs1.getString("item_name")%></td>
    	<td><%=rs1.getString("item_description")%></td>
    	<td><%=rs1.getString("item_qty")%></td>
    	<td><%=rs1.getString("item_price")%></td>
    	<td><%=rs1.getString("item_UOM")%></td>
    	
    <% } %>
   
    

</tr>
</tbody>
</table>
</div>
</table>
</div>


 <div class="modal-footer" id="contact_submit">
         <input type="button" value="Back" style="background:#204b58;" class="pull-left btn btn-info"  onclick="goBack()"/>
         </div>
</div>
</div>
</div>
</div>
</div>
<%@include file="footer.jsp" %>
</body>
<script type="text/javascript">
function goBack() {
    window.history.back(); 
};
</script>
</html>