Se adapta el cargarpoblaciones de toda la aplicación para que si no se cambia de provincia no vuelva a pedir al servidor las poblaciones

git-svn-id: https://192.168.0.254/svn/Proyectos.Noviseda_FactuGES2/trunk@136 f33bb606-9f5c-448d-9c99-757f00063c96
This commit is contained in:
roberto 2010-07-20 09:12:30 +00:00
parent d5a1bb79fa
commit 89a87e5287
15 changed files with 227 additions and 183 deletions

Binary file not shown.

View File

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

@ -137,6 +137,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;
@ -243,27 +244,29 @@ end;
procedure TfrViewAlbaranCliente.CargarPoblaciones; procedure TfrViewAlbaranCliente.CargarPoblaciones;
var var
i : integer; i : integer;
AID : Integer;
begin begin
AID := StrToInt(FProvincias.Values[cbProvincia.Text]); if (FIDProvincia <> StrToInt(FProvincias.Values[cbProvincia.Text])) then
with TProvinciasPoblacionesController.Create do Begin
try FIDProvincia := StrToInt(FProvincias.Values[cbProvincia.Text]);
FPoblaciones := DarListaPoblaciones(AID); with TProvinciasPoblacionesController.Create do
try
FPoblaciones := DarListaPoblaciones(FIDProvincia);
with cbPoblacion.Properties.Items do with cbPoblacion.Properties.Items do
begin begin
BeginUpdate; BeginUpdate;
try try
Clear; Clear;
for i := 0 to FPoblaciones.Count - 1 do for i := 0 to FPoblaciones.Count - 1 do
Add(FPoblaciones.Names[i]); Add(FPoblaciones.Names[i]);
finally finally
EndUpdate; EndUpdate;
end;
end; end;
finally
Free;
end; end;
finally End;
Free;
end;
end; end;
procedure TfrViewAlbaranCliente.CargarProvincias; procedure TfrViewAlbaranCliente.CargarProvincias;

View File

@ -12,8 +12,6 @@ inherited frViewDireccionEntregaAlbaranCliente: TfrViewDireccionEntregaAlbaranCl
ParentBackground = True ParentBackground = True
TabOrder = 0 TabOrder = 0
TabStop = False TabStop = False
AutoContentSizes = [acsWidth, acsHeight]
ExplicitHeight = 129
object eCalle: TcxDBTextEdit object eCalle: TcxDBTextEdit
Left = 64 Left = 64
Top = 10 Top = 10
@ -142,64 +140,67 @@ inherited frViewDireccionEntregaAlbaranCliente: TfrViewDireccionEntregaAlbaranCl
Width = 263 Width = 263
end end
object dxLayoutGroup1: TdxLayoutGroup object dxLayoutGroup1: TdxLayoutGroup
ShowCaption = False AlignHorz = ahParentManaged
AlignVert = avParentManaged
CaptionOptions.Visible = False
ButtonOptions.Buttons = <>
Hidden = True Hidden = True
ShowBorder = False ShowBorder = False
object dxLayoutControl1Item1: TdxLayoutItem object dxLayoutControl1Item1: TdxLayoutItem
Caption = 'Calle:' CaptionOptions.Text = 'Calle:'
Control = eCalle Control = eCalle
ControlOptions.ShowBorder = False ControlOptions.ShowBorder = False
end end
object dxLayoutControl1Group3: TdxLayoutGroup object dxLayoutControl1Group3: TdxLayoutGroup
ShowCaption = False CaptionOptions.Visible = False
ButtonOptions.Buttons = <>
Hidden = True Hidden = True
ShowBorder = False ShowBorder = False
object dxLayoutControl1Group1: TdxLayoutGroup object dxLayoutControl1Group1: TdxLayoutGroup
ShowCaption = False CaptionOptions.Visible = False
ButtonOptions.Buttons = <>
Hidden = True Hidden = True
ShowBorder = False ShowBorder = False
object dxLayoutControl1Group2: TdxLayoutGroup object dxLayoutControl1Group2: TdxLayoutGroup
ShowCaption = False CaptionOptions.Visible = False
ButtonOptions.Buttons = <>
Hidden = True Hidden = True
LayoutDirection = ldHorizontal LayoutDirection = ldHorizontal
ShowBorder = False ShowBorder = False
object dxLayoutControl1Item2: TdxLayoutItem object dxLayoutControl1Item2: TdxLayoutItem
AutoAligns = [aaVertical]
AlignHorz = ahClient AlignHorz = ahClient
Caption = 'Provincia:' CaptionOptions.Text = 'Provincia:'
Control = cbProvincia Control = cbProvincia
ControlOptions.ShowBorder = False ControlOptions.ShowBorder = False
end end
object dxLayoutControl1Item4: TdxLayoutItem object dxLayoutControl1Item4: TdxLayoutItem
AutoAligns = [aaVertical]
AlignHorz = ahRight AlignHorz = ahRight
Caption = 'C.P.:' CaptionOptions.Text = 'C.P.:'
Control = eCodigoPostal Control = eCodigoPostal
ControlOptions.ShowBorder = False ControlOptions.ShowBorder = False
end end
end end
object dxLayoutControl1Item3: TdxLayoutItem object dxLayoutControl1Item3: TdxLayoutItem
Caption = 'Poblaci'#243'n:' CaptionOptions.Text = 'Poblaci'#243'n:'
Control = cbPoblacion Control = cbPoblacion
ControlOptions.ShowBorder = False ControlOptions.ShowBorder = False
end end
end end
object dxLayoutControl1Group4: TdxLayoutGroup object dxLayoutControl1Group4: TdxLayoutGroup
ShowCaption = False CaptionOptions.Visible = False
ButtonOptions.Buttons = <>
Hidden = True Hidden = True
LayoutDirection = ldHorizontal LayoutDirection = ldHorizontal
ShowBorder = False ShowBorder = False
object dxLayoutControl1Item6: TdxLayoutItem object dxLayoutControl1Item6: TdxLayoutItem
AutoAligns = [aaVertical]
AlignHorz = ahClient AlignHorz = ahClient
Caption = 'Contacto:' CaptionOptions.Text = 'Contacto:'
Control = ePersonaContacto Control = ePersonaContacto
ControlOptions.ShowBorder = False ControlOptions.ShowBorder = False
end end
object dxLayoutControl1Item5: TdxLayoutItem object dxLayoutControl1Item5: TdxLayoutItem
AutoAligns = [aaVertical]
AlignHorz = ahRight AlignHorz = ahRight
Caption = 'Tel'#233'fono:' CaptionOptions.Text = 'Tel'#233'fono:'
Control = eTlfTrabajo Control = eTlfTrabajo
ControlOptions.ShowBorder = False ControlOptions.ShowBorder = False
end end

View File

@ -7,7 +7,8 @@ uses
Dialogs, uViewBase, uBizAlbaranesCliente, cxGraphics, dxLayoutControl, cxMemo, Dialogs, uViewBase, uBizAlbaranesCliente, cxGraphics, dxLayoutControl, cxMemo,
cxContainer, cxEdit, cxTextEdit, cxMaskEdit, cxDropDownEdit, cxLookupEdit, cxContainer, cxEdit, cxTextEdit, cxMaskEdit, cxDropDownEdit, cxLookupEdit,
cxDBLookupEdit, cxDBLookupComboBox, StdCtrls, cxControls, DB, uDADataTable, cxDBLookupEdit, cxDBLookupComboBox, StdCtrls, cxControls, DB, uDADataTable,
ActnList, uAlbaranesClienteController, Buttons, cxDBEdit, uDAInterfaces; ActnList, uAlbaranesClienteController, Buttons, cxDBEdit, uDAInterfaces,
cxLookAndFeels, cxLookAndFeelPainters, dxLayoutcxEditAdapters;
type type
IViewDireccionEntregaAlbaranCliente = interface(IViewBase) IViewDireccionEntregaAlbaranCliente = interface(IViewBase)
@ -47,7 +48,9 @@ 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;
function GetAlbaranCliente: IBizAlbaranCliente; function GetAlbaranCliente: IBizAlbaranCliente;
@ -71,27 +74,29 @@ uses
procedure TfrViewDireccionEntregaAlbaranCliente.CargarPoblaciones; procedure TfrViewDireccionEntregaAlbaranCliente.CargarPoblaciones;
var var
i : integer; i : integer;
AID : Integer;
begin begin
AID := StrToInt(FProvincias.Values[cbProvincia.Text]); if (FIDProvincia <> StrToInt(FProvincias.Values[cbProvincia.Text])) then
with TProvinciasPoblacionesController.Create do Begin
try FIDProvincia := StrToInt(FProvincias.Values[cbProvincia.Text]);
FPoblaciones := DarListaPoblaciones(AID); with TProvinciasPoblacionesController.Create do
try
FPoblaciones := DarListaPoblaciones(FIDProvincia);
with cbPoblacion.Properties.Items do with cbPoblacion.Properties.Items do
begin begin
BeginUpdate; BeginUpdate;
try try
Clear; Clear;
for i := 0 to FPoblaciones.Count - 1 do for i := 0 to FPoblaciones.Count - 1 do
Add(FPoblaciones.Names[i]); Add(FPoblaciones.Names[i]);
finally finally
EndUpdate; EndUpdate;
end;
end; end;
finally
Free;
end; end;
finally End;
Free;
end;
end; end;
procedure TfrViewDireccionEntregaAlbaranCliente.CargarProvincias; procedure TfrViewDireccionEntregaAlbaranCliente.CargarProvincias;
@ -168,6 +173,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

@ -6,7 +6,8 @@ uses Windows, SysUtils, Classes, Graphics, Forms, Controls, StdCtrls,
Buttons, ExtCtrls, Mask, DBCtrls, DB, uDADataTable, Buttons, ExtCtrls, Mask, DBCtrls, DB, uDADataTable,
cxControls, cxContainer, cxEdit, cxTextEdit, cxDBEdit, cxControls, cxContainer, cxEdit, cxTextEdit, cxDBEdit,
uIEditorDireccionEntregaAlbaranProveedor, uBizAlbaranesProveedor, uIEditorDireccionEntregaAlbaranProveedor, uBizAlbaranesProveedor,
uDAInterfaces, cxGraphics, cxMaskEdit, cxDropDownEdit; uDAInterfaces, cxGraphics, cxMaskEdit, cxDropDownEdit, cxLookAndFeels,
cxLookAndFeelPainters;
type type
TfEditorDireccionEntregaAlbaranProveedor = class(TForm, IEditorDireccionEntregaAlbaranProveedor) TfEditorDireccionEntregaAlbaranProveedor = class(TForm, IEditorDireccionEntregaAlbaranProveedor)
@ -38,6 +39,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;
pPersonaContacto: String; pPersonaContacto: String;
pTelefono: String; pTelefono: String;
@ -63,27 +65,30 @@ 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; 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 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

@ -51,6 +51,7 @@ type
FAlmacen: IBizAlmacen; FAlmacen: IBizAlmacen;
FProvincias : TStringList; FProvincias : TStringList;
FPoblaciones : TStringList; FPoblaciones : TStringList;
FIDProvincia : Integer; //Almacenará la provincia que hay seleccionada para no cargar las poblaciones si no es necesario
procedure CargarProvincias; procedure CargarProvincias;
procedure CargarPoblaciones; procedure CargarPoblaciones;
function GetAlmacen: IBizAlmacen; function GetAlmacen: IBizAlmacen;
@ -78,27 +79,30 @@ 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; 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 TfrViewAlmacen.CargarProvincias; procedure TfrViewAlmacen.CargarProvincias;
@ -153,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

@ -156,7 +156,6 @@ inherited frViewContacto: TfrViewContacto
Properties.ImmediateUpdateText = True Properties.ImmediateUpdateText = True
Properties.PostPopupValueOnTab = True Properties.PostPopupValueOnTab = True
Properties.OnInitPopup = cbPoblacionPropertiesInitPopup Properties.OnInitPopup = cbPoblacionPropertiesInitPopup
Style.BorderStyle = ebs3D
Style.LookAndFeel.Kind = lfStandard Style.LookAndFeel.Kind = lfStandard
Style.LookAndFeel.NativeStyle = True Style.LookAndFeel.NativeStyle = True
Style.LookAndFeel.SkinName = '' Style.LookAndFeel.SkinName = ''

View File

@ -103,6 +103,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;
@ -171,27 +172,30 @@ 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; 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 TfrViewContacto.CargarProvincias; procedure TfrViewContacto.CargarProvincias;
@ -221,7 +225,7 @@ end;
procedure TfrViewContacto.cbPoblacionPropertiesInitPopup(Sender: TObject); procedure TfrViewContacto.cbPoblacionPropertiesInitPopup(Sender: TObject);
begin begin
inherited; inherited;
{
ShowHourglassCursor; ShowHourglassCursor;
try try
FreeANDNIL(FPoblaciones); FreeANDNIL(FPoblaciones);
@ -232,12 +236,12 @@ begin
finally finally
HideHourglassCursor; HideHourglassCursor;
end; end;
}
end; 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

@ -11,7 +11,6 @@ inherited frViewDireccionEntrega: TfrViewDireccionEntrega
Align = alClient Align = alClient
TabOrder = 0 TabOrder = 0
TabStop = False TabStop = False
ExplicitHeight = 245
object cbPoblacion: TcxDBComboBox object cbPoblacion: TcxDBComboBox
Left = 64 Left = 64
Top = 64 Top = 64

View File

@ -32,7 +32,9 @@ type
procedure cbProvinciaPropertiesInitPopup(Sender: TObject); procedure cbProvinciaPropertiesInitPopup(Sender: TObject);
protected protected
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;
@ -53,27 +55,30 @@ uses
procedure TfrViewDireccionEntrega.CargarPoblaciones; procedure TfrViewDireccionEntrega.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 TfrViewDireccionEntrega.CargarProvincias; procedure TfrViewDireccionEntrega.CargarProvincias;
@ -132,6 +137,7 @@ end;
constructor TfrViewDireccionEntrega.Create(AOwner: TComponent); constructor TfrViewDireccionEntrega.Create(AOwner: TComponent);
begin begin
inherited; inherited;
FIDProvincia := 0;
FProvincias := NIL; FProvincias := NIL;
FPoblaciones := NIL; FPoblaciones := NIL;
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

@ -6,7 +6,7 @@ uses Windows, SysUtils, Classes, Graphics, Forms, Controls, StdCtrls,
Buttons, ExtCtrls, Mask, DBCtrls, DB, uDADataTable, Buttons, ExtCtrls, Mask, DBCtrls, DB, uDADataTable,
cxControls, cxContainer, cxEdit, cxTextEdit, cxDBEdit, cxControls, cxContainer, cxEdit, cxTextEdit, cxDBEdit,
uIEditorDireccionEntregaPedidoProveedor, uBizPedidosProveedor, uDAInterfaces, uIEditorDireccionEntregaPedidoProveedor, uBizPedidosProveedor, uDAInterfaces,
cxGraphics, cxMaskEdit, cxDropDownEdit; cxGraphics, cxMaskEdit, cxDropDownEdit, cxLookAndFeels, cxLookAndFeelPainters;
type type
TfEditorDireccionEntregaPedidoProveedor = class(TForm, IEditorDireccionEntregaPedidoProveedor) TfEditorDireccionEntregaPedidoProveedor = class(TForm, IEditorDireccionEntregaPedidoProveedor)
@ -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,30 @@ 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; 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 TfEditorDireccionEntregaPedidoProveedor.CargarProvincias; procedure TfEditorDireccionEntregaPedidoProveedor.CargarProvincias;
@ -146,6 +150,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

@ -17,7 +17,7 @@ BEGIN
VALUE "InternalName", "FactuGES Servidor\0" VALUE "InternalName", "FactuGES Servidor\0"
VALUE "ProductName", "FactuGES Servidor\0" VALUE "ProductName", "FactuGES Servidor\0"
VALUE "ProductVersion", "1.0.8.0\0" VALUE "ProductVersion", "1.0.8.0\0"
VALUE "CompileDate", "lunes, 19 de julio de 2010 18:25\0" VALUE "CompileDate", "martes, 20 de julio de 2010 10:55\0"
END END
END END
BLOCK "VarFileInfo" BLOCK "VarFileInfo"