Procedure SetPositionItemNumbers;
begin
try
if ccTable.RowCount > 0 then
begin
ItemStrNum := VarToStr(ccTable.GetValue(0,0));
if length(ItemStrNum) > 0 then
begin
if (strtoint(ItemStrNum) mod 10) = 0
then IncItemNumber := 10
else IncItemNumber := 1;
end else IncItemNumber := 10;
end else IncItemNumber := 10;
except
IncItemNumber := 10;
end;
ItemNumber := 0;
for i:=0 to ccTable.RowCount-1 do
begin
ItemStrNum := VarToStr(ccTable.GetValue(0,i));
if length(ItemStrNum) = 0 then
begin
ItemNumber := GetPositionMaxItemNumber + IncItemNumber;
ccTable.SetValue(0,i,inttostr(ItemNumber));
end;
end;
end;
Procedure EventOnAddRow;
begin
SetPositionItemNumbers;
end; |