git-svn-id: https://192.168.0.254/svn/Proyectos.EstudioCarnicero_ProGestion/trunk@4 1b8572a8-2d6b-b84e-8c90-20ed86fa4eca
169 lines
6.2 KiB
ObjectPascal
169 lines
6.2 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 uEditorPresupuestoContacto;
|
|
|
|
interface
|
|
|
|
uses
|
|
|
|
JvAppStorage, JvAppRegistryStorage, JvComponentBase, JvFormPlacement, ImgList,
|
|
PngImageList, StdActns, ActnList, ComCtrls, TBX, TB2Item, TB2Dock,
|
|
TB2Toolbar, ExtCtrls, JvExControls, JvComponent, JvNavigationPane,
|
|
dxLayoutLookAndFeels, DB, uDADataTable, Controls, Classes,
|
|
Windows, SysUtils, Forms, uEditorDBItem, uBizObra, uViewPresupuestoContacto;
|
|
|
|
type
|
|
IEditorPresupuestoContacto = interface(IEditorDBItem)
|
|
['{B759C9B7-DB89-40FD-AC24-DA4F727E89BB}']
|
|
function GetPresupuestoContacto: IBizPresupuestosObra;
|
|
procedure SetPresupuestoContacto(const Value: IBizPresupuestosObra);
|
|
property PresupuestoContacto: IBizPresupuestosObra read GetPresupuestoContacto write SetPresupuestoContacto;
|
|
end;
|
|
|
|
TfEditorPresupuestoContacto = class(TfEditorDBItem)
|
|
procedure FormShow(Sender: TObject);
|
|
procedure dsDataTableDataChange(Sender: TObject; Field: TField);
|
|
private
|
|
FPresupuestoContacto: IBizPresupuestosObra;
|
|
function GetPresupuestoContacto: IBizPresupuestosObra;
|
|
procedure SetPresupuestoContacto(const Value: IBizPresupuestosObra);
|
|
protected
|
|
FViewPresupuestoContacto: IViewPresupuestoContacto;
|
|
function GetViewPresupuestoContacto: IViewPresupuestoContacto;
|
|
procedure SetViewPresupuestoContacto(const Value: IViewPresupuestoContacto);
|
|
property ViewPresupuestoContacto: IViewPresupuestoContacto read GetViewPresupuestoContacto write SetViewPresupuestoContacto;
|
|
public
|
|
property PresupuestoContacto: IBizPresupuestosObra read GetPresupuestoContacto write SetPresupuestoContacto;
|
|
constructor Create(AOwner: TComponent); override;
|
|
destructor Destroy; override;
|
|
end;
|
|
|
|
var
|
|
fEditorPresupuestoContacto: TfEditorPresupuestoContacto;
|
|
|
|
implementation
|
|
{$R *.dfm}
|
|
|
|
uses uEditorUtils, uViewTrabajoContacto, uEditorBase, uEditorDBBase, LiteralesObras;
|
|
|
|
function ShowEditorPresupuestoContacto (ABizObject : TDADataTableRules) : TModalResult;
|
|
var
|
|
AEditor: TfEditorPresupuestoContacto;
|
|
begin
|
|
AEditor := TfEditorPresupuestoContacto.Create(Application);
|
|
try
|
|
AEditor.PresupuestoContacto := (ABizObject as IBizPresupuestosObra);
|
|
Result := AEditor.ShowModal;
|
|
finally
|
|
AEditor.Release;
|
|
end;
|
|
end;
|
|
|
|
{ TfEditorPresupuestoContacto }
|
|
|
|
constructor TfEditorPresupuestoContacto.Create(AOwner: TComponent);
|
|
begin
|
|
inherited;
|
|
FApplyUpdates := False;
|
|
end;
|
|
|
|
destructor TfEditorPresupuestoContacto.Destroy;
|
|
begin
|
|
FViewPresupuestoContacto := Nil;
|
|
FPresupuestoContacto := Nil;
|
|
inherited;
|
|
end;
|
|
|
|
function TfEditorPresupuestoContacto.GetPresupuestoContacto: IBizPresupuestosObra;
|
|
begin
|
|
Result:= FPresupuestoContacto;
|
|
end;
|
|
|
|
function TfEditorPresupuestoContacto.GetViewPresupuestoContacto: IViewPresupuestoContacto;
|
|
begin
|
|
Result := FViewPresupuestoContacto;
|
|
end;
|
|
|
|
procedure TfEditorPresupuestoContacto.SetPresupuestoContacto(const Value: IBizPresupuestosObra);
|
|
begin
|
|
FPresupuestoContacto := Value;
|
|
|
|
if Assigned(FPresupuestoContacto) then
|
|
begin
|
|
dsDataTable.DataTable := FPresupuestoContacto.DataTable;
|
|
|
|
//En el caso de ser un trabajo cambiamos de vista
|
|
if FPresupuestoContacto.CLASE = CLASE_PRESUPUESTO
|
|
then ViewPresupuestoContacto := CreateView(TfrViewPresupuestoContacto) as IViewPresupuestoContacto
|
|
else ViewPresupuestoContacto := CreateView(TfrViewTrabajoContacto) as IViewPresupuestoContacto;
|
|
end
|
|
else
|
|
dsDataTable.DataTable := Nil;
|
|
end;
|
|
|
|
procedure TfEditorPresupuestoContacto.SetViewPresupuestoContacto(const Value: IViewPresupuestoContacto);
|
|
begin
|
|
FViewPresupuestoContacto := Value;
|
|
|
|
if Assigned(FViewPresupuestoContacto) and Assigned(FPresupuestoContacto) then
|
|
FViewPresupuestoContacto.PresupuestoContacto := FPresupuestoContacto;
|
|
end;
|
|
|
|
procedure TfEditorPresupuestoContacto.FormShow(Sender: TObject);
|
|
begin
|
|
inherited;
|
|
|
|
if not Assigned(FViewPresupuestoContacto) then
|
|
raise Exception.Create('No hay ninguna vista asignada');
|
|
|
|
if not Assigned(PresupuestoContacto) then
|
|
raise Exception.Create('No hay ningún presupuesto asignado');
|
|
|
|
FViewPresupuestoContacto.ShowEmbedded(pagGeneral);
|
|
FViewPresupuestoContacto.SetFocus;
|
|
end;
|
|
|
|
procedure TfEditorPresupuestoContacto.dsDataTableDataChange(Sender: TObject; Field: TField);
|
|
begin
|
|
inherited;
|
|
if Assigned(FPresupuestoContacto) and (not (FPresupuestoContacto.DataTable.Fetching) or
|
|
not (FPresupuestoContacto.DataTable.Opening) or not (FPresupuestoContacto.DataTable.Closing)) then
|
|
begin
|
|
if Length(FPresupuestoContacto.NOMBRE) = 0 then
|
|
if FPresupuestoContacto.CLASE = CLASE_PRESUPUESTO
|
|
then JvNavPanelHeader.Caption := msgLitPresupuestoNuv
|
|
else JvNavPanelHeader.Caption := msgLitTrabajoNuv
|
|
else
|
|
if FPresupuestoContacto.CLASE = CLASE_PRESUPUESTO
|
|
then JvNavPanelHeader.Caption := msgPresupuestos + FPresupuestoContacto.NOMBRE
|
|
else JvNavPanelHeader.Caption := msgTrabajos + FPresupuestoContacto.NOMBRE;
|
|
Self.Caption := JvNavPanelHeader.Caption;
|
|
end;
|
|
end;
|
|
|
|
initialization
|
|
RegisterEditor(IBizPresupuestosObra, ShowEditorPresupuestoContacto, etItem);
|
|
|
|
end.
|