git-svn-id: https://192.168.0.254/svn/Proyectos.Acana_FactuGES2/trunk@57 f4e31baf-9722-1c47-927c-6f952f962d4b
157 lines
4.3 KiB
ObjectPascal
157 lines
4.3 KiB
ObjectPascal
unit uEditorEpigrafes;
|
||
|
||
interface
|
||
|
||
uses
|
||
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
||
Dialogs, uEditorBase, ToolWin, ComCtrls, JvExControls, JvComponent,
|
||
JvNavigationPane, uViewEpigrafes, uBizEpigrafes, ActnList, DBActns, uViewGrid,
|
||
Menus, uDataModuleBase, ImgList, PngImageList, TB2Dock, TB2Toolbar, TBX,
|
||
TB2Item, StdActns, TB2ExtItems, TBXExtItems, TB2MRU, DB, uDADataTable,
|
||
JvFormAutoSize, uDAScriptingProvider, uDACDSDataTable, JvAppStorage,
|
||
JvAppRegistryStorage, JvFormPlacement, ExtCtrls, uCustomView, uViewBase,
|
||
uViewBarraSeleccion, pngimage, uIEditorEpigrafes, uEditorGridBase,
|
||
JvComponentBase, uViewGridBase, uEpigrafesController, JvExComCtrls,
|
||
JvStatusBar, uDAInterfaces;
|
||
|
||
type
|
||
TfEditorEpigrafes = class(TfEditorGridBase, IEditorEpigrafes)
|
||
frViewEpigrafes1: TfrViewEpigrafes;
|
||
procedure FormShow(Sender: TObject);
|
||
private
|
||
FEpigrafes: IBizEpigrafe;
|
||
FController : IEpigrafesController;
|
||
protected
|
||
function GetEpigrafes: IBizEpigrafe;
|
||
procedure SetEpigrafes(const Value: IBizEpigrafe);
|
||
function GetController : IEpigrafesController; virtual;
|
||
procedure SetController (const Value : IEpigrafesController); virtual;
|
||
|
||
procedure NuevoInterno; override;
|
||
procedure EliminarInterno; override;
|
||
procedure ModificarInterno; override;
|
||
procedure DuplicarInterno; override;
|
||
|
||
public
|
||
procedure PonerTitulos(const ATitulo: string = ''); override;
|
||
property Epigrafes: IBizEpigrafe read GetEpigrafes write SetEpigrafes;
|
||
property Controller : IEpigrafesController read GetController write SetController;
|
||
constructor Create(AOwner: TComponent); override;
|
||
destructor Destroy; override;
|
||
end;
|
||
|
||
implementation
|
||
|
||
uses
|
||
uCustomEditor, uDataModuleUsuarios,
|
||
// uEditorEpigrafe,
|
||
uEditorDBBase, uFactuGES_App,
|
||
cxGrid, cxGridCustomTableView; //, uListaEpigrafes;
|
||
|
||
{$R *.dfm}
|
||
|
||
{
|
||
****************************** TfEditorEpigrafes *******************************
|
||
}
|
||
procedure TfEditorEpigrafes.FormShow(Sender: TObject);
|
||
begin
|
||
inherited;
|
||
|
||
if not Assigned(ViewGrid) then
|
||
raise Exception.Create('No hay ninguna vista asignada');
|
||
|
||
if not Assigned(Epigrafes) then
|
||
raise Exception.Create('No hay ningún Epigrafe asignado');
|
||
|
||
Epigrafes.DataTable.Active := True;
|
||
ViewGrid.GotoFirst;
|
||
end;
|
||
|
||
function TfEditorEpigrafes.GetEpigrafes: IBizEpigrafe;
|
||
begin
|
||
Result := FEpigrafes;
|
||
end;
|
||
|
||
function TfEditorEpigrafes.GetController: IEpigrafesController;
|
||
begin
|
||
Result := FController;
|
||
end;
|
||
|
||
procedure TfEditorEpigrafes.ModificarInterno;
|
||
begin
|
||
inherited;
|
||
FController.Ver(Epigrafes);
|
||
end;
|
||
|
||
procedure TfEditorEpigrafes.NuevoInterno;
|
||
begin
|
||
inherited;
|
||
FController.Anadir(Epigrafes);
|
||
FController.Ver(Epigrafes);
|
||
end;
|
||
|
||
procedure TfEditorEpigrafes.PonerTitulos(const ATitulo: string);
|
||
var
|
||
FTitulo : String;
|
||
begin
|
||
FTitulo := 'Lista de Epigrafes - ' + AppFactuGES.EmpresaActiva.NOMBRE + ' - ' + AppFactuGES.EjercicioActivo.NOMBRE;
|
||
inherited PonerTitulos(FTitulo);
|
||
end;
|
||
|
||
procedure TfEditorEpigrafes.SetEpigrafes(const Value: IBizEpigrafe);
|
||
begin
|
||
FEpigrafes := Value;
|
||
dsDataTable.DataTable := FEpigrafes.DataTable;
|
||
if Assigned(ViewGrid) then
|
||
(ViewGrid as IViewEpigrafes).Epigrafes := Epigrafes;
|
||
end;
|
||
|
||
procedure TfEditorEpigrafes.SetController(const Value: IEpigrafesController);
|
||
begin
|
||
FController := Value;
|
||
end;
|
||
|
||
destructor TfEditorEpigrafes.Destroy;
|
||
begin
|
||
FEpigrafes := NIL;
|
||
inherited;
|
||
end;
|
||
|
||
procedure TfEditorEpigrafes.DuplicarInterno;
|
||
var
|
||
AEpigrafe : IBizEpigrafe;
|
||
begin
|
||
AppFactuGES.ShowCapado;
|
||
{
|
||
inherited;
|
||
AEpigrafe := FController.Duplicar(Epigrafes);
|
||
try
|
||
FController.Ver(AEpigrafe);
|
||
finally
|
||
actRefrescar.Execute;
|
||
end;
|
||
}
|
||
end;
|
||
|
||
procedure TfEditorEpigrafes.EliminarInterno;
|
||
begin
|
||
|
||
if (Application.MessageBox('¿Desea borrar este almacén?', 'Atención', MB_YESNO) = IDYES) then
|
||
begin
|
||
inherited;
|
||
//Para que en el caso de no poderse realizar la operación se refresquen
|
||
//los datos y no nos permita eliminar un registro a la segunda
|
||
if not FController.Eliminar(Epigrafes) then
|
||
actRefrescar.Execute;
|
||
end;
|
||
end;
|
||
|
||
constructor TfEditorEpigrafes.Create(AOwner: TComponent);
|
||
begin
|
||
inherited;
|
||
ViewGrid := frViewEpigrafes1; //CreateView(TfrViewEpigrafes) as IViewEpigrafes;
|
||
end;
|
||
|
||
end.
|
||
|
||
|