This repository has been archived on 2024-11-28. You can view files and clone it, but cannot push or open issues or pull requests.
Noviseda_FactuGES2/Source/Modulos/Obras/Views/uViewEjecucionObra.pas
2009-12-16 17:16:54 +00:00

182 lines
5.8 KiB
ObjectPascal
Raw Blame History

unit uViewEjecucionObra;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, uViewBase, dxLayoutControl, cxControls, uBizObras, DB, uDAInterfaces,
uDADataTable, cxContainer, cxEdit, cxTextEdit, cxMaskEdit, cxDropDownEdit,
cxCalendar, cxDBEdit, uCustomView, uViewDatosYSeleccionProveedor,
uViewSubcontrataObra, StdCtrls, ActnList, ComCtrls, ExtCtrls, cxCurrencyEdit,
uViewListaPedidosProvObra, uViewDetallesGenerico, uViewListaPresupuestosObra,
Buttons, uProveedoresController, uObrasController;
type
IViewEjecucionObra = interface(IViewBase)
['{09B874DF-8A3B-4775-8617-4B4F834EEB25}']
function GetObra: IBizObra;
procedure SetObra(const Value: IBizObra);
property Obra: IBizObra read GetObra write SetObra;
function GetController : IObrasController;
procedure SetController (const Value : IObrasController);
property Controller : IObrasController read GetController write SetController;
end;
TfrViewEjecucionObra = class(TfrViewBase, IViewEjecucionObra)
dxLayoutControlEjecucionObraGroup_Root: TdxLayoutGroup;
dxLayoutControlEjecucionObra: TdxLayoutControl;
dxLayoutControlEjecucionObraGroup1: TdxLayoutGroup;
dxLayoutControlEjecucionObraGroup2: TdxLayoutGroup;
dsEjecucion: TDADataSource;
dxLayoutControlEjecucionObraItem1: TdxLayoutItem;
edtFecha: TcxDBDateEdit;
ActionList1: TActionList;
actFinEjecucion: TAction;
actCancelarEjecucion: TAction;
dxLayoutControlEjecucionObraItem2: TdxLayoutItem;
bCancelarEjecucion: TButton;
dxLayoutControlEjecucionObraGroup3: TdxLayoutGroup;
dxLayoutControlEjecucionObraItem4: TdxLayoutItem;
ImporteBase: TcxDBCurrencyEdit;
dxLayoutControlEjecucionObraItem5: TdxLayoutItem;
ImporteIVA: TcxDBCurrencyEdit;
dxLayoutControlEjecucionObraItem6: TdxLayoutItem;
ImporteTotal: TcxDBCurrencyEdit;
dxLayoutControlEjecucionObraItem7: TdxLayoutItem;
Bevel4: TBevel;
dxLayoutControlEjecucionObraItem8: TdxLayoutItem;
frViewListaPresupuestosObra1: TfrViewListaPresupuestosObra;
dxLayoutControlEjecucionObraItem9: TdxLayoutItem;
frViewListaPedidosProvObra1: TfrViewListaPedidosProvObra;
dxLayoutControlEjecucionObraGroup4: TdxLayoutGroup;
dxLayoutControlEjecucionObraGroup5: TdxLayoutGroup;
dxLayoutControlEjecucionObraItem11: TdxLayoutItem;
bElegirSubcontrata: TBitBtn;
dxLayoutControlEjecucionObraItem10: TdxLayoutItem;
edtlNombre: TcxDBTextEdit;
dxLayoutControlEjecucionObraGroup6: TdxLayoutGroup;
procedure CustomViewShow(Sender: TObject);
procedure actFinEjecucionExecute(Sender: TObject);
procedure bElegirSubcontrataClick(Sender: TObject);
procedure CustomViewCreate(Sender: TObject);
procedure CustomViewDestroy(Sender: TObject);
protected
FObra : IBizObra;
FEjecucion : IBizEjecucionesObra;
FObrasController : IObrasController;
FProveedoresController : IProveedoresController;
FPresupuestos : IBizEjecucionPresupuestos;
function GetObra: IBizObra;
procedure SetObra(const Value: IBizObra);
function GetController : IObrasController;
procedure SetController (const Value : IObrasController);
public
property Controller : IObrasController read GetController write SetController;
property Obra: IBizObra read GetObra write SetObra;
end;
implementation
{$R *.dfm}
{ TfrViewEjecucionObra }
uses
uDialogUtils, uEditorObra, uBizContactos;
procedure TfrViewEjecucionObra.actFinEjecucionExecute(Sender: TObject);
begin
inherited;
if (Parent is TfEditorObra) then
(Parent as TfEditorObra).actFinalizarEjecucion.Execute;
end;
procedure TfrViewEjecucionObra.bElegirSubcontrataClick(Sender: TObject);
var
ASubcontratas : IBizProveedor;
ASubcontrata : IBizProveedor;
begin
inherited;
ASubcontratas := IBizProveedor(FProveedoresController.BuscarSubcontratas);
try
ASubcontrata := IBizProveedor(FProveedoresController.ElegirContacto(ASubcontratas, 'Elija la subcontrata de esta ejecuci<63>n de obra', False));
finally
ASubcontratas := NIL;
end;
if Assigned(ASubcontrata) then
begin
try
ASubcontrata.Open;
FObra.Ejecuciones.Edit;
FObra.Ejecuciones.ID_SUBCONTRATA := ASubcontrata.ID;
FObra.Ejecuciones.NOMBRE := ASubcontrata.NOMBRE;
finally
ASubcontrata := NIL;
end;
end;
end;
procedure TfrViewEjecucionObra.CustomViewCreate(Sender: TObject);
begin
inherited;
FProveedoresController := TProveedoresController.Create;
end;
procedure TfrViewEjecucionObra.CustomViewDestroy(Sender: TObject);
begin
inherited;
FProveedoresController := NIL;
end;
procedure TfrViewEjecucionObra.CustomViewShow(Sender: TObject);
begin
inherited;
bCancelarEjecucion.Visible := False;
end;
function TfrViewEjecucionObra.GetController: IObrasController;
begin
Result := FObrasController;
end;
function TfrViewEjecucionObra.GetObra: IBizObra;
begin
Result := FObra;
end;
procedure TfrViewEjecucionObra.SetController(const Value: IObrasController);
begin
FObrasController := Value;
frViewListaPresupuestosObra1.Controller := FObrasController;
end;
procedure TfrViewEjecucionObra.SetObra(const Value: IBizObra);
begin
FObra := Value;
if Assigned(FObra) then
begin
FEjecucion := FObra.Ejecuciones;
dsEjecucion.DataTable := FEjecucion.DataTable;
FPresupuestos := FEjecucion.Presupuestos;
frViewListaPresupuestosObra1.Obra := FObra;
frViewListaPedidosProvObra1.Obra := FObra;
end
else begin
FEjecucion := NIL;
FObra := NIL;
dsEjecucion.DataTable := NIL;
FPresupuestos := NIL;
frViewListaPresupuestosObra1.Obra := NIL;
frViewListaPedidosProvObra1.Obra := NIL;
end;
end;
end.