Arreglado un fallo de renumerar la posición al copiar y pegar texto desde el portapapeles.
git-svn-id: https://192.168.0.254/svn/Proyectos.Tecsitel_FactuGES2/trunk@664 0c75b7a4-871f-7646-8a2f-f78d34cc349f
This commit is contained in:
parent
d9ef45bec8
commit
8b6a55d9ad
@ -47,21 +47,33 @@ end;
|
|||||||
|
|
||||||
procedure RenumerarCampoPosicion(ADataSet : TDataSet);
|
procedure RenumerarCampoPosicion(ADataSet : TDataSet);
|
||||||
var
|
var
|
||||||
iContador : Integer;
|
i, j : Integer;
|
||||||
AField : TField;
|
AField : TField;
|
||||||
begin
|
begin
|
||||||
AField := ADataSet.FindField('POSICION');
|
AField := ADataSet.FindField('POSICION');
|
||||||
if Assigned(AField) and not (ADataSet.IsEmpty) then
|
if Assigned(AField) and not (ADataSet.IsEmpty) then
|
||||||
begin
|
begin
|
||||||
ADataSet.Last;
|
with ADataSet do
|
||||||
iContador := ADataSet.RecordCount;
|
begin
|
||||||
repeat
|
for i:=0 to RecordCount-1 do
|
||||||
ADataSet.Edit;
|
begin
|
||||||
AField.AsInteger := iContador - 1;
|
First;
|
||||||
ADataSet.Post;
|
if not Locate('POSICION', i, []) then
|
||||||
AdataSet.Prior;
|
begin
|
||||||
iContador := iContador - 1;
|
j := i;
|
||||||
until ADataSet.BOF;
|
First;
|
||||||
|
while not Locate('POSICION', j, []) do
|
||||||
|
begin
|
||||||
|
Inc(j);
|
||||||
|
First;
|
||||||
|
end;
|
||||||
|
|
||||||
|
Edit;
|
||||||
|
FieldByName('POSICION').AsInteger := i;
|
||||||
|
Post;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -158,21 +170,30 @@ begin
|
|||||||
if bEstabaVacia then
|
if bEstabaVacia then
|
||||||
ADataSet.Append
|
ADataSet.Append
|
||||||
else begin
|
else begin
|
||||||
if iContador > 0 then
|
if iContador = 0 then
|
||||||
|
ADataSet.Edit
|
||||||
|
else begin
|
||||||
ADataSet.Next;
|
ADataSet.Next;
|
||||||
ADataSet.Insert;
|
if ADataSet.EOF then
|
||||||
|
ADataSet.Append
|
||||||
|
else
|
||||||
|
ADataSet.Insert;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
try
|
try
|
||||||
for iCols := 0 to NumCols - 1 do
|
for iCols := 0 to NumCols - 1 do
|
||||||
begin
|
begin
|
||||||
AValue := AReader.ReadVariant;
|
AValue := AReader.ReadVariant;
|
||||||
if (Pos(AValueNameList[iCols], AView.DataController.KeyFieldNames) = 0) then
|
if (Pos(AValueNameList[iCols], AView.DataController.KeyFieldNames) = 0) and
|
||||||
|
(AValueNameList[iCols] <> 'POSICION') then
|
||||||
|
begin
|
||||||
if _BuscarColumna(AView, AValueNameList[iCols], AValueTypeList[iCols], AIndex) then
|
if _BuscarColumna(AView, AValueNameList[iCols], AValueTypeList[iCols], AIndex) then
|
||||||
begin
|
begin
|
||||||
if AIndex <> -1 then
|
if AIndex <> -1 then
|
||||||
ADataSet.FieldByName(AView.DataController.GetItemField(AIndex).FieldName).Value := AValue;
|
ADataSet.FieldByName(AView.DataController.GetItemField(AIndex).FieldName).Value := AValue;
|
||||||
end;
|
end;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
finally
|
finally
|
||||||
ADataSet.Post;
|
ADataSet.Post;
|
||||||
@ -564,9 +585,15 @@ begin
|
|||||||
if bEstabaVacia then
|
if bEstabaVacia then
|
||||||
ADataSet.Append
|
ADataSet.Append
|
||||||
else begin
|
else begin
|
||||||
{if iContador > 0 then
|
if iContador = 0 then
|
||||||
ADataSet.Next;}
|
ADataSet.Edit
|
||||||
ADataSet.Insert;
|
else begin
|
||||||
|
ADataSet.Next;
|
||||||
|
if ADataSet.EOF then
|
||||||
|
ADataSet.Append
|
||||||
|
else
|
||||||
|
ADataSet.Insert;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
try
|
try
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user