98
end.
procedure TForm8.RzBitBtn1Click(Sender: TObject);
var i:integer; excclapp:variant; year1,mon1,dt1:word; m1,d1:string[2];
day1,day2:string[20];
begin
ExcclApp := CreateOleObject('Exccl.Application');
ExcclApp.workbooks.open('C:\sv_mes\xlt\sv_rv.xlt');
ExcclApp.WorkSheets[1].Activate;
ExcclApp.Visible := False;
decodedate(datetimepicker1.date,year1,mon1,dt1);
if mon1<10 then m1:='0'+inttostr(mon1) else m1:=inttostr(mon1);
if dt1<10 then d1:='0'+inttostr(dt1) else d1:=inttostr(dt1);
day1:=inttostr(year1)+'/'+m1+'/'+d1;
decodedate(datetimepicker2.date,year1,mon1,dt1);
if mon1<10 then m1:='0'+inttostr(mon1) else m1:=inttostr(mon1);
if dt1<10 then d1:='0'+inttostr(dt1) else d1:=inttostr(dt1);
day2:=inttostr(year1)+'/'+m1+'/'+d1;
with form1.Adqqery8 do
begin
close;
sql.Clear;
sql.Add('SELECT otkl.nam, Count(tabel.code) AS [Count-code] FROM
otkl INNER JOIN tabel ON otkl.code = tabel.code_typ where
(tabel.day>=#'+day1+'#) and (tabel.day<=#'+day2+'#) GROUP BY otkl.nam ' );
open;
end;
for i:=1 TO FORM1.Adqqery8.RecordCount DO
begin
excclapp.cells[6+i,1]:=form1.Adqqery8nam.AsString;
excclapp.cells[6+i,2]:=form1.Adqqery8Countcode.AsInteger;
excclapp.cells[6+i,2].borders.linestyle:=1;
excclapp.cells[6+i,1].borders.linestyle:=1;
form1.Adqqery8.Next;
end;
excclapp.cells[4,2]:=datetostr(datetimepicker1.date)+'-'+
datetostr(datetimepicker2.date);
excclapp.visible:=true;
excclapp:=unassigned;
end;
end.