getYear:GWM
This commit is contained in:
parent
ec3e8ecc5c
commit
8645bc8e8f
@ -613,14 +613,14 @@ exports.BrokenPeriods = (req, res) => {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
exports.createFinancials = (req, res) => {
|
exports.createFinancials = async (req, res) => {
|
||||||
|
|
||||||
const req_array_data = req.body;
|
const req_array_data = req.body;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
req_array_data.forEach((value, key)=>{
|
req_array_data.forEach(async(value, key)=>{
|
||||||
|
|
||||||
Financials.findOne({ where: { id : value.id , is_active : 1} }).then(function(result) {
|
await Financials.findOne({ where: { id : value.id , is_active : 1} }).then(async function(result) {
|
||||||
|
|
||||||
if(result.value == value.value)
|
if(result.value == value.value)
|
||||||
{
|
{
|
||||||
@ -628,9 +628,9 @@ exports.createFinancials = (req, res) => {
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Financials.update({ is_active : 0 },{ where: { id: value.id }});
|
await Financials.update({ is_active : 0 },{ where: { id: value.id }});
|
||||||
logMsg.info("updated is_active = 0 for primary key : "+value.id);
|
logMsg.info("updated is_active = 0 for primary key : "+value.id);
|
||||||
Financials.create({ "entity_id":value.entity_id,"st_type":value.st_type,"itemid":value.itemid,"fy":value.fy,"value":value.value,"sub_value":value.sub_value,"is_active":value.is_active,"createdby":value.createdby })
|
await Financials.create({ "entity_id":value.entity_id,"st_type":value.st_type,"itemid":value.itemid,"fy":value.fy,"value":value.value,"sub_value":value.sub_value,"is_active":value.is_active,"createdby":value.createdby })
|
||||||
logMsg.info("Created new financials data - EntityId : "+value.entity_id+" , FY : "+value.fy+",ItemId : "+value.itemid);
|
logMsg.info("Created new financials data - EntityId : "+value.entity_id+" , FY : "+value.fy+",ItemId : "+value.itemid);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -883,8 +883,17 @@ exports.checkProbeStatus = (req, res) => {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// this api for other income module
|
||||||
|
exports.getFinancialsYears = async (req, res) => {
|
||||||
|
try
|
||||||
|
{
|
||||||
|
data = await Entityfinyear.findAll({where : { losid : req.query.losid } , attributes: [ [sequelize.fn('DISTINCT', sequelize.col('FY')), 'FY'] ] , order: [['FY', 'DESC']] })
|
||||||
|
res.send({'status':200,"message": "success." ,'data': data});
|
||||||
|
} catch(err) {
|
||||||
|
res.send({'status':404,message: err.message || "Some error occurred while inserting statements." ,'data': "No data"});
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -896,31 +905,7 @@ exports.checkProbeStatus = (req, res) => {
|
|||||||
exports.test = async (req, res) => {
|
exports.test = async (req, res) => {
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
res.send({'status':200,"message": "success." ,'data': "No data"});
|
||||||
|
|
||||||
// const str = 'a v:ery (long) string';
|
|
||||||
// console.log(str)
|
|
||||||
// var remove_spl_char = str.replace(/[^a-zA-Z ]/g, "")
|
|
||||||
// console.log(remove_spl_char)
|
|
||||||
// var strUnderscores = remove_spl_char.replace(/\s+/g, '_');
|
|
||||||
// console.log(strUnderscores)
|
|
||||||
// TempItemMaster.findAll({raw : true ,where :{statement:3 , section:17} , attributes: [ 'id' , 'itemtext' ] })
|
|
||||||
// .then(async(ItemsmasterData) => {
|
|
||||||
|
|
||||||
// for( value of ItemsmasterData)
|
|
||||||
// {
|
|
||||||
// var txt = value.itemtext;
|
|
||||||
// var txt1 = txt.slice(0, 15)
|
|
||||||
// var txt2 = txt1.replace(/[^a-zA-Z ]/g, "");
|
|
||||||
// var txt3 = txt2.replace(/\s+/g, '_');
|
|
||||||
// var txt4 = "cf_cff_"+txt3;
|
|
||||||
// var txt5 = txt4.toLowerCase();
|
|
||||||
// console.log(txt5);
|
|
||||||
|
|
||||||
// await TempItemMaster.update({ itemkey : txt5 } , { where: { id: value.id }});
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
|
|
||||||
} catch(err) {
|
} catch(err) {
|
||||||
res.send({'status':404,message: err.message || "Some error occurred while inserting statements." ,'data': "No data"});
|
res.send({'status':404,message: err.message || "Some error occurred while inserting statements." ,'data': "No data"});
|
||||||
}
|
}
|
||||||
@ -929,60 +914,9 @@ exports.test = async (req, res) => {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
exports.demo = async (req, res) => {
|
// exports.redirectionApitest = async (req, res) => {
|
||||||
try
|
// try
|
||||||
{
|
// {
|
||||||
|
|
||||||
key = "manual";
|
|
||||||
Itemsmaster.findAll({ where :{manual:1,is_active : 1},attributes: ['id'] , order: [['statement', 'ASC'],['section', 'ASC'],['itemorder', 'ASC']] })
|
|
||||||
.then(ItemsmasterData => {
|
|
||||||
res.send(ItemsmasterData);
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Statementsmaster.findAll({ where :{is_active : 1} , include: { all: true, nested: true , where :{is_active : 1} , required:false}})
|
|
||||||
// .then(MasterData => {
|
|
||||||
// Entities.findAll({where : { losid } , attributes: [ 'id', 'losid' , 'pan' , 'cin' , 'bizname' , 'entity_type' , 'activity_group' , 'biz_act_desc' , 'process_instance_id' , 'probe42_data_status' ,'is_verified' ] })
|
|
||||||
// .then(EntitiesData => {
|
|
||||||
|
|
||||||
|
|
||||||
// let data = [];
|
|
||||||
// var getCamundaStatus = new Promise(async (resolve, reject) => {
|
|
||||||
|
|
||||||
// await EntitiesData.forEach(async (value, key , array)=>{
|
|
||||||
|
|
||||||
// instancesid = value.dataValues.process_instance_id;
|
|
||||||
// taskid = await camundaHelper.financialsListOfProcessInstances(instancesid);
|
|
||||||
|
|
||||||
// formVariable = await camundaHelper.financialsFormVariables(taskid);
|
|
||||||
|
|
||||||
// formVariableResult = await JSON.parse(formVariable);
|
|
||||||
// if(formVariableResult.type){ camunda_status = {"process_status":"NULL"}; } else { camunda_status = formVariableResult; }
|
|
||||||
// obj_data = { ...value.dataValues ,status:camunda_status , statementsmasterrData:MasterData }
|
|
||||||
// data.push(obj_data);
|
|
||||||
// if (key === array.length -1) { resolve(); }
|
|
||||||
// }); // end of EntitiesData foreach
|
|
||||||
|
|
||||||
// });
|
|
||||||
|
|
||||||
// getCamundaStatus.then(()=>{
|
|
||||||
// // below code for overall sum object push process
|
|
||||||
// sum_data = { ...{'losid':losid,'bizname':"Consolidated Financials Summary",'is_consolidated_api_call':1} , statementsmasterrData:MasterData };
|
|
||||||
// data.push(sum_data);
|
|
||||||
// // send respose to FE
|
|
||||||
// res.send({'status':200,'message':"success",'data':data});
|
|
||||||
// });
|
|
||||||
|
|
||||||
// }); // end of findall EntitiesData
|
|
||||||
// }); // end of findall masters datas
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -1013,11 +947,11 @@ exports.test = async (req, res) => {
|
|||||||
// });//end of probe42 api call
|
// });//end of probe42 api call
|
||||||
// });
|
// });
|
||||||
|
|
||||||
}catch(err) {
|
// }catch(err) {
|
||||||
res.send({'status':404,message: err.message || "Some error occurred while inserting statements." ,'data': "No data"});
|
// res.send({'status':404,message: err.message || "Some error occurred while inserting statements." ,'data': "No data"});
|
||||||
}
|
// }
|
||||||
|
|
||||||
};
|
// };
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -1037,7 +971,7 @@ exports.test = async (req, res) => {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
// exports.demoone = (req, res) => {
|
// exports.probedatatest = (req, res) => {
|
||||||
// Sync(function()
|
// Sync(function()
|
||||||
// {
|
// {
|
||||||
// try
|
// try
|
||||||
|
|||||||
@ -7,7 +7,7 @@ module.exports = app => {
|
|||||||
const { logMsg } = require('../services/logger.js');
|
const { logMsg } = require('../services/logger.js');
|
||||||
var router = require("express").Router();
|
var router = require("express").Router();
|
||||||
|
|
||||||
router.get("/demo", financials.demo);
|
router.get("/test", financials.test);
|
||||||
/**
|
/**
|
||||||
* @swagger
|
* @swagger
|
||||||
* /api/checkProbeStatus:
|
* /api/checkProbeStatus:
|
||||||
@ -1057,6 +1057,28 @@ module.exports = app => {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @swagger
|
||||||
|
* /api/getFinancialsYears:
|
||||||
|
* get:
|
||||||
|
* summary: getFinancialsYears(other income module)
|
||||||
|
* description: getFinancialsYears
|
||||||
|
* parameters:
|
||||||
|
* - in: query
|
||||||
|
* name: losid
|
||||||
|
* schema:
|
||||||
|
* type: string
|
||||||
|
* required: true
|
||||||
|
* description: losid
|
||||||
|
* example: MW112233
|
||||||
|
* responses:
|
||||||
|
* 200:
|
||||||
|
* description: success
|
||||||
|
*/
|
||||||
|
router.get("/getFinancialsYears", financials.getFinancialsYears);
|
||||||
|
|
||||||
// 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 = {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user