- Revisión de las unidades base de tratamiento de detalles para mejorar el posicionamiento mediante el campo POSICION.
- Activado el campo DESCUENTO en los detalles base. - Cambiada la fuente para el campo DESCRIPCION de los detalles base. - Nueva función 'LocalizarPosicion' en el controlador de detalles base. git-svn-id: https://192.168.0.254/svn/Proyectos.Tecsitel_FactuGES2/trunk@189 0c75b7a4-871f-7646-8a2f-f78d34cc349f
This commit is contained in:
parent
9f72108bda
commit
724b8806d6
@ -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;
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
inherited frViewDetallesBase: TfrViewDetallesBase
|
||||
Width = 975
|
||||
Height = 372
|
||||
Width = 451
|
||||
Height = 304
|
||||
Align = alClient
|
||||
OnCreate = CustomViewCreate
|
||||
OnDestroy = CustomViewDestroy
|
||||
@ -9,8 +9,8 @@ inherited frViewDetallesBase: TfrViewDetallesBase
|
||||
object ToolBar1: TToolBar
|
||||
Left = 0
|
||||
Top = 0
|
||||
Width = 975
|
||||
Height = 24
|
||||
Width = 451
|
||||
Height = 46
|
||||
AutoSize = True
|
||||
ButtonWidth = 63
|
||||
Caption = 'ToolBar1'
|
||||
@ -25,8 +25,6 @@ inherited frViewDetallesBase: TfrViewDetallesBase
|
||||
TabOrder = 0
|
||||
Transparent = True
|
||||
Visible = False
|
||||
ExplicitWidth = 451
|
||||
ExplicitHeight = 46
|
||||
object ToolButton1: TToolButton
|
||||
Left = 0
|
||||
Top = 0
|
||||
@ -56,16 +54,17 @@ inherited frViewDetallesBase: TfrViewDetallesBase
|
||||
Top = 0
|
||||
Action = FontEdit1
|
||||
AutoSize = True
|
||||
Wrap = True
|
||||
end
|
||||
object FontName: TJvFontComboBox
|
||||
Left = 274
|
||||
Top = 0
|
||||
Left = 0
|
||||
Top = 22
|
||||
Width = 145
|
||||
Height = 22
|
||||
DroppedDownWidth = 145
|
||||
MaxMRUCount = 0
|
||||
FontName = 'Tahoma'
|
||||
ItemIndex = 35
|
||||
ItemIndex = 34
|
||||
Options = [foTrueTypeOnly, foNoOEMFonts, foScalableOnly, foWysiWyg]
|
||||
Sorted = True
|
||||
TabOrder = 2
|
||||
@ -74,8 +73,8 @@ inherited frViewDetallesBase: TfrViewDetallesBase
|
||||
OnClick = FontNameChange
|
||||
end
|
||||
object FontSize: TEdit
|
||||
Left = 419
|
||||
Top = 0
|
||||
Left = 145
|
||||
Top = 22
|
||||
Width = 26
|
||||
Height = 22
|
||||
Hint = 'Font Size|Select font size'
|
||||
@ -85,8 +84,8 @@ inherited frViewDetallesBase: TfrViewDetallesBase
|
||||
OnChange = FontSizeChange
|
||||
end
|
||||
object UpDown1: TUpDown
|
||||
Left = 445
|
||||
Top = 0
|
||||
Left = 171
|
||||
Top = 22
|
||||
Width = 16
|
||||
Height = 22
|
||||
Associate = FontSize
|
||||
@ -94,69 +93,67 @@ inherited frViewDetallesBase: TfrViewDetallesBase
|
||||
Visible = False
|
||||
end
|
||||
object ToolButton13: TToolButton
|
||||
Left = 461
|
||||
Top = 0
|
||||
Left = 187
|
||||
Top = 22
|
||||
Width = 8
|
||||
Caption = 'ToolButton13'
|
||||
ImageIndex = 10
|
||||
Style = tbsSeparator
|
||||
end
|
||||
object ToolButton6: TToolButton
|
||||
Left = 469
|
||||
Top = 0
|
||||
Left = 195
|
||||
Top = 22
|
||||
Action = RichEditBold1
|
||||
AutoSize = True
|
||||
end
|
||||
object ToolButton7: TToolButton
|
||||
Left = 503
|
||||
Top = 0
|
||||
Left = 229
|
||||
Top = 22
|
||||
Action = RichEditItalic1
|
||||
AutoSize = True
|
||||
end
|
||||
object ToolButton8: TToolButton
|
||||
Left = 537
|
||||
Top = 0
|
||||
Left = 263
|
||||
Top = 22
|
||||
Action = RichEditUnderline1
|
||||
AutoSize = True
|
||||
end
|
||||
object ToolButton12: TToolButton
|
||||
Left = 571
|
||||
Top = 0
|
||||
Left = 297
|
||||
Top = 22
|
||||
Width = 8
|
||||
Caption = 'ToolButton12'
|
||||
ImageIndex = 10
|
||||
Style = tbsSeparator
|
||||
end
|
||||
object ToolButton9: TToolButton
|
||||
Left = 579
|
||||
Top = 0
|
||||
Left = 305
|
||||
Top = 22
|
||||
Action = RichEditAlignLeft1
|
||||
AutoSize = True
|
||||
end
|
||||
object ToolButton10: TToolButton
|
||||
Left = 613
|
||||
Top = 0
|
||||
Left = 339
|
||||
Top = 22
|
||||
Action = RichEditAlignCenter1
|
||||
AutoSize = True
|
||||
end
|
||||
object ToolButton11: TToolButton
|
||||
Left = 647
|
||||
Top = 0
|
||||
Left = 373
|
||||
Top = 22
|
||||
Action = RichEditAlignRight1
|
||||
AutoSize = True
|
||||
end
|
||||
end
|
||||
object cxGrid: TcxGrid
|
||||
Left = 0
|
||||
Top = 50
|
||||
Width = 975
|
||||
Height = 322
|
||||
Top = 72
|
||||
Width = 451
|
||||
Height = 232
|
||||
Align = alClient
|
||||
TabOrder = 1
|
||||
LookAndFeel.Kind = lfStandard
|
||||
LookAndFeel.NativeStyle = True
|
||||
ExplicitLeft = 24
|
||||
ExplicitTop = 74
|
||||
object cxGridView: TcxGridDBTableView
|
||||
NavigatorButtons.ConfirmDelete = False
|
||||
FilterBox.Visible = fvNever
|
||||
@ -198,6 +195,7 @@ inherited frViewDetallesBase: TfrViewDetallesBase
|
||||
OptionsView.GroupByBox = False
|
||||
OptionsView.HeaderEndEllipsis = True
|
||||
OptionsView.Indicator = True
|
||||
OptionsView.NewItemRowInfoText = 'Click here to add a new row'
|
||||
Styles.ContentEven = cxStyleEven
|
||||
Styles.ContentOdd = cxStyleOdd
|
||||
Styles.Selection = cxStyleSelection
|
||||
@ -312,13 +310,11 @@ inherited frViewDetallesBase: TfrViewDetallesBase
|
||||
end
|
||||
object TBXDock1: TTBXDock
|
||||
Left = 0
|
||||
Top = 24
|
||||
Width = 975
|
||||
Top = 46
|
||||
Width = 451
|
||||
Height = 26
|
||||
BackgroundOnToolbars = False
|
||||
UseParentBackground = True
|
||||
ExplicitTop = 46
|
||||
ExplicitWidth = 451
|
||||
object TBXToolbar1: TTBXToolbar
|
||||
Left = 0
|
||||
Top = 0
|
||||
@ -725,5 +721,9 @@ inherited frViewDetallesBase: TfrViewDetallesBase
|
||||
Font.Name = 'Tahoma'
|
||||
Font.Style = [fsBold]
|
||||
end
|
||||
object cxStyle_DESCUENTO: TcxStyle
|
||||
AssignedValues = [svTextColor]
|
||||
TextColor = 7977877
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@ -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;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user