updateFinancial:GWM
This commit is contained in:
parent
4e733b4da4
commit
51642489cd
@ -775,12 +775,23 @@ exports.updateFinancials = (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)=>{
|
||||||
const id = value.id;
|
await Financials.findOne({ where: { id : value.id , is_active : 1} }).then(async function(result) {
|
||||||
Financials.update({ "entity_id":value.entity_id,"st_type":value.sy_type,"itemid":value.itemid,"fy":value.fy,"value":value.value,"is_active":value.is_active,"updatedby":value.updatedby },{ where: { id:id }})
|
|
||||||
|
if(result.value == value.value)
|
||||||
|
{
|
||||||
|
logMsg.info("Value not updated for - EntityId : "+value.entity_id+" , FY : "+value.fy+",ItemId : "+value.itemid+",primary key :"+value.id);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Financials.update({ "value":value.value,"sub_value":value.sub_value},{ where: { id:value.id }})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
});
|
});
|
||||||
res.send({'status':200,'message':"success",'data':"No data"});
|
res.send({'status':200,'message':"success",'data':"No data"});
|
||||||
logMsg.info("multiple financials update Success");
|
|
||||||
}catch(err) {
|
}catch(err) {
|
||||||
res.send({'status':404,
|
res.send({'status':404,
|
||||||
message: err.message || "Some error occurred while inserting statements." ,'data': "No data"
|
message: err.message || "Some error occurred while inserting statements." ,'data': "No data"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user