/tilgungsplan/trunk/src/ratenplan.ui |
---|
0,0 → 1,176 |
<!DOCTYPE UI><UI version="3.3" stdsetdef="1"> |
<class>ratenplanWidgetBase</class> |
<comment>Zeigt einen zuvor errechneten Ratenplan an.</comment> |
<author>Andreas Theofilu <andreas@TheoSys.at></author> |
<widget class="QDialog"> |
<property name="name"> |
<cstring>Ratenplan</cstring> |
</property> |
<property name="geometry"> |
<rect> |
<x>0</x> |
<y>0</y> |
<width>844</width> |
<height>500</height> |
</rect> |
</property> |
<property name="caption"> |
<string>Ratenplan</string> |
</property> |
<property name="icon"> |
<pixmap>hi16-app-tilgungsplan.png</pixmap> |
</property> |
<property name="iconText"> |
<string>Ratenplan</string> |
</property> |
<property name="modal"> |
<bool>true</bool> |
</property> |
<widget class="KListView"> |
<column> |
<property name="text"> |
<string>Zeile</string> |
</property> |
<property name="clickable"> |
<bool>true</bool> |
</property> |
<property name="resizable"> |
<bool>true</bool> |
</property> |
</column> |
<column> |
<property name="text"> |
<string>Datum</string> |
</property> |
<property name="clickable"> |
<bool>true</bool> |
</property> |
<property name="resizable"> |
<bool>true</bool> |
</property> |
</column> |
<column> |
<property name="text"> |
<string>Text</string> |
</property> |
<property name="clickable"> |
<bool>true</bool> |
</property> |
<property name="resizable"> |
<bool>true</bool> |
</property> |
</column> |
<column> |
<property name="text"> |
<string>Kapital</string> |
</property> |
<property name="clickable"> |
<bool>true</bool> |
</property> |
<property name="resizable"> |
<bool>true</bool> |
</property> |
</column> |
<column> |
<property name="text"> |
<string>Tilgung</string> |
</property> |
<property name="clickable"> |
<bool>true</bool> |
</property> |
<property name="resizable"> |
<bool>true</bool> |
</property> |
</column> |
<column> |
<property name="text"> |
<string>Annuität</string> |
</property> |
<property name="clickable"> |
<bool>true</bool> |
</property> |
<property name="resizable"> |
<bool>true</bool> |
</property> |
</column> |
<column> |
<property name="text"> |
<string>Zinsen</string> |
</property> |
<property name="clickable"> |
<bool>true</bool> |
</property> |
<property name="resizable"> |
<bool>true</bool> |
</property> |
</column> |
<column> |
<property name="text"> |
<string>Restkapital</string> |
</property> |
<property name="clickable"> |
<bool>true</bool> |
</property> |
<property name="resizable"> |
<bool>true</bool> |
</property> |
</column> |
<property name="name"> |
<cstring>kListView_Plan</cstring> |
</property> |
<property name="geometry"> |
<rect> |
<x>10</x> |
<y>10</y> |
<width>830</width> |
<height>440</height> |
</rect> |
</property> |
<property name="selectionMode" stdset="0"> |
<enum>NoSelection</enum> |
</property> |
<property name="allColumnsShowFocus"> |
<bool>true</bool> |
</property> |
<property name="showToolTips"> |
<bool>false</bool> |
</property> |
</widget> |
<widget class="QPushButton"> |
<property name="name"> |
<cstring>pushButton_Cancel</cstring> |
</property> |
<property name="geometry"> |
<rect> |
<x>400</x> |
<y>460</y> |
<width>86</width> |
<height>34</height> |
</rect> |
</property> |
<property name="text"> |
<string>Schliessen</string> |
</property> |
</widget> |
</widget> |
<connections> |
<connection> |
<sender>pushButton_Cancel</sender> |
<signal>toggled(bool)</signal> |
<receiver>Ratenplan</receiver> |
<slot>pbCancelSlot()</slot> |
</connection> |
</connections> |
<tabstops> |
<tabstop>kListView_Plan</tabstop> |
<tabstop>pushButton_Cancel</tabstop> |
</tabstops> |
<slots> |
<slot>pbCancelSlot()</slot> |
</slots> |
<pixmapinproject/> |
<layoutdefaults spacing="6" margin="11"/> |
<includehints> |
<includehint>klistview.h</includehint> |
</includehints> |
</UI> |
/tilgungsplan/trunk/src/blitz.png |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes: |
Added: svn:mime-type |
+application/octet-stream |
\ No newline at end of property |
/tilgungsplan/trunk/src/ratenplanwidget.cpp |
---|
0,0 → 1,144 |
/*************************************************************************** |
* 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. * |
***************************************************************************/ |
#include <kmessagebox.h> |
#include <klistview.h> |
#include <klocale.h> |
#include <qdir.h> |
#include <qfile.h> |
#include <sys/stat.h> |
#include "ratenplanwidget.h" |
#include "helper.h" |
#include "tilgplan.h" |
ratenplanWidget::ratenplanWidget ( QWidget* parent, const char* name, bool modal, WFlags fl ) |
: ratenplanWidgetBase ( parent,name, modal,fl ) |
{ |
// Spaltenbreiten und Alignment setzen |
kListView_Plan->setColumnWidth(0, 50); // Datum |
kListView_Plan->setColumnWidth(1, 80); // Datum |
kListView_Plan->setColumnWidth(2, 110); // Text |
kListView_Plan->setColumnWidth(3, 100); // Kapital |
kListView_Plan->setColumnAlignment(3, Qt::AlignRight); |
kListView_Plan->setColumnWidth(4, 100); // Tilgung |
kListView_Plan->setColumnAlignment(4, Qt::AlignRight); |
kListView_Plan->setColumnWidth(5, 100); // Annuität |
kListView_Plan->setColumnAlignment(5, Qt::AlignRight); |
kListView_Plan->setColumnWidth(6, 100); // Zinsen |
kListView_Plan->setColumnAlignment(6, Qt::AlignRight); |
kListView_Plan->setColumnWidth(7, 100); // Restkapital |
kListView_Plan->setColumnAlignment(7, Qt::AlignRight); |
kListView_Plan->setSortColumn(0); |
readDTable(); |
} |
ratenplanWidget::~ratenplanWidget() |
{} |
void ratenplanWidget::readDTable() |
{ |
QString hdir = QDir::homeDirPath (); |
QString zeile, datum, text, kapital, tilg, rate, zinsen, rkapi; |
QFile tmpFile; |
TPPARS TpPars; |
DTABLE dTable; |
int day, mon, year, line; |
char hv0[32]; |
struct stat sbuf; |
hdir.append("/.date_tbl.dat"); |
tmpFile.setName(hdir); |
if (tmpFile.open(IO_ReadOnly) == FALSE) |
{ |
KMessageBox::error(0, QString("Could not open file for reading: %1").arg(tmpFile.errorString())); |
return; |
} |
fstat (tmpFile.handle(), &sbuf); |
if (sbuf.st_size <= sizeof(TPPARS)) |
{ |
tmpFile.close (); |
KMessageBox::information(this, i18n("Bitte berechnen sie zuerst einen Tilgungsplan!")); |
return; |
} |
// Als erstes befindet sich die Struktur mit den Parametern und |
// Summenergebnissen in der Datei. |
read(tmpFile.handle(), &TpPars, sizeof(TPPARS)); |
// Nun lesen wir den Ratenplan aus und schreiben das Ergebnis in die |
// Tabelle der Dialogbox. |
line = 1; |
while (read (tmpFile.handle(), &dTable, sizeof(DTABLE)) >= sizeof(DTABLE)) |
{ |
zeile.sprintf("%04d", line); |
date_int(&day, &mon, &year, dTable.datum); |
datum.sprintf("%02d.%02d.%d", day, mon, year); |
switch (dTable.kz) |
{ |
case 'A': text = QString("Abschluss"); break; |
case 'R': text = QString("Rate"); break; |
case 'Z': text = QString::fromUtf8("Zinssatzänderung auf %1").arg(dTable.rate, 0, 'f', 3); break; |
case 'E': |
text = QString("Ergebnis"); |
date_int(&day, &mon, &year, TpPars.ragab); |
datum.sprintf("%02d.%02d.%d", day, mon, year); |
break; |
default: text = QString("??? <%1>").arg(dTable.kz); |
} |
if (dTable.kz != 'Z') |
{ |
kapital = QString("%1").arg(PointNumber(dTable.kapital, 2, &hv0[0])); |
tilg = QString("%1").arg(PointNumber(dTable.tilg, 2, &hv0[0])); |
rate = QString("%1").arg(PointNumber(dTable.rate, 2, &hv0[0])); |
zinsen = QString("%1").arg(PointNumber(dTable.zinsen, 2, &hv0[0])); |
rkapi = QString("%1").arg(PointNumber(dTable.rkapi, 2, &hv0[0])); |
} |
else |
{ |
kapital = QString(""); |
tilg = QString(""); |
rate = QString(""); |
zinsen = QString(""); |
rkapi = QString(""); |
} |
QListViewItem *element = new QListViewItem(kListView_Plan, zeile, datum, text, kapital, tilg, rate, zinsen, rkapi); |
kListView_Plan->insertItem(element); |
line++; |
} |
tmpFile.close(); |
} |
/*$SPECIALIZATION$*/ |
void ratenplanWidget::pbCancelSlot() |
{ |
done(QDialog::Accepted); |
} |
#include "ratenplanwidget.moc" |
/tilgungsplan/trunk/src/ratenplanwidget.h |
---|
0,0 → 1,48 |
/*************************************************************************** |
* 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 RATENPLANWIDGET_H |
#define RATENPLANWIDGET_H |
#include "ratenplan.h" |
class ratenplanWidget : public ratenplanWidgetBase |
{ |
Q_OBJECT |
public: |
ratenplanWidget ( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); |
~ratenplanWidget(); |
/*$PUBLIC_FUNCTIONS$*/ |
public slots: |
/*$PUBLIC_SLOTS$*/ |
virtual void pbCancelSlot(); |
protected: |
/*$PROTECTED_FUNCTIONS$*/ |
void readDTable(); |
protected slots: |
/*$PROTECTED_SLOTS$*/ |
}; |
#endif |