git-svn-id: https://192.168.0.254/svn/Proyectos.Tecsitel_FactuGES2/trunk@720 0c75b7a4-871f-7646-8a2f-f78d34cc349f
190 lines
5.0 KiB
ObjectPascal
190 lines
5.0 KiB
ObjectPascal
unit uEditorEjecucionObra;
|
||
|
||
interface
|
||
|
||
uses
|
||
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
||
Dialogs, uEditorDBItem, ToolWin, ComCtrls, JvExControls, JvComponent,
|
||
uViewObra, uBizObras, JvNavigationPane, ActnList,
|
||
uEditorBase, StdActns, TB2Dock, TB2Toolbar, TBX, ImgList, PngImageList,
|
||
TB2Item, uEditorItem, DB, uDADataTable, uEditorDBBase, JvFormAutoSize,
|
||
uDAScriptingProvider, uDACDSDataTable, StdCtrls, pngimage, ExtCtrls,
|
||
TBXDkPanels, JvButton, AppEvnts, uCustomView, uViewBase,
|
||
JvAppStorage, JvAppRegistryStorage, JvFormPlacement, JvComponentBase,
|
||
|
||
uViewObras, uIEditorEjecucionObra, uObrasController, JvExComCtrls,
|
||
JvStatusBar, dxLayoutLookAndFeels, uDAInterfaces, dxGDIPlusClasses,
|
||
cxControls, cxContainer, cxEdit, cxLabel, uViewDetallesGenerico,
|
||
uViewListaEjecucionesObra, uViewEjecucionObra, Grids, DBGrids;
|
||
|
||
type
|
||
TfEditorEjecucionObra = class(TfEditorDBItem, IEditorEjecucionObra)
|
||
dxLayoutLookAndFeelList1: TdxLayoutLookAndFeelList;
|
||
dxLayoutOfficeLookAndFeel1: TdxLayoutOfficeLookAndFeel;
|
||
procedure FormShow(Sender: TObject);
|
||
procedure CustomEditorClose(Sender: TObject; var Action: TCloseAction);
|
||
protected
|
||
FController : IObrasController;
|
||
FObra: IBizObra;
|
||
FViewEjecucionActual: IViewEjecucionObra;
|
||
|
||
function GetController : IObrasController;
|
||
procedure SetController (const Value : IObrasController); virtual;
|
||
function GetObra: IBizObra; virtual;
|
||
procedure SetObra(const Value: IBizObra); virtual;
|
||
|
||
procedure GuardarInterno; override;
|
||
procedure EliminarInterno; override;
|
||
|
||
procedure PonerTitulos(const ATitulo: string = ''); override;
|
||
|
||
//Si queremos crear otra vista para el editor heredado solo tendriamos que
|
||
//sobreescribir este metodo
|
||
procedure AsignarVista; virtual;
|
||
|
||
public
|
||
property Obra: IBizObra read GetObra write SetObra;
|
||
constructor Create(AOwner: TComponent); override;
|
||
destructor Destroy; override;
|
||
end;
|
||
|
||
implementation
|
||
|
||
{$R *.dfm}
|
||
|
||
uses
|
||
uCustomEditor, uDataModuleObras, uDataModuleBase, uDialogUtils;
|
||
|
||
{function ShowEditorObra (ABizObject : TDADataTableRules): TModalResult;
|
||
var
|
||
AEditor: TfEditorObra;
|
||
begin
|
||
AEditor := TfEditorObra.Create(Application);
|
||
try
|
||
AEditor.Obra := (ABizObject as IBizObra);
|
||
Result := AEditor.ShowModal;
|
||
finally
|
||
AEditor.Release;
|
||
end;
|
||
end;}
|
||
|
||
{
|
||
******************************* TfEditorObra *******************************
|
||
}
|
||
function TfEditorEjecucionObra.GetObra: IBizObra;
|
||
begin
|
||
Result := FObra;
|
||
end;
|
||
|
||
function TfEditorEjecucionObra.GetController: IObrasController;
|
||
begin
|
||
Result := FController;
|
||
end;
|
||
|
||
procedure TfEditorEjecucionObra.GuardarInterno;
|
||
begin
|
||
inherited;
|
||
|
||
FController.Guardar(FObra);
|
||
Modified := False;
|
||
end;
|
||
|
||
procedure TfEditorEjecucionObra.PonerTitulos(const ATitulo: string);
|
||
var
|
||
FTitulo : String;
|
||
begin
|
||
if Assigned(Obra) then
|
||
begin
|
||
if Obra.EsNuevo then
|
||
FTitulo := 'Nueva ejecuci<63>n de obra'
|
||
else
|
||
FTitulo := 'Ejecuci<63>n de la obra' + ' - ' + Obra.NOMBRE;
|
||
end;
|
||
|
||
inherited PonerTitulos(FTitulo);
|
||
end;
|
||
|
||
procedure TfEditorEjecucionObra.SetObra(const Value: IBizObra);
|
||
begin
|
||
FObra := Value;
|
||
dsDataTable.DataTable := FObra.DataTable;
|
||
|
||
if Assigned(FViewEjecucionActual) and Assigned(FObra) then
|
||
begin
|
||
FViewEjecucionActual.Obra := FObra;
|
||
end
|
||
else
|
||
FViewEjecucionActual.Obra := NIL;
|
||
end;
|
||
|
||
procedure TfEditorEjecucionObra.SetController(const Value: IObrasController);
|
||
begin
|
||
FController := Value;
|
||
if Assigned(FViewEjecucionActual) and Assigned(FController) then
|
||
FViewEjecucionActual.Controller := FController;
|
||
end;
|
||
|
||
procedure TfEditorEjecucionObra.FormShow(Sender: TObject);
|
||
begin
|
||
inherited;
|
||
|
||
if not Assigned(FViewEjecucionActual) then
|
||
raise Exception.Create('No hay ninguna vista asignada');
|
||
|
||
if not Assigned(Obra) then
|
||
raise Exception.Create('No hay ninguna obra asignada');
|
||
|
||
Obra.DataTable.Active := True;
|
||
ReadOnly := True;
|
||
FViewEjecucionActual.ReadOnly := True;
|
||
end;
|
||
|
||
destructor TfEditorEjecucionObra.Destroy;
|
||
begin
|
||
// Utilizar mejor OnClose;
|
||
inherited;
|
||
end;
|
||
|
||
procedure TfEditorEjecucionObra.AsignarVista;
|
||
var
|
||
AViewEjecucion: TfrViewEjecucionObra;
|
||
begin
|
||
AViewEjecucion := TfrViewEjecucionObra.Create(NIL);
|
||
|
||
with AViewEjecucion do
|
||
begin
|
||
Parent := pagGeneral;
|
||
Align := alClient;
|
||
dxLayoutControlEjecucionObra.LookAndFeel := dxLayoutOfficeLookAndFeel1;
|
||
Controller := FController;
|
||
Obra := FObra;
|
||
|
||
end;
|
||
FViewEjecucionActual := AViewEjecucion;
|
||
end;
|
||
|
||
constructor TfEditorEjecucionObra.Create(AOwner: TComponent);
|
||
begin
|
||
inherited;
|
||
pgPaginas.ActivePage := pagGeneral;
|
||
FViewEjecucionActual := NIL;
|
||
AsignarVista;
|
||
end;
|
||
|
||
procedure TfEditorEjecucionObra.CustomEditorClose(Sender: TObject;
|
||
var Action: TCloseAction);
|
||
begin
|
||
inherited;
|
||
dsDataTable.DataTable := NIL;
|
||
FViewEjecucionActual := NIL;
|
||
FObra := NIL;
|
||
end;
|
||
|
||
procedure TfEditorEjecucionObra.EliminarInterno;
|
||
begin
|
||
//
|
||
end;
|
||
|
||
end.
|
||
|