84 os <<
"The goal <b><i>"" << the_goal.
description <<
""</i></b> is to show you the resources that are not used by your other goals.";
91 std::transform(s.begin(), s.end(), s.begin(), ::tolower);
93 os << setiosflags(ios::fixed) << setprecision(2)
94 <<
"The goal <b><i>"" << the_goal.
description <<
""</i></b> is to achieve"
99 <<
"This goal's relative priority is " << the_goal.
priority;
103 os << setiosflags(ios::fixed) << setprecision(2)
104 <<
"This goal <b><i>"" << the_goal.
description <<
""</i></b> is to have a safety layer (\"rainy day savings\") always available."
106 <<
".<br>This goal's relative priority is " << the_goal.
priority;
110 os << setiosflags(ios::fixed) << setprecision(2)
112 <<
" asap.<br>This goal's relative priority is " << the_goal.
priority;
116 os << setiosflags(ios::fixed) << setprecision(2)
117 <<
"The goal <b><i>"" << the_goal.
description <<
""</i></b> is to achieve"
119 <<
" at the age of " << setprecision(0) << the_goal.
realization_age <<
".<br>" <<setprecision(2)
120 <<
"This goal's relative priority is " << the_goal.
priority
128 int g_type_id = atoi(g_type.c_str());
129 unordered_map<int, string>::const_iterator got =
goal_type_i2s.find(g_type_id);
144 this->
amount = atof(amnt.c_str());
167 this->
description =
"Please change this text with your own goal-description!";
192 the_age = atof(real_age.c_str());
193 if ((the_age < actual_age) || (the_age > (
MAX_AGE + 0.0)))
195 error_message =
error_message +
"<li>the realization_age of the goal should be a number between your actual age and " + to_string(
MAX_AGE + 0) +
"(provided: realization age = " + real_age +
"; compared to actual age = " + to_string(actual_age) +
".</li>";
244 struct tm tm_from_date, tm_till_date;
249 if (difftime(mktime(&tm_till_date),mktime(&tm_from_date)) >= 0)
270 float the_sf = atof(shortfall.c_str());
273 std_message =
std_message +
"<li>are you sure that the shortfall can be higher than the target amount (note: this is saved, but you might want to reconsider)</li>";
288 s =
"INSERT INTO " +
oConfig.
tbl_prefix +
"_goals (investor, goal_type, description, need_level, realization_age, from_date, ";
289 s = s +
"till_date, frequency, amount, currency, max_shortfall, priority) VALUES (?,?,?,?,?,?,?,?,?,?,?,?);";
309 catch (sql::SQLException &e)
312 debug_info = debug_info +
"# ERR: SQLException in " + __FILE__ +
"(" + __FUNCTION__
313 +
") on line " + to_string(__LINE__) +
"<br># ERR: " + e.what()
314 +
" (MySQL error code: " + to_string(e.getErrorCode())
315 +
", SQLState: " + e.getSQLState() +
" )<br>";
330 s =
"UPDATE " +
oConfig.
tbl_prefix +
"_goals SET , goal_type = ?, description = ?, need_level = ?, realization_age = ?, from_date = ?, ";
331 s = s +
"till_date = ?, frequency = ?, amount = ?, currency = ?, max_shortfall = ?, priority = ?";
332 s = s +
" WHERE investor_id = " + to_string(this->
investor) +
";";
340 catch (sql::SQLException &e)
343 debug_info = debug_info +
"# ERR: SQLException in " + __FILE__ +
"(" + __FUNCTION__
344 +
") on line " + to_string(__LINE__) +
"<br># ERR: " + e.what()
345 +
" (MySQL error code: " + to_string(e.getErrorCode())
346 +
", SQLState: " + e.getSQLState() +
" )<br>";
bool is_valid_dateStr(string theDate)
string date_format_dateStr(string s)
std::map< int, float > means_goal
the means implied by the goal (eg. the regular income during retirement for goal type income from/to)...
string s_goal
javaScript variable for the upper quantile
bool set_max_shortfall(string shortfall)
bool set_freq(string the_freq)
std::map< int, float > benchmark
int goal_type
(0, "unallocated"), (1, "amount@date"), (2, "income from/to"), (3, "rainy day savings"), (4, "amount asap");
ostream & operator<<(ostream &os, const aGOAL &the_goal)
bool set_description(string desc)
string simulation_string
a string containing the simulated values of the advised portfolio [45,1000], [45,083, 1100], etc.]]
bool set_goal_type(string g_type)
saves the benchmark and savings plan, !!! TODO
unordered_map< int, string > goal_type_i2s
string error_message
global message variables
const string tbl_prefix
tables start with "" + oConfig.tbl_prefix + "_" if the prefix is eg. "tbl" then we have "tbl_invesotr...
friend ostream & operator<<(ostream &os, const aGOAL &the_goal)
other functions:
string curr_format(float dv, string the_curr="")
aGOAL(int investor_id=0)
constructor
bool set_from_date(string f_date)
float simulation_endvalue
the last value obtained by the simulation (only used in the Follow-Up screens to allow the evolution ...
bool set_currency(string curr)
bool set_priority(string imp)
check if exists, if not then add the default
bool set_curr(string the_curr)
string s_low
javaScript variable for the lower quantile as [[45,100], [45.1,101],....]
std::map< int, float > saving_plan
variables calculated and allocated during investment_problem.solve() AFTER solution: ...
void dateStr2tm(string dStr, tm *target_tm)
bool set_realization_age(string real_age, float actual_age)
bool set_till_date(string t_date)
string s_high
javaScript variable for the expecpted evolution
int goal_id
variables stored in database before investment_problem.solve():
#define MAX_AGE
the maximum age allowed in the goals
config oConfig
mysql connection mysql connector from dev.mysql.com
float target_amount
target_amount is for goal_type amount
float alpha
variables calculated and allocated during investment_problem.solve() BEFORE solution: ...
bool set_frequency(string freq)
unordered_map< string, int > goal_type_s2i
Global lists.
bool set_amount(string amnt)
Needs goal_type to be set first.
sql::PreparedStatement * pstmt
int show_graph_till_MNbr()