ConsolidatedSummary:GWM
This commit is contained in:
parent
4b7767b3c4
commit
b7b9c59aaf
@ -493,9 +493,23 @@ exports.ConsolidatedSummary = async (req, res) => {
|
||||
const Year_4 = EntityfinyearsData[0][years_count - 4].years;
|
||||
if(Year_4 == null)
|
||||
{
|
||||
sequelize.query("select x.id as statement_id,x.statement as statement,y.id as section_id,y.section as section,e.subsection as subsection_id,g.subsection as subsection , g.itemtext as subsection_itemtext,a.itemid,e.itemtext as items,a.fy as Y1 , SUM(a.value) as Y1_value,b.fy as Y2 , SUM(b.value) as Y2_value,c.fy as Y3 , SUM(c.value) as Y3_value from entities z JOIN(SELECT entity_id,itemid,fy,value FROM financials WHERE fy = '"+Year_1+"' and is_active = 1 GROUP BY itemid,fy,is_active,value,entity_id) a ON z.id = a.entity_id JOIN(SELECT entity_id,itemid,fy,value FROM financials WHERE fy = '"+Year_2+"' and is_active = 1 GROUP BY itemid,fy,is_active,value,entity_id) b ON z.id = b.entity_id and a.itemid = b.itemid JOIN(SELECT entity_id,itemid,fy,value FROM financials WHERE fy = '"+Year_3+"' and is_active = 1 GROUP BY itemid,fy,is_active,value,entity_id) c ON z.id = c.entity_id and a.itemid = c.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 ) g ON e.subsection = g.id where losid = '"+losid+"' GROUP BY a.itemid,x.id,x.statement,y.id,y.section,e.subsection,g.subsection,g.itemtext,e.itemtext,e.statement,e.section,e.id,a.fy,b.fy,c.fy ORDER BY e.statement asc , e.section asc , e.id asc")
|
||||
.then(sum_data =>{
|
||||
res.send({'status':200,message: "success" ,'data': sum_data });
|
||||
sequelize.query("select x.id as statement_id,x.statement as statement,y.id as section_id,y.section as section,e.subsection as subsection_id,g.subsection as subsection , g.itemtext as subsection_itemtext,a.itemid,e.itemtext as items,e.is_summary,a.fy as Y1 , SUM(a.value) as Y1_value,b.fy as Y2 , SUM(b.value) as Y2_value,c.fy as Y3 , SUM(c.value) as Y3_value from entities z JOIN(SELECT entity_id,itemid,fy,value FROM financials WHERE fy = '"+Year_1+"' and is_active = 1 GROUP BY itemid,fy,is_active,value,entity_id) a ON z.id = a.entity_id JOIN(SELECT entity_id,itemid,fy,value FROM financials WHERE fy = '"+Year_2+"' and is_active = 1 GROUP BY itemid,fy,is_active,value,entity_id) b ON z.id = b.entity_id and a.itemid = b.itemid JOIN(SELECT entity_id,itemid,fy,value FROM financials WHERE fy = '"+Year_3+"' and is_active = 1 GROUP BY itemid,fy,is_active,value,entity_id) c ON z.id = c.entity_id and a.itemid = c.itemid JOIN ( SELECT id,itemtext,statement,section,subsection,formula,is_calculated,is_summary 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 ) g ON e.subsection = g.id where losid = '"+losid+"' GROUP BY a.itemid,x.id,x.statement,y.id,y.section,e.subsection,g.subsection,g.itemtext,e.itemtext,e.statement,e.section,e.id,a.fy,b.fy,c.fy,e.is_summary ORDER BY e.statement asc , e.section asc , e.id asc")
|
||||
.then(sum_data =>{
|
||||
// is_summary filter from fin_summary data
|
||||
let is_summary_item_array = [];
|
||||
const summary_data = sum_data[0];
|
||||
summary_data.forEach((value, key)=>{
|
||||
if(value.is_summary == 1)
|
||||
{
|
||||
obj_data = value;
|
||||
is_summary_item_array.push(obj_data);
|
||||
}
|
||||
});
|
||||
setTimeout(function()
|
||||
{
|
||||
res.send({'status':200,message: "success" ,"summary": is_summary_item_array ,'data': sum_data });
|
||||
}, 3000);
|
||||
// res.send({'status':200,message: "success" ,'data': sum_data });
|
||||
})
|
||||
.catch(err => {
|
||||
res.status(404).send({'status':404,
|
||||
@ -504,9 +518,23 @@ exports.ConsolidatedSummary = async (req, res) => {
|
||||
}
|
||||
else
|
||||
{
|
||||
sequelize.query("select x.id as statement_id,x.statement as statement,y.id as section_id,y.section as section,e.subsection as subsection_id,g.subsection as subsection , g.itemtext as subsection_itemtext,a.itemid,e.itemtext as items,a.fy as Y1 , SUM(a.value) as Y1_value,b.fy as Y2 , SUM(b.value) as Y2_value,c.fy as Y3 , SUM(c.value) as Y3_value,d.fy as Y4 , SUM(d.value) as Y4_value from entities z JOIN(SELECT entity_id,itemid,fy,value FROM financials WHERE fy = '"+Year_1+"' and is_active = 1 GROUP BY itemid,fy,is_active,value,entity_id) a ON z.id = a.entity_id JOIN(SELECT entity_id,itemid,fy,value FROM financials WHERE fy = '"+Year_2+"' and is_active = 1 GROUP BY itemid,fy,is_active,value,entity_id) b ON z.id = b.entity_id and a.itemid = b.itemid JOIN(SELECT entity_id,itemid,fy,value FROM financials WHERE fy = '"+Year_3+"' and is_active = 1 GROUP BY itemid,fy,is_active,value,entity_id) c ON z.id = c.entity_id and a.itemid = c.itemid JOIN(SELECT entity_id,itemid,fy,value FROM financials WHERE fy = '"+Year_4+"' and is_active = 1 GROUP BY itemid,fy,is_active,value,entity_id) d ON z.id = d.entity_id and a.itemid = d.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 ) g ON e.subsection = g.id where losid = '"+losid+"' GROUP BY a.itemid,x.id,x.statement,y.id,y.section,e.subsection,g.subsection,g.itemtext,e.itemtext,e.statement,e.section,e.id,a.fy,b.fy,c.fy,d.fy ORDER BY e.statement asc , e.section asc , e.id asc")
|
||||
sequelize.query("select x.id as statement_id,x.statement as statement,y.id as section_id,y.section as section,e.subsection as subsection_id,g.subsection as subsection , g.itemtext as subsection_itemtext,a.itemid,e.itemtext as items,e.is_summary,a.fy as Y1 , SUM(a.value) as Y1_value,b.fy as Y2 , SUM(b.value) as Y2_value,c.fy as Y3 , SUM(c.value) as Y3_value,d.fy as Y4 , SUM(d.value) as Y4_value from entities z JOIN(SELECT entity_id,itemid,fy,value FROM financials WHERE fy = '"+Year_1+"' and is_active = 1 GROUP BY itemid,fy,is_active,value,entity_id) a ON z.id = a.entity_id JOIN(SELECT entity_id,itemid,fy,value FROM financials WHERE fy = '"+Year_2+"' and is_active = 1 GROUP BY itemid,fy,is_active,value,entity_id) b ON z.id = b.entity_id and a.itemid = b.itemid JOIN(SELECT entity_id,itemid,fy,value FROM financials WHERE fy = '"+Year_3+"' and is_active = 1 GROUP BY itemid,fy,is_active,value,entity_id) c ON z.id = c.entity_id and a.itemid = c.itemid JOIN(SELECT entity_id,itemid,fy,value FROM financials WHERE fy = '"+Year_4+"' and is_active = 1 GROUP BY itemid,fy,is_active,value,entity_id) d ON z.id = d.entity_id and a.itemid = d.itemid JOIN ( SELECT id,itemtext,statement,section,subsection,formula,is_calculated,is_summary 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 ) g ON e.subsection = g.id where losid = '"+losid+"' GROUP BY a.itemid,x.id,x.statement,y.id,y.section,e.subsection,g.subsection,g.itemtext,e.itemtext,e.statement,e.section,e.id,a.fy,b.fy,c.fy,d.fy,e.is_summary ORDER BY e.statement asc , e.section asc , e.id asc")
|
||||
.then(sum_data =>{
|
||||
res.send({'status':200,message: "success" ,'data': sum_data });
|
||||
// is_summary filter from fin_summary data
|
||||
let is_summary_item_array = [];
|
||||
const summary_data = sum_data[0];
|
||||
summary_data.forEach((value, key)=>{
|
||||
if(value.is_summary == 1)
|
||||
{
|
||||
obj_data = value;
|
||||
is_summary_item_array.push(obj_data);
|
||||
}
|
||||
});
|
||||
setTimeout(function()
|
||||
{
|
||||
res.send({'status':200,message: "success" ,"summary": is_summary_item_array ,'data': sum_data });
|
||||
}, 3000);
|
||||
//res.send({'status':200,message: "success" ,'data': sum_data });
|
||||
})
|
||||
.catch(err => {
|
||||
res.status(404).send({'status':404,
|
||||
@ -806,18 +834,17 @@ exports.camunda = async (req, res) => {
|
||||
const losid = "MW112233";
|
||||
try
|
||||
{
|
||||
Entities.findAll({where : { losid } , attributes: [ 'id', 'losid' , 'pan' , 'cin' , 'bizname' , 'entity_type' , 'activity_group' , 'biz_act_desc' , 'process_instance_id' ] })
|
||||
.then(EntitiesData => {
|
||||
console.log("Start");
|
||||
let promiseone = new Promise.resolve();
|
||||
EntitiesData.forEach((value, key)=>{
|
||||
promisetwo = promiseone.then(() => {
|
||||
console.log(value.dataValues.process_instance_id);
|
||||
})
|
||||
const myPromise = new Promise((resolve, reject) => {
|
||||
Entities.findAll({where : { losid } , attributes: [ 'id', 'losid' , 'pan' , 'cin' , 'bizname' , 'entity_type' , 'activity_group' , 'biz_act_desc' , 'process_instance_id' ] })
|
||||
.then(EntitiesData => {
|
||||
console.log("Start");
|
||||
EntitiesData.forEach(value => {
|
||||
console.log(value.dataValues.process_instance_id);
|
||||
});
|
||||
})
|
||||
});
|
||||
promisetwo.then(()=>{ console.log("End");});
|
||||
})
|
||||
|
||||
myPromise.then( console.log("End"))
|
||||
|
||||
} catch(err) {
|
||||
res.status(500).send({'status':404,
|
||||
|
||||
@ -8,7 +8,7 @@ module.exports = app => {
|
||||
var router = require("express").Router();
|
||||
|
||||
|
||||
// router.get("/camunda", financials.camunda);
|
||||
// router.get("/camunda", financials.camunda);
|
||||
// router.get("/test", financials.test);
|
||||
|
||||
/**
|
||||
|
||||
Loading…
Reference in New Issue
Block a user