- 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.Acana_FactuGES2/trunk@86 f4e31baf-9722-1c47-927c-6f952f962d4b
This commit is contained in:
parent
322906a6c3
commit
0f0529a8c2
@ -27,7 +27,7 @@ const
|
|||||||
implementation
|
implementation
|
||||||
|
|
||||||
uses
|
uses
|
||||||
SysUtils, DB, Variants;
|
SysUtils, DB, Variants, cxControls;
|
||||||
|
|
||||||
function CalcularLineaConcepto (const ADataTable : TDADataTable): Double;
|
function CalcularLineaConcepto (const ADataTable : TDADataTable): Double;
|
||||||
var
|
var
|
||||||
@ -122,11 +122,12 @@ end;
|
|||||||
function DarTotalPorte(ADetalles: IDAStronglyTypedDataTable): Double;
|
function DarTotalPorte(ADetalles: IDAStronglyTypedDataTable): Double;
|
||||||
var
|
var
|
||||||
ImporteTotal: Currency;
|
ImporteTotal: Currency;
|
||||||
ABookmark : TBookmark;
|
AuxPosicionIni : Integer;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
|
AuxPosicionIni := ADetalles.DataTable.FieldByName(CAMPO_POSICION).AsInteger;
|
||||||
|
|
||||||
|
ShowHourglassCursor;
|
||||||
try
|
try
|
||||||
ABookmark := ADetalles.DataTable.GetBookMark;
|
|
||||||
ADetalles.DataTable.DisableControls;
|
ADetalles.DataTable.DisableControls;
|
||||||
ADetalles.DataTable.DisableEventHandlers;
|
ADetalles.DataTable.DisableEventHandlers;
|
||||||
|
|
||||||
@ -140,10 +141,10 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
finally
|
finally
|
||||||
|
ADetalles.DataTable.Locate(CAMPO_POSICION, IntToStr(AuxPosicionIni), []);
|
||||||
ADetalles.DataTable.EnableEventHandlers;
|
ADetalles.DataTable.EnableEventHandlers;
|
||||||
ADetalles.DataTable.GotoBookmark(ABookmark);
|
|
||||||
ADetalles.DataTable.FreeBookmark(ABookmark);
|
|
||||||
ADetalles.DataTable.EnableControls;
|
ADetalles.DataTable.EnableControls;
|
||||||
|
HideHourglassCursor;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
Result := ImporteTotal;
|
Result := ImporteTotal;
|
||||||
|
|||||||
@ -152,7 +152,7 @@ inherited frViewDetallesBase: TfrViewDetallesBase
|
|||||||
Height = 232
|
Height = 232
|
||||||
Align = alClient
|
Align = alClient
|
||||||
TabOrder = 1
|
TabOrder = 1
|
||||||
LookAndFeel.Kind = lfOffice11
|
LookAndFeel.Kind = lfStandard
|
||||||
LookAndFeel.NativeStyle = True
|
LookAndFeel.NativeStyle = True
|
||||||
object cxGridView: TcxGridDBTableView
|
object cxGridView: TcxGridDBTableView
|
||||||
NavigatorButtons.ConfirmDelete = False
|
NavigatorButtons.ConfirmDelete = False
|
||||||
@ -185,6 +185,7 @@ inherited frViewDetallesBase: TfrViewDetallesBase
|
|||||||
OptionsCustomize.DataRowSizing = True
|
OptionsCustomize.DataRowSizing = True
|
||||||
OptionsData.Appending = True
|
OptionsData.Appending = True
|
||||||
OptionsData.CancelOnExit = False
|
OptionsData.CancelOnExit = False
|
||||||
|
OptionsSelection.InvertSelect = False
|
||||||
OptionsSelection.MultiSelect = True
|
OptionsSelection.MultiSelect = True
|
||||||
OptionsSelection.UnselectFocusedRecordOnExit = False
|
OptionsSelection.UnselectFocusedRecordOnExit = False
|
||||||
OptionsView.CellEndEllipsis = True
|
OptionsView.CellEndEllipsis = True
|
||||||
@ -197,32 +198,34 @@ inherited frViewDetallesBase: TfrViewDetallesBase
|
|||||||
OptionsView.NewItemRowInfoText = 'Click here to add a new row'
|
OptionsView.NewItemRowInfoText = 'Click here to add a new row'
|
||||||
Styles.ContentEven = cxStyleEven
|
Styles.ContentEven = cxStyleEven
|
||||||
Styles.ContentOdd = cxStyleOdd
|
Styles.ContentOdd = cxStyleOdd
|
||||||
Styles.Inactive = cxStyleSelection
|
|
||||||
Styles.Selection = cxStyleSelection
|
Styles.Selection = cxStyleSelection
|
||||||
Styles.OnGetContentStyle = cxGridViewStylesGetContentStyle
|
Styles.OnGetContentStyle = cxGridViewStylesGetContentStyle
|
||||||
object cxGridViewID: TcxGridDBColumn
|
object cxGridViewID: TcxGridDBColumn
|
||||||
DataBinding.FieldName = 'ID'
|
DataBinding.FieldName = 'ID'
|
||||||
Visible = False
|
Visible = False
|
||||||
|
Width = 25
|
||||||
end
|
end
|
||||||
object cxGridViewPOSICION: TcxGridDBColumn
|
object cxGridViewPOSICION: TcxGridDBColumn
|
||||||
DataBinding.FieldName = 'POSICION'
|
DataBinding.FieldName = 'POSICION'
|
||||||
Visible = False
|
Visible = False
|
||||||
SortIndex = 0
|
SortIndex = 0
|
||||||
SortOrder = soAscending
|
SortOrder = soAscending
|
||||||
|
Width = 25
|
||||||
end
|
end
|
||||||
object cxGridViewTIPO: TcxGridDBColumn
|
object cxGridViewTIPO: TcxGridDBColumn
|
||||||
Caption = 'Tipo'
|
Caption = 'Tipo'
|
||||||
DataBinding.FieldName = 'TIPO_DETALLE'
|
DataBinding.FieldName = 'TIPO_DETALLE'
|
||||||
PropertiesClassName = 'TcxImageComboBoxProperties'
|
PropertiesClassName = 'TcxImageComboBoxProperties'
|
||||||
|
Properties.ImmediatePost = True
|
||||||
Properties.Items = <>
|
Properties.Items = <>
|
||||||
BestFitMaxWidth = 64
|
BestFitMaxWidth = 64
|
||||||
Width = 56
|
Width = 35
|
||||||
end
|
end
|
||||||
object cxGridViewDESCRIPCION: TcxGridDBColumn
|
object cxGridViewDESCRIPCION: TcxGridDBColumn
|
||||||
Caption = 'Concepto'
|
Caption = 'Concepto'
|
||||||
DataBinding.FieldName = 'CONCEPTO'
|
DataBinding.FieldName = 'CONCEPTO'
|
||||||
PropertiesClassName = 'TcxRichEditProperties'
|
PropertiesClassName = 'TcxRichEditProperties'
|
||||||
Width = 224
|
Width = 317
|
||||||
end
|
end
|
||||||
object cxGridViewCANTIDAD: TcxGridDBColumn
|
object cxGridViewCANTIDAD: TcxGridDBColumn
|
||||||
Caption = 'Cantidad'
|
Caption = 'Cantidad'
|
||||||
@ -231,7 +234,7 @@ inherited frViewDetallesBase: TfrViewDetallesBase
|
|||||||
Properties.Alignment.Horz = taRightJustify
|
Properties.Alignment.Horz = taRightJustify
|
||||||
BestFitMaxWidth = 64
|
BestFitMaxWidth = 64
|
||||||
HeaderAlignmentHorz = taRightJustify
|
HeaderAlignmentHorz = taRightJustify
|
||||||
Width = 130
|
Width = 30
|
||||||
end
|
end
|
||||||
object cxGridViewIMPORTEUNIDAD: TcxGridDBColumn
|
object cxGridViewIMPORTEUNIDAD: TcxGridDBColumn
|
||||||
Caption = 'Importe unidad'
|
Caption = 'Importe unidad'
|
||||||
@ -241,7 +244,7 @@ inherited frViewDetallesBase: TfrViewDetallesBase
|
|||||||
BestFitMaxWidth = 120
|
BestFitMaxWidth = 120
|
||||||
FooterAlignmentHorz = taRightJustify
|
FooterAlignmentHorz = taRightJustify
|
||||||
HeaderAlignmentHorz = taRightJustify
|
HeaderAlignmentHorz = taRightJustify
|
||||||
Width = 130
|
Width = 60
|
||||||
end
|
end
|
||||||
object cxGridViewIMPORTETOTAL: TcxGridDBColumn
|
object cxGridViewIMPORTETOTAL: TcxGridDBColumn
|
||||||
Caption = 'Importe total'
|
Caption = 'Importe total'
|
||||||
@ -251,7 +254,7 @@ inherited frViewDetallesBase: TfrViewDetallesBase
|
|||||||
BestFitMaxWidth = 120
|
BestFitMaxWidth = 120
|
||||||
HeaderAlignmentHorz = taRightJustify
|
HeaderAlignmentHorz = taRightJustify
|
||||||
Options.Editing = False
|
Options.Editing = False
|
||||||
Width = 130
|
Width = 60
|
||||||
end
|
end
|
||||||
object cxGridViewVISIBLE: TcxGridDBColumn
|
object cxGridViewVISIBLE: TcxGridDBColumn
|
||||||
Caption = #191'Visible?'
|
Caption = #191'Visible?'
|
||||||
@ -298,6 +301,7 @@ inherited frViewDetallesBase: TfrViewDetallesBase
|
|||||||
Visible = False
|
Visible = False
|
||||||
FooterAlignmentHorz = taCenter
|
FooterAlignmentHorz = taCenter
|
||||||
HeaderAlignmentHorz = taCenter
|
HeaderAlignmentHorz = taCenter
|
||||||
|
Width = 25
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
object cxGridLevel: TcxGridLevel
|
object cxGridLevel: TcxGridLevel
|
||||||
@ -709,8 +713,17 @@ inherited frViewDetallesBase: TfrViewDetallesBase
|
|||||||
Color = cl3DLight
|
Color = cl3DLight
|
||||||
end
|
end
|
||||||
object cxStyle_TITULO: TcxStyle
|
object cxStyle_TITULO: TcxStyle
|
||||||
AssignedValues = [svColor]
|
AssignedValues = [svColor, svFont]
|
||||||
Color = clMenuBar
|
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
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -106,6 +106,7 @@ type
|
|||||||
actAnchoAutomatico: TAction;
|
actAnchoAutomatico: TAction;
|
||||||
TBXSeparatorItem5: TTBXSeparatorItem;
|
TBXSeparatorItem5: TTBXSeparatorItem;
|
||||||
TBXItem13: TTBXItem;
|
TBXItem13: TTBXItem;
|
||||||
|
cxStyle_DESCUENTO: TcxStyle;
|
||||||
|
|
||||||
procedure actAnadirExecute(Sender: TObject);
|
procedure actAnadirExecute(Sender: TObject);
|
||||||
procedure actEliminarExecute(Sender: TObject);
|
procedure actEliminarExecute(Sender: TObject);
|
||||||
@ -160,7 +161,8 @@ type
|
|||||||
protected
|
protected
|
||||||
function HayQueRecalcular(AItem: TcxCustomGridTableItem): Boolean; virtual;
|
function HayQueRecalcular(AItem: TcxCustomGridTableItem): Boolean; virtual;
|
||||||
function EsTipoEditable(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 GetFocusedView : TcxGridDBTableView; virtual;
|
||||||
function GetGrid : TcxGrid; virtual;
|
function GetGrid : TcxGrid; virtual;
|
||||||
procedure SeleccionarRowActual;
|
procedure SeleccionarRowActual;
|
||||||
@ -185,7 +187,8 @@ type
|
|||||||
implementation
|
implementation
|
||||||
{$R *.dfm}
|
{$R *.dfm}
|
||||||
|
|
||||||
uses uCalculosUtils;
|
uses
|
||||||
|
uCalculosUtils;
|
||||||
|
|
||||||
function EnumFontsProc(var LogFont: TLogFont; var TextMetric: TTextMetric;
|
function EnumFontsProc(var LogFont: TLogFont; var TextMetric: TTextMetric;
|
||||||
FontType: Integer; Data: Pointer): Integer; stdcall;
|
FontType: Integer; Data: Pointer): Integer; stdcall;
|
||||||
@ -287,11 +290,13 @@ begin
|
|||||||
_FocusedView.BeginUpdate;
|
_FocusedView.BeginUpdate;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TfrViewDetallesBase.darTipoLetraPorDefecto: TFont;
|
function TfrViewDetallesBase.DarTipoConcepto(
|
||||||
|
ARecord: TcxCustomGridRecord): string;
|
||||||
|
var
|
||||||
|
IndiceCol : Integer;
|
||||||
begin
|
begin
|
||||||
Result := TFont.Create;
|
IndiceCol := cxGridView.GetColumnByFieldName(CAMPO_TIPO).Index;
|
||||||
Result.Name := 'Tahoma';
|
Result := ARecord.DisplayTexts[IndiceCol];
|
||||||
Result.Size := 9;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
destructor TfrViewDetallesBase.Destroy;
|
destructor TfrViewDetallesBase.Destroy;
|
||||||
@ -415,12 +420,13 @@ procedure TfrViewDetallesBase.cxGridViewInitEdit(Sender: TcxCustomGridTableView;
|
|||||||
AItem: TcxCustomGridTableItem; AEdit: TcxCustomEdit);
|
AItem: TcxCustomGridTableItem; AEdit: TcxCustomEdit);
|
||||||
var
|
var
|
||||||
FuentePorDefecto: TFont;
|
FuentePorDefecto: TFont;
|
||||||
|
ARecord: TcxCustomGridRecord;
|
||||||
begin
|
begin
|
||||||
inherited;
|
inherited;
|
||||||
|
|
||||||
if AEdit is TcxRichEdit then
|
if AEdit is TcxRichEdit then
|
||||||
begin
|
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
|
//La primera vez que accedemos al grid entra dos veces y perderiamos el editor
|
||||||
//dando un pete.
|
//dando un pete.
|
||||||
if not Assigned(CurEdit) then
|
if not Assigned(CurEdit) then
|
||||||
@ -454,25 +460,65 @@ procedure TfrViewDetallesBase.cxGridViewStylesGetContentStyle(
|
|||||||
Sender: TcxCustomGridTableView; ARecord: TcxCustomGridRecord;
|
Sender: TcxCustomGridTableView; ARecord: TcxCustomGridRecord;
|
||||||
AItem: TcxCustomGridTableItem; out AStyle: TcxStyle);
|
AItem: TcxCustomGridTableItem; out AStyle: TcxStyle);
|
||||||
var
|
var
|
||||||
IndiceCol : Integer;
|
|
||||||
ATipo : String;
|
ATipo : String;
|
||||||
begin
|
begin
|
||||||
|
AStyle := cxStyleEven;
|
||||||
if Assigned(ARecord) then
|
if Assigned(ARecord) then
|
||||||
begin
|
begin
|
||||||
IndiceCol := cxGridViewTIPO.Index;
|
ATipo := DarTipoConcepto(ARecord);
|
||||||
ATipo := VarToStr(ARecord.Values[IndiceCol]);
|
|
||||||
if ATipo = TIPO_DETALLE_SUBTOTAL then
|
|
||||||
AStyle := cxStyle_SUBTOTAL;
|
|
||||||
if ATipo = TIPO_DETALLE_TITULO then
|
if ATipo = TIPO_DETALLE_TITULO then
|
||||||
AStyle := cxStyle_TITULO;
|
AStyle := cxStyle_TITULO;
|
||||||
|
|
||||||
|
if ATipo = TIPO_DETALLE_SUBTOTAL then
|
||||||
|
AStyle := cxStyle_SUBTOTAL;
|
||||||
|
|
||||||
|
if ATipo = TIPO_DETALLE_DESCUENTO then
|
||||||
|
AStyle := cxStyle_DESCUENTO;
|
||||||
end;
|
end;
|
||||||
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
|
var
|
||||||
i, j: Integer;
|
i, j: Integer;
|
||||||
begin
|
begin
|
||||||
j := darPosicionCampo(CAMPO_POSICION);
|
j := DarPosicionCampo(CAMPO_POSICION);
|
||||||
|
|
||||||
with cxGridView.Controller do
|
with cxGridView.Controller do
|
||||||
for i:=0 to SelectedRecordCount-1 do
|
for i:=0 to SelectedRecordCount-1 do
|
||||||
@ -647,7 +693,7 @@ begin
|
|||||||
//Rellenamos los tipos de conceptos que hay
|
//Rellenamos los tipos de conceptos que hay
|
||||||
if Assigned(FController) then
|
if Assigned(FController) then
|
||||||
begin
|
begin
|
||||||
AListaValores := FController.darListaTIPOSDETALLE;
|
AListaValores := FController.DarListaTIPOSDETALLE;
|
||||||
with (cxGridViewTIPO.Properties as TcxImageComboBoxProperties) do
|
with (cxGridViewTIPO.Properties as TcxImageComboBoxProperties) do
|
||||||
if Items.Count = 0 then
|
if Items.Count = 0 then
|
||||||
begin
|
begin
|
||||||
@ -737,9 +783,8 @@ begin
|
|||||||
if cxGridView.Controller.EditingController.IsEditing then
|
if cxGridView.Controller.EditingController.IsEditing then
|
||||||
cxGridView.Controller.EditingController.Edit.PostEditValue;
|
cxGridView.Controller.EditingController.Edit.PostEditValue;
|
||||||
|
|
||||||
if Assigned(Controller)
|
if Assigned(Controller) and Assigned(FDetalles) then
|
||||||
and Assigned(FDetalles) then
|
Controller.Move(FDetalles, DarListaSeleccionados, -1);
|
||||||
Controller.move(FDetalles, darListaSeleccionados, -1);
|
|
||||||
finally
|
finally
|
||||||
cxGridView.EndUpdate;
|
cxGridView.EndUpdate;
|
||||||
end;
|
end;
|
||||||
|
|||||||
Binary file not shown.
Loading…
Reference in New Issue
Block a user