ПРИЛОЖЕНИЕ 3
Программный код при формировании отчета «Прайс-Лист»
procedure TForm1.N12Click(Sender: TObject);
var calc:toocalc; i:integer;
begin
calc:=toocalc.Create('c:\CRMplus\Templates\pricelist.xlt');
with form1.ADOQuery5 do
begin
close;
sql.Clear;
sql.Add('select * from services order by group');
open;
end;
for i:=1 to form1.adoquery5.RecordCount do
begin
with form1.ADOQuery2 do
begin
close;
sql.Clear;
sql.Add('select * from groups where code='+form1.adoquery5group.AsString);
open;
end;
calc.Cell[5,1]:=form1.ADOQuery5.RecordCount-i+1;
calc.Cell[5,2]:=form1.adoquery5name.AsString;
calc.Cell[5,3]:=form1.adoquery2name.AsString;
calc.Cell[5,4]:=form1.ADOQuery5proisv.AsString;
form1.adoquery5.Next;
calc.InsertRow(5,true);
end;
calc.Cell[3,2]:=datetostr(now);
calc.Visible:=true;
calc.SaveAsExcel97('c:\CRMplus\files\price.xls');
end;