ProGestion/Modulos/Obras/Cliente/uViewObras.pas

174 lines
5.5 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 uViewObras;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, uViewGrid, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData,
cxDataStorage, cxEdit, DB, cxDBData, uDADataTable, cxGridLevel,
cxClasses, cxControls, cxGridCustomView, cxGridCustomTableView,
cxGridTableView, cxGridDBTableView, cxGrid, uBizObra, ActnList, Menus,
cxGridBandedTableView, cxGridDBBandedTableView, dxPSGlbl, dxPSUtl,
dxPSEngn, dxPrnPg, dxBkgnd, dxWrap, dxPrnDev, dxPSCompsProvider,
dxPSFillPatterns, dxPSEdgePatterns, dxPSCore, dxPScxCommon, dxPScxGridLnk,
ImgList, PngImageList, cxImageComboBox;
type
IViewObras = interface(IViewGrid)
['{7D0C82BF-84D2-4632-9875-41964B0349FD}']
function GetObras: IBizObra;
procedure SetObras(const Value: IBizObra);
property Obras: IBizObra read GetObras write SetObras;
end;
TfrViewObras = class(TfrViewGrid, IViewObras)
cxGridViewRecID: TcxGridDBColumn;
cxGridViewCODIGO: TcxGridDBColumn;
cxGridViewNOMBRE: TcxGridDBColumn;
cxGridViewFECHAINIOBR: TcxGridDBColumn;
cxGridViewFECHAFINOBR: TcxGridDBColumn;
PngImageList: TPngImageList;
cxStyleRepository: TcxStyleRepository;
cxStyleFinalizado: TcxStyle;
cxStylePendiente: TcxStyle;
cxGridViewESTADO: TcxGridDBColumn;
cxGridViewNOMBRECLIENTE: TcxGridDBColumn;
cxGridViewALMACEN: TcxGridDBColumn;
procedure cxGridViewESTADOCustomDrawCell(
Sender: TcxCustomGridTableView; ACanvas: TcxCanvas;
AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
procedure cxGridViewStylesGetContentStyle(
Sender: TcxCustomGridTableView; ARecord: TcxCustomGridRecord;
AItem: TcxCustomGridTableItem; out AStyle: TcxStyle);
procedure cxGridViewALMACENCustomDrawCell(
Sender: TcxCustomGridTableView; ACanvas: TcxCanvas;
AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
protected
FObras: IBizObra;
function GetObras: IBizObra; virtual;
procedure SetObras(const Value: IBizObra); virtual;
public
property Obra: IBizObra read GetObras write SetObras;
procedure Preview; override;
procedure Print; override;
end;
var
frViewObras: TfrViewObras;
implementation
uses uDataModuleObras, uDBSelectionList, schObrasClient_Intf, uUtils,
UDataTableUtils;
{$R *.dfm}
{ TfrViewObras }
{
******************************* TfrViewObras *******************************
}
function TfrViewObras.GetObras: IBizObra;
begin
Result := FObras;
end;
procedure TfrViewObras.SetObras(const Value: IBizObra);
begin
FObras := Value;
if Assigned(FObras) then
DADataSource.DataTable := FObras.DataTable;
end;
procedure TfrViewObras.cxGridViewESTADOCustomDrawCell(
Sender: TcxCustomGridTableView; ACanvas: TcxCanvas;
AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
var
R : TRect;
begin
inherited;
if not VarIsNull (AViewInfo.Value) then
begin
R := AViewInfo.ContentBounds;
ACanvas.FillRect(R);
ACanvas.DrawImage(PngImageList, R.Left, R.Top, 0);
ADone := True;
end;
end;
procedure TfrViewObras.cxGridViewStylesGetContentStyle(
Sender: TcxCustomGridTableView; ARecord: TcxCustomGridRecord;
AItem: TcxCustomGridTableItem; out AStyle: TcxStyle);
var
IndiceCol : Integer;
ASituacion: String;
begin
inherited;
if Assigned(ARecord) then
begin
IndiceCol := (Sender as TcxGridDBTableView).GetColumnByFieldName(fld_ObrasFECHAFINOBR).Index;
ASituacion := VarToStr(ARecord.DisplayTexts[IndiceCol]);
if ASituacion = '' then
AStyle := cxStylePendiente
else
AStyle := cxStyleFinalizado;
end;
end;
procedure TfrViewObras.Preview;
begin
cxGridViewESTADO.Visible := False;
inherited;
cxGridViewESTADO.Visible := True;
end;
procedure TfrViewObras.Print;
begin
cxGridViewESTADO.Visible := False;
inherited;
cxGridViewESTADO.Visible := True;
end;
procedure TfrViewObras.cxGridViewALMACENCustomDrawCell(
Sender: TcxCustomGridTableView; ACanvas: TcxCanvas;
AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
var
R : TRect;
begin
inherited;
if (AViewInfo.Value <> '0') then
begin
R := AViewInfo.ContentBounds;
ACanvas.FillRect(R);
ACanvas.DrawImage(PngImageList, R.Left, R.Top, 3);
ADone := True;
end;
end;
end.