inr_value:GWM

This commit is contained in:
sriramv 2023-08-08 14:29:41 +05:30
parent 5bf6f37330
commit c639c62abe
4 changed files with 18 additions and 7 deletions

View File

@ -24,7 +24,8 @@ module.exports = (sequelize, DataTypes) => {
is_editable: { type: DataTypes.INTEGER }, is_editable: { type: DataTypes.INTEGER },
is_active: { type: DataTypes.INTEGER }, is_active: { type: DataTypes.INTEGER },
value: { type: DataTypes.INTEGER }, value: { type: DataTypes.INTEGER },
sub_value: { type: DataTypes.STRING }, sub_value: { type: DataTypes.STRING },
inr_value: { type: DataTypes.INTEGER },
createdby: { type: DataTypes.INTEGER }, createdby: { type: DataTypes.INTEGER },
updatedby: { type: DataTypes.INTEGER }, updatedby: { type: DataTypes.INTEGER },

View File

@ -26,7 +26,7 @@ function probe42ApiCall(cin) {
method: "POST", method: "POST",
json: true, json: true,
body: myJSONObject body: myJSONObject
}, function (error, response, body) { }, function (error, response, body) {
if (body != undefined) { if (body != undefined) {
if (response.statusCode == 200 && body.hasOwnProperty("data") && body.data.financials.length != 0) { if (response.statusCode == 200 && body.hasOwnProperty("data") && body.data.financials.length != 0) {
financial_data = body.data.financials; financial_data = body.data.financials;

View File

@ -94,9 +94,12 @@ const { logMsg } = require('../services/logger.js');
update_array_data.forEach((value,index) => { update_array_data.forEach((value,index) => {
if(value.value != null) if(value.value != null)
{ {
Financials.update( { value: value.value , is_editable : 0 } , { where: { entity_id: value.entityid , itemid: value.itemid , fy:value.year} }) // Replace this with the INR value you want to convert
.then(data => { logMsg.info("update success : "+ data); }) lakhsValue = convertINRtoLakhs(value.value);
.catch(err => { logMsg.info("update failed : " + err); });
Financials.update( { inr_value:value.value,value: lakhsValue , is_editable : 0 } , { where: { entity_id: value.entityid , itemid: value.itemid , fy:value.year} })
.then(data => { logMsg.info("update success : "+ data); })
.catch(err => { logMsg.info("update failed : " + err); });
} }
if (index === update_array_data.length -1) { resolve(); } if (index === update_array_data.length -1) { resolve(); }
}); });
@ -131,7 +134,13 @@ const { logMsg } = require('../services/logger.js');
console.log(error); console.log(error);
} }
} }
function convertINRtoLakhs(inrValue) {
return inrValue / 100000;
}
module.exports = { module.exports = {
lineItemFetching : lineItemFetching , lineItemFetching : lineItemFetching ,

View File

@ -68,4 +68,5 @@ app.listen({ port: PORT_NUMBER }, async () => {
console.log('Server up on http://localhost:'+PORT_NUMBER) console.log('Server up on http://localhost:'+PORT_NUMBER)
//await sequelize.authenticate() //await sequelize.authenticate()
}) })