From ce8c9d64eb580ebb534c73030dae5b362f9f9b5d Mon Sep 17 00:00:00 2001
From: lowercase-donkey <lowercasedonkey@gmail.com>
Date: Mon, 14 Jan 2019 17:28:20 -0500
Subject: [PATCH] First Stage of the budget screen, should have most of the
 good stuff

---
 devNotes/twine JS.txt                        |   70 ++
 src/init/storyInit.tw                        |    2 +
 src/js/datatypeCleanupJS.tw                  |    7 +
 src/js/economyJS.tw                          |  499 ++++++--
 src/pregmod/personalNotes.tw                 |    3 +-
 src/uncategorized/arcadeReport.tw            |   10 +-
 src/uncategorized/arcmgmt.tw                 |   52 +-
 src/uncategorized/brothelReport.tw           |   49 +-
 src/uncategorized/cellblockReport.tw         |    3 +-
 src/uncategorized/clinicReport.tw            |    3 +-
 src/uncategorized/clubReport.tw              |   18 +-
 src/uncategorized/corporationDevelopments.tw |   16 +-
 src/uncategorized/costsBudget.tw             | 1062 ++++++++++++++++++
 src/uncategorized/costsReport.tw             |   14 +
 src/uncategorized/costsWidgets.tw            |  551 +++++++++
 src/uncategorized/dairyReport.tw             |   49 +-
 src/uncategorized/endWeek.tw                 |    3 +
 src/uncategorized/labReport.tw               |    3 +-
 src/uncategorized/main.tw                    |    2 +-
 src/uncategorized/saGetMilked.tw             |    8 +-
 src/uncategorized/saLongTermEffects.tw       |    7 +-
 src/uncategorized/saServeThePublic.tw        |    2 +-
 src/uncategorized/saWhore.tw                 |    6 +-
 src/uncategorized/saWorkAGloryHole.tw        |    2 +-
 src/uncategorized/saWorkTheFarm.tw           |    8 +-
 src/uncategorized/sellSlave.tw               |  242 ++--
 src/uncategorized/servantsQuartersReport.tw  |    2 +-
 src/uncategorized/slaveInteract.tw           |    3 +
 src/uncategorized/spaReport.tw               |    2 +-
 src/uncategorized/storyCaption.tw            |    2 +-
 30 files changed, 2423 insertions(+), 277 deletions(-)
 create mode 100644 src/uncategorized/costsBudget.tw
 create mode 100644 src/uncategorized/costsWidgets.tw

diff --git a/devNotes/twine JS.txt b/devNotes/twine JS.txt
index 3943d54ffa8..d3f6679d3ab 100644
--- a/devNotes/twine JS.txt	
+++ b/devNotes/twine JS.txt	
@@ -2925,6 +2925,69 @@ window.initFacilityStatistics = function(facility) {
 	return facility;
 };
 
+window.cashX = function(cost, what, who) {
+	const V = State.variables;
+
+	if(isNaN(cost)){
+		V.lastWeeksErrors += (' NaN: \"' + cost + '\"" at ' + what + ',');
+	} else {
+		
+		//INCOME
+		if(cost > 0) {
+				if (typeof V.lastWeeksCashIncome[what] !== 'undefined') {
+					
+					//record the action
+					V.lastWeeksCashIncome[what] += cost;
+
+					//record the slave, if available
+					if (who !== undefined){
+						if(what == "slaveTransfer"){
+							who.slaveCost = cost;
+						} else {
+							who.lastWeeksCashIncome += cost;
+							who.lifetimeCashIncome += cost;
+						}
+					}
+
+					//Spend the money
+					V.cash += cost;
+				} else {
+					V.lastWeeksErrors += (' unknown place \"' + what +'\",');
+				}
+		}
+		
+		//EXPENSES
+		else if(cost < 0) {
+				if (typeof V.lastWeeksCashExpenses[what] !== 'undefined') {
+					
+					//record the action
+					V.lastWeeksCashExpenses[what] += cost;
+					
+					//record the slave, if available
+					if (who !== undefined){
+						who.lifetimeCashExpenses += cost;
+					}
+
+					//Spend the money
+					V.cash += cost;
+				} else {
+					V.lastWeeksErrors += (' unknown place \"' + what +'\",');
+				}
+		}
+		else {
+			//somebody probably tried to pass a 0, ignore it.
+		}
+		return cost;
+	}
+};
+
+window.forceNeg = function(x) {
+	if (x > 0){
+		x = Math.abs(x) * -1;
+	}
+	return x;
+};
+
 Number.prototype.toFixedHTML = function() {
 	return commaNum(Number.prototype.toFixed.apply(this, arguments)).replace(/\.0+$/, '<span style="opacity: 0.3">$&</span>');
 };
@@ -37782,6 +37845,13 @@ window.slaveMiscellaneousDatatypeCleanup = function slaveMiscellaneousDatatypeCl
 	if (typeof slave.death !== "string") {
 		slave.death = "";
 	}
+	slave.slaveCost = Math.max(+slave.slaveCost, -1) || -1;
+	slave.lifetimeCashExpenses = Math.max(+slave.lifetimeCashExpenses, 0) || 0;
+	slave.lifetimeCashIncome = Math.max(+slave.lifetimeCashIncome, 0) || 0;
+	slave.lastWeeksCashIncome = Math.max(+slave.lifetimeCashIncome, 0) || 0;
+	slave.lifetimeRepExpenses = Math.max(+slave.lifetimeCashExpenses, 0) || 0;
+	slave.lifetimeRepIncome = Math.max(+slave.lifetimeCashIncome, 0) || 0;
+	slave.lastWeeksRepIncome = Math.max(+slave.lifetimeCashIncome, 0) || 0;
 };
 
 /* a lot of this may need to be removed */
diff --git a/src/init/storyInit.tw b/src/init/storyInit.tw
index 5508ff1f8d7..5599d00a6ac 100644
--- a/src/init/storyInit.tw
+++ b/src/init/storyInit.tw
@@ -797,6 +797,8 @@ DairyRestraintsSetting($dairyRestraintsSetting)
 <<set $shelterAbuse = 0>>
 <<set $shelterSlaveGeneratedWeek = 0>>
 
+<<setupLastWeeksCash>>
+
 /* alternate clothing access variables */
 <<set $clothesBoughtBunny = 0>>
 <<set $clothesBoughtConservative = 0>>
diff --git a/src/js/datatypeCleanupJS.tw b/src/js/datatypeCleanupJS.tw
index ae100e2d21e..91b64fdf60d 100644
--- a/src/js/datatypeCleanupJS.tw
+++ b/src/js/datatypeCleanupJS.tw
@@ -597,6 +597,13 @@ window.slaveMiscellaneousDatatypeCleanup = function slaveMiscellaneousDatatypeCl
 	if (typeof slave.death !== "string") {
 		slave.death = "";
 	}
+	slave.slaveCost = Math.max(+slave.slaveCost, -1) || -1;
+	slave.lifetimeCashExpenses = Math.max(+slave.lifetimeCashExpenses, 0) || 0;
+	slave.lifetimeCashIncome = Math.max(+slave.lifetimeCashIncome, 0) || 0;
+	slave.lastWeeksCashIncome = Math.max(+slave.lifetimeCashIncome, 0) || 0;
+	slave.lifetimeRepExpenses = Math.max(+slave.lifetimeCashExpenses, 0) || 0;
+	slave.lifetimeRepIncome = Math.max(+slave.lifetimeCashIncome, 0) || 0;
+	slave.lastWeeksRepIncome = Math.max(+slave.lifetimeCashIncome, 0) || 0;
 };
 
 /* a lot of this may need to be removed */
diff --git a/src/js/economyJS.tw b/src/js/economyJS.tw
index 05a00db7caf..dcbf43ea432 100644
--- a/src/js/economyJS.tw
+++ b/src/js/economyJS.tw
@@ -11,67 +11,220 @@ window.Job = Object.freeze({
 	});
 window.PersonalAttention = Object.freeze({TRADE: 'trading', WAR: 'warfare', SLAVING: 'slaving', ENGINEERING: 'engineering', MEDICINE: 'medicine', MAID: 'upkeep', HACKING: 'hacking'});
 
+window.predictCost = function(array) {
+	var array2 = array;
+	var totalCosts = ( 
+	getBrothelCosts() +
+	getArcadeCosts()  +
+	getClubCosts() +
+	getDairyCosts() +
+	getIncubatorCosts() +
+	getServantsQuartersCosts() +
+	getMasterSuiteCosts() +
+	getNurseyCosts() +
+	getFarmyardCosts() +
+	getSecurityExpansionCost() +
+	getLifestyleCosts() +
+	getFSCosts() +
+	getCitizenOrphanageCosts() +
+	getPrivateOrphanageCosts() +
+	getPeacekeeperCosts() +
+	getMercenariesCosts() +
+	getMenialRetirementCosts() +
+	getRecruiterCosts() +
+	getSchoolCosts() +
+	getPolicyCosts() +
+	getCyberModCosts() +
+	getPCTrainingCosts() +
+	getPCCosts() +
+	predictTotalSlaveCosts(array2)
+	);
+
+	 //these two apply a multiplicative effect to all costs so far.
+	totalCosts = getEnvironmentCosts(totalCosts);
+	totalCosts = getPCMultiplierCosts(totalCosts);
+	
+	//in the old order these were applied after multiplication.  Not sure if deliberate, but I'm leaving it for now.
+	totalCosts += (
+	getSFCosts() + 
+	getWeatherCosts()
+	);
+/*
+	// clean up
+	if(totalCosts > 0) {
+		totalCosts = 0;
+	} else {
+		totalCosts = Math.ceil(totalCosts);
+	}
+*/
+	return totalCosts;
+}
+
 window.getCost = function(array) {
-	var rulesCost = State.variables.rulesCost;
-	var foodCost = State.variables.foodCost;
-	var drugsCost = State.variables.drugsCost;
+	var array2 = array;
+	var oldCash = State.variables.cash;
+	var fee = 0;
+	var costSoFar = 0;
+	cashX(forceNeg(getBrothelCosts()), "brothel");
+	cashX(forceNeg(getArcadeCosts()), "arcade");
+	cashX(forceNeg(getClubCosts()), "club");
+	cashX(forceNeg(getDairyCosts()), "dairy");
+	cashX(forceNeg(getIncubatorCosts()), "incubator");
+	cashX(forceNeg(getServantsQuartersCosts()), "servantsQuarters");
+	cashX(forceNeg(getMasterSuiteCosts()), "masterSuite");
+	cashX(forceNeg(getNurseyCosts()), "nursery");
+	cashX(forceNeg(getFarmyardCosts()), "farmyard");
+	cashX(forceNeg(getSecurityExpansionCost()), "securityExpansion");
+	cashX(forceNeg(getLifestyleCosts()), "personalBusiness");
+	cashX(forceNeg(getFSCosts()), "futureSocieties");
+	cashX(forceNeg(getCitizenOrphanageCosts()), "citizenOrphanage");
+	cashX(forceNeg(getPrivateOrphanageCosts()), "privateOrphanage");
+	cashX(forceNeg(getPeacekeeperCosts()), "peacekeepers");
+	cashX(forceNeg(getMercenariesCosts()), "mercenaries");
+	cashX(forceNeg(getMenialRetirementCosts()), "menialRetirement");
+	cashX(forceNeg(getRecruiterCosts()), "recruiter");
+	cashX(forceNeg(getSchoolCosts()), "schoolBacking");
+	cashX(forceNeg(getPolicyCosts()), "policies");
+	cashX(forceNeg(getCyberModCosts()), "cyberMod");
+	cashX(forceNeg(getPCTrainingCosts()), "PCtraining");
+	cashX(forceNeg(getPCCosts()), "PCmedical");
+	getTotalSlaveCosts(array2);
+	
+	
+	//these two apply a multiplicative effect to all costs so far.
+	// Calculate what the deduced expenses would be, then subtract 
+	costSoFar = (oldCash - State.variables.cash); //expected to be positive.
+	fee = (costSoFar - getEnvironmentCosts(costSoFar));
+	cashX(forceNeg(fee), "environment");
+
+	costSoFar = (oldCash - State.variables.cash);
+	fee = (costSoFar - getPCMultiplierCosts(costSoFar));
+	cashX(forceNeg(fee), "PCskills");
+
+	//in the old order these were applied after multiplication.  Not sure if deliberate, but I'm leaving it for now.
+	cashX(forceNeg(getSFCosts()), "specialForces");
+	cashX(forceNeg(getWeatherCosts()), "weather");
+	return (oldCash - State.variables.cash);
+}
+
+//slave expenses
+window.predictTotalSlaveCosts = function(array3) {
+	var loopCosts = 0;	
+	//slave expenses
+	for (var slave of array3) {
+		loopCosts += getSlaveCost(slave);
+		loopCosts += getSlaveMinorCosts(slave);
+	}
+	return loopCosts;
+}
+
+window.getTotalSlaveCosts = function(array3) {
+	var slaveCost = 0
+	var slaveCostMinor = 0
+	for (var slave of array3) {
+		slaveCost = getSlaveCost(slave);
+		cashX(forceNeg(slaveCost), "slaveUpkeep", slave);
+		slaveCostMinor = getSlaveMinorCosts(slave);
+		cashX(forceNeg(slaveCostMinor), "slaveUpkeep", slave);
+	}
+	//nothing to return, cashX already billed.
+}
+
+//facility expenses
+window.getBrothelCosts = function() {
 	var facilityCost = State.variables.facilityCost;
-	var localEcon = State.variables.localEcon;
 	var brothel = State.variables.brothel;
+	var costs = (brothel * facilityCost);
+	costs += (0.1 * State.variables.brothelUpgradeDrugs * brothel * facilityCost);
+	if(brothel > 0) {
+		costs += State.variables.brothelAdsSpending;
+	}
+	return costs;
+}
+
+window.getArcadeCosts = function() {
+	var facilityCost = State.variables.facilityCost;
 	var arcade = State.variables.arcade;
+	var costs = (arcade * facilityCost * 0.5);
+	costs += (0.2 * State.variables.arcadeUpgradeInjectors * arcade * facilityCost)
+	+ (0.2 * State.variables.arcadeUpgradeCollectors * arcade * facilityCost);
+	return costs;
+}
+
+window.getClubCosts = function() {
+	var facilityCost = State.variables.facilityCost;
 	var club = State.variables.club;
-	var dairy = State.variables.dairy;
-	var farmyard = State.variables.farmyard;
-	var servantsQuarters = State.variables.servantsQuarters;
-	var nursery = State.variables.nursery;
-	var incubator = State.variables.incubator;
-	var mercCosts = State.variables.mercenaries * 2000;
-	var policyCost = State.variables.policyCost;
-	var costs = (brothel * facilityCost)
-		+ (arcade * facilityCost * 0.5)
-		+ (club * facilityCost)
-		+ (dairy * facilityCost)
-		+ (nursery * facilityCost)
-		+ (farmyard * facilityCost)
-		+ (State.variables.incubator * facilityCost * 10);
-	var secExpCost = 0;
-	var soldierMod = 0;
+	var costs = (club * facilityCost);
+	costs += (0.2 * State.variables.clubUpgradePDAs * club * facilityCost);
+	if(club > 0) {
+		costs += State.variables.clubAdsSpending;
+	}
+	return costs;
+}
 
-	//facility expenses
-	costs += (0.1 * State.variables.brothelUpgradeDrugs * brothel * facilityCost)
-	+ (0.2 * State.variables.arcadeUpgradeInjectors * arcade * facilityCost)
-	+ (0.2 * State.variables.arcadeUpgradeCollectors * arcade * facilityCost)
-	+ (0.2 * State.variables.clubUpgradePDAs * club * facilityCost)
-	+ (0.2 * State.variables.dairyFeedersUpgrade * dairy * facilityCost)
+window.getDairyCosts = function() {
+	var facilityCost = State.variables.facilityCost;
+	var dairy = State.variables.dairy;
+	var costs = (dairy * facilityCost) + (0.2 * State.variables.dairyFeedersUpgrade * dairy * facilityCost)
 	+ (0.1 * State.variables.dairyPregUpgrade * dairy * facilityCost)
-	+ (0.2 * State.variables.dairyStimulatorsUpgrade * facilityCost)
-	+ (0.2 * State.variables.servantsQuartersUpgradeMonitoring * servantsQuarters * facilityCost)
-	+ (0.2 * State.variables.incubatorUpgradeWeight * incubator * facilityCost)
+	+ (0.2 * State.variables.dairyStimulatorsUpgrade * facilityCost);
+	if(dairy > 0) {
+		costs += ((State.variables.bioreactorsXY + State.variables.bioreactorsXX + State.variables.bioreactorsHerm + State.variables.bioreactorsBarren) * 100);
+	}
+	return costs;
+}
+
+window.getIncubatorCosts = function() {
+	var facilityCost = State.variables.facilityCost;
+	var incubator = State.variables.incubator;
+	var costs = (State.variables.incubator * facilityCost * 10);
+	costs += (0.2 * State.variables.incubatorUpgradeWeight * incubator * facilityCost)
 	+ (0.2 * State.variables.incubatorUpgradeMuscles * incubator * facilityCost)
 	+ (0.2 * State.variables.incubatorUpgradeReproduction * incubator * facilityCost)
 	+ (0.2 * State.variables.incubatorUpgradeGrowthStims * incubator * facilityCost)
 	+ (0.5 * State.variables.incubatorUpgradeSpeed * incubator * facilityCost);
-
-	if(dairy > 0) {
-		costs += ((State.variables.bioreactorsXY + State.variables.bioreactorsXX + State.variables.bioreactorsHerm + State.variables.bioreactorsBarren) * 100);
-	}
-	if(brothel > 0) {
-		costs += State.variables.brothelAdsSpending;
-	}
-	if(club > 0) {
-		costs += State.variables.clubAdsSpending;
-	}
 	if(incubator > 0) {
 		costs += ((State.variables.incubatorWeightSetting + State.variables.incubatorMusclesSetting + State.variables.incubatorReproductionSetting + State.variables.incubatorGrowthStimsSetting) * 500);
 	}
+	return costs;
+}
+
+window.getServantsQuartersCosts = function() {
+	var facilityCost = State.variables.facilityCost;
+	var servantsQuarters = State.variables.servantsQuarters;
+	var costs = (0.2 * State.variables.servantsQuartersUpgradeMonitoring * servantsQuarters * facilityCost)
+	return costs;
+}
+
+window.getMasterSuiteCosts = function() {
+	var costs = 0;	
 	if(State.variables.masterSuitePregnancySlaveLuxuries === 1) {
 		costs += 500;
 	}
 	if(State.variables.masterSuitePregnancyFertilitySupplements === 1) {
 		costs += 1000;
 	}
+	return costs;
+}
+
+window.getNurseyCosts = function() {
+	var facilityCost = State.variables.facilityCost;
+	var nursery = State.variables.nursery;
+	var costs = (nursery * facilityCost);
+	return costs;
+}
 
+window.getFarmyardCosts = function() {
+	var facilityCost = State.variables.facilityCost;
+	var farmyard = State.variables.farmyard;
+	var costs = (farmyard * facilityCost);
+	return costs;
+}
+
+window.getSecurityExpansionCost = function() {
 	//security expansion
+	var secExpCost = 0;
+	var soldierMod = 0;
 	if(State.variables.secExp == 1) {
 		if(State.variables.edictsUpkeep > 0) {
 			secExpCost += State.variables.edictsUpkeep;
@@ -121,26 +274,54 @@ window.getCost = function(array) {
 				}
 			}
 		}
-		costs += secExpCost;
 	}
+	return secExpCost;
+}
 
 	//general arcology costs
+
+window.getLifestyleCosts = function() {
+	var costs = 0;
+	var localEcon = State.variables.localEcon;
 	costs += (State.variables.girls * (250 + (50000 / localEcon)));
+	return costs;
+}
 
+window.getFSCosts = function() {
+	var costs = 0;
+	costs += State.variables.FSSpending;
 	if(State.variables.arcologies[0].FSRepopulationFocusLaw === 1 && State.variables.PC.pregKnown == 1) {
 		costs -= 500;
 	}
+	return costs;
+}
 
+window.getCitizenOrphanageCosts = function() {
+	var costs = 0;	
 	costs += State.variables.citizenOrphanageTotal * 100;
+	return costs;
+}
+
+window.getPrivateOrphanageCosts = function() {
+	var costs = 0;	
 	costs += State.variables.privateOrphanageTotal * 500;
 	if(State.variables.breederOrphanageTotal > 0) {
 		costs += 50;
 	}
+	return costs;
+}
 
+window.getPeacekeeperCosts = function() {
+	var costs = 0;	
 	if(State.variables.peacekeepers !== 0 && State.variables.peacekeepers.undermining !== 0) {
 		costs += State.variables.peacekeepers.undermining;
 	}
+	return costs;
+}
 
+window.getMercenariesCosts = function() {
+	var costs = 0;
+	var mercCosts = State.variables.mercenaries * 2000;
 	if(State.variables.mercenaries > 0) {
 		if(State.variables.barracks) {
 			mercCosts *= 0.5;
@@ -150,61 +331,28 @@ window.getCost = function(array) {
 		}
 		costs += mercCosts;
 	}
+	return costs;
+}
 
+window.getMenialRetirementCosts = function() {
+	var costs = 0;	
 	if(State.variables.citizenRetirementMenials == 1) {
 		costs += State.variables.menials * 2;
 	}
+	return costs;
+}
 
-	costs += State.variables.FSSpending;
-
-	//slave expenses
-	for (var slave of array) {
-		costs += getSlaveCost(slave);
-		if(slave.assignment === Job.SERVANT || slave.assignment === Job.SERVER) {
-			if(slave.trust < -20) {
-				costs -= rulesCost * 4;
-			} else if(slave.devotion < -20) {
-				if (slave.trust >= 20) {
-					costs -= rulesCost / 2;
-				} else {
-					costs -= rulesCost * 2;
-				}
-			} else if(slave.devotion <= 20) {
-				costs -= rulesCost * 3;
-			} else if(slave.devotion <= 50) {
-				costs -= rulesCost * 4;
-			} else {
-				costs -= rulesCost * 5;
-			}
-			if(slave.fetish === 'submissive') {
-				costs -= rulesCost;
-			} else if(slave.fetish === 'dom') {
-				costs += rulesCost;
-			}
-			if(slave.relationship < -1) {
-				costs -= rulesCost;
-			}
-			if(slave.energy < 20) {
-				costs -= rulesCost;
-			} else if(slave.energy < 40) {
-				costs -= rulesCost / 2;
-			}
-			if(slave.lactation > 0) {
-				costs -= 25;
-			}
-			if(slave.assignment === Job.SERVANT) {
-				costs -= rulesCost;
-			}
-			if(setup.servantCareers.includes(slave.career) || slave.skillS >= State.variables.masteredXP) {
-				costs -= rulesCost;
-			}
-		}
-	}
-
-	// policy and other expenses
+// policy and other expenses
+window.getRecruiterCosts = function() {
+	var costs = 0;	
 	if(State.variables.Recruiter !== 0) {
 		costs += 250;
 	}
+	return costs;
+}
+
+window.getSchoolCosts = function() {
+	var costs = 0;	
 	if(State.variables.TSS.schoolPresent === 1) {
 		costs += 1000;
 	}
@@ -253,7 +401,12 @@ window.getCost = function(array) {
 	if(State.variables.TFS.subsidize !== 0) {
 		costs += 1000;
 	}
+	return costs;
+}
 
+window.getPolicyCosts = function() {
+	var costs = 0;
+	var policyCost = State.variables.policyCost;
 	if(State.variables.alwaysSubsidizeGrowth === 1) {
 		costs += policyCost;
 	}
@@ -274,7 +427,21 @@ window.getCost = function(array) {
 	if(State.variables.CoursingAssociation === 1) {
 		costs += 1000;
 	}
+	return costs;
+}
+
+window.getCyberModCosts = function() {
+	var costs = 0;	
+	if(State.variables.cyberMod !== 0 && State.variables.researchLab.built === 'true') {
+		costs += ((100 * State.variables.researchLab.maxSpace) + (300 * State.variables.researchLab.hired) + (100 * State.variables.researchLab.hired));
+	}
+	return costs;
+}
 
+
+//player expenses
+window.getPCTrainingCosts = function() {
+	var costs = 0;	
 	if(State.variables.PC.actualAge >= State.variables.IsInPrimePC && State.variables.PC.actualAge < State.variables.IsPastPrimePC) {
 	if(State.variables.personalAttention === PersonalAttention.TRADE) {
 		costs += 10000*State.variables.AgeEffectOnTrainerPricingPC;
@@ -290,13 +457,10 @@ window.getCost = function(array) {
 		costs += 10000*State.variables.AgeEffectOnTrainerPricingPC;
 	}
 	}
-
-	if(State.variables.cyberMod !== 0 && State.variables.researchLab.built === 'true') {
-		costs += ((100 * State.variables.researchLab.maxSpace) + (300 * State.variables.researchLab.hired) + (100 * State.variables.researchLab.hired));
-	}
-
-	//player expenses
-
+	return costs;
+}
+window.getPCCosts = function() {
+	var costs = 0;	
 	if(State.variables.PC.preg === -1) {
 		costs += 25;
 	} else if(State.variables.PC.fertDrugs === 1) {
@@ -307,29 +471,41 @@ window.getCost = function(array) {
 	if(State.variables.PC.staminaPills === 1) {
 		costs += 50;
 	}
+	return costs;
+}
+
 
+window.getPCMultiplierCosts = function(cost) {
 	if(State.variables.PC.career === 'servant') {
 		if(State.variables.personalAttention === PersonalAttention.MAID) {
 			if(State.variables.PC.belly >= 5000) {
-				costs *= 0.80;
+				cost *= 0.80;
 			} else {
-				costs *= 0.75;
+				cost *= 0.75;
 			}
 		} else {
-			costs *= 0.9;
+			cost *= 0.9;
 		}
 	}
 
+	return cost;
+}
+
+window.getEnvironmentCosts = function(cost) {
 	if(State.variables.secExp == 1) {
 		if(State.variables.terrain === 'oceanic' || State.variables.terrain === 'marine') {
 			if(State.variables.docks > 0) {
-				costs *= (1 - State.variables.docks * 0.05);
+				cost *= (1 - State.variables.docks * 0.05);
 			}
 		} else if(State.variables.railway > 0) {
-			costs *= (1 - State.variables.railway * 0.05);
+			cost *= (1 - State.variables.railway * 0.05);
 		}
 	}
+	return cost;
+}
 
+window.getSFCosts = function() {
+	var costs = 0;	
 	if(State.variables.SF.Toggle && State.variables.SF.Active >= 1) {
 		if(State.variables.SF.Subsidy) {
 			costs += Math.ceil( (10000*(State.variables.SF.Squad.Troops/10))+(1+(State.variables.arcologies[0].prosperity/100))+(1+(State.variables.SF.Size/100)) );
@@ -340,22 +516,64 @@ window.getCost = function(array) {
 			costs += Math.ceil(T.SFCashBonus);
 		}
 	}
+	return costs;
+}
+
+window.getWeatherCosts = function() {
+	var costs = 0;	
 	if(State.variables.econWeatherDamage && State.variables.disasterResponse > 0) {
 		costs += Math.trunc(State.variables.disasterResponse * 200000 / State.variables.localEcon);
 	}
 	if(State.variables.antiWeatherFreeze > 0) {
 		costs += Math.trunc(State.variables.antiWeatherFreeze * 200000 / State.variables.localEcon);
 	}
-	// clean up
-	if(costs < 0) {
-		costs = 0;
+	return costs;
+}
+
+window.getSlaveMinorCosts = function(slave) {
+	var costs = 0
+	var rulesCost = State.variables.rulesCost;
+	if(slave.assignment === Job.SERVANT || slave.assignment === Job.SERVER) {
+	if(slave.trust < -20) {
+		costs -= rulesCost * 4;
+	} else if(slave.devotion < -20) {
+		if (slave.trust >= 20) {
+			costs -= rulesCost / 2;
+		} else {
+			costs -= rulesCost * 2;
+		}
+	} else if(slave.devotion <= 20) {
+		costs -= rulesCost * 3;
+	} else if(slave.devotion <= 50) {
+		costs -= rulesCost * 4;
 	} else {
-		costs = Math.ceil(costs);
+		costs -= rulesCost * 5;
+	}
+	if(slave.fetish === 'submissive') {
+		costs -= rulesCost;
+	} else if(slave.fetish === 'dom') {
+		costs += rulesCost;
+	}
+	if(slave.relationship < -1) {
+		costs -= rulesCost;
+	}
+	if(slave.energy < 20) {
+		costs -= rulesCost;
+	} else if(slave.energy < 40) {
+		costs -= rulesCost / 2;
+	}
+	if(slave.lactation > 0) {
+		costs -= 25;
+	}
+	if(slave.assignment === Job.SERVANT) {
+		costs -= rulesCost;
+	}
+	if(setup.servantCareers.includes(slave.career) || slave.skillS >= State.variables.masteredXP) {
+		costs -= rulesCost;
+	}
 	}
-
 	return costs;
 }
-
 window.getSlaveCost = function(s) {
 	if(!s) { return 0; }
 	// Data duplicated from Cost Report
@@ -704,6 +922,77 @@ window.initFacilityStatistics = function(facility) {
 	return facility;
 };
 
+/* Example  
+<<run cashX(1000, "whore", $activeSlave)>>
+
+Make sure that expenses arrive in COST as a negative, they are often positive in code.  Use forceNeg and pass along on a temporary variable if needed.
+
+*/
+
+window.cashX = function(cost, what, who) {
+	const V = State.variables;
+
+	if(isNaN(cost)){
+		V.lastWeeksErrors += (' NaN: \"' + cost + '\"" at ' + what + ',');
+	} else {
+		
+		//INCOME
+		if(cost > 0) {
+				if (typeof V.lastWeeksCashIncome[what] !== 'undefined') {
+					
+					//record the action
+					V.lastWeeksCashIncome[what] += cost;
+
+					//record the slave, if available
+					if (who !== undefined){
+						if(what == "slaveTransfer"){
+							who.slaveCost = cost;
+						} else {
+							who.lastWeeksCashIncome += cost;
+							who.lifetimeCashIncome += cost;
+						}
+					}
+
+					//Spend the money
+					V.cash += cost;
+				} else {
+					V.lastWeeksErrors += (' unknown place \"' + what +'\",');
+				}
+		}
+		
+		//EXPENSES
+		else if(cost < 0) {
+				if (typeof V.lastWeeksCashExpenses[what] !== 'undefined') {
+					
+					//record the action
+					V.lastWeeksCashExpenses[what] += cost;
+					
+					//record the slave, if available
+					if (who !== undefined){
+						who.lifetimeCashExpenses += cost;
+					}
+
+					//Spend the money
+					V.cash += cost;
+				} else {
+					V.lastWeeksErrors += (' unknown place \"' + what +'\",');
+				}
+		}
+		else {
+			//somebody probably tried to pass a 0, ignore it.
+		}
+		return cost;
+	}
+};
+
+window.forceNeg = function(x) {
+	if (x > 0){
+		x = Math.abs(x) * -1;
+	}
+	return x;
+};
+
 Number.prototype.toFixedHTML = function() {
 	return commaNum(Number.prototype.toFixed.apply(this, arguments)).replace(/\.0+$/, '<span style="opacity: 0.3">$&</span>');
 };
+
diff --git a/src/pregmod/personalNotes.tw b/src/pregmod/personalNotes.tw
index f0f2938a012..33582c6ff73 100644
--- a/src/pregmod/personalNotes.tw
+++ b/src/pregmod/personalNotes.tw
@@ -67,7 +67,8 @@
 				<<set _milkSale = _milk*8>>
 				Your milk is sold for @@.yellowgreen;<<print cashFormat(_milkSale)>>.@@
 			<</if>>
-			<<set $cash += _milkSale>>
+			<<run cashX(_milkSale, "personalBusiness")>>
+
 		<<else>>
 			You regularly see to your breasts to make sure your milk production doesn't dry up; be it by hand, milker or mouth, you keep yourself comfortably drained.
 		<</if>>
diff --git a/src/uncategorized/arcadeReport.tw b/src/uncategorized/arcadeReport.tw
index 369786421d7..56caa19c1fb 100644
--- a/src/uncategorized/arcadeReport.tw
+++ b/src/uncategorized/arcadeReport.tw
@@ -5,6 +5,7 @@
 
 <<SlaveSort $ArcadeiIDs>>
 <<set _DL = $ArcadeiIDs.length, $arcadeSlaves = _DL, _SL = $slaves.length, _cockmilked = 0, _milked = 0, _milkprofits = 0, _profits = 0, _oldCash = 0, $boobsImplanted = 0, $prostatesImplanted = 0, $vasectomiesUndone = 0>>
+<<set _surgeryCost forceNeg($surgeryCost)>>
 
 <!-- Statistics gathering -->
 <<set $facility = $facility || {}, $facility.arcade = initFacilityStatistics($facility.arcade)>>
@@ -85,11 +86,14 @@
 	<</if>>
 	<<if ($arcadeUpgradeCollectors > 0)>>
 		<<if ($slaves[$i].vasectomy == 1)>>
-			<<set $slaves[$i].vasectomy = 0, $slaves[$i].health -= 10, $cash -= $surgeryCost, $vasectomiesUndone++>>
+			<<set $slaves[$i].vasectomy = 0, $slaves[$i].health -= 10, $vasectomiesUndone++>>
+			<<run cashX(_surgeryCost, "slaveSurgery", $slaves[$i])>>
 		<<elseif ($slaves[$i].lactation < 2)>>
-			<<set $slaves[$i].lactation = 2, $slaves[$i].health -= 10, $cash -= $surgeryCost, $boobsImplanted++>>
+			<<set $slaves[$i].lactation = 2, $slaves[$i].health -= 10, $boobsImplanted++>>
+			<<run cashX(_surgeryCost, "slaveSurgery", $slaves[$i])>>
 		<<elseif $slaves[$i].prostate == 1>>
-			<<set $slaves[$i].prostate = 2, $slaves[$i].health -= 10, $cash -= $surgeryCost, $prostatesImplanted++>>
+			<<set $slaves[$i].prostate = 2, $slaves[$i].health -= 10, $prostatesImplanted++>>
+			<<run cashX(_surgeryCost, "slaveSurgery", $slaves[$i])>>
 		<<elseif ($slaves[$i].lactation > 0) || ($slaves[$i].balls > 0)>>
 			<<set _oldCash = $cash>>
 			<<if $showEWD != 0>>
diff --git a/src/uncategorized/arcmgmt.tw b/src/uncategorized/arcmgmt.tw
index fd114695dc6..918a841c787 100644
--- a/src/uncategorized/arcmgmt.tw
+++ b/src/uncategorized/arcmgmt.tw
@@ -1081,8 +1081,10 @@ _percTopClass = Math.trunc(($topClass / ($ACitizens + $ASlaves)) * 1000) / 10>>
 <<set _rents = Math.trunc(($lowerClass * $LCRent + $middleClass * $MCRent + $upperClass * $UCRent + $topClass * $TCRent) * _rentMultiplier / 25)>>
 <<if !isInt(_rents)>>
 	<br>@@.red;Error: rents is outside accepted range, please report this issue@@
+<<else>>
+	<<run cashX(_rents, "rents")>>
 <</if>>
-<<set $cash += _rents>>
+
 
 This week, rents from $arcologies[0].name came to @@.yellowgreen;<<print cashFormat(_rents)>>.@@
 <<if $difficultySwitch == 0>>
@@ -1092,44 +1094,53 @@ This week, rents from $arcologies[0].name came to @@.yellowgreen;<<print cashFor
 			<<set _bribes += Math.trunc($cash*0.02)>>
 		<</if>>
 		The @@.red;degenerating world economy@@ makes supplying and maintaining $arcologies[0].name extremely difficult. This week, bribes and other costs to keep it running came to @@.yellowgreen;<<print cashFormat(_bribes)>>.@@
-		<<set $cash -= _bribes>>
+		<<set _bribes = forceNeg(_bribes)>>
+		<<run cashX(_bribes, "rents")>>
 	<</if>>
 <</if>>
 
 <<if $menials+$menialBioreactors+$fuckdolls > 0>>
-<<set _earnings = 0>>
 You own
 <<if $menials > 0>>
 	<<if $menials > Math.trunc(_LSCD / _slaveProductivity - _SCD)>>
 		<<set _earnings += Math.trunc(_LSCD / _slaveProductivity - _SCD) * 10>>
 		<br>@@.red;more menial slaves than there was work,@@ consider selling some. You own
 	<<else>>
-		<<set _earnings += $menials*10>>
+		<<set _menialEarnings += $menials*10>>
 		<<if $Sweatshops > 0>>
 			<<if $Sweatshops*500 <= $menials>>
-				<<set _earnings += $Sweatshops*7000>>
-				<<set _earnings += ($menials-$Sweatshops*500)*10>>
+				<<set _menialEarnings += $Sweatshops*7000>>
+				<<set _menialEarnings += ($menials-$Sweatshops*500)*10>>
 			<<else>>
-				<<set _earnings += $menials*10>>
+				<<set _menialEarnings += $menials*10>>
 			<</if>>
 		<</if>>
 	<</if>>
 	<<if $menials > 1>> <<print commaNum($menials)>> menial slaves<<if ($menialBioreactors > 0) && ($fuckdolls == 0)>> and<<else>>,<</if>><<else>>one menial slave<<if ($menialBioreactors > 0) && ($fuckdolls == 0)>> and<<else>>,<</if>><</if>>
+	<<run cashX(_menialEarnings, "menialTrades")>>
 <</if>>
+
+
 <<if $menialBioreactors > 0>>
-	<<set _earnings += $menialBioreactors*(10+(10*$arcologies[0].FSPastoralistLaw))>>
-	<<if $dairy && $dairyUpgradeMenials>><<set _earnings += $menialBioreactors*5>><</if>>
+	<<set _bioreactorEarnings = 0>>
+	<<set _bioreactorEarnings += $menialBioreactors*(10+(10*$arcologies[0].FSPastoralistLaw))>>
+	<<if $dairy && $dairyUpgradeMenials>><<set _bioreactorEarnings += $menialBioreactors*5>><</if>>
 	<<if $menialBioreactors > 1>> <<print commaNum($menialBioreactors)>> standard bioreactors,<<else>>one standard bioreactor,<</if>>
 	<<if $fuckdolls > 0>>and<</if>>
+	<<run cashX(_bioreactorEarnings, "menialBioreactors")>>
 <</if>>
+
+
 <<if $fuckdolls > 0>>
-	<<set _earnings += $fuckdolls*(15+(10*$arcologies[0].FSDegradationistLaw))>>
-	<<if $arcade && $arcadeUpgradeMenials>><<set _earnings += $fuckdolls*5>><</if>>
-	<<if $fuckdolls > 1>> <<print commaNum($fuckdolls)>> standard Fuckdolls,<<else>>one Fuckdoll,<</if>>
+	<<set _fuckdollsEarnings = 0>>
+	<<set _fuckdollsEarnings += $fuckdolls*(15+(10*$arcologies[0].FSDegradationistLaw))>>
+	<<if $arcade && $arcadeUpgradeMenials>><<set _fuckdollsEarnings += $fuckdolls*5>><</if>>
+	<<if $fuckdolls > 1>> <<print commaNum($fuckdolls)>> standard fuckdolls,<<else>>one fuckdoll,<</if>>
+	<<set _fuckdollsEarnings += random(1,10)>>
+	<<run cashX(_fuckdollsEarnings, "fuckdolls")>>
 <</if>>
-<<set _earnings += random(1,10)>>
 
-<<set $cash += _earnings>>
+<<set _earnings = (_menialEarnings + _bioreactorEarnings + _fuckdollsEarnings)>>
 earning you @@.yellowgreen;<<print cashFormat(_earnings)>>.@@
 <</if>>
 
@@ -1537,14 +1548,18 @@ Your ''business assistant'' manages the menial slave market.
 	There is no room in the parts of your arcology you own for more menial slaves.
 	<<else>>
 		<<if $cash > $marketAssistantLimit+_menialSlaveValue>>
+			<<set _cashX = $cash>>
 			<<set _menialBulkPremium = Math.trunc(1+Math.clamp(($cash-$marketAssistantLimit)/_menialSlaveValue,0,_bulkMax)/400)>>
 			_HeM acquires more chattel, since it's a buyers' market.
 			<<if ($arcologies[0].FSPastoralist != "unset") && ($arcologies[0].FSPaternalist == "unset")>>
 				<<set $menialBioreactors += Math.trunc(Math.clamp(($cash-$marketAssistantLimit)/(_menialSlaveValue+_menialBulkPremium-100),0,_bulkMax)), $menialSupplyFactor -= Math.trunc(Math.clamp(($cash-$marketAssistantLimit)/(_menialSlaveValue+_menialBulkPremium-100),0,_bulkMax)), $cash -= Math.trunc(Math.clamp(($cash-$marketAssistantLimit)/(_menialSlaveValue+_menialBulkPremium-100),0,_bulkMax))*(_menialSlaveValue+_menialBulkPremium-100)>>
+				<<set $lastWeeksCashExpenses.menialBioreactorsTransfer += ($cash - _cashX)>>
 			<<elseif ($arcologies[0].FSDegradationist != "unset")>>
 				<<set $fuckdolls += Math.trunc(Math.clamp(($cash-$marketAssistantLimit)/((_menialSlaveValue+_menialBulkPremium)*2),0,_bulkMax)), $menialSupplyFactor -= Math.trunc(Math.clamp(($cash-$marketAssistantLimit)/((_menialSlaveValue+_menialBulkPremium)*2),0,_bulkMax)), $cash -= Math.trunc(Math.clamp(($cash-$marketAssistantLimit)/((_menialSlaveValue+_menialBulkPremium)*2),0,_bulkMax))*((_menialSlaveValue+_menialBulkPremium)*2)>>
+				<<set $lastWeeksCashExpenses.fuckdollsTransfer += ($cash - _cashX)>>
 			<<else>>
 				<<set $menials += Math.trunc(Math.clamp(($cash-$marketAssistantLimit)/(_menialSlaveValue+100),0,_bulkMax)), $menialSupplyFactor -= Math.trunc(Math.clamp(($cash-$marketAssistantLimit)/(_menialSlaveValue+_menialBulkPremium),0,_bulkMax)), $cash -= Math.trunc(Math.clamp(($cash-$marketAssistantLimit)/(_menialSlaveValue+_menialBulkPremium),0,_bulkMax)*(_menialSlaveValue+_menialBulkPremium))>>
+				<<set $lastWeeksCashExpenses.menialTradesTransfer += ($cash - _cashX)>>
 			<</if>>
 		<</if>>
 	<</if>>
@@ -1553,13 +1568,16 @@ Your ''business assistant'' manages the menial slave market.
 		_HeM liquidates your chattel holdings, since it's a sellers' market.
 	<</if>>
 	<<if $menials > 0>>
-		<<set $cash += $menials*(menialSlaveCost(-$menials)), $menialDemandFactor -= $menials, $menials = 0>>
+		<<set _cashX = $menials*(menialSlaveCost(-$menials)), $menialDemandFactor -= $menials, $menials = 0>>
+		<<run cashX(_cashX, "menialTradesTransfer")>>
 	<</if>>
 	<<if $fuckdolls > 0>>
-		<<set $cash += $fuckdolls*(menialSlaveCost(-$fuckdolls)*2), $menialDemandFactor -= $fuckdolls, $fuckdolls = 0>>
+		<<set _cashX = $fuckdolls*(menialSlaveCost(-$fuckdolls)*2), $menialDemandFactor -= $fuckdolls, $fuckdolls = 0>>
+		<<run cashX(_cashX, "fuckdollsTransfer")>>
 	<</if>>
 	<<if $menialBioreactors > 0>>
-		<<set $cash += $menialBioreactors*(menialSlaveCost(-$menialBioreactors)-100), $menialDemandFactor -= $menialBioreactors, $menialBioreactors = 0>>
+		<<set _cashX = $menialBioreactors*(menialSlaveCost(-$menialBioreactors)-100), $menialDemandFactor -= $menialBioreactors, $menialBioreactors = 0>>
+		<<run cashX(_cashX, "menialBioreactorsTransfer")>>
 	<</if>>
 <<else>>
 	Prices are average, so _heM does not make any significant moves.
diff --git a/src/uncategorized/brothelReport.tw b/src/uncategorized/brothelReport.tw
index 63543cc4ec3..5c4219edec7 100644
--- a/src/uncategorized/brothelReport.tw
+++ b/src/uncategorized/brothelReport.tw
@@ -199,7 +199,9 @@
 			<<else>>
 				<<silently>><<include "SA whore">><</silently>>
 			<</if>>
-			<<set _seed = $cash-_oldCash, $cash += Math.trunc(0.5*_seed), _seed = Math.trunc(1.5*_seed), _profits += _seed>>
+			<<set _seed = $cash-_oldCash, _cashX += Math.trunc(0.5*_seed), _seed = Math.trunc(1.5*_seed), _profits += _seed>>
+			$Madam
+			<<run cashX(_cashX, "whore", $Madam)>>
 			<br>&nbsp;&nbsp;&nbsp;&nbsp;Since $he doesn't have enough whores to manage to keep $him busy, $he sees $beauty customers $himself (<<print Math.trunc($beauty/7)>> a day), earning you @@.yellowgreen;<<print cashFormat(_seed)>>.@@ $He can charge more for $his time, since many citizens find it erotic to fuck the Madam.
 		<</if>>
 	<</if>>
@@ -467,10 +469,12 @@
 			<</if>>
 			<<if _seed > 0>>
 				<<set _adsIncome = _seed * random(50,60) * Math.trunc($brothelAdsSpending/1000)>>
-				<<set $cash += _adsIncome, getSlaveStatisticData($slaves[$i], $facility.brothel).adsIncome += _adsIncome>>
+				<<set _cashX = _adsIncome, getSlaveStatisticData($slaves[$i], $facility.brothel).adsIncome += _adsIncome>>
+				<<run cashX(_cashX, "brothelAds")>>
 			<<else>>
 				<<set _adsIncome = random(50,60) * Math.trunc($brothelAdsSpending/1000)>>
-				<<set $cash += _adsIncome, getSlaveStatisticData($slaves[$i], $facility.brothel).adsIncome += _adsIncome>>
+				<<set _cashX = _adsIncome, getSlaveStatisticData($slaves[$i], $facility.brothel).adsIncome += _adsIncome>>
+				<<run cashX(_cashX, "brothelAds")>>
 			<</if>>
 		<</if>>
 	<</for>>
@@ -506,7 +510,8 @@
 			<<if ($brothelAdsSpending == 0) || ($brothelAdsStacked == 0)>>
 				<<set _possibleBonuses++>>
 				<<if (_slim > 0) && (_stacked > 0) && (Math.abs(_slim-_stacked) <= (_DL/3))>>
-					<<set _adsIncome = _DL*random(20,30), $cash += _adsIncome, $facility.brothel.adsIncome += _adsIncome, _brothelBonuses++>>
+					<<set _adsIncome = _DL*random(20,30),$facility.brothel.adsIncome += _adsIncome, _brothelBonuses++>>
+					<<run cashX(_adsIncome, "brothelAds")>>
 					The brothel offers a @@.yellowgreen;wide@@ variety of slim and stacked slaves.
 				<</if>>
 			<</if>>
@@ -527,7 +532,8 @@
 	<<if (_pref == 0)>> /*customers don't care*/
 	<<elseif ($brothelAdsSpending > 0)>>
 		<<if (_ads == _pref) && (_girls == _ads)>>
-			<<set _adsIncome = _DL*random(20,30), $cash += _adsIncome, $facility.brothel.adsIncome += _adsIncome, _brothelBonuses++>>
+			<<set _adsIncome = _DL*random(20,30), $facility.brothel.adsIncome += _adsIncome, _brothelBonuses++>>
+			<<run cashX(_adsIncome, "brothelAds")>>
 			Its advertising for <<if _ads == 1>>stacked <<elseif _ads == -1>>trim <</if>>girls matched most customers' preferences and the girls in the brothel matched its advertisements. Your @@.green;reputation@@ increased slightly as a result.
 			<<set $rep += random(_minBonus,_maxBonus)>>
 		<<elseif (_ads == _pref) && (_girls != _ads)>>
@@ -573,7 +579,8 @@
 			<<if ($brothelAdsSpending == 0) || ($brothelAdsPreg == 0)>>
 				<<set _possibleBonuses++>>
 				<<if (_pregYes > 0) && (_pregNo > 0) && (Math.abs(_pregYes-_pregNo) <= (_DL/3))>>
-					<<set _adsIncome = _DL*random(20,30), $cash += _adsIncome, $facility.brothel.adsIncome += _adsIncome, _brothelBonuses++>>
+					<<set _adsIncome = _DL*random(20,30), $facility.brothel.adsIncome += _adsIncome, _brothelBonuses++>>
+					<<run cashX(_adsIncome, "brothelAds")>>
 					The brothel offers a @@.yellowgreen;wide@@ selection of slaves with a variety of middles.
 				<</if>>
 			<</if>>
@@ -594,7 +601,8 @@
 	<<if _pref == 0>> /*customers don't care*/
 	<<elseif ($brothelAdsSpending > 0)>>
 		<<if (_ads == _pref) && (_girls == _ads)>>
-			<<set _adsIncome = _DL*random(20,30), $cash += _adsIncome, $facility.brothel.adsIncome += _adsIncome, _brothelBonuses++>>
+			<<set _adsIncome = _DL*random(20,30), $facility.brothel.adsIncome += _adsIncome, _brothelBonuses++>>
+			<<run cashX(_adsIncome, "brothelAds")>>
 			Its advertising for <<if _ads == 1>>pregnant <<elseif _ads == -1>>flat-bellied <</if>>girls matched most customers' preferences and the girls in the brothel matched its advertisements. Your @@.green;reputation@@ increased slightly as a result.
 			<<set $rep += random(_minBonus,_maxBonus)>>
 		<<elseif (_ads == _pref) && (_girls != _ads)>>
@@ -640,7 +648,8 @@
 			<<if ($brothelAdsSpending == 0) || ($brothelAdsModded == 0)>>
 				<<set _possibleBonuses++>>
 				<<if (_modded > 0) && (_unmodded > 0) && (Math.abs(_modded-_unmodded) <= (_DL/3))>>
-					<<set _adsIncome = _DL*random(20,30), $cash += _adsIncome, $facility.brothel.adsIncome += _adsIncome, _brothelBonuses++>>
+					<<set _adsIncome = _DL*random(20,30), $facility.brothel.adsIncome += _adsIncome, _brothelBonuses++>>
+					<<run cashX(_adsIncome, "brothelAds")>>
 					The brothel offers a @@.yellowgreen;both@@ a selection of heavily altered slaves and those with more natural bodies.
 				<</if>>
 			<</if>>
@@ -661,7 +670,8 @@
 	<<if (_pref == 0)>> /*customers don't care*/
 	<<elseif ($brothelAdsSpending > 0) && (_pref != 0)>>
 		<<if (_ads == _pref) && (_girls == _ads)>>
-			<<set _adsIncome = _DL*random(20,30), $cash += _adsIncome, $facility.brothel.adsIncome += _adsIncome, _brothelBonuses++>>
+			<<set _adsIncome = _DL*random(20,30), $facility.brothel.adsIncome += _adsIncome, _brothelBonuses++>>
+			<<run cashX(_adsIncome, "brothelAds")>>
 			Its advertising for <<if _ads == 1>>heavily modified <<elseif _ads == -1>>natural bodied <</if>>girls matched most customers' preferences and the girls in the brothel matched its advertisements. Your @@.green;reputation@@ increased slightly as a result.
 			<<set $rep += random(_minBonus,_maxBonus)>>
 		<<elseif (_ads == _pref) && (_girls != _ads)>>
@@ -707,7 +717,8 @@
 			<<if ($brothelAdsSpending == 0) || ($brothelAdsImplanted == 0)>>
 				<<set _possibleBonuses++>>
 				<<if (_implanted > 0) && (_pure > 0) && (Math.abs(_implanted-_pure) <= (_DL/3))>>
-					<<set _adsIncome = _DL*random(20,30), $cash += _adsIncome, $facility.brothel.adsIncome += _adsIncome, _brothelBonuses++>>
+					<<set _adsIncome = _DL*random(20,30), $facility.brothel.adsIncome += _adsIncome, _brothelBonuses++>>
+					<<run cashX(_adsIncome, "brothelAds")>>
 					The brothel offers @@.yellowgreen;both@@ all-natural girls, and slaves whose beauty has been improved by surgical means.
 				<</if>>
 			<</if>>
@@ -728,7 +739,8 @@
 	<<if _pref == 0>> /*customers don't care*/
 	<<elseif ($brothelAdsSpending > 0)>>
 		<<if (_ads == _pref) && (_girls == _ads)>>
-			<<set _adsIncome = _DL*random(20,30), $cash += _adsIncome, $facility.brothel.adsIncome += _adsIncome, _brothelBonuses++>>
+			<<set _adsIncome = _DL*random(20,30), $facility.brothel.adsIncome += _adsIncome, _brothelBonuses++>>
+			<<run cashX(_adsIncome, "brothelAds")>>
 			Its advertising for <<if _ads == 1>>implanted or surgically improved <<elseif _ads == -1>>naturally pure <</if>>girls matched most customers' preferences and the girls in the brothel matched its advertisements. Your @@.green;reputation@@ increased slightly as a result.
 			<<set $rep += random(_minBonus,_maxBonus)>>
 		<<elseif (_ads == _pref) && (_girls != _ads)>>
@@ -774,7 +786,8 @@
 			<<if ($brothelAdsSpending == 0) || ($brothelAdsXX == 0)>>
 				<<set _possibleBonuses++>>
 				<<if (_XX > 0) && (_XY > 0) && (Math.abs(_XX-_XY) <= (_DL/3))>>
-					<<set _adsIncome = _DL*random(20,30), $cash += _adsIncome, $facility.brothel.adsIncome += _adsIncome, _brothelBonuses++>>
+					<<set _adsIncome = _DL*random(20,30), $facility.brothel.adsIncome += _adsIncome, _brothelBonuses++>>
+					<<run cashX(_adsIncome, "brothelAds")>>
 					The brothel offers a @@.yellowgreen;mix@@ of whores that can appeal to varied tastes in genitalia.
 				<</if>>
 			<</if>>
@@ -794,7 +807,8 @@
 		<<if _pref == 0>> /*customers don't care*/
 		<<elseif ($brothelAdsSpending > 0) >>
 			<<if (_ads == _pref) && (_girls == _ads)>>
-				<<set _adsIncome = _DL*random(20,30), $cash += _adsIncome, $facility.brothel.adsIncome += _adsIncome, _brothelBonuses++>>
+				<<set _adsIncome = _DL*random(20,30), $facility.brothel.adsIncome += _adsIncome, _brothelBonuses++>>
+				<<run cashX(_adsIncome, "brothelAds")>>
 				Its advertising for girls <<if _ads == 1>>with pussies <<elseif _ads == -1>>with dicks <</if>> matches most customers' preferences as advertised. Your @@.green;reputation@@ increased slightly as a result.
 				<<set $rep += random(_minBonus,_maxBonus)>>
 			<<elseif (_ads == _pref) && (_girls != _ads)>>
@@ -848,7 +862,8 @@
 			<<if ($brothelAdsSpending == 0) || ($brothelAdsOld == 0)>>
 				<<set _possibleBonuses++>>
 				<<if (_young > 0) && (_old > 0) && (Math.abs(_young-_old) <= (_DL/3))>>
-					<<set _adsIncome = _DL*random(20,30), $cash += _adsIncome, $facility.brothel.adsIncome += _adsIncome, _brothelBonuses++>>
+					<<set _adsIncome = _DL*random(20,30), $facility.brothel.adsIncome += _adsIncome, _brothelBonuses++>>
+					<<run cashX(_adsIncome, "brothelAds")>>
 					The brothel offers girls @@.yellowgreen;both@@ young and mature.
 				<</if>>
 			<</if>>
@@ -869,7 +884,8 @@
 	<<if _pref == 0>> /*customers don't care*/
 	<<elseif ($brothelAdsSpending > 0) >>
 		<<if (_ads == _pref) && (_girls == _ads)>>
-			<<set _adsIncome = _DL*random(20,30), $cash += _adsIncome, $facility.brothel.adsIncome += _adsIncome, _brothelBonuses++>>
+			<<set _adsIncome = _DL*random(20,30), $facility.brothel.adsIncome += _adsIncome, _brothelBonuses++>>
+			<<run cashX(_adsIncome, "brothelAds")>>
 			Its advertising matches most customers' age preferences and the girls in the brothel match the ages as advertised. Your @@.green;reputation@@ increased slightly as a result.
 			<<set $rep += random(_minBonus,_maxBonus)>>
 		<<elseif (_ads == _pref) && (_girls != _ads)>>
@@ -893,7 +909,8 @@
 
 	<<if (_possibleBonuses > 0) && (_brothelBonuses >= _possibleBonuses)>>
 		<br>&nbsp;&nbsp;&nbsp;&nbsp;
-		<<set _adsIncome = _DL*random(40,60), $cash += _adsIncome, $facility.brothel.adsIncome += _adsIncome>>
+		<<set _adsIncome = _DL*random(40,60), $facility.brothel.adsIncome += _adsIncome>>
+		<<run cashX(_adsIncome, "brothelAds")>>
 		There is a ''@@.yellowgreen;perfect variety@@'' of slave whores working in the brothel.
 	<</if>>
 
diff --git a/src/uncategorized/cellblockReport.tw b/src/uncategorized/cellblockReport.tw
index 95f9bc6e3dd..715c2239ef8 100644
--- a/src/uncategorized/cellblockReport.tw
+++ b/src/uncategorized/cellblockReport.tw
@@ -113,7 +113,8 @@
 		<</if>>
 	<</for>>
 	<<if (_DL < $cellblock)>>
-		<<set _seed = random(1,10)+(($cellblock-_DL)*(random(150,170)+(_idleBonus*10))), $cash += _seed>>
+		<<set _seed = random(1,10)+(($cellblock-_DL)*(random(150,170)+(_idleBonus*10)))>>
+		<<run cashX(_seed, "cellblock", $Wardeness)>>
 		<br>&nbsp;&nbsp;&nbsp;&nbsp;Since $he doesn't have enough prisoners to manage to keep $him busy, $he works on citizens' slaves, earning @@.yellowgreen;<<print cashFormat(_seed)>>.@@
 	<</if>>
 	<<if (_DL > 0)>><br><br><</if>>
diff --git a/src/uncategorized/clinicReport.tw b/src/uncategorized/clinicReport.tw
index 64133a24aca..fbebaa1fb68 100644
--- a/src/uncategorized/clinicReport.tw
+++ b/src/uncategorized/clinicReport.tw
@@ -182,7 +182,8 @@
 		<</if>>
 	<</for>>
 	<<if (_DL < $clinic)>>
-		<<set _seed = random(1,10)+(($clinic-_DL)*(random(150,170)+(_idleBonus*10))), $cash += _seed>>
+		<<set _seed = random(1,10)+(($clinic-_DL)*(random(150,170)+(_idleBonus*10)))>>
+		<<run cashX(_seed, "clinic", $Nurse)>>
 		<br>&nbsp;&nbsp;&nbsp;&nbsp;Since $he doesn't have enough girls to occupy all $his time, the clinic takes in citizens' slaves on a contract basis and $he helps them too, earning @@.yellowgreen;<<print cashFormat(_seed)>>.@@
 	<</if>>
 	<<if (_DL > 0)>><br><br><</if>>
diff --git a/src/uncategorized/clubReport.tw b/src/uncategorized/clubReport.tw
index 377cc769866..7346c103b80 100644
--- a/src/uncategorized/clubReport.tw
+++ b/src/uncategorized/clubReport.tw
@@ -354,7 +354,8 @@
 	<<if _pref == 0>> /*customers don't care*/
 	<<elseif ($clubAdsSpending > 0)>>
 		<<if (_ads == _pref) && (_girls == _ads)>>
-			<<set _adsIncome = _DL*random(20,30), $cash += _adsIncome, $facility.club.adsIncome += _adsIncome, _clubBonuses++>>
+			<<set _adsIncome = _DL*random(20,30), $facility.club.adsIncome += _adsIncome, _clubBonuses++>>
+			<<run cashX(_adsIncome, "clubAds")>>
 			Its advertising for <<if _ads == 1>>stacked <<elseif _ads == -1>>slim <</if>>girls matched most customers' preferences and the girls in the club matched its advertisements. Your @@.green;reputation@@ increased slightly as a result.
 			<<set $rep += random(_minBonus,_maxBonus)>>
 		<<elseif (_ads == _pref) && (_girls != _ads)>>
@@ -421,7 +422,8 @@
 	<<if _pref == 0>> /*customers don't care*/
 	<<elseif ($clubAdsSpending > 0)>>
 		<<if (_ads == _pref) && (_girls == _ads)>>
-			<<set _adsIncome = _DL*random(20,30), $cash += _adsIncome, $facility.club.adsIncome += _adsIncome, _clubBonuses++>>
+			<<set _adsIncome = _DL*random(20,30), $facility.club.adsIncome += _adsIncome, _clubBonuses++>>
+			<<run cashX(_adsIncome, "clubAds")>>
 			Its advertising for <<if _ads == 1>>heavily modded <<elseif _ads == -1>>natural bodied <</if>>girls matched most customers' preferences and the girls in the club matched its advertisements. Your @@.green;reputation@@ increased slightly as a result.
 			<<set $rep += random(_minBonus,_maxBonus)>>
 		<<elseif (_ads == _pref) && (_girls != _ads)>>
@@ -488,7 +490,8 @@
 	<<if _pref == 0>> /*customers don't care*/
 	<<elseif ($clubAdsSpending > 0)>>
 		<<if (_ads == _pref) && (_girls == _ads)>>
-			<<set _adsIncome = _DL*random(20,30), $cash += _adsIncome, $facility.club.adsIncome += _adsIncome, _clubBonuses++>>
+			<<set _adsIncome = _DL*random(20,30), $facility.club.adsIncome += _adsIncome, _clubBonuses++>>
+			<<run cashX(_adsIncome, "clubAds")>>
 			Its advertising for <<if _ads == 1>>implanted or surgically improved <<elseif _ads == -1>>naturally pure <</if>>girls matched most customers' preferences and the girls in the club matched its advertisements. Your @@.green;reputation@@ increased slightly as a result.
 			<<set $rep += random(_minBonus,_maxBonus)>>
 		<<elseif (_ads == _pref) && (_girls != _ads)>>
@@ -554,7 +557,8 @@
 		<<if _pref == 0>> /*customers don't care*/
 		<<elseif ($clubAdsSpending > 0) >>
 			<<if (_ads == _pref) && (_girls == _ads)>>
-				<<set _adsIncome = _DL*random(20,30), $cash += _adsIncome, $facility.club.adsIncome += _adsIncome, _clubBonuses++>>
+				<<set _adsIncome = _DL*random(20,30), $facility.club.adsIncome += _adsIncome, _clubBonuses++>>
+				<<run cashX(_adsIncome, "clubAds")>>
 				Its advertising for girls <<if _ads == 1>>with pussies <<elseif _ads == -1>>with dicks <</if>> matches most customers' preferences as advertised. Your @@.green;reputation@@ increased slightly as a result.
 				<<set $rep += random(_minBonus,_maxBonus)>>
 			<<elseif (_ads == _pref) && (_girls != _ads)>>
@@ -629,7 +633,8 @@
 	<<if _pref == 0>> /*customers don't care*/
 	<<elseif ($clubAdsSpending > 0)>>
 		<<if (_ads == _pref) && (_girls == _ads)>>
-			<<set _adsIncome = _DL*random(20,30), $cash += _adsIncome, $facility.club.adsIncome += _adsIncome, _clubBonuses++>>
+			<<set _adsIncome = _DL*random(20,30), $facility.club.adsIncome += _adsIncome, _clubBonuses++>>
+			<<run cashX(_adsIncome, "clubAds")>>
 			Its advertising matches most customers' age preferences and the girls in the club match the ages as advertised. Your @@.green;reputation@@ increased slightly as a result.
 			<<set $rep += random(_minBonus,_maxBonus)>>
 		<<elseif (_ads == _pref) && (_girls != _ads)>>
@@ -697,7 +702,8 @@
 		<<if (_pref == 0)>> /*customers don't care*/
 		<<elseif ($clubAdsSpending > 0)>>
 			<<if (_ads == _pref) && (_girls == _ads)>>
-				<<set _adsIncome = _DL*random(20,30), $cash += _adsIncome, $facility.club.adsIncome += _adsIncome, _clubBonuses++>>
+				<<set _adsIncome = _DL*random(20,30), $facility.club.adsIncome += _adsIncome, _clubBonuses++>>
+				<<run cashX(_adsIncome, "clubAds")>>
 				Its advertising for <<if _ads == 1>>pregnant <<elseif _ads == -1>>flat-bellied <</if>>girls matched most customers' preferences and the girls in the club matched its advertisements. Your @@.green;reputation@@ increased slightly as a result.
 				<<set $rep += random(_minBonus,_maxBonus)>>
 			<<elseif (_ads == _pref) && (_girls != _ads)>>
diff --git a/src/uncategorized/corporationDevelopments.tw b/src/uncategorized/corporationDevelopments.tw
index c3e4f4356d6..f41ea0798dd 100644
--- a/src/uncategorized/corporationDevelopments.tw
+++ b/src/uncategorized/corporationDevelopments.tw
@@ -119,9 +119,11 @@ Since it is
 <</if>>
 <<if _dividendPerShare >= 0.1>>/share<</if>> was paid out to stockholders; you received @@.yellowgreen;<<if _dividendPerShare >= 0.1>> <<print cashFormat($personalShares*_multplier)>> <<else>> <<print cashFormat(_multplier)>> <</if>>@@.
 <<if _dividendPerShare >= 0.1>>
-	<<set $cash += Math.trunc($personalShares*_multplier), $corpCash -= Math.trunc($personalShares*_multplier)>>
+	<<set $corpCash -= Math.trunc($personalShares*_multplier)>>
+	<<run cashX(Math.trunc($personalShares*_multplier), "stocks")>>
 <<else>>
-	<<set $cash += _multplier, $corpCash -= Math.trunc($corpProfit*0.2)>>
+	<<set $corpCash -= Math.trunc($corpProfit*0.2)>>
+	<<run cashX(_multplier, "stocks")>>
 <</if>>
 
 <<set _roll = random(1,100)>>
@@ -176,7 +178,7 @@ You hold <<print commaNum($personalShares)>> shares valued at @@.yellowgreen;<<p
 		<<link "<<print commaNum(1000)>> valued at @@.yellowgreen;<<print cashFormat(Math.ceil($sharePrice*1000))>>@@">>
 			<<set $personalShares -= 1000>>
 			<<set $publicShares += 1000>>
-			<<set $cash += Math.ceil($sharePrice*1000)>>
+			<<run cashX(Math.ceil($sharePrice*1000), "stocks")>>
 			<<set $sharePrice = (Math.trunc($sharePrice*either(98,99,$PC.trading >= 100 ? 99 : 98)))/100>>
 			<<replace "#CorpAction">>
 				<br>You sold <<print commaNum(1000)>> shares valued at @@.yellowgreen;<<print cashFormat(Math.ceil($sharePrice*1000))>>,@@ driving the share price down slightly.
@@ -186,7 +188,7 @@ You hold <<print commaNum($personalShares)>> shares valued at @@.yellowgreen;<<p
 			| <<link "<<print commaNum(5000)>> valued at @@.yellowgreen;<<print cashFormat(Math.ceil(($sharePrice*5000)*.95))>>@@">>
 				<<set $personalShares -= 5000>>
 				<<set $publicShares += 5000>>
-				<<set $cash += Math.ceil(($sharePrice*5000)*.95)>>
+				<<run cashX(Math.ceil(($sharePrice*5000)*.95), "stocks")>>
 				<<set $sharePrice = (Math.trunc($sharePrice*either(98,99,$PC.trading >= 100 ? 99 : 98)))/100>>
 				<<replace "#CorpAction">>
 					<br>You sold <<print commaNum(5000)>> shares valued at @@.yellowgreen;<<print cashFormat(Math.ceil(($sharePrice*5000)*.95))>>,@@ driving the share price down slightly.
@@ -197,7 +199,7 @@ You hold <<print commaNum($personalShares)>> shares valued at @@.yellowgreen;<<p
 			| <<link "<<print commaNum(10000)>> valued at @@.yellowgreen;<<print cashFormat(Math.ceil(($sharePrice*10000)*.9))>>@@">>
 				<<set $personalShares -= 10000>>
 				<<set $publicShares += 10000>>
-				<<set $cash += Math.ceil(($sharePrice*10000)*.9)>>
+				<<run cashX(Math.ceil(($sharePrice*10000)*.9), "stocks")>>
 				<<set $sharePrice = (Math.trunc($sharePrice*either(98,99,$PC.trading >= 100 ? 99 : 98)))/100>>
 				<<replace "#CorpAction">>
 					<br>You sold <<print commaNum(10000)>> shares valued at @@.yellowgreen;<<print cashFormat(Math.ceil(($sharePrice*10000)*.9))>>,@@ driving the share price down slightly.
@@ -208,7 +210,7 @@ You hold <<print commaNum($personalShares)>> shares valued at @@.yellowgreen;<<p
 			| <<link "<<print commaNum(15000)>> valued at @@.yellowgreen;<<print cashFormat(Math.ceil(($sharePrice*15000)*.85))>>@@">>
 				<<set $personalShares -= 15000>>
 				<<set $publicShares += 15000>>
-				<<set $cash += Math.ceil(($sharePrice*15000)*.85)>>
+				<<run cashX(Math.ceil(($sharePrice*15000)*.85), "stocks")>>
 				<<set $sharePrice = (Math.trunc($sharePrice*either(98,99,$PC.trading >= 100 ? 99 : 98)))/100>>
 				<<replace "#CorpAction">>
 					<br>You sold <<print commaNum(15000)>> shares valued at @@.yellowgreen;<<print cashFormat(Math.ceil(($sharePrice*15000)*.85))>>,@@ driving the share price down somewhat.
@@ -219,7 +221,7 @@ You hold <<print commaNum($personalShares)>> shares valued at @@.yellowgreen;<<p
 			| <<link "<<print commaNum(20000)>> valued at @@.yellowgreen;<<print cashFormat(Math.ceil(($sharePrice*20000)*.8))>>@@">>
 				<<set $personalShares -= 20000>>
 				<<set $publicShares += 20000>>
-				<<set $cash += Math.ceil(($sharePrice*20000)*.8)>>
+				<<run cashX(Math.ceil(($sharePrice*20000)*.8), "stocks")>>
 				<<set $sharePrice = (Math.trunc($sharePrice*either(98,99,$PC.trading >= 100 ? 99 : 98)))/100>>
 				<<replace "#CorpAction">>
 					<br>You sold <<print commaNum(20000)>> shares valued at @@.yellowgreen;<<print cashFormat(Math.ceil(($sharePrice*20000)*.8))>>,@@ driving the share price down significantly.
diff --git a/src/uncategorized/costsBudget.tw b/src/uncategorized/costsBudget.tw
new file mode 100644
index 00000000000..bf99295075e
--- /dev/null
+++ b/src/uncategorized/costsBudget.tw
@@ -0,0 +1,1062 @@
+:: Costs Budget [nobr]
+
+<<set $nextButton = "Back to Main", $nextLink = "Main", _archologyCosts = 0>>
+
+<<if def $lastWeeksCashIncome>>
+	<<set $lastWeeksCashIncome.Total = 0>>
+	<<set $lastWeeksCashExpenses.Total = 0>>
+	<<set $lastWeeksCashProfits.Total = 0>>
+<</if>>
+
+
+<br>
+//Here you can view many of the financial details of your arcology.  A list of details about slaves and their costs (food, hormones) can be found in the "Slave maintenance" link.  Other links will take you to relevant areas of your arcology where costs may be able to be adjusted.  "Actuals" are visible back at the main screen (as "since last week") and listed at the very bottom of this page; they very accurately record the total cash change since the previous week.  The other numbers may have small inaccuracies, and some transactions may not be tracked yet at all, but they should help you keep a finger on the financial pulse of your arcology.
+
+<br style="clear:both" /><<if $lineSeparations == 0>><br><<else>><hr style="margin:0"><</if>>
+<br>
+Your weekly costs are as follows://
+
+/* Table of Totals */
+<<if ndef $lastWeeksCashIncome>>
+	There doesn't see to be financial data available right now.
+<<else>>
+
+<<script>>
+for(var i = 0; i < State.variables.lastWeeksCashIncome.length; i++){
+   State.variables.lastWeeksCashProfits[i] = (State.variables.lastWeeksCashIncome[i] + State.variables.lastWeeksCashExpenses[i]);
+}
+<</script>>
+
+<<set $sillystring = ($lastWeeksCashIncome + $lastWeeksCashExpenses)>>
+
+<style>
+	table.finances {
+		/*table-layout: fixed;*/
+		text-align: right;
+		border-collapse: separate;
+		border-spacing: 5px;
+		border-style: hidden;
+		empty-cells: hide;
+		width: 75%;
+	}
+</style>
+
+	
+<table class="finances" border="1">
+	<tr>
+		<th><h2>Jobs</h2></th>
+		<th>Income</th>
+		<th>Expense</th>
+		<th>Totals</th>
+	</tr>
+	
+	<<if $lastWeeksCashIncome.whore || $lastWeeksCashExpenses.whore>> /* If it's not 0, it will return true. */
+		<tr>
+			<td>Whores</td>
+			<td>$lastWeeksCashIncome.whore</td>
+			<td>$lastWeeksCashExpenses.whore</td>
+			<td>
+				<<set $lastWeeksCashProfits.whore = ($lastWeeksCashIncome.whore + $lastWeeksCashExpenses.whore)>>
+				$lastWeeksCashProfits.whore
+			</td>
+		</tr>
+	<</if>>
+	
+	<<if $lastWeeksCashIncome.rest || $lastWeeksCashExpenses.rest>>
+		<tr>
+			<td>Rests</td>
+			<td>$lastWeeksCashIncome.rest</td>
+			<td>$lastWeeksCashExpenses.rest</td>
+			<td>
+				<<set $lastWeeksCashProfits.rest = ($lastWeeksCashIncome.rest + $lastWeeksCashExpenses.rest)>>
+				$lastWeeksCashProfits.rest
+			</td>
+		</tr>
+	<</if>>
+	
+	<<if $lastWeeksCashIncome.fucktoy || $lastWeeksCashExpenses.fucktoy>>
+		<tr>
+			<td>Fucktoys <<if $Concubine != 0>>including your concubine <</if>>($fuckSlaves slaves)</td>
+			<td>Rep: $lastWeeksCashIncome.fucktoy</td>
+			<td>$lastWeeksCashExpenses.fucktoy</td>
+			<td>
+				<<set $lastWeeksCashProfits.fucktoy = (+ $lastWeeksCashExpenses.fucktoy)>>
+				$lastWeeksCashProfits.fucktoy
+			</td>
+		</tr>
+	<</if>>
+	
+	<<if $lastWeeksCashIncome.subordinateSlave || $lastWeeksCashExpenses.subordinateSlave>>
+		<tr>
+			<td>subordinateSlaves</td>
+			<td>$lastWeeksCashIncome.subordinateSlave</td>
+			<td>$lastWeeksCashExpenses.subordinateSlave</td>
+			<td>
+				<<set $lastWeeksCashProfits.subordinateSlave = ($lastWeeksCashIncome.subordinateSlave + $lastWeeksCashExpenses.subordinateSlave)>>
+				$lastWeeksCashProfits.subordinateSlave
+			</td>
+		</tr>
+	<</if>>
+	
+	<<if $lastWeeksCashIncome.houseServant || $lastWeeksCashExpenses.houseServant>>
+		<tr>
+			<td>HouseServants</td>
+			<td>$lastWeeksCashIncome.houseServant</td>
+			<td>$lastWeeksCashExpenses.houseServant</td>
+			<td>
+				<<set $lastWeeksCashProfits.houseServant = ($lastWeeksCashIncome.houseServant + $lastWeeksCashExpenses.houseServant)>>
+				$lastWeeksCashProfits.houseServant
+			</td>
+		</tr>
+	<</if>>
+	
+	<<if $lastWeeksCashIncome.confined || $lastWeeksCashExpenses.confined>>
+		<tr>
+			<td>Confined</td>
+			<td>$lastWeeksCashIncome.confined</td>
+			<td>$lastWeeksCashExpenses.confined</td>
+			<td>
+				<<set $lastWeeksCashProfits.confined = ($lastWeeksCashIncome.confined + $lastWeeksCashExpenses.confined)>>
+				$lastWeeksCashProfits.confined
+			</td>
+		</tr>
+	<</if>>
+	
+	<<if $lastWeeksCashIncome.publicServant || $lastWeeksCashExpenses.publicServant>>
+		<tr>
+			<td>Public servants</td>
+			<td>Rep: $lastWeeksCashIncome.publicServant</td>
+			<td>$lastWeeksCashExpenses.publicServant</td>
+			<td>
+				<<set $lastWeeksCashProfits.publicServant = ($lastWeeksCashIncome.publicServant + $lastWeeksCashExpenses.publicServant)>>
+				$lastWeeksCashProfits.publicServant
+			</td>
+		</tr>
+	<</if>>	
+	
+	<<if $lastWeeksCashIncome.classes || $lastWeeksCashExpenses.classes>>
+		<tr>
+			<td>Classes</td>
+			<td>$lastWeeksCashIncome.classes</td>
+			<td>$lastWeeksCashExpenses.classes</td>
+			<td>
+				<<set $lastWeeksCashProfits.classes = ($lastWeeksCashIncome.classes + $lastWeeksCashExpenses.classes)>>
+				$lastWeeksCashProfits.classes
+			</td>
+		</tr>
+	<</if>>
+	
+	
+	<<if $lastWeeksCashIncome.milked || $lastWeeksCashExpenses.milked>>
+		<tr>
+			<td>Milked</td> 
+			<td>$lastWeeksCashIncome.milked</td>
+			<td>$lastWeeksCashExpenses.milked</td>
+			<td>
+				<<set $lastWeeksCashProfits.milked = ($lastWeeksCashIncome.milked + $lastWeeksCashExpenses.milked)>>
+				$lastWeeksCashProfits.milked
+			</td>
+		</tr>
+	<</if>>
+	
+	<<if $lastWeeksCashIncome.gloryhole || $lastWeeksCashExpenses.gloryhole>>
+		<tr>
+			<td>Gloryhole</td>
+			<td>$lastWeeksCashIncome.gloryhole</td>
+			<td>$lastWeeksCashExpenses.gloryhole</td>
+			<td>
+				<<set $lastWeeksCashProfits.gloryhole = ($lastWeeksCashIncome.gloryhole + $lastWeeksCashExpenses.gloryhole)>>
+				$lastWeeksCashProfits.gloryhole
+			</td>
+		</tr>
+	<</if>>
+	
+	<tr>
+		<h2>Structures</h2>
+	</tr>	
+
+	<<if $brothel > 0>>
+		<tr>
+			<td>[[$brothelName|Brothel][$nextButton = "Back to Budget", $nextLink = "Costs Budget"]] ($brothelSlaves slaves)</td>
+			<td>$lastWeeksCashIncome.brothel</td>
+			<td>$lastWeeksCashExpenses.brothel</td>
+			<td>
+				<<set $lastWeeksCashProfits.brothel = ($lastWeeksCashIncome.brothel + $lastWeeksCashExpenses.brothel)>>
+				$lastWeeksCashProfits.brothel
+			</td>
+		</tr>
+	<</if>>
+
+	<<if $lastWeeksCashIncome.brothelAds || $lastWeeksCashExpenses.brothelAds>>
+		<tr>
+			<td>[[Brothel Ads|Brothel][$nextButton = "Back to Budget", $nextLink = "Costs Budget"]]</td>
+			<td>$lastWeeksCashIncome.brothelAds</td>
+			<td>$lastWeeksCashExpenses.brothelAds</td>
+			<td>
+				<<set $lastWeeksCashProfits.brothelAds = ($lastWeeksCashIncome.brothelAds + $lastWeeksCashExpenses.brothelAds)>>
+				$lastWeeksCashProfits.brothelAds
+			</td>
+		</tr>
+	<</if>>
+	
+	<<if $club > 0>>
+		<tr>
+			<td>[[$clubName|Club][$nextButton = "Back to Budget", $nextLink = "Costs Budget"]] ($clubSlaves slaves)</td>
+			<td>Rep:$lastWeeksCashIncome.club</td>
+			<td>$lastWeeksCashExpenses.club</td>
+			<td>
+				<<set $lastWeeksCashProfits.club = ($lastWeeksCashIncome.club + $lastWeeksCashExpenses.club)>>
+				$lastWeeksCashProfits.club
+			</td>
+		</tr>
+	<</if>>
+
+	<<if $arcade > 0>>
+	<tr>
+		<td>[[$arcadeName|Arcade][$nextButton = "Back to Budget", $nextLink = "Costs Budget"]] ($arcadeSlaves slaves)</td>
+		<td>$lastWeeksCashIncome.arcade</td>
+		<td>$lastWeeksCashExpenses.arcade</td>
+		<td>
+			<<set $lastWeeksCashProfits.arcade = ($lastWeeksCashIncome.arcade + $lastWeeksCashExpenses.arcade)>>
+			$lastWeeksCashProfits.arcade
+		</td>
+	</tr>
+	<</if>>
+	
+	<<if $dairy > 0>>
+		<tr>
+			<td>[[$dairyName|Dairy][$nextButton = "Back to Budget", $nextLink = "Costs Budget"]] ($dairySlaves slaves)</td>
+			<td>$lastWeeksCashIncome.dairy</td>
+			<td>$lastWeeksCashExpenses.dairy</td>
+			<td>
+				<<set $lastWeeksCashProfits.dairy = ($lastWeeksCashIncome.dairy + $lastWeeksCashExpenses.dairy)>>
+				$lastWeeksCashProfits.dairy
+			</td>
+		</tr>
+	<</if>>
+	
+	<<if ($servantsQuarters > 0) && ($servantsQuartersUpgradeMonitoring > 0)>>	
+		<tr>
+			<td>[[Servants' Quarters][$nextButton = "Back to Budget", $nextLink = "Costs Budget"]] ($servantsQuartersSlaves slaves)</td>
+			<td>$lastWeeksCashIncome.servantsQuarters</td> /*Does not count servants who are serving, only what Stewardess makes.  If I can find savings, perhaps show as negative expense? */
+			<td>$lastWeeksCashExpenses.servantsQuarters</td>
+			<td>
+				<<set $lastWeeksCashProfits.servantsQuarters = ($lastWeeksCashIncome.servantsQuarters + $lastWeeksCashExpenses.servantsQuarters)>>
+				//$lastWeeksCashProfits.servantsQuarters//
+			</td>
+		</tr>
+	<</if>>
+	
+	<<if ($masterSuiteUpgradePregnancy == 1)>>
+		<tr>
+			<td>[[Master Suite][$nextButton = "Back to Budget", $nextLink = "Costs Budget"]] ($masterSuiteSlaves slaves)</td>
+			<td>Rep: $lastWeeksCashIncome.masterSuite</td>
+			<td>$lastWeeksCashExpenses.masterSuite</td>
+			<td>
+				<<set $lastWeeksCashProfits.masterSuite = ($lastWeeksCashIncome.masterSuite + $lastWeeksCashExpenses.masterSuite)>>
+				$lastWeeksCashProfits.masterSuite
+			</td>
+		</tr>
+	<</if>>
+	
+	<<if $schoolroom>>
+		<tr>
+			<td>[[$schoolroomName|Schoolroom][$nextButton = "Back to Budget", $nextLink = "Costs Budget"]] ($schoolroomSlaves slaves)</td>
+			<td>$lastWeeksCashIncome.school</td>
+			<td>$lastWeeksCashExpenses.school</td>
+			<td>
+				<<set $lastWeeksCashProfits.school = ($lastWeeksCashIncome.school + $lastWeeksCashExpenses.school)>>
+				$lastWeeksCashProfits.school
+			</td>
+		</tr>
+	<</if>>
+	
+	<<if $spa>>
+		<tr>
+			<td>[[$spaName|Spa][$nextButton = "Back to Budget", $nextLink = "Costs Budget"]] ($spaSlaves slaves)</td>
+			<td>$lastWeeksCashIncome.spa</td>
+			<td>$lastWeeksCashExpenses.spa</td>
+			<td>
+				<<set $lastWeeksCashProfits.spa = ($lastWeeksCashIncome.spa + $lastWeeksCashExpenses.spa)>>
+				$lastWeeksCashProfits.spa
+			</td>
+		</tr>
+	<</if>>
+	
+	<<if $clinic>>
+		<tr>
+			<td>[[$clinicName|Clinic][$nextButton = "Back to Budget", $nextLink = "Costs Budget"]] ($clinicSlaves slaves)</td>
+			<td>$lastWeeksCashIncome.clinic</td>
+			<td>$lastWeeksCashExpenses.clinic</td>
+			<td>
+				<<set $lastWeeksCashProfits.clinic = ($lastWeeksCashIncome.clinic + $lastWeeksCashExpenses.clinic)>>
+				$lastWeeksCashProfits.clinic
+			</td>
+		</tr>
+	<</if>>
+	
+	<<if $cellblock>>
+		<tr>
+			<td>[[$cellblockName|Cellblock][$nextButton = "Back to Budget", $nextLink = "Costs Budget"]] ($cellblockSlaves slaves)</td>
+			<td>$lastWeeksCashIncome.cellblock</td>
+			<td>$lastWeeksCashExpenses.cellblock</td>
+			<td>
+				<<set $lastWeeksCashProfits.cellblock = ($lastWeeksCashIncome.cellblock + $lastWeeksCashExpenses.cellblock)>>
+				$lastWeeksCashProfits.cellblock
+			</td>
+		</tr>
+	<</if>>
+	
+	<<if $researchLab.built == "true">>
+		<tr>
+			<td>[[Research Lab][$nextButton = "Back to Budget", $nextLink = "Costs Budget"]]: Maintenance</td>
+			<td>$lastWeeksCashIncome.lab</td>
+			<td>
+				<<set $lastWeeksCashExpenses.lab = (100*$researchLab.maxSpace)>>
+				$lastWeeksCashExpenses.lab
+			</td>
+			<td>
+				<<set $lastWeeksCashProfits.lab = ($lastWeeksCashIncome.lab + $lastWeeksCashExpenses.lab)>>
+				$lastWeeksCashProfits.lab
+			</td>
+		</tr>
+		<<if $researchLab.hired != 0>>
+			<tr>
+				<td>[[Research Lab][$nextButton = "Back to Budget", $nextLink = "Costs Budget"]]: ($researchLab.hired scientists)</td>
+				<td></td>
+				<td>
+					<<set $lastWeeksCashExpenses.lab += (300*$researchLab.hired)>>
+					<<print (300*$researchLab.hired)>>
+				</td>
+				<td><<print (300*$researchLab.hired)>></td>
+			</tr>
+		<</if>>
+		<<if $researchLab.menials != 0>>
+			<tr>
+				<td>[[Research Lab][$nextButton = "Back to Budget", $nextLink = "Costs Budget"]]: ($researchLab.menials menial Slaves)</td>
+				<td></td>
+				<td>
+					<<set $lastWeeksCashExpenses.lab += (100*$researchLab.menials)>>
+					<<print (100*$researchLab.menials)>>
+				</td>
+				<td><<print (100*$researchLab.menials)>></td>
+			</tr>
+		<</if>>
+	<</if>>
+
+	<<if $lastWeeksCashIncome.cyberMod || $lastWeeksCashExpenses.cyberMod>>
+		<tr>
+			<td>CyberMod</td>
+			<td>$lastWeeksCashIncome.cyberMod</td>
+			<td>$lastWeeksCashExpenses.cyberMod</td>
+			<td>
+				<<set $lastWeeksCashProfits.cyberMod = ($lastWeeksCashIncome.cyberMod + $lastWeeksCashExpenses.cyberMod)>>
+				$lastWeeksCashProfits.cyberMod
+			</td>
+		</tr>
+	<</if>>
+	
+	<<if $incubator>>
+		<tr>
+			<td>[[$incubatorName|Incubator][$nextButton = "Back to Budget", $nextLink = "Costs Budget"]] ($incubatorSlaves slaves)</td>
+			<td>$lastWeeksCashIncome.incubator</td>
+			<td>$lastWeeksCashExpenses.incubator</td>
+			<td>
+				<<set $lastWeeksCashProfits.incubator = ($lastWeeksCashIncome.incubator + $lastWeeksCashExpenses.incubator)>>
+				$lastWeeksCashProfits.incubator
+			</td>
+		</tr>
+	<</if>>
+
+	<<if $nursery>>
+		<tr>
+			<td>[[$nurseryName|Nursery][$nextButton = "Back to Budget", $nextLink = "Costs Budget"]] ($nurserySlaves slaves)</td>
+			<td>$lastWeeksCashIncome.nursery</td>
+			<td>$lastWeeksCashExpenses.nursery</td>
+			<td>
+				<<set $lastWeeksCashProfits.nursery = ($lastWeeksCashIncome.nursery + $lastWeeksCashExpenses.nursery)>>
+				$lastWeeksCashProfits.nursery
+			</td>
+		</tr>
+	<</if>>
+
+	<<if $farmyard>>
+		<tr>
+			<td>[[$farmyardName|Farmyard][$nextButton = "Back to Budget", $nextLink = "Costs Budget"]] ($farmyardSlaves slaves)</td>
+			<td>$lastWeeksCashIncome.farmyard</td>
+			<td>$lastWeeksCashExpenses.farmyard</td>
+			<td>
+				<<set $lastWeeksCashProfits.farmyard = ($lastWeeksCashIncome.farmyard + $lastWeeksCashExpenses.farmyard)>>
+				$lastWeeksCashProfits.farmyard
+			</td>
+		</tr>
+	<</if>>
+
+	<<if $pit>>
+		<tr>
+			<td>[[$pitName|Pit][$nextButton = "Back to Budget", $nextLink = "Costs Budget"]] ($pitSlaves slaves)</td>
+			<td>$lastWeeksCashIncome.pit</td>
+			<td>$lastWeeksCashExpenses.pit</td>
+			<td>
+				<<set $lastWeeksCashProfits.pit = ($lastWeeksCashIncome.pit + $lastWeeksCashExpenses.pit)>>
+				$lastWeeksCashProfits.pit
+			</td>
+		</tr>
+	<</if>>
+
+	<<if$lastWeeksCashIncome.arcologyImprovement|| $lastWeeksCashExpenses.arcologyImprovement>>
+		<tr>
+			<td>Arcology construction and repair</td>
+			<td>$lastWeeksCashIncome.arcologyImprovement</td>
+			<td>$lastWeeksCashExpenses.arcologyImprovement</td>
+			<td>
+				<<set $lastWeeksCashProfits.arcologyImprovement = ($lastWeeksCashIncome.arcologyImprovement + $lastWeeksCashExpenses.arcologyImprovement)>>
+				$lastWeeksCashProfits.arcologyImprovement
+			</td>
+		</tr>
+	<</if>>
+
+	<<if$lastWeeksCashIncome.environment || $lastWeeksCashExpenses.environment>>
+		<tr>
+			<td>Environment</td>
+			<td>$lastWeeksCashIncome.environment</td>
+			<td>$lastWeeksCashExpenses.environment</td>
+			<td>
+				<<set $lastWeeksCashProfits.environment = ($lastWeeksCashIncome.environment + $lastWeeksCashExpenses.environment)>>
+				$lastWeeksCashProfits.environment
+			</td>
+		</tr>
+	<</if>>
+
+	<<if $lastWeeksCashIncome.weather || $lastWeeksCashExpenses.weather>>
+		<tr>
+			<td>Weather</td>
+			<td>$lastWeeksCashIncome.weather</td>
+			<td>$lastWeeksCashExpenses.weather</td>
+			<td>
+				<<set $lastWeeksCashProfits.weather = ($lastWeeksCashIncome.weather + $lastWeeksCashExpenses.weather)>>
+				$lastWeeksCashProfits.weather
+			</td>
+		</tr>
+	<</if>>
+
+	
+	<tr>
+		<h2>Slaves</h2>
+	</tr>
+	
+	<tr>
+		<td>[[Slave maintenance|Costs Report][$nextButton = "Back to Budget", $nextLink = "Costs Budget"]] (food, hormones) ($slaves.length slaves)</td>
+		<td>$lastWeeksCashIncome.slaveUpkeep</td>
+		<td>$lastWeeksCashExpenses.slaveUpkeep</td>
+		<td>
+			<<set $lastWeeksCashProfits.slaveUpkeep = ($lastWeeksCashIncome.slaveUpkeep + $lastWeeksCashExpenses.slaveUpkeep)>>
+			$lastWeeksCashProfits.slaveUpkeep
+		</td>
+	</tr>
+	
+	<<if $lastWeeksCashIncome.extraMilk || $lastWeeksCashExpenses.extraMilk>>
+		<tr>
+			<td>Extra Milk</td>
+			<td>$lastWeeksCashIncome.extraMilk</td>
+			<td>$lastWeeksCashExpenses.extraMilk</td>
+			<td>$lastWeeksCashIncome.extraMilk
+				<<set $lastWeeksCashProfits.extraMilk = ($lastWeeksCashIncome.extraMilk + $lastWeeksCashExpenses.extraMilk)>>
+				$lastWeeksCashProfits.extraMilk
+			</td>
+		</tr>
+	<</if>>
+
+	<<if $lastWeeksCashIncome.extraMilk || $lastWeeksCashExpenses.extraMilk>>
+		<tr>
+			<td>Extra Milk</td>
+			<td>$lastWeeksCashIncome.extraMilk</td>
+			<td>$lastWeeksCashExpenses.extraMilk</td>
+			<td>$lastWeeksCashIncome.extraMilk
+				<<set $lastWeeksCashProfits.extraMilk = ($lastWeeksCashIncome.extraMilk + $lastWeeksCashExpenses.extraMilk)>>
+				$lastWeeksCashProfits.extraMilk
+			</td>
+		</tr>
+	<</if>>
+	<<if $marketAssistantLimit>>
+		<tr>
+			<td>Menials: [[Assistant's|Personal assistant options][$nextButton = "Back to Budget", $nextLink = "Costs Budget"]] flipping</td>
+			<td>$lastWeeksCashIncome.menialTradesTransfer</td>
+			<td>$lastWeeksCashExpenses.menialTradesTransfer</td>
+			<td>
+				<<set $lastWeeksCashProfits.menialTradesTransfer = ($lastWeeksCashIncome.menialTradesTransfer + $lastWeeksCashExpenses.menialTradesTransfer)>>
+				$lastWeeksCashProfits.menialTradesTransfer
+			</td>
+		</tr>
+	<</if>>
+
+	<<if ($lastWeeksCashIncome.menialTrades) || ($lastWeeksCashExpenses.menialTrades)>>
+		<tr>
+			<td>Menials: labor</td>
+			<td>$lastWeeksCashIncome.menialTrades</td>
+			<td>$lastWeeksCashExpenses.menialTrades</td>
+			<td>
+				<<set $lastWeeksCashProfits.menialTrades = ($lastWeeksCashIncome.menialTrades + $lastWeeksCashExpenses.menialTrades)>>
+				$lastWeeksCashProfits.menialTrades
+			</td>
+		</tr>
+	<</if>>
+
+	<<if $lastWeeksCashIncome.fuckdolls || $lastWeeksCashExpenses.fuckdolls>>
+		<tr>
+			<td>Fuckdolls</td>
+			<td>$lastWeeksCashIncome.fuckdolls</td>
+			<td>$lastWeeksCashExpenses.fuckdolls</td>
+			<td>$lastWeeksCashIncome.fuckdolls
+				<<set $lastWeeksCashProfits.fuckdolls = ($lastWeeksCashIncome.fuckdolls + $lastWeeksCashExpenses.fuckdolls)>>
+				$lastWeeksCashProfits.fuckdolls
+			</td>
+		</tr>
+	<</if>>
+
+	<<if ($lastWeeksCashIncome.menialBioreactors) || ($lastWeeksCashExpenses.menialBioreactors)>>
+		<tr>
+			<td>Menials: bioreactors</td>
+			<td>$lastWeeksCashIncome.menialBioreactors</td>
+			<td>$lastWeeksCashExpenses.menialBioreactors</td>
+			<td>
+				<<set $lastWeeksCashProfits.menialBioreactors = ($lastWeeksCashIncome.menialBioreactors + $lastWeeksCashExpenses.menialBioreactors)>>
+				$lastWeeksCashProfits.menialBioreactors
+			</td>
+		</tr>
+	<</if>>
+
+	<<if ($lastWeeksCashIncome.fuckDollBioFactory) || ($lastWeeksCashExpenses.fuckDollBioFactory)>>
+		<tr>
+			<td>Menials: labor</td>
+			<td>$lastWeeksCashIncome.fuckDollBioFactory</td>
+			<td>$lastWeeksCashExpenses.fuckDollBioFactory</td>
+			<td>
+				<<set $lastWeeksCashProfits.fuckDollBioFactory = ($lastWeeksCashIncome.fuckDollBioFactory + $lastWeeksCashExpenses.fuckDollBioFactory)>>
+				$lastWeeksCashProfits.fuckDollBioFactory
+			</td>
+		</tr>
+	<</if>>
+	
+
+
+	<<if $lastWeeksCashIncome.porn || $lastWeeksCashExpenses.porn>>
+		<tr>
+			<td>Porn</td>
+			<td>$lastWeeksCashIncome.porn</td>
+			<td>$lastWeeksCashExpenses.porn</td>
+			<td>$lastWeeksCashIncome.porn
+				<<set $lastWeeksCashProfits.porn = ($lastWeeksCashIncome.porn + $lastWeeksCashExpenses.porn)>>
+				$lastWeeksCashProfits.porn
+			</td>
+		</tr>
+	<</if>>
+
+	<<if $lastWeeksCashIncome.recruiter || $lastWeeksCashExpenses.recruiter>>
+		<tr>
+			<td>Recruiter</td>
+			<td>$lastWeeksCashIncome.recruiter</td>
+			<td>$lastWeeksCashExpenses.recruiter</td>
+			<td>$lastWeeksCashIncome.recruiter
+				<<set $lastWeeksCashProfits.recruiter = ($lastWeeksCashIncome.recruiter + $lastWeeksCashExpenses.recruiter)>>
+				$lastWeeksCashProfits.recruiter
+			</td>
+		</tr>
+	<</if>>
+
+
+	
+	<<if $lastWeeksCashIncome.slaveTransfer || $lastWeeksCashExpenses.slaveTransfer>>
+		<tr>
+			<td>Buying/Selling Major Slaves</td>
+			<td>$lastWeeksCashIncome.slaveTransfer</td>
+			<td>$lastWeeksCashExpenses.slaveTransfer</td>
+			<td>$lastWeeksCashIncome.slaveTransfer
+				<<set $lastWeeksCashProfits.slaveTransfer = ($lastWeeksCashIncome.slaveTransfer + $lastWeeksCashExpenses.slaveTransfer)>>
+				$lastWeeksCashProfits.slaveTransfer
+			</td>
+		</tr>
+	<</if>>
+
+	<<if $lastWeeksCashIncome.fuckdollsTransfer || $lastWeeksCashExpenses.fuckdollsTransfer>>
+		<tr>
+			<td>Buying/Selling Fuckdolls</td>
+			<td>$lastWeeksCashIncome.fuckdollsTransfer</td>
+			<td>$lastWeeksCashExpenses.fuckdollsTransfer</td>
+			<td>$lastWeeksCashIncome.fuckdollsTransfer
+				<<set $lastWeeksCashProfits.fuckdollsTransfer = ($lastWeeksCashIncome.fuckdollsTransfer + $lastWeeksCashExpenses.fuckdollsTransfer)>>
+				$lastWeeksCashProfits.fuckdollsTransfer
+			</td>
+		</tr>
+	<</if>>
+
+	<<if $lastWeeksCashIncome.menialRetirement || $lastWeeksCashExpenses.menialRetirement>>
+		<tr>
+			<td>Menials retiring</td>
+			<td>$lastWeeksCashIncome.menialRetirement</td>
+			<td>$lastWeeksCashExpenses.menialRetirement</td>
+			<td>$lastWeeksCashIncome.menialRetirement
+				<<set $lastWeeksCashProfits.menialRetirement = ($lastWeeksCashIncome.menialRetirement + $lastWeeksCashExpenses.menialRetirement)>>
+				$lastWeeksCashProfits.menialRetirement
+			</td>
+		</tr>
+	<</if>>
+
+	<<if $lastWeeksCashIncome.slaveSurgery || $lastWeeksCashExpenses.slaveSurgery>>
+		<tr>
+			<td>Slave Surgery</td>
+			<td>$lastWeeksCashIncome.slaveSurgery</td>
+			<td>$lastWeeksCashExpenses.slaveSurgery</td>
+			<td>$lastWeeksCashIncome.slaveSurgery
+				<<set $lastWeeksCashProfits.slaveSurgery = ($lastWeeksCashIncome.slaveSurgery + $lastWeeksCashExpenses.slaveSurgery)>>
+				$lastWeeksCashProfits.slaveSurgery
+			</td>
+		</tr>
+	<</if>>
+
+	<<if $lastWeeksCashIncome.birth || $lastWeeksCashExpenses.birth>>
+		<tr>
+			<td>Slave Surgery</td>
+			<td>$lastWeeksCashIncome.birth</td>
+			<td>$lastWeeksCashExpenses.birth</td>
+			<td>$lastWeeksCashIncome.birth
+				<<set $lastWeeksCashProfits.birth = ($lastWeeksCashIncome.birth + $lastWeeksCashExpenses.birth)>>
+				$lastWeeksCashProfits.birth
+			</td>
+		</tr>
+	<</if>>
+
+
+	<tr>
+		<h2>Finance</h2>
+	</tr>
+	
+	<<if $lastWeeksCashIncome.PCtraining || $lastWeeksCashExpenses.PCtraining>>
+		<tr>
+			<td>Your training</td>
+			<td>$lastWeeksCashIncome.PCtraining</td>
+			<td>$lastWeeksCashExpenses.PCtraining</td>
+			<td>
+				<<set $lastWeeksCashProfits.PCtraining = ($lastWeeksCashIncome.PCtraining + $lastWeeksCashExpenses.PCtraining)>>
+				$lastWeeksCashProfits.PCtraining
+			</td>
+		</tr>
+	<</if>>
+
+	<<if $lastWeeksCashIncome.PCmedical || $lastWeeksCashExpenses.PCmedical>>
+		<tr>
+			<td>Your medical expenses</td>
+			<td>$lastWeeksCashIncome.PCmedical</td>
+			<td>$lastWeeksCashExpenses.PCmedical</td>
+			<td>
+				<<set $lastWeeksCashProfits.PCmedical = ($lastWeeksCashIncome.PCmedical + $lastWeeksCashExpenses.PCmedical)>>
+				$lastWeeksCashProfits.PCmedical
+			</td>
+		</tr>
+	<</if>>
+
+	<<if $lastWeeksCashIncome.PCskills || $lastWeeksCashExpenses.PCskills>>
+		<tr>
+			<td>Your skills</td>
+			<td>$lastWeeksCashIncome.PCskills</td>
+			<td>$lastWeeksCashExpenses.PCskills</td>
+			<td>
+				<<set $lastWeeksCashProfits.PCskills = ($lastWeeksCashIncome.PCskills + $lastWeeksCashExpenses.PCskills)>>
+				$lastWeeksCashProfits.PCskills
+			</td>
+		</tr>
+	<</if>>
+
+	<tr>
+		<td>
+			Your rents
+			<<if $lastWeeksCashExpenses.rents > 0>>
+				(and bribes)
+			<</if>>
+		</td>
+		<td>$lastWeeksCashIncome.rents</td>
+		<td>$lastWeeksCashExpenses.rents</td>
+		<td>
+			<<set $lastWeeksCashIncome.rents = ($lastWeeksCashIncome.rents + $lastWeeksCashExpenses.rents)>>
+			$lastWeeksCashIncome.rents
+		</td>
+	</tr>
+
+	<<if $lastWeeksCashIncome.stocks || $personalShares > 0>>
+		<tr>
+			<td>Stock income ($personalShares/<<print ($publicShares + $personalShares)>> shares):</td>
+			<td>$lastWeeksCashIncome.stocks</td>
+			<td>$lastWeeksCashExpenses.stocks</td>
+			<td>
+				<<set $lastWeeksCashProfits.stocks = ($lastWeeksCashIncome.stocks + $lastWeeksCashExpenses.stocks)>>
+				$lastWeeksCashProfits.stocks
+			</td>
+		</tr>
+	<</if>>
+
+	<<if $lastWeeksCashIncome.stocksBought|| $lastWeeksCashExpenses.stocksBought>>
+		<tr>
+			<td>Stock trading</td>
+			<td>$lastWeeksCashIncome.stocksBought</td>
+			<td>$lastWeeksCashExpenses.stocksBought</td>
+			<td>
+				<<set $lastWeeksCashProfits.stocksBought = ($lastWeeksCashIncome.stocksBought + $lastWeeksCashExpenses.stocksBought)>>
+				$lastWeeksCashProfits.stocksBought
+			</td>
+		</tr>
+	<</if>>
+
+	<<if $lastWeeksCashIncome.fines || $lastWeeksCashExpenses.fines>>
+		<tr>
+			<td>Fines</td>
+			<td>$lastWeeksCashIncome.fines</td>
+			<td>$lastWeeksCashExpenses.fines</td>
+			<td>
+				<<set $lastWeeksCashProfits.fines = ($lastWeeksCashIncome.fines + $lastWeeksCashExpenses.fines)>>
+				$lastWeeksCashProfits.fines
+			</td>
+		</tr>
+	<</if>>
+
+	<<if $lastWeeksCashIncome.event || $lastWeeksCashExpenses.event>>
+		<tr>
+			<td>Events</td>
+			<td>$lastWeeksCashIncome.event</td>
+			<td>$lastWeeksCashExpenses.event</td>
+			<td>
+				<<set $lastWeeksCashProfits.event = ($lastWeeksCashIncome.event + $lastWeeksCashExpenses.event)>>
+				$lastWeeksCashProfits.event
+			</td>
+		</tr>
+	<</if>>
+
+	<<if $lastWeeksCashIncome.war || $lastWeeksCashExpenses.war>>
+		<tr>
+			<td>Archology conflict</td>
+			<td>$lastWeeksCashIncome.war</td>
+			<td>$lastWeeksCashExpenses.war</td>
+			<td>
+				<<set $lastWeeksCashProfits.war = ($lastWeeksCashIncome.war + $lastWeeksCashExpenses.war)>>
+				$lastWeeksCashProfits.war
+			</td>
+		</tr>
+	<</if>>
+
+	<<if $lastWeeksCashIncome.cheating || $lastWeeksCashExpenses.cheating>>
+		<tr>
+			<td>CHEATING</td>
+			<td>$lastWeeksCashIncome.cheating</td>
+			<td>$lastWeeksCashExpenses.cheating</td>
+			<td>
+				<<set $lastWeeksCashProfits.cheating = ($lastWeeksCashIncome.cheating + $lastWeeksCashExpenses.cheating)>>
+				$lastWeeksCashProfits.cheating
+			</td>
+		</tr>
+	<</if>>
+	
+	<tr>
+		<h2>Policies</h2>
+	</tr>	
+	
+	<tr>
+		<<if $girls == 3>>
+			<td>Since you are accustomed to luxury, your personal living expenses are:</td>
+		<<elseif $girls == 2>>
+			<td>Since you are used to living well, your personal living expenses are:</td>
+		<<else>>
+			<td>Since you are used to a fairly normal life, your personal living expenses are:</td>
+		<</if>>
+			<td>$lastWeeksCashIncome.personalBusiness</td>
+			<td>$lastWeeksCashExpenses.personalBusiness</td>
+			<td>
+				<<set $lastWeeksCashProfits.personalBusiness = ($lastWeeksCashIncome.personalBusiness + $lastWeeksCashExpenses.personalBusiness)>>
+				$lastWeeksCashProfits.personalBusiness
+			</td>
+	</tr>
+	
+	<<if $citizenOrphanageTotal > 0>>
+		<tr>
+			<td>Education of $citizenOrphanageTotal of your slaves' children in citizen schools</td>
+			<td>$lastWeeksCashIncome.citizenOrphanage</td>
+			<td>$lastWeeksCashExpenses.citizenOrphanage</td>
+			<td>
+				<<set $lastWeeksCashProfits.citizenOrphanage = ($lastWeeksCashIncome.citizenOrphanage + $lastWeeksCashExpenses.citizenOrphanage)>>
+				$lastWeeksCashProfits.citizenOrphanage
+			</td>
+		</tr>
+	<</if>>
+
+	<<if $privateOrphanageTotal > 0>>
+		<tr>
+			<td>Private tutelage of $privateOrphanageTotal of your slaves' children</td>
+			<td>$lastWeeksCashIncome.privateOrphanage</td>
+			<td>$lastWeeksCashExpenses.privateOrphanage</td>
+			<td>
+				<<set $lastWeeksCashProfits.privateOrphanage = ($lastWeeksCashIncome.privateOrphanage + $lastWeeksCashExpenses.privateOrphanage)>>
+				$lastWeeksCashProfits.privateOrphanage
+			</td>
+		</tr>
+	<</if>>
+	
+	<<if $mercenaries > 0>>
+		<tr>
+			<td>Security: [[$mercenariesTitle|Barracks][$nextButton = "Back to Budget", $nextLink = "Costs Budget"]]
+			<<if $barracks>><<else>><br>//@@.red;Cost increased by the lack of a barracks.@@//<</if>>
+			<<if ($PC.warfare >= 100) || ($PC.career == "arcology owner")>><br>//Cost reduced by your @@.springgreen;mercenary contacts.@@//<</if>>
+			</td>
+			<td>$lastWeeksCashIncome.mercenaries</td>
+			<td>$lastWeeksCashExpenses.mercenaries</td>
+			<td>
+				<<set $lastWeeksCashProfits.mercenaries = ($lastWeeksCashIncome.mercenaries + $lastWeeksCashExpenses.mercenaries)>>
+				$lastWeeksCashProfits.mercenaries
+			</td>
+		</tr>
+	<</if>>
+	
+	<<if $lastWeeksCashIncome.securityExpansion || $lastWeeksCashExpenses.securityExpansion>>
+		<tr>
+			<td>Security Expansion</td>
+			<td>$lastWeeksCashIncome.securityExpansion</td>
+			<td>$lastWeeksCashExpenses.securityExpansion</td>
+			<td>
+				<<set $lastWeeksCashProfits.securityExpansion = ($lastWeeksCashIncome.securityExpansion + $lastWeeksCashExpenses.securityExpansion)>>
+				$lastWeeksCashProfits.securityExpansion
+			</td>
+		</tr>
+	<</if>>
+
+	<<if $lastWeeksCashIncome.specialForces || $lastWeeksCashExpenses.specialForces>>
+		<tr>
+			<td>Special Forces</td>
+			<td>$lastWeeksCashIncome.specialForces</td>
+			<td>$lastWeeksCashExpenses.specialForces</td>
+			<td>
+				<<set $lastWeeksCashProfits.specialForces = ($lastWeeksCashIncome.specialForces + $lastWeeksCashExpenses.specialForces)>>
+				$lastWeeksCashProfits.specialForces
+			</td>
+		</tr>
+	<</if>>
+	
+	<<if $securityForceActive > 0>>
+		<tr>
+			<td>Acquisitions: [[$securityForceName|SFM Barracks][$nextButton = "Back to Budget", $nextLink = "Costs Budget"]]</td>
+			<td>$lastWeeksCashIncome.mercenaries</td>
+			<td>$lastWeeksCashExpenses.mercenaries</td>
+			<td>
+				<<set $lastWeeksCashProfits.mercenaries = ($lastWeeksCashIncome.mercenaries + $lastWeeksCashExpenses.mercenaries)>>
+				$lastWeeksCashProfits.mercenaries
+			</td>
+		</tr>
+	<</if>>
+	
+	<<if (def $peacekeepers) and ($peacekeepers != 0) >>
+		<<if $peacekeepers.undermining != 0>>
+			<tr>
+				<td>Undermine political support for the nearby old world peacekeeping mission.</td>
+				<td>$lastWeeksCashIncome.peacekeepers</td>
+				<td>$lastWeeksCashExpenses.peacekeepers</td>
+				<td>
+					<<set $lastWeeksCashProfits.peacekeepers = ($lastWeeksCashIncome.peacekeepers + $lastWeeksCashExpenses.peacekeepers)>>
+					$lastWeeksCashProfits.peacekeepers
+				</td>
+			</tr>
+		<</if>>
+	<</if>>
+	
+	<<if $FSSpending != 0>>
+		<tr>
+			<td>[[Society Shaping|Future Society][$nextButton = "Back to Budget", $nextLink = "Costs Budget"]]</td>
+			<td>$lastWeeksCashIncome.futureSocieties</td>
+			<td>$lastWeeksCashExpenses.futureSocieties</td>
+			<td>
+				<<set $lastWeeksCashProfits.futureSocieties = ($lastWeeksCashIncome.futureSocieties + $lastWeeksCashExpenses.futureSocieties)>>
+				$lastWeeksCashProfits.futureSocieties
+			</td>
+		</tr>
+	<</if>>
+
+	<<if $lastWeeksCashIncome.capEx || $lastWeeksCashExpenses.capEx>>
+		<tr>
+			<td>Capital Expenses</td>
+			<td>$lastWeeksCashIncome.capEx</td>
+			<td>$lastWeeksCashExpenses.capEx</td>
+			<td>
+				<<set $lastWeeksCashProfits.capEx = ($lastWeeksCashIncome.capEx + $lastWeeksCashExpenses.capEx)>>
+				$lastWeeksCashProfits.capEx
+			</td>
+		</tr>
+	<</if>>
+	
+	<<if $lastWeeksCashIncome.recruiter || $lastWeeksCashExpenses.recruiter>>
+		<tr>
+			<td>__Recruiting__</td>
+			<td>$lastWeeksCashIncome.recruiter</td>
+			<td>$lastWeeksCashExpenses.recruiter</td>
+			<td>
+				<<set $lastWeeksCashProfits.recruiter = ($lastWeeksCashIncome.recruiter + $lastWeeksCashExpenses.recruiter)>>
+				$lastWeeksCashProfits.recruiter
+			</td>
+		</tr>	
+	<</if>>
+	
+		<<if $lastWeeksCashIncome.schoolBacking || $lastWeeksCashExpenses.schoolBacking>>
+			<tr>
+				<td>
+					<<if $TSS.subsidize != 0>>[[The Slavegirl School|Policies][$nextButton = "Back to Budget", $nextLink = "Costs Budget"]] branch campus influence </td>
+					<<elseif $GRI.subsidize != 0>>[[Growth Research Institute|Policies][$nextButton = "Back to Budget", $nextLink = "Costs Budget"]] subsidiary lab influence </td>
+					<<elseif $SCP.subsidize != 0>>[[St. Claver Preparatory|Policies][$nextButton = "Back to Budget", $nextLink = "Costs Budget"]] branch campus influence </td>
+					<<elseif $LDE.subsidize != 0>>>[[L'Encole des Enculees|Policies][$nextButton = "Back to Budget", $nextLink = "Costs Budget"]] branch campus influence </td>
+					<<elseif $TGA.subsidize != 0>>>[[The Gymnasium-Academy|Policies][$nextButton = "Back to Budget", $nextLink = "Costs Budget"]] branch campus influence </td>
+					<<elseif $TFS.subsidize != 0>>[[The Futanari Sisters|Policies][$nextButton = "Back to Budget", $nextLink = "Costs Budget"]] community influence </td>
+					<<elseif $TSS.schoolPresent == 1>>[[The Slavegirl School|Policies][$nextButton = "Back to Budget", $nextLink = "Costs Budget"]] branch campus upkeep
+					<<elseif $GRI.schoolPresent == 1>>[[Growth Research Institute|Policies][$nextButton = "Back to Budget", $nextLink = "Costs Budget"]] subsidiary lab upkeep </td>
+					<<elseif $SCP.schoolPresent == 1>>[[St. Claver Preparatory|Policies][$nextButton = "Back to Budget", $nextLink = "Costs Budget"]] branch campus upkeep </td>
+					<<elseif $LDE.schoolPresent == 1>>[[L'Encole des Enculees|Policies][$nextButton = "Back to Budget", $nextLink = "Costs Budget"]] branch campus upkeep </td>
+					<<elseif $TGA.schoolPresent == 1>>>[[The Gymnasium-Academy|Policies][$nextButton = "Back to Budget", $nextLink = "Costs Budget"]] branch campus upkeep </td>
+					<<elseif ($TFS.schoolPresent == 1) && (($PC.dick == 0) || ($PC.vagina == 0) || ($PC.boobs == 0))>>[[The Futanari Sisters|Policies][$nextButton = "Back to Budget", $nextLink = "Costs Budget"]] community upkeep </td>
+					<</if>>
+				</td>
+				<td>$lastWeeksCashIncome.schoolBacking</td>
+				<td>$lastWeeksCashExpenses.schoolBacking</td>
+				<td>
+					<<set $lastWeeksCashProfits.schoolBacking = ($lastWeeksCashIncome.schoolBacking + $lastWeeksCashExpenses.schoolBacking)>>
+					$lastWeeksCashProfits.schoolBacking
+				</td>
+			</tr>	
+		<</if>>
+
+	
+	
+	/* old way, guessing records.  Very granular though.
+	
+	<<set _policyCost = 0>>
+	<<if $alwaysSubsidizeGrowth == 1>>
+		<<set _policyCost += $policyCost>>
+		<tr><td>[[Weekly arcology growth subsidy|Policies][$nextButton = "Back to Budget", $nextLink = "Costs Budget"]] 
+		$policyCost</td></tr>
+	<</if>>
+	<<if $alwaysSubsidizeRep == 1>>
+		<<set _policyCost += $policyCost>>
+		<tr><td>[[Weekly self-promotion budget|Policies][$nextButton = "Back to Budget", $nextLink = "Costs Budget"]] 
+		$policyCost</td></tr>
+	<</if>>
+	<<if $RegularParties == 1>>
+		<<set _policyCost += $policyCost>>
+		<tr><td>[[Weekly social gatherings|Policies][$nextButton = "Back to Budget", $nextLink = "Costs Budget"]]</td>
+		<td></td>
+		<td>$policyCost</td></tr>
+	<</if>>
+
+	<<if $ProImmigrationCash == 1>>
+		<<set _policyCost += $policyCost>>
+		<tr><td>[[Pro-immigration promotion budget|Policies][$nextButton = "Back to Budget", $nextLink = "Costs Budget"]]</td>
+		<td></td>
+		<td>$policyCost</td></tr>
+	<</if>>
+	<<if $AntiEnslavementCash == 1>>
+		<<set _policyCost += $policyCost>>
+		<tr><td>[[Anti-enslavement charity budget|Policies][$nextButton = "Back to Budget", $nextLink = "Costs Budget"]]</td>
+		<td></td>
+		<td>$policyCost</td></tr>
+	<</if>>
+	
+	<<set _coursingCost = 0>>
+	<<if $CoursingAssociation == 1>>
+		<<set _coursingCost += 1000>>
+		<tr><td>[[Coursing Association membership|Policies][$nextButton = "Back to Budget", $nextLink = "Costs Budget"]]</td>
+		<td></td>
+		<td>_coursingCost</td>
+		<td>_coursingCost</td></tr>
+	<</if>>*/
+
+	<<if $lastWeeksCashIncome.policies || $lastWeeksCashExpenses.policies>>
+		<tr>
+			<td>[[Policies|Policies][$nextButton = "Back to Budget", $nextLink = "Costs Budget"]]</td>
+			<td>$lastWeeksCashIncome.policies</td>
+			<td>$lastWeeksCashExpenses.policies</td>
+			<td>
+				<<set $lastWeeksCashProfits.policies = ($lastWeeksCashIncome.policies + $lastWeeksCashExpenses.policies)>>
+				$lastWeeksCashProfits.policies
+			</td>
+		</tr>	
+	<</if>>
+
+	<<if $lastWeeksCashIncome.PCtraining || $lastWeeksCashExpenses.PCtraining>>
+		<tr>
+			<td>
+				<<if ($personalAttention == "trading")>>
+					[[Trading trainer|Personal Attention Select][$nextButton = "Back to Budget", $nextLink = "Costs Budget"]] fees
+				<<elseif ($personalAttention == "warfare")>>
+					[[Warfare trainer|Personal Attention Select][$nextButton = "Back to Budget", $nextLink = "Costs Budget"]] fees
+				<<elseif ($personalAttention == "slaving")>>
+					[[Slaving trainer|Personal Attention Select][$nextButton = "Back to Budget", $nextLink = "Costs Budget"]] fees
+				<<elseif ($personalAttention == "engineering")>>
+					[[Engineering trainer|Personal Attention Select][$nextButton = "Back to Budget", $nextLink = "Costs Budget"]] fees
+				<<elseif ($personalAttention == "medicine")>>
+					[[Medicine trainer|Personal Attention Select][$nextButton = "Back to Budget", $nextLink = "Costs Budget"]] fees
+				<</if>>
+			</td>
+			<td>$lastWeeksCashIncome.PCtraining</td>
+			<td>$lastWeeksCashExpenses.PCtraining</td>
+			<td>
+				<<set $lastWeeksCashProfits.PCtraining = ($lastWeeksCashIncome.PCtraining + $lastWeeksCashExpenses.PCtraining)>>
+				$lastWeeksCashProfits.PCtraining
+			</td>
+		</tr>	
+	<</if>>
+	
+
+	<tr><td></td></tr>
+	<tr>
+		<td>Totals</td>	
+		<td>
+			<<set $lastWeeksCashIncome.Total = hashSum($lastWeeksCashIncome)>>
+			$lastWeeksCashIncome.Total
+		</td>
+		
+		<td>
+			<<set $lastWeeksCashExpenses.Total = hashSum($lastWeeksCashExpenses)>>
+			$lastWeeksCashExpenses.Total
+		</td>
+		<td>
+			<<set $lastWeeksCashProfits.Total  = ($lastWeeksCashIncome.Total + $lastWeeksCashExpenses.Total)
+			>>
+			$lastWeeksCashProfits.Total
+			<br>
+			<<print ($lastWeeksCashIncome.Total +$lastWeeksCashExpenses.Total)>>
+		</td>
+	</tr>
+	<tr><td></td></tr>
+	<tr>
+		<td>Last week actuals</td>
+		<td></td>
+		<td>$costs</td>
+		<td><<print ($cash-$cashLastWeek)>></td>	
+	</tr>
+		<tr>
+		<td>Transaction tracking off by:</td>
+		<td></td>
+		<td><<print ($lastWeeksCashExpenses.Total + $costs)>></td>
+		<td><<print off: ($lastWeeksCashProfits.Total - ($cash-$cashLastWeek))>></td>	
+	</tr>
+
+</table>
+
+<br>
+
+<table> /* long entries */
+
+
+</table>
+<</if>>
+
+<<if ndef $lastWeeksErrors>>
+	<<set $lastWeeksErrors = "Errors:">>
+<</if>>
+
+<<if $lastWeeksErrors !== "Errors:">>
+	<<link "Reset">> 
+		<<set $lastWeeksErrors = "Errors:">>
+	<</link>>
+	@@.red;<<print $lastWeeksErrors>>@@
+<</if>>
\ No newline at end of file
diff --git a/src/uncategorized/costsReport.tw b/src/uncategorized/costsReport.tw
index 595557f25fb..e8d009de4a6 100644
--- a/src/uncategorized/costsReport.tw
+++ b/src/uncategorized/costsReport.tw
@@ -1,6 +1,10 @@
 :: Costs Report [nobr]
 
+<<<<<<< HEAD
 <<set $nextButton = "Back to Main", $nextLink = "Main",_arcologyCosts = 0>>
+=======
+<<set $nextButton = "Back to Budget", $nextLink = "Costs Budget",_archologyCosts = 0>>
+>>>>>>> First Stage of the budget screen, should have most of the good stuff
 <<if $PCSlutContacts == 0>><<set $PCSlutContacts = 1>><</if>>
 
 //Your weekly costs are as follows.//
@@ -420,6 +424,7 @@ $nursery > 0 || $masterSuiteUpgradePregnancy > 0 || $incubator > 0 ||
 
 <<set _total = 0>> <<set _SL = $slaves.length>>
 <<for $i = 0; $i < _SL; $i++>>
+<<<<<<< HEAD
 <<set _individualCosts = 0>>
 	''$slaves[$i].slaveName'':
 	<<switch $slaves[$i].assignment>>
@@ -814,6 +819,15 @@ $nursery > 0 || $masterSuiteUpgradePregnancy > 0 || $incubator > 0 ||
 	<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;__Total__:
 	@@.yellowgreen;<<print cashFormat(Math.trunc(_individualCosts))>>@@
 	<br>
+=======
+	<<set $activeSlave = $slaves[$i]>>
+	<br style="clear:both" /><<if $lineSeparations == 0>><br><<else>><hr style="margin:0"><</if>>
+	/* TODO: This link explodes slave interact for some reason, bugfix needed.*/
+	/*[[$slaves[$i].slaveName|Slave Interact][$activeSlave = $slaves[$i]]] will $slaves[$i].assignment.*/
+	$slaves[$i].slaveName will $slaves[$i].assignment. /*delete if above fixed */
+
+	<<SlaveExpenses>>
+>>>>>>> First Stage of the budget screen, should have most of the good stuff
 <</for>>
 
 <br>Overall slave costs: @@.yellowgreen;<<print cashFormat(_total)>>@@
diff --git a/src/uncategorized/costsWidgets.tw b/src/uncategorized/costsWidgets.tw
new file mode 100644
index 00000000000..b7ef84b5ac5
--- /dev/null
+++ b/src/uncategorized/costsWidgets.tw
@@ -0,0 +1,551 @@
+:: Cost widgets [nobr widget]
+
+<<widget "SlaveExpenses">>
+	<<set _individualCosts = 0>>
+	''$slaves[$i].slaveName'':
+	<<switch $slaves[$i].assignment>>
+		<<case "be confined in the arcade">>
+			<<set _livingExpense = ($rulesCost*.75)>>
+		<<case "work in the dairy">>
+			<<if $dairyRestraintsSetting >= 2>>
+				<<set _livingExpense = ($rulesCost*.75)>>
+			<<elseif $slaves[$i].livingRules == "normal">>
+				<<set _livingExpense = ($rulesCost*1.5)>>
+			<<elseif $dairyDecoration == "Degradationist">>
+				<<set _livingExpense = ($rulesCost*.9)>>
+			<<else>>
+				<<set _livingExpense = $rulesCost>>
+			<</if>>
+		<<case "work as a farmhand">>
+			<<if $slaves[$i].livingRules == "luxurious">>
+				<<set _livingExpense = ($rulesCost)>>
+			<<elseif $slaves[$i].livingRules == "normal">>
+				<<set _livingExpense = ($rulesCost*2)>>
+			<<else>>
+				<<set _livingExpense = ($rulesCost*.9)>>
+			<</if>>
+		<<case "work in the brothel">>
+			<<if $slaves[$i].livingRules == "normal">>
+				<<set _livingExpense = ($rulesCost*1.5)>>
+			<<else>>
+				<<set _livingExpense = $rulesCost>>
+			<</if>>
+		<<case "serve in the club" "learn in the schoolroom">>
+			<<set _livingExpense = ($rulesCost*1.5)>>
+		<<case "get treatment in the clinic">>
+			<<if $slaves[$i].livingRules == "luxurious">>
+				<<set _livingExpense = ($rulesCost*2)>>
+			<<elseif $slaves[$i].livingRules == "normal">>
+				<<set _livingExpense = ($rulesCost*1.5)>>
+			<<else>>
+				<<set _livingExpense = $rulesCost>>
+			<</if>>
+		<<case "rest in the spa" "work as a nanny">>
+			<<if $slaves[$i].livingRules == "luxurious">>
+				<<set _livingExpense = ($rulesCost*1.75)>>
+			<<elseif $slaves[$i].livingRules == "normal">>
+				<<set _livingExpense = ($rulesCost*1.5)>>
+			<<else>>
+				<<set _livingExpense = $rulesCost>>
+			<</if>>
+		<<case "be a servant">>
+			<<if $slaves[$i].livingRules == "normal">>
+				<<set _livingExpense = ($rulesCost*1.5)>>
+			<<else>>
+				<<if $servantsQuartersDecoration == "Degradationist">>
+					<<set _livingExpense = ($rulesCost*.9)>>
+				<<else>>
+					<<set _livingExpense = $rulesCost>>
+				<</if>>
+			<</if>>
+		<<case "be confined in the cellblock">>
+			<<if $slaves[$i].livingRules == "normal">>
+				<<set _livingExpense = ($rulesCost*1.25)>>
+			<<else>>
+				<<set _livingExpense = ($rulesCost*.9)>>
+			<</if>>
+		<<case "be the Madam" "be the DJ" "be the Nurse" "be the Wardeness" "be the Attendant" "be the Matron" "be the Schoolteacher" "be the Stewardess" "be the Milkmaid" "be the Farmer">>
+			<<set _livingExpense = ($rulesCost*2)>>
+		<<default>>
+			<<if $slaves[$i].livingRules == "luxurious">>
+				<<if $slaves[$i].relationship >= 4>>
+					<<set _livingExpense = ($rulesCost*3)>>
+				<<else>>
+					<<set _livingExpense = ($rulesCost*4)>>
+				<</if>>
+			<<elseif $slaves[$i].livingRules == "normal">>
+				<<set _livingExpense = ($rulesCost*2)>>
+			<<else>>
+				<<set _livingExpense = $rulesCost>>
+			<</if>>
+	<</switch>>
+	<br>&nbsp;&nbsp;&nbsp;&nbsp;<i>Living expenses:</i> @@.yellowgreen;<<print cashFormat(_livingExpense)>>@@
+	<<set _individualCosts += _livingExpense>>
+
+	<br>&nbsp;&nbsp;&nbsp;&nbsp;<i>Basic slave food cost:</i> @@.yellowgreen;<<print cashFormat($foodCost*4)>>@@
+	<<set _individualCosts += $foodCost*4>>
+	<<switch $slaves[$i].diet>>
+		<<case "fattening" "muscle building">>
+			<br>&nbsp;&nbsp;&nbsp;&nbsp;<i>Heavy diet:</i> @@.yellowgreen;<<print cashFormat($foodCost)>>@@
+			<<set _individualCosts += $foodCost>>
+		<<case "restricted" "slimming">>
+			<br>&nbsp;&nbsp;&nbsp;&nbsp;<i>Light diet: //reduced by//</i> @@.yellowgreen;<<print cashFormat($foodCost)>>@@
+			<<set _individualCosts -= $foodCost>>
+	<</switch>>
+	<<if $slaves[$i].weight > 130 || $slaves[$i].weight > 50 || $slaves[$i].weight < -50>>
+		<br>&nbsp;&nbsp;&nbsp;&nbsp;<i>Caloric adjustment for</i>
+		<<if $slaves[$i].weight > 130>>
+			<i>heavy weight:</i> @@.yellowgreen;<<print cashFormat($foodCost*2)>>@@
+			<<set _individualCosts += $foodCost*2>>
+		<<elseif $slaves[$i].weight > 50>>
+			<i>high weight:</i> @@.yellowgreen;<<print cashFormat($foodCost)>>@@
+			<<set _individualCosts += $foodCost>>
+		<<elseif $slaves[$i].weight < -50>>
+			<i>light weight:</i> //reduced by// @@.yellowgreen;<<print cashFormat($foodCost)>>@@
+			<<set _individualCosts -= $foodCost>>
+		<</if>>
+	<</if>>
+	<<if ($slaves[$i].geneticQuirks.fertility == 2 && $slaves[$i].geneticQuirks.hyperFertility == 2 && $slaves[$i].preg == 0 && ($slaves[$i].ovaries == 1 || $slaves[$i].mpreg == 1))>>
+		<br>&nbsp;&nbsp;&nbsp;&nbsp;
+		<<if $geneticMappingUpgrade == 1>>
+			<i>Additional dietary supplements due to genetic hyper-fertility:</i> @@.yellowgreen;<<print cashFormat($foodCost/2)>>@@
+		<<else>>
+			<i>Adjustment for unusual deitary deficiencies:</i> @@.yellowgreen;<<print cashFormat($foodCost/2)>>@@
+		<</if>>
+		<<set _individualCosts += $foodCost/2>>
+	<</if>>
+	<<if $slaves[$i].drugs == "appetite suppressors">>
+		<br>&nbsp;&nbsp;&nbsp;&nbsp;<i>Food saved via suppressed appetite:</i> //reduced by// @@.yellowgreen;<<print cashFormat($foodCost)>>@@
+		<<set _individualCosts -= $foodCost>>
+	<</if>>
+	<<if $slaves[$i].lactation > 0>>
+		<br>&nbsp;&nbsp;&nbsp;&nbsp;<i>Food to support
+		<<if $slaves[$i].lactation > 1>>heavy<<else>>natural<</if>> lactation from
+		<<if Math.trunc($slaves[$i].boobs/10000) > 2>>absurd udders<<elseif Math.trunc($slaves[$i].boobs/10000) > 1>>enormous boobs<<else>>reasonable breasts<</if>>:</i>
+		@@.yellowgreen;<<print cashFormat($foodCost*$slaves[$i].lactation*(1+Math.trunc($slaves[$i].boobs/10000)))>>@@
+		<<set _individualCosts += $foodCost*$slaves[$i].lactation*(1+Math.trunc($slaves[$i].boobs/10000))>>
+	<</if>>
+	<<if $slaves[$i].preg > $slaves[$i].pregData.normalBirth/8>>
+		<<if $slaves[$i].assignment == "work in the dairy" && $dairyFeedersSetting > 0>>
+			<br>&nbsp;&nbsp;&nbsp;&nbsp;<i>Extra feeding costs to support pregnancy are covered by dairy feeders.</i>
+		<<elseif ($slaves[$i].assignment == "serve in the master suite" || $slaves[$i].assignment == "be your concubine") && $masterSuiteUpgradePregnancy == 1>>
+			<br>&nbsp;&nbsp;&nbsp;&nbsp;<i>Extra feeding costs to support pregnancy are covered by $masterSuiteName luxuries.</i>
+		<<else>>
+			<<set _pAccMult = 1>>
+			<br>&nbsp;&nbsp;&nbsp;&nbsp;<i>Extra feeding to support <<if $slaves[$i].pregControl == "speed up">>accelerated <<set _pAccMult = 3>><</if>>pregnancy:</i>
+			@@.yellowgreen;<<print cashFormat($foodCost*$slaves[$i].pregType*_pAccMult)>>@@
+			<<set _individualCosts += $foodCost*$slaves[$i].pregType*_pAccMult>>
+			<<if $slaves[$i].pregType >= 10>>
+				<br>&nbsp;&nbsp;&nbsp;&nbsp;<i>Specialized food blend to support multiples:</i>
+				@@.yellowgreen;<<print cashFormat($foodCost*$slaves[$i].pregType*2*_pAccMult)>>@@
+				<<set _individualCosts += $foodCost*$slaves[$i].pregType*_pAccMult>>
+			<<elseif $slaves[$i].pregType >= 30>>
+				<br>&nbsp;&nbsp;&nbsp;&nbsp;<i>Concentrated, quick to digest food blend to support extreme multiples:</i> @@.yellowgreen;<<print cashFormat($foodCost*$slaves[$i].pregType*_pAccMult)>>@@
+				<<set _individualCosts += $foodCost*2*$slaves[$i].pregType*_pAccMult>>
+			<<elseif $slaves[$i].pregType >= 50>>
+				<br>&nbsp;&nbsp;&nbsp;&nbsp;<i>Specialized dietary adjustments and concentrated, quick to digest food required to support absurd multiples:</i> <<print cashFormat($foodCost*$slaves[$i].pregType*3*_pAccMult)>>
+				<<set _individualCosts += $foodCost*$slaves[$i].pregType*3*_pAccMult>>
+			<<elseif $slaves[$i].pregType >= 100>>
+				<br>&nbsp;&nbsp;&nbsp;&nbsp;<i>Specialized dietary requirements and feeding methods to support absurd multiples:</i> 
+				@@.yellowgreen;<<print cashFormat($foodCost*$slaves[$i].pregType*5*_pAccMult)>>@@
+				<<set _individualCosts += $foodCost*$slaves[$i].pregType*5*_pAccMult>>
+			<</if>>
+		<</if>>
+	<</if>>
+	<<switch $slaves[$i].diet>>
+		<<case "XX" "XY">>
+			<br>&nbsp;&nbsp;&nbsp;&nbsp;<i>Hormone enriched diet:</i>
+			@@.yellowgreen;<<print cashFormat(25)>>@@
+			<<set _individualCosts += 25>>
+		<<case "XXY">>
+			<br>&nbsp;&nbsp;&nbsp;&nbsp;<i>Specialized hermaphrodite diet:</i>
+			@@.yellowgreen;<<print cashFormat(75)>>@@
+			<<set _individualCosts += 75>>
+		<<case "cleansing">>
+			<br>&nbsp;&nbsp;&nbsp;&nbsp;<i>Chemical cleansing diet:</i>
+			@@.yellowgreen;<<print cashFormat(50)>>@@
+			<<set _individualCosts += 50>>
+		<<case "fertility">>
+			<br>&nbsp;&nbsp;&nbsp;&nbsp;<i>Specialized fertility diet:</i>
+			@@.yellowgreen;<<print cashFormat(25)>>@@
+			<<set _individualCosts += 50>>
+	<</switch>>
+	<<if $boobAccessibility != 1>>
+		<<if ($slaves[$i].boobs > 20000)>>
+			<<if ($slaves[$i].assignment != "work in the dairy" || $dairyRestraintsSetting < 2) && ($slaves[$i].assignment != "be confined in the arcade")>>
+				<br>&nbsp;&nbsp;&nbsp;&nbsp;<i>Increased living expenses due to inconveniently huge boobs:</i>
+				@@.yellowgreen;<<print cashFormat(50)>>@@
+				<<set _individualCosts += 50>>
+			<</if>>
+		<</if>>
+	<</if>>
+	<<if $pregAccessibility != 1>>
+		<<if ($slaves[$i].belly >= 60000)>>
+			<<if ($slaves[$i].assignment != "labor in the production line") && ($slaves[$i].assignment != "work in the dairy" || $dairyRestraintsSetting < 2) && ($slaves[$i].assignment != "be confined in the arcade")>>
+				<br>&nbsp;&nbsp;&nbsp;&nbsp;<i>Increased living expenses due to an inconveniently huge belly:</i>
+				@@.yellowgreen;<<print cashFormat(100)>>@@
+				<<set _individualCosts += 100>>
+			<</if>>
+		<</if>>
+	<</if>>
+	<<if $dickAccessibility != 1>>
+		<<if ($slaves[$i].dick > 45)>>
+			<<if ($slaves[$i].assignment != "work in the dairy" || $dairyRestraintsSetting < 2) && ($slaves[$i].assignment != "be confined in the arcade")>>
+				<br>&nbsp;&nbsp;&nbsp;&nbsp;<i>Increased living expenses due to an inconveniently huge penis:</i>
+				@@.yellowgreen;<<print cashFormat(50)>>@@
+				<<set _individualCosts += 50>>
+			<</if>>
+		<</if>>
+	<</if>>
+	<<if $ballsAccessibility != 1>>
+		<<if ($slaves[$i].balls > 90)>>
+			<<if ($slaves[$i].assignment != "work in the dairy" || $dairyRestraintsSetting < 2) && ($slaves[$i].assignment != "be confined in the arcade")>>
+				<br>&nbsp;&nbsp;&nbsp;&nbsp;<i>Increased living expenses due to inconveniently huge balls:</i>
+				@@.yellowgreen;<<print cashFormat(50)>>@@
+				<<set _individualCosts += 50>>
+			<</if>>
+		<</if>>
+	<</if>>
+	<<if $buttAccessibility != 1>>
+		<<if ($slaves[$i].butt > 15)>>
+			<<if ($slaves[$i].assignment != "work in the dairy" || $dairyRestraintsSetting < 2) && ($slaves[$i].assignment != "be confined in the arcade")>>
+				<br>&nbsp;&nbsp;&nbsp;&nbsp;<i>Increased living expenses due to an inconveniently huge butt:</i>
+				@@.yellowgreen;<<print cashFormat(50)>>@@
+				<<set _individualCosts += 50>>
+			<</if>>
+		<</if>>
+	<</if>>
+	<<if !canSee($slaves[$i]) && ($slaves[$i].assignment != "work in the dairy" || $dairyRestraintsSetting < 2) && ($slaves[$i].assignment != "be confined in the arcade")>>
+		<br>&nbsp;&nbsp;&nbsp;&nbsp;<i>Increased living expenses due to lack of sight:</i>
+		@@.yellowgreen;<<print cashFormat(50)>>@@
+		<<set _individualCosts += 50>>
+	<<elseif $slaves[$i].eyes <= -1 && $slaves[$i].eyewear != "corrective glasses" && $slaves[$i].eyewear != "corrective contacts">>
+		<br>&nbsp;&nbsp;&nbsp;&nbsp;<i>Increased living expenses due to poor vision:</i>
+		@@.yellowgreen;<<print cashFormat(25)>>@@
+		<<set _individualCosts += 25>>
+	<<elseif ($slaves[$i].eyewear == "blurring glasses") || ($slaves[$i].eyewear == "blurring contacts")>>
+		<br>&nbsp;&nbsp;&nbsp;&nbsp;<i>Increased living expenses due to blurred vision:</i>
+		@@.yellowgreen;<<print cashFormat(25)>>@@
+		<<set _individualCosts += 25>>
+	<</if>>
+	<<if !canHear($slaves[$i]) && ($slaves[$i].assignment != "work in the dairy" || $dairyRestraintsSetting < 2) && ($slaves[$i].assignment != "be confined in the arcade")>>
+		<br>&nbsp;&nbsp;&nbsp;&nbsp;<i>Increased living expenses due to lack of hearing:</i>
+		@@.yellowgreen;<<print cashFormat(20)>>@@
+		<<set _individualCosts += 20>>
+	<<elseif $slaves[$i].hears <= -1 && $slaves[$i].earwear != "hearing aids">>
+		<br>&nbsp;&nbsp;&nbsp;&nbsp;<i>Increased living expenses due to poor hearing:</i>
+		@@.yellowgreen;<<print cashFormat(5)>>@@
+		<<set _individualCosts += 5>>
+	<<elseif ($slaves[$i].earwear == "muffling ear plugs")>>
+		<br>&nbsp;&nbsp;&nbsp;&nbsp;<i>Increased living expenses due to muffled hearing:</i>
+		@@.yellowgreen;<<print cashFormat(5)>>@@
+		<<set _individualCosts += 5>>
+	<</if>>
+	<<if ($slaves[$i].assignment != "work in the dairy" || $dairyRestraintsSetting < 2) && ($slaves[$i].assignment != "be confined in the arcade")>>
+		<<if ($slaves[$i].amp != 0)>>
+			<<if ($slaves[$i].amp == 1)>>
+				<br>&nbsp;&nbsp;&nbsp;&nbsp;<i>Increased living expenses due to limblessness:</i>
+				@@.yellowgreen;<<print cashFormat($rulesCost)>>@@
+				<<set _individualCosts += $rulesCost>>
+			<<else>>
+				<br>&nbsp;&nbsp;&nbsp;&nbsp;<i>Increased living expenses due to prosthetics:</i>
+				@@.yellowgreen;<<print cashFormat($rulesCost/2)>>@@
+				<<set _individualCosts += $rulesCost/2>>
+			<</if>>
+		<<elseif !canWalk($slaves[$i])>>
+			<br>&nbsp;&nbsp;&nbsp;&nbsp;<i>Increased living expenses due to immobility:</i>
+			@@.yellowgreen;<<print cashFormat($rulesCost)>>@@
+			<<set _individualCosts += $rulesCost>>
+		<</if>>
+	<</if>>
+	<<if $slaves[$i].boobs > 10000>>
+		<<if $slaves[$i].boobsImplantType == 1>>
+			<br>&nbsp;&nbsp;&nbsp;&nbsp;<i>Maintenance cost for oversized string implants:</i>
+			@@.yellowgreen;<<print cashFormat(50)>>@@
+			<<set _individualCosts += 50>>
+		<</if>>
+	<</if>>
+	<<if $slaves[$i].butt > 10>>
+		<<if $slaves[$i].buttImplantType == 1>>
+			<br>&nbsp;&nbsp;&nbsp;&nbsp;<i>Maintenance cost for oversized string implants:</i>
+			@@.yellowgreen;<<print cashFormat(50)>>@@
+			<<set _individualCosts += 50>>
+		<</if>>
+	<</if>>
+	<<if $slaves[$i].preg > $slaves[$i].pregData.minLiveBirth>>
+		<<if $universalRulesBirthing == 1>>
+			<<if ($slaves[$i].assignment != "work in the dairy" || $dairyRestraintsSetting < 2)>>
+				<br>&nbsp;&nbsp;&nbsp;&nbsp;<i>Coverage cost for daily pregnancy scanning:</i>
+				@@.yellowgreen;<<print cashFormat(50)>>@@
+				<<set _individualCosts += 50>>
+			<</if>>
+		<</if>>
+	<</if>>
+	<<if $CitizenRetirement == 1>>
+		<br>&nbsp;&nbsp;&nbsp;&nbsp;<i>Retirement account payments:</i>
+		@@.yellowgreen;<<print cashFormat(250)>>@@
+		<<set _individualCosts += 250>>
+	<</if>>
+	<<if ($slaves[$i].inflation == 3)>>
+		<<switch $slaves[$i].inflationType>>
+		<<case "water">>
+			<br>&nbsp;&nbsp;&nbsp;&nbsp;<i>Costs of specially formulated water for enemas; 2 gallons:</i>
+			@@.yellowgreen;<<print cashFormat(100)>>@@
+			<<set _individualCosts += 100>>
+		<<case "food">>
+			<br>&nbsp;&nbsp;&nbsp;&nbsp;<i>Costs of filler food for slave stuffing; 2 gallons:</i>
+			@@.yellowgreen;<<print cashFormat(($foodCost*4))>>@@
+			<<set _individualCosts += ($foodCost*4)>>
+		<<case "curative" "aphrodisiac" "tightener">>
+			<br>&nbsp;&nbsp;&nbsp;&nbsp;<i>Costs of specially formulated drug mixtures for enemas; 2 gallons:</i>
+			@@.yellowgreen;<<print cashFormat((100+($drugsCost*2)))>>@@
+			<<set _individualCosts += (100+($drugsCost*2))>>
+		<</switch>>
+	<<elseif ($slaves[$i].inflation == 2)>>
+		<<switch $slaves[$i].inflationType>>
+		<<case "water">>
+			<br>&nbsp;&nbsp;&nbsp;&nbsp;<i>Costs of specially formulated water for enemas; 1 gallon:</i>
+			@@.yellowgreen;<<print cashFormat(50)>>@@
+			<<set _individualCosts += 50>>
+		<<case "food">>
+			<br>&nbsp;&nbsp;&nbsp;&nbsp;<i>Costs of filler food for slave stuffing; 1 gallon:</i>
+			@@.yellowgreen;<<print cashFormat(($foodCost*2))>>@@
+			<<set _individualCosts += ($foodCost*4)>>
+		<<case "curative" "aphrodisiac" "tightener">>
+			<br>&nbsp;&nbsp;&nbsp;&nbsp;<i>Costs of specially formulated drug mixtures for enemas; 1 gallon:</i>
+			@@.yellowgreen;<<print cashFormat((50+($drugsCost*2)))>>@@
+			<<set _individualCosts += (50+($drugsCost*2))>>
+		<</switch>>
+	<<elseif ($slaves[$i].inflation == 1)>>
+		<<switch $slaves[$i].inflationType>>
+		<<case "water">>
+			<br>&nbsp;&nbsp;&nbsp;&nbsp;<i>Costs of specially formulated water for enemas; 2 liters:</i>
+			@@.yellowgreen;<<print cashFormat(25)>>@@
+			<<set _individualCosts += 25>>
+		<<case "food">>
+			<br>&nbsp;&nbsp;&nbsp;&nbsp;<i>Costs of filler food for slave stuffing; 2 liters:</i>
+			<<print cashFormat(($foodCost))>>
+			<<set _individualCosts += ($foodCost)>>
+		<<case "curative" "aphrodisiac" "tightener">>
+			<br>&nbsp;&nbsp;&nbsp;&nbsp;<i>Costs of specially formulated drug mixtures for enemas; 2 liters:</i>
+			@@.yellowgreen;<<print cashFormat((25+($drugsCost*2)))>>@@
+			<<set _individualCosts += (25+($drugsCost*2))>>
+		<</switch>>
+	<</if>>
+	<<switch $slaves[$i].drugs>>
+	<<case "anti-aging cream">>
+		<br>&nbsp;&nbsp;&nbsp;&nbsp;<i>Anti-aging creams:</i>
+		<<print cashFormat(($drugsCost*10))>>
+		<<set _individualCosts += ($drugsCost*10)>>
+	<<case "female hormone injections" "male hormone injections">>
+		<br>&nbsp;&nbsp;&nbsp;&nbsp;<i>Hormonal injections:</i>
+		@@.yellowgreen;<<print cashFormat(($drugsCost*5))>>@@
+		<<set _individualCosts += ($drugsCost*5)>>
+	<<case "growth stimulants">>
+		<br>&nbsp;&nbsp;&nbsp;&nbsp;<i>Growth stimulants:</i>
+		@@.yellowgreen;<<print cashFormat(($drugsCost*5))>>@@
+		<<set _individualCosts += ($drugsCost*5)>>
+	<<case "intensive breast injections" "intensive butt injections" "intensive penis enhancement" "intensive testicle enhancement" "intensive lip injections" "hyper breast injections" "hyper butt injections" "hyper penis enhancement" "hyper testicle enhancement" "hyper lip injections">>
+		<br>&nbsp;&nbsp;&nbsp;&nbsp;<i>Intensive drugs:</i>
+		@@.yellowgreen;<<print cashFormat($drugsCost*5)>>@@
+		<<set _individualCosts += $drugsCost*5>>
+	<<case "sag-B-gone">>
+		<br>&nbsp;&nbsp;&nbsp;&nbsp;<i>Questionable infomercial creams:</i>
+		@@.yellowgreen;<<print cashFormat(Math.trunc($drugsCost/10))>>@@
+		<<set _individualCosts += ($drugsCost/10)>>
+	<<case "no drugs" "none">>
+	<<default>>
+		<br>&nbsp;&nbsp;&nbsp;&nbsp;<i>Standard drugs:</i>
+		@@.yellowgreen;<<print cashFormat(($drugsCost*2))>>@@
+		<<set _individualCosts += ($drugsCost*2)>>
+	<</switch>>
+	<<if $slaves[$i].curatives == 1 && $slaves[$i].assignmentVisible != 1>>
+	<<elseif $slaves[$i].curatives > 0>>
+		<br>&nbsp;&nbsp;&nbsp;&nbsp;<i>Health drugs:</i>
+		@@.yellowgreen;<<print cashFormat($drugsCost+($slaves[$i].curatives*$drugsCost))>>@@
+		<<set _individualCosts += $drugsCost+($slaves[$i].curatives*$drugsCost)>>
+	<</if>>
+	<<if ($slaves[$i].aphrodisiacs !== 0)>>
+		<br>&nbsp;&nbsp;&nbsp;&nbsp;<i>Aphrodisiacs/Anaphrodisiacs:</i>
+		@@.yellowgreen;<<print cashFormat(Math.trunc($drugsCost*Math.abs($slaves[$i].aphrodisiacs)))>>@@
+		<<set _individualCosts += $drugsCost*Math.abs($slaves[$i].aphrodisiacs)>>
+	<</if>>
+	<<if ($slaves[$i].hormones != 0)>>
+		<br>&nbsp;&nbsp;&nbsp;&nbsp;<i>Hormones:</i>
+		@@.yellowgreen;<<print cashFormat((Math.trunc($drugsCost*Math.abs($slaves[$i].hormones)*0.5)))>>@@
+		<<set _individualCosts += Math.trunc($drugsCost*Math.abs($slaves[$i].hormones)*0.5)>>
+	<</if>>
+	<<if ($slaves[$i].bodySwap > 0)>>
+		<br>&nbsp;&nbsp;&nbsp;&nbsp;<i>JS-Suppressants:</i>
+		@@.yellowgreen;<<print cashFormat(($drugsCost*10*$slaves[$i].bodySwap))>>@@
+		<<set _individualCosts += Math.trunc($drugsCost*10*$slaves[$i].bodySwap)>>
+	<</if>>
+	<<if ($slaves[$i].preg == -1) && isFertile($slaves[$i])>>
+		<br>&nbsp;&nbsp;&nbsp;&nbsp;<i>Contraceptives:</i>
+		@@.yellowgreen;<<print cashFormat((Math.trunc($drugsCost*0.5)))>>@@
+		<<set _individualCosts += Math.trunc($drugsCost*0.5)>>
+	<</if>>
+	<<if ($studio == 1)>>
+		<<if ($slaves[$i].pornFameSpending > 0)>>
+			<br>&nbsp;&nbsp;&nbsp;&nbsp;<i>Publicity:</i>
+			@@.yellowgreen;<<print cashFormat($slaves[$i].pornFameSpending/$PCSlutContacts)>>@@
+			<<set _individualCosts += ($slaves[$i].pornFameSpending/$PCSlutContacts)>>
+		<</if>>
+	<</if>> <<set _total += Math.trunc(_individualCosts)>>
+	<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;__Total__:
+	@@.yellowgreen;<<print cashFormat(Math.trunc(_individualCosts))>>@@
+	<br>
+	<br>&nbsp;&nbsp;&nbsp;&nbsp;__Expense__: @@.red;<<print cashFormat(Math.trunc(_individualCosts))>>@@
+	<<if $assistantPower > 0>>
+		<<if $activeSlave.lastWeeksCashIncome > 0>>
+			<br>Income: @@.yellowgreen;¤<<print $activeSlave.lastWeeksCashIncome>>@@
+			<<set _total = (Math.trunc($activeSlave.lastWeeksCashIncome - _individualCosts))>>
+			<br>&nbsp;&nbsp;&nbsp;&nbsp;__Total__:
+			<<if _total > 0>>
+				@@.yellowgreen;<<print cashFormat(Math.trunc(_total))>>@@
+			<<else>>
+				@@.red;<<print cashFormat(Math.trunc(_total))>>@@
+			<</if>>
+		<</if>>
+	<</if>>
+	
+	//<br>
+	<<if $activeSlave.origin != 0>>
+		$activeSlave.origin<br>
+	<</if>>
+	<<if $activeSlave.slaveCost > 0>>
+		You bought her for: ¤$activeSlave.slaveCost.
+		<<set _Cost = $activeSlave.slaveCost>>
+	<<elseif $activeSlave.slaveCost == 0>>
+		You spent nothing to aquire her.
+		<<set _Cost = $activeSlave.slaveCost>>
+	<<else>>
+		You have no record of how much <<if $activeSlave.origin != 0>>this<<else>>she originally<</if>> cost.
+		<<set _Cost = 0>>
+	<</if>>
+
+	//<<if $assistantPower > 0>>
+		<<if $activeSlave.lifetimeCashExpenses < 0>>
+			<br>In her <<if $activeSlave.weekAcquired > 0>>$activeSlave.weekAcquired weeks<<else>>time<</if>> with you, she has cost @@.red;¤$activeSlave.lifetimeCashExpenses@@.
+			<<set _Expense = $activeSlave.lifetimeCashExpenses>>
+		<<else>>
+			<br>You have no record of her costing you any ¤.
+			<<set _Expense = 0>>
+		<</if>>
+
+		<<if $activeSlave.lifetimeCashIncome > 0>>
+			<br>In her <<if $activeSlave.weekAcquired > 0>>$activeSlave.weekAcquired weeks<<else>>time<</if>> with you, she has earned @@.yellowgreen;¤$activeSlave.lifetimeCashIncome@@.
+			<<set _Income = $activeSlave.lifetimeCashIncome>>
+		<<else>>
+			<br>You have no record of her making you any ¤.
+			<<set _Income = 0>>
+		<</if>>
+		
+		<br>Overall, 
+		<<if (_Income - _Cost - _Expense) > 0>>
+			you have made ¤@@.yellowgreen;<<print (_Income - _Cost - _Expense)>>@@ net from her labors.
+		<<elseif (_Income - _Cost - _Expense) == 0>>
+			she is even in cost and income.
+		<<else>>
+			she has cost you ¤@@.red;<<print (_Income - _Cost - _Expense)>>@@.
+		<</if>>
+	//<</if>>
+<</widget>>
+
+
+<<widget "setupLastWeeksCash">>
+
+<<set $lastWeeksCashIncome = {
+/*Slave Jobs*/
+whore: 0,
+rest: 0,
+fucktoy: 0,
+subordinateSlave: 0,
+houseServant: 0,
+confined: 0,
+publicServant: 0,
+classes: 0,
+milked: 0,
+extraMilk: 0, /*milk from slaves doing other things*/
+gloryhole: 0,
+porn: 0,
+
+recruiter: 0,
+
+
+/*Slaves in general*/
+fuckdolls:0,
+menialTrades:0,
+menialBioreactors: 0,
+
+slaveTransfer:0,
+fuckdollsTransfer:0,
+menialTradesTransfer:0,
+menialBioreactorsTransfer: 0,
+menialRetirement: 0,
+
+slaveMod:0,
+slaveSurgery:0,
+slaveUpkeep: 0,
+birth: 0,
+
+/*Buildings*/
+lab: 0,
+brothel: 0,
+brothelAds: 0,
+club: 0,
+/*clubAds: 0,*/
+arcade: 0,
+dairy: 0,
+servantsQuarters: 0,
+masterSuite: 0,
+school: 0,
+spa: 0,
+clinic: 0,
+cellblock: 0,
+incubator: 0,
+nursery: 0,
+farmyard: 0,
+pit: 0,
+
+arcologyImprovement:0,
+environment: 0,
+weather: 0,
+
+mercenaries:0,
+peacekeepers: 0,
+specialForces: 0,
+securityExpansion: 0,
+cyberMod: 0,
+
+
+citizenOrphanage:0,
+privateOrphanage:0,
+
+capEx:0,
+futureSocieties: 0,
+schoolBacking: 0,
+policies: 0,
+
+/*Personal Finance*/
+personalBusiness:0,
+PCtraining: 0,
+PCmedical: 0,
+PCskills: 0,
+stocksBought:0, /*trading*/
+stocks:0, /*share growth*/
+fines:0,
+event:0, /*poker night etc.  Try to file things elsewhere if you can.*/
+war: 0,
+
+rents: 0,
+
+cheating: 0,
+total: 0
+
+}>>
+
+<<set $lastWeeksCashExpenses = clone($lastWeeksCashIncome)>>
+<<set $lastWeeksCashProfits = clone($lastWeeksCashIncome)>>
+
+<</widget>>
\ No newline at end of file
diff --git a/src/uncategorized/dairyReport.tw b/src/uncategorized/dairyReport.tw
index 706c14cef6d..82780a78f9e 100644
--- a/src/uncategorized/dairyReport.tw
+++ b/src/uncategorized/dairyReport.tw
@@ -7,6 +7,7 @@
 
 <<SlaveSort $DairyiIDs>>
 <<set _DL = $DairyiIDs.length, $dairySlaves = _DL, _SL = $slaves.length, $bioreactorPerfectedID = 0, $legendaryBallsID = 0, $legendaryCowID = 0, $milkmaidDevotionBonus = 1, $milkmaidHealthBonus = 0, $milkmaidTrustBonus = 1, $milkmaidDevotionThreshold = 45, $milkmaidTrustThreshold = 35, _anusesStretched = 0, _birthers = 0, _births = 0, _cumWeek = 0, _femCumWeek = 0, _FLsFetish = 0, _milkWeek = 0, _balltacular = 0, _boobtacular = 0, _careerForgotten = 0, _chemMinor = 0, _chemSevere = 0, _desterilized = 0, _hatefilled = 0, _horrified = 0, $intelligenceLost = 0, _mindbroken = 0, _profits = 0, _skillsLost = 0, _stupidified = 0, _vaginasStretched = 0>>
+<<set _surgeryCost forceNeg($surgeryCost)>>
 
 <!-- Statistics gathering -->
 <<set $facility = $facility || {}, $facility.dairy = initFacilityStatistics($facility.dairy)>>
@@ -453,15 +454,18 @@
 		<<set $slaves[$i].boobs += _growth>>
 	<</if>>
 	<<if $slaves[$i].prostate == 1>>
-		<<set $slaves[$i].prostate = 2, $slaves[$i].health -= 10, $cash -= $surgeryCost>>
+		<<set $slaves[$i].prostate = 2, $slaves[$i].health -= 10>>
+		<<run cashX(_surgeryCost, "slaveSurgery", $slaves[$i])>>
 	<</if>>
 	<<if $slaves[$i].vasectomy == 1>>
-		<<set $slaves[$i].vasectomy = 0, $slaves[$i].health -= 10, $cash -= $surgeryCost>>
+		<<set $slaves[$i].vasectomy = 0, $slaves[$i].health -= 10,>>
+		<<run cashX(_surgeryCost, "slaveSurgery", $slaves[$i])>>
 	<</if>>
 	<<if ($dairySlimMaintain == 0)>>
 		<<if $dairyImplantsSetting <= 1>>
 			<<if ($slaves[$i].lactation < 2) && ($slaves[$i].boobs > 300 || $slaves[$i].balls == 0 || $slaves[$i].lactation == 1 || $dairyImplantsSetting == 1)>>
-				<<set $slaves[$i].lactation = 2, $slaves[$i].lactationDuration = 2, $slaves[$i].health -= 10, $cash -= $surgeryCost>>
+				<<set $slaves[$i].lactation = 2, $slaves[$i].lactationDuration = 2, $slaves[$i].health -= 10>>
+				<<run cashX(_surgeryCost, "slaveSurgery", $slaves[$i])>>
 			<</if>>
 		<<elseif $dairyImplantsSetting == 3>>
 			<<if ($slaves[$i].lactation < 1) && ($slaves[$i].boobs > 300 || $slaves[$i].balls == 0)>>
@@ -846,11 +850,11 @@
 				<</if>>
 			<<elseif ($slaves[$i].pregKnown == 1)>>
 				<<if ($dairyPregSetting > 2)>>
-					<<set $cash += 100>>
+					<<run cashX(100, "Milked", $slaves[$i])>>
 				<<elseif ($dairyPregSetting > 1)>>
-					<<set $cash += 50>>
+					<<run cashX(50, "Milked", $slaves[$i])>>
 				<<else>>
-					<<set $cash += 25>>
+					<<run cashX(25, "Milked", $slaves[$i])>>
 				<</if>>
 				<<if ($dairyPregSetting > 1) && ($slaves[$i].vagina < 4)>>
 					<<set $slaves[$i].vagina++>>
@@ -879,36 +883,47 @@
 	<<set _tempCash = $cash>>
 	<<set _seed = (100*$bioreactorsXY) + (100*$bioreactorsHerm), _cumWeek += _seed>>
 	<<if ($arcologies[0].FSPastoralistLaw == 1)>>
-		<<set $cash += _seed*random(40,50)>>
+		<<set _cashX = _seed*random(40,50)>>
+		<<run cashX(_cashX, "menialBioreactors")>>
 	<<elseif ($arcologies[0].FSPastoralist != "unset")>>
-		<<set $cash += _seed*(random(25,35)+Math.trunc($arcologies[0].FSPastoralist/10))>>
+		<<set _cashX = _seed*(random(25,35)+Math.trunc($arcologies[0].FSPastoralist/10))>>
+		<<run cashX(_cashX, "menialBioreactors")>>
 	<<else>>
-		<<set $cash += _seed*random(25,35)>>
+		<<set _cashX = _seed*random(25,35)>>
+		<<run cashX(_cashX, "menialBioreactors")>>
 	<</if>>
 	<<set _seed = (2*$bioreactorsXX) + (2*$bioreactorsHerm), _femCumWeek += _seed>>
 	<<if ($arcologies[0].FSPastoralistLaw == 1)>>
-		<<set $cash += _seed*random(40,50)>>
+		<<set _cashX = _seed*random(40,50)>>
+		<<run cashX(_cashX, "menialBioreactors")>>
 	<<elseif ($arcologies[0].FSPastoralist != "unset")>>
-		<<set $cash += _seed*(random(25,35)+Math.trunc($arcologies[0].FSPastoralist/10))>>
+		<<set _cashX = _seed*(random(25,35)+Math.trunc($arcologies[0].FSPastoralist/10))>>
+		<<run cashX(_cashX, "menialBioreactors")>>
 	<<else>>
-		<<set $cash += _seed*random(25,35)>>
+		<<set _cashX = _seed*random(25,35)>>
+		<<run cashX(_cashX, "menialBioreactors")>>
 	<</if>>
 	<<set _seed = (800*$bioreactorsXX) + (700*$bioreactorsBarren) + (600*$bioreactorsXY) + (600*$bioreactorsHerm), _milkWeek += _seed>>
 	<<if ($arcologies[0].FSPastoralistLaw == 1)>>
-		<<set $cash += _seed*(13+Math.trunc($arcologies[0].FSPastoralist/30))>>
+		<<set _cashX = _seed*(13+Math.trunc($arcologies[0].FSPastoralist/30))>>
+		<<run cashX(_cashX, "menialBioreactors")>>
 	<<elseif ($arcologies[0].FSPastoralist != "unset")>>
-		<<set $cash += _seed*(8+Math.trunc($arcologies[0].FSPastoralist/30))>>
+		<<set _cashX = _seed*(8+Math.trunc($arcologies[0].FSPastoralist/30))>>
+		<<run cashX(_cashX, "menialBioreactors")>>
 	<<else>>
-		<<set $cash += _seed*9>>
+		<<set _cashX = _seed*9>>
+		<<run cashX(_cashX, "menialBioreactors")>>
 	<</if>>
 	<br><br>_Tadd permanently converted biological "machine<<if _Tadd > 1>>s<</if>>" produce<<if _Tadd == 1>>s<</if>> @@.yellowgreen;<<print cashFormat($cash-_tempCash)>>@@ income.
 <</if>>
 
 <<if $inflatedSlavesMilk > 0>>
-	<<set $cash -= Math.trunc(((600*($inflatedSlavesMilk)+8)+random(50,200)))>>
+	<<set _cashX -= Math.trunc(((600*($inflatedSlavesMilk)+8)+random(50,200)))>>
+	<<run cashX(_cashX, "milked")>>
 <</if>>
 <<if $inflatedSlavesCum > 0>>
-	<<set $cash -= Math.trunc(((300*($inflatedSlavesCum+8))+random(25,100)))>>
+	<<set _cashX -= Math.trunc(((300*($inflatedSlavesCum+8))+random(25,100)))>>
+	<<run cashX(_cashX, "milked")>>
 <</if>>
 
 <<set _profits = $cash-_oldCash>>
diff --git a/src/uncategorized/endWeek.tw b/src/uncategorized/endWeek.tw
index ce47dc0a47b..9b935586904 100644
--- a/src/uncategorized/endWeek.tw
+++ b/src/uncategorized/endWeek.tw
@@ -111,6 +111,9 @@
 
 <<set $TSS.schoolSale = 0, $GRI.schoolSale = 0, $SCP.schoolSale = 0, $LDE.schoolSale = 0, $TGA.schoolSale = 0, $HA.schoolSale = 0, $TFS.schoolSale = 0, $TCR.schoolSale = 0, $independenceDay = 0, $showEncyclopedia = 0, $racialVarieties = [], $shelterGirlsIDs = [], $oldWeek = $week, $cashLastWeek = $cash>>
 
+<<setupLastWeeksCash>>
+<<set $lastWeeksErrors = "Errors:">>
+
 <<set $retiree = 0>>
 <<set $expiree = 0>>
 
diff --git a/src/uncategorized/labReport.tw b/src/uncategorized/labReport.tw
index c5c1f6b5ce2..83a49905524 100644
--- a/src/uncategorized/labReport.tw
+++ b/src/uncategorized/labReport.tw
@@ -5,7 +5,8 @@
 <<if ($researchLab.hired + $researchLab.menials) != 0>>
 	<<if $researchLab.research == "none" && $researchLab.manufacture == "none">>
 		Since the lab is currently not working on any projects it takes contract work and earns you @@.yellowgreen;<<print cashFormat((($researchLab.hired * 3 + $researchLab.menials) * $researchLab.aiModule * 20))>>.@@
-		<<set $cash += (($researchLab.hired * 3 + $researchLab.menials) * $researchLab.aiModule * 20)>>
+		<<set _cashX = (($researchLab.hired * 3 + $researchLab.menials) * $researchLab.aiModule * 20)>>
+		<<run cashX(_cashX, "lab")>>
 	<<elseif $researchLab.research != "none">>
 		<<set $researchLab.productionTime -= (($researchLab.hired * 3) + ($researchLab.menials) * ($researchLab.aiModule))>>
 		<<if $researchLab.productionTime <= 0>>
diff --git a/src/uncategorized/main.tw b/src/uncategorized/main.tw
index e5981aad54c..dfa689eff8f 100644
--- a/src/uncategorized/main.tw
+++ b/src/uncategorized/main.tw
@@ -67,7 +67,7 @@
 <<if (def _BG && $dojo > 1)>><<set $slavesVisible++>><</if>>
 
 <<set $nextButton = "END WEEK", $nextLink = "End Week", $showEncyclopedia = 1, $encyclopedia = "How to Play">>
-<<set $costs = getCost($slaves)>>
+<<set $costs = predictCost($slaves)>>
 
 <<run FacilityNameCleanup()>>
 <<if ($PC.customTitle == "")>>
diff --git a/src/uncategorized/saGetMilked.tw b/src/uncategorized/saGetMilked.tw
index 88c0313d193..0248e26f424 100644
--- a/src/uncategorized/saGetMilked.tw
+++ b/src/uncategorized/saGetMilked.tw
@@ -168,7 +168,7 @@ gets milked this week.
 		<<set $milkSale = $milk*6>>
 		$His milk is sold for @@.yellowgreen;<<print cashFormat($milkSale)>>.@@
 	<</if>>
-	<<set $cash += $milkSale>>
+	<<run cashX($milkSale, "milked", $slaves[$i])>>
 	<<set _incomeStats.income += $milkSale>>
 
 	<<if $slaves[$i].fetishKnown>>
@@ -393,7 +393,7 @@ gets milked this week.
 		<<if $slaves[$i].vasectomy == 1 || $slaves[$i].ballType == "sterile">><<set _cumSale *= 0.2>><<elseif $slaves[$i].prostate == 3>><<set _cumSale *= 0.5>><</if>>
 		$He produces <<print $cum>> deciliters of cum over the week; the fresh ejaculate, which is in high demand given the new cultural preference for slave products, is sold for @@.yellowgreen;<<print cashFormat(_cumSale)>>.@@
 	<</if>>
-	<<set $cash += _cumSale>>
+	<<run cashX(_cumSale, "milked", $slaves[$i])>>
 	<<set _incomeStats.income += _cumSale>>
 
 	<<if ($slaves[$i].energy > 95)>>
@@ -465,7 +465,7 @@ gets milked this week.
 		Because of your arcology's cultural preferences, it comes with extra value.
 	<</if>>
 	It is sold for @@.yellowgreen;<<print cashFormat($fluidSale)>>.@@
-	<<set $cash += $fluidSale>>
+	<<run cashX( $fluidSale, "milked", $slaves[$i])>>
 	<<set _incomeStats.income += $fluidSale>>
 <</if>> /* CLOSES FEMALE PROSTATE FLUID GATHERING */
 
@@ -486,7 +486,7 @@ gets milked this week.
 		<<else>>
 			an incident without lasting effect.
 		<</if>>
-		<<set $cash += Math.trunc($FResult*_vignette.effect)>>
+		<<run cashX(Math.trunc($FResult*_vignette.effect), "milked", $slaves[$i])>>
 		<<set _incomeStats.income += Math.trunc($FResult*_vignette.effect)>>
 	<<elseif (_vignette.type == "devotion")>>
 		<<if (_vignette.effect > 0)>>
diff --git a/src/uncategorized/saLongTermEffects.tw b/src/uncategorized/saLongTermEffects.tw
index b149f3c9469..11a25e4eeab 100644
--- a/src/uncategorized/saLongTermEffects.tw
+++ b/src/uncategorized/saLongTermEffects.tw
@@ -7240,8 +7240,13 @@
 	<<set $repGain += (100*$slaves[$i].pornPrestige)>>
 	<<set _donations = Math.floor($slaves[$i].pornFame/(random(13,20)))+(random(-5000,5000))>>
 	<<if _donations > 0>>
+<<<<<<< HEAD
 		A number of gifts and donations totaling @@.yellowgreen;<<print cashFormat(_donations)>>@@ were also sent to $him, among other things.
 		<<set $cash += _donations>>
+=======
+		A number of gifts and donations totalling @@.yellowgreen;<<print cashFormat(_donations)>>@@ were also sent to $him, among other things.
+		<<run cashX(_donations, "porn", $slaves[$i])>>
+>>>>>>> First Stage of the budget screen, should have most of the good stuff
 	<</if>>
 <<elseif $slaves[$i].pornFeed > 0>>
 	<<include "SA Porn">>
@@ -7307,7 +7312,7 @@
 			<<set $slaves[$i].pregKnown = 0>>
 			<<set WombFlush($slaves[$i])>>
 			<<run SetBellySize($slaves[$i])>>
-			<<set $cash -= 100000>>
+			<<run cashX(-100000, "fines", $slaves[$i])>>
 			<<set $failedElite += 150>>
 		<</if>>
 	<</if>>
diff --git a/src/uncategorized/saServeThePublic.tw b/src/uncategorized/saServeThePublic.tw
index 606dda54241..eb16a397139 100644
--- a/src/uncategorized/saServeThePublic.tw
+++ b/src/uncategorized/saServeThePublic.tw
@@ -1217,7 +1217,7 @@ $His appearance attracted $beauty members of the public (<<print Math.trunc($bea
 		<<else>>
 			an incident without lasting effect.
 		<</if>>
-		<<set $cash += Math.trunc($FResult*_vignette.effect)>>
+		<<run cashX(Math.trunc($FResult*_vignette.effect), "publicServant", $slaves[$i])>>
 		<<set _incomeStats.rep += Math.trunc($FResult*_vignette.effect)>>
 	<<elseif (_vignette.type == "devotion")>>
 		<<if (_vignette.effect > 0)>>
diff --git a/src/uncategorized/saWhore.tw b/src/uncategorized/saWhore.tw
index 21cae4ef1c8..ec228393a2c 100644
--- a/src/uncategorized/saWhore.tw
+++ b/src/uncategorized/saWhore.tw
@@ -1061,7 +1061,8 @@ $His appearance attracted $beauty customers (<<print Math.trunc($beauty/7)>> a d
 <</if>>
 
 In total, you were paid @@.yellowgreen;<<print cashFormat(Math.trunc($beauty*$FResult))>>@@ for the use of $slaves[$i].slaveName's body this week.
-<<set $cash += Math.trunc(($beauty*$FResult)*(1+(0.002*$slaves[$i].whoreSkill)))>>
+<<set _cashX = Math.trunc(($beauty*$FResult)*(1+(0.002*$slaves[$i].whoreSkill)))>>
+<<run cashX(_cashX, "whore", $slaves[$i])>>
 <<set _incomeStats.income += Math.trunc(($beauty*$FResult)*(1+(0.002*$slaves[$i].whoreSkill)))>>
 
 /* FACILITY DECORATION IMPACTS */
@@ -1227,7 +1228,8 @@ In total, you were paid @@.yellowgreen;<<print cashFormat(Math.trunc($beauty*$FR
 		<<else>>
 			an incident without lasting effect.
 		<</if>>
-		<<set $cash += Math.trunc($FResult*_vignette.effect)>>
+		<<set _cashX = Math.trunc($FResult*_vignette.effect)>>
+		<<run cashX(_cashX, "whore", $slaves[$i])>>
 	<<set _incomeStats.income += Math.trunc($FResult*_vignette.effect)>>
 	<<elseif (_vignette.type == "devotion")>>
 		<<if (_vignette.effect > 0)>>
diff --git a/src/uncategorized/saWorkAGloryHole.tw b/src/uncategorized/saWorkAGloryHole.tw
index 7a48cf2fe60..687e5b0dd49 100644
--- a/src/uncategorized/saWorkAGloryHole.tw
+++ b/src/uncategorized/saWorkAGloryHole.tw
@@ -265,6 +265,6 @@ $His feelings, skills, and appearance do not matter. $He is condemned to a world
 	<<set $slaves[$i].bellyImplant += _cervixPump>>
 <</if>>
 
-<<set $cash += ($beauty*$FResult)>>
+<<run cashX(($beauty*$FResult), "gloryhole", $slaves[$i])>>
 <<set _profits += ($beauty*$FResult)>>
 <<set _incomeStats.income += ($beauty*$FResult)>>
diff --git a/src/uncategorized/saWorkTheFarm.tw b/src/uncategorized/saWorkTheFarm.tw
index 0f6b72fb477..3523da7dfb1 100644
--- a/src/uncategorized/saWorkTheFarm.tw
+++ b/src/uncategorized/saWorkTheFarm.tw
@@ -164,7 +164,7 @@ gets milked this week.
 		<<set $milkSale = $milk*6>>
 		$His milk is sold for @@.yellowgreen;<<print cashFormat($milkSale)>>.@@
 	<</if>>
-	<<set $cash += $milkSale>>
+	<<run cashX($milkSale, "milked", $slaves[$i])>>
 	<<set _incomeStats.income += $milkSale>>
 
 	<<if $slaves[$i].fetishKnown>>
@@ -386,7 +386,7 @@ gets milked this week.
 		<<if $slaves[$i].vasectomy == 1 || $slaves[$i].ballType == "sterile">><<set _cumSale *= 0.2>><<elseif $slaves[$i].prostate == 3>><<set _cumSale *= 0.5>><</if>>
 		$He produces <<print $cum>> deciliters of cum over the week; the fresh ejaculate, which is in high demand given the new cultural preference for slave products, is sold for @@.yellowgreen;<<print cashFormat(_cumSale)>>.@@
 	<</if>>
-	<<set $cash += _cumSale>>
+	<<run cashX(_cumSale, "milked", $slaves[$i])>>
 	<<set _incomeStats.income += _cumSale>>
 
 	<<if ($slaves[$i].energy > 95)>>
@@ -458,7 +458,7 @@ gets milked this week.
 		Because of your arcology's cultural preferences, it comes with extra value.
 	<</if>>
 	It is sold for @@.yellowgreen;<<print cashFormat($fluidSale)>>.@@
-	<<set $cash += $fluidSale>>
+	<<run cashX($fluidSale, "milked", $slaves[$i])>>
 	<<set _incomeStats.income += $fluidSale>>
 <</if>> /* CLOSES FEMALE PROSTATE FLUID GATHERING */
 
@@ -479,7 +479,7 @@ gets milked this week.
 		<<else>>
 			an incident without lasting effect.
 		<</if>>
-		<<set $cash += Math.trunc($FResult*_vignette.effect)>>
+		<<run cashX(Math.trunc($FResult*_vignette.effect), "milked", $slaves[$i])>>
 		<<set _incomeStats.income += Math.trunc($FResult*_vignette.effect)>>
 	<<elseif (_vignette.type == "devotion")>>
 		<<if (_vignette.effect > 0)>>
diff --git a/src/uncategorized/sellSlave.tw b/src/uncategorized/sellSlave.tw
index df558ab6ee2..934be4fefd4 100644
--- a/src/uncategorized/sellSlave.tw
+++ b/src/uncategorized/sellSlave.tw
@@ -687,7 +687,7 @@ A reputable slave appraiser arrives promptly to inspect $him and certify $his qu
 <<set _Price = 500*Math.trunc(($slaveCost*1.1)/500)>>
 	<br>The current offer for $him stands at ''<<print cashFormat(_Price)>>''.
 	<<link "Accept bid" "Slave Sold">>
-		<<set $cash += _Price>>
+		<<run cashX(_Price, "slaveTransfer")>>
 		<<set $buyer = "elite auction">>
 	<</link>>
 <<else>>
@@ -766,7 +766,7 @@ __Bids Received__
 <</if>>
 <<if _NewOwner == 1>>
 	<<link "Accept bid""Slave Sold">>
-	<<set $cash += _Price>>
+	<<run cashX(_Price, "slaveTransfer")>>
 	<</link>>
 <</if>>
 
@@ -775,7 +775,8 @@ __Bids Received__
 	<<if random(1,100) > 50>>
 	<br>''<<print cashFormat(500*Math.trunc(($slaveCost*0.9)/500))>>'' from a polite older citizen looking for a housekeeper and bedwarmer.
 	<<link "Accept bid" "Slave Sold">>
-		<<set $cash += 500*Math.trunc(($slaveCost*0.9)/500)>>
+		<<set _Price += 500*Math.trunc(($slaveCost*0.9)/500)>>
+		<<run cashX(_Price, "slaveSold", $activeSlave)>>
 		<<set $buyer = "housekeeper">>
 	<</link>>
 	<</if>>
@@ -788,7 +789,8 @@ __Bids Received__
 	<<if random(1,100) > 60>>
 	<br>''<<print cashFormat(500*Math.trunc(($slaveCost*1.05)/500))>>'' from a male citizen who wants to ensure his posterity by using $him to carry his children.
 	<<link "Accept bid" "Slave Sold">>
-		<<set $cash += 500*Math.trunc(($slaveCost*1.05)/500)>>
+		<<set _Price += 500*Math.trunc(($slaveCost*1.05)/500)>>
+		<<run cashX(_Price, "slaveSold", $activeSlave)>>
 		<<set $buyer = "preg fetishist">>
 	<</link>>
 	<</if>>
@@ -798,7 +800,8 @@ __Bids Received__
 	<<if random(1,100) > 60>>
 	<br>''<<print cashFormat(500*Math.trunc(($slaveCost*1.05)/500))>>'' from an organ modifier interested in $his anal womb.
 	<<link "Accept bid" "Slave Sold">>
-		<<set $cash += 500*Math.trunc(($slaveCost*1.05)/500)>>
+		<<set _Price += 500*Math.trunc(($slaveCost*1.05)/500)>>
+		<<run cashX(_Price, "slaveSold", $activeSlave)>>
 		<<set $buyer = "organ crafter">>
 	<</link>>
 	<</if>>
@@ -809,7 +812,8 @@ __Bids Received__
 	<<if random(1,100) > 60>>
 	<br>''<<print cashFormat(400*Math.trunc(($slaveCost*1.05)/500))>>'' from a pharmaceuticals corporation looking for fertile virgins for testing extreme fertility drugs.
 	<<link "Accept bid" "Slave Sold">>
-		<<set $cash += 400*Math.trunc(($slaveCost*1.05)/500)>>
+		<<set _Price += 400*Math.trunc(($slaveCost*1.05)/500)>>
+		<<run cashX(_Price, "slaveSold", $activeSlave)>>
 		<<set $buyer = "womb filler">>
 	<</link>>
 	<</if>>
@@ -822,7 +826,8 @@ __Bids Received__
 	<<if random(1,100) > 90>>
 	<br>''<<print cashFormat(500*Math.trunc(($slaveCost*1.1)/500))>>'' from a fellow arcology owner seeking a smart, pretty slave to use as a breeder to produce superior children.
 	<<link "Accept bid" "Slave Sold">>
-		<<set $cash += 500*Math.trunc(($slaveCost*1.1)/500)>>
+		<<set _Price += 500*Math.trunc(($slaveCost*1.1)/500)>>
+		<<run cashX(_Price, "slaveSold", $activeSlave)>>
 		<<set $buyer = "eugenics arcology">>
 	<</link>>
 	<</if>>
@@ -835,7 +840,8 @@ __Bids Received__
 	<<if random(1,100) > 60>>
 	<br>''<<print cashFormat(500*Math.trunc(($slaveCost*1.05)/500))>>'' from a fellow arcology owner focusing on building a future society based on his genes: he seeks fertile virgins with wide hips, feeling they will be the best mothers.
 	<<link "Accept bid" "Slave Sold">>
-		<<set $cash += 500*Math.trunc(($slaveCost*1.05)/500)>>
+		<<set _Price += 500*Math.trunc(($slaveCost*1.05)/500)>>
+		<<run cashX(_Price, "slaveSold", $activeSlave)>>
 		<<set $buyer = "repopulationist arcology">>
 	<</link>>
 	<</if>>
@@ -846,7 +852,8 @@ __Bids Received__
 	<<if random(1,100) > 60>>
 	<br>''<<print cashFormat(500*Math.trunc(($slaveCost*1.3)/500))>>'' from a slave trader with a notorious virgin impregnation fetish: he uses his work to provide himself with an endless supply of virgins to knock up and resell.
 	<<link "Accept bid" "Slave Sold">>
-		<<set $cash += 500*Math.trunc(($slaveCost*1.3)/500)>>
+		<<set _Price += 500*Math.trunc(($slaveCost*1.3)/500)>>
+		<<run cashX(_Price, "slaveSold", $activeSlave)>>
 		<<set $buyer = "virgin trader">>
 	<</link>>
 	<</if>>
@@ -861,7 +868,8 @@ __Bids Received__
 	<<if random(1,100) > 60>>
 	<br>''<<print cashFormat(500*Math.trunc(($slaveCost*1.05)/500))>>'' from a group that takes pleasure in performing abortions on live TV.
 	<<link "Accept bid" "Slave Sold">>
-		<<set $cash += 400*Math.trunc(($slaveCost*1.05)/500)>>
+		<<set _Price += 400*Math.trunc(($slaveCost*1.05)/500)>>
+		<<run cashX(_Price, "slaveSold", $activeSlave)>>
 		<<set $buyer = "abortion TV">>
 	<</link>>
 	<</if>>
@@ -874,7 +882,8 @@ __Bids Received__
 	<<if random(1,100) > 60>>
 	<br>''<<print cashFormat(500*Math.trunc(($slaveCost*1.05)/500))>>'' from a female citizen with a very specific fetish: she loves breasts to the point of enjoying slaves with nipples large enough to meaningfully penetrate her.
 	<<link "Accept bid" "Slave Sold">>
-		<<set $cash += 500*Math.trunc(($slaveCost*1.05)/500)>>
+		<<set _Price += 500*Math.trunc(($slaveCost*1.05)/500)>>
+		<<run cashX(_Price, "slaveSold", $activeSlave)>>
 		<<set $buyer = "nipple fetishist">>
 	<</link>>
 	<</if>>
@@ -884,7 +893,8 @@ __Bids Received__
 	<<if random(1,100) > 60>>
 	<br>''<<print cashFormat(500*Math.trunc(($slaveCost*1.1)/500))>>'' from a male citizen with a kink that's hard to satisfy: he loves nipple fucking, but hates how breasts just don't work that way.
 	<<link "Accept bid" "Slave Sold">>
-		<<set $cash += 500*Math.trunc(($slaveCost*1.1)/500)>>
+		<<set _Price += 500*Math.trunc(($slaveCost*1.1)/500)>>
+		<<run cashX(_Price, "slaveSold", $activeSlave)>>
 		<<set $buyer = "nipple fetishist">>
 	<</link>>
 	<</if>>
@@ -896,7 +906,8 @@ __Bids Received__
 	<<if random(1,100) > 60>>
 	<br>''<<print cashFormat(500*Math.trunc(($slaveCost*1.05)/500))>>'' from a citizen who enjoys buttfucking slaves with the necessary equipment, willingness, and anal skill to reward his efforts with messy, hands-free orgasms of their own.
 	<<link "Accept bid" "Slave Sold">>
-		<<set $cash += 500*Math.trunc(($slaveCost*1.05)/500)>>
+		<<set _Price += 500*Math.trunc(($slaveCost*1.05)/500)>>
+		<<run cashX(_Price, "slaveSold", $activeSlave)>>
 		<<set $buyer = "anal fetishist">>
 	<</link>>
 	<</if>>
@@ -909,7 +920,8 @@ __Bids Received__
 	<<if random(1,100) > 60>>
 	<br>''<<print cashFormat(500*Math.trunc(($slaveCost*1.05)/500))>>'' from an unusually well-endowed citizen who strongly prefers oral sex with willing partners who can deepthroat him successfully.
 	<<link "Accept bid" "Slave Sold">>
-		<<set $cash += 500*Math.trunc(($slaveCost*1.05)/500)>>
+		<<set _Price += 500*Math.trunc(($slaveCost*1.05)/500)>>
+		<<run cashX(_Price, "slaveSold", $activeSlave)>>
 		<<set $buyer = "oral fetishist">>
 	<</link>>
 	<</if>>
@@ -921,7 +933,8 @@ __Bids Received__
 	<<if random(1,100) > 60>>
 	<br>''<<print cashFormat(500*Math.trunc(($slaveCost*1.05)/500))>>'' from a sadistic citizen who likes hurting her slaves, dislikes masochists for their enjoyment of her treatment, yet prefers slaves who will not hate her.
 	<<link "Accept bid" "Slave Sold">>
-		<<set $cash += 500*Math.trunc(($slaveCost*1.05)/500)>>
+		<<set _Price += 500*Math.trunc(($slaveCost*1.05)/500)>>
+		<<run cashX(_Price, "slaveSold", $activeSlave)>>
 		<<set $buyer = "pain fetishist">>
 	<</link>>
 	<</if>>
@@ -934,7 +947,8 @@ __Bids Received__
 	<<if random(1,100) > 60>>
 	<br>''<<print cashFormat(500*Math.trunc(($slaveCost*1.05)/500))>>'' from a sadistic citizen who is looking for an imposing, stupid slave she can train to rape her victims on command.
 	<<link "Accept bid" "Slave Sold">>
-		<<set $cash += 500*Math.trunc(($slaveCost*1.05)/500)>>
+		<<set _Price += 500*Math.trunc(($slaveCost*1.05)/500)>>
+		<<run cashX(_Price, "slaveSold", $activeSlave)>>
 		<<set $buyer = "sadism fetishist">>
 	<</link>>
 	<</if>>
@@ -948,7 +962,8 @@ __Bids Received__
 	<<if random(1,100) > 60>>
 	<br>''<<print cashFormat(500*Math.trunc(($slaveCost*1.05)/500))>>'' from a newly wealthy citizen who is expanding his household and is interested in smart, educated, and obedient slaves for leadership roles.
 	<<link "Accept bid" "Slave Sold">>
-		<<set $cash += 500*Math.trunc(($slaveCost*1.05)/500)>>
+		<<set _Price += 500*Math.trunc(($slaveCost*1.05)/500)>>
+		<<run cashX(_Price, "slaveSold", $activeSlave)>>
 		<<set $buyer = "dom fetishist">>
 	<</link>>
 	<</if>>
@@ -961,7 +976,8 @@ __Bids Received__
 	<<if random(1,100) > 60>>
 	<br>''<<print cashFormat(500*Math.trunc(($slaveCost*1.05)/500))>>'' from a citizen whose job keeps her deskbound; bored, she's looking for a devoted oral slave to occupy the space under the desk and be her constant pussylicking appliance.
 	<<link "Accept bid" "Slave Sold">>
-		<<set $cash += 500*Math.trunc(($slaveCost*1.05)/500)>>
+		<<set _Price += 500*Math.trunc(($slaveCost*1.05)/500)>>
+		<<run cashX(_Price, "slaveSold", $activeSlave)>>
 		<<set $buyer = "sub fetishist">>
 	<</link>>
 	<</if>>
@@ -972,7 +988,8 @@ __Bids Received__
 	<<if random(1,100) > 60>>
 	<br>''<<print cashFormat(500*Math.trunc(($slaveCost*1.3)/500))>>'' from a wealthy citizen infamous for cruelly raping anal virgins in public; he buys and abuses a new one every few weeks.
 	<<link "Accept bid" "Slave Sold">>
-		<<set $cash += 500*Math.trunc(($slaveCost*1.3)/500)>>
+		<<set _Price += 500*Math.trunc(($slaveCost*1.3)/500)>>
+		<<run cashX(_Price, "slaveSold", $activeSlave)>>
 		<<set $buyer = "buttbreaker">>
 	<</link>>
 	<</if>>
@@ -984,7 +1001,8 @@ __Bids Received__
 	<<if random(1,100) > 60>>
 	<br>''<<print cashFormat(500*Math.trunc(($slaveCost*1.1)/500))>>'' from a small, local slave trainer interested in using $him to help train new slaves in the sexual arts.
 	<<link "Accept bid" "Slave Sold">>
-		<<set $cash += 500*Math.trunc(($slaveCost*1.1)/500)>>
+		<<set _Price += 500*Math.trunc(($slaveCost*1.1)/500)>>
+		<<run cashX(_Price, "slaveSold", $activeSlave)>>
 		<<set $buyer = "trainer staffing">>
 	<</link>>
 	<</if>>
@@ -1000,7 +1018,8 @@ __Bids Received__
 	<<if random(1,100) > 60>>
 	<br>''<<print cashFormat(500*Math.trunc(($slaveCost*1.4)/500))>>'' from a skilled slave trainer who feels that MILFs make the best slave trainers.
 	<<link "Accept bid" "Slave Sold">>
-		<<set $cash += 500*Math.trunc(($slaveCost*1.4)/500)>>
+		<<set _Price += 500*Math.trunc(($slaveCost*1.4)/500)>>
+		<<run cashX(_Price, "slaveSold", $activeSlave)>>
 		<<set $buyer = "D milf staffing">>
 	<</link>>
 	<</if>>
@@ -1017,7 +1036,8 @@ __Bids Received__
 	<<if random(1,100) > 60>>
 	<br>''<<print cashFormat(500*Math.trunc(($slaveCost*1.25)/500))>>'' from a prominent citizen with a notorious fetish for fertile, natural cows.
 	<<link "Accept bid" "Slave Sold">>
-		<<set $cash += 500*Math.trunc(($slaveCost*1.25)/500)>>
+		<<set _Price += 500*Math.trunc(($slaveCost*1.25)/500)>>
+		<<run cashX(_Price, "slaveSold", $activeSlave)>>
 		<<set $buyer = "D hucow">>
 	<</link>>
 	<</if>>
@@ -1033,7 +1053,8 @@ __Bids Received__
 	<<if random(1,100) > 60>>
 	<br>''<<print cashFormat(500*Math.trunc(($slaveCost*1.35)/500))>>'' from a prominent citizen who's pursuing some sort of mercenary project that requires worryingly large numbers of thin <<print $girl>>s with sharp teeth.
 	<<link "Accept bid" "Slave Sold">>
-		<<set $cash += 500*Math.trunc(($slaveCost*1.35)/500)>>
+		<<set _Price += 500*Math.trunc(($slaveCost*1.35)/500)>>
+		<<run cashX(_Price, "slaveSold", $activeSlave)>>
 		<<set $buyer = "D startled the witch">>
 	<</link>>
 	<</if>>
@@ -1049,7 +1070,8 @@ __Bids Received__
 	<<if random(1,100) > 60>>
 	<br>''<<print cashFormat(500*Math.trunc(($slaveCost*1.35)/500))>>'' from a prominent citizen who appreciates <<print $girl>>s who are both vaginal virgins and anal veterans.
 	<<link "Accept bid" "Slave Sold">>
-		<<set $cash += 500*Math.trunc(($slaveCost*1.35)/500)>>
+		<<set _Price += 500*Math.trunc(($slaveCost*1.35)/500)>>
+		<<run cashX(_Price, "slaveSold", $activeSlave)>>
 		<<set $buyer = "D virgin asspussy">>
 	<</link>>
 	<</if>>
@@ -1065,7 +1087,8 @@ __Bids Received__
 	<<if random(1,100) > 60>>
 	<br>''<<print cashFormat(500*Math.trunc(($slaveCost*1.35)/500))>>'' from a prominent citizen with moist palms who insistently refers to $him as "his waifu," whatever that means.
 	<<link "Accept bid" "Slave Sold">>
-		<<set $cash += 500*Math.trunc(($slaveCost*1.35)/500)>>
+		<<set _Price += 500*Math.trunc(($slaveCost*1.35)/500)>>
+		<<run cashX(_Price, "slaveSold", $activeSlave)>>
 		<<set $buyer = "D waifu">>
 	<</link>>
 	<</if>>
@@ -1081,7 +1104,8 @@ __Bids Received__
 	<<if random(1,100) > 60>>
 	<br>''<<print cashFormat(500*Math.trunc(($slaveCost*1.35)/500))>>'' from a prominent citizen who likes to provide his favored, well-endowed slaves with subordinate, orally skilled dickgirls with nice butts.
 	<<link "Accept bid" "Slave Sold">>
-		<<set $cash += 500*Math.trunc(($slaveCost*1.35)/500)>>
+		<<set _Price += 500*Math.trunc(($slaveCost*1.35)/500)>>
+		<<run cashX(_Price, "slaveSold", $activeSlave)>>
 		<<set $buyer = "D oral servants">>
 	<</link>>
 	<</if>>
@@ -1099,7 +1123,8 @@ __Bids Received__
 	<<if random(1,100) > 60>>
 	<br>''<<print cashFormat(500*Math.trunc(($slaveCost*1.35)/500))>>'' from a prominent citizen who prefers slaves that look like demure <<print $girl>>s with their clothes on, and are willing to take cock up their pretty asspussies.
 	<<link "Accept bid" "Slave Sold">>
-		<<set $cash += 500*Math.trunc(($slaveCost*1.35)/500)>>
+		<<set _Price += 500*Math.trunc(($slaveCost*1.35)/500)>>
+		<<run cashX(_Price, "slaveSold", $activeSlave)>>
 		<<set $buyer = "D trap lover">>
 	<</link>>
 	<</if>>
@@ -1117,7 +1142,8 @@ __Bids Received__
 	<<if random(1,100) > 60>>
 	<br>''<<print cashFormat(500*Math.trunc(($slaveCost*1.35)/500))>>'' from an eccentric citizen notorious for keeping tall slaves with huge soft butts, just so he can bury himself between their cheeks when they're standing.
 	<<link "Accept bid" "Slave Sold">>
-		<<set $cash += 500*Math.trunc(($slaveCost*1.35)/500)>>
+		<<set _Price += 500*Math.trunc(($slaveCost*1.35)/500)>>
+		<<run cashX(_Price, "slaveSold", $activeSlave)>>
 		<<set $buyer = "D butt bury">>
 	<</link>>
 	<</if>>
@@ -1136,7 +1162,8 @@ __Bids Received__
 	<<if random(1,100) > 60>>
 	<br>''<<print cashFormat(500*Math.trunc(($slaveCost*1.35)/500))>>'' from a prominent citizen with strong opinions on futas: he likes a feminine $girl with a nice cock, a lovely pussy, no visible balls and yet the ability to get hard, and plentifully milky nipples.
 	<<link "Accept bid" "Slave Sold">>
-		<<set $cash += 500*Math.trunc(($slaveCost*1.35)/500)>>
+		<<set _Price += 500*Math.trunc(($slaveCost*1.35)/500)>>
+		<<run cashX(_Price, "slaveSold", $activeSlave)>>
 		<<set $buyer = "D milky herm">>
 	<</link>>
 	<</if>>
@@ -1156,7 +1183,8 @@ __Bids Received__
 	<<if random(1,100) > 60>>
 	<br>''<<print cashFormat(500*Math.trunc(($slaveCost*1.35)/500))>>'' from a prominent citizen whose friends never let him hear the end of his incorrigibly romantic treatment of his apartment full of amazons.
 	<<link "Accept bid" "Slave Sold">>
-		<<set $cash += 500*Math.trunc(($slaveCost*1.35)/500)>>
+		<<set _Price += 500*Math.trunc(($slaveCost*1.35)/500)>>
+		<<run cashX(_Price, "slaveSold", $activeSlave)>>
 		<<set $buyer = "D amazon hunter">>
 	<</link>>
 	<</if>>
@@ -1174,7 +1202,8 @@ __Bids Received__
 	<<if random(1,100) > 60>>
 	<br>''<<print cashFormat(500*Math.trunc(($slaveCost*1.35)/500))>>'' from a prominent citizen who keeps a large harem of lithe, muscular <<print $girl>>s to bear him children.
 	<<link "Accept bid" "Slave Sold">>
-		<<set $cash += 500*Math.trunc(($slaveCost*1.35)/500)>>
+		<<set _Price += 500*Math.trunc(($slaveCost*1.35)/500)>>
+		<<run cashX(_Price, "slaveSold", $activeSlave)>>
 		<<set $buyer = "D shorty breeder">>
 	<</link>>
 	<</if>>
@@ -1192,7 +1221,8 @@ __Bids Received__
 	<<if random(1,100) > 60>>
 	<br>''<<print cashFormat(500*Math.trunc(($slaveCost*1.35)/500))>>'' from a prominent citizen who's looking for a fresh, skilled pair of lips eager to wrap around a thick cock.
 	<<link "Accept bid" "Slave Sold">>
-		<<set $cash += 500*Math.trunc(($slaveCost*1.35)/500)>>
+		<<set _Price += 500*Math.trunc(($slaveCost*1.35)/500)>>
+		<<run cashX(_Price, "slaveSold", $activeSlave)>>
 		<<set $buyer = "D oral servants">>
 	<</link>>
 	<</if>>
@@ -1210,7 +1240,8 @@ __Bids Received__
 	<<if random(1,100) > 80>>
 	<br>''<<print cashFormat(500*Math.trunc(($slaveCost*1.15)/500))>>'' from a prominent citizen who's a notoriously inexperienced lover; it's painfully obvious that he prefers inexperienced slaves as they make him feel less insecure.
 	<<link "Accept bid" "Slave Sold">>
-		<<set $cash += 500*Math.trunc(($slaveCost*1.15)/500)>>
+		<<set _Price += 500*Math.trunc(($slaveCost*1.15)/500)>>
+		<<run cashX(_Price, "slaveSold", $activeSlave)>>
 		<<set $buyer = "D r9k">>
 	<</link>>
 	<</if>>
@@ -1227,7 +1258,8 @@ __Bids Received__
 	<<if random(1,100) > 60>>
 	<br>''<<print cashFormat(500*Math.trunc(($slaveCost*1.25)/500))>>'' from a prominent citizen who takes unusually close interest in $his health and muscle tone, and cannot quite hide his salivation as he does so.
 	<<link "Accept bid" "Slave Sold">>
-		<<set $cash += 500*Math.trunc(($slaveCost*1.25)/500)>>
+		<<set _Price += 500*Math.trunc(($slaveCost*1.25)/500)>>
+		<<run cashX(_Price, "slaveSold", $activeSlave)>>
 		<<set $buyer = "D cannibal">>
 	<</link>>
 	<</if>>
@@ -1240,7 +1272,8 @@ __Bids Received__
 	<<if random(1,100) == 69>>
 	<br>''<<print cashFormat(200*Math.trunc(($slaveCost*2)/200))>>'' from an obsessive fan who absolutely must have $him for himself.
 	<<link "Accept bid" "Slave Sold">>
-		<<set $cash += 200*Math.trunc(($slaveCost*2)/200)>>
+		<<set _Price += 200*Math.trunc(($slaveCost*2)/200)>>
+		<<run cashX(_Price, "slaveSold", $activeSlave)>>
 		<<set $buyer = "obsessed fan">>
 	<</link>>
 	<</if>>
@@ -1248,7 +1281,8 @@ __Bids Received__
 	<<if random(1,100) > 90>>
 	<br>''<<print cashFormat(500*Math.trunc(($slaveCost*1.3)/500))>>'' from a studio interested in continued production of $his porn.
 	<<link "Accept bid" "Slave Sold">>
-		<<set $cash += 500*Math.trunc(($slaveCost*1.3)/500)>>
+		<<set _Price += 500*Math.trunc(($slaveCost*1.3)/500)>>
+		<<run cashX(_Price, "slaveSold", $activeSlave)>>
 		<<set $buyer = "porn studio">>
 	<</link>>
 	<</if>>
@@ -1259,7 +1293,8 @@ __Bids Received__
 	<<if random(1,100) > 60>>
 	<br>''<<print cashFormat(500*Math.trunc(($slaveCost*1.1)/500))>>'' from a slave trainer that specializes in educating slaves and reselling them at a profit.
 	<<link "Accept bid" "Slave Sold">>
-		<<set $cash += 500*Math.trunc(($slaveCost*1.1)/500)>>
+		<<set _Price += 500*Math.trunc(($slaveCost*1.1)/500)>>
+		<<run cashX(_Price, "slaveSold", $activeSlave)>>
 		<<set $buyer = "teaching trainer">>
 	<</link>>
 	<</if>>
@@ -1271,7 +1306,8 @@ __Bids Received__
 	<<if random(1,100) > 60>>
 	<br>''<<print cashFormat(500*Math.trunc(($slaveCost*1.1)/500))>>'' from a slave trainer that specializes in filling slaves with implants before resale.
 	<<link "Accept bid" "Slave Sold">>
-		<<set $cash += 500*Math.trunc(($slaveCost*1.1)/500)>>
+		<<set _Price += 500*Math.trunc(($slaveCost*1.1)/500)>>
+		<<run cashX(_Price, "slaveSold", $activeSlave)>>
 		<<set $buyer = "implanting trainer">>
 	<</link>>
 	<</if>>
@@ -1283,7 +1319,8 @@ __Bids Received__
 	<<if random(1,100) > 60>>
 	<br>''<<print cashFormat(500*Math.trunc(($slaveCost*1.1)/500))>>'' from a slave trainer that specializes in fixing slaves who have been surgically ruined with overimplantation.
 	<<link "Accept bid" "Slave Sold">>
-		<<set $cash += 500*Math.trunc(($slaveCost*1.1)/500)>>
+		<<set _Price += 500*Math.trunc(($slaveCost*1.1)/500)>>
+		<<run cashX(_Price, "slaveSold", $activeSlave)>>
 		<<set $buyer = "purifying trainer">>
 	<</link>>
 	<</if>>
@@ -1297,7 +1334,8 @@ __Bids Received__
 	<<if random(1,100) > 60>>
 	<br>''<<print cashFormat(500*Math.trunc(($slaveCost*1.1)/500))>>'' from a slave trainer that specializes in slimming down fat slaves to appeal to buyers who prefer slim <<print $girl>>s.
 	<<link "Accept bid" "Slave Sold">>
-		<<set $cash += 500*Math.trunc(($slaveCost*1.1)/500)>>
+		<<set _Price += 500*Math.trunc(($slaveCost*1.1)/500)>>
+		<<run cashX(_Price, "slaveSold", $activeSlave)>>
 		<<set $buyer = "slimming trainer">>
 	<</link>>
 	<</if>>
@@ -1313,7 +1351,8 @@ __Bids Received__
 	<<if random(1,100) > 60>>
 	<br>''<<print cashFormat(500*Math.trunc(($slaveCost*1.1)/500))>>'' from a slave trainer that specializes in improving slaves with disappointing assets; they prefer pharmaceutical means but are not averse to surgical intervention if necessary.
 	<<link "Accept bid" "Slave Sold">>
-		<<set $cash += 500*Math.trunc(($slaveCost*1.1)/500)>>
+		<<set _Price += 500*Math.trunc(($slaveCost*1.1)/500)>>
+		<<run cashX(_Price, "slaveSold", $activeSlave)>>
 		<<set $buyer = "broadening trainer">>
 	<</link>>
 	<</if>>
@@ -1328,7 +1367,8 @@ __Bids Received__
 	<<if random(1,100) > 60>>
 	<br>''<<print cashFormat(500*Math.trunc(($slaveCost*1.1)/500))>>'' from a slave trainer that specializes in getting $women ready to be dairy cows by using aggressive hormonal and pharmaceutical treatment to balloon their tits.
 	<<link "Accept bid" "Slave Sold">>
-		<<set $cash += 500*Math.trunc(($slaveCost*1.1)/500)>>
+		<<set _Price += 500*Math.trunc(($slaveCost*1.1)/500)>>
+		<<run cashX(_Price, "slaveSold", $activeSlave)>>
 		<<set $buyer = "cow trainer">>
 	<</link>>
 	<</if>>
@@ -1342,7 +1382,8 @@ __Bids Received__
 	<<if random(1,100) > 60>>
 	<br>''<<print cashFormat(500*Math.trunc(($slaveCost*1.1)/500))>>'' from a slave trainer that specializes in feminizing imperfect shemales; an orchiectomy is invariably their first step.
 	<<link "Accept bid" "Slave Sold">>
-		<<set $cash += 500*Math.trunc(($slaveCost*1.1)/500)>>
+		<<set _Price += 500*Math.trunc(($slaveCost*1.1)/500)>>
+		<<run cashX(_Price, "slaveSold", $activeSlave)>>
 		<<set $buyer = "clipping trainer">>
 	<</link>>
 	<</if>>
@@ -1356,7 +1397,8 @@ __Bids Received__
 	<<if random(1,100) > 60>>
 	<br>''<<print cashFormat(500*Math.trunc(($slaveCost*1.1)/500))>>'' from a slave trainer that specializes in creating proper slave $women from raw material that falls short of that ideal but has potential anyway.
 	<<link "Accept bid" "Slave Sold">>
-		<<set $cash += 500*Math.trunc(($slaveCost*1.1)/500)>>
+		<<set _Price += 500*Math.trunc(($slaveCost*1.1)/500)>>
+		<<run cashX(_Price, "slaveSold", $activeSlave)>>
 		<<set $buyer = "reassignment trainer">>
 	<</link>>
 	<</if>>
@@ -1369,7 +1411,8 @@ __Bids Received__
 	<<if random(1,100) > 70>>
 	<br>''<<print cashFormat(500*Math.trunc(($slaveCost*1.25)/500))>>'' from a fellow arcology owner working towards autarkic slave pastoralism. He's awed by $his milk productivity.
 	<<link "Accept bid" "Slave Sold">>
-		<<set $cash += 500*Math.trunc(($slaveCost*1.25)/500)>>
+		<<set _Price += 500*Math.trunc(($slaveCost*1.25)/500)>>
+		<<run cashX(_Price, "slaveSold", $activeSlave)>>
 		<<set $buyer = "pastoralist arcology">>
 	<</link>>
 	<</if>>
@@ -1382,7 +1425,8 @@ __Bids Received__
 	<<if random(1,100) > 70>>
 	<br>''<<print cashFormat(500*Math.trunc(($slaveCost*1.25)/500))>>'' from a fellow arcology owner building a facsimile of ancient Egypt. He's in the market for wise and educated slaves willing to pass on their skills.
 	<<link "Accept bid" "Slave Sold">>
-		<<set $cash += 500*Math.trunc(($slaveCost*1.25)/500)>>
+		<<set _Price += 500*Math.trunc(($slaveCost*1.25)/500)>>
+		<<run cashX(_Price, "slaveSold", $activeSlave)>>
 		<<set $buyer = "egyptian revivalist arcology">>
 	<</link>>
 	<</if>>
@@ -1396,7 +1440,8 @@ __Bids Received__
 	<<if random(1,100) > 70>>
 	<br>''<<print cashFormat(500*Math.trunc(($slaveCost*1.25)/500))>>'' from a fellow arcology owner building a recreation of the Great Aztec Empire. He's in the market for willing, strong and combat ready slaves, to bolster his empire
 	<<link "Accept bid" "Slave Sold">>
-		<<set $cash += 500*Math.trunc(($slaveCost*1.25)/500)>>
+		<<set _Price += 500*Math.trunc(($slaveCost*1.25)/500)>>
+		<<run cashX(_Price, "slaveSold", $activeSlave)>>
 		<<set $buyer = "aztec revivalist arcology">>
 	<</link>>
 	<</if>>
@@ -1410,7 +1455,8 @@ __Bids Received__
 	<<if random(1,100) > 70>>
 	<br>''<<print cashFormat(500*Math.trunc(($slaveCost*1.25)/500))>>'' from a fellow arcology owner building a facsimile of classical Rome. He's in the market for slaves with basic combat skills to fight in modern gladiatorial combats.
 	<<link "Accept bid" "Slave Sold">>
-		<<set $cash += 500*Math.trunc(($slaveCost*1.25)/500)>>
+		<<set _Price += 500*Math.trunc(($slaveCost*1.25)/500)>>
+		<<run cashX(_Price, "slaveSold", $activeSlave)>>
 		<<set $buyer = "roman revivalist arcology">>
 	<</link>>
 	<</if>>
@@ -1423,7 +1469,8 @@ __Bids Received__
 	<<if random(1,100) > 70>>
 	<br>''<<print cashFormat(500*Math.trunc(($slaveCost*1.25)/500))>>'' from a fellow arcology owner with interesting religious beliefs, which require beautiful slaves to be available to the public. Since $activeSlave.slaveName is pretty and not heavily used, he considers it a duty to buy $him and make $him a holy prostitute.
 	<<link "Accept bid" "Slave Sold">>
-		<<set $cash += 500*Math.trunc(($slaveCost*1.25)/500)>>
+		<<set _Price += 500*Math.trunc(($slaveCost*1.25)/500)>>
+		<<run cashX(_Price, "slaveSold", $activeSlave)>>
 		<<set $buyer = "chattel religionist arcology">>
 	<</link>>
 	<</if>>
@@ -1436,7 +1483,8 @@ __Bids Received__
 	<<if random(1,100) > 70>>
 	<br>''<<print cashFormat(500*Math.trunc(($slaveCost*1.25)/500))>>'' from a fellow arcology owner devoted to muscular ladies. He seems to feel that $activeSlave.slaveName is not at $his true potential, and wants a try at improving $his physique himself.
 	<<link "Accept bid" "Slave Sold">>
-		<<set $cash += 500*Math.trunc(($slaveCost*1.25)/500)>>
+		<<set _Price += 500*Math.trunc(($slaveCost*1.25)/500)>>
+		<<run cashX(_Price, "slaveSold", $activeSlave)>>
 		<<set $buyer = "physical idealist arcology">>
 	<</link>>
 	<</if>>
@@ -1450,7 +1498,8 @@ __Bids Received__
 	<<if random(1,100) > 70>>
 	<br>''<<print cashFormat(500*Math.trunc(($slaveCost*1.25)/500))>>'' from a fellow arcology owner devoted to chubby ladies. He seems to feel that $activeSlave.slaveName can handle a fair bit more weight, and wants a try at fattening $him up himself.
 	<<link "Accept bid" "Slave Sold">>
-		<<set $cash += 500*Math.trunc(($slaveCost*1.25)/500)>>
+		<<set _Price += 500*Math.trunc(($slaveCost*1.25)/500)>>
+		<<run cashX(_Price, "slaveSold", $activeSlave)>>
 		<<set $buyer = "hedonistic decadence arcology">>
 	<</link>>
 	<</if>>
@@ -1465,7 +1514,8 @@ __Bids Received__
 	<<if random(1,100) > 80>>
 	<br>''<<print cashFormat(500*Math.trunc(($slaveCost*1.1)/400))>>'' from a chef that likes stuffing more than just turkeys.
 	<<link "Accept bid" "Slave Sold">>
-		<<set $cash += 500*Math.trunc(($slaveCost*1.1)/400)>>
+		<<set _Price += 500*Math.trunc(($slaveCost*1.1)/400)>>
+		<<run cashX(_Price, "slaveSold", $activeSlave)>>
 		<<set $buyer = "stuffer chef">>
 	<</link>>
 	<</if>>
@@ -1479,7 +1529,8 @@ __Bids Received__
 	<<if random(1,100) > 70>>
 	<br>''<<print cashFormat(500*Math.trunc(($slaveCost*1.25)/500))>>'' from a fellow arcology owner who loves breast implants. Since large natural breasts can support larger implants, he seems to feel $activeSlave.slaveName has good potential to be implanted up to a truly gigantic size without too much stretching.
 	<<link "Accept bid" "Slave Sold">>
-		<<set $cash += 500*Math.trunc(($slaveCost*1.25)/500)>>
+		<<set _Price += 500*Math.trunc(($slaveCost*1.25)/500)>>
+		<<run cashX(_Price, "slaveSold", $activeSlave)>>
 		<<set $buyer = "transformation fetishist arcology">>
 	<</link>>
 	<</if>>
@@ -1492,7 +1543,8 @@ __Bids Received__
 	<<if random(1,100) > 70>>
 	<br>''<<print cashFormat(500*Math.trunc(($slaveCost*1.25)/500))>>'' from a fellow arcology owner who never fails to dream big. He's interested in $him mostly for growth potential, since $his assets have grown so big, so young.
 	<<link "Accept bid" "Slave Sold">>
-		<<set $cash += 500*Math.trunc(($slaveCost*1.25)/500)>>
+		<<set _Price += 500*Math.trunc(($slaveCost*1.25)/500)>>
+		<<run cashX(_Price, "slaveSold", $activeSlave)>>
 		<<set $buyer = "asset expansionist arcology">>
 	<</link>>
 	<</if>>
@@ -1507,7 +1559,8 @@ __Bids Received__
 	<<if random(1,100) > 70>>
 	<br>''<<print cashFormat(500*Math.trunc(($slaveCost*1.25)/500))>>'' from a fellow arcology owner with simple tastes. He likes his slaves young, slim, and reasonably innocent.
 	<<link "Accept bid" "Slave Sold">>
-		<<set $cash += 500*Math.trunc(($slaveCost*1.25)/500)>>
+		<<set _Price += 500*Math.trunc(($slaveCost*1.25)/500)>>
+		<<run cashX(_Price, "slaveSold", $activeSlave)>>
 		<<set $buyer = "slimness enthusiast arcology">>
 	<</link>>
 	<</if>>
@@ -1522,7 +1575,8 @@ __Bids Received__
 	<<if random(1,100) > 70>>
 	<br>''<<print cashFormat(500*Math.trunc(($slaveCost*1.25)/500))>>'' from a fellow arcology owner with a hatred of implants that reaches missionary zeal. He buys slaves full of silicone, removes their implants, reconditions them, and resells them whenever his finances will permit.
 	<<link "Accept bid" "Slave Sold">>
-		<<set $cash += 500*Math.trunc(($slaveCost*1.25)/500)>>
+		<<set _Price += 500*Math.trunc(($slaveCost*1.25)/500)>>
+		<<run cashX(_Price, "slaveSold", $activeSlave)>>
 		<<set $buyer = "body purist arcology">>
 	<</link>>
 	<</if>>
@@ -1534,7 +1588,8 @@ __Bids Received__
 	<<if random(1,100) > 70>>
 	<br>''<<print cashFormat(500*Math.trunc(($slaveCost*1.25)/500))>>'' from a fellow arcology owner who runs a terrifyingly degrading society. He prefers slaves who have been well-treated previously; it lends their screams a certain special authenticity.
 	<<link "Accept bid" "Slave Sold">>
-		<<set $cash += 500*Math.trunc(($slaveCost*1.25)/500)>>
+		<<set _Price += 500*Math.trunc(($slaveCost*1.25)/500)>>
+		<<run cashX(_Price, "slaveSold", $activeSlave)>>
 		<<set $buyer = "degradationist arcology">>
 	<</link>>
 	<</if>>
@@ -1546,7 +1601,8 @@ __Bids Received__
 	<<if random(1,100) > 70>>
 	<br>''<<print cashFormat(500*Math.trunc(($slaveCost*1.25)/500))>>'' from a fellow arcology owner with an almost messianic calling to educate and improve slaves, though somewhat hypocritically, he prefers to start with reasonably obedient <<print $girl>>s, which usually means slaves broken by someone else.
 	<<link "Accept bid" "Slave Sold">>
-		<<set $cash += 500*Math.trunc(($slaveCost*1.25)/500)>>
+		<<set _Price += 500*Math.trunc(($slaveCost*1.25)/500)>>
+		<<run cashX(_Price, "slaveSold", $activeSlave)>>
 		<<set $buyer = "paternalist arcology">>
 	<</link>>
 	<</if>>
@@ -1562,7 +1618,8 @@ __Bids Received__
 	<<if random(1,100) > 70>>
 	<br>''<<print cashFormat(500*Math.trunc(($slaveCost*1.25)/500))>>'' from a fellow arcology owner who likes willing, uncomplicated young ladies with bouncing boobs and big butts. He's an uncomplicated sort.
 	<<link "Accept bid" "Slave Sold">>
-		<<set $cash += 500*Math.trunc(($slaveCost*1.25)/500)>>
+		<<set _Price += 500*Math.trunc(($slaveCost*1.25)/500)>>
+		<<run cashX(_Price, "slaveSold", $activeSlave)>>
 		<<set $buyer = "gender fundamentalist arcology">>
 	<</link>>
 	<</if>>
@@ -1578,7 +1635,8 @@ __Bids Received__
 	<<if random(1,100) > 70>>
 	<br>''<<print cashFormat(500*Math.trunc(($slaveCost*1.25)/500))>>'' from a fellow arcology owner with a notorious fetish for the process of feminization. He prefers diamonds in the rough, because the process of polishing is so much fun.
 	<<link "Accept bid" "Slave Sold">>
-		<<set $cash += 500*Math.trunc(($slaveCost*1.25)/500)>>
+		<<set _Price += 500*Math.trunc(($slaveCost*1.25)/500)>>
+		<<run cashX(_Price, "slaveSold", $activeSlave)>>
 		<<set $buyer = "gender radicalist arcology">>
 	<</link>>
 	<</if>>
@@ -1592,7 +1650,8 @@ __Bids Received__
 	<<if random(1,100) > 70>>
 	<br>''<<print cashFormat(500*Math.trunc(($slaveCost*1.25)/500))>>'' from a fellow arcology owner with a strongly held belief that $activeSlave.race people should not be slaves. He devotes as much of his resources as he can to manumission of such <<print $girl>>s, concentrating on the downtrodden.
 	<<link "Accept bid" "Slave Sold">>
-		<<set $cash += 500*Math.trunc(($slaveCost*1.25)/500)>>
+		<<set _Price += 500*Math.trunc(($slaveCost*1.25)/500)>>
+		<<run cashX(_Price, "slaveSold", $activeSlave)>>
 		<<set $buyer = "supremacist arcology">>
 	<</link>>
 	<</if>>
@@ -1606,7 +1665,8 @@ __Bids Received__
 	<<if random(1,100) > 70>>
 	<br>''<<print cashFormat(500*Math.trunc(($slaveCost*1.25)/500))>>'' from a fellow arcology owner working on a project to breed a race of $activeSlave.race people with natural, unquestioning obedience. He clearly considers $him good stock for the project.
 	<<link "Accept bid" "Slave Sold">>
-		<<set $cash += 500*Math.trunc(($slaveCost*1.25)/500)>>
+		<<set _Price += 500*Math.trunc(($slaveCost*1.25)/500)>>
+		<<run cashX(_Price, "slaveSold", $activeSlave)>>
 		<<set $buyer = "subjugationist arcology">>
 	<</link>>
 	<</if>>
@@ -1619,7 +1679,8 @@ __Bids Received__
 	<<if random(1,100) > 50>>
 	<br>''<<print cashFormat(500*Math.trunc(($slaveCost*1.1)/500))>>'' from a cheap brothel chain that operates a franchise on a lower level of the arcology.
 	<<link "Accept bid" "Slave Sold">>
-		<<set $cash += 500*Math.trunc(($slaveCost*1.1)/500)>>
+		<<set _Price += 500*Math.trunc(($slaveCost*1.1)/500)>>
+		<<run cashX(_Price, "slaveSold", $activeSlave)>>
 		<<set $buyer = "cheap brothel">>
 	<</link>>
 	<</if>>
@@ -1632,7 +1693,8 @@ __Bids Received__
 	<<if random(1,100) > 50>>
 	<br>''<<print cashFormat(500*Math.trunc(($slaveCost*1.1)/500))>>'' from a factory farm notorious for extracting every drop of value from its slaves' bodies.
 	<<link "Accept bid" "Slave Sold">>
-		<<set $cash += 500*Math.trunc(($slaveCost*1.1)/500)>>
+		<<set _Price += 500*Math.trunc(($slaveCost*1.1)/500)>>
+		<<run cashX(_Price, "slaveSold", $activeSlave)>>
 		<<set $buyer = "factory farm">>
 	<</link>>
 	<</if>>
@@ -1645,7 +1707,8 @@ __Bids Received__
 	<<if random(1,100) > 50>>
 	<br>''<<print cashFormat(500*Math.trunc(($slaveCost*1.1)/500))>>'' from a sex arcade that maintains good service quality by rapidly cycling new slaves through their facilities.
 	<<link "Accept bid" "Slave Sold">>
-		<<set $cash += 500*Math.trunc(($slaveCost*1.1)/500)>>
+		<<set _Price += 500*Math.trunc(($slaveCost*1.1)/500)>>
+		<<run cashX(_Price, "slaveSold", $activeSlave)>>
 		<<set $buyer = "arcade">>
 	<</link>>
 	<</if>>
@@ -1660,7 +1723,8 @@ __Bids Received__
 	<<if random(1,100) > 50>>
 	<br>''<<print cashFormat(500*Math.trunc(($slaveCost*1.1)/500))>>'' from a high-volume breeding operation interested in $him mostly for $his healthy, functional womb.
 	<<link "Accept bid" "Slave Sold">>
-		<<set $cash += 500*Math.trunc(($slaveCost*1.1)/500)>>
+		<<set _Price += 500*Math.trunc(($slaveCost*1.1)/500)>>
+		<<run cashX(_Price, "slaveSold", $activeSlave)>>
 		<<set $buyer = "volume breeder">>
 	<</link>>
 	<</if>>
@@ -1675,7 +1739,8 @@ __Bids Received__
 	<<if random(1,100) > 50>>
 	<br>''<<print cashFormat(500*Math.trunc(($slaveCost*1.1)/500))>>'' from a group of partners that run a handsome brothel off the promenade.
 	<<link "Accept bid" "Slave Sold">>
-		<<set $cash += 500*Math.trunc(($slaveCost*1.1)/500)>>
+		<<set _Price += 500*Math.trunc(($slaveCost*1.1)/500)>>
+		<<run cashX(_Price, "slaveSold", $activeSlave)>>
 		<<set $buyer = "nice brothel">>
 	<</link>>
 	<</if>>
@@ -1689,7 +1754,8 @@ __Bids Received__
 	<<if random(1,100) > 50>>
 	<br>''<<print cashFormat(500*Math.trunc(($slaveCost*0.8)/500))>>'' from a free-range farm that pays for the high costs of high quality livestock care by aggressively marketing its cruelty-free products.
 	<<link "Accept bid" "Slave Sold">>
-		<<set $cash += 500*Math.trunc(($slaveCost*0.8)/500)>>
+		<<set _Price += 500*Math.trunc(($slaveCost*0.8)/500)>>
+		<<run cashX(_Price, "slaveSold", $activeSlave)>>
 		<<set $buyer = "free range">>
 	<</link>>
 	<</if>>
@@ -1703,7 +1769,8 @@ __Bids Received__
 	<<if random(1,100) > 10>>
 	<br>''<<print cashFormat(500*Math.trunc(($slaveCost*1.2)/500))>>'' from an organ harvesting firm that acquires healthy raw materials cheaply.
 	<<link "Accept bid" "Slave Sold">>
-		<<set $cash += 500*Math.trunc(($slaveCost*1.2)/500)>>
+		<<set _Price += 500*Math.trunc(($slaveCost*1.2)/500)>>
+		<<run cashX(_Price, "slaveSold", $activeSlave)>>
 		<<set $buyer = "harvester">>
 	<</link>>
 	<</if>>
@@ -1714,7 +1781,8 @@ __Bids Received__
 	<<if random(1,100) > 10>>
 	<br>''<<print cashFormat(500*Math.trunc(($slaveCost*1)/500))>>'' from a manufacturer of large sexual appliances that include a living inmate, drugged into helplessness.
 	<<link "Accept bid" "Slave Sold">>
-		<<set $cash += 500*Math.trunc(($slaveCost*1)/500)>>
+		<<set _Price += 500*Math.trunc(($slaveCost*1)/500)>>
+		<<run cashX(_Price, "slaveSold", $activeSlave)>>
 		<<set $buyer = "fuckdoll">>
 	<</link>>
 	<</if>>
@@ -1727,7 +1795,8 @@ __Bids Received__
 <<if random(1,100) > 90>>
 	<br>''<<print cashFormat(7000)>>'' from a porn director interested in a cheap slave with a belly implant for use in a snuff film.
 	<<link "Accept bid" "Slave Sold">>
-		<<set $cash += 7000>>
+		<<set _Price += 7000>>
+		<<run cashX(_Price, "slaveSold", $activeSlave)>>
 		<<set $buyer = "tentacle bred">>
 	<</link>>
 <</if>>
@@ -1739,7 +1808,8 @@ __Bids Received__
 <<if random(1,100) > 30>>
 	<br>''<<print cashFormat(500*Math.trunc(($slaveCost*0.9)/500))>>'' from a reputable slave trader who will likely ship $him out of the arcology.
 	<<link "Accept bid" "Slave Sold">>
-	<<set $cash += 500*Math.trunc(($slaveCost*0.9)/500)>>
+		<<set _Price += 500*Math.trunc(($slaveCost*0.9)/500)>>
+		<<run cashX(_Price, "slaveSold", $activeSlave)>>
 	<</link>>
 <</if>>
 
@@ -1747,7 +1817,8 @@ __Bids Received__
 	<<if random(1,100) > 20>>
 	<br>''<<print cashFormat(500*Math.trunc(($slaveCost*0.9)/500))>>'' from a slave trader who buys vast numbers of mindbroken <<print $girl>>s. His purpose is unknown, and none of them are ever seen again.
 	<<link "Accept bid" "Slave Sold">>
-		<<set $cash += 500*Math.trunc(($slaveCost*0.9)/500)>>
+		<<set _Price += 500*Math.trunc(($slaveCost*0.9)/500)>>
+		<<run cashX(_Price, "slaveSold", $activeSlave)>>
 	<</link>>
 	<</if>>
 <</if>>
@@ -1759,7 +1830,8 @@ __Bids Received__
 	<<if $activeSlave.oralSkill + $activeSlave.analSkill + $activeSlave.vaginalSkill > 100>>
 		<br>''<<print cashFormat(500*Math.trunc(($slaveCost*0.5)/500))>>'' from the officer in charge of 'recreational activities' for General $peacekeepers.generalName's forces. This is far less than the slave is worth, but the bid comes with the implicit offer of more influence over the peacekeepers.
 		<<link "Accept bid" "Slave Sold">>
-			<<set $cash += 500*Math.trunc(($slaveCost*0.5)/500), $buyer = "peacekeepers">>
+			<<set _Price += 500*Math.trunc(($slaveCost*0.5)/500), $buyer = "peacekeepers">>
+			<<run cashX(_Price, "slaveSold", $activeSlave)>>
 		<</link>>
 	<</if>>
 <<else>>
@@ -1767,52 +1839,52 @@ __Bids Received__
 	<<case "lusty futanari">>
 		<<if $activeSlave.balls > 0 && $activeSlave.ballType != "sterile" && $activeSlave.scrotum > 0 && $activeSlave.dick > 0 && $activeSlave.vagina > -1 && $activeSlave.energy > 50>>
 			<br>''<<print cashFormat(500*Math.trunc(($slaveCost*1.2)/500))>>'' from the sex slave buyer for General $peacekeepers.generalName's client state, which prefers $peacekeepers.tastes.
-			<<link "Accept bid" "Slave Sold">><<set $cash += 500*Math.trunc(($slaveCost*1.2)/500), $buyer = "peacekeepers">><</link>>
+			<<link "Accept bid" "Slave Sold">><<set _Price += 500*Math.trunc(($slaveCost*1.2)/500), $buyer = "peacekeepers">><<run cashX(_Price, "slaveSold", $activeSlave)>><</link>>
 		<</if>>
 	<<case "cum addicts">>
 		<<if $activeSlave.fetish == "cumslut" && $activeSlave.fetishStrength > 95 && $activeSlave.sexualFlaw == "cum addict">>
 			<br>''<<print cashFormat(500*Math.trunc(($slaveCost*1.2)/500))>>'' from the sex slave buyer for General $peacekeepers.generalName's client state, which prefers $peacekeepers.tastes.
-			<<link "Accept bid" "Slave Sold">><<set $cash += 500*Math.trunc(($slaveCost*1.2)/500), $buyer = "peacekeepers">><</link>>
+			<<link "Accept bid" "Slave Sold">><<set _Price += 500*Math.trunc(($slaveCost*1.2)/500), $buyer = "peacekeepers">><<run cashX(_Price, "slaveSold" , $activeSlave)>><</link>>
 		<</if>>
 	<<case "horny MILFs">>
 		<<if $activeSlave.physicalAge > 34 && $activeSlave.visualAge > 34 && $activeSlave.energy > 80>>
 			<br>''<<print cashFormat(500*Math.trunc(($slaveCost*1.2)/500))>>'' from the sex slave buyer for General $peacekeepers.generalName's client state, which prefers $peacekeepers.tastes.
-			<<link "Accept bid" "Slave Sold">><<set $cash += 500*Math.trunc(($slaveCost*1.2)/500), $buyer = "peacekeepers">><</link>>
+			<<link "Accept bid" "Slave Sold">><<set _Price += 500*Math.trunc(($slaveCost*1.2)/500), $buyer = "peacekeepers">><<run cashX(_Price, "slaveSold", $activeSlave)>><</link>>
 		<</if>>
 	<<case "big-breasted cows">>
 		<<if $activeSlave.boobs > 2000 && $activeSlave.lactation > 1>>
 			<br>''<<print cashFormat(500*Math.trunc(($slaveCost*1.2)/500))>>'' from the sex slave buyer for General $peacekeepers.generalName's client state, which prefers $peacekeepers.tastes.
-			<<link "Accept bid" "Slave Sold">><<set $cash += 500*Math.trunc(($slaveCost*1.2)/500), $buyer = "peacekeepers">><</link>>
+			<<link "Accept bid" "Slave Sold">><<set _Price += 500*Math.trunc(($slaveCost*1.2)/500), $buyer = "peacekeepers">><<run cashX(_Price, "slaveSold", $activeSlave)>><</link>>
 		<</if>>
 	<<case "beautiful young sex slaves">>
 		<<if $activeSlave.physicalAge < 25 && $activeSlave.visualAge < 25 && $activeSlave.face > 95>>
 			<br>''<<print cashFormat(500*Math.trunc(($slaveCost*1.2)/500))>>'' from the sex slave buyer for General $peacekeepers.generalName's client state, which prefers $peacekeepers.tastes.
-			<<link "Accept bid" "Slave Sold">><<set $cash += 500*Math.trunc(($slaveCost*1.2)/500), $buyer = "peacekeepers">><</link>>
+			<<link "Accept bid" "Slave Sold">><<set _Price += 500*Math.trunc(($slaveCost*1.2)/500), $buyer = "peacekeepers">><<run cashX(_Price, "slaveSold", $activeSlave)>><</link>>
 		<</if>>
 	<<case "fertile virgins">>
 		<<if $activeSlave.vagina == 0 && isFertile($activeSlave)>>
 			<br>''<<print cashFormat(500*Math.trunc(($slaveCost*1.2)/500))>>'' from the sex slave buyer for General $peacekeepers.generalName's client state, which prefers $peacekeepers.tastes.
-			<<link "Accept bid" "Slave Sold">><<set $cash += 500*Math.trunc(($slaveCost*1.2)/500), $buyer = "peacekeepers">><</link>>
+			<<link "Accept bid" "Slave Sold">><<set _Price += 500*Math.trunc(($slaveCost*1.2)/500), $buyer = "peacekeepers">><<run cashX(_Price, "slaveSold", $activeSlave)>><</link>>
 		<</if>>
 	<<case "lusty preggos">>
 		<<if $activeSlave.preg > $activeSlave.pregData.normalBirth/4 && $activeSlave.energy > 50>>
 			<br>''<<print cashFormat(500*Math.trunc(($slaveCost*1.2)/500))>>'' from the sex slave buyer for General $peacekeepers.generalName's client state, which prefers $peacekeepers.tastes.
-			<<link "Accept bid" "Slave Sold">><<set $cash += 500*Math.trunc(($slaveCost*1.2)/500), $buyer = "peacekeepers">><</link>>
+			<<link "Accept bid" "Slave Sold">><<set _Price += 500*Math.trunc(($slaveCost*1.2)/500), $buyer = "peacekeepers">><<run cashX(_Price, "slaveSold", $activeSlave)>><</link>>
 		<</if>>
 	<<case "baby obsessed breeders">>
 		<<if $activeSlave.preg > $activeSlave.pregData.normalBirth/4 && $activeSlave.fetish == "pregnancy" && $activeSlave.sexualFlaw == "breeder">>
 			<br>''<<print cashFormat(500*Math.trunc(($slaveCost*1.2)/500))>>'' from the sex slave buyer for General $peacekeepers.generalName's client state, which prefers $peacekeepers.tastes.
-			<<link "Accept bid" "Slave Sold">><<set $cash += 500*Math.trunc(($slaveCost*1.2)/500), $buyer = "peacekeepers">><</link>>
+			<<link "Accept bid" "Slave Sold">><<set _Price += 500*Math.trunc(($slaveCost*1.2)/500), $buyer = "peacekeepers">><<run cashX(_Price, "slaveSold", $activeSlave)>><</link>>
 		<</if>>
 	<<case "bellies with girls attached">>
 		<<if $activeSlave.belly >= 300000>>
 			<br>''<<print cashFormat(500*Math.trunc(($slaveCost*1.2)/500))>>'' from the sex slave buyer for General $peacekeepers.generalName's client state, which prefers $peacekeepers.tastes.
-			<<link "Accept bid" "Slave Sold">><<set $cash += 500*Math.trunc(($slaveCost*1.2)/500), $buyer = "peacekeepers">><</link>>
+			<<link "Accept bid" "Slave Sold">><<set _Price += 500*Math.trunc(($slaveCost*1.2)/500), $buyer = "peacekeepers">><<run cashX(_Price, "slaveSold", $activeSlave)>><</link>>
 		<</if>>
 	<<case "flesh balloons">>
 		<<if $activeSlave.boobs > 20000 && $activeSlave.butt > 10>>
 			<br>''<<print cashFormat(500*Math.trunc(($slaveCost*1.2)/500))>>'' from the sex slave buyer for General $peacekeepers.generalName's client state, which prefers $peacekeepers.tastes.
-			<<link "Accept bid" "Slave Sold">><<set $cash += 500*Math.trunc(($slaveCost*1.2)/500), $buyer = "peacekeepers">><</link>>
+			<<link "Accept bid" "Slave Sold">><<set _Price += 500*Math.trunc(($slaveCost*1.2)/500), $buyer = "peacekeepers">><<run cashX(_Price, "slaveSold", $activeSlave)>><</link>>
 		<</if>>
 	<</switch>>
 <</if>>
@@ -1821,7 +1893,7 @@ __Bids Received__
 <</if>>
 
 <br><br>
-<<link "Re-list $him" "Sell Slave">><<set $cash -= 500>><</link>>
+<<link "Re-list $him" "Sell Slave">><<run cashX(-500, "slaveTransfer")>><</link>>
 //This will cost <<print cashFormat(500)>>//
 
 <</if>>
diff --git a/src/uncategorized/servantsQuartersReport.tw b/src/uncategorized/servantsQuartersReport.tw
index b9024446dde..69ff0af0117 100644
--- a/src/uncategorized/servantsQuartersReport.tw
+++ b/src/uncategorized/servantsQuartersReport.tw
@@ -164,7 +164,7 @@
 			She walks among the cowering servants looking for an excuse to extract sex from shirkers as @@.hotpink;punishment.@@
 		<</if>>
 		/% Get it out of the loop %/
-		<<set $cash += ($stewardessBonus * _DL)>>
+		<<run cashX(($stewardessBonus * _DL), "servantsQuarters", $Stewardess)>>
 		<br><br>
 	<</if>>
 <</if>>
diff --git a/src/uncategorized/slaveInteract.tw b/src/uncategorized/slaveInteract.tw
index 14edce10b92..69cc9539818 100644
--- a/src/uncategorized/slaveInteract.tw
+++ b/src/uncategorized/slaveInteract.tw
@@ -1794,6 +1794,9 @@ Relationship rules: ''<span id="relationshipRules">$activeSlave.relationshipRule
 	<</if>>
 <</if>>
 
+<br><br>
+__Financial__:
+<<SlaveExpenses>>
 <br><br>
 <<if ($slaveCostFactor > 1)>>
 	@@.yellow;The slave market is bullish; the price of slaves is high.@@
diff --git a/src/uncategorized/spaReport.tw b/src/uncategorized/spaReport.tw
index 0cb26dfb59d..c848d8562b8 100644
--- a/src/uncategorized/spaReport.tw
+++ b/src/uncategorized/spaReport.tw
@@ -201,7 +201,7 @@
 	<</for>>
 	<<if (_DL < $spa)>>
 		<<set _seed = random(1,10)+(($spa-_DL)*(random(150,170)+(_idleBonus*10)))>>
-		<<set $cash += _seed>>
+		<<run cashX(_seed, "spa", $Attendant)>>
 		<br>&nbsp;&nbsp;&nbsp;&nbsp;Since $he doesn't have enough girls to occupy all $his time, the spa takes in citizens' slaves on a contract basis and $he helps them too, earning @@.yellowgreen;<<print cashFormat(_seed)>>.@@
 		<<if ($arcologies[0].FSHedonisticDecadence > 0) && (_DL == 0)>>
 			Society @@.green;loves@@ being allowed to lounge in your spa, greatly advancing your laid back culture.
diff --git a/src/uncategorized/storyCaption.tw b/src/uncategorized/storyCaption.tw
index 0880b62046e..c525f0ad3bb 100644
--- a/src/uncategorized/storyCaption.tw
+++ b/src/uncategorized/storyCaption.tw
@@ -121,7 +121,7 @@
 		since last week)
 		<</link>>
 	<</if>>
-	<br>[[Upkeep|Costs Report]] |
+	<br>[[Upkeep|Costs Budget]] |
 <<else>>
 	<br>Upkeep |
 <</if>><<print cashFormat($costs)>>
-- 
GitLab