Subversion Repositories public

Rev

Rev 52 | Rev 64 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 52 Rev 60
Line 15... Line 15...
15
 *   along with this program; if not, write to the                         *
15
 *   along with this program; if not, write to the                         *
16
 *   Free Software Foundation, Inc.,                                       *
16
 *   Free Software Foundation, Inc.,                                       *
17
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
17
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
18
 ***************************************************************************/
18
 ***************************************************************************/
19
 
19
 
20
#ifndef _ZINSAENDERUNG
-
 
21
   #define _ZINSAENDERUNG
-
 
22
#endif
-
 
23
 
-
 
24
#include <klineedit.h>
20
#include <klineedit.h>
25
#include <kmessagebox.h>
21
#include <kmessagebox.h>
26
#include <klocale.h>
22
#include <klocale.h>
27
#include <kdatewidget.h>
23
#include <kdatewidget.h>
28
#include <kcombobox.h>
24
#include <kcombobox.h>
29
#include <knuminput.h>
25
#include <knuminput.h>
-
 
26
#include <kfiledialog.h>
30
#include <qcheckbox.h>
27
#include <qcheckbox.h>
31
#include <qradiobutton.h>
28
#include <qradiobutton.h>
-
 
29
#include <qdir.h>
-
 
30
#include <qfile.h>
32
 
31
 
33
#include <stdlib.h>
32
#include <stdlib.h>
34
#include <iostream.h>
33
//#include <iostream.h>
35
#include "helper.h"
34
#include "helper.h"
36
#include "tilgungsplanwidget.h"
35
#include "tilgungsplanwidget.h"
37
#include "ziaendwidget.h"
36
#include "ziaendwidget.h"
-
 
37
#include "ratenplanwidget.h"
38
 
38
 
39
tilgungsplanWidget::tilgungsplanWidget ( QWidget* parent, const char* name, WFlags fl )
39
tilgungsplanWidget::tilgungsplanWidget ( QWidget* parent, const char* name, WFlags fl )
40
		: tilgungsplanWidgetBase ( parent,name,fl )
40
		: tilgungsplanWidgetBase ( parent,name,fl )
41
{
41
{
42
QDate dt;
42
	dirty = FALSE;
-
 
43
	mamma = parent;		// Parent window needed to exit application
43
 
44
 
44
	// Maske mit sinnvollen Parametern versorgen
45
	// Zuletzt verwendete Maskenparameter aus der Datei holen, sofern
45
	comboBox_tageber->setCurrentItem(3);
-
 
46
	comboBox_Ratart->setCurrentItem(1);
-
 
47
	comboBox_Abschl->setCurrentItem(10);
-
 
48
	kDoubleNumInput_Zinssatz->setValue(5.5);
-
 
49
	kDateWidget_Auszahlung->setDate(QDate::currentDate());
-
 
50
	// Datum: Der 5. des nächsten Monats
46
	// es diese Datei bereits gibt.
51
	dt = QDate::currentDate();
-
 
52
	dt = dt.addMonths(1);
-
 
53
	dt.setYMD(dt.year(), dt.month(), 5);
-
 
54
	kDateWidget_RaVon->setDate(dt);
-
 
55
	dt = dt.addYears(1);
47
	readValues();
56
	kDateWidget_RaBis->setDate(dt);
-
 
57
	kDateWidget_ZiGiltAb->setDate(QDate::currentDate());
-
 
58
	kDoubleNumInput_Betrag->setValue(100000.0);
-
 
59
	checkBox_RaJan->setChecked(TRUE);
-
 
60
	checkBox_RaFeb->setChecked(TRUE);
-
 
61
	checkBox_RaMar->setChecked(TRUE);
-
 
62
	checkBox_RaApr->setChecked(TRUE);
-
 
63
	checkBox_RaMai->setChecked(TRUE);
-
 
64
	checkBox_RaJun->setChecked(TRUE);
-
 
65
	checkBox_RaJul->setChecked(TRUE);
-
 
66
	checkBox_RaAug->setChecked(TRUE);
-
 
67
	checkBox_RaSep->setChecked(TRUE);
-
 
68
	checkBox_RaOkt->setChecked(TRUE);
-
 
69
	checkBox_RaNov->setChecked(TRUE);
-
 
70
	checkBox_RaDez->setChecked(TRUE);
-
 
71
#ifndef _ZINSAENDERUNG
-
 
72
	checkBox_ZiChange->setProperty("enabled", QVariant("FALSE"));
-
 
73
#endif
-
 
74
}
48
}
75
 
49
 
76
tilgungsplanWidget::~tilgungsplanWidget()
50
tilgungsplanWidget::~tilgungsplanWidget()
77
{}
51
{
-
 
52
QString hdir = QDir::homeDirPath ();
-
 
53
QFile tmpFile;
78
 
54
 
-
 
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));
79
/*$SPECIALIZATION$*/
70
	tmpFile.close();
-
 
71
}
-
 
72
 
80
void tilgungsplanWidget::mnCalcTPSumSlot()
73
void tilgungsplanWidget::moveValues()
81
{
74
{
82
QDate dt, dt1;
75
QDate dt;
83
QString str, zia;
-
 
84
TRech *tp;
76
int ret;
85
int ret, day1, day2, mon1, mon2, year1, year2;
-
 
86
char hv0[255];
-
 
87
 
77
 
-
 
78
	memset(&TpPars, 0, sizeof(TPPARS));
88
	// Zuweisen der Inhalte der Widgets zur internen Parameterstruktur.
79
	// Zuweisen der Inhalte der Widgets zur internen Parameterstruktur.
89
	TpPars.effformel = 0.0;
80
	TpPars.effformel = 0.0;
90
	TpPars.gewicht = 0.0;
81
	TpPars.gewicht = 0.0;
91
	TpPars.tageb = comboBox_tageber->currentItem() + 1;
82
	TpPars.tageb = comboBox_tageber->currentItem() + 1;
92
 
83
 
Line 125... Line 116...
125
	   case 8: TpPars.abschlry = 47; break;
116
	   case 8: TpPars.abschlry = 47; break;
126
	   case 9: TpPars.abschlry = 48; break;
117
	   case 9: TpPars.abschlry = 48; break;
127
	   case 10: TpPars.abschlry = 52; break;
118
	   case 10: TpPars.abschlry = 52; break;
128
        }
119
        }
129
 
120
 
130
	TpPars.zuschver = 0;		// Zuschuss Verrechnung ??
121
	TpPars.zuschver = 0;		// wird derzeit nicht verwendet!
131
	TpPars.spesen = kDoubleNumInput_Fixspesen->value();
122
	TpPars.spesen = kDoubleNumInput_Fixspesen->value();
132
	TpPars.rahmen = kDoubleNumInput_Betrag->value();
123
	TpPars.rahmen = kDoubleNumInput_Betrag->value();
133
	TpPars.kapital = 0.0;
124
	TpPars.kapital = 0.0;
134
	TpPars.raplan[0] = checkBox_RaJan->isChecked();
125
	TpPars.raplan[0] = checkBox_RaJan->isChecked();
135
	TpPars.raplan[1] = checkBox_RaFeb->isChecked();
126
	TpPars.raplan[1] = checkBox_RaFeb->isChecked();
Line 156... Line 147...
156
#ifdef _ZINSAENDERUNG
147
#ifdef _ZINSAENDERUNG
157
	TpPars.ziaend = checkBox_ZiChange->isChecked();
148
	TpPars.ziaend = checkBox_ZiChange->isChecked();
158
#else
149
#else
159
	TpPars.ziaend = FALSE;
150
	TpPars.ziaend = FALSE;
160
#endif
151
#endif
161
	TpPars.effekt = TRUE;
152
	TpPars.effekt = FALSE;
162
	TpPars.fixrate = checkBox_Rate->isChecked();
153
	TpPars.fixrate = checkBox_Rate->isChecked();
-
 
154
}
-
 
155
 
-
 
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();
163
 
314
 
164
	if (TpPars.dbis > TpPars.endfaell)
315
	if (TpPars.dbis > TpPars.endfaell)
165
	   TpPars.endfaell = TpPars.dbis;
316
	   TpPars.endfaell = TpPars.dbis;
166
 
317
 
-
 
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
 
167
	// Berechnung anstossen
327
	// Berechnung anstossen
168
	tp = new TRech (&TpPars);
328
	tp = new TRech (&TpPars);
169
 
329
 
170
	if ((ret = tp->tilgpl()) != 0)
330
	if ((ret = tp->tilgpl()) != 0)
171
	{
331
	{
Line 209... Line 369...
209
	      case 14: str = QString::fromUtf8("Die Laufzeit ist über 100 Jahre!"); break;
369
	      case 14: str = QString::fromUtf8("Die Laufzeit ist über 100 Jahre!"); break;
210
	      case 15: str = QString::fromUtf8("Es wurde keine Rate vorgegeben!"); break;
370
	      case 15: str = QString::fromUtf8("Es wurde keine Rate vorgegeben!"); break;
211
	      case 16: str = QString::fromUtf8("Die vorgegebene Rate darf nicht kleiner als 0 sein!"); break;
371
	      case 16: str = QString::fromUtf8("Die vorgegebene Rate darf nicht kleiner als 0 sein!"); break;
212
	      case 18: str = QString::fromUtf8("Die erste Einschränkung oder die Ratenleiste ist ungültig!"); break;
372
	      case 18: str = QString::fromUtf8("Die erste Einschränkung oder die Ratenleiste ist ungültig!"); break;
213
	      case 19: str = QString::fromUtf8("Die letzte 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;
-
 
374
	      case 20: str = QString::fromUtf8("Interner Rechenfehler!"); break;
214
	      case 22: str = QString::fromUtf8("Nicht genügend Speicher!"); break;
375
	      case 22: str = QString::fromUtf8("Nicht genügend Speicher!"); break;
215
	      case 23: str = QString::fromUtf8("\"Antizipativ\" erlaubt keine Zinssatzänderung!"); break;
376
	      case 23: str = QString::fromUtf8("\"Antizipativ\" erlaubt keine Zinssatzänderung!"); break;
216
	      case 24: 
377
	      case 24: 
217
	      case 25: str = QString::fromUtf8("Fehler beim Lesen der Zinssatzänderungen!"); break;
378
	      case 25: str = QString::fromUtf8("Fehler beim Lesen der Zinssatzänderungen!"); break;
-
 
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;
218
	      default:
383
	      default:
219
		 sprintf (hv0, "Unbekannter Fehler \"%d\"! Prüfen Sie die Eingaben.", ret);
384
//		 sprintf (hv0, "Unbekannter Fehler \"%d\"! Prüfen Sie die Eingaben.", ret);
220
	         str = QString::fromUtf8(hv0);
385
	         str = QString("Unbekannter Fehler \"%1\"! Prüfen Sie die Eingaben.").arg(ret);
221
	   }
386
	   }
222
 
387
 
223
	   KMessageBox::error(0, str, i18n("Fehler"));
388
	   KMessageBox::error(0, str, i18n("Fehler"));
224
	   lineEdit_EffZi->clear();
389
	   lineEdit_EffZi->clear();
225
	   lineEdit_GesBelast->clear();
390
	   lineEdit_GesBelast->clear();
Line 227... Line 392...
227
	   lineEdit_ErgLRate->clear();
392
	   lineEdit_ErgLRate->clear();
228
	   lineEdit_ErgZinsen->clear();
393
	   lineEdit_ErgZinsen->clear();
229
	   lineEdit_ErgZiZusch->clear();
394
	   lineEdit_ErgZiZusch->clear();
230
	   lineEdit_ErgAnnZusch->clear();
395
	   lineEdit_ErgAnnZusch->clear();
231
	   lineEdit_ErgSumAnnZusch->clear();
396
	   lineEdit_ErgSumAnnZusch->clear();
-
 
397
	   delete tp;
232
	   return;
398
	   return;
233
	}
399
	}
234
 
400
/*
235
	if (TpPars.effformel > 0.0)
401
	if (TpPars.effformel > 0.0)
236
	   PointNumber(TpPars.effformel, 3, &hv0[0]);
402
	   PointNumber(TpPars.effformel, 3, &hv0[0]);
237
	else
403
	else
238
	   PointNumber(TpPars.gewicht, 3, &hv0[0]);
404
	   PointNumber(TpPars.gewicht, 3, &hv0[0]);
239
 
405
 
240
	lineEdit_EffZi->clear();
406
	lineEdit_EffZi->clear();
241
	lineEdit_EffZi->insert(hv0);
407
	lineEdit_EffZi->insert(hv0);
242
 
408
*/
243
	PointNumber(TpPars.gesamt, 2, &hv0[0]);
409
	PointNumber(TpPars.gesamt, 2, &hv0[0]);
244
	lineEdit_GesBelast->clear();
410
	lineEdit_GesBelast->clear();
245
	lineEdit_GesBelast->insert(hv0);
411
	lineEdit_GesBelast->insert(hv0);
246
 
412
 
247
//	kDoubleNumInput_Rate->setValue(TpPars.ergrate);
-
 
248
	kIntNumInput_AnzRaten->setValue(TpPars.anzraten);
413
	kIntNumInput_AnzRaten->setValue(TpPars.anzraten);
249
	
414
	
250
	date_int(&day1, &mon1, &year1, TpPars.dbis);
415
	date_int(&day1, &mon1, &year1, TpPars.dbis);
251
	dt.setYMD(year1, mon1, day1);
416
	dt.setYMD(year1, mon1, day1);
252
	kDateWidget_RaBis->setDate(dt);
417
	kDateWidget_RaBis->setDate(dt);
253
	
418
	
254
	date_int(&day1, &mon1, &year1, TpPars.endfaell);
419
	date_int(&day1, &mon1, &year1, TpPars.endfaell);
255
	dt.setYMD(year1, mon1, day1);
420
	dt.setYMD(year1, mon1, day1);
256
	kDateWidget_Endfael->setDate(dt);
421
	kDateWidget_Endfael->setDate(dt);
257
 
422
 
-
 
423
	rate = TpPars.ergrate;
258
	PointNumber(TpPars.ergrate, 2, hv0);
424
	PointNumber(TpPars.ergrate, 2, hv0);
259
	lineEdit_ErgRate->clear();
425
	lineEdit_ErgRate->clear();
260
	lineEdit_ErgRate->insert(hv0);
426
	lineEdit_ErgRate->insert(hv0);
261
 
427
 
262
	PointNumber(TpPars.lrate, 2, hv0);
428
	PointNumber(TpPars.lrate, 2, hv0);
Line 276... Line 442...
276
	lineEdit_ErgAnnZusch->insert(hv0);
442
	lineEdit_ErgAnnZusch->insert(hv0);
277
 
443
 
278
	PointNumber(TpPars.antotal, 2, hv0);
444
	PointNumber(TpPars.antotal, 2, hv0);
279
	lineEdit_ErgSumAnnZusch->clear();
445
	lineEdit_ErgSumAnnZusch->clear();
280
	lineEdit_ErgSumAnnZusch->insert(hv0);
446
	lineEdit_ErgSumAnnZusch->insert(hv0);
-
 
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;
281
}
490
}
282
 
491
 
283
void tilgungsplanWidget::txRaDezSlot()
492
void tilgungsplanWidget::txRaDezSlot()
-
 
493
{
-
 
494
	dirty = TRUE;
284
{}
495
}
285
 
496
 
286
void tilgungsplanWidget::txRaNovSlot()
497
void tilgungsplanWidget::txRaNovSlot()
-
 
498
{
-
 
499
	dirty = TRUE;
287
{}
500
}
288
 
501
 
289
void tilgungsplanWidget::txRaOktSlot()
502
void tilgungsplanWidget::txRaOktSlot()
-
 
503
{
-
 
504
	dirty = TRUE;
290
{}
505
}
291
 
506
 
292
void tilgungsplanWidget::txRaSepSlot()
507
void tilgungsplanWidget::txRaSepSlot()
-
 
508
{
-
 
509
	dirty = TRUE;
293
{}
510
}
294
 
511
 
295
void tilgungsplanWidget::txRaAugSlot()
512
void tilgungsplanWidget::txRaAugSlot()
-
 
513
{
-
 
514
	dirty = TRUE;
296
{}
515
}
297
 
516
 
298
void tilgungsplanWidget::txRaJulSlot()
517
void tilgungsplanWidget::txRaJulSlot()
-
 
518
{
-
 
519
	dirty = TRUE;
299
{}
520
}
300
 
521
 
301
void tilgungsplanWidget::txRaJunSlot()
522
void tilgungsplanWidget::txRaJunSlot()
-
 
523
{
-
 
524
	dirty = TRUE;
302
{}
525
}
303
 
526
 
304
void tilgungsplanWidget::txRaMaiSlot()
527
void tilgungsplanWidget::txRaMaiSlot()
-
 
528
{
-
 
529
	dirty = TRUE;
305
{}
530
}
306
 
531
 
307
void tilgungsplanWidget::txRaMarSlot()
532
void tilgungsplanWidget::txRaMarSlot()
-
 
533
{
-
 
534
	dirty = TRUE;
308
{}
535
}
309
 
536
 
310
void tilgungsplanWidget::txRaFebSlot()
537
void tilgungsplanWidget::txRaFebSlot()
-
 
538
{
-
 
539
	dirty = TRUE;
311
{}
540
}
312
 
541
 
313
void tilgungsplanWidget::txRaJanSlot()
542
void tilgungsplanWidget::txRaJanSlot()
-
 
543
{
-
 
544
	dirty = TRUE;
314
{}
545
}
315
 
546
 
316
void tilgungsplanWidget::txRaAprSlot()
547
void tilgungsplanWidget::txRaAprSlot()
-
 
548
{
-
 
549
	dirty = TRUE;
317
{}
550
}
318
 
551
 
319
void tilgungsplanWidget::txGesBelastSlot()
552
void tilgungsplanWidget::txGesBelastSlot()
-
 
553
{
-
 
554
	dirty = TRUE;
320
{}
555
}
321
 
556
 
322
void tilgungsplanWidget::txEffZiSlot()
557
void tilgungsplanWidget::txEffZiSlot()
-
 
558
{
-
 
559
	dirty = TRUE;
323
{}
560
}
324
 
561
 
325
void tilgungsplanWidget::intAnzRatenSlot()
562
void tilgungsplanWidget::intAnzRatenSlot()
-
 
563
{
-
 
564
	dirty = TRUE;
326
{}
565
}
327
 
566
 
328
void tilgungsplanWidget::numAnnZuschSlot()
567
void tilgungsplanWidget::numAnnZuschSlot()
-
 
568
{
-
 
569
	dirty = TRUE;
329
{}
570
}
330
 
571
 
331
void tilgungsplanWidget::dtZiGiltAbSlot()
572
void tilgungsplanWidget::dtZiGiltAbSlot()
-
 
573
{
-
 
574
	dirty = TRUE;
332
{}
575
}
333
 
576
 
334
void tilgungsplanWidget::dtRaVonSlot()
577
void tilgungsplanWidget::dtRaVonSlot()
-
 
578
{
-
 
579
	dirty = TRUE;
335
{}
580
}
336
 
581
 
337
void tilgungsplanWidget::dtRaBisSlot()
582
void tilgungsplanWidget::dtRaBisSlot()
-
 
583
{
-
 
584
	dirty = TRUE;
338
{}
585
}
339
 
586
 
340
void tilgungsplanWidget::dtEndfaelSlot()
587
void tilgungsplanWidget::dtEndfaelSlot()
-
 
588
{
-
 
589
	dirty = TRUE;
341
{}
590
}
342
 
591
 
343
void tilgungsplanWidget::dtAuszahlSlot()
592
void tilgungsplanWidget::dtAuszahlSlot()
-
 
593
{
-
 
594
	kDateWidget_ZiGiltAb->setDate(kDateWidget_Auszahlung->date());
-
 
595
	dirty = TRUE;
344
{}
596
}
345
 
597
 
346
void tilgungsplanWidget::dtAbschlussSlot()
598
void tilgungsplanWidget::dtAbschlussSlot()
-
 
599
{
-
 
600
	dirty = TRUE;
347
{}
601
}
348
 
602
 
349
void tilgungsplanWidget::lbRatartSlot()
603
void tilgungsplanWidget::lbRatartSlot()
-
 
604
{
-
 
605
	dirty = TRUE;
350
{}
606
}
351
 
607
 
352
void tilgungsplanWidget::cbZiChangeSlot()
608
void tilgungsplanWidget::cbZiChangeSlot()
-
 
609
{
-
 
610
	dirty = TRUE;
353
{}
611
}
354
 
612
 
355
void tilgungsplanWidget::cbUltimoSlot()
613
void tilgungsplanWidget::cbUltimoSlot()
-
 
614
{
-
 
615
	dirty = TRUE;
356
{}
616
}
357
 
617
 
358
void tilgungsplanWidget::cbRateSlot()
618
void tilgungsplanWidget::cbRateSlot()
-
 
619
{
-
 
620
	dirty = TRUE;
359
{}
621
}
360
 
622
 
361
void tilgungsplanWidget::mnCalcTPSlot()
623
void tilgungsplanWidget::mnCalcTPSlot()
362
{}
624
{
-
 
625
ratenplanWidget *dlg = new ratenplanWidget(this, "ratenplanWidgetBase", TRUE, 0);
-
 
626
 
-
 
627
	dlg->exec();
-
 
628
	delete dlg;
-
 
629
}
363
 
630
 
364
void tilgungsplanWidget::mnInputZiSlot()
631
void tilgungsplanWidget::mnInputZiSlot()
365
{
632
{
-
 
633
#ifdef _ZINSAENDERUNG
366
ziaendWidget *dlg = new ziaendWidget(this, "ziaendWidgetBase", TRUE, 0);
634
ziaendWidget *dlg = new ziaendWidget(this, "ziaendWidgetBase", TRUE, 0);
367
 
635
 
368
	dlg->exec();
636
	dlg->exec();
369
	delete dlg;
637
	delete dlg;
-
 
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
370
}
641
}
371
 
642
 
372
void tilgungsplanWidget::lbVerzartSlot()
643
void tilgungsplanWidget::lbVerzartSlot()
-
 
644
{
-
 
645
	dirty = TRUE;
373
{}
646
}
374
 
647
 
375
void tilgungsplanWidget::lbTageberSlot()
648
void tilgungsplanWidget::lbTageberSlot()
-
 
649
{
-
 
650
	dirty = TRUE;
376
{}
651
}
377
 
652
 
378
void tilgungsplanWidget::numZuzaehlSlot()
653
void tilgungsplanWidget::numZuzaehlSlot()
-
 
654
{
-
 
655
	dirty = TRUE;
379
{}
656
}
380
 
657
 
381
void tilgungsplanWidget::numBeaGebSlot()
658
void tilgungsplanWidget::numBeaGebSlot()
-
 
659
{
-
 
660
	dirty = TRUE;
382
{}
661
}
383
 
662
 
384
void tilgungsplanWidget::numZisatzSlot()
663
void tilgungsplanWidget::numZisatzSlot()
-
 
664
{
-
 
665
	dirty = TRUE;
385
{}
666
}
386
 
667
 
387
void tilgungsplanWidget::numZiZuschSlot()
668
void tilgungsplanWidget::numZiZuschSlot()
-
 
669
{
-
 
670
	dirty = TRUE;
388
{}
671
}
389
 
672
 
390
void tilgungsplanWidget::numRateSlot()
673
void tilgungsplanWidget::numRateSlot()
-
 
674
{
-
 
675
	dirty = TRUE;
391
{}
676
}
392
 
677
 
393
void tilgungsplanWidget::numFixspesenSlot()
678
void tilgungsplanWidget::numFixspesenSlot()
-
 
679
{
-
 
680
	dirty = TRUE;
394
{}
681
}
395
 
682
 
396
void tilgungsplanWidget::rbZuschPSlot()
683
void tilgungsplanWidget::rbZuschPSlot()
397
{
684
{
398
	if (radioButton_ZuschP->isChecked())
685
	if (radioButton_ZuschP->isChecked())
399
	{
686
	{
Line 424... Line 711...
424
	   radioButton_ZuschP->setChecked(TRUE);
711
	   radioButton_ZuschP->setChecked(TRUE);
425
	}
712
	}
426
}
713
}
427
 
714
 
428
void tilgungsplanWidget::cbRundenSlot()
715
void tilgungsplanWidget::cbRundenSlot()
-
 
716
{
-
 
717
	dirty = TRUE;
429
{}
718
}
430
 
719
 
431
void tilgungsplanWidget::numBetragSlot()
720
void tilgungsplanWidget::numBetragSlot()
-
 
721
{
-
 
722
	dirty = TRUE;
432
{}
723
}
433
 
724
 
434
void tilgungsplanWidget::helpAbout()
725
void tilgungsplanWidget::helpAbout()
435
{}
726
{}
436
 
727
 
437
void tilgungsplanWidget::helpContents()
728
void tilgungsplanWidget::helpContents()
Line 458... Line 749...
458
void tilgungsplanWidget::editUndo()
749
void tilgungsplanWidget::editUndo()
459
{}
750
{}
460
 
751
 
461
void tilgungsplanWidget::fileExit()
752
void tilgungsplanWidget::fileExit()
462
{
753
{
463
 
-
 
-
 
754
	mamma->close();
464
}
755
}
465
 
756
 
466
void tilgungsplanWidget::filePrint()
757
void tilgungsplanWidget::filePrint()
467
{}
758
{}
468
 
759
 
469
void tilgungsplanWidget::fileSaveAs()
760
void tilgungsplanWidget::fileSaveAs()
-
 
761
{
-
 
762
QString fname = KFileDialog::getSaveFileName(QString("tilgpars.dat"), QString("*.dat"), this, QString("Tilgungsplan"));
-
 
763
QFile tmpFile;
-
 
764
 
-
 
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;
470
{}
774
	}
-
 
775
 
-
 
776
	moveValues();
-
 
777
	write (tmpFile.handle(), &TpPars, sizeof(TPPARS));
-
 
778
	tmpFile.close();
-
 
779
}
471
 
780
 
472
void tilgungsplanWidget::fileSave()
781
void tilgungsplanWidget::fileSave()
-
 
782
{
-
 
783
QString hdir = QDir::homeDirPath ();
-
 
784
QFile tmpFile;
-
 
785
 
-
 
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;
473
{}
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
}
474
 
804
 
475
void tilgungsplanWidget::fileOpen()
805
void tilgungsplanWidget::fileOpen()
476
{}
806
{
-
 
807
QString fname = KFileDialog::getOpenFileName(QString::null, QString("*.dat"), this, QString("Tilgungsplan"));
-
 
808
 
-
 
809
	if (fname.isEmpty())
-
 
810
	   return;
-
 
811
 
-
 
812
	readValues(fname.ascii());
-
 
813
}
477
 
814
 
478
void tilgungsplanWidget::fileNew()
815
void tilgungsplanWidget::fileNew()
479
{}
816
{}
480
 
817
 
481
void tilgungsplanWidget::lbValutaSlot()
818
void tilgungsplanWidget::lbValutaSlot()
-
 
819
{
-
 
820
	dirty = TRUE;
482
{}
821
}
483
 
822
 
484
void tilgungsplanWidget::cbAbschlSlot()
823
void tilgungsplanWidget::cbAbschlSlot()
485
{
824
{
486
int item = comboBox_Abschl->currentItem();
825
int item = comboBox_Abschl->currentItem();
487
char hv0[256];
826
char hv0[256];
Line 500... Line 839...
500
	   case 9: TpPars.abschlry = 48; break;
839
	   case 9: TpPars.abschlry = 48; break;
501
	   case 10: TpPars.abschlry = 52; break;
840
	   case 10: TpPars.abschlry = 52; break;
502
	   default:
841
	   default:
503
	      sprintf (hv0, "Gewähltes Item: %d", item);
842
	      sprintf (hv0, "Gewähltes Item: %d", item);
504
	      KMessageBox::information(0, i18n(hv0));
843
	      KMessageBox::information(0, i18n(hv0));
-
 
844
	}
-
 
845
 
505
        }
846
	dirty = TRUE;
506
}
847
}
507
 
848
 
508
#include "tilgungsplanwidget.moc"
849
#include "tilgungsplanwidget.moc"
509
 
850