2007-09-12 14:11:44 +00:00
|
|
|
|
unit uEditorContactos;
|
|
|
|
|
|
|
|
|
|
|
|
interface
|
|
|
|
|
|
|
|
|
|
|
|
uses
|
|
|
|
|
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|
|
|
|
|
Dialogs, uEditorBase, uEditorGridBase, ToolWin, ComCtrls, JvExControls, JvComponent,
|
|
|
|
|
|
JvNavigationPane, uViewContactos, uBizContactos, ActnList, DBActns, uViewGridBase,
|
2007-10-24 18:54:18 +00:00
|
|
|
|
Menus, uDMBase, ImgList, PngImageList, TB2Dock, TB2Toolbar, TBX,
|
2007-09-12 14:11:44 +00:00
|
|
|
|
TB2Item, StdActns, TB2ExtItems, TBXExtItems, TB2MRU, DB, uDADataTable,
|
|
|
|
|
|
JvFormAutoSize, uDAScriptingProvider, uDACDSDataTable, JvAppStorage,
|
|
|
|
|
|
JvAppRegistryStorage, JvFormPlacement, ExtCtrls, uCustomView, uViewBase,
|
|
|
|
|
|
uViewBarraSeleccion, JvComponentBase, uContactosController,
|
|
|
|
|
|
|
2007-10-03 10:27:58 +00:00
|
|
|
|
uIEditorContactos, pngimage, TBXStatusBars, JvExComCtrls, JvStatusBar,
|
|
|
|
|
|
uDAInterfaces;
|
2007-09-12 14:11:44 +00:00
|
|
|
|
|
|
|
|
|
|
type
|
|
|
|
|
|
TfEditorContactos = class(TfEditorGridBase, IEditorContactos)
|
2008-11-10 11:29:57 +00:00
|
|
|
|
TBXSubmenuItemAcciones: TTBXSubmenuItem;
|
2007-09-12 14:11:44 +00:00
|
|
|
|
procedure FormShow(Sender: TObject);
|
|
|
|
|
|
protected
|
|
|
|
|
|
FContactos: IBizContacto;
|
|
|
|
|
|
FController : IContactosController;
|
|
|
|
|
|
|
|
|
|
|
|
function GetContactos: IBizContacto; virtual;
|
|
|
|
|
|
procedure SetContactos(const Value: IBizContacto); virtual;
|
|
|
|
|
|
procedure SetViewGrid(const Value: IViewGridBase); override;
|
|
|
|
|
|
function GetController : IContactosController; virtual;
|
|
|
|
|
|
procedure SetController (const Value : IContactosController); virtual;
|
|
|
|
|
|
procedure NuevoInterno; override;
|
|
|
|
|
|
procedure ModificarInterno; override;
|
|
|
|
|
|
procedure EliminarInterno; override;
|
|
|
|
|
|
procedure DuplicarInterno; override;
|
|
|
|
|
|
procedure ImprimirInterno; override;
|
|
|
|
|
|
procedure PrevisualizarInterno; override;
|
|
|
|
|
|
|
|
|
|
|
|
public
|
|
|
|
|
|
procedure PonerTitulos(const ATitulo: string = ''); override;
|
|
|
|
|
|
property Controller : IContactosController read GetController
|
|
|
|
|
|
write SetController;
|
|
|
|
|
|
property Contactos: IBizContacto read GetContactos write SetContactos;
|
|
|
|
|
|
destructor Destroy; override;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
implementation
|
|
|
|
|
|
|
|
|
|
|
|
uses
|
2007-11-18 12:49:11 +00:00
|
|
|
|
uCustomEditor, uDataModuleContactos, uFactuGES_App,
|
|
|
|
|
|
uEditorDBBase, cxGrid, cxGridCustomTableView,
|
|
|
|
|
|
uDBSelectionListUtils;
|
2007-09-12 14:11:44 +00:00
|
|
|
|
|
|
|
|
|
|
{$R *.dfm}
|
|
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
****************************** TfEditorContactos *******************************
|
|
|
|
|
|
}
|
|
|
|
|
|
procedure TfEditorContactos.FormShow(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
|
|
|
|
|
|
if not Assigned(ViewGrid) then
|
|
|
|
|
|
raise Exception.Create('No hay ninguna vista asignada');
|
|
|
|
|
|
|
|
|
|
|
|
if not Assigned(Contactos) then
|
|
|
|
|
|
raise Exception.Create('No hay ning<6E>n contacto asignado');
|
|
|
|
|
|
|
|
|
|
|
|
Contactos.DataTable.Active := True;
|
|
|
|
|
|
ViewGrid.GotoFirst;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
function TfEditorContactos.GetContactos: IBizContacto;
|
|
|
|
|
|
begin
|
|
|
|
|
|
Result := FContactos;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
function TfEditorContactos.GetController: IContactosController;
|
|
|
|
|
|
begin
|
|
|
|
|
|
Result := FController;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfEditorContactos.ImprimirInterno;
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfEditorContactos.ModificarInterno;
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
FController.Ver(Contactos);
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfEditorContactos.NuevoInterno;
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
FController.Anadir(Contactos);
|
|
|
|
|
|
FController.Ver(Contactos);
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfEditorContactos.PonerTitulos(const ATitulo: string);
|
|
|
|
|
|
var
|
|
|
|
|
|
FTitulo : String;
|
|
|
|
|
|
begin
|
|
|
|
|
|
FTitulo := ATitulo;
|
2007-11-18 12:49:11 +00:00
|
|
|
|
if FTitulo = '' then
|
|
|
|
|
|
FTitulo := 'Lista de contactos - ' + AppFactuGES.EmpresaActiva.NOMBRE;
|
2007-09-12 14:11:44 +00:00
|
|
|
|
inherited PonerTitulos(FTitulo);
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfEditorContactos.PrevisualizarInterno;
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfEditorContactos.SetContactos(const Value: IBizContacto);
|
|
|
|
|
|
begin
|
|
|
|
|
|
FContactos := Value;
|
|
|
|
|
|
|
|
|
|
|
|
if Assigned(FContactos) and Assigned(FContactos.DataTable) then
|
|
|
|
|
|
begin
|
|
|
|
|
|
dsDataTable.DataTable := FContactos.DataTable;
|
|
|
|
|
|
if Assigned(ViewGrid) then
|
|
|
|
|
|
(ViewGrid as IViewContactos).Contactos := FContactos;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfEditorContactos.SetController(const Value: IContactosController);
|
|
|
|
|
|
begin
|
|
|
|
|
|
FController := Value;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfEditorContactos.SetViewGrid(const Value: IViewGridBase);
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
if Assigned(ViewGrid) and Assigned(Contactos) then
|
|
|
|
|
|
(ViewGrid as IViewContactos).Contactos := Contactos;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
destructor TfEditorContactos.Destroy;
|
|
|
|
|
|
begin
|
|
|
|
|
|
FContactos := NIL;
|
2007-10-22 17:55:10 +00:00
|
|
|
|
FController := NIL;
|
2007-09-12 14:11:44 +00:00
|
|
|
|
inherited;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfEditorContactos.DuplicarInterno;
|
|
|
|
|
|
var
|
|
|
|
|
|
AContacto : IBizContacto;
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
AContacto := FController.Duplicar(Contactos);
|
|
|
|
|
|
try
|
|
|
|
|
|
FController.Ver(AContacto);
|
|
|
|
|
|
finally
|
|
|
|
|
|
actRefrescar.Execute;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfEditorContactos.EliminarInterno;
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
//Para que en el caso de no poderse realizar la operaci<63>n se refresquen
|
|
|
|
|
|
//los datos y no nos permita eliminar un registro a la segunda
|
|
|
|
|
|
if not FController.Eliminar(Contactos) then
|
|
|
|
|
|
actRefrescar.Execute;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
end.
|
|
|
|
|
|
|