Current File : //home/obabain/anms_obaba_in/datadfghh.jsp
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
    <%@ include file="Connection.jsp" %>
    <%@include file="master_one.jsp" %>

  <% String from=request.getParameter("from");
     String to=request.getParameter("to");
     
     String pid=request.getParameter("pid");
     Statement st=con.createStatement();
 	String id=request.getParameter("Id");

     %>
     
  <%-- <%!
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;
    
    if(filt==null)
    {
    	rsRowCnt=st.executeQuery("select count(*)as cnt from ip_products1 ");
        if(rsRowCnt.next())
        {
           iTotalRows=rsRowCnt.getInt("cnt");
        }
    }
        else
        {
        	rsRowCnt=st.executeQuery("select count(*)as cnt from ip_products1 where product_name like '%"+filt+"%'");
        	if(rsRowCnt.next())
            {
               iTotalRows=rsRowCnt.getInt("cnt");
            }
        }
        
    
    %> 
  
   --%>
  
  
  
<!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>
<style>

.scrollmenu {

  overflow: auto;
  white-space: nowrap;
}
</style>
<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">

<link rel="stylesheet" href="https://cdn.datatables.net/1.10.19/css/jquery.dataTables.min.css">
<link rel="stylesheet" href="https://cdn.datatables.net/buttons/1.5.6/css/buttons.dataTables.min.css">
<link rel="stylesheet" href="https://cdn.datatables.net/select/1.3.0/css/select.dataTables.min.css">
 
 <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/buttons/1.5.6/js/dataTables.buttons.min.js'></script>
 <script src='https://cdn.datatables.net/buttons/1.5.6/js/buttons.flash.min.js'></script>
 <script src='https://cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/jszip.min.js'></script>
 <script src='https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.53/pdfmake.min.js'></script>
 <script src='https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.53/vfs_fonts.js'></script>
 <script src='https://cdn.datatables.net/buttons/1.5.6/js/buttons.html5.min.js'></script>
 <script src='https://cdn.datatables.net/buttons/1.5.6/js/buttons.print.min.js'></script>
 <script src='https://cdn.datatables.net/select/1.3.0/js/dataTables.select.min.js'></script> 

 
 <script >
 $(document).ready(function() {
	    $('#someTable').DataTable( {
	        dom: 'Bfrtip',
	        buttons: [
	            'copy',
	            'csv',
	            'excel',
	            'pdf',
	            {
	                extend: 'print',
	                text: 'Print all (not just selected)',
	                exportOptions: {
	                    modifier: {
	                        selected: null
	                    }
	                }
	            }
	        ],
	        select: true
	    } );
	} );
 
 </script>

<script>
        $(function () {
            var $chk = $("#grpChkBox input:checkbox"); 
            var $tbl = $("#someTable");
            var $tblhead = $("#someTable th");

            $chk.prop('checked', true); 

            $chk.click(function () {
                var colToHide = $tblhead.filter("." + $(this).attr("name"));
                var index = $(colToHide).index();
                $tbl.find('tr :nth-child(' + (index + 1) + ')').toggle();
            });
        });
    </script>


</head>
<body>
<!-- <script type="text/javascript">
$(document).ready(function() {
    $('#example').DataTable();
} );
</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" style="background: linear-gradient(55deg, #0fb8ad 0%, #1fc8db 40%, #2cb5e8 85%);">
        <h3 class="panel-title"><a href="viewproduct_2.jsp">
          <span class="glyphicon glyphicon-th"></span>
        </a>&nbsp;&nbsp;Purchase&nbsp;&nbsp;Invoice Datewise Report View</h3>
        <div class="headerbar-item pull-right" style="margin-top:-23px;">
      
         <a style="background:#204b58" class="btn btn-info"  onclick="goBack()">Back</a>
       




</div>

        
              </div>
             </div> 
             
<div id="grpChkBox">
 <div style="margin-top:-20px;margin-left:70px;" class="options btn-group pull-right">
<a class="btn btn-success  dropdown-toggle fontstyle"  data-toggle="dropdown">
  Options</a>
 <ul class="dropdown-menu">
  <li style="margin-left:20px;"><input type="checkbox" name="Sname">Date</li>
  <li style="margin-left:20px;"><input type="checkbox" name="person">Invoice  No.</li>
  <li style="margin-left:20px;"><input type="checkbox" name="phone">Supplier Name</li>
  <li style="margin-left:20px;"><input type="checkbox" name="email">P.O No.</li>
  
   <li style="margin-left:20px;"><input type="checkbox" name="Stype">P.O Date</li>
   <li style="margin-left:20px;"><input type="checkbox" name="address">Item Name</li>
   <li style="margin-left:20px;"><input type="checkbox" name="Region">Unit</li>
   <li style="margin-left:20px;"><input type="checkbox" name="reffered">Item Qty</li>
   <li style="margin-left:20px;"><input type="checkbox" name="oneTime">Item Price</li>
   
    <li style="margin-left:20px;"><input type="checkbox" name="code1">Total</li>
   <li style="margin-left:20px;"><input type="checkbox" name="code2">Net Amount</li>
  
</ul></div>
</div>


  <div style="overflow-x:auto;width:100%;">          
<table id="someTable" class="table table-striped table-bordered">

<thead>
<tr>
<th style="width:20px;"class="Sname">Invoice Created Date</th>
<th class="person">Invoice  No.</th>


<th class="code2">IGST</th>

<th class="code2">CGST</th>
<th class="code2">SGST</th>



</tr>
</thead>
<tbody>
<%
try{
	ResultSet rs=null;
	int l=0;

	rs=st.executeQuery ("select tb.*,(select invoice_date_created from  ip_puchase_invoice2 where pinvoice_id=tb.invoice_id )gdate ,(select supplier_name from  ip_puchase_invoice2 where pinvoice_id=tb.invoice_id)name ,(select invoice_id from  ip_puchase_invoice2 where pinvoice_id=tb.invoice_id)inv ,(select podate from  ip_puchase_invoice2 where pinvoice_id=tb.invoice_id)podate ,(select invoice_id from  ip_puchase_invoice2 where pinvoice_id=tb.invoice_id)inv ,(select total from  ip_puchase_invoice2 where pinvoice_id=tb.invoice_id)total ,(item_qty*item_price)stock, ROUND((case when (select tax_rate_name from ip_tax_rates where tax_rate_id=tb.item_tax_rate_id)='IGST'   then ((item_qty*item_price)*(select tax_rate_percent from ip_tax_rates where tax_rate_id=tb.item_tax_rate_id))/100 else 0 end),2)as igst,ROUND((case when (select tax_rate_name from ip_tax_rates where tax_rate_id=tb.item_tax_rate_id)='IGST'  then 0 else  ((item_qty*item_price)*(select tax_rate_percent from ip_tax_rates where tax_rate_id=tb.item_tax_rate_id))/100 end),2)as sgst FROM ip_purchase_invoice_item2 tb where item_date_added	 between '"+from+"' and '"+to+"'");

 

 while(rs.next())  
	{
		
  Double i =Double.parseDouble(rs.getString("item_qty"));
   Double j=Double.parseDouble(rs.getString("item_price"));
		
	 Double k = i * j;
				
				
%>

<tr>
<td><%=rs.getString("gdate")%></td>
<td><%=rs.getString("inv")%></td>


  <td  align="right"> <%=rs.getString("igst")%></td>
   <td  align="right"> <%=rs.getString("sgst")%></td>
 
   <td  align="right"> <%=rs.getString("sgst")%></td>



<% } 
	}
	catch(Exception el){}
	%>
</tr>

</tbody>
<tr>           
       
              <td></td>
                 
                         
                   
                            
              <td > </td>

                
                               
              
                  
              
              
               <% 
              ResultSet rt=null;
              if(from==null){
            	  rt=st.executeQuery ("select IFNULL(sum(case when (select tax_rate_name from ip_tax_rates where tax_rate_id=tb.item_tax_rate_id)='IGST'   then ((item_qty*item_price)*(select tax_rate_percent from ip_tax_rates where tax_rate_id=tb.item_tax_rate_id))/100 else 0 end),2)as igst FROM ip_purchase_invoice_item2 tb where item_date_added	 between '"+from+"' and '"+to+"' ");
            	  }
              else{
                  
            	  rt=st.executeQuery ("select IFNULL(sum(case when (select tax_rate_name from ip_tax_rates where tax_rate_id=tb.item_tax_rate_id)='IGST'   then ((item_qty*item_price)*(select tax_rate_percent from ip_tax_rates where tax_rate_id=tb.item_tax_rate_id))/100 else 0 end),2)as igst FROM ip_purchase_invoice_item2 tb where item_date_added	 between '"+from+"' and '"+to+"' ");
             
      }    
            while(rt.next())
             {
            %> 
           <td style="text-align: center;color:red;">  <b> <input style="text-align: center;width:150px;margin-left:0px; " class="form-control" type="text" value="<%=rt.getString("igst")%>" readonly ></b>
               </td>
              <%} %>
                      <% 
              ResultSet rq=null;
              if(from==null){
            	  rq=st.executeQuery ("select IFNULL(sum(case when (select tax_rate_name from ip_tax_rates where tax_rate_id=tb.item_tax_rate_id)='IGST'  then 0 else  ((item_qty*item_price)*(select tax_rate_percent from ip_tax_rates where tax_rate_id=tb.item_tax_rate_id))/100 end),2)as sgst FROM ip_purchase_invoice_item2 tb where item_date_added	 between '"+from+"' and '"+to+"' ");
            	  }
              else{
                  
            	  rq=st.executeQuery ("select IFNULL(sum(case when (select tax_rate_name from ip_tax_rates where tax_rate_id=tb.item_tax_rate_id)='IGST'  then 0 else  ((item_qty*item_price)*(select tax_rate_percent from ip_tax_rates where tax_rate_id=tb.item_tax_rate_id))/100 end),2)as sgst FROM ip_purchase_invoice_item2 tb where item_date_added	 between '"+from+"' and '"+to+"' ");
             
      }    
            while(rq.next())
             {
            %> 
           <td style="text-align: center;color:red;">  <b> <input style="text-align: center;width:150px;margin-left:0px; " class="form-control" type="text" value="<%=rq.getString("sgst")%>" readonly ></b>
               </td>
              <%} %>
          <% 
              ResultSet ry=null;
              if(from==null){
            	  ry=st.executeQuery ("select IFNULL(sum(case when (select tax_rate_name from ip_tax_rates where tax_rate_id=tb.item_tax_rate_id)='IGST'  then 0 else  ((item_qty*item_price)*(select tax_rate_percent from ip_tax_rates where tax_rate_id=tb.item_tax_rate_id))/100 end),2)as sgst FROM ip_purchase_invoice_item2 tb where item_date_added	 between '"+from+"' and '"+to+"' ");
            	  }
              else{
                  
            	  ry=st.executeQuery ("select IFNULL(sum(case when (select tax_rate_name from ip_tax_rates where tax_rate_id=tb.item_tax_rate_id)='IGST'  then 0 else  ((item_qty*item_price)*(select tax_rate_percent from ip_tax_rates where tax_rate_id=tb.item_tax_rate_id))/100 end),2)as sgst FROM ip_purchase_invoice_item2 tb where item_date_added	 between '"+from+"' and '"+to+"' ");
             
      }    
            while(ry.next())
             {
            %> 
           <td style="text-align: center;color:red;">  <b> <input style="text-align: center;width:150px;margin-left:0px; " class="form-control" type="text" value="<%=ry.getString("sgst")%>" readonly ></b>
               </td>
               
              <%} %> 
              <br>
              
                            <td style="text-align: center;">  <label>Total&nbsp;Amount</label></td>
              
                <% 
              ResultSet rp=null;
              if(from==null){
                rp=st.executeQuery ("select IFNULL(sum(total),0)sqtyy from  ip_puchase_invoice2 tb where invoice_date_created   between '"+from+"' and '"+to+"'    ");
 }else{
                  
                   rp=st.executeQuery("select IFNULL(sum(total),0)sqtyy from  ip_puchase_invoice2 tb where invoice_date_created   between '"+from+"' and '"+to+"'    ");
      }    
            while(rp.next())
             {
            %> 
                        <Lable style="text-align: center;color:red;">Total Amount&nbsp;&nbsp;<%=rp.getString("sqtyy")%></Lable><br>
            
           <td style="text-align: center;color:red;">  <b> <input style="text-align: center;width:150px;margin-left:0px; " class="form-control" type="text" value="<%=rp.getString("sqtyy")%>" readonly ></b>
               </td>
              <%} %>                         
                  </tr>
</table>
</div>




</div>
</div></div>
<%@include file="footer.jsp" %>
</form>




<script type="text/javascript">
function goBack() {window.history.back();};
</script>


 
    

</body>
</html>