Bladeren bron

Fetch customer name in contact screen

Devansh Vakharia 2 dagen geleden
bovenliggende
commit
2fd140b639
1 gewijzigde bestanden met toevoegingen van 8 en 3 verwijderingen
  1. 8 3
      controllers/dvrReportController.js

+ 8 - 3
controllers/dvrReportController.js

@@ -1956,7 +1956,8 @@ module.exports.getCustcontactDetails = async (req, res) => {
             passing_id = queryresult[0].customer_id;
 
 
-            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 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 query_id = "SELECT customer_name,first_name,last_name,mobile_number,email_id,designation,department,function_area,mob_no,stage_id FROM contact_master JOIN customer_master ON contact_master.customer_id=customer_master.customer_id where contact_master.customer_id= '" + passing_id + "' order by first_name;"
             const queryresult_id = await db.executequery(query_id);
             console.log("query", query);
 
@@ -1993,7 +1994,9 @@ module.exports.getCustcontactDetails = async (req, res) => {
 
             if (customer_id == 0) {
                 console.log("getting all contact data");
-                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 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 query = "SELECT customer_name,first_name,last_name,mobile_number,email_id,designation,department,function_area,mob_no,stage_id FROM contact_master JOIN customer_master ON contact_master.customer_id=customer_master.customer_id order by first_name;"
+
                 const queryresult = await db.executequery(query);
                 console.log("query", query);
 
@@ -2027,7 +2030,9 @@ module.exports.getCustcontactDetails = async (req, res) => {
 
             } else {
                 console.log("getting only specific customer contact data");
-                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 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 query = "SELECT customer_name,first_name,last_name,mobile_number,email_id,designation,department,function_area,mob_no,stage_id FROM contact_master JOIN customer_master ON contact_master.customer_id=customer_master.customer_id where contact_master.customer_id= '" + customer_id + "' order by first_name;"
+
                 const queryresult = await db.executequery(query);
                 console.log("query", query);