This commit is contained in:
sriramv 2022-06-17 16:42:05 +05:30
parent c50c7d6fa0
commit 2d5f73f2e8
3 changed files with 15 additions and 11 deletions

View File

@ -66,12 +66,12 @@ exports.SanctionAmtAndReplaceOfDeptDetailsList =async (req, res) =>
monthRangeArray.push(obj);
key_addition = index + 1;
alisename = words[key_addition];
select_items += ","+alisename+".amt as amt_"+monthRange_aliseName+","+alisename+".count as count_"+monthRange_aliseName+","+alisename+".opening_amt as opening_amt_"+monthRange_aliseName+","+alisename+".opening_count as opening_count_"+monthRange_aliseName+","+alisename+".closing_amt as closing_amt_"+monthRange_aliseName+","+alisename+".closing_count as closing_count_"+monthRange_aliseName+" ";
select_items += ","+alisename+".months_range as months_range_"+monthRange_aliseName+","+alisename+".amt as amt_"+monthRange_aliseName+","+alisename+".count as count_"+monthRange_aliseName+","+alisename+".opening_amt as opening_amt_"+monthRange_aliseName+","+alisename+".opening_count as opening_count_"+monthRange_aliseName+","+alisename+".closing_amt as closing_amt_"+monthRange_aliseName+","+alisename+".closing_count as closing_count_"+monthRange_aliseName+" ";
sub_query += " JOIN ( SELECT id,sanction_amt_id,months_range,amt,count,opening_amt,opening_count,closing_amt,closing_count FROM out_sanction_amt_and_replacement_of_debt_c where months_range= '"+monthRange+"') "+alisename+" ON a.id = "+alisename+".sanction_amt_id";
});
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+"'";
var query = "Select a.id,a.facility_type,a.total_amt,a.total_count,a.open_total_amt,a.open_total_count,a.closed_total_amt,a.closed_total_count "+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};
@ -112,12 +112,12 @@ exports.EnquirySummaryDetailsList =async (req, res) =>
monthRangeArray.push(obj);
key_addition = index + 1;
alisename = words[key_addition];
select_items += ","+alisename+".amt as amt_"+monthRange_aliseName+","+alisename+".count as count_"+monthRange_aliseName+" ";
select_items += ","+alisename+".months_range as months_range_"+monthRange_aliseName+","+alisename+".amt as amt_"+monthRange_aliseName+","+alisename+".count as count_"+monthRange_aliseName+" ";
sub_query += " JOIN ( SELECT id,enquiry_amount_id,months_range,amt,count FROM out_enquiry_amount_c where months_range= '"+monthRange+"') "+alisename+" ON a.id = "+alisename+".enquiry_amount_id";
});
var query = "Select a.id,a.facility_type,a.total "+select_items+" FROM out_enquity_amount_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_amt,a.total_count "+select_items+" FROM out_enquity_amount_p a "+sub_query+" WHERE a.losid = '"+req.query.losid+"' and ref_no = '"+req.query.ref_no+"'";
sequelize.query(query).then(async(data) => {
EnquiryData = {monthRange : monthRangeArray ,EnquiryAmountData : data};
@ -211,8 +211,8 @@ exports.ConsolidatedSanctionAmtAndReplaceOfDeptDetailsList =async (req, res) =>
});
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";
var query = "Select a.facility_type,SUM(a.total_amt) as total_amt,SUM(a.total_count) as total_count,SUM(a.open_total_amt) as open_total_amt,SUM(a.open_total_count) as open_total_count ,SUM(a.closed_total_amt) as closed_total_amt,SUM(a.closed_total_count) as closed_total_count "+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_amt,a.total_count,a.open_total_amt,a.open_total_count,a.closed_total_amt,a.closed_total_count";
sequelize.query(query).then(async(data) => {
SanctionData = {monthRange : monthRangeArray ,SanctionAmountData : data};
res.send({'status':200 , message:"Success." ,'data':SanctionData});
@ -257,7 +257,7 @@ exports.ConsolidatedEnquirySummaryDetailsList =async (req, res) =>
});
var query = "Select a.facility_type,SUM(a.total) as total "+select_items+" FROM out_enquity_amount_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_amt) as total_amt,SUM(a.total_count) as total_count "+select_items+" FROM out_enquity_amount_p a "+sub_query+" WHERE a.losid = '"+req.query.losid+"' group by a.facility_type,a.total_amt,a.total_count ";
sequelize.query(query).then(async(data) => {
EnquiryData = {monthRange : monthRangeArray ,EnquiryAmountData : data};

View File

@ -10,9 +10,12 @@ module.exports = (sequelize, DataTypes) => {
losid : { type: DataTypes.STRING },
ref_no : { type: DataTypes.STRING },
facility_type : { type: DataTypes.STRING },
total : { type: DataTypes.INTEGER },
open_total : { type: DataTypes.INTEGER },
closed_total : { type: DataTypes.INTEGER },
total_amt : { type: DataTypes.INTEGER },
open_total_amt : { type: DataTypes.INTEGER },
closed_total_amt : { type: DataTypes.INTEGER },
total_count : { type: DataTypes.INTEGER },
open_total_count : { type: DataTypes.INTEGER },
closed_total_count : { type: DataTypes.INTEGER },
createdAt : { type: DataTypes.DATE },
createdby : { type: DataTypes.INTEGER },
updatedAt : { type: DataTypes.DATE },

View File

@ -10,7 +10,8 @@ module.exports = (sequelize, DataTypes) => {
losid : { type: DataTypes.STRING },
ref_no : { type: DataTypes.STRING },
facility_type : { type: DataTypes.STRING },
total : { type: DataTypes.INTEGER },
total_amt : { type: DataTypes.INTEGER },
total_count : { type: DataTypes.INTEGER },
is_active : { type: DataTypes.INTEGER },
createdAt : { type: DataTypes.DATE },
createdby : { type: DataTypes.INTEGER },