nexschedule date added here
This commit is contained in:
parent
5891605545
commit
d294dccb8c
@ -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) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user