-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dmRPTS.pas
133 lines (119 loc) · 3.87 KB
/
dmRPTS.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
unit dmRPTS;
interface
uses
System.SysUtils, System.Classes, dmSCM, FireDAC.Stan.Intf,
FireDAC.Stan.Option, FireDAC.Stan.Param, FireDAC.Stan.Error, FireDAC.DatS,
FireDAC.Phys.Intf, FireDAC.DApt.Intf, FireDAC.Stan.Async, FireDAC.DApt,
frxClass, frxDBSet, Data.DB, FireDAC.Comp.DataSet, FireDAC.Comp.Client,
frxDesgn, frxExportImage, frxExportBaseDialog, frxExportPDF, frxBarcode,
Vcl.BaseImageCollection, Vcl.ImageCollection, Vcl.Graphics, System.ImageList,
Vcl.ImgList, Vcl.VirtualImageList;
type
TRPTS = class(TDataModule)
qrySharedHeader: TFDQuery;
frxDBSharedHeader: TfrxDBDataset;
frxRptMembership: TfrxReport;
frxDBMember: TfrxDBDataset;
qryMember: TFDQuery;
frxPDFExport1: TfrxPDFExport;
frxBMPExport1: TfrxBMPExport;
frxJPEGExport1: TfrxJPEGExport;
frxDesigner1: TfrxDesigner;
frxBarCodeObject1: TfrxBarCodeObject;
qryINDVmember: TFDQuery;
qryPodiumGold: TFDQuery;
qryPodiumSilver: TFDQuery;
qryPodiumBronze: TFDQuery;
frxDBSilver: TfrxDBDataset;
frxDBBronze: TfrxDBDataset;
frxRptGold: TfrxReport;
frxDBGold: TfrxDBDataset;
frxRptSilver: TfrxReport;
frxRptBronze: TfrxReport;
procedure DataModuleCreate(Sender: TObject);
private
{ Private declarations }
fIsActive: boolean;
fSwimClubID: integer;
public
{ Public declarations }
procedure PrepareMembership(sdate, edate: TDATETIME; switch: boolean);
procedure PreparePodium(SessionID: integer);
end;
var
RPTS: TRPTS;
implementation
{%CLASSGROUP 'Vcl.Controls.TControl'}
uses SCMUtility, IniFiles;
{$R *.dfm}
procedure TRPTS.DataModuleCreate(Sender: TObject);
begin
// I N I T I A L I Z E P A R A M S .
fIsActive := False;
fSwimClubID := 1;
// C O N N E C T .
if Assigned(SCM) then
begin
fIsActive := True;
// CONNECTIONS DONE ON DEMAND
// if not Assigned(qryMember.Connection) then
// qryMember.Connection := SCM.scmConnection;
// if not Assigned(qryPodiumSessionGold.Connection) then
// qryPodiumSessionGold.Connection := SCM.scmConnection;
// if not Assigned(qryPodiumSessionSilver.Connection) then
// qryPodiumSessionSilver.Connection := SCM.scmConnection;
// if not Assigned(qryPodiumSessionBronze.Connection) then
// qryPodiumSessionBronze.Connection := SCM.scmConnection;
end;
end;
procedure TRPTS.PrepareMembership(sdate, edate: TDATETIME; switch: boolean);
begin
if Assigned(SCM) then
begin
if not Assigned(qryMember.Connection) then
qryMember.Connection := SCM.scmConnection;
try
if qryMember.Active then
qryMember.close;
qryMember.ParamByName('SWITCH').AsBoolean := switch;
qryMember.ParamByName('STARTDT').AsDateTime := sdate;
qryMember.ParamByName('ENDDT').AsDateTime := edate;
qryMember.Prepare;
qryMember.Open;
if qryMember.Active then
begin
// DO something
end;
finally
// qryMember.Close;
end;
end;
end;
procedure TRPTS.PreparePodium(SessionID: integer);
begin
if Assigned(SCM) then
begin
if not Assigned(qryPodiumGold.Connection) then
qryPodiumGold.Connection := SCM.scmConnection;
if qryPodiumGold.Active then
qryPodiumGold.close;
qryPodiumGold.ParamByName('SESSIONID').AsInteger := SessionID;
qryPodiumGold.Prepare;
qryPodiumGold.Open;
if not Assigned(qryPodiumSilver.Connection) then
qryPodiumSilver.Connection := SCM.scmConnection;
if qryPodiumSilver.Active then
qryPodiumSilver.close;
qryPodiumSilver.ParamByName('SESSIONID').AsInteger := SessionID;
qryPodiumSilver.Prepare;
qryPodiumSilver.Open;
if not Assigned(qryPodiumBronze.Connection) then
qryPodiumBronze.Connection := SCM.scmConnection;
if qryPodiumBronze.Active then
qryPodiumBronze.close;
qryPodiumBronze.ParamByName('SESSIONID').AsInteger := SessionID;
qryPodiumBronze.Prepare;
qryPodiumBronze.Open;
end;
end;
end.