version 2.0.4 git-svn-id: https://192.168.0.254/svn/Proyectos.EstudioCarnicero_ProGestion/trunk@13 1b8572a8-2d6b-b84e-8c90-20ed86fa4eca
213 lines
7.1 KiB
ObjectPascal
213 lines
7.1 KiB
ObjectPascal
{
|
|
===============================================================================
|
|
Copyright (©) 2006. Rodax Software.
|
|
===============================================================================
|
|
Los contenidos de este fichero son propiedad de Rodax Software titular del
|
|
copyright. Este fichero sólo podrá ser copiado, distribuido y utilizado,
|
|
en su totalidad o en parte, con el permiso escrito de Rodax Software, o de
|
|
acuerdo con los términos y condiciones establecidas en el acuerdo/contrato
|
|
bajo el que se suministra.
|
|
-----------------------------------------------------------------------------
|
|
Web: www.rodax-software.com
|
|
===============================================================================
|
|
Fecha primera versión: 22-05-2006
|
|
Versión actual: 1.0.0
|
|
Fecha versión actual: 22-05-2006
|
|
===============================================================================
|
|
Modificaciones:
|
|
|
|
Fecha Comentarios
|
|
---------------------------------------------------------------------------
|
|
===============================================================================
|
|
}
|
|
|
|
unit uEditorProyectoObra;
|
|
|
|
interface
|
|
|
|
uses
|
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|
Dialogs, uEditorDBItem, dxLayoutLookAndFeels, DB, uDADataTable,
|
|
JvAppStorage, JvAppRegistryStorage, JvComponentBase, JvFormPlacement,
|
|
ImgList, PngImageList, StdActns, ActnList, ComCtrls, TBX, TB2Item,
|
|
TB2Dock, TB2Toolbar, ExtCtrls, JvExControls, JvComponent,
|
|
JvNavigationPane, uCustomView, uViewBase, uViewProyectoObra,
|
|
uBizObra, uViewDocumentosAsociados, pngimage;
|
|
|
|
type
|
|
IEditorProyectoObra = interface(IEditorDBItem)
|
|
['{EE12C3A5-99A2-47B1-A662-E3DA7737BCBC}']
|
|
end;
|
|
|
|
TfEditorProyectoObra = class(TfEditorDBItem, IEditorProyectoObra)
|
|
frViewProyectoObra: TfrViewProyectoObra;
|
|
frViewDocumentosAsociados: TfrViewDocumentosAsociados;
|
|
|
|
//DOCUMENTOS ASOCIADOS
|
|
procedure frViewProyectoObraedtDescripcionPropertiesValidate(
|
|
Sender: TObject; var DisplayValue: Variant; var ErrorText: TCaption;
|
|
var Error: Boolean);
|
|
procedure dsDataTableDataChange(Sender: TObject; Field: TField);
|
|
|
|
private
|
|
FProyectoObra: IBizProyectosObra;
|
|
function GetProyectoObra: IBizProyectosObra;
|
|
procedure SetProyectoObra(const Value: IBizProyectosObra);
|
|
|
|
protected
|
|
//DOCUMENTOS ASOCIADOS
|
|
FViewDocumentosPresupuesto : IViewDocumentosAsociados;
|
|
function GetViewDocumentosPresupuesto: IViewDocumentosAsociados;
|
|
procedure SetViewDocumentosPresupuesto(const Value: IViewDocumentosAsociados);
|
|
property ViewDocumentosPresupuesto: IViewDocumentosAsociados read GetViewDocumentosPresupuesto write SetViewDocumentosPresupuesto;
|
|
|
|
public
|
|
property ProyectoObra: IBizProyectosObra read GetProyectoObra write SetProyectoObra;
|
|
constructor Create(AOwner: TComponent); override;
|
|
destructor Destroy; override;
|
|
end;
|
|
|
|
var
|
|
fEditorProyectoObra: TfEditorProyectoObra;
|
|
|
|
implementation
|
|
{$R *.dfm}
|
|
|
|
uses uEditorUtils, uBizDocumentosAsociados, LiteralesObras, cxDBEdit,
|
|
cxEdit;
|
|
|
|
function ShowEditorProyectoObra (ABizObject : TDADataTableRules) : TModalResult;
|
|
var
|
|
AEditor: TfEditorProyectoObra;
|
|
begin
|
|
AEditor := TfEditorProyectoObra.Create(Application);
|
|
try
|
|
AEditor.ProyectoObra := (ABizObject as IBizProyectosObra);
|
|
Result := AEditor.ShowModal;
|
|
finally
|
|
AEditor.Release;
|
|
end;
|
|
end;
|
|
|
|
{ TfEditorProyectoObra }
|
|
|
|
constructor TfEditorProyectoObra.Create(AOwner: TComponent);
|
|
begin
|
|
inherited;
|
|
|
|
//DOCUMENTOS ASOCIADOS
|
|
ViewDocumentosPresupuesto := frViewDocumentosAsociados;
|
|
end;
|
|
|
|
destructor TfEditorProyectoObra.Destroy;
|
|
begin
|
|
//DOCUMENTOS ASOCIADOS
|
|
FViewDocumentosPresupuesto := NIL;
|
|
|
|
inherited;
|
|
end;
|
|
|
|
function TfEditorProyectoObra.GetProyectoObra: IBizProyectosObra;
|
|
begin
|
|
Result := FProyectoObra;
|
|
end;
|
|
|
|
function TfEditorProyectoObra.GetViewDocumentosPresupuesto: IViewDocumentosAsociados;
|
|
begin
|
|
Result := FViewDocumentosPresupuesto;
|
|
end;
|
|
|
|
procedure TfEditorProyectoObra.SetProyectoObra(const Value: IBizProyectosObra);
|
|
begin
|
|
FProyectoObra := Value;
|
|
|
|
if Assigned(FProyectoObra) then
|
|
begin
|
|
dsDataTable.DataTable := FProyectoObra.DataTable;
|
|
frViewProyectoObra.ProyectoObra := FProyectoObra;
|
|
|
|
//DOCUMENTOS ASOCIADOS
|
|
if Assigned(FViewDocumentosPresupuesto) then
|
|
begin
|
|
if (ProyectoObra.Obra.ALMACEN = CTE_ALMACEN_ANTIGUO) then
|
|
FViewDocumentosPresupuesto.GestorDocumentos := (ProyectoObra as IBizDocumentosAsociados).GestorDocumentos
|
|
else
|
|
FViewDocumentosPresupuesto.GestorDocumentos := (ProyectoObra as IBizDocumentosAsociados).GestorDocumentosNuevo;
|
|
FViewDocumentosPresupuesto.GestorDocumentos.ModoInsert := (ProyectoObra.DataTable.State = dsInsert);
|
|
end;
|
|
end
|
|
else
|
|
begin
|
|
dsDataTable.DataTable := Nil;
|
|
frViewProyectoObra.ProyectoObra := Nil;
|
|
end;
|
|
end;
|
|
|
|
procedure TfEditorProyectoObra.SetViewDocumentosPresupuesto(const Value: IViewDocumentosAsociados);
|
|
begin
|
|
FViewDocumentosPresupuesto := Value;
|
|
|
|
if Assigned(FViewDocumentosPresupuesto) and Assigned(ProyectoObra) then
|
|
begin
|
|
if (ProyectoObra.Obra.ALMACEN = CTE_ALMACEN_ANTIGUO) then
|
|
FViewDocumentosPresupuesto.GestorDocumentos := (ProyectoObra as IBizDocumentosASociados).GestorDocumentos
|
|
else
|
|
FViewDocumentosPresupuesto.GestorDocumentos := (ProyectoObra as IBizDocumentosASociados).GestorDocumentosNuevo
|
|
end;
|
|
end;
|
|
|
|
procedure TfEditorProyectoObra.frViewProyectoObraedtDescripcionPropertiesValidate(
|
|
Sender: TObject; var DisplayValue: Variant; var ErrorText: TCaption;
|
|
var Error: Boolean);
|
|
begin
|
|
inherited;
|
|
//Si cambia el nombre del proyecto debe cambiar el nombre del directorio raiz de la estructura
|
|
|
|
if (frViewProyectoObra.edtDescripcion.EditValue <> DisplayValue) then
|
|
begin
|
|
frViewDocumentosAsociados.DeshabilitarDocumentos;
|
|
|
|
if Length(DisplayValue)=0 then
|
|
begin
|
|
Error := True;
|
|
ErrorText := msgLitNombreProObligatorio;
|
|
DisplayValue := frViewProyectoObra.edtDescripcion.EditValue;
|
|
end
|
|
else
|
|
begin
|
|
try
|
|
frViewDocumentosAsociados.GestorDocumentos.Directorio := DisplayValue;
|
|
except
|
|
on E: Exception do
|
|
begin
|
|
Error := True;
|
|
ErrorText := E.Message;
|
|
DisplayValue := frViewProyectoObra.edtDescripcion.EditValue;
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
frViewDocumentosAsociados.HabilitarDocumentos;
|
|
frViewDocumentosAsociados.refrescarTree;
|
|
end;
|
|
end;
|
|
|
|
procedure TfEditorProyectoObra.dsDataTableDataChange(Sender: TObject; Field: TField);
|
|
begin
|
|
inherited;
|
|
if Assigned(FProyectoObra) and (not (FProyectoObra.DataTable.Fetching) or
|
|
not (FProyectoObra.DataTable.Opening) or not (FProyectoObra.DataTable.Closing)) then
|
|
begin
|
|
if Length(FProyectoObra.DESCRIPCION) = 0 then
|
|
JvNavPanelHeader.Caption := msgLitProyectoNuv
|
|
else
|
|
JvNavPanelHeader.Caption := msgProyectos + FProyectoObra.DESCRIPCION;
|
|
Self.Caption := JvNavPanelHeader.Caption;
|
|
end;
|
|
end;
|
|
|
|
initialization
|
|
RegisterEditor(IBizProyectosObra, ShowEditorProyectoObra, etItem);
|
|
|
|
end.
|