From ccde722577a21a06fdf55635751c7067b266d1e5 Mon Sep 17 00:00:00 2001 From: AJITHKUMAR12 Date: Mon, 15 Dec 2025 11:07:58 +0530 Subject: [PATCH] food distribution updated code --- .../configuration/DataSourceConfig.java | 95 + .../controller/FoodSchemeController.java | 226 ++ .../service/FoodSchemeService.java | 2218 +++++++++++++++++ .../modules/food_scheme/driverreport.html | 677 +++++ .../modules/food_scheme/feedbackreport.html | 858 +++++++ .../modules/food_scheme/foodschemereport.html | 1748 +++++++++++++ 6 files changed, 5822 insertions(+) create mode 100644 src/main/java/com/gcc/commissionerreview/configuration/DataSourceConfig.java create mode 100644 src/main/java/com/gcc/commissionerreview/controller/FoodSchemeController.java create mode 100644 src/main/java/com/gcc/commissionerreview/service/FoodSchemeService.java create mode 100644 src/main/resources/templates/modules/food_scheme/driverreport.html create mode 100644 src/main/resources/templates/modules/food_scheme/feedbackreport.html create mode 100644 src/main/resources/templates/modules/food_scheme/foodschemereport.html diff --git a/src/main/java/com/gcc/commissionerreview/configuration/DataSourceConfig.java b/src/main/java/com/gcc/commissionerreview/configuration/DataSourceConfig.java new file mode 100644 index 0000000..509f75f --- /dev/null +++ b/src/main/java/com/gcc/commissionerreview/configuration/DataSourceConfig.java @@ -0,0 +1,95 @@ +package com.gcc.commissionerreview.configuration; + +<<<<<<< HEAD +import com.zaxxer.hikari.HikariConfig; +import com.zaxxer.hikari.HikariDataSource; +======= +import javax.sql.DataSource; +>>>>>>> fabb49a5aeb9c63fb5d5a238dd689811f2cc2643 + +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Primary; +import org.springframework.jdbc.datasource.DataSourceTransactionManager; +import org.springframework.jdbc.datasource.DriverManagerDataSource; +import org.springframework.transaction.PlatformTransactionManager; +import org.springframework.transaction.annotation.EnableTransactionManagement; + +@Configuration +@EnableTransactionManagement +public class DataSourceConfig { + + private static String host = "localhost:3306"; + private static String dbpassword = "root"; + + // private static String host = + // "gcc-facial-db-instance-1.cf48eqcciziq.ap-south-1.rds.amazonaws.com:3306"; + // private static String dbpassword = "gcc-facial-password"; + + public static class MyDataSourceConfig { + @Primary + @Bean(name = "mydatasource") +<<<<<<< HEAD + +======= +>>>>>>> fabb49a5aeb9c63fb5d5a238dd689811f2cc2643 + public DataSource MyDataSource() { + // DriverManagerDataSource dataSource = new DriverManagerDataSource(); + // dataSource.setDriverClassName("com.mysql.cj.jdbc.Driver"); + // dataSource.setUrl("jdbc:mysql://"+host+"/dashboard_service"); + // dataSource.setUsername("root"); + // dataSource.setPassword("root"); + // return dataSource; + + DriverManagerDataSource dataSource = new DriverManagerDataSource(); + dataSource.setUrl("jdbc:mysql://" + host + "/commissioner_review"); + // dataSource.setUrl("jdbc:mysql://"+host+"/dashboard_service"); + dataSource.setUsername("root"); + dataSource.setPassword(dbpassword); + dataSource.setDriverClassName("com.mysql.cj.jdbc.Driver"); + return dataSource; + + } + + @Primary + @Bean(name = "myTransactionManager") + public PlatformTransactionManager myTransactionManager(@Qualifier("mydatasource") DataSource dataSource) { + return new DataSourceTransactionManager(dataSource); + } + } + + ////////////////////////////// Domestic Waste Management + ////////////////////////////// //////////////////////// + @Bean(name = "mysqlSofaBedCollectionDataSource") + public DataSource mysqlSofaBedCollectionDataSource() { + DriverManagerDataSource dataSource = new DriverManagerDataSource(); + dataSource.setDriverClassName("com.mysql.cj.jdbc.Driver"); + dataSource.setUrl("jdbc:mysql://" + host + "/domestic_waste_management"); + dataSource.setUsername("root"); + dataSource.setPassword(dbpassword); + return dataSource; + } + + ////////////////////////////// Food distribution //////////////////////// + @Bean(name = "mysqlFoodDistributionDataSource") + public DataSource mysqlFoodDistributionDataSource() { + DriverManagerDataSource dataSource = new DriverManagerDataSource(); + dataSource.setDriverClassName("com.mysql.cj.jdbc.Driver"); + dataSource.setUrl("jdbc:mysql://" + host + "/gcc_food_distribution"); + dataSource.setUsername("root"); + dataSource.setPassword(dbpassword); + return dataSource; + } + + ////////////////////////////// ORACLE //////////////////////// + @Bean(name = "oracleDataSource") + public DataSource oracleDataSource() { + DriverManagerDataSource dataSource = new DriverManagerDataSource(); + dataSource.setDriverClassName("oracle.jdbc.OracleDriver"); + dataSource.setUrl("jdbc:oracle:thin:@10.1.0.14:1521:chncorp"); + dataSource.setUsername("FAS"); + dataSource.setPassword("FAS"); + return dataSource; + } +} diff --git a/src/main/java/com/gcc/commissionerreview/controller/FoodSchemeController.java b/src/main/java/com/gcc/commissionerreview/controller/FoodSchemeController.java new file mode 100644 index 0000000..c64ad05 --- /dev/null +++ b/src/main/java/com/gcc/commissionerreview/controller/FoodSchemeController.java @@ -0,0 +1,226 @@ +package com.gcc.commissionerreview.controller; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import com.gcc.commissionerreview.service.FoodSchemeService; + +@RestController +@RequestMapping("/commissionerreview/api") +public class FoodSchemeController { + + @Autowired + private FoodSchemeService foodSchemeService; + + /* + * @GetMapping("/feedback-summary") + * public List> getFeedbackSummary(@RequestParam String + * date) { + * return feedbackService.getFeedbackSummary(date); + * } + * + * @GetMapping("/driver-report") + * public List> getDriverReport(@RequestParam String date) { + * //System.out.println("Date received in controller: " + date); + * return feedbackService.getDriverReport(date); + * } + */ + // ak + @GetMapping("/feedback-summary") + public ResponseEntity getFeedbackSummary(@RequestParam String date) { + try { + List> data = foodSchemeService.getFeedbackSummary(date); + + Map response = new HashMap<>(); + response.put("status", "success"); + response.put("date", date); + response.put("data", data); + + return ResponseEntity.ok(response); + + } catch (Exception e) { + Map error = new HashMap<>(); + error.put("status", "error"); + error.put("message", e.getMessage()); + + return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(error); + } + } + +<<<<<<< HEAD + // ak + @GetMapping("/zone-details") + public ResponseEntity getZoneDetails( + @RequestParam int qid, + @RequestParam String column, + @RequestParam String date) { + + try { + List> data = foodSchemeService.getZoneDetails(qid, column, date); + + Map response = new HashMap<>(); + response.put("status", "success"); + response.put("date", date); + response.put("data", data); + + return ResponseEntity.ok(response); + + } catch (Exception e) { + Map error = new HashMap<>(); + error.put("status", "error"); + error.put("message", e.getMessage()); + + return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(error); + } + } + + + + @GetMapping("/ward-details") + public ResponseEntity getWardDetails( + @RequestParam int qid, + @RequestParam String column, + @RequestParam String date, + @RequestParam int zoneId) { + + return ResponseEntity.ok(Map.of( + "status", "success", + "date", date, + "data", foodSchemeService.getWardDetails(qid, column, date, zoneId))); + } + + @GetMapping("/driver-report") + public ResponseEntity getDriverReport(@RequestParam String date, @RequestParam(required = false) Integer zone) { + try { + List> data = foodSchemeService.getDriverReport(date, zone); +======= + @GetMapping("/driver-report") + public ResponseEntity getDriverReport(@RequestParam String date) { + try { + List> data = foodSchemeService.getDriverReport(date); +>>>>>>> fabb49a5aeb9c63fb5d5a238dd689811f2cc2643 + + Map response = new HashMap<>(); + response.put("status", "success"); + response.put("date", date); + response.put("data", data); + + return ResponseEntity.ok(response); + + } catch (Exception e) { + Map error = new HashMap<>(); + error.put("status", "error"); + error.put("message", e.getMessage()); + + return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(error); + } + } + +<<<<<<< HEAD + @GetMapping("/zones") + public ResponseEntity getZones() { + List> data = foodSchemeService.getZones(); + return ResponseEntity.ok(Map.of("data", data)); + } + +======= +>>>>>>> fabb49a5aeb9c63fb5d5a238dd689811f2cc2643 + /// yogi + @GetMapping("/abstract") + public ResponseEntity getAbstractReport(@RequestParam String date) { + try { + List> report = foodSchemeService.getAbstractReport(date); + // System.out.println("report : " + report); + + Map response = new HashMap<>(); + response.put("status", "success"); + response.put("date", date); + response.put("data", report); + + return ResponseEntity.ok(response); + + } catch (Exception e) { + Map error = new HashMap<>(); + error.put("status", "error"); + error.put("message", e.getMessage()); + return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(error); + } + } + + @GetMapping("/zoneandshiftbasedreport") + public ResponseEntity getZoneWiseShiftBasedReport(@RequestParam String date, @RequestParam Integer shiftId) { + try { + List> report = foodSchemeService.getZoneWiseShiftBasedReport(date, shiftId); + // System.out.println("report : " + report); + + Map response = new HashMap<>(); + response.put("status", "success"); + response.put("date", date); + response.put("data", report); + + return ResponseEntity.ok(response); + + } catch (Exception e) { + Map error = new HashMap<>(); + error.put("status", "error"); + error.put("message", e.getMessage()); + return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(error); + } + } + +<<<<<<< HEAD + @GetMapping("/wardwiseShiftReport") + public ResponseEntity getWardWiseShiftReport( + @RequestParam String date, + @RequestParam Integer shiftId, + @RequestParam Integer zone) { + + try { + List> data = foodSchemeService.getWardWiseShiftReport(shiftId, zone, date); + + Map response = new HashMap<>(); + response.put("status", "success"); + response.put("zone", zone); + response.put("data", data); + + return ResponseEntity.ok(response); + + } catch (Exception e) { + Map error = new HashMap<>(); + error.put("status", "error"); + error.put("message", e.getMessage()); + return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(error); + } + } + +======= +>>>>>>> fabb49a5aeb9c63fb5d5a238dd689811f2cc2643 + @GetMapping("/wardlocationreport") + public ResponseEntity getWardLocationReport(@RequestParam String date) { + try { + List> report = foodSchemeService.getWardLocationWiseReport(date); + + Map response = new HashMap<>(); + response.put("status", "success"); + response.put("date", date); + response.put("data", report); + + return ResponseEntity.ok(response); + } catch (Exception e) { + Map error = new HashMap<>(); + error.put("status", "error"); + error.put("message", e.getMessage()); + return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(error); + } + } + +} diff --git a/src/main/java/com/gcc/commissionerreview/service/FoodSchemeService.java b/src/main/java/com/gcc/commissionerreview/service/FoodSchemeService.java new file mode 100644 index 0000000..e940a0a --- /dev/null +++ b/src/main/java/com/gcc/commissionerreview/service/FoodSchemeService.java @@ -0,0 +1,2218 @@ +package com.gcc.commissionerreview.service; + +import java.util.List; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +import javax.imageio.ImageIO; +import javax.sql.DataSource; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.core.env.Environment; +import org.springframework.jdbc.core.JdbcTemplate; +import org.springframework.stereotype.Service; +import java.net.URL; +import java.awt.image.BufferedImage; +import java.io.ByteArrayOutputStream; +import javax.imageio.ImageIO; +<<<<<<< HEAD + +import java.util.Arrays; +======= +>>>>>>> fabb49a5aeb9c63fb5d5a238dd689811f2cc2643 +import java.util.Base64; +import java.util.concurrent.ConcurrentHashMap; +import java.util.Map; + +import com.gcc.commissionerreview.configuration.AppConfig; + +@Service +public class FoodSchemeService { + + @Autowired + private JdbcTemplate jdbcTemplate; + @Autowired + private Environment environment; + @Autowired + private AppConfig appConfig; + + @Autowired + @Value("${fileBaseUrl}") + + private String fileBaseUrl; + + // ak for pdf image render + // private final Map imageCache = new ConcurrentHashMap<>(); + + @Autowired + public void setFeedbackDataSource(@Qualifier("mysqlFoodDistributionDataSource") DataSource dataSource) { + this.jdbcTemplate = new JdbcTemplate(dataSource); + } + + public FoodSchemeService(Environment environment) { + + this.environment = environment; + + this.fileBaseUrl = environment.getProperty("fileBaseUrl"); + } + /* + * private String convertUrlToBase64(String url) { + * try { + * if (imageCache.containsKey(url)) { + * return imageCache.get(url); + * } + * + * URL imageUrl = new URL(url); + * BufferedImage image = ImageIO.read(imageUrl); + * + * ByteArrayOutputStream baos = new ByteArrayOutputStream(); + * ImageIO.write(image, "jpeg", baos); + * + * String base64 = "data:image/jpeg;base64," + + * Base64.getEncoder().encodeToString(baos.toByteArray()); + * + * imageCache.put(url, base64); + * return base64; + * + * } catch (Exception e) { + * e.printStackTrace(); + * return null; + * } + * } + */ + + public List> getFeedbackSummary(String date) { + +<<<<<<< HEAD + String sql = "SELECT " + + " fq.qid, " + + " fq.question, " + + "fq.qid, " + + + " SUM(CASE WHEN fq.qid = 1 AND fd.q1 = '1' THEN 1 ELSE 0 END) AS on_time_distribution, " + + " SUM(CASE WHEN fq.qid = 1 AND fd.q1 = '2' THEN 1 ELSE 0 END) AS delayeded, " + + + " SUM(CASE WHEN fq.qid = 2 AND fd.q2 = '3' THEN 1 ELSE 0 END) AS good, " + + " SUM(CASE WHEN fq.qid = 2 AND fd.q2 = '4' THEN 1 ELSE 0 END) AS average, " + + + " SUM(CASE WHEN fq.qid = 3 AND fd.q3 = '5' THEN 1 ELSE 0 END) AS sufficient_food_quantity, " + + " SUM(CASE WHEN fq.qid = 3 AND fd.q3 = '6' THEN 1 ELSE 0 END) AS less_quantity " + + + "FROM feedback_questions fq " + // ← space added + "LEFT JOIN feedback_data fd " + // ← space added + " ON fd.isactive = 1 " + // ← space added + " AND fd.isdelete = 0 " + // ← space added + " AND DATE(fd.feedback_date) = ? " + // ← space added +======= + /* + * String sql = """ + * SELECT + * fq.qid, + * fq.question, + * + * -- YES Count + * SUM( + * CASE + * WHEN fq.qid = 1 AND fd.q1 = '1' THEN 1 + * WHEN fq.qid = 2 AND fd.q2 = '3' THEN 1 + * WHEN fq.qid = 3 AND fd.q3 = '5' THEN 1 + * ELSE 0 + * END + * ) AS yes_count, + * + * -- NO Count + * SUM( + * CASE + * WHEN fq.qid = 1 AND fd.q1 = '2' THEN 1 + * WHEN fq.qid = 2 AND fd.q2 = '4' THEN 1 + * WHEN fq.qid = 3 AND fd.q3 = '6' THEN 1 + * ELSE 0 + * END + * ) AS no_count + * + * FROM feedback_questions fq + * LEFT JOIN feedback_data fd + * ON fd.isactive = 1 + * AND fd.isdelete = 0 + * AND DATE(fd.feedback_date) = ? + * + * + * WHERE fq.isactive = 1 + * AND fq.isdelete = 0 + * + * GROUP BY fq.qid, fq.question + * ORDER BY fq.orderby + * """; + */ + String sql = "SELECT " + + " fq.qid, " + + " fq.question, " + + + " SUM( " + + " CASE " + + " WHEN fq.qid = 1 AND fd.q1 = '1' THEN 1 " + + " WHEN fq.qid = 2 AND fd.q2 = '3' THEN 1 " + + " WHEN fq.qid = 3 AND fd.q3 = '5' THEN 1 " + + " ELSE 0 " + + " END " + + " ) AS yes_count, " + + + " SUM( " + + " CASE " + + " WHEN fq.qid = 1 AND fd.q1 = '2' THEN 1 " + + " WHEN fq.qid = 2 AND fd.q2 = '4' THEN 1 " + + " WHEN fq.qid = 3 AND fd.q3 = '6' THEN 1 " + + " ELSE 0 " + + " END " + + " ) AS no_count " + + + "FROM feedback_questions fq " + + "LEFT JOIN feedback_data fd " + + " ON fd.isactive = 1 " + + " AND fd.isdelete = 0 " + + " AND DATE(fd.feedback_date) = ? " + +>>>>>>> fabb49a5aeb9c63fb5d5a238dd689811f2cc2643 + + "WHERE fq.isactive = 1 " + + "AND fq.isdelete = 0 " + + + "GROUP BY fq.qid, fq.question " + + "ORDER BY fq.orderby"; + + return jdbcTemplate.queryForList(sql, date); +<<<<<<< HEAD + + } + + // ak + public List> getZoneDetails(int qid, String column, String date) { + + String sql = "SELECT lm.zone, fq.qid, fq.question, " + + "SUM(CASE " + + " WHEN ? = 'on_time_distribution' AND fd.q1 = '1' THEN 1 " + + " WHEN ? = 'delayeded' AND fd.q1 = '2' THEN 1 " + + + " WHEN ? = 'good' AND fd.q2 = '3' THEN 1 " + + " WHEN ? = 'average' AND fd.q2 = '4' THEN 1 " + + + " WHEN ? = 'sufficient_food_quantity' AND fd.q3 = '5' THEN 1 " + + " WHEN ? = 'less_quantity' AND fd.q3 = '6' THEN 1 " + + " ELSE 0 END) AS count_value " + + + "FROM feedback_data fd " + + "INNER JOIN location_mapping lm ON fd.feedback_by = lm.siloginid " + + "INNER JOIN feedback_questions fq ON fq.qid = ? " + + + "WHERE fd.isactive = 1 " + + "AND fd.isdelete = 0 " + + "AND DATE(fd.feedback_date) = ? " + + + "GROUP BY lm.zone, fq.qid, fq.question " + + "ORDER BY lm.zone"; + + return jdbcTemplate.queryForList( + sql, + column, column, column, column, column, column, // 6 column comparisons + qid, // qid + date // date + ); + } + + /* + * public List> getZoneDetails(int qid, String column, + * String date) { + * + * String sql = "SELECT lm.zone, fq.qid, fq.question, " + + * "SUM(CASE " + + * " WHEN ? = 'on_time_distribution' AND fd.q1 = '1' THEN 1 " + + * " WHEN ? = 'delayeded' AND fd.q1 = '2' THEN 1 " + + * + * " WHEN ? = 'good' AND fd.q2 = '3' THEN 1 " + + * " WHEN ? = 'average' AND fd.q2 = '4' THEN 1 " + + * + * " WHEN ? = 'sufficient_food_quantity' AND fd.q3 = '5' THEN 1 " + + * " WHEN ? = 'less_quantity' AND fd.q3 = '6' THEN 1 " + + * " ELSE 0 END) AS count_value " + + * + * "FROM location_mapping lm " + + * "LEFT JOIN feedback_data fd ON fd.feedback_by = lm.siloginid " + + * " AND fd.isactive = 1 " + + * " AND fd.isdelete = 0 " + + * " AND DATE(fd.feedback_date) = ? " + + * + * "LEFT JOIN feedback_questions fq ON fq.qid = ? " + + * + * "GROUP BY lm.zone, fq.qid, fq.question " + + * "ORDER BY lm.zone"; + * + * return jdbcTemplate.queryForList(sql, + * column, column, column, column, column, column, // bind 6 times + * date, // date + * qid // qid + * ); + * } + */ + + public List> getDriverReport(String date, Integer zone) { + // System.out.println("File Base URL: " + fileBaseUrl);. + String zoneCondition = ""; + if (zone != null) { + zoneCondition = " AND lm.zone = " + zone + " "; + } + System.out.println("zoneCondition: " + zone); + + String sql = "SELECT lm.location AS LocationDescription, " + + "dl.username AS DriverName, " + + "lm.zone AS Zone, " + + "lm.ward AS Ward, " + + "SUBSTRING(dss_start.driver_live_mobile, 4) AS DriverMobile, " + + "CONCAT('" + fileBaseUrl + "/gccofficialapp/files', dss_start.image) AS StartImage, " + + // "CONCAT(dss_start.latitude, ', ', dss_start.longitude) AS StartPoint, " + + "dss_start.address AS StartAddress, " + + + // "DATE_FORMAT(dss_start.datetime, '%Y-%m-%d %H:%i') AS StartTime, " + + "DATE_FORMAT(dss_start.datetime, '%h:%i %p') AS StartTime," + + // "CONCAT(dss_stop.latitude, ', ', dss_stop.longitude) AS EndPoint, " + + "dss_stop.address AS EndAddress, " + + "CONCAT('" + fileBaseUrl + "/gccofficialapp/files', dss_stop.image) AS EndImage, " + + // "DATE_FORMAT(dss_stop.datetime, '%Y-%m-%d %H:%i') AS EndTime " + + "DATE_FORMAT(dss_stop.datetime, '%h:%i %p') AS EndTime " + +======= + } + + public List> getDriverReport(String date) { + // System.out.println("File Base URL: " + fileBaseUrl); + + String sql = "SELECT lm.location AS LocationDescription, " + + "dl.username AS DriverName, " + + "CONCAT('" + fileBaseUrl + "/gccofficialapp/files', dss_start.image) AS upload_image_url, " + + "CONCAT(dss_start.latitude, ', ', dss_start.longitude) AS StartPoint, " + + "Date(dss_start.datetime) AS StartTime, " + + "CONCAT(dss_stop.latitude, ', ', dss_stop.longitude) AS EndPoint, " + + "Date(dss_stop.datetime) AS EndTime " + +>>>>>>> fabb49a5aeb9c63fb5d5a238dd689811f2cc2643 + + "FROM location_mapping lm " + + "INNER JOIN driver_login dl ON dl.loginid = lm.driverid " + + + "LEFT JOIN driver_start_stop dss_start " + + "ON dss_start.loginid = lm.driverid " + + "AND dss_start.action = 'Start' " + + + "LEFT JOIN driver_start_stop dss_stop " + + "ON dss_stop.loginid = lm.driverid " + + "AND dss_stop.action = 'Stop' " + + "AND dss_stop.startid = dss_start.locationid " + + +<<<<<<< HEAD + "WHERE DATE(dss_start.datetime) = ?" + zoneCondition + + "order by dss_start.datetime"; +======= + "WHERE DATE(dss_start.datetime) = ?"; +>>>>>>> fabb49a5aeb9c63fb5d5a238dd689811f2cc2643 + + return jdbcTemplate.queryForList(sql, date); + } + +<<<<<<< HEAD + public List> getZones() { + String sql = "SELECT DISTINCT zone FROM location_mapping "; + return jdbcTemplate.queryForList(sql); + } + + // yogi used has old without isactive isdelete + // public List> getAbstractReport(String date) { + + // String sql = """ + // SELECT * FROM ( + + // SELECT + + // sm.name AS shift_name, + // sm.Code as shift_code, + // sm.shiftid as shiftid, + // IFNULL(SUM(gru.total_food_requested), 0) AS food_requested, + // IFNULL(SUM(gru.total_food_received), 0) AS food_delivered, + // IFNULL(SUM(dr.nulm + dr.private + dr.permanent), 0) AS overall_count, + // IFNULL(SUM(dr.nulm + dr.private + dr.permanent), 0) AS present_count, + // IFNULL(SUM(gru.today_absentees_nulm + gru.today_absentees_private + + // gru.today_absentees_permanent), 0) AS unplanned_count, + // IFNULL(SUM(dr.absentees_nulm + dr.absentees_private + + // dr.absentees_permanent), 0) AS absent_count, + // IFNULL(SUM(gru.total_box_shortfall), 0) AS food_shortfall + // FROM shift_master sm + // LEFT JOIN daily_request dr + // ON sm.shiftid = dr.shiftid AND dr.required_date = ? + // LEFT JOIN gcc_received_update gru + // ON gru.requestid = dr.requestid + // GROUP BY sm.shiftid, sm.name + + // UNION ALL + + // SELECT + // 'Total' AS shift_name, + // 'TOTAL' AS shift_code, + // 'TOTAL' as shift_id, + // IFNULL(SUM(gru.total_food_requested), 0), + // IFNULL(SUM(gru.total_food_received), 0), + // IFNULL(SUM(dr.nulm + dr.private + dr.permanent), 0), + // IFNULL(SUM(dr.nulm + dr.private + dr.permanent), 0), + // IFNULL(SUM(gru.today_absentees_nulm + gru.today_absentees_private + + // gru.today_absentees_permanent), 0), + // IFNULL(SUM(dr.absentees_nulm + dr.absentees_private + + // dr.absentees_permanent), 0), + // IFNULL(SUM(gru.total_box_shortfall), 0) + // FROM shift_master sm + // LEFT JOIN daily_request dr + // ON sm.shiftid = dr.shiftid AND dr.required_date = ? + // LEFT JOIN gcc_received_update gru + // ON gru.requestid = dr.requestid + // ) AS final_result + // """; + + // return jdbcTemplate.queryForList(sql, date, date); + // } + + // new abstract report old + // public List> getAbstractReport(String date) { + + // String sql = """ + // SELECT * FROM ( + + // /* ================= SHIFT-WISE SUMMARY ================= */ + // SELECT + // sm.name AS shift_name, + // sm.code AS shift_code, + // sm.shiftid AS shiftid, + + // /* ---------------- TOTAL COMPLEMENT ---------------- */ + // IFNULL(SUM(dr.permanent + dr.nulm + dr.private + dr.nmr + dr.others), 0) AS + // total_complement, + + // /* ---------------- WEEKLY OFF ---------------- */ + // IFNULL(SUM(dr.weeklyoff_permanent + dr.weeklyoff_private + dr.weeklyoff_nulm + // + + // dr.weeklyoff_others + dr.weeklyoff_nmr), 0) AS weekly_off, + + // /* ---------------- PLANNED LEAVE ---------------- */ + // IFNULL(SUM(dr.absentees_permanent + dr.absentees_private + dr.absentees_nulm + // + + // dr.absentees_others + dr.absentees_nmr), 0) AS planned_leave, + + // /* ---------------- PRESENT COUNT ---------------- */ + // ( + // IFNULL(SUM(dr.permanent + dr.nulm + dr.private + dr.nmr + dr.others), 0) + // - + // IFNULL(SUM(dr.weeklyoff_permanent + dr.weeklyoff_private + dr.weeklyoff_nulm + // + + // dr.weeklyoff_others + dr.weeklyoff_nmr), 0) + // - + // IFNULL(SUM(dr.absentees_permanent + dr.absentees_private + dr.absentees_nulm + // + + // dr.absentees_others + dr.absentees_nmr), 0) + // ) AS present_count, + + // /* ---------------- FOOD REQUESTED ---------------- */ + // ( + // IFNULL(SUM(dr.permanent + dr.nulm + dr.private + dr.nmr + dr.others), 0) + // - + // IFNULL(SUM(dr.weeklyoff_permanent + dr.weeklyoff_private + dr.weeklyoff_nulm + // + + // dr.weeklyoff_others + dr.weeklyoff_nmr), 0) + // - + // IFNULL(SUM(dr.absentees_permanent + dr.absentees_private + dr.absentees_nulm + // + + // dr.absentees_others + dr.absentees_nmr), 0) + // ) AS food_requested, + + // /* ---------------- FOOD DELIVERED ---------------- */ + // IFNULL(SUM(gru.total_food_received), 0) AS food_delivered, + + // /* ---------------- FOOD SHORTFALL ---------------- */ + // ( + // ( + // IFNULL(SUM(dr.permanent + dr.nulm + dr.private + dr.nmr + dr.others), 0) + // - + // IFNULL(SUM(dr.weeklyoff_permanent + dr.weeklyoff_private + dr.weeklyoff_nulm + // + + // dr.weeklyoff_others + dr.weeklyoff_nmr), 0) + // - + // IFNULL(SUM(dr.absentees_permanent + dr.absentees_private + dr.absentees_nulm + // + + // dr.absentees_others + dr.absentees_nmr), 0) + // ) + // - + // IFNULL(SUM(gru.total_food_received), 0) + // ) AS food_shortfall + + // FROM shift_master sm + // LEFT JOIN daily_request dr + // ON sm.shiftid = dr.shiftid AND dr.required_date = ? + // LEFT JOIN gcc_received_update gru + // ON gru.requestid = dr.requestid + // WHERE sm.isactive = 1 AND sm.isdelete = 0 + // GROUP BY sm.shiftid, sm.name + + // UNION ALL + + // /* ================= TOTAL SUMMARY ================= */ + // SELECT + // 'Total' AS shift_name, + // 'TOTAL' AS shift_code, + // 'TOTAL' AS shiftid, + + // /* TOTAL COMPLEMENT */ + // IFNULL(SUM(dr.permanent + dr.nulm + dr.private + dr.nmr + dr.others), 0), + + // /* WEEKLY OFF */ + // IFNULL(SUM(dr.weeklyoff_permanent + dr.weeklyoff_private + dr.weeklyoff_nulm + // + + // dr.weeklyoff_others + dr.weeklyoff_nmr), 0), + + // /* PLANNED LEAVE */ + // IFNULL(SUM(dr.absentees_permanent + dr.absentees_private + dr.absentees_nulm + // + + // dr.absentees_others + dr.absentees_nmr), 0), + + // /* PRESENT COUNT */ + // ( + // IFNULL(SUM(dr.permanent + dr.nulm + dr.private + dr.nmr + dr.others), 0) + // - + // IFNULL(SUM(dr.weeklyoff_permanent + dr.weeklyoff_private + dr.weeklyoff_nulm + // + + // dr.weeklyoff_others + dr.weeklyoff_nmr), 0) + // - + // IFNULL(SUM(dr.absentees_permanent + dr.absentees_private + dr.absentees_nulm + // + + // dr.absentees_others + dr.absentees_nmr), 0) + // ), + + // /* FOOD REQUESTED */ + // ( + // IFNULL(SUM(dr.permanent + dr.nulm + dr.private + dr.nmr + dr.others), 0) + // - + // IFNULL(SUM(dr.weeklyoff_permanent + dr.weeklyoff_private + dr.weeklyoff_nulm + // + + // dr.weeklyoff_others + dr.weeklyoff_nmr), 0) + // - + // IFNULL(SUM(dr.absentees_permanent + dr.absentees_private + dr.absentees_nulm + // + + // dr.absentees_others + dr.absentees_nmr), 0) + // ), + + // /* FOOD DELIVERED */ + // IFNULL(SUM(gru.total_food_received), 0), + + // /* FOOD SHORTFALL */ + // ( + // ( + // IFNULL(SUM(dr.permanent + dr.nulm + dr.private + dr.nmr + dr.others), 0) + // - + // IFNULL(SUM(dr.weeklyoff_permanent + dr.weeklyoff_private + dr.weeklyoff_nulm + // + + // dr.weeklyoff_others + dr.weeklyoff_nmr), 0) + // - + // IFNULL(SUM(dr.absentees_permanent + dr.absentees_private + dr.absentees_nulm + // + + // dr.absentees_others + dr.absentees_nmr), 0) + // ) + // - + // IFNULL(SUM(gru.total_food_received), 0) + // ) + + // FROM shift_master sm + // LEFT JOIN daily_request dr + // ON sm.shiftid = dr.shiftid AND dr.required_date = ? + // LEFT JOIN gcc_received_update gru + // ON gru.requestid = dr.requestid + // WHERE sm.isactive = 1 AND sm.isdelete = 0 + // ) final_table + // """; + + // return jdbcTemplate.queryForList(sql, date, date); + // } + + // with using isactive and isdelete + public List> getAbstractReport(String date) { + + String sql = """ + SELECT * FROM ( + + /* ================= SHIFT-WISE SUMMARY ================= */ + SELECT + sm.name AS shift_name, + sm.code AS shift_code, + sm.shiftid AS shiftid, + + /* TOTAL COMPLEMENT */ + IFNULL(SUM(dr.permanent + dr.nulm + dr.private + dr.nmr + dr.others), 0) AS total_complement, + + /* WEEKLY OFF */ + IFNULL(SUM(dr.weeklyoff_permanent + dr.weeklyoff_private + dr.weeklyoff_nulm + + dr.weeklyoff_others + dr.weeklyoff_nmr), 0) AS weekly_off, + + /* PLANNED LEAVE */ + IFNULL(SUM(dr.absentees_permanent + dr.absentees_private + dr.absentees_nulm + + dr.absentees_others + dr.absentees_nmr), 0) AS planned_leave, + + /* PRESENT COUNT */ + ( + IFNULL(SUM(dr.permanent + dr.nulm + dr.private + dr.nmr + dr.others), 0) + - + IFNULL(SUM(dr.weeklyoff_permanent + dr.weeklyoff_private + dr.weeklyoff_nulm + + dr.weeklyoff_others + dr.weeklyoff_nmr), 0) + - + IFNULL(SUM(dr.absentees_permanent + dr.absentees_private + dr.absentees_nulm + + dr.absentees_others + dr.absentees_nmr), 0) + ) AS present_count, + + /* FOOD REQUESTED = PRESENT COUNT */ + ( + IFNULL(SUM(dr.permanent + dr.nulm + dr.private + dr.nmr + dr.others), 0) + - + IFNULL(SUM(dr.weeklyoff_permanent + dr.weeklyoff_private + dr.weeklyoff_nulm + + dr.weeklyoff_others + dr.weeklyoff_nmr), 0) + - + IFNULL(SUM(dr.absentees_permanent + dr.absentees_private + dr.absentees_nulm + + dr.absentees_others + dr.absentees_nmr), 0) + ) AS food_requested, + + /* FOOD DELIVERED */ + IFNULL(SUM(gru.total_food_received), 0) AS food_delivered, + + /* FOOD SHORTFALL */ + ( + ( + IFNULL(SUM(dr.permanent + dr.nulm + dr.private + dr.nmr + dr.others), 0) + - + IFNULL(SUM(dr.weeklyoff_permanent + dr.weeklyoff_private + dr.weeklyoff_nulm + + dr.weeklyoff_others + dr.weeklyoff_nmr), 0) + - + IFNULL(SUM(dr.absentees_permanent + dr.absentees_private + dr.absentees_nulm + + dr.absentees_others + dr.absentees_nmr), 0) + ) + - + IFNULL(SUM(gru.total_food_received), 0) + ) AS food_shortfall + + FROM shift_master sm + LEFT JOIN daily_request dr + ON sm.shiftid = dr.shiftid + AND dr.required_date = ? + AND dr.isactive = 1 + AND dr.isdelete = 0 + LEFT JOIN gcc_received_update gru + ON gru.requestid = dr.requestid + AND gru.isactive = 1 + AND gru.isdelete = 0 + WHERE sm.isactive = 1 AND sm.isdelete = 0 + GROUP BY sm.shiftid, sm.name + + UNION ALL + + /* ================= TOTAL SUMMARY ================= */ + SELECT + 'Total' AS shift_name, + 'TOTAL' AS shift_code, + 'TOTAL' AS shiftid, + + /* TOTAL COMPLEMENT */ + IFNULL(SUM(dr.permanent + dr.nulm + dr.private + dr.nmr + dr.others), 0), + + /* WEEKLY OFF */ + IFNULL(SUM(dr.weeklyoff_permanent + dr.weeklyoff_private + dr.weeklyoff_nulm + + dr.weeklyoff_others + dr.weeklyoff_nmr), 0), + + /* PLANNED LEAVE */ + IFNULL(SUM(dr.absentees_permanent + dr.absentees_private + dr.absentees_nulm + + dr.absentees_others + dr.absentees_nmr), 0), + + /* PRESENT COUNT */ + ( + IFNULL(SUM(dr.permanent + dr.nulm + dr.private + dr.nmr + dr.others), 0) + - + IFNULL(SUM(dr.weeklyoff_permanent + dr.weeklyoff_private + dr.weeklyoff_nulm + + dr.weeklyoff_others + dr.weeklyoff_nmr), 0) + - + IFNULL(SUM(dr.absentees_permanent + dr.absentees_private + dr.absentees_nulm + + dr.absentees_others + dr.absentees_nmr), 0) + ), + + /* FOOD REQUESTED */ + ( + IFNULL(SUM(dr.permanent + dr.nulm + dr.private + dr.nmr + dr.others), 0) + - + IFNULL(SUM(dr.weeklyoff_permanent + dr.weeklyoff_private + dr.weeklyoff_nulm + + dr.weeklyoff_others + dr.weeklyoff_nmr), 0) + - + IFNULL(SUM(dr.absentees_permanent + dr.absentees_private + dr.absentees_nulm + + dr.absentees_others + dr.absentees_nmr), 0) + ), + + /* FOOD DELIVERED */ + IFNULL(SUM(gru.total_food_received), 0), + + /* FOOD SHORTFALL */ + ( + ( + IFNULL(SUM(dr.permanent + dr.nulm + dr.private + dr.nmr + dr.others), 0) + - + IFNULL(SUM(dr.weeklyoff_permanent + dr.weeklyoff_private + dr.weeklyoff_nulm + + dr.weeklyoff_others + dr.weeklyoff_nmr), 0) + - + IFNULL(SUM(dr.absentees_permanent + dr.absentees_private + dr.absentees_nulm + + dr.absentees_others + dr.absentees_nmr), 0) + ) + - + IFNULL(SUM(gru.total_food_received), 0) + ) + + FROM shift_master sm + LEFT JOIN daily_request dr + ON sm.shiftid = dr.shiftid + AND dr.required_date = ? + AND dr.isactive = 1 + AND dr.isdelete = 0 + LEFT JOIN gcc_received_update gru + ON gru.requestid = dr.requestid + AND gru.isactive = 1 + AND gru.isdelete = 0 + WHERE sm.isactive = 1 AND sm.isdelete = 0 + ) final_table +======= + // yogi + public List> getAbstractReport(String date) { + + String sql = """ + SELECT * FROM ( + + SELECT + + sm.name AS shift_name, + sm.Code as shift_code, + sm.shiftid as shiftid, + IFNULL(SUM(gru.total_food_requested), 0) AS food_requested, + IFNULL(SUM(gru.total_food_received), 0) AS food_delivered, + IFNULL(SUM(dr.nulm + dr.private + dr.permanent), 0) AS overall_count, + IFNULL(SUM(dr.nulm + dr.private + dr.permanent), 0) AS present_count, + IFNULL(SUM(gru.today_absentees_nulm + gru.today_absentees_private + gru.today_absentees_permanent), 0) AS unplanned_count, + IFNULL(SUM(dr.absentees_nulm + dr.absentees_private + dr.absentees_permanent), 0) AS absent_count, + IFNULL(SUM(gru.total_box_shortfall), 0) AS food_shortfall + FROM shift_master sm + LEFT JOIN daily_request dr + ON sm.shiftid = dr.shiftid AND dr.required_date = ? + LEFT JOIN gcc_received_update gru + ON gru.requestid = dr.requestid + GROUP BY sm.shiftid, sm.name + + UNION ALL + + SELECT + 'Total' AS shift_name, + 'TOTAL' AS shift_code, + 'TOTAL' as shift_id, + IFNULL(SUM(gru.total_food_requested), 0), + IFNULL(SUM(gru.total_food_received), 0), + IFNULL(SUM(dr.nulm + dr.private + dr.permanent), 0), + IFNULL(SUM(dr.nulm + dr.private + dr.permanent), 0), + IFNULL(SUM(gru.today_absentees_nulm + gru.today_absentees_private + gru.today_absentees_permanent), 0), + IFNULL(SUM(dr.absentees_nulm + dr.absentees_private + dr.absentees_permanent), 0), + IFNULL(SUM(gru.total_box_shortfall), 0) + FROM shift_master sm + LEFT JOIN daily_request dr + ON sm.shiftid = dr.shiftid AND dr.required_date = ? + LEFT JOIN gcc_received_update gru + ON gru.requestid = dr.requestid + ) AS final_result +>>>>>>> fabb49a5aeb9c63fb5d5a238dd689811f2cc2643 + """; + + return jdbcTemplate.queryForList(sql, date, date); + } + +<<<<<<< HEAD + public List> getWardDetails(int qid, String column, String date, int zone) { + + String imageColumn = ""; + String whereCondition = ""; // <-- will be used in WHERE + String sumCondition = ""; // <-- used inside SUM() + + switch (column) { + case "on_time_distribution": + imageColumn = "fd.q1_img"; + whereCondition = "fd.q1 = '1'"; + sumCondition = "fd.q1 = '1'"; + break; + + case "delayeded": + imageColumn = "fd.q1_img"; + whereCondition = "fd.q1 = '2'"; + sumCondition = "fd.q1 = '2'"; + break; + + case "good": + imageColumn = "fd.q2_img"; + whereCondition = "fd.q2 = '3'"; + sumCondition = "fd.q2 = '3'"; + break; + + case "average": + imageColumn = "fd.q2_img"; + whereCondition = "fd.q2 = '4'"; + sumCondition = "fd.q2 = '4'"; + break; + + case "sufficient_food_quantity": + imageColumn = "fd.q3_img"; + whereCondition = "fd.q3 = '5'"; + sumCondition = "fd.q3 = '5'"; + break; + + case "less_quantity": + imageColumn = "fd.q3_img"; + whereCondition = "fd.q3 = '6'"; + sumCondition = "fd.q3 = '6'"; + break; + } + + String sql = "SELECT lm.ward,lm.location, fq.question, " + + "SUM(CASE WHEN " + sumCondition + " THEN 1 ELSE 0 END) AS count_value, " + + "CONCAT('" + fileBaseUrl + "/gccofficialapp/files'," + imageColumn + ") AS feedbackImage " + + "FROM feedback_data fd " + + "INNER JOIN location_mapping lm ON fd.feedback_by = lm.siloginid " + + "INNER JOIN feedback_questions fq ON fq.qid = ? " + + "WHERE lm.zone = ? " + + "AND DATE(fd.feedback_date) = ? " + + "AND fd.isactive = 1 AND fd.isdelete = 0 " + + "AND " + whereCondition + " " + // <-- EXACT MATCH ADDED + "GROUP BY lm.ward,lm.location,fq.question, " + imageColumn + " " + + "ORDER BY lm.ward"; + + return jdbcTemplate.queryForList(sql, qid, zone, date); + } + + // with using isactive and isdelete + // public List> getZoneWiseShiftBasedReport(String date, int + // shiftId) { + + // String sql = """ + // SELECT * + // FROM ( + + // /* ================= ZONE-WISE SUMMARY ================= */ + // SELECT + // z.zone AS zone, + + // /* -------- TOTAL COMPLEMENT -------- */ + // ( + // SELECT IFNULL(SUM(dr.permanent + dr.nulm + dr.private + dr.nmr + dr.others), + // 0) + // FROM daily_request dr + // WHERE dr.required_date = ? + // AND dr.shiftid = ? + // AND dr.request_by IN ( + // SELECT lm.siloginid FROM location_mapping lm WHERE lm.zone = z.zone + // ) + // ) AS total_complement, + + // /* -------- WEEKLY OFF -------- */ + // ( + // SELECT IFNULL(SUM(dr.weeklyoff_permanent + dr.weeklyoff_private + + // dr.weeklyoff_nulm + dr.weeklyoff_others + dr.weeklyoff_nmr), 0) + // FROM daily_request dr + // WHERE dr.required_date = ? + // AND dr.shiftid = ? + // AND dr.request_by IN ( + // SELECT lm.siloginid FROM location_mapping lm WHERE lm.zone = z.zone + // ) + // ) AS weekly_off, + + // /* -------- PLANNED LEAVE -------- */ + // ( + // SELECT IFNULL(SUM(dr.absentees_permanent + dr.absentees_private + + // dr.absentees_nulm + dr.absentees_others + dr.absentees_nmr), 0) + // FROM daily_request dr + // WHERE dr.required_date = ? + // AND dr.shiftid = ? + // AND dr.request_by IN ( + // SELECT lm.siloginid FROM location_mapping lm WHERE lm.zone = z.zone + // ) + // ) AS planned_leave, + + // /* -------- PRESENT COUNT -------- */ + // ( + // ( + // SELECT IFNULL(SUM(dr.permanent + dr.nulm + dr.private + dr.nmr + dr.others), + // 0) + // FROM daily_request dr + // WHERE dr.required_date = ? + // AND dr.shiftid = ? + // AND dr.request_by IN ( + // SELECT lm.siloginid FROM location_mapping lm WHERE lm.zone = z.zone + // ) + // ) + // - + // ( + // SELECT IFNULL(SUM(dr.weeklyoff_permanent + dr.weeklyoff_private + + // dr.weeklyoff_nulm + dr.weeklyoff_others + dr.weeklyoff_nmr), 0) + // FROM daily_request dr + // WHERE dr.required_date = ? + // AND dr.shiftid = ? + // AND dr.request_by IN ( + // SELECT lm.siloginid FROM location_mapping lm WHERE lm.zone = z.zone + // ) + // ) + // - + // ( + // SELECT IFNULL(SUM(dr.absentees_permanent + dr.absentees_private + + // dr.absentees_nulm + dr.absentees_others + dr.absentees_nmr), 0) + // FROM daily_request dr + // WHERE dr.required_date = ? + // AND dr.shiftid = ? + // AND dr.request_by IN ( + // SELECT lm.siloginid FROM location_mapping lm WHERE lm.zone = z.zone + // ) + // ) + // ) AS present_count, + + // /* -------- FOOD REQUESTED -------- */ + // ( + // ( + // SELECT IFNULL(SUM(dr.permanent + dr.nulm + dr.private + dr.nmr + dr.others), + // 0) + // FROM daily_request dr + // WHERE dr.required_date = ? + // AND dr.shiftid = ? + // AND dr.request_by IN ( + // SELECT lm.siloginid FROM location_mapping lm WHERE lm.zone = z.zone + // ) + // ) + // - + // ( + // SELECT IFNULL(SUM(dr.weeklyoff_permanent + dr.weeklyoff_private + + // dr.weeklyoff_nulm + dr.weeklyoff_others + dr.weeklyoff_nmr), 0) + // FROM daily_request dr + // WHERE dr.required_date = ? + // AND dr.shiftid = ? + // AND dr.request_by IN ( + // SELECT lm.siloginid FROM location_mapping lm WHERE lm.zone = z.zone + // ) + // ) + // - + // ( + // SELECT IFNULL(SUM(dr.absentees_permanent + dr.absentees_private + + // dr.absentees_nulm + dr.absentees_others + dr.absentees_nmr), 0) + // FROM daily_request dr + // WHERE dr.required_date = ? + // AND dr.shiftid = ? + // AND dr.request_by IN ( + // SELECT lm.siloginid FROM location_mapping lm WHERE lm.zone = z.zone + // ) + // ) + // ) AS food_requested, + + // /* -------- FOOD DELIVERED -------- */ + // ( + // SELECT IFNULL(SUM(gru.total_food_received), 0) + // FROM gcc_received_update gru + // WHERE gru.shiftid = ? + // AND gru.requestid IN ( + // SELECT dr.requestid + // FROM daily_request dr + // WHERE dr.required_date = ? + // AND dr.shiftid = ? + // AND dr.request_by IN ( + // SELECT lm.siloginid FROM location_mapping lm WHERE lm.zone = z.zone + // ) + // ) + // ) AS food_delivered, + + // /* -------- FOOD SHORTFALL (UPDATED) -------- */ + // ( + // ( + // ( + // SELECT IFNULL(SUM(dr.permanent + dr.nulm + dr.private + dr.nmr + dr.others), + // 0) + // FROM daily_request dr + // WHERE dr.required_date = ? + // AND dr.shiftid = ? + // AND dr.request_by IN ( + // SELECT lm.siloginid FROM location_mapping lm WHERE lm.zone = z.zone + // ) + // ) + // - + // ( + // SELECT IFNULL(SUM(dr.weeklyoff_permanent + dr.weeklyoff_private + + // dr.weeklyoff_nulm + dr.weeklyoff_others + dr.weeklyoff_nmr), 0) + // FROM daily_request dr + // WHERE dr.required_date = ? + // AND dr.shiftid = ? + // AND dr.request_by IN ( + // SELECT lm.siloginid FROM location_mapping lm WHERE lm.zone = z.zone + // ) + // ) + // - + // ( + // SELECT IFNULL(SUM(dr.absentees_permanent + dr.absentees_private + + // dr.absentees_nulm + dr.absentees_others + dr.absentees_nmr), 0) + // FROM daily_request dr + // WHERE dr.required_date = ? + // AND dr.shiftid = ? + // AND dr.request_by IN ( + // SELECT lm.siloginid FROM location_mapping lm WHERE lm.zone = z.zone + // ) + // ) + // ) + // - + // ( + // SELECT IFNULL(SUM(gru.total_food_received), 0) + // FROM gcc_received_update gru + // WHERE gru.shiftid = ? + // AND gru.requestid IN ( + // SELECT dr.requestid + // FROM daily_request dr + // WHERE dr.required_date = ? + // AND dr.shiftid = ? + // AND dr.request_by IN ( + // SELECT lm.siloginid FROM location_mapping lm WHERE lm.zone = z.zone + // ) + // ) + // ) + // ) AS food_shortfall + + // FROM ( + // SELECT DISTINCT zone + // FROM location_mapping + // WHERE zone IS NOT NULL + // ORDER BY CAST(zone AS UNSIGNED) + // ) z + + // UNION ALL + + // /* ================= GRAND TOTAL ================= */ + // SELECT + // 'TOTAL' AS zone, + + // IFNULL(SUM(dr.permanent + dr.nulm + dr.private + dr.nmr + dr.others), 0), + // IFNULL(SUM(dr.weeklyoff_permanent + dr.weeklyoff_private + dr.weeklyoff_nulm + // + + // dr.weeklyoff_others + dr.weeklyoff_nmr), 0), + // IFNULL(SUM(dr.absentees_permanent + dr.absentees_private + dr.absentees_nulm + // + + // dr.absentees_others + dr.absentees_nmr), 0), + + // ( + // IFNULL(SUM(dr.permanent + dr.nulm + dr.private + dr.nmr + dr.others), 0) + // - + // IFNULL(SUM(dr.weeklyoff_permanent + dr.weeklyoff_private + dr.weeklyoff_nulm + // + + // dr.weeklyoff_others + dr.weeklyoff_nmr), 0) + // - + // IFNULL(SUM(dr.absentees_permanent + dr.absentees_private + dr.absentees_nulm + // + + // dr.absentees_others + dr.absentees_nmr), 0) + // ), + + // /* food_requested total = present_count total */ + // ( + // IFNULL(SUM(dr.permanent + dr.nulm + dr.private + dr.nmr + dr.others), 0) + // - + // IFNULL(SUM(dr.weeklyoff_permanent + dr.weeklyoff_private + dr.weeklyoff_nulm + // + + // dr.weeklyoff_others + dr.weeklyoff_nmr), 0) + // - + // IFNULL(SUM(dr.absentees_permanent + dr.absentees_private + dr.absentees_nulm + // + + // dr.absentees_others + dr.absentees_nmr), 0) + // ), + + // /* delivered */ + // IFNULL(SUM(gru.total_food_received), 0), + + // /* -------- TOTAL FOOD SHORTFALL -------- */ + // ( + // ( + // IFNULL(SUM(dr.permanent + dr.nulm + dr.private + dr.nmr + dr.others), 0) + // - + // IFNULL(SUM(dr.weeklyoff_permanent + dr.weeklyoff_private + dr.weeklyoff_nulm + // + + // dr.weeklyoff_others + dr.weeklyoff_nmr), 0) + // - + // IFNULL(SUM(dr.absentees_permanent + dr.absentees_private + dr.absentees_nulm + // + + // dr.absentees_others + dr.absentees_nmr), 0) + // ) + // - + // IFNULL(SUM(gru.total_food_received), 0) + // ) + + // FROM daily_request dr + // LEFT JOIN gcc_received_update gru + // ON gru.requestid = dr.requestid + // WHERE dr.required_date = ? + // AND dr.shiftid = ? + + // ) final_output + + // ORDER BY + // CASE WHEN zone = 'TOTAL' THEN 1 ELSE 0 END, + // CAST(zone AS UNSIGNED); + // """; + + // return jdbcTemplate.queryForList(sql, + // /* zone-wise params */ + // date, shiftId, + // date, shiftId, + // date, shiftId, + // date, shiftId, date, shiftId, date, shiftId, + // date, shiftId, date, shiftId, date, shiftId, + // shiftId, date, shiftId, + + // /* shortfall zone params */ + // date, shiftId, date, shiftId, date, shiftId, + // shiftId, date, shiftId, + + // /* total row */ + // date, shiftId); + // } + + // with using isactive isdelete +======= + // yogi +>>>>>>> fabb49a5aeb9c63fb5d5a238dd689811f2cc2643 + public List> getZoneWiseShiftBasedReport(String date, int shiftId) { + + String sql = """ + SELECT * + FROM ( + +<<<<<<< HEAD + /* ================= ZONE-WISE SUMMARY ================= */ + SELECT + z.zone AS zone, + + /* -------- TOTAL COMPLEMENT -------- */ + ( + SELECT IFNULL(SUM(dr.permanent + dr.nulm + dr.private + dr.nmr + dr.others), 0) + FROM daily_request dr + WHERE dr.required_date = ? + AND dr.shiftid = ? + AND dr.isactive = 1 + AND dr.isdelete = 0 + AND dr.request_by IN ( + SELECT lm.siloginid + FROM location_mapping lm + WHERE lm.zone = z.zone + AND lm.isactive = 1 + AND lm.isdelete = 0 + ) + ) AS total_complement, + + /* -------- WEEKLY OFF -------- */ + ( + SELECT IFNULL(SUM(dr.weeklyoff_permanent + dr.weeklyoff_private + + dr.weeklyoff_nulm + dr.weeklyoff_others + dr.weeklyoff_nmr), 0) + FROM daily_request dr + WHERE dr.required_date = ? + AND dr.shiftid = ? + AND dr.isactive = 1 + AND dr.isdelete = 0 + AND dr.request_by IN ( + SELECT lm.siloginid + FROM location_mapping lm + WHERE lm.zone = z.zone + AND lm.isactive = 1 + AND lm.isdelete = 0 + ) + ) AS weekly_off, + + /* -------- PLANNED LEAVE -------- */ + ( + SELECT IFNULL(SUM(dr.absentees_permanent + dr.absentees_private + + dr.absentees_nulm + dr.absentees_others + dr.absentees_nmr), 0) + FROM daily_request dr + WHERE dr.required_date = ? + AND dr.shiftid = ? + AND dr.isactive = 1 + AND dr.isdelete = 0 + AND dr.request_by IN ( + SELECT lm.siloginid + FROM location_mapping lm + WHERE lm.zone = z.zone + AND lm.isactive = 1 + AND lm.isdelete = 0 + ) + ) AS planned_leave, + + /* -------- PRESENT COUNT -------- */ + ( + ( + SELECT IFNULL(SUM(dr.permanent + dr.nulm + dr.private + dr.nmr + dr.others), 0) + FROM daily_request dr + WHERE dr.required_date = ? + AND dr.shiftid = ? + AND dr.isactive = 1 + AND dr.isdelete = 0 + AND dr.request_by IN ( + SELECT lm.siloginid + FROM location_mapping lm + WHERE lm.zone = z.zone + AND lm.isactive = 1 + AND lm.isdelete = 0 + ) + ) + - + ( + SELECT IFNULL(SUM(dr.weeklyoff_permanent + dr.weeklyoff_private + + dr.weeklyoff_nulm + dr.weeklyoff_others + dr.weeklyoff_nmr), 0) + FROM daily_request dr + WHERE dr.required_date = ? + AND dr.shiftid = ? + AND dr.isactive = 1 + AND dr.isdelete = 0 + AND dr.request_by IN ( + SELECT lm.siloginid + FROM location_mapping lm + WHERE lm.zone = z.zone + AND lm.isactive = 1 + AND lm.isdelete = 0 + ) + ) + - + ( + SELECT IFNULL(SUM(dr.absentees_permanent + dr.absentees_private + + dr.absentees_nulm + dr.absentees_others + dr.absentees_nmr), 0) + FROM daily_request dr + WHERE dr.required_date = ? + AND dr.shiftid = ? + AND dr.isactive = 1 + AND dr.isdelete = 0 + AND dr.request_by IN ( + SELECT lm.siloginid + FROM location_mapping lm + WHERE lm.zone = z.zone + AND lm.isactive = 1 + AND lm.isdelete = 0 + ) + ) + ) AS present_count, + + /* -------- FOOD REQUESTED -------- */ + ( + ( + SELECT IFNULL(SUM(dr.permanent + dr.nulm + dr.private + dr.nmr + dr.others), 0) + FROM daily_request dr + WHERE dr.required_date = ? + AND dr.shiftid = ? + AND dr.isactive = 1 + AND dr.isdelete = 0 + AND dr.request_by IN ( + SELECT lm.siloginid + FROM location_mapping lm + WHERE lm.zone = z.zone + AND lm.isactive = 1 + AND lm.isdelete = 0 + ) + ) + - + ( + SELECT IFNULL(SUM(dr.weeklyoff_permanent + dr.weeklyoff_private + + dr.weeklyoff_nulm + dr.weeklyoff_others + dr.weeklyoff_nmr), 0) + FROM daily_request dr + WHERE dr.required_date = ? + AND dr.shiftid = ? + AND dr.isactive = 1 + AND dr.isdelete = 0 + AND dr.request_by IN ( + SELECT lm.siloginid + FROM location_mapping lm + WHERE lm.zone = z.zone + AND lm.isactive = 1 + AND lm.isdelete = 0 + ) + ) + - + ( + SELECT IFNULL(SUM(dr.absentees_permanent + dr.absentees_private + + dr.absentees_nulm + dr.absentees_others + dr.absentees_nmr), 0) + FROM daily_request dr + WHERE dr.required_date = ? + AND dr.shiftid = ? + AND dr.isactive = 1 + AND dr.isdelete = 0 + AND dr.request_by IN ( + SELECT lm.siloginid + FROM location_mapping lm + WHERE lm.zone = z.zone + AND lm.isactive = 1 + AND lm.isdelete = 0 + ) + ) + ) AS food_requested, + + /* -------- FOOD DELIVERED -------- */ +======= + /* ==================== 1. ZONE-WISE SUMMARY ===================== */ + SELECT + z.zone, + + /* FOOD REQUESTED */ + ( + SELECT IFNULL(SUM(gru.total_food_requested), 0) + FROM gcc_received_update gru + WHERE gru.shiftid = ? + AND gru.received_by IN ( + SELECT siloginid FROM location_mapping WHERE zone = z.zone + ) + AND gru.requestid IN ( + SELECT requestid FROM daily_request WHERE required_date = ? + ) + ) AS food_requested, + + /* FOOD DELIVERED */ +>>>>>>> fabb49a5aeb9c63fb5d5a238dd689811f2cc2643 + ( + SELECT IFNULL(SUM(gru.total_food_received), 0) + FROM gcc_received_update gru + WHERE gru.shiftid = ? +<<<<<<< HEAD + AND gru.isactive = 1 + AND gru.isdelete = 0 + AND gru.requestid IN ( + SELECT dr.requestid + FROM daily_request dr + WHERE dr.required_date = ? + AND dr.shiftid = ? + AND dr.isactive = 1 + AND dr.isdelete = 0 + AND dr.request_by IN ( + SELECT lm.siloginid + FROM location_mapping lm + WHERE lm.zone = z.zone + AND lm.isactive = 1 + AND lm.isdelete = 0 + ) + ) + ) AS food_delivered, + + /* -------- FOOD SHORTFALL -------- */ + ( + ( + ( + SELECT IFNULL(SUM(dr.permanent + dr.nulm + dr.private + dr.nmr + dr.others), 0) + FROM daily_request dr + WHERE dr.required_date = ? + AND dr.shiftid = ? + AND dr.isactive = 1 + AND dr.isdelete = 0 + AND dr.request_by IN ( + SELECT lm.siloginid + FROM location_mapping lm + WHERE lm.zone = z.zone + AND lm.isactive = 1 + AND lm.isdelete = 0 + ) + ) + - + ( + SELECT IFNULL(SUM(dr.weeklyoff_permanent + dr.weeklyoff_private + + dr.weeklyoff_nulm + dr.weeklyoff_others + dr.weeklyoff_nmr), 0) + FROM daily_request dr + WHERE dr.required_date = ? + AND dr.shiftid = ? + AND dr.isactive = 1 + AND dr.isdelete = 0 + AND dr.request_by IN ( + SELECT lm.siloginid + FROM location_mapping lm + WHERE lm.zone = z.zone + AND lm.isactive = 1 + AND lm.isdelete = 0 + ) + ) + - + ( + SELECT IFNULL(SUM(dr.absentees_permanent + dr.absentees_private + + dr.absentees_nulm + dr.absentees_others + dr.absentees_nmr), 0) + FROM daily_request dr + WHERE dr.required_date = ? + AND dr.shiftid = ? + AND dr.isactive = 1 + AND dr.isdelete = 0 + AND dr.request_by IN ( + SELECT lm.siloginid + FROM location_mapping lm + WHERE lm.zone = z.zone + AND lm.isactive = 1 + AND lm.isdelete = 0 + ) + ) + ) + - + ( + SELECT IFNULL(SUM(gru.total_food_received), 0) + FROM gcc_received_update gru + WHERE gru.shiftid = ? + AND gru.isactive = 1 + AND gru.isdelete = 0 + AND gru.requestid IN ( + SELECT dr.requestid + FROM daily_request dr + WHERE dr.required_date = ? + AND dr.shiftid = ? + AND dr.isactive = 1 + AND dr.isdelete = 0 + AND dr.request_by IN ( + SELECT lm.siloginid + FROM location_mapping lm + WHERE lm.zone = z.zone + AND lm.isactive = 1 + AND lm.isdelete = 0 + ) + ) + ) +======= + AND gru.received_by IN ( + SELECT siloginid FROM location_mapping WHERE zone = z.zone + ) + AND gru.requestid IN ( + SELECT requestid FROM daily_request WHERE required_date = ? + ) + ) AS food_delivered, + + /* PRESENT */ + ( + SELECT IFNULL(SUM(dr.nulm + dr.private + dr.permanent), 0) + FROM daily_request dr + WHERE dr.required_date = ? + AND dr.shiftid = ? + AND dr.request_by IN ( + SELECT siloginid FROM location_mapping WHERE zone = z.zone + ) + ) AS present_count, + + /* ABSENT */ + ( + SELECT IFNULL(SUM(dr.absentees_nulm + dr.absentees_private + dr.absentees_permanent), 0) + FROM daily_request dr + WHERE dr.required_date = ? + AND dr.shiftid = ? + AND dr.request_by IN ( + SELECT siloginid FROM location_mapping WHERE zone = z.zone + ) + ) AS absent_count, + + /* UNPLANNED */ + ( + SELECT IFNULL(SUM(gru.today_absentees_nulm + + gru.today_absentees_private + + gru.today_absentees_permanent), 0) + FROM gcc_received_update gru + WHERE gru.shiftid = ? + AND gru.requestid IN ( + SELECT requestid FROM daily_request WHERE required_date = ? + ) + AND gru.received_by IN ( + SELECT siloginid FROM location_mapping WHERE zone = z.zone + ) + ) AS unplanned_count, + + /* FOOD SHORTFALL */ + ( + SELECT IFNULL(SUM(gru.total_box_shortfall), 0) + FROM gcc_received_update gru + WHERE gru.shiftid = ? + AND gru.received_by IN ( + SELECT siloginid FROM location_mapping WHERE zone = z.zone + ) + AND gru.requestid IN ( + SELECT requestid FROM daily_request WHERE required_date = ? + ) +>>>>>>> fabb49a5aeb9c63fb5d5a238dd689811f2cc2643 + ) AS food_shortfall + + FROM ( + SELECT DISTINCT zone + FROM location_mapping + WHERE zone IS NOT NULL +<<<<<<< HEAD + AND isactive = 1 + AND isdelete = 0 + ORDER BY CAST(zone AS UNSIGNED) + ) z + + UNION ALL + + /* ================= GRAND TOTAL ================= */ + SELECT + 'TOTAL' AS zone, + + IFNULL(SUM(dr.permanent + dr.nulm + dr.private + dr.nmr + dr.others), 0), + IFNULL(SUM(dr.weeklyoff_permanent + dr.weeklyoff_private + dr.weeklyoff_nulm + + dr.weeklyoff_others + dr.weeklyoff_nmr), 0), + IFNULL(SUM(dr.absentees_permanent + dr.absentees_private + dr.absentees_nulm + + dr.absentees_others + dr.absentees_nmr), 0), + + ( + IFNULL(SUM(dr.permanent + dr.nulm + dr.private + dr.nmr + dr.others), 0) + - + IFNULL(SUM(dr.weeklyoff_permanent + dr.weeklyoff_private + dr.weeklyoff_nulm + + dr.weeklyoff_others + dr.weeklyoff_nmr), 0) + - + IFNULL(SUM(dr.absentees_permanent + dr.absentees_private + dr.absentees_nulm + + dr.absentees_others + dr.absentees_nmr), 0) + ), + + ( + IFNULL(SUM(dr.permanent + dr.nulm + dr.private + dr.nmr + dr.others), 0) + - + IFNULL(SUM(dr.weeklyoff_permanent + dr.weeklyoff_private + dr.weeklyoff_nulm + + dr.weeklyoff_others + dr.weeklyoff_nmr), 0) + - + IFNULL(SUM(dr.absentees_permanent + dr.absentees_private + dr.absentees_nulm + + dr.absentees_others + dr.absentees_nmr), 0) + ), + + IFNULL(SUM(gru.total_food_received), 0), + + ( + ( + IFNULL(SUM(dr.permanent + dr.nulm + dr.private + dr.nmr + dr.others), 0) + - + IFNULL(SUM(dr.weeklyoff_permanent + dr.weeklyoff_private + dr.weeklyoff_nulm + + dr.weeklyoff_others + dr.weeklyoff_nmr), 0) + - + IFNULL(SUM(dr.absentees_permanent + dr.absentees_private + dr.absentees_nulm + + dr.absentees_others + dr.absentees_nmr), 0) + ) + - + IFNULL(SUM(gru.total_food_received), 0) + ) + + FROM daily_request dr + LEFT JOIN gcc_received_update gru + ON gru.requestid = dr.requestid + AND gru.isactive = 1 + AND gru.isdelete = 0 + WHERE dr.required_date = ? + AND dr.shiftid = ? + AND dr.isactive = 1 + AND dr.isdelete = 0 + + ) final_output +======= + ) z + + + UNION ALL + + /* ==================== 2. GRAND TOTAL ===================== */ + SELECT + 'TOTAL' AS zone, + + (SELECT IFNULL(SUM(total_food_requested), 0) + FROM gcc_received_update + WHERE shiftid = ? + AND requestid IN (SELECT requestid FROM daily_request WHERE required_date = ?) + ) AS food_requested, + + (SELECT IFNULL(SUM(total_food_received), 0) + FROM gcc_received_update + WHERE shiftid = ? + AND requestid IN (SELECT requestid FROM daily_request WHERE required_date = ?) + ) AS food_delivered, + + (SELECT IFNULL(SUM(nulm + private + permanent), 0) + FROM daily_request + WHERE required_date = ? AND shiftid = ? + ) AS present_count, + + (SELECT IFNULL(SUM(absentees_nulm + absentees_private + absentees_permanent), 0) + FROM daily_request + WHERE required_date = ? AND shiftid = ? + ) AS absent_count, + + (SELECT IFNULL(SUM(today_absentees_nulm + + today_absentees_private + + today_absentees_permanent), 0) + FROM gcc_received_update + WHERE shiftid = ? + AND requestid IN (SELECT requestid FROM daily_request WHERE required_date = ?) + ) AS unplanned_count, + + (SELECT IFNULL(SUM(total_box_shortfall), 0) + FROM gcc_received_update + WHERE shiftid = ? + AND requestid IN (SELECT requestid FROM daily_request WHERE required_date = ?) + ) AS food_shortfall + + ) AS final_output +>>>>>>> fabb49a5aeb9c63fb5d5a238dd689811f2cc2643 + + ORDER BY + CASE WHEN zone = 'TOTAL' THEN 1 ELSE 0 END, + CAST(zone AS UNSIGNED); + """; + +<<<<<<< HEAD + return jdbcTemplate.queryForList( + sql, + + /* zone-wise params */ + date, shiftId, + date, shiftId, + date, shiftId, + date, shiftId, date, shiftId, date, shiftId, + date, shiftId, date, shiftId, date, shiftId, + shiftId, date, shiftId, + + /* shortfall zone params */ + date, shiftId, date, shiftId, date, shiftId, + shiftId, date, shiftId, + + /* total row */ + date, shiftId); + } + + // without using isactive and isdelete + // public List> getWardWiseShiftReport(Integer shiftId, + // Integer zone, String date) { + + // String sql = """ + // WITH ward_data AS ( + // SELECT + // w.ward, + // IFNULL(SUM(dr.permanent + dr.nulm + dr.private + dr.nmr + dr.others),0) AS + // total_complement, + // IFNULL(SUM(dr.weeklyoff_permanent + dr.weeklyoff_private + dr.weeklyoff_nulm + // + dr.weeklyoff_others + dr.weeklyoff_nmr),0) AS weekly_off, + // IFNULL(SUM(dr.absentees_permanent + dr.absentees_private + dr.absentees_nulm + // + dr.absentees_others + dr.absentees_nmr),0) AS planned_leave, + + // -- PRESENT COUNT + // ( + // IFNULL(SUM(dr.permanent + dr.nulm + dr.private + dr.nmr + dr.others),0) + // - IFNULL(SUM(dr.weeklyoff_permanent + dr.weeklyoff_private + + // dr.weeklyoff_nulm + dr.weeklyoff_others + dr.weeklyoff_nmr),0) + // - IFNULL(SUM(dr.absentees_permanent + dr.absentees_private + + // dr.absentees_nulm + dr.absentees_others + dr.absentees_nmr),0) + // ) AS present_count, + + // -- FOOD REQUESTED + // ( + // IFNULL(SUM(dr.permanent + dr.nulm + dr.private + dr.nmr + dr.others),0) + // - IFNULL(SUM(dr.weeklyoff_permanent + dr.weeklyoff_private + + // dr.weeklyoff_nulm + dr.weeklyoff_others + dr.weeklyoff_nmr),0) + // - IFNULL(SUM(dr.absentees_permanent + dr.absentees_private + + // dr.absentees_nulm + dr.absentees_others + dr.absentees_nmr),0) + // ) AS food_requested, + + // IFNULL(SUM(gru.total_food_received),0) AS food_delivered, + + // -- FOOD SHORTFALL (corrected logic) + // CASE + // WHEN IFNULL(SUM(gru.total_food_received),0) >= ( + // IFNULL(SUM(dr.permanent + dr.nulm + dr.private + dr.nmr),0) + // - IFNULL(SUM(dr.weeklyoff_permanent + dr.weeklyoff_nulm + + // dr.weeklyoff_private + dr.weeklyoff_nmr),0) + // - IFNULL(SUM(dr.absentees_permanent + dr.absentees_nulm + + // dr.absentees_private + dr.absentees_nmr),0) + // ) + // THEN 0 + // ELSE ( + // ( + // IFNULL(SUM(dr.permanent + dr.nulm + dr.private + dr.nmr),0) + // - IFNULL(SUM(dr.weeklyoff_permanent + dr.weeklyoff_nulm + + // dr.weeklyoff_private + dr.weeklyoff_nmr),0) + // - IFNULL(SUM(dr.absentees_permanent + dr.absentees_nulm + + // dr.absentees_private + dr.absentees_nmr),0) + // ) + // - IFNULL(SUM(gru.total_food_received),0) + // ) + // END AS food_shortfall + + // FROM (SELECT DISTINCT ward FROM location_mapping WHERE zone = ? AND ward IS + // NOT NULL) w + // LEFT JOIN location_mapping lm ON lm.ward = w.ward AND lm.zone = ? + // LEFT JOIN daily_request dr ON dr.request_by = lm.siloginid + // AND dr.required_date = ? + // AND dr.shiftid = ? + // LEFT JOIN gcc_received_update gru ON gru.requestid = dr.requestid + + // GROUP BY w.ward + // ) + + // SELECT * FROM ward_data + + // UNION ALL + + // SELECT + // 'TOTAL' AS ward, + // SUM(total_complement), + // SUM(weekly_off), + // SUM(planned_leave), + // SUM(present_count), + // SUM(food_requested), + // SUM(food_delivered), + // SUM(food_shortfall) + // FROM ward_data + + // ORDER BY CASE WHEN ward = 'TOTAL' THEN 1 ELSE 0 END, ward; + // """; + + // Object[] params = new Object[] { + // zone, // w.zone + // zone, // lm.zone + // date, // dr.required_date + // shiftId // dr.shiftid + // }; + + // return jdbcTemplate.queryForList(sql, params); + // } + + // with using isactive isdelete + public List> getWardWiseShiftReport(Integer shiftId, Integer zone, String date) { + + String sql = """ + WITH ward_data AS ( + SELECT + w.ward, + + /* TOTAL COMPLEMENT */ + IFNULL(SUM(dr.permanent + dr.nulm + dr.private + dr.nmr + dr.others), 0) AS total_complement, + + /* WEEKLY OFF */ + IFNULL(SUM( + dr.weeklyoff_permanent + dr.weeklyoff_private + + dr.weeklyoff_nulm + dr.weeklyoff_others + dr.weeklyoff_nmr + ), 0) AS weekly_off, + + /* PLANNED LEAVE */ + IFNULL(SUM( + dr.absentees_permanent + dr.absentees_private + + dr.absentees_nulm + dr.absentees_others + dr.absentees_nmr + ), 0) AS planned_leave, + + /* PRESENT COUNT */ + ( + IFNULL(SUM(dr.permanent + dr.nulm + dr.private + dr.nmr + dr.others), 0) + - + IFNULL(SUM( + dr.weeklyoff_permanent + dr.weeklyoff_private + + dr.weeklyoff_nulm + dr.weeklyoff_others + dr.weeklyoff_nmr + ), 0) + - + IFNULL(SUM( + dr.absentees_permanent + dr.absentees_private + + dr.absentees_nulm + dr.absentees_others + dr.absentees_nmr + ), 0) + ) AS present_count, + + /* FOOD REQUESTED */ + ( + IFNULL(SUM(dr.permanent + dr.nulm + dr.private + dr.nmr + dr.others), 0) + - + IFNULL(SUM( + dr.weeklyoff_permanent + dr.weeklyoff_private + + dr.weeklyoff_nulm + dr.weeklyoff_others + dr.weeklyoff_nmr + ), 0) + - + IFNULL(SUM( + dr.absentees_permanent + dr.absentees_private + + dr.absentees_nulm + dr.absentees_others + dr.absentees_nmr + ), 0) + ) AS food_requested, + + /* FOOD DELIVERED */ + IFNULL(SUM(gru.total_food_received), 0) AS food_delivered, + + /* FOOD SHORTFALL */ + CASE + WHEN IFNULL(SUM(gru.total_food_received), 0) >= + ( + IFNULL(SUM(dr.permanent + dr.nulm + dr.private + dr.nmr + dr.others), 0) + - + IFNULL(SUM( + dr.weeklyoff_permanent + dr.weeklyoff_private + + dr.weeklyoff_nulm + dr.weeklyoff_others + dr.weeklyoff_nmr + ), 0) + - + IFNULL(SUM( + dr.absentees_permanent + dr.absentees_private + + dr.absentees_nulm + dr.absentees_others + dr.absentees_nmr + ), 0) + ) + THEN 0 + ELSE + ( + ( + IFNULL(SUM(dr.permanent + dr.nulm + dr.private + dr.nmr + dr.others), 0) + - + IFNULL(SUM( + dr.weeklyoff_permanent + dr.weeklyoff_private + + dr.weeklyoff_nulm + dr.weeklyoff_others + dr.weeklyoff_nmr + ), 0) + - + IFNULL(SUM( + dr.absentees_permanent + dr.absentees_private + + dr.absentees_nulm + dr.absentees_others + dr.absentees_nmr + ), 0) + ) + - + IFNULL(SUM(gru.total_food_received), 0) + ) + END AS food_shortfall + + FROM ( + SELECT DISTINCT ward + FROM location_mapping + WHERE zone = ? + AND ward IS NOT NULL + AND isactive = 1 + AND isdelete = 0 + ) w + + LEFT JOIN location_mapping lm + ON lm.ward = w.ward + AND lm.zone = ? + AND lm.isactive = 1 + AND lm.isdelete = 0 + + LEFT JOIN daily_request dr + ON dr.request_by = lm.siloginid + AND dr.required_date = ? + AND dr.shiftid = ? + AND dr.isactive = 1 + AND dr.isdelete = 0 + + LEFT JOIN gcc_received_update gru + ON gru.requestid = dr.requestid + AND gru.isactive = 1 + AND gru.isdelete = 0 + + GROUP BY w.ward + ) + + SELECT * FROM ward_data + + UNION ALL + + SELECT + 'TOTAL' AS ward, + SUM(total_complement), + SUM(weekly_off), + SUM(planned_leave), + SUM(present_count), + SUM(food_requested), + SUM(food_delivered), + SUM(food_shortfall) + FROM ward_data + + ORDER BY + CASE WHEN ward = 'TOTAL' THEN 1 ELSE 0 END, + ward; + """; + + Object[] params = new Object[] { + zone, // ward subquery zone + zone, // lm.zone + date, // dr.required_date + shiftId // dr.shiftid + }; + + return jdbcTemplate.queryForList(sql, params); + } + + // without using isactive and isdelete + // public List> getWardLocationWiseReport(String date) { + + // String sql = """ + // SELECT * FROM ( + // -- ================= LOCATION WISE ================= + // SELECT + // lm.driverid, + // lm.zone, + // lm.ward, + // lm.location, + // IFNULL(SUM(dr.permanent + dr.nulm + dr.private + dr.nmr + dr.others),0) AS + // total_complement, + // IFNULL(SUM(dr.weeklyoff_permanent + dr.weeklyoff_private + dr.weeklyoff_nulm + // + dr.weeklyoff_others + dr.weeklyoff_nmr),0) AS weekly_off, + // IFNULL(SUM(dr.absentees_permanent + dr.absentees_private + dr.nulm + + // dr.absentees_others + dr.absentees_nmr),0) AS planned_leave, + // (IFNULL(SUM(dr.permanent + dr.nulm + dr.private + dr.nmr + dr.others),0) + // - IFNULL(SUM(dr.weeklyoff_permanent + dr.weeklyoff_private + dr.nulm + + // dr.weeklyoff_others + dr.weeklyoff_nmr),0) + // - IFNULL(SUM(dr.absentees_permanent + dr.absentees_private + dr.nulm + + // dr.absentees_others + dr.absentees_nmr),0) + // ) AS present_count, + // (IFNULL(SUM(dr.permanent + dr.nulm + dr.private + dr.nmr + dr.others),0) + // - IFNULL(SUM(dr.weeklyoff_permanent + dr.weeklyoff_private + dr.nulm + + // dr.weeklyoff_others + dr.weeklyoff_nmr),0) + // - IFNULL(SUM(dr.absentees_permanent + dr.absentees_private + dr.nulm + + // dr.absentees_others + dr.absentees_nmr),0) + // ) AS food_requested, + // IFNULL(SUM(gru.total_food_received),0) AS food_delivered, + // -- ===== FOOD SHORTFALL LOGIC ===== + // (IFNULL(SUM(dr.permanent + dr.nulm + dr.private + dr.nmr + dr.others),0) + // - IFNULL(SUM(dr.weeklyoff_permanent + dr.weeklyoff_private + dr.nulm + + // dr.weeklyoff_others + dr.weeklyoff_nmr),0) + // - IFNULL(SUM(dr.absentees_permanent + dr.absentees_private + dr.nulm + + // dr.absentees_others + dr.absentees_nmr),0) + // ) - IFNULL(SUM(gru.total_food_received),0) AS food_shortfall + // FROM location_mapping lm + // LEFT JOIN daily_request dr + // ON dr.request_by = lm.siloginid AND dr.required_date = ? + // LEFT JOIN gcc_received_update gru + // ON gru.received_by = lm.siloginid AND gru.requestid = dr.requestid + // WHERE lm.ward IS NOT NULL AND lm.location IS NOT NULL + // GROUP BY lm.driverid, lm.zone, lm.ward, lm.location + + // UNION ALL + + // -- ================= TOTAL ROW ================= + // SELECT + // 999999 AS driverid, + // 'TOTAL' AS zone, + // 'TOTAL' AS ward, + // 'TOTAL' AS location, + // IFNULL(SUM(dr.permanent + dr.nulm + dr.private + dr.nmr + dr.others),0) AS + // total_complement, + // IFNULL(SUM(dr.weeklyoff_permanent + dr.weeklyoff_private + dr.weeklyoff_nulm + // + dr.weeklyoff_others + dr.weeklyoff_nmr),0) AS weekly_off, + // IFNULL(SUM(dr.absentees_permanent + dr.absentees_private + dr.nulm + + // dr.absentees_others + dr.absentees_nmr),0) AS planned_leave, + // (IFNULL(SUM(dr.permanent + dr.nulm + dr.private + dr.nmr + dr.others),0) + // - IFNULL(SUM(dr.weeklyoff_permanent + dr.weeklyoff_private + + // dr.weeklyoff_nulm + dr.weeklyoff_others + dr.weeklyoff_nmr),0) + // - IFNULL(SUM(dr.absentees_permanent + dr.absentees_private + dr.nulm + + // dr.absentees_others + dr.absentees_nmr),0) + // ) AS present_count, + // (IFNULL(SUM(dr.permanent + dr.nulm + dr.private + dr.nmr + dr.others),0) + // - IFNULL(SUM(dr.weeklyoff_permanent + dr.weeklyoff_private + dr.nulm + + // dr.weeklyoff_others + dr.weeklyoff_nmr),0) + // - IFNULL(SUM(dr.absentees_permanent + dr.absentees_private + dr.nulm + + // dr.absentees_others + dr.absentees_nmr),0) + // ) AS food_requested, + // IFNULL(SUM(gru.total_food_received),0) AS food_delivered, + // -- ===== FOOD SHORTFALL TOTAL ===== + // (IFNULL(SUM(dr.permanent + dr.nulm + dr.private + dr.nmr + dr.others),0) + // - IFNULL(SUM(dr.weeklyoff_permanent + dr.weeklyoff_private + dr.nulm + + // dr.weeklyoff_others + dr.weeklyoff_nmr),0) + // - IFNULL(SUM(dr.absentees_permanent + dr.absentees_private + dr.nulm + + // dr.absentees_others + dr.absentees_nmr),0) + // ) - IFNULL(SUM(gru.total_food_received),0) AS food_shortfall + // FROM daily_request dr + // LEFT JOIN gcc_received_update gru ON gru.requestid = dr.requestid + // WHERE dr.required_date = ? + // ) final_output + // ORDER BY driverid ASC + // """; + + // Object[] params = new Object[] { date, date }; // first for location JOIN, + // second for TOTAL row + // return jdbcTemplate.queryForList(sql, params); + // } + + // with using isactive isdelete + public List> getWardLocationWiseReport(String date) { + + String sql = """ + SELECT * FROM ( + /* ================= LOCATION WISE ================= */ + SELECT + lm.driverid, + lm.zone, + lm.ward, + lm.location, + + /* TOTAL COMPLEMENT */ + IFNULL(SUM(dr.permanent + dr.nulm + dr.private + dr.nmr + dr.others), 0) AS total_complement, + + /* WEEKLY OFF */ + IFNULL(SUM( + dr.weeklyoff_permanent + dr.weeklyoff_private + + dr.weeklyoff_nulm + dr.weeklyoff_others + dr.weeklyoff_nmr + ), 0) AS weekly_off, + + /* PLANNED LEAVE */ + IFNULL(SUM( + dr.absentees_permanent + dr.absentees_private + + dr.absentees_nulm + dr.absentees_others + dr.absentees_nmr + ), 0) AS planned_leave, + + /* PRESENT COUNT */ + ( + IFNULL(SUM(dr.permanent + dr.nulm + dr.private + dr.nmr + dr.others), 0) + - + IFNULL(SUM( + dr.weeklyoff_permanent + dr.weeklyoff_private + + dr.weeklyoff_nulm + dr.weeklyoff_others + dr.weeklyoff_nmr + ), 0) + - + IFNULL(SUM( + dr.absentees_permanent + dr.absentees_private + + dr.absentees_nulm + dr.absentees_others + dr.absentees_nmr + ), 0) + ) AS present_count, + + /* FOOD REQUESTED */ + ( + IFNULL(SUM(dr.permanent + dr.nulm + dr.private + dr.nmr + dr.others), 0) + - + IFNULL(SUM( + dr.weeklyoff_permanent + dr.weeklyoff_private + + dr.weeklyoff_nulm + dr.weeklyoff_others + dr.weeklyoff_nmr + ), 0) + - + IFNULL(SUM( + dr.absentees_permanent + dr.absentees_private + + dr.absentees_nulm + dr.absentees_others + dr.absentees_nmr + ), 0) + ) AS food_requested, + + /* FOOD DELIVERED */ + IFNULL(SUM(gru.total_food_received), 0) AS food_delivered, + + /* FOOD SHORTFALL */ + ( + ( + IFNULL(SUM(dr.permanent + dr.nulm + dr.private + dr.nmr + dr.others), 0) + - + IFNULL(SUM( + dr.weeklyoff_permanent + dr.weeklyoff_private + + dr.weeklyoff_nulm + dr.weeklyoff_others + dr.weeklyoff_nmr + ), 0) + - + IFNULL(SUM( + dr.absentees_permanent + dr.absentees_private + + dr.absentees_nulm + dr.absentees_others + dr.absentees_nmr + ), 0) + ) + - + IFNULL(SUM(gru.total_food_received), 0) + ) AS food_shortfall + + FROM location_mapping lm + LEFT JOIN daily_request dr + ON dr.request_by = lm.siloginid + AND dr.required_date = ? + AND dr.isactive = 1 + AND dr.isdelete = 0 + + LEFT JOIN gcc_received_update gru + ON gru.requestid = dr.requestid + AND gru.received_by = lm.siloginid + AND gru.isactive = 1 + AND gru.isdelete = 0 + + WHERE lm.ward IS NOT NULL + AND lm.location IS NOT NULL + AND lm.isactive = 1 + AND lm.isdelete = 0 + + GROUP BY + lm.driverid, + lm.zone, + lm.ward, + lm.location + + UNION ALL + + /* ================= TOTAL ROW ================= */ + SELECT + 999999 AS driverid, + 'TOTAL' AS zone, + 'TOTAL' AS ward, + 'TOTAL' AS location, + + IFNULL(SUM(dr.permanent + dr.nulm + dr.private + dr.nmr + dr.others), 0), + IFNULL(SUM( + dr.weeklyoff_permanent + dr.weeklyoff_private + + dr.weeklyoff_nulm + dr.weeklyoff_others + dr.weeklyoff_nmr + ), 0), + IFNULL(SUM( + dr.absentees_permanent + dr.absentees_private + + dr.absentees_nulm + dr.absentees_others + dr.absentees_nmr + ), 0), + + ( + IFNULL(SUM(dr.permanent + dr.nulm + dr.private + dr.nmr + dr.others), 0) + - + IFNULL(SUM( + dr.weeklyoff_permanent + dr.weeklyoff_private + + dr.weeklyoff_nulm + dr.weeklyoff_others + dr.weeklyoff_nmr + ), 0) + - + IFNULL(SUM( + dr.absentees_permanent + dr.absentees_private + + dr.absentees_nulm + dr.absentees_others + dr.absentees_nmr + ), 0) + ), + + ( + IFNULL(SUM(dr.permanent + dr.nulm + dr.private + dr.nmr + dr.others), 0) + - + IFNULL(SUM( + dr.weeklyoff_permanent + dr.weeklyoff_private + + dr.weeklyoff_nulm + dr.weeklyoff_others + dr.weeklyoff_nmr + ), 0) + - + IFNULL(SUM( + dr.absentees_permanent + dr.absentees_private + + dr.absentees_nulm + dr.absentees_others + dr.absentees_nmr + ), 0) + ), + + IFNULL(SUM(gru.total_food_received), 0), + + ( + ( + IFNULL(SUM(dr.permanent + dr.nulm + dr.private + dr.nmr + dr.others), 0) + - + IFNULL(SUM( + dr.weeklyoff_permanent + dr.weeklyoff_private + + dr.weeklyoff_nulm + dr.weeklyoff_others + dr.weeklyoff_nmr + ), 0) + - + IFNULL(SUM( + dr.absentees_permanent + dr.absentees_private + + dr.absentees_nulm + dr.absentees_others + dr.absentees_nmr + ), 0) + ) + - + IFNULL(SUM(gru.total_food_received), 0) + ) + + FROM daily_request dr + LEFT JOIN gcc_received_update gru + ON gru.requestid = dr.requestid + AND gru.isactive = 1 + AND gru.isdelete = 0 + WHERE dr.required_date = ? + AND dr.isactive = 1 + AND dr.isdelete = 0 + + ) final_output + ORDER BY driverid ASC + """; + + Object[] params = new Object[] { + date, // location-wise join + date // total row + }; + + return jdbcTemplate.queryForList(sql, params); + } + +} + +======= + // parameters repeated in correct order + return jdbcTemplate.queryForList(sql, + shiftId, date, + shiftId, date, + date, shiftId, + date, shiftId, + shiftId, date, + shiftId, date, + + /* total section */ + shiftId, date, + shiftId, date, + date, shiftId, + date, shiftId, + shiftId, date, + shiftId, date); + } + + // yogi + public List> getWardLocationWiseReport(String date) { + + String sql = "SELECT ward, location, food_requested, food_delivered, present_count, absent_count, unplanned_count, food_shortfall " + + + "FROM (" + + " SELECT lm.driverid, lm.ward, lm.location, " + + " (SELECT IFNULL(SUM(gru.total_food_requested),0) FROM gcc_received_update gru " + + " WHERE gru.received_by IN (SELECT siloginid FROM location_mapping WHERE ward=lm.ward AND location=lm.location) " + + + " AND gru.requestid IN (SELECT requestid FROM daily_request WHERE required_date = ?)) AS food_requested, " + + + " (SELECT IFNULL(SUM(gru.total_food_received),0) FROM gcc_received_update gru " + + " WHERE gru.received_by IN (SELECT siloginid FROM location_mapping WHERE ward=lm.ward AND location=lm.location) " + + + " AND gru.requestid IN (SELECT requestid FROM daily_request WHERE required_date = ?)) AS food_delivered, " + + + " (SELECT IFNULL(SUM(dr.nulm + dr.private + dr.permanent),0) FROM daily_request dr " + + " WHERE dr.required_date = ? " + + " AND dr.request_by IN (SELECT siloginid FROM location_mapping WHERE ward=lm.ward AND location=lm.location)) AS present_count, " + + + " (SELECT IFNULL(SUM(dr.absentees_nulm + dr.absentees_private + dr.absentees_permanent),0) FROM daily_request dr " + + + " WHERE dr.required_date = ? " + + " AND dr.request_by IN (SELECT siloginid FROM location_mapping WHERE ward=lm.ward AND location=lm.location)) AS absent_count, " + + + " (SELECT IFNULL(SUM(gru.today_absentees_nulm + gru.today_absentees_private + gru.today_absentees_permanent),0) FROM gcc_received_update gru " + + + " WHERE gru.requestid IN (SELECT requestid FROM daily_request WHERE required_date = ?) " + + " AND gru.received_by IN (SELECT siloginid FROM location_mapping WHERE ward=lm.ward AND location=lm.location)) AS unplanned_count, " + + + " (SELECT IFNULL(SUM(gru.total_box_shortfall),0) FROM gcc_received_update gru " + + " WHERE gru.received_by IN (SELECT siloginid FROM location_mapping WHERE ward=lm.ward AND location=lm.location) " + + + " AND gru.requestid IN (SELECT requestid FROM daily_request WHERE required_date = ?)) AS food_shortfall " + + + " FROM location_mapping lm " + + " WHERE lm.ward IS NOT NULL AND lm.location IS NOT NULL " + + " GROUP BY lm.driverid, lm.ward, lm.location " + + " UNION ALL " + + " SELECT 999999 AS driverid, 'TOTAL' AS ward, 'TOTAL' AS location, " + + " (SELECT IFNULL(SUM(total_food_requested),0) FROM gcc_received_update WHERE requestid IN (SELECT requestid FROM daily_request WHERE required_date = ?)), " + + + " (SELECT IFNULL(SUM(total_food_received),0) FROM gcc_received_update WHERE requestid IN (SELECT requestid FROM daily_request WHERE required_date = ?)), " + + + " (SELECT IFNULL(SUM(nulm + private + permanent),0) FROM daily_request WHERE required_date = ?), " + + + " (SELECT IFNULL(SUM(absentees_nulm + absentees_private + absentees_permanent),0) FROM daily_request WHERE required_date = ?), " + + + " (SELECT IFNULL(SUM(today_absentees_nulm + today_absentees_private + today_absentees_permanent),0) FROM gcc_received_update WHERE requestid IN (SELECT requestid FROM daily_request WHERE required_date = ?)), " + + + " (SELECT IFNULL(SUM(total_box_shortfall),0) FROM gcc_received_update WHERE requestid IN (SELECT requestid FROM daily_request WHERE required_date = ?)) " + + + ") AS final_output " + + "ORDER BY driverid ASC"; + + return jdbcTemplate.queryForList(sql, date, date, date, date, date, date, date, date, date, date, date, date); + } + +} +>>>>>>> fabb49a5aeb9c63fb5d5a238dd689811f2cc2643 +/* + * String sql = "SELECT lm.location AS LocationDescription, "+ + * "dl.username AS DriverName, "+ + * " CONCAT('" + * +fileBaseUrl+"/gccofficialapp/files',dss_start.image) as upload_image_url, "+ + * " CONCAT(dss_start.latitude, ', ', dss_start.longitude) AS StartPoint, "+ + * "Date(dss_start.datetime) AS StartTime, "+ + * + * " CONCAT(dss_stop.latitude, ', ', dss_stop.longitude) AS EndPoint, "+ + * Date(dss_stop.datetime) AS EndTime + * + * FROM location_mapping lm + * INNER JOIN driver_login dl + * ON dl.loginid = lm.driverid + * + * LEFT JOIN driver_start_stop dss_start + * ON dss_start.loginid = lm.driverid + * AND dss_start.action = 'Start' + * + * + * LEFT JOIN driver_start_stop dss_stop + * ON dss_stop.loginid = lm.driverid + * AND dss_stop.action = 'Stop' + * AND dss_stop.startid = dss_start.locationid + * WHERE DATE(dss_start.datetime) = ?"; + * change for full query + */ \ No newline at end of file diff --git a/src/main/resources/templates/modules/food_scheme/driverreport.html b/src/main/resources/templates/modules/food_scheme/driverreport.html new file mode 100644 index 0000000..c26c217 --- /dev/null +++ b/src/main/resources/templates/modules/food_scheme/driverreport.html @@ -0,0 +1,677 @@ + + + + + Food Scheme Operations Dashboard + + + + + + + + + + + + + + +
+

Food Scheme Report

+
+ + + +<<<<<<< HEAD +
+
+ +
+
Driver Logistics Report
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ +
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + +======= +
+
+ +
+
Driver Logistics Report
+ +
+ + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + +
+
+>>>>>>> fabb49a5aeb9c63fb5d5a238dd689811f2cc2643 + + + + + + + + + + + + + + + + + + + + + + + + +<<<<<<< HEAD + + + + + \ No newline at end of file diff --git a/src/main/resources/templates/modules/food_scheme/feedbackreport.html b/src/main/resources/templates/modules/food_scheme/feedbackreport.html new file mode 100644 index 0000000..99a8a1f --- /dev/null +++ b/src/main/resources/templates/modules/food_scheme/feedbackreport.html @@ -0,0 +1,858 @@ + + + + + Feedback Summary Report + + + + +<<<<<<< HEAD + + + + + +
+

Food Scheme – Feedback Summary

+
+ +
+
+ +
+<<<<<<< HEAD +
Feedback Summary
+ +
+ + +
+
+ +
+ +
+
Feedback - Food Distribution Time
+ + + + + + + + + +
CategoryCount
+
+ +
+
Feedback - Food Taste
+ + + + + + + + +
CategoryCount
+
+ +
+
Feedback - Food Quantity
+ + + + + + + + +
CategoryCount
+
+ +
+ + +
+
+ + + + + + + + + + + + + + + + +<<<<<<< HEAD + + + + +======= + + + + + + + + +>>>>>>> fabb49a5aeb9c63fb5d5a238dd689811f2cc2643 + + + + + + + + + + + + +<<<<<<< HEAD + +======= + +>>>>>>> fabb49a5aeb9c63fb5d5a238dd689811f2cc2643 diff --git a/src/main/resources/templates/modules/food_scheme/foodschemereport.html b/src/main/resources/templates/modules/food_scheme/foodschemereport.html new file mode 100644 index 0000000..e3b00a8 --- /dev/null +++ b/src/main/resources/templates/modules/food_scheme/foodschemereport.html @@ -0,0 +1,1748 @@ + + + + + + + +<<<<<<< HEAD + Food Distribution Operations Dashboard +======= + Food Scheme Operations Dashboard +>>>>>>> fabb49a5aeb9c63fb5d5a238dd689811f2cc2643 + + + + + + + + + + + + + + +
+<<<<<<< HEAD +

Food Distribution Report

+======= +

Food Scheme Report

+>>>>>>> fabb49a5aeb9c63fb5d5a238dd689811f2cc2643 +
+ + + +
+
+<<<<<<< HEAD +
Shift Wise Overview
+======= +
Food Scheme
+>>>>>>> fabb49a5aeb9c63fb5d5a238dd689811f2cc2643 + +
+ + + + + + + +
+ + +
+<<<<<<< HEAD + +>>>>>>> fabb49a5aeb9c63fb5d5a238dd689811f2cc2643 + Absent Count + Food Shortfall + + + + + +<<<<<<< HEAD + --> + + + + + + + + + + + + + + + + +======= +>>>>>>> fabb49a5aeb9c63fb5d5a238dd689811f2cc2643 +
ShiftTotal ComplementWeekly OffPlanned LeavePresent CountFood RequestedFood DeliveredFood Shortfall
+
+
+ + + +
+
+<<<<<<< HEAD +
Shift A - Daily Food Menu
+======= +
Shift A Daily Food Menu
+>>>>>>> fabb49a5aeb9c63fb5d5a238dd689811f2cc2643 + + + + + + + + + + + + + + + + +<<<<<<< HEAD + + + + + + + +======= + + + + + + + +>>>>>>> fabb49a5aeb9c63fb5d5a238dd689811f2cc2643 + + +
SundayMondayTuesdayWednesdayThursdayFridaySaturday
Sambar Rice (650g) & Porial (100g)Lemon Rice (5000g) & Potato/yam/Raw banana fry (100g)Veg Biryani (500g) & Brinjal Onion (75g)Tomato Rice (500g) & Potato/yam/Raw banana fry (100g)Coriander/Mint Rice (500g) & Potato/yam/Raw banana fry (100g)Tamarind Rice (500g) & Potato/yam/Raw banana fry (100g)Veg Biryani (500g) & Brinjal Onion (75g)Semiya Kitchadi (500g) & Sambar (250g)Idly (6*50g), Medhu Vadai (50g) & Sambar(250 g)Rava Kitchadi(500g) & Red Chutney (100g)Veg Biryani (500g) & Brinjal Onion (75g)Pongal (500g) & Sambar (250g)Rava Upma (500g) & Mint/Coriander Cocunut Chutney (100g)Rava Pongal (500g) & sambar (250g)
+ +
+
+ + + + + + + + + +
+
+ + +<<<<<<< HEAD + +>>>>>>> fabb49a5aeb9c63fb5d5a238dd689811f2cc2643 +
+ + + + + + + + + + + + +
zonePresent CountAbsent CountFood RequestedFood DeliveredFood Shortfall
+
+<<<<<<< HEAD +
--> + +
+
+
+
Zone wise Overallview
+ +
+ + +
+ + + + + + + + + + + + + + +
zoneTotal Complementweekly OffPlanned LeavePresent CountFood RequestedFood DeliveredFood Shortfall
+
+======= +>>>>>>> fabb49a5aeb9c63fb5d5a238dd689811f2cc2643 +
+ + + +<<<<<<< HEAD +
+
+
+
Overall Location wise Overview
+
Select Zone:
+ + +
+ + + + + + + +======= +
+
+
+
Zone wise Logistics Overview
+ +
+ + +>>>>>>> fabb49a5aeb9c63fb5d5a238dd689811f2cc2643 +
+
+ + + +<<<<<<< HEAD + + + + + + + +======= + + + +>>>>>>> fabb49a5aeb9c63fb5d5a238dd689811f2cc2643 + + + + + + +
ZoneWardLocationsTotal Complementweekly OffPlanned LeavePresent CountLocationsPresent CountAbsent CountFood RequestedFood DeliveredFood Shortfall
+
+
+
+ +
+
+<<<<<<< HEAD + + +======= +>>>>>>> fabb49a5aeb9c63fb5d5a238dd689811f2cc2643 + + + +<<<<<<< HEAD + + + + + +======= +>>>>>>> fabb49a5aeb9c63fb5d5a238dd689811f2cc2643 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file