unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, DBCtrls,
DB, DBTables, ComCtrls;
type
TForm1 =
class(TForm)
Button1: TButton;
Button2: TButton;
Button3: TButton;
Edit2: TEdit;
Edit3: TEdit;
Edit4: TEdit;
Edit5: TEdit;
Edit6: TEdit;
Edit7: TEdit;
Edit8: TEdit;
Edit9: TEdit;
Edit10: TEdit;
Edit11: TEdit;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
Label8: TLabel;
Label9: TLabel;
Label10: TLabel;
Label11: TLabel;
ComboBox1: TComboBox;
ComboBox2: TComboBox;
DBRadioGroup1: TDBRadioGroup;
DBRadioGroup2: TDBRadioGroup;
DBRadioGroup3: TDBRadioGroup;
DBRadioGroup4: TDBRadioGroup;
Query1: TQuery;
DateTimePicker1: TDateTimePicker;
Label12: TLabel;
Label13: TLabel;
procedure Button1Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
Query1: TQuery;
datum, wupb1, wupb2, wupb3, wupb4, wupb1d, wupb2d, wupb3d, wupb4d, wupb1ab, wupb2ab, wupb3ab, wupb4ab, wupgesd, wupsl, wupgt, wupel, wupges: integer;
ort,
name:
string[50];
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
//Einlesen der Variablen
wupb1 := StrToInt(Edit2.Text);
wupb2 := StrToInt(Edit3.Text);
wupb3 := StrToInt(Edit4.Text);
wupb4 := StrToInt(Edit5.Text);
wupb1d := StrToInt (Edit7.Text);
wupb2d := StrToInt (Edit8.Text);
wupb3d := StrToInt (Edit9.Text);
wupb4d := StrToInt (Edit10.Text);
//Abzüge pro Bahn
//Bahn1
case DBRadioGroup1.ItemIndex
of
0 : wupb1 := wupb1 - 1;
1 : wupb1 := wupb1 - 2;
2 : wupb1 := wupb1 - 5;
end;
//Bahn2
case DBRadioGroup2.ItemIndex
of
0 : wupb2 := wupb2 - 1;
1 : wupb2 := wupb2 - 2;
2 : wupb2 := wupb2 - 5;
end;
//Bahn3
case DBRadioGroup3.ItemIndex
of
0 : wupb3 := wupb3 - 1;
1 : wupb3 := wupb3 - 2;
2 : wupb3 := wupb3 - 5;
end;
//Bahn4
case DBRadioGroup4.ItemIndex
of
0 : wupb4 := wupb4 - 1;
1 : wupb4 := wupb4 - 2;
2 : wupb4 := wupb4 - 5;
end;
//Drops pro Bahn incl. Zuzüge
wupb1 := (wupb1d * 2) + wupb1;
wupb2 := (wupb2d * 2) + wupb2;
wupb3 := (wupb3d * 2) + wupb3;
wupb4 := (wupb4d * 2) + wupb4;
//GesamtDrops
wupgesd := wupb1d + wupb2d + wupb3d + wupb4d;
//GesamtSchläge incl. Abzüge
wupges := wupb1 + wupb2 + wupb3 + wupb4;
//Ausgabe - Gesamt Drops
Edit11.Text := IntToStr(wupgesd);
//Ausgabe - Gesamt Schläge incl. Zu-/Abzüge
Edit6.Text := IntToStr(wupges);
name := ComboBox1.Items.Strings[ComboBox1.ItemIndex];
ort := ComboBox2.Items.Strings[ComboBox2.ItemIndex];
wupb1ab := 1;
wupb2ab := 1;
wupb3ab := 1;
wupb4ab := 1;
wupsl := 1;
wupel := 1;
wupgt := 1;
datum := 1;
end;
procedure TForm1.Button3Click(Sender: TObject);
var
f :textfile;
begin
//In Datei schreiben
AssignFile(f,'
erg_wup.txt');
{$i-}
Append(f);
{$i+}
if IOResult <> 0
then halt;
Writeln(f,ComboBox2.Items.Strings[ComboBox2.ItemIndex] + '
,' + ComboBox1.Items.Strings[ComboBox1.ItemIndex] + '
,' + Edit2.Text + '
,' + Edit7.Text + '
,' + Edit3.Text + '
,' + Edit8.Text + '
,' + Edit4.Text + '
,' + Edit9.Text + '
,' + Edit5.Text + '
,' + Edit10.Text + '
,' + Edit6.Text + '
,' + Edit11.Text);
CloseFile(f)
end;
procedure PEinlesen;
var
StrTable:
String;
begin
StrTable := ExtractFilePath(ParamStr(0)) + '
db/db.db';
// Datensätze mit Query einfügen
With Query1
Do
Begin
SQL.Text :=
'
Insert INTO ' + StrTable + #10 +
'
(Ort' + #10 +
'
,Datum' + #10 +
'
,Name' + #10 +
'
,Bahn1' + #10 +
'
,Bahn1Ab' + #10 +
'
,Bahn1Drops' + #10 +
'
,Bahn2' + #10 +
'
,Bahn2Ab' + #10 +
'
,Bahn2Drops' + #10 +
'
,Bahn3' + #10 +
'
,Bahn3Ab' + #10 +
'
,Bahn3Drops' + #10 +
'
,Bahn4' + #10 +
'
,Bahn4Ab' + #10 +
'
,Bahn4Drops' + #10 +
'
,GesDrops' + #10 +
'
,GesSL' + #10 +
'
,GesGT' + #10 +
'
,GesEL' + #10 +
'
,Gesamt)' + #10 +
'
VALUES' + #10 +
'
(:i_Ort' + #10 +
'
,:i_Datum' + #10 +
'
,:i_Name' + #10 +
'
,:i_Bahn1' + #10 +
'
,:i_Bahn1Ab' + #10 +
'
,:i_Bahn1Drops' + #10 +
'
,:i_Bahn2' + #10 +
'
,:i_Bahn2Ab' + #10 +
'
,:i_Bahn2Drops' + #10 +
'
,:i_Bahn3' + #10 +
'
,:i_Bahn3Ab' + #10 +
'
,:i_Bahn3Drops' + #10 +
'
,:i_Bahn4' + #10 +
'
,:i_Bahn4Ab' + #10 +
'
,:i_Bahn4Drops' + #10 +
'
,:i_GesDrops' + #10 +
'
,:i_GesSL' + #10 +
'
,:i_GesGT' + #10 +
'
,:i_GesEL' + #10 +
'
,:i_Gesamt)';
Prepared := True;
With Params
Do
Begin
ParamByName('
:i_Ort') .AsString := ort;
// Ich nahm an, dass DATUM in der Tabelle ein Datumsfeld ist
ParamByName('
:i_DATUM') .AsInteger := datum;
ParamByName('
:i_NAME') .AsString :=
name;
ParamByName('
:i_Bahn1') .AsInteger := wupb1;
ParamByName('
:i_Bahn1Ab') .AsInteger := wupb1ab;
ParamByName('
:i_Bahn1Drops').AsInteger := wupb1d;
ParamByName('
:i_Bahn2') .AsInteger := wupb2;
ParamByName('
:i_Bahn2Ab') .AsInteger := wupb2ab;
ParamByName('
:i_Bahn2Drops').AsInteger := wupb2d;
ParamByName('
:i_Bahn3') .AsInteger := wupb3;
ParamByName('
:i_Bahn3Ab') .AsInteger := wupb3ab;
ParamByName('
:i_Bahn3Drops').AsInteger := wupb3d;
ParamByName('
:i_Bahn4') .AsInteger := wupb4;
ParamByName('
:i_Bahn4Ab') .AsInteger := wupb4ab;
ParamByName('
:i_Bahn4Drops').AsInteger := wupb4d;
ParamByName('
:i_GesDrops') .AsInteger := wupgesd;
ParamByName('
:i_GesSL') .AsInteger := wupsl;
ParamByName('
:i_GesGT') .AsInteger := wupgt;
ParamByName('
:i_GesEL') .AsInteger := wupel;
ParamByName('
:i_Gesamt') .AsInteger := wupges;
End;
ExecSQL;
End;
end;
end.