Subversion Repositories public

Rev

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