fim_summary:GWM
This commit is contained in:
parent
00aa101be0
commit
da9a9d7752
@ -63,6 +63,7 @@ exports.MenuList = async (req, res) => {
|
|||||||
obj_data = { ...value.dataValues , statementsmasterrData:MasterData}
|
obj_data = { ...value.dataValues , statementsmasterrData:MasterData}
|
||||||
data.push(obj_data);
|
data.push(obj_data);
|
||||||
});
|
});
|
||||||
|
|
||||||
res.send({'status':200,'message':"success",'data':data});
|
res.send({'status':200,'message':"success",'data':data});
|
||||||
logMsg.info("MenuList api working");
|
logMsg.info("MenuList api working");
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
@ -86,11 +87,13 @@ exports.FinantialsSummary = async (req, res) => {
|
|||||||
const Year_1 = data[0].dataValues.fy
|
const Year_1 = data[0].dataValues.fy
|
||||||
const Year_2 = data[1].dataValues.fy
|
const Year_2 = data[1].dataValues.fy
|
||||||
const Year_3 = data[2].dataValues.fy
|
const Year_3 = data[2].dataValues.fy
|
||||||
|
const years_data = {'Y1':Year_1 , 'Y2':Year_2 , 'Y3':Year_3}
|
||||||
//sequelize.query("Select a.entity_id,a.itemid,e.statement as statement_id ,e.section as section_id ,e.itemtext as items , a.value as fy_"+Year_1+" , b.value fy_"+Year_2+" , c.value fy_"+Year_3+" FROM financials a JOIN ( SELECT id,statement,section, itemtext FROM itemsmaster) e ON a.itemid = e.id JOIN ( SELECT entity_id, itemid, value, fy FROM financials WHERE fy = "+Year_3+") c ON a.entity_id = c.entity_id and a.itemid = c.itemid JOIN ( SELECT entity_id, itemid, value, fy FROM financials WHERE fy = "+Year_2+") b ON a.entity_id = b.entity_id and a.itemid = b.itemid AND a.fy = "+Year_1+" WHERE a.entity_id = "+id)
|
//sequelize.query("Select a.entity_id,a.itemid,e.statement as statement_id ,e.section as section_id ,e.itemtext as items , a.value as fy_"+Year_1+" , b.value fy_"+Year_2+" , c.value fy_"+Year_3+" FROM financials a JOIN ( SELECT id,statement,section, itemtext FROM itemsmaster) e ON a.itemid = e.id JOIN ( SELECT entity_id, itemid, value, fy FROM financials WHERE fy = "+Year_3+") c ON a.entity_id = c.entity_id and a.itemid = c.itemid JOIN ( SELECT entity_id, itemid, value, fy FROM financials WHERE fy = "+Year_2+") b ON a.entity_id = b.entity_id and a.itemid = b.itemid AND a.fy = "+Year_1+" WHERE a.entity_id = "+id)
|
||||||
//sequelize.query("Select a.entity_id,x.id as statement_id,x.statement as statement,y.id as section_id,y.section as section,a.itemid,e.itemtext as items,a.value as fy_"+Year_1+",b.value fy_"+Year_2+",c.value fy_"+Year_3+" FROM financials a JOIN ( SELECT id, itemtext ,statement 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.statement = y.id JOIN ( SELECT entity_id, itemid, value, fy FROM financials WHERE fy = "+Year_3+") c ON a.entity_id = c.entity_id and a.itemid = c.itemid JOIN ( SELECT entity_id, itemid, value, fy FROM financials WHERE fy = "+Year_2+") b ON a.entity_id = b.entity_id and a.itemid = b.itemid AND a.fy = "+Year_1+" WHERE a.entity_id = "+id+" order by x.id asc , y.id asc , a.itemid asc ")
|
//sequelize.query("Select a.entity_id,x.id as statement_id,x.statement as statement,y.id as section_id,y.section as section,a.itemid,e.itemtext as items,a.value as fy_"+Year_1+",b.value fy_"+Year_2+",c.value fy_"+Year_3+" FROM financials a JOIN ( SELECT id, itemtext ,statement 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.statement = y.id JOIN ( SELECT entity_id, itemid, value, fy FROM financials WHERE fy = "+Year_3+") c ON a.entity_id = c.entity_id and a.itemid = c.itemid JOIN ( SELECT entity_id, itemid, value, fy FROM financials WHERE fy = "+Year_2+") b ON a.entity_id = b.entity_id and a.itemid = b.itemid AND a.fy = "+Year_1+" WHERE a.entity_id = "+id+" order by x.id asc , y.id asc , a.itemid asc ")
|
||||||
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,a.itemid,e.itemtext as items,e.formula,e.is_calculated,f.statement_name as st_type,a.id as id_"+Year_1+" ,a.value as fy_"+Year_1+" , b.id id_"+Year_2+" ,b.value fy_"+Year_2+" ,c.id as id_"+Year_3+" ,c.value fy_"+Year_3+" FROM financials a JOIN ( SELECT id,itemtext,statement,section,subsection,formula,is_calculated FROM itemsmaster ) e ON a.itemid = e.id JOIN ( SELECT id, statement_name FROM statement_type ) f ON a.st_type = f.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 JOIN ( SELECT id,entity_id, itemid, value,fy,is_active FROM financials WHERE fy = "+Year_3+" and is_active = 1) c ON a.entity_id = c.entity_id and a.itemid = c.itemid JOIN ( SELECT id,entity_id, itemid, value,fy,is_active FROM financials WHERE fy = "+Year_2+" and is_active = 1) b ON a.entity_id = b.entity_id and a.itemid = b.itemid AND a.fy = "+Year_1+" WHERE a.entity_id = "+id+" and a.is_active = 1 order by x.id asc , y.id asc , a.itemid asc ")
|
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,a.itemid,e.itemtext as items,e.formula,e.is_calculated,f.statement_name as st_type,a.id as Y1_id ,a.value as Y1_value , b.id Y2_id ,b.value Y2_value ,c.id as Y3_id ,c.value Y3_value FROM financials a JOIN ( SELECT id,itemtext,statement,section,subsection,formula,is_calculated FROM itemsmaster ) e ON a.itemid = e.id JOIN ( SELECT id, statement_name FROM statement_type ) f ON a.st_type = f.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 JOIN ( SELECT id,entity_id, itemid, value,fy,is_active FROM financials WHERE fy = "+Year_3+" and is_active = 1) c ON a.entity_id = c.entity_id and a.itemid = c.itemid JOIN ( SELECT id,entity_id, itemid, value,fy,is_active FROM financials WHERE fy = "+Year_2+" and is_active = 1) b ON a.entity_id = b.entity_id and a.itemid = b.itemid AND a.fy = "+Year_1+" WHERE a.entity_id = "+id+" and a.is_active = 1 order by x.id asc , y.id asc , a.itemid asc ")
|
||||||
.then(result => {
|
.then(result => {
|
||||||
res.send({'status':200,'message':"success",'data':result});
|
const arr = {"years" : years_data , "summary" : result }
|
||||||
|
res.send({'status':200,'message':"success",'data':{"years" : years_data , "summary" : result } });
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
res.status(500).send({'status':404,
|
res.status(500).send({'status':404,
|
||||||
message: err.message || "Some error occurred while retrieving tutorials." ,'data': "No data" });
|
message: err.message || "Some error occurred while retrieving tutorials." ,'data': "No data" });
|
||||||
@ -174,10 +177,18 @@ exports.BrokenPeriods = (req, res) => {
|
|||||||
|
|
||||||
exports.createFinancials = (req, res) => {
|
exports.createFinancials = (req, res) => {
|
||||||
let req_array_data = req.body;
|
let req_array_data = req.body;
|
||||||
|
let req_array_id = [];
|
||||||
req_array_data.forEach((value, key)=>{
|
req_array_data.forEach((value, key)=>{
|
||||||
Financials.update({ is_active : 0 },{ where: { id: value.id }});
|
req_array_id.push(value.id);
|
||||||
delete value.id;
|
delete value.id;
|
||||||
});
|
});
|
||||||
|
Financials.update({ is_active : 0 },{ where: { id: req_array_id }})
|
||||||
|
.then(data => {
|
||||||
|
logMsg.info("Is_active 0 update Success for :"(data));
|
||||||
|
})
|
||||||
|
.catch(err => {
|
||||||
|
logMsg.info("Is_active update failed ,meaasge :"(err.message));
|
||||||
|
});
|
||||||
Financials.bulkCreate(req_array_data)
|
Financials.bulkCreate(req_array_data)
|
||||||
.then(data => {
|
.then(data => {
|
||||||
res.send({'status':200,'message':"success",'data':data});
|
res.send({'status':200,'message':"success",'data':data});
|
||||||
|
|||||||
@ -231,10 +231,22 @@ module.exports = app => {
|
|||||||
|
|
||||||
// third party api call example
|
// third party api call example
|
||||||
router.get('/third_party_api', (req, res) => {
|
router.get('/third_party_api', (req, res) => {
|
||||||
const options = {
|
// const options = {
|
||||||
url: "http://localhost:4000/api/MenuList/MW112233",
|
// url: "http://localhost:8000/api/MenuList/MW112233",
|
||||||
};
|
// };
|
||||||
request.get(options).pipe(res);
|
// request.get(options).pipe(res);
|
||||||
|
// console.log(options.status);
|
||||||
|
|
||||||
|
request('http://localhost:8000/api/MenuList/MW112233', function (error, response, body) {
|
||||||
|
console.error('error:', error); // Print the error if one occurred
|
||||||
|
console.log('statusCode:', response && response.statusCode); // Print the response status code if a response was received
|
||||||
|
let data = JSON.parse(body);
|
||||||
|
let array = data.data;
|
||||||
|
array.forEach((value, key)=>{
|
||||||
|
console.log('result :',value.statementsmasterrData ); // Print the HTML for the Google homepage.
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
})
|
})
|
||||||
|
|
||||||
// routes started here
|
// routes started here
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user