48 while (
db.
res->next())
66 cout <<
"<form method=\"post\" action=\"" +
oConfig.
soft_url +
"?a=as\">";
67 cout <<
"<table class=\"asset\">\n";
69 cout <<
"<th>Description</th><th>Asset Class</th><th>Amount</th><th>Currency</th><th>Actions</th>";
73 cout <<
"</tr>\n<tr>\n";
74 cout <<
"<td><input type=\"text\" name=\"description\" required value=\"" <<
description <<
"\"></td>" ;
76 cout <<
"<td><input type=\"number\" min=\"0\" name=\"amount\" required title=\"Please enter a positive number\" value=\"" <<
amount <<
"\"></td>" ;
82 cout <<
"<td><button type=\"submit\" value=\"Submit\"><img src=\"" <<
oConfig.
css_dir <<
"check.svg\" alt=\"add\" width=\"16\" height=\"16\" alt=\"Save\"></button><a href=\"" +
oConfig.
soft_url +
"?a=if&iid=" << iid <<
"\" class=\"button\"><img src=\"" <<
oConfig.
css_dir <<
"arrow_left.svg\" alt=\"Go back without saving the changes!\" width=\"16\" height=\"16\"></a></td>" ;
85 cout <<
"<td><button type=\"submit\" value=\"Submit\" data-toggle=\"tooltip\" title=\"" <<
t_save <<
"\"><span class=\"glyphicon glyphicon-ok\" style=\"color:green\"></span></button>";
86 cout <<
"<a data-toggle=\"tooltip\" title=\"" <<
t_cancel <<
"\" href=\"" +
oConfig.
soft_url +
"?a=if&iid=" << iid <<
"\"><span class=\"glyphicon glyphicon-chevron-left\" style=\"color:blue\"></span></a></td>" ;
89 cout <<
"<td><button type=\"submit\" value=\"Submit\"><img src=\"" <<
oConfig.
css_dir <<
"check.svg\" alt=\"add\" width=\"16\" height=\"16\" alt=\"Save\"></button><a href=\"" +
oConfig.
soft_url +
"?a=if&iid=" << iid <<
"\" class=\"button\"><img src=\"" <<
oConfig.
css_dir <<
"arrow_left.svg\" alt=\"Go back without saving the changes!\" width=\"16\" height=\"16\"></a></td>" ;
93 cout <<
"</tr></table>\n";
94 cout <<
"<input type=\"hidden\" name=\"iid\" value=\"" << iid <<
"\" />\n";
95 cout <<
"<input type=\"hidden\" name=\"aid\" value=\"" <<
asset_id <<
"\" />\n";
96 cout <<
"<p>All fields are required.</p>";
107 s =
"SELECT A.*, AC.asset_class_name FROM " +
oConfig.
tbl_prefix +
"_assets AS A, " +
oConfig.
tbl_prefix +
"_asset_classes AS AC WHERE A.asset_class = AC.asset_class_id && A.investor = " + std::to_string(iid) +
";";
112 while (
db.
res->next())
115 s = s +
"<td>" +
db.
res->getString(
"description") +
"</td>";
116 s = s +
"<td>" +
db.
res->getString(
"asset_class_name") +
"</td>";
117 s = s +
"<td>" +
db.
res->getString(
"amount") +
"</td>";
118 s = s +
"<td>" +
db.
res->getString(
"currency") +
"</td>";
123 s = s +
"<td><a href=\"" +
oConfig.
soft_url +
"?a=ae&iid=" + std::to_string(iid) +
"&aid=" +
db.
res->getString(
"asset_id") +
"\"><img src=\"" +
oConfig.
css_dir +
"pen.svg\" alt=\"edit\" width=\"16\" height=\"16\"></a> ";
124 s =s +
"<a href=\"" +
oConfig.
soft_url +
"?a=ad&iid=" + std::to_string(iid) +
"&aid=" +
db.
res->getString(
"asset_id") +
"\"><img src=\"" +
oConfig.
css_dir +
"x.svg\" alt=\"delete\" width=\"16\" height=\"16\"></a></td>";
127 s = s +
"<td><a class=\"btn btn-default\" href=\"" +
oConfig.
soft_url +
"?a=ae&iid=" + std::to_string(iid) +
"&aid=" +
db.
res->getString(
"asset_id") +
"\" data-toggle=\"tooltip\" title=\"" +
t_edit +
"\"><span class=\"glyphicon glyphicon-pencil\" style=\"color:blue\"></span></a> ";
128 s = s +
"<a href=\"" +
oConfig.
soft_url +
"?a=ad&iid=" + std::to_string(iid) +
"&aid=" +
db.
res->getString(
"asset_id") +
"\" data-toggle=\"tooltip\" title=\"" +
t_delete +
"\"><span class=\"glyphicon glyphicon-remove\" style=\"color:red\"></span></a></td>";
131 s = s +
"<td><a href=\"" +
oConfig.
soft_url +
"?a=ae&iid=" + std::to_string(iid) +
"&aid=" +
db.
res->getString(
"asset_id") +
"\"><img src=\"" +
oConfig.
css_dir +
"pen.svg\" alt=\"edit\" width=\"16\" height=\"16\"></a> ";
132 s =s +
"<a href=\"" +
oConfig.
soft_url +
"?a=ad&iid=" + std::to_string(iid) +
"&aid=" +
db.
res->getString(
"asset_id") +
"\"><img src=\"" +
oConfig.
css_dir +
"x.svg\" alt=\"delete\" width=\"16\" height=\"16\"></a></td>";
150 int a = atoi(s.c_str());
153 if ((a < 0) || (a > 1000000))
165 int a = atoi(s.c_str());
168 if ((a < 0) || (a > 1000000))
192 int a = atoi(s.c_str());
195 if ((a < 0) || (a > 100))
206 int a = atof(s.c_str());
209 if ((a < 0) || (a > 100000000))
235 s =
"INSERT INTO " +
oConfig.
tbl_prefix +
"_assets (investor, asset_class, description, currency, amount) ";
243 s = s +
" WHERE asset_id=" + std::to_string(
asset_id) +
";";
261 s =
"SELECT COUNT(*) AS CNT FROM " +
oConfig.
tbl_prefix +
"_assets WHERE asset_id = " + std::to_string(aid) +
";";
263 while (
db.
res->next()) {rc = (
db.
res->getString(
"CNT") ==
"1") ?
true :
false;}
bool set_currency(const std::string &s)
bool set_description(const std::string &s)
bool set_asset_id(const std::string &s)
void show_edit_form(int iid)
bool set_amount(const std::string &s)
string error_message
global message variables
string dropDown_currency(string defaultCurr="EUR")
const string tbl_prefix
tables start with "" + oConfig.tbl_prefix + "_" if the prefix is eg. "tbl" then we have "tbl_invesotr...
string dropDown_assetClass(int defaultAC=0)
bool set_asset_class(const std::string &s)
void list_assets(int iid)
config oConfig
mysql connection mysql connector from dev.mysql.com
bool set_investor(const std::string &s)