Arreglo en el recalculo de los detalles, cuando modificamos un artículo (elegimos otro articulo diferente dando al boton de referencia)

git-svn-id: https://192.168.0.254/svn/Proyectos.Tecsitel_FactuGES2/trunk@244 0c75b7a4-871f-7646-8a2f-f78d34cc349f
This commit is contained in:
roberto 2008-02-05 15:49:19 +00:00
parent 9fad9cefc3
commit 6671f00f1b

View File

@ -14,7 +14,7 @@ type
IControllerDetallesArticulos = interface(IControllerDetallesBase)
['{6E156796-DB1F-4727-BBFB-FBAEF2E5C098}']
procedure AnadirArticulos(ADetalles: IDAStronglyTypedDataTable; const ANuevaFila :Boolean = True);
procedure AnadirArticulos(ADetalles: IDAStronglyTypedDataTable; const ANuevaFila :Boolean = True);
function AnadirArticulo(ADetalles: IDAStronglyTypedDataTable; Referencia: String; TipoReferencia: TEnumReferencia; AClienteID: Integer = -1): Boolean; overload;
function AnadirArticulo(ADetalles: IDAStronglyTypedDataTable; IDArticulo: Integer; AClienteID: Integer = -1): Boolean; overload;
procedure ActualizarDetalles(ADetalles: IDAStronglyTypedDataTable; AArticulos: IBizArticulo);
@ -155,8 +155,7 @@ begin
end;
end;
procedure TControllerDetallesArticulos.AnadirArticulos(
ADetalles: IDAStronglyTypedDataTable; const ANuevaFila: Boolean);
procedure TControllerDetallesArticulos.AnadirArticulos(ADetalles: IDAStronglyTypedDataTable; const ANuevaFila: Boolean);
var
AArticulos: IBizArticulo;
begin
@ -164,11 +163,17 @@ begin
begin
try
AArticulos := (FArticulosController.BuscarTodos as IBizArticulo);
AArticulos := FArticulosController.ElegirArticulos(AArticulos, 'Elija los artículos que desea añadir', True);
if ANuevaFila then
//Si nueva fila es false, quiere decir que se sustituye un determinado artículo, por ello la lista a seleccionar no debe ser multiselect
if ANuevaFila then
begin
AArticulos := FArticulosController.ElegirArticulos(AArticulos, 'Elija los artículos que desea añadir', True);
Add(ADetalles, AArticulos)
end
else
begin
AArticulos := FArticulosController.ElegirArticulos(AArticulos, 'Elija el artículo que desea añadir', False);
RellenarDetalle(ADetalles, AArticulos);
end;
finally
AArticulos := Nil;
end;
@ -307,14 +312,19 @@ procedure TControllerDetallesArticulos.RellenarDetalle(ADetalles: IDAStronglyTyp
begin
if Assigned(ADetalles) then
begin
if not ADetalles.DataTable.Editing then
ADetalles.DataTable.Edit;
BeginUpdate(ADetalles);
try
if not ADetalles.DataTable.Editing then
ADetalles.DataTable.Edit;
RellenarGenerales(ADetalles, AArticulos);
RellenarImportes(ADetalles, AArticulos);
RellenarOtros(ADetalles, AArticulos);
RellenarGenerales(ADetalles, AArticulos);
RellenarImportes(ADetalles, AArticulos);
RellenarOtros(ADetalles, AArticulos);
ADetalles.DataTable.Post;
ADetalles.DataTable.Post;
finally
EndUpdate(ADetalles);
end;
end;
end;