|
@@ -46,9 +46,9 @@ module.exports.createContactEntry = async (req, res) => {
|
|
|
|
|
|
} else {
|
|
} else {
|
|
console.log("new contact details")
|
|
console.log("new contact details")
|
|
- const query = "INSERT INTO contact_master(first_name,last_name,mobile_number,email_id,designation,department,function_area,created_by,created_on,customer_id,stage_id)" +
|
|
|
|
- "VALUES(?,?,?,?,?,?,?,?,?,?,?)";
|
|
|
|
- const values = [req.body.first_name, req.body.last_name, req.body.mobile_no, req.body.email_id, req.body.designation, req.body.department, req.body.function, req.body.created_by, createdate, req.body.contact_for, stage_id]
|
|
|
|
|
|
+ const query = "INSERT INTO contact_master(first_name,last_name,mobile_number,email_id,designation,department,function_area,created_by,created_on,customer_id,stage_id,mob_no)" +
|
|
|
|
+ "VALUES(?,?,?,?,?,?,?,?,?,?,?,?)";
|
|
|
|
+ const values = [req.body.first_name, req.body.last_name, req.body.mobile_no, req.body.email_id, req.body.designation, req.body.department, req.body.function, req.body.created_by, createdate, req.body.contact_for, stage_id,req.body.mob_no]
|
|
const res1 = await db.executevaluesquery(query, values);
|
|
const res1 = await db.executevaluesquery(query, values);
|
|
|
|
|
|
logger.info('log to file', res);
|
|
logger.info('log to file', res);
|
|
@@ -123,7 +123,7 @@ module.exports.getdvrDetails = async (req, res) => {
|
|
const validationResp = await validation.getdvrDetailscheck(req);
|
|
const validationResp = await validation.getdvrDetailscheck(req);
|
|
if (validationResp.status) {
|
|
if (validationResp.status) {
|
|
try {
|
|
try {
|
|
- const query = "SELECT d.dvr_id,d.date_of_visit,d.customer_name,d.contact_name,d.physical_meeting,d.message,s.stage_desc,d.stage_id,d.created_on FROM dvr_report d JOIN stage_master s ON d.stage_id=s.stage_id WHERE d.dvr_id = '" + req.query.dvrid + "' and d.delete_id = 0";
|
|
|
|
|
|
+ const query = "SELECT d.dvr_id,d.date_of_visit,d.customer_name,d.contact_name,d.physical_meeting,d.message,s.stage_desc,d.stage_id,d.created_on,d.nextstep FROM dvr_report d JOIN stage_master s ON d.stage_id=s.stage_id WHERE d.dvr_id = '" + req.query.dvrid + "' and d.delete_id = 0";
|
|
console.log("query", query)
|
|
console.log("query", query)
|
|
const queryresult = await db.executequery(query);
|
|
const queryresult = await db.executequery(query);
|
|
if (queryresult.length > 0) {
|
|
if (queryresult.length > 0) {
|
|
@@ -140,7 +140,8 @@ module.exports.getdvrDetails = async (req, res) => {
|
|
physical_metting: queryresult[0].physical_meeting,
|
|
physical_metting: queryresult[0].physical_meeting,
|
|
stage_desc: queryresult[0].stage_desc,
|
|
stage_desc: queryresult[0].stage_desc,
|
|
stage_id: queryresult[0].stage_id,
|
|
stage_id: queryresult[0].stage_id,
|
|
- created_on: queryresult[0].created_on
|
|
|
|
|
|
+ created_on: queryresult[0].created_on,
|
|
|
|
+ nextstep:queryresult[0].nextstep
|
|
}
|
|
}
|
|
],
|
|
],
|
|
errors: ""
|
|
errors: ""
|
|
@@ -312,38 +313,38 @@ module.exports.getdashboarddetails = async (req, res) => {
|
|
|
|
|
|
if (sale_person != undefined && customer == undefined && searchfilter == 'undefineddate' && sale_person != 'all') {
|
|
if (sale_person != undefined && customer == undefined && searchfilter == 'undefineddate' && sale_person != 'all') {
|
|
console.log("only for sale_person");
|
|
console.log("only for sale_person");
|
|
- querydvr = "select dvr_id, date_of_visit,customer_name,contact_name,message,physical_meeting,sale_person from dvr_report where sale_person like '%" + sale_person + "%' and delete_id=0 order by DATE_FORMAT(date_of_visit, '%Y%m%d') desc";
|
|
|
|
|
|
+ querydvr = "select dvr_id, date_of_visit,customer_name,contact_name,message,physical_meeting,sale_person,nextstep from dvr_report where sale_person like '%" + sale_person + "%' and delete_id=0 order by DATE_FORMAT(date_of_visit, '%Y%m%d') desc";
|
|
countquery = "call SP_CountDashboard_admin ('" + firstdate + "','" + seconddate + "','" + emai_id + "','" + '' + "','" + '' + "')";
|
|
countquery = "call SP_CountDashboard_admin ('" + firstdate + "','" + seconddate + "','" + emai_id + "','" + '' + "','" + '' + "')";
|
|
|
|
|
|
} else if (sale_person == undefined && customer != undefined && searchfilter == 'undefineddate' && sale_person != 'all' && customer != 'all') {
|
|
} else if (sale_person == undefined && customer != undefined && searchfilter == 'undefineddate' && sale_person != 'all' && customer != 'all') {
|
|
console.log("only for customer");
|
|
console.log("only for customer");
|
|
- querydvr = "select dvr_id, date_of_visit,customer_name,contact_name,message,physical_meeting,sale_person from dvr_report where customer_name like '%" + customer + "%' and delete_id=0 order by DATE_FORMAT(date_of_visit, '%Y%m%d') desc";
|
|
|
|
|
|
+ querydvr = "select dvr_id, date_of_visit,customer_name,contact_name,message,physical_meeting,sale_person,nextstep from dvr_report where customer_name like '%" + customer + "%' and delete_id=0 order by DATE_FORMAT(date_of_visit, '%Y%m%d') desc";
|
|
countquery = "call SP_CountDashboard_admin ('" + firstdate + "','" + seconddate + "','" + '' + "','" + customer + "','" + customer_id + "')";
|
|
countquery = "call SP_CountDashboard_admin ('" + firstdate + "','" + seconddate + "','" + '' + "','" + customer + "','" + customer_id + "')";
|
|
|
|
|
|
} else if (sale_person != undefined && customer != undefined && customer_id != undefined && sale_person != 'all') {
|
|
} else if (sale_person != undefined && customer != undefined && customer_id != undefined && sale_person != 'all') {
|
|
console.log("for sales_person and Customer");
|
|
console.log("for sales_person and Customer");
|
|
- querydvr = "select dvr_id, date_of_visit,customer_name,contact_name,message,physical_meeting,sale_person from dvr_report where customer_name like '%" + customer + "%' and sale_person like '%" + sale_person + "%' and delete_id=0 order by DATE_FORMAT(date_of_visit, '%Y%m%d') desc";
|
|
|
|
|
|
+ querydvr = "select dvr_id, date_of_visit,customer_name,contact_name,message,physical_meeting,sale_person,nextstep from dvr_report where customer_name like '%" + customer + "%' and sale_person like '%" + sale_person + "%' and delete_id=0 order by DATE_FORMAT(date_of_visit, '%Y%m%d') desc";
|
|
countquery = "call SP_CountDashboard_admin ('" + firstdate + "','" + seconddate + "','" + emai_id + "','" + customer + "','" + customer_id + "')";
|
|
countquery = "call SP_CountDashboard_admin ('" + firstdate + "','" + seconddate + "','" + emai_id + "','" + customer + "','" + customer_id + "')";
|
|
|
|
|
|
} else if (sale_person != 'all' && firstdate != undefined && seconddate != undefined && sale_person != undefined) {
|
|
} else if (sale_person != 'all' && firstdate != undefined && seconddate != undefined && sale_person != undefined) {
|
|
console.log("date and sale_person");
|
|
console.log("date and sale_person");
|
|
- querydvr = "select dvr_id, date_of_visit,customer_name,contact_name,message,physical_meeting,sale_person from dvr_report where date_of_visit between'" + firstdate + "' and '" + seconddate + "' and sale_person like '%" + sale_person + "%' and delete_id=0 order by DATE_FORMAT(date_of_visit, '%Y%m%d') desc";
|
|
|
|
|
|
+ querydvr = "select dvr_id, date_of_visit,customer_name,contact_name,message,physical_meeting,sale_person,nextstep from dvr_report where date_of_visit between'" + firstdate + "' and '" + seconddate + "' and sale_person like '%" + sale_person + "%' and delete_id=0 order by DATE_FORMAT(date_of_visit, '%Y%m%d') desc";
|
|
countquery = "call SP_CountDashboard_admin ('" + firstdate + "','" + seconddate + "','" + emai_id + "','" + '' + "','" + '' + "')";
|
|
countquery = "call SP_CountDashboard_admin ('" + firstdate + "','" + seconddate + "','" + emai_id + "','" + '' + "','" + '' + "')";
|
|
|
|
|
|
|
|
|
|
} else if (customer != undefined && firstdate != undefined && seconddate != undefined && sale_person == undefined) {
|
|
} else if (customer != undefined && firstdate != undefined && seconddate != undefined && sale_person == undefined) {
|
|
console.log("for date and customer");
|
|
console.log("for date and customer");
|
|
- querydvr = "select dvr_id, date_of_visit,customer_name,contact_name,message,physical_meeting,sale_person from dvr_report where date_of_visit between'" + firstdate + "' and '" + seconddate + "' and customer_name like '%" + customer + "%' and delete_id=0 order by DATE_FORMAT(date_of_visit, '%Y%m%d') desc";
|
|
|
|
|
|
+ querydvr = "select dvr_id, date_of_visit,customer_name,contact_name,message,physical_meeting,sale_person,nextstep from dvr_report where date_of_visit between'" + firstdate + "' and '" + seconddate + "' and customer_name like '%" + customer + "%' and delete_id=0 order by DATE_FORMAT(date_of_visit, '%Y%m%d') desc";
|
|
countquery = "call SP_CountDashboard_admin ('" + firstdate + "','" + seconddate + "','" + '' + "','" + customer + "','" + customer_id + "')";
|
|
countquery = "call SP_CountDashboard_admin ('" + firstdate + "','" + seconddate + "','" + '' + "','" + customer + "','" + customer_id + "')";
|
|
|
|
|
|
} else if (customer != undefined && firstdate != undefined && seconddate != undefined && sale_person != undefined) {
|
|
} else if (customer != undefined && firstdate != undefined && seconddate != undefined && sale_person != undefined) {
|
|
console.log("all filters");
|
|
console.log("all filters");
|
|
- querydvr = "select dvr_id, date_of_visit,customer_name,contact_name,message,physical_meeting,sale_person from dvr_report where date_of_visit between'" + firstdate + "' and '" + seconddate + "' and customer_name like '%" + customer + "%' and sale_person like '%" + sale_person + "%' and delete_id=0 order by DATE_FORMAT(date_of_visit, '%Y%m%d') desc";
|
|
|
|
|
|
+ querydvr = "select dvr_id, date_of_visit,customer_name,contact_name,message,physical_meeting,sale_person,nextstep from dvr_report where date_of_visit between'" + firstdate + "' and '" + seconddate + "' and customer_name like '%" + customer + "%' and sale_person like '%" + sale_person + "%' and delete_id=0 order by DATE_FORMAT(date_of_visit, '%Y%m%d') desc";
|
|
countquery = "call SP_CountDashboard_admin ('" + firstdate + "','" + seconddate + "','" + emai_id + "','" + customer + "','" + customer_id + "')";
|
|
countquery = "call SP_CountDashboard_admin ('" + firstdate + "','" + seconddate + "','" + emai_id + "','" + customer + "','" + customer_id + "')";
|
|
}
|
|
}
|
|
else {
|
|
else {
|
|
console.log("only for date");
|
|
console.log("only for date");
|
|
- querydvr = "select dvr_id, date_of_visit,customer_name,contact_name,message,physical_meeting,sale_person from dvr_report where date_of_visit between'" + firstdate + "' and '" + seconddate + "' and delete_id=0 order by DATE_FORMAT(date_of_visit, '%Y%m%d') desc";
|
|
|
|
|
|
+ querydvr = "select dvr_id, date_of_visit,customer_name,contact_name,message,physical_meeting,sale_person,nextstep from dvr_report where date_of_visit between'" + firstdate + "' and '" + seconddate + "' and delete_id=0 order by DATE_FORMAT(date_of_visit, '%Y%m%d') desc";
|
|
countquery = "call SP_CountDashboard_admin ('" + firstdate + "','" + seconddate + "','" + '' + "','" + '' + "','" + '' + "')";
|
|
countquery = "call SP_CountDashboard_admin ('" + firstdate + "','" + seconddate + "','" + '' + "','" + '' + "','" + '' + "')";
|
|
|
|
|
|
}
|
|
}
|
|
@@ -459,10 +460,10 @@ module.exports.getdashboarddetails = async (req, res) => {
|
|
const currentDate = await getcurrentDate();
|
|
const currentDate = await getcurrentDate();
|
|
console.log(lastweek)
|
|
console.log(lastweek)
|
|
if (sale_person == undefined) {
|
|
if (sale_person == undefined) {
|
|
- querydvr = "select dvr_id, date_of_visit,customer_name,contact_name,message,physical_meeting,sale_person from dvr_report where date_of_visit between'" + lastweek + "' and '" + currentDate + "' and delete_id=0 order by DATE_FORMAT(date_of_visit, '%Y%m%d') desc";
|
|
|
|
|
|
+ querydvr = "select dvr_id, date_of_visit,customer_name,contact_name,message,physical_meeting,sale_person,nextstep from dvr_report where date_of_visit between'" + lastweek + "' and '" + currentDate + "' and delete_id=0 order by DATE_FORMAT(date_of_visit, '%Y%m%d') desc";
|
|
|
|
|
|
} else {
|
|
} else {
|
|
- querydvr = "select dvr_id, date_of_visit,customer_name,contact_name,message,physical_meeting,sale_person from dvr_report where date_of_visit between'" + lastweek + "' and '" + currentDate + "' and contact_name like '%" + sale_person + "%' and delete_id=0 order by DATE_FORMAT(date_of_visit, '%Y%m%d') desc";
|
|
|
|
|
|
+ querydvr = "select dvr_id, date_of_visit,customer_name,contact_name,message,physical_meeting,sale_person,nextstep from dvr_report where date_of_visit between'" + lastweek + "' and '" + currentDate + "' and contact_name like '%" + sale_person + "%' and delete_id=0 order by DATE_FORMAT(date_of_visit, '%Y%m%d') desc";
|
|
}
|
|
}
|
|
|
|
|
|
const countquery = "call SP_CountDashboard ('" + lastweek + "','" + currentDate + "','" + '' + "')";
|
|
const countquery = "call SP_CountDashboard ('" + lastweek + "','" + currentDate + "','" + '' + "')";
|
|
@@ -521,10 +522,10 @@ module.exports.getdashboarddetails = async (req, res) => {
|
|
const currentDate = await getcurrentDate();
|
|
const currentDate = await getcurrentDate();
|
|
|
|
|
|
if (sale_person == undefined) {
|
|
if (sale_person == undefined) {
|
|
- querydvr = "select dvr_id, date_of_visit,customer_name,contact_name,message,physical_meeting,sale_person from dvr_report where date_of_visit between'" + lastyeardate + "' and '" + currentDate + "' and delete_id=0 order by DATE_FORMAT(date_of_visit, '%Y%m%d') desc";
|
|
|
|
|
|
+ querydvr = "select dvr_id, date_of_visit,customer_name,contact_name,message,physical_meeting,sale_person,nextstep from dvr_report where date_of_visit between'" + lastyeardate + "' and '" + currentDate + "' and delete_id=0 order by DATE_FORMAT(date_of_visit, '%Y%m%d') desc";
|
|
|
|
|
|
} else {
|
|
} else {
|
|
- querydvr = "select dvr_id, date_of_visit,customer_name,contact_name,message,physical_meeting,sale_person from dvr_report where date_of_visit between'" + lastyeardate + "' and '" + currentDate + "' and contact_name like '%" + sale_person + "%' and delete_id=0 order by DATE_FORMAT(date_of_visit, '%Y%m%d') desc ";
|
|
|
|
|
|
+ querydvr = "select dvr_id, date_of_visit,customer_name,contact_name,message,physical_meeting,sale_person,nextstep from dvr_report where date_of_visit between'" + lastyeardate + "' and '" + currentDate + "' and contact_name like '%" + sale_person + "%' and delete_id=0 order by DATE_FORMAT(date_of_visit, '%Y%m%d') desc ";
|
|
}
|
|
}
|
|
|
|
|
|
console.log("lastyeardate", lastyeardate, " ", currentDate);
|
|
console.log("lastyeardate", lastyeardate, " ", currentDate);
|
|
@@ -600,11 +601,11 @@ module.exports.getdashboarddetails = async (req, res) => {
|
|
console.log("lastmonthDate", lastmonthDate, "currentDate", currentDate);
|
|
console.log("lastmonthDate", lastmonthDate, "currentDate", currentDate);
|
|
|
|
|
|
if (sale_person == undefined) {
|
|
if (sale_person == undefined) {
|
|
- querydvr = "select dvr_id, date_of_visit,customer_name,contact_name,message,physical_meeting,sale_person from dvr_report where date_of_visit between'" + lastmonthDate + "' and '" + currentDate + "' and delete_id=0 order by DATE_FORMAT(date_of_visit, '%Y%m%d') desc";
|
|
|
|
|
|
+ querydvr = "select dvr_id, date_of_visit,customer_name,contact_name,message,physical_meeting,sale_person,nextstep from dvr_report where date_of_visit between'" + lastmonthDate + "' and '" + currentDate + "' and delete_id=0 order by DATE_FORMAT(date_of_visit, '%Y%m%d') desc";
|
|
|
|
|
|
}
|
|
}
|
|
else {
|
|
else {
|
|
- querydvr = "select dvr_id, date_of_visit,customer_name,contact_name,message,physical_meeting,sale_person from dvr_report where date_of_visit between'" + lastmonthDate + "' and '" + currentDate + "' and contact_name like '%" + sale_person + "%' and delete_id=0 order by DATE_FORMAT(date_of_visit, '%Y%m%d') desc";
|
|
|
|
|
|
+ querydvr = "select dvr_id, date_of_visit,customer_name,contact_name,message,physical_meeting,sale_person,nextstep from dvr_report where date_of_visit between'" + lastmonthDate + "' and '" + currentDate + "' and contact_name like '%" + sale_person + "%' and delete_id=0 order by DATE_FORMAT(date_of_visit, '%Y%m%d') desc";
|
|
}
|
|
}
|
|
|
|
|
|
const countquery = "call SP_CountDashboard ('" + lastmonthDate + "' , '" + currentDate + "','" + '' + "')";
|
|
const countquery = "call SP_CountDashboard ('" + lastmonthDate + "' , '" + currentDate + "','" + '' + "')";
|
|
@@ -666,10 +667,10 @@ module.exports.getdashboarddetails = async (req, res) => {
|
|
const currentDate = await getcurrentDate();
|
|
const currentDate = await getcurrentDate();
|
|
console.log("lastmonthDate ", lastmonthDate, " currentDate", currentDate)
|
|
console.log("lastmonthDate ", lastmonthDate, " currentDate", currentDate)
|
|
if (sale_person == undefined) {
|
|
if (sale_person == undefined) {
|
|
- querydvr = "select dvr_id, date_of_visit,customer_name,contact_name,message,physical_meeting,sale_person from dvr_report where date_of_visit between'" + lastmonthDate + "' and '" + currentDate + "' and delete_id=0 order by DATE_FORMAT(date_of_visit, '%Y%m%d') desc";
|
|
|
|
|
|
+ querydvr = "select dvr_id, date_of_visit,customer_name,contact_name,message,physical_meeting,sale_person,nextstep from dvr_report where date_of_visit between'" + lastmonthDate + "' and '" + currentDate + "' and delete_id=0 order by DATE_FORMAT(date_of_visit, '%Y%m%d') desc";
|
|
|
|
|
|
} else {
|
|
} else {
|
|
- querydvr = "select dvr_id, date_of_visit,customer_name,contact_name,message,physical_meeting,sale_person from dvr_report where date_of_visit between'" + lastmonthDate + "' and '" + currentDate + "' and contact_name like '%" + sale_person + "%' and delete_id=0 order by DATE_FORMAT(date_of_visit, '%Y%m%d') desc ";
|
|
|
|
|
|
+ querydvr = "select dvr_id, date_of_visit,customer_name,contact_name,message,physical_meeting,sale_person,nextstep from dvr_report where date_of_visit between'" + lastmonthDate + "' and '" + currentDate + "' and contact_name like '%" + sale_person + "%' and delete_id=0 order by DATE_FORMAT(date_of_visit, '%Y%m%d') desc ";
|
|
}
|
|
}
|
|
const countquery = "call SP_CountDashboard ('" + lastmonthDate + "' , '" + currentDate + "' ,'" + '' + "')";
|
|
const countquery = "call SP_CountDashboard ('" + lastmonthDate + "' , '" + currentDate + "' ,'" + '' + "')";
|
|
|
|
|
|
@@ -776,7 +777,7 @@ module.exports.getdashboarddetails = async (req, res) => {
|
|
|
|
|
|
if (getcustomer_name) {
|
|
if (getcustomer_name) {
|
|
for (var i = 0; i < getcustomer_name.length; i++) {
|
|
for (var i = 0; i < getcustomer_name.length; i++) {
|
|
- const query = "select dvr_id, date_of_visit,customer_name,contact_name,message,physical_meeting,sale_person from dvr_report where date_of_visit between'" + firstdate + "' and '" + seconddate + "' and customer_name in ('" + getcustomer_name[i] + "') and delete_id=0 order by DATE_FORMAT(date_of_visit, '%Y%m%d') desc";
|
|
|
|
|
|
+ const query = "select dvr_id, date_of_visit,customer_name,contact_name,message,physical_meeting,sale_person,nextstep from dvr_report where date_of_visit between'" + firstdate + "' and '" + seconddate + "' and customer_name in ('" + getcustomer_name[i] + "') and delete_id=0 order by DATE_FORMAT(date_of_visit, '%Y%m%d') desc";
|
|
dvrlist[i] = await db.executequery(query);
|
|
dvrlist[i] = await db.executequery(query);
|
|
|
|
|
|
}
|
|
}
|
|
@@ -912,7 +913,7 @@ module.exports.getdashboarddetails = async (req, res) => {
|
|
|
|
|
|
if (getcustomer_name) {
|
|
if (getcustomer_name) {
|
|
for (var i = 0; i < getcustomer_name.length; i++) {
|
|
for (var i = 0; i < getcustomer_name.length; i++) {
|
|
- const query = "select dvr_id, date_of_visit,customer_name,contact_name,message,physical_meeting,sale_person from dvr_report where date_of_visit between'" + lastweek + "' and '" + currentDate + "' and customer_name in ('" + getcustomer_name[i] + "') and delete_id=0 order by DATE_FORMAT(date_of_visit, '%Y%m%d') desc";
|
|
|
|
|
|
+ const query = "select dvr_id, date_of_visit,customer_name,contact_name,message,physical_meeting,sale_person,nextstep from dvr_report where date_of_visit between'" + lastweek + "' and '" + currentDate + "' and customer_name in ('" + getcustomer_name[i] + "') and delete_id=0 order by DATE_FORMAT(date_of_visit, '%Y%m%d') desc";
|
|
dvrlist[i] = await db.executequery(query);
|
|
dvrlist[i] = await db.executequery(query);
|
|
|
|
|
|
}
|
|
}
|
|
@@ -1049,7 +1050,7 @@ module.exports.getdashboarddetails = async (req, res) => {
|
|
|
|
|
|
if (getcustomer_name) {
|
|
if (getcustomer_name) {
|
|
for (var i = 0; i < getcustomer_name.length; i++) {
|
|
for (var i = 0; i < getcustomer_name.length; i++) {
|
|
- const query = "select dvr_id, date_of_visit,customer_name,contact_name,message,physical_meeting,sale_person from dvr_report where date_of_visit between'" + lastyeardate + "' and '" + currentDate + "' and customer_name in ('" + getcustomer_name[i] + "') and delete_id=0 order by DATE_FORMAT(date_of_visit, '%Y%m%d') desc";
|
|
|
|
|
|
+ const query = "select dvr_id, date_of_visit,customer_name,contact_name,message,physical_meeting,sale_person,nextstep from dvr_report where date_of_visit between'" + lastyeardate + "' and '" + currentDate + "' and customer_name in ('" + getcustomer_name[i] + "') and delete_id=0 order by DATE_FORMAT(date_of_visit, '%Y%m%d') desc";
|
|
dvrlist[i] = await db.executequery(query);
|
|
dvrlist[i] = await db.executequery(query);
|
|
|
|
|
|
}
|
|
}
|
|
@@ -1188,7 +1189,7 @@ module.exports.getdashboarddetails = async (req, res) => {
|
|
|
|
|
|
if (getcustomer_name) {
|
|
if (getcustomer_name) {
|
|
for (var i = 0; i < getcustomer_name.length; i++) {
|
|
for (var i = 0; i < getcustomer_name.length; i++) {
|
|
- const query = "select dvr_id, date_of_visit,customer_name,contact_name,message,physical_meeting,sale_person from dvr_report where date_of_visit between'" + lastmonthDate + "' and '" + currentDate + "' and customer_name in ('" + getcustomer_name[i] + "') and delete_id=0 order by DATE_FORMAT(date_of_visit, '%Y%m%d') desc";
|
|
|
|
|
|
+ const query = "select dvr_id, date_of_visit,customer_name,contact_name,message,physical_meeting,sale_person,nextstep from dvr_report where date_of_visit between'" + lastmonthDate + "' and '" + currentDate + "' and customer_name in ('" + getcustomer_name[i] + "') and delete_id=0 order by DATE_FORMAT(date_of_visit, '%Y%m%d') desc";
|
|
dvrlist[i] = await db.executequery(query);
|
|
dvrlist[i] = await db.executequery(query);
|
|
|
|
|
|
}
|
|
}
|
|
@@ -1331,7 +1332,7 @@ module.exports.getdashboarddetails = async (req, res) => {
|
|
|
|
|
|
if (getcustomer_name) {
|
|
if (getcustomer_name) {
|
|
for (var i = 0; i < getcustomer_name.length; i++) {
|
|
for (var i = 0; i < getcustomer_name.length; i++) {
|
|
- const query = "select dvr_id, date_of_visit,customer_name,contact_name,message,physical_meeting,sale_person from dvr_report where date_of_visit between'" + lastmonthDate + "' and '" + currentDate + "' and customer_name in ('" + getcustomer_name[i] + "') and delete_id=0 order by DATE_FORMAT(date_of_visit, '%Y%m%d') desc";
|
|
|
|
|
|
+ const query = "select dvr_id, date_of_visit,customer_name,contact_name,message,physical_meeting,sale_person,nextstep from dvr_report where date_of_visit between'" + lastmonthDate + "' and '" + currentDate + "' and customer_name in ('" + getcustomer_name[i] + "') and delete_id=0 order by DATE_FORMAT(date_of_visit, '%Y%m%d') desc";
|
|
dvrlist[i] = await db.executequery(query);
|
|
dvrlist[i] = await db.executequery(query);
|
|
|
|
|
|
}
|
|
}
|
|
@@ -1432,9 +1433,9 @@ module.exports.createDvrEntry = async (req, res) => {
|
|
const date_of_visit = new Date(req.body.visit_date);
|
|
const date_of_visit = new Date(req.body.visit_date);
|
|
//const date_of_visit=req.body.visit_date;
|
|
//const date_of_visit=req.body.visit_date;
|
|
|
|
|
|
- const query = "INSERT INTO dvr_report(date_of_visit,customer_name,contact_name,physical_meeting,message,created_by,created_on,stage_id,login_id,sale_person,delete_id)" +
|
|
|
|
- "VALUES(?,?,?,?,?,?,?,?,?,?,?)";
|
|
|
|
- const values = [date_of_visit, req.body.customer_name, req.body.contact_name, req.body.physical_metting, req.body.message, req.body.created_by, createdate, req.body.stage_id, req.body.created_by, req.body.sale_person, 0]
|
|
|
|
|
|
+ const query = "INSERT INTO dvr_report(date_of_visit,customer_name,contact_name,physical_meeting,message,created_by,created_on,stage_id,login_id,sale_person,delete_id,nextstep)" +
|
|
|
|
+ "VALUES(?,?,?,?,?,?,?,?,?,?,?,?)";
|
|
|
|
+ const values = [date_of_visit, req.body.customer_name, req.body.contact_name, req.body.physical_metting, req.body.message, req.body.created_by, createdate, req.body.stage_id, req.body.created_by, req.body.sale_person, 0,req.body.nextstep]
|
|
|
|
|
|
// console.log("query",query);
|
|
// console.log("query",query);
|
|
//console.log("values",values);
|
|
//console.log("values",values);
|
|
@@ -1501,7 +1502,7 @@ module.exports.updatedvrDetails = async (req, res) => {
|
|
|
|
|
|
if (validationResp.status) {
|
|
if (validationResp.status) {
|
|
try {
|
|
try {
|
|
- const query = "UPDATE dvr_report SET date_of_visit = '" + req.body.visit_date + "' ,customer_name= '" + req.body.customer_name + "',contact_name= '" + req.body.contact_name + "',message= '" + req.body.message + "' ,physical_meeting= '" + req.body.physical_metting + "' ,updated_by= '" + req.body.updated_by + "', updated_on= '" + updatedDate + "', stage_id= '" + req.body.stage_id + "' where dvr_id= '" + req.body.dvr_id + "'";
|
|
|
|
|
|
+ const query = "UPDATE dvr_report SET date_of_visit = '" + req.body.visit_date + "' ,customer_name= '" + req.body.customer_name + "',contact_name= '" + req.body.contact_name + "',message= '" + req.body.message + "' ,physical_meeting= '" + req.body.physical_metting + "' ,updated_by= '" + req.body.updated_by + "', updated_on= '" + updatedDate + "', stage_id= '" + req.body.stage_id + "' , nextstep= '" + req.body.nextstep + "' where dvr_id= '" + req.body.dvr_id + "'";
|
|
console.log("query", query);
|
|
console.log("query", query);
|
|
const queryresult = await db.executequery(query);
|
|
const queryresult = await db.executequery(query);
|
|
console.log("queryresult", queryresult);
|
|
console.log("queryresult", queryresult);
|
|
@@ -1594,7 +1595,7 @@ module.exports.updateContactDetails = async (req, res) => {
|
|
|
|
|
|
if (validationResp.status) {
|
|
if (validationResp.status) {
|
|
try {
|
|
try {
|
|
- const query = "UPDATE contact_master SET customer_id= '" + req.body.customer_id + "',first_name= '" + req.body.first_name + "',last_name= '" + req.body.last_name + "' ,mobile_number= '" + req.body.mobile_number + "' ,email_id= '" + req.body.email_id + "', designation= '" + req.body.designation + "', department= '" + req.body.department + "', updated_on= '" + updatedDate + "' where customer_id= '" + req.body.customer_id + "'";
|
|
|
|
|
|
+ const query = "UPDATE contact_master SET customer_id= '" + req.body.customer_id + "',first_name= '" + req.body.first_name + "',last_name= '" + req.body.last_name + "' ,mobile_number= '" + req.body.mobile_number + "' ,email_id= '" + req.body.email_id + "', designation= '" + req.body.designation + "', department= '" + req.body.department + "', updated_on= '" + updatedDate + "' , mob_no= '" + req.body.mob_no + "' where customer_id= '" + req.body.customer_id + "'";
|
|
console.log("query", query);
|
|
console.log("query", query);
|
|
const queryresult = await db.executequery(query);
|
|
const queryresult = await db.executequery(query);
|
|
console.log("queryresult", queryresult);
|
|
console.log("queryresult", queryresult);
|
|
@@ -1918,7 +1919,7 @@ module.exports.getCustcontactDetails = async (req, res) => {
|
|
passing_id = queryresult[0].customer_id;
|
|
passing_id = queryresult[0].customer_id;
|
|
|
|
|
|
|
|
|
|
- const query_id = "SELECT first_name,last_name,mobile_number,email_id,designation,department,function_area FROM contact_master where customer_id= '" + passing_id + "' order by first_name";
|
|
|
|
|
|
+ const query_id = "SELECT first_name,last_name,mobile_number,email_id,designation,department,function_area,mob_no,stage_id FROM contact_master where customer_id= '" + passing_id + "' order by first_name";
|
|
const queryresult_id = await db.executequery(query_id);
|
|
const queryresult_id = await db.executequery(query_id);
|
|
console.log("query", query);
|
|
console.log("query", query);
|
|
|
|
|
|
@@ -1955,7 +1956,7 @@ module.exports.getCustcontactDetails = async (req, res) => {
|
|
|
|
|
|
if (customer_id == 0) {
|
|
if (customer_id == 0) {
|
|
console.log("getting all contact data");
|
|
console.log("getting all contact data");
|
|
- const query = "SELECT first_name,last_name,mobile_number,email_id,designation,department,function_area FROM contact_master order by first_name";
|
|
|
|
|
|
+ const query = "SELECT first_name,last_name,mobile_number,email_id,designation,department,function_area,mob_no,stage_id FROM contact_master order by first_name";
|
|
const queryresult = await db.executequery(query);
|
|
const queryresult = await db.executequery(query);
|
|
console.log("query", query);
|
|
console.log("query", query);
|
|
|
|
|
|
@@ -1989,7 +1990,7 @@ module.exports.getCustcontactDetails = async (req, res) => {
|
|
|
|
|
|
} else {
|
|
} else {
|
|
console.log("getting only specific customer contact data");
|
|
console.log("getting only specific customer contact data");
|
|
- const query = "SELECT first_name,last_name,mobile_number,email_id,designation,department,function_area FROM contact_master where customer_id= '" + customer_id + "' order by first_name";
|
|
|
|
|
|
+ const query = "SELECT first_name,last_name,mobile_number,email_id,designation,department,function_area,mob_no,stage_id FROM contact_master where customer_id= '" + customer_id + "' order by first_name";
|
|
const queryresult = await db.executequery(query);
|
|
const queryresult = await db.executequery(query);
|
|
console.log("query", query);
|
|
console.log("query", query);
|
|
|
|
|