Browse Source

Counter Detailed Report added for admin and HQ login

master
kanimozhi 1 year ago
parent
commit
d66445f20d
  1. 17
      src/main/java/com/gcc/communityHall/controller/AdminAPIController.java
  2. 24
      src/main/java/com/gcc/communityHall/controller/Admincontroller.java
  3. 120
      src/main/java/com/gcc/communityHall/controller/HeadquartersController.java
  4. 58
      src/main/java/com/gcc/communityHall/repository/BookingDetailsRepository.java
  5. 5
      src/main/java/com/gcc/communityHall/service/BookingService.java
  6. 17
      src/main/java/com/gcc/communityHall/service/Impl/BookingServiceImpl.java
  7. 129
      src/main/resources/templates/admin/reports.html
  8. 675
      src/main/resources/templates/headquarters/reports.html
  9. 2
      src/main/resources/templates/user/viewhistory.html

17
src/main/java/com/gcc/communityHall/controller/AdminAPIController.java

@ -327,6 +327,7 @@ public class AdminAPIController {
return new ResponseEntity<>(HttpStatus.NOT_FOUND); return new ResponseEntity<>(HttpStatus.NOT_FOUND);
} }
} }
@Operation( @Operation(
summary = "HallDetails by HallId REST API", summary = "HallDetails by HallId REST API",
description = "REST API to Retrieving the Hall Details by hallId" description = "REST API to Retrieving the Hall Details by hallId"
@ -551,6 +552,7 @@ public class AdminAPIController {
public List<ReasonMaster> getAllReasons() { public List<ReasonMaster> getAllReasons() {
return reasonMasterService.getAllReasons(); return reasonMasterService.getAllReasons();
} }
@Operation( @Operation(
summary = "Reason Documents by reasonId REST API", summary = "Reason Documents by reasonId REST API",
description = "REST API to Get the ReasonDocuments By reasonId" description = "REST API to Get the ReasonDocuments By reasonId"
@ -600,7 +602,6 @@ public class AdminAPIController {
} }
@Operation( @Operation(
summary = " GCC Blocked Booking Details REST API", summary = " GCC Blocked Booking Details REST API",
description = "REST API to get the GCC Blocked BookingDetails" description = "REST API to get the GCC Blocked BookingDetails"
@ -630,7 +631,6 @@ public class AdminAPIController {
} }
@Operation( @Operation(
summary = "UNBLOCK the gcc Blocked Event REST API", summary = "UNBLOCK the gcc Blocked Event REST API",
description = "REST API to unblocking the Gcc blocked Events for blocking" description = "REST API to unblocking the Gcc blocked Events for blocking"
@ -953,6 +953,7 @@ public class AdminAPIController {
return ResponseEntity.ok(results); return ResponseEntity.ok(results);
} }
@GetMapping("/getblockedbookingdetails") @GetMapping("/getblockedbookingdetails")
public ResponseEntity<List<Map<String, Object>>> viewBlockedHallsByHallIdAndReason( public ResponseEntity<List<Map<String, Object>>> viewBlockedHallsByHallIdAndReason(
@RequestParam String hallIds, @RequestParam String hallIds,
@ -1117,8 +1118,7 @@ public class AdminAPIController {
} }
@GetMapping("/getHallsDetailsByZone") @GetMapping("/getHallsDetailsByZone")
public ResponseEntity<Map<String, Object>> getHallsDetailsByZone( @RequestParam String zone)
{
public ResponseEntity<Map<String, Object>> getHallsDetailsByZone(@RequestParam String zone) {
Map<String, Object> hallzones = hallDetailService.getHallsDetailsByZone(zone); Map<String, Object> hallzones = hallDetailService.getHallsDetailsByZone(zone);
// Debug log to verify the response before sending it to the client // Debug log to verify the response before sending it to the client
// System.out.println("Response from getHallsDetailsByZone: " + hallzones); // System.out.println("Response from getHallsDetailsByZone: " + hallzones);
@ -1162,6 +1162,7 @@ public class AdminAPIController {
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(Collections.singletonMap("error", "Failed to update image")); return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(Collections.singletonMap("error", "Failed to update image"));
} }
} }
@DeleteMapping("/deleteHallImage/{hallImageId}") @DeleteMapping("/deleteHallImage/{hallImageId}")
public ResponseEntity<String> deleteHallImage(@PathVariable Integer hallImageId) { public ResponseEntity<String> deleteHallImage(@PathVariable Integer hallImageId) {
try { try {
@ -1172,11 +1173,13 @@ public class AdminAPIController {
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Error deleting image."); return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body("Error deleting image.");
} }
} }
@GetMapping("/bookingdetailsByzone") @GetMapping("/bookingdetailsByzone")
public ResponseEntity<List<BookingDetails>> getBookingDetailsByZone(@RequestParam String zone) { public ResponseEntity<List<BookingDetails>> getBookingDetailsByZone(@RequestParam String zone) {
List<BookingDetails> bookingDetails = bookingDetailsRepository.findByZone(zone); List<BookingDetails> bookingDetails = bookingDetailsRepository.findByZone(zone);
return ResponseEntity.ok(bookingDetails); return ResponseEntity.ok(bookingDetails);
} }
@GetMapping("/divisionsByZone") @GetMapping("/divisionsByZone")
public List<String> getDivisionsByZone(@RequestParam("zoneId") String zoneId) { public List<String> getDivisionsByZone(@RequestParam("zoneId") String zoneId) {
// Use zoneId instead of zone // Use zoneId instead of zone
@ -1192,6 +1195,7 @@ public class AdminAPIController {
} }
return new ResponseEntity<>(halls, HttpStatus.OK); return new ResponseEntity<>(halls, HttpStatus.OK);
} }
@PostMapping("/manualrefund") @PostMapping("/manualrefund")
public ResponseEntity<?> manualRefund( public ResponseEntity<?> manualRefund(
@RequestParam int bookingId, @RequestParam int bookingId,
@ -1399,8 +1403,7 @@ public class AdminAPIController {
} }
@GetMapping("/getHallDetailsById") @GetMapping("/getHallDetailsById")
public ResponseEntity<List<Map<String, Object>>> getHallDetailsById(@RequestParam Integer hall_id)
{
public ResponseEntity<List<Map<String, Object>>> getHallDetailsById(@RequestParam Integer hall_id) {
List<Map<String, Object>> halldetails = bookingService.getHallDetailsForOfficer(hall_id); List<Map<String, Object>> halldetails = bookingService.getHallDetailsForOfficer(hall_id);
return ResponseEntity.ok(halldetails); return ResponseEntity.ok(halldetails);
} }
@ -1450,6 +1453,7 @@ public class AdminAPIController {
List<Object[]> userDetails = userRepository.findUserDetailsByBookingDate(fromDate, toDate); List<Object[]> userDetails = userRepository.findUserDetailsByBookingDate(fromDate, toDate);
return ResponseEntity.ok(userDetails); return ResponseEntity.ok(userDetails);
} }
@GetMapping("/getPaymentswithRefunds") @GetMapping("/getPaymentswithRefunds")
public List<Object[]> getPaymentsWithRefunds(@RequestParam String startDate, @RequestParam String endDate) { public List<Object[]> getPaymentsWithRefunds(@RequestParam String startDate, @RequestParam String endDate) {
return userRepository.findPaymentsWithRefunds(startDate, endDate); return userRepository.findPaymentsWithRefunds(startDate, endDate);
@ -1464,6 +1468,7 @@ public class AdminAPIController {
public List<Object[]> getPaymentsWithRefundsOnly(@RequestParam String startDate, @RequestParam String endDate) { public List<Object[]> getPaymentsWithRefundsOnly(@RequestParam String startDate, @RequestParam String endDate) {
return userRepository.findPaymentsWithRefundsOnly(startDate, endDate); return userRepository.findPaymentsWithRefundsOnly(startDate, endDate);
} }
@PostMapping("/send") @PostMapping("/send")
public ResponseEntity<Map<String, String>> sendMessage(@RequestBody Map<String, String> messagePayload) { public ResponseEntity<Map<String, String>> sendMessage(@RequestBody Map<String, String> messagePayload) {
String userMessage = messagePayload.get("message"); String userMessage = messagePayload.get("message");

24
src/main/java/com/gcc/communityHall/controller/Admincontroller.java

@ -564,9 +564,11 @@ public class Admincontroller {
@RequestParam(name = "filterby", required = false) String filterby, @RequestParam(name = "filterby", required = false) String filterby,
@RequestParam(name = "zone1", required = false, defaultValue = "ALL") String zone, @RequestParam(name = "zone1", required = false, defaultValue = "ALL") String zone,
@RequestParam(name = "division1", required = false, defaultValue = "ALL") String division, @RequestParam(name = "division1", required = false, defaultValue = "ALL") String division,
@RequestParam(name = "hall1", required = false, defaultValue = "1000") Integer hallid,
@RequestParam(name = "hall1", required = false) Integer hallid,
@RequestParam(name = "basedon", required = false) String basedon, @RequestParam(name = "basedon", required = false) String basedon,
@RequestParam(name = "bookingId", required = false) Long bookingId, HttpSession session) throws JsonProcessingException {
@RequestParam(name = "bookingId", required = false) Long bookingId,
@RequestParam(name = "reporttype", required = false) String reporttype,
@RequestParam(name = "counterId", required = false) String counterId, HttpSession session) throws JsonProcessingException {
String adminname = (String) session.getAttribute("usertype"); String adminname = (String) session.getAttribute("usertype");
if (adminname != null) { if (adminname != null) {
long mobileno = (long) session.getAttribute("mobileno"); long mobileno = (long) session.getAttribute("mobileno");
@ -621,20 +623,32 @@ public class Admincontroller {
model.addAttribute("totalBookings", totalBookings); model.addAttribute("totalBookings", totalBookings);
List<Object[]> hallbookingList = handleBookingHallDetailsReportRequest(request, fromDate, toDate, filterby, zone, division, hallid); List<Object[]> hallbookingList = handleBookingHallDetailsReportRequest(request, fromDate, toDate, filterby, zone, division, hallid);
List<Object[]> counterBookingList = request.equals("9") ? bookingService.getCounterWiseBookingCount(fromDate, toDate) : new ArrayList<>();
if ("9".equals(request)) {
if("abstract".equals(reporttype)){
List<Object[]> counterBookingList = new ArrayList<>();
counterBookingList = bookingService.getCounterWiseBookingCount(fromDate, toDate);
model.addAttribute("counterBookingList", counterBookingList); model.addAttribute("counterBookingList", counterBookingList);
System.out.println("counterBookingList.." + counterBookingList); System.out.println("counterBookingList.." + counterBookingList);
List<Object[]> hallBookingByCounter = bookingService.getHallWiseBookingDetails(fromDate, toDate);
List<Object[]> hallBookingByCounter = bookingService.getHallWiseBookingDetails(fromDate, toDate, counterId);
// Convert to JSON for JS usage // Convert to JSON for JS usage
String hallBookingJson = new ObjectMapper().writeValueAsString(hallBookingByCounter); String hallBookingJson = new ObjectMapper().writeValueAsString(hallBookingByCounter);
model.addAttribute("hallBookingJson", hallBookingJson); model.addAttribute("hallBookingJson", hallBookingJson);
List<Object[]> hallBookingDetails = bookingService.getBookingDetailsForAllHalls(fromDate, toDate);
List<Object[]> hallBookingDetails = bookingService.getBookingDetailsForAllHalls(fromDate, toDate, counterId, hallid);
String hallBookingDetailsJson = new ObjectMapper().writeValueAsString(hallBookingDetails); String hallBookingDetailsJson = new ObjectMapper().writeValueAsString(hallBookingDetails);
model.addAttribute("hallBookingDetailsJson", hallBookingDetailsJson); model.addAttribute("hallBookingDetailsJson", hallBookingDetailsJson);
} else {
List<Object[]> counterBookingList = new ArrayList<>();
counterBookingList = bookingService.getCounterWiseBookingDetails(fromDate, toDate);
model.addAttribute("counterBookingList", counterBookingList);
}
model.addAttribute("reporttype", reporttype);
}
model.addAttribute("filterby", filterby); model.addAttribute("filterby", filterby);
model.addAttribute("users", userList); model.addAttribute("users", userList);
model.addAttribute("bookings", bookingList); model.addAttribute("bookings", bookingList);

120
src/main/java/com/gcc/communityHall/controller/HeadquartersController.java

@ -1,9 +1,12 @@
package com.gcc.communityHall.controller; package com.gcc.communityHall.controller;
import java.util.*; import java.util.*;
import java.util.function.Function; import java.util.function.Function;
import java.util.function.Predicate; import java.util.function.Predicate;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.gcc.communityHall.entity.GccBlockingDate; import com.gcc.communityHall.entity.GccBlockingDate;
import com.gcc.communityHall.others.AppConfig; import com.gcc.communityHall.others.AppConfig;
import com.gcc.communityHall.repository.GccBlockingDateRepository; import com.gcc.communityHall.repository.GccBlockingDateRepository;
@ -87,8 +90,7 @@ public class HeadquartersController {
@GetMapping("/Reports") @GetMapping("/Reports")
public String viewReports(Model model,HttpSession session)
{
public String viewReports(Model model, HttpSession session) {
String headquartersname = (String) session.getAttribute("usertype"); String headquartersname = (String) session.getAttribute("usertype");
if (headquartersname != null) { if (headquartersname != null) {
long mobileno = (long) session.getAttribute("mobileno"); long mobileno = (long) session.getAttribute("mobileno");
@ -102,8 +104,7 @@ public class HeadquartersController {
} }
@GetMapping("/getReport") @GetMapping("/getReport")
public String getReports(Model model,HttpSession session)
{
public String getReports(Model model, HttpSession session) {
String headquartersname = (String) session.getAttribute("usertype"); String headquartersname = (String) session.getAttribute("usertype");
if (headquartersname != null) { if (headquartersname != null) {
long mobileno = (long) session.getAttribute("mobileno"); long mobileno = (long) session.getAttribute("mobileno");
@ -115,6 +116,7 @@ public class HeadquartersController {
return "redirect:/communityhall/login"; return "redirect:/communityhall/login";
} }
} }
@GetMapping("/approval-history") @GetMapping("/approval-history")
public String viewApproval(Model model, HttpSession session) { public String viewApproval(Model model, HttpSession session) {
String headquartersname = (String) session.getAttribute("usertype"); String headquartersname = (String) session.getAttribute("usertype");
@ -185,9 +187,11 @@ public class HeadquartersController {
@RequestParam(name = "filterby", required = false) String filterby, @RequestParam(name = "filterby", required = false) String filterby,
@RequestParam(name = "zone1", required = false, defaultValue = "ALL") String zone, @RequestParam(name = "zone1", required = false, defaultValue = "ALL") String zone,
@RequestParam(name = "division1", required = false, defaultValue = "ALL") String division, @RequestParam(name = "division1", required = false, defaultValue = "ALL") String division,
@RequestParam(name = "hall1",required = false, defaultValue = "1000") Integer hallid,
@RequestParam(name = "hall1", required = false) Integer hallid,
@RequestParam(name = "basedon", required = false) String basedon, @RequestParam(name = "basedon", required = false) String basedon,
@RequestParam(name = "bookingId", required = false) Long bookingId,HttpSession session) {
@RequestParam(name = "bookingId", required = false) Long bookingId,
@RequestParam(name = "reporttype", required = false) String reporttype,
@RequestParam(name = "counterId", required = false) String counterId, HttpSession session) throws JsonProcessingException {
String headquartersname = (String) session.getAttribute("usertype"); String headquartersname = (String) session.getAttribute("usertype");
if (headquartersname != null) { if (headquartersname != null) {
long mobileno = (long) session.getAttribute("mobileno"); long mobileno = (long) session.getAttribute("mobileno");
@ -242,6 +246,30 @@ public class HeadquartersController {
model.addAttribute("totalBookings", totalBookings); model.addAttribute("totalBookings", totalBookings);
List<Object[]> hallbookingList = handleBookingHallDetailsReportRequest(request, fromDate, toDate, filterby, zone, division, hallid); List<Object[]> hallbookingList = handleBookingHallDetailsReportRequest(request, fromDate, toDate, filterby, zone, division, hallid);
if ("9".equals(request)) {
if("abstract".equals(reporttype)){
List<Object[]> counterBookingList = new ArrayList<>();
counterBookingList = bookingService.getCounterWiseBookingCount(fromDate, toDate);
model.addAttribute("counterBookingList", counterBookingList);
System.out.println("counterBookingList.." + counterBookingList);
List<Object[]> hallBookingByCounter = bookingService.getHallWiseBookingDetails(fromDate, toDate, counterId);
// Convert to JSON for JS usage
String hallBookingJson = new ObjectMapper().writeValueAsString(hallBookingByCounter);
model.addAttribute("hallBookingJson", hallBookingJson);
List<Object[]> hallBookingDetails = bookingService.getBookingDetailsForAllHalls(fromDate, toDate, counterId, hallid);
String hallBookingDetailsJson = new ObjectMapper().writeValueAsString(hallBookingDetails);
model.addAttribute("hallBookingDetailsJson", hallBookingDetailsJson);
} else {
List<Object[]> counterBookingList = new ArrayList<>();
counterBookingList = bookingService.getCounterWiseBookingDetails(fromDate, toDate);
model.addAttribute("counterBookingList", counterBookingList);
}
model.addAttribute("reporttype", reporttype);
}
model.addAttribute("filterby", filterby); model.addAttribute("filterby", filterby);
model.addAttribute("users", userList); model.addAttribute("users", userList);
@ -272,23 +300,19 @@ public class HeadquartersController {
} }
} }
private List<Object[]> handleBookingHallDetailsReportRequest(String request, String fromDate, String toDate,String filterby,String zone,String division,Integer hallid)
{
private List<Object[]> handleBookingHallDetailsReportRequest(String request, String fromDate, String toDate, String filterby, String zone, String division, Integer hallid) {
if (!request.equals("5")) { if (!request.equals("5")) {
return new ArrayList<>(); return new ArrayList<>();
} }
if(filterby.isEmpty())
{
if (filterby.isEmpty()) {
return bookingService.getBookingHallDetailsReportByBookingDate(fromDate, toDate, zone, division, hallid); return bookingService.getBookingHallDetailsReportByBookingDate(fromDate, toDate, zone, division, hallid);
} }
if ("1".equals(filterby))
{
if ("1".equals(filterby)) {
return bookingService.getBookingHallDetailsReportByBookingDate(fromDate, toDate, zone, division, hallid); return bookingService.getBookingHallDetailsReportByBookingDate(fromDate, toDate, zone, division, hallid);
} }
if ("2".equals(filterby))
{
if ("2".equals(filterby)) {
return bookingService.getBookingHallDetailsReportByEventDate(fromDate, toDate, zone, division, hallid); return bookingService.getBookingHallDetailsReportByEventDate(fromDate, toDate, zone, division, hallid);
@ -314,49 +338,36 @@ public class HeadquartersController {
} }
private List<Object[]> handleBookingRequest(String request, String fromDate, String toDate, String bookingStatus, String filterby, Long bookingId, String zone, String division, Integer hallid) { private List<Object[]> handleBookingRequest(String request, String fromDate, String toDate, String bookingStatus, String filterby, Long bookingId, String zone, String division, Integer hallid) {
if (!request.equals("2")) { if (!request.equals("2")) {
return new ArrayList<>(); return new ArrayList<>();
} }
if(filterby.isEmpty() && bookingStatus.isEmpty() && bookingId == null)
{
if (filterby.isEmpty() && bookingStatus.isEmpty() && bookingId == null) {
return bookingService.getBookingDetailsByBookingDate(fromDate, toDate, zone, division, hallid); return bookingService.getBookingDetailsByBookingDate(fromDate, toDate, zone, division, hallid);
} }
if(bookingId!=null && bookingStatus.isEmpty())
{
if (bookingId != null && bookingStatus.isEmpty()) {
return bookingDetailsRepo.getAllBookingDetailsWithBookingId(fromDate, toDate, bookingId); return bookingDetailsRepo.getAllBookingDetailsWithBookingId(fromDate, toDate, bookingId);
} }
if(bookingId!=null && !bookingStatus.isEmpty())
{
if (bookingId != null && !bookingStatus.isEmpty()) {
return bookingDetailsRepo.getAllBookingDetailsWithBookingIdwithbookingStatus(fromDate, toDate, bookingId, bookingStatus); return bookingDetailsRepo.getAllBookingDetailsWithBookingIdwithbookingStatus(fromDate, toDate, bookingId, bookingStatus);
} }
if(bookingId==null && filterby.isEmpty() && !bookingStatus.isEmpty())
{
if (bookingId == null && filterby.isEmpty() && !bookingStatus.isEmpty()) {
return bookingService.getBookingDetailsByBookingDateWithStatus(fromDate, toDate, bookingStatus, zone, division, hallid); return bookingService.getBookingDetailsByBookingDateWithStatus(fromDate, toDate, bookingStatus, zone, division, hallid);
} }
if(!filterby.isEmpty())
{
if (!filterby.isEmpty()) {
if ("1".equals(filterby))
{
if(bookingStatus.isEmpty())
{
if ("1".equals(filterby)) {
if (bookingStatus.isEmpty()) {
return bookingService.getBookingDetailsByBookingDate(fromDate, toDate, zone, division, hallid); return bookingService.getBookingDetailsByBookingDate(fromDate, toDate, zone, division, hallid);
}
else
{
} else {
return bookingService.getBookingDetailsByBookingDateWithStatus(fromDate, toDate, bookingStatus, zone, division, hallid); return bookingService.getBookingDetailsByBookingDateWithStatus(fromDate, toDate, bookingStatus, zone, division, hallid);
} }
} }
if ("2".equals(filterby))
{
if(bookingStatus.isEmpty())
{
if ("2".equals(filterby)) {
if (bookingStatus.isEmpty()) {
return bookingService.getBookingDetailsByEventDate(fromDate, toDate, zone, division, hallid); return bookingService.getBookingDetailsByEventDate(fromDate, toDate, zone, division, hallid);
}
else {
} else {
return bookingService.getBookingDetailsByEventDateWithStatus(fromDate, toDate, bookingStatus, zone, division, hallid); return bookingService.getBookingDetailsByEventDateWithStatus(fromDate, toDate, bookingStatus, zone, division, hallid);
} }
@ -371,36 +382,26 @@ public class HeadquartersController {
if (!request.equals("6")) { if (!request.equals("6")) {
return new ArrayList<>(); return new ArrayList<>();
} }
if(filterby.isEmpty() && refundStatus.isEmpty())
{
if (filterby.isEmpty() && refundStatus.isEmpty()) {
return bookingService.getAllBookingsettlementDetailsByBookingDate(fromDate, toDate); return bookingService.getAllBookingsettlementDetailsByBookingDate(fromDate, toDate);
} }
if(filterby.isEmpty() && !refundStatus.isEmpty())
{
if (filterby.isEmpty() && !refundStatus.isEmpty()) {
return bookingService.getAllBookingsettlementDetailsByBookingDateWithStatus(fromDate, toDate, refundStatus); return bookingService.getAllBookingsettlementDetailsByBookingDateWithStatus(fromDate, toDate, refundStatus);
} }
if(!filterby.isEmpty())
{
if (!filterby.isEmpty()) {
if ("1".equals(filterby))
{
if(refundStatus.isEmpty())
{
if ("1".equals(filterby)) {
if (refundStatus.isEmpty()) {
return bookingService.getAllBookingsettlementDetailsByBookingDate(fromDate, toDate); return bookingService.getAllBookingsettlementDetailsByBookingDate(fromDate, toDate);
}
else
{
} else {
return bookingService.getAllBookingsettlementDetailsByBookingDateWithStatus(fromDate, toDate, refundStatus); return bookingService.getAllBookingsettlementDetailsByBookingDateWithStatus(fromDate, toDate, refundStatus);
} }
} }
if ("2".equals(filterby))
{
if(refundStatus.isEmpty())
{
if ("2".equals(filterby)) {
if (refundStatus.isEmpty()) {
return bookingService.getAllBookingsettlementDetailsByEventDate(fromDate, toDate); return bookingService.getAllBookingsettlementDetailsByEventDate(fromDate, toDate);
}
else {
} else {
return bookingService.getAllBookingsettlementDetailsByEventDateWithStatus(fromDate, toDate, refundStatus); return bookingService.getAllBookingsettlementDetailsByEventDateWithStatus(fromDate, toDate, refundStatus);
} }
@ -410,6 +411,7 @@ public class HeadquartersController {
// Handle default or error case // Handle default or error case
return new ArrayList<>(); return new ArrayList<>();
} }
@GetMapping("/ongoingevents") @GetMapping("/ongoingevents")
public String viewRecentevents(Model model, HttpSession session) { public String viewRecentevents(Model model, HttpSession session) {
String headquartersname = (String) session.getAttribute("usertype"); String headquartersname = (String) session.getAttribute("usertype");
@ -564,12 +566,12 @@ public String RefundFailedList(Model model,HttpSession session) {
model.addAttribute("refundfailedcancelledbookings", refundfailedcancelledbookings); model.addAttribute("refundfailedcancelledbookings", refundfailedcancelledbookings);
model.addAttribute("refundfailedrejectedbookings", refundfailedrejectedbookings); model.addAttribute("refundfailedrejectedbookings", refundfailedrejectedbookings);
return "headquarters/refund-failedlist"; return "headquarters/refund-failedlist";
}
else {
} else {
session.invalidate(); session.invalidate();
return "redirect:/communityhall/login"; return "redirect:/communityhall/login";
} }
} }
@GetMapping("/settlement-completedlist") @GetMapping("/settlement-completedlist")
public String viewSettlementcompletedMaster(Model model, HttpSession session) { public String viewSettlementcompletedMaster(Model model, HttpSession session) {
String headquartersname = (String) session.getAttribute("usertype"); String headquartersname = (String) session.getAttribute("usertype");

58
src/main/java/com/gcc/communityHall/repository/BookingDetailsRepository.java

@ -1434,14 +1434,20 @@ public interface BookingDetailsRepository extends JpaRepository<BookingDetails,
List<BookingDetails> getAllwaitingNOC(); List<BookingDetails> getAllwaitingNOC();
@Query(value = "SELECT bd.counter_id, COUNT(*) AS total_count " +
@Query(value =
"SELECT bd.counter_id, COUNT(*) AS total_count " +
"FROM booking_details bd " + "FROM booking_details bd " +
"WHERE DATE(bd.booking_date) BETWEEN :fromDate AND :toDate " + "WHERE DATE(bd.booking_date) BETWEEN :fromDate AND :toDate " +
"AND bd.booking_status <> 'PENDING' " +
"AND bd.counter_id IS NOT NULL " + "AND bd.counter_id IS NOT NULL " +
"GROUP BY bd.counter_id", nativeQuery = true)
List<Object[]> getCounterWiseBookingCount(@Param("fromDate") String fromDate, @Param("toDate") String toDate);
"GROUP BY bd.counter_id",
nativeQuery = true)
List<Object[]> getCounterWiseBookingCount(
@Param("fromDate") String fromDate,
@Param("toDate") String toDate
);
@Query(value = "SELECT bd.counter_id, h.zone, h. division, h.hall_name, COUNT(*) as total_bookings " +
/*@Query(value = "SELECT bd.counter_id, h.zone, h. division, h.hall_name, COUNT(*) as total_bookings " +
"FROM booking_details bd " + "FROM booking_details bd " +
"JOIN hall_details h ON h.hall_id = bd.hall_details_hall_id " + "JOIN hall_details h ON h.hall_id = bd.hall_details_hall_id " +
"WHERE DATE(bd.booking_date) BETWEEN :fromDate AND :toDate " + "WHERE DATE(bd.booking_date) BETWEEN :fromDate AND :toDate " +
@ -1457,6 +1463,48 @@ public interface BookingDetailsRepository extends JpaRepository<BookingDetails,
"JOIN hall_details h ON h.hall_id = bd.hall_details_hall_id " + "JOIN hall_details h ON h.hall_id = bd.hall_details_hall_id " +
"WHERE DATE(bd.booking_date) BETWEEN :fromDate AND :toDate " + "WHERE DATE(bd.booking_date) BETWEEN :fromDate AND :toDate " +
"AND bd.counter_id IS NOT NULL", nativeQuery = true) "AND bd.counter_id IS NOT NULL", nativeQuery = true)
List<Object[]> getBookingDetailsForAllHalls(@Param("fromDate") String fromDate, @Param("toDate") String toDate);
List<Object[]> getBookingDetailsForAllHalls(@Param("fromDate") String fromDate, @Param("toDate") String toDate);*/
@Query(value =
"SELECT bd.counter_id, h.zone, h.division, h.hall_name, COUNT(*) AS total_bookings " +
"FROM booking_details bd " +
"JOIN hall_details h ON h.hall_id = bd.hall_details_hall_id " +
"WHERE DATE(bd.booking_date) BETWEEN :fromDate AND :toDate " +
"AND bd.counter_id IS NOT NULL " +
"AND bd.booking_status <> 'PENDING' " +
"AND (:counterId IS NULL OR bd.counter_id = :counterId) " +
"GROUP BY bd.counter_id, h.zone, h.division, h.hall_name",
nativeQuery = true)
List<Object[]> getHallWiseBookingDetails(
@Param("fromDate") String fromDate,
@Param("toDate") String toDate,
@Param("counterId") String counterId
);
@Query(value = " SELECT bd.booking_id, h.hall_name, bd.booking_date, bd.start_date, " +
"bd.end_date, bd.starting_slot, bd.ending_slot, bd.no_of_days, bd.reason, " +
"bd.amount_received, bd.hall_amount, bd.deposit_amount, bd.gst, bd.booking_status, " +
"bd.booking_type FROM booking_details bd " +
"JOIN hall_details h ON h.hall_id = bd.hall_details_hall_id " +
"WHERE DATE(bd.booking_date) BETWEEN :fromDate AND :toDate " +
"AND bd.counter_id IS NOT NULL " +
"AND ( :counterId IS NULL OR bd.counter_id = :counterId ) " +
"AND ( :hallid IS NULL OR bd.hall_details_hall_id = :hallid ) " +
"AND bd.booking_status <> 'PENDING' ", nativeQuery = true)
List<Object[]> getBookingDetailsForAllHalls(
@Param("fromDate") String fromDate,
@Param("toDate") String toDate,
@Param("counterId") String counterId,
@Param("hallid") Integer hallid
);
@Query(value = " SELECT bd.booking_id, h.hall_name, bd.booking_date, bd.start_date, " +
"bd.end_date, bd.starting_slot, bd.ending_slot, bd.no_of_days, bd.reason, " +
"bd.amount_received, bd.hall_amount, bd.deposit_amount, bd.gst, bd.booking_status, " +
"bd.booking_type, bd.counter_id FROM booking_details bd " +
"JOIN hall_details h ON h.hall_id = bd.hall_details_hall_id " +
"WHERE DATE(bd.booking_date) BETWEEN :fromDate AND :toDate " +
"AND bd.counter_id IS NOT NULL " +
"AND bd.booking_status <> 'PENDING' GROUP BY bd.counter_id, bd.booking_id ", nativeQuery = true)
List<Object[]> getCounterWiseBookingDetails(String fromDate, String toDate);
} }

5
src/main/java/com/gcc/communityHall/service/BookingService.java

@ -207,8 +207,9 @@ public interface BookingService {
List<Object[]> getCounterWiseBookingCount(String fromDate, String toDate); List<Object[]> getCounterWiseBookingCount(String fromDate, String toDate);
List<Object[]> getHallWiseBookingDetails(String fromDate, String toDate);
List<Object[]> getHallWiseBookingDetails(String fromDate, String toDate, String CounterId);
List<Object[]> getBookingDetailsForAllHalls(String fromDate, String toDate);
List<Object[]> getBookingDetailsForAllHalls(String fromDate, String toDate, String CounterId, Integer hallid);
List<Object[]> getCounterWiseBookingDetails(String fromDate, String toDate);
} }

17
src/main/java/com/gcc/communityHall/service/Impl/BookingServiceImpl.java

@ -2453,7 +2453,7 @@ public class BookingServiceImpl implements BookingService {
return bookingDetailsRepository.getCounterWiseBookingCount(fromDate, toDate); return bookingDetailsRepository.getCounterWiseBookingCount(fromDate, toDate);
} }
@Override
/*@Override
public List<Object[]> getHallWiseBookingDetails(String fromDate, String toDate) { public List<Object[]> getHallWiseBookingDetails(String fromDate, String toDate) {
return bookingDetailsRepository.getHallWiseBookingDetails(fromDate, toDate); return bookingDetailsRepository.getHallWiseBookingDetails(fromDate, toDate);
} }
@ -2461,6 +2461,21 @@ public class BookingServiceImpl implements BookingService {
@Override @Override
public List<Object[]> getBookingDetailsForAllHalls(String fromDate, String toDate){ public List<Object[]> getBookingDetailsForAllHalls(String fromDate, String toDate){
return bookingDetailsRepository.getBookingDetailsForAllHalls(fromDate,toDate); return bookingDetailsRepository.getBookingDetailsForAllHalls(fromDate,toDate);
}*/
@Override
public List<Object[]> getHallWiseBookingDetails(String fromDate, String toDate, String counterId) {
return bookingDetailsRepository.getHallWiseBookingDetails(fromDate, toDate,counterId);
}
@Override
public List<Object[]> getBookingDetailsForAllHalls(String fromDate, String toDate, String counterId,Integer hallid){
return bookingDetailsRepository.getBookingDetailsForAllHalls(fromDate,toDate,counterId,hallid);
}
@Override
public List<Object[]> getCounterWiseBookingDetails(String fromDate, String toDate){
return bookingDetailsRepository.getCounterWiseBookingDetails(fromDate,toDate);
} }
} }

129
src/main/resources/templates/admin/reports.html

@ -304,6 +304,20 @@
</select> </select>
</div> </div>
<div class="col-sm-3 mb-2" id="counterreportDropdown" style="display: none;">
<label class="form-label" for="reporttype">Report Type: <span
class="text-danger">*</span></label>
<select class="form-control text-center" id="reporttype" name="reporttype"
th:value="${reporttype}">
<option value="">Select</option>
<option value="abstract" th:selected="${reporttype == 'abstract'}">Abstract
</option>
<option value="detailed" th:selected="${reporttype == 'detailed'}">Detailed Report
</option>
</select>
<span id="reportTypeError" class="text-danger"></span>
</div>
<div class="col-sm-3"> <div class="col-sm-3">
<br> <br>
@ -620,6 +634,7 @@
</div> </div>
<!--<div class="table-responsive" id="countertable" th:if="${request == '9'}">--> <!--<div class="table-responsive" id="countertable" th:if="${request == '9'}">-->
<div class="table-responsive" id="countertable" th:if="${request}==9"> <div class="table-responsive" id="countertable" th:if="${request}==9">
<div th:if="${reporttype == 'abstract'}">
<table id="requestTable9" class="table table-striped table-bordered table-hover dataTable" <table id="requestTable9" class="table table-striped table-bordered table-hover dataTable"
role="grid" width="99.5%"> role="grid" width="99.5%">
<thead class="thead-dark"> <thead class="thead-dark">
@ -648,6 +663,61 @@
</tbody> </tbody>
</table> </table>
</div> </div>
<div th:if="${reporttype == 'detailed'}">
<table id="detailedrequestTable" class="table table-striped table-bordered table-hover dataTable"
role="grid" width="99.5%">
<thead class="thead-dark">
<tr role="row">
<th>S.No</th>
<th>Booking ID</th>
<th>Hall Name</th>
<th>Booking Date</th>
<th>Start Date</th>
<th>End Date</th>
<th>Starting Slot</th>
<th>Ending Slot</th>
<th>No.of.Days</th>
<th>Reason for Booking</th>
<th>Hall Amount</th>
<th>Deposit Amount</th>
<th>GSt</th>
<th>Amount Received</th>
<th>Booking Status</th>
<th>Booking Type</th>
<th>Counter Id</th>
<th>View</th>
</tr>
</thead>
<tbody>
<tr th:each="counterdata, iterstat : ${counterBookingList}">
<td th:text="${iterstat.index + 1}"></td>
<td th:text="${counterdata[0]}"></td>
<td th:text="${counterdata[1]}"></td>
<td th:text="${counterdata[2]}"></td>
<td th:text="${counterdata[3]}"></td>
<td th:text="${counterdata[4]}"></td>
<td th:text="${counterdata[5]}"></td>
<td th:text="${counterdata[6]}"></td>
<td th:text="${counterdata[7]}"></td>
<td th:text="${counterdata[8]}"></td>
<td th:text="${counterdata[9]}"></td>
<td th:text="${counterdata[10]}"></td>
<td th:text="${counterdata[11]}"></td>
<td th:text="${counterdata[12]}"></td>
<td th:text="${counterdata[13]}"></td>
<td th:text="${counterdata[14]}"></td>
<td th:text="${counterdata[15]}"></td>
<td>
<p>
<span class="badge bg-warning" style="cursor: pointer;"
th:onclick="viewDetails([[${counterdata[0]}]])">View</span>
</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div> </div>
@ -1487,6 +1557,9 @@
} else if (tableId === 'hallDetailsTable') { } else if (tableId === 'hallDetailsTable') {
orientation = 'landscape'; orientation = 'landscape';
pageSize = 'A3'; pageSize = 'A3';
} else if (tableId === 'detailedrequestTable') {
orientation = 'landscape';
pageSize = 'A3';
} }
return [{ return [{
@ -1538,7 +1611,7 @@
}); });
// Tables with custom PDF buttons // Tables with custom PDF buttons
['requestTable9', 'modalBookingTable', 'hallDetailsTable'].forEach(function (tableId) {
['requestTable9', 'modalBookingTable', 'hallDetailsTable', 'detailedrequestTable'].forEach(function (tableId) {
$('#' + tableId).DataTable({ $('#' + tableId).DataTable({
dom: 'Bftip', dom: 'Bftip',
columnDefs: [{ columnDefs: [{
@ -1632,36 +1705,13 @@
} }
// document.addEventListener("DOMContentLoaded", function () {
// const form = document.getElementById('myForm'); // Change selector if needed
// var requestValue = document.getElementById("request").value;
// if(requestValue ==="7"){
// console.log("inside 7");
// const basedonSelect = document.getElementById('basedon');
// const errorSpan = document.getElementById('basedonError');
//
// form.addEventListener("submit", function (event) {
// console.log("basedonSelect.value====="+basedonSelect.value);
// if (basedonSelect.value === "") {
// event.preventDefault(); // Stop form submission
// errorSpan.textContent = "Please select a value.";
// basedonSelect.classList.add("is-invalid"); // Optional: Bootstrap styling
// }
// else {
// errorSpan.textContent = "";
// basedonSelect.classList.remove("is-invalid");
// }
// });
// }
//
// });
document.addEventListener("DOMContentLoaded", function () { document.addEventListener("DOMContentLoaded", function () {
const form = document.getElementById('myForm'); const form = document.getElementById('myForm');
const basedonSelect = document.getElementById('basedon'); const basedonSelect = document.getElementById('basedon');
const errorSpan = document.getElementById('basedonError'); const errorSpan = document.getElementById('basedonError');
const request = document.getElementById('request'); const request = document.getElementById('request');
const reportTypeSelect = document.getElementById('reporttype');
const reportTypeerror = document.getElementById('reportTypeError');
form.addEventListener("submit", function (event) { form.addEventListener("submit", function (event) {
const requestValue = request.value; const requestValue = request.value;
@ -1678,6 +1728,18 @@
errorSpan.textContent = ""; errorSpan.textContent = "";
basedonSelect.classList.remove("is-invalid"); basedonSelect.classList.remove("is-invalid");
} }
} else if (requestValue === "9") {
console.log("inside 9");
console.log("reportTypeSelect.value=====" + reportTypeSelect.value);
if (reportTypeSelect.value === "") {
event.preventDefault(); // Stop form submission
reportTypeerror.textContent = "Please select a value.";
reportTypeSelect.classList.add("is-invalid");
} else {
reportTypeerror.textContent = "";
reportTypeSelect.classList.remove("is-invalid");
}
} }
}); });
@ -1685,10 +1747,13 @@
this.classList.remove("is-invalid"); this.classList.remove("is-invalid");
document.getElementById("basedonError").textContent = ""; document.getElementById("basedonError").textContent = "";
}); });
document.getElementById("reporttype").addEventListener("change", function () {
this.classList.remove("is-invalid");
document.getElementById("reportTypeError").textContent = "";
});
}); });
// Function to manage the display of dropdowns based on the request type // Function to manage the display of dropdowns based on the request type
function myRequest() { function myRequest() {
var requestValue = document.getElementById("request").value; var requestValue = document.getElementById("request").value;
@ -1705,6 +1770,7 @@
document.getElementById("hallContainer").style.display = "none"; document.getElementById("hallContainer").style.display = "none";
document.getElementById("bookingcountbasedonDropdown").style.display = "none"; document.getElementById("bookingcountbasedonDropdown").style.display = "none";
document.getElementById("paymentInfoDropdown1").style.display = "none"; document.getElementById("paymentInfoDropdown1").style.display = "none";
document.getElementById("counterreportDropdown").style.display = "none";
// Reset dropdown values // Reset dropdown values
@ -1760,6 +1826,8 @@
document.getElementById("divisionContainer").style.display = "block"; document.getElementById("divisionContainer").style.display = "block";
document.getElementById("hallContainer").style.display = "block"; document.getElementById("hallContainer").style.display = "block";
document.getElementById("paymentInfoDropdown1").style.display = "block"; document.getElementById("paymentInfoDropdown1").style.display = "block";
} else if (requestValue === "9") {
document.getElementById("counterreportDropdown").style.display = "block";
} }
} }
@ -1771,6 +1839,13 @@
}); });
}); });
document.addEventListener("DOMContentLoaded", function () {
document.getElementById("reporttype").addEventListener("change", function () {
const selectedValue = this.value;
document.getElementById("counterreportDropdown").style.display = selectedValue ? "block" : "none";
});
});
// Function to reset date fields // Function to reset date fields
function resetDate() { function resetDate() {

675
src/main/resources/templates/headquarters/reports.html
File diff suppressed because it is too large
View File

2
src/main/resources/templates/user/viewhistory.html

@ -1362,7 +1362,7 @@
name="bookingId" required> name="bookingId" required>
<label for="startDateInput" class="form-label">Start Date:</label> <label for="startDateInput" class="form-label">Start Date:</label>
<input type="text" class="form-control" id="startDateInput" <input type="text" class="form-control" id="startDateInput"
name="startDateInput" required>
name="startDateInput" required readonly>
<input type="hidden" class="form-control" id="startDatetext" <input type="hidden" class="form-control" id="startDatetext"
name="startDatetext" required> name="startDatetext" required>
</div> </div>

Loading…
Cancel
Save