Архитектура Аудит Военная наука Иностранные языки Медицина Металлургия Метрология Образование Политология Производство Психология Стандартизация Технологии |
Результаты тестирования программы ⇐ ПредыдущаяСтр 8 из 8
Рисунок В.1 – Результаты игры Рисунок В.2 – Рейтинг участников Рисунок В.3 – Общий рейтинг
Рисунок В.4 – Календарь мероприятий (сайт) Рисунок В.5 – Результаты игры (сайт) Рисунок В.6 – Общий рейтинг (сайт) Приложение Г Тексты программ program pr_golf;
uses Forms, menu in 'menu.pas' {Fm_Main}, dm in 'dm.pas' {DataModule1: TDataModule}, fm_kalendar in 'fm_kalendar.pas' {fm_kal}, fm_vedosmost in 'fm_vedosmost.pas' {fm_ved}, fm_protokol in 'fm_protokol.pas' {fm_prot}, fm_poisk in 'fm_poisk.pas' {fm_choose}, fm_player in 'fm_player.pas' {fm_play}, fm_spravochniki in 'fm_spravochniki.pas' {fm_sprav}, fm_allPlayers in 'fm_allPlayers.pas' {fm_SpravPlayer};
{$R *.res}
begin Application.Initialize; Application.CreateForm(TFm_Main, Fm_Main); Application.CreateForm(TDataModule1, DataModule1); Application.CreateForm(Tfm_kal, fm_kal); Application.CreateForm(Tfm_ved, fm_ved); Application.CreateForm(Tfm_prot, fm_prot); Application.CreateForm(Tfm_choose, fm_choose); Application.CreateForm(Tfm_play, fm_play); Application.CreateForm(Tfm_sprav, fm_sprav); Application.CreateForm(Tfm_SpravPlayer, fm_SpravPlayer); Application.Run; end.
unit dm;
interface
uses SysUtils, Classes, DB, IBDatabase, IBCustomDataSet, IBQuery, IBTable, IBUpdateSQL, dialogs, windows, Messages, Variants, Graphics, Controls, Forms, IBStoredProc;
type TDataModule1 = class(TDataModule) db_golf: TIBDatabase; tr_golf: TIBTransaction; qr_reg: TIBQuery; ds_reg: TDataSource; tb_tourney: TIBTable; tb_where: TIBTable; ds_tourney: TDataSource; ds_where: TDataSource; tb_tourneyNAME_TOURNEY: TIBStringField; tb_tourneyTEXT_TOURNEY: TIBStringField; tb_tourneyDATE_TOURNEY: TDateField; tb_tourneyRATING_CITY: TIntegerField; tb_tourneyHOLE_TOURNEY: TIntegerField; tb_tourneyID_WHERE: TSmallintField; tb_tourneyNUM_TOURNEY: TSmallintField; tb_tourneyNAME_WHERE: TStringField; up_tourney: TIBUpdateSQL; tb_whereID_WHERE: TSmallintField; tb_whereNAME_WHERE: TIBStringField; tb_group: TIBTable; ds_group: TDataSource; sp_tourney: TIBStoredProc; ds_result: TDataSource; ds_club: TDataSource; tb_club: TIBTable; tb_groupID_GROUP: TSmallintField; tb_groupNAME_GROUP: TIBStringField; tb_city: TIBTable; ds_city: TDataSource; up_where: TIBUpdateSQL; up_group: TIBUpdateSQL; up_city: TIBUpdateSQL; up_club: TIBUpdateSQL; tb_clubID_CLUB: TSmallintField; tb_clubNAME_CLUB: TIBStringField; tb_clubID_CITY: TSmallintField; tb_clubNAME_CITY: TStringField; tb_cityID_CITY: TSmallintField; tb_cityNAME_CITY: TIBStringField; qr_add: TIBQuery; qr_title: TIBQuery; ds_player: TDataSource; tb_wherenum_where: TIntegerField; tb_groupnum_group: TIntegerField; tb_citynum_city: TIntegerField; tb_clubnum_club: TIntegerField; qr_player: TIBQuery; tb_regAll: TIBTable; ds_regAll: TDataSource; tb_regAllID_PLAYER: TSmallintField; tb_result: TIBTable; tb_resultNUM_HOLE: TSmallintField; tb_resultID_REG: TSmallintField; tb_resultHOLE: TIntegerField; tb_resultnum_holeCalc: TIntegerField; qr_dop: TIBQuery; up_result: TIBUpdateSQL; tb_groupMIN_GROUP: TIntegerField; tb_groupMAX_GROUP: TIntegerField; qr_playerNAME_CLUB: TIBStringField; qr_playerFAM_PLAYER: TIBStringField; qr_playerNAME_PLAYER: TIBStringField; qr_playerSEX_PLAYER: TIBStringField; qr_playerBD_PLAYER: TDateField; qr_playerTEL: TIBStringField; qr_playerID_PLAYER: TSmallintField; qr_playerID_CLUB: TSmallintField; qr_playernum_player: TIntegerField; tb_regAllNUM_TOURNEY: TSmallintField; qr_result: TIBQuery; procedure tb_tourneyAfterPost(DataSet: TDataSet); procedure tb_tourneyBeforeDelete(DataSet: TDataSet); procedure tb_whereAfterPost(DataSet: TDataSet); procedure tb_whereBeforeDelete(DataSet: TDataSet); procedure tb_groupAfterPost(DataSet: TDataSet); procedure tb_groupBeforeDelete(DataSet: TDataSet); procedure tb_cityAfterPost(DataSet: TDataSet); procedure tb_cityBeforeDelete(DataSet: TDataSet); procedure tb_clubAfterPost(DataSet: TDataSet); procedure tb_clubBeforeDelete(DataSet: TDataSet); procedure tb_whereBeforeInsert(DataSet: TDataSet); procedure tb_whereNewRecord(DataSet: TDataSet); procedure tb_groupBeforeInsert(DataSet: TDataSet); procedure tb_groupNewRecord(DataSet: TDataSet); procedure tb_cityBeforeInsert(DataSet: TDataSet); procedure tb_cityNewRecord(DataSet: TDataSet); procedure tb_clubBeforeInsert(DataSet: TDataSet); procedure tb_clubBeforePost(DataSet: TDataSet); procedure tb_tourneyBeforeInsert(DataSet: TDataSet); procedure tb_tourneyBeforePost(DataSet: TDataSet); procedure tb_tourneyAfterDelete(DataSet: TDataSet); procedure tb_whereAfterDelete(DataSet: TDataSet); procedure tb_groupAfterDelete(DataSet: TDataSet); procedure tb_cityAfterDelete(DataSet: TDataSet); procedure tb_clubAfterDelete(DataSet: TDataSet); procedure qr_regCalcFields(DataSet: TDataSet); procedure tb_whereCalcFields(DataSet: TDataSet); procedure tb_groupCalcFields(DataSet: TDataSet); procedure tb_cityCalcFields(DataSet: TDataSet); procedure tb_clubCalcFields(DataSet: TDataSet); procedure qr_playerCalcFields(DataSet: TDataSet); procedure qr_playerBeforeInsert(DataSet: TDataSet); procedure qr_playerNewRecord(DataSet: TDataSet); procedure tb_resultCalcFields(DataSet: TDataSet); private { Private declarations } public { Public declarations } end;
var DataModule1: TDataModule1; cur: integer;
implementation
{$R *.dfm}
procedure TDataModule1.tb_tourneyAfterPost(DataSet: TDataSet); begin if DataModule1.tb_tourney.UpdatesPending = true then begin if application.MessageBox('Ï î ä ò â å ð ä è ò å ç à ï è ñ ü è ç ì å í å í è é è í ô î ð ì à ö è è î ò ó ð í è ð à õ ', 'Ï î ä ò â å ð æ ä å í è å ', mb_YesNo)=id_Yes then begin DataModule1.tb_tourney.ApplyUpdates; DataModule1.tr_golf.Commit; DataModule1.tb_tourney.active: =true; end; end else Application.MessageBox('Â û í å ñ î â å ð ø è ë è ê à ê è õ -ë è á î è ç ì å í å í è é ', 'Ï ð å ä ó ï ð å æ ä å í è å ', mb_ok); end;
procedure TDataModule1.tb_tourneyBeforeDelete(DataSet: TDataSet); begin if application.MessageBox('Â û ó â å ð å í û, ÷ ò î õ î ò è ò å ó ä à ë è ò ü è í ô î ð ì à ö è þ î ò ó ð í è ð å? ', 'Ó ä à ë å í è å ', mb_YesNo)< > id_Yes then begin abort; end; end;
procedure TDataModule1.tb_whereAfterPost(DataSet: TDataSet); begin if DataModule1.tb_where.UpdatesPending = true then begin if application.MessageBox('Ï î ä ò â å ð ä è ò å ç à ï è ñ ü è ç ì å í å í è é è í ô î ð ì à ö è è î ì å ñ ò à õ ï ð î â å ä å í è ÿ ', 'Ï î ä ò â å ð æ ä å í è å ', mb_YesNo)=id_Yes then begin DataModule1.tb_where.ApplyUpdates; DataModule1.tr_golf.Commit; DataModule1.tb_where.active: =true; end; end else Application.MessageBox('Â û í å ñ î â å ð ø è ë è ê à ê è õ -ë è á î è ç ì å í å í è é ', 'Ï ð å ä ó ï ð å æ ä å í è å ', mb_ok); end;
procedure TDataModule1.tb_whereBeforeDelete(DataSet: TDataSet); begin if application.MessageBox('Â û ó â å ð å í û, ÷ ò î õ î ò è ò å ó ä à ë è ò ü è í ô î ð ì à ö è þ î ì å ñ ò å ï ð î â å ä å í è ÿ? ', 'Ó ä à ë å í è å ', mb_YesNo)< > id_Yes then begin abort; end; end;
procedure TDataModule1.tb_groupAfterPost(DataSet: TDataSet); begin if DataModule1.tb_group.UpdatesPending = true then begin if application.MessageBox('Ï î ä ò â å ð ä è ò å ç à ï è ñ ü è ç ì å í å í è é è í ô î ð ì à ö è è î ã ð ó ï ï à õ ó ÷ à ñ ò í è ê î â ', 'Ï î ä ò â å ð æ ä å í è å ', mb_YesNo)=id_Yes then begin DataModule1.tb_group.ApplyUpdates; DataModule1.tr_golf.Commit; DataModule1.tb_group.active: =true; end; end else Application.MessageBox('Â û í å ñ î â å ð ø è ë è ê à ê è õ -ë è á î è ç ì å í å í è é ', 'Ï ð å ä ó ï ð å æ ä å í è å ', mb_ok); end;
procedure TDataModule1.tb_groupBeforeDelete(DataSet: TDataSet); begin if application.MessageBox('Â û ó â å ð å í û, ÷ ò î õ î ò è ò å ó ä à ë è ò ü è í ô î ð ì à ö è þ î ã ð ó ï ï å ó ÷ à ñ ò í è ê î â? ', 'Ó ä à ë å í è å ', mb_YesNo)< > id_Yes then begin abort; end; end;
procedure TDataModule1.tb_cityAfterPost(DataSet: TDataSet); begin if DataModule1.tb_city.UpdatesPending = true then begin if application.MessageBox('Ï î ä ò â å ð ä è ò å ç à ï è ñ ü è ç ì å í å í è é è í ô î ð ì à ö è è î ã î ð î ä à õ ', 'Ï î ä ò â å ð æ ä å í è å ', mb_YesNo)=id_Yes then begin DataModule1.tb_city.ApplyUpdates; DataModule1.tr_golf.Commit; DataModule1.tb_city.active: =true; end; end else Application.MessageBox('Â û í å ñ î â å ð ø è ë è ê à ê è õ -ë è á î è ç ì å í å í è é ', 'Ï ð å ä ó ï ð å æ ä å í è å ', mb_ok); end;
procedure TDataModule1.tb_cityBeforeDelete(DataSet: TDataSet); begin if application.MessageBox('Â û ó â å ð å í û, ÷ ò î õ î ò è ò å ó ä à ë è ò ü è í ô î ð ì à ö è þ î ã î ð î ä å? ', 'Ó ä à ë å í è å ', mb_YesNo)< > id_Yes then begin abort; end; end;
procedure TDataModule1.tb_clubAfterPost(DataSet: TDataSet); begin if DataModule1.tb_club.UpdatesPending = true then begin if application.MessageBox('Ï î ä ò â å ð ä è ò å ç à ï è ñ ü è ç ì å í å í è é è í ô î ð ì à ö è è î ê ë ó á à õ ', 'Ï î ä ò â å ð æ ä å í è å ', mb_YesNo)=id_Yes then begin DataModule1.tb_club.ApplyUpdates; DataModule1.tr_golf.Commit; DataModule1.tb_club.active: =true; end; end else Application.MessageBox('Â û í å ñ î â å ð ø è ë è ê à ê è õ -ë è á î è ç ì å í å í è é ', 'Ï ð å ä ó ï ð å æ ä å í è å ', mb_ok); end;
procedure TDataModule1.tb_clubBeforeDelete(DataSet: TDataSet); begin if application.MessageBox('Â û ó â å ð å í û, ÷ ò î õ î ò è ò å ó ä à ë è ò ü è í ô î ð ì à ö è þ î ê ë ó á å? ', 'Ó ä à ë å í è å ', mb_YesNo)< > id_Yes then begin abort; end; end;
procedure TDataModule1.tb_whereBeforeInsert(DataSet: TDataSet);
begin tb_where.Last; cur: =tb_whereID_WHERE.Value; end;
procedure TDataModule1.tb_whereNewRecord(DataSet: TDataSet); begin tb_whereID_WHERE.Value: =cur+1; end;
procedure TDataModule1.tb_groupBeforeInsert(DataSet: TDataSet); begin tb_group.Last; cur: =tb_groupID_GROUP.Value; end;
procedure TDataModule1.tb_groupNewRecord(DataSet: TDataSet); begin tb_groupID_GROUP.Value: =cur+1; end;
procedure TDataModule1.tb_cityBeforeInsert(DataSet: TDataSet); begin tb_city.Last; cur: =tb_cityID_CITY.Value; end;
procedure TDataModule1.tb_cityNewRecord(DataSet: TDataSet); begin tb_cityID_CITY.Value: =cur+1; end;
procedure TDataModule1.tb_clubBeforeInsert(DataSet: TDataSet); begin tb_club.Last; cur: =tb_clubID_CLUB.Value; end;
procedure TDataModule1.tb_clubBeforePost(DataSet: TDataSet); begin if tb_clubID_CITY.Value< > 0 then tb_clubID_CLUB.Value: =cur+1 else begin MessageDlg('Ð à ñ ï î ë î æ å í è å ê ë ó á à í å á û ë î â û á ð à í î! ', mtWarning, [mbOK], 0); Abort; end; end;
procedure TDataModule1.tb_tourneyBeforeInsert(DataSet: TDataSet); begin tb_tourney.Last; cur: =tb_tourneyNUM_TOURNEY.Value; end;
procedure TDataModule1.tb_tourneyBeforePost(DataSet: TDataSet); begin tb_tourneyNUM_TOURNEY.Value: =cur+1; end;
procedure TDataModule1.tb_tourneyAfterDelete(DataSet: TDataSet); begin
tb_tourney.ApplyUpdates; tr_golf.Commit; tb_tourney.Open; end;
procedure TDataModule1.tb_whereAfterDelete(DataSet: TDataSet); begin tb_where.ApplyUpdates; tr_golf.Commit; tb_where.Open; end;
procedure TDataModule1.tb_groupAfterDelete(DataSet: TDataSet); begin tb_group.ApplyUpdates; tr_golf.Commit; tb_group.Open; end;
procedure TDataModule1.tb_cityAfterDelete(DataSet: TDataSet); begin tb_city.ApplyUpdates; tr_golf.Commit; tb_city.Open; end;
procedure TDataModule1.tb_clubAfterDelete(DataSet: TDataSet); begin tb_club.ApplyUpdates; tr_golf.Commit; tb_club.Open; end;
procedure TDataModule1.qr_regCalcFields(DataSet: TDataSet); begin // qr_regNum_player.AsInteger: =qr_reg.RecNo; end;
procedure TDataModule1.tb_whereCalcFields(DataSet: TDataSet); begin tb_wherenum_where.AsInteger: =tb_where.RecNo; end;
procedure TDataModule1.tb_groupCalcFields(DataSet: TDataSet); begin tb_groupnum_group.AsInteger: =tb_group.RecNo; end;
procedure TDataModule1.tb_cityCalcFields(DataSet: TDataSet); begin tb_citynum_city.AsInteger: =tb_city.RecNo; end;
procedure TDataModule1.tb_clubCalcFields(DataSet: TDataSet); begin tb_clubnum_club.AsInteger: =tb_club.RecNo; end;
procedure TDataModule1.qr_playerCalcFields(DataSet: TDataSet); begin qr_playernum_player.AsInteger: =qr_player.RecNo; end;
procedure TDataModule1.qr_playerBeforeInsert(DataSet: TDataSet); begin qr_player.Last; cur: =qr_playerID_PLAYER.Value; end;
procedure TDataModule1.qr_playerNewRecord(DataSet: TDataSet); begin qr_playerID_PLAYER.AsInteger: =cur+1; end;
procedure TDataModule1.tb_resultCalcFields(DataSet: TDataSet); begin tb_resultnum_holeCalc.AsInteger: =tb_result.RecNo; end;
end.
unit menu;
interface
uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, Menus, jpeg, ExtCtrls, ComObj, DB, StdCtrls;
type TFm_Main = class(TForm) MainMenu1: TMainMenu; N1: TMenuItem; N2: TMenuItem; N3: TMenuItem; N4: TMenuItem; N5: TMenuItem; N6: TMenuItem; N7: TMenuItem; N8: TMenuItem; N9: TMenuItem; N10: TMenuItem; img_back: TImage; img_logo: TImage; N11: TMenuItem; N12: TMenuItem; N13: TMenuItem; procedure N5Click(Sender: TObject); procedure N4Click(Sender: TObject); procedure N6Click(Sender: TObject); procedure N7Click(Sender: TObject); procedure N8Click(Sender: TObject); procedure N11Click(Sender: TObject); procedure N9Click(Sender: TObject); procedure N10Click(Sender: TObject); private { Private declarations } public { Public declarations } end;
var Fm_Main: TFm_Main; choose: integer;
implementation
uses fm_kalendar, dm, fm_vedosmost, fm_protokol, fm_poisk, fm_spravochniki;
{$R *.dfm}
procedure TFm_Main.N5Click(Sender: TObject); begin fm_kal.ShowModal; end;
procedure TFm_Main.N4Click(Sender: TObject); begin if MessageDlg('Â û ó â å ð å í û, ÷ ò î õ î ò è ò å â û é ò è? ', mtConfirmation, [mbYes, mbNo], 0)=mryes then Fm_Main.Close;
end;
procedure TFm_Main.N6Click(Sender: TObject); begin fm_ved.ShowModal; end;
procedure TFm_Main.N7Click(Sender: TObject); begin fm_prot.ShowModal; end;
procedure TFm_Main.N8Click(Sender: TObject); begin choose: =1; fm_choose.Caption: ='Ð å ç ó ë ü ò à ò û è ã ð û '; fm_choose.ShowModal; end;
procedure TFm_Main.N11Click(Sender: TObject); begin fm_sprav.ShowModal; end;
procedure TFm_Main.N9Click(Sender: TObject); begin choose: =2; fm_choose.Caption: ='Ð å é ò è í ã ó ÷ à ñ ò í è ê î â '; fm_choose.ShowModal; end;
procedure TFm_Main.N10Click(Sender: TObject); const Mes: array[1..12] of string = ('ÿ í â à ð ü ', 'ô å â ð à ë ü ', 'ì à ð ò ', 'à ï ð å ë ü ', 'ì à é ', 'è þ í ü ', 'è þ ë ü ', 'à â ã ó ñ ò ', 'ñ å í ò ÿ á ð ü ', 'î ê ò ÿ á ð ü ', 'í î ÿ á ð ü ', 'ä å ê à á ð ü '); var Year, Month, Day: Word; result: string; begin DecodeDate(now, Year, Month, Day); Result: = Mes[Month]; Result: = result + ' ' + IntToStr(Year) + ' ã î ä à '; DataModule1.qr_reg.SQL.Clear; DataModule1.qr_reg.SQL.Text: ='SELECT TB_PLAYER.FAM_PLAYER, TB_PLAYER.NAME_PLAYER, SUM( TB_REG.RATING_REG ) SUM_OF_RATING_REG, '+ 'TB_REG.ID_PLAYER, TB_PLAYER.SEX_PLAYER, TB_REG.ID_REG FROM TB_PLAYER '+ 'INNER JOIN TB_REG ON (TB_PLAYER.ID_PLAYER = TB_REG.ID_PLAYER) '+ 'GROUP BY TB_PLAYER.FAM_PLAYER, TB_PLAYER.NAME_PLAYER, TB_REG.ID_PLAYER, TB_PLAYER.SEX_PLAYER, TB_REG.ID_REG '+ 'ORDER BY 3 DESC '; DataModule1.qr_reg.Open; DataModule1.sp_tourney.StoredProcName: ='SP_RED_RATING'; excel_golf: =createOLEObject('Excel.sheet'); excel_book: =excel_golf.application;
excel_book.range['A1'].value: ='Î á ù è é ð å é ò è í ã ì è í è -ã î ë ü ô è ñ ò î â ã.Ò î ë ü ÿ ò ò è ('+result+')'; excel_book.range['A1'].font.name: ='Arial Black'; excel_book.range['A1'].font.size: =12; excel_book.range['A2'].value: ='Ì ó æ ÷ è í û '; excel_book.range['A2'].font.underline: =true; excel_book.range['A2'].font.bold: =true; excel_book.range['A3'].value: ='¹ '; excel_book.range['A3'].columnwidth: =45/10; excel_book.range['B3'].value: ='Ó ÷ à ñ ò í è ê '; excel_book.range['B3'].columnwidth: =25; excel_book.range['C3'].value: ='Ð å é ò è í ã '; excel_book.range['C3'].columnwidth: =10; excel_book.range['A2: C3'].font.size: =12; n: =4; m: =1; while not (DataModule1.qr_reg.eof) do if (DataModule1.qr_reg.FieldByName('SEX_PLAYER').AsString='ì ') then begin mark_player: =DataModule1.qr_reg.GetBookmark; excel_book.range['A'+IntToStr(n)].value: =m; excel_book.range['B'+IntToStr(n)].value: =''+DataModule1.qr_reg.FieldByName('FAM_PLAYER').AsString+' '+DataModule1.qr_reg.FieldByName('NAME_PLAYER').AsString; excel_book.range['C'+IntToStr(n)].value: =DataModule1.qr_reg.FieldByName('SUM_OF_RATING_REG').AsString; DataModule1.sp_tourney.ParamByName('RED_PLAYER').AsSmallInt: =DataModule1.qr_reg.fieldbyname('ID_PLAYER').AsInteger; DataModule1.sp_tourney.ParamByName('NEW_RATING').AsFloat: =DataModule1.qr_reg.fieldbyname('SUM_OF_RATING_REG').AsFloat; DataModule1.sp_tourney.Prepare; DataModule1.sp_tourney.ExecProc; DataModule1.tr_golf.Commit; DataModule1.qr_reg.Open; DataModule1.qr_reg.GotoBookmark(mark_player); inc(n); inc(m); DataModule1.qr_reg.Next; end else DataModule1.qr_reg.Next; excel_book.range['A3: C'+inttostr(n-1)].select; excel_book.selection.Borders.LineStyle: =1; excel_book.selection.font.bold: =true; excel_book.selection.HorizontalAlignment: =3; excel_book.range['B2: B'+inttostr(n-1)].HorizontalAlignment: =2;
excel_book.range['D3'].columnwidth: =5; excel_book.range['E2'].value: ='Æ å í ù è í û '; excel_book.range['E2'].font.underline: =true; excel_book.range['E2'].font.bold: =true; excel_book.range['E3'].value: ='¹ '; excel_book.range['E3'].columnwidth: =45/10; excel_book.range['F3'].value: ='Ó ÷ à ñ ò í è ê '; excel_book.range['F3'].columnwidth: =25; excel_book.range['G3'].value: ='Ð å é ò è í ã '; excel_book.range['G3'].columnwidth: =10; excel_book.range['E2: G3'].font.size: =12; DataModule1.qr_reg.First; n: =4; m: =1; while not(DataModule1.qr_reg.Eof) do if (DataModule1.qr_reg.FieldByName('SEX_PLAYER').AsString='æ ') then begin mark_player: =DataModule1.qr_reg.GetBookmark; excel_book.range['E'+inttostr(n)].value: =m; excel_book.range['F'+inttostr(n)].value: =''+DataModule1.qr_reg.FieldByName('FAM_PLAYER').AsString+' '+DataModule1.qr_reg.FieldByName('NAME_PLAYER').AsString; excel_book.range['G'+IntToStr(n)].value: =DataModule1.qr_reg.FieldByName('SUM_OF_RATING_REG').AsString; DataModule1.sp_tourney.ParamByName('RED_PLAYER').AsSmallInt: =DataModule1.qr_reg.fieldbyname('ID_PLAYER').AsInteger; DataModule1.sp_tourney.ParamByName('NEW_RATING').AsFloat: =DataModule1.qr_reg.fieldbyname('SUM_OF_RATING_REG').AsFloat; DataModule1.sp_tourney.Prepare; DataModule1.sp_tourney.ExecProc; DataModule1.tr_golf.Commit; DataModule1.qr_reg.Open; DataModule1.qr_reg.GotoBookmark(mark_player); inc(n); inc(m); DataModule1.qr_reg.Next; end else DataModule1.qr_reg.Next; excel_book.range['E3: G'+inttostr(n-1)].select; excel_book.selection.Borders.LineStyle: =1; excel_book.selection.font.bold: =true; excel_book.selection.HorizontalAlignment: =3; excel_book.range['F2: F'+inttostr(n-1)].HorizontalAlignment: =2; MessageDlg('Â û õ î ä í î é ä î ê ó ì å í ò ñ ô î ð ì è ð î â à í ', mtInformation, [mbOK], 0); excel_book.Visible: =true; end;
end.
unit fm_allPlayers;
interface
uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, Grids, DBGrids, ExtCtrls, DBCtrls, StdCtrls, DB, dateUtils, jpeg;
type Tfm_SpravPlayer = class(TForm) gr_players: TDBGrid; edt_find: TEdit; lb_zag: TLabel; lb_find: TLabel; lb_nothing: TLabel; btn_addPlayer: TButton; btn_updatePlayer: TButton; btn_delPlayer: TButton; btn_reg: TButton; img_back: TImage; btn_back: TButton; procedure edt_findChange(Sender: TObject); procedure edt_findEnter(Sender: TObject); procedure btn_addPlayerClick(Sender: TObject); procedure btn_updatePlayerClick(Sender: TObject); procedure btn_delPlayerClick(Sender: TObject); procedure btn_regClick(Sender: TObject); procedure FormActivate(Sender: TObject); procedure btn_backClick(Sender: TObject); private { Private declarations } public { Public declarations } end;
var fm_SpravPlayer: Tfm_SpravPlayer; cur_id: integer; mark_player: TBookmark;
implementation
uses dm, fm_player;
{$R *.dfm}
procedure Tfm_SpravPlayer.edt_findChange(Sender: TObject); var abc: string; begin if (trim(edt_find.Text)='') or (trim(edt_find.Text)='Ï î è ñ ê ') then begin DataModule1.qr_player.SQL.Clear; DataModule1.qr_player.SQL.Text: ='SELECT TB_CLUB.NAME_CLUB, TB_PLAYER.FAM_PLAYER, TB_PLAYER.NAME_PLAYER, '+ 'TB_PLAYER.SEX_PLAYER, TB_PLAYER.BD_PLAYER, TB_PLAYER.TEL, TB_PLAYER.ID_PLAYER, TB_PLAYER.ID_CLUB FROM TB_PLAYER '+ 'INNER JOIN TB_CLUB ON (TB_PLAYER.ID_CLUB = TB_CLUB.ID_CLUB)'; DataModule1.qr_player.Open; end else begin abc: =edt_find.text+'%'; DataModule1.qr_player.SQL.Clear; DataModule1.qr_player.SQL.Text: ='SELECT TB_CLUB.NAME_CLUB, TB_PLAYER.FAM_PLAYER, TB_PLAYER.NAME_PLAYER, '+ 'TB_PLAYER.SEX_PLAYER, TB_PLAYER.BD_PLAYER, TB_PLAYER.TEL, TB_PLAYER.ID_PLAYER, TB_PLAYER.ID_CLUB FROM TB_PLAYER '+ 'INNER JOIN TB_CLUB ON (TB_PLAYER.ID_CLUB = TB_CLUB.ID_CLUB) '+ 'where TB_PLAYER.FAM_PLAYER LIKE '''+trim(abc)+''''; DataModule1.qr_player.Open; end; if DataModule1.qr_player.IsEmpty=true then lb_nothing.Caption: ='Ä à í í û õ ï î ô à ì è ë è è í å í à é ä å í î ' else lb_nothing.Caption: =''; end;
procedure Tfm_SpravPlayer.edt_findEnter(Sender: TObject); begin edt_find.Clear; end;
procedure Tfm_SpravPlayer.btn_addPlayerClick(Sender: TObject); begin cur_id: =0; fm_play.edt_Fam.Clear; fm_play.edt_name.Clear; fm_play.edt_sex.clear; fm_play.edt_birthday.Clear; fm_play.edt_tel.clear; fm_play.cmb_club.KeyValue: =0; fm_play.Caption: ='Ä î á à â ë å í è å í î â î ã î è ã ð î ê à '; fm_play.ShowModal; DataModule1.qr_reg.Last; end;
procedure Tfm_SpravPlayer.btn_updatePlayerClick(Sender: TObject); begin mark_player: =DataModule1.qr_player.GetBookmark; cur_id: =DataModule1.qr_player.fieldbyname('Id_player').AsInteger; fm_play.edt_Fam.Text: =trim(DataModule1.qr_playerFAM_PLAYER.Value); fm_play.edt_name.Text: =trim(DataModule1.qr_playerNAME_PLAYER.Value); fm_play.edt_birthday.Text: =Trim(DataModule1.qr_player.fieldbyname('BD_player').asstring); fm_play.edt_tel.Text: =trim(DataModule1.qr_player.fieldbyname('tel').AsString); fm_play.edt_sex.Text: =trim(DataModule1.qr_player.fieldbyname('SEX_player').CurValue); fm_play.cmb_club.KeyValue: =DataModule1.qr_player.fieldbyname('ID_Club').CurValue; fm_play.Caption: ='Ð å ä à ê ò è ð î â à í è å è ã ð î ê à '; fm_play.ShowModal; if DataModule1.qr_player.BookmarkValid(mark_player)=true then begin DataModule1.qr_player.GotoBookmark(mark_player); DataModule1.qr_player.FreeBookmark(mark_player); end; end;
procedure Tfm_SpravPlayer.btn_delPlayerClick(Sender: TObject); begin if MessageDlg('Â û ó â å ð å í û ÷ ò î õ î ò è ò å ó ä à ë è ò ü è ã ð î ê à '+trim(DataModule1.qr_playerFAM_PLAYER.AsString), mtConfirmation, [mbYes, mbNo], 0)=mryes then begin cur_id: =DataModule1.qr_player.fieldbyname('ID_PLAYER').curvalue; DataModule1.sp_tourney.StoredProcName: ='SP_DEL_PLAYER'; DataModule1.sp_tourney.ParamByName('del_player').AsInteger: =cur_id; DataModule1.sp_tourney.Prepare; DataModule1.sp_tourney.ExecProc; DataModule1.tr_golf.Commit; DataModule1.qr_player.Open; // DataModule1.tb_regAll.Open; end; end;
procedure Tfm_SpravPlayer.btn_regClick(Sender: TObject); var age: Integer; check: boolean; begin check: =false; // DataModule1.tb_regAll.First; while not (DataModule1.qr_reg.Eof) do begin if DataModule1.qr_reg.FieldByName('ID_PLAYER').CurValue=DataModule1.qr_playerID_PLAYER.CurValue then begin check: =true; MessageDlg('Â ä à í í î ì ò ó ð í è ð å ó æ å ç à ð å ã è ñ ò ð è ð î â à í â û á ð à í í û é è ã ð î ê ', mtWarning, [mbOK], 0); end; if check then DataModule1.qr_reg.Last else DataModule1.qr_reg.Next; end; if not check then begin DataModule1.sp_tourney.StoredProcName: ='SP_ADD_REG'; age: =YearsBetween(now, VarToDateTime(DataModule1.qr_playerBD_PLAYER.CurValue)); if age< 10 then DataModule1.sp_tourney.ParamByName('NEW_GROUP').AsInteger: =1; if (age> =10) and (age< 15) then DataModule1.sp_tourney.ParamByName('NEW_GROUP').AsInteger: =2; if (age> =15) and (age< 20) then DataModule1.sp_tourney.ParamByName('NEW_GROUP').AsInteger: =3; if (age> =20) and (age< 45) then DataModule1.sp_tourney.ParamByName('NEW_GROUP').AsInteger: =4; if age> =45 then DataModule1.sp_tourney.ParamByName('NEW_GROUP').AsInteger: =5; DataModule1.sp_tourney.ParamByName('NEW_YEAR').AsInteger: =age; DataModule1.sp_tourney.ParamByName('NEW_NUM').AsInteger: =DataModule1.tb_tourneyNUM_TOURNEY.CurValue; DataModule1.sp_tourney.ParamByName('NEW_PLAYER').AsInteger: =DataModule1.qr_playerID_PLAYER.CurValue; DataModule1.sp_tourney.Prepare; DataModule1.sp_tourney.ExecProc; end; end;
procedure Tfm_SpravPlayer.FormActivate(Sender: TObject); begin DataModule1.qr_player.SQL.Clear; DataModule1.qr_player.SQL.Text: ='SELECT TB_CLUB.NAME_CLUB, TB_PLAYER.FAM_PLAYER, TB_PLAYER.NAME_PLAYER, '+ 'TB_PLAYER.SEX_PLAYER, TB_PLAYER.BD_PLAYER, TB_PLAYER.TEL, TB_PLAYER.ID_PLAYER, TB_PLAYER.ID_CLUB FROM TB_PLAYER '+ 'INNER JOIN TB_CLUB ON (TB_PLAYER.ID_CLUB = TB_CLUB.ID_CLUB)'; DataModule1.qr_player.Open; end;
procedure Tfm_SpravPlayer.btn_backClick(Sender: TObject); begin fm_SpravPlayer.Close; end;
end.
unit fm_kalendar;
interface
uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, Grids, DBGrids, StdCtrls, jpeg, ExtCtrls, DBCtrls;
type Tfm_kal = class(TForm) gr_kalendar: TDBGrid; img_back: TImage; lb_red: TLabel; nvg_kal: TDBNavigator; btn_close: TButton; procedure FormClose(Sender: TObject; var Action: TCloseAction); procedure FormCreate(Sender: TObject); procedure btn_closeClick(Sender: TObject); procedure FormActivate(Sender: TObject); private { Private declarations } public { Public declarations } end;
var fm_kal: Tfm_kal;
implementation
uses dm;
{$R *.dfm}
procedure Tfm_kal.FormClose(Sender: TObject; var Action: TCloseAction); begin if DataModule1.tb_tourney.UpdatesPending = true then if application.MessageBox('Á à ç à ä à í í û õ á û ë à è ç ì å í å í à. Ï î ä â ò å ð ä è ò å è ç ì å í å í è ÿ ', 'Ï î ä ò â å ð æ ä å í è å ', mb_YesNo)=id_Yes then begin DataModule1.tb_tourney.ApplyUpdates; DataModule1.tr_golf.Commit; DataModule1.tb_tourney.active: =true; end;
end;
procedure Tfm_kal.FormCreate(Sender: TObject); begin DataModule1.tb_tourney.Open; end;
procedure Tfm_kal.btn_closeClick(Sender: TObject); begin fm_kal.Close; end;
procedure Tfm_kal.FormActivate(Sender: TObject); begin DataModule1.tb_tourney.Open; end;
end.
unit fm_player;
interface
uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, DBCtrls, Mask, jpeg, ExtCtrls;
type Tfm_play = class(TForm) Label1: TLabel; lb_fam: TLabel; lb_sex: TLabel; lb_birthday: TLabel; lb_tel: TLabel; lb_club: TLabel; btn_Ok: TButton; btn_cancel: TButton; cmb_club: TDBLookupComboBox; edt_fam: TEdit; edt_name: TEdit; edt_sex: TEdit; edt_tel: TEdit; img_back: TImage; edt_birthday: TMaskEdit; procedure btn_cancelClick(Sender: TObject); procedure FormShow(Sender: TObject); procedure btn_OkClick(Sender: TObject); private { Private declarations } public { Public declarations } end;
var fm_play: Tfm_play;
implementation
uses dm, fm_vedosmost, fm_allPlayers;
{$R *.dfm}
procedure Tfm_play.btn_cancelClick(Sender: TObject); begin fm_play.Close; end;
procedure Tfm_play.FormShow(Sender: TObject); begin edt_Fam.SetFocus; end;
procedure Tfm_play.btn_OkClick(Sender: TObject); begin if (trim(edt_Fam.Text)='') or (trim(edt_name.Text)='') or (trim(edt_sex.Text)='') or (Trim(cmb_club.Text)='') then Application.MessageBox('Í å â ñ å ä à í í û å á û ë è â â å ä å í û! ', 'Ï ð å ä ó ï ð å æ ä å í è å ', mb_ok) else if (trim(edt_sex.Text)< > 'ì ') and (trim(edt_sex.Text)< > 'æ ') then Application.MessageBox('Ï î ë ì î æ å ò á û ò ü ò î ë ü ê î " ì " è ë è " æ "! ', 'Î ø è á ê à ', mb_ok) else begin if cur_id=0 then begin DataModule1.sp_tourney.StoredProcName: ='SP_ADD_PLAYER'; DataModule1.sp_tourney.ParamByName('new_fam').AsString: =trim(edt_fam.Text); DataModule1.sp_tourney.ParamByName('new_name').AsString: =trim(edt_name.Text); DataModule1.sp_tourney.ParamByName('new_sex').AsString: =trim(edt_sex.Text); DataModule1.sp_tourney.ParamByName('new_bd').AsDate: =StrToDate(trim(edt_birthday.Text)); DataModule1.sp_tourney.ParamByName('new_tel').AsString: =trim(edt_tel.Text); DataModule1.sp_tourney.ParamByName('new_club').AsSmallInt: =cmb_club.KeyValue; end else begin DataModule1.sp_tourney.StoredProcName: ='SP_RED_PLAYER'; DataModule1.sp_tourney.ParamByName('red_player').AsInteger: =cur_id; DataModule1.sp_tourney.ParamByName('new_fam').AsString: =trim(edt_Fam.text); DataModule1.sp_tourney.ParamByName('new_name').AsString: =trim(edt_name.Text); DataModule1.sp_tourney.ParamByName('new_sex').AsString: =trim(edt_sex.Text); DataModule1.sp_tourney.ParamByName('new_bd').AsDate: =StrToDate(trim(edt_birthday.Text)); DataModule1.sp_tourney.ParamByName('new_tel').AsString: =trim(edt_tel.Text); DataModule1.sp_tourney.ParamByName('new_club').AsSmallInt: =cmb_club.KeyValue; end; DataModule1.sp_tourney.Prepare; DataModule1.sp_tourney.ExecProc; DataModule1.tr_golf.Commit; DataModule1.qr_reg.Open; fm_play.close; end; end;
end.
unit fm_poisk;
interface
uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, DBCtrls, ComObj, jpeg, ExtCtrls;
type Tfm_choose = class(TForm) lb_find: TLabel; cmb_Tourney: TDBLookupComboBox; btn_Ok: TButton; img_back: TImage; procedure FormActivate(Sender: TObject); procedure btn_OkClick(Sender: TObject); private { Private declarations } public { Public declarations } end;
var fm_choose: Tfm_choose; excel_golf, //ó ê à ç à ò å ë ü í à OLE-î á ú å ê ò ò è ï à Excel excel_book: variant; //ó ê à ç à ò å ë ü í à ê í è ã ó excel kol, n, m, place: integer;
implementation
uses dm, menu, DB;
{$R *.dfm}
procedure Tfm_choose.FormActivate(Sender: TObject); begin DataModule1.tb_tourney.Open; while not(DataModule1.tb_tourney.Eof) do DataModule1.tb_tourney.Next; end;
procedure Tfm_choose.btn_OkClick(Sender: TObject); begin if Choose=1 then begin if cmb_Tourney.Text='' then MessageDlg('Â û á å ð è ò å ò ó ð í è ð ', mtWarning, [mbOK], 0) else begin DataModule1.qr_reg.SQL.Clear; DataModule1.qr_reg.SQL.Text: ='SELECT TB_REG.ID_REG, TB_PLAYER.FAM_PLAYER, TB_PLAYER.NAME_PLAYER, TB_CLUB.NAME_CLUB, COUNT( TB_RESULT.NUM_HOLE ) COUNT_OF_NUM_HOLE, '+ 'TB_GROUP.NAME_GROUP, TB_REG.PLACE_REG, TB_REG.NUM_TOURNEY, TB_PLAYER.BD_PLAYER, TB_PLAYER.SEX_PLAYER, TB_PLAYER.TEL, '+ 'TB_REG.ID_GROUP, TB_PLAYER.ID_CLUB, TB_PLAYER.ID_PLAYER, TB_REG.YEAR_REG, TB_REG.SCORE_REG, TB_REG.KOEF_REG FROM TB_RESULT '+ 'INNER JOIN TB_REG ON (TB_RESULT.ID_REG = TB_REG.ID_REG) '+ 'INNER JOIN TB_PLAYER ON (TB_REG.ID_PLAYER = TB_PLAYER.ID_PLAYER) '+ 'INNER JOIN TB_CLUB ON (TB_PLAYER.ID_CLUB = TB_CLUB.ID_CLUB) '+ 'INNER JOIN TB_GROUP ON (TB_REG.ID_GROUP = TB_GROUP.ID_GROUP) '+ 'where TB_REG.NUM_TOURNEY='+vartostr(cmb_Tourney.KeyValue)+ ' GROUP BY TB_REG.ID_REG, TB_PLAYER.FAM_PLAYER, TB_PLAYER.NAME_PLAYER, TB_CLUB.NAME_CLUB, TB_GROUP.NAME_GROUP, TB_REG.PLACE_REG, TB_REG.NUM_TOURNEY, '+ 'TB_PLAYER.BD_PLAYER, TB_PLAYER.SEX_PLAYER, TB_PLAYER.TEL, TB_GROUP.NAME_GROUP, TB_REG.ID_GROUP, TB_REG.ID_REG, TB_PLAYER.ID_CLUB, TB_PLAYER.ID_PLAYER, TB_REG.YEAR_REG, TB_REG.SCORE_REG, TB_REG.PLACE_REG, TB_REG.KOEF_REG '+ 'order by TB_REG.KOEF_REG'; DataModule1.qr_reg.Open; if DataModule1.qr_reg.IsEmpty then MessageDlg('Ä à í í û õ ï î ò ó ð í è ð ó í å í à é ä å í î ', mtWarning, [mbOK], 0) else begin excel_golf: =createOLEObject('Excel.sheet'); excel_book: =excel_golf.application; DataModule1.qr_title.SQL.Clear; DataModule1.qr_title.SQL.Text: ='SELECT TB_WHERE.NAME_WHERE, TB_TOURNEY.DATE_TOURNEY, TB_TOURNEY.NUM_TOURNEY, TB_TOURNEY.HOLE_TOURNEY '+ 'FROM TB_TOURNEY INNER JOIN TB_WHERE ON (TB_TOURNEY.ID_WHERE = TB_WHERE.ID_WHERE) '+ 'where TB_TOURNEY.NUM_TOURNEY='+VarToStr(cmb_Tourney.KeyValue); datamodule1.qr_title.open; // excel_book.range['A1'].Font.color: ='342144';
excel_book.range['A1'].value: =('Ð å ç ó ë ü ò à ò û ò ó ð í è ð à " '+trim(cmb_Tourney.Text)+'" '); excel_book.range['A2'].value: ='Ì å ñ ò î ï ð î â å ä å í è ÿ: '+trim((DataModule1.qr_title.FieldByName('name_where').AsString))+', Ä à ò à: '+trim((DataModule1.qr_title.FieldByName('Date_Tourney').AsString));
excel_book.Range['A1: W1'].Select; excel_book.selection.MergeCells: =true; excel_book.selection.font.name: ='Arial Black'; excel_book.selection.font.size: =14; excel_book.selection.HorizontalAlignment: =3;
excel_book.Range['A2: W2'].Select; excel_book.selection.MergeCells: =true; excel_book.selection.font.name: ='Arial Black'; excel_book.selection.font.size: =10; excel_book.selection.font.bold: =true; excel_book.selection.HorizontalAlignment: =3;
DataModule1.qr_reg.First;
excel_book.Range['A4: CA100'].HorizontalAlignment: =3; excel_book.range['A4'].value: =('¹ '); excel_book.range['A4'].columnwidth: =45/10; excel_book.range['B4'].value: =('Ó ÷ à ñ ò í è ê '); excel_book.range['B4'].columnwidth: =25; excel_book.range['C4'].value: =('Ê ë ó á '); excel_book.range['C4'].columnwidth: =11; n: =3; m: =0; while (DataModule1.qr_title.FieldByName('HOLE_TOURNEY').AsInteger)< > m do begin m: =m+1; n: =n+1; Excel_book.Cells[4, n].value: =m; excel_book.cells[4, n].columnwidth: =3; end; n: =n+1; excel_book.cells[4, n].value: ='È ò î ã î '; n: =n+1; excel_book.cells[4, n].value: ='Ì å ñ ò î '; DataModule1.tb_group.First; n: =4; while not(DataModule1.tb_group.Eof) do begin m: =1; DataModule1.qr_reg.First; place: =1; while not(DataModule1.qr_reg.Eof) do begin if DataModule1.tb_group.FieldByName('id_group').Value=DataModule1.qr_reg.FieldByName('id_group').value then begin DataModule1.qr_result.SQL.Clear; DataModule1.qr_result.SQL.Text: ='SELECT TB_RESULT.NUM_HOLE, TB_RESULT.HOLE, TB_RESULT.ID_REG '+ 'FROM TB_RESULT where TB_RESULT.ID_REG='+DataModule1.qr_reg.fieldbyname('ID_REG').AsString; DataModule1.qr_result.Open; if m=1 then begin n: =n+1; excel_book.range['B'+inttostr(n)].value: =DataModule1.tb_group.FieldByName('name_group').CurValue; excel_book.range['B'+inttostr(n)].font.size: =12; n: =n+1; excel_book.range['A'+inttostr(n)].value: =m; m: =m+1; excel_book.range['B'+inttostr(n)].value: =''+DataModule1.qr_reg.FieldByName('FAM_PLAYER').CurValue+' '+DataModule1.qr_reg.FieldByName('NAME_PLAYER').AsString; excel_book.range['B'+inttostr(n)].HorizontalAlignment: =2; excel_book.range['C'+inttostr(n)].value: =DataModule1.qr_reg.FieldByName('NAME_CLUB').CurValue; kol: =4; DataModule1.qr_result.First; while not(DataModule1.qr_result.Eof) do begin excel_book.cells[n, kol].value: =DataModule1.qr_result.FieldByName('hole').AsInteger; DataModule1.qr_result.Next; kol: =kol+1; end; excel_book.cells[n, kol].value: =DataModule1.qr_Reg.FieldByName('SCORE_REG').AsInteger; excel_book.cells[n, kol+1].value: =place; inc(place); DataModule1.qr_reg.Next; end else begin n: =n+1; excel_book.range['A'+inttostr(n)].value: =m; m: =m+1; excel_book.range['B'+inttostr(n)].value: =''+DataModule1.qr_reg.FieldByName('FAM_PLAYER').CurValue+' '+DataModule1.qr_reg.FieldByName('NAME_PLAYER').AsString; excel_book.range['B'+inttostr(n)].HorizontalAlignment: =2; excel_book.range['C'+inttostr(n)].value: =DataModule1.qr_reg.FieldByName('NAME_CLUB').CurValue; kol: =4; while not(DataModule1.qr_result.Eof) do begin excel_book.cells[n, kol].value: =DataModule1.qr_result.FieldByName('hole').AsInteger; DataModule1.qr_result.Next; kol: =kol+1; end; excel_book.cells[n, kol].value: =DataModule1.qr_Reg.FieldByName('SCORE_REG').AsInteger; excel_book.cells[n, kol+1].value: =place; inc(place); DataModule1.qr_reg.Next; end; end else DataModule1.qr_reg.Next; end; DataModule1.tb_group.Next; end; excel_book.range[excel_book.cells[4, 1], excel_book.cells[n, kol+1]].select; excel_book.selection.Borders.LineStyle: =1; excel_book.selection.font.bold: =true; excel_book.selection.font.name: ='Arial'; excel_book.range['A1'].select; excel_book.Visible: =true; end; end; end; if choose=2 then begin if cmb_Tourney.Text='' then MessageDlg('Â û á å ð è ò å ò ó ð í è ð ', mtWarning, [mbOK], 0) else begin DataModule1.qr_reg.SQL.Clear; DataModule1.qr_reg.SQL.Text: ='SELECT TB_TOURNEY.NUM_TOURNEY, TB_PLAYER.FAM_PLAYER, TB_PLAYER.NAME_PLAYER, TB_CLUB.NAME_CLUB, '+ 'TB_GROUP.NAME_GROUP, TB_REG.SCORE_REG, TB_REG.HOLE_REG, TB_REG.KOEF_REG, TB_REG.PLACE_REG, TB_REG.RATING_REG, TB_REG.ID_REG FROM TB_GROUP '+ 'INNER JOIN TB_REG ON (TB_GROUP.ID_GROUP = TB_REG.ID_GROUP) '+ 'INNER JOIN TB_TOURNEY ON (TB_REG.NUM_TOURNEY = TB_TOURNEY.NUM_TOURNEY) '+ 'INNER JOIN TB_PLAYER ON (TB_REG.ID_PLAYER = TB_PLAYER.ID_PLAYER) '+ 'INNER JOIN TB_CLUB ON (TB_PLAYER.ID_CLUB = TB_CLUB.ID_CLUB) '+ 'WHERE TB_REG.NUM_TOURNEY = TB_TOURNEY.NUM_TOURNEY ORDER BY TB_REG.KOEF_REG'; DataModule1.qr_reg.Open; if DataModule1.qr_reg.IsEmpty then MessageDlg('Ä à í í û õ ï î ò ó ð í è ð ó í å í à é ä å í î ', mtWarning, [mbOK], 0) else begin excel_golf: =createOLEObject('Excel.sheet'); excel_book: =excel_golf.application;
DataModule1.qr_title.SQL.Clear; DataModule1.qr_title.SQL.Text: ='SELECT TB_WHERE.NAME_WHERE, TB_TOURNEY.DATE_TOURNEY, TB_TOURNEY.NUM_TOURNEY, TB_TOURNEY.HOLE_TOURNEY '+ 'FROM TB_TOURNEY INNER JOIN TB_WHERE ON (TB_TOURNEY.ID_WHERE = TB_WHERE.ID_WHERE) '+ 'where TB_TOURNEY.NUM_TOURNEY='+VarToStr(cmb_Tourney.KeyValue); datamodule1.qr_title.open;
//excel_book.range['A1'].Font.color: ='342144'; excel_book.range['A1'].value: =('Ð å é ò è í ã ó ÷ à ñ ò í è ê î â " '+trim(cmb_Tourney.Text)+'" '); excel_book.range['A2'].value: ='Ì å ñ ò î ï ð î â å ä å í è ÿ: '+trim((DataModule1.qr_title.FieldByName('name_where').AsString))+', Ä à ò à: '+trim((DataModule1.qr_title.FieldByName('Date_Tourney').AsString));
excel_book.Range['A1: I1'].Select; excel_book.selection.MergeCells: =true; excel_book.selection.font.name: ='Arial Black'; excel_book.selection.font.size: =12; excel_book.selection.HorizontalAlignment: =3;
excel_book.Range['A2: I2'].Select; excel_book.selection.MergeCells: =true; excel_book.selection.font.name: ='Arial'; excel_book.selection.font.size: =12; excel_book.selection.HorizontalAlignment: =2;
excel_book.Range['A3: I100'].HorizontalAlignment: =3; excel_book.range['A3'].value: ='¹ '; excel_book.range['A3'].columnwidth: =45/10; excel_book.range['B3'].value: ='Ó ÷ à ñ ò í è ê '; excel_book.range['B3'].columnwidth: =24; excel_book.range['C3'].value: ='Ê ë ó á '; excel_book.range['C3'].columnwidth: =18; excel_book.range['D3'].value: ='Ã ð ó ï ï à '; excel_book.range['D3'].columnwidth: =10; excel_book.range['E3'].value: ='Á à ë ë '; excel_book.range['E3'].columnwidth: =7; excel_book.range['F3'].value: ='Õ î ó ë '; excel_book.range['F3'].columnwidth: =7; excel_book.range['G3'].value: ='Ê î ý ô -ò '; excel_book.range['G3'].columnwidth: =10; excel_book.range['H3'].value: ='Ì å ñ ò î '; excel_book.range['C3'].columnwidth: =10; excel_book.range['I3'].value: ='Ð å é ò è í ã '; excel_book.range['I3'].columnwidth: =10; excel_book.range['A3: I3'].font.size: =13; DataModule1.qr_reg.First; n: =4; m: =1; while not (DataModule1.qr_reg.Eof) do begin excel_book.range['A'+IntToStr(n)].value: =m; excel_book.range['B'+inttostr(n)].value: =''+DataModule1.qr_reg.FieldByName('FAM_PLAYER').CurValue+' '+DataModule1.qr_reg.FieldByName('NAME_PLAYER').CurValue; excel_book.range['B'+inttostr(n)].HorizontalAlignment: =2; excel_book.range['C'+inttostr(n)].value: =DataModule1.qr_reg.FieldByName('NAME_CLUB').CurValue; excel_book.range['D'+inttostr(n)].value: =DataModule1.qr_reg.FieldByName('NAME_GROUP').CurValue; excel_book.range['E'+inttostr(n)].value: =DataModule1.qr_reg.FieldByName('SCORE_REG').CurValue; excel_book.range['F'+inttostr(n)].value: =DataModule1.qr_reg.FieldByName('HOLE_REG').CurValue; // excel_book.range['G'+inttostr(n)].NumberFormat: = '0.00'; excel_book.range['G'+inttostr(n)].select; excel_book.selection.NumberFormat: = '@'; excel_book.range['G'+inttostr(n)].value: =DataModule1.qr_reg.FieldByName('KOEF_REG').AsString; excel_book.range['H'+inttostr(n)].value: =DataModule1.qr_reg.FieldByName('PLACE_REG').CurValue; excel_book.range['I'+inttostr(n)].select; excel_book.selection.NumberFormat: = '@'; excel_book.range['I'+inttostr(n)].value: =DataModule1.qr_reg.FieldByName('RATING_REG').AsString; inc(n); inc(m); DataModule1.qr_reg.Next; end; excel_book.range['A3: I'+inttostr(n-1)].select; excel_book.selection.Borders.LineStyle: =1; excel_book.selection.font.bold: =true; excel_book.range['A1'].select; excel_book.Visible: =true; end; end; end; end;
end.
unit fm_protokol;
interface
uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, DBCtrls, StdCtrls, Mask, ExtCtrls, Grids, DBGrids, DB, jpeg;
type Tfm_prot = class(TForm) lb_nameTourney: TLabel; lb_where: TLabel; lb_dateTourney: TLabel; nvg_tourney: TDBNavigator; nvg_player: TDBNavigator; btn_newResults: TButton; gr_players: TDBGrid; gr_result: TDBGrid; btn_DoIt: TButton; btn_result: TButton; btn_close: TButton; lb_cap: TLabel; edt_tourney: TDBEdit; edt_where: TDBEdit; edt_date: TDBEdit; img_back: TImage; procedure btn_newResultsClick(Sender: TObject); procedure FormActivate(Sender: TObject); procedure nvg_playerClick(Sender: TObject; Button: TNavigateBtn); procedure nvg_tourneyClick(Sender: TObject; Button: TNavigateBtn); procedure btn_DoItClick(Sender: TObject); procedure btn_enable; procedure btn_resultClick(Sender: TObject); procedure btn_closeClick(Sender: TObject); private { Private declarations } public { Public declarations } end;
var fm_prot: Tfm_prot; mark_result, mark_tourney, mark_player: TBookmark;
Популярное:
|
Последнее изменение этой страницы: 2016-07-12; Просмотров: 596; Нарушение авторского права страницы