• No results found

Page 126 display: inline-block;

In document Railway Reservation System (Page 126-144)

margin: 0; padding: 4px 5px; width: auto; background-color: #043d9b; color: #ffffff; font-weight: bold; } .email { font-weight:bold; } </style> <script> $(document).ready(function() {

var max_fields = 10; //maximum input boxes allowed var wrapper = $(".input_fields_wrap"); //Fields wrapper var add_button = $(".add_field_button"); //Add button ID var add_more_html;

var x = 1; //initlal text box count

$(add_button).click(function(e){ //on add input button click e.preventDefault();

if(x < max_fields){ //max input box allowed x++; //text box increment

add_more_html = $("#add_more_fields").html(); $(wrapper).append(add_more_html); //add input box

Page - 127

} });

$(wrapper).on("click",".remove_field", function(e){ //user click on remove text e.preventDefault(); $(this).closest('table').remove(); x--; calculateTotal(); }) }); function calculateTotal() { var total = 0; $('.medicine_total').each(function(i, obj) { if($(this).val()) {

total = total + parseInt($(this).val()); }

});

$('#total_cost').val(total); }

</script>

<div class="wrapper row3"> <div class="rounded">

<main class="container clear"> <!-- main body -->

<div id="comments" style="width: 70%; float:left; margin-right:30px"> <h2>Enter Passengar Details</h2>

Page - 128

<form action="model/booking.jsp" method="post"> <div id="empl_id" class="half_width">

<label for="email" style="font-weight:bold;">Train Number<span>*</span></label> <%=request.getParameter("train_no")%>

</div>

<div class="half_width">

<label for="email" style="font-weight:bold;">Train Name<span>*</span></label> <%=request.getParameter("train_name")%>

</div>

<div id="empl_id" class="half_width">

<label for="email" style="font-weight:bold;">From City<span>*</span></label> <%=request.getParameter("fromStation")%>

</div>

<div class="half_width">

<label for="email" style="font-weight:bold;">To City<span>*</span></label> <%=request.getParameter("toStation")%>

</div>

<div id="empl_id" class="half_width">

<label for="email" style="font-weight:bold;">Total Distance<span>*</span></label> <%=request.getParameter("total_distance")%> KM

</div>

<div class="half_width">

<label for="email" style="font-weight:bold;">Seat Type<span>*</span></label> <%=request.getParameter("type")%>

Page - 129

<div class="input_fields_wrap">

<div style="margin-bottom:15px; clear:both; text-align: right;"> <button class="add_field_button my_button">Add More Passengar</button> </div> <table> <tr> <th>Name</th> <th>Gender</th> <th>Age</th> <th>Action</th> </tr> <tr>

<td><input type="text" name="passengar_name" id="passengar_name" required></td>

<td><input type="text" name="passengar_gender" id="passengar_gender" required></td>

<td><input type="text" name="passengar_age" class="passengar_age" required onkeyup="calculateTotal()"></td>

<td style="width:100px;"> &nbsp; </td> </tr>

</table> </div>

<div class="block clear"></div> <div>

<input name="submit" type="submit" value="Book Ticket"> &nbsp;

Page - 130

<input name="reset" type="reset" value="Reset Form"> </div>

<input type="hidden" name="act" value="Save" />

<input type="hidden" name="tr_id" value="<%=request.getParameter("tr_id")%>"> <input type="hidden" name="ticket_fare"

value="<%=request.getParameter("fare")%>">

<input type="hidden" name="booking_seat_type" value="<%=request.getParameter("type")%>">

<input type="hidden" name="booking_journey_date" value="<%=request.getParameter("journey_date")%>">

</form> </div>

<div style="float: left">

<div><img src="images/save_1.jpg" style="width: 250px"></div><br> <div><img src="images/save_2.jpg" style="width: 250px"></div> </div>

<div class="clear"></div> </main>

</div> </div>

<!-- Add More HTML Block -->

<div id = "add_more_fields" style="display:none"> <table>

<tr style="background-color:#ffffff">

<td><input type="text" name="passengar_name" required></td> <td><input type="text" name="passengar_gender" required></td> <td><input type="text" name="passengar_age"></td>

Page - 131

<td style="width:100px; text-align:center; vertical-align:middle; font- weight:bold; font-size:11px;"><a href="#" class="remove_field">Remove</a></td>

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

<%@ include file="includes/footer.jsp" %> Coding for Print-Ticket.jsp

<%@ include file="includes/header.jsp" %> <%@ page import= "java.util.*" %>

<%@ page import= "Model.*" %> <%

//// Get the booking details ///// Booking bookingObj = new Booking(); Train trainDetails = new Train();

int booking_id = Integer.parseInt(request.getParameter ("booking_id")); HashMap BookingValues = bookingObj.getBookingTrainDetails(booking_id); ArrayList allPassengars = bookingObj.getFullBookingDetails(booking_id);

String fromStation = trainDetails.getOptionValue("city","city_name","city_id",(Integer) BookingValues.get("tr_from_station"));

String toStation = trainDetails.getOptionValue("city","city_name","city_id",(Integer) BookingValues.get("tr_to_station")); %> <style> table { margin-bottom:0px;

Page - 132

}

#comments input, #comments textarea { padding:5px; } .my_button { cursor: pointer; display: inline-block; margin: 0; padding: 4px 5px; width: auto; background-color: #043d9b; color: #ffffff; font-weight: bold; } .email { font-weight:bold; } </style> <script> $(document).ready(function() {

var max_fields = 10; //maximum input boxes allowed var wrapper = $(".input_fields_wrap"); //Fields wrapper var add_button = $(".add_field_button"); //Add button ID var add_more_html;

Page - 133

$(add_button).click(function(e){ //on add input button click e.preventDefault();

if(x < max_fields){ //max input box allowed x++; //text box increment

add_more_html = $("#add_more_fields").html(); $(wrapper).append(add_more_html); //add input box }

});

$(wrapper).on("click",".remove_field", function(e){ //user click on remove text e.preventDefault(); $(this).closest('table').remove(); x--; calculateTotal(); }) }); function calculateTotal() { var total = 0; $('.medicine_total').each(function(i, obj) { if($(this).val()) {

total = total + parseInt($(this).val()); }

});

$('#total_cost').val(total); }

Page - 134

<div class="wrapper row3"> <div class="rounded">

<main class="container clear"> <!-- main body -->

<div id="comments" style="width: 70%; float:left; margin-right:30px"> <h2>Booking Receipt</h2>

<form action="model/booking.jsp" method="post"> <div id="empl_id" class="half_width">

<label for="email" style="font-weight:bold;">Train Number<span>*</span></label> <%=BookingValues.get("train_no")%>

</div>

<div class="half_width">

<label for="email" style="font-weight:bold;">Train Name<span>*</span></label> <%=BookingValues.get("train_name")%>

</div>

<div id="empl_id" class="half_width">

<label for="email" style="font-weight:bold;">From City<span>*</span></label> <%=fromStation%>

</div>

<div class="half_width">

<label for="email" style="font-weight:bold;">To City<span>*</span></label> <%=toStation%>

</div>

<div id="empl_id" class="half_width">

Page - 135

<%=BookingValues.get("tr_distance")%> KM </div>

<div class="half_width">

<label for="email" style="font-weight:bold;">Seat Type<span>*</span></label> <%=BookingValues.get("booking_seat_type")%> </div> <div class="input_fields_wrap"> <table> <tr> <th>Name</th> <th>Gender</th> <th>Age</th> <th>Coach</th> <th>Seat No</th> </tr> <% for(int i=0;i<allPassengars.size();i++) {

HashMap PassengarDetails = new HashMap(); PassengarDetails = (HashMap)allPassengars.get(i); %> <tr> <td><% out.print(PassengarDetails.get("passengar_name")); %></td> <td><% out.print(PassengarDetails.get("passengar_gender")); %></td> <td><% out.print(PassengarDetails.get("passengar_age")); %></td>

Page - 136

<td><% out.print(PassengarDetails.get("passengar_coach")); %></td> <td><% out.print(PassengarDetails.get("passengar_seat_no")); %></td> </tr> <% } %> </table> </div>

<div style="float:right; color:#000000; font-weight:bold;">Total Ticket Amount : &#x20B9; <% out.print(BookingValues.get("booking_total_fare")); %>.00</div>

<div class="block clear"></div> <div>

<input name="print" type="button" value="Print Ticket" onclick="window.print()" style="width:200px; background-color: #043d9b; color: #ffffff; font-weight:bold"> &nbsp;

</div>

<input type="hidden" name="act" value="Save" />

<input type="hidden" name="tr_id" value="<%=request.getParameter("tr_id")%>"> <input type="hidden" name="booking_journey_date"

value="<%=request.getParameter("journey_date")%>"> </form>

</div>

<div style="float: left">

<div><img src="images/save_1.jpg" style="width: 250px"></div><br> <div><img src="images/save_2.jpg" style="width: 250px"></div> </div>

Page - 137

</main> </div> </div>

<!-- Add More HTML Block -->

<div id = "add_more_fields" style="display:none"> <table>

<tr style="background-color:#ffffff">

<td><input type="text" name="passengar_name" required></td> <td><input type="text" name="passengar_gender" required></td> <td><input type="text" name="passengar_age"></td>

<td style="width:100px; text-align:center; vertical-align:middle; font- weight:bold; font-size:11px;"><a href="#" class="remove_field">Remove</a></td>

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

<%@ include file="includes/footer.jsp" %> Coding for Report-Employee.jsp

<%@ include file="includes/header.jsp" %> <%@ page import= "java.util.*" %>

<%@ page import= "Model.*" %> <script>

function gotform(obj) { if(obj.value != "") {

window.location.href = obj.value; }

Page - 138

}

</script> <%

Employee employeeDetails = new Employee(); String employeeID = "0";

if(session.getAttribute("login_level") != null && session.getAttribute("login_level").equals("2")) { employeeID = (String) session.getAttribute("login_emp_id");

}

ArrayList allEmployees = employeeDetails.getAllEmployee(employeeID); %>

<div class="wrapper row3"> <div class="rounded">

<main class="container clear"> <!-- main body -->

<div class="scrollable"> <h2>Empoloyee Report</h2>

<% if(request.getParameter("msg") != null) { %>

<div class="msg"><%=request.getParameter("msg") %></div> <% } %> <table> <thead> <tr> <th>Employee Code</th> <th>Name</th> <th>Mobile</th>

Page - 139

<th>Department</th> <th>Status</th> <th>Email</th> <th>Action</th> </tr> </thead> <tbody> <% for(int i=0;i<allEmployees.size();i++) {

HashMap EmployeeDetails = new HashMap(); EmployeeDetails = (HashMap)allEmployees.get(i);

String department = employeeDetails.getDepartment((Integer) EmployeeDetails.get("employee_deparment"));

String status = employeeDetails.getStatus((Integer) EmployeeDetails.get("employee_status")); %> <tr> <td><% out.print(EmployeeDetails.get("employee_id")); %></td> <td><% out.print(EmployeeDetails.get("employee_first_name")); %></td> <td><% out.print(EmployeeDetails.get("employee_mobile")); %></td> <td><% out.print(department); %></td> <td><% out.print(status); %></td> <td><% out.print(EmployeeDetails.get("employee_email")); %></td> <td> <select onchange="gotform(this)">

Page - 140

<option value="employee.jsp?employee_id=<% out.print(EmployeeDetails.get("employee_id")); %>">Edit Employee</option>

</select> </td> </tr> <% } %> </tbody> </table> </div> </main> </div> </div> <%@ include file="includes/footer.jsp" %>

Page - 141

Coding for Report-Train.jsp

<%@ include file="includes/header.jsp" %> <%@ page import= "java.util.*" %>

<%@ page import= "Model.*" %> <script> function gotform(obj) { if(obj.value != "") { window.location.href = obj.value; } } </script> <%

Train trainDetails = new Train();

ArrayList allTrain = trainDetails.getAllTrain(); %>

<div class="wrapper row3"> <div class="rounded">

<main class="container clear"> <!-- main body -->

<div class="scrollable"> <h2>Train Report</h2>

<% if(request.getParameter("msg") != null) { %>

Page - 142

<% } %> <table> <thead> <tr> <th>Train No.</th> <th>Name</th> <th>Type</th> <th>From Station</th> <th>To Station</th> <th>Action</th> </tr> </thead> <tbody> <% for(int i=0;i<allTrain.size();i++) {

HashMap TrainDetails = new HashMap(); TrainDetails = (HashMap)allTrain.get(i); String toCity = trainDetails.getOptionValue("city","city_name","city_id",(Integer) TrainDetails.get("train_to")); %> <tr> <td style="text-align:center;"><% out.print(TrainDetails.get("train_no")); %></td> <td><% out.print(TrainDetails.get("train_name")); %></td> <td><% out.print(TrainDetails.get("train_type")); %></td> <td><% out.print(TrainDetails.get("train_from_city")); %></td>

Page - 143

<td><% out.print(toCity); %></td> <td>

<select onchange="gotform(this)">

<option value="">Select Action</option> <option value="train.jsp?train_id=<% out.print(TrainDetails.get("train_id")); %>">Edit Train</option>

<option value="report-train-coach.jsp?train_id=<% out.print(TrainDetails.get("train_id")); %>">View Coach</option>

<option value="report-train-route.jsp?train_id=<% out.print(TrainDetails.get("train_id")); %>">View Route</option>

</select> </td> </tr> <% } %> </tbody> </table> </div> </main> </div> </div> <%@ include file="includes/footer.jsp" %>

Page - 144

In document Railway Reservation System (Page 126-144)

Related documents