procedure TForm_RefereeMain.MainMenu_Click(Sender: TObject);
var cSQL, ss: string;
maxid, y: integer;
fa: TForm_About;
fo: TForm_Options;
fb: TForm_Betalingen;
fco: TForm_Coordinatoren_Overzicht;
fdo: TForm_Divisies_Overzicht;
feo: TForm_Evaluatie_Overzicht;
fkg: TForm_KM_Gereden;
fkm: TForm_KM_Vergoeding;
flo: TForm_Licentie_Overzicht;
fro: TForm_Referee_Overzicht;
frs: TForm_RapportStraffenOverzicht;
fso: TForm_Supervisors_Overzicht;
fto: TForm_Teams_Overzicht;
fwo: TForm_Wedstrijd_Overzicht;
fyo: TForm_IJsbanen_Overzicht;
begin
for maxid := 1 to Screen.FormCount - 1 do begin
// bij 1 beginnen en niet bij 0 omdat het beginscherm altijd open is.
if Screen.Forms[maxid].Visible then begin
Form_Message.MsgWindow(mVraag, bOk,
'First close the active window' + sCrLf +
'before opening a new one !!', PrgNaam);
// Screen.Forms[maxid].SetFocus;
exit;
end; // if
end; // for
case TMenuItem(Sender).Tag of
11: begin // Files Exit
Form_Message.MsgWindow(mVraag, bYesNo,
'Are you sure that you want to exit' + sCrLf + PrgNaam + ' ?', PrgNaam);
if Form_MessageButtonPressed = 0 then begin
Trans_RefereeDB.Active := False;
Connect_RefereeDB.Connected := False;
Application.Terminate;
Exit;
end; // if
end; // Files Exit
12: begin
fo := TForm_Options.Create(Self);
fo.Show;
end; // 12
21: begin
fwo := TForm_Wedstrijd_Overzicht.Create(Self);
fwo.Show;
end; // 21
22: begin
fdo := TForm_Divisies_Overzicht.Create(Self);
fdo.Show;
end; // 22
23: begin
fto := TForm_Teams_Overzicht.Create(self);
fto.Show;
end; // 23
24: begin
frs := TForm_RapportStraffenOverzicht.Create(Self);
frs.Show;
end; // 24
31: begin
fro := TForm_Referee_Overzicht.Create(Self);
fro.Show;
end; // 31
32: begin
feo := TForm_Evaluatie_Overzicht.Create(Self);
feo.Show;
end; // 32
33: begin
fkg := TForm_KM_Gereden.Create (Self);
fkg.Show;
end; // 33
71: begin
if CheckReport (ResourceDir + 'rpt_Wedstrijden_Seizoen.lrf') = False then begin
Form_Message.MsgWindow(mUitroep, bOk,
'The report you want to' + sCrLf +
'access is not available.' + sCrLf + sCrLf +
'Please contact vendor for' + sCrLf +
'further information.', PrgNaam);
Exit;
end; // if
// set de query
cSQL := 'SELECT * FROM qry_Overzicht_Wedstrijden WHERE Seizoen = ' +
BepaalHuidigSeizoen.ToString;
TQ_Rapport_Master.Active := False;
TQ_Rapport_Master.DataBase := Connect_RefereeDB;
TQ_Rapport_Master.SQL.Text := cSQL;
TQ_Rapport_Master.Active := True;
// open het rapport in LazReport
frReport_Evaluatie.LoadFromFile(ResourceDir + 'rpt_Wedstrijden_Seizoen.lrf');
frReport_Evaluatie.Title:='All Games played in Season ' +
MLookUp ('Sei_Periode', 'tbl_Seizoenen', 'Sei_ID='+BepaalHuidigSeizoen.ToString);
frReport_Evaluatie.ShowReport;
end; // 71
72: begin
if CheckReport (ResourceDir + 'rpt_Wedstrijden_Alle.lrf') = False then begin
Form_Message.MsgWindow(mUitroep, bOk,
'The report you want to' + sCrLf +
'access is not available.' + sCrLf + sCrLf +
'Please contact vendor for' + sCrLf +
'further information.', PrgNaam);
Exit;
end; // if
// set de query
cSQL := 'SELECT * FROM qry_Overzicht_Wedstrijden';
TQ_Rapport_Master.Active := False;
TQ_Rapport_Master.DataBase := Connect_RefereeDB;
TQ_Rapport_Master.SQL.Text := cSQL;
TQ_Rapport_Master.Active := True;
// open het rapport in LazReport
frReport_Evaluatie.LoadFromFile(ResourceDir + 'rpt_Wedstrijden_Alle.lrf');
frReport_Evaluatie.ShowReport;
end; // 72
73: begin
fb := TForm_Betalingen.Create (Self);
fb.Show;
end; // 73
74: begin
if CheckReport (ResourceDir + 'rpt_Wedstrijden_Club.lrf') = False then begin
Form_Message.MsgWindow(mUitroep, bOk,
'The report you want to' + sCrLf +
'access is not available.' + sCrLf + sCrLf +
'Please contact vendor for' + sCrLf +
'further information.', PrgNaam);
Exit;
end; // if
// set de query
cSQL := 'SELECT * FROM qry_Overzicht_Wedstrijden WHERE (Seizoen = ' +
IntToStr(BepaalHuidigSeizoen) + ' AND ABS(Wed_Meetellen) = 1)';
TQ_Rapport_Master.Active := False;
TQ_Rapport_Master.DataBase := Connect_RefereeDB;
TQ_Rapport_Master.SQL.Text := cSQL;
TQ_Rapport_Master.Active := True;
// open het rapport in LazReport
frReport_Evaluatie.LoadFromFile(ResourceDir + 'rpt_Wedstrijden_Club.lrf');
frReport_Evaluatie.Title:='All Club Games played in Season ' +
MLookUp ('Sei_Periode', 'tbl_Seizoenen', 'Sei_ID='+BepaalHuidigSeizoen.ToString);
frReport_Evaluatie.ShowReport;
end; // 74
75: begin
if CheckReport (ResourceDir + 'rpt_Wedstrijden_Overige.lrf') = False then begin
Form_Message.MsgWindow(mUitroep, bOk,
'The report you want to' + sCrLf +
'access is not available.' + sCrLf + sCrLf +
'Please contact vendor for' + sCrLf +
'further information.', PrgNaam);
Exit;
end; // if
// set de query
cSQL := 'SELECT * FROM qry_Overzicht_Wedstrijden WHERE (Seizoen = ' +
BepaalHuidigSeizoen.ToString + ' AND Wed_Meetellen = 0)';
TQ_Rapport_Master.Active := False;
TQ_Rapport_Master.DataBase := Connect_RefereeDB;
TQ_Rapport_Master.SQL.Text := cSQL;
TQ_Rapport_Master.Active := True;
// open het rapport in LazReport
frReport_Evaluatie.LoadFromFile(ResourceDir + 'rpt_Wedstrijden_Overige.lrf');
frReport_Evaluatie.Title:='All Non-Club Games played in Season ' +
MLookUp ('Sei_Periode', 'tbl_Seizoenen', 'Sei_ID='+BepaalHuidigSeizoen.ToString);
frReport_Evaluatie.ShowReport;
end; // 75
76: begin
if CheckReport (ResourceDir + 'rpt_Evaluatie_Overzicht_Seizoen.lrf') = False then begin
Form_Message.MsgWindow(mUitroep, bOk,
'The report you want to' + sCrLf +
'access is not available.' + sCrLf + sCrLf +
'Please contact vendor for' + sCrLf +
'further information.', PrgNaam);
Exit;
end; // if
// set de query
cSQL := 'SELECT * FROM qry_Overzicht_Evaluaties ' +
'WHERE Seizoen = ' + BepaalHuidigSeizoen.ToString + ';';
TQ_Rapport_Master.Active := False;
TQ_Rapport_Master.DataBase := Connect_RefereeDB;
TQ_Rapport_Master.SQL.Text := cSQL;
TQ_Rapport_Master.Active := True;
// open het rapport in LazReport
frReport_Evaluatie.LoadFromFile(ResourceDir + 'rpt_Evaluatie_Overzicht_Seizoen.lrf');
frReport_Evaluatie.ShowReport;
end; // 76
77: begin
if CheckReport (ResourceDir + 'rpt_Evaluatie_Overzicht_Alle.lrf') = False then begin
Form_Message.MsgWindow(mUitroep, bOk,
'The report you want to' + sCrLf +
'access is not available.' + sCrLf + sCrLf +
'Please contact vendor for' + sCrLf +
'further information.', PrgNaam);
Exit;
end; // if
// set de query
cSQL := 'SELECT * FROM qry_Overzicht_Evaluaties';
TQ_Rapport_Master.Active := False;
TQ_Rapport_Master.DataBase := Connect_RefereeDB;
TQ_Rapport_Master.SQL.Text := cSQL;
TQ_Rapport_Master.Active := True;
// open het rapport in LazReport
frReport_Evaluatie.LoadFromFile(ResourceDir + 'rpt_Evaluatie_Overzicht_Alle.lrf');
frReport_Evaluatie.ShowReport;
end; // 77
78: begin
if CheckReport (ResourceDir + 'rpt_Wedstrijden_Toernooi.lrf') = False then begin
Form_Message.MsgWindow(mUitroep, bOk,
'The report you want to' + sCrLf +
'access is not available.' + sCrLf + sCrLf +
'Please contact vendor for' + sCrLf +
'further information.', PrgNaam);
Exit;
end; // if
// set de query
cSQL := 'SELECT * FROM qry_Overzicht_Wedstrijden WHERE (Seizoen = ' +
BepaalHuidigSeizoen.ToString + ' AND T = ' + SingleQuotedStr('x') + ')';
TQ_Rapport_Master.Active := False;
TQ_Rapport_Master.DataBase := Connect_RefereeDB;
TQ_Rapport_Master.SQL.Text := cSQL;
TQ_Rapport_Master.Active := True;
// open het rapport in LazReport
frReport_Evaluatie.LoadFromFile(ResourceDir + 'rpt_Wedstrijden_Toernooi.lrf');
frReport_Evaluatie.Title:='All Tournament Games played in Season ' +
MLookUp ('Sei_Periode', 'tbl_Seizoenen', 'Sei_ID='+BepaalHuidigSeizoen.ToString);
frReport_Evaluatie.ShowReport;
end; // 78
81: begin
// bepaal het laatste seizoen
maxid := strtointdef(MLookup('MAX(Sei_ID)','tbl_Seizoenen','1=1'), 0);
y := MLookup('Sei_Tot','tbl_Seizoenen','Sei_ID='+maxid.ToString);
ss := MLookup('Sei_Letter','tbl_Seizoenen','Sei_ID='+maxid.ToString);
Form_Message.MsgWindow(mVraag, bYesNo,
'Are you sure that you want to add' + sCrLf +
'Season ' + IntToStr(y) + '-' + IntToStr(y+1) + ' ?', PrgNaam);
if Form_MessageButtonPressed = 0 then begin
// De letter A is ASCII 65.
// SS[2] := Dus wordt het 64 + (maxid mod 26) is letter.
// SS[1] := 65 + (maxid DIV 26)
maxid := maxid + 1;
SS := ' ';
SS[2] := CHR(64 + (maxid MOD 26));
SS[1] := CHR(65 + (maxid DIV 26));
// insert recordgegevens met het juiste seizoen en id.
cSQL := 'INSERT INTO tbl_Seizoenen ' +
'VALUES (' + IntToStr(maxid) + ',"' + IntToStr(y) + '-' + IntToStr(y+1) + '",' +
IntToStr(y) + ',' + IntToStr(y+1) + ',1,0.0,0.0,"' + SS + '")';
Connect_RefereeDB.ExecuteDirect(cSQL);
Trans_RefereeDB.Commit;
SS := 'Season ' + IntToStr(y) + '-' + IntToStr(y+1) + ' added !!' + sCrLf + sCrLf +
'Milage Compensaion is set to € 0.00.' + sCrLf +
'Food Compensaion is set to € 0.00.';
Form_Message.MsgWindow(mInfo, bOk, SS, PrgNaam);
end; // if
end; // 81
82: begin
fco := TForm_Coordinatoren_Overzicht.Create (Self);
fco.Show;
end; // 82
83: begin
fyo := TForm_IJsbanen_Overzicht.Create (Self);
fyo.Show;
end; // 83
84: begin
fso := TForm_Supervisors_Overzicht.Create (Self);
fso.Show;
end; // 84
85: begin
flo := TForm_Licentie_Overzicht.Create(Self);
flo.Show;
end; // 85
86: begin
fkm := TForm_KM_Vergoeding.Create(Self);
fkm.Show;
end; // 86
91: begin
fa := TForm_About.Create (Self);
fa.Show;
end; // 91
else
Form_Message.MsgWindow(mStop, bOk, 'Work in Progress !!', Prgnaam);
end; // case
end; // MainMenu_Click