+$companyname = Voorbeeld en Test
+$companyurl = http://www.example.com/
001.00 B Onroerend goed
002.00 B Inventaris kantoor
002.04 B Inventaris werkplaats
460.00 K Div. kosten
461.00 K Koersverschillen
480.00 K Research kosten
+
700.00 B Voorraad produkten (#75-#79)
701.00 K Afschrijving produkten
710.00 B Voorraad supplies (#80-#89)
711.00 K Afschrijving supplies
720.00 B Voorraad software (#90-#99)
721.00 K Afschrijving software
+
800.00 K Inkoopprijs van de verkopen
800.20 K Inkoopprijs van de verkopen eigen produktie
800.40 K Inkoopprijs software
840.61 K Opbrengst Advies/ontwikkeling 0%
840.80 K Opbrengst reparaties
910.00 K Diverse baten en lasten
+
int i;
s << "<?xml version='1.0'?>\n";
- s << "<accounting>\n";
+ s << "<accounting companyname='" << companyname << "'>\n";
s << "<balance-sheet begin='" << period_begin << "' end='" << period_end << "'>\n";
for (i=0; i<nr_accs; i++)
{
{
std::ifstream in(filename);
Account A;
+ char line_begin;
if (!in)
{
}
nr_accs = 0;
- while (in >> A)
- accs[nr_accs++] = A;
+ while (in)
+ {
+ in.get(line_begin);
+ if (isdigit(line_begin))
+ {
+ in.putback(line_begin);
+ in >> A;
+ accs[nr_accs++] = A;
+ }
+ else if (line_begin == '$')
+ {
+ // Optional attributes
+ String attribute;
+ String a_name, a_value;
+
+ in >> attribute;
+
+ int separator = attribute.index('=');
+ do
+ {
+ separator--;
+ }
+ while (isspace(attribute[separator]));
+ a_name = attribute(0, separator+1);
+
+ separator = attribute.index('=');
+ do
+ {
+ separator++;
+ }
+ while (isspace(attribute[separator]));
+ a_value = attribute;
+ a_value(0, separator) = "";
+
+ if (a_name == "companyname")
+ {
+ companyname = a_value;
+ }
+ else
+ {
+ std::cerr << "Unrecognized attribute in Ledger: " << a_name << "\n";
+ }
+ }
+ else if (line_begin == '\n')
+ {
+ // Ignore empty lines
+ }
+ else
+ {
+ // Anything else is comment: eat it.
+ String comment;
+ in >> comment;
+ }
+ }
accs[nr_accs].Name() = String("Rekening bestaat niet");
}
class Ledger
{
+ String companyname;
+
Account accs[200];
int nr_accs;
int idx;
</head>
<body>
- <h1>Balans per <xsl:value-of select='@end'/></h1>
+ <h1>Balans voor <xsl:value-of select='../@companyname'/> per <xsl:value-of select='@end'/></h1>
<h2>Bezittingen</h2>
<table>
<title>Winst en Verlies rekening</title>
</head>
<body>
- <h1>Winst en Verlies rekening</h1>
+ <h1>Winst en Verlies rekening <xsl:value-of select='../@companyname'/></h1>
<h2>Periode van <xsl:value-of select='@begin'/> tot <xsl:value-of select='@end'/></h2>
<h2>Opbrengsten</h2>
<head>
</head>
<body>
- <h1>Saldi Balans</h1>
+ <h1>Saldi Balans <xsl:value-of select='../@companyname'/></h1>
<h2>Periode van <xsl:value-of select='@begin'/> tot <xsl:value-of select='@end'/></h2>
<table border='1'>