Facturas de cliente: Arreglado error de posicionamiento al realizar el recorrido de los detalles para calcular el total de la factura.
git-svn-id: https://192.168.0.254/svn/Proyectos.Acana_FactuGES2/trunk@87 f4e31baf-9722-1c47-927c-6f952f962d4b
This commit is contained in:
parent
0f0529a8c2
commit
80cf052f33
@ -786,6 +786,7 @@ procedure TFacturasClienteController.RecalcularImportes(
|
|||||||
AFactura: IBizFacturaCliente);
|
AFactura: IBizFacturaCliente);
|
||||||
var
|
var
|
||||||
bEnEdicion : Boolean;
|
bEnEdicion : Boolean;
|
||||||
|
ADetallePosAct : Integer;
|
||||||
begin
|
begin
|
||||||
if not Assigned(AFactura) then
|
if not Assigned(AFactura) then
|
||||||
raise Exception.Create ('Factura no asignado (RecalcularImportes)');
|
raise Exception.Create ('Factura no asignado (RecalcularImportes)');
|
||||||
@ -793,19 +794,28 @@ begin
|
|||||||
if AFactura.DataTable.Active then
|
if AFactura.DataTable.Active then
|
||||||
AFactura.DataTable.Active := True;
|
AFactura.DataTable.Active := True;
|
||||||
|
|
||||||
|
{ Hay que guardar la posición en la que estamos en los detalles por que
|
||||||
|
la asignación de valores a los campos IMPORTE_NETO e IMPORTE_PORTE
|
||||||
|
(ver más adelante) colocan el puntero en la tabla detalle al principio.
|
||||||
|
No he encontrado la razón por la que mueve el puntero. }
|
||||||
|
|
||||||
|
ADetallePosAct := AFactura.Detalles.POSICION;
|
||||||
|
|
||||||
bEnEdicion := (AFactura.DataTable.State in dsEditModes);
|
bEnEdicion := (AFactura.DataTable.State in dsEditModes);
|
||||||
if not bEnEdicion then
|
if not bEnEdicion then
|
||||||
AFactura.Edit;
|
AFactura.Edit;
|
||||||
|
|
||||||
ShowHourglassCursor;
|
ShowHourglassCursor;
|
||||||
AFactura.Edit;
|
|
||||||
try
|
try
|
||||||
AFactura.IMPORTE_NETO := FDetallesController.DarTotalImporteTotal(AFactura.Detalles);
|
AFactura.IMPORTE_NETO := FDetallesController.DarTotalImporteTotal(AFactura.Detalles);
|
||||||
AFactura.IMPORTE_PORTE := FDetallesController.DarTotalPorteTotal(AFactura.Detalles);
|
AFactura.IMPORTE_PORTE := FDetallesController.DarTotalPorteTotal(AFactura.Detalles);
|
||||||
|
|
||||||
if not bEnEdicion then
|
if not bEnEdicion then
|
||||||
AFactura.Post;
|
AFactura.Post;
|
||||||
finally
|
finally
|
||||||
HideHourglassCursor;
|
HideHourglassCursor;
|
||||||
|
// Restaurar la posición que teníamos en los detalles.
|
||||||
|
FDetallesController.LocalizarPosicion(AFactura.Detalles, ADetallePosAct);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -1095,4 +1105,4 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
end.
|
end.
|
||||||
| |||||||