Subversion Repositories public

Rev

Rev 60 | Go to most recent revision | Details | Last modification | View Log | RSS feed

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