2 #include <AXE/String.h>
5 #include "postscript.h"
7 // An account number is a number in two parts, separated by a dot (.).
8 // The first part is a 3-digit group number and the second part is a
9 // 2-digit account number within the group.
11 // Operations include input and output, conversion to or from a String
12 // and test for equality.
14 // added comment for git test
18 unsigned short group, nr;
27 acc_nr(unsigned short g, unsigned short n)
36 int operator==(acc_nr a)
38 return group == a.group && nr == a.nr;
41 friend std::istream & operator>>(std::istream &, acc_nr&);
42 friend std::ostream & operator<<(std::ostream &, acc_nr);
45 //typedef enum { DEBIT, CREDIT } direction;
58 amount(unsigned long l)
68 amount operator+(amount a)
72 sum.value = value + a.value;
76 amount &operator+=(amount a)
85 friend std::istream & operator>>(std::istream &, amount &);
86 friend std::ostream & operator<<(std::ostream &, amount);
97 Debit = 0; Credit = 0;
100 balance(amount D, amount C)
116 balance operator~() // Calculate balance, leaving either
117 { // Debit or Credit 0.
121 saldo = Debit - Credit;
122 if (long(Debit) > long(Credit))
123 b.Debit = Debit - Credit;
125 b.Credit = Credit - Debit;
130 balance operator-() // Reverse the balance
140 balance operator+(balance b)
144 sum.Debit = Debit + b.Debit;
145 sum.Credit = Credit + b.Credit;
149 balance &operator+=(balance b)
157 operator int() // Check equality
159 return Debit == Credit;
162 friend std::ostream & operator<<(std::ostream &, balance );
183 Booking &operator=(Booking &b)
192 friend std::istream & operator>>(std::istream &, Booking &);
193 friend std::ostream & operator<<(std::ostream &, Booking &);
223 friend std::istream & operator>>(std::istream &, Mutation &);
224 friend std::ostream & operator<<(std::ostream &, Mutation &);
227 typedef enum {BALANCE, COST} acc_kind;
249 Account& operator=(Account &a)
269 int operator==(acc_nr Anr)
271 return Anumber == Anr;
274 int operator!=(acc_nr Anr)
276 return !(Anumber == Anr);
278 Account &operator+=(Mutation &mut)
287 return kind == BALANCE;
295 void sheet(std::ostream &);
296 void Postscript_sheet(PostScript &);
298 friend std::istream & operator>>(std::istream&, Account&);
299 friend std::ostream & operator<<(std::ostream&, Account&);
315 Account &operator[](acc_nr Anr);
318 void operator+=(Account &a)
324 void read(char *filename);
333 static Account bogus = Account(acc_nr(1000, 1000));
344 friend std::ostream & operator<<(std::ostream &, Ledger&);
346 void accounts_report(const char *);
347 void saldi_report(const char *, date period_begin, date period_end);
348 void XML_saldi(std::ostream &, date period_begin, date period_end);