Rev 60 | Blame | Compare with Previous | Last modification | View Log | RSS feed
/***************************************************************************
* Copyright (C) 2007 by Andreas Theofilu *
* andreas@TheoSys.at *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation version 3 of the License. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#ifndef _TILGPLAN_H
#define _TILGPLAN_H
#ifndef BOOL
typedef unsigned char BOOL;
#endif
typedef struct TpParameter
{
int tageb; /* Tageberechnung */
int verzart; /* Verzinsungsart */
int ratenart; /* Ratenart */
int valuta; /* Valuta Rückzahlung */
double zssoll; /* %-Satz Zinsen Soll */
double zuschfix; /* Zuschuß fix */
double zuschprz; /* Zuschuß %-Satz */
double zuschannu; /* Annuitätenzuschuß */
long ragab; /* Rahmen gültig ab (Zuzählungsdatum) */
long abschl; /* Abschluß (Datum) */
BOOL ultimo; /* Berechnung auf Ultimo */
int abschlry; /* Abschlußrythmus */
int zuschver; /* Zuschuß Verrechnung */
double spesen; /* Fixspesen --> Abschlussentgelt */
double kosten; /* Fixspesen --> 1 x bei Auszahlung! */
double rahmen; /* Ursprüngliche Rahmen */
double kapital; /* Endkapital */
int raplan[12]; /* Ratenplan */
double rate; /* Rate (Ratenvorgabe) */
long dvon; /* Erste Einschränkung */
long dbis; /* Letzte Einschränkung */
long endfaell; /* Endfälligkeit */
BOOL runden; /* Runden (J/N) */
BOOL mehrfach; /* Mehrfachtilgungsplan (J/N) */
BOOL laufstop; /* Laufzeitunterbrechnung (J/N) */
BOOL ziaend; /* Zinssatzänderung (J/N) */
BOOL effekt; /* Effektivzinssatz (J/N) */
BOOL fixrate; /* Fixraten (J/N) */
/* Ergebnisse */
double gesamt; /* Gesamtbelastung */
double ergrate; /* Rate */
double lrate; /* Letzte Rate */
double ezins; /* Zinsen */
double zuschuss; /* Zinsenzuschuß */
double effformel; /* Effektivzinssatz nach Formel */
double gewicht; /* Effektivzinssatz gewichtet */
double anzuschuss; /* Annuitätenzuschuß */
double antotal; /* Gesamter Annuitätenzuschuß */
int anzraten; /* Anzahl Raten */
}TPPARS;
typedef struct DateTable
{
long datum; /* Raten/ Abschlußdatum */
char kz; /* Kennzeichen (A/R) */
double kapital; /* Kapital */
double tilg; /* Tilgung */
double rate; /* Annuität */
double zinsen;
double rkapi; /* Restkapital */
}DTABLE;
struct ZIAEND
{
long Datum;
double Zins;
double NewRate;
BOOL FixRate;
BOOL Rate;
};
extern int MonLeiste[];
extern char sTable1[];
extern char sTable2[];
//------------------ Funktionsdeklarationen ---------------------------
/*
* Declared in helper.h
long DateToDay (long);
long DayToDate (long);
long make_date (int, int, int);
long get_date (char *);
long get_gebos_date (char *, int);
void set_feb (int);
void date_int (int *day, int *mon, int *year, long date);
double integer (double zahl);
double round (double zahl, int prez);
char *PointNumber (double Zahl, int prec, char *ret);
void putError (HWND hWnd, int Err1, int Err2);
int MsgBox (HWND hWnd, int msg1, int msg2, UINT Buttons);
*/
//------------ Klassendefinition des Tilgungsplans (Groß) -------------
class TRech
{
public:
TRech (TPPARS *pPars) { TpPars = pPars; rund_fakt = (pPars->runden) ? 0 : 2; };
void setPars(TPPARS *pPars) { TpPars = pPars; };
int tilgpl (void); // Plausibilitätsprüfung, Steuerung
#ifdef _ZINSAENDERUNG
int GetZiaend ();
#endif
protected:
double GetRate (double rahmen, long ragab, long dvon);
int DekursivTable (void); // Dekursive Datumstabelle
int AntizipativTable (void); // Antizipative Datumstabelle
int Ratenplan (); // Erstellung eines Tilgungsplans
int DekursivPlan ();
#ifdef _ZINSAENDERUNG
void DekZiAend (int fdZins, long *zoff, long size, ZIAEND *Zi);
#endif
int AntizipativPlan ();
double runden (double zahl, int komma);
private:
BOOL test_abschl (int am);
long tageber (long date);
void vorrech ();
void einschr ();
void abschlus ();
void init_global_vars ();
private:
TPPARS *TpPars;
DTABLE DTable;
int rund_fakt;
int verzinsung;
int reh;
double divisor;
int a_ind;
int r_ind;
int max_abs, max_rat;
long pos;
long a_dat;
long tg_par, tg_alt;
long ab_dat[1200];
long rat_dat[1200];
int rat_anz[1200];
char AbschlPlan[12];
long ab_tag;
long dat_par;
long r_dat;
long ldat;
double zi_rat, zi_kap, rat, kap;
};
#endif // _TILGPLAN_H