ConnectionWord(self);
ItemN:=
1
;
row:=
2
;
j:=
1
;
ii:=
2
;
numLines:=
1
;
for
I :=
0
to
5
do
begin
TD:=TadoQuery
.
create(
nil
);
with
TD
do
begin
try
connection:=DataModule1
.
ADOConnection;
sql
.
Text:=Format(SQLtext,[inttostr(i),inttostr(KafCode), inttostr(LearnYear)]);
ExecSQL;
open;
if
td
.
RecordCount <
1
then
begin
if
numLines >
1
then
WDoc
.
Tables
.
Item(ItemN).Rows
.
Add(EmptyParam);
WDoc
.
Tables
.
Item(ItemN).Cell(row+numLines,j).Range
.
Text:= RazdelName(i);
numLines := numLines+
1
;
row:=row+
1
;
ii:=ii+
1
;
end
;
while
not
TD
.
Eof
do
begin
for
Ind :=
0
to
td
.
RecordCount-
1
do
begin
if
numLines >
1
then
WDoc
.
Tables
.
Item(ItemN).Rows
.
Add(EmptyParam);
WDoc
.
Tables
.
Item(ItemN).Cell(row,
2
).Range
.
Text:= td
.
FieldByName(
'Meripriyt'
).AsString;
WDoc
.
Tables
.
Item(ItemN).Cell(row,
3
).Range
.
Text:= td
.
FieldByName(
'Srok_vip'
).AsString;
WDoc
.
Tables
.
Item(ItemN).Cell(row,
4
).Range
.
Text:= td
.
FieldByName(
'Otvetstven'
).AsString;
WDoc
.
Tables
.
Item(ItemN).Cell(row,
5
).Range
.
Text:= td
.
FieldByName(
'Note'
).AsString;
td
.
Next;
numLines := numLines+
1
;
inc(row);
end
;
WDoc
.
Tables
.
Item(ItemN).Cell(i+numLines,j).Range
.
Text:= td
.
FieldByName(
'NAME_VIDDEYAT'
).AsString;
if
td
.
RecordCount >
1
then
begin
WDoc
.
Tables
.
Item(ItemN).Cell(ii,j).Merge(WDoc
.
Tables
.
Item(ItemN).Cell(
1
+numLines,j));
ii:= numLines+
1
;
end
;
ii:= numLines+
1
;
end
;
finally
Free;
end
;
WApp
.
Visible :=
true
;
end
;