bug fixed

This commit is contained in:
Sibunnayak 2024-11-06 16:26:15 +05:30
parent 83750fb4e5
commit 2ae2b593ca

View File

@ -80,11 +80,11 @@ export const getProductsWithOpenInventoryInfo = async (req, res) => {
name: product.name, name: product.name,
brand: product.brand?.brandName || "N/A", // Access brandName here brand: product.brand?.brandName || "N/A", // Access brandName here
category: product.category?.categoryName || "N/A", // Access categoryName here category: product.category?.categoryName || "N/A", // Access categoryName here
allPDs: (pdMap[product.SKU] || 0).toFixed(2), allPDs: parseFloat((pdMap[product.SKU] || 0).toFixed(2)),
allRDs: (rdMap[product.SKU] || 0).toFixed(2), allRDs: parseFloat((rdMap[product.SKU] || 0).toFixed(2)),
allPdAndRd: ( allPdAndRd: parseFloat((
(pdMap[product.SKU] || 0) + (rdMap[product.SKU] || 0) (pdMap[product.SKU] || 0) + (rdMap[product.SKU] || 0)
).toFixed(2), ).toFixed(2)),
})); }));
// Step 7: Get total count for pagination // Step 7: Get total count for pagination
@ -181,11 +181,11 @@ export const getProductsWithStockInfo = async (req, res) => {
name: product.name, name: product.name,
brand: product.brand?.brandName || "N/A", // Access brandName here brand: product.brand?.brandName || "N/A", // Access brandName here
category: product.category?.categoryName || "N/A", // Access categoryName here category: product.category?.categoryName || "N/A", // Access categoryName here
allPDs: (pdMap[product.SKU] || 0).toFixed(2), allPDs: parseFloat((pdMap[product.SKU] || 0).toFixed(2)),
allRDs: (rdMap[product.SKU] || 0).toFixed(2), allRDs: parseFloat((rdMap[product.SKU] || 0).toFixed(2)),
allPdAndRd: ( allPdAndRd: parseFloat((
(pdMap[product.SKU] || 0) + (rdMap[product.SKU] || 0) (pdMap[product.SKU] || 0) + (rdMap[product.SKU] || 0)
).toFixed(2), ).toFixed(2)),
})); }));
// Step 7: Get total count for pagination // Step 7: Get total count for pagination
@ -269,10 +269,10 @@ export const DownloadProductsWithOpenInventoryInfo = async (req, res) => {
"Category Name": product.category?.categoryName || "N/A", // Category Name "Category Name": product.category?.categoryName || "N/A", // Category Name
"Brand Name": product.brand?.brandName || "N/A", // Brand Name "Brand Name": product.brand?.brandName || "N/A", // Brand Name
"Total At PDs And Retailers": ( "Total At PDs And Retailers": (
(pdMap[product.SKU] || 0) + (rdMap[product.SKU] || 0) parseFloat((pdMap[product.SKU] || 0) + (rdMap[product.SKU] || 0)
).toFixed(2), // Total At PDs & Retailers ).toFixed(2)), // Total At PDs & Retailers
"All PDs": (pdMap[product.SKU] || 0).toFixed(2), // All PDs "All PDs": parseFloat((pdMap[product.SKU] || 0).toFixed(2)), // All PDs
"All Retailers": (rdMap[product.SKU] || 0).toFixed(2), // All Retailers "All Retailers": parseFloat((rdMap[product.SKU] || 0).toFixed(2)), // All Retailers
})); }));
// Define headers (first row in the sheet) // Define headers (first row in the sheet)
@ -396,10 +396,10 @@ export const DownloadProductsWithStockInfo = async (req, res) => {
"Category Name": product.category?.categoryName || "N/A", // Category Name "Category Name": product.category?.categoryName || "N/A", // Category Name
"Brand Name": product.brand?.brandName || "N/A", // Brand Name "Brand Name": product.brand?.brandName || "N/A", // Brand Name
"Total At PDs And Retailers": ( "Total At PDs And Retailers": (
(pdMap[product.SKU] || 0) + (rdMap[product.SKU] || 0) parseFloat((pdMap[product.SKU] || 0) + (rdMap[product.SKU] || 0)
).toFixed(2), // Total At PDs & Retailers ).toFixed(2)), // Total At PDs & Retailers
"All PDs": (pdMap[product.SKU] || 0).toFixed(2), // All PDs "All PDs": parseFloat((pdMap[product.SKU] || 0).toFixed(2)), // All PDs
"All Retailers": (rdMap[product.SKU] || 0).toFixed(2), // All Retailers "All Retailers": parseFloat((rdMap[product.SKU] || 0).toFixed(2)), // All Retailers
})); }));
// Define headers (first row in the sheet) // Define headers (first row in the sheet)