From 0f0529a8c2ba88a07f4632fb04e2e0765d93a148 Mon Sep 17 00:00:00 2001 From: david Date: Wed, 2 Jan 2008 12:43:04 +0000 Subject: [PATCH] =?UTF-8?q?-=20Revisi=C3=B3n=20de=20las=20unidades=20base?= =?UTF-8?q?=20de=20tratamiento=20de=20detalles=20para=20mejorar=20el=20pos?= =?UTF-8?q?icionamiento=20mediante=20el=20campo=20POSICION.=20-=20Activado?= =?UTF-8?q?=20el=20campo=20DESCUENTO=20en=20los=20detalles=20base.=20-=20C?= =?UTF-8?q?ambiada=20la=20fuente=20para=20el=20campo=20DESCRIPCION=20de=20?= =?UTF-8?q?los=20detalles=20base.=20-=20Nueva=20funci=C3=B3n=20'LocalizarP?= =?UTF-8?q?osicion'=20en=20el=20controlador=20de=20detalles=20base.?= 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.Acana_FactuGES2/trunk@86 f4e31baf-9722-1c47-927c-6f952f962d4b --- Source/Base/Utiles/uCalculosUtils.pas | 13 +-- Source/GUIBase/uViewDetallesBase.dfm | 31 +++++-- Source/GUIBase/uViewDetallesBase.pas | 83 ++++++++++++++---- .../Contabilidad/Views/Contabilidad_view.res | Bin 4748 -> 384 bytes 4 files changed, 93 insertions(+), 34 deletions(-) diff --git a/Source/Base/Utiles/uCalculosUtils.pas b/Source/Base/Utiles/uCalculosUtils.pas index b5eb6dea..5b9e1dae 100644 --- a/Source/Base/Utiles/uCalculosUtils.pas +++ b/Source/Base/Utiles/uCalculosUtils.pas @@ -27,7 +27,7 @@ const implementation uses - SysUtils, DB, Variants; + SysUtils, DB, Variants, cxControls; function CalcularLineaConcepto (const ADataTable : TDADataTable): Double; var @@ -122,11 +122,12 @@ end; function DarTotalPorte(ADetalles: IDAStronglyTypedDataTable): Double; var ImporteTotal: Currency; - ABookmark : TBookmark; - + AuxPosicionIni : Integer; begin + AuxPosicionIni := ADetalles.DataTable.FieldByName(CAMPO_POSICION).AsInteger; + + ShowHourglassCursor; try - ABookmark := ADetalles.DataTable.GetBookMark; ADetalles.DataTable.DisableControls; ADetalles.DataTable.DisableEventHandlers; @@ -140,10 +141,10 @@ begin end; finally + ADetalles.DataTable.Locate(CAMPO_POSICION, IntToStr(AuxPosicionIni), []); ADetalles.DataTable.EnableEventHandlers; - ADetalles.DataTable.GotoBookmark(ABookmark); - ADetalles.DataTable.FreeBookmark(ABookmark); ADetalles.DataTable.EnableControls; + HideHourglassCursor; end; Result := ImporteTotal; diff --git a/Source/GUIBase/uViewDetallesBase.dfm b/Source/GUIBase/uViewDetallesBase.dfm index 261580f1..823cc458 100644 --- a/Source/GUIBase/uViewDetallesBase.dfm +++ b/Source/GUIBase/uViewDetallesBase.dfm @@ -152,7 +152,7 @@ inherited frViewDetallesBase: TfrViewDetallesBase Height = 232 Align = alClient TabOrder = 1 - LookAndFeel.Kind = lfOffice11 + LookAndFeel.Kind = lfStandard LookAndFeel.NativeStyle = True object cxGridView: TcxGridDBTableView NavigatorButtons.ConfirmDelete = False @@ -185,6 +185,7 @@ inherited frViewDetallesBase: TfrViewDetallesBase OptionsCustomize.DataRowSizing = True OptionsData.Appending = True OptionsData.CancelOnExit = False + OptionsSelection.InvertSelect = False OptionsSelection.MultiSelect = True OptionsSelection.UnselectFocusedRecordOnExit = False OptionsView.CellEndEllipsis = True @@ -197,32 +198,34 @@ inherited frViewDetallesBase: TfrViewDetallesBase OptionsView.NewItemRowInfoText = 'Click here to add a new row' Styles.ContentEven = cxStyleEven Styles.ContentOdd = cxStyleOdd - Styles.Inactive = cxStyleSelection Styles.Selection = cxStyleSelection Styles.OnGetContentStyle = cxGridViewStylesGetContentStyle object cxGridViewID: TcxGridDBColumn DataBinding.FieldName = 'ID' Visible = False + Width = 25 end object cxGridViewPOSICION: TcxGridDBColumn DataBinding.FieldName = 'POSICION' Visible = False SortIndex = 0 SortOrder = soAscending + Width = 25 end object cxGridViewTIPO: TcxGridDBColumn Caption = 'Tipo' DataBinding.FieldName = 'TIPO_DETALLE' PropertiesClassName = 'TcxImageComboBoxProperties' + Properties.ImmediatePost = True Properties.Items = <> BestFitMaxWidth = 64 - Width = 56 + Width = 35 end object cxGridViewDESCRIPCION: TcxGridDBColumn Caption = 'Concepto' DataBinding.FieldName = 'CONCEPTO' PropertiesClassName = 'TcxRichEditProperties' - Width = 224 + Width = 317 end object cxGridViewCANTIDAD: TcxGridDBColumn Caption = 'Cantidad' @@ -231,7 +234,7 @@ inherited frViewDetallesBase: TfrViewDetallesBase Properties.Alignment.Horz = taRightJustify BestFitMaxWidth = 64 HeaderAlignmentHorz = taRightJustify - Width = 130 + Width = 30 end object cxGridViewIMPORTEUNIDAD: TcxGridDBColumn Caption = 'Importe unidad' @@ -241,7 +244,7 @@ inherited frViewDetallesBase: TfrViewDetallesBase BestFitMaxWidth = 120 FooterAlignmentHorz = taRightJustify HeaderAlignmentHorz = taRightJustify - Width = 130 + Width = 60 end object cxGridViewIMPORTETOTAL: TcxGridDBColumn Caption = 'Importe total' @@ -251,7 +254,7 @@ inherited frViewDetallesBase: TfrViewDetallesBase BestFitMaxWidth = 120 HeaderAlignmentHorz = taRightJustify Options.Editing = False - Width = 130 + Width = 60 end object cxGridViewVISIBLE: TcxGridDBColumn Caption = #191'Visible?' @@ -298,6 +301,7 @@ inherited frViewDetallesBase: TfrViewDetallesBase Visible = False FooterAlignmentHorz = taCenter HeaderAlignmentHorz = taCenter + Width = 25 end end object cxGridLevel: TcxGridLevel @@ -709,8 +713,17 @@ inherited frViewDetallesBase: TfrViewDetallesBase Color = cl3DLight end object cxStyle_TITULO: TcxStyle - AssignedValues = [svColor] - Color = clMenuBar + AssignedValues = [svColor, svFont] + Color = 7977877 + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -15 + Font.Name = 'Tahoma' + Font.Style = [fsBold] + end + object cxStyle_DESCUENTO: TcxStyle + AssignedValues = [svTextColor] + TextColor = 7977877 end end end diff --git a/Source/GUIBase/uViewDetallesBase.pas b/Source/GUIBase/uViewDetallesBase.pas index 146a5e37..95eca84d 100644 --- a/Source/GUIBase/uViewDetallesBase.pas +++ b/Source/GUIBase/uViewDetallesBase.pas @@ -106,6 +106,7 @@ type actAnchoAutomatico: TAction; TBXSeparatorItem5: TTBXSeparatorItem; TBXItem13: TTBXItem; + cxStyle_DESCUENTO: TcxStyle; procedure actAnadirExecute(Sender: TObject); procedure actEliminarExecute(Sender: TObject); @@ -160,7 +161,8 @@ type protected function HayQueRecalcular(AItem: TcxCustomGridTableItem): Boolean; virtual; function EsTipoEditable(AItem: TcxCustomGridTableItem): Boolean; virtual; - function darTipoLetraPorDefecto: TFont; virtual; + function DarTipoConcepto(ARecord: TcxCustomGridRecord): string; virtual; + function DarFuentePorDefecto(const ATipo : String = TIPO_DETALLE_CONCEPTO): TFont; virtual; function GetFocusedView : TcxGridDBTableView; virtual; function GetGrid : TcxGrid; virtual; procedure SeleccionarRowActual; @@ -185,7 +187,8 @@ type implementation {$R *.dfm} -uses uCalculosUtils; +uses + uCalculosUtils; function EnumFontsProc(var LogFont: TLogFont; var TextMetric: TTextMetric; FontType: Integer; Data: Pointer): Integer; stdcall; @@ -287,11 +290,13 @@ begin _FocusedView.BeginUpdate; end; -function TfrViewDetallesBase.darTipoLetraPorDefecto: TFont; +function TfrViewDetallesBase.DarTipoConcepto( + ARecord: TcxCustomGridRecord): string; +var + IndiceCol : Integer; begin - Result := TFont.Create; - Result.Name := 'Tahoma'; - Result.Size := 9; + IndiceCol := cxGridView.GetColumnByFieldName(CAMPO_TIPO).Index; + Result := ARecord.DisplayTexts[IndiceCol]; end; destructor TfrViewDetallesBase.Destroy; @@ -415,12 +420,13 @@ procedure TfrViewDetallesBase.cxGridViewInitEdit(Sender: TcxCustomGridTableView; AItem: TcxCustomGridTableItem; AEdit: TcxCustomEdit); var FuentePorDefecto: TFont; + ARecord: TcxCustomGridRecord; begin inherited; - if AEdit is TcxRichEdit then begin - FuentePorDefecto := darTipoLetraPorDefecto; + ARecord := AItem.FocusedCellViewInfo.GridRecord; + FuentePorDefecto := DarFuentePorDefecto(DarTipoConcepto(ARecord)); //La primera vez que accedemos al grid entra dos veces y perderiamos el editor //dando un pete. if not Assigned(CurEdit) then @@ -454,25 +460,65 @@ procedure TfrViewDetallesBase.cxGridViewStylesGetContentStyle( Sender: TcxCustomGridTableView; ARecord: TcxCustomGridRecord; AItem: TcxCustomGridTableItem; out AStyle: TcxStyle); var - IndiceCol : Integer; ATipo : String; begin + AStyle := cxStyleEven; if Assigned(ARecord) then begin - IndiceCol := cxGridViewTIPO.Index; - ATipo := VarToStr(ARecord.Values[IndiceCol]); - if ATipo = TIPO_DETALLE_SUBTOTAL then - AStyle := cxStyle_SUBTOTAL; + ATipo := DarTipoConcepto(ARecord); + if ATipo = TIPO_DETALLE_TITULO then AStyle := cxStyle_TITULO; + + if ATipo = TIPO_DETALLE_SUBTOTAL then + AStyle := cxStyle_SUBTOTAL; + + if ATipo = TIPO_DETALLE_DESCUENTO then + AStyle := cxStyle_DESCUENTO; end; end; -function TfrViewDetallesBase.darListaSeleccionados: TIntegerArray; +function TfrViewDetallesBase.DarFuentePorDefecto(const ATipo: String): TFont; +begin + Result := TFont.Create; + + if ATipo = TIPO_DETALLE_CONCEPTO then + begin + Result.Name := 'Tahoma'; + Result.Size := 9; + Result.Style := []; + end; + + if ATipo = TIPO_DETALLE_TITULO then + begin + Result.Name := cxStyle_TITULO.Font.Name; + Result.Color := cxStyle_TITULO.TextColor; + Result.Size := cxStyle_TITULO.Font.Size; + Result.Style := cxStyle_TITULO.Font.Style; + end; + + if ATipo = TIPO_DETALLE_SUBTOTAL then + begin + Result.Name := cxStyle_SUBTOTAL.Font.Name; + Result.Color := cxStyle_SUBTOTAL.TextColor; + Result.Size := cxStyle_SUBTOTAL.Font.Size; + Result.Style := cxStyle_SUBTOTAL.Font.Style; + end; + + if ATipo = TIPO_DETALLE_DESCUENTO then + begin + Result.Name := cxStyle_DESCUENTO.Font.Name; + Result.Color := cxStyle_DESCUENTO.TextColor; + Result.Size := cxStyle_DESCUENTO.Font.Size; + Result.Style := cxStyle_DESCUENTO.Font.Style; + end; +end; + +function TfrViewDetallesBase.DarListaSeleccionados: TIntegerArray; var i, j: Integer; begin - j := darPosicionCampo(CAMPO_POSICION); + j := DarPosicionCampo(CAMPO_POSICION); with cxGridView.Controller do for i:=0 to SelectedRecordCount-1 do @@ -647,7 +693,7 @@ begin //Rellenamos los tipos de conceptos que hay if Assigned(FController) then begin - AListaValores := FController.darListaTIPOSDETALLE; + AListaValores := FController.DarListaTIPOSDETALLE; with (cxGridViewTIPO.Properties as TcxImageComboBoxProperties) do if Items.Count = 0 then begin @@ -737,9 +783,8 @@ begin if cxGridView.Controller.EditingController.IsEditing then cxGridView.Controller.EditingController.Edit.PostEditValue; - if Assigned(Controller) - and Assigned(FDetalles) then - Controller.move(FDetalles, darListaSeleccionados, -1); + if Assigned(Controller) and Assigned(FDetalles) then + Controller.Move(FDetalles, DarListaSeleccionados, -1); finally cxGridView.EndUpdate; end; diff --git a/Source/Modulos/Contabilidad/Views/Contabilidad_view.res b/Source/Modulos/Contabilidad/Views/Contabilidad_view.res index 1641339fcc482e7e3492d1b45813a86619622c33..8b251f312bcccec5485024f6fe8d80e1cdf25746 100644 GIT binary patch delta 11 ScmeBCZD5|Duvteife`=|>;pCc literal 4748 zcmbW5&ub)A5XUPdpe&2#;C*uNAUVhgd+&(4um@dnom`vXF9g}ZuHJ;se=<3UNdFJg zbCw+UD9j$byGIXV`~6hC>h4S?F|k9X-j90q{Z_qtZ<;nUJCO8!h?p${kR>3GhM`oH*q zk=UsjOCIgA_4!`B+Gb&`I84R)bT4dy-BQV<-SyFz?R8ILEQ(+JB$u{sEXE@j@B*7W zT;iZH#|OJ<&DO$RCkM6VbK3(B(k{nbdv1lpc;E$xz9as|v3uE1V{hw2w~g3eD0an7 z{BT%G%irdMe*|oDJmgvJaA2`9B<6Xi*?M~Q;)@Sbfwf3uf zVaWkbUjU=;sL{BlYemIZXv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