5 |
#include <tntdb/row.h> |
#include <tntdb/row.h> |
6 |
|
|
7 |
#include "common.h" |
#include "common.h" |
8 |
|
|
9 |
|
#include <sstream> |
10 |
</%pre> |
</%pre> |
11 |
|
|
12 |
<%config> |
<%config> |
13 |
dburl; |
dburl; |
14 |
</%config> |
</%config> |
15 |
|
|
16 |
<&header title="Critical systems"> |
<&header title="Customers and installations"> |
17 |
</&header> |
</&header> |
18 |
|
|
19 |
<h2>Customers and installations</h2> |
<h2>Customers and installations</h2> |
34 |
for (tntdb::Result::const_iterator it = res.begin(); it != res.end(); ++it) |
for (tntdb::Result::const_iterator it = res.begin(); it != res.end(); ++it) |
35 |
{ |
{ |
36 |
tntdb::Row row = *it; |
tntdb::Row row = *it; |
37 |
out << "<table border=1 width=80% cellspacing=0 align=center><tr><td>"; |
int customerid = row.getInt(0); |
38 |
|
out << "<table border=1 width='80%' cellspacing=0 align=center><tr><td>"; |
39 |
out << "<b>" << row.getString(1) << "</b><br>\n\n"; |
out << "<b>" << row.getString(1) << "</b><br>\n\n"; |
40 |
|
|
41 |
|
|
42 |
out << nl2br(row.getString(2)) << "<br>\n"; |
out << nl2br(trim(row.getString(2))) << "<br>\n"; |
43 |
|
|
44 |
|
out << "<i>Phone:</i> " << row.getString(3) << "<br>\n"; |
45 |
|
out << "<i>Contact:</i> " << row.getString(4) << "<br>\n"; |
46 |
|
|
47 |
|
out << "<br>\n"; |
48 |
|
|
49 |
|
|
50 |
|
std::stringstream sqlstream; |
51 |
|
sqlstream << "SELECT id, description FROM installation "; |
52 |
|
sqlstream << "WHERE customerid = " << customerid; |
53 |
|
sqlstream << " ORDER BY description ASC"; |
54 |
|
|
55 |
|
tntdb::Result instres = conn.select(sqlstream.str()); |
56 |
|
|
57 |
|
if (instres.size() > 0) |
58 |
|
{ |
59 |
|
out << "Installations:\n"; |
60 |
|
out << "<ol>\n"; |
61 |
|
for (tntdb::Result::const_iterator instit = instres.begin(); instit != instres.end(); ++instit) |
62 |
|
{ |
63 |
|
tntdb::Row instrow = *instit; |
64 |
|
out << "<li><a href='installationdetails?id=" << instrow.getString(0) << "'>"; |
65 |
|
out << instrow.getString(1) << "</a></li>"; |
66 |
|
} |
67 |
|
out << "</ol>\n"; |
68 |
|
} |
69 |
|
else |
70 |
|
{ |
71 |
|
out << "<i>No installations !</i>\n"; |
72 |
|
} |
73 |
|
|
74 |
|
|
75 |
|
|
76 |
|
|
77 |
|
|
78 |
out << "</td></tr></table><br>\n"; |
out << "</td></tr></table><br>\n"; |