unit Umain;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls;
type
TForm1 =
class(TForm)
Label1: TLabel;
Label2: TLabel;
EditID: TEdit;
ButtonND: TButton;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
RG: TRadioGroup;
ButtonBA: TButton;
ButtonSAVE: TButton;
ButtonCLOSE: TButton;
EditDS: TEdit;
EditB: TEdit;
EditLZ: TEdit;
CB: TComboBox;
EditmZ: TEdit;
EditmR: TEdit;
EditGz: TEdit;
EditGza: TEdit;
Label7: TLabel;
Label8: TLabel;
Label9: TLabel;
Label10: TLabel;
procedure ButtonBAClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure ButtonNDClick(Sender: TObject);
procedure RGClick(Sender: TObject);
procedure ButtonSAVEClick(Sender: TObject);
procedure ButtonCLOSEClick(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
liste: TStrings;
anz: integer;
implementation
uses UDarlehen;
{$R *.dfm}
procedure TForm1.ButtonBAClick(Sender: TObject);
begin
EditDS.Enabled := False;
EditB.Enabled := False;
EditLZ.Enabled := False;
CB.Enabled := False;
Label3.Enabled := False;
Label4.Enabled := False;
Label5.Enabled := False;
Label6.Enabled := False;
Label7.Enabled := True;
Label8.Enabled := True;
Label9.Enabled := True;
Label10.Enabled := True;
EditGZ.Enabled := True;
EditGza.Enabled := True;
EditmR.Enabled := True;
if (EditDS.Text = '
')
or (EditB.Text = '
')
or (EditLZ.Text = '
')
or (CB.Text = '
')
then begin
EditDS.SetFocus;
end
else begin
darlehen.set_DS(strtofloat(Editds.Text));
darlehen.set_BE(strtodate(EditB.Text));
darlehen.set_LZ(strtoint(EditLZ.Text));
darlehen.set_JZ(strtofloat(CB.Text));
case RG.ItemIndex
of
0:
begin
EditMR.Text := formatfloat('
0.00',darlehen.get_mon_Raten);
EditMZ.Clear;
EditGZ.Text := formatfloat('
0.00',darlehen.get_ges_zinsen);
EditGza.Text := formatfloat('
0.00',darlehen.get_ges_zahlung);
end;
1:
begin
EditMZ.Text := formatfloat('
0.00',darlehen.get_mon_Zinsen);
EditMR.Text := '
';
end;
end;
EditGz.Text := formatfloat('
0.00', darlehen.get_ges_zinsen);
EditGza.Text := formatfloat('
0.00', darlehen.get_ges_zahlung);
end;
ButtonSave.Enabled := True;
ButtonClose.Enabled := True;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
liste := TStringList.Create;
end;
procedure TForm1.ButtonNDClick(Sender: TObject);
begin
ButtonND.Enabled := False;
EditID.Enabled := False;
Label2.Enabled := False;
EditDS.Enabled := True;
EditB.Enabled := True;
EditLZ.Enabled := True;
CB.Enabled := True;
Label3.Enabled := True;
Label4.Enabled := True;
Label5.Enabled := True;
Label6.Enabled := True;
if RG.ItemIndex = -1
then begin
showmessage('
Bitte Darlehensart auswählen! ');
end
else begin
liste.LoadFromFile('
darlehen.txt');
anz := + liste.Count + 1000;
//showmessage(inttostr(anz));
EditID.Text := upcase(RG.Items[RG.ItemIndex][1]) + inttostr(anz);
case RG.ItemIndex
of
0: darlehen := TAnnuitaetendarlehen.create(Editid.Text);
1: darlehen := TEndfaelliges_Darlehen.create(Editid.Text);
end;
ButtonBA.Enabled := True;
end;
end;
procedure TForm1.RGClick(Sender: TObject);
begin
ButtonND.Enabled := True;
Label2.Enabled := True;
end;
procedure TForm1.ButtonSAVEClick(Sender: TObject);
begin
liste.Add(darlehen.speichern);
liste.SaveToFile('
darlehen.txt');
showmessage('
Daten erfolgreich gespeichert!');
liste.Free;
darlehen.Free;
end;
procedure TForm1.ButtonCLOSEClick(Sender: TObject);
begin
close;
end;
end.