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.
16 unsigned short group, nr;
25 acc_nr(unsigned short g, unsigned short n)
34 int operator==(acc_nr a)
36 return group == a.group && nr == a.nr;
39 friend std::istream & operator>>(std::istream &, acc_nr&);
40 friend std::ostream & operator<<(std::ostream &, acc_nr);
43 //typedef enum { DEBIT, CREDIT } direction;
56 amount(unsigned long l)
66 amount operator+(amount a)
70 sum.value = value + a.value;
74 amount &operator+=(amount a)
83 friend std::istream & operator>>(std::istream &, amount &);
84 friend std::ostream & operator<<(std::ostream &, amount);
95 Debit = 0; Credit = 0;
98 balance(amount D, amount C)
114 balance operator~() // Calculate balance, leaving either
115 { // Debit or Credit 0.
119 saldo = Debit - Credit;
120 if (long(Debit) > long(Credit))
121 b.Debit = Debit - Credit;
123 b.Credit = Credit - Debit;
128 balance operator-() // Reverse the balance
138 balance operator+(balance b)
142 sum.Debit = Debit + b.Debit;
143 sum.Credit = Credit + b.Credit;
147 balance &operator+=(balance b)
155 operator int() // Check equality
157 return Debit == Credit;
160 friend std::ostream & operator<<(std::ostream &, balance );
181 Booking &operator=(Booking &b)
190 friend std::istream & operator>>(std::istream &, Booking &);
191 friend std::ostream & operator<<(std::ostream &, Booking &);
221 friend std::istream & operator>>(std::istream &, Mutation &);
222 friend std::ostream & operator<<(std::ostream &, Mutation &);
225 typedef enum {BALANCE, COST} acc_kind;
247 Account& operator=(Account &a)
267 int operator==(acc_nr Anr)
269 return Anumber == Anr;
272 int operator!=(acc_nr Anr)
274 return !(Anumber == Anr);
276 Account &operator+=(Mutation &mut)
285 return kind == BALANCE;
293 void sheet(std::ostream &);
294 void Postscript_sheet(PostScript &);
296 friend std::istream & operator>>(std::istream&, Account&);
297 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);