trying to sort with respect to months in the date like I want all the data of jan,feb,march......etc together what do i use in queryfilter to filter that data,have tried playing with currMonth = today.getMonth() plus and minus
router.get('/', isAdmin, function (req, res, next) {
errorMsg = req.flash('error')[0];
successMsg = req.flash('success')[0];
var tot = totalSales(function (err, next) {
if (err) {
//////console.log(err.message);
return res.error('err');
}
});
var custresponse_store;
Message.distinct('form', (err, custresponse) => {
//res.send(messages);
custresponse_store = custresponse;
// console.log(custresponse);
})
var today = new Date();
var currDay = today.getDate();
var currMonth = today.getMonth() + 1;
var currYear = today.getFullYear();
// console.log(currYear + "-" + currMonth + "-" + currDay);
var date = (currYear + "-" + currMonth + "-" + currDay);
qryFilter = { "checkin": date };
qryFilter1 = { "checkout": date };
qryFilter2 = { "created": { $gte: moment(date) } };
Order.find(qryFilter, function (err, docs) {
var bookings = docs.length;
Order.find(qryFilter1, function (err, docs1) {
var checkouts = docs1.length;
Order.find(qryFilter2, function (err, docs3) {
var bookingsno = docs3.length;
res.render('admin/dashboard', {
layout: 'admin-page.hbs',
docs: docs,
docs1: docs1,
docs3:docs3,
bookingsno:bookingsno,
noErrors: 1,
date: date,
user: req.user,
bookings: bookings,
checkouts: checkouts,
custresponse_store: custresponse_store
});
});
});
});
});
this is the code i currently haveand want to modify for the required result
Comments
Post a Comment