eFinancialPlanner  V1.0 (proof of concept)
Personal Financial Planning based on Maslowian Portfolio Theory
 All Classes Namespaces Files Functions Variables Typedefs Friends Macros Pages
bona_goal.class.cpp
Go to the documentation of this file.
1 /*
2  *
3  * class goal_di == database interface for goal
4  *
5  * copyright: (c) Philippe De Brouwer 2014
6  *
7  * last modification:
8  *
9  */
10 
11 class goal: public bona
12 {
13 public:
14  goal();
15 };
16 
17 
18 /**********************************************
19  * goal
20  * CONSTRUCTOR
21  * ********************************************/
23 {
24  int i;
25  tbl_name = oConfig.tbl_prefix + "_goals";
26  class_name = "goal";
27  action_ref = "g";
28  order_by = "priority ASC";
29  i=1;
30  tbl[i].column_name = "goal_id";
31  tbl[i].post_code = "gid";
32  tbl[i].placeholder = "";
33  tbl[i].col_type = 'i';
34  tbl[i].input_type = "hidden";
35  i++;
36  tbl[i].column_name = "investor";
37  tbl[i].post_code = "iid"; //this will be overwritten by Apache with the hidden iid in the form!
38  tbl[i].placeholder = "";
39  tbl[i].col_type = 'i';
40  tbl[i].input_type = "hidden";
41  i++;
42  tbl[i].column_name = "goal_type";
43  tbl[i].post_code = "gtype";
44  tbl[i].label = "Goal Type";
45  tbl[i].placeholder = "1";
46  tbl[i].col_type = 's';
47  tbl[i].input_type = "dropDown";
48  tbl[i].drop_down_table = oConfig.tbl_prefix + "_goal_types";
49  tbl[i].drop_down_keyField = "goal_type_id";
50  tbl[i].drop_down_keyFieldQuote = "'";
51  tbl[i].drop_down_showField = "description";
52  tbl[i].drop_down_default = "1";
53  defList[tbl[i].column_name] = i;
54  i++;
55  tbl[i].column_name = "description";
56  tbl[i].post_code = "desc";
57  tbl[i].label = "Goal Description";
58  tbl[i].placeholder = "describe the goal in your own words";
59  tbl[i].col_type = 's';
60  tbl[i].input_type = "text";
61  defList[tbl[i].column_name] = i;
62  i++;
63  tbl[i].column_name = "realization_age";
64  tbl[i].post_code = "when";
65  tbl[i].label = "Age of<br>Realization";
66  tbl[i].placeholder = "66";
67  tbl[i].col_type = 'i';
68  tbl[i].input_type = "number";
69  i++;
70  tbl[i].column_name = "from_date";
71  tbl[i].post_code = "fdt";
72  tbl[i].label = "From Date";
73  tbl[i].placeholder = "2025-12-25";
74  tbl[i].col_type = 'd';
75  tbl[i].input_type = "date";
76  defList[tbl[i].column_name] = i;
77  i++;
78  tbl[i].column_name = "till_date";
79  tbl[i].post_code = "tdt";
80  tbl[i].label = "Till Date";
81  tbl[i].placeholder = "2030-12-25";
82  tbl[i].col_type = 'd';
83  tbl[i].input_type = "date";
84  tbl[i].show_with_previous = true;
85  defList[tbl[i].column_name] = i;
86  i++;
87  tbl[i].column_name = "frequency";
88  tbl[i].post_code = "freq";
89  tbl[i].label = "Frequency";
90  tbl[i].placeholder = "";
91  tbl[i].col_type = 's';
92  tbl[i].input_type = "dropDown";
93  tbl[i].drop_down_table = oConfig.tbl_prefix + "_frequencies";
94  tbl[i].drop_down_keyField = "frequency_id";
95  tbl[i].drop_down_keyFieldQuote = "'";
96  tbl[i].drop_down_showField = "frequency_name";
97  tbl[i].drop_down_default = "M";
98  tbl[i].show_with_previous = true;
99  defList[tbl[i].column_name] = i;
100  i++;
101  tbl[i].column_name = "amount";
102  tbl[i].post_code = "amt";
103  tbl[i].label = "Amount";
104  tbl[i].placeholder = "10000";
105  tbl[i].col_type = 'f';
106  tbl[i].input_type = "number";
107  i++;
108  tbl[i].column_name = "currency";
109  tbl[i].post_code = "curr";
110  tbl[i].label = "Currency";
111 //?? tbl[i].placeholder = "5000";
112  tbl[i].col_type = 's';
113  tbl[i].input_type = "dropDown";
114  tbl[i].drop_down_table = oConfig.tbl_prefix + "_currencies";
115  tbl[i].drop_down_keyField = "currency_id";
116  tbl[i].drop_down_keyFieldQuote = "'";
117  tbl[i].drop_down_showField = "currency_id";
118  tbl[i].drop_down_default = "EUR";
119  i++;
120  tbl[i].column_name = "max_shortfall";
121  tbl[i].post_code = "msf";
122 // tbl[i].label = "Max Shortfall";
123  tbl[i].placeholder = "1000";
124  tbl[i].col_type = 'f';
125  tbl[i].input_type = "hidden";
126  i++;
127  tbl[i].column_name = "priority";
128  tbl[i].post_code = "imp";
129  tbl[i].label = "Priority";
130  tbl[i].placeholder = "number from 1 (highest) to 10 (lowest)";
131  tbl[i].col_type = 'i';
132  tbl[i].input_type = "number";
133  /*
134  i++;
135  tbl[i].column_name = "need_level";
136  tbl[i].post_code = "nlev";
137  tbl[i].label = "Need Level";
138  tbl[i].placeholder = "";
139  tbl[i].col_type = 'i';
140  tbl[i].input_type = "dropDown";
141  tbl[i].drop_down_table = oConfig.tbl_prefix + "_need_levels";
142  tbl[i].drop_down_keyField = "need_level_id";
143  tbl[i].drop_down_keyFieldQuote = "";
144  tbl[i].drop_down_showField = "description";
145  //tbl[i].drop_down_default = "1";
146  */
147  tbl[1].set_value(0); // to initialize the goal_id to zero (avoid NULLs)
148 }
string action_ref
Definition: bona.class.cpp:17
string order_by
should be the column name eventually followed by DESC/ASC, eg. "priority ASC"
Definition: bona.class.cpp:28
const string tbl_prefix
tables start with "" + oConfig.tbl_prefix + "_" if the prefix is eg. "tbl" then we have "tbl_invesotr...
std::map< int, column > tbl
Definition: bona.class.cpp:14
string tbl_name
Definition: bona.class.cpp:15
std::map< string, int > defList
list holding the column names in the table connected to the correct id of the column ...
Definition: bona.class.cpp:26
config oConfig
mysql connection mysql connector from dev.mysql.com
Definition: efp.cpp:149
string class_name
Definition: bona.class.cpp:16