diff --git a/app/controllers/cibil.controller.js b/app/controllers/cibil.controller.js index e259bf9..794655e 100644 --- a/app/controllers/cibil.controller.js +++ b/app/controllers/cibil.controller.js @@ -6,8 +6,8 @@ exports.LandingPageDetailsList =async (req, res) => { try { - consumer = await sequelize.query("SELECT con_borrower_detail.MemberReferenceNumber as ReferenceNumber, con_id_detail.IDNumber as PanNumber FROM con_borrower_detail LEFT JOIN con_id_detail ON con_borrower_detail.MemberReferenceNumber = con_id_detail.MemberReferenceNumber and con_id_detail.IDType = 'Income Tax ID Number' where con_borrower_detail.losid = '"+req.query.losid+"'").catch(err=>{ }); - commercial = await sequelize.query("SELECT ApplicationRefno as ReferenceNumber, EnqInfoPan as PanNumber FROM com_borrower_profile where losid = '"+req.query.losid+"'").catch(err=>{ }); + consumer = await sequelize.query("SELECT con_borrower_detail.ConsumerNameField1 as name,con_borrower_detail.MemberReferenceNumber as ReferenceNumber, con_id_detail.IDNumber as PanNumber FROM con_borrower_detail LEFT JOIN con_id_detail ON con_borrower_detail.MemberReferenceNumber = con_id_detail.MemberReferenceNumber and con_id_detail.IDType = 'Income Tax ID Number' where con_borrower_detail.losid = '"+req.query.losid+"'").catch(err=>{ }); + commercial = await sequelize.query("SELECT EnqInfoBorrowerName as name,ApplicationRefno as ReferenceNumber, EnqInfoPan as PanNumber FROM com_borrower_profile where losid = '"+req.query.losid+"'").catch(err=>{ }); LandingPageData = {commercialData : commercial[0] , consumerData : consumer[0]} @@ -71,7 +71,7 @@ exports.SanctionAmtAndReplaceOfDeptDetailsList =async (req, res) => }); - var query = "Select a.id,a.facility_type,a.total "+select_items+" FROM out_sanction_amt_and_replacement_of_debt_p a "+sub_query+" WHERE a.losid = '"+req.query.losid+"' and ref_no = '"+req.query.ref_no+"'"; + var query = "Select a.id,a.facility_type,a.total,a.open_total,a.closed_total "+select_items+" FROM out_sanction_amt_and_replacement_of_debt_p a "+sub_query+" WHERE a.losid = '"+req.query.losid+"' and ref_no = '"+req.query.ref_no+"'"; console.log(query); sequelize.query(query).then(async(data) => { SanctionData = {monthRange : monthRangeArray ,SanctionAmountData : data}; @@ -211,7 +211,7 @@ exports.ConsolidatedSanctionAmtAndReplaceOfDeptDetailsList =async (req, res) => }); - var query = "Select a.facility_type,SUM(a.total) as total "+select_items+" FROM out_sanction_amt_and_replacement_of_debt_p a "+sub_query+" WHERE a.losid = '"+req.query.losid+"' group by a.facility_type,a.total"; + var query = "Select a.facility_type,SUM(a.total) as total,SUM(a.open_total) as open_total ,SUM(a.closed_total) as closed_total "+select_items+" FROM out_sanction_amt_and_replacement_of_debt_p a "+sub_query+" WHERE a.losid = '"+req.query.losid+"' group by a.facility_type,a.total,a.open_total,a.closed_total"; sequelize.query(query).then(async(data) => { SanctionData = {monthRange : monthRangeArray ,SanctionAmountData : data}; diff --git a/app/models/OutSanctionAmt_P.js b/app/models/OutSanctionAmt_P.js index f036346..dfd23f0 100644 --- a/app/models/OutSanctionAmt_P.js +++ b/app/models/OutSanctionAmt_P.js @@ -10,7 +10,9 @@ module.exports = (sequelize, DataTypes) => { losid : { type: DataTypes.STRING }, ref_no : { type: DataTypes.STRING }, facility_type : { type: DataTypes.STRING }, - total : { type: DataTypes.INTEGER }, + total : { type: DataTypes.INTEGER }, + open_total : { type: DataTypes.INTEGER }, + closed_total : { type: DataTypes.INTEGER }, createdAt : { type: DataTypes.DATE }, createdby : { type: DataTypes.INTEGER }, updatedAt : { type: DataTypes.DATE },