Contratos -> mostrar teléfonos del cliente en la ficha del contrato

git-svn-id: https://192.168.0.254/svn/Proyectos.Acana_FactuGES2/trunk@491 f4e31baf-9722-1c47-927c-6f952f962d4b
This commit is contained in:
David Arranz 2009-12-17 15:02:36 +00:00
parent 18749d1756
commit af71604151
4 changed files with 116 additions and 246 deletions

View File

@ -410,6 +410,7 @@ object srvContratosCliente: TsrvContratosCliente
Name = 'REFERENCIA'
DataType = datString
Size = 255
ServerAutoRefresh = True
DictionaryEntry = 'ContratosCliente_REFERENCIA'
end
item

View File

@ -15,8 +15,6 @@ inherited frViewContratoCliente: TfrViewContratoCliente
TabOrder = 0
TabStop = False
AutoContentSizes = [acsWidth, acsHeight]
ExplicitWidth = 939
ExplicitHeight = 392
DesignSize = (
810
449)
@ -182,17 +180,13 @@ inherited frViewContratoCliente: TfrViewContratoCliente
Width = 224
end
inherited edtNIFCIF: TcxDBTextEdit
Left = 301
ExplicitLeft = 301
ExplicitWidth = 103
Width = 103
end
inherited bVerFichaCliente: TBitBtn
Left = 212
ExplicitLeft = 212
end
inherited edtPersonaContacto: TcxDBTextEdit
ExplicitWidth = 283
Width = 283
end
inherited edtDireccion: TcxMemo
ExplicitWidth = 121
Width = 121
@ -201,17 +195,13 @@ inherited frViewContratoCliente: TfrViewContratoCliente
Left = 381
ExplicitLeft = 381
end
inherited bElegirPersonaContacto: TButton
Left = 381
ExplicitLeft = 381
end
inherited edtTelefonos: TcxTextEdit
Left = 226
ExplicitLeft = 226
ExplicitWidth = 193
Width = 193
end
inherited edtReferencia: TcxDBTextEdit
Left = 268
ExplicitLeft = 268
ExplicitWidth = 103
Width = 103
end

View File

@ -21,7 +21,7 @@ inherited frViewDatosYSeleccionClienteContrato: TfrViewDatosYSeleccionClienteCon
447
224)
object edtlNombre: TcxDBTextEdit
Left = 71
Left = 66
Top = 41
Anchors = [akLeft, akTop, akRight]
AutoSize = False
@ -43,8 +43,8 @@ inherited frViewDatosYSeleccionClienteContrato: TfrViewDatosYSeleccionClienteCon
Width = 224
end
object edtNIFCIF: TcxDBTextEdit
Left = 334
Top = 41
Left = 66
Top = 68
Anchors = [akLeft, akTop, akRight]
AutoSize = False
DataBinding.DataField = 'NIF_CIF'
@ -154,12 +154,12 @@ inherited frViewDatosYSeleccionClienteContrato: TfrViewDatosYSeleccionClienteCon
end
object bVerFichaCliente: TBitBtn
Left = 245
Top = 185
Top = 181
Width = 192
Height = 25
Action = actVerContacto
Caption = 'Ver ficha completa del cliente...'
TabOrder = 10
TabOrder = 8
Glyph.Data = {
36040000424D3604000000000000360000002800000010000000100000000100
2000000000000004000000000000000000000000000000000000FF00FF00FF00
@ -196,28 +196,8 @@ inherited frViewDatosYSeleccionClienteContrato: TfrViewDatosYSeleccionClienteCon
FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00
FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00}
end
object edtPersonaContacto: TcxDBTextEdit
Left = 71
Top = 156
Anchors = [akLeft, akTop, akRight]
AutoSize = False
DataBinding.DataField = 'PERSONA_CONTACTO'
DataBinding.DataSource = dsContrato
ParentFont = False
Style.BorderColor = clWindowFrame
Style.BorderStyle = ebs3D
Style.HotTrack = False
Style.LookAndFeel.NativeStyle = True
StyleDisabled.LookAndFeel.NativeStyle = True
StyleDisabled.TextColor = clWindowText
StyleFocused.LookAndFeel.NativeStyle = True
StyleHot.LookAndFeel.NativeStyle = True
TabOrder = 8
Height = 21
Width = 283
end
object edtDireccion: TcxMemo
Left = 71
Left = 66
Top = 95
Style.BorderColor = clWindowFrame
Style.BorderStyle = ebs3D
@ -231,46 +211,38 @@ inherited frViewDatosYSeleccionClienteContrato: TfrViewDatosYSeleccionClienteCon
StyleFocused.LookAndFeel.NativeStyle = True
StyleHot.LookAndFeel.Kind = lfStandard
StyleHot.LookAndFeel.NativeStyle = True
TabOrder = 6
Height = 53
Width = 437
end
object bElegirDireccion: TButton
Left = 414
Top = 95
Width = 23
Height = 25
Action = actElegirDireccion
TabOrder = 7
end
object bElegirPersonaContacto: TButton
Left = 414
Top = 154
Width = 23
Height = 25
Action = actElegirPersonaContacto
TabOrder = 9
end
object edtTelefonos: TcxTextEdit
Left = 239
Top = 68
Style.BorderColor = clWindowFrame
Style.BorderStyle = ebs3D
Style.HotTrack = False
Style.LookAndFeel.Kind = lfStandard
Style.LookAndFeel.NativeStyle = True
StyleDisabled.LookAndFeel.Kind = lfStandard
StyleDisabled.LookAndFeel.NativeStyle = True
StyleDisabled.TextColor = clWindowText
StyleFocused.LookAndFeel.Kind = lfStandard
StyleFocused.LookAndFeel.NativeStyle = True
StyleHot.LookAndFeel.Kind = lfStandard
StyleHot.LookAndFeel.NativeStyle = True
TabOrder = 5
Height = 53
Width = 437
end
object bElegirDireccion: TButton
Left = 414
Top = 95
Width = 23
Height = 25
Action = actElegirDireccion
TabOrder = 6
end
object edtTelefonos: TcxTextEdit
Left = 66
Top = 154
Style.BorderColor = clWindowFrame
Style.BorderStyle = ebs3D
Style.HotTrack = False
Style.LookAndFeel.Kind = lfStandard
Style.LookAndFeel.NativeStyle = True
StyleDisabled.LookAndFeel.Kind = lfStandard
StyleDisabled.LookAndFeel.NativeStyle = True
StyleDisabled.TextColor = clWindowText
StyleFocused.LookAndFeel.Kind = lfStandard
StyleFocused.LookAndFeel.NativeStyle = True
StyleHot.LookAndFeel.Kind = lfStandard
StyleHot.LookAndFeel.NativeStyle = True
TabOrder = 7
Width = 193
end
object edtReferencia: TcxDBTextEdit
Left = 71
Left = 284
Top = 68
Anchors = [akLeft, akTop, akRight]
AutoSize = False
@ -317,37 +289,59 @@ inherited frViewDatosYSeleccionClienteContrato: TfrViewDatosYSeleccionClienteCon
ControlOptions.ShowBorder = False
end
end
object dxLayoutControl1Group4: TdxLayoutGroup
ShowCaption = False
Hidden = True
LayoutDirection = ldHorizontal
ShowBorder = False
object dxLayoutControl1Item1: TdxLayoutItem
AutoAligns = [aaVertical]
AlignHorz = ahClient
Caption = 'Nombre:'
Control = edtlNombre
ControlOptions.ShowBorder = False
end
object dxLayoutControl1Item2: TdxLayoutItem
AutoAligns = [aaVertical]
AlignHorz = ahRight
Caption = 'NIF/CIF:'
Control = edtNIFCIF
ControlOptions.ShowBorder = False
end
object dxLayoutControl1Item1: TdxLayoutItem
AutoAligns = [aaVertical]
AlignHorz = ahClient
Caption = 'Nombre:'
Control = edtlNombre
ControlOptions.ShowBorder = False
end
object dxLayoutControl1Group7: TdxLayoutGroup
ShowCaption = False
Hidden = True
LayoutDirection = ldHorizontal
ShowBorder = False
object dxLayoutControl1Item11: TdxLayoutItem
AutoAligns = [aaVertical]
AlignHorz = ahClient
Caption = 'Referencia:'
Control = edtReferencia
ControlOptions.ShowBorder = False
object dxLayoutControl1Group3: TdxLayoutGroup
ShowCaption = False
Hidden = True
LayoutDirection = ldHorizontal
ShowBorder = False
object dxLayoutControl1Item2: TdxLayoutItem
AutoAligns = [aaVertical]
AlignHorz = ahClient
Caption = 'NIF/CIF:'
Control = edtNIFCIF
ControlOptions.ShowBorder = False
end
object dxLayoutControl1Item11: TdxLayoutItem
AutoAligns = [aaVertical]
AlignHorz = ahClient
Caption = 'Referencia:'
Control = edtReferencia
ControlOptions.ShowBorder = False
end
end
object dxLayoutControl1Group2: TdxLayoutGroup
ShowCaption = False
Hidden = True
LayoutDirection = ldHorizontal
ShowBorder = False
object dxLayoutControl1Item4: TdxLayoutItem
AutoAligns = []
AlignHorz = ahClient
AlignVert = avCenter
Caption = 'Direcci'#243'n:'
CaptionOptions.AlignVert = tavTop
Control = edtDireccion
ControlOptions.ShowBorder = False
end
object dxLayoutControl1Item5: TdxLayoutItem
AutoAligns = [aaVertical]
AlignHorz = ahRight
Caption = 'Button4'
ShowCaption = False
Control = bElegirDireccion
ControlOptions.ShowBorder = False
end
end
object dxLayoutControl1Item10: TdxLayoutItem
AutoAligns = [aaVertical]
@ -358,55 +352,6 @@ inherited frViewDatosYSeleccionClienteContrato: TfrViewDatosYSeleccionClienteCon
end
end
end
object dxLayoutControl1Group2: TdxLayoutGroup
ShowCaption = False
Hidden = True
ShowBorder = False
object dxLayoutControl1Group3: TdxLayoutGroup
ShowCaption = False
Hidden = True
LayoutDirection = ldHorizontal
ShowBorder = False
object dxLayoutControl1Item4: TdxLayoutItem
AutoAligns = []
AlignHorz = ahClient
AlignVert = avCenter
Caption = 'Direcci'#243'n'
CaptionOptions.AlignVert = tavTop
Control = edtDireccion
ControlOptions.ShowBorder = False
end
object dxLayoutControl1Item5: TdxLayoutItem
AutoAligns = [aaVertical]
AlignHorz = ahRight
Caption = 'Button4'
ShowCaption = False
Control = bElegirDireccion
ControlOptions.ShowBorder = False
end
end
object dxLayoutControl1Group5: TdxLayoutGroup
ShowCaption = False
Hidden = True
LayoutDirection = ldHorizontal
ShowBorder = False
object dxLayoutControl1Item3: TdxLayoutItem
AutoAligns = []
AlignHorz = ahClient
AlignVert = avCenter
Caption = 'Contacto:'
Control = edtPersonaContacto
ControlOptions.ShowBorder = False
end
object dxLayoutControl1Item6: TdxLayoutItem
AutoAligns = [aaVertical]
AlignHorz = ahRight
ShowCaption = False
Control = bElegirPersonaContacto
ControlOptions.ShowBorder = False
end
end
end
object dxLayoutControl1Item9: TdxLayoutItem
AutoAligns = [aaVertical]
AlignHorz = ahRight
@ -418,12 +363,12 @@ inherited frViewDatosYSeleccionClienteContrato: TfrViewDatosYSeleccionClienteCon
end
end
object dsCliente: TDADataSource
Left = 400
Left = 376
Top = 8
end
object ActionList1: TActionList
Images = PngImageList
Left = 368
Left = 344
Top = 8
object actElegirContacto: TAction
Caption = 'Elegir un cliente'
@ -446,11 +391,6 @@ inherited frViewDatosYSeleccionClienteContrato: TfrViewDatosYSeleccionClienteCon
OnExecute = actElegirDireccionExecute
OnUpdate = actElegirDireccionUpdate
end
object actElegirPersonaContacto: TAction
Caption = '...'
OnExecute = actElegirPersonaContactoExecute
OnUpdate = actElegirPersonaContactoUpdate
end
end
object PngImageList: TPngImageList
PngImages = <
@ -531,12 +471,12 @@ inherited frViewDatosYSeleccionClienteContrato: TfrViewDatosYSeleccionClienteCon
Name = 'PngImage2'
Background = clWindow
end>
Left = 304
Left = 280
Top = 8
Bitmap = {}
end
object dsContrato: TDADataSource
Left = 336
Left = 312
Top = 8
end
end

View File

@ -33,7 +33,6 @@ type
property OnClienteChanged : TNotifyEvent read GetOnClienteChanged
write SetOnClienteChanged;
procedure ElegirPersonaContacto;
procedure ElegirDireccionParaContrato;
procedure ElegirCliente;
procedure VerFichaCliente;
@ -64,36 +63,25 @@ type
dxLayoutControl1Group2: TdxLayoutGroup;
dsContrato: TDADataSource;
actElegirDireccion: TAction;
actElegirPersonaContacto: TAction;
dxLayoutControl1Item3: TdxLayoutItem;
edtPersonaContacto: TcxDBTextEdit;
dxLayoutControl1Item4: TdxLayoutItem;
edtDireccion: TcxMemo;
bElegirDireccion: TButton;
dxLayoutControl1Item5: TdxLayoutItem;
dxLayoutControl1Group3: TdxLayoutGroup;
dxLayoutControl1Item6: TdxLayoutItem;
bElegirPersonaContacto: TButton;
dxLayoutControl1Group5: TdxLayoutGroup;
dxLayoutControl1Item10: TdxLayoutItem;
edtTelefonos: TcxTextEdit;
dxLayoutControl1Item11: TdxLayoutItem;
edtReferencia: TcxDBTextEdit;
dxLayoutControl1Group6: TdxLayoutGroup;
dxLayoutControl1Group4: TdxLayoutGroup;
dxLayoutControl1Group7: TdxLayoutGroup;
dxLayoutControl1Group3: TdxLayoutGroup;
procedure actElegirContactoExecute(Sender: TObject);
procedure actAnadirContactoExecute(Sender: TObject);
procedure actVerContactoUpdate(Sender: TObject);
procedure edtPersonaContactoPropertiesButtonClick(Sender: TObject;
AButtonIndex: Integer);
procedure edtDireccionPropertiesButtonClick(Sender: TObject;
AButtonIndex: Integer);
procedure actVerContactoExecute(Sender: TObject);
procedure actElegirDireccionUpdate(Sender: TObject);
procedure actElegirDireccionExecute(Sender: TObject);
procedure actElegirPersonaContactoExecute(Sender: TObject);
procedure actElegirPersonaContactoUpdate(Sender: TObject);
private
FOnClienteChanged : TNotifyEvent;
@ -118,7 +106,6 @@ type
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
procedure ElegirPersonaContacto;
procedure ElegirDireccionParaContrato;
procedure ElegirCliente;
procedure VerFichaCliente;
@ -135,7 +122,7 @@ implementation
{$R *.dfm}
uses
uDataModuleClientes, Math, uCustomView, uBizContactosPersonal, uDialogUtils;
uDataModuleClientes, Math, uCustomView, uDialogUtils;
procedure TfrViewDatosYSeleccionClienteContrato.actElegirContactoExecute(Sender: TObject);
@ -160,23 +147,6 @@ begin
and (FCliente.Direcciones.RecordCount > 0);
end;
procedure TfrViewDatosYSeleccionClienteContrato.actElegirPersonaContactoExecute(
Sender: TObject);
begin
inherited;
ElegirPersonaContacto;
RefrescarDireccion;
end;
procedure TfrViewDatosYSeleccionClienteContrato.actElegirPersonaContactoUpdate(
Sender: TObject);
begin
inherited;
(Sender as TAction).Enabled := Assigned(FCliente) and
Assigned(FCliente.Personal) and (FCliente.Personal.Active)
and (FCliente.Personal.RecordCount > 0);
end;
procedure TfrViewDatosYSeleccionClienteContrato.actAnadirContactoExecute(
Sender: TObject);
begin
@ -216,7 +186,6 @@ begin
edtlNombre.Enabled := False;
edtNIFCIF.Enabled := False;
edtDireccion.Enabled := False;
edtPersonaContacto.Enabled := False;
edtReferencia.Enabled := False;
edtTelefonos.Enabled := False;
end;
@ -235,13 +204,6 @@ begin
ElegirDireccionParaContrato;
end;
procedure TfrViewDatosYSeleccionClienteContrato.edtPersonaContactoPropertiesButtonClick(
Sender: TObject; AButtonIndex: Integer);
begin
inherited;
ElegirPersonaContacto;
end;
procedure TfrViewDatosYSeleccionClienteContrato.ElegirCliente;
var
ACliente : IBizCliente;
@ -269,47 +231,33 @@ begin
if Assigned(ADireccion) then
begin
FContrato.Edit;
if ADireccion.IDIsNull then // Se ha elegido la dirección de razón social
begin
FContrato.ClearField('ID_DIRECCION');
FContrato.ClearField('IMPORTE_PORTE');
end
else begin
FContrato.ID_DIRECCION := ADireccion.ID;
FContrato.IMPORTE_PORTE := ADireccion.PORTE;
end;
try
if ADireccion.IDIsNull then // Se ha elegido la dirección de razón social
begin
FContrato.ClearField('ID_DIRECCION');
FContrato.ClearField('IMPORTE_PORTE');
end
else begin
FContrato.ID_DIRECCION := ADireccion.ID;
FContrato.IMPORTE_PORTE := ADireccion.PORTE;
end;
with FContrato do
begin
CALLE := ADireccion.CALLE;
POBLACION := ADireccion.POBLACION;
CODIGO_POSTAL := ADireccion.CODIGO_POSTAL;
PROVINCIA := ADireccion.PROVINCIA;
PERSONA_CONTACTO := ADireccion.PERSONA_CONTACTO;
TELEFONO := ADireccion.TELEFONO;
MOVIL := ADireccion.MOVIL;
with FContrato do
begin
CALLE := ADireccion.CALLE;
POBLACION := ADireccion.POBLACION;
CODIGO_POSTAL := ADireccion.CODIGO_POSTAL;
PROVINCIA := ADireccion.PROVINCIA;
PERSONA_CONTACTO := ADireccion.PERSONA_CONTACTO;
TELEFONO := ADireccion.TELEFONO;
MOVIL := ADireccion.MOVIL;
end;
finally
FContrato.Post;
end;
end;
end;
procedure TfrViewDatosYSeleccionClienteContrato.ElegirPersonaContacto;
var
APersona : IBizContactoPersonal;
begin
inherited;
APersona := FClientesController.ElegirPersonaContacto(FCliente.Personal, 'El cliente dispone de personas de contacto dadas de alta en su ficha. Seleccione la que quiere utilizar.');
try
if Assigned(APersona) then
begin
FContrato.Edit;
FContrato.PERSONA_CONTACTO := APersona.NOMBRE;
end;
finally
APersona := NIL;
end;
end;
procedure TfrViewDatosYSeleccionClienteContrato.EscribirTextoDireccion;
var
ACadena : String;
@ -350,10 +298,6 @@ begin
if not FCliente.DataTable.Active then
FCliente.DataTable.Active := True;
//Solo podremos establecer persona de contacto si se ha asignado un cliente
if FCliente.ID > 0 then
edtPersonaContacto.Enabled := True;
ElegirDireccionParaContrato;
EscribirTextoDireccion;
EscribirTextoTelefonos;
@ -361,7 +305,6 @@ begin
else begin
dsCliente.DataTable := NIL;
FCliente := NIL;
edtPersonaContacto.Enabled := False;
end;
if Assigned(FOnClienteChanged) then
@ -431,12 +374,8 @@ begin
// ¿Hay cliente en el contrato?
if FCliente.ID > 0 then
begin
edtPersonaContacto.Enabled := True;
RefrescarDireccion;
end
RefrescarDireccion
else begin
edtPersonaContacto.Enabled := False;
edtDireccion.Lines.Clear;
edtTelefonos.Text := '';
end;