Subversion Repositories public

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
43 root 1
/***************************************************************************
2
 *   Copyright (C) 2007 by Andreas Theofilu   *
3
 *   andreas@TheoSys.at   *
4
 *                                                                         *
5
 *   This program is free software; you can redistribute it and/or modify  *
6
 *   it under the terms of the GNU General Public License as published by  *
7
 *   the Free Software Foundation; either version 2 of the License, or     *
8
 *   (at your option) any later version.                                   *
9
 *                                                                         *
10
 *   This program is distributed in the hope that it will be useful,       *
11
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
12
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
13
 *   GNU General Public License for more details.                          *
14
 *                                                                         *
15
 *   You should have received a copy of the GNU General Public License     *
16
 *   along with this program; if not, write to the                         *
17
 *   Free Software Foundation, Inc.,                                       *
18
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
19
 ***************************************************************************/
20
 
21
#ifndef _tprech_h
22
#define _tprech_h
23
 
24
#ifndef _RAIFFEISEN
25
   #define _RAIFFEISEN
26
#endif
27
 
28
#ifndef BOOL
29
typedef unsigned char BOOL;
30
#endif
31
 
32
typedef struct TpParameter
33
{
34
	int     tageb;                  /* Tageberechnung */
35
	int     verzart;                /* Verzinsungsart */
36
	int     ratenart;               /* Ratenart */
37
	int     valuta;                 /* Valuta Rückzahlung */
38
	double  zssoll;                 /* %-Satz Zinsen Soll */
39
	double  zuschfix;               /* Zuschuß fix */
40
	double  zuschprz;               /* Zuschuß %-Satz */
41
	double  zuschannu;		/* Annuitätenzuschuß */
42
	long    ragab;                  /* Rahmen gültig ab (Zuzählungsdatum) */
43
	long    abschl;                 /* Abschluß (Datum) */
44
	BOOL    ultimo;                 /* Berechnung auf Ultimo */
45
	int     abschlry;               /* Abschlußrythmus */
46
	int     zuschver;               /* Zuschuß Verrechnung */
47
	double  spesen;                 /* Fixspesen */
48
	double  rahmen;                 /* Ursprüngliche Rahmen */
49
	double  kapital;                /* Endkapital */
50
	int     raplan[12];             /* Ratenplan */
51
	double  rate;                   /* Rate (Ratenvorgabe) */
52
	long    dvon;                   /* Erste Einschränkung */
53
	long    dbis;                   /* Letzte Einschränkung */
54
	long    endfaell;               /* Endfälligkeit */
55
	BOOL    runden;                 /* Runden (J/N) */
56
	BOOL    mehrfach;               /* Mehrfachtilgungsplan (J/N) */
57
	BOOL    laufstop;               /* Laufzeitunterbrechnung (J/N) */
58
	BOOL    ziaend;                 /* Zinssatzänderung (J/N) */
59
	BOOL    effekt;                 /* Effektivzinssatz (J/N) */
60
	BOOL    fixrate;                /* Fixraten (J/N) */
61
	/* Ergebnisse */
62
	double  gesamt;                 /* Gesamtbelastung */
63
	double  ergrate;                /* Rate */
64
	double  lrate;                  /* Letzte Rate */
65
	double  ezins;			/* Zinsen */
66
	double  zuschuss;		/* Zinsenzuschuß */
67
	double  effformel;              /* Effektivzinssatz nach Formel */
68
	double  gewicht;                /* Effektivzinssatz gewichtet */
69
	double  anzuschuss;		/* Annuitätenzuschuß */
70
	double  antotal;		/* Gesamter Annuitätenzuschuß */
71
	int     anzraten;		/* Anzahl Raten */
72
}TPPARS;
73
 
74
typedef struct DateTable
75
{
76
	long    datum;			/* Raten/ Abschlußdatum */
77
	char    kz;                     /* Kennzeichen (A/R) */
78
	double  kapital;		/* Kapital */
79
	double  tilg;			/* Tilgung */
80
	double  rate;			/* Annuität */
81
	double  zinsen;
82
	double  rkapi;			/* Restkapital */
83
}DTABLE;
84
 
85
struct ZIAEND
86
{
87
	long Datum;
88
	double Zins;
89
	double NewRate;
90
        BOOL FixRate;
91
	BOOL Rate;
92
};
93
 
94
extern char sTable1[];
95
extern char sTable2[];
96
 
97
//------------ Klassendefinition des Tilgungsplans (Groß) -------------
98
 
99
class TRech
100
{
101
	public:
102
	   TRech (TPPARS *pPars) { TpPars = pPars; rund_fakt = (pPars->runden) ? 0 : 2; };
103
	   int tilgpl (void);		// Plausibilitätsprüfung, Steuerung
104
#ifdef _RAIFFEISEN
105
	   int GetZiaend (void);
106
#endif
107
 
108
	protected:
109
	   double GetRate (double rahmen, long ragab, long dvon);
110
	   int DekursivTable (void);	// Dekursive Datumstabelle
111
           int AntizipativTable (void); // Antizipative Datumstabelle
112
	   int Ratenplan ();		// Erstellung eines Tilgungsplans
113
	   int DekursivPlan ();
114
#ifdef _RAIFFEISEN
115
	   void DekZiAend (int fdZins, long *zoff, long size, ZIAEND *Zi);
116
#endif
117
	   int AntizipativPlan ();
118
	   double runden (double zahl, int komma);
119
 
120
	private:
121
	   BOOL test_abschl (int am);
122
	   long tageber (long date);
123
	   void vorrech ();
124
	   void einschr ();
125
	   void abschlus ();
126
	   void init_global_vars ();
127
	   int  gesamt1 ();
128
 
129
	private:
130
	   TPPARS *TpPars;
131
	   DTABLE DTable;
132
	   int rund_fakt;
133
	   int verzinsung;
134
	   int reh;
135
	   double divisor;
136
	   int a_ind;
137
	   int r_ind;
138
	   int max_abs, max_rat;
139
	   long pos;
140
	   long a_dat;
141
	   long tg_par, tg_alt;
142
	   long ab_dat[1200];
143
	   long rat_dat[1200];
144
	   int rat_anz[1200];
145
	   char AbschlPlan[12];
146
	   long ab_tag;
147
	   long dat_par;
148
	   long r_dat;
149
           long ldat;
150
	   double zi_rat, zi_kap, rat, kap;
151
};
152
 
153
#endif		// _tprech_h