Subversion Repositories public

Rev

Rev 52 | Rev 64 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
43 root 1
/***************************************************************************
52 andreas 2
 *   Copyright (C) 2007 by Andreas Theofilu                                *
3
 *   andreas@TheoSys.at                                                    *
43 root 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  *
52 andreas 7
 *   the Free Software Foundation version 3 of the License.                *
43 root 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
#include <klineedit.h>
21
#include <kmessagebox.h>
22
#include <klocale.h>
23
#include <kdatewidget.h>
24
#include <kcombobox.h>
25
#include <knuminput.h>
60 andreas 26
#include <kfiledialog.h>
43 root 27
#include <qcheckbox.h>
52 andreas 28
#include <qradiobutton.h>
60 andreas 29
#include <qdir.h>
30
#include <qfile.h>
43 root 31
 
32
#include <stdlib.h>
60 andreas 33
//#include <iostream.h>
43 root 34
#include "helper.h"
35
#include "tilgungsplanwidget.h"
36
#include "ziaendwidget.h"
60 andreas 37
#include "ratenplanwidget.h"
43 root 38
 
39
tilgungsplanWidget::tilgungsplanWidget ( QWidget* parent, const char* name, WFlags fl )
40
		: tilgungsplanWidgetBase ( parent,name,fl )
41
{
60 andreas 42
	dirty = FALSE;
43
	mamma = parent;		// Parent window needed to exit application
43 root 44
 
60 andreas 45
	// Zuletzt verwendete Maskenparameter aus der Datei holen, sofern
46
	// es diese Datei bereits gibt.
47
	readValues();
43 root 48
}
49
 
50
tilgungsplanWidget::~tilgungsplanWidget()
60 andreas 51
{
52
QString hdir = QDir::homeDirPath ();
53
QFile tmpFile;
43 root 54
 
60 andreas 55
	if (!dirty)
56
	   return;
57
 
58
	// Zuletzt verwendete Maskenparameter in eine Datei schreiben.
59
	hdir.append("/.tilgpars.dat");
60
	tmpFile.setName(hdir);
61
 
62
	if (tmpFile.open(IO_ReadWrite | IO_Truncate) == FALSE)
63
	{
64
	   KMessageBox::error(0, QString("Could not open file for writing: %1").arg(tmpFile.errorString()));
65
	   return;
66
	}
67
 
68
	moveValues();
69
	write (tmpFile.handle(), &TpPars, sizeof(TPPARS));
70
	tmpFile.close();
71
}
72
 
73
void tilgungsplanWidget::moveValues()
43 root 74
{
60 andreas 75
QDate dt;
76
int ret;
43 root 77
 
60 andreas 78
	memset(&TpPars, 0, sizeof(TPPARS));
43 root 79
	// Zuweisen der Inhalte der Widgets zur internen Parameterstruktur.
80
	TpPars.effformel = 0.0;
81
	TpPars.gewicht = 0.0;
52 andreas 82
	TpPars.tageb = comboBox_tageber->currentItem() + 1;
83
 
84
	switch (comboBox_verzart->currentItem())
85
	{
86
	   case 0: TpPars.verzart = 0; break;	// Dekursiv
87
	   case 1: TpPars.verzart = 3; break;	// Antizipativ
88
	   case 2: TpPars.verzart = 7; break;	// Dekursiv; Zinsen am Beg.d. Absclussp.
89
	   case 3: TpPars.verzart = 4; break;	// Unverzinst
90
	}
91
 
43 root 92
	TpPars.ratenart = comboBox_Ratart->currentItem();
93
	TpPars.valuta = comboBox_valuta->currentItem();
94
	TpPars.zssoll = kDoubleNumInput_Zinssatz->value();
46 andreas 95
	TpPars.zuschfix = kDoubleNumInput_ZuschFix->value();
96
	TpPars.zuschprz = kDoubleNumInput_ZiZuschuss->value();
43 root 97
	TpPars.zuschannu = kDoubleNumInput_AnnZuschuss->value();
98
	dt = kDateWidget_Auszahlung->date();
99
	TpPars.ragab = make_date(dt.day(), dt.month(), dt.year());
100
	dt = kDateWidget_Abschluss->date();
101
	TpPars.abschl = make_date(dt.day(), dt.month(), dt.year());
102
	TpPars.ultimo = checkBox_RechUltimo->isChecked();
103
	TpPars.anzraten = kIntNumInput_AnzRaten->value();
104
	ret = comboBox_Abschl->currentItem();
105
 
106
	switch (ret)
107
	{
108
           case 0: TpPars.abschlry = 0; break;
109
	   case 1: TpPars.abschlry = 1; break;
110
	   case 2: TpPars.abschlry = 3; break;
111
	   case 3: TpPars.abschlry = 6; break;
112
	   case 4: TpPars.abschlry = 12; break;
113
	   case 5: TpPars.abschlry = 41; break;
114
	   case 6: TpPars.abschlry = 43; break;
115
	   case 7: TpPars.abschlry = 46; break;
116
	   case 8: TpPars.abschlry = 47; break;
117
	   case 9: TpPars.abschlry = 48; break;
118
	   case 10: TpPars.abschlry = 52; break;
119
        }
120
 
60 andreas 121
	TpPars.zuschver = 0;		// wird derzeit nicht verwendet!
43 root 122
	TpPars.spesen = kDoubleNumInput_Fixspesen->value();
123
	TpPars.rahmen = kDoubleNumInput_Betrag->value();
124
	TpPars.kapital = 0.0;
44 andreas 125
	TpPars.raplan[0] = checkBox_RaJan->isChecked();
126
	TpPars.raplan[1] = checkBox_RaFeb->isChecked();
127
	TpPars.raplan[2] = checkBox_RaMar->isChecked();
128
	TpPars.raplan[3] = checkBox_RaApr->isChecked();
129
	TpPars.raplan[4] = checkBox_RaMai->isChecked();
130
	TpPars.raplan[5] = checkBox_RaJun->isChecked();
131
	TpPars.raplan[6] = checkBox_RaJul->isChecked();
132
	TpPars.raplan[7] = checkBox_RaAug->isChecked();
133
	TpPars.raplan[8] = checkBox_RaSep->isChecked();
134
	TpPars.raplan[9] = checkBox_RaOkt->isChecked();
135
	TpPars.raplan[10] = checkBox_RaNov->isChecked();
136
	TpPars.raplan[11] = checkBox_RaDez->isChecked();
43 root 137
	TpPars.rate = kDoubleNumInput_Rate->value();
138
	dt = kDateWidget_RaVon->date();
139
	TpPars.dvon = make_date(dt.day(), dt.month(), dt.year());
140
	dt = kDateWidget_RaBis->date();
141
	TpPars.dbis = make_date(dt.day(), dt.month(), dt.year());
142
	dt = kDateWidget_Endfael->date();
143
	TpPars.endfaell = make_date(dt.day(), dt.month(), dt.year());
144
	TpPars.runden = checkBox_Runden->isChecked();
145
	TpPars.mehrfach = FALSE;
146
	TpPars.laufstop = FALSE;
52 andreas 147
#ifdef _ZINSAENDERUNG
148
	TpPars.ziaend = checkBox_ZiChange->isChecked();
149
#else
43 root 150
	TpPars.ziaend = FALSE;
52 andreas 151
#endif
60 andreas 152
	TpPars.effekt = FALSE;
43 root 153
	TpPars.fixrate = checkBox_Rate->isChecked();
60 andreas 154
}
43 root 155
 
60 andreas 156
void tilgungsplanWidget::readValues(const char *fname, BOOL home)
157
{
158
QDate dt;
159
QString hdir = QDir::homeDirPath ();
160
QFile tmpFile;
161
int fd, day, mon, year;
162
 
163
	// Zuletzt verwendete Maskenparameter aus der Datei holen, sofern
164
	// es diese Datei bereits gibt.
165
	if (home)
166
	{
167
	   hdir = QDir::homeDirPath();
168
	   hdir.append(fname);
169
	}
170
	else
171
	   hdir = QString(fname);
172
 
173
	tmpFile.setName(hdir);
174
 
175
	if (tmpFile.open(IO_ReadOnly) == FALSE)
176
	{
177
	   // Maske mit sinnvollen Parametern versorgen
178
	   comboBox_tageber->setCurrentItem(3);
179
	   comboBox_Ratart->setCurrentItem(1);
180
	   comboBox_Abschl->setCurrentItem(10);
181
	   kDoubleNumInput_Zinssatz->setValue(5.5);
182
	   kDateWidget_Auszahlung->setDate(QDate::currentDate());
183
	   // Datum: Der 5. des nächsten Monats
184
	   dt = QDate::currentDate();
185
	   dt = dt.addMonths(1);
186
	   dt.setYMD(dt.year(), dt.month(), 5);
187
	   kDateWidget_RaVon->setDate(dt);
188
	   dt = dt.addYears(1);
189
	   kDateWidget_RaBis->setDate(dt);
190
	   kDateWidget_ZiGiltAb->setDate(QDate::currentDate());
191
	   kDoubleNumInput_Betrag->setValue(100000.0);
192
	   checkBox_RaJan->setChecked(TRUE);
193
	   checkBox_RaFeb->setChecked(TRUE);
194
	   checkBox_RaMar->setChecked(TRUE);
195
	   checkBox_RaApr->setChecked(TRUE);
196
	   checkBox_RaMai->setChecked(TRUE);
197
	   checkBox_RaJun->setChecked(TRUE);
198
	   checkBox_RaJul->setChecked(TRUE);
199
	   checkBox_RaAug->setChecked(TRUE);
200
	   checkBox_RaSep->setChecked(TRUE);
201
	   checkBox_RaOkt->setChecked(TRUE);
202
	   checkBox_RaNov->setChecked(TRUE);
203
	   checkBox_RaDez->setChecked(TRUE);
204
#ifndef _ZINSAENDERUNG
205
	   checkBox_ZiChange->setProperty("enabled", QVariant("FALSE"));
206
#endif
207
	   return;
208
	}
209
 
210
	fd = tmpFile.handle();
211
	read (fd, &TpPars, sizeof(TPPARS));
212
	tmpFile.close();
213
	kDoubleNumInput_Betrag->setValue(TpPars.rahmen);
214
	date_int(&day, &mon, &year, TpPars.ragab);
215
	dt.setYMD(year, mon, day);
216
	kDateWidget_Auszahlung->setDate(dt);
217
	comboBox_tageber->setCurrentItem(TpPars.tageb-1);
218
 
219
	switch (TpPars.verzart)
220
	{
221
	   case 0: comboBox_verzart->setCurrentItem(0); break;
222
	   case 3: comboBox_verzart->setCurrentItem(1); break;
223
	   case 7: comboBox_verzart->setCurrentItem(2); break;
224
	   case 4: comboBox_verzart->setCurrentItem(3); break;
225
	}
226
 
227
	kDoubleNumInput_Fixspesen->setValue(TpPars.spesen);
228
	kDoubleNumInput_Zinssatz->setValue(TpPars.zssoll);
229
#ifdef _ZINSAENDERUNG
230
	checkBox_ZiChange->setChecked(TpPars.ziaend);
231
#else
232
	checkBox_ZiChange->setProperty("enabled", QVariant("FALSE"));
233
#endif
234
	date_int(&day, &mon, &year, TpPars.ragab);
235
	dt.setYMD(year, mon, day);
236
	kDateWidget_ZiGiltAb->setDate(dt);		// Dummy!
237
	checkBox_RechUltimo->setChecked(TpPars.ultimo);
238
	kDoubleNumInput_ZiZuschuss->setValue(TpPars.zuschprz);
239
	kDoubleNumInput_ZuschFix->setValue(TpPars.zuschfix);
240
 
241
	if (TpPars.zuschprz > 0.0)
242
	{
243
	   radioButton_ZuschP->setChecked(TRUE);
244
	   radioButton_ZuschF->setChecked(FALSE);
245
	}
246
	else
247
	{
248
	   radioButton_ZuschP->setChecked(FALSE);
249
	   radioButton_ZuschF->setChecked(TRUE);
250
	}
251
 
252
	kDoubleNumInput_AnnZuschuss->setValue(TpPars.zuschannu);
253
	checkBox_Runden->setChecked(TpPars.runden);
254
	kIntNumInput_AnzRaten->setValue(TpPars.anzraten);
255
	kDoubleNumInput_Rate->setValue(TpPars.rate);
256
	date_int(&day, &mon, &year, TpPars.endfaell);
257
	dt.setYMD(year, mon, day);
258
	kDateWidget_Endfael->setDate(dt);
259
	date_int(&day, &mon, &year, TpPars.dvon);
260
	dt.setYMD(year, mon, day);
261
	kDateWidget_RaVon->setDate(dt);
262
	checkBox_Rate->setChecked(TpPars.fixrate);
263
	comboBox_Ratart->setCurrentItem(TpPars.ratenart);
264
	checkBox_RaJan->setChecked(TpPars.raplan[0]);
265
	checkBox_RaFeb->setChecked(TpPars.raplan[1]);
266
	checkBox_RaMar->setChecked(TpPars.raplan[2]);
267
	checkBox_RaApr->setChecked(TpPars.raplan[3]);
268
	checkBox_RaMai->setChecked(TpPars.raplan[4]);
269
	checkBox_RaJun->setChecked(TpPars.raplan[5]);
270
	checkBox_RaJul->setChecked(TpPars.raplan[6]);
271
	checkBox_RaAug->setChecked(TpPars.raplan[7]);
272
	checkBox_RaSep->setChecked(TpPars.raplan[8]);
273
	checkBox_RaOkt->setChecked(TpPars.raplan[9]);
274
	checkBox_RaNov->setChecked(TpPars.raplan[10]);
275
	checkBox_RaDez->setChecked(TpPars.raplan[11]);
276
	date_int(&day, &mon, &year, TpPars.dbis);
277
	dt.setYMD(year, mon, day);
278
	kDateWidget_RaBis->setDate(dt);
279
	comboBox_valuta->setCurrentItem(TpPars.valuta);
280
 
281
	switch (TpPars.abschlry)
282
	{
283
	   case 0: comboBox_Abschl->setCurrentItem(0); break;
284
	   case 1: comboBox_Abschl->setCurrentItem(1); break;
285
	   case 3: comboBox_Abschl->setCurrentItem(2); break;
286
	   case 6: comboBox_Abschl->setCurrentItem(3); break;
287
	   case 12: comboBox_Abschl->setCurrentItem(4); break;
288
	   case 41: comboBox_Abschl->setCurrentItem(5); break;
289
	   case 43: comboBox_Abschl->setCurrentItem(6); break;
290
	   case 46: comboBox_Abschl->setCurrentItem(7); break;
291
	   case 47: comboBox_Abschl->setCurrentItem(8); break;
292
	   case 48: comboBox_Abschl->setCurrentItem(9); break;
293
	   case 52: comboBox_Abschl->setCurrentItem(10); break;
294
	}
295
 
296
	date_int (&day, &mon, &year, TpPars.abschl);
297
	dt.setYMD(year, mon, day);
298
	kDateWidget_Abschluss->setDate(dt);
299
}
300
 
301
/*$SPECIALIZATION$*/
302
void tilgungsplanWidget::mnCalcTPSumSlot()
303
{
304
QDate dt, dt1;
305
QString str, zia;
306
TRech *tp;
307
int ret, day1, day2, mon1, mon2, year1, year2;
308
char hv0[255];
309
double ezins, rate;
310
TPPARS pars;
311
 
312
	// Zuweisen der Inhalte der Widgets zur internen Parameterstruktur.
313
	moveValues();
314
 
43 root 315
	if (TpPars.dbis > TpPars.endfaell)
316
	   TpPars.endfaell = TpPars.dbis;
317
 
60 andreas 318
	if (TpPars.fixrate)
319
	{
320
	   TpPars.endfaell = 0L;
321
	   TpPars.dbis = 0L;
322
	}
323
 
324
	// Parameter für spätere Effektivzinsberechnung wegspeichern
325
	memmove (&pars, &TpPars, sizeof(TPPARS));
326
 
43 root 327
	// Berechnung anstossen
328
	tp = new TRech (&TpPars);
329
 
330
	if ((ret = tp->tilgpl()) != 0)
331
	{
332
	   switch (ret)
333
	   {
334
	      case 1: str = QString::fromUtf8("Fehler beim Erzeugen einer Temporärdatei!"); break;
335
	      case 2: str = QString::fromUtf8("Erste Einschränkung nicht vorhanden!"); break;
336
	      case 3:
337
		 date_int (&day1, &mon1, &year1, TpPars.ragab);
338
		 date_int (&day2, &mon2, &year2, TpPars.dvon);
339
		 sprintf (hv0, "Das Auszahlungsdatum (%02d.%02d.%d) muss kleiner als das Datum der ersten Einschränkung sein (%02d.%02d.%d)!",
340
			day1, mon1, year1, day2, mon2, year2);
341
		 str = QString::fromUtf8(hv0); break;
342
	      case 4:
343
		 date_int (&day1, &mon1, &year1, TpPars.abschl);
344
		 date_int (&day2, &mon2, &year2, TpPars.ragab);
345
		 sprintf (hv0, "Das Abschlussdatum (%02d.%02d.%d) darf nicht kleiner als das Auszahlungsdatum (%02d, %02d.%d) sein!",
346
			day1, mon1, year1, day2, mon2, year2);
347
		 str = QString::fromUtf8(hv0); break;
348
	      case 5:
349
		 date_int (&day1, &mon1, &year1, TpPars.dvon);
350
		 date_int (&day2, &mon2, &year2, TpPars.dbis);
351
		 sprintf (hv0, "Die erste Einschränkung (%02d.%02d.%d) darf nicht größer als die letzte Einschränkung (%02d.%02d.%d) sein!",
352
			day1, mon1, year1, day2, mon2, year2);
353
		 str = QString::fromUtf8(hv0); break;
354
	      case 6:
355
		 date_int (&day1, &mon1, &year1, TpPars.dbis);
356
		 date_int (&day2, &mon2, &year2, TpPars.endfaell);
357
		 sprintf (hv0, "Die letzte Einschränkung (%02d.%02d.%d) darf nicht größer die Endfälligkeit (%02d.%02d.%d) sein!",
358
			day1, mon1, year1, day2, mon2, year2);
359
		 str = QString::fromUtf8(hv0); break;
360
	      case 7: str = QString::fromUtf8("Es wurde keine Rate angegeben!"); break;
361
	      case 8: str = QString::fromUtf8("Kein, oder ungültiges Auszahlungsdatum!"); break;
362
	      case 9: str = QString::fromUtf8("Die Verzinsung in Bezug auf den Abschlussrythmus ist ungültig!"); break;
363
	      case 10: str = QString::fromUtf8("Das Abschlussdatum fehlt oder ist ungültig!"); break;
364
	      case 11:
365
		 sprintf(hv0, "Der Abschlussrythmus ist ungültig! (%d)",TpPars.abschlry);
366
		 str = QString::fromUtf8(hv0); break;
367
	      case 12: str = QString::fromUtf8("Die Verzinsungsart ist ungültig!"); break;
368
	      case 13: str = QString::fromUtf8("Die Ratenart ist ungültig!"); break;
369
	      case 14: str = QString::fromUtf8("Die Laufzeit ist über 100 Jahre!"); break;
370
	      case 15: str = QString::fromUtf8("Es wurde keine Rate vorgegeben!"); break;
371
	      case 16: str = QString::fromUtf8("Die vorgegebene Rate darf nicht kleiner als 0 sein!"); break;
372
	      case 18: str = QString::fromUtf8("Die erste Einschränkung oder die Ratenleiste ist ungültig!"); break;
373
	      case 19: str = QString::fromUtf8("Die letzte Einschränkung oder die Ratenleiste ist ungültig!"); break;
60 andreas 374
	      case 20: str = QString::fromUtf8("Interner Rechenfehler!"); break;
43 root 375
	      case 22: str = QString::fromUtf8("Nicht genügend Speicher!"); break;
376
	      case 23: str = QString::fromUtf8("\"Antizipativ\" erlaubt keine Zinssatzänderung!"); break;
44 andreas 377
	      case 24: 
378
	      case 25: str = QString::fromUtf8("Fehler beim Lesen der Zinssatzänderungen!"); break;
60 andreas 379
	      case 26: str = QString::fromUtf8("Interner Fehler bei der Effektivzinsberechnung! Der Abschlussrhythmus muss jährlich sein!"); break;
380
	      case 27: str = QString::fromUtf8("Interner Fehler bei der Effektivzinsberechnung! Die Laufzeit muss genau 1 Jahr betragen!"); break;
381
	      case 28: str = QString::fromUtf8("Eine Effektivzinsberechnung ist bei <b>dekursiver</b> Verzinsung möglich!"); break;
382
	      case 29: str = QString::fromUtf8("Für die Effektivzinsberechnung muss eine Rate größer 0 angegeben werden!"); break;
43 root 383
	      default:
60 andreas 384
//		 sprintf (hv0, "Unbekannter Fehler \"%d\"! Prüfen Sie die Eingaben.", ret);
385
	         str = QString("Unbekannter Fehler \"%1\"! Prüfen Sie die Eingaben.").arg(ret);
43 root 386
	   }
387
 
388
	   KMessageBox::error(0, str, i18n("Fehler"));
389
	   lineEdit_EffZi->clear();
390
	   lineEdit_GesBelast->clear();
44 andreas 391
	   lineEdit_ErgRate->clear();
392
	   lineEdit_ErgLRate->clear();
393
	   lineEdit_ErgZinsen->clear();
394
	   lineEdit_ErgZiZusch->clear();
395
	   lineEdit_ErgAnnZusch->clear();
396
	   lineEdit_ErgSumAnnZusch->clear();
60 andreas 397
	   delete tp;
43 root 398
	   return;
399
	}
60 andreas 400
/*
52 andreas 401
	if (TpPars.effformel > 0.0)
402
	   PointNumber(TpPars.effformel, 3, &hv0[0]);
403
	else
404
	   PointNumber(TpPars.gewicht, 3, &hv0[0]);
405
 
43 root 406
	lineEdit_EffZi->clear();
407
	lineEdit_EffZi->insert(hv0);
60 andreas 408
*/
43 root 409
	PointNumber(TpPars.gesamt, 2, &hv0[0]);
410
	lineEdit_GesBelast->clear();
411
	lineEdit_GesBelast->insert(hv0);
44 andreas 412
 
43 root 413
	kIntNumInput_AnzRaten->setValue(TpPars.anzraten);
44 andreas 414
 
43 root 415
	date_int(&day1, &mon1, &year1, TpPars.dbis);
416
	dt.setYMD(year1, mon1, day1);
417
	kDateWidget_RaBis->setDate(dt);
44 andreas 418
 
43 root 419
	date_int(&day1, &mon1, &year1, TpPars.endfaell);
420
	dt.setYMD(year1, mon1, day1);
421
	kDateWidget_Endfael->setDate(dt);
44 andreas 422
 
60 andreas 423
	rate = TpPars.ergrate;
44 andreas 424
	PointNumber(TpPars.ergrate, 2, hv0);
425
	lineEdit_ErgRate->clear();
426
	lineEdit_ErgRate->insert(hv0);
427
 
428
	PointNumber(TpPars.lrate, 2, hv0);
429
	lineEdit_ErgLRate->clear();
430
	lineEdit_ErgLRate->insert(hv0);
431
 
432
	PointNumber(TpPars.ezins, 2, hv0);
433
	lineEdit_ErgZinsen->clear();
434
	lineEdit_ErgZinsen->insert(hv0);
435
 
436
	PointNumber(TpPars.zuschuss, 2, hv0);
437
	lineEdit_ErgZiZusch->clear();
438
	lineEdit_ErgZiZusch->insert(hv0);
439
 
440
	PointNumber(TpPars.anzuschuss, 2, hv0);
441
	lineEdit_ErgAnnZusch->clear();
442
	lineEdit_ErgAnnZusch->insert(hv0);
443
 
444
	PointNumber(TpPars.antotal, 2, hv0);
445
	lineEdit_ErgSumAnnZusch->clear();
446
	lineEdit_ErgSumAnnZusch->insert(hv0);
60 andreas 447
 
448
	// Effektivzinssatz berechnen
449
/*	pars.effekt = TRUE;
450
	pars.zuschfix = 0.0;
451
	pars.zuschprz = 0.0;
452
	pars.zuschannu = 0.0;
453
	pars.ergrate = 0.0;
454
	pars.lrate = 0.0;
455
	pars.ezins = 0.0;
456
	pars.zuschuss = 0.0;
457
	pars.gewicht = 0.0;
458
 
459
	if (TpPars.abschlry > 40)
460
	   pars.abschlry = 52;
461
	else
462
	   pars.abschlry = 12;
463
 
464
	pars.spesen = 0.0;
465
	pars.rate = TpPars.ergrate;
466
	pars.endfaell = 0L;
467
	pars.fixrate = TRUE;
468
	pars.ziaend = FALSE;
469
 
470
	tp->setPars(&pars);
471
 
472
	if ((ret = tp->tilgpl()) != 0)
473
	{
474
	   KMessageBox::error(0, QString("Interner Fehler \"%1\"!").arg(ret), i18n("Fehler"));
475
	   delete tp;
476
	   return;
477
	}
478
 
479
	PointNumber(100.0 - (100.0 / TpPars.ezins * pars.ezins), 3, &hv0[0]);
480
	lineEdit_EffZi->clear();
481
	lineEdit_EffZi->insert(hv0);
482
 
483
KMessageBox::information(this, QString("O-EZins: %1\nN-EZins: %2\nGesamt1: %3\nGesamt2: %4")
484
	.arg(TpPars.ezins)
485
	.arg(pars.ezins)
486
	.arg(TpPars.gesamt)
487
	.arg(pars.gesamt));
488
*/
489
	delete tp;
43 root 490
}
491
 
492
void tilgungsplanWidget::txRaDezSlot()
60 andreas 493
{
494
	dirty = TRUE;
495
}
43 root 496
 
497
void tilgungsplanWidget::txRaNovSlot()
60 andreas 498
{
499
	dirty = TRUE;
500
}
43 root 501
 
502
void tilgungsplanWidget::txRaOktSlot()
60 andreas 503
{
504
	dirty = TRUE;
505
}
43 root 506
 
507
void tilgungsplanWidget::txRaSepSlot()
60 andreas 508
{
509
	dirty = TRUE;
510
}
43 root 511
 
512
void tilgungsplanWidget::txRaAugSlot()
60 andreas 513
{
514
	dirty = TRUE;
515
}
43 root 516
 
517
void tilgungsplanWidget::txRaJulSlot()
60 andreas 518
{
519
	dirty = TRUE;
520
}
43 root 521
 
522
void tilgungsplanWidget::txRaJunSlot()
60 andreas 523
{
524
	dirty = TRUE;
525
}
43 root 526
 
527
void tilgungsplanWidget::txRaMaiSlot()
60 andreas 528
{
529
	dirty = TRUE;
530
}
43 root 531
 
532
void tilgungsplanWidget::txRaMarSlot()
60 andreas 533
{
534
	dirty = TRUE;
535
}
43 root 536
 
537
void tilgungsplanWidget::txRaFebSlot()
60 andreas 538
{
539
	dirty = TRUE;
540
}
43 root 541
 
542
void tilgungsplanWidget::txRaJanSlot()
60 andreas 543
{
544
	dirty = TRUE;
545
}
43 root 546
 
547
void tilgungsplanWidget::txRaAprSlot()
60 andreas 548
{
549
	dirty = TRUE;
550
}
43 root 551
 
552
void tilgungsplanWidget::txGesBelastSlot()
60 andreas 553
{
554
	dirty = TRUE;
555
}
43 root 556
 
557
void tilgungsplanWidget::txEffZiSlot()
60 andreas 558
{
559
	dirty = TRUE;
560
}
43 root 561
 
562
void tilgungsplanWidget::intAnzRatenSlot()
60 andreas 563
{
564
	dirty = TRUE;
565
}
43 root 566
 
567
void tilgungsplanWidget::numAnnZuschSlot()
60 andreas 568
{
569
	dirty = TRUE;
570
}
43 root 571
 
572
void tilgungsplanWidget::dtZiGiltAbSlot()
60 andreas 573
{
574
	dirty = TRUE;
575
}
43 root 576
 
577
void tilgungsplanWidget::dtRaVonSlot()
60 andreas 578
{
579
	dirty = TRUE;
580
}
43 root 581
 
582
void tilgungsplanWidget::dtRaBisSlot()
60 andreas 583
{
584
	dirty = TRUE;
585
}
43 root 586
 
587
void tilgungsplanWidget::dtEndfaelSlot()
60 andreas 588
{
589
	dirty = TRUE;
590
}
43 root 591
 
592
void tilgungsplanWidget::dtAuszahlSlot()
60 andreas 593
{
594
	kDateWidget_ZiGiltAb->setDate(kDateWidget_Auszahlung->date());
595
	dirty = TRUE;
596
}
43 root 597
 
598
void tilgungsplanWidget::dtAbschlussSlot()
60 andreas 599
{
600
	dirty = TRUE;
601
}
43 root 602
 
603
void tilgungsplanWidget::lbRatartSlot()
60 andreas 604
{
605
	dirty = TRUE;
606
}
43 root 607
 
608
void tilgungsplanWidget::cbZiChangeSlot()
60 andreas 609
{
610
	dirty = TRUE;
611
}
43 root 612
 
613
void tilgungsplanWidget::cbUltimoSlot()
60 andreas 614
{
615
	dirty = TRUE;
616
}
43 root 617
 
618
void tilgungsplanWidget::cbRateSlot()
60 andreas 619
{
620
	dirty = TRUE;
621
}
43 root 622
 
623
void tilgungsplanWidget::mnCalcTPSlot()
60 andreas 624
{
625
ratenplanWidget *dlg = new ratenplanWidget(this, "ratenplanWidgetBase", TRUE, 0);
43 root 626
 
60 andreas 627
	dlg->exec();
628
	delete dlg;
629
}
630
 
44 andreas 631
void tilgungsplanWidget::mnInputZiSlot()
632
{
60 andreas 633
#ifdef _ZINSAENDERUNG
44 andreas 634
ziaendWidget *dlg = new ziaendWidget(this, "ziaendWidgetBase", TRUE, 0);
635
 
52 andreas 636
	dlg->exec();
44 andreas 637
	delete dlg;
60 andreas 638
#else
639
	KMessageBox::information(0, i18n("This module was omitted at compile time! To activate it, define \"_ZINSAENDERUNG\" globaly and recompile the program."));
640
#endif
44 andreas 641
}
642
 
43 root 643
void tilgungsplanWidget::lbVerzartSlot()
60 andreas 644
{
645
	dirty = TRUE;
646
}
43 root 647
 
648
void tilgungsplanWidget::lbTageberSlot()
60 andreas 649
{
650
	dirty = TRUE;
651
}
43 root 652
 
653
void tilgungsplanWidget::numZuzaehlSlot()
60 andreas 654
{
655
	dirty = TRUE;
656
}
43 root 657
 
658
void tilgungsplanWidget::numBeaGebSlot()
60 andreas 659
{
660
	dirty = TRUE;
661
}
43 root 662
 
663
void tilgungsplanWidget::numZisatzSlot()
60 andreas 664
{
665
	dirty = TRUE;
666
}
43 root 667
 
668
void tilgungsplanWidget::numZiZuschSlot()
60 andreas 669
{
670
	dirty = TRUE;
671
}
43 root 672
 
673
void tilgungsplanWidget::numRateSlot()
60 andreas 674
{
675
	dirty = TRUE;
676
}
43 root 677
 
678
void tilgungsplanWidget::numFixspesenSlot()
60 andreas 679
{
680
	dirty = TRUE;
681
}
43 root 682
 
52 andreas 683
void tilgungsplanWidget::rbZuschPSlot()
684
{
685
	if (radioButton_ZuschP->isChecked())
686
	{
687
	   kDoubleNumInput_ZiZuschuss->setProperty("enabled", QVariant("TRUE"));
688
	   kDoubleNumInput_ZuschFix->setProperty("enabled", QVariant("FALSE"));
689
	   radioButton_ZuschF->setChecked(FALSE);
690
	}
691
	else
692
	{
693
	   kDoubleNumInput_ZiZuschuss->setProperty("enabled", QVariant("FALSE"));
694
	   kDoubleNumInput_ZuschFix->setProperty("enabled", QVariant("TRUE"));
695
	   radioButton_ZuschF->setChecked(TRUE);
696
	}
697
}
698
 
699
void tilgungsplanWidget::rbZuschFSlot()
700
{
701
	if (radioButton_ZuschF->isChecked())
702
	{
703
	   kDoubleNumInput_ZiZuschuss->setProperty("enabled", QVariant("FALSE"));
704
	   kDoubleNumInput_ZuschFix->setProperty("enabled", QVariant("TRUE"));
705
	   radioButton_ZuschP->setChecked(FALSE);
706
	}
707
	else
708
	{
709
	   kDoubleNumInput_ZiZuschuss->setProperty("enabled", QVariant("TRUE"));
710
	   kDoubleNumInput_ZuschFix->setProperty("enabled", QVariant("FALSE"));
711
	   radioButton_ZuschP->setChecked(TRUE);
712
	}
713
}
714
 
43 root 715
void tilgungsplanWidget::cbRundenSlot()
60 andreas 716
{
717
	dirty = TRUE;
718
}
43 root 719
 
720
void tilgungsplanWidget::numBetragSlot()
60 andreas 721
{
722
	dirty = TRUE;
723
}
43 root 724
 
725
void tilgungsplanWidget::helpAbout()
726
{}
727
 
728
void tilgungsplanWidget::helpContents()
729
{}
730
 
731
void tilgungsplanWidget::helpIndex()
732
{}
733
 
734
void tilgungsplanWidget::editFind()
735
{}
736
 
737
void tilgungsplanWidget::editPaste()
738
{}
739
 
740
void tilgungsplanWidget::editCopy()
741
{}
742
 
743
void tilgungsplanWidget::editCut()
744
{}
745
 
746
void tilgungsplanWidget::editRedo()
747
{}
748
 
749
void tilgungsplanWidget::editUndo()
750
{}
751
 
752
void tilgungsplanWidget::fileExit()
44 andreas 753
{
60 andreas 754
	mamma->close();
44 andreas 755
}
756
 
43 root 757
void tilgungsplanWidget::filePrint()
758
{}
759
 
760
void tilgungsplanWidget::fileSaveAs()
60 andreas 761
{
762
QString fname = KFileDialog::getSaveFileName(QString("tilgpars.dat"), QString("*.dat"), this, QString("Tilgungsplan"));
763
QFile tmpFile;
43 root 764
 
60 andreas 765
	if (fname.isEmpty())
766
	   return;
767
 
768
	tmpFile.setName(fname);
769
 
770
	if (tmpFile.open(IO_ReadWrite | IO_Truncate) == FALSE)
771
	{
772
	   KMessageBox::error(0, QString("Could not open file for writing: %1").arg(tmpFile.errorString()));
773
	   return;
774
	}
775
 
776
	moveValues();
777
	write (tmpFile.handle(), &TpPars, sizeof(TPPARS));
778
	tmpFile.close();
779
}
780
 
43 root 781
void tilgungsplanWidget::fileSave()
60 andreas 782
{
783
QString hdir = QDir::homeDirPath ();
784
QFile tmpFile;
43 root 785
 
60 andreas 786
	if (!dirty)
787
	   return;
788
 
789
	// Zuletzt verwendete Maskenparameter in eine Datei schreiben.
790
	hdir.append("/.tilgpars.dat");
791
	tmpFile.setName(hdir);
792
 
793
	if (tmpFile.open(IO_ReadWrite | IO_Truncate) == FALSE)
794
	{
795
	   KMessageBox::error(0, QString("Could not open file for writing: %1").arg(tmpFile.errorString()));
796
	   return;
797
	}
798
 
799
	moveValues();
800
	write (tmpFile.handle(), &TpPars, sizeof(TPPARS));
801
	tmpFile.close();
802
	KMessageBox::information(this, i18n("Die Daten der Eingabemaske wurden erfolgreich gespeichert."));
803
}
804
 
43 root 805
void tilgungsplanWidget::fileOpen()
60 andreas 806
{
807
QString fname = KFileDialog::getOpenFileName(QString::null, QString("*.dat"), this, QString("Tilgungsplan"));
43 root 808
 
60 andreas 809
	if (fname.isEmpty())
810
	   return;
811
 
812
	readValues(fname.ascii());
813
}
814
 
43 root 815
void tilgungsplanWidget::fileNew()
816
{}
817
 
818
void tilgungsplanWidget::lbValutaSlot()
60 andreas 819
{
820
	dirty = TRUE;
821
}
43 root 822
 
823
void tilgungsplanWidget::cbAbschlSlot()
824
{
825
int item = comboBox_Abschl->currentItem();
826
char hv0[256];
827
 
828
	switch (item)
829
	{
830
           case 0: TpPars.abschlry = 0; break;
831
	   case 1: TpPars.abschlry = 1; break;
832
	   case 2: TpPars.abschlry = 3; break;
833
	   case 3: TpPars.abschlry = 6; break;
834
	   case 4: TpPars.abschlry = 12; break;
835
	   case 5: TpPars.abschlry = 41; break;
836
	   case 6: TpPars.abschlry = 43; break;
837
	   case 7: TpPars.abschlry = 46; break;
838
	   case 8: TpPars.abschlry = 47; break;
839
	   case 9: TpPars.abschlry = 48; break;
840
	   case 10: TpPars.abschlry = 52; break;
841
	   default:
842
	      sprintf (hv0, "Gewähltes Item: %d", item);
843
	      KMessageBox::information(0, i18n(hv0));
60 andreas 844
	}
845
 
846
	dirty = TRUE;
43 root 847
}
848
 
849
#include "tilgungsplanwidget.moc"
850