From 9d9ba8851bafca3eeead3ea1c51860f5c4db68ee Mon Sep 17 00:00:00 2001 From: lowercase-donkey <lowercasedonkey@gmail.com> Date: Sat, 23 Feb 2019 01:58:46 -0500 Subject: [PATCH] strip trunc from cash reporting --- src/js/economyJS.js | 2 +- src/js/utilJS.js | 2 +- src/uncategorized/costsBudget.tw | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/js/economyJS.js b/src/js/economyJS.js index b5d2e911456..0ce77a087cb 100644 --- a/src/js/economyJS.js +++ b/src/js/economyJS.js @@ -515,7 +515,7 @@ window.getEnvironmentCosts = function(cost) { cost *= (1 - State.variables.railway * 0.05); } } - return cost; + return Math.trunc(cost); }; window.getSFCosts = function() { diff --git a/src/js/utilJS.js b/src/js/utilJS.js index 68ea053731c..7c66513e064 100644 --- a/src/js/utilJS.js +++ b/src/js/utilJS.js @@ -486,7 +486,7 @@ window.commaNum = function(s) { window.cashFormat = function(s) { if (!s) { s = 0; } - return "¤" + commaNum(Math.round(s * 100) / 100); + return "¤" + commaNum(s); }; window.repFormat = function(s) { diff --git a/src/uncategorized/costsBudget.tw b/src/uncategorized/costsBudget.tw index 4025a6aaae4..53d199c1e8b 100644 --- a/src/uncategorized/costsBudget.tw +++ b/src/uncategorized/costsBudget.tw @@ -333,11 +333,11 @@ for(var i = 0; i < State.variables.lastWeeksCashIncome.length; i++){ <td></td> <td>/*<<print ($lastWeeksCashExpenses.Total + $costs)>>*/</td> <td><<if (($cash-$cashLastWeek) - $lastWeeksCashProfits.Total) > 0>> - @@.yellowgreen;+<<print cashFormat(Math.trunc(($cash-$cashLastWeek) - $lastWeeksCashProfits.Total))>>@@ - <<elseif Math.trunc((($cash-$cashLastWeek) - $lastWeeksCashProfits.Total)) == 0>> - <<print cashFormat(Math.trunc((($cash-$cashLastWeek) - $lastWeeksCashProfits.Total)))>> + @@.yellowgreen;+<<print cashFormat(($cash-$cashLastWeek) - $lastWeeksCashProfits.Total)>>@@ + <<elseif (($cash-$cashLastWeek) - $lastWeeksCashProfits.Total) == 0>> + <<print cashFormat((($cash-$cashLastWeek) - $lastWeeksCashProfits.Total))>> <<else>> - @@.red;-<<print cashFormat(Math.abs(Math.trunc(($cash-$cashLastWeek) - $lastWeeksCashProfits.Total)))>>@@ + @@.red;-<<print cashFormat(Math.abs(($cash-$cashLastWeek) - $lastWeeksCashProfits.Total))>>@@ <</if>></td> </tr> <</if>> -- GitLab