Subversion Repositories public

Rev

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