function get_income_table(&$objUser) { include_once 'inc/functions/production.php'; include_once 'inc/functions/population.php'; $arrIncome = getTotalIncome($objUser); $arrTaxes = getCitizenIncome($objUser); $arrMineProd = getMineProduction($objUser); $arrBankProd = getBankProduction($objUser); $iUpkeepCost = getMilitaryUpkeep($objUser); $balanceText = "positive"; if ($arrIncome['total'] < '0') { $balanceText = "negative"; } $balanceText .= "\">" . number_format($arrIncome['total']); $ifStarving = ''; if ($arrTaxes['starvation'] > 0) { $ifStarving = "<tr class=\"data\">" . "<th>" . "Starvation:" . "</th>" . "<td class=\"negative\">-" . number_format($arrTaxes['starvation']) . " cr" . "</td>" . "</tr>"; } $moneyProduction = "<table class=\"small\" cellpadding=\"0\" cellspacing=\"0\">" . "<tr class=\"header\">" . "<th colspan=\"2\">" . "Money" . "</th>" . "</tr>" . "<tr class=\"subheader\">" . "<th>" . "Type" . "</th>" . "<td>" . "Amount" . "</td>" . "</tr>" . "<tr class=\"data\">" . "<th>" . "Taxes:" . "</th>" . "<td>" . number_format($arrTaxes['raw']) . " cr" . "</td>" . "</tr>" . $ifStarving . "<tr class=\"data\">" . "<th>" . "Spell Bonus:" . "</th>" . "<td>" . "+" . number_format($arrTaxes['spell_bonus']) . " cr" . "</td>" . "</tr>" . "<tr class=\"data\">" . "<th>" . "Mines Produce:" . "</th>" . "<td>" . "+" . number_format($arrMineProd['raw']) . " cr" . "</td>" . "</tr>" . "<tr class=\"data\">" . "<th>" . "Banks Produce:" . "</th>" . "<td>" . "+" . number_format($arrBankProd['raw']) . " cr" . "</td>" . "</tr>" . "<tr class=\"data\">" . "<th>" . "Production Bonus:" . "</th>" . "<td>" . "+" . number_format($arrMineProd['research_bonus'] + $arrBankProd['research_bonus']) . " cr" . "</td>" . "</tr>" . "<tr class=\"data\">" . "<th>" . "Military Upkeep:" . "</th>" . "<td>" . "-" . number_format($iUpkeepCost) . " cr" . "</td>" . "</tr>" . "<tr class=\"data\">" . "<th class=\"bsup\">" . "Balance:" . "</th>" . "<td class=\"bsup " . $balanceText . " cr" . "</td>" . "</tr>" . "</table>"; return $moneyProduction; }
function getTotalIncome(&$objUser) { $cash_balance = array(); $strRace = $objUser->get_stat(RACE); // Income From Citizens $arrTaxes = getCitizenIncome($objUser); // Income From Mines $arrMineProd = getMineProduction($objUser); // Income From Banks $arrBankProd = getBankProduction($objUser); // Costs for Military Upkeep $iUpkeep = getMilitaryUpkeep($objUser); // Total Income Balance $total_income = $arrTaxes['total'] + $arrMineProd['total'] + $arrBankProd['total'] - $iUpkeep; $cash_balance['total'] = $total_income; return $cash_balance; }