A lot of improvements
- added cookies to store client settings - missing industry tax calculations - missing page to edit user settings
This commit is contained in:
parent
a65a3d6e6c
commit
c6e8cd3fd1
|
@ -4,11 +4,13 @@ var async = require('async');
|
||||||
var fs = require('fs');
|
var fs = require('fs');
|
||||||
var svurl = "mongodb://localhost:27017/eve-reactor";
|
var svurl = "mongodb://localhost:27017/eve-reactor";
|
||||||
var items = require('./items.json');
|
var items = require('./items.json');
|
||||||
|
var systems = require('./systems.json');
|
||||||
var marketUrl = "https://market.fuzzwork.co.uk/aggregates/?region=60003760&types=";
|
var marketUrl = "https://market.fuzzwork.co.uk/aggregates/?region=60003760&types=";
|
||||||
var testMarketUrl = "https://market.fuzzwork.co.uk/aggregates/?region=60003760&types=34,35,36";
|
var testMarketUrl = "https://market.fuzzwork.co.uk/aggregates/?region=60003760&types=34,35,36";
|
||||||
|
|
||||||
//addDaily();
|
//addDaily();
|
||||||
newUpdateItems();
|
newUpdateItems();
|
||||||
|
updateCostIndex();
|
||||||
|
|
||||||
function getItemID(name) {
|
function getItemID(name) {
|
||||||
for (let i = 0; i < items.length; i++) {
|
for (let i = 0; i < items.length; i++) {
|
||||||
|
@ -34,6 +36,48 @@ function getDate() {
|
||||||
return today;
|
return today;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getSystem(arr, id) {
|
||||||
|
for (let i = 0; i < arr.length; i++) {
|
||||||
|
if (arr[i].solar_system_id === id) {
|
||||||
|
return arr[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function updateCostIndex() {
|
||||||
|
let esiurl = "https://esi.tech.ccp.is/latest/industry/systems/?datasource=tranquility";
|
||||||
|
request(esiurl, function(err, res, body) {
|
||||||
|
let esi = JSON.parse(body);
|
||||||
|
let sys = [];
|
||||||
|
for (let i = 0; i < systems.length; i++) {
|
||||||
|
let temp = {
|
||||||
|
"updateOne": {
|
||||||
|
"filter": {
|
||||||
|
"_id": parseInt(systems[i].solarSystemID)
|
||||||
|
},
|
||||||
|
"update": {
|
||||||
|
"_id": systems[i].solarSystemID,
|
||||||
|
"name": systems[i].solarSystemName,
|
||||||
|
"index": getSystem(esi, systems[i].solarSystemID).cost_indices[5].cost_index
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sys.push(temp);
|
||||||
|
}
|
||||||
|
mongo.connect(svurl, function(err, db) {
|
||||||
|
if (err) {
|
||||||
|
console.log(err);
|
||||||
|
} else {
|
||||||
|
db.collection('systems').bulkWrite(sys, { "ordered": true, "w": 1 }, function(err, result) {
|
||||||
|
if (err) throw err;
|
||||||
|
console.log(result.modifiedCount);
|
||||||
|
console.log("success!!");
|
||||||
|
db.close();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function split50() {
|
function split50() {
|
||||||
let arr = [];
|
let arr = [];
|
||||||
|
@ -99,8 +143,8 @@ function updateDB(itms) {
|
||||||
if (err) throw err;
|
if (err) throw err;
|
||||||
console.log(result.modifiedCount);
|
console.log(result.modifiedCount);
|
||||||
console.log("success!!");
|
console.log("success!!");
|
||||||
|
db.close();
|
||||||
});
|
});
|
||||||
db.close();
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -140,8 +184,8 @@ function addDaily() { //need to re-write this
|
||||||
} else {
|
} else {
|
||||||
db.collection('history').insert(insert, function(err, result) {
|
db.collection('history').insert(insert, function(err, result) {
|
||||||
console.log("success!!");
|
console.log("success!!");
|
||||||
|
db.close();
|
||||||
});
|
});
|
||||||
db.close();
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
45
package.json
45
package.json
|
@ -1,23 +1,24 @@
|
||||||
{
|
{
|
||||||
"name": "eve-reactions-calculator",
|
"name": "eve-reactions-calculator",
|
||||||
"version": "0.0.0",
|
"version": "0.0.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "node ./bin/www"
|
"start": "node ./bin/www"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"async": "^2.6.0",
|
"async": "^2.6.0",
|
||||||
"body-parser": "~1.17.1",
|
"body-parser": "~1.17.1",
|
||||||
"cluster": "^0.7.7",
|
"cluster": "^0.7.7",
|
||||||
"cookie-parser": "~1.4.3",
|
"cookie-parser": "^1.4.3",
|
||||||
"debug": "~2.6.3",
|
"debug": "~2.6.3",
|
||||||
"express": "~4.15.2",
|
"express": "~4.15.2",
|
||||||
"hbs": "~4.0.1",
|
"hbs": "~4.0.1",
|
||||||
"mongodb": "^2.2.33",
|
"mongodb": "^2.2.33",
|
||||||
"mongoose": "^4.13.0",
|
"mongoose": "^4.13.0",
|
||||||
"morgan": "~1.8.1",
|
"morgan": "~1.8.1",
|
||||||
"numeral": "^2.0.6",
|
"numeral": "^2.0.6",
|
||||||
"request": "^2.83.0",
|
"request": "^2.83.0",
|
||||||
"serve-favicon": "~2.4.2"
|
"serve-favicon": "~2.4.2",
|
||||||
}
|
"xml-js": "^1.5.2"
|
||||||
}
|
}
|
||||||
|
}
|
214
routes/comp.js
214
routes/comp.js
|
@ -3,24 +3,18 @@ var mongo = require('mongodb');
|
||||||
var request = require('request');
|
var request = require('request');
|
||||||
var async = require('async');
|
var async = require('async');
|
||||||
var numeral = require('numeral');
|
var numeral = require('numeral');
|
||||||
|
var cookieParser = require('cookie-parser');
|
||||||
|
var xmljs = require('xml-js');
|
||||||
var router = express.Router();
|
var router = express.Router();
|
||||||
|
|
||||||
var svurl = "mongodb://localhost:27017/eve-reactor";
|
var svurl = "mongodb://localhost:27017/eve-reactor";
|
||||||
|
|
||||||
function getCostIndex(id) {
|
function getCostIndex(sys, name) {
|
||||||
var esiIndyUrl = "https://esi.tech.ccp.is/latest/industry/systems/?datasource=tranquility"
|
for (let i = 0; i < sys.length; i++) {
|
||||||
request(esiIndyUrl, function(err, res, body) {
|
if (sys[i].name.toUpperCase() === name.toUpperCase()) {
|
||||||
let data = JSON.parse(body);
|
return sys[i].index;
|
||||||
for (let i = 0; i < data.length; i++) {
|
|
||||||
if (data[i].solar_system_id === id) {
|
|
||||||
for (var ii = 0; ii < 6; ii++) {
|
|
||||||
if (data[i].cost_indices[ii].activity === "reaction") {
|
|
||||||
return data[i].cost_indices[ii].cost_index;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getItem(data, id) {
|
function getItem(data, id) {
|
||||||
|
@ -31,21 +25,51 @@ function getItem(data, id) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getSimplePrice(data, id) {
|
||||||
|
var tempsell = 0;
|
||||||
|
var tempbuy = 0;
|
||||||
|
for (let i = 0; i < data.length; i++) {
|
||||||
|
if (data[i].id === id) {
|
||||||
|
for (let ii = 0; ii < data[i].inputs.length; ii++) {
|
||||||
|
tempsell += data[i].inputs[ii].sell;
|
||||||
|
tempbuy += data[i].inputs[ii].buy;
|
||||||
|
}
|
||||||
|
let exp = {
|
||||||
|
"sell": tempsell,
|
||||||
|
"buy": tempbuy
|
||||||
|
}
|
||||||
|
return exp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* GET comp page. */
|
/* GET comp page. */
|
||||||
router.get('/', function(req, res, next) {
|
router.get('/', function(req, res, next) {
|
||||||
//querry opts
|
//querry opts
|
||||||
let opt = req.query;
|
let opt = req.query;
|
||||||
console.log("opt:", opt);
|
if (opt.input) { var imeth = opt.input; }
|
||||||
if (opt.i) { var imeth = opt.i; }
|
if (opt.output) { var ometh = opt.output; }
|
||||||
if (opt.o) { var ometh = opt.o; }
|
if (opt.skill) { var skill = parseInt(opt.skill); }
|
||||||
if (opt.s) { var skill = parseInt(opt.s); }
|
if (opt.facility) { var facility = opt.facility; }
|
||||||
if (opt.f) { var facility = opt.f; }
|
if (opt.rig) { var rig = parseInt(opt.rig); var rige = true; }
|
||||||
if (opt.r) { var rig = parseInt(opt.r); var rige = true; }
|
|
||||||
if (opt.space) { var space = opt.space; }
|
if (opt.space) { var space = opt.space; }
|
||||||
|
if (opt.indyTax) { var indyTax = opt.indyTax; }
|
||||||
|
if (opt.system) { var syst = opt.system; }
|
||||||
var matb = 1;
|
var matb = 1;
|
||||||
var time = 180;
|
var time = 180;
|
||||||
var bonus = {};
|
var bonus = {};
|
||||||
|
|
||||||
|
//set cookies if not found
|
||||||
|
console.log(req.cookies);
|
||||||
|
if (!req.cookies.input) { res.cookie('input', 'buy'); }
|
||||||
|
if (!req.cookies.output) { res.cookie('output', 'sell'); }
|
||||||
|
if (!req.cookies.skill) { res.cookie('skill', 5); }
|
||||||
|
if (!req.cookies.facility) { res.cookie('facility', 'large'); }
|
||||||
|
if (!req.cookies.rig) { res.cookie('rig', 1); }
|
||||||
|
if (!req.cookies.space) { res.cookie('space', 'null'); }
|
||||||
|
if (!req.cookies.indyTax) { res.cookie('indyTax', 0); }
|
||||||
|
if (!req.cookies.system) { res.cookie('system', 'Jita'); }
|
||||||
|
|
||||||
//calc bonus with opts
|
//calc bonus with opts
|
||||||
//default is Skill (Reactions) 5, Large facility & T1 rig in NullSec
|
//default is Skill (Reactions) 5, Large facility & T1 rig in NullSec
|
||||||
if (skill && facility && rige && space) { // S F R SPACE
|
if (skill && facility && rige && space) { // S F R SPACE
|
||||||
|
@ -370,13 +394,12 @@ router.get('/', function(req, res, next) {
|
||||||
"time": time
|
"time": time
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//var cycles = Math.floor(43200 / bonus.time);
|
var cycles = Math.floor(43200 / bonus.time);
|
||||||
var cycles = 1;
|
//var cycles = 1;
|
||||||
|
|
||||||
//vars
|
//vars
|
||||||
let lvid = 30000891;
|
let lvid = 30000891;
|
||||||
let costIndex = getCostIndex(lvid);
|
let querry = ['items', 'bps', 'systems'];
|
||||||
let querry = ['items', 'bps'];
|
|
||||||
|
|
||||||
async.map(querry, function(coll, callback) {
|
async.map(querry, function(coll, callback) {
|
||||||
mongo.connect(svurl, function(err, db) {
|
mongo.connect(svurl, function(err, db) {
|
||||||
|
@ -392,34 +415,102 @@ router.get('/', function(req, res, next) {
|
||||||
}, function(err, results) {
|
}, function(err, results) {
|
||||||
let itemData = results[0];
|
let itemData = results[0];
|
||||||
let bpsData = results[1];
|
let bpsData = results[1];
|
||||||
|
let systems = results[2];
|
||||||
|
//get cost index
|
||||||
|
var costIndex = getCostIndex(systems, 'l-vxtk');
|
||||||
let calc = [];
|
let calc = [];
|
||||||
let reac = bpsData[0].reaction;
|
let reac = bpsData[0].reaction;
|
||||||
//START build new BP array with prices
|
//START build new BP array with prices
|
||||||
for (let i = 0; i < reac.length; i++) {
|
for (let i = 0; i < reac.length; i++) {
|
||||||
let tempin = [];
|
let tempin = [];
|
||||||
for (let inp = 0; inp < reac[i].inputs.length; inp++) {
|
let tempout = {};
|
||||||
let tmpPrc = {
|
let ttmp = {};
|
||||||
"id": reac[i].inputs[inp].id,
|
let tmpPrc = {};
|
||||||
"buy": getItem(itemData, reac[i].inputs[inp].id).buy * reac[i].inputs[inp].qt * cycles,
|
if (reac[i].type === "simple") {
|
||||||
"sell": getItem(itemData, reac[i].inputs[inp].id).sell * reac[i].inputs[inp].qt * cycles
|
for (let inp = 0; inp < reac[i].inputs.length; inp++) {
|
||||||
|
tmpPrc = {
|
||||||
|
"id": reac[i].inputs[inp].id,
|
||||||
|
"buy": getItem(itemData, reac[i].inputs[inp].id).buy * reac[i].inputs[inp].qt * cycles,
|
||||||
|
"sell": getItem(itemData, reac[i].inputs[inp].id).sell * reac[i].inputs[inp].qt * cycles
|
||||||
|
}
|
||||||
|
tempin.push(tmpPrc);
|
||||||
}
|
}
|
||||||
tempin.push(tmpPrc);
|
tempout = {
|
||||||
|
"id": reac[i].output.id,
|
||||||
|
"sell": getItem(itemData, reac[i].output.id).sell * reac[i].output.qt * cycles,
|
||||||
|
"buy": getItem(itemData, reac[i].output.id).buy * reac[i].output.qt * cycles
|
||||||
|
}
|
||||||
|
ttmp = {
|
||||||
|
"id": reac[i].id,
|
||||||
|
"name": reac[i].name,
|
||||||
|
"chain": "No",
|
||||||
|
"inputs": tempin,
|
||||||
|
"output": tempout
|
||||||
|
}
|
||||||
|
calc.push(ttmp);
|
||||||
|
} else if (reac[i].type === "complex") {
|
||||||
|
//calc as simple
|
||||||
|
tempin = [];
|
||||||
|
tempout = {};
|
||||||
|
tmpPrc = {};
|
||||||
|
for (let inp = 0; inp < reac[i].inputs.length; inp++) {
|
||||||
|
tmpPrc = {
|
||||||
|
"id": reac[i].inputs[inp].id,
|
||||||
|
"buy": getItem(itemData, reac[i].inputs[inp].id).buy * reac[i].inputs[inp].qt * cycles,
|
||||||
|
"sell": getItem(itemData, reac[i].inputs[inp].id).sell * reac[i].inputs[inp].qt * cycles
|
||||||
|
}
|
||||||
|
tempin.push(tmpPrc);
|
||||||
|
}
|
||||||
|
tempout = {
|
||||||
|
"id": reac[i].output.id,
|
||||||
|
"sell": getItem(itemData, reac[i].output.id).sell * reac[i].output.qt * cycles,
|
||||||
|
"buy": getItem(itemData, reac[i].output.id).buy * reac[i].output.qt * cycles
|
||||||
|
}
|
||||||
|
ttmp = {
|
||||||
|
"id": reac[i].id,
|
||||||
|
"name": reac[i].name,
|
||||||
|
"chain": "No",
|
||||||
|
"inputs": tempin,
|
||||||
|
"output": tempout
|
||||||
|
}
|
||||||
|
calc.push(ttmp);
|
||||||
|
//calc as chain
|
||||||
|
tempin = [];
|
||||||
|
tmpPrc = {};
|
||||||
|
tempout = {};
|
||||||
|
for (let inp = 0; inp < reac[i].inputs.length; inp++) {
|
||||||
|
if (inp === reac[i].inputs.length - 1) { //look for fuel block
|
||||||
|
tmpPrc = {
|
||||||
|
"id": reac[i].inputs[inp].id,
|
||||||
|
"buy": getItem(itemData, reac[i].inputs[inp].id).buy * reac[i].inputs[inp].qt * cycles,
|
||||||
|
"sell": getItem(itemData, reac[i].inputs[inp].id).sell * reac[i].inputs[inp].qt * cycles
|
||||||
|
}
|
||||||
|
} else { //look for input from other reactions
|
||||||
|
tmpPrc = {
|
||||||
|
"id": reac[i].inputs[inp].id,
|
||||||
|
"buy": getSimplePrice(calc, reac[i].inputs[inp].id).buy / 2,
|
||||||
|
"sell": getSimplePrice(calc, reac[i].inputs[inp].id).sell / 2
|
||||||
|
}
|
||||||
|
}
|
||||||
|
tempin.push(tmpPrc);
|
||||||
|
}
|
||||||
|
tempout = {
|
||||||
|
"id": reac[i].output.id,
|
||||||
|
"sell": getItem(itemData, reac[i].output.id).sell * reac[i].output.qt * cycles,
|
||||||
|
"buy": getItem(itemData, reac[i].output.id).buy * reac[i].output.qt * cycles
|
||||||
|
}
|
||||||
|
ttmp = {
|
||||||
|
"id": reac[i].id,
|
||||||
|
"name": reac[i].name,
|
||||||
|
"chain": "yes",
|
||||||
|
"inputs": tempin,
|
||||||
|
"output": tempout
|
||||||
|
}
|
||||||
|
calc.push(ttmp);
|
||||||
}
|
}
|
||||||
let tempout = {
|
|
||||||
"id": reac[i].output.id,
|
|
||||||
"sell": getItem(itemData, reac[i].output.id).sell * reac[i].output.qt * cycles,
|
|
||||||
"buy": getItem(itemData, reac[i].output.id).buy * reac[i].output.qt * cycles
|
|
||||||
}
|
|
||||||
let ttmp = {
|
|
||||||
"id": reac[i].id,
|
|
||||||
"name": reac[i].name,
|
|
||||||
"chain": "No",
|
|
||||||
"inputs": tempin,
|
|
||||||
"output": tempout
|
|
||||||
}
|
|
||||||
calc.push(ttmp);
|
|
||||||
}
|
}
|
||||||
|
//console.log(calc);
|
||||||
//END build new BP array with prices
|
//END build new BP array with prices
|
||||||
//START build array with total input cost, output cost & profits
|
//START build array with total input cost, output cost & profits
|
||||||
let prof = [];
|
let prof = [];
|
||||||
|
@ -429,6 +520,7 @@ router.get('/', function(req, res, next) {
|
||||||
let rout = calc[i].output;
|
let rout = calc[i].output;
|
||||||
let tisell = 0;
|
let tisell = 0;
|
||||||
let tibuy = 0;
|
let tibuy = 0;
|
||||||
|
var indexTax = rout.sell * costIndex;
|
||||||
for (let ii = 0; ii < rin.length; ii++) {
|
for (let ii = 0; ii < rin.length; ii++) {
|
||||||
tisell += rin[ii].sell;
|
tisell += rin[ii].sell;
|
||||||
tibuy += rin[ii].buy;
|
tibuy += rin[ii].buy;
|
||||||
|
@ -439,9 +531,10 @@ router.get('/', function(req, res, next) {
|
||||||
"name": calc[i].name,
|
"name": calc[i].name,
|
||||||
"chain": calc[i].chain,
|
"chain": calc[i].chain,
|
||||||
"i": numeral(tibuy * bonus.mat).format('0,0.00'),
|
"i": numeral(tibuy * bonus.mat).format('0,0.00'),
|
||||||
|
"tax": numeral(indexTax).format('0,0.00'),
|
||||||
"o": numeral(rout.sell).format('0,0.00'),
|
"o": numeral(rout.sell).format('0,0.00'),
|
||||||
"prof": numeral(rout.sell - tibuy * bonus.mat).format('0,0.00'),
|
"prof": numeral((rout.sell - tibuy * bonus.mat) + indexTax).format('0,0.00'),
|
||||||
"per": numeral(((rout.sell - tibuy * bonus.mat) / rout.sell)).format('0.00%')
|
"per": numeral((((rout.sell - tibuy * bonus.mat) + indexTax) / rout.sell)).format('0.00%')
|
||||||
}
|
}
|
||||||
if (((rout.sell - tibuy * bonus.mat) / rout.sell) > 0) {
|
if (((rout.sell - tibuy * bonus.mat) / rout.sell) > 0) {
|
||||||
temp.pos = true;
|
temp.pos = true;
|
||||||
|
@ -454,9 +547,10 @@ router.get('/', function(req, res, next) {
|
||||||
"name": calc[i].name,
|
"name": calc[i].name,
|
||||||
"chain": calc[i].chain,
|
"chain": calc[i].chain,
|
||||||
"i": numeral(tibuy * bonus.mat).format('0,0.00'),
|
"i": numeral(tibuy * bonus.mat).format('0,0.00'),
|
||||||
|
"tax": numeral(indexTax).format('0,0.00'),
|
||||||
"o": numeral(rout.buy).format('0,0.00'),
|
"o": numeral(rout.buy).format('0,0.00'),
|
||||||
"prof": numeral(rout.buy - tibuy * bonus.mat).format('0,0.00'),
|
"prof": numeral((rout.buy - tibuy * bonus.mat) + indexTax).format('0,0.00'),
|
||||||
"per": numeral(((rout.buy - tibuy * bonus.mat) / rout.buy)).format('0.00%')
|
"per": numeral((((rout.buy - tibuy * bonus.mat) + indexTax) / rout.buy)).format('0.00%')
|
||||||
}
|
}
|
||||||
if (((rout.buy - tibuy * bonus.mat) / rout.buy) > 0) {
|
if (((rout.buy - tibuy * bonus.mat) / rout.buy) > 0) {
|
||||||
temp.pos = true;
|
temp.pos = true;
|
||||||
|
@ -469,9 +563,10 @@ router.get('/', function(req, res, next) {
|
||||||
"name": calc[i].name,
|
"name": calc[i].name,
|
||||||
"chain": calc[i].chain,
|
"chain": calc[i].chain,
|
||||||
"i": numeral(tisell * bonus.mat).format('0,0.00'),
|
"i": numeral(tisell * bonus.mat).format('0,0.00'),
|
||||||
|
"tax": numeral(indexTax).format('0,0.00'),
|
||||||
"o": numeral(rout.sell).format('0,0.00'),
|
"o": numeral(rout.sell).format('0,0.00'),
|
||||||
"prof": numeral(rout.sell - tisell * bonus.mat).format('0,0.00'),
|
"prof": numeral((rout.sell - tisell * bonus.mat) + indexTax).format('0,0.00'),
|
||||||
"per": numeral(((rout.sell - tisell * bonus.mat) / rout.sell)).format('0.00%')
|
"per": numeral((((rout.sell - tisell * bonus.mat) + indexTax) / rout.sell)).format('0.00%')
|
||||||
}
|
}
|
||||||
if (((rout.sell - tisell * bonus.mat) / rout.sell) > 0) {
|
if (((rout.sell - tisell * bonus.mat) / rout.sell) > 0) {
|
||||||
temp.pos = true;
|
temp.pos = true;
|
||||||
|
@ -484,9 +579,10 @@ router.get('/', function(req, res, next) {
|
||||||
"name": calc[i].name,
|
"name": calc[i].name,
|
||||||
"chain": calc[i].chain,
|
"chain": calc[i].chain,
|
||||||
"i": numeral(tisell * bonus.mat).format('0,0.00'),
|
"i": numeral(tisell * bonus.mat).format('0,0.00'),
|
||||||
|
"tax": numeral(indexTax).format('0,0.00'),
|
||||||
"o": numeral(rout.buy).format('0,0.00'),
|
"o": numeral(rout.buy).format('0,0.00'),
|
||||||
"prof": numeral(rout.buy - tisell * bonus.mat).format('0,0.00'),
|
"prof": numeral((rout.buy - tisell * bonus.mat) + indexTax).format('0,0.00'),
|
||||||
"per": numeral(((rout.buy - tisell * bonus.mat) / rout.buy)).format('0.00%')
|
"per": numeral((((rout.buy - tisell * bonus.mat) + indexTax) / rout.buy)).format('0.00%')
|
||||||
}
|
}
|
||||||
if (((rout.buy - tisell * bonus.mat) / rout.buy) > 0) {
|
if (((rout.buy - tisell * bonus.mat) / rout.buy) > 0) {
|
||||||
temp.pos = true;
|
temp.pos = true;
|
||||||
|
@ -499,9 +595,10 @@ router.get('/', function(req, res, next) {
|
||||||
"name": calc[i].name,
|
"name": calc[i].name,
|
||||||
"chain": calc[i].chain,
|
"chain": calc[i].chain,
|
||||||
"i": numeral(tibuy * bonus.mat).format('0,0.00'),
|
"i": numeral(tibuy * bonus.mat).format('0,0.00'),
|
||||||
|
"tax": numeral(indexTax).format('0,0.00'),
|
||||||
"o": numeral(rout.buy).format('0,0.00'),
|
"o": numeral(rout.buy).format('0,0.00'),
|
||||||
"prof": numeral(rout.buy - tibuy * bonus.mat).format('0,0.00'),
|
"prof": numeral((rout.buy - tibuy * bonus.mat) + indexTax).format('0,0.00'),
|
||||||
"per": numeral(((rout.buy - tibuy * bonus.mat) / rout.buy)).format('0.00%')
|
"per": numeral((((rout.buy - tibuy * bonus.mat) + indexTax) / rout.buy)).format('0.00%')
|
||||||
}
|
}
|
||||||
if (((rout.buy - tibuy * bonus.mat) / rout.buy) > 0) {
|
if (((rout.buy - tibuy * bonus.mat) / rout.buy) > 0) {
|
||||||
temp.pos = true;
|
temp.pos = true;
|
||||||
|
@ -514,9 +611,10 @@ router.get('/', function(req, res, next) {
|
||||||
"name": calc[i].name,
|
"name": calc[i].name,
|
||||||
"chain": calc[i].chain,
|
"chain": calc[i].chain,
|
||||||
"i": numeral(tisell * bonus.mat).format('0,0.00'),
|
"i": numeral(tisell * bonus.mat).format('0,0.00'),
|
||||||
|
"tax": numeral(indexTax).format('0,0.00'),
|
||||||
"o": numeral(rout.sell).format('0,0.00'),
|
"o": numeral(rout.sell).format('0,0.00'),
|
||||||
"prof": numeral(rout.sell - tisell * bonus.mat).format('0,0.00'),
|
"prof": numeral((rout.sell - tisell * bonus.mat) + indexTax).format('0,0.00'),
|
||||||
"per": numeral(((rout.sell - tisell * bonus.mat) / rout.sell)).format('0.00%')
|
"per": numeral((((rout.sell - tisell * bonus.mat) + indexTax) / rout.sell)).format('0.00%')
|
||||||
}
|
}
|
||||||
if (((rout.sell - tisell * bonus.mat) / rout.sell) > 0) {
|
if (((rout.sell - tisell * bonus.mat) / rout.sell) > 0) {
|
||||||
temp.pos = true;
|
temp.pos = true;
|
||||||
|
@ -529,9 +627,10 @@ router.get('/', function(req, res, next) {
|
||||||
"name": calc[i].name,
|
"name": calc[i].name,
|
||||||
"chain": calc[i].chain,
|
"chain": calc[i].chain,
|
||||||
"i": numeral(tibuy * bonus.mat).format('0,0.00'),
|
"i": numeral(tibuy * bonus.mat).format('0,0.00'),
|
||||||
|
"tax": numeral(indexTax).format('0,0.00'),
|
||||||
"o": numeral(rout.sell).format('0,0.00'),
|
"o": numeral(rout.sell).format('0,0.00'),
|
||||||
"prof": numeral(rout.sell - tibuy * bonus.mat).format('0,0.00'),
|
"prof": numeral((rout.sell - tibuy * bonus.mat) + indexTax).format('0,0.00'),
|
||||||
"per": numeral(((rout.sell - tibuy * bonus.mat) / rout.sell)).format('0.00%')
|
"per": numeral((((rout.sell - tibuy * bonus.mat) + indexTax) / rout.sell)).format('0.00%')
|
||||||
}
|
}
|
||||||
if (((rout.sell - tibuy * bonus.mat) / rout.sell) > 0) {
|
if (((rout.sell - tibuy * bonus.mat) / rout.sell) > 0) {
|
||||||
temp.pos = true;
|
temp.pos = true;
|
||||||
|
@ -542,7 +641,6 @@ router.get('/', function(req, res, next) {
|
||||||
prof.push(temp);
|
prof.push(temp);
|
||||||
}
|
}
|
||||||
//END build array with total input cost, output cost & profits
|
//END build array with total input cost, output cost & profits
|
||||||
|
|
||||||
res.render('comp', { title: 'Composite Reactions', comp: true, table: prof });
|
res.render('comp', { title: 'Composite Reactions', comp: true, table: prof });
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,15 +1,11 @@
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="row mt-5">
|
<div class="row mt-5">
|
||||||
<div class="btn-group">
|
|
||||||
<button class="btn btn-secondary btn-sm dropdown-toggle" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
|
||||||
Skill 5
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
<table class="table">
|
<table class="table">
|
||||||
<thead>
|
<thead>
|
||||||
<th scope="col">Reaction</th>
|
<th scope="col">Reaction</th>
|
||||||
<th scope="col">Chain ?</th>
|
<th scope="col">Chain ?</th>
|
||||||
<th scope="col">Inputs</th>
|
<th scope="col">Inputs</th>
|
||||||
|
<th scope="col">Tax</th>
|
||||||
<th scope="col">Output</th>
|
<th scope="col">Output</th>
|
||||||
<th scope="col">Profit</th>
|
<th scope="col">Profit</th>
|
||||||
<th scope="col">% prof</th>
|
<th scope="col">% prof</th>
|
||||||
|
@ -20,6 +16,7 @@
|
||||||
<td>{{name}}</td>
|
<td>{{name}}</td>
|
||||||
<td>{{chain}}</td>
|
<td>{{chain}}</td>
|
||||||
<td>{{i}}</td>
|
<td>{{i}}</td>
|
||||||
|
<td>{{tax}}</td>
|
||||||
<td>{{o}}</td>
|
<td>{{o}}</td>
|
||||||
<td>{{prof}}</td>
|
<td>{{prof}}</td>
|
||||||
<td>{{per}}</td>
|
<td>{{per}}</td>
|
||||||
|
|
Loading…
Reference in New Issue