Browse Source

Half Deposit Amount added and BookingServiceImpl changes

master
kanimozhi 1 year ago
parent
commit
6a701cf277
  1. 2
      src/main/java/com/gcc/communityHall/controller/AdminAPIController.java
  2. 19
      src/main/java/com/gcc/communityHall/controller/Admincontroller.java
  3. 16
      src/main/java/com/gcc/communityHall/controller/UserAPIController.java
  4. 12
      src/main/java/com/gcc/communityHall/entity/HallDetails.java
  5. 293
      src/main/java/com/gcc/communityHall/repository/BookingDetailsRepository.java
  6. 6
      src/main/java/com/gcc/communityHall/service/BookingService.java
  7. 2
      src/main/java/com/gcc/communityHall/service/HallDetailService.java
  8. 65
      src/main/java/com/gcc/communityHall/service/Impl/BookingServiceImpl.java
  9. 4
      src/main/java/com/gcc/communityHall/service/Impl/HallDetailServiceImpl.java
  10. 1
      src/main/resources/application-prod.properties
  11. 3070
      src/main/resources/templates/admin/halldetailslist.html
  12. 177
      src/main/resources/templates/admin/reports.html
  13. 8
      src/main/resources/templates/user/dashboard.html
  14. 3
      src/main/resources/templates/user/hallbookingform.html
  15. 5
      src/main/resources/templates/user/viewhallform.html

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

@ -211,6 +211,7 @@ public class AdminAPIController {
@RequestParam("hallInchargeMobno") long hallInchargeMobno, @RequestParam("hallInchargeMobno") long hallInchargeMobno,
@RequestParam("hallInchargeName") String hallInchargeName, @RequestParam("hallInchargeName") String hallInchargeName,
@RequestParam("depositAmount") float depositAmount, @RequestParam("depositAmount") float depositAmount,
@RequestParam("halfDepositAmount") float halfDepositAmount,
@RequestParam("fullDayRent") float fullDayRent, @RequestParam("fullDayRent") float fullDayRent,
@RequestParam("halfDayRent") float halfDayRent, @RequestParam("halfDayRent") float halfDayRent,
@RequestParam("parkingCapacity") String parkingCapacity, @RequestParam("parkingCapacity") String parkingCapacity,
@ -237,6 +238,7 @@ public class AdminAPIController {
hallDetails.setHallInchargeMobno(hallInchargeMobno); hallDetails.setHallInchargeMobno(hallInchargeMobno);
hallDetails.setHallInchargeName(hallInchargeName); hallDetails.setHallInchargeName(hallInchargeName);
hallDetails.setDepositAmount(depositAmount); hallDetails.setDepositAmount(depositAmount);
hallDetails.setHalfDepositAmount(halfDepositAmount);
hallDetails.setFullDayRent(fullDayRent); hallDetails.setFullDayRent(fullDayRent);
hallDetails.setHalfDayRent(halfDayRent); hallDetails.setHalfDayRent(halfDayRent);
hallDetails.setParkingCapacity(parkingCapacity); hallDetails.setParkingCapacity(parkingCapacity);

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

@ -399,6 +399,7 @@ public class Admincontroller {
public String saveHall( public String saveHall(
@RequestParam String hallName, @RequestParam String hallName,
@RequestParam float depositAmount, @RequestParam float depositAmount,
@RequestParam float halfdepositAmt,
@RequestParam float halfDayAmt, @RequestParam float halfDayAmt,
@RequestParam float fullDayAmt, @RequestParam float fullDayAmt,
@RequestParam float gst, @RequestParam float gst,
@ -422,7 +423,7 @@ public class Admincontroller {
@RequestParam("hallImages") MultipartFile[] hallImages, HttpSession session) { @RequestParam("hallImages") MultipartFile[] hallImages, HttpSession session) {
String updatedId = (String) session.getAttribute("employeeId"); String updatedId = (String) session.getAttribute("employeeId");
hallDetailService.saveHall(hallName, depositAmount, halfDayAmt, fullDayAmt, gst, hallArea, ebNumber, ebCostPerUnit, parkingCapacity, seatingCapacity, doorNo, hallDetailService.saveHall(hallName, depositAmount, halfDayAmt, fullDayAmt, gst, hallArea, ebNumber, ebCostPerUnit, parkingCapacity, seatingCapacity, doorNo,
street, area, zone, division, landMark, city, pinCode, latitude, longitude, hallInchargeName, hallInchargeNo, updatedId, hallImages);
street, area, zone, division, landMark, city, pinCode, latitude, longitude, hallInchargeName, hallInchargeNo, updatedId, hallImages, halfdepositAmt);
String adminname = (String) session.getAttribute("usertype"); String adminname = (String) session.getAttribute("usertype");
Integer loginid = (Integer) session.getAttribute("id"); Integer loginid = (Integer) session.getAttribute("id");
ApplicationLogs logs = new ApplicationLogs(); ApplicationLogs logs = new ApplicationLogs();
@ -649,6 +650,22 @@ public class Admincontroller {
model.addAttribute("reporttype", reporttype); model.addAttribute("reporttype", reporttype);
} }
if ("10".equals(request)) {
List<Object> zoneWiseBookingList = bookingService.getZoneWiseBookingList(fromDate, toDate);
model.addAttribute("zoneWiseBookingList", zoneWiseBookingList);
// Fetch all hall data (not dependent on zone dropdown yet)
List<Object> hallWiseBookingList = bookingService.getAllHallWiseBookingList(fromDate, toDate);
String hallWiseBookingJson = new ObjectMapper().writeValueAsString(hallWiseBookingList);
model.addAttribute("hallWiseBookingList", hallWiseBookingJson);
// Fetch all counter data
List<Object> counterWiseBookingList = bookingService.getAllCounterWiseBookingList(fromDate, toDate);
String counterWiseBookingJson = new ObjectMapper().writeValueAsString(counterWiseBookingList);
model.addAttribute("counterWiseBookingList", counterWiseBookingJson);
}
model.addAttribute("filterby", filterby); model.addAttribute("filterby", filterby);
model.addAttribute("users", userList); model.addAttribute("users", userList);
model.addAttribute("bookings", bookingList); model.addAttribute("bookings", bookingList);

16
src/main/java/com/gcc/communityHall/controller/UserAPIController.java

@ -1729,12 +1729,13 @@ public class UserAPIController {
double fullDayAmount = hallDetails.getFullDayRent(); double fullDayAmount = hallDetails.getFullDayRent();
double halfDayAmount = hallDetails.getHalfDayRent(); double halfDayAmount = hallDetails.getHalfDayRent();
double depositAmount = hallDetails.getDepositAmount(); double depositAmount = hallDetails.getDepositAmount();
double halfDepositAmount = hallDetails.getHalfDepositAmount();
double gstRate = hallDetails.getGst(); double gstRate = hallDetails.getGst();
Map<String, Object> response = new HashMap<>(); Map<String, Object> response = new HashMap<>();
double amount = calculateAmount(numDays, startPeriod, endPeriod, fullDayAmount, halfDayAmount); double amount = calculateAmount(numDays, startPeriod, endPeriod, fullDayAmount, halfDayAmount);
double totalDepositAmount = calculateDepositAmount(numDays, startPeriod, endPeriod, depositAmount);
double totalDepositAmount = calculateDepositAmount(numDays, startPeriod, endPeriod, depositAmount, halfDepositAmount);
double totalAmount; double totalAmount;
double discountAmount = 0.0; double discountAmount = 0.0;
response.put("reasonforBooking", reasonforBooking); response.put("reasonforBooking", reasonforBooking);
@ -1887,17 +1888,17 @@ public class UserAPIController {
} }
} }
public double calculateDepositAmount(double numDays, String startPeriod, String endPeriod, double depositAmount) {
public double calculateDepositAmount(double numDays, String startPeriod, String endPeriod, double depositAmount, double HalfDepositAmount) {
double damount = 0; double damount = 0;
// FOR FULL DAY
// If there is only one day // If there is only one day
if (numDays == 1) { if (numDays == 1) {
if ("1".equals(startPeriod) && "2".equals(endPeriod)) { if ("1".equals(startPeriod) && "2".equals(endPeriod)) {
damount = depositAmount; damount = depositAmount;
} else if ("1".equals(startPeriod) && "1".equals(endPeriod)) { } else if ("1".equals(startPeriod) && "1".equals(endPeriod)) {
damount = depositAmount;
damount = HalfDepositAmount;
} else if ("2".equals(startPeriod) && "2".equals(endPeriod)) { } else if ("2".equals(startPeriod) && "2".equals(endPeriod)) {
damount = depositAmount;
damount = HalfDepositAmount;
} else { } else {
damount = numDays; damount = numDays;
} }
@ -1906,16 +1907,15 @@ public class UserAPIController {
if ("1".equals(startPeriod) && "2".equals(endPeriod)) { if ("1".equals(startPeriod) && "2".equals(endPeriod)) {
damount = depositAmount * numDays; damount = depositAmount * numDays;
} else if ("1".equals(startPeriod) && "1".equals(endPeriod)) { } else if ("1".equals(startPeriod) && "1".equals(endPeriod)) {
damount = depositAmount * (numDays - 1) + depositAmount;
damount = depositAmount * (numDays - 1) + HalfDepositAmount;
} else if ("2".equals(startPeriod) && "2".equals(endPeriod)) { } else if ("2".equals(startPeriod) && "2".equals(endPeriod)) {
damount = depositAmount * (numDays - 1) + depositAmount;
damount = depositAmount * (numDays - 1) + HalfDepositAmount;
} else if ("2".equals(startPeriod) && "1".equals(endPeriod)) { } else if ("2".equals(startPeriod) && "1".equals(endPeriod)) {
damount = depositAmount * (numDays - 2) + depositAmount; damount = depositAmount * (numDays - 2) + depositAmount;
} else { } else {
damount = numDays; damount = numDays;
} }
} }
return damount; return damount;
} }

12
src/main/java/com/gcc/communityHall/entity/HallDetails.java

@ -56,6 +56,10 @@ public class HallDetails {
@Column(name = "deposit_amount", nullable = false) @Column(name = "deposit_amount", nullable = false)
private float depositAmount; private float depositAmount;
@Column(name = "half_deposit_amount", nullable = false)
private float halfDepositAmount;
@Column(name="full_day_rent",nullable=false) @Column(name="full_day_rent",nullable=false)
private float fullDayRent; private float fullDayRent;
@Column(name="half_day_rent",nullable=false) @Column(name="half_day_rent",nullable=false)
@ -365,4 +369,12 @@ public class HallDetails {
this.hallDetailsConcession = hallDetailsConcession; this.hallDetailsConcession = hallDetailsConcession;
} }
public float getHalfDepositAmount() {
return halfDepositAmount;
}
public void setHalfDepositAmount(float halfDepositAmount) {
this.halfDepositAmount = halfDepositAmount;
}
} }

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

@ -77,8 +77,8 @@ public interface BookingDetailsRepository extends JpaRepository<BookingDetails,
// List<BookingDetails> findFutureEventsByHallId(Integer hallId); // List<BookingDetails> findFutureEventsByHallId(Integer hallId);
@Query(value = "select count(users_user_id), us.user_status from booking_details bd inner join users us on us.user_id = bd.users_user_id \r\n"
+ "where users_user_id=:userId and booking_status in ('APPROVED','COMPLETED','WAITING_FOR_NOC','WAITING_FOR_NOC_APPROVAL') and DATE_SUB(CURDATE(), INTERVAL 1 YEAR) \r\n"
@Query(value = "select count(users_user_id), us.user_status from booking_details bd inner join users us on us.user_id = bd.users_user_id \r"
+ "where users_user_id=:userId and booking_status in ('APPROVED','COMPLETED','WAITING_FOR_NOC','WAITING_FOR_NOC_APPROVAL') and DATE_SUB(CURDATE(), INTERVAL 1 YEAR) \r"
+ "and us.user_status not in ('PENDING')", nativeQuery = true) + "and us.user_status not in ('PENDING')", nativeQuery = true)
int checkUserBookinglimitation(int userId); int checkUserBookinglimitation(int userId);
@ -143,29 +143,29 @@ public interface BookingDetailsRepository extends JpaRepository<BookingDetails,
"bd.hall_details_hall_id", nativeQuery = true) "bd.hall_details_hall_id", nativeQuery = true)
List<Object[]> getBookingHallDetailsReport(@Param("fromDate") String fromDate, @Param("toDate") String toDate); List<Object[]> getBookingHallDetailsReport(@Param("fromDate") String fromDate, @Param("toDate") String toDate);
@Query(value = "SELECT \r\n"
+ " COALESCE( SUM(\r\n"
+ " CASE \r\n"
+ " WHEN start_date = CURDATE() THEN 1\r\n"
+ " ELSE 0\r\n"
+ " END\r\n"
+ " ),0) AS currente,\r\n"
+ " COALESCE( SUM(\r\n"
+ " CASE \r\n"
+ " \r\n"
+ " WHEN start_date < CURDATE() THEN 1\r\n"
+ " ELSE 0\r\n"
+ " END\r\n"
+ " ), 0) AS past,\r\n"
+ " COALESCE( SUM(\r\n"
+ " CASE \r\n"
+ " \r\n"
+ " WHEN start_date > CURDATE() THEN 1\r\n"
+ " ELSE 0\r\n"
+ " END\r\n"
+ " ),0) AS FUTURE\r\n"
+ "FROM \r\n"
+ " booking_details hall\r\n"
@Query(value = "SELECT \r"
+ " COALESCE( SUM(\r"
+ " CASE \r"
+ " WHEN start_date = CURDATE() THEN 1\r"
+ " ELSE 0\r"
+ " END\r"
+ " ),0) AS currente,\r"
+ " COALESCE( SUM(\r"
+ " CASE \r"
+ " \r"
+ " WHEN start_date < CURDATE() THEN 1\r"
+ " ELSE 0\r"
+ " END\r"
+ " ), 0) AS past,\r"
+ " COALESCE( SUM(\r"
+ " CASE \r"
+ " \r"
+ " WHEN start_date > CURDATE() THEN 1\r"
+ " ELSE 0\r"
+ " END\r"
+ " ),0) AS FUTURE\r"
+ "FROM \r"
+ " booking_details hall\r"
+ " where hall_details_hall_id= :hall_id and booking_status='APPROVED'", nativeQuery = true) + " where hall_details_hall_id= :hall_id and booking_status='APPROVED'", nativeQuery = true)
List<Map<String, Object>> pieChartCount(int hall_id); List<Map<String, Object>> pieChartCount(int hall_id);
@ -242,102 +242,102 @@ public interface BookingDetailsRepository extends JpaRepository<BookingDetails,
// @Param("toDate") String toDate, // @Param("toDate") String toDate,
// @Param("paymentStatus") String paymentStatus); // @Param("paymentStatus") String paymentStatus);
@Query(value = "SELECT SUM(CASE WHEN bd.booking_status = 'APPROVED' THEN 1 ELSE 0 END) AS approved_booking_count,\r\n"
+ "SUM(CASE WHEN bd.booking_status = 'REJECTED' THEN 1 ELSE 0 END) AS rejected_booking_count,\r\n"
+ "SUM(CASE WHEN bd.refund_status = 'WAITING' THEN 1 ELSE 0 END) AS waiting_settlement_count,\r\n"
+ "SUM(CASE WHEN bd.refund_status = 'APPROVED' THEN 1 ELSE 0 END) AS approved_settlement_count,\r\n"
+ "SUM(CASE WHEN bd.refund_status = 'REJECTED' THEN 1 ELSE 0 END) AS reject_settlement_count\r\n"
@Query(value = "SELECT SUM(CASE WHEN bd.booking_status = 'APPROVED' THEN 1 ELSE 0 END) AS approved_booking_count,\r"
+ "SUM(CASE WHEN bd.booking_status = 'REJECTED' THEN 1 ELSE 0 END) AS rejected_booking_count,\r"
+ "SUM(CASE WHEN bd.refund_status = 'WAITING' THEN 1 ELSE 0 END) AS waiting_settlement_count,\r"
+ "SUM(CASE WHEN bd.refund_status = 'APPROVED' THEN 1 ELSE 0 END) AS approved_settlement_count,\r"
+ "SUM(CASE WHEN bd.refund_status = 'REJECTED' THEN 1 ELSE 0 END) AS reject_settlement_count\r"
+ "FROM booking_details bd " + "FROM booking_details bd "
+ "JOIN hall_details hd ON bd.hall_details_hall_id = hd.hall_id " + "JOIN hall_details hd ON bd.hall_details_hall_id = hd.hall_id "
+ "WHERE hd.zone = :zone", nativeQuery = true) + "WHERE hd.zone = :zone", nativeQuery = true)
List<Map<String, Object>> toatlBookingCount(String zone); List<Map<String, Object>> toatlBookingCount(String zone);
@Query(value = " SELECT SUM(CASE WHEN booking_status = 'APPROVED' THEN 1 ELSE 0 END) AS approved_count,\r\n"
+ " SUM(CASE WHEN bd.booking_status = 'REJECTED' THEN 1 ELSE 0 END) AS rejected_count,\r\n"
+ " SUM(CASE WHEN bd.booking_status = 'PENDING' THEN 1 ELSE 0 END) AS pending_count,\r\n"
+ " SUM(CASE WHEN bd.booking_status = 'CANCELED' THEN 1 ELSE 0 END) AS CANCELED,\r\n"
+ " SUM(CASE WHEN bd.booking_status = 'PAYMENT_FAILURE' THEN 1 ELSE 0 END) AS PAYMENT_FAILURE,\r\n"
+ " SUM(CASE WHEN bd.booking_status = 'GCC_BLOCKED' THEN 1 ELSE 0 END) AS GCC_BLOCKED\r\n"
@Query(value = " SELECT SUM(CASE WHEN booking_status = 'APPROVED' THEN 1 ELSE 0 END) AS approved_count,\r"
+ " SUM(CASE WHEN bd.booking_status = 'REJECTED' THEN 1 ELSE 0 END) AS rejected_count,\r"
+ " SUM(CASE WHEN bd.booking_status = 'PENDING' THEN 1 ELSE 0 END) AS pending_count,\r"
+ " SUM(CASE WHEN bd.booking_status = 'CANCELED' THEN 1 ELSE 0 END) AS CANCELED,\r"
+ " SUM(CASE WHEN bd.booking_status = 'PAYMENT_FAILURE' THEN 1 ELSE 0 END) AS PAYMENT_FAILURE,\r"
+ " SUM(CASE WHEN bd.booking_status = 'GCC_BLOCKED' THEN 1 ELSE 0 END) AS GCC_BLOCKED\r"
+ "FROM booking_details bd " + "FROM booking_details bd "
+ "JOIN hall_details hd ON bd.hall_details_hall_id = hd.hall_id " + "JOIN hall_details hd ON bd.hall_details_hall_id = hd.hall_id "
+ "WHERE hd.zone = :zone", nativeQuery = true) + "WHERE hd.zone = :zone", nativeQuery = true)
List<Map<String, Object>> getCount(String zone); List<Map<String, Object>> getCount(String zone);
@Query(value = "SELECT CONCAT(YEAR(bd.start_date), '-', LPAD(MONTH(bd.start_date), 2, '0')) AS months, SUM(CASE WHEN booking_status = 'APPROVED' THEN 1 ELSE 0 END) AS approved_count,\r\n"
+ " SUM(CASE WHEN bd.booking_status = 'REJECTED' THEN 1 ELSE 0 END) AS rejected_count,\r\n"
+ " SUM(CASE WHEN bd.booking_status = 'PENDING' THEN 1 ELSE 0 END) AS pending_count\r\n"
+ "FROM booking_details bd JOIN hall_details hd ON bd.hall_details_hall_id = hd.hall_id \r\n"
+ "WHERE bd.start_date >= DATE_SUB(CURDATE(), INTERVAL 6 MONTH)\r\n"
+ " AND bd.start_date <= DATE_ADD(CURDATE(), INTERVAL 6 MONTH) AND hd.zone = :zone \r\n"
@Query(value = "SELECT CONCAT(YEAR(bd.start_date), '-', LPAD(MONTH(bd.start_date), 2, '0')) AS months, SUM(CASE WHEN booking_status = 'APPROVED' THEN 1 ELSE 0 END) AS approved_count,\r"
+ " SUM(CASE WHEN bd.booking_status = 'REJECTED' THEN 1 ELSE 0 END) AS rejected_count,\r"
+ " SUM(CASE WHEN bd.booking_status = 'PENDING' THEN 1 ELSE 0 END) AS pending_count\r"
+ "FROM booking_details bd JOIN hall_details hd ON bd.hall_details_hall_id = hd.hall_id \r"
+ "WHERE bd.start_date >= DATE_SUB(CURDATE(), INTERVAL 6 MONTH)\r"
+ " AND bd.start_date <= DATE_ADD(CURDATE(), INTERVAL 6 MONTH) AND hd.zone = :zone \r"
+ " group by months order by months ASC", nativeQuery = true) + " group by months order by months ASC", nativeQuery = true)
List<Map<String, Object>> getmounthcount(String zone); List<Map<String, Object>> getmounthcount(String zone);
@Query(value = "SELECT CONCAT(YEAR(bd.start_date), '-', LPAD(MONTH(bd.start_date), 2, '0')) AS months, SUM(CASE WHEN booking_status = 'APPROVED' THEN 1 ELSE 0 END) AS approved_count,\r\n"
+ " SUM(CASE WHEN bd.booking_status = 'REJECTED' THEN 1 ELSE 0 END) AS rejected_count,\r\n"
+ " SUM(CASE WHEN bd.booking_status = 'PENDING' THEN 1 ELSE 0 END) AS pending_count\r\n"
+ "FROM booking_details bd JOIN hall_details hd ON bd.hall_details_hall_id = hd.hall_id \r\n"
+ "WHERE bd.start_date >= DATE_SUB(CURDATE(), INTERVAL 6 MONTH)\r\n"
+ " AND bd.start_date <= DATE_ADD(CURDATE(), INTERVAL 6 MONTH) \r\n"
+ "AND (:zone = 'all zones' OR hd.zone = :zone)\r\n "
@Query(value = "SELECT CONCAT(YEAR(bd.start_date), '-', LPAD(MONTH(bd.start_date), 2, '0')) AS months, SUM(CASE WHEN booking_status = 'APPROVED' THEN 1 ELSE 0 END) AS approved_count,\r"
+ " SUM(CASE WHEN bd.booking_status = 'REJECTED' THEN 1 ELSE 0 END) AS rejected_count,\r"
+ " SUM(CASE WHEN bd.booking_status = 'PENDING' THEN 1 ELSE 0 END) AS pending_count\r"
+ "FROM booking_details bd JOIN hall_details hd ON bd.hall_details_hall_id = hd.hall_id \r"
+ "WHERE bd.start_date >= DATE_SUB(CURDATE(), INTERVAL 6 MONTH)\r"
+ " AND bd.start_date <= DATE_ADD(CURDATE(), INTERVAL 6 MONTH) \r"
+ "AND (:zone = 'all zones' OR hd.zone = :zone)\r "
+ " group by months order by months ASC", nativeQuery = true) + " group by months order by months ASC", nativeQuery = true)
List<Map<String, Object>> getAllAdminmonthcount(@Param("zone") String zone); List<Map<String, Object>> getAllAdminmonthcount(@Param("zone") String zone);
@Query(value = " SELECT SUM(CASE WHEN booking_status = 'APPROVED' THEN 1 ELSE 0 END) AS approved_count,\r\n"
+ " SUM(CASE WHEN bd.booking_status = 'REJECTED' THEN 1 ELSE 0 END) AS rejected_count,\r\n"
+ " SUM(CASE WHEN bd.booking_status = 'PENDING' THEN 1 ELSE 0 END) AS pending_count,\r\n"
+ " SUM(CASE WHEN bd.booking_status = 'CANCELED' THEN 1 ELSE 0 END) AS CANCELED,\r\n"
+ " SUM(CASE WHEN bd.booking_status = 'PAYMENT_FAILURE' THEN 1 ELSE 0 END) AS PAYMENT_FAILURE,\r\n"
+ " SUM(CASE WHEN bd.booking_status = 'GCC_BLOCKED' THEN 1 ELSE 0 END) AS GCC_BLOCKED\r\n"
@Query(value = " SELECT SUM(CASE WHEN booking_status = 'APPROVED' THEN 1 ELSE 0 END) AS approved_count,\r"
+ " SUM(CASE WHEN bd.booking_status = 'REJECTED' THEN 1 ELSE 0 END) AS rejected_count,\r"
+ " SUM(CASE WHEN bd.booking_status = 'PENDING' THEN 1 ELSE 0 END) AS pending_count,\r"
+ " SUM(CASE WHEN bd.booking_status = 'CANCELED' THEN 1 ELSE 0 END) AS CANCELED,\r"
+ " SUM(CASE WHEN bd.booking_status = 'PAYMENT_FAILURE' THEN 1 ELSE 0 END) AS PAYMENT_FAILURE,\r"
+ " SUM(CASE WHEN bd.booking_status = 'GCC_BLOCKED' THEN 1 ELSE 0 END) AS GCC_BLOCKED\r"
+ "FROM booking_details bd " + "FROM booking_details bd "
+ "JOIN hall_details hd ON bd.hall_details_hall_id = hd.hall_id " + "JOIN hall_details hd ON bd.hall_details_hall_id = hd.hall_id "
+ "WHERE (:zone = 'all zones' OR hd.zone = :zone)", nativeQuery = true) + "WHERE (:zone = 'all zones' OR hd.zone = :zone)", nativeQuery = true)
List<Map<String, Object>> getAdmincount(@Param("zone") String zone); List<Map<String, Object>> getAdmincount(@Param("zone") String zone);
@Query(value = "SELECT CONCAT(YEAR(bd.start_date), '-', LPAD(MONTH(bd.start_date), 2, '0')) AS months, SUM(CASE WHEN booking_status = 'APPROVED' THEN 1 ELSE 0 END) AS approved_count,\r\n"
+ " SUM(CASE WHEN bd.booking_status = 'REJECTED' THEN 1 ELSE 0 END) AS rejected_count,\r\n"
+ " SUM(CASE WHEN bd.booking_status = 'COMPLETED' THEN 1 ELSE 0 END) AS completed_count\r\n"
+ "FROM booking_details bd JOIN hall_details hd ON bd.hall_details_hall_id = hd.hall_id \r\n"
+ "WHERE bd.start_date >= DATE_SUB(CURDATE(), INTERVAL 6 MONTH)\r\n"
+ " AND bd.start_date <= DATE_ADD(CURDATE(), INTERVAL 6 MONTH) AND hd.hall_id=:hall_id \r\n"
@Query(value = "SELECT CONCAT(YEAR(bd.start_date), '-', LPAD(MONTH(bd.start_date), 2, '0')) AS months, SUM(CASE WHEN booking_status = 'APPROVED' THEN 1 ELSE 0 END) AS approved_count,\r"
+ " SUM(CASE WHEN bd.booking_status = 'REJECTED' THEN 1 ELSE 0 END) AS rejected_count,\r"
+ " SUM(CASE WHEN bd.booking_status = 'COMPLETED' THEN 1 ELSE 0 END) AS completed_count\r"
+ "FROM booking_details bd JOIN hall_details hd ON bd.hall_details_hall_id = hd.hall_id \r"
+ "WHERE bd.start_date >= DATE_SUB(CURDATE(), INTERVAL 6 MONTH)\r"
+ " AND bd.start_date <= DATE_ADD(CURDATE(), INTERVAL 6 MONTH) AND hd.hall_id=:hall_id \r"
+ " group by months order by months ASC", nativeQuery = true) + " group by months order by months ASC", nativeQuery = true)
List<Map<String, Object>> getCartakermounthcount(int hall_id); List<Map<String, Object>> getCartakermounthcount(int hall_id);
@Query(value = " SELECT SUM(CASE WHEN booking_status = 'APPROVED' THEN 1 ELSE 0 END) AS approved_count,\r\n"
+ " SUM(CASE WHEN bd.booking_status = 'REJECTED' THEN 1 ELSE 0 END) AS rejected_count,\r\n"
+ " SUM(CASE WHEN bd.booking_status = 'COMPLETED' THEN 1 ELSE 0 END) AS completed_count,\r\n"
+ " SUM(CASE WHEN bd.booking_status = 'CANCELED' THEN 1 ELSE 0 END) AS CANCELED,\r\n"
+ " SUM(CASE WHEN bd.booking_status = 'PAYMENT_FAILURE' THEN 1 ELSE 0 END) AS PAYMENT_FAILURE,\r\n"
+ " SUM(CASE WHEN bd.booking_status = 'GCC_BLOCKED' THEN 1 ELSE 0 END) AS GCC_BLOCKED\r\n"
@Query(value = " SELECT SUM(CASE WHEN booking_status = 'APPROVED' THEN 1 ELSE 0 END) AS approved_count,\r"
+ " SUM(CASE WHEN bd.booking_status = 'REJECTED' THEN 1 ELSE 0 END) AS rejected_count,\r"
+ " SUM(CASE WHEN bd.booking_status = 'COMPLETED' THEN 1 ELSE 0 END) AS completed_count,\r"
+ " SUM(CASE WHEN bd.booking_status = 'CANCELED' THEN 1 ELSE 0 END) AS CANCELED,\r"
+ " SUM(CASE WHEN bd.booking_status = 'PAYMENT_FAILURE' THEN 1 ELSE 0 END) AS PAYMENT_FAILURE,\r"
+ " SUM(CASE WHEN bd.booking_status = 'GCC_BLOCKED' THEN 1 ELSE 0 END) AS GCC_BLOCKED\r"
+ "FROM booking_details bd " + "FROM booking_details bd "
+ "JOIN hall_details hd ON bd.hall_details_hall_id = hd.hall_id where hd.hall_id=:hall_id", nativeQuery = true) + "JOIN hall_details hd ON bd.hall_details_hall_id = hd.hall_id where hd.hall_id=:hall_id", nativeQuery = true)
List<Map<String, Object>> getcartakecount(int hall_id); List<Map<String, Object>> getcartakecount(int hall_id);
@Query(value = "SELECT \r\n"
+ " bd.*, \r\n"
+ " CASE \r\n"
+ " WHEN bd.start_date < CURDATE() THEN 'Past'\r\n"
+ " WHEN bd.start_date = CURDATE() THEN 'Current'\r\n"
+ " WHEN bd.booking_status = 'WAITING_FOR_NOC' THEN 'waitingfornoc'\r\n"
+ " WHEN bd.booking_status = 'WAITING_FOR_NOC_APPROVAL' THEN 'waitingfornocapproval'\r\n"
+ " WHEN bd.schedule_count = 0 AND bd.start_date > CURDATE() THEN 'Reschedule'\r\n"
@Query(value = "SELECT \r"
+ " bd.*, \r"
+ " CASE \r"
+ " WHEN bd.start_date < CURDATE() THEN 'Past'\r"
+ " WHEN bd.start_date = CURDATE() THEN 'Current'\r"
+ " WHEN bd.booking_status = 'WAITING_FOR_NOC' THEN 'waitingfornoc'\r"
+ " WHEN bd.booking_status = 'WAITING_FOR_NOC_APPROVAL' THEN 'waitingfornocapproval'\r"
+ " WHEN bd.schedule_count = 0 AND bd.start_date > CURDATE() THEN 'Reschedule'\r"
+ " WHEN bd.reason IN ('State Govt Event','Central Govt Event','Commericial & Others') AND bd.booking_status='APPROVED' THEN 'noaction'" + " WHEN bd.reason IN ('State Govt Event','Central Govt Event','Commericial & Others') AND bd.booking_status='APPROVED' THEN 'noaction'"
+ " ELSE 'Future' \r\n"
+ " END AS event_category,\r\n"
+ " users.*, \r\n"
+ " hd.*, \r\n"
+ " cd.*, \r\n"
+ " pd.* \r\n"
+ "FROM booking_details bd \r\n"
+ "INNER JOIN users users ON bd.users_user_id = users.user_id \r\n"
+ "INNER JOIN hall_details hd ON hd.hall_id = bd.hall_details_hall_id \r\n"
+ "LEFT JOIN counter_details cd ON cd.counter_id = bd.counterdetails_counter_id\r\n"
+ "LEFT JOIN payments pd ON bd.booking_id = pd.booking_details_booking_id \r\n"
+ "WHERE bd.users_user_id = :userId and booking_status IN ('GCC_BLOCKED', 'APPROVED','CANCELED','REJECTED','COMPLETED','WAITING_FOR_NOC','WAITING_FOR_NOC_APPROVAL') \r\n"
+ "ORDER BY bd.booking_id DESC\r\n", nativeQuery = true)
+ " ELSE 'Future' \r"
+ " END AS event_category,\r"
+ " users.*, \r"
+ " hd.*, \r"
+ " cd.*, \r"
+ " pd.* \r"
+ "FROM booking_details bd \r"
+ "INNER JOIN users users ON bd.users_user_id = users.user_id \r"
+ "INNER JOIN hall_details hd ON hd.hall_id = bd.hall_details_hall_id \r"
+ "LEFT JOIN counter_details cd ON cd.counter_id = bd.counterdetails_counter_id\r"
+ "LEFT JOIN payments pd ON bd.booking_id = pd.booking_details_booking_id \r"
+ "WHERE bd.users_user_id = :userId and booking_status IN ('GCC_BLOCKED', 'APPROVED','CANCELED','REJECTED','COMPLETED','WAITING_FOR_NOC','WAITING_FOR_NOC_APPROVAL') \r"
+ "ORDER BY bd.booking_id DESC\r", nativeQuery = true)
List<Map<String, Object>> getAllBookingEventsByUserId(Integer userId); List<Map<String, Object>> getAllBookingEventsByUserId(Integer userId);
//counter //counter
@ -775,23 +775,23 @@ public interface BookingDetailsRepository extends JpaRepository<BookingDetails,
@Param("userType") String userType @Param("userType") String userType
); );
@Query(value = "SELECT \r\n"
+ " b.booking_date as booking_date,\r\n"
+ " u.name as name,\r\n"
+ " u.usertype as usertype,\r\n"
+ " b.reason as reason,\r\n"
+ " b.start_date as start_date,\r\n"
+ " b.end_date as end_date,\r\n"
+ " b.no_of_days as no_of_days,\r\n"
+ " b.booking_status as booking_status,\r\n"
+ " b.amount_received as amount_received,\r\n"
+ " COALESCE(rt.amount_refunded, 0) as amount_refunded,\r\n"
+ " COALESCE(r.balace_amount, 0) as balance_amount\r\n"
+ "FROM booking_details b\r\n"
+ "JOIN hall_details h ON b.hall_details_hall_id = h.hall_id \r\n"
+ "LEFT JOIN users u ON b.users_user_id = u.user_id\r\n"
+ "LEFT JOIN refund_response r ON b.booking_id = r.booking_id\r\n"
+ "LEFT JOIN refund_transaction rt ON b.booking_id = rt.booking_details_booking_id\r\n"
@Query(value = "SELECT \r"
+ " b.booking_date as booking_date,\r"
+ " u.name as name,\r"
+ " u.usertype as usertype,\r"
+ " b.reason as reason,\r"
+ " b.start_date as start_date,\r"
+ " b.end_date as end_date,\r"
+ " b.no_of_days as no_of_days,\r"
+ " b.booking_status as booking_status,\r"
+ " b.amount_received as amount_received,\r"
+ " COALESCE(rt.amount_refunded, 0) as amount_refunded,\r"
+ " COALESCE(r.balace_amount, 0) as balance_amount\r"
+ "FROM booking_details b\r"
+ "JOIN hall_details h ON b.hall_details_hall_id = h.hall_id \r"
+ "LEFT JOIN users u ON b.users_user_id = u.user_id\r"
+ "LEFT JOIN refund_response r ON b.booking_id = r.booking_id\r"
+ "LEFT JOIN refund_transaction rt ON b.booking_id = rt.booking_details_booking_id\r"
+ "WHERE h.hall_id = :hallId AND b.booking_status != 'PENDING' ", nativeQuery = true) + "WHERE h.hall_id = :hallId AND b.booking_status != 'PENDING' ", nativeQuery = true)
List<Map<String, Object>> getBookingDetailsByHallId(@Param("hallId") int hallId); List<Map<String, Object>> getBookingDetailsByHallId(@Param("hallId") int hallId);
@ -921,23 +921,23 @@ public interface BookingDetailsRepository extends JpaRepository<BookingDetails,
@Param("userType") String userType @Param("userType") String userType
); );
@Query(value = "SELECT \r\n"
+ " b.booking_date as booking_date,\r\n"
+ " u.name as name,\r\n"
+ " u.usertype as usertype,\r\n"
+ " b.reason as reason,\r\n"
+ " b.start_date as start_date,\r\n"
+ " b.end_date as end_date,\r\n"
+ " b.no_of_days as no_of_days,\r\n"
+ " b.booking_status as booking_status,\r\n"
+ " b.amount_received as amount_received,\r\n"
+ " COALESCE(rt.amount_refunded, 0) as amount_refunded,\r\n"
+ " COALESCE(r.balace_amount, 0) as balance_amount\r\n"
+ "FROM booking_details b\r\n"
+ "JOIN hall_details h ON b.hall_details_hall_id = h.hall_id \r\n"
+ "LEFT JOIN users u ON b.users_user_id = u.user_id\r\n"
+ "LEFT JOIN refund_response r ON b.booking_id = r.booking_id\r\n"
+ "LEFT JOIN refund_transaction rt ON b.booking_id = rt.booking_details_booking_id\r\n"
@Query(value = "SELECT \r"
+ " b.booking_date as booking_date,\r"
+ " u.name as name,\r"
+ " u.usertype as usertype,\r"
+ " b.reason as reason,\r"
+ " b.start_date as start_date,\r"
+ " b.end_date as end_date,\r"
+ " b.no_of_days as no_of_days,\r"
+ " b.booking_status as booking_status,\r"
+ " b.amount_received as amount_received,\r"
+ " COALESCE(rt.amount_refunded, 0) as amount_refunded,\r"
+ " COALESCE(r.balace_amount, 0) as balance_amount\r"
+ "FROM booking_details b\r"
+ "JOIN hall_details h ON b.hall_details_hall_id = h.hall_id \r"
+ "LEFT JOIN users u ON b.users_user_id = u.user_id\r"
+ "LEFT JOIN refund_response r ON b.booking_id = r.booking_id\r"
+ "LEFT JOIN refund_transaction rt ON b.booking_id = rt.booking_details_booking_id\r"
+ "WHERE h.hall_id = :hallId AND b.booking_status != 'PENDING' ", nativeQuery = true) + "WHERE h.hall_id = :hallId AND b.booking_status != 'PENDING' ", nativeQuery = true)
List<Map<String, Object>> getHallDetailsForOfficer(@Param("hallId") Integer hallIid); List<Map<String, Object>> getHallDetailsForOfficer(@Param("hallId") Integer hallIid);
@ -1507,4 +1507,53 @@ public interface BookingDetailsRepository extends JpaRepository<BookingDetails,
"AND bd.counter_id IS NOT NULL " + "AND bd.counter_id IS NOT NULL " +
"AND bd.booking_status <> 'PENDING' GROUP BY bd.counter_id, bd.booking_id ", nativeQuery = true) "AND bd.booking_status <> 'PENDING' GROUP BY bd.counter_id, bd.booking_id ", nativeQuery = true)
List<Object[]> getCounterWiseBookingDetails(String fromDate, String toDate); List<Object[]> getCounterWiseBookingDetails(String fromDate, String toDate);
@Query(value = " SELECT hd.zone, " +
" COUNT(DISTINCT hd.hall_id) AS hall_count, " +
" COUNT(bd.booking_id) AS total_count, " +
" SUM(CASE " +
" WHEN bd.booking_type = 'ONLINE' AND bd.counter_id IS NULL THEN 1 " +
" ELSE 0 " +
" END) AS online_count, " +
" SUM(CASE " +
" WHEN bd.booking_type = 'ONLINE' AND bd.counter_id IS NOT NULL THEN 1 " +
" ELSE 0 " +
" END) AS counter_count " +
"FROM hall_details hd " +
"LEFT JOIN booking_details bd " +
" ON hd.hall_id = bd.hall_details_hall_id " +
" AND DATE(bd.booking_date) BETWEEN :fromDate AND :toDate " +
" AND bd.booking_status NOT IN ('PENDING','GCC_UNBLOCKED','REFUNDED','GCC_BLOCKED') " +
" AND bd.booking_type IS NOT NULL " +
"GROUP BY hd.zone " +
"ORDER BY hd.zone", nativeQuery = true)
List<Object> getZoneWiseBookingList(String fromDate, String toDate);
@Query(value = " select hd.hall_id, hd.hall_name, " +
"COUNT(bd.booking_id) AS total_count, " +
" SUM(CASE " +
" WHEN bd.booking_type = 'ONLINE' AND bd.counter_id IS NULL THEN 1 " +
" ELSE 0 " +
" END) AS online_count, " +
" SUM(CASE " +
" WHEN bd.booking_type = 'ONLINE' AND bd.counter_id IS NOT NULL THEN 1 " +
" ELSE 0 " +
" END) AS counter_count, hd.zone from hall_details hd " +
"left join booking_details bd on hd.hall_id = bd.hall_details_hall_id " +
"where DATE(bd.booking_date) BETWEEN :fromDate AND :toDate and " +
"bd.booking_status not in ('PENDING','GCC_UNBLOCKED','REFUNDED','GCC_BLOCKED') and bd.booking_type is not null " +
"group by hd.hall_name, hd.hall_id ", nativeQuery = true)
List<Object> getHallWiseBookingList(String fromDate, String toDate);
@Query(value = " SELECT " +
" bd.counter_id, bd.hall_details_hall_id, " +
" COUNT(bd.booking_id) AS booking_count " +
"FROM booking_details bd " +
"WHERE DATE(bd.booking_date) BETWEEN :fromDate AND :toDate " +
" AND bd.booking_status NOT IN ('PENDING','GCC_UNBLOCKED','REFUNDED','GCC_BLOCKED') " +
" AND bd.booking_type IS NOT NULL " +
" AND bd.counter_id IS NOT NULL " +
"GROUP BY bd.counter_id, bd.hall_details_hall_id " , nativeQuery = true)
List<Object> getCounterWiseBookingList( String fromDate, String toDate);
} }

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

@ -212,4 +212,10 @@ public interface BookingService {
List<Object[]> getBookingDetailsForAllHalls(String fromDate, String toDate, String CounterId, Integer hallid); List<Object[]> getBookingDetailsForAllHalls(String fromDate, String toDate, String CounterId, Integer hallid);
List<Object[]> getCounterWiseBookingDetails(String fromDate, String toDate); List<Object[]> getCounterWiseBookingDetails(String fromDate, String toDate);
List<Object> getZoneWiseBookingList(String fromDate, String toDate);
List<Object> getAllHallWiseBookingList(String fromDate, String toDate);
List<Object> getAllCounterWiseBookingList(String fromDate, String toDate);
} }

2
src/main/java/com/gcc/communityHall/service/HallDetailService.java

@ -30,7 +30,7 @@ public interface HallDetailService {
String longitude, String hallInchargeName, String longitude, String hallInchargeName,
long hallInchargeNo, long hallInchargeNo,
String updatedId, String updatedId,
MultipartFile hallImages[] );
MultipartFile hallImages[], float halfDepositAmt );
List<HallImages> getHallImages(int hallId); List<HallImages> getHallImages(int hallId);
String updateHallDetail(HallDetails hallDetails, List<MultipartFile> images); String updateHallDetail(HallDetails hallDetails, List<MultipartFile> images);

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

@ -662,6 +662,7 @@ public class BookingServiceImpl implements BookingService {
String endDate = formData.get("endDate").toString(); String endDate = formData.get("endDate").toString();
String relation = formData.get("relation").toString(); String relation = formData.get("relation").toString();
double days = Double.parseDouble(formData.get("days").toString()); double days = Double.parseDouble(formData.get("days").toString());
int daysrange = Integer.parseInt(formData.get("daysrange").toString()); int daysrange = Integer.parseInt(formData.get("daysrange").toString());
Optional<DiscountRange> discountOpt = discountRangeService.getDiscountByUserType(user.getUsertype()); Optional<DiscountRange> discountOpt = discountRangeService.getDiscountByUserType(user.getUsertype());
DiscountRange discountrange = discountOpt.get(); DiscountRange discountrange = discountOpt.get();
@ -674,9 +675,19 @@ public class BookingServiceImpl implements BookingService {
String usertype = user.getUsertype().toString(); String usertype = user.getUsertype().toString();
String reason = reasonMaster.getReason(); String reason = reasonMaster.getReason();
//double depositeamount = hallDetails.getDepositAmount() * daysrange;
double depositeamount = hallDetails.getDepositAmount() * Math.ceil(days);
String startingSlot_txt = formData.get("startingSlot").toString();
String endingSlot_txt = formData.get("endingSlot").toString();
//double depositeamount = hallDetails.getDepositAmount() * daysrange;
double depositeamount = hallDetails.getDepositAmount() ;
System.out.println("depositeamount...."+depositeamount);
double halfDepositAmount = hallDetails.getHalfDepositAmount();
System.out.println("halfDepositAmount...."+halfDepositAmount);
System.err.println("days.."+days);
System.err.println("daysrange.."+daysrange);
double Totaldepositeamount = calculateDepositAmount(daysrange, startingSlot_txt, endingSlot_txt, depositeamount, halfDepositAmount);
System.out.println("Totaldepositeamount.."+Totaldepositeamount);
depositeamount = Totaldepositeamount;
// Calculate discount based on user type // Calculate discount based on user type
if (usertype.equals("COUNCILLOR") || usertype.equals("PENSIONER") || usertype.equals("GCC_EMPLOYEE") || usertype.equals("PUBLIC")) { if (usertype.equals("COUNCILLOR") || usertype.equals("PENSIONER") || usertype.equals("GCC_EMPLOYEE") || usertype.equals("PUBLIC")) {
discountAmount = (hallAmount * discount) / 100; discountAmount = (hallAmount * discount) / 100;
@ -952,6 +963,41 @@ public class BookingServiceImpl implements BookingService {
return hallAmount; return hallAmount;
} }
public double calculateDepositAmount(double numDays, String startPeriod, String endPeriod, double depositAmount, double HalfDepositAmount) {
double damount = 0;
// FOR FULL DAY
// If there is only one day
System.err.println("in calculate numDays..."+numDays);
System.err.println("in calculate depositAmount..."+depositAmount);
System.err.println("in calculate HalfDepositAmount..."+HalfDepositAmount);
if (numDays == 1) {
if ("1".equals(startPeriod) && "2".equals(endPeriod)) {
damount = depositAmount;
} else if ("1".equals(startPeriod) && "1".equals(endPeriod)) {
damount = HalfDepositAmount;
} else if ("2".equals(startPeriod) && "2".equals(endPeriod)) {
damount = HalfDepositAmount;
} else {
damount = numDays;
}
} else {
// For multiple days
if ("1".equals(startPeriod) && "2".equals(endPeriod)) {
damount = depositAmount * numDays;
} else if ("1".equals(startPeriod) && "1".equals(endPeriod)) {
damount = depositAmount * (numDays - 1) + HalfDepositAmount;
} else if ("2".equals(startPeriod) && "2".equals(endPeriod)) {
damount = depositAmount * (numDays - 1) + HalfDepositAmount;
} else if ("2".equals(startPeriod) && "1".equals(endPeriod)) {
damount = depositAmount * (numDays - 2) + depositAmount;
} else {
damount = numDays;
}
}
System.err.println("in calculate damount..."+damount);
return damount;
}
public String uploadNOCFile(MultipartFile file, int bookingId) { public String uploadNOCFile(MultipartFile file, int bookingId) {
// Retrieve booking details, throw an exception if not found // Retrieve booking details, throw an exception if not found
BookingDetails bookingDetails = bookingDetailsRepository.findById(bookingId) BookingDetails bookingDetails = bookingDetailsRepository.findById(bookingId)
@ -2478,4 +2524,19 @@ public class BookingServiceImpl implements BookingService {
return bookingDetailsRepository.getCounterWiseBookingDetails(fromDate,toDate); return bookingDetailsRepository.getCounterWiseBookingDetails(fromDate,toDate);
} }
@Override
public List<Object> getZoneWiseBookingList(String fromDate, String toDate){
return bookingDetailsRepository.getZoneWiseBookingList(fromDate,toDate);
}
@Override
public List<Object> getAllHallWiseBookingList(String fromDate, String toDate){
return bookingDetailsRepository.getHallWiseBookingList(fromDate,toDate);
}
@Override
public List<Object> getAllCounterWiseBookingList(String fromDate, String toDate){
return bookingDetailsRepository.getCounterWiseBookingList( fromDate,toDate);
}
} }

4
src/main/java/com/gcc/communityHall/service/Impl/HallDetailServiceImpl.java

@ -70,7 +70,7 @@ public class HallDetailServiceImpl implements HallDetailService {
String doorNo, String street, String area, String zone, String doorNo, String street, String area, String zone,
String division, String landMark, String city, int pinCode, String division, String landMark, String city, int pinCode,
String latitude, String longitude, String hallInchargeName, String latitude, String longitude, String hallInchargeName,
long hallInchargeNo,String updatedId, MultipartFile[] hallImages) {
long hallInchargeNo,String updatedId, MultipartFile[] hallImages, float halfDepositAmt) {
HallDetails hall = new HallDetails(); HallDetails hall = new HallDetails();
hall.setHallName(hallName); hall.setHallName(hallName);
hall.setDoorNo(doorNo); hall.setDoorNo(doorNo);
@ -96,6 +96,7 @@ public class HallDetailServiceImpl implements HallDetailService {
hall.setLankMark(landMark); hall.setLankMark(landMark);
hall.setUpdatedId(updatedId); hall.setUpdatedId(updatedId);
hall.setCreateddate(LocalDate.now()); hall.setCreateddate(LocalDate.now());
hall.setHalfDepositAmount(halfDepositAmt);
HallDetails hallDetails = hallDetailsRepository.save(hall); HallDetails hallDetails = hallDetailsRepository.save(hall);
if(hallImages!=null && hallImages.length>0){ if(hallImages!=null && hallImages.length>0){
int i=0; int i=0;
@ -196,6 +197,7 @@ public class HallDetailServiceImpl implements HallDetailService {
existingHall.setLatitude(hallDetails.getLatitude()); existingHall.setLatitude(hallDetails.getLatitude());
existingHall.setLongitude(hallDetails.getLongitude()); existingHall.setLongitude(hallDetails.getLongitude());
existingHall.setDepositAmount(hallDetails.getDepositAmount()); existingHall.setDepositAmount(hallDetails.getDepositAmount());
existingHall.setHalfDepositAmount(hallDetails.getHalfDepositAmount());
existingHall.setFullDayRent(hallDetails.getFullDayRent()); existingHall.setFullDayRent(hallDetails.getFullDayRent());
existingHall.setHalfDayRent(hallDetails.getHalfDayRent()); existingHall.setHalfDayRent(hallDetails.getHalfDayRent());
existingHall.setParkingCapacity(hallDetails.getParkingCapacity()); existingHall.setParkingCapacity(hallDetails.getParkingCapacity());

1
src/main/resources/application-prod.properties

@ -22,6 +22,7 @@ app.erpUrl=https://erp.chennaicorporation.gov.in/pgr/external/mobileservice?
server.address=0.0.0.0 server.address=0.0.0.0
server.port=8062 server.port=8062
#fileHanding #fileHanding
file.upload.directory=${user.dir}/communityHallDocuments file.upload.directory=${user.dir}/communityHallDocuments
file.hall.upload.directory=${user.dir}/communityHallDocuments/hallImages file.hall.upload.directory=${user.dir}/communityHallDocuments/hallImages

3070
src/main/resources/templates/admin/halldetailslist.html
File diff suppressed because it is too large
View File

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

@ -127,6 +127,7 @@
<option value="6" th:selected="${request=='6'}">Refund Details</option> <option value="6" th:selected="${request=='6'}">Refund Details</option>
<option value="7" th:selected="${request=='7'}">Total Count</option> <option value="7" th:selected="${request=='7'}">Total Count</option>
<option value="9" th:selected="${request=='9'}">Counter Details</option> <option value="9" th:selected="${request=='9'}">Counter Details</option>
<option value="10" th:selected="${request=='10'}">Review Report</option>
</select> </select>
</div> </div>
@ -719,6 +720,39 @@
</div> </div>
</div> </div>
<div class="table-responsive" id="zoneWiseBookingTable" th:if="${request}==10">
<table id="requestTable10" 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>Zone</th>
<th>Hall Count</th>
<th>Online Booking Count</th>
<th>Counter Booking Count</th>
<th>Total Count</th>
</tr>
</thead>
<tr th:each="zoneList, iterStat : ${zoneWiseBookingList}">
<td th:text="${iterStat.count}">0</td>
<td>
<button href="#"
th:attr="data-zone-id=${zoneList[0]}"
data-bs-toggle="modal"
data-bs-target="#hallModal"
style="background-color: #2a807f; color: white; border: none; padding: 6px 12px; border-radius: 4px;"
onclick="showHallDetailsTable(this)">
<span th:text="${zoneList[0]}"></span>
</button>
</td>
<td th:text="${zoneList[1]}"></td>
<td th:text="${zoneList[3]}"></td>
<td th:text="${zoneList[4]}"></td>
<td th:text="${zoneList[2]}"></td>
</tr>
</table>
</div>
</div> </div>
<div class="modal fade backdrop" id="showBookingDetails" data-backdrop="static" <div class="modal fade backdrop" id="showBookingDetails" data-backdrop="static"
@ -1434,6 +1468,63 @@
</div> </div>
</div> </div>
</div> </div>
<!--Modal For Review Report-->
<div class="modal fade" id="hallModal" tabindex="-1" aria-labelledby="hallModalLabel" aria-hidden="true">
<div class="modal-dialog modal-xl modal-dialog-scrollable">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Hall-wise Booking Details</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<!--
<table id="modalBookingTable" class="table table-bordered table-striped dataTable" style="width: 100%;">
-->
<table id="hallwiseBookingTable"
class="table table-striped table-bordered table-hover dataTable"
role="grid" width="99.5%">
<input type="hidden" id="hallWiseBookingList" th:value="${hallWiseBookingList}" />
<thead>
<tr>
<th>S.No</th>
<th>Hall Name</th>
<th>Online Booking Count</th>
<th>Counter Booking Count</th>
<th>Total Count</th>
</tr>
</thead>
<tbody id="hallwiseBookingDetails"></tbody>
</table>
</div>
</div>
</div>
</div>
<div class="modal fade" id="counterDetailModal" tabindex="-1" aria-hidden="true">
<div class="modal-dialog modal-fullscreen-custom modal-dialog-scrollable">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Booking Details for Hall</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal"></button>
</div>
<div class="modal-body">
<table id="counterDetailsTable" class="table table-bordered table-striped">
<input type="hidden" id="counterWiseBookingList" th:value="${counterWiseBookingList}" />
<thead>
<tr>
<th>S.No</th>
<th>Counter ID</th>
<th>No.of Booking</th>
</tr>
</thead>
<tbody id="counterDetailsTableBody"></tbody>
</table>
</div>
</div>
</div>
</div>
<div class="modal fade" id="bookingInfoModal" tabindex="-1" aria-labelledby="bookingInfoModalLabel" <div class="modal fade" id="bookingInfoModal" tabindex="-1" aria-labelledby="bookingInfoModalLabel"
aria-hidden="true"> aria-hidden="true">
@ -1588,7 +1679,7 @@
} }
// Tables using default buttons // Tables using default buttons
$('#requestTable1, #requestTable2, #requestTable3, #requestTable8, #requestTable4, #requestTable5, #requestTable6, #requestTable7').DataTable({
$('#requestTable1, #requestTable2, #requestTable3, #requestTable8, #requestTable4, #requestTable5, #requestTable6, #requestTable7, #requestTable10, #hallwiseBookingTable, #counterDetailsTable').DataTable({
dom: 'Bftip', dom: 'Bftip',
columnDefs: [{ columnDefs: [{
targets: 'no-sort', targets: 'no-sort',
@ -2489,7 +2580,7 @@
row[3], // Hall Name row[3], // Hall Name
`<button href="#" class="hall-detail-link" `<button href="#" class="hall-detail-link"
style="background-color: #2a807f; color: white; border: none; padding: 6px 12px; border-radius: 4px;" style="background-color: #2a807f; color: white; border: none; padding: 6px 12px; border-radius: 4px;"
data-hall-name="${row[3]}">${row[4]}</button>`
data-hall-name="${row[3]}">${row[4]}</button>`
]); ]);
}); });
@ -2548,6 +2639,88 @@ data-hall-name="${row[3]}">${row[4]}</button>`
viewDetails(bookingId); viewDetails(bookingId);
} }
// for review report
let halldetailcount = [];
let counterdetailcount = [];
window.addEventListener("DOMContentLoaded", () => {
try {
const jsonString1 = document.getElementById("hallWiseBookingList")?.value;
if (jsonString1) {
halldetailcount = JSON.parse(jsonString1);
console.log("Parsed hall wise count data:", halldetailcount);
}
const jsonString2 = document.getElementById("counterWiseBookingList")?.value;
if (jsonString2) {
counterdetailcount = JSON.parse(jsonString2);
console.log("Parsed counter wise count data:", counterdetailcount);
}
} catch (e) {
console.error("Failed to parse JSON inputs", e);
}
$(document).on('click', '.counter-booking-link', function (e) {
e.preventDefault();
const hallId = $(this).data('hall-id');
showCounterCountDetails(hallId);
});
});
function showHallDetailsTable(elem) {
const zoneId = elem.getAttribute("data-zone-id");
console.log("Selected Zone:", zoneId);
console.log("Full Data:", halldetailcount);
// FIX: Compare correct column (zoneId might be at index 5)
const filtered = halldetailcount.filter(row => String(row[5]) === String(zoneId));
console.log("Filtered Data:", filtered);
const table = $('#hallwiseBookingTable').DataTable();
table.clear();
filtered.forEach((row, index) => {
table.row.add([
index + 1,
row[1], // hall name
row[3], // online booking
`<button type="button" class="btn btn-sm btn-info counter-booking-link"
data-hall-id="${row[0]}">${row[4]}</button>`, // clickable counter count
row[2] // total count
]);
});
table.draw();
$('#hallModal').modal('show');
}
function showCounterCountDetails(hallId) {
console.log("Looking for hallId:", hallId);
console.log("All Counter Data:", counterdetailcount);
const filtered = counterdetailcount.filter(row => String(row[1]) === String(hallId));
console.log("Filtered Counter Data:", filtered);
const table = $('#counterDetailsTable').DataTable();
table.clear();
filtered.forEach((row, index) => {
table.row.add([
index + 1,
row[0], // Counter ID
row[2] // Booking count
]);
});
table.draw();
$('#counterDetailModal').modal('show');
}
</script> </script>
</body> </body>

8
src/main/resources/templates/user/dashboard.html

@ -411,11 +411,17 @@
class="text-muted"></td> class="text-muted"></td>
</tr> </tr>
<tr> <tr>
<th class="text-muted">Security Deposit:
<th class="text-muted">Full Day Security Deposit:
</th> </th>
<td th:text="${hall.depositAmount}" <td th:text="${hall.depositAmount}"
class="text-muted"></td> class="text-muted"></td>
</tr> </tr>
<tr>
<th class="text-muted">Half Day Security Deposit:
</th>
<td th:text="${hall.halfDepositAmount}"
class="text-muted"></td>
</tr>
</table> </table>
<div class="job-meta-data"><i <div class="job-meta-data"><i
class="icofont icofont-location-arrow"></i> class="icofont icofont-location-arrow"></i>

3
src/main/resources/templates/user/hallbookingform.html

@ -1157,6 +1157,8 @@
id="rentAmount"></span></p> id="rentAmount"></span></p>
<p>Full Day Rent: Rs <span <p>Full Day Rent: Rs <span
id="fullDayAmount"></span></p> id="fullDayAmount"></span></p>
<p>Half Day Security Deposit: Rs <span
id="halfrentAmount"></span></p>
<p>Half Day Rent: Rs <span <p>Half Day Rent: Rs <span
id="halfDayAmount"></span></p> id="halfDayAmount"></span></p>
<p>GST: <span id="gst"></span>%</p> <p>GST: <span id="gst"></span>%</p>
@ -2618,6 +2620,7 @@
$('#rentAmount').html('<strong>' + response.depositAmount + '</strong>'); $('#rentAmount').html('<strong>' + response.depositAmount + '</strong>');
$('#gst').html('<strong>' + response.gst + '</strong>'); $('#gst').html('<strong>' + response.gst + '</strong>');
$('#fullDayAmount').html('<strong>' + response.fullDayRent + '</strong>'); $('#fullDayAmount').html('<strong>' + response.fullDayRent + '</strong>');
$('#halfrentAmount').html('<strong>' + response.halfDepositAmount + '</strong>');
$('#halfDayAmount').html('<strong>' + response.halfDayRent + '</strong>'); $('#halfDayAmount').html('<strong>' + response.halfDayRent + '</strong>');
$('#ebunit').html('<strong>' + response.ebCostPerUnit + '</strong>'); $('#ebunit').html('<strong>' + response.ebCostPerUnit + '</strong>');
$('#statichallId').val(response.hallId); $('#statichallId').val(response.hallId);

5
src/main/resources/templates/user/viewhallform.html

@ -1175,10 +1175,12 @@
<div id="amountDetails"> <div id="amountDetails">
<br> <br>
<h6><b>Amount Details:</b></h6> <h6><b>Amount Details:</b></h6>
<p>Security Deposit: Rs <span
<p>Full Day Security Deposit: Rs <span
id="rentAmount"></span></p> id="rentAmount"></span></p>
<p>Full Day Rent: Rs <span <p>Full Day Rent: Rs <span
id="fullDayAmount"></span></p> id="fullDayAmount"></span></p>
<p>Half Day Security Deposit: Rs <span
id="halfrentAmount"></span></p>
<p>Half Day Rent: Rs <span <p>Half Day Rent: Rs <span
id="halfDayAmount"></span></p> id="halfDayAmount"></span></p>
<p>GST: <span id="gst"></span>%</p> <p>GST: <span id="gst"></span>%</p>
@ -1327,6 +1329,7 @@
$('#rentAmount').html('<strong>' + response.depositAmount + '</strong>'); $('#rentAmount').html('<strong>' + response.depositAmount + '</strong>');
$('#gst').html('<strong>' + response.gst + '</strong>'); $('#gst').html('<strong>' + response.gst + '</strong>');
$('#fullDayAmount').html('<strong>' + response.fullDayRent + '</strong>'); $('#fullDayAmount').html('<strong>' + response.fullDayRent + '</strong>');
$('#halfrentAmount').html('<strong>' + response.halfDepositAmount + '</strong>');
$('#halfDayAmount').html('<strong>' + response.halfDayRent + '</strong>'); $('#halfDayAmount').html('<strong>' + response.halfDayRent + '</strong>');
$('#ebunit').html('<strong>' + response.ebCostPerUnit + '</strong>'); $('#ebunit').html('<strong>' + response.ebCostPerUnit + '</strong>');
$('#statichallId').val(response.hallId); $('#statichallId').val(response.hallId);

Loading…
Cancel
Save