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.Tecsitel_FactuGES2/trunk@1016 0c75b7a4-871f-7646-8a2f-f78d34cc349f
This commit is contained in:
roberto 2010-07-20 09:27:50 +00:00
parent 20e1d4e7fb
commit e4d648a7c9
14 changed files with 226 additions and 165 deletions

View File

@ -110,6 +110,7 @@ type
FEmpresa: IBizEmpresa; FEmpresa: IBizEmpresa;
FController : IEmpresasController; FController : IEmpresasController;
FProvincias : TStringList; FProvincias : TStringList;
FIDProvincia : Integer; //Almacenará la provincia que hay seleccionada para no cargar las poblaciones si no es necesario
FPoblaciones : TStringList; FPoblaciones : TStringList;
FFormasPago: TStringList; FFormasPago: TStringList;
FTiposIVA: TStringList; FTiposIVA: TStringList;
@ -202,27 +203,30 @@ end;
procedure TfrViewEmpresa.CargarPoblaciones; procedure TfrViewEmpresa.CargarPoblaciones;
var var
i : integer; i : integer;
AID : Integer;
begin
AID := StrToInt(FProvincias.Values[cbProvincia.Text]);
with TProvinciasPoblacionesController.Create do
try
FPoblaciones := DarListaPoblaciones(AID);
with cbPoblacion.Properties.Items do begin
begin if (FIDProvincia <> StrToInt(FProvincias.Values[cbProvincia.Text])) then
BeginUpdate; Begin
try FIDProvincia := StrToInt(FProvincias.Values[cbProvincia.Text]);
Clear; with TProvinciasPoblacionesController.Create do
for i := 0 to FPoblaciones.Count - 1 do try
Add(FPoblaciones.Names[i]); FPoblaciones := DarListaPoblaciones(FIDProvincia);
finally
EndUpdate; 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; end;
finally
Free;
end; end;
finally End;
Free;
end;
end; end;
procedure TfrViewEmpresa.CargarProvincias; procedure TfrViewEmpresa.CargarProvincias;
@ -279,6 +283,7 @@ end;
constructor TfrViewEmpresa.Create(AOwner : TComponent); constructor TfrViewEmpresa.Create(AOwner : TComponent);
begin begin
inherited; inherited;
FIDProvincia := 0;
FProvincias := NIL; FProvincias := NIL;
FPoblaciones := NIL; FPoblaciones := NIL;
bModificarCatalogo := False; bModificarCatalogo := False;

View File

@ -15,7 +15,6 @@ inherited frViewAlbaranCliente: TfrViewAlbaranCliente
TabOrder = 0 TabOrder = 0
TabStop = False TabStop = False
AutoContentSizes = [acsWidth, acsHeight] AutoContentSizes = [acsWidth, acsHeight]
ExplicitHeight = 550
DesignSize = ( DesignSize = (
903 903
506) 506)

View File

@ -128,6 +128,7 @@ type
FFormasPago : IBizFormaPago; FFormasPago : IBizFormaPago;
FFormasPagoController : IFormasPagoController; FFormasPagoController : IFormasPagoController;
FProvincias : TStringList; FProvincias : TStringList;
FIDProvincia : Integer; //Almacenará la provincia que hay seleccionada para no cargar las poblaciones si no es necesario
FPoblaciones : TStringList; FPoblaciones : TStringList;
procedure CargarProvincias; procedure CargarProvincias;
@ -216,27 +217,30 @@ end;
procedure TfrViewAlbaranCliente.CargarPoblaciones; procedure TfrViewAlbaranCliente.CargarPoblaciones;
var var
i : integer; i : integer;
AID : Integer;
begin
AID := StrToInt(FProvincias.Values[cbProvincia.Text]);
with TProvinciasPoblacionesController.Create do
try
FPoblaciones := DarListaPoblaciones(AID);
with cbPoblacion.Properties.Items do begin
begin if (FIDProvincia <> StrToInt(FProvincias.Values[cbProvincia.Text])) then
BeginUpdate; Begin
try FIDProvincia := StrToInt(FProvincias.Values[cbProvincia.Text]);
Clear; with TProvinciasPoblacionesController.Create do
for i := 0 to FPoblaciones.Count - 1 do try
Add(FPoblaciones.Names[i]); FPoblaciones := DarListaPoblaciones(FIDProvincia);
finally
EndUpdate; 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; end;
finally
Free;
end; end;
finally End;
Free;
end;
end; end;
procedure TfrViewAlbaranCliente.CargarProvincias; procedure TfrViewAlbaranCliente.CargarProvincias;
@ -312,6 +316,7 @@ end;
procedure TfrViewAlbaranCliente.CustomViewCreate(Sender: TObject); procedure TfrViewAlbaranCliente.CustomViewCreate(Sender: TObject);
begin begin
inherited; inherited;
FIDProvincia := 0;
FProvincias := NIL; FProvincias := NIL;
FPoblaciones := NIL; FPoblaciones := NIL;

View File

@ -13,7 +13,6 @@ inherited frViewDireccionEntregaAlbaranCliente: TfrViewDireccionEntregaAlbaranCl
TabOrder = 0 TabOrder = 0
TabStop = False TabStop = False
AutoContentSizes = [acsWidth, acsHeight] AutoContentSizes = [acsWidth, acsHeight]
ExplicitHeight = 129
object eCalle: TcxDBTextEdit object eCalle: TcxDBTextEdit
Left = 64 Left = 64
Top = 10 Top = 10

View File

@ -47,6 +47,7 @@ type
FAlbaran : IBizAlbaranCliente; FAlbaran : IBizAlbaranCliente;
FController : IAlbaranesClienteController; FController : IAlbaranesClienteController;
FProvincias : TStringList; FProvincias : TStringList;
FIDProvincia : Integer; //Almacenará la provincia que hay seleccionada para no cargar las poblaciones si no es necesario
FPoblaciones : TStringList; FPoblaciones : TStringList;
procedure CargarProvincias; procedure CargarProvincias;
procedure CargarPoblaciones; procedure CargarPoblaciones;
@ -71,27 +72,30 @@ uses
procedure TfrViewDireccionEntregaAlbaranCliente.CargarPoblaciones; procedure TfrViewDireccionEntregaAlbaranCliente.CargarPoblaciones;
var var
i : integer; i : integer;
AID : Integer;
begin
AID := StrToInt(FProvincias.Values[cbProvincia.Text]);
with TProvinciasPoblacionesController.Create do
try
FPoblaciones := DarListaPoblaciones(AID);
with cbPoblacion.Properties.Items do begin
begin if (FIDProvincia <> StrToInt(FProvincias.Values[cbProvincia.Text])) then
BeginUpdate; Begin
try FIDProvincia := StrToInt(FProvincias.Values[cbProvincia.Text]);
Clear; with TProvinciasPoblacionesController.Create do
for i := 0 to FPoblaciones.Count - 1 do try
Add(FPoblaciones.Names[i]); FPoblaciones := DarListaPoblaciones(FIDProvincia);
finally
EndUpdate; 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; end;
finally
Free;
end; end;
finally End;
Free;
end;
end; end;
procedure TfrViewDireccionEntregaAlbaranCliente.CargarProvincias; procedure TfrViewDireccionEntregaAlbaranCliente.CargarProvincias;
@ -168,6 +172,7 @@ end;
constructor TfrViewDireccionEntregaAlbaranCliente.Create(AOwner: TComponent); constructor TfrViewDireccionEntregaAlbaranCliente.Create(AOwner: TComponent);
begin begin
inherited; inherited;
FIDProvincia := 0;
FAlbaran := NIL; FAlbaran := NIL;
FProvincias := NIL; FProvincias := NIL;
FPoblaciones := NIL; FPoblaciones := NIL;

View File

@ -42,6 +42,7 @@ type
pPersonaContacto: String; pPersonaContacto: String;
pTelefono: String; pTelefono: String;
FProvincias : TStringList; FProvincias : TStringList;
FIDProvincia : Integer; //Almacenará la provincia que hay seleccionada para no cargar las poblaciones si no es necesario
FPoblaciones : TStringList; FPoblaciones : TStringList;
FAlbaran : IBizAlbaranProveedor; FAlbaran : IBizAlbaranProveedor;
function GetAlbaran: IBizAlbaranProveedor; function GetAlbaran: IBizAlbaranProveedor;
@ -63,27 +64,31 @@ uses
procedure TfEditorDireccionEntregaAlbaranProveedor.CargarPoblaciones; procedure TfEditorDireccionEntregaAlbaranProveedor.CargarPoblaciones;
var var
i : integer; i : integer;
AID : Integer;
begin
AID := StrToInt(FProvincias.Values[cbProvincia.Text]);
with TProvinciasPoblacionesController.Create do
try
FPoblaciones := DarListaPoblaciones(AID);
with cbPoblacion.Properties.Items do begin
begin if (FIDProvincia <> StrToInt(FProvincias.Values[cbProvincia.Text])) then
BeginUpdate; Begin
try FIDProvincia := StrToInt(FProvincias.Values[cbProvincia.Text]);
Clear;
for i := 0 to FPoblaciones.Count - 1 do with TProvinciasPoblacionesController.Create do
Add(FPoblaciones.Names[i]); try
finally FPoblaciones := DarListaPoblaciones(FIDProvincia);
EndUpdate;
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; end;
finally
Free;
end; end;
finally End;
Free;
end;
end; end;
procedure TfEditorDireccionEntregaAlbaranProveedor.CargarProvincias; procedure TfEditorDireccionEntregaAlbaranProveedor.CargarProvincias;
@ -154,6 +159,7 @@ end;
procedure TfEditorDireccionEntregaAlbaranProveedor.FormCreate(Sender: TObject); procedure TfEditorDireccionEntregaAlbaranProveedor.FormCreate(Sender: TObject);
begin begin
FIDProvincia := 0;
FProvincias := NIL; FProvincias := NIL;
FPoblaciones := NIL; FPoblaciones := NIL;
end; end;

View File

@ -49,6 +49,7 @@ type
protected protected
FAlmacen: IBizAlmacen; FAlmacen: IBizAlmacen;
FProvincias : TStringList; FProvincias : TStringList;
FIDProvincia : Integer; //Almacenará la provincia que hay seleccionada para no cargar las poblaciones si no es necesario
FPoblaciones : TStringList; FPoblaciones : TStringList;
procedure CargarProvincias; procedure CargarProvincias;
procedure CargarPoblaciones; procedure CargarPoblaciones;
@ -77,27 +78,31 @@ uses
procedure TfrViewAlmacen.CargarPoblaciones; procedure TfrViewAlmacen.CargarPoblaciones;
var var
i : integer; i : integer;
AID : Integer;
begin
AID := StrToInt(FProvincias.Values[cbProvincia.Text]);
with TProvinciasPoblacionesController.Create do
try
FPoblaciones := DarListaPoblaciones(AID);
with cbPoblacion.Properties.Items do begin
begin if (FIDProvincia <> StrToInt(FProvincias.Values[cbProvincia.Text])) then
BeginUpdate; Begin
try FIDProvincia := StrToInt(FProvincias.Values[cbProvincia.Text]);
Clear;
for i := 0 to FPoblaciones.Count - 1 do with TProvinciasPoblacionesController.Create do
Add(FPoblaciones.Names[i]); try
finally FPoblaciones := DarListaPoblaciones(FIDProvincia);
EndUpdate;
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; end;
finally
Free;
end; end;
finally End;
Free;
end;
end; end;
procedure TfrViewAlmacen.CargarProvincias; procedure TfrViewAlmacen.CargarProvincias;
@ -152,6 +157,7 @@ end;
constructor TfrViewAlmacen.Create(AOwner: TComponent); constructor TfrViewAlmacen.Create(AOwner: TComponent);
begin begin
inherited; inherited;
FIDProvincia := 0;
FProvincias := NIL; FProvincias := NIL;
FPoblaciones := NIL; FPoblaciones := NIL;
end; end;

View File

@ -9,6 +9,8 @@
<Projects Include="..\..\Cliente\FactuGES.dproj" /> <Projects Include="..\..\Cliente\FactuGES.dproj" />
<Projects Include="..\..\GUIBase\GUIBase.dproj" /> <Projects Include="..\..\GUIBase\GUIBase.dproj" />
<Projects Include="..\..\Servidor\FactuGES_Server.dproj" /> <Projects Include="..\..\Servidor\FactuGES_Server.dproj" />
<Projects Include="..\Albaranes de cliente\Views\AlbaranesCliente_view.dproj" />
<Projects Include="..\Obras\Views\Obras_view.dproj" />
<Projects Include="Controller\Contactos_controller.dproj" /> <Projects Include="Controller\Contactos_controller.dproj" />
<Projects Include="Data\Contactos_data.dproj" /> <Projects Include="Data\Contactos_data.dproj" />
<Projects Include="Model\Contactos_model.dproj" /> <Projects Include="Model\Contactos_model.dproj" />
@ -111,14 +113,32 @@
<Target Name="FactuGES_Server:Make"> <Target Name="FactuGES_Server:Make">
<MSBuild Projects="..\..\Servidor\FactuGES_Server.dproj" Targets="Make" /> <MSBuild Projects="..\..\Servidor\FactuGES_Server.dproj" Targets="Make" />
</Target> </Target>
<Target Name="AlbaranesCliente_view">
<MSBuild Projects="..\Albaranes de cliente\Views\AlbaranesCliente_view.dproj" Targets="" />
</Target>
<Target Name="AlbaranesCliente_view:Clean">
<MSBuild Projects="..\Albaranes de cliente\Views\AlbaranesCliente_view.dproj" Targets="Clean" />
</Target>
<Target Name="AlbaranesCliente_view:Make">
<MSBuild Projects="..\Albaranes de cliente\Views\AlbaranesCliente_view.dproj" Targets="Make" />
</Target>
<Target Name="Obras_view">
<MSBuild Projects="..\Obras\Views\Obras_view.dproj" Targets="" />
</Target>
<Target Name="Obras_view:Clean">
<MSBuild Projects="..\Obras\Views\Obras_view.dproj" Targets="Clean" />
</Target>
<Target Name="Obras_view:Make">
<MSBuild Projects="..\Obras\Views\Obras_view.dproj" Targets="Make" />
</Target>
<Target Name="Build"> <Target Name="Build">
<CallTarget Targets="Base;GUIBase;ApplicationBase;Contactos_model;Contactos_data;Contactos_controller;Contactos_view;Contactos_plugin;FactuGES;FactuGES_Server" /> <CallTarget Targets="Base;GUIBase;ApplicationBase;Contactos_model;Contactos_data;Contactos_controller;Contactos_view;Contactos_plugin;FactuGES;FactuGES_Server;AlbaranesCliente_view;Obras_view" />
</Target> </Target>
<Target Name="Clean"> <Target Name="Clean">
<CallTarget Targets="Base:Clean;GUIBase:Clean;ApplicationBase:Clean;Contactos_model:Clean;Contactos_data:Clean;Contactos_controller:Clean;Contactos_view:Clean;Contactos_plugin:Clean;FactuGES:Clean;FactuGES_Server:Clean" /> <CallTarget Targets="Base:Clean;GUIBase:Clean;ApplicationBase:Clean;Contactos_model:Clean;Contactos_data:Clean;Contactos_controller:Clean;Contactos_view:Clean;Contactos_plugin:Clean;FactuGES:Clean;FactuGES_Server:Clean;AlbaranesCliente_view:Clean;Obras_view:Clean" />
</Target> </Target>
<Target Name="Make"> <Target Name="Make">
<CallTarget Targets="Base:Make;GUIBase:Make;ApplicationBase:Make;Contactos_model:Make;Contactos_data:Make;Contactos_controller:Make;Contactos_view:Make;Contactos_plugin:Make;FactuGES:Make;FactuGES_Server:Make" /> <CallTarget Targets="Base:Make;GUIBase:Make;ApplicationBase:Make;Contactos_model:Make;Contactos_data:Make;Contactos_controller:Make;Contactos_view:Make;Contactos_plugin:Make;FactuGES:Make;FactuGES_Server:Make;AlbaranesCliente_view:Make;Obras_view:Make" />
</Target> </Target>
<Import Condition="Exists('$(MSBuildBinPath)\Borland.Group.Targets')" Project="$(MSBuildBinPath)\Borland.Group.Targets" /> <Import Condition="Exists('$(MSBuildBinPath)\Borland.Group.Targets')" Project="$(MSBuildBinPath)\Borland.Group.Targets" />
</Project> </Project>

View File

@ -100,6 +100,7 @@ type
FContacto: IBizContacto; FContacto: IBizContacto;
FController : IContactosController; FController : IContactosController;
FProvincias : TStringList; FProvincias : TStringList;
FIDProvincia : Integer; //Almacenará la provincia que hay seleccionada para no cargar las poblaciones si no es necesario
FPoblaciones : TStringList; FPoblaciones : TStringList;
procedure CargarProvincias; procedure CargarProvincias;
procedure CargarPoblaciones; procedure CargarPoblaciones;
@ -168,27 +169,31 @@ end;
procedure TfrViewContacto.CargarPoblaciones; procedure TfrViewContacto.CargarPoblaciones;
var var
i : integer; i : integer;
AID : Integer;
begin
AID := StrToInt(FProvincias.Values[cbProvincia.Text]);
with TProvinciasPoblacionesController.Create do
try
FPoblaciones := DarListaPoblaciones(AID);
with cbPoblacion.Properties.Items do begin
begin if (FIDProvincia <> StrToInt(FProvincias.Values[cbProvincia.Text])) then
BeginUpdate; Begin
try FIDProvincia := StrToInt(FProvincias.Values[cbProvincia.Text]);
Clear;
for i := 0 to FPoblaciones.Count - 1 do with TProvinciasPoblacionesController.Create do
Add(FPoblaciones.Names[i]); try
finally FPoblaciones := DarListaPoblaciones(FIDProvincia);
EndUpdate;
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; end;
finally
Free;
end; end;
finally End;
Free;
end;
end; end;
procedure TfrViewContacto.CargarProvincias; procedure TfrViewContacto.CargarProvincias;
@ -234,6 +239,7 @@ end;
constructor TfrViewContacto.Create(AOwner : TComponent); constructor TfrViewContacto.Create(AOwner : TComponent);
begin begin
inherited; inherited;
FIDProvincia := 0;
FProvincias := NIL; FProvincias := NIL;
FPoblaciones := NIL; FPoblaciones := NIL;
end; end;

View File

@ -1,24 +1,22 @@
inherited frViewObra: TfrViewObra inherited frViewObra: TfrViewObra
Width = 692 Width = 451
Height = 448 Height = 304
Align = alClient Align = alClient
ExplicitWidth = 451 ExplicitWidth = 451
ExplicitHeight = 304 ExplicitHeight = 304
object dxLayoutControlObra: TdxLayoutControl object dxLayoutControlObra: TdxLayoutControl
Left = 0 Left = 0
Top = 0 Top = 0
Width = 692 Width = 451
Height = 448 Height = 304
Align = alClient Align = alClient
ParentBackground = True ParentBackground = True
TabOrder = 0 TabOrder = 0
TabStop = False TabStop = False
AutoContentSizes = [acsWidth, acsHeight] AutoContentSizes = [acsWidth, acsHeight]
ExplicitWidth = 451
ExplicitHeight = 304
DesignSize = ( DesignSize = (
692 451
448) 304)
object eNombre: TcxDBTextEdit object eNombre: TcxDBTextEdit
Left = 130 Left = 130
Top = 34 Top = 34
@ -171,7 +169,7 @@ inherited frViewObra: TfrViewObra
Width = 203 Width = 203
end end
object eCodigoPostal: TcxDBTextEdit object eCodigoPostal: TcxDBTextEdit
Left = 236 Left = 189
Top = 145 Top = 145
DataBinding.DataField = 'CODIGO_POSTAL' DataBinding.DataField = 'CODIGO_POSTAL'
DataBinding.DataSource = DADataSource DataBinding.DataSource = DADataSource
@ -247,7 +245,7 @@ inherited frViewObra: TfrViewObra
Width = 224 Width = 224
end end
inline frViewClienteAsociadoObra1: TfrViewClienteAsociadoObra inline frViewClienteAsociadoObra1: TfrViewClienteAsociadoObra
Left = 357 Left = 310
Top = 34 Top = 34
Width = 503 Width = 503
Height = 213 Height = 213
@ -259,7 +257,7 @@ inherited frViewObra: TfrViewObra
ParentFont = False ParentFont = False
TabOrder = 10 TabOrder = 10
ReadOnly = False ReadOnly = False
ExplicitLeft = 357 ExplicitLeft = 310
ExplicitTop = 34 ExplicitTop = 34
ExplicitWidth = 503 ExplicitWidth = 503
ExplicitHeight = 213 ExplicitHeight = 213
@ -309,16 +307,16 @@ inherited frViewObra: TfrViewObra
Width = 429 Width = 429
end end
inherited edtCodigoPostal: TcxDBTextEdit inherited edtCodigoPostal: TcxDBTextEdit
Left = 221 Left = 192
Style.LookAndFeel.SkinName = '' Style.LookAndFeel.SkinName = ''
StyleDisabled.LookAndFeel.SkinName = '' StyleDisabled.LookAndFeel.SkinName = ''
StyleFocused.LookAndFeel.SkinName = '' StyleFocused.LookAndFeel.SkinName = ''
StyleHot.LookAndFeel.SkinName = '' StyleHot.LookAndFeel.SkinName = ''
ExplicitLeft = 221 ExplicitLeft = 192
end end
inherited Button3: TBitBtn inherited Button3: TBitBtn
Left = 111 Left = 82
ExplicitLeft = 111 ExplicitLeft = 82
end end
end end
end end

View File

@ -64,6 +64,7 @@ type
FObra: IBizObra; FObra: IBizObra;
FController : IObrasController; FController : IObrasController;
FProvincias : TStringList; FProvincias : TStringList;
FIDProvincia : Integer; //Almacenará la provincia que hay seleccionada para no cargar las poblaciones si no es necesario
FPoblaciones : TStringList; FPoblaciones : TStringList;
procedure CargarProvincias; procedure CargarProvincias;
procedure CargarPoblaciones; procedure CargarPoblaciones;
@ -96,27 +97,31 @@ uses
procedure TfrViewObra.CargarPoblaciones; procedure TfrViewObra.CargarPoblaciones;
var var
i : integer; i : integer;
AID : Integer;
begin
AID := StrToInt(FProvincias.Values[cbProvincia.Text]);
with TProvinciasPoblacionesController.Create do
try
FPoblaciones := DarListaPoblaciones(AID);
with cbPoblacion.Properties.Items do begin
begin if (FIDProvincia <> StrToInt(FProvincias.Values[cbProvincia.Text])) then
BeginUpdate; Begin
try FIDProvincia := StrToInt(FProvincias.Values[cbProvincia.Text]);
Clear;
for i := 0 to FPoblaciones.Count - 1 do with TProvinciasPoblacionesController.Create do
Add(FPoblaciones.Names[i]); try
finally FPoblaciones := DarListaPoblaciones(FIDProvincia);
EndUpdate;
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; end;
finally
Free;
end; end;
finally End;
Free;
end;
end; end;
procedure TfrViewObra.CargarProvincias; procedure TfrViewObra.CargarProvincias;
@ -171,6 +176,7 @@ end;
constructor TfrViewObra.Create(AOwner: TComponent); constructor TfrViewObra.Create(AOwner: TComponent);
begin begin
inherited; inherited;
FIDProvincia := 0;
FProvincias := NIL; FProvincias := NIL;
FPoblaciones := NIL; FPoblaciones := NIL;
end; end;

View File

@ -34,6 +34,7 @@ type
pDireccion: String; pDireccion: String;
pPoblacion: String; pPoblacion: String;
pProvincia: String; pProvincia: String;
FIDProvincia : Integer; //Almacenará la provincia que hay seleccionada para no cargar las poblaciones si no es necesario
pCodigoPostal: String; pCodigoPostal: String;
FProvincias : TStringList; FProvincias : TStringList;
FPoblaciones : TStringList; FPoblaciones : TStringList;
@ -57,27 +58,31 @@ uses
procedure TfEditorDireccionEntregaPedidoProveedor.CargarPoblaciones; procedure TfEditorDireccionEntregaPedidoProveedor.CargarPoblaciones;
var var
i : integer; i : integer;
AID : Integer;
begin
AID := StrToInt(FProvincias.Values[cbProvincia.Text]);
with TProvinciasPoblacionesController.Create do
try
FPoblaciones := DarListaPoblaciones(AID);
with cbPoblacion.Properties.Items do begin
begin if (FIDProvincia <> StrToInt(FProvincias.Values[cbProvincia.Text])) then
BeginUpdate; Begin
try FIDProvincia := StrToInt(FProvincias.Values[cbProvincia.Text]);
Clear;
for i := 0 to FPoblaciones.Count - 1 do with TProvinciasPoblacionesController.Create do
Add(FPoblaciones.Names[i]); try
finally FPoblaciones := DarListaPoblaciones(FIDProvincia);
EndUpdate;
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; end;
finally
Free;
end; end;
finally End;
Free;
end;
end; end;
procedure TfEditorDireccionEntregaPedidoProveedor.CargarProvincias; procedure TfEditorDireccionEntregaPedidoProveedor.CargarProvincias;
@ -146,6 +151,7 @@ end;
procedure TfEditorDireccionEntregaPedidoProveedor.FormCreate(Sender: TObject); procedure TfEditorDireccionEntregaPedidoProveedor.FormCreate(Sender: TObject);
begin begin
FIDProvincia := 0;
FProvincias := NIL; FProvincias := NIL;
FPoblaciones := NIL; FPoblaciones := NIL;
end; end;

Binary file not shown.

View File

@ -14,7 +14,7 @@ BEGIN
BEGIN BEGIN
VALUE "FileVersion", "1.8.3.0\0" VALUE "FileVersion", "1.8.3.0\0"
VALUE "ProductVersion", "1.8.3.0\0" VALUE "ProductVersion", "1.8.3.0\0"
VALUE "CompileDate", "lunes, 19 de julio de 2010 18:17\0" VALUE "CompileDate", "martes, 20 de julio de 2010 11:19\0"
END END
END END
BLOCK "VarFileInfo" BLOCK "VarFileInfo"