Current File : /home/obabain/autoclutchess_obaba_in/AccountGroup.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;
%>
<%@page import="java.sql.*,java.util.*"%>
<%@page import="java.sql.ResultSet"%>
    
   <!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-1.12.4.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"  rel="stylesheet">
    <link href="css/select2.min.css" rel="stylesheet">
    <link href="css/jquery.datetimepicker.css" rel="stylesheet">

</head>

<body>
<%@include file="master.jsp" %>
<form action="AccountGroup.jsp"  method="post" id="contact" name="form1">

<section id="main">
<div class="container">
 <div class="row" style="width:110%">
    <div class="col-md-10" >
       <div class="panel panel-default" >
       <div class="panel-heading main-color-bg">
        <h3 class="panel-title">Account Group creation</h3>
    </div>
    
        
           <br><br><div class="panel-body"  >
            <a class="pull-right btn btn-info" style="background:#204b58" href="ViewAccountgroup.jsp">View</a>
       <div class="row" >     
                <div class="col-xs-4">
          <label for="lastname" style="margin-left:5px;">Name</label> 
          <input type="text" name="group" class="form-control"> 
          </div>  
          <div class="col-xs-4">
          <label for="lastname" style="margin-left:5px;">(alias)</label> 
          <input type="text" name="gpalias" class="form-control"> 
          </div>       
        </div> 
         <div class="row" >     
                <div class="col-xs-4">
          <label for="lastname" style="margin-left:5px;">Under</label> 
          <select name="under" class="form-control"> 
          <option value="0">select</option>
          <%
          rs=st.executeQuery("select * from accountgroup");
          while(rs.next())
          {
          %>
          
          <option value="<%=rs.getString("grp_id") %>"><%=rs.getString("ag_group") %></option>
          <%} %>
          </select>
          </div>  
          </div>    
<br>
           </div>      
         <div class="modal-footer" id="contact_submit">
         <input type="button" value="Back" style="background:#204b58;margin-right:720px" class="btn btn-info" onclick="goBack()" />
          <a class="btn btn-default"  href="">Reset</a>
      <!--  <button type="submit" style="background:#204b58" class="btn btn-info" >Save Changes</button>-->
        <input type="submit" style="background:#204b58;" class="btn btn-info" value="Save changes">
       
        <strong></strong>
      </div>      
       <%
       String gpname=request.getParameter("group");
String gpalias=request.getParameter("gpalias");
String under=request.getParameter("under");
String typ="";
try
{
	 st=con.createStatement();
	 
	 rs=st.executeQuery("select type from accountgroup where grp_id="+under+"");
	 while(rs.next())
	 {
		 typ=rs.getString("type");
	 }
	 if(gpname!=null)
	 {
int i=st.executeUpdate("insert into accountgroup values(0,'"+gpname+"',NOW(),'"+gpalias+"',"+loginid+","+under+","+typ+")");
	 }
}
catch(Exception e)
{

}
%>     
    
      <br>   
    <div class="panel-body">  
<%-- <table  class="table table-bordered">
<tr>
<th>Sl No</th>
<th>AccountGroup</th>
<th>Created Date</th>

<th>Edit</th>
<th>Delete</th>
</tr>

<%
try{
	st=con.createStatement();
String sql ="select * from accountgroup";
rs = st.executeQuery(sql);
int i=0;
while(rs.next()){
i++;	
%>
<tr>

<td>
<%=i %>
</td>

<td>
<%=rs.getString("ag_group") %>
</td>
<td>
<%=rs.getString("ag_cdate") %>
 
</td>
<td>
 <input type="button" name="edit" value="Edit" onclick="editRecord(<%=r1.getString(1)%>);" ><i class="material-icons">&#xe254;</i>
 
 <td><input type="button" name="edit" value="Edit" style="background-color:#49743D;font-weight:bold;color:#ffffff;" onclick="editRecord(<%=r1.getString("d_id")%>);" ></td>

 <a href="editAccountgroup.jsp?id=<%=rs.getString("grp_id")%>"><span class="glyphicon glyphicon-pencil"></span></a>
 </td>


<td>
<a href="AccountGroup.jsp?id=<%=rs.getString("grp_id") %>"><i class='glyphicon glyphicon-trash'></i></button></a>
 
</td>
</tr>
 <%
 
}


} catch (Exception e) {
}
%>
</table> --%>
</div> 
   
         
     </div>
     </div>  
    
  </div>
  </div>
</section>
<%-- <% }else{ 
     response.sendRedirect("login.jsp");
    } %> --%>
</form>
</body>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
    <!-- Include all compiled plugins (below), or include individual files as needed -->
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"></script>
    <script src="js/select2.min.js"></script>
    <script src="js/jquery.datetimepicker.full.js"></script>
   
    <script>
    $('select').select2();
    </script>
    <script type="text/javascript">
function goBack() {
    window.history.back();
   
};
</script>
</html>