From 14bd15f14b571dc26ece61bbac39a85695edbf6d Mon Sep 17 00:00:00 2001 From: david Date: Tue, 9 Dec 2008 17:54:57 +0000 Subject: [PATCH] Albaranes de cliente: repaso porque no dejaba cambiar la persona de contacto a la que va el presupuesto ni copiaba la persona de contacto al cambiar de cliente. git-svn-id: https://192.168.0.254/svn/Proyectos.Tecsitel_FactuGES2/trunk@799 0c75b7a4-871f-7646-8a2f-f78d34cc349f --- .../uAlbaranesClienteController.pas | 1 - .../Views/AlbaranesCliente_view.dpk | 34 +- .../Views/AlbaranesCliente_view.dproj | 66 ++- .../Views/uEditorAlbaranCliente.dfm | 72 +-- .../Views/uEditorAlbaranCliente.pas | 94 ++-- .../Views/uViewAlbaranCliente.dfm | 115 ++-- .../Views/uViewAlbaranCliente.pas | 4 +- .../Views/uViewAlbaranDevCliente.dfm | 135 +++-- .../Views/uViewAlbaranDevCliente.pas | 3 +- .../uViewDatosYSeleccionClienteAlbaran.dfm | 489 +++++++++++++++--- .../uViewDatosYSeleccionClienteAlbaran.pas | 365 ++++++++++--- 11 files changed, 992 insertions(+), 386 deletions(-) diff --git a/Source/Modulos/Albaranes de cliente/Controller/uAlbaranesClienteController.pas b/Source/Modulos/Albaranes de cliente/Controller/uAlbaranesClienteController.pas index a3ca221e..bdaf77ed 100644 --- a/Source/Modulos/Albaranes de cliente/Controller/uAlbaranesClienteController.pas +++ b/Source/Modulos/Albaranes de cliente/Controller/uAlbaranesClienteController.pas @@ -1006,7 +1006,6 @@ begin AAlbaran.DataTable.FieldByName(fld_AlbaranesClienteCODIGO_POSTAL).Clear; AAlbaran.DataTable.FieldByName(fld_AlbaranesClientePROVINCIA).Clear; AAlbaran.DataTable.FieldByName(fld_AlbaranesClienteTELEFONO).Clear; - AAlbaran.DataTable.FieldByName(fld_AlbaranesClientePERSONA_CONTACTO).Clear; if not bEnEdicion then AAlbaran.Post; diff --git a/Source/Modulos/Albaranes de cliente/Views/AlbaranesCliente_view.dpk b/Source/Modulos/Albaranes de cliente/Views/AlbaranesCliente_view.dpk index 1bcdc056..780c6ac5 100644 --- a/Source/Modulos/Albaranes de cliente/Views/AlbaranesCliente_view.dpk +++ b/Source/Modulos/Albaranes de cliente/Views/AlbaranesCliente_view.dpk @@ -25,40 +25,14 @@ package AlbaranesCliente_view; {$IMPLICITBUILD OFF} requires + Base, + GUIBase, + ApplicationBase, AlbaranesCliente_model, AlbaranesCliente_controller, Articulos_view, Almacenes_controller, - vcl, - rtl, - PNG_D10, - PngComponentsD10, - vclactnband, - vclx, - tb2k_d10, - tbx_d10, - JvCoreD11R, - vcldb, - dbrtl, - vcljpg, - Jcl, - JclVcl, - JvSystemD11R, - JvStdCtrlsD11R, - JvPageCompsD11R, - frx11, - fs11, - frxe11, - AlbCli_FacCli_relation, - DataAbstract_Core_D11, - dsnap, - adortl, - RemObjects_Core_D11, - cxLibraryD11, - dxThemeD11, - dxGDIPlusD11, - dxLayoutControlD11, - dxComnD11; + AlbCli_FacCli_relation; contains uAlbaranesClienteViewRegister in 'uAlbaranesClienteViewRegister.pas', diff --git a/Source/Modulos/Albaranes de cliente/Views/AlbaranesCliente_view.dproj b/Source/Modulos/Albaranes de cliente/Views/AlbaranesCliente_view.dproj index e90eeb9c..2c359702 100644 --- a/Source/Modulos/Albaranes de cliente/Views/AlbaranesCliente_view.dproj +++ b/Source/Modulos/Albaranes de cliente/Views/AlbaranesCliente_view.dproj @@ -43,6 +43,30 @@ Package FalseTrueFalseFalseFalseFalseTrueFalse1000FalseFalseFalseFalseFalse308212521.0.0.01.0.0.0 + + + + + + + + + + + + + + + + + + + + + + + + File c:\archivos de programa\borland\delphi10\Bin\dclIntraweb_80_100.bpl not found File c:\archivos de programa\borland\delphi10\Bin\dclnet100.bpl not found File c:\archivos de programa\borland\delphi10\Bin\dclsoap100.bpl not found @@ -54,40 +78,14 @@ MainSource - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + +
fEditorAlbaranCliente
diff --git a/Source/Modulos/Albaranes de cliente/Views/uEditorAlbaranCliente.dfm b/Source/Modulos/Albaranes de cliente/Views/uEditorAlbaranCliente.dfm index 53793098..ef376508 100644 --- a/Source/Modulos/Albaranes de cliente/Views/uEditorAlbaranCliente.dfm +++ b/Source/Modulos/Albaranes de cliente/Views/uEditorAlbaranCliente.dfm @@ -163,7 +163,6 @@ inherited fEditorAlbaranCliente: TfEditorAlbaranCliente inherited pgPaginas: TPageControl Width = 759 Height = 406 - ActivePage = pagContenido TabOrder = 1 OnChanging = pgPaginasChanging ExplicitWidth = 759 @@ -200,10 +199,22 @@ inherited fEditorAlbaranCliente: TfEditorAlbaranCliente Height = 51 ExplicitWidth = 751 ExplicitHeight = 51 - inherited ToolButton14: TToolButton + inherited ToolButton3: TToolButton Wrap = False end - inherited FontName: TJvFontComboBox + inherited ToolButton4: TToolButton + Left = 278 + Top = 0 + ExplicitLeft = 278 + ExplicitTop = 0 + end + inherited ToolButton14: TToolButton [4] + Left = 334 + Top = 0 + ExplicitLeft = 334 + ExplicitTop = 0 + end + inherited FontName: TJvFontComboBox [5] Left = 399 Top = 0 ExplicitLeft = 399 @@ -212,10 +223,18 @@ inherited fEditorAlbaranCliente: TfEditorAlbaranCliente inherited FontSize: TEdit Left = 544 Top = 0 + Width = 58 ExplicitLeft = 544 ExplicitTop = 0 + ExplicitWidth = 58 end - inherited ToolButton13: TToolButton [7] + inherited UpDown1: TUpDown + Left = 602 + Top = 0 + ExplicitLeft = 602 + ExplicitTop = 0 + end + inherited ToolButton13: TToolButton Left = 0 Top = 0 Wrap = True @@ -223,54 +242,47 @@ inherited fEditorAlbaranCliente: TfEditorAlbaranCliente ExplicitTop = 0 ExplicitHeight = 27 end - inherited UpDown1: TUpDown [8] + inherited ToolButton6: TToolButton [9] Left = 0 Top = 27 ExplicitLeft = 0 ExplicitTop = 27 end - inherited ToolButton6: TToolButton - Left = 17 + inherited ToolButton7: TToolButton [10] + Left = 66 Top = 27 - ExplicitLeft = 17 + ExplicitLeft = 66 ExplicitTop = 27 end - inherited ToolButton7: TToolButton - Left = 83 + inherited ToolButton8: TToolButton [11] + Left = 133 Top = 27 - ExplicitLeft = 83 + ExplicitLeft = 133 ExplicitTop = 27 end - inherited ToolButton8: TToolButton - Left = 150 + inherited ToolButton12: TToolButton [12] + Left = 216 Top = 27 - ExplicitLeft = 150 - ExplicitTop = 27 - end - inherited ToolButton12: TToolButton - Left = 233 - Top = 27 - Wrap = False - ExplicitLeft = 233 + ExplicitLeft = 216 ExplicitTop = 27 ExplicitHeight = 22 end - inherited ToolButton9: TToolButton - Left = 241 + inherited ToolButton9: TToolButton [13] + Left = 224 Top = 27 - ExplicitLeft = 241 + ExplicitLeft = 224 ExplicitTop = 27 end - inherited ToolButton10: TToolButton - Left = 386 + inherited ToolButton10: TToolButton [14] + Left = 369 Top = 27 - ExplicitLeft = 386 + ExplicitLeft = 369 ExplicitTop = 27 end - inherited ToolButton11: TToolButton - Left = 511 + inherited ToolButton11: TToolButton [15] + Left = 494 Top = 27 - ExplicitLeft = 511 + ExplicitLeft = 494 ExplicitTop = 27 end end diff --git a/Source/Modulos/Albaranes de cliente/Views/uEditorAlbaranCliente.pas b/Source/Modulos/Albaranes de cliente/Views/uEditorAlbaranCliente.pas index ab10f078..eb6c1859 100644 --- a/Source/Modulos/Albaranes de cliente/Views/uEditorAlbaranCliente.pas +++ b/Source/Modulos/Albaranes de cliente/Views/uEditorAlbaranCliente.pas @@ -242,60 +242,48 @@ end; procedure TfEditorAlbaranCliente.OnClienteChanged(Sender: TObject); var - AClientesController : IClientesController; ADireccion : IBizDireccionesContacto; begin if Assigned(FAlbaran) then begin FAlbaran.Cliente := ViewAlbaran.ViewClienteAlbaran.Cliente; - AClientesController := TClientesController.Create; - try - // Avisar si no hay datos bancarios - {if not AClientesController.TieneDatosBancarios(FAlbaran.Cliente) then - ShowWarningMessage('Este cliente no tiene datos bancarios en su ficha');} + // Avisar si no hay datos bancarios + {if not AClientesController.TieneDatosBancarios(FAlbaran.Cliente) then + ShowWarningMessage('Este cliente no tiene datos bancarios en su ficha');} - // Elegir la dirección de envio - case FAlbaran.Cliente.Direcciones.RecordCount of - 0 : begin - ADireccion := NIL; - //ShowWarningMessage('Este cliente no tiene ninguna dirección de envío en su ficha'); - end; - 1 : begin - ADireccion := FAlbaran.Cliente.Direcciones; - end - else begin - ADireccion := AClientesController.ElegirDireccionEntrega(FAlbaran.Cliente, 'Seleccione la dirección del cliente que quiere utilizar como dirección de envio de este albaran.'); - end; - end; - - // Si hay dirección de envio, copiarla al albarán y poner el coste del porte - if Assigned(ADireccion) then - begin - try - FAlbaran.Edit; - FAlbaran.IMPORTE_PORTE := ADireccion.PORTE; - FController.CopiarDireccionEnvio(ADireccion, FAlbaran); - finally - ADireccion := NIL; - end; - end - else begin - FController.QuitarDireccionEnvio(FAlbaran); - FAlbaran.Edit; - FAlbaran.IMPORTE_PORTE := 0; - end; - - // Si el pedido tiene detalles hay que mirar si los descuentos - // para los artículos hay que cambiarlos. - if (FAlbaran.Detalles.RecordCount > 0) then - begin - FController.DetallesController.ActualizarDetalles(FAlbaran.Detalles, FAlbaran.Cliente); - end; - - finally - AClientesController := NIL; + // Elegir la dirección de envio + case FAlbaran.Cliente.Direcciones.RecordCount of + 0 : begin + ADireccion := NIL; + //ShowWarningMessage('Este cliente no tiene ninguna dirección de envío en su ficha'); + end; + 1 : begin + ADireccion := FAlbaran.Cliente.Direcciones; + end end; + + // Si hay dirección de envio, copiarla al albarán y poner el coste del porte + if Assigned(ADireccion) then + begin + try + FAlbaran.Edit; + FAlbaran.IMPORTE_PORTE := ADireccion.PORTE; + FController.CopiarDireccionEnvio(ADireccion, FAlbaran); + finally + ADireccion := NIL; + end; + end + else begin + FController.QuitarDireccionEnvio(FAlbaran); + FAlbaran.Edit; + FAlbaran.IMPORTE_PORTE := 0; + end; + + // Si el pedido tiene detalles hay que mirar si los descuentos + // para los artículos hay que cambiarlos. + if (FAlbaran.Detalles.RecordCount > 0) then + FController.DetallesController.ActualizarDetalles(FAlbaran.Detalles, FAlbaran.Cliente); end; end; @@ -363,11 +351,14 @@ begin if Assigned(FViewAlbaran) then begin - FViewAlbaran.Albaran := FAlbaran; - ViewAlbaran.ViewClienteAlbaran.Cliente := FAlbaran.Cliente; - ViewAlbaran.ViewClienteAlbaran.OnClienteChanged := OnClienteChanged; - frViewDetallesAlbaranCliente1.Detalles := FAlbaran.Detalles; - frViewDetallesAlbaranCliente1.Albaran := FAlbaran; //Para poder sacar los descuento del articulos segun el cliente seleccionado + ViewAlbaran.ViewClienteAlbaran.OnClienteChanged := NIL; + try + FViewAlbaran.Albaran := FAlbaran; + frViewDetallesAlbaranCliente1.Detalles := FAlbaran.Detalles; + frViewDetallesAlbaranCliente1.Albaran := FAlbaran; //Para poder sacar los descuento del articulos segun el cliente seleccionado + finally + ViewAlbaran.ViewClienteAlbaran.OnClienteChanged := OnClienteChanged; + end; end; end else begin @@ -379,7 +370,6 @@ begin begin FViewAlbaran.Albaran := NIL; ViewAlbaran.ViewClienteAlbaran.OnClienteChanged := NIL; - ViewAlbaran.ViewClienteAlbaran.Cliente := NIL; frViewDetallesAlbaranCliente1.Detalles := NIL; frViewDetallesAlbaranCliente1.Albaran := NIL; end; diff --git a/Source/Modulos/Albaranes de cliente/Views/uViewAlbaranCliente.dfm b/Source/Modulos/Albaranes de cliente/Views/uViewAlbaranCliente.dfm index e056a484..75fa55b7 100644 --- a/Source/Modulos/Albaranes de cliente/Views/uViewAlbaranCliente.dfm +++ b/Source/Modulos/Albaranes de cliente/Views/uViewAlbaranCliente.dfm @@ -1,23 +1,24 @@ inherited frViewAlbaranCliente: TfrViewAlbaranCliente Width = 903 - Height = 550 + Height = 506 OnCreate = CustomViewCreate OnDestroy = CustomViewDestroy ExplicitWidth = 903 - ExplicitHeight = 550 + ExplicitHeight = 506 object dxLayoutControl1: TdxLayoutControl Left = 0 Top = 0 Width = 903 - Height = 550 + Height = 506 Align = alClient ParentBackground = True TabOrder = 0 TabStop = False AutoContentSizes = [acsWidth, acsHeight] + ExplicitHeight = 550 DesignSize = ( 903 - 550) + 506) object Label1: TLabel Left = 22 Top = 450 @@ -59,8 +60,8 @@ inherited frViewAlbaranCliente: TfrViewAlbaranCliente Width = 336 end object memObservaciones: TcxDBMemo - Left = 475 - Top = 338 + Left = 478 + Top = 356 Anchors = [akLeft, akTop, akRight, akBottom] DataBinding.DataField = 'OBSERVACIONES' DataBinding.DataSource = DADataSource @@ -77,8 +78,8 @@ inherited frViewAlbaranCliente: TfrViewAlbaranCliente StyleHot.LookAndFeel.NativeStyle = True StyleHot.LookAndFeel.SkinName = '' TabOrder = 21 - Height = 141 - Width = 399 + Height = 69 + Width = 403 end object eReferencia: TcxDBTextEdit Left = 116 @@ -134,7 +135,7 @@ inherited frViewAlbaranCliente: TfrViewAlbaranCliente Width = 336 end object eCodigoPostal: TcxDBTextEdit - Left = 380 + Left = 383 Top = 251 DataBinding.DataField = 'CODIGO_POSTAL' DataBinding.DataSource = DADataSource @@ -204,7 +205,7 @@ inherited frViewAlbaranCliente: TfrViewAlbaranCliente Width = 336 end object bElegirDireccion: TBitBtn - Left = 273 + Left = 276 Top = 359 Width = 172 Height = 23 @@ -213,7 +214,7 @@ inherited frViewAlbaranCliente: TfrViewAlbaranCliente TabOrder = 14 end object Button1: TButton - Left = 313 + Left = 316 Top = 138 Width = 132 Height = 23 @@ -282,7 +283,7 @@ inherited frViewAlbaranCliente: TfrViewAlbaranCliente Width = 198 end object bFormasPago: TButton - Left = 313 + Left = 316 Top = 109 Width = 132 Height = 23 @@ -291,8 +292,8 @@ inherited frViewAlbaranCliente: TfrViewAlbaranCliente OnClick = bFormasPagoClick end object eFechaRecepcion: TcxDBDateEdit - Left = 609 - Top = 281 + Left = 612 + Top = 299 Anchors = [akLeft, akTop, akRight] DataBinding.DataField = 'FECHA_RECEPCION' DataBinding.DataSource = DADataSource @@ -393,8 +394,8 @@ inherited frViewAlbaranCliente: TfrViewAlbaranCliente Width = 336 end object eFechaPrevista: TcxDBDateEdit - Left = 609 - Top = 227 + Left = 612 + Top = 245 Anchors = [akLeft, akTop, akRight] DataBinding.DataField = 'FECHA_PREVISTA_ENVIO' DataBinding.DataSource = DADataSource @@ -453,8 +454,8 @@ inherited frViewAlbaranCliente: TfrViewAlbaranCliente Width = 336 end object eFechaEnvio: TcxDBDateEdit - Left = 609 - Top = 254 + Left = 612 + Top = 272 Anchors = [akLeft, akTop, akRight] DataBinding.DataField = 'FECHA_ENVIO' DataBinding.DataSource = DADataSource @@ -540,10 +541,10 @@ inherited frViewAlbaranCliente: TfrViewAlbaranCliente Width = 336 end inline frViewDatosYSeleccionClienteAlbaran1: TfrViewDatosYSeleccionClienteAlbaran - Left = 475 + Left = 478 Top = 28 - Width = 413 - Height = 163 + Width = 406 + Height = 181 Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText Font.Height = -11 @@ -552,41 +553,83 @@ inherited frViewAlbaranCliente: TfrViewAlbaranCliente ParentFont = False TabOrder = 17 ReadOnly = False - ExplicitLeft = 475 + ExplicitLeft = 478 ExplicitTop = 28 + ExplicitWidth = 406 + ExplicitHeight = 181 inherited dxLayoutControl1: TdxLayoutControl + Width = 406 + Height = 181 + ExplicitWidth = 406 + ExplicitHeight = 181 inherited edtlNombre: TcxDBTextEdit Style.LookAndFeel.SkinName = '' StyleDisabled.LookAndFeel.SkinName = '' StyleFocused.LookAndFeel.SkinName = '' StyleHot.LookAndFeel.SkinName = '' - ExplicitWidth = 276 - Width = 276 + ExplicitWidth = 224 + Width = 224 end - inherited bElegirDireccion: TButton - Left = 373 - ExplicitLeft = 373 + inherited edtNIFCIF: TcxDBTextEdit + Left = 290 + Style.LookAndFeel.SkinName = '' + StyleDisabled.LookAndFeel.SkinName = '' + StyleFocused.LookAndFeel.SkinName = '' + StyleHot.LookAndFeel.SkinName = '' + ExplicitLeft = 290 + end + inherited Button3: TBitBtn + Left = 201 + Top = 139 + ExplicitLeft = 201 + ExplicitTop = 139 end inherited edtPersonaContacto: TcxDBTextEdit + Top = 110 Style.LookAndFeel.SkinName = '' StyleDisabled.LookAndFeel.SkinName = '' StyleFocused.LookAndFeel.SkinName = '' StyleHot.LookAndFeel.SkinName = '' - ExplicitWidth = 403 - Width = 403 + ExplicitTop = 110 + ExplicitWidth = 283 + Width = 283 end - inherited bElegirPersonaContacto: TButton - Left = 373 - ExplicitLeft = 373 - end - inherited memDireccion: TcxMemo + inherited edtDireccion: TcxMemo Style.LookAndFeel.SkinName = '' StyleDisabled.LookAndFeel.SkinName = '' StyleFocused.LookAndFeel.SkinName = '' StyleHot.LookAndFeel.SkinName = '' - ExplicitWidth = 340 - Width = 340 + ExplicitWidth = 287 + ExplicitHeight = 34 + Height = 34 + Width = 287 end + inherited Button4: TButton + Left = 370 + ExplicitLeft = 370 + end + inherited Button5: TButton + Left = 370 + Top = 108 + ExplicitLeft = 370 + ExplicitTop = 108 + end + end + inherited dsCliente: TDADataSource + Left = 352 + Top = 32 + end + inherited ActionList1: TActionList + Left = 312 + Top = 32 + end + inherited PngImageList: TPngImageList + Left = 232 + Top = 32 + end + inherited dsAlbaran: TDADataSource + Left = 272 + Top = 32 end end object dxLayoutControl1Group_Root: TdxLayoutGroup diff --git a/Source/Modulos/Albaranes de cliente/Views/uViewAlbaranCliente.pas b/Source/Modulos/Albaranes de cliente/Views/uViewAlbaranCliente.pas index 27c57008..c7615c43 100644 --- a/Source/Modulos/Albaranes de cliente/Views/uViewAlbaranCliente.pas +++ b/Source/Modulos/Albaranes de cliente/Views/uViewAlbaranCliente.pas @@ -429,7 +429,7 @@ begin if Assigned(FAlbaran) then begin DADataSource.DataTable := FAlbaran.DataTable; - FViewClienteAlbaran.AlbaranCliente := FAlbaran; + FViewClienteAlbaran.Albaran := FAlbaran; FFormasPago := FFormasPagoController.BuscarTodos; dsFormaPago.DataTable := FFormasPago.DataTable; @@ -481,7 +481,7 @@ begin end else begin DADataSource.DataTable := NIL; - FViewClienteAlbaran.AlbaranCliente := NIL; + FViewClienteAlbaran.Albaran := NIL; // FPedidoAsociado := NIL; dsFormaPago.DataTable := NIL; dsAlmacenes.DataTable := NIL; diff --git a/Source/Modulos/Albaranes de cliente/Views/uViewAlbaranDevCliente.dfm b/Source/Modulos/Albaranes de cliente/Views/uViewAlbaranDevCliente.dfm index fc6cac92..9fbecb4c 100644 --- a/Source/Modulos/Albaranes de cliente/Views/uViewAlbaranDevCliente.dfm +++ b/Source/Modulos/Albaranes de cliente/Views/uViewAlbaranDevCliente.dfm @@ -9,70 +9,32 @@ inherited frViewAlbaranDevCliente: TfrViewAlbaranDevCliente StyleDisabled.LookAndFeel.SkinName = '' StyleFocused.LookAndFeel.SkinName = '' StyleHot.LookAndFeel.SkinName = '' + ExplicitWidth = 336 + Width = 336 end inherited memObservaciones: TcxDBMemo Style.LookAndFeel.SkinName = '' StyleDisabled.LookAndFeel.SkinName = '' StyleFocused.LookAndFeel.SkinName = '' StyleHot.LookAndFeel.SkinName = '' + ExplicitHeight = 69 + Height = 69 end inherited eReferencia: TcxDBTextEdit Style.LookAndFeel.SkinName = '' StyleDisabled.LookAndFeel.SkinName = '' StyleFocused.LookAndFeel.SkinName = '' StyleHot.LookAndFeel.SkinName = '' - end - inherited frViewClienteAlbaran: TfrViewDatosYSeleccionCliente - inherited dxLayoutControl1: TdxLayoutControl - inherited edtlNombre: TcxDBTextEdit - Style.LookAndFeel.SkinName = '' - StyleDisabled.LookAndFeel.SkinName = '' - StyleFocused.LookAndFeel.SkinName = '' - StyleHot.LookAndFeel.SkinName = '' - end - inherited edtNIFCIF: TcxDBTextEdit - Style.LookAndFeel.SkinName = '' - StyleDisabled.LookAndFeel.SkinName = '' - StyleFocused.LookAndFeel.SkinName = '' - StyleHot.LookAndFeel.SkinName = '' - end - inherited edtCalle: TcxDBTextEdit - Style.LookAndFeel.SkinName = '' - StyleDisabled.LookAndFeel.SkinName = '' - StyleFocused.LookAndFeel.SkinName = '' - StyleHot.LookAndFeel.SkinName = '' - end - inherited edtPoblacion: TcxDBTextEdit - Style.LookAndFeel.SkinName = '' - StyleDisabled.LookAndFeel.SkinName = '' - StyleFocused.LookAndFeel.SkinName = '' - StyleHot.LookAndFeel.SkinName = '' - end - inherited edtProvincia: TcxDBTextEdit - Style.LookAndFeel.SkinName = '' - StyleDisabled.LookAndFeel.SkinName = '' - StyleFocused.LookAndFeel.SkinName = '' - StyleHot.LookAndFeel.SkinName = '' - end - inherited edtCodigoPostal: TcxDBTextEdit - Style.LookAndFeel.SkinName = '' - StyleDisabled.LookAndFeel.SkinName = '' - StyleFocused.LookAndFeel.SkinName = '' - StyleHot.LookAndFeel.SkinName = '' - end - end + ExplicitWidth = 336 + Width = 336 end inherited eCalle: TcxDBTextEdit Style.LookAndFeel.SkinName = '' StyleDisabled.LookAndFeel.SkinName = '' StyleFocused.LookAndFeel.SkinName = '' StyleHot.LookAndFeel.SkinName = '' - end - inherited ePoblacion: TcxDBTextEdit - Style.LookAndFeel.SkinName = '' - StyleDisabled.LookAndFeel.SkinName = '' - StyleFocused.LookAndFeel.SkinName = '' - StyleHot.LookAndFeel.SkinName = '' + ExplicitWidth = 336 + Width = 336 end inherited eCodigoPostal: TcxDBTextEdit Style.LookAndFeel.SkinName = '' @@ -80,71 +42,140 @@ inherited frViewAlbaranDevCliente: TfrViewAlbaranDevCliente StyleFocused.LookAndFeel.SkinName = '' StyleHot.LookAndFeel.SkinName = '' end - inherited eProvincia: TcxDBTextEdit - Style.LookAndFeel.SkinName = '' - StyleDisabled.LookAndFeel.SkinName = '' - StyleFocused.LookAndFeel.SkinName = '' - StyleHot.LookAndFeel.SkinName = '' - end inherited ePersonaContacto: TcxDBTextEdit Style.LookAndFeel.SkinName = '' StyleDisabled.LookAndFeel.SkinName = '' StyleFocused.LookAndFeel.SkinName = '' StyleHot.LookAndFeel.SkinName = '' + ExplicitWidth = 336 + Width = 336 end inherited eTlfTrabajo: TcxDBTextEdit Style.LookAndFeel.SkinName = '' StyleDisabled.LookAndFeel.SkinName = '' StyleFocused.LookAndFeel.SkinName = '' StyleHot.LookAndFeel.SkinName = '' + ExplicitWidth = 336 + Width = 336 end inherited eReferenciaPedidoCli: TcxTextEdit Style.LookAndFeel.SkinName = '' StyleDisabled.LookAndFeel.SkinName = '' StyleFocused.LookAndFeel.SkinName = '' StyleHot.LookAndFeel.SkinName = '' + ExplicitWidth = 198 + Width = 198 end inherited cbFormaPago: TcxDBLookupComboBox Style.LookAndFeel.SkinName = '' StyleDisabled.LookAndFeel.SkinName = '' StyleFocused.LookAndFeel.SkinName = '' StyleHot.LookAndFeel.SkinName = '' + ExplicitWidth = 198 + Width = 198 end inherited eFechaRecepcion: TcxDBDateEdit Style.LookAndFeel.SkinName = '' StyleDisabled.LookAndFeel.SkinName = '' StyleFocused.LookAndFeel.SkinName = '' StyleHot.LookAndFeel.SkinName = '' + ExplicitWidth = 265 + Width = 265 end inherited cbAlmacen: TcxDBLookupComboBox Style.LookAndFeel.SkinName = '' StyleDisabled.LookAndFeel.SkinName = '' StyleFocused.LookAndFeel.SkinName = '' StyleHot.LookAndFeel.SkinName = '' + ExplicitWidth = 235 + Width = 235 end inherited eRefFacturaCli: TcxDBTextEdit Style.LookAndFeel.SkinName = '' StyleDisabled.LookAndFeel.SkinName = '' StyleFocused.LookAndFeel.SkinName = '' StyleHot.LookAndFeel.SkinName = '' + ExplicitWidth = 336 + Width = 336 end inherited eFechaPrevista: TcxDBDateEdit Style.LookAndFeel.SkinName = '' StyleDisabled.LookAndFeel.SkinName = '' StyleFocused.LookAndFeel.SkinName = '' StyleHot.LookAndFeel.SkinName = '' + ExplicitWidth = 265 + Width = 265 end inherited eRefCliente: TcxDBTextEdit Style.LookAndFeel.SkinName = '' StyleDisabled.LookAndFeel.SkinName = '' StyleFocused.LookAndFeel.SkinName = '' StyleHot.LookAndFeel.SkinName = '' + ExplicitWidth = 336 + Width = 336 end inherited eFechaEnvio: TcxDBDateEdit Style.LookAndFeel.SkinName = '' StyleDisabled.LookAndFeel.SkinName = '' StyleFocused.LookAndFeel.SkinName = '' StyleHot.LookAndFeel.SkinName = '' + ExplicitWidth = 265 + Width = 265 + end + inherited cbProvincia: TcxDBComboBox + Style.LookAndFeel.SkinName = '' + StyleDisabled.LookAndFeel.SkinName = '' + StyleFocused.LookAndFeel.SkinName = '' + StyleHot.LookAndFeel.SkinName = '' + ExplicitWidth = 235 + Width = 235 + end + inherited cbPoblacion: TcxDBComboBox + Style.LookAndFeel.SkinName = '' + StyleDisabled.LookAndFeel.SkinName = '' + StyleFocused.LookAndFeel.SkinName = '' + StyleHot.LookAndFeel.SkinName = '' + ExplicitWidth = 336 + Width = 336 + end + inherited frViewDatosYSeleccionClienteAlbaran1: TfrViewDatosYSeleccionClienteAlbaran + Width = 406 + ExplicitWidth = 406 + inherited dxLayoutControl1: TdxLayoutControl + Width = 406 + ExplicitWidth = 406 + ExplicitHeight = 181 + inherited edtlNombre: TcxDBTextEdit + Style.LookAndFeel.SkinName = '' + StyleDisabled.LookAndFeel.SkinName = '' + StyleFocused.LookAndFeel.SkinName = '' + StyleHot.LookAndFeel.SkinName = '' + ExplicitWidth = 224 + Width = 224 + end + inherited edtNIFCIF: TcxDBTextEdit + Style.LookAndFeel.SkinName = '' + StyleDisabled.LookAndFeel.SkinName = '' + StyleFocused.LookAndFeel.SkinName = '' + StyleHot.LookAndFeel.SkinName = '' + end + inherited edtPersonaContacto: TcxDBTextEdit + Style.LookAndFeel.SkinName = '' + StyleDisabled.LookAndFeel.SkinName = '' + StyleFocused.LookAndFeel.SkinName = '' + StyleHot.LookAndFeel.SkinName = '' + ExplicitWidth = 283 + Width = 283 + end + inherited edtDireccion: TcxMemo + Style.LookAndFeel.SkinName = '' + StyleDisabled.LookAndFeel.SkinName = '' + StyleFocused.LookAndFeel.SkinName = '' + StyleHot.LookAndFeel.SkinName = '' + ExplicitWidth = 287 + Width = 287 + end + end end inherited dxLayoutControl1Group_Root: TdxLayoutGroup inherited dxLayoutControl1Group6: TdxLayoutGroup diff --git a/Source/Modulos/Albaranes de cliente/Views/uViewAlbaranDevCliente.pas b/Source/Modulos/Albaranes de cliente/Views/uViewAlbaranDevCliente.pas index 0156044a..b3137fd4 100644 --- a/Source/Modulos/Albaranes de cliente/Views/uViewAlbaranDevCliente.pas +++ b/Source/Modulos/Albaranes de cliente/Views/uViewAlbaranDevCliente.pas @@ -8,7 +8,8 @@ uses dxLayoutControl, StdCtrls, cxDropDownEdit, cxLookupEdit, cxDBLookupEdit, cxDBLookupComboBox, cxTextEdit, Buttons, uCustomView, uViewBase, uViewDatosYSeleccionCliente, cxDBEdit, cxMemo, cxContainer, cxEdit, - cxMaskEdit, cxCalendar, cxControls, uDAInterfaces; + cxMaskEdit, cxCalendar, cxControls, uDAInterfaces, + uViewDatosYSeleccionClienteAlbaran; type TfrViewAlbaranDevCliente = class(TfrViewAlbaranCliente) diff --git a/Source/Modulos/Albaranes de cliente/Views/uViewDatosYSeleccionClienteAlbaran.dfm b/Source/Modulos/Albaranes de cliente/Views/uViewDatosYSeleccionClienteAlbaran.dfm index 376b514e..621b9af3 100644 --- a/Source/Modulos/Albaranes de cliente/Views/uViewDatosYSeleccionClienteAlbaran.dfm +++ b/Source/Modulos/Albaranes de cliente/Views/uViewDatosYSeleccionClienteAlbaran.dfm @@ -1,17 +1,28 @@ inherited frViewDatosYSeleccionClienteAlbaran: TfrViewDatosYSeleccionClienteAlbaran - Height = 163 - ExplicitHeight = 163 - inherited dxLayoutControl1: TdxLayoutControl - Height = 128 - ExplicitTop = 35 - ExplicitWidth = 413 - ExplicitHeight = 128 + Width = 505 + Height = 196 + ExplicitWidth = 505 + ExplicitHeight = 196 + object dxLayoutControl1: TdxLayoutControl + Left = 0 + Top = 0 + Width = 505 + Height = 196 + Margins.Left = 0 + Margins.Top = 0 + Margins.Right = 0 + Margins.Bottom = 0 + Align = alClient + ParentBackground = True + TabOrder = 0 + TabStop = False + AutoContentSizes = [acsWidth, acsHeight] DesignSize = ( - 413 - 128) - object edtlNombre: TcxDBTextEdit [0] + 505 + 196) + object edtlNombre: TcxDBTextEdit Left = 63 - Top = 10 + Top = 41 Anchors = [akLeft, akTop, akRight] AutoSize = False DataBinding.DataField = 'NOMBRE' @@ -32,21 +43,172 @@ inherited frViewDatosYSeleccionClienteAlbaran: TfrViewDatosYSeleccionClienteAlba StyleFocused.LookAndFeel.SkinName = '' StyleHot.LookAndFeel.NativeStyle = True StyleHot.LookAndFeel.SkinName = '' - TabOrder = 0 - Height = 21 - Width = 276 - end - object bElegirDireccion: TButton [1] - Left = 380 - Top = 37 - Width = 23 - Height = 25 - Action = actElegirDireccion TabOrder = 2 + Height = 21 + Width = 224 end - object edtPersonaContacto: TcxDBTextEdit [2] + object edtNIFCIF: TcxDBTextEdit + Left = 392 + Top = 41 + Anchors = [akLeft, akTop, akRight] + AutoSize = False + DataBinding.DataField = 'NIF_CIF' + DataBinding.DataSource = dsCliente + Enabled = False + ParentFont = False + Properties.ReadOnly = True + Properties.UseLeftAlignmentOnEditing = False + Style.BorderColor = clWindowFrame + Style.BorderStyle = ebs3D + Style.HotTrack = False + Style.LookAndFeel.NativeStyle = True + Style.LookAndFeel.SkinName = '' + StyleDisabled.LookAndFeel.NativeStyle = True + StyleDisabled.LookAndFeel.SkinName = '' + StyleDisabled.TextColor = clWindowText + StyleFocused.LookAndFeel.NativeStyle = True + StyleFocused.LookAndFeel.SkinName = '' + StyleHot.LookAndFeel.NativeStyle = True + StyleHot.LookAndFeel.SkinName = '' + TabOrder = 3 + Height = 21 + Width = 103 + end + object Button1: TBitBtn + Left = 10 + Top = 10 + Width = 115 + Height = 25 + Action = actElegirContacto + Caption = 'Elegir un cliente' + TabOrder = 0 + Glyph.Data = { + 36040000424D3604000000000000360000002800000010000000100000000100 + 2000000000000004000000000000000000000000000000000000FF00FF00FF00 + FF00FF00FF00EB00EB00C507C600AB13AD00A119A2009F19A000A215A400AA10 + AC00B608B800CE00CE00EF00EF00FF00FF00FF00FF00FF00FF00FF00FF00FF00 + FF00B426B000526840004A823400478F310043962F0042992F0043972F004690 + 3100488533004B7237005A405100D201D200FF00FF00FF00FF00FF00FF00FF00 + FF0062654E004F81350047903100409C2E003AA62C0038AA2B0039A72B003E9E + 2D00459230004D84340056753800A0189F00FF00FF00FF00FF00FF00FF00FF00 + FF005F6B4C004B89330042992F0039A82B0032B428002EBB260031B6270037AB + 2A00409C2E00498C3200527B3600B015B100FF00FF00FF00FF00FF00FF00FF00 + FF0090488700488D32003E9E2D0035AF290035B631007ACB7B002DBF280033B2 + 28003DA12D0047903100576A4800EC01EC00FF00FF00FF00FF00FF00FF00FF00 + FF00F008F1005F7351003E9F2D0034B0290080AC8100D2D3D30081BB820032B2 + 28003DA22D004A863A00C519C500FF00FF00FF00FF00FF00FF00FF00FF00FF00 + FF00FF00FF00EE09EF007861730036923E00598CAE00498CBB004A81A6002B70 + 3A00606D5900D613D600FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00 + FF00FF00FF00FF00FF00EA0CF400608CD00054A2D80053A1D6004F9DD300488B + C2009D11AC00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00 + FF00FF00FF00FF00FF008C67DE005CA9DD005CA9DD005AA7DC0056A4D900519F + D400565FAB00EA00EA00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00 + FF00FF00FF00EC0DF60060A7DE0063B0E30063B0E30061AEE1005CA9DD0056A4 + D9004E94CC00C105C600FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00 + FF00FF00FF00C532ED0066B2E5006BB7E9006BB7E90067B3E60061AEE1005AA7 + DC00539FD500A817BE00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00 + FF00FF00FF00BA3AE7004989B1004A85AC005895BD0068B2E30064B0E4005CA9 + DE0053A0D400AA1BC300FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00 + FF00FF00FF00CA23E8005098C400539AC7004E93BE00437DA2005190BA005198 + C6003C79A000BE08C300FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00 + FF00FF00FF00F804FC006995D40062ACDA005DA6D3005299C6004284AD003C7F + A900535AA100F300F300FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00 + FF00FF00FF00FF00FF00C140ED0071BAEA0068B2E00059A1CF004990BC004378 + AA00C315D600FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00 + FF00FF00FF00FF00FF00FF00FF00C83EF000808BDF00668BCC007C60C700D116 + E400FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00} + end + object Button2: TBitBtn + Left = 131 + Top = 10 + Width = 143 + Height = 25 + Action = actAnadirContacto + Caption = 'Dar de alta un cliente' + TabOrder = 1 + Glyph.Data = { + 36040000424D3604000000000000360000002800000010000000100000000100 + 2000000000000004000000000000000000000000000000000000FF00FF00FF00 + FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00 + FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00D5BFB1006947 + 3100694731006947310069473100694731006947310069473100694731006947 + 3100694731006947310069473100694731006947310069473100D5BFB100F6F2 + EF00B7A29300B7A29300B7A29300B7A29300B7A29300B7A29300B7A29300B7A2 + 9300B7A29300B7A29300B7A29300B7A29300B7A2930069473100D5BFB1002A80 + 1E00136F0D00136F0D00136F0D00136F0D00136F0D00136F0D002A801E00E3D5 + CE00E0D1C900DFCFC600DCCBC100DBC9BF00B7A2930069473100D5BFB10059A8 + 5100448B2F003CA02C0032A4260032A526003D9E2C00438D2E00136F0D00E7DB + D500A1745C00A1745C00A1745C00A1745C00B7A2930069473100D5BFB10080BC + 790042952E0031A62600369B3200369E320032A727003E952C00136F0D00EAE0 + DA00E7DBD500E4D7D000E2D3CB00DFCFC600B7A2930069473100D5BFB100CFE8 + CD004CA741002D942F0071AB90006FA68E0030923100136F0D00EFE8E300EDE4 + DF00A1745C00A1745C00A1745C00A1745C00B7A2930069473100D5BFB100FFFF + FF00B9DDC2004F9DA000559BC8004E96C2004E8E8F00A8C2AA00F2ECE800EFE8 + E300EDE4DF00EAE0DA00E7DBD500E4D7D000B7A2930069473100D5BFB100FFFF + FF00A5CDE8005DAADD005CA9DD0057A4D900519ACC00A0BACA00F5F0ED00F2EC + E800EFE8E300EDE4DF00EAE0DA00E7DBD500B7A2930069473100D5BFB100ECF6 + FA006CB9DF0065B2E50065B1E5005FACDF0056A2D700689EBE00F7F4F100F5F0 + ED00F2ECE800006000000060000000600000B7A2930069473100D5BFB100E9F6 + FA005BB0D5005CA6D50065AFDF0062AFE20058A4D8003285A700FAF8F600F7F4 + F100F7A073000060000033CB510000600000B7A2930069473100D5BFB100F4FA + FC0078C0DD0056A0CD00569DCA00539CCA00448DBB003285A700FDFCFB000060 + 0000006000000060000040D86500006000000060000000600000D5BFB100FFFF + FF00CEEAF40062B5DE005DA7D5004B92BE003285A700C6DCE600FFFFFF000060 + 000060F898005AF28F004DE57A0040D865003AD25C0000600000D5BFB100FFFF + FF00FFFFFF00CEEAF400A5CDE800A5CDE800CEEAF400FFFFFF00FFFFFF000060 + 000000600000006000005AF28F00006000000060000000600000D5BFB100D5BF + B100D5BFB100D5BFB100D5BFB100D5BFB100D5BFB100D5BFB100D5BFB100D5BF + B100D5BFB1000060000060F8980000600000D5BFB100D5BFB100FF00FF00FF00 + FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00 + FF00FF00FF00006000000060000000600000FF00FF00FF00FF00} + end + object Button3: TBitBtn + Left = 303 + Top = 158 + Width = 192 + Height = 25 + Action = actVerContacto + Caption = 'Ver ficha completa del cliente...' + TabOrder = 8 + Glyph.Data = { + 36040000424D3604000000000000360000002800000010000000100000000100 + 2000000000000004000000000000000000000000000000000000FF00FF00FF00 + FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00 + FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00D5BFB1006947 + 3100694731006947310069473100694731006947310069473100694731006947 + 3100694731006947310069473100694731006947310069473100D5BFB100F6F2 + EF00B7A29300B7A29300B7A29300B7A29300B7A29300B7A29300B7A29300B7A2 + 9300B7A29300B7A29300B7A29300B7A29300B7A2930069473100D5BFB1002A80 + 1E00136F0D00136F0D00136F0D00136F0D00136F0D00136F0D002A801E00E3D5 + CE00E0D1C900DFCFC600DCCBC100DBC9BF00B7A2930069473100D5BFB10059A8 + 5100448B2F003CA02C0032A4260032A526003D9E2C00438D2E00136F0D00E7DB + D500A1745C00A1745C00A1745C00A1745C00B7A2930069473100D5BFB10080BC + 790042952E0031A62600369B3200369E320032A727003E952C00136F0D00EAE0 + DA00E7DBD500E4D7D000E2D3CB00DFCFC600B7A2930069473100D5BFB100CFE8 + CD004CA741002D942F0071AB90006FA68E0030923100136F0D00EFE8E300EDE4 + DF00A1745C00A1745C00A1745C00A1745C00B7A2930069473100D5BFB100FFFF + FF00B9DDC2004F9DA000559BC8004E96C2004E8E8F00A8C2AA00F2ECE800EFE8 + E300EDE4DF00EAE0DA00E7DBD500E4D7D000B7A2930069473100D5BFB100FFFF + FF00A5CDE8005DAADD005CA9DD0057A4D900519ACC00A0BACA00F5F0ED00F2EC + E800EFE8E300EDE4DF00EAE0DA00E7DBD500B7A2930069473100D5BFB100ECF6 + FA006CB9DF0065B2E50065B1E5005FACDF0056A2D700689EBE00F7F4F100F5F0 + ED00F2ECE800EFE8E300EDE4DF00EAE0DA00B7A2930069473100D5BFB100E9F6 + FA005BB0D5005CA6D50065AFDF0062AFE20058A4D8003285A700FAF8F600F7F4 + F100F7A07300F7A07300F7A07300F7A07300B7A2930069473100D5BFB100F4FA + FC0078C0DD0056A0CD00569DCA00539CCA00448DBB003285A700FDFCFB00FAF8 + F600F7F4F100F5F0ED00F2ECE800EFE8E300B7A2930069473100D5BFB100FFFF + FF00CEEAF40062B5DE005DA7D5004B92BE003285A700C6DCE600FFFFFF00FDFC + FB00F7A07300F7A07300F7A07300F7A07300B7A2930069473100D5BFB100FFFF + FF00FFFFFF00CEEAF400A5CDE800A5CDE800CEEAF400FFFFFF00FFFFFF00FFFF + FF00FEFEFD00FCFAF900F9F6F400F6F2EF00F3EEEA0069473100D5BFB100D5BF + B100D5BFB100D5BFB100D5BFB100D5BFB100D5BFB100D5BFB100D5BFB100D5BF + B100D5BFB100D5BFB100D5BFB100D5BFB100D5BFB100D5BFB100FF00FF00FF00 + FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00 + FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00} + end + object edtPersonaContacto: TcxDBTextEdit Left = 63 - Top = 89 + Top = 129 Anchors = [akLeft, akTop, akRight] AutoSize = False DataBinding.DataField = 'PERSONA_CONTACTO' @@ -64,23 +226,13 @@ inherited frViewDatosYSeleccionClienteAlbaran: TfrViewDatosYSeleccionClienteAlba StyleFocused.LookAndFeel.SkinName = '' StyleHot.LookAndFeel.NativeStyle = True StyleHot.LookAndFeel.SkinName = '' - TabOrder = 3 + TabOrder = 6 Height = 21 - Width = 403 + Width = 283 end - object bElegirPersonaContacto: TButton [3] - Left = 380 - Top = 87 - Width = 23 - Height = 25 - Action = actElegirPersonaContacto - TabOrder = 4 - end - object memDireccion: TcxMemo [4] + object edtDireccion: TcxMemo Left = 63 - Top = 37 - Enabled = False - Properties.ReadOnly = True + Top = 68 Style.BorderColor = clWindowFrame Style.BorderStyle = ebs3D Style.HotTrack = False @@ -97,78 +249,247 @@ inherited frViewDatosYSeleccionClienteAlbaran: TfrViewDatosYSeleccionClienteAlba StyleHot.LookAndFeel.Kind = lfStandard StyleHot.LookAndFeel.NativeStyle = True StyleHot.LookAndFeel.SkinName = '' - TabOrder = 1 - Height = 44 - Width = 340 + TabOrder = 4 + Height = 53 + Width = 403 end - inherited dxLayoutControl1Group_Root: TdxLayoutGroup - object dxLayoutControl1Item1: TdxLayoutItem - Caption = 'Nombre:' - Control = edtlNombre - ControlOptions.ShowBorder = False - end - object dxLayoutControl1Group4: TdxLayoutGroup + object Button4: TButton + Left = 472 + Top = 68 + Width = 23 + Height = 25 + Action = actElegirDireccion + TabOrder = 5 + end + object Button5: TButton + Left = 472 + Top = 127 + Width = 23 + Height = 25 + Action = actElegirPersonaContacto + TabOrder = 7 + end + object dxLayoutControl1Group_Root: TdxLayoutGroup + ShowCaption = False + Hidden = True + ShowBorder = False + object dxLayoutControl1Group1: TdxLayoutGroup ShowCaption = False Hidden = True LayoutDirection = ldHorizontal ShowBorder = False - object dxLayoutControl1Item6: TdxLayoutItem - AutoAligns = [aaVertical] - AlignHorz = ahClient - Caption = 'Direcci'#243'n:' - CaptionOptions.AlignVert = tavTop - Control = memDireccion + object dxLayoutControl1Item7: TdxLayoutItem + Caption = 'Button1' + ShowCaption = False + Control = Button1 ControlOptions.ShowBorder = False end - object dxLayoutControl1Item3: TdxLayoutItem - AutoAligns = [aaVertical] - AlignHorz = ahRight - CaptionOptions.AlignVert = tavTop + object dxLayoutControl1Item8: TdxLayoutItem + Caption = 'Button2' ShowCaption = False - Control = bElegirDireccion + Control = Button2 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 = 'Contacto:' - Control = edtPersonaContacto - ControlOptions.ShowBorder = False - end - object dxLayoutControl1Item5: TdxLayoutItem - AutoAligns = [aaVertical] - AlignHorz = ahRight + object dxLayoutControl1Group4: TdxLayoutGroup ShowCaption = False - Control = bElegirPersonaContacto - ControlOptions.ShowBorder = 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 end + 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 = Button4 + 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 = Button5 + ControlOptions.ShowBorder = False + end + end + end + object dxLayoutControl1Item9: TdxLayoutItem + AutoAligns = [aaVertical] + AlignHorz = ahRight + Caption = 'Button3' + ShowCaption = False + Control = Button3 + ControlOptions.ShowBorder = False end end end - inherited Panel1: TPanel - ExplicitTop = 0 - inherited bElegirCliente: TBitBtn - ExplicitLeft = 4 - ExplicitTop = 4 + object dsCliente: TDADataSource + Left = 400 + Top = 8 + end + object ActionList1: TActionList + Images = PngImageList + Left = 368 + Top = 8 + object actElegirContacto: TAction + Caption = 'Elegir un cliente' + ImageIndex = 1 + OnExecute = actElegirContactoExecute end - inherited bNuevoCliente: TBitBtn - ExplicitLeft = 266 - ExplicitTop = 4 + object actAnadirContacto: TAction + Caption = 'Dar de alta un cliente' + ImageIndex = 0 + OnExecute = actAnadirContactoExecute end - inherited bVerFicha: TBitBtn - ExplicitLeft = 121 - ExplicitTop = 4 + object actVerContacto: TAction + Caption = 'Ver ficha completa del cliente...' + ImageIndex = 2 + OnExecute = actVerContactoExecute + OnUpdate = actVerContactoUpdate + end + object actElegirDireccion: TAction + Caption = '...' + OnExecute = actElegirDireccionExecute + OnUpdate = actElegirDireccionUpdate + end + object actElegirPersonaContacto: TAction + Caption = '...' + OnExecute = actElegirPersonaContactoExecute + OnUpdate = actElegirPersonaContactoUpdate end end + object PngImageList: TPngImageList + PngImages = < + item + PngImage.Data = { + 89504E470D0A1A0A0000000D49484452000000100000001008060000001FF3FF + 610000000970485973000017120000171201679FD252000002224944415478DA + 95935D48936114C77FCB36584A6064161515DEA441108B240293E8A682246805 + DEA45020F40196505D081242DE94512B8C20169937056914D52E726B6083B114 + D44CD3D51A216BB6656B5FEF677B5FF31D23033DF070CE03CFFFF73F1CCE6362 + 29D1806AD44E4C5A32F5F58FAA8BD5D73DD8465757034D4D4EFA4E8C62000ED7 + 56E997647490DFE131BD2ED9584971D98EB9478D2603D279B39EE6733DC6DD00 + 68E2EF7E07E95F2291688C48629ABDC71DACABD8AD0334E7B420104D24F4A3D5 + DDD707E60087F66C2234D0CECF2F41643987556566676799C9C4387AD18FF964 + 91E178EA522DF73ADC851D1CA85ECD27D77948995861B552844C2A9962303441 + DD051FA22473E5095C735B3972DAC6D3DB016EED7BC9FD47CFE601E57CF3B661 + C966D1E62C880299549A696915B6639D4892A243D6B6AC349C0B00DA0C22EF7B + 484EBDCA015424512491125036D751B1CBAE8BB5330F12459937EF860A01DEA0 + 8BA0FB0E5B154BAE832C810CACDF594F4DD5C17FC45AF6FA87F3800D95022DFD + ADC47E84682CDF8F222A3C9CF1303915E6C3E5495DDC7AE379C14E546F5F9307 + F8E4C7BC187F4BA6344E49D24C6E8A24AD12E65809A1895102CD6386B3F8B793 + C0F0C73CC0196927188E2297651096A7D096D4922D6659DCC2E7AF43F8CE8C70 + F5AEEBFF1D9CF5D889C7230BAE6F696939BDF6D7BAABACA87A567279647C320F + A8B16DA1BBD7B3A47FA5850168EB702C596C6CA2AA2EFA332E187F0080F1503E + 182A98A90000000049454E44AE426082} + Name = 'PngImage0' + Background = clWindow + end + item + PngImage.Data = { + 89504E470D0A1A0A0000000D49484452000000100000001008060000001FF3FF + 61000000097048597300000AC400000AC401666D82D4000002A94944415478DA + 7D925D48536118C79FF3B5AF36DD66B639CB924243225010BC49BA914004CDE8 + E32228B482EA4689A22289C8CBA28B32B1061688902912D28D16991F6062B2DC + 45921FB954669BF39C9D6DE7EC9CF3EEBC9D2D8C2CB7079E9BF779FEBFF7F922 + 30C69034822060D3665F5F3A0B90B8C672FCAEC07AD8E35DF0DFBFE3F64EC05F + F647F72FC0DB75AED1E1B43D138438C9B26108B11C0443BC30ECF959D731303F + 9411D0D35C612C2ADBEF3319F5B992AC402412037F9003A4C8E05F17679BDA3E + 976BA9D1F4807B95552E877D90222910250556023170E66481D900F0CD17C0AD + 5DDE63F3CBFC505AC0685B6DE34654762B88009B350B8AF658815011C8521C04 + 518487DD530D9D83BECEB480C98EDA13F9798E5E9A61526F098440D1CA572409 + 24298EEFBA271B7BC756D203FA5A8FE49516EDF3313A5D8AA0AAAAD6BF929A01 + CFC7505DCBBBAAD590349C710BD3EEFA57D916D3A954920648249255283031B3 + 3A7BE1D164A5F61CCC0878D15C917FA8C43165D6334E558B25DBD80847E51BCF + A79B3E7D65DB33AEF1E04D570EE5723DB513C4C966E9006101ED0662043C6697 + 30B7DB3021CE6D5C5EEA58FAB22DE0F0ADBD36D25E38A6E6E2126413E00CAA81 + FAE27AE85FEB876EF10D30DC0E2083542432F3E3F8E2CBC5F7FF01CA5A8E3E21 + 6CC6AB8A264636110C7A80EADC2AE88B0E004474C0B026A035C76BF2B2A7ED43 + 29E671680BA0FC76B50F5BC902641501658B90304BA0EA11100A05544C0774D8 + 0834A7396B04DFE8C8E9B58FC19EAD80EB358B84852E44D9F1DF62930C9856B5 + 6320801419A0A27AA079430AB4303E722530EE6FDF3A838B15E729B3E50195C3 + D855B34A247F074A8BA91A40A2808C91803955E6E70233F36F3D0D58C6DEEDD6 + B8D35040179B9DA602305266AC028925A4A0B822A090C20BAB09BF96F35D736E + 53F70B90E997F07974AFDF0000000049454E44AE426082} + Name = 'PngImage1' + Background = clWindow + end + item + PngImage.Data = { + 89504E470D0A1A0A0000000D49484452000000100000001008060000001FF3FF + 610000000970485973000017120000171201679FD252000001EC4944415478DA + A5934B6813511486BF541B88CD26620DA262A51BDB8520158308D5852055B01B + A3E8CEBD2E7CE063512852D09D2E82E04604AB1B5D4451B059D8A6010D84D842 + 5B6B6B1A8D414A4C9B18EB4C27F3F466D41943ED4233309C3BDC39DFFFDF9F7B + 3C9665D1C8E379323CD510C1061C3DD0697F48C531BEE7A7EDB57F6B072DADBB + 9C1F4DE154D74D34DD70DE43272FB9805AF3975484E56F1A856289C2D23CFB4F + 44D8D4BE17DD30B932A8D629B7358D70F7C1D39F8023FBB6917B35C0D78F590C + 43EC5A06954A8505A5C4B1CB2947F14F07D158D205F48436F03E761E640FEB7C + 3ED660204B3263B9597A2F24ED866B8F59DD414F28C8E7443FDE6A55A883AAA9 + 28F232F3FA7ABA8EDFAC53FEBD1E1A4DBB805A0685370F91E65E0880084BD358 + 9255CCB65EDAF784571E413378F97ABC1E90C8C6C88EDC6687E9150EAAA415D8 + BCFB14DD9D875734D76A2235E102B674A85C1CEEA3B498E374F020A666727F21 + 4E662ECFDBAB19BBB9EFD6B3BA0C423B37BA80A4F188E733A32881327EA91991 + 22924FA7B9E427373B45FADCB4A3ACFD72929E78E702EE1506C8E68B18AD0AEA + 5A595C2F44A02D3495BD7CF8344EF2CC24D7EFC4567770361EA65C2EFCF5AA06 + 0241A2E1215BD5302DBB9AA24ECE645C4077D77606A3F17F9E0307D07F23F2FF + C3D4E838FF008E7263BE13CA147C0000000049454E44AE426082} + Name = 'PngImage2' + Background = clWindow + end> + Left = 304 + Top = 8 + Bitmap = {} + end object dsAlbaran: TDADataSource - Left = 232 + Left = 336 Top = 8 end end diff --git a/Source/Modulos/Albaranes de cliente/Views/uViewDatosYSeleccionClienteAlbaran.pas b/Source/Modulos/Albaranes de cliente/Views/uViewDatosYSeleccionClienteAlbaran.pas index 80fbe9d3..a0b7b631 100644 --- a/Source/Modulos/Albaranes de cliente/Views/uViewDatosYSeleccionClienteAlbaran.pas +++ b/Source/Modulos/Albaranes de cliente/Views/uViewDatosYSeleccionClienteAlbaran.pas @@ -4,119 +4,280 @@ interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, - Dialogs, uViewDatosYSeleccionClienteBase, ImgList, PngImageList, ActnList, DB, - uDAInterfaces, uDADataTable, dxLayoutControl, StdCtrls, Buttons, cxControls, - cxTextEdit, cxContainer, cxEdit, cxDBEdit, ExtCtrls, cxMemo, - uBizAlbaranesCliente; + Dialogs, uViewBase, StdCtrls, cxControls, cxContainer, cxEdit, cxLabel, + cxDBLabel, ExtCtrls, DB, uDADataTable, uBizContactos, + ComCtrls, ToolWin, ActnList, ImgList, PngImageList, cxTextEdit, cxDBEdit, + pngimage, JvExControls, JvComponent, JvButton, JvTransparentButton, Mask, + DBCtrls, uClientesController, dxLayoutControl, Buttons, uDAInterfaces, + cxMaskEdit, cxButtonEdit, uBizAlbaranesCliente, uBizDireccionesContacto, + uDireccionesContactoController, Menus, cxLookAndFeelPainters, cxButtons, + cxMemo; type - IViewDatosYSeleccionClienteAlbaran = interface(IViewDatosYSeleccionClienteBase) - ['{41EA09A7-F21A-4D89-AC60-559CB6B430C9}'] - function GetAlbaranCliente: IBizAlbaranCliente; - procedure SetAlbaranCliente(const Value: IBizAlbaranCliente); - property AlbaranCliente: IBizAlbaranCliente read GetAlbaranCliente write SetAlbaranCliente; + IViewDatosYSeleccionClienteAlbaran = interface(IViewBase) + ['{02F0A00C-FAE7-43A4-B959-D2B929FF287A}'] + function GetAlbaran: IBizAlbaranCliente; + procedure SetAlbaran(const Value: IBizAlbaranCliente); + property Albaran: IBizAlbaranCliente read GetAlbaran write SetAlbaran; + + function GetCliente: IBizCliente; + procedure SetCliente(Value: IBizCliente); + property Cliente: IBizCliente read GetCliente write SetCliente; + + function GetID_Cliente: integer; + procedure SetID_Cliente(const Value: integer); + property ID_Cliente: integer read GetID_Cliente write SetID_Cliente; + + function GetOnClienteChanged : TNotifyEvent; + procedure SetOnClienteChanged (const Value : TNotifyEvent); + property OnClienteChanged : TNotifyEvent read GetOnClienteChanged + write SetOnClienteChanged; + + procedure ElegirPersonaContacto; + procedure ElegirDireccionCliente; + procedure ElegirCliente; + procedure VerFichaCliente; + procedure AnadirNuevoCliente; + procedure RefrescarDireccion; end; - - TfrViewDatosYSeleccionClienteAlbaran = class(TfrViewDatosYSeleccionClienteBase, IViewDatosYSeleccionClienteAlbaran) + TfrViewDatosYSeleccionClienteAlbaran = class(TfrViewBase, IViewDatosYSeleccionClienteAlbaran) + dsCliente: TDADataSource; + ActionList1: TActionList; + actElegirContacto: TAction; + actAnadirContacto: TAction; + actVerContacto: TAction; + PngImageList: TPngImageList; + dxLayoutControl1Group_Root: TdxLayoutGroup; + dxLayoutControl1: TdxLayoutControl; dxLayoutControl1Item1: TdxLayoutItem; edtlNombre: TcxDBTextEdit; - dxLayoutControl1Item3: TdxLayoutItem; - bElegirDireccion: TButton; - dxLayoutControl1Item4: TdxLayoutItem; - edtPersonaContacto: TcxDBTextEdit; - dxLayoutControl1Item5: TdxLayoutItem; - bElegirPersonaContacto: TButton; + dxLayoutControl1Item2: TdxLayoutItem; + edtNIFCIF: TcxDBTextEdit; + Button1: TBitBtn; + dxLayoutControl1Item7: TdxLayoutItem; + Button2: TBitBtn; + dxLayoutControl1Item8: TdxLayoutItem; + Button3: TBitBtn; + dxLayoutControl1Item9: TdxLayoutItem; + dxLayoutControl1Group1: TdxLayoutGroup; dxLayoutControl1Group2: TdxLayoutGroup; - dxLayoutControl1Item6: TdxLayoutItem; - memDireccion: TcxMemo; - dxLayoutControl1Group4: TdxLayoutGroup; dsAlbaran: TDADataSource; - protected - FAlbaran : IBizAlbaranCliente; - function GetAlbaranCliente: IBizAlbaranCliente; - procedure SetAlbaranCliente(const Value: IBizAlbaranCliente); + actElegirDireccion: TAction; + actElegirPersonaContacto: TAction; + dxLayoutControl1Item3: TdxLayoutItem; + edtPersonaContacto: TcxDBTextEdit; + dxLayoutControl1Group4: TdxLayoutGroup; + dxLayoutControl1Item4: TdxLayoutItem; + edtDireccion: TcxMemo; + Button4: TButton; + dxLayoutControl1Item5: TdxLayoutItem; + dxLayoutControl1Group3: TdxLayoutGroup; + dxLayoutControl1Item6: TdxLayoutItem; + Button5: TButton; + dxLayoutControl1Group5: 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; + FMsgElegirCliente: String; + protected + FClientesController : IClientesController; + FDireccionesController : IDireccionesContactoController; + FAlbaran : IBizAlbaranCliente; + FCliente : IBizCliente; + FDireccion : IBizDireccionesContacto; + function GetCliente: IBizCliente; virtual; + procedure SetCliente(Value: IBizCliente); virtual; + function GetOnClienteChanged : TNotifyEvent; + procedure SetOnClienteChanged (const Value : TNotifyEvent); + procedure SetReadOnly(Value: Boolean); override; + function GetID_Cliente: integer; virtual; + procedure SetID_Cliente(const Value: integer); virtual; + function GetAlbaran: IBizAlbaranCliente; + procedure SetAlbaran(const Value: IBizAlbaranCliente); procedure EscribirTextoDireccion; - procedure RefrescarDireccion; public - procedure ElegirCliente; override; - procedure ElegirDireccionCliente; override; - procedure ElegirPersonaContacto; override; - procedure AnadirNuevoCliente; override; - property AlbaranCliente: IBizAlbaranCliente read GetAlbaranCliente write SetAlbaranCliente; + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + procedure ElegirPersonaContacto; + procedure ElegirDireccionCliente; + procedure ElegirCliente; + procedure VerFichaCliente; + procedure AnadirNuevoCliente; + procedure RefrescarDireccion; + property Albaran: IBizAlbaranCliente read GetAlbaran write SetAlbaran; + property Cliente: IBizCliente read GetCliente write SetCliente; + property OnClienteChanged : TNotifyEvent read GetOnClienteChanged write SetOnClienteChanged; + property ID_Cliente: integer read GetID_Cliente write SetID_Cliente; end; implementation {$R *.dfm} -{ TfrViewDatosYSeleccionClienteAlbaran } +uses + uDataModuleClientes, Math, uCustomView, uBizContactosPersonal, uDialogUtils; + + +procedure TfrViewDatosYSeleccionClienteAlbaran.actElegirContactoExecute(Sender: TObject); +begin + ElegirCliente; +end; + +procedure TfrViewDatosYSeleccionClienteAlbaran.actElegirDireccionExecute( + Sender: TObject); +begin + inherited; + ElegirDireccionCliente; +end; + +procedure TfrViewDatosYSeleccionClienteAlbaran.actElegirDireccionUpdate( + Sender: TObject); +begin + inherited; + (Sender as TAction).Enabled := Assigned(FCliente.Direcciones) and + (FCliente.Direcciones.Active) and (FCliente.Direcciones.RecordCount > 0); +end; + +procedure TfrViewDatosYSeleccionClienteAlbaran.actElegirPersonaContactoExecute( + Sender: TObject); +begin + inherited; + ElegirPersonaContacto; +end; + +procedure TfrViewDatosYSeleccionClienteAlbaran.actElegirPersonaContactoUpdate( + Sender: TObject); +begin + inherited; + (Sender as TAction).Enabled := Assigned(FCliente.Personal) and + (FCliente.Personal.Active) and (FCliente.Personal.RecordCount > 0); +end; + +procedure TfrViewDatosYSeleccionClienteAlbaran.actAnadirContactoExecute( + Sender: TObject); +begin + AnadirNuevoCliente; +end; + +procedure TfrViewDatosYSeleccionClienteAlbaran.actVerContactoExecute( + Sender: TObject); +begin + inherited; + VerFichaCliente; +end; + +procedure TfrViewDatosYSeleccionClienteAlbaran.actVerContactoUpdate(Sender: TObject); +begin + inherited; + (Sender as TAction).Enabled := (Length(edtlNombre.Text) > 0); +end; procedure TfrViewDatosYSeleccionClienteAlbaran.AnadirNuevoCliente; +var + ACliente : IBizCliente; begin - if Assigned(FAlbaran) and Assigned(FCliente) and - Assigned (FAlbaran.Detalles) and (FAlbaran.Detalles.RecordCount > 0) then - begin - if (Application.MessageBox('Los descuentos de los artículos del albarán serán actualizados con los del nuevo cliente seleccionado, ¿Desea continuar?', 'Atención', MB_YESNO) = IDNO) then - Exit; - end; - inherited; + ACliente := (FClientesController.Nuevo as IBizCliente); + FClientesController.Ver(ACliente); + Self.Cliente := ACliente; +end; + +constructor TfrViewDatosYSeleccionClienteAlbaran.Create(AOwner: TComponent); +begin + inherited; + FMsgElegirCliente := 'Elija el cliente al que se le realizará el presupuesto.'; + FClientesController := TClientesController.Create; + FDireccionesController := TDireccionesContactoController.Create; + + edtlNombre.Enabled := False; + edtNIFCIF.Enabled := False; + edtDireccion.Enabled := False; + edtPersonaContacto.Enabled := False; +end; + +destructor TfrViewDatosYSeleccionClienteAlbaran.Destroy; +begin + FClientesController := NIL; + FDireccionesController := NIL; + inherited; +end; + +procedure TfrViewDatosYSeleccionClienteAlbaran.edtDireccionPropertiesButtonClick( + Sender: TObject; AButtonIndex: Integer); +begin + inherited; + ElegirDireccionCliente; +end; + +procedure TfrViewDatosYSeleccionClienteAlbaran.edtPersonaContactoPropertiesButtonClick( + Sender: TObject; AButtonIndex: Integer); +begin + inherited; + ElegirPersonaContacto; end; procedure TfrViewDatosYSeleccionClienteAlbaran.ElegirCliente; +var + ACliente : IBizCliente; begin - if Assigned(FAlbaran) and Assigned(FCliente) and - Assigned (FAlbaran.Detalles) and (FAlbaran.Detalles.RecordCount > 0) then - begin - if (Application.MessageBox('Los descuentos de los artículos del albarán serán actualizados con los del nuevo cliente seleccionado, ¿Desea continuar?', 'Atención', MB_YESNO) = IDNO) then - Exit; - end; - inherited; + + ACliente := (FClientesController.ElegirContacto(FClientesController.BuscarTodos, FMsgElegirCliente, False) as IBizCliente); + + if Assigned(ACliente) then + Self.Cliente := ACliente; + ACliente := Nil; end; procedure TfrViewDatosYSeleccionClienteAlbaran.ElegirDireccionCliente; +var + ADireccion : IBizDireccionesContacto; begin inherited; + ADireccion := FClientesController.ElegirDireccionEntrega(FCliente, ' '); - if Assigned(FDireccion) then + if Assigned(ADireccion) then begin + FDireccion := ADireccion; FAlbaran.Edit; if FDireccion.IDIsNull then begin FAlbaran.ClearField('ID_DIRECCION'); FAlbaran.ClearField('IMPORTE_PORTE'); - FAlbaran.ClearField('CALLE'); - FAlbaran.ClearField('POBLACION'); - FAlbaran.ClearField('PROVINCIA'); - FAlbaran.ClearField('CODIGO_POSTAL'); - FAlbaran.ClearField('TELEFONO'); end else begin FAlbaran.ID_DIRECCION := FDireccion.ID; - FAlbaran.CALLE := FDireccion.CALLE; - FAlbaran.POBLACION := FDireccion.POBLACION; - FAlbaran.PROVINCIA := FDireccion.PROVINCIA; - FAlbaran.CODIGO_POSTAL := FDireccion.CODIGO_POSTAL; - FAlbaran.TELEFONO := FDireccion.TELEFONO; FAlbaran.IMPORTE_PORTE := FDireccion.PORTE; FAlbaran.PERSONA_CONTACTO := FDireccion.PERSONA_CONTACTO; end; EscribirTextoDireccion; end; - end; procedure TfrViewDatosYSeleccionClienteAlbaran.ElegirPersonaContacto; +var + APersona : IBizContactoPersonal; begin inherited; - if Assigned(FPersonaContacto) then + APersona := FClientesController.ElegirPersonaContacto(FCliente.Personal, 'El cliente dispone de personas de contacto dadas de alta en su ficha. Seleccione la que quiere utilizar.'); + if Assigned(APersona) then begin FAlbaran.Edit; - FAlbaran.PERSONA_CONTACTO := FPersonaContacto.NOMBRE; + FAlbaran.PERSONA_CONTACTO := APersona.NOMBRE; end; end; @@ -131,17 +292,66 @@ begin [FDireccion.CALLE, FDireccion.POBLACION, FDireccion.CODIGO_POSTAL, FDireccion.PROVINCIA]); - memDireccion.Lines.Clear; - memDireccion.Lines.Text := ACadena; + edtDireccion.Text := ACadena; end; +function TfrViewDatosYSeleccionClienteAlbaran.GetCliente: IBizCliente; +begin + Result := FCliente; +end; -function TfrViewDatosYSeleccionClienteAlbaran.GetAlbaranCliente: IBizAlbaranCliente; +function TfrViewDatosYSeleccionClienteAlbaran.GetID_Cliente: integer; +begin + Result := -1; + if Assigned(FCliente) then + Result := FCliente.ID; +end; + +procedure TfrViewDatosYSeleccionClienteAlbaran.SetCliente(Value: IBizCliente); +begin + FCliente := Value; + if Assigned(FCliente) then + begin + dsCliente.DataTable := FCliente.DataTable; + + if not FCliente.DataTable.Active then + FCliente.DataTable.Active := True; + edtPersonaContacto.Enabled := True; + + if FCliente.Direcciones.RecordCount > 0 then + ElegirDireccionCliente + else begin + FAlbaran.Edit; + FAlbaran.PERSONA_CONTACTO := FCliente.PERSONA_CONTACTO; + RefrescarDireccion; + end; + end + else begin + dsCliente.DataTable := NIL; + FCliente := NIL; + FDireccion := NIL; + edtPersonaContacto.Enabled := False; + end; + + if Assigned(FOnClienteChanged) then + FOnClienteChanged(Self); +end; + +procedure TfrViewDatosYSeleccionClienteAlbaran.SetID_Cliente(const Value: integer); +begin + Self.Cliente := IBizCliente(FClientesController.Buscar(Value)); +end; + +function TfrViewDatosYSeleccionClienteAlbaran.GetOnClienteChanged: TNotifyEvent; +begin + Result := FOnClienteChanged; +end; + +function TfrViewDatosYSeleccionClienteAlbaran.GetAlbaran: IBizAlbaranCliente; begin Result := FAlbaran; end; - procedure TfrViewDatosYSeleccionClienteAlbaran.RefrescarDireccion; begin FDireccion := FDireccionesController.Nuevo; @@ -155,7 +365,13 @@ begin EscribirTextoDireccion; end; -procedure TfrViewDatosYSeleccionClienteAlbaran.SetAlbaranCliente( +procedure TfrViewDatosYSeleccionClienteAlbaran.SetOnClienteChanged( + const Value: TNotifyEvent); +begin + FOnClienteChanged := Value; +end; + +procedure TfrViewDatosYSeleccionClienteAlbaran.SetAlbaran( const Value: IBizAlbaranCliente); begin FAlbaran := Value; @@ -169,6 +385,7 @@ begin if not FCliente.DataTable.Active then FCliente.DataTable.Active := True; + edtPersonaContacto.Enabled := True; RefrescarDireccion; end else begin @@ -178,4 +395,24 @@ begin end; end; +procedure TfrViewDatosYSeleccionClienteAlbaran.SetReadOnly(Value: Boolean); +begin + inherited; + + if (csLoading in Self.ComponentState) then + Exit; + + actAnadirContacto.Enabled := not ReadOnly; + actElegirContacto.Enabled := not ReadOnly; +end; + +procedure TfrViewDatosYSeleccionClienteAlbaran.VerFichaCliente; +begin + if not Assigned(Cliente) then + ShowErrorMessage('No se ha indicado un cliente', 'El presupuesto no tiene ningún cliente asociado a mostrar.') + else begin + FClientesController.Ver(Cliente); + end; +end; + end.