Repaso del paso de pedido de cliente a albarán de cliente.

git-svn-id: https://192.168.0.254/svn/Proyectos.LuisLeon_FactuGES/trunk@34 c93665c3-c93d-084d-9b98-7d5f4a9c3376
This commit is contained in:
David Arranz 2007-06-14 13:10:45 +00:00
parent ba59a11005
commit c6100549bb
8 changed files with 72 additions and 55 deletions

View File

@ -170,8 +170,7 @@
<VersionInfoKeys Name="ProductName"></VersionInfoKeys> <VersionInfoKeys Name="ProductName"></VersionInfoKeys>
<VersionInfoKeys Name="ProductVersion">1.0.0.0</VersionInfoKeys> <VersionInfoKeys Name="ProductVersion">1.0.0.0</VersionInfoKeys>
<VersionInfoKeys Name="Comments"></VersionInfoKeys> <VersionInfoKeys Name="Comments"></VersionInfoKeys>
</VersionInfoKeys> </VersionInfoKeys> <Excluded_Packages>
<Excluded_Packages>
<Excluded_Packages Name="C:\Archivos de programa\RemObjects Software\Data Abstract for Delphi\Dcu\D10\DataAbstract_IDE_D10.bpl">RemObjects Data Abstract - IDE Package</Excluded_Packages> <Excluded_Packages Name="C:\Archivos de programa\RemObjects Software\Data Abstract for Delphi\Dcu\D10\DataAbstract_IDE_D10.bpl">RemObjects Data Abstract - IDE Package</Excluded_Packages>
<Excluded_Packages Name="C:\Documents and Settings\David\Mis documentos\Borland Studio Projects\Bpl\SMImportD2006.bpl">SMImport suite: data importing into dataset. Scalabium/Mike Shkolnik, 2000-2005</Excluded_Packages> <Excluded_Packages Name="C:\Documents and Settings\David\Mis documentos\Borland Studio Projects\Bpl\SMImportD2006.bpl">SMImport suite: data importing into dataset. Scalabium/Mike Shkolnik, 2000-2005</Excluded_Packages>
<Excluded_Packages Name="C:\Documents and Settings\David\Mis documentos\Borland Studio Projects\Bpl\SMExportD2006.bpl">SMExport suite: data export from dataset. Written by Mike Shkolnik/Scalabium, 1998-2004.</Excluded_Packages> <Excluded_Packages Name="C:\Documents and Settings\David\Mis documentos\Borland Studio Projects\Bpl\SMExportD2006.bpl">SMExport suite: data export from dataset. Written by Mike Shkolnik/Scalabium, 1998-2004.</Excluded_Packages>

Binary file not shown.

View File

@ -73,6 +73,9 @@ type
property ViewFiltros: IViewFiltroBase read GetViewFiltros write SetViewFiltros; property ViewFiltros: IViewFiltroBase read GetViewFiltros write SetViewFiltros;
function esSeleccionCeldaDatos: Boolean; function esSeleccionCeldaDatos: Boolean;
function Locate(const AItemIndex: Integer; const AValue: String;
const APartialCompare: Boolean = False) : Boolean;
end; end;
@ -130,6 +133,9 @@ type
procedure StoreToRegistry (const Path : String); virtual; procedure StoreToRegistry (const Path : String); virtual;
procedure RestoreFromRegistry (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 Filter: string read GetFilter write SetFilter;
property Filtered : Boolean read GetFiltered; property Filtered : Boolean read GetFiltered;
@ -243,6 +249,13 @@ begin
Result := (_FocusedView.ViewData.RowCount < 1); Result := (_FocusedView.ViewData.RowCount < 1);
end; 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; procedure TfrViewGridBase.Preview;
begin begin
// //
@ -291,8 +304,6 @@ end;
procedure TfrViewGridBase.SetFilter(const Value: string); procedure TfrViewGridBase.SetFilter(const Value: string);
begin 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 //Así tendremos el mismo valor en el filtro simple que en el filtro en detalle
@ -306,7 +317,6 @@ begin
if Assigned(FOnFilterChanged) then if Assigned(FOnFilterChanged) then
FOnFilterChanged(Self); FOnFilterChanged(Self);
// end;
end; end;
procedure TfrViewGridBase.SetMultiSelect(const Value: Boolean); procedure TfrViewGridBase.SetMultiSelect(const Value: Boolean);

View File

@ -285,8 +285,8 @@ end;
procedure TfEditorAlbaranesCliente.NuevoInterno; procedure TfEditorAlbaranesCliente.NuevoInterno;
var var
Respuesta : Integer; Respuesta : Integer;
FPedidosClienteController : IPedidosClienteController; AAlbaran : IBizAlbaranCliente;
APedido : IBizPedidoCliente; IDAlbaranAux: Integer;
begin begin
inherited; inherited;
@ -296,15 +296,8 @@ begin
begin begin
case JsNuevoAlbaranDialog.CustomButtonResult of case JsNuevoAlbaranDialog.CustomButtonResult of
200 : begin // Utilizar un pedido 200 : begin // Utilizar un pedido
FPedidosClienteController := TPedidosClienteController.Create; if ElegirPedidoYGenerarAlbaranCli(IDAlbaranAux) then
try actRefrescar.Execute;
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;
end; end;
100 : begin // Albaran nuevo vacio 100 : begin // Albaran nuevo vacio
if FController.Anadir(Albaranes) then if FController.Anadir(Albaranes) then

View File

@ -20,7 +20,8 @@
<Projects Name="PedidosCliente_data.bpl">Data\PedidosCliente_data.bdsproj</Projects> <Projects Name="PedidosCliente_data.bpl">Data\PedidosCliente_data.bdsproj</Projects>
<Projects Name="PedidosCliente_controller.bpl">Controller\PedidosCliente_controller.bdsproj</Projects> <Projects Name="PedidosCliente_controller.bpl">Controller\PedidosCliente_controller.bdsproj</Projects>
<Projects Name="PedidosCliente_view.bpl">Views\PedidosCliente_view.bdsproj</Projects> <Projects Name="PedidosCliente_view.bpl">Views\PedidosCliente_view.bdsproj</Projects>
<Projects Name="Targets">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</Projects> <Projects Name="PedidosCliente_plugin.bpl">Plugin\PedidosCliente_plugin.bdsproj</Projects>
<Projects Name="Targets">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</Projects>
</Projects> </Projects>
<Dependencies/> <Dependencies/>
</Default.Personality> </Default.Personality>

View File

@ -2,7 +2,6 @@ inherited fEditorPedidosCliente: TfEditorPedidosCliente
Caption = 'Lista de pedidos de cliente' Caption = 'Lista de pedidos de cliente'
ClientWidth = 674 ClientWidth = 674
ExplicitWidth = 682 ExplicitWidth = 682
ExplicitHeight = 240
PixelsPerInch = 96 PixelsPerInch = 96
TextHeight = 13 TextHeight = 13
inherited JvNavPanelHeader: TJvNavPanelHeader inherited JvNavPanelHeader: TJvNavPanelHeader

View File

@ -92,9 +92,11 @@ begin
end; end;
procedure TfEditorPedidosCliente.actGenerarAlbaranCliExecute(Sender: TObject); procedure TfEditorPedidosCliente.actGenerarAlbaranCliExecute(Sender: TObject);
var
IDAlbaranAux : Integer;
begin begin
inherited; inherited;
GenerarAlbaranCli(FPedidos); GenerarAlbaranCli(FPedidos.ID, IDAlbaranAux);
end; end;
procedure TfEditorPedidosCliente.actGenerarExecute(Sender: TObject); procedure TfEditorPedidosCliente.actGenerarExecute(Sender: TObject);

View File

@ -3,16 +3,17 @@ unit uGenerarAlbaranesCliUtils;
interface interface
uses uses
Windows, SysUtils, Classes, uBizPedidosCliente, pngimage, JSDialog; Windows, SysUtils, Classes, pngimage, JSDialog,
uBizPedidosCliente, uBizAlbaranesCliente;
type type
TdmGenerarAlbaranesCli = class(TDataModule) TdmGenerarAlbaranesCli = class(TDataModule)
JsListaAlbaranesGenerados: TJSDialog; JsListaAlbaranesGenerados: TJSDialog;
end; end;
function GenerarAlbaranCli(const IDPedido : Integer) : Boolean; overload; function GenerarAlbaranCli(const IDPedido : Integer; var IDAlbaran: Integer) : Boolean; overload;
function GenerarAlbaranCli(APedido : IBizPedidoCliente) : Boolean; overload; function GenerarAlbaranCli(APedido : IBizPedidoCliente; var AAlbaran: IBizAlbaranCliente) : Boolean; overload;
function GenerarAlbaranCli : Boolean; overload; function ElegirPedidoYGenerarAlbaranCli(var IDAlbaran: Integer) : Boolean;
implementation implementation
@ -22,7 +23,7 @@ uses
uDialogUtils, uBizDetallesPedidoCliente, uBizDetallesAlbaranCliente, uDialogUtils, uBizDetallesPedidoCliente, uBizDetallesAlbaranCliente,
uPedidosClienteController, uAlbaranesClienteController, uClientesController, uPedidosClienteController, uAlbaranesClienteController, uClientesController,
uDetallesAlbaranClienteController, uControllerDetallesBase, uDetallesAlbaranClienteController, uControllerDetallesBase,
uBizAlbaranesCliente, uBizContactos, schPedidosClienteClient_Intf, uBizContactos, schPedidosClienteClient_Intf,
schAlbaranesClienteClient_Intf; schAlbaranesClienteClient_Intf;
var var
@ -140,11 +141,14 @@ begin
end; end;
function GenerarAlbaranCli(const IDPedido : Integer) : Boolean; overload; function GenerarAlbaranCli(const IDPedido : Integer;
var IDAlbaran: Integer) : Boolean; overload;
var var
APedido : IBizPedidoCliente; APedido : IBizPedidoCliente;
AAlbaran : IBizAlbaranCliente;
begin begin
Result := False; Result := False;
IDAlbaran := -1;
try try
if not Assigned(APedidosClienteController) then if not Assigned(APedidosClienteController) then
@ -152,20 +156,25 @@ begin
APedido := APedidosClienteController.Buscar(IDPedido); APedido := APedidosClienteController.Buscar(IDPedido);
if Assigned(APedido) then if Assigned(APedido) then
Result := GenerarAlbaranCli(APedido); begin
Result := GenerarAlbaranCli(APedido, AAlbaran);
if Result then
IDAlbaran := AAlbaran.ID;
end;
finally finally
if Assigned(APedidosClienteController) then if Assigned(APedidosClienteController) then
Finalizar; Finalizar;
end; end;
end; end;
function GenerarAlbaranCli(APedido : IBizPedidoCliente) : Boolean; overload; function GenerarAlbaranCli(APedido : IBizPedidoCliente; var AAlbaran: IBizAlbaranCliente) : Boolean; overload;
var var
ARespuesta : Integer; ARespuesta : Integer;
AAlbaran : IBizAlbaranCliente; AuxAlbaran : IBizAlbaranCliente;
AArticulosPendientes: IBizPedidoClienteArticulosPend; AArticulosPendientes: IBizPedidoClienteArticulosPend;
begin begin
Result := False; Result := False;
AAlbaran := NIL;
if not Assigned(APedido) then if not Assigned(APedido) then
raise Exception.Create('Pedido de cliente no asignado (GenerarAlbaranCli)'); raise Exception.Create('Pedido de cliente no asignado (GenerarAlbaranCli)');
@ -185,34 +194,30 @@ begin
if AArticulosPendientes.DataTable.RecordCount = 0 then if AArticulosPendientes.DataTable.RecordCount = 0 then
begin 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'); 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. Exit; // Aunque es un exit, se ejecuta la parte del finally antes de salir.
end; end;
AAlbaran := AAlbaranesClienteController.Nuevo; AuxAlbaran := AAlbaranesClienteController.Nuevo;
CopiarPedidoAAlbaran(APedido, AAlbaran); CopiarPedidoAAlbaran(APedido, AuxAlbaran);
CopiarArticulosPendAAlbaran(APedido, AAlbaran, AArticulosPendientes); CopiarArticulosPendAAlbaran(APedido, AuxAlbaran, AArticulosPendientes);
//Sustituir por if de guardar //Sustituir por if de guardar
if AAlbaranesClienteController.Guardar(AAlbaran) then if AAlbaranesClienteController.Guardar(AuxAlbaran) then
begin 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 with dmGenerarAlbaranesCli.JsListaAlbaranesGenerados do
begin begin
Instruction.Text := 'Se ha generado el albarán'; Instruction.Text := 'Se ha generado el albarán';
Content.Clear; 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; Execute;
ARespuesta := CustomButtonResult; ARespuesta := CustomButtonResult;
case ARespuesta of case ARespuesta of
100 : begin 100 : begin
// Ver el albarán // Ver el albarán
AAlbaranesClienteController.Ver(AAlbaran); AAlbaranesClienteController.Ver(AuxAlbaran);
end; end;
200 : // Continuar; 200 : // Continuar;
end; end;
@ -227,11 +232,15 @@ begin
end; end;
end; end;
function GenerarAlbaranCli : Boolean; overload; function ElegirPedidoYGenerarAlbaranCli(var IDAlbaran: Integer) : Boolean; overload;
var var
APedido : IBizPedidoCliente; APedido : IBizPedidoCliente;
AAlbaran : IBizAlbaranCliente;
begin begin
Result := False; Result := False;
IDAlbaran := -1;
AAlbaran := NIL;
try try
if not Assigned(APedidosClienteController) then if not Assigned(APedidosClienteController) then
Inicializar; Inicializar;
@ -241,7 +250,11 @@ begin
, False); , False);
if Assigned(APedido) then if Assigned(APedido) then
Result := GenerarAlbaranCli(APedido); begin
Result := GenerarAlbaranCli(APedido, AAlbaran);
if Result then
IDAlbaran := AAlbaran.ID;
end;
finally finally
if Assigned(APedidosClienteController) then if Assigned(APedidosClienteController) then
Finalizar; Finalizar;