Added begin and end dates of the booking period
[account.git] / account.cpp
index 9fa1931..ef1d0b8 100644 (file)
@@ -238,12 +238,12 @@ std::ostream& operator<<(std::ostream &s, Ledger &l)
    return s;
 }
 
-void PostScript_balans_layout(PostScript &ps)
+void PostScript_balans_layout(PostScript &ps, String header)
 {
    ps.Line(16, 595, 755, 595);
    ps.Line(16, 580, 755, 580);
    ps.Line(16, 40, 755, 40);
-   ps.Text(200, 582, "Saldibalans");
+   ps.Text(200, 582, header);
 
    ps.Line( 16, 595,  16, 40);
    ps.Line(755, 595, 755, 40);
@@ -272,7 +272,7 @@ void Ledger::accounts_report(const char * filename)
    }
 }
 
-void Ledger::saldi_report(const char * filename)
+void Ledger::saldi_report(const char * filename, date period_begin, date period_end)
 {
    PostScript ps(filename);
    balance total, saldi;
@@ -281,6 +281,10 @@ void Ledger::saldi_report(const char * filename)
    float      y = 572;
    int        row = 0;
 
+   String     header("Saldibalans");
+
+   header += " van " + period_begin.format("%e %B %Y") + " tot " + period_end.format("%e %B %Y");
+
    ps.NewPage(842, 595);
    ps.FontSize(6);
 
@@ -294,7 +298,7 @@ void Ledger::saldi_report(const char * filename)
          if (row == 64)
          {
             ps.FontSize(9);
-            PostScript_balans_layout(ps);
+            PostScript_balans_layout(ps, header);
             ps.NewPage(842, 595);
             ps.FontSize(6);
             y = 572;
@@ -341,7 +345,7 @@ void Ledger::saldi_report(const char * filename)
    }
 
    ps.FontSize(9);
-   PostScript_balans_layout(ps);
+   PostScript_balans_layout(ps, header);
 
    balance profit;
    profit = ~Result;
@@ -370,13 +374,13 @@ void Ledger::saldi_report(const char * filename)
    ps.Text(690, y, EndBalance.credit().to_string());
 }
 
-void Ledger::XML_saldi(std::ostream &s)
+void Ledger::XML_saldi(std::ostream &s, date period_begin, date period_end)
 {
    int  i;
 
    s << "<?xml version='1.0'?>\n";
    s << "<accounting>\n";
-   s << "<balance-sheet>\n";
+   s << "<balance-sheet begin='" << period_begin << "' end='" << period_end << "'>\n";
    for (i=0; i<nr_accs; i++)
    {
       balance saldo = ~balance(accs[i]);