small update in get SUB
BIN
public/temp/tmp-1-1726740645735
Normal file
After Width: | Height: | Size: 53 KiB |
BIN
public/temp/tmp-2-1726740645736
Normal file
After Width: | Height: | Size: 53 KiB |
BIN
public/temp/tmp-3-1726740697903
Normal file
After Width: | Height: | Size: 53 KiB |
BIN
public/temp/tmp-4-1726740697904
Normal file
After Width: | Height: | Size: 53 KiB |
BIN
public/temp/tmp-5-1726740697905
Normal file
After Width: | Height: | Size: 53 KiB |
BIN
public/temp/tmp-6-1726740697908
Normal file
After Width: | Height: | Size: 53 KiB |
BIN
public/temp/tmp-7-1726740697911
Normal file
After Width: | Height: | Size: 53 KiB |
@ -806,13 +806,13 @@ export const getProcessingInvoices = async (req, res) => {
|
|||||||
try {
|
try {
|
||||||
const page = parseInt(req.query.page, 10) || 1;
|
const page = parseInt(req.query.page, 10) || 1;
|
||||||
const limit = parseInt(req.query.limit, 10) || 5;
|
const limit = parseInt(req.query.limit, 10) || 5;
|
||||||
const { invoiceId, orderId } = req.query;
|
const { invoiceId, orderId } = req.query;
|
||||||
const skip = (page - 1) * limit;
|
const skip = (page - 1) * limit;
|
||||||
|
|
||||||
let query = { courierStatus: "processing" };
|
let query = { courierStatus: "processing" };
|
||||||
|
|
||||||
if (invoiceId) {
|
if (invoiceId) {
|
||||||
query.invoiceId = { $regex: invoiceId, $options: "i" };
|
query.invoiceId = { $regex: invoiceId, $options: "i" };
|
||||||
}
|
}
|
||||||
const invoices = await Invoice.find(query)
|
const invoices = await Invoice.find(query)
|
||||||
.sort({ createdAt: -1 })
|
.sort({ createdAt: -1 })
|
||||||
@ -824,9 +824,11 @@ export const getProcessingInvoices = async (req, res) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (orderId) {
|
if (orderId) {
|
||||||
const filteredInvoices = invoices.filter(invoice =>
|
const filteredInvoices = invoices.filter(
|
||||||
invoice.orderId && invoice.orderId.uniqueId &&
|
(invoice) =>
|
||||||
invoice.orderId.uniqueId.toLowerCase().includes(orderId.toLowerCase())
|
invoice.orderId &&
|
||||||
|
invoice.orderId.uniqueId &&
|
||||||
|
invoice.orderId.uniqueId.toLowerCase().includes(orderId.toLowerCase())
|
||||||
);
|
);
|
||||||
res.status(200).json({
|
res.status(200).json({
|
||||||
totalCount: filteredInvoices.length,
|
totalCount: filteredInvoices.length,
|
||||||
@ -858,7 +860,7 @@ export const getInvoiceDetailsById = async (req, res) => {
|
|||||||
populate: {
|
populate: {
|
||||||
path: "addedBy",
|
path: "addedBy",
|
||||||
model: "User",
|
model: "User",
|
||||||
select: "name email phone", // Select only specific fields
|
select: "name email phone SBU", // Select only specific fields
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -1008,13 +1010,13 @@ export const getDispatchedInvoices = async (req, res) => {
|
|||||||
try {
|
try {
|
||||||
const page = parseInt(req.query.page, 10) || 1;
|
const page = parseInt(req.query.page, 10) || 1;
|
||||||
const limit = parseInt(req.query.limit, 10) || 5;
|
const limit = parseInt(req.query.limit, 10) || 5;
|
||||||
const { invoiceId, orderId } = req.query;
|
const { invoiceId, orderId } = req.query;
|
||||||
const skip = (page - 1) * limit;
|
const skip = (page - 1) * limit;
|
||||||
|
|
||||||
let query = { courierStatus: "dispatched" };
|
let query = { courierStatus: "dispatched" };
|
||||||
|
|
||||||
if (invoiceId) {
|
if (invoiceId) {
|
||||||
query.invoiceId = { $regex: invoiceId, $options: "i" };
|
query.invoiceId = { $regex: invoiceId, $options: "i" };
|
||||||
}
|
}
|
||||||
const invoices = await Invoice.find(query)
|
const invoices = await Invoice.find(query)
|
||||||
.sort({ createdAt: -1 })
|
.sort({ createdAt: -1 })
|
||||||
@ -1026,9 +1028,11 @@ export const getDispatchedInvoices = async (req, res) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (orderId) {
|
if (orderId) {
|
||||||
const filteredInvoices = invoices.filter(invoice =>
|
const filteredInvoices = invoices.filter(
|
||||||
invoice.orderId && invoice.orderId.uniqueId &&
|
(invoice) =>
|
||||||
invoice.orderId.uniqueId.toLowerCase().includes(orderId.toLowerCase())
|
invoice.orderId &&
|
||||||
|
invoice.orderId.uniqueId &&
|
||||||
|
invoice.orderId.uniqueId.toLowerCase().includes(orderId.toLowerCase())
|
||||||
);
|
);
|
||||||
res.status(200).json({
|
res.status(200).json({
|
||||||
totalCount: filteredInvoices.length,
|
totalCount: filteredInvoices.length,
|
||||||
@ -1193,13 +1197,13 @@ export const getDeliveredInvoices = async (req, res) => {
|
|||||||
try {
|
try {
|
||||||
const page = parseInt(req.query.page, 10) || 1;
|
const page = parseInt(req.query.page, 10) || 1;
|
||||||
const limit = parseInt(req.query.limit, 10) || 5;
|
const limit = parseInt(req.query.limit, 10) || 5;
|
||||||
const { invoiceId, orderId } = req.query;
|
const { invoiceId, orderId } = req.query;
|
||||||
const skip = (page - 1) * limit;
|
const skip = (page - 1) * limit;
|
||||||
|
|
||||||
let query = { courierStatus: "delivered" };
|
let query = { courierStatus: "delivered" };
|
||||||
|
|
||||||
if (invoiceId) {
|
if (invoiceId) {
|
||||||
query.invoiceId = { $regex: invoiceId, $options: "i" };
|
query.invoiceId = { $regex: invoiceId, $options: "i" };
|
||||||
}
|
}
|
||||||
const invoices = await Invoice.find(query)
|
const invoices = await Invoice.find(query)
|
||||||
.sort({ createdAt: -1 })
|
.sort({ createdAt: -1 })
|
||||||
@ -1211,9 +1215,11 @@ export const getDeliveredInvoices = async (req, res) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (orderId) {
|
if (orderId) {
|
||||||
const filteredInvoices = invoices.filter(invoice =>
|
const filteredInvoices = invoices.filter(
|
||||||
invoice.orderId && invoice.orderId.uniqueId &&
|
(invoice) =>
|
||||||
invoice.orderId.uniqueId.toLowerCase().includes(orderId.toLowerCase())
|
invoice.orderId &&
|
||||||
|
invoice.orderId.uniqueId &&
|
||||||
|
invoice.orderId.uniqueId.toLowerCase().includes(orderId.toLowerCase())
|
||||||
);
|
);
|
||||||
res.status(200).json({
|
res.status(200).json({
|
||||||
totalCount: filteredInvoices.length,
|
totalCount: filteredInvoices.length,
|
||||||
|