fin_summary:GWM
This commit is contained in:
parent
204a280402
commit
917128eb93
@ -71,17 +71,17 @@ exports.MenuList = (req, res) => {
|
||||
EntitiesData.forEach((value, key)=>{
|
||||
var camunda_status;
|
||||
instancesid = value.dataValues.process_instance_id;
|
||||
// taskid = camundaHelper.financialsListOfProcessInstances(instancesid);
|
||||
// taskid.then(function(result){
|
||||
// formVariable = camundaHelper.financialsFormVariables(result);
|
||||
// formVariable.then(function(form_result){
|
||||
// camunda_status = JSON.parse(form_result);
|
||||
// obj_data = { ...value.dataValues ,status:camunda_status , statementsmasterrData:MasterData }
|
||||
// data.push(obj_data);
|
||||
// });
|
||||
// });
|
||||
obj_data = { ...value.dataValues , statementsmasterrData:MasterData }
|
||||
data.push(obj_data);
|
||||
taskid = camundaHelper.financialsListOfProcessInstances(instancesid);
|
||||
taskid.then(function(result){
|
||||
formVariable = camundaHelper.financialsFormVariables(result);
|
||||
formVariable.then(function(form_result){
|
||||
camunda_status = JSON.parse(form_result);
|
||||
obj_data = { ...value.dataValues ,status:camunda_status , statementsmasterrData:MasterData }
|
||||
data.push(obj_data);
|
||||
});
|
||||
});
|
||||
// obj_data = { ...value.dataValues , statementsmasterrData:MasterData }
|
||||
// data.push(obj_data);
|
||||
|
||||
}); // end of EntitiesData foreach
|
||||
|
||||
@ -108,7 +108,9 @@ exports.MenuList = (req, res) => {
|
||||
// FinantialsSummary
|
||||
exports.FinantialsSummary = async (req, res) => {
|
||||
const id = req.query.entityid
|
||||
|
||||
Entities.findOne({where : { id } , attributes: [ 'process_instance_id' ] })
|
||||
.then(EntitiesData => {
|
||||
const instancesid = EntitiesData.dataValues.process_instance_id;
|
||||
sequelize.query("select a.losid,a.entityid,a.Y1,a.Y2,a.Y3,a.Y4,a.Y1_st_type as Y1_st_type_id, b.statement_name as Y1_st_type_name,a.Y2_st_type as Y2_st_type_id, c.statement_name as Y2_st_type_name,a.Y3_st_type as Y3_st_type_id, d.statement_name as Y3_st_type_name , a.Y4_st_type as Y4_st_type_id, e.statement_name as Y4_st_type_name,a.additional_year_type FROM entity_fin_years a LEFT JOIN (SELECT id,statement_name FROM statement_type) b ON a.Y1_st_type = b.id LEFT JOIN (SELECT id,statement_name FROM statement_type) c ON a.Y2_st_type = c.id LEFT JOIN (SELECT id,statement_name FROM statement_type) d ON a.Y3_st_type = d.id LEFT JOIN (SELECT id,statement_name FROM statement_type) e ON a.Y4_st_type = e.id WHERE entityid ="+id)
|
||||
.then(data => {
|
||||
|
||||
@ -122,9 +124,16 @@ exports.FinantialsSummary = async (req, res) => {
|
||||
{
|
||||
const three_years_data = {"losid": data[0][0].losid,"entityid": data[0][0].entityid,"Y1": data[0][0].Y1,"Y2": data[0][0].Y2,"Y3": data[0][0].Y3,"Y1_st_type_id":data[0][0].Y1_st_type_id,"Y1_st_type_name": data[0][0].Y1_st_type_name,"Y2_st_type_id":data[0][0].Y2_st_type_id,"Y2_st_type_name": data[0][0].Y2_st_type_name,"Y3_st_type_id": data[0][0].Y3_st_type_id,"Y3_st_type_name": data[0][0].Y3_st_type_name}
|
||||
sequelize.query("Select a.entity_id,x.id as statement_id,x.statement as statement,y.id as section_id,y.section as section,e.subsection as subsection_id,z.subsection as subsection , z.itemtext as subsection_itemtext ,a.itemid,e.itemtext as items,e.formula,e.is_calculated,a.st_type as Y1_st_type,a.fy as Y1,a.id as Y1_id ,a.value as Y1_value ,b.st_type as Y2_st_type,b.fy as Y2, b.id Y2_id ,b.value Y2_value ,c.st_type as Y3_st_type,c.fy as Y3,c.id as Y3_id ,c.value Y3_value , g.remarks , g.id as remarks_id FROM financials a LEFT JOIN ( SELECT id,entity_id,itemid,remarks FROM fin_remarks WHERE is_active = 1) g ON a.entity_id = g.entity_id and a.itemid = g.itemid JOIN ( SELECT id,itemtext,statement,section,subsection,formula,is_calculated FROM itemsmaster ) e ON a.itemid = e.id JOIN ( SELECT id, statement FROM statementsmaster ) x ON e.statement = x.id JOIN ( SELECT id, section FROM sectionsmaster ) y ON e.section = y.id LEFT JOIN ( SELECT id, subsection , itemtext FROM subsectionsmaster ) z ON e.subsection = z.id LEFT JOIN ( SELECT id,entity_id, itemid, value,fy,is_active,st_type FROM financials WHERE fy = "+Year_3+" and entity_id ="+id+" and is_active = 1) c ON a.entity_id = c.entity_id and a.itemid = c.itemid LEFT JOIN ( SELECT id,entity_id, itemid, value,fy,is_active,st_type FROM financials WHERE fy = "+Year_2+" and entity_id = "+id+" and is_active = 1) b ON a.entity_id = b.entity_id and a.itemid = b.itemid WHERE a.fy = "+Year_1+" and a.entity_id = "+id+" and a.is_active = 1 order by e.statement asc , e.section asc , e.id asc")
|
||||
.then(result => {
|
||||
|
||||
res.send({'status':200,'message':"success",'data':{"years" : three_years_data ,"add_new_finyear_flag" : add_new_FY_flag, "summary" : result } });
|
||||
.then(summary => {
|
||||
taskid = camundaHelper.financialsListOfProcessInstances(instancesid);
|
||||
taskid.then(function(result){
|
||||
formVariable = camundaHelper.financialsFormVariables(result);
|
||||
formVariable.then(function(form_result){
|
||||
camunda_status = JSON.parse(form_result);
|
||||
res.send({'status':200,'message':"success",'data':{"years" : three_years_data ,"add_new_finyear_flag" : add_new_FY_flag,status:camunda_status, "summary" : summary } });
|
||||
});
|
||||
});
|
||||
//res.send({'status':200,'message':"success",'data':{"years" : three_years_data ,"add_new_finyear_flag" : add_new_FY_flag, "summary" : result } });
|
||||
}).catch(err => {
|
||||
res.status(500).send({'status':404,
|
||||
message: err.message || "Some error occurred while retrieving tutorials." ,'data': "No data" });
|
||||
@ -134,15 +143,26 @@ exports.FinantialsSummary = async (req, res) => {
|
||||
{
|
||||
const four_years_data = {"losid": data[0][0].losid,"entityid": data[0][0].entityid,"Y1": data[0][0].Y1,"Y2": data[0][0].Y2,"Y3": data[0][0].Y3,"Y4": data[0][0].Y4,"Y1_st_type_id":data[0][0].Y1_st_type_id,"Y1_st_type_name": data[0][0].Y1_st_type_name,"Y2_st_type_id":data[0][0].Y2_st_type_id,"Y2_st_type_name": data[0][0].Y2_st_type_name,"Y3_st_type_id": data[0][0].Y3_st_type_id,"Y3_st_type_name": data[0][0].Y3_st_type_name,"Y4_st_type_id":data[0][0].Y4_st_type_id,"Y4_st_type_name":data[0][0].Y4_st_type_name,"additional_year_type":data[0][0].additional_year_type}
|
||||
sequelize.query("Select a.entity_id,x.id as statement_id,x.statement as statement,y.id as section_id,y.section as section,e.subsection as subsection_id,z.subsection as subsection , z.itemtext as subsection_itemtext ,a.itemid,e.itemtext as items,e.formula,e.is_calculated,a.st_type as Y1_st_type,a.fy as Y1,a.id as Y1_id ,a.value as Y1_value ,b.st_type as Y2_st_type,b.fy as Y2, b.id Y2_id ,b.value Y2_value ,c.st_type as Y3_st_type,c.fy as Y3,c.id as Y3_id ,c.value Y3_value ,d.st_type as Y4_st_type,d.fy as Y4,d.id as Y4_id ,d.value Y4_value , g.remarks , g.id as remarks_id FROM financials a LEFT JOIN ( SELECT id,entity_id,itemid,remarks FROM fin_remarks WHERE is_active = 1) g ON a.entity_id = g.entity_id and a.itemid = g.itemid JOIN ( SELECT id,itemtext,statement,section,subsection,formula,is_calculated FROM itemsmaster ) e ON a.itemid = e.id JOIN ( SELECT id, statement FROM statementsmaster ) x ON e.statement = x.id JOIN ( SELECT id, section FROM sectionsmaster ) y ON e.section = y.id LEFT JOIN ( SELECT id, subsection , itemtext FROM subsectionsmaster ) z ON e.subsection = z.id LEFT JOIN ( SELECT id,entity_id, itemid, value,fy,is_active,st_type FROM financials WHERE fy = "+Year_4+" and entity_id ="+id+" and is_active = 1) d ON a.entity_id = d.entity_id and a.itemid = d.itemid LEFT JOIN ( SELECT id,entity_id, itemid, value,fy,is_active,st_type FROM financials WHERE fy = "+Year_3+" and entity_id ="+id+" and is_active = 1) c ON a.entity_id = c.entity_id and a.itemid = c.itemid LEFT JOIN ( SELECT id,entity_id, itemid, value,fy,is_active,st_type FROM financials WHERE fy = "+Year_2+" and entity_id = "+id+" and is_active = 1) b ON a.entity_id = b.entity_id and a.itemid = b.itemid WHERE a.fy = "+Year_1+" and a.entity_id = "+id+" and a.is_active = 1 order by e.statement asc , e.section asc , e.id asc")
|
||||
.then(result => {
|
||||
|
||||
res.send({'status':200,'message':"success",'data':{"years" : four_years_data ,"add_new_finyear_flag" : add_new_FY_flag, "summary" : result } });
|
||||
.then(summary => {
|
||||
taskid = camundaHelper.financialsListOfProcessInstances(instancesid);
|
||||
taskid.then(function(result){
|
||||
formVariable = camundaHelper.financialsFormVariables(result);
|
||||
formVariable.then(function(form_result){
|
||||
camunda_status = JSON.parse(form_result);
|
||||
res.send({'status':200,'message':"success",'data':{"years" : four_years_data ,"add_new_finyear_flag" : add_new_FY_flag,status:camunda_status, "summary" : summary } });
|
||||
});
|
||||
});
|
||||
//res.send({'status':200,'message':"success",'data':{"years" : four_years_data ,"add_new_finyear_flag" : add_new_FY_flag, "summary" : result } });
|
||||
}).catch(err => {
|
||||
res.status(500).send({'status':404,
|
||||
message: err.message || "Some error occurred while retrieving tutorials." ,'data': "No data" });
|
||||
});
|
||||
}
|
||||
|
||||
})
|
||||
.catch(err => {
|
||||
res.status(500).send({'status':404,
|
||||
message: err.message || "Some error occurred while retrieving tutorials." ,'data': "No data" });
|
||||
});
|
||||
|
||||
|
||||
})
|
||||
|
||||
Loading…
Reference in New Issue
Block a user