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 36f26e23..86c94e6a 100644
Binary files a/Source/Base/GUIBase/GUIBase.res and b/Source/Base/GUIBase/GUIBase.res differ
diff --git a/Source/Base/GUIBase/uViewGridBase.pas b/Source/Base/GUIBase/uViewGridBase.pas
index dd9d6d67..83d2da35 100644
--- a/Source/Base/GUIBase/uViewGridBase.pas
+++ b/Source/Base/GUIBase/uViewGridBase.pas
@@ -73,7 +73,10 @@ type
property ViewFiltros: IViewFiltroBase read GetViewFiltros write SetViewFiltros;
function esSeleccionCeldaDatos: Boolean;
- end;
+
+ function Locate(const AItemIndex: Integer; const AValue: String;
+ const APartialCompare: Boolean = False) : Boolean;
+ end;
TfrViewGridBase = class(TfrViewBase, IViewGridBase)
@@ -130,6 +133,9 @@ type
procedure StoreToRegistry (const Path : String); virtual;
procedure RestoreFromRegistry (const Path : String); virtual;
+ function Locate(const AItemIndex: Integer; const AValue: String;
+ const APartialCompare: Boolean = False) : Boolean;
+
property Filter: string read GetFilter write SetFilter;
property Filtered : Boolean read GetFiltered;
@@ -243,6 +249,13 @@ begin
Result := (_FocusedView.ViewData.RowCount < 1);
end;
+function TfrViewGridBase.Locate(const AItemIndex: Integer; const AValue: String;
+ const APartialCompare: Boolean): Boolean;
+begin
+{ if Assigned(_FocusedView) then
+ Result := _FocusedView.DataController.FindRecordIndexByText(0, AItemIndex, AText, APartialCompare, True, True)}
+end;
+
procedure TfrViewGridBase.Preview;
begin
//
@@ -291,22 +304,19 @@ end;
procedure TfrViewGridBase.SetFilter(const Value: string);
begin
-// if FFilter <> 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;