var
lst, i2, i4 :integer;
number, rs :string;
begin
files:=0;
for lst := 0 to FileListBox1.Items.Count-1 do
begin
//Загружаем документ EXCEL в StringGrid1 начинаем обработку
if Xls_To_StringGrid(StringGrid1, DirectoryListBox1.Directory+'\'+FileListBox1.Items[lst]) then
begin
s1:=DirectoryListBox1.Directory+'\'+FileListBox1.Items[lst];
len:=length(s1);
Application.ProcessMessages();
MyThread:=TMyThread.Create(False);
MyThread.Priority:=tpNormal;
end;
x_cab:=0;
x_rez:=0;
x_nar:=0;
x_other:=0;
x_grs:=0;
x_roa:=0;
number:='';
for i:=1 to StringGrid1.RowCount-1 do
begin
if (StringGrid1.Cells[4,i]='NarDATA-Off') or
(StringGrid1.Cells[4,i]='NarDATA-Pk') then
begin
x_nar:=x_nar+strtofloat(StringGrid1.Cells[9,i]);
end;
if (StringGrid1.Cells[4,i]='CabDATA-Pk') or
(StringGrid1.Cells[4,i]='CabDATA-Off') then
begin
x_cab:=x_cab+strtofloat(StringGrid1.Cells[9,i]);
end;
if (StringGrid1.Cells[4,i]='RezDATA-Pk') or
(StringGrid1.Cells[4,i]='RezDATA-Off') then
begin
x_rez:=x_rez+strtofloat(StringGrid1.Cells[9,i]);
end;
rs:=copy(StringGrid1.Cells[4,i], 1, 4);
if rs='RSteel' then //rsteel
begin
x_grs:=x_grs+strtofloat(StringGrid1.Cells[9,i]);
end;
if rs='Roa' then //roa
begin
x_roa:=x_roa+strtofloat(StringGrid1.Cells[9,i]);
end
else
begin
if trim(StringGrid1.Cells[9,i])='' then
begin
end
else
x_other:=x_other+strtofloat(StringGrid1.Cells[9,i]); //other
end;
for i4 := 1 to StringGrid3.RowCount-1 do
begin
if trim(StringGrid3.Cells[0,i])=trim(label3.Caption) then
number:=StringGrid3.Cells[1,i];
end;
StringGrid2.Cells[0,files]:=label3.Caption;
StringGrid2.Cells[1,files]:=number;//NAME
StringGrid2.Cells[2,files]:=FloatToStrF(x_cab, ffFixed, 15, 3); //Cab DATA
StringGrid2.Cells[3,files]:=FloatToStrF(x_nar, ffFixed, 15, 3); //Nar DATA
StringGrid2.Cells[4,files]:=FloatToStrF(x_rez, ffFixed, 15, 3); //Rez DATA
StringGrid2.Cells[5,files]:=FloatToStrF(x_grs, ffFixed, 15, 3);//RSteel DATA
StringGrid2.Cells[6,files]:=FloatToStrF(x_roa, ffFixed, 15, 3);//Roa DATA
StringGrid2.Cells[7,files]:=FloatToStrF(x_other-x_nar-x_cab-x_rez-x_grs, ffFixed, 15, 3);//Other DATA
StringGrid2.Cells[8,files]:=FloatToStrF(x_other+x_roa, ffFixed, 15, 3);;//TOTAL
stringGrid2.RowCount:=StringGrid2.RowCount+1;
progressbar2.Position:=progressbar2.Position+1;
end;
end;
for i2 := StringGrid2.RowCount-1 downto 1 do
begin
if trim(StringGrid2.Cells[2,i2])='' then // delete EMPTY rows
TDeleteGrid(StringGrid2).DeleteRow(i2);
end;
end;