From c6100549bbd24e53a0957fa315a6899fed20dec6 Mon Sep 17 00:00:00 2001 From: david Date: Thu, 14 Jun 2007 13:10:45 +0000 Subject: [PATCH] =?UTF-8?q?Repaso=20del=20paso=20de=20pedido=20de=20client?= =?UTF-8?q?e=20a=20albar=C3=A1n=20de=20cliente.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: https://192.168.0.254/svn/Proyectos.LuisLeon_FactuGES/trunk@34 c93665c3-c93d-084d-9b98-7d5f4a9c3376 --- Source/Base/GUIBase/GUIBase.bdsproj | 3 +- Source/Base/GUIBase/GUIBase.res | Bin 32 -> 5056 bytes Source/Base/GUIBase/uViewGridBase.pas | 36 ++++++---- .../Views/uEditorAlbaranesCliente.pas | 15 ++-- .../PedidosCliente_Group.bdsgroup | 3 +- .../Views/uEditorPedidosCliente.dfm | 1 - .../Views/uEditorPedidosCliente.pas | 4 +- .../uGenerarAlbaranesCliUtils.pas | 65 +++++++++++------- 8 files changed, 72 insertions(+), 55 deletions(-) diff --git a/Source/Base/GUIBase/GUIBase.bdsproj b/Source/Base/GUIBase/GUIBase.bdsproj index ad2c0046..c085d671 100644 --- a/Source/Base/GUIBase/GUIBase.bdsproj +++ b/Source/Base/GUIBase/GUIBase.bdsproj @@ -170,8 +170,7 @@ 1.0.0.0 - - + RemObjects Data Abstract - IDE Package SMImport suite: data importing into dataset. Scalabium/Mike Shkolnik, 2000-2005 SMExport suite: data export from dataset. Written by Mike Shkolnik/Scalabium, 1998-2004. diff --git a/Source/Base/GUIBase/GUIBase.res b/Source/Base/GUIBase/GUIBase.res index 36f26e234a8ac66a47e95cec6d496cf2f1442471..86c94e6ada7b3c85f6761b1ee234a9f34ef3c861 100644 GIT binary patch literal 5056 zcmbW5&x;&Y5XWnifD(f4!IPI+L`3!=E9BmaF%VEA#@TDLXpF&R6XJUC)cc=I4kFSA z{{!hg%bp}hVRP_qjvmDJ`>A@>-7}euyEfF+`%$mH-*3IwZ-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W3N zaydTsdE#>2dGSt*&wOX~r{!54?~lxS4gM|rOZH6mRCZMCP#!z)bEv-^up_gJ*i*BY zl>1d-%!E}5v+s{C_OF@Qj;!xrv5)P2yJ4TmKCqke`Aq-U;NJ}WpRu*&|7!3r$c7zU zF#m_6?>Cia!E%D)b;IaF{ zzPG~QEyw>z^LKm}whzS>Dx3Ct`1w98?Y5 Value then -// begin - FFilter := Value; + FFilter := Value; - //Así tendremos el mismo valor en el filtro simple que en el filtro en detalle - if Assigned(ViewFiltros) then - ViewFiltros.Texto := FFilter; + //Así tendremos el mismo valor en el filtro simple que en el filtro en detalle + if Assigned(ViewFiltros) then + ViewFiltros.Texto := FFilter; - FiltrarGrid(FFilter); + FiltrarGrid(FFilter); - //Obliga a generar todos los filtros de las vista hija - AnadirOtrosFiltros; + //Obliga a generar todos los filtros de las vista hija + AnadirOtrosFiltros; - if Assigned(FOnFilterChanged) then - FOnFilterChanged(Self); -// end; + if Assigned(FOnFilterChanged) then + FOnFilterChanged(Self); end; procedure TfrViewGridBase.SetMultiSelect(const Value: Boolean); diff --git a/Source/Modulos/Albaranes de cliente/Views/uEditorAlbaranesCliente.pas b/Source/Modulos/Albaranes de cliente/Views/uEditorAlbaranesCliente.pas index fcc164df..d245f4cc 100644 --- a/Source/Modulos/Albaranes de cliente/Views/uEditorAlbaranesCliente.pas +++ b/Source/Modulos/Albaranes de cliente/Views/uEditorAlbaranesCliente.pas @@ -285,8 +285,8 @@ end; procedure TfEditorAlbaranesCliente.NuevoInterno; var Respuesta : Integer; - FPedidosClienteController : IPedidosClienteController; - APedido : IBizPedidoCliente; + AAlbaran : IBizAlbaranCliente; + IDAlbaranAux: Integer; begin inherited; @@ -296,15 +296,8 @@ begin begin case JsNuevoAlbaranDialog.CustomButtonResult of 200 : begin // Utilizar un pedido - FPedidosClienteController := TPedidosClienteController.Create; - try - APedido := FPedidosClienteController.ElegirPedidos(FPedidosClienteController.BuscarPendientes, - 'Elija el pedido de cliente que desea utilizar para dar de alta el albarán.', False); - if Assigned(APedido) then - GenerarAlbaranCli(APedido); // El proceso de generación ya pregunta si el usuario quiere ver o no el albarán generado. - finally - FPedidosClienteController := NIL; - end; + if ElegirPedidoYGenerarAlbaranCli(IDAlbaranAux) then + actRefrescar.Execute; end; 100 : begin // Albaran nuevo vacio if FController.Anadir(Albaranes) then diff --git a/Source/Modulos/Pedidos de cliente/PedidosCliente_Group.bdsgroup b/Source/Modulos/Pedidos de cliente/PedidosCliente_Group.bdsgroup index f879c0cb..cddfade0 100644 --- a/Source/Modulos/Pedidos de cliente/PedidosCliente_Group.bdsgroup +++ b/Source/Modulos/Pedidos de cliente/PedidosCliente_Group.bdsgroup @@ -20,7 +20,8 @@ Data\PedidosCliente_data.bdsproj Controller\PedidosCliente_controller.bdsproj Views\PedidosCliente_view.bdsproj - Base.bpl ControllerBase.bpl GUIBase.bpl Articulos_model.bpl Articulos_data.bpl Articulos_controller.bpl Articulos_view.bpl PedidosCliente_model.bpl PedidosCliente_data.bpl PedidosCliente_controller.bpl PedidosCliente_view.bpl + Plugin\PedidosCliente_plugin.bdsproj + Base.bpl ControllerBase.bpl GUIBase.bpl Articulos_model.bpl Articulos_data.bpl Articulos_controller.bpl Articulos_view.bpl PedidosCliente_model.bpl PedidosCliente_data.bpl PedidosCliente_controller.bpl PedidosCliente_view.bpl PedidosCliente_plugin.bpl diff --git a/Source/Modulos/Pedidos de cliente/Views/uEditorPedidosCliente.dfm b/Source/Modulos/Pedidos de cliente/Views/uEditorPedidosCliente.dfm index 21386e88..7ea195e1 100644 --- a/Source/Modulos/Pedidos de cliente/Views/uEditorPedidosCliente.dfm +++ b/Source/Modulos/Pedidos de cliente/Views/uEditorPedidosCliente.dfm @@ -2,7 +2,6 @@ inherited fEditorPedidosCliente: TfEditorPedidosCliente Caption = 'Lista de pedidos de cliente' ClientWidth = 674 ExplicitWidth = 682 - ExplicitHeight = 240 PixelsPerInch = 96 TextHeight = 13 inherited JvNavPanelHeader: TJvNavPanelHeader diff --git a/Source/Modulos/Pedidos de cliente/Views/uEditorPedidosCliente.pas b/Source/Modulos/Pedidos de cliente/Views/uEditorPedidosCliente.pas index 12d7485d..cdcbbd48 100644 --- a/Source/Modulos/Pedidos de cliente/Views/uEditorPedidosCliente.pas +++ b/Source/Modulos/Pedidos de cliente/Views/uEditorPedidosCliente.pas @@ -92,9 +92,11 @@ begin end; procedure TfEditorPedidosCliente.actGenerarAlbaranCliExecute(Sender: TObject); +var + IDAlbaranAux : Integer; begin inherited; - GenerarAlbaranCli(FPedidos); + GenerarAlbaranCli(FPedidos.ID, IDAlbaranAux); end; procedure TfEditorPedidosCliente.actGenerarExecute(Sender: TObject); diff --git a/Source/Modulos/Relaciones/Pedidos de cliente - Albaranes de cliente/uGenerarAlbaranesCliUtils.pas b/Source/Modulos/Relaciones/Pedidos de cliente - Albaranes de cliente/uGenerarAlbaranesCliUtils.pas index 84d5fa7f..906fae2d 100644 --- a/Source/Modulos/Relaciones/Pedidos de cliente - Albaranes de cliente/uGenerarAlbaranesCliUtils.pas +++ b/Source/Modulos/Relaciones/Pedidos de cliente - Albaranes de cliente/uGenerarAlbaranesCliUtils.pas @@ -3,16 +3,17 @@ unit uGenerarAlbaranesCliUtils; interface uses - Windows, SysUtils, Classes, uBizPedidosCliente, pngimage, JSDialog; + Windows, SysUtils, Classes, pngimage, JSDialog, + uBizPedidosCliente, uBizAlbaranesCliente; type TdmGenerarAlbaranesCli = class(TDataModule) JsListaAlbaranesGenerados: TJSDialog; end; - function GenerarAlbaranCli(const IDPedido : Integer) : Boolean; overload; - function GenerarAlbaranCli(APedido : IBizPedidoCliente) : Boolean; overload; - function GenerarAlbaranCli : Boolean; overload; + function GenerarAlbaranCli(const IDPedido : Integer; var IDAlbaran: Integer) : Boolean; overload; + function GenerarAlbaranCli(APedido : IBizPedidoCliente; var AAlbaran: IBizAlbaranCliente) : Boolean; overload; + function ElegirPedidoYGenerarAlbaranCli(var IDAlbaran: Integer) : Boolean; implementation @@ -20,9 +21,9 @@ implementation uses uDialogUtils, uBizDetallesPedidoCliente, uBizDetallesAlbaranCliente, - uPedidosClienteController, uAlbaranesClienteController, uClientesController, + uPedidosClienteController, uAlbaranesClienteController, uClientesController, uDetallesAlbaranClienteController, uControllerDetallesBase, - uBizAlbaranesCliente, uBizContactos, schPedidosClienteClient_Intf, + uBizContactos, schPedidosClienteClient_Intf, schAlbaranesClienteClient_Intf; var @@ -140,32 +141,40 @@ begin end; -function GenerarAlbaranCli(const IDPedido : Integer) : Boolean; overload; +function GenerarAlbaranCli(const IDPedido : Integer; + var IDAlbaran: Integer) : Boolean; overload; var APedido : IBizPedidoCliente; + AAlbaran : IBizAlbaranCliente; begin Result := False; - + IDAlbaran := -1; + try if not Assigned(APedidosClienteController) then Inicializar; APedido := APedidosClienteController.Buscar(IDPedido); if Assigned(APedido) then - Result := GenerarAlbaranCli(APedido); + begin + Result := GenerarAlbaranCli(APedido, AAlbaran); + if Result then + IDAlbaran := AAlbaran.ID; + end; finally if Assigned(APedidosClienteController) then Finalizar; end; end; -function GenerarAlbaranCli(APedido : IBizPedidoCliente) : Boolean; overload; +function GenerarAlbaranCli(APedido : IBizPedidoCliente; var AAlbaran: IBizAlbaranCliente) : Boolean; overload; var ARespuesta : Integer; - AAlbaran : IBizAlbaranCliente; + AuxAlbaran : IBizAlbaranCliente; AArticulosPendientes: IBizPedidoClienteArticulosPend; begin Result := False; + AAlbaran := NIL; if not Assigned(APedido) then raise Exception.Create('Pedido de cliente no asignado (GenerarAlbaranCli)'); @@ -185,34 +194,30 @@ begin if AArticulosPendientes.DataTable.RecordCount = 0 then begin ShowWarningMessage('Generar albarán a partir del pedido', 'Todos los artículos de este pedido ya figuran en uno o más albaranes de cliente. Por lo que no se pueden generar nuevos albaranes para este pedido'); -// ARespuesta := ShowConfirmMessage('Generar albarán a partir del pedido', 'Todos los artículos de este pedido ya figuran en uno o más albaranes de cliente.' + -// #10#13 + '¿Desea generar de todas formas otro albarán para este pedido?'); -// if (ARespuesta = IDNO) then Exit; // Aunque es un exit, se ejecuta la parte del finally antes de salir. end; - AAlbaran := AAlbaranesClienteController.Nuevo; - CopiarPedidoAAlbaran(APedido, AAlbaran); - CopiarArticulosPendAAlbaran(APedido, AAlbaran, AArticulosPendientes); + AuxAlbaran := AAlbaranesClienteController.Nuevo; + CopiarPedidoAAlbaran(APedido, AuxAlbaran); + CopiarArticulosPendAAlbaran(APedido, AuxAlbaran, AArticulosPendientes); //Sustituir por if de guardar - if AAlbaranesClienteController.Guardar(AAlbaran) then + if AAlbaranesClienteController.Guardar(AuxAlbaran) then begin -// ShowWarningMessage('Todos los artículos que contiene el pedido no están en el catálogo, y por lo tanto no se puede generar el albarán'); - + AAlbaran := AuxAlbaran; with dmGenerarAlbaranesCli.JsListaAlbaranesGenerados do begin Instruction.Text := 'Se ha generado el albarán'; Content.Clear; - Content.Add(Format('Se ha generado correctamente el albarán %s a partir del pedido de cliente' + #10#13, [AAlbaran.REFERENCIA])); + Content.Add(Format('Se ha generado correctamente el albarán %s a partir del pedido de cliente' + #10#13, [AuxAlbaran.REFERENCIA])); Execute; ARespuesta := CustomButtonResult; case ARespuesta of 100 : begin // Ver el albarán - AAlbaranesClienteController.Ver(AAlbaran); + AAlbaranesClienteController.Ver(AuxAlbaran); end; 200 : // Continuar; end; @@ -227,24 +232,32 @@ begin end; end; -function GenerarAlbaranCli : Boolean; overload; +function ElegirPedidoYGenerarAlbaranCli(var IDAlbaran: Integer) : Boolean; overload; var APedido : IBizPedidoCliente; + AAlbaran : IBizAlbaranCliente; begin Result := False; + IDAlbaran := -1; + + AAlbaran := NIL; try if not Assigned(APedidosClienteController) then - Inicializar; + Inicializar; APedido := APedidosClienteController.ElegirPedidos(APedidosClienteController.BuscarPendientes, 'Elija el pedido de cliente que desea utilizar para dar de alta el albarán de cliente.' , False); if Assigned(APedido) then - Result := GenerarAlbaranCli(APedido); + begin + Result := GenerarAlbaranCli(APedido, AAlbaran); + if Result then + IDAlbaran := AAlbaran.ID; + end; finally if Assigned(APedidosClienteController) then - Finalizar; + Finalizar; end; end;