PageRenderTime 9ms CodeModel.GetById 2ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/Demos/REPORTS/UNIT5.PAS

http://github.com/FastReports/FreeReport
Pascal | 97 lines | 76 code | 18 blank | 3 comment | 2 complexity | d3b1d8ecc69e32e397fe233312c60d47 MD5 | raw file
 1unit Unit5;
 2
 3interface
 4
 5uses
 6  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
 7  FR_DSet, FR_Class;
 8
 9type
10  TForm5 = class(TForm)
11    frReport1: TfrReport;
12    CrossRowDataset: TFRUserDataset;
13    CrossColumnDataset: TFRUserDataset;
14    procedure CrossRowDatasetFirst(Sender: TObject);
15    procedure CrossRowDatasetNext(Sender: TObject);
16    procedure CrossRowDatasetCheckEOF(Sender: TObject; var EOF: Boolean);
17    procedure CrossColumnDatasetFirst(Sender: TObject);
18    procedure CrossColumnDatasetNext(Sender: TObject);
19    procedure CrossColumnDatasetCheckEOF(Sender: TObject;
20      var EOF: Boolean);
21    procedure frReport1GetValue(const ParName: string;
22      var ParValue: Variant);
23    procedure FormCreate(Sender: TObject);
24  private
25    { Private declarations }
26  public
27    { Public declarations }
28    procedure StartReport;
29  end;
30
31var
32  Form5: TForm5;
33
34implementation
35
36uses datasets, Unit2;
37
38{$R *.DFM}
39
40var i, j: Integer;
41    RowCount, ColCount: Integer;
42
43procedure TForm5.FormCreate(Sender: TObject);
44begin
45  ColCount := 16; RowCount := 20;
46end;
47
48procedure TForm5.StartReport;
49begin
50  if Form2.ShowModal = mrOk then
51  begin
52    ColCount := StrToInt(Form2.Edit1.Text);
53    RowCount := StrToInt(Form2.Edit2.Text);
54    frReport1.ShowReport;
55  end;
56end;
57
58procedure TForm5.CrossRowDatasetFirst(Sender: TObject);
59begin
60  i := 0;
61end;
62
63procedure TForm5.CrossRowDatasetNext(Sender: TObject);
64begin
65  Inc(i);
66end;
67
68procedure TForm5.CrossRowDatasetCheckEOF(Sender: TObject;
69  var EOF: Boolean);
70begin
71  EOF := EOF or (i >= RowCount);
72end;
73
74procedure TForm5.CrossColumnDatasetFirst(Sender: TObject);
75begin
76  j := 0;
77end;
78
79procedure TForm5.CrossColumnDatasetNext(Sender: TObject);
80begin
81  Inc(j);
82end;
83
84procedure TForm5.CrossColumnDatasetCheckEOF(Sender: TObject;
85  var EOF: Boolean);
86begin
87  EOF := EOF or (j >= ColCount);
88end;
89
90procedure TForm5.frReport1GetValue(const ParName: string;
91  var ParValue: Variant);
92begin
93  if AnsiUpperCase(ParName) = 'CELL' then
94    ParValue := IntToStr(i * ColCount + j + 1);
95end;
96
97end.