From d294dccb8c9281550b1ece8e0c58dbb787fb77da Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 12 Jan 2026 17:23:52 +0530 Subject: [PATCH] nexschedule date added here --- app/controllers/manufacturingIPI.controller.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/app/controllers/manufacturingIPI.controller.js b/app/controllers/manufacturingIPI.controller.js index 1a0937d..8ccba6c 100644 --- a/app/controllers/manufacturingIPI.controller.js +++ b/app/controllers/manufacturingIPI.controller.js @@ -3,6 +3,7 @@ const ManufacturingIpi = db.ManufacturingIpi; const Isic2DigitIndices = db.Isic2DigitIndices; const Isic3DigitIndices = db.Isic3DigitIndices; const Isic4DigitIndices = db.Isic4DigitIndices; +const QuarterlyWindowsConfiguration = db.QuarterlyWindowsConfiguration; const logger = require("../services/logger"); const formatDecimal = (value) => { @@ -14,6 +15,17 @@ const formatDecimal = (value) => { exports.getAllManufacturingIndexDetails = async (req, res) => { try { + const latestWindow = await QuarterlyWindowsConfiguration.findOne({ + order: [["created_at", "DESC"]], + }); + + let nextScheduleDate = null; + if (latestWindow && latestWindow.end_date && latestWindow.grace_periods_days !== null) { + const endDate = new Date(latestWindow.end_date); + endDate.setDate(endDate.getDate()+ 1 + latestWindow.grace_periods_days); + nextScheduleDate = endDate.toISOString().split("T")[0]; // YYYY-MM-DD + } + const rawData = await ManufacturingIpi.findAll({ order: [["created_at", "DESC"]], }); @@ -36,7 +48,8 @@ exports.getAllManufacturingIndexDetails = async (req, res) => { res.status(200).send({ status: "success", message: "Fetched successfully", - data: data + data: data, + nextScheduleDate: nextScheduleDate }); } catch (error) {