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/Albaranes de cliente/Cliente/uViewAlbaranesCliente.pas
2007-06-21 15:59:26 +00:00

135 lines
4.3 KiB
ObjectPascal

unit uViewAlbaranesCliente;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, uViewGrid, uViewPreview, cxStyles, cxCustomData, cxGraphics,
cxFilter, cxData, cxDataStorage, cxEdit, DB, cxDBData, dxPSGlbl, dxPSUtl,
dxPSEngn, dxPrnPg, dxBkgnd, dxWrap, dxPrnDev, dxPSCompsProvider,
dxPSFillPatterns, dxPSEdgePatterns, cxImageComboBox, cxTextEdit, ImgList,
PngImageList, cxGridCustomTableView, cxGridTableView, cxGridDBTableView,
dxPSCore, dxPScxCommon, dxPScxGridLnk, ActnList, uDADataTable,
cxGridLevel, cxClasses, cxControls, cxGridCustomView, cxGrid,
uBizAlbaranesCliente, cxImage, Grids, DBGrids;
type
IViewAlbaranesCliente = interface(IViewGrid)
['{A490D8D4-B431-44D2-8AD7-BA74B40E98B7}']
procedure SyncFocusedRecord;
function GetAlbaranesCliente: IBizAlbaranesCliente;
procedure SetAlbaranesCliente(const Value: IBizAlbaranesCliente);
property AlbaranesCliente: IBizAlbaranesCliente read GetAlbaranesCliente
write SetAlbaranesCliente;
end;
TfrViewAlbaranesCliente = class(TfrViewGrid, IViewAlbaranesCliente)
PngImageList: TPngImageList;
cxGridViewNOMBRE: TcxGridDBColumn;
cxGridViewFECHAALBARAN: TcxGridDBColumn;
cxGridViewSITUACION: TcxGridDBColumn;
cxGridViewFECHAPAGO: TcxGridDBColumn;
cxGridViewIMPORTETOTAL: TcxGridDBColumn;
cxGridViewREFERENCIA: TcxGridDBColumn;
cxGridViewCODIGO: TcxGridDBColumn;
cxGridViewICONO: TcxGridDBColumn;
cxGridLevel1: TcxGridLevel;
cxGridLevel2: TcxGridLevel;
cxGridViewREFERENCIAPRESUPUESTO: TcxGridDBColumn;
procedure cxGridViewCODIGOCustomDrawCell(
Sender: TcxCustomGridTableView; ACanvas: TcxCanvas;
AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
procedure cxGridActiveTabChanged(Sender: TcxCustomGrid;
ALevel: TcxGridLevel);
private
protected
FNivelFiltrado : TcxFilterCriteriaItemList;
FAlbaranesCliente: IBizAlbaranesCliente;
function GetAlbaranesCliente: IBizAlbaranesCliente;
procedure SetAlbaranesCliente(const Value: IBizAlbaranesCliente);
procedure FilterChanged(Sender : TObject); override;
public
procedure SyncFocusedRecord;
property AlbaranesCliente: IBizAlbaranesCliente read GetAlbaranesCliente
write SetAlbaranesCliente;
end;
var
frViewAlbaranesCliente: TfrViewAlbaranesCliente;
implementation
uses
uDataModuleAlbaranesCliente;
{$R *.dfm}
{ TfrViewAlbaranesCliente }
function TfrViewAlbaranesCliente.GetAlbaranesCliente: IBizAlbaranesCliente;
begin
Result := FAlbaranesCliente;
end;
procedure TfrViewAlbaranesCliente.SetAlbaranesCliente(
const Value: IBizAlbaranesCliente);
begin
FAlbaranesCliente := Value;
if Assigned(FAlbaranesCliente) then
DADataSource.DataTable := FAlbaranesCliente.DataTable;
end;
procedure TfrViewAlbaranesCliente.cxGridViewCODIGOCustomDrawCell(
Sender: TcxCustomGridTableView; ACanvas: TcxCanvas;
AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
var
R : TRect;
begin
inherited;
R := AViewInfo.ContentBounds;
ACanvas.FillRect(R);
ACanvas.DrawImage(PngImageList, R.Left, R.Top, 2);
ADone := True;
end;
procedure TfrViewAlbaranesCliente.SyncFocusedRecord;
begin
//
end;
procedure TfrViewAlbaranesCliente.cxGridActiveTabChanged(Sender: TcxCustomGrid; ALevel: TcxGridLevel);
begin
inherited;
FreeAndNil(FNivelFiltrado);
FilterChanged(self);
end;
procedure TfrViewAlbaranesCliente.FilterChanged(Sender: TObject);
var
AItemList: TcxFilterCriteriaItemList;
AItemList2: TcxFilterCriteriaItemList;
begin
inherited;
cxGridView.DataController.Filter.BeginUpdate;
AItemList := cxGridView.DataController.Filter.Root;
AItemList2 := AItemList.AddItemList(fboAnd);
FNivelFiltrado := AItemList2;
case cxGrid.ActiveLevel.Index of
1 : AItemList2.AddItem(cxGridViewSITUACION, foEqual, SITUACION_PENDIENTE, SITUACION_PENDIENTE);
2 : AItemList2.AddItem(cxGridViewSITUACION, foEqual, SITUACION_PAGADO, SITUACION_PAGADO);
end;
AItemList := AItemList2;
if cxGridView.DataController.Filter.IsEmpty
then cxGridView.DataController.Filter.Active := False
else cxGridView.DataController.Filter.Active := True;
cxGridView.DataController.Filter.EndUpdate;
cxGrid.ActiveLevel.GridView := cxGridView;
end;
end.