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:
parent
ba59a11005
commit
c6100549bb
@ -170,8 +170,7 @@
|
||||
<VersionInfoKeys Name="ProductName"></VersionInfoKeys>
|
||||
<VersionInfoKeys Name="ProductVersion">1.0.0.0</VersionInfoKeys>
|
||||
<VersionInfoKeys Name="Comments"></VersionInfoKeys>
|
||||
</VersionInfoKeys>
|
||||
<Excluded_Packages>
|
||||
</VersionInfoKeys> <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\SMExportD2006.bpl">SMExport suite: data export from dataset. Written by Mike Shkolnik/Scalabium, 1998-2004.</Excluded_Packages>
|
||||
|
||||
Binary file not shown.
@ -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);
|
||||
|
||||
@ -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
|
||||
|
||||
@ -20,7 +20,8 @@
|
||||
<Projects Name="PedidosCliente_data.bpl">Data\PedidosCliente_data.bdsproj</Projects>
|
||||
<Projects Name="PedidosCliente_controller.bpl">Controller\PedidosCliente_controller.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>
|
||||
<Dependencies/>
|
||||
</Default.Personality>
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user