This repository has been archived on 2024-12-02. You can view files and clone it, but cannot push or open issues or pull requests.
AlonsoYSal_FactuGES/Modulos/Presupuestos_/Cliente/uEditorPresupuesto.pas
2007-06-21 16:02:50 +00:00

198 lines
6.3 KiB
ObjectPascal
Raw Blame History

unit uEditorPresupuesto;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, uEditorItem, ImgList, PngImageList, StdActns, ActnList, TBX,
TB2Item, TB2Dock, TB2Toolbar, ComCtrls, JvExControls, JvComponent,
JvNavigationPane, uEditorDBItem, DB, uDADataTable, uBizPresupuestosCliente,
uViewPresupuesto, uCustomView, uViewBase, uViewTotales, uViewGrid,
uViewContenido, TBXDkPanels, ExtCtrls, uDAScriptingProvider,
uDACDSDataTable, uViewMensaje, JvAppStorage, JvAppRegistryStorage,
JvFormPlacement, uViewDetallesPresupuesto, pngimage, StdCtrls, Mask,
DBCtrls, uViewDetallesFamilias, uViewDocumentosAsociados, uBizDocumentosAsociados,
JvComponentBase;
type
IEditorPresupuesto = interface(IEditorDBItem)
['{E06BB9E1-A95D-4983-B08D-6E1719C48D91}']
function GetPresupuesto: IBizPresupuestos;
procedure SetPresupuesto(const Value: IBizPresupuestos);
property Presupuesto: IBizPresupuestos read GetPresupuesto write SetPresupuesto;
end;
TfEditorPresupuesto = class(TfEditorDBItem, IEditorPresupuesto)
pagContenido: TTabSheet;
pagPlanos: TTabSheet;
frViewDetallesPresupuesto1: TfrViewDetallesPresupuesto;
frViewTotales1: TfrViewTotales;
frViewPresupuesto1: TfrViewPresupuesto;
procedure FormShow(Sender: TObject);
procedure actEliminarExecute(Sender: TObject);
procedure frViewClientePresupuesto1edtlNombrePropertiesChange(
Sender: TObject);
private
FPresupuesto : IBizPresupuestos;
FViewPresupuesto : IViewPresupuesto;
FViewDocumentosPresupuesto : IViewDocumentosAsociados;
protected
function GetPresupuesto: IBizPresupuestos;
procedure SetPresupuesto(const Value: IBizPresupuestos);
function GetViewPresupuesto: IViewPresupuesto;
procedure SetViewPresupuesto(const Value: IViewPresupuesto);
property ViewPresupuesto: IViewPresupuesto read GetViewPresupuesto write
SetViewPresupuesto;
//DOCUMENTOS ASOCIADOS
{ function GetViewDocumentosPresupuesto: IViewDocumentosAsociados;
procedure SetViewDocumentosPresupuesto(const Value: IViewDocumentosAsociados);
property ViewDocumentosPresupuesto: IViewDocumentosAsociados read GetViewDocumentosPresupuesto write
SetViewDocumentosPresupuesto;
}
public
property Presupuesto: IBizPresupuestos read GetPresupuesto write SetPresupuesto;
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
end;
implementation
{$R *.dfm}
uses
uEditorUtils;
function ShowEditorPresupuesto (ABizObject : TDADataTableRules) : TModalResult;
var
AEditor: TfEditorPresupuesto;
begin
AEditor := TfEditorPresupuesto.Create(Application);
try
AEditor.Presupuesto := (ABizObject as IBizPresupuestos);
Result := AEditor.ShowModal;
finally
AEditor.Release;
end;
end;
{ TfEditorPresupuesto }
function TfEditorPresupuesto.GetPresupuesto: IBizPresupuestos;
begin
Result := FPresupuesto;
end;
function TfEditorPresupuesto.GetViewPresupuesto: IViewPresupuesto;
begin
Result := FViewPresupuesto;
end;
procedure TfEditorPresupuesto.SetPresupuesto(const Value: IBizPresupuestos);
begin
FPresupuesto := Value;
if Assigned(FPresupuesto) then
begin
dsDataTable.DataTable := FPresupuesto.DataTable;
frViewTotales1.DADataSource.DataTable := FPresupuesto.DataTable;
frViewDetallesPresupuesto1.DADataSource.DataTable := FPresupuesto.Detalles.DataTable;
if Assigned(FViewPresupuesto) then
FViewPresupuesto.Presupuesto := Presupuesto;
//DOCUMENTOS ASOCIADOS
{ if Assigned(FViewDocumentosPresupuesto) then
begin
FViewDocumentosPresupuesto.GestorDocumentos := (Presupuesto as IBizDocumentosAsociados).GestorDocumentos;
FViewDocumentosPresupuesto.GestorDocumentos.ModoInsert := (Presupuesto.DataTable.State = dsInsert);
end;}
end;
end;
procedure TfEditorPresupuesto.SetViewPresupuesto(
const Value: IViewPresupuesto);
begin
FViewPresupuesto := Value;
if Assigned(FViewPresupuesto) and Assigned(Presupuesto) then
FViewPresupuesto.Presupuesto := Presupuesto;
end;
procedure TfEditorPresupuesto.FormShow(Sender: TObject);
begin
inherited;
if not Assigned(FViewPresupuesto) then
raise Exception.Create('No hay ninguna vista asignada');
if not Assigned(Presupuesto) then
raise Exception.Create('No hay ning<6E>n presupuesto asignado');
Presupuesto.DataTable.Active := True;
// FViewPresupuesto.ShowEmbedded(pagGeneral);
// FViewPresupuesto.SetFocus;
end;
constructor TfEditorPresupuesto.Create(AOwner: TComponent);
begin
inherited;
// ViewPresupuesto := CreateView(TfrViewPresupuesto) as IViewPresupuesto;
pgPaginas.ActivePageIndex := 0;
ViewPresupuesto := frViewPresupuesto1;
//DOCUMENTOS ASOCIADOS
// ViewDocumentosPresupuesto := frViewDocumentosAsociados;
end;
destructor TfEditorPresupuesto.Destroy;
begin
FViewPresupuesto := NIL;
FPresupuesto := NIL;
//DOCUMENTOS ASOCIADOS
// FViewDocumentosPresupuesto := NIL;
inherited;
end;
procedure TfEditorPresupuesto.actEliminarExecute(Sender: TObject);
begin
if (Application.MessageBox('<27>Desea borrar este presupuesto?', 'Atenci<63>n', MB_YESNO) = IDYES) then
inherited;
end;
procedure TfEditorPresupuesto.frViewClientePresupuesto1edtlNombrePropertiesChange(
Sender: TObject);
begin
inherited;
if Length(frViewPresupuesto1.frViewClientePresupuesto1.edtlNombre.Text) = 0 then
JvNavPanelHeader.Caption := 'Nuevo presupuesto de cliente'
else
JvNavPanelHeader.Caption := 'Presupuesto de ' +
frViewPresupuesto1.frViewClientePresupuesto1.edtlNombre.Text +
' (' + FPresupuesto.SITUACION + ')';
Caption := JvNavPanelHeader.Caption;
end;
{function TfEditorPresupuesto.GetViewDocumentosPresupuesto: IViewDocumentosAsociados;
begin
Result := FViewDocumentosPresupuesto;
end;
procedure TfEditorPresupuesto.SetViewDocumentosPresupuesto(const Value: IViewDocumentosAsociados);
begin
FViewDocumentosPresupuesto := Value;
if Assigned(FViewDocumentosPresupuesto) and Assigned(Presupuesto) then
FViewDocumentosPresupuesto.GestorDocumentos := (Presupuesto as IBizDocumentosASociados).GestorDocumentos;
end;}
initialization
RegisterEditor(IBizPresupuestos, ShowEditorPresupuesto, etItem);
finalization
end.