surya 2021-08-17 13:26:11 +05:30
commit fc948852fc
2 changed files with 13 additions and 3 deletions

View File

@ -72,8 +72,9 @@ exports.FinantialsSummary = async (req, res) => {
const Year_1 = data[0].dataValues.fy
const Year_2 = data[1].dataValues.fy
const Year_3 = data[2].dataValues.fy
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)
.then(result => {
//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 ")
.then(result => {
res.send({'status':200,'message':"success",'data':result});
}).catch(err => {
res.status(500).send({'status':404,

View File

@ -17,8 +17,17 @@ module.exports = app => {
// Retrieve all Tutorials
router.get("/EntitiesList", financials.findAllEntities);
/**
* @openapi
* /FinantialsSummary/:id:
* get:
* description: Welcome to swagger-jsdoc!
* responses:
* 200:
* description: Returns a mysterious string.
*/
// get statment master data
router.get("/FinantialsSummary/:id/", financials.FinantialsSummary);
router.get("/FinantialsSummary/:id", financials.FinantialsSummary);
// get statment master data
router.get("/MenuList/:losid", financials.MenuList);