Se arregla la carga de poblaciones de las provincias para que si no se cambia de provincia no se vuelva a solicitar al servidor las poblaciones
git-svn-id: https://192.168.0.254/svn/Proyectos.Acana_FactuGES2/trunk@531 f4e31baf-9722-1c47-927c-6f952f962d4b
This commit is contained in:
parent
b11ba9df75
commit
8786d03ee1
@ -48,6 +48,7 @@ type
|
||||
procedure cbProvinciaPropertiesInitPopup(Sender: TObject);
|
||||
private
|
||||
FProvincias : TStringList;
|
||||
FIDProvincia : Integer; //Almacenará la provincia que hay seleccionada para no cargar las poblaciones si no es necesario
|
||||
FPoblaciones : TStringList;
|
||||
procedure CargarProvincias;
|
||||
procedure CargarPoblaciones;
|
||||
@ -83,28 +84,31 @@ type
|
||||
procedure TfEditorTiendaEmpresa.CargarPoblaciones;
|
||||
var
|
||||
i : integer;
|
||||
AID : Integer;
|
||||
|
||||
begin
|
||||
AID := StrToInt(FProvincias.Values[cbProvincia.Text]);
|
||||
with TProvinciasPoblacionesController.Create do
|
||||
begin
|
||||
try
|
||||
FPoblaciones := DarListaPoblaciones(AID);
|
||||
with cbPoblacion.Properties.Items do
|
||||
begin
|
||||
BeginUpdate;
|
||||
try
|
||||
Clear;
|
||||
for i := 0 to FPoblaciones.Count - 1 do
|
||||
Add(FPoblaciones.Names[i]);
|
||||
finally
|
||||
EndUpdate;
|
||||
if (FIDProvincia <> StrToInt(FProvincias.Values[cbProvincia.Text])) then
|
||||
Begin
|
||||
FIDProvincia := StrToInt(FProvincias.Values[cbProvincia.Text]);
|
||||
with TProvinciasPoblacionesController.Create do
|
||||
begin
|
||||
try
|
||||
FPoblaciones := DarListaPoblaciones(FIDProvincia);
|
||||
with cbPoblacion.Properties.Items do
|
||||
begin
|
||||
BeginUpdate;
|
||||
try
|
||||
Clear;
|
||||
for i := 0 to FPoblaciones.Count - 1 do
|
||||
Add(FPoblaciones.Names[i]);
|
||||
finally
|
||||
EndUpdate;
|
||||
end;
|
||||
end;
|
||||
finally
|
||||
Free;
|
||||
end;
|
||||
finally
|
||||
Free;
|
||||
end;
|
||||
end;
|
||||
End;
|
||||
end;
|
||||
|
||||
procedure TfEditorTiendaEmpresa.CargarProvincias;
|
||||
@ -162,6 +166,7 @@ constructor TfEditorTiendaEmpresa.Create(AOwner: TComponent);
|
||||
begin
|
||||
inherited;
|
||||
FController := NIL;
|
||||
FIDProvincia := 0;
|
||||
FProvincias := NIL;
|
||||
FPoblaciones := NIL;
|
||||
|
||||
|
||||
@ -100,6 +100,7 @@ type
|
||||
FEmpresa: IBizEmpresa;
|
||||
FController : IEmpresasController;
|
||||
FProvincias : TStringList;
|
||||
FIDProvincia : Integer; //Almacenará la provincia que hay seleccionada para no cargar las poblaciones si no es necesario
|
||||
FPoblaciones : TStringList;
|
||||
FFormasPago: TStringList;
|
||||
FTiposIVA: TStringList;
|
||||
@ -178,28 +179,32 @@ end;
|
||||
procedure TfrViewEmpresa.CargarPoblaciones;
|
||||
var
|
||||
i : integer;
|
||||
AID : Integer;
|
||||
|
||||
begin
|
||||
AID := StrToInt(FProvincias.Values[cbProvincia.Text]);
|
||||
with TProvinciasPoblacionesController.Create do
|
||||
begin
|
||||
try
|
||||
FPoblaciones := DarListaPoblaciones(AID);
|
||||
with cbPoblacion.Properties.Items do
|
||||
begin
|
||||
BeginUpdate;
|
||||
try
|
||||
Clear;
|
||||
for i := 0 to FPoblaciones.Count - 1 do
|
||||
Add(FPoblaciones.Names[i]);
|
||||
finally
|
||||
EndUpdate;
|
||||
if (FIDProvincia <> StrToInt(FProvincias.Values[cbProvincia.Text])) then
|
||||
Begin
|
||||
FIDProvincia := StrToInt(FProvincias.Values[cbProvincia.Text]);
|
||||
|
||||
with TProvinciasPoblacionesController.Create do
|
||||
begin
|
||||
try
|
||||
FPoblaciones := DarListaPoblaciones(FIDProvincia);
|
||||
with cbPoblacion.Properties.Items do
|
||||
begin
|
||||
BeginUpdate;
|
||||
try
|
||||
Clear;
|
||||
for i := 0 to FPoblaciones.Count - 1 do
|
||||
Add(FPoblaciones.Names[i]);
|
||||
finally
|
||||
EndUpdate;
|
||||
end;
|
||||
end;
|
||||
finally
|
||||
Free;
|
||||
end;
|
||||
finally
|
||||
Free;
|
||||
end;
|
||||
end;
|
||||
End;
|
||||
end;
|
||||
|
||||
procedure TfrViewEmpresa.CargarProvincias;
|
||||
@ -231,6 +236,7 @@ end;
|
||||
constructor TfrViewEmpresa.Create(AOwner : TComponent);
|
||||
begin
|
||||
inherited;
|
||||
FIDProvincia := 0;
|
||||
FProvincias := NIL;
|
||||
FPoblaciones := NIL;
|
||||
end;
|
||||
|
||||
@ -13,7 +13,6 @@ inherited frViewContacto: TfrViewContacto
|
||||
TabOrder = 0
|
||||
TabStop = False
|
||||
AutoContentSizes = [acsWidth, acsHeight]
|
||||
ExplicitHeight = 536
|
||||
object PngSpeedButton1: TPngSpeedButton
|
||||
Left = 579
|
||||
Top = 222
|
||||
@ -503,6 +502,7 @@ inherited frViewContacto: TfrViewContacto
|
||||
inherited memObservaciones: TcxDBMemo
|
||||
DataBinding.DataField = 'NOTAS'
|
||||
DataBinding.DataSource = dsContacto
|
||||
ExplicitHeight = 228
|
||||
Height = 228
|
||||
end
|
||||
end
|
||||
|
||||
@ -103,6 +103,7 @@ type
|
||||
procedure cbPoblacionPropertiesInitPopup(Sender: TObject);
|
||||
private
|
||||
FProvincias : TStringList;
|
||||
FIDProvincia : Integer; //Almacenará la provincia que hay seleccionada para no cargar las poblaciones si no es necesario
|
||||
FPoblaciones : TStringList;
|
||||
procedure CargarProvincias;
|
||||
procedure CargarPoblaciones;
|
||||
@ -173,28 +174,31 @@ end;
|
||||
procedure TfrViewContacto.CargarPoblaciones;
|
||||
var
|
||||
i : integer;
|
||||
AID : Integer;
|
||||
|
||||
begin
|
||||
AID := StrToInt(FProvincias.Values[cbProvincia.Text]);
|
||||
with TProvinciasPoblacionesController.Create do
|
||||
begin
|
||||
try
|
||||
FPoblaciones := DarListaPoblaciones(AID);
|
||||
with cbPoblacion.Properties.Items do
|
||||
begin
|
||||
BeginUpdate;
|
||||
try
|
||||
Clear;
|
||||
for i := 0 to FPoblaciones.Count - 1 do
|
||||
Add(FPoblaciones.Names[i]);
|
||||
finally
|
||||
EndUpdate;
|
||||
if (FIDProvincia <> StrToInt(FProvincias.Values[cbProvincia.Text])) then
|
||||
Begin
|
||||
FIDProvincia := StrToInt(FProvincias.Values[cbProvincia.Text]);
|
||||
with TProvinciasPoblacionesController.Create do
|
||||
begin
|
||||
try
|
||||
FPoblaciones := DarListaPoblaciones(FIDProvincia);
|
||||
with cbPoblacion.Properties.Items do
|
||||
begin
|
||||
BeginUpdate;
|
||||
try
|
||||
Clear;
|
||||
for i := 0 to FPoblaciones.Count - 1 do
|
||||
Add(FPoblaciones.Names[i]);
|
||||
finally
|
||||
EndUpdate;
|
||||
end;
|
||||
end;
|
||||
finally
|
||||
Free;
|
||||
end;
|
||||
finally
|
||||
Free;
|
||||
end;
|
||||
end;
|
||||
End;
|
||||
end;
|
||||
|
||||
procedure TfrViewContacto.CargarProvincias;
|
||||
@ -251,6 +255,7 @@ end;
|
||||
constructor TfrViewContacto.Create(AOwner: TComponent);
|
||||
begin
|
||||
inherited;
|
||||
FIDProvincia := 0;
|
||||
FProvincias := NIL;
|
||||
FPoblaciones := NIL;
|
||||
end;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user