From 02017c27daba3789a9616fb663d9a397e70d80a9 Mon Sep 17 00:00:00 2001 From: roberto Date: Tue, 23 Sep 2008 15:38:22 +0000 Subject: [PATCH] =?UTF-8?q?Se=20a=C3=B1ade=20la=20posiblidad=20de=20filtra?= =?UTF-8?q?r=20los=20presupuestos=20entre=20facturados=20y=20no=20facturad?= =?UTF-8?q?os?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: https://192.168.0.254/svn/Proyectos.Tecsitel_FactuGES2/trunk@609 0c75b7a4-871f-7646-8a2f-f78d34cc349f --- .../Views/uViewPresupuestosCliente.dfm | 47 ++++++++++- .../Views/uViewPresupuestosCliente.pas | 79 ++++++++++++++++++- 2 files changed, 123 insertions(+), 3 deletions(-) diff --git a/Source/Modulos/Presupuestos de cliente/Views/uViewPresupuestosCliente.dfm b/Source/Modulos/Presupuestos de cliente/Views/uViewPresupuestosCliente.dfm index 2da33f36..5c89ded3 100644 --- a/Source/Modulos/Presupuestos de cliente/Views/uViewPresupuestosCliente.dfm +++ b/Source/Modulos/Presupuestos de cliente/Views/uViewPresupuestosCliente.dfm @@ -1,6 +1,8 @@ inherited frViewPresupuestosCliente: TfrViewPresupuestosCliente Width = 903 Height = 525 + OnDestroy = CustomViewDestroy + OnShow = CustomViewShow ExplicitWidth = 903 ExplicitHeight = 525 inherited cxGrid: TcxGrid @@ -152,19 +154,55 @@ inherited frViewPresupuestosCliente: TfrViewPresupuestosCliente Width = 903 ExplicitWidth = 903 inherited txtFiltroTodo: TcxTextEdit + Style.LookAndFeel.SkinName = '' + StyleDisabled.LookAndFeel.SkinName = '' + StyleFocused.LookAndFeel.SkinName = '' + StyleHot.LookAndFeel.SkinName = '' ExplicitWidth = 806 Width = 806 end inherited edtFechaIniFiltro: TcxDateEdit + Style.LookAndFeel.SkinName = '' + StyleDisabled.LookAndFeel.SkinName = '' + StyleFocused.LookAndFeel.SkinName = '' + StyleHot.LookAndFeel.SkinName = '' ExplicitWidth = 285 Width = 285 end inherited edtFechaFinFiltro: TcxDateEdit - Left = 389 - ExplicitLeft = 389 + Left = 308 + Style.LookAndFeel.SkinName = '' + StyleDisabled.LookAndFeel.SkinName = '' + StyleFocused.LookAndFeel.SkinName = '' + StyleHot.LookAndFeel.SkinName = '' + ExplicitLeft = 308 ExplicitWidth = 504 Width = 504 end + inherited eLista: TcxComboBox + Left = 733 + Properties.OnChange = nil + Style.LookAndFeel.SkinName = '' + StyleDisabled.LookAndFeel.SkinName = '' + StyleFocused.LookAndFeel.SkinName = '' + StyleHot.LookAndFeel.SkinName = '' + ExplicitLeft = 733 + ExplicitWidth = 215 + Width = 215 + end + inherited dxLayoutControl1Group_Root: TdxLayoutGroup + inherited dxLayoutControl1Group1: TdxLayoutGroup + inherited dxLayoutControl1Item2: TdxLayoutItem + AlignHorz = ahClient + end + inherited dxLayoutControl1Item3: TdxLayoutItem + AlignHorz = ahClient + end + inherited dxLayoutControl1Item4: TdxLayoutItem + Visible = True + end + end + end end inherited TBXAlignmentPanel1: TTBXAlignmentPanel Width = 903 @@ -178,6 +216,11 @@ inherited frViewPresupuestosCliente: TfrViewPresupuestosCliente inherited dxLayoutLookAndFeelList1: TdxLayoutLookAndFeelList Left = 56 end + inherited ActionList1: TActionList + inherited actQuitarFiltro: TAction + OnExecute = frViewFiltroBase1actQuitarFiltroExecute + end + end end inherited pnlAgrupaciones: TTBXDockablePanel Top = 499 diff --git a/Source/Modulos/Presupuestos de cliente/Views/uViewPresupuestosCliente.pas b/Source/Modulos/Presupuestos de cliente/Views/uViewPresupuestosCliente.pas index a1aa4437..835eb311 100644 --- a/Source/Modulos/Presupuestos de cliente/Views/uViewPresupuestosCliente.pas +++ b/Source/Modulos/Presupuestos de cliente/Views/uViewPresupuestosCliente.pas @@ -12,7 +12,7 @@ uses uDADataTable, cxGridLevel, cxClasses, cxControls, cxGridCustomView, Classes, cxGrid, uBizPresupuestosCliente, cxCurrencyEdit, Forms, uViewFiltroBase, ActnList, TB2Item, TBX, TB2Toolbar, TBXDkPanels, TB2Dock, dxPgsDlg, uDAInterfaces, Windows; - + type IViewPresupuestosCliente = interface(IViewGrid) ['{96821714-55CF-4BC1-A0C1-16E027B2EF16}'] @@ -66,11 +66,17 @@ type procedure cxGridViewDataControllerCompare( ADataController: TcxCustomDataController; ARecordIndex1, ARecordIndex2, AItemIndex: Integer; const V1, V2: Variant; var Compare: Integer); + procedure OnFiltroListaPropertiesChange(Sender: TObject); + procedure OnFiltroListaPropertiesInitPopup(Sender: TObject); + procedure CustomViewDestroy(Sender: TObject); + procedure CustomViewShow(Sender: TObject); + procedure frViewFiltroBase1actQuitarFiltroExecute(Sender: TObject); private //Filtros relativos a la vista procedure AnadirFiltroSituaciones; procedure AnadirFiltroFechas; + procedure AnadirFiltroFacturado; protected FPresupuestos: IBizPresupuestoCliente; @@ -153,6 +159,31 @@ begin end; end; +procedure TfrViewPresupuestosCliente.AnadirFiltroFacturado; +var + FFiltro : TcxFilterCriteriaItemList; + Index: Integer; +begin + //Solo se aplica este filtro en el caso de tener activo el panel de detalle de filtro + //y sobre la lista de articulos detallada por proveedor + if frViewFiltroBase1.Visible then + begin + case frViewFiltroBase1.eLista.ItemIndex of +//Sin facturar + 1 : begin + FFiltro := AddFilterGrid(fboAnd); + FFiltro.AddItem(cxGridViewFACTURA, foEqual, NULL, 'NoFacturado'); + end; + +//Facturados + 2: begin + FFiltro := AddFilterGrid(fboAnd); + FFiltro.AddItem(cxGridViewFACTURA, foNotEqual, NULL, 'Facturado'); + end; + end; + end; +end; + procedure TfrViewPresupuestosCliente.AnadirFiltroSituaciones; var FFiltro : TcxFilterCriteriaItemList; @@ -172,6 +203,7 @@ begin AnadirFiltroSituaciones; AnadirFiltroFechas; + AnadirFiltroFacturado; //Finalmente activamos el filtro si tenemos algo if cxGridView.DataController.Filter.IsEmpty then @@ -181,6 +213,20 @@ begin cxGrid.ActiveLevel.GridView := cxGridView; end; +procedure TfrViewPresupuestosCliente.CustomViewDestroy(Sender: TObject); +begin + frViewFiltroBase1.eLista.Properties.OnChange := Nil; + frViewFiltroBase1.eLista.Properties.OnInitPopup := Nil; + inherited; +end; + +procedure TfrViewPresupuestosCliente.CustomViewShow(Sender: TObject); +begin + inherited; + frViewFiltroBase1.eLista.Properties.OnChange := OnFiltroListaPropertiesChange; + frViewFiltroBase1.eLista.Properties.OnInitPopup := OnFiltroListaPropertiesInitPopup; +end; + procedure TfrViewPresupuestosCliente.cxGridActiveTabChanged(Sender: TcxCustomGrid; ALevel: TcxGridLevel); begin inherited; @@ -252,6 +298,37 @@ begin end; end; +procedure TfrViewPresupuestosCliente.frViewFiltroBase1actQuitarFiltroExecute(Sender: TObject); +begin + frViewFiltroBase1.txtFiltroTodo.Clear; + frViewFiltroBase1.eLista.Clear; +end; + +procedure TfrViewPresupuestosCliente.OnFiltroListaPropertiesChange(Sender: TObject); +begin + inherited; + RefrescarFiltro; +end; + +procedure TfrViewPresupuestosCliente.OnFiltroListaPropertiesInitPopup(Sender: TObject); +begin + inherited; + + with frViewFiltroBase1.eLista.Properties.Items do + begin + BeginUpdate; + try + Clear; + Add('Todos'); //Case 0 + Add('Sin facturar'); //Case 1 + Add('Facturados'); //Case 2 + frViewFiltroBase1.eLista.ItemIndex := 0; + finally + EndUpdate; + end; + end; +end; + function TfrViewPresupuestosCliente.GetPresupuestos: IBizPresupuestoCliente; begin Result := FPresupuestos;