81
showmessage('Записано');
rzbitbtn1.Click;
with form1.ADOQuery2 do
begin
close;
sql.Clear;
sql.Add('select * from spc where
fio='+form1.Label1.Caption+trim(form7.adoquery1fio.AsString)+form1.Label1.Caption);
open;
end;
excelapp.cells[3,3]:=form7.ADOQuery1fio.AsString;
excelapp.cells[4,3]:=datetostr(datetimepicker1.DateTime)+' '+form7.ADOQuery1chm.AsString;
excelapp.cells[5,3]:=form1.ADOQuery2cab.AsString;
excelapp.cells[6,3]:=form1.ADOQuery2tel.AsString;
excelapp.cells[9,1]:=form1.ADOQuery4fio.AsString;
excelapp.cells[10,1]:=form1.ADOQuery4adr.AsString;
excelapp.visible:=true;
excelapp:=unassigned;
end
else showmessage('Не выбрано время, либо выбрано более одной позиции');
end;
end.
procedure TForm8.RzBitBtn1Click(Sender: TObject);
var year1,mon1,dt1:word; m1,d1:string[2]; day1,qq:string[20]; excelapp:variant; i:integer;
begin
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;
with form8.ADOQuery1 do
begin
close;
sql.Clear;
sql.Add('SELECT gur_prm.day, clients.fio, vid_usl.nam, vrem.chm FROM vrem INNER JOIN
(vid_usl INNER JOIN (clients INNER JOIN gur_prm ON clients.code_cli = gur_prm.code_cli) ON vid_usl.code =
gur_prm.code_usl) ON vrem.code_vr = gur_prm.code_vr ');
sql.Add('where (gur_prm.code_cli>1) and
(gur_prm.day=(convert(datetime,'+form1.label1.caption+datetostr(datetimepicker1.date)+form1.Label1.Caption+',1
04))) and (gur_prm.code_spc='+form1.ADOQuery2code_spc.AsString+') order by gur_prm.code_vr');
open;
end;
ExcelApp := CreateOleObject('Excel.Application');
ExcelApp.workbooks.open('C:\uch_usl\xlt\rasp.xlt');
ExcelApp.Visible := False;
for i:=1 to form8.ADOQuery1.RecordCount do
begin
excelapp.cells[8+i,1]:=form8.ADOQuery1chm.AsString;
excelapp.cells[8+i,1].borders.linestyle:=1;
excelapp.cells[8+i,2]:=form8.ADOQuery1fio.AsString;
excelapp.cells[8+i,2].borders.linestyle:=1;
excelapp.cells[8+i,3]:=form8.ADOQuery1nam.AsString;
excelapp.cells[8+i,3].borders.linestyle:=1;
form8.ADOQuery1.Next;
end;
excelapp.cells[3,2]:=form8.ADOQuery1day.AsString;
excelapp.cells[4,1]:='ФИО специалиста: '+trim(form1.ADOQuery2fio.AsString);
excelapp.cells[5,2]:=form1.ADOQuery2dolgn.AsString;
excelapp.cells[6,2]:=form1.ADOQuery2cab.AsString;
excelapp.visible:=true;
excelapp:=unassigned;
end;