Приложение. Исходный код системы (по модулям).
Chart1.Enabled:=False;
DBGrid1.Enabled:=False;
RadioGroup1.Enabled:=False;
Exit;
end;
if Query1.RecordCount=0 then
begin
Application.MessageBox('В БД нет ни одной записи.','Сообщение',mb_Ok+MB_ICONASTERISK);
RadioGroup1.Enabled:=False;
Exit;
end;
try
with Query1 do
begin
First;
for i:=1 to RecordCount do
begin
if BCon='3' then
begin
blocks[1]:=FieldValues['MARK1']+FieldValues['MARK2'];
blocks[2]:=FieldValues['MARK3']+FieldValues['MARK4'];
blocks[3]:=FieldValues['MARK5']+FieldValues['MARK6'];
param[1]:=(blocks[1]+blocks[2]+blocks[3])-3*NumMarks;
param[2]:=2*(blocks[2]-0.5*(blocks[1]+blocks[3]));
param[3]:=(blocks[3]-blocks[1])+NumMarks;
end;
if Bcon='2' then
begin
blocks[1]:=FieldValues['MARK1']+FieldValues['MARK2']+FieldValues['MARK3'];
blocks[2]:=FieldValues['MARK4']+FieldValues['MARK5']+FieldValues['MARK6'];
blocks[3]:=0;
param[1]:=(blocks[1]+blocks[2])-3*NumMarks;
param[2]:=(blocks[2]-blocks[1])+NumMarks;
param[3]:=0;
end;
if Bcon='1' then
begin
blocks[1]:=FieldValues['MARK1']+FieldValues['MARK2']+FieldValues['MARK3']+FieldValues['MARK4']+FieldValues['MARK5']+FieldValues['MARK6'];
blocks[2]:=0;
blocks[3]:=0;
param[1]:=blocks[1]-NumMarks;
param[2]:=0;
param[3]:=0;
end;
Edit;
FieldValues['PARAM1']:=param[1];
FieldValues['PARAM2']:=param[2];
FieldValues['PARAM3']:=param[3];
Next;
end;
end;
except
Application.MessageBox('Неизвестная ошибка!','Ошибка',mb_Ok+MB_ICONHAND);
Exit;
end;
try
with Query1 do
begin
Active:=False;
SQL.Clear;
SQL.Add('select * from "'+Form1.Table1.TableName+'"');
SQL.Add('order by PARAM1 desc, PARAM2 desc, PARAM3 desc');
ExecSQL;
end;
DataSource1.DataSet:=Query1;
DataSource1.Enabled:=True;
DBGrid1.DataSource:=DataSource1;
DBGrid1.Enabled:=True;
Query1.Active:=True;
except
Application.MessageBox('Ошибка выполнения сортировки участников. Проверьте конфигурацию.','Ошибка',mb_Ok+MB_ICONHAND);
Exit;
end;
end;
procedure TForm5.BitBtn1Click(Sender: TObject);
begin
ModalResult:=mrOk;
end;
procedure TForm5.RadioGroup1Click(Sender: TObject);
var
SortStr:string;
begin
case RadioGroup1.ItemIndex of
0: SortStr:='order by PARAM1 desc';
1: SortStr:='order by PARAM2 desc';
2: SortStr:='order by PARAM3 desc';
3: SortStr:='order by PARAM1 desc,PARAM2 desc,PARAM3 desc';
end;
if (SortType='1') and (RadioGroup1.ItemIndex=3) then SortStr:='order by PARAM1 desc, PARAM3 desc, PARAM3 desc';
with Query1 do
begin
Active:=False;
SQL.Clear;
SQL.Add('select * from "'+Form1.Table1.TableName+'"');
SQL.Add(SortStr);
ExecSQL;
Active:=True;
end;
end;
procedure TForm5.N11Click(Sender: TObject);
var
i,j,NumI:integer;
ind,per:double;
GrPar, GrPercent, parm:array[1 200] of double;
begin
NumI:=StrToInt(FloatToStr(NumMarks));
for i:=0 to 200 do
begin
GrPar[i]:=0;
GrPercent[i]:=0;
parm[i]:=0;
end;
per:=0;
ind:=0;
Query1.First;
if Sender=N11 then
begin
for j:=1 to Query1.RecordCount do
begin
parm[j]:=Query1.FieldValues['PARAM1'];
Query1.Next;
end;
ind:=-3*NumMarks;
for i:=1 to 6*NumI+1 do
begin
for j:=1 to Query1.RecordCount do
begin
if ind=parm[j] then per:=per+1;
end;
GrPar[i]:=ind;
GrPercent[i]:=per/Query1.RecordCount;
per:=0;
ind:=ind+1;
end;
Series1.Clear;
Chart1.BottomAxis.Title.Caption:='Параметр 1';
Chart1.BottomAxis.Minimum:=-3*NumMarks;
Chart1.BottomAxis.Maximum:=ind-1;
For i:=0 to 6*NumI+1 do