130 lines
4.4 KiB
ObjectPascal
130 lines
4.4 KiB
ObjectPascal
|
|
unit uViewFacturasCliente;
|
||
|
|
|
||
|
|
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,
|
||
|
|
cxImage, Grids, DBGrids, uBizFacturasCliente;
|
||
|
|
|
||
|
|
type
|
||
|
|
IViewFacturasCliente = interface(IViewGrid)
|
||
|
|
['{0B893BAC-967F-45BD-BD74-B1B78662FCFC}']
|
||
|
|
function GetFacturasCliente: IBizFacturasCliente;
|
||
|
|
procedure SetFacturasCliente(const Value: IBizFacturasCliente);
|
||
|
|
property FacturasCliente: IBizFacturasCliente read GetFacturasCliente write SetFacturasCliente;
|
||
|
|
end;
|
||
|
|
|
||
|
|
TfrViewFacturasCliente = class(TfrViewGrid, IViewFacturasCliente)
|
||
|
|
PngImageList: TPngImageList;
|
||
|
|
cxGridViewNOMBRE: TcxGridDBColumn;
|
||
|
|
cxGridViewFECHAFACTURA: TcxGridDBColumn;
|
||
|
|
cxGridViewNIFCIF: TcxGridDBColumn;
|
||
|
|
cxGridViewIMPORTETOTAL: TcxGridDBColumn;
|
||
|
|
cxGridViewREFERENCIA: TcxGridDBColumn;
|
||
|
|
cxGridViewCODIGO: TcxGridDBColumn;
|
||
|
|
cxGridViewICONO: TcxGridDBColumn;
|
||
|
|
cxGridViewCLASEFACTURA: TcxGridDBColumn;
|
||
|
|
cxGridViewPAGADA: TcxGridDBColumn;
|
||
|
|
cxGridViewFECHAVENCIMIENTO: TcxGridDBColumn;
|
||
|
|
cxGridLevel1: TcxGridLevel;
|
||
|
|
cxGridLevel2: TcxGridLevel;
|
||
|
|
procedure cxGridActiveTabChanged(Sender: TcxCustomGrid; ALevel: TcxGridLevel);
|
||
|
|
procedure CustomViewShow(Sender: TObject);
|
||
|
|
protected
|
||
|
|
FNivelFiltrado : TcxFilterCriteriaItemList;
|
||
|
|
FFacturasCliente: IBizFacturasCliente;
|
||
|
|
function GetFacturasCliente: IBizFacturasCliente;
|
||
|
|
procedure SetFacturasCliente(const Value: IBizFacturasCliente);
|
||
|
|
procedure FilterChanged(Sender : TObject); override;
|
||
|
|
public
|
||
|
|
property FacturasCliente: IBizFacturasCliente read GetFacturasCliente write SetFacturasCliente;
|
||
|
|
end;
|
||
|
|
|
||
|
|
var
|
||
|
|
frViewFacturasCliente: TfrViewFacturasCliente;
|
||
|
|
|
||
|
|
implementation
|
||
|
|
|
||
|
|
uses
|
||
|
|
uDataModuleFacturasCliente;
|
||
|
|
|
||
|
|
{$R *.dfm}
|
||
|
|
|
||
|
|
{ TfrViewFacturasCliente }
|
||
|
|
|
||
|
|
function TfrViewFacturasCliente.GetFacturasCliente: IBizFacturasCliente;
|
||
|
|
begin
|
||
|
|
Result := FFacturasCliente;
|
||
|
|
end;
|
||
|
|
|
||
|
|
procedure TfrViewFacturasCliente.SetFacturasCliente(
|
||
|
|
const Value: IBizFacturasCliente);
|
||
|
|
begin
|
||
|
|
FFacturasCliente := Value;
|
||
|
|
if Assigned(FFacturasCliente) then
|
||
|
|
DADataSource.DataTable := FFacturasCliente.DataTable;
|
||
|
|
end;
|
||
|
|
|
||
|
|
procedure TfrViewFacturasCliente.cxGridActiveTabChanged(Sender: TcxCustomGrid; ALevel: TcxGridLevel);
|
||
|
|
begin
|
||
|
|
inherited;
|
||
|
|
FreeAndNil(FNivelFiltrado);
|
||
|
|
FilterChanged(self);
|
||
|
|
end;
|
||
|
|
|
||
|
|
procedure TfrViewFacturasCliente.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
|
||
|
|
0 : begin
|
||
|
|
AItemList2.AddItem(cxGridViewCLASEFACTURA, foNotEqual, CTE_PROFORMA, CTE_PROFORMA);
|
||
|
|
AItemList2.BoolOperatorKind := fboAnd;
|
||
|
|
AItemList2.AddItem(cxGridViewPAGADA, foEqual, SITUACION_PENDIENTE, SITUACION_PENDIENTE);
|
||
|
|
cxGridViewPAGADA.Visible := True;
|
||
|
|
end;
|
||
|
|
1 : begin
|
||
|
|
AItemList2.AddItem(cxGridViewCLASEFACTURA, foNotEqual, CTE_PROFORMA, CTE_PROFORMA);
|
||
|
|
AItemList2.BoolOperatorKind := fboAnd;
|
||
|
|
AItemList2.AddItem(cxGridViewPAGADA, foEqual, SITUACION_PAGADO, SITUACION_PAGADO);
|
||
|
|
cxGridViewPAGADA.Visible := True;
|
||
|
|
end;
|
||
|
|
2 : begin
|
||
|
|
AItemList2.AddItem(cxGridViewCLASEFACTURA, foEqual, CTE_PROFORMA, CTE_PROFORMA);
|
||
|
|
cxGridViewPAGADA.Visible := False;
|
||
|
|
end;
|
||
|
|
end;
|
||
|
|
|
||
|
|
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;
|
||
|
|
|
||
|
|
procedure TfrViewFacturasCliente.CustomViewShow(Sender: TObject);
|
||
|
|
begin
|
||
|
|
inherited;
|
||
|
|
FreeAndNil(FNivelFiltrado);
|
||
|
|
FilterChanged(self);
|
||
|
|
end;
|
||
|
|
|
||
|
|
end.
|