DM.dstPlaces2.Sort := 'Наименование';
D
M
d
s
t
P
l
a
c
e
s
F
i
r
s
t
Цикл по раб. местам:
while not DM.dstPlaces2.Eof do
//Определение списка устройств на текущем раб. месте:
DM.dstDevicesAtPlace.Close;
DM.dstDevicesAtPlace.Parameters.ParamByName('pRM').Value :=
DM.dstPlaces2.FieldByName('ID').AsInteger;
//Данные по раб. месту выводим только если к нему приписаны какие-либо
устройства:
if DM.dstDevicesAtPlace.RecordCount > 0 then
begin
Caption := DM.dstPlaces2.FieldByName('Наименование').AsString;
if DM.dstPlaces2.FieldByName('СетевоеИмя').AsString <> '' then
Caption := Caption + ' (' + DM.dstPlaces2.FieldByName('СетевоеИмя').AsString +
')';
Excel.Cells[i,1] := Caption;
Excel.Cells[i,1].Font.Bold := True;
Excel.Cells[i,1].Font.Size := 12;
Inc(i);
//Заголовки столбцов:
Excel.Cells[i,2] := 'Инв. №';
Excel.Cells[i,3] := 'Устройство';
Excel.Cells[i,4] := 'Дата размещения';
Excel.Cells[i,3].ColumnWidth := 50;
Excel.Cells[i,2].Font.Bold := True;
Excel.Cells[i,3].Font.Bold := True;
Excel.Cells[i,4].Font.Bold := True;
Inc(i);
DM.dstDevicesAtPlace.First;
//Цикл по устройствам на раб. месте:
while not DM.dstDevicesAtPlace.Eof do
begin
Excel.Cells[i,2] := FormatFloat('0000',
DM.dstDevicesAtPlace.FieldByName('ИнвN').AsInteger);
Excel.Cells[i,3] := DM.dstDevicesAtPlace.FieldByName('Устройство').AsString;
Excel.Cells[i,4] := DM.dstDevicesAtPlace.FieldByName('Дата').AsString;
DM.dstDevicesAtPlace.Next;
Inc(i);
end;
Inc(i, 2);
end;
DM.dstPlaces2.Next;
end; //while
DM.dstPlaces2.Close;
Excel.Application.EnableEvents := True;