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);
|
||||
var
|
||||
iContador : Integer;
|
||||
i, j : Integer;
|
||||
AField : TField;
|
||||
begin
|
||||
AField := ADataSet.FindField('POSICION');
|
||||
if Assigned(AField) and not (ADataSet.IsEmpty) then
|
||||
begin
|
||||
ADataSet.Last;
|
||||
iContador := ADataSet.RecordCount;
|
||||
repeat
|
||||
ADataSet.Edit;
|
||||
AField.AsInteger := iContador - 1;
|
||||
ADataSet.Post;
|
||||
AdataSet.Prior;
|
||||
iContador := iContador - 1;
|
||||
until ADataSet.BOF;
|
||||
with ADataSet do
|
||||
begin
|
||||
for i:=0 to RecordCount-1 do
|
||||
begin
|
||||
First;
|
||||
if not Locate('POSICION', i, []) then
|
||||
begin
|
||||
j := i;
|
||||
First;
|
||||
while not Locate('POSICION', j, []) do
|
||||
begin
|
||||
Inc(j);
|
||||
First;
|
||||
end;
|
||||
|
||||
Edit;
|
||||
FieldByName('POSICION').AsInteger := i;
|
||||
Post;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -158,21 +170,30 @@ begin
|
||||
if bEstabaVacia then
|
||||
ADataSet.Append
|
||||
else begin
|
||||
if iContador > 0 then
|
||||
if iContador = 0 then
|
||||
ADataSet.Edit
|
||||
else begin
|
||||
ADataSet.Next;
|
||||
ADataSet.Insert;
|
||||
if ADataSet.EOF then
|
||||
ADataSet.Append
|
||||
else
|
||||
ADataSet.Insert;
|
||||
end;
|
||||
end;
|
||||
|
||||
try
|
||||
for iCols := 0 to NumCols - 1 do
|
||||
begin
|
||||
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
|
||||
begin
|
||||
if AIndex <> -1 then
|
||||
ADataSet.FieldByName(AView.DataController.GetItemField(AIndex).FieldName).Value := AValue;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
finally
|
||||
ADataSet.Post;
|
||||
@ -564,9 +585,15 @@ begin
|
||||
if bEstabaVacia then
|
||||
ADataSet.Append
|
||||
else begin
|
||||
{if iContador > 0 then
|
||||
ADataSet.Next;}
|
||||
ADataSet.Insert;
|
||||
if iContador = 0 then
|
||||
ADataSet.Edit
|
||||
else begin
|
||||
ADataSet.Next;
|
||||
if ADataSet.EOF then
|
||||
ADataSet.Append
|
||||
else
|
||||
ADataSet.Insert;
|
||||
end;
|
||||
end;
|
||||
|
||||
try
|
||||
|
||||
Loading…
Reference in New Issue
Block a user