2019-11-18 10:36:42 +00:00
|
|
|
|
unit uEditorElegirClientes;
|
|
|
|
|
|
|
|
|
|
|
|
interface
|
|
|
|
|
|
|
|
|
|
|
|
uses
|
|
|
|
|
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|
|
|
|
|
Dialogs, uEditorClientes, DB, uDADataTable, Menus, JvAppStorage,
|
|
|
|
|
|
JvAppRegistryStorage, JvComponentBase, JvFormPlacement, ImgList, PngImageList,
|
|
|
|
|
|
StdActns, ActnList, uCustomView, uViewBase, uViewGridBase, uViewGrid,
|
|
|
|
|
|
uViewContactos, uViewClientes, ComCtrls, TB2ExtItems, TBXExtItems, TBX,
|
|
|
|
|
|
TB2Item, TB2Dock, TB2Toolbar, pngimage, ExtCtrls, JvExControls, JvComponent,
|
|
|
|
|
|
JvNavigationPane, uIEditorElegirClientes, uViewBarraSeleccion,
|
|
|
|
|
|
StdCtrls, uBizContactos, TBXStatusBars, JvExComCtrls, JvStatusBar, JSDialog,
|
|
|
|
|
|
uDAInterfaces;
|
|
|
|
|
|
|
|
|
|
|
|
type
|
|
|
|
|
|
TfEditorElegirClientes = class(TfEditorClientes, IEditorElegirClientes)
|
|
|
|
|
|
frViewBarraSeleccion1: TfrViewBarraSeleccion;
|
|
|
|
|
|
JsClienteBloqueadoDialog: TJSDialog;
|
|
|
|
|
|
EditorSeleccionActionList: TActionList;
|
|
|
|
|
|
actBuscar2: TAction;
|
|
|
|
|
|
actQuitarFiltro2: TAction;
|
|
|
|
|
|
actAnchoAuto2: TAction;
|
|
|
|
|
|
pnlHeader: TPanel;
|
|
|
|
|
|
lblTitle: TLabel;
|
|
|
|
|
|
lblComments: TLabel;
|
|
|
|
|
|
procedure frViewBarraSeleccion1actSeleccionarUpdate(Sender: TObject);
|
|
|
|
|
|
procedure frViewBarraSeleccion1actCancelarExecute(Sender: TObject);
|
|
|
|
|
|
procedure frViewBarraSeleccion1actSeleccionarExecute(Sender: TObject);
|
|
|
|
|
|
procedure FormShow(Sender: TObject);
|
|
|
|
|
|
procedure actQuitarFiltro2Execute(Sender: TObject);
|
|
|
|
|
|
procedure actAnchoAuto2Execute(Sender: TObject);
|
|
|
|
|
|
protected
|
|
|
|
|
|
procedure SetMultiSelect (AValue : Boolean);
|
|
|
|
|
|
function GetMultiSelect : Boolean;
|
|
|
|
|
|
function GetContactosSeleccionados: IBizContacto;
|
|
|
|
|
|
procedure SetViewGrid(const Value: IViewGridBase); override;
|
|
|
|
|
|
procedure SetMensaje (const AValue: String);
|
|
|
|
|
|
function GetMensaje: String;
|
|
|
|
|
|
public
|
|
|
|
|
|
property Mensaje : String read GetMensaje write SetMensaje;
|
|
|
|
|
|
property ContactosSeleccionados: IBizContacto read GetContactosSeleccionados;
|
|
|
|
|
|
property MultiSelect : Boolean read GetMultiSelect write SetMultiSelect;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
implementation
|
|
|
|
|
|
|
|
|
|
|
|
uses
|
|
|
|
|
|
uEditorGridBase, cxGridCustomTableView, uIntegerListUtils, uEditorContactos,
|
|
|
|
|
|
uGridUtils, uEditorBase, cxControls, uDBSelectionListUtils,
|
|
|
|
|
|
uDialogUtils;
|
|
|
|
|
|
|
|
|
|
|
|
{$R *.dfm}
|
|
|
|
|
|
|
|
|
|
|
|
{ TfEditorElegirClientes }
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfEditorElegirClientes.actAnchoAuto2Execute(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
actAnchoAuto.Execute;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfEditorElegirClientes.actQuitarFiltro2Execute(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
actQuitarFiltro.Execute;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfEditorElegirClientes.FormShow(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
2020-02-10 10:32:15 +00:00
|
|
|
|
// EditorActionList.State := asSuspended;
|
2019-11-18 10:36:42 +00:00
|
|
|
|
frViewClientes1.cxViewGridPopupMenu.PopupMenus.Items[0].HitTypes := [];
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfEditorElegirClientes.frViewBarraSeleccion1actCancelarExecute(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
Close;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfEditorElegirClientes.frViewBarraSeleccion1actSeleccionarExecute(Sender: TObject);
|
|
|
|
|
|
var
|
|
|
|
|
|
Respuesta : Integer;
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
|
|
|
|
|
|
// <20>El cliente seleccionado est<73> bloqueado?
|
|
|
|
|
|
if (FContactos as IBizCliente).BLOQUEADO = 1 then
|
|
|
|
|
|
begin
|
|
|
|
|
|
JsClienteBloqueadoDialog.Content.Text := 'Motivo: ' +
|
|
|
|
|
|
(FContactos as IBizCliente).MOTIVO_BLOQUEO;
|
|
|
|
|
|
Respuesta := JsClienteBloqueadoDialog.Execute;
|
|
|
|
|
|
|
|
|
|
|
|
if Respuesta <> IDCANCEL then
|
|
|
|
|
|
begin
|
|
|
|
|
|
case JsClienteBloqueadoDialog.CustomButtonResult of
|
|
|
|
|
|
200 : begin // Utilizarlo aunque est<73> bloqueado
|
|
|
|
|
|
ModalResult := mrOk;
|
|
|
|
|
|
Exit;
|
|
|
|
|
|
end;
|
|
|
|
|
|
100 : begin // Elegir otro
|
|
|
|
|
|
Exit;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end
|
|
|
|
|
|
else // El cliente no est<73> bloqueado. Puedo continuar.
|
|
|
|
|
|
ModalResult := mrOk;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfEditorElegirClientes.frViewBarraSeleccion1actSeleccionarUpdate(
|
|
|
|
|
|
Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
(Sender as TAction).Enabled := (ViewGrid._FocusedView.Controller.SelectedRowCount > 0)
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
function TfEditorElegirClientes.GetContactosSeleccionados: IBizContacto;
|
|
|
|
|
|
begin
|
|
|
|
|
|
ShowHourglassCursor;
|
|
|
|
|
|
try
|
|
|
|
|
|
SeleccionarFilasDesdeGrid(ViewGrid._FocusedView, (Contactos as ISeleccionable).SelectedRecords);
|
|
|
|
|
|
// En Contactos.SelectedRecords tengo los ID de las filas seleccionadas del grid
|
|
|
|
|
|
Result := Controller.ExtraerSeleccionados(Contactos);
|
|
|
|
|
|
finally
|
|
|
|
|
|
HideHourglassCursor;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
function TfEditorElegirClientes.GetMensaje: String;
|
|
|
|
|
|
begin
|
|
|
|
|
|
Result := lblComments.Caption;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
function TfEditorElegirClientes.GetMultiSelect: Boolean;
|
|
|
|
|
|
begin
|
|
|
|
|
|
Result := ViewGrid.MultiSelect;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfEditorElegirClientes.SetMensaje(const AValue: String);
|
|
|
|
|
|
begin
|
|
|
|
|
|
lblComments.Caption := AValue;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfEditorElegirClientes.SetMultiSelect(AValue: Boolean);
|
|
|
|
|
|
begin
|
|
|
|
|
|
ViewGrid.MultiSelect := AValue;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfEditorElegirClientes.SetViewGrid(const Value: IViewGridBase);
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
ViewGrid.OnDblClick := frViewBarraSeleccion1.actSeleccionar.OnExecute;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
end.
|