Skip to content

Commit

Permalink
Modified All tables
Browse files Browse the repository at this point in the history
  • Loading branch information
shabeelashraf5 committed Jan 20, 2025
1 parent 8689360 commit c5469f7
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 13 deletions.
5 changes: 2 additions & 3 deletions server/controller/accountingController.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ const loadInv = async (req, res) => {
}
}
}
})
.exec();
}).sort({ createdAt: -1 }).exec();

console.log('invData:', invData);

Expand Down Expand Up @@ -189,7 +188,7 @@ const loadTrans = async (req, res) => {
}
}
}
}).exec();
}).sort({ createdAt: -1 }).exec();

console.log('transData:', transData);

Expand Down
2 changes: 1 addition & 1 deletion server/controller/purchaseController.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const loadPo = async (req, res) => {
path: 'salesRFQ_id',
model: 'sales-rfq',
select: 'srfq'
} }).exec();
} }).sort({ createdAt: -1 }).exec();
console.log('Supplier PO:', supplierPO);

if (!supplierPO || supplierPO.length === 0) {
Expand Down
14 changes: 9 additions & 5 deletions server/controller/salesController.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,15 @@ const loadRfq = async (req, res) => {
res.setHeader('Cache-Control', 'no-cache, no-store');


const customerRFQ = await salesRFQ.find({ employee_id: employeeId }).populate({
const customerRFQ = await salesRFQ
.find({ employee_id: employeeId })
.populate({
path: 'employee_id',
select: 'fname lname',
model: 'employee'
}).exec();
select: 'fname lname',
model: 'employee',
})
.sort({ createdAt: -1 }) // Sort by `createdAt` in descending order
.exec();
console.log('Customer RFQ:', customerRFQ);

if (!customerRFQ || customerRFQ.length === 0) {
Expand Down Expand Up @@ -244,7 +248,7 @@ const loadSalesOrder = async (req , res) => {
path: 'employee_id',
select: 'fname lname',
model: 'employee'
}).populate({path: 'salesRFQ_id', select: 'srfq'}).exec();
}).populate({path: 'salesRFQ_id', select: 'srfq'}).sort({ createdAt: -1 }).exec();
console.log('ClientDetails:',salesOrder);
console.log(salesOrder)

Expand Down
6 changes: 3 additions & 3 deletions server/controller/shipmentController.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ let express = require('express');
const collectionshipment = require('../model/shipmentDB')


const loadInv = async (req, res) => {
const loadShip = async (req, res) => {

try {

Expand Down Expand Up @@ -41,7 +41,7 @@ const loadInv = async (req, res) => {
}
}
}
}).exec();
}).sort({ createdAt: -1 }).exec();

console.log('shipData:', shipData);

Expand Down Expand Up @@ -84,7 +84,7 @@ const changeStatus = async (req , res) => {
module.exports = {


loadInv,
loadShip,
changeStatus

}
2 changes: 1 addition & 1 deletion server/routes/shipment.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const {verifyToken} = require('../token/tokenauth')



router.get('/shipment-history', verifyToken , shipmentController.loadInv)
router.get('/shipment-history', verifyToken , shipmentController.loadShip)
router.put('/:id/update-status', verifyToken , shipmentController.changeStatus)


Expand Down

0 comments on commit c5469f7

Please sign in to comment.