2010-02-17 10:44:34 +00:00
|
|
|
|
unit uEditorPedidosCliente;
|
|
|
|
|
|
|
|
|
|
|
|
interface
|
|
|
|
|
|
|
|
|
|
|
|
uses
|
|
|
|
|
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|
|
|
|
|
Menus, DB, uDADataTable, JvAppStorage,
|
|
|
|
|
|
JvAppRegistryStorage, JvComponent, JvFormPlacement, ImgList,
|
|
|
|
|
|
PngImageList, StdActns, ActnList, ComCtrls, TB2ExtItems,
|
|
|
|
|
|
|
|
|
|
|
|
JvNavigationPane, uViewGrid, pngimage, JvComponentBase,
|
|
|
|
|
|
uEditorGridBase,
|
|
|
|
|
|
uBizPedidosCliente, uIEditorPedidosCliente, uPedidosClienteController,
|
|
|
|
|
|
uCustomView, uViewBase, uViewBarraSeleccion, uViewGridBase,
|
|
|
|
|
|
uViewPedidosCliente, JvExComCtrls, JvStatusBar, JSDialog, StdCtrls,
|
|
|
|
|
|
uDAInterfaces, SpTBXItem, TntStdCtrls, SpTBXEditors, TB2Item, TB2Dock,
|
|
|
|
|
|
TB2Toolbar, ExtCtrls, JvExControls;
|
|
|
|
|
|
|
|
|
|
|
|
type
|
|
|
|
|
|
TfEditorPedidosCliente = class(TfEditorGridBase, IEditorPedidosCliente)
|
|
|
|
|
|
actGenerarAlbaranCli: TAction;
|
|
|
|
|
|
actGenerarFactura: TAction;
|
2010-04-19 15:57:24 +00:00
|
|
|
|
actVerArticulosPendientes: TAction;
|
2010-02-17 10:44:34 +00:00
|
|
|
|
N4: TMenuItem;
|
|
|
|
|
|
actGenerar: TAction;
|
|
|
|
|
|
Generar2: TMenuItem;
|
|
|
|
|
|
JsGenerarDialog: TJSDialog;
|
|
|
|
|
|
JsPrevisualizarDialog: TJSDialog;
|
|
|
|
|
|
JsImprimirDialog: TJSDialog;
|
|
|
|
|
|
JsListaPedidosNoEliminados: TJSDialog;
|
|
|
|
|
|
actEnviarEmail: TAction;
|
2010-04-19 15:57:24 +00:00
|
|
|
|
SpTBXItem2: TSpTBXItem;
|
2010-05-05 11:07:11 +00:00
|
|
|
|
frViewPedidosCliente1: TfrViewPedidosCliente;
|
|
|
|
|
|
SpTBXItem3: TSpTBXItem;
|
2010-02-17 10:44:34 +00:00
|
|
|
|
procedure FormShow(Sender: TObject);
|
|
|
|
|
|
procedure actGenerarAlbaranCliExecute(Sender: TObject);
|
|
|
|
|
|
procedure actEliminarUpdate(Sender: TObject);
|
|
|
|
|
|
procedure actGenerarFacturaUpdate(Sender: TObject);
|
|
|
|
|
|
procedure actGenerarFacturaExecute(Sender: TObject);
|
2010-04-19 15:57:24 +00:00
|
|
|
|
procedure actVerArticulosPendientesExecute(Sender: TObject);
|
2010-02-17 10:44:34 +00:00
|
|
|
|
procedure actGenerarExecute(Sender: TObject);
|
|
|
|
|
|
procedure actGenerarUpdate(Sender: TObject);
|
|
|
|
|
|
procedure actEnviarEmailExecute(Sender: TObject);
|
|
|
|
|
|
procedure actEnviarEmailUpdate(Sender: TObject);
|
|
|
|
|
|
procedure OnListaAnosChange(Sender: TObject);
|
2010-05-05 11:07:11 +00:00
|
|
|
|
procedure actQuitarFiltroExecute(Sender: TObject);
|
2010-02-17 10:44:34 +00:00
|
|
|
|
|
|
|
|
|
|
protected
|
|
|
|
|
|
FPedidos: IBizPedidoCliente;
|
|
|
|
|
|
FController : IPedidosClienteController;
|
|
|
|
|
|
|
|
|
|
|
|
function GetPedidos: IBizPedidoCliente;
|
|
|
|
|
|
procedure SetPedidos(const Value: IBizPedidoCliente);
|
|
|
|
|
|
|
|
|
|
|
|
function GetController : IPedidosClienteController; virtual;
|
|
|
|
|
|
procedure SetController (const Value : IPedidosClienteController); virtual;
|
|
|
|
|
|
|
|
|
|
|
|
procedure NuevoInterno; override;
|
|
|
|
|
|
procedure ModificarInterno; override;
|
|
|
|
|
|
procedure EliminarInterno; override;
|
|
|
|
|
|
procedure DuplicarInterno; override;
|
|
|
|
|
|
procedure ImprimirInterno; override;
|
|
|
|
|
|
procedure PrevisualizarInterno; override;
|
|
|
|
|
|
procedure RefrescarInterno; override;
|
|
|
|
|
|
|
|
|
|
|
|
//Si queremos crear otra vista para el editor heredado solo tendriamos que
|
|
|
|
|
|
//sobreescribir este metodo
|
|
|
|
|
|
procedure AsignarVista; virtual;
|
|
|
|
|
|
|
|
|
|
|
|
public
|
|
|
|
|
|
procedure PonerTitulos(const ATitulo: string = ''); override;
|
|
|
|
|
|
property Pedidos: IBizPedidoCliente read GetPedidos write SetPedidos;
|
|
|
|
|
|
property Controller : IPedidosClienteController read GetController write SetController;
|
|
|
|
|
|
constructor Create(AOwner: TComponent); override;
|
|
|
|
|
|
destructor Destroy; override;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
implementation
|
|
|
|
|
|
|
|
|
|
|
|
uses
|
|
|
|
|
|
uDataModulePedidosCliente, uDataModuleUsuarios, uBizAlbaranesCliente,
|
|
|
|
|
|
uAlbaranesClienteController, uEditorBase, uEditorDBBase, uDialogUtils,
|
|
|
|
|
|
uFacturasClienteController, uBizFacturasCliente, uGridUtils, uDBSelectionListUtils,
|
|
|
|
|
|
// uGenerarPedidosProvUtils,
|
|
|
|
|
|
uGenerarAlbaranesCliUtils, cxControls, uFactuGES_App;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{$R *.dfm}
|
|
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
*************************** TfEditorPedidosCliente ***************************
|
|
|
|
|
|
}
|
|
|
|
|
|
procedure TfEditorPedidosCliente.actEliminarUpdate(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
if (Sender as TAction).Enabled then
|
|
|
|
|
|
(Sender as TAction).Enabled := (FPedidos.SITUACION = SITUACION_PEDIDO_PENDIENTE);
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfEditorPedidosCliente.actEnviarEmailExecute(Sender: TObject);
|
|
|
|
|
|
var
|
|
|
|
|
|
APedidos : IBizPedidoCliente;
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
{
|
|
|
|
|
|
if ViewGrid.NumSeleccionados = 1 then
|
|
|
|
|
|
FController.GenerarEmailPedido(Pedidos)
|
|
|
|
|
|
else begin
|
|
|
|
|
|
ShowHourglassCursor;
|
|
|
|
|
|
try
|
|
|
|
|
|
SeleccionarFilasDesdeGrid(ViewGrid._FocusedView, (Pedidos as ISeleccionable).SelectedRecords);
|
|
|
|
|
|
APedidos := (Controller as IPedidosClienteController).ExtraerSeleccionados(Pedidos, ViewGrid) as IBizPedidoCliente;
|
|
|
|
|
|
|
|
|
|
|
|
if Assigned(APedidos) then
|
|
|
|
|
|
if FController.EnviarEmailPedidos(APedidos) then
|
|
|
|
|
|
RefrescarInterno;
|
|
|
|
|
|
finally
|
|
|
|
|
|
APedidos := NIL;
|
|
|
|
|
|
HideHourglassCursor;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
}
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfEditorPedidosCliente.actEnviarEmailUpdate(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
{
|
|
|
|
|
|
if HayDatos and Assigned(ViewGrid) then
|
|
|
|
|
|
(Sender as TAction).Enabled := ViewGrid.esSeleccionCeldaDatos
|
|
|
|
|
|
and (ViewGrid.NumSeleccionados > 0)
|
|
|
|
|
|
else
|
|
|
|
|
|
(Sender as TAction).Enabled := False;
|
|
|
|
|
|
}
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfEditorPedidosCliente.actGenerarAlbaranCliExecute(Sender: TObject);
|
|
|
|
|
|
var
|
|
|
|
|
|
IDAlbaranAux : Integer;
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
GenerarAlbaranCli(FPedidos.ID, IDAlbaranAux);
|
2010-04-07 08:23:49 +00:00
|
|
|
|
actRefrescar.Execute;
|
2010-02-17 10:44:34 +00:00
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfEditorPedidosCliente.actGenerarExecute(Sender: TObject);
|
|
|
|
|
|
var
|
|
|
|
|
|
Respuesta : Integer;
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
|
|
|
|
|
|
Respuesta := JsGenerarDialog.Execute;
|
|
|
|
|
|
|
|
|
|
|
|
if Respuesta <> IDCANCEL then
|
|
|
|
|
|
begin
|
|
|
|
|
|
case JsGenerarDialog.CustomButtonResult of
|
|
|
|
|
|
200 : begin // Generar uno o m<>s pedidos a proveedor
|
2010-04-19 15:57:24 +00:00
|
|
|
|
// actGenerarPedidoProv.Execute;
|
2010-02-17 10:44:34 +00:00
|
|
|
|
end;
|
|
|
|
|
|
100 : begin // Albaran nuevo
|
|
|
|
|
|
actGenerarAlbaranCli.Execute;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
actRefrescar.Execute;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfEditorPedidosCliente.actGenerarFacturaExecute(Sender: TObject);
|
|
|
|
|
|
var
|
|
|
|
|
|
AFacturasController : IFacturasClienteController;
|
|
|
|
|
|
AFactura : IBizFacturaCliente;
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
{
|
|
|
|
|
|
AFacturasController := TFacturasClienteController.Create;
|
|
|
|
|
|
try
|
|
|
|
|
|
AFactura := AFacturasController.Nuevo;
|
|
|
|
|
|
if AFacturasController.Anadir(AFactura, FPedidos.ID) then
|
|
|
|
|
|
AFacturasController.Ver(AFactura);
|
|
|
|
|
|
actRefrescar.Execute;
|
|
|
|
|
|
finally
|
|
|
|
|
|
AFacturasController := NIL;
|
|
|
|
|
|
AFactura := NIL;
|
|
|
|
|
|
end;
|
|
|
|
|
|
}
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfEditorPedidosCliente.actGenerarFacturaUpdate(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
(Sender as TAction).Enabled := HayDatos
|
|
|
|
|
|
and ViewGrid.esSeleccionCeldaDatos
|
|
|
|
|
|
and (FPedidos.SITUACION = SITUACION_PEDIDO_PENDIENTE);
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
2010-04-19 15:57:24 +00:00
|
|
|
|
procedure TfEditorPedidosCliente.actVerArticulosPendientesExecute(Sender: TObject);
|
2010-02-17 10:44:34 +00:00
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
2010-04-19 15:57:24 +00:00
|
|
|
|
FController.VerArticulosPendientes;
|
2010-02-17 10:44:34 +00:00
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfEditorPedidosCliente.actGenerarUpdate(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
(Sender as TAction).Enabled := HayDatos and
|
|
|
|
|
|
not (ViewGrid.NumSeleccionados > 1) and
|
|
|
|
|
|
ViewGrid.esSeleccionCeldaDatos and
|
|
|
|
|
|
(FPedidos.SITUACION <> SITUACION_PEDIDO_SERVIDO);
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
2010-05-05 11:07:11 +00:00
|
|
|
|
procedure TfEditorPedidosCliente.actQuitarFiltroExecute(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
frViewPedidosCliente1.frViewFiltroBase1actQuitarFiltroExecute(Sender);
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
2010-02-17 10:44:34 +00:00
|
|
|
|
procedure TfEditorPedidosCliente.AsignarVista;
|
|
|
|
|
|
begin
|
2010-05-05 11:07:11 +00:00
|
|
|
|
ViewGrid := frViewPedidosCliente1;
|
2010-02-17 10:44:34 +00:00
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
constructor TfEditorPedidosCliente.Create(AOwner: TComponent);
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
AsignarVista;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
destructor TfEditorPedidosCliente.Destroy;
|
|
|
|
|
|
begin
|
|
|
|
|
|
FPedidos := NIL;
|
|
|
|
|
|
FController := NIL;
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfEditorPedidosCliente.DuplicarInterno;
|
|
|
|
|
|
var
|
|
|
|
|
|
APedido : IBizPedidoCliente;
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
APedido := FController.Duplicar(Pedidos);
|
|
|
|
|
|
try
|
|
|
|
|
|
FController.Ver(APedido);
|
|
|
|
|
|
finally
|
|
|
|
|
|
actRefrescar.Execute;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfEditorPedidosCliente.EliminarInterno;
|
|
|
|
|
|
var
|
|
|
|
|
|
APedidos: IBizPedidoCliente;
|
|
|
|
|
|
AllItems: Boolean;
|
|
|
|
|
|
begin
|
|
|
|
|
|
APedidos := Nil;
|
|
|
|
|
|
AllItems := False;
|
|
|
|
|
|
|
|
|
|
|
|
if MultiSelect and Assigned(ViewGrid) then
|
|
|
|
|
|
AllItems := (ViewGrid.NumSeleccionados > 1);
|
|
|
|
|
|
|
|
|
|
|
|
if AllItems then
|
|
|
|
|
|
begin
|
|
|
|
|
|
if (Application.MessageBox('<27>Desea borrar los pedidos de proveedor seleccionados?', 'Atenci<63>n', MB_YESNO) = IDYES) then
|
|
|
|
|
|
begin
|
|
|
|
|
|
SeleccionarFilasDesdeGrid(ViewGrid._FocusedView, (Pedidos as ISeleccionable).SelectedRecords);
|
|
|
|
|
|
APedidos := (Controller as IPedidosClienteController).ExtraerSeleccionados(Pedidos) as IBizPedidoCliente;
|
|
|
|
|
|
end
|
|
|
|
|
|
end
|
|
|
|
|
|
else begin
|
|
|
|
|
|
if (Application.MessageBox('<27>Desea borrar el pedido de proveedor seleccionado?', 'Atenci<63>n', MB_YESNO) = IDYES) then
|
|
|
|
|
|
APedidos := Pedidos;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
if Assigned(APedidos) then
|
|
|
|
|
|
begin
|
|
|
|
|
|
FController.Eliminar(APedidos, AllItems);
|
|
|
|
|
|
if AllItems then
|
|
|
|
|
|
begin
|
|
|
|
|
|
if (APedidos.DataTable.RecordCount > 0) then
|
|
|
|
|
|
begin
|
|
|
|
|
|
with APedidos.DataTable do
|
|
|
|
|
|
begin
|
|
|
|
|
|
First;
|
|
|
|
|
|
while not EOF do
|
|
|
|
|
|
begin
|
|
|
|
|
|
JsListaPedidosNoEliminados.Content.Add('Ref. pedido: ' + APedidos.REFERENCIA + ' ' + APedidos.NOMBRE);
|
|
|
|
|
|
Next;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
JsListaPedidosNoEliminados.Execute;
|
|
|
|
|
|
end;
|
|
|
|
|
|
actRefrescar.Execute;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
ViewGrid.GotoFirst;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfEditorPedidosCliente.FormShow(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
cbxListaAnos.OnChange := OnListaAnosChange; //OJO SIEMPRE ANTES QUE EL INHERITED
|
|
|
|
|
|
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
|
|
|
|
|
|
if not Assigned(ViewGrid) then
|
|
|
|
|
|
raise Exception.Create('No hay ninguna vista asignada');
|
|
|
|
|
|
|
|
|
|
|
|
if not Assigned(Pedidos) then
|
|
|
|
|
|
raise Exception.Create('No hay ning<6E>n pedido asignado');
|
|
|
|
|
|
|
|
|
|
|
|
Pedidos.DataTable.Active := True;
|
|
|
|
|
|
ViewGrid.GotoFirst;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
function TfEditorPedidosCliente.GetController: IPedidosClienteController;
|
|
|
|
|
|
begin
|
|
|
|
|
|
Result := FController;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
function TfEditorPedidosCliente.GetPedidos: IBizPedidoCliente;
|
|
|
|
|
|
begin
|
|
|
|
|
|
Result := FPedidos;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfEditorPedidosCliente.ImprimirInterno;
|
|
|
|
|
|
var
|
|
|
|
|
|
Respuesta : Integer;
|
|
|
|
|
|
APedidos: IBizPedidoCliente;
|
|
|
|
|
|
AllItems: Boolean;
|
|
|
|
|
|
begin
|
|
|
|
|
|
APedidos := Nil;
|
|
|
|
|
|
AllItems := False;
|
|
|
|
|
|
|
|
|
|
|
|
if MultiSelect and Assigned(ViewGrid) then
|
|
|
|
|
|
AllItems := (ViewGrid.NumSeleccionados > 1);
|
|
|
|
|
|
|
|
|
|
|
|
//Si esta agrupado solo podr<64> imprimir la lista de elementos visibles
|
|
|
|
|
|
if not ViewGrid.esSeleccionCeldaDatos then
|
|
|
|
|
|
inherited
|
|
|
|
|
|
else
|
|
|
|
|
|
begin
|
|
|
|
|
|
Respuesta := JsImprimirDialog.Execute;
|
|
|
|
|
|
if Respuesta <> IDCANCEL then
|
|
|
|
|
|
begin
|
|
|
|
|
|
case JsImprimirDialog.CustomButtonResult of
|
|
|
|
|
|
200 : begin // Lista de elementos visibles
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
end;
|
|
|
|
|
|
100 : begin // Elemento Seleccionado
|
|
|
|
|
|
if AllItems then
|
|
|
|
|
|
begin
|
|
|
|
|
|
SeleccionarFilasDesdeGrid(ViewGrid._FocusedView, (Pedidos as ISeleccionable).SelectedRecords);
|
|
|
|
|
|
APedidos := (Controller as IPedidosClienteController).ExtraerSeleccionados(Pedidos) as IBizPedidoCliente;
|
|
|
|
|
|
end
|
|
|
|
|
|
else
|
|
|
|
|
|
APedidos := Pedidos;
|
|
|
|
|
|
|
|
|
|
|
|
if Assigned(APedidos) then
|
|
|
|
|
|
if FController.Print(APedidos, AllItems) then
|
|
|
|
|
|
RefrescarInterno;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfEditorPedidosCliente.ModificarInterno;
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
FController.Ver(Pedidos);
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfEditorPedidosCliente.NuevoInterno;
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
if FController.Anadir(Pedidos) then
|
|
|
|
|
|
FController.Ver(Pedidos);
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfEditorPedidosCliente.OnListaAnosChange(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
Controller.FiltrarAno(Pedidos, DynWhereDataTable, cbxListaAnos.Text);
|
|
|
|
|
|
if Pedidos.DataTable.Active then
|
|
|
|
|
|
RefrescarInterno;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfEditorPedidosCliente.PonerTitulos(const ATitulo: string);
|
|
|
|
|
|
var
|
|
|
|
|
|
FTitulo : String;
|
|
|
|
|
|
begin
|
|
|
|
|
|
FTitulo := 'Lista de pedidos de cliente - ' + AppFactuGES.EmpresaActiva.NOMBRE;
|
|
|
|
|
|
inherited PonerTitulos(FTitulo);
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfEditorPedidosCliente.PrevisualizarInterno;
|
|
|
|
|
|
var
|
|
|
|
|
|
Respuesta : Integer;
|
|
|
|
|
|
APedidos: IBizPedidoCliente;
|
|
|
|
|
|
AllItems: Boolean;
|
|
|
|
|
|
begin
|
|
|
|
|
|
APedidos := Nil;
|
|
|
|
|
|
AllItems := False;
|
|
|
|
|
|
|
|
|
|
|
|
if MultiSelect and Assigned(ViewGrid) then
|
|
|
|
|
|
AllItems := (ViewGrid.NumSeleccionados > 1);
|
|
|
|
|
|
|
|
|
|
|
|
//Si esta agrupado solo podr<64> imprimir la lista de elementos visibles
|
|
|
|
|
|
if not ViewGrid.esSeleccionCeldaDatos then
|
|
|
|
|
|
inherited
|
|
|
|
|
|
else
|
|
|
|
|
|
begin
|
|
|
|
|
|
Respuesta := JsPrevisualizarDialog.Execute;
|
|
|
|
|
|
if Respuesta <> IDCANCEL then
|
|
|
|
|
|
begin
|
|
|
|
|
|
case JsPrevisualizarDialog.CustomButtonResult of
|
|
|
|
|
|
200 : begin // Lista de elementos visibles
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
end;
|
|
|
|
|
|
100 : begin // Elemento Seleccionado
|
|
|
|
|
|
if AllItems then
|
|
|
|
|
|
begin
|
|
|
|
|
|
SeleccionarFilasDesdeGrid(ViewGrid._FocusedView, (Pedidos as ISeleccionable).SelectedRecords);
|
|
|
|
|
|
APedidos := (Controller as IPedidosClienteController).ExtraerSeleccionados(Pedidos) as IBizPedidoCliente;
|
|
|
|
|
|
end
|
|
|
|
|
|
else
|
|
|
|
|
|
APedidos := Pedidos;
|
|
|
|
|
|
|
|
|
|
|
|
if Assigned(APedidos) then
|
|
|
|
|
|
FController.Preview(APedidos, AllItems);
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfEditorPedidosCliente.RefrescarInterno;
|
|
|
|
|
|
begin
|
|
|
|
|
|
//Volvemos a cargar los a<>os de los pedidos
|
|
|
|
|
|
if Assigned(FController) then
|
|
|
|
|
|
ListaAnos := FController.DarListaAnosPedidos;
|
|
|
|
|
|
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfEditorPedidosCliente.SetController(const Value: IPedidosClienteController);
|
|
|
|
|
|
begin
|
|
|
|
|
|
FController := Value;
|
|
|
|
|
|
|
|
|
|
|
|
if Assigned(FController) then
|
|
|
|
|
|
ListaAnos := FController.DarListaAnosPedidos;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfEditorPedidosCliente.SetPedidos(const Value: IBizPedidoCliente);
|
|
|
|
|
|
begin
|
|
|
|
|
|
FPedidos := Value;
|
|
|
|
|
|
|
|
|
|
|
|
if Assigned(FPedidos) then
|
|
|
|
|
|
begin
|
|
|
|
|
|
//Se guarda el where de la sentencia origen, por si el editor tiene filtros que
|
|
|
|
|
|
//afecten a este where y en un futuro se desea volver al where origen (filtro de a<>o))
|
|
|
|
|
|
DynWhereDataTable := FPedidos.DataTable.DynamicWhere.Xml;
|
|
|
|
|
|
|
|
|
|
|
|
dsDataTable.DataTable := FPedidos.DataTable;
|
|
|
|
|
|
if Assigned(ViewGrid) then
|
|
|
|
|
|
(ViewGrid as IViewPedidosCliente).Pedidos := Pedidos;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
end.
|