This commit is contained in:
sriramv 2022-03-18 09:54:43 +05:30
parent d78eae16f1
commit 99f4ab4d90

View File

@ -97,7 +97,9 @@ exports.MenuList = async (req, res) => {
const user = "SMC";
processInstanceId = camundaHelper.startFinancialsProcessInstance(Entitydata.dataValues.losid,Entitydata.dataValues.pan,user);
processInstanceId.then(function(InstanceId){
Entities.update({ "process_instance_id":InstanceId },{ where: { id: entityid }});
Entities.update({ "process_instance_id":InstanceId },{ where: { id: entityid }}).then(processInstanceIdData =>{
// resolve here
if (key === array.length -1) { resolve(); } }).catch(err=>{ logMsg.info("camunda process_instance_id creation for entity_id= "+entityid); });
});
// call and get financial year wise data for entity (probe42 api call)
@ -156,10 +158,12 @@ exports.MenuList = async (req, res) => {
});//end of lineItem filter from api response helper call
} // end of probe42 api responce success else condition
});//end of probe42 api call
} // end of cin number exist check in redirection api response
// resolve here
} else {
// resolve here
if (key === array.length -1) { resolve(); }
}
}).catch(err => {
res.status(404).send({'status':404,
@ -220,7 +224,7 @@ exports.MenuList = async (req, res) => {
} // end of for loop
setTimeout(()=>{
if(data.length >= 1)
if(data.length > 1)
{
// below code for overall sum object push process
sum_data = { ...{'losid':losid,'bizname':"Consolidated Financials Summary",'is_consolidated_api_call':1} , statementsmasterrData:MasterData };
@ -228,6 +232,11 @@ exports.MenuList = async (req, res) => {
// send respose to FE
res.send({'status':200,'message':"success",'data':data});
}
else if(data.length == 1)
{
// send respose to FE
res.send({'status':200,'message':"success",'data':data});
}
else
{
res.send({'status':404,'message':"failed",'data':"data not found"});
@ -854,7 +863,34 @@ exports.refreshApi = (req, res) => {
exports.demo = async (req, res) => {
try
{
losid = req.query.losid
start_date = "'2019-08-12'";
let starting_date = new Date(start_date);
end_date = "'2021-05-12'";
let date = new Date(end_date);
years_skeleton = [];
for(let i=0;i<12;i++)
{
//store on fly month number
month_count = date.getMonth() + 1;
//create on fly month data
new_date = date.toLocaleString('default', { month: 'short' })+"-"+date.getFullYear();
//create on fly period data
new_period = date.getFullYear()+"-"+month_count+"-01";
obj = {month:new_date,period:new_period};
// push skeleton object
years_skeleton.push(obj);
//Reset date here
date.setMonth(date.getMonth() - 1);
//check if loop meets starting date or not
if(starting_date.getFullYear() == date.getFullYear() && starting_date.getMonth() + 1 == month_count) { break; }
}
console.log(years_skeleton);
// Statementsmaster.findAll({ where :{is_active : 1} , include: { all: true, nested: true , where :{is_active : 1} , required:false}})
// .then(MasterData => {