-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathQRORDER0.PAS
129 lines (110 loc) · 3.55 KB
/
QRORDER0.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
{ QuickReport mailing labels form }
unit Qrorder0;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Qrctrls, quickrpt, qrextra, DB, DBTables, ExtCtrls,
StdCtrls, mask, ToolEdit;
type
TFormQReport0 = class(TQuickRep)
DetailBand1: TQRBand;
QRLabel1: TQRLabel;
QRLabel3: TQRLabel;
QRLabel4: TQRLabel;
ChildBand1: TQRChildBand;
QRImage1: TQRImage;
DetailBand2: TQRBand;
QRSysData1: TQRSysData;
QRLabel10: TQRLabel;
procedure FormQReportBeforePrint(Sender: TQuickRep;
var PrintReport: Boolean);
procedure ChildBand1BeforePrint(Sender: TQRCustomBand;
var PrintBand: Boolean);
procedure CreateLabels;
private
{ Private declarations }
public
{ Public declarations }
RowCounter, MaxCols: integer;
DataLabels: array[0..199] of TQRLabel;
SafeToRun : boolean;
end;
var
FormQReport0: TFormQReport0;
implementation
uses export1, protocol;
{$R *.DFM}
procedure TFormQReport0.FormQReportBeforePrint(Sender: TQuickRep;
var PrintReport: Boolean);
begin
IF FormExport1.CheckBox1.Checked then
if FileExists('detapro.bmp') then
QRImage1.Picture.LoadFromFile('detapro.bmp');
ChildBand1.Enabled:=FormExport1.CheckBox1.Checked;
end;
procedure TFormQReport0.ChildBand1BeforePrint(Sender: TQRCustomBand;
var PrintBand: Boolean);
begin
ChildBand1.Height := QRImage1.Height+10;
end;
procedure TFormQReport0.CreateLabels;
var
i, nIdx, pIdx: integer;
FromTop, FromLeft: integer;
begin
pIdx := 0;
FromTop := 10;
FromLeft := 20;
// íà 200 ºëåìåíòîâ !!!
for i:=0 to 199 do
for nIdx:=0 to FormProtocol.ComponentCount - 1 do
IF (1 = StrToIntDef(Copy(FormProtocol.Components[nIdx].Name,2,1), -1) ) then
IF (i = StrToIntDef(Copy(FormProtocol.Components[nIdx].Name,3,3), -1) ) then
begin
DataLabels[pIdx] := TQRLabel.Create(Self);
with DataLabels[pIdx] do
begin
Alignment := taLeftJustify;
Color := clWhite;
Parent := DetailBand2;
AlignToBand := False;
Height := Parent.Height;
Autosize := True;
WordWrap := True;
if (FormProtocol.Components[nIdx] is TLabel) then
begin
Caption := (FormProtocol.Components[nIdx] as TLabel).Caption;
if ((FormProtocol.Components[nIdx] as TLabel).Font.Style =
[fsBold, fsUnderline]) then
begin
// ïåðåõîä íà íîâóþ ñòðîêó ïî òîëñòîé ìåòêå
FromLeft:=10;
FromTop := FromTop + 15;
end;
end;
if (FormProtocol.Components[nIdx] is TEdit) then
Caption := (FormProtocol.Components[nIdx] as TEdit).Text;
if (FormProtocol.Components[nIdx] is TComboBox) then
Caption := (FormProtocol.Components[nIdx] as TComboBox).Text;
if (FormProtocol.Components[nIdx] is TMaskEdit) then
Caption := (FormProtocol.Components[nIdx] as TMaskEdit).Text;
if (FormProtocol.Components[nIdx] is TDateEdit) then
Caption := (FormProtocol.Components[nIdx] as TDateEdit).Text;
if (FormProtocol.Components[nIdx] is TMemo) then
Caption := (FormProtocol.Components[nIdx] as TMemo).Text;
Top := FromTop;
Left := FromLeft;
FromLeft:=FromLeft + DataLabels[pIdx].Width + 20;
IF ((FromLeft + FormExport1.SpinEdit1.Value) >= DetailBand2.Width) then
// IF ((FromLeft + 250) >= DetailBand2.Width) then
// ïåðåõîä íà íîâóþ ñòðîêó ïî ïðåâ³øåíèþ äëèí³ ñòðîêè
begin
FromLeft:=10;
FromTop := FromTop + 15;
end;
end;
Inc(pIdx);
end;
SafeToRun := True;
end;
end.