From a3a605575dbaeb52ff352afd1b78ffaaf2c413e6 Mon Sep 17 00:00:00 2001 From: Arjen Baart Date: Tue, 21 Dec 2010 16:23:06 +0100 Subject: [PATCH] Added a 'companyname' attribute in the Ledger. The Ledger may now have attributes stated on lines of the form $name = value. The attribute now implemented is 'companyname' which is subsequently used in titles on XML generated reports. --- Ledger | 5 +++++ account.cpp | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++++++--- account.h | 2 ++ balans.xsl | 2 +- profit.xsl | 2 +- saldibalans.xsl | 2 +- 6 files changed, 66 insertions(+), 6 deletions(-) diff --git a/Ledger b/Ledger index 005c484..c83e605 100644 --- a/Ledger +++ b/Ledger @@ -1,3 +1,5 @@ +$companyname = Voorbeeld en Test +$companyurl = http://www.example.com/ 001.00 B Onroerend goed 002.00 B Inventaris kantoor 002.04 B Inventaris werkplaats @@ -74,12 +76,14 @@ 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 @@ -93,3 +97,4 @@ 840.61 K Opbrengst Advies/ontwikkeling 0% 840.80 K Opbrengst reparaties 910.00 K Diverse baten en lasten + diff --git a/account.cpp b/account.cpp index ef1d0b8..ea071d6 100644 --- a/account.cpp +++ b/account.cpp @@ -379,7 +379,7 @@ void Ledger::XML_saldi(std::ostream &s, date period_begin, date period_end) int i; s << "\n"; - s << "\n"; + s << "\n"; s << "\n"; for (i=0; i> 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"); } diff --git a/account.h b/account.h index ea03a2c..133c82a 100644 --- a/account.h +++ b/account.h @@ -299,6 +299,8 @@ public: class Ledger { + String companyname; + Account accs[200]; int nr_accs; int idx; diff --git a/balans.xsl b/balans.xsl index e476b34..d77f3a0 100644 --- a/balans.xsl +++ b/balans.xsl @@ -15,7 +15,7 @@ -

Balans per

+

Balans voor per

Bezittingen

diff --git a/profit.xsl b/profit.xsl index 26c44d4..08ce8e9 100644 --- a/profit.xsl +++ b/profit.xsl @@ -14,7 +14,7 @@ Winst en Verlies rekening -

Winst en Verlies rekening

+

Winst en Verlies rekening

Periode van tot

Opbrengsten

diff --git a/saldibalans.xsl b/saldibalans.xsl index 7e0ba7c..66a7776 100644 --- a/saldibalans.xsl +++ b/saldibalans.xsl @@ -12,7 +12,7 @@ -

Saldi Balans

+

Saldi Balans

Periode van tot

-- 2.11.0