181 lines
6.5 KiB
ObjectPascal
181 lines
6.5 KiB
ObjectPascal
|
|
{
|
|||
|
|
===============================================================================
|
|||
|
|
Copyright (<EFBFBD>) 2006. Rodax Software.
|
|||
|
|
===============================================================================
|
|||
|
|
Los contenidos de este fichero son propiedad de Rodax Software titular del
|
|||
|
|
copyright. Este fichero s<EFBFBD>lo podr<EFBFBD> ser copiado, distribuido y utilizado,
|
|||
|
|
en su totalidad o en parte, con el permiso escrito de Rodax Software, o de
|
|||
|
|
acuerdo con los t<EFBFBD>rminos y condiciones establecidas en el acuerdo/contrato
|
|||
|
|
bajo el que se suministra.
|
|||
|
|
-----------------------------------------------------------------------------
|
|||
|
|
Web: www.rodax-software.com
|
|||
|
|
===============================================================================
|
|||
|
|
Fecha primera versi<EFBFBD>n: 22-05-2006
|
|||
|
|
Versi<EFBFBD>n actual: 1.0.0
|
|||
|
|
Fecha versi<EFBFBD>n actual: 22-05-2006
|
|||
|
|
===============================================================================
|
|||
|
|
Modificaciones:
|
|||
|
|
|
|||
|
|
Fecha Comentarios
|
|||
|
|
---------------------------------------------------------------------------
|
|||
|
|
===============================================================================
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
unit uViewTrabajosObra;
|
|||
|
|
|
|||
|
|
interface
|
|||
|
|
|
|||
|
|
uses
|
|||
|
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|||
|
|
Dialogs, uViewGrid, ComCtrls, ToolWin, StdCtrls, cxStyles, cxCustomData,
|
|||
|
|
cxGraphics, cxFilter, cxData, cxDataStorage, cxEdit, DB, cxDBData,
|
|||
|
|
dxPSGlbl, dxPSUtl, dxPSEngn, dxPrnPg, dxBkgnd, dxWrap, dxPrnDev,
|
|||
|
|
dxPSCompsProvider, dxPSFillPatterns, dxPSEdgePatterns, dxPSCore,
|
|||
|
|
dxPScxCommon, dxPScxGridLnk, uDADataTable, ActnList, cxGridLevel,
|
|||
|
|
cxGridCustomTableView, cxGridTableView, cxGridDBTableView, cxClasses,
|
|||
|
|
cxControls, cxGridCustomView, cxGrid, cxGroupBox, cxRadioGroup, cxDBEdit,
|
|||
|
|
cxSpinEdit, cxContainer, cxTextEdit, cxMaskEdit, cxDropDownEdit, cxCalc,
|
|||
|
|
cxLabel, dxLayoutControl, uBizObra, uViewBase, uCustomView,
|
|||
|
|
uViewPresupuestosBase, ImgList, PngImageList;
|
|||
|
|
|
|||
|
|
type
|
|||
|
|
IViewTrabajosObra = interface(IViewBase)
|
|||
|
|
['{87DE9081-B5B7-4F73-B806-FB3FFC8582A4}']
|
|||
|
|
function GetPresupuestos: IBizPresupuestosObra;
|
|||
|
|
procedure SetPresupuestos(const Value: IBizPresupuestosObra);
|
|||
|
|
property Presupuestos: IBizPresupuestosObra read GetPresupuestos write SetPresupuestos;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
TfrViewTrabajosObra = class(TfrViewBase, IViewTrabajosObra)
|
|||
|
|
ActionList1: TActionList;
|
|||
|
|
actEditar: TAction;
|
|||
|
|
actEliminar: TAction;
|
|||
|
|
actEliminarTodo: TAction;
|
|||
|
|
actAnadir: TAction;
|
|||
|
|
DADataSource: TDADataSource;
|
|||
|
|
cxStyleRepository1: TcxStyleRepository;
|
|||
|
|
cxStyleEven: TcxStyle;
|
|||
|
|
cxStyleOdd: TcxStyle;
|
|||
|
|
cxStyleSelection: TcxStyle;
|
|||
|
|
dxPSEngineController1: TdxPSEngineController;
|
|||
|
|
dxComponentPrinter: TdxComponentPrinter;
|
|||
|
|
dxComponentPrinterLink: TdxGridReportLink;
|
|||
|
|
ToolBar1: TToolBar;
|
|||
|
|
ToolButton1: TToolButton;
|
|||
|
|
ToolButton2: TToolButton;
|
|||
|
|
ToolButton4: TToolButton;
|
|||
|
|
ToolButton3: TToolButton;
|
|||
|
|
ToolButton5: TToolButton;
|
|||
|
|
frViewTrabajos: TfrViewPresupuestosBase;
|
|||
|
|
PngImageList: TPngImageList;
|
|||
|
|
procedure CustomViewCreate(Sender: TObject);
|
|||
|
|
procedure CustomViewDestroy(Sender: TObject);
|
|||
|
|
|
|||
|
|
procedure actEliminarExecute(Sender: TObject);
|
|||
|
|
procedure actEliminarTodoExecute(Sender: TObject);
|
|||
|
|
procedure actEliminarUpdate(Sender: TObject);
|
|||
|
|
procedure actEliminarTodoUpdate(Sender: TObject);
|
|||
|
|
procedure actEditarUpdate(Sender: TObject);
|
|||
|
|
|
|||
|
|
private
|
|||
|
|
FPresupuestos: IBizPresupuestosObra;
|
|||
|
|
FViewTrabajosObra: IViewGrid;
|
|||
|
|
function GetPresupuestos: IBizPresupuestosObra;
|
|||
|
|
procedure SetPresupuestos(const Value: IBizPresupuestosObra);
|
|||
|
|
function GetGridView(ViewGrid: IViewGrid): TcxCustomGridView;
|
|||
|
|
|
|||
|
|
public
|
|||
|
|
property Presupuestos: IBizPresupuestosObra read GetPresupuestos write SetPresupuestos;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
var
|
|||
|
|
frViewTrabajosObra: TfrViewTrabajosObra;
|
|||
|
|
|
|||
|
|
implementation
|
|||
|
|
{$R *.dfm}
|
|||
|
|
|
|||
|
|
uses LiteralesObras, schObrasClient_Intf;
|
|||
|
|
|
|||
|
|
{ TfrViewTrabajosObra }
|
|||
|
|
|
|||
|
|
function TfrViewTrabajosObra.GetPresupuestos: IBizPresupuestosObra;
|
|||
|
|
begin
|
|||
|
|
Result := FPresupuestos;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrViewTrabajosObra.SetPresupuestos(const Value: IBizPresupuestosObra);
|
|||
|
|
begin
|
|||
|
|
FPresupuestos := Value;
|
|||
|
|
|
|||
|
|
if Assigned(FPresupuestos) then
|
|||
|
|
DADataSource.DataTable := FPresupuestos.DataTable
|
|||
|
|
else
|
|||
|
|
DADataSource.DataTable := Nil;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrViewTrabajosObra.CustomViewCreate(Sender: TObject);
|
|||
|
|
var
|
|||
|
|
ColumnaClase: TcxGridDBColumn;
|
|||
|
|
begin
|
|||
|
|
inherited;
|
|||
|
|
|
|||
|
|
FViewTrabajosObra := frViewTrabajos;
|
|||
|
|
ColumnaClase := (GetGridView(FViewTrabajosObra) as TcxGridDBTableView).GetColumnByFieldName(fld_PresupuestosObraCLASE);
|
|||
|
|
with GetGridView(FViewTrabajosObra).DataController.Filter do
|
|||
|
|
begin
|
|||
|
|
BeginUpdate;
|
|||
|
|
Clear;
|
|||
|
|
Root.AddItem(ColumnaClase, foEqual, CLASE_TRABAJO, CLASE_TRABAJO);
|
|||
|
|
EndUpdate;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrViewTrabajosObra.actEliminarUpdate(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
inherited;
|
|||
|
|
(Sender as TAction).Enabled := ((GetGridView(FViewTrabajosObra).DataController.FocusedRowIndex <> -1) AND (GetGridView(FViewTrabajosObra).DataController.FilteredRecordCount > 0));
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrViewTrabajosObra.actEliminarTodoUpdate(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
inherited;
|
|||
|
|
(Sender as TAction).Enabled := ((GetGridView(FViewTrabajosObra).DataController.FocusedRowIndex <> -1) AND (GetGridView(FViewTrabajosObra).DataController.FilteredRecordCount > 0));
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
function TfrViewTrabajosObra.GetGridView(ViewGrid: IViewGrid): TcxCustomGridView;
|
|||
|
|
begin
|
|||
|
|
if (ViewGrid.Grid.ViewCount > 0)
|
|||
|
|
then Result := ViewGrid.Grid.ActiveView
|
|||
|
|
else raise Exception.Create('El grid no tiene vistas');
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrViewTrabajosObra.actEliminarExecute(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
inherited;
|
|||
|
|
if (MessageDlg(msgLitBorrarPO, mtConfirmation, [mbYes, mbNo], 0) = mrYes) then
|
|||
|
|
GetGridView(FViewTrabajosObra).DataController.DeleteSelection;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrViewTrabajosObra.actEliminarTodoExecute(Sender: TObject);
|
|||
|
|
var
|
|||
|
|
i: Integer;
|
|||
|
|
begin
|
|||
|
|
if (MessageDlg(msgLitBorrarTPO, mtConfirmation, [mbYes, mbNo], 0) = mrYes) then
|
|||
|
|
for i:=0 to GetGridView(FViewTrabajosObra).DataController.FilteredRecordCount - 1 do
|
|||
|
|
GetGridView(FViewTrabajosObra).DataController.DeleteSelection;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrViewTrabajosObra.CustomViewDestroy(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
FViewTrabajosObra := Nil;
|
|||
|
|
inherited;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrViewTrabajosObra.actEditarUpdate(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
inherited;
|
|||
|
|
(Sender as TAction).Enabled := ((GetGridView(FViewTrabajosObra).DataController.FocusedRowIndex <> -1) AND (GetGridView(FViewTrabajosObra).DataController.FilteredRecordCount > 0));
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
end.
|